public class Rectangle3D extends Object
It exists primarily to provide bounding boxes for 3D geometry.
TODO: add dirty flag to avoid unnecessary recalculation of extent and center
Modifier and Type | Field and Description |
---|---|
static Rectangle3D |
EMPTY_BOX |
static Rectangle3D |
unitCube |
Constructor and Description |
---|
Rectangle3D() |
Rectangle3D(double[][] vlist) |
Rectangle3D(double w,
double h,
double d) |
Modifier and Type | Method and Description |
---|---|
void |
add(double d) |
Rectangle3D |
computeFromVectorList(double[][] vlist)
Receiver configures himself as bounding box of the
vertices in the list vlist.
|
boolean |
contains(Rectangle3D b2) |
Rectangle2D |
convertToRectangle2D(Rectangle2D rec)
Project this box onto its first two dimensions
|
void |
copyInto(Rectangle3D bb) |
double[][] |
getBounds()
Get the two opposite corners of this box (min(x,y,z) and max(x,y,z)).
|
double[][] |
getBounds(double[][] store) |
double[] |
getCenter()
Get the center of this box.
|
double[] |
getCenter(double[] store) |
double[] |
getExtent()
Get the dimensions of the box (length, width, depth).
|
double[] |
getExtent(double[] store) |
double |
getMaxExtent() |
double |
getMaxX() |
double |
getMaxY() |
double |
getMaxZ() |
double |
getMinX() |
double |
getMinY() |
double |
getMinZ() |
void |
initialize() |
boolean |
isEmpty() |
void |
scale(double d) |
void |
setBounds(double[][] b)
Get the two opposite corners of this box (min(x,y,z) and max(x,y,z)).
|
String |
toString() |
Rectangle3D |
transformByMatrix(Rectangle3D target,
double[] aTransform)
Transform a bounding box by a matrix.
|
Rectangle3D |
unionWith(Rectangle3D aBound,
Rectangle3D target)
Finds the union of the receiver and aBound, places
result in target and returns it.
|
void |
update() |
public static final Rectangle3D EMPTY_BOX
public static final Rectangle3D unitCube
public Rectangle3D()
public Rectangle3D(double w, double h, double d)
public Rectangle3D(double[][] vlist)
public void initialize()
public void copyInto(Rectangle3D bb)
public boolean isEmpty()
public void update()
public Rectangle3D transformByMatrix(Rectangle3D target, double[] aTransform)
true
, then return a new instance containing the result,
else overwrite this
.aTransform
- copyflag
- public Rectangle3D computeFromVectorList(double[][] vlist)
vlist
- public Rectangle3D unionWith(Rectangle3D aBound, Rectangle3D target)
aBound
- target
- public double[] getCenter()
public double[] getExtent()
public double getMaxExtent()
public Rectangle2D convertToRectangle2D(Rectangle2D rec)
rec
- public double[][] getBounds()
public void setBounds(double[][] b)
public double getMinX()
public double getMaxX()
public double getMinY()
public double getMaxY()
public double getMinZ()
public double getMaxZ()
public double[] getCenter(double[] store)
public double[] getExtent(double[] store)
public double[][] getBounds(double[][] store)
store
- double[2][3]public void scale(double d)
public void add(double d)
public boolean contains(Rectangle3D b2)