public class Grid
extends java.lang.Object
implements java.io.Serializable
| Constructor and Description |
|---|
Grid(int spacing)
Creates a grid with the same cell size along each coordinate
axis.
|
Grid(int xSpacing,
int zSpacing)
Creates a grid with the specified cell size for the x and z
axes and 0 for the y axis, indicating that there is no partitioning
in the y axis.
|
Grid(int xSpacing,
int ySpacing,
int zSpacing)
Creates a grid with the specified spacing along the x, y, and z
axes.
|
Grid(int xSpacing,
int ySpacing,
int zSpacing,
Vec3i gridBits)
Creates a grid with the specified spacing alon the x, y, and z
axes using the specified bit sizes for each when doing ID encoding.
|
Grid(Vec3i gridSpacing)
Creates a grid with the specified spacing along the x, y, and z
axes.
|
Grid(Vec3i gridSpacing,
Vec3i gridBits)
Creates a grid with the specified spacing alon the x, y, and z
axes using the specified bit sizes for each when doing ID encoding.
|
| Modifier and Type | Method and Description |
|---|---|
long |
cellToId(int xCell,
int yCell,
int zCell)
Converts the x, y, z cell location into a single composite long value.
|
long |
cellToId(Vec3i cell)
Converts the x, y, z cell location into a single composite long value.
|
Vec3i |
cellToWorld(int xCell,
int yCell,
int zCell)
Returns the world location of the origin of the specified
grid cell location as a Vec3i.
|
Vec3d |
cellToWorld(int xCell,
int yCell,
int zCell,
Vec3d store)
Returns the world location of the origin of the specified
grid cell location as a Vec3d, storing it in the specified 'store' argument.
|
Vec3i |
cellToWorld(int xCell,
int yCell,
int zCell,
Vec3i store)
Returns the world location of the origin of the specified
grid cell location as a Vec3i, storing it in the specified 'store' argument.
|
Vec3i |
cellToWorld(Vec3i cell)
Returns the world location of the origin of the specified
grid cell location as a Vec3i, storing it in the specified 'store' argument.
|
Vec3d |
cellToWorld(Vec3i cell,
Vec3d store)
Returns the world location of the origin of the specified
grid cell location as a Vec3d, storing it in the specified 'store' argument.
|
Vec3i |
cellToWorld(Vec3i cell,
Vec3i store)
Returns the world location of the origin of the specified
grid cell location as a Vec3i, storing it in the specified 'store' argument.
|
GridCell |
getContainingCell(double xWorld,
double yWorld,
double zWorld)
Returns a GridCell object that represents the section of space that
contains the specified world location.
|
GridCell |
getContainingCell(Vec3d world)
Returns a GridCell object that represents the section of space that
contains the specified world location.
|
GridCell |
getContainingCell(Vec3i world)
Returns a GridCell object that represents the section of space that
contains the specified world location.
|
int |
getDimensions() |
GridCell |
getGridCell(int xCell,
int yCell,
int zCell)
Returns a GridCell object the represents the section of space
for the specified grid cell coordinate.
|
GridCell |
getGridCell(Vec3i cell)
Returns a GridCell object the represents the section of space
for the specified grid cell coordinate.
|
Vec3i |
getIdBits() |
Vec3i |
getSpacing() |
Vec3i |
idToCell(long id) |
Vec3i |
idToCell(long id,
Vec3i store) |
java.lang.String |
toString() |
Vec3i |
worldToCell(double xWorld,
double yWorld,
double zWorld)
Returns the grid cell coordinate that contains the
specified world space coordinate.
|
Vec3i |
worldToCell(double xWorld,
double yWorld,
double zWorld,
Vec3i store)
Returns the grid cell coordinate that contains the
specified world space coordinate, storing it in the specified
store argument.
|
Vec3i |
worldToCell(Vec3d world)
Returns the grid cell coordinate that contains the
specified world space coordinate.
|
Vec3i |
worldToCell(Vec3d world,
Vec3i store)
Returns the grid cell coordinate that contains the
specified world space coordinate, storing it in the specified
store argument.
|
long |
worldToId(double xWorld,
double yWorld,
double zWorld)
Converts the world location to a cell location and then to a cell ID.
|
long |
worldToId(Vec3d world)
Converts the world location to a cell location and then to a cell ID.
|
public Grid(int spacing)
public Grid(int xSpacing,
int zSpacing)
public Grid(int xSpacing,
int ySpacing,
int zSpacing)
public Grid(int xSpacing,
int ySpacing,
int zSpacing,
Vec3i gridBits)
public Grid(Vec3i gridSpacing)
public final Vec3i getSpacing()
public final int getDimensions()
public final Vec3i getIdBits()
public final GridCell getContainingCell(double xWorld, double yWorld, double zWorld)
public final GridCell getContainingCell(Vec3d world)
public final GridCell getContainingCell(Vec3i world)
public final GridCell getGridCell(Vec3i cell)
public final GridCell getGridCell(int xCell, int yCell, int zCell)
public final Vec3i worldToCell(double xWorld, double yWorld, double zWorld)
public final Vec3i worldToCell(double xWorld, double yWorld, double zWorld, Vec3i store)
public final Vec3i worldToCell(Vec3d world)
public final Vec3i worldToCell(Vec3d world, Vec3i store)
public final Vec3i cellToWorld(int xCell, int yCell, int zCell)
public final Vec3i cellToWorld(int xCell, int yCell, int zCell, Vec3i store)
public final Vec3d cellToWorld(int xCell, int yCell, int zCell, Vec3d store)
public final Vec3i cellToWorld(Vec3i cell)
public final Vec3i cellToWorld(Vec3i cell, Vec3i store)
public final Vec3d cellToWorld(Vec3i cell, Vec3d store)
public final long worldToId(Vec3d world)
public final long worldToId(double xWorld,
double yWorld,
double zWorld)
public final long cellToId(Vec3i cell)
public final long cellToId(int xCell,
int yCell,
int zCell)
public final Vec3i idToCell(long id)
public java.lang.String toString()
toString in class java.lang.Object