Class SpatialMath

java.lang.Object
repast.simphony.space.SpatialMath

public class SpatialMath extends Object
Author:
Nick Collier
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    static double
    angleFromDisplacement(double dX, double dY)
    Returns the angle in radians corresponding to the displacement (dX, dY).
    static double
    calcAngleFor2DMovement(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 displacement
    static int[]
    getDisplacementInt(int dimCount, int unitDimension, double scale, double... anglesInRadians)
    Returns the displacement TODO: try and optimize this so taht
    static void
    scale(double[] point, double scale)
    Scales the point by the specified amount.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • 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 scale
      scale - 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 space
      unitDimension - the dimension that we are rotating relative to
      scale - 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 space
      unitDimension - the dimension that we are rotating relative to
      scale - 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: