Package repast.simphony.space.continuous
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
newLocationWrapped
protected double[]
origin
protected double[]
spaceWidths
-
Fields inherited from class repast.simphony.space.continuous.AbstractPointTranslator
dimensions
-
-
Constructor Summary
Constructors Constructor Description WrapAroundBorders()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected double
getNewCoord(int dimension, double location)
void
init(Dimensions dimensions)
Initializes this with the given dimensions.boolean
isNewLocationWrapped()
boolean
isPeriodic()
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
-
-
-
-
Method Detail
-
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 interfacePointTranslator
- Overrides:
init
in classAbstractPointTranslator
- 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 locationdisplacement
- 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 locationnewLocation
- holds the newLocation after the method has completeddisplacement
- 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 interfacePointTranslator
- Overrides:
transform
in classAbstractPointTranslator
- Parameters:
transformedLocation
- coordinates holds the current location and the new coordinates once they have been transformed by this PointTranslatortargetLocation
- 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 interfacePointTranslator
- Overrides:
transform
in classAbstractPointTranslator
- Parameters:
transformedLocation
- holds the original coordinates and the new coordinates once they have been transformed by this PointTranslatortargetLocation
- 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.
-
-