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
FieldsModifier and TypeFieldDescriptionprotected booleanprotected double[]protected double[]Fields inherited from class repast.simphony.space.continuous.AbstractPointTranslator
dimensions -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected doublegetNewCoord(int dimension, double location) voidinit(Dimensions dimensions) Initializes this with the given dimensions.booleanbooleanTrue if this translator is periodic (in the sense that moving off one border makes you appear on the other one), otherwise false.voidsetNewLocationWrapped(boolean newCoordinateWrapped) voidtransform(double[] transformedLocation, double... targetLocation) Transform the given targetLocation according to periodic "wrapped" semantics.voidTransform the given targetLocation according to periodic "wrapped" semantics.voidtranslate(double[] location, double... displacement) Translates the specified location by the specified displacement according to periodic "wrapped" semantics.voidTranslates 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:
initin interfacePointTranslator- Overrides:
initin 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:
transformin interfacePointTranslator- Overrides:
transformin 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:
transformin interfacePointTranslator- Overrides:
transformin 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:PointTranslatorTrue 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.
-