Class WrapAroundBorders

java.lang.Object
repast.simphony.space.continuous.AbstractPointTranslator
repast.simphony.space.continuous.WrapAroundBorders
All Implemented Interfaces:
PointTranslator

public class WrapAroundBorders extends AbstractPointTranslator
Periodic type border implementation. Translates and transforms beyond the space's dimensions are wrapped around the borders. Creating a 2D space with these types of border results in a torus.
Author:
Jerry Vos
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    protected boolean
     
    protected double[]
     
    protected double[]
     

    Fields inherited from class repast.simphony.space.continuous.AbstractPointTranslator

    dimensions
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    protected double
    getNewCoord(int dimension, double location)
     
    void
    init(Dimensions dimensions)
    Initializes this with the given dimensions.
    boolean
     
    boolean
    True if this translator is periodic (in the sense that moving off one border makes you appear on the other one), otherwise false.
    void
    setNewLocationWrapped(boolean newCoordinateWrapped)
     
    void
    transform(double[] transformedLocation, double... targetLocation)
    Transform the given targetLocation according to periodic "wrapped" semantics.
    void
    transform(NdPoint transformedLocation, double... targetLocation)
    Transform the given targetLocation according to periodic "wrapped" semantics.
    void
    translate(double[] location, double... displacement)
    Translates the specified location by the specified displacement according to periodic "wrapped" semantics.
    void
    translate(NdPoint location, double[] newLocation, double... displacement)
    Translates the specified location by the specified displacement according to periodic "wrapped" semantics.

    Methods inherited from class repast.simphony.space.continuous.AbstractPointTranslator

    boundsCheck, minusEpsilon

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

    • spaceWidths

      protected transient double[] spaceWidths
    • origin

      protected transient double[] origin
    • newLocationWrapped

      protected transient boolean newLocationWrapped
  • Constructor Details

    • WrapAroundBorders

      public WrapAroundBorders()
  • Method Details

    • isNewLocationWrapped

      public boolean isNewLocationWrapped()
    • setNewLocationWrapped

      public void setNewLocationWrapped(boolean newCoordinateWrapped)
    • init

      public void init(Dimensions dimensions)
      Initializes this with the given dimensions.
      Specified by:
      init in interface PointTranslator
      Overrides:
      init in class AbstractPointTranslator
      Parameters:
      dimensions - the dimensions of the space
    • translate

      public void translate(double[] location, double... displacement)
      Translates the specified location by the specified displacement according to periodic "wrapped" semantics. Locations outside the grid will be wrapped into the spaces's dimensions. The results will be placed into the location array.
      Parameters:
      location - the current location
      displacement - the amount of displacement
    • translate

      public void translate(NdPoint location, double[] newLocation, double... displacement)
      Translates the specified location by the specified displacement according to periodic "wrapped" semantics. Locations outside the grid will be wrapped into the spaces's dimensions. The results will be placed into the newLocation array.
      Parameters:
      location - the current location
      newLocation - holds the newLocation after the method has completed
      displacement - the amount of displacement
    • transform

      public void transform(double[] transformedLocation, double... targetLocation)
      Transform the given targetLocation according to periodic "wrapped" semantics. The new transformed coordinates will be placed in the transformedLocation.
      Specified by:
      transform in interface PointTranslator
      Overrides:
      transform in class AbstractPointTranslator
      Parameters:
      transformedLocation - coordinates holds the current location and the new coordinates once they have been transformed by this PointTranslator
      targetLocation - the new target location whose coordinates will be transformed
      Throws:
      SpatialException - if the transform is invalid.
    • transform

      public void transform(NdPoint transformedLocation, double... targetLocation)
      Transform the given targetLocation according to periodic "wrapped" semantics. The new transformed coordinates will be placed in the transformedLocation.
      Specified by:
      transform in interface PointTranslator
      Overrides:
      transform in class AbstractPointTranslator
      Parameters:
      transformedLocation - holds the original coordinates and the new coordinates once they have been transformed by this PointTranslator
      targetLocation - the new target location whose coordinates will be transformed
      Throws:
      SpatialException - if the transform is invalid.
    • getNewCoord

      protected double getNewCoord(int dimension, double location)
    • isPeriodic

      public boolean isPeriodic()
      Description copied from interface: PointTranslator
      True if this translator is periodic (in the sense that moving off one border makes you appear on the other one), otherwise false.
      Returns:
      true if this translator is periodic, otherwise false.