Package repast.simphony.space
Class SpatialMath
java.lang.Object
repast.simphony.space.SpatialMath
- Author:
- Nick Collier
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic doubleangleFromDisplacement(double dX, double dY) Returns the angle in radians corresponding to the displacement (dX, dY).static doublecalcAngleFor2DMovement(ContinuousSpace<? extends Object> space, NdPoint point1, NdPoint point2) Calculates the angle in radians between the two points on the horizontal plane.static double[]getDisplacement(int dimCount, int unitDimension, double scale, double... anglesInRadians) Returns the displacementstatic int[]getDisplacementInt(int dimCount, int unitDimension, double scale, double... anglesInRadians) Returns the displacement TODO: try and optimize this so tahtstatic voidscale(double[] point, double scale) Scales the point by the specified amount.
-
Constructor Details
-
SpatialMath
public SpatialMath()
-
-
Method Details
-
scale
public static void scale(double[] point, double scale) Scales the point by the specified amount. The point is updated to the new value.- Parameters:
point- the point to scalescale- the amount to scale the point by
-
getDisplacement
public static double[] getDisplacement(int dimCount, int unitDimension, double scale, double... anglesInRadians) Returns the displacement- Parameters:
dimCount- the number of dimensions in the spaceunitDimension- the dimension that we are rotating relative toscale- the distance we are moving (length of the displacement vector)anglesInRadians- the angles relative to the unit dimension- Returns:
- the displacement
-
getDisplacementInt
public static int[] getDisplacementInt(int dimCount, int unitDimension, double scale, double... anglesInRadians) Returns the displacement TODO: try and optimize this so taht- Parameters:
dimCount- the number of dimensions in the spaceunitDimension- the dimension that we are rotating relative toscale- the distance we are moving (length of the displacement vector)anglesInRadians- the angles relative to the unit dimension- Returns:
- the displacement
-
angleFromDisplacement
public static double angleFromDisplacement(double dX, double dY) Returns the angle in radians corresponding to the displacement (dX, dY).- Parameters:
dX-dY-- Returns:
- the angle in radians corresponding to the displacement (dX, dY).
-
calcAngleFor2DMovement
public static double calcAngleFor2DMovement(ContinuousSpace<? extends Object> space, NdPoint point1, NdPoint point2) Calculates the angle in radians between the two points on the horizontal plane. This angle is suitable for use with moveByVector in a 2D continuous space.- Parameters:
point1-point2-- Returns:
-