Package repast.simphony.space.continuous
Class WrapAroundBorders
java.lang.Object
repast.simphony.space.continuous.AbstractPointTranslator
repast.simphony.space.continuous.WrapAroundBorders
- All Implemented Interfaces:
PointTranslator
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
Modifier and TypeFieldDescriptionprotected boolean
protected double[]
protected double[]
Fields inherited from class repast.simphony.space.continuous.AbstractPointTranslator
dimensions
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionprotected 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 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
Translates the specified location by the specified displacement according to periodic "wrapped" semantics.Methods inherited from class repast.simphony.space.continuous.AbstractPointTranslator
boundsCheck, minusEpsilon
-
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
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
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
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.
-