|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcrowdmodel.utils.MathUtils
public class MathUtils
Class that describes static method functions = functions that do not need a class instantiation to be used = mathematical functions that are convenient for my model, however are not part of the model
Constructor Summary | |
---|---|
MathUtils()
|
Method Summary | |
---|---|
static double |
AngleAddition(double angle0,
double angle1)
Adds two angles with each other and corrects for non-existing angles [0-360] Repast corrects itself for this. |
static double |
AngleSubtraction(double angle0,
double angle1)
Subtracts two angles with each other and corrects for non-existing angles [0-360] |
static double |
calcArea(double angle,
double az)
Function calculates the area of a triangle Calculates the opposite, given the angle and Adjacent side opposite = tan(angle/2) * adjacent area = 2(opposite * adjacent) |
static double |
calcHeading(double heading,
repast.simphony.space.continuous.NdPoint pos1,
repast.simphony.space.continuous.NdPoint pos2)
Calculates what the heading(angle) is given a position and the heading to the new heading should be, given a point it should be directed to In repast the coordinate system allows mixed ranges: - from 0 (top), 90 (right), 180/-180 (bottom), -90 (left) |
static repast.simphony.space.continuous.NdPoint |
calcNewPosition(double x,
double y,
double v,
double heading)
Calculates a new position (NdPoint) on the continuous space Given the current position, heading and speed. |
static double |
dist(double v)
Calculates the transposition (the distance in moving given a certain velocity) returns the distance in terms of simulation distance given a velocity in real (m/s) terms Physical space is related to a real physical space 1 grid cell / unit = 40x40cm (0.4x0.4m) movement of 1 is 40cm in real v [m/s] = [2.5 unit / s] // need to think how simulation time relates to real time |
static double |
getAngleDiff(double h0,
double h1)
Returns the angle between two headings (in degrees) this is used to see whether a specific agent is positioned within a certain gaze-width |
static double |
getDistance(repast.simphony.space.continuous.NdPoint pos1,
repast.simphony.space.continuous.NdPoint pos2)
Returns the distance between two NdPoints |
static double |
getMax(double[] ar)
returns the maximal value of an double array. |
static int |
getMax(int[] ar)
returns the maximal value of an Integer array. |
static int |
getMaxIndex(double[] ar)
Returns the index of the maximum value given an array of values |
static int |
getMin(int[] ar,
int length)
getMin returns the minimal value of an Integer array. |
static int[] |
getMinAndMax(int[] ar)
getMinAndMax returns the min and max value of an Integer array. |
static int[] |
getMinAndMax(int[] ar,
int length)
Overloaded function that returns the min and max value of an Integer array. |
static boolean |
withinLineOfSight(double myheading,
double alpha,
double gazeWidth)
Function that decides whether a heading (beta) lies within line of sight given a current heading (myheading) and a range inbetween the value is supposed to lie. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public MathUtils()
Method Detail |
---|
public static double getDistance(repast.simphony.space.continuous.NdPoint pos1, repast.simphony.space.continuous.NdPoint pos2)
public static double calcHeading(double heading, repast.simphony.space.continuous.NdPoint pos1, repast.simphony.space.continuous.NdPoint pos2)
pos1
- - my position (A)pos2
- - position where I am heading to (B)public static boolean withinLineOfSight(double myheading, double alpha, double gazeWidth)
myheading
- alpha
- gazeWidth
-
public static double getAngleDiff(double h0, double h1)
public static double AngleAddition(double angle0, double angle1)
angle0
- angle1
-
public static double AngleSubtraction(double angle0, double angle1)
angle0
- angle1
-
public static repast.simphony.space.continuous.NdPoint calcNewPosition(double x, double y, double v, double heading)
public static double dist(double v)
public static int getMin(int[] ar, int length)
public static int getMax(int[] ar)
ar,
- length
public static double getMax(double[] ar)
ar
-
public static int getMaxIndex(double[] ar)
ar
- length
-
public static int[] getMinAndMax(int[] ar)
public static int[] getMinAndMax(int[] ar, int length)
ar
- length
-
public static double calcArea(double angle, double az)
angle
- - in degreesaz
- - adjacent side
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |