|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectde.jreality.scene.SceneGraphVisitor
de.jreality.geometry.BoundingBoxTraversal
public class BoundingBoxTraversal
This class traverses a scene graph starting from the given "root" scene graph component and calculates the 3D bounding box.
At any point of the traversal, there is a current transformation representing
the transformation from the root. Call this M. It can be initialized
to a value using setInitialMatrix(double[])
. For the following,
let the current state of the
bounding box during the traversal be denoted by B.
Only instances of Geometry
currently contribute to the bounding box.
They can do this in three ways:
PointSet
is found,
M is applied to it vertices, and B is set to the union of
the bounding box of these points
is union-ed with B.Sphere
have build-in bounding boxes
which are transformed and union-ed with B
Geometry
has a geometry attribute with key GeometryUtility.BOUNDING_BOX
then this value is expected to be an instance of Rectangle3D
and is
union-ed with B. This overrides the first option given above.
One can obtain the bounding box using the methods getXmin()
, etc, or all at once using
getBoundingBox()
.
* @author Tim Hoffmann, Charles Gunn
Constructor Summary | |
---|---|
BoundingBoxTraversal()
|
Method Summary | |
---|---|
Rectangle3D |
getBoundingBox()
Convert result into Rectangle3D instance (see Rectangle3D |
static Rectangle3D |
getBoundingBox(double[] initialMatrix,
SceneGraphComponent sgc)
|
double[] |
getBoundingBoxCenter(double[] c)
|
double |
getXmax()
|
double |
getXmin()
|
double |
getYmax()
|
double |
getYmin()
|
double |
getZmax()
|
double |
getZmin()
|
void |
setInitialMatrix(double[] initialMatrix)
Sets the initialTransformation. |
void |
traverse(SceneGraphComponent root)
This starts the traversal of a SceneGraph starting form root. |
void |
visit(ClippingPlane p)
|
void |
visit(Cylinder c)
|
void |
visit(Geometry g)
|
void |
visit(PointSet p)
|
void |
visit(SceneGraphComponent c)
|
void |
visit(Sphere s)
|
void |
visit(Transformation t)
|
Methods inherited from class de.jreality.scene.SceneGraphVisitor |
---|
visit, visit, visit, visit, visit, visit, visit, visit, visit, visit |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public BoundingBoxTraversal()
Method Detail |
---|
public void setInitialMatrix(double[] initialMatrix)
initialTransformation
- The initialTransformation to setpublic void traverse(SceneGraphComponent root)
root
- public void visit(SceneGraphComponent c)
visit
in class SceneGraphVisitor
public void visit(Transformation t)
visit
in class SceneGraphVisitor
public void visit(Geometry g)
visit
in class SceneGraphVisitor
public void visit(ClippingPlane p)
visit
in class SceneGraphVisitor
public void visit(Cylinder c)
visit
in class SceneGraphVisitor
public void visit(PointSet p)
visit
in class SceneGraphVisitor
public void visit(Sphere s)
visit
in class SceneGraphVisitor
public double getXmax()
public double getXmin()
public double getYmax()
public double getYmin()
public double getZmax()
public double getZmin()
public double[] getBoundingBoxCenter(double[] c)
public Rectangle3D getBoundingBox()
Rectangle3D
public static Rectangle3D getBoundingBox(double[] initialMatrix, SceneGraphComponent sgc)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |