com.partnersoft.v3x.geometry.single
Class Grid
java.lang.Object
com.partnersoft.v3x.geometry.single.Grid
public class Grid
- extends java.lang.Object
A square grid in space, defined as an origin and rectangular cell size.
Coordinates are stored as two UInt16s stored in a single UInt32. x
|
Constructor Summary |
Grid()
|
Grid(float originX,
float originY,
float cellSize)
|
Grid(float originX,
float originY,
float cellWidth,
float cellHeight)
|
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
originX
public float originX
originY
public float originY
cellWidth
public float cellWidth
cellHeight
public float cellHeight
Grid
public Grid()
Grid
public Grid(float originX,
float originY,
float cellSize)
Grid
public Grid(float originX,
float originY,
float cellWidth,
float cellHeight)
packGridCoordinate
public static final int packGridCoordinate(int x,
int y)
- Converts a grid coordinate (x, y) into a single int. The first short is x
and the second is y. All numbers are unsigned.
unpackGridCoordinate
public static final int[] unpackGridCoordinate(int packedCoord)
- Unpacks a grid coordinate into an int array. Order is x, y.
xToCell
public final int xToCell(float x)
yToCell
public final int yToCell(float y)
cellToX
public final float cellToX(int cellX)
cellToY
public final float cellToY(int cellY)
chop
public java.util.Map chop(FloatBuffer coords)
- Chops up a Polyline into multiple cells. Returns a Map containing the
results; key is the GridCoordinate and the value is a PolylineArray with
one or more polylines.