public abstract class AbstractGrid3D extends java.lang.Object implements Grid3D
Grid3D foo = ... ; foo.tx(4); // will not get inlined AbstractGrid3D bar = ...; bar.tx(4); // WILL get inlined
Constructor and Description |
---|
AbstractGrid3D() |
Modifier and Type | Method and Description |
---|---|
java.util.Map |
buildMap(int size)
Creates a map of the provided size (or any size it likes if ANY_SIZE is passed in).
|
java.util.Map |
buildMap(java.util.Map other)
Creates a Map which is a copy of another.
|
protected void |
checkBounds(Grid3D other) |
int |
getHeight()
Get the height
|
int |
getLength()
Get the length
|
void |
getMooreLocations(int x,
int y,
int z,
int dist,
int mode,
boolean includeOrigin,
IntBag xPos,
IntBag yPos,
IntBag zPos)
Gets all neighbors of a location that satisfy max( abs(x-X) , abs(y-Y), abs(z-Z) ) <= dist.
|
void |
getNeighborsHamiltonianDistance(int x,
int y,
int z,
int dist,
boolean toroidal,
IntBag xPos,
IntBag yPos,
IntBag zPos)
Deprecated.
|
void |
getNeighborsMaxDistance(int x,
int y,
int z,
int dist,
boolean toroidal,
IntBag xPos,
IntBag yPos,
IntBag zPos)
Deprecated.
|
void |
getRadialLocations(int x,
int y,
int z,
double dist,
int mode,
boolean includeOrigin,
IntBag xPos,
IntBag yPos,
IntBag zPos)
Gets all neighbors overlapping with a spherical region centered at (X,Y,Z) and with a radius of dist.
|
void |
getRadialLocations(int x,
int y,
int z,
double dist,
int mode,
boolean includeOrigin,
int measurementRule,
boolean closed,
IntBag xPos,
IntBag yPos,
IntBag zPos)
Gets all neighbors overlapping with a spherical region centered at (X,Y,Z) and with a radius of dist.
|
void |
getVonNeumannLocations(int x,
int y,
int z,
int dist,
int mode,
boolean includeOrigin,
IntBag xPos,
IntBag yPos,
IntBag zPos)
Gets all neighbors of a location that satisfy abs(x-X) + abs(y-Y) + abs(z-Z) <= dist.
|
int |
getWidth()
Get the width
|
protected boolean |
isDistributed() |
protected void |
removeOrigin(int x,
int y,
int z,
IntBag xPos,
IntBag yPos,
IntBag zPos) |
protected void |
removeOriginToroidal(int x,
int y,
int z,
IntBag xPos,
IntBag yPos,
IntBag zPos) |
int |
stx(int x)
Simple [and fast] toroidal x.
|
int |
sty(int y)
Simple [and fast] toroidal y.
|
int |
stz(int z)
Simple [and fast] toroidal z.
|
int |
stz(int z,
int length) |
int |
tx(int x)
Toroidal x.
|
int |
ty(int y)
Toroidal y.
|
int |
tz(int z)
Toroidal z.
|
public final int getWidth()
Grid3D
public final int getHeight()
Grid3D
public final int getLength()
Grid3D
public java.util.Map buildMap(java.util.Map other)
Grid3D
public java.util.Map buildMap(int size)
Grid3D
public final int tx(int x)
Grid3D
public final int ty(int y)
Grid3D
public final int tz(int z)
Grid3D
public final int stx(int x)
Grid3D
public final int sty(int y)
Grid3D
public final int stz(int z)
Grid3D
public final int stz(int z, int length)
protected void removeOrigin(int x, int y, int z, IntBag xPos, IntBag yPos, IntBag zPos)
protected void removeOriginToroidal(int x, int y, int z, IntBag xPos, IntBag yPos, IntBag zPos)
public void getNeighborsMaxDistance(int x, int y, int z, int dist, boolean toroidal, IntBag xPos, IntBag yPos, IntBag zPos)
Grid3D
This function may only run in two modes: toroidal or bounded. Unbounded lookup is not permitted, and so this function is deprecated: instead you should use the other version of this function which has more functionality. If "bounded", then the neighbors are restricted to be only those which lie within the box ranging from (0,0,0) to (width, height,length), that is, the width and height of the grid. if "toroidal", then the environment is assumed to be toroidal, that is, wrap-around, and neighbors are computed in this fashion. Toroidal locations will not appear multiple times: specifically, if the neighborhood distance is so large that it wraps completely around the width or height of the box, neighbors will not be counted multiple times. Note that to ensure this, subclasses may need to resort to expensive duplicate removal, so it's not suggested you use so unreasonably large distances.
The origin -- that is, the (x,y,z) point at the center of the neighborhood -- is always included in the results.
This function is equivalent to: getNeighborsMaxDistance(x,y,dist,toroidal ? Grid3D.TOROIDAL : Grid3D.BOUNDED, true, xPos, yPos, zPos);
getNeighborsMaxDistance
in interface Grid3D
public void getMooreLocations(int x, int y, int z, int dist, int mode, boolean includeOrigin, IntBag xPos, IntBag yPos, IntBag zPos)
Grid3D
This function may be run in one of three modes: Grid3D.BOUNDED, Grid3D.UNBOUNDED, and GrideD.TOROIDAL. If "bounded", then the neighbors are restricted to be only those which lie within the box ranging from (0,0,0) to (width, height,length), that is, the width and height of the grid. If "unbounded", then the neighbors are not so restricted. Note that unbounded neighborhood lookup only makes sense if your grid allows locations to actually be outside this box. For example, SparseGrid3D permits this but ObjectGrid3D and DoubleGrid3D and IntGrid3D and DenseGrid3D do not. Finally if "toroidal", then the environment is assumed to be toroidal, that is, wrap-around, and neighbors are computed in this fashion. Toroidal locations will not appear multiple times: specifically, if the neighborhood distance is so large that it wraps completely around the width or height of the box, neighbors will not be counted multiple times. Note that to ensure this, subclasses may need to resort to expensive duplicate removal, so it's not suggested you use so unreasonably large distances.
You can also opt to include the origin -- that is, the (x,y,z) point at the center of the neighborhood -- in the neighborhood results.
getMooreLocations
in interface Grid3D
public void getNeighborsHamiltonianDistance(int x, int y, int z, int dist, boolean toroidal, IntBag xPos, IntBag yPos, IntBag zPos)
Grid3D
This function may only run in two modes: toroidal or bounded. Unbounded lookup is not permitted, and so this function is deprecated: instead you should use the other version of this function which has more functionality. If "bounded", then the neighbors are restricted to be only those which lie within the box ranging from (0,0,0) to (width, height,length), that is, the width and height of the grid. if "toroidal", then the environment is assumed to be toroidal, that is, wrap-around, and neighbors are computed in this fashion. Toroidal locations will not appear multiple times: specifically, if the neighborhood distance is so large that it wraps completely around the width or height of the box, neighbors will not be counted multiple times. Note that to ensure this, subclasses may need to resort to expensive duplicate removal, so it's not suggested you use so unreasonably large distances.
The origin -- that is, the (x,y,z) point at the center of the neighborhood -- is always included in the results.
This function is equivalent to: getNeighborsHamiltonianDistance(x,y,dist,toroidal ? Grid3D.TOROIDAL : Grid3D.BOUNDED, true, xPos, yPos, zPos);
getNeighborsHamiltonianDistance
in interface Grid3D
public void getVonNeumannLocations(int x, int y, int z, int dist, int mode, boolean includeOrigin, IntBag xPos, IntBag yPos, IntBag zPos)
Grid3D
This function may be run in one of three modes: Grid3D.BOUNDED, Grid3D.UNBOUNDED, and GrideD.TOROIDAL. If "bounded", then the neighbors are restricted to be only those which lie within the box ranging from (0,0,0) to (width, height,length), that is, the width and height of the grid. If "unbounded", then the neighbors are not so restricted. Note that unbounded neighborhood lookup only makes sense if your grid allows locations to actually be outside this box. For example, SparseGrid3D permits this but ObjectGrid3D and DoubleGrid3D and IntGrid3D and DenseGrid3D do not. Finally if "toroidal", then the environment is assumed to be toroidal, that is, wrap-around, and neighbors are computed in this fashion. Toroidal locations will not appear multiple times: specifically, if the neighborhood distance is so large that it wraps completely around the width or height of the box, neighbors will not be counted multiple times. Note that to ensure this, subclasses may need to resort to expensive duplicate removal, so it's not suggested you use so unreasonably large distances.
You can also opt to include the origin -- that is, the (x,y,z) point at the center of the neighborhood -- in the neighborhood results.
getVonNeumannLocations
in interface Grid3D
public void getRadialLocations(int x, int y, int z, double dist, int mode, boolean includeOrigin, IntBag xPos, IntBag yPos, IntBag zPos)
Grid3D
Places each x, y, and z value of these locations in the provided IntBags xPos, yPos, and zPos, clearing the bags first.
This function may be run in one of three modes: Grid3D.BOUNDED, Grid3D.UNBOUNDED, and GrideD.TOROIDAL. If "bounded", then the neighbors are restricted to be only those which lie within the box ranging from (0,0,0) to (width, height,length), that is, the width and height of the grid. If "unbounded", then the neighbors are not so restricted. Note that unbounded neighborhood lookup only makes sense if your grid allows locations to actually be outside this box. For example, SparseGrid3D permits this but ObjectGrid3D and DoubleGrid3D and IntGrid3D and DenseGrid3D do not. Finally if "toroidal", then the environment is assumed to be toroidal, that is, wrap-around, and neighbors are computed in this fashion. Toroidal locations will not appear multiple times: specifically, if the neighborhood distance is so large that it wraps completely around the width or height of the box, neighbors will not be counted multiple times. Note that to ensure this, subclasses may need to resort to expensive duplicate removal, so it's not suggested you use so unreasonably large distances.
You can also opt to include the origin -- that is, the (x,y,z) point at the center of the neighborhood -- in the neighborhood results.
getRadialLocations
in interface Grid3D
public void getRadialLocations(int x, int y, int z, double dist, int mode, boolean includeOrigin, int measurementRule, boolean closed, IntBag xPos, IntBag yPos, IntBag zPos)
Grid3D
Places each x, y, and z value of these locations in the provided IntBags xPos, yPos, and zPos, clearing the bags first.
This function may be run in one of three modes: Grid3D.BOUNDED, Grid3D.UNBOUNDED, and GrideD.TOROIDAL. If "bounded", then the neighbors are restricted to be only those which lie within the box ranging from (0,0,0) to (width, height,length), that is, the width and height of the grid. If "unbounded", then the neighbors are not so restricted. Note that unbounded neighborhood lookup only makes sense if your grid allows locations to actually be outside this box. For example, SparseGrid3D permits this but ObjectGrid3D and DoubleGrid3D and IntGrid3D and DenseGrid3D do not. Finally if "toroidal", then the environment is assumed to be toroidal, that is, wrap-around, and neighbors are computed in this fashion. Toroidal locations will not appear multiple times: specifically, if the neighborhood distance is so large that it wraps completely around the width or height of the box, neighbors will not be counted multiple times. Note that to ensure this, subclasses may need to resort to expensive duplicate removal, so it's not suggested you use so unreasonably large distances.
You can also opt to include the origin -- that is, the (x,y,z) point at the center of the neighborhood -- in the neighborhood results.
getRadialLocations
in interface Grid3D
protected void checkBounds(Grid3D other)
protected boolean isDistributed()