|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectde.jreality.geometry.GeometryUtility
public class GeometryUtility
Static methods for various geometric operations.
There are a few basic categories:
IndexedFaceSet
instances,PointSet
instances,
Field Summary | |
---|---|
static String |
BOUNDING_BOX
For setting the bounding box of the geometry; Value: Rectangle3D . |
static String |
HEIGHT_FIELD_SHAPE
For identifying this IndexedFaceSet as a QuadMesh with a single value at each point (z-value on a regular x-y 2D domain); Value: Rectangle2D identifies the 2D domain. |
static String |
QUAD_MESH_SHAPE
For identifying this IndexedFaceSet as a QuadMesh; Value: Dimension . |
static String |
SIGNATURE
For setting the signature ( Pn ) of the geometry;
Value: Integer |
Method Summary | |
---|---|
static void |
calculateAndSetFaceNormals(IndexedFaceSet ifs)
|
static void |
calculateAndSetNormals(IndexedFaceSet ifs)
|
static void |
calculateAndSetVertexNormals(IndexedFaceSet ifs)
|
static Rectangle3D |
calculateBoundingBox(double[][] verts)
Calculate the bounding box of the vertices verts. |
static Rectangle3D |
calculateBoundingBox(double[] initialMatrix,
SceneGraphComponent sgc)
Calculate the bounding box assuming that the scene graph is first transformed by the matrix initialMatrix |
static Rectangle3D |
calculateBoundingBox(PointSet ps)
|
static Rectangle3D |
calculateBoundingBox(SceneGraphComponent sgc)
|
static Rectangle3D |
calculateBoundingBox(Sphere sph)
|
static Rectangle3D |
calculateChildrenBoundingBox(SceneGraphComponent sgc)
Calculate the bounding box for the scene graph tooted at sgc but do not apply the transformation, if any, attached to sgc. |
static double[][] |
calculateFaceNormals(IndexedFaceSet ifs)
|
static double[][] |
calculateFaceNormals(IndexedFaceSet ifs,
int signature)
|
static double[][] |
calculateFaceNormals(int[][] indices,
double[][] verts,
int signature)
Calculate face normals for the faces defined by the index list indices and the vertex list verts, with respect to the given signature. |
static void |
calculateFaceNormals(SceneGraphComponent c)
Traverse a scene graph, calculating (and setting) face normals for all instances of IndexedFaceSet . |
static double[][] |
calculateVertexNormals(IndexedFaceSet ifs)
|
static double[][] |
calculateVertexNormals(IndexedFaceSet ifs,
int signature)
|
static double[][] |
calculateVertexNormals(int[][] indices,
double[][] vertsAs2D,
double[][] fn,
int signature)
Calculate the vertex normals of the vertices by averaging the face normals of all faces to which the vertex belongs. |
static void |
calculateVertexNormals(SceneGraphComponent c)
Traverse a scene graph, calculating (and setting) vertex normals for all instances of IndexedFaceSet . |
static SceneGraphComponent |
flatten(SceneGraphComponent sgc)
|
static SceneGraphComponent |
flatten(SceneGraphComponent sgc,
boolean rejectInvis)
Apply transformations recursively to all instances of PointSet and
produce a flat scene graph with no transformations. |
static int |
getSignature(Geometry g)
|
static int |
getVectorLength(DataList ps)
Find out the length of the first element of this DataList . |
static int |
getVectorLength(PointSet ps)
Find out the length of the coordinates for a single vertex of this PointSet . |
static void |
setSignature(Geometry g,
int s)
Set the signature ( Pn ) associated to this geometry. |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static String BOUNDING_BOX
Rectangle3D
.
Geometry#setGeometryAttributes(Attribute, Object).
public static String QUAD_MESH_SHAPE
Dimension
.
Geometry#setGeometryAttributes(Attribute, Object).
,
QuadMeshFactory
public static String HEIGHT_FIELD_SHAPE
Rectangle2D
identifies the 2D domain.
Geometry#setGeometryAttributes(Attribute, Object).
,
HeightFieldFactory
public static String SIGNATURE
Pn
) of the geometry;
Value: Integer
Geometry#setGeometryAttributes(Attribute, Object).
Method Detail |
---|
public static void calculateAndSetFaceNormals(IndexedFaceSet ifs)
public static void calculateAndSetNormals(IndexedFaceSet ifs)
public static void calculateAndSetVertexNormals(IndexedFaceSet ifs)
public static Rectangle3D calculateBoundingBox(double[] initialMatrix, SceneGraphComponent sgc)
tmp
- sgc
-
public static Rectangle3D calculateBoundingBox(double[][] verts)
verts
-
Pn
for details.public static Rectangle3D calculateBoundingBox(PointSet ps)
public static Rectangle3D calculateBoundingBox(SceneGraphComponent sgc)
public static Rectangle3D calculateBoundingBox(Sphere sph)
public static Rectangle3D calculateChildrenBoundingBox(SceneGraphComponent sgc)
sgc
-
public static double[][] calculateFaceNormals(IndexedFaceSet ifs)
public static double[][] calculateFaceNormals(IndexedFaceSet ifs, int signature)
public static double[][] calculateFaceNormals(int[][] indices, double[][] verts, int signature)
indices
- verts
- signature
-
public static void calculateFaceNormals(SceneGraphComponent c)
IndexedFaceSet
. If face normals are already
present, they are not calculated again. The setting has to take place
after the traversal due to locking considerations.
c
- public static double[][] calculateVertexNormals(IndexedFaceSet ifs)
public static double[][] calculateVertexNormals(IndexedFaceSet ifs, int signature)
public static double[][] calculateVertexNormals(int[][] indices, double[][] vertsAs2D, double[][] fn, int signature)
Note: This method currently does not
correctly average vertices lying on the boundary of a closed quad mesh
.
indices
- vertsAs2D
- fn
- signature
-
public static void calculateVertexNormals(SceneGraphComponent c)
IndexedFaceSet
. If vertex normals are already
present, they are not calculated again. The setting has to take place
after the traversal due to locking considerations.
c
- public static SceneGraphComponent flatten(SceneGraphComponent sgc)
public static SceneGraphComponent flatten(SceneGraphComponent sgc, boolean rejectInvis)
PointSet
and
produce a flat scene graph with no transformations.
It collects these instances, and transforms them into world coordinates.
All these instances are put into one parent, and this parent is returned.
Geometry that is not PointSet is simply ignored. Attributes are copied as much
as possible, normals are also transformed. The code is not robust.
sgc
- rejectInvis
- if true, non-visible scene graph components are skipped (default: false)
public static int getSignature(Geometry g)
public static int getVectorLength(DataList ps)
DataList
.
ps
-
public static int getVectorLength(PointSet ps)
PointSet
.
ps
-
public static void setSignature(Geometry g, int s)
Pn
) associated to this geometry.
g
- s
-
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |