public class IndexedFaceSetUtility extends Object
IndexedFaceSet
.Modifier and Type | Method and Description |
---|---|
static void |
assignSmoothVertexNormals(IndexedFaceSet ifs,
double maxAngle,
int digits)
Averages the vertex normals for duplicate coordinates.
|
static void |
assignSmoothVertexNormals(IndexedFaceSet ifs,
int digits)
Averages the vertex normals for duplicate coordinates.
|
static void |
assignVertexTangents(IndexedFaceSet ifs) |
static IndexedFaceSet |
binaryRefine(IndexedFaceSet ifs)
Only applicable for ifs all of whose faces are triangles; then
each triangle is broken into
four smaller triangles by bisecting the edges.
|
static void |
calculateAndSetEdgesFromFaces(IndexedFaceSet ifs) |
static void |
calculateAndSetFaceNormals(IndexedFaceSet ifs) |
static void |
calculateAndSetFaceNormals(IndexedFaceSet ifs,
int metric) |
static void |
calculateAndSetNormals(IndexedFaceSet ifs) |
static void |
calculateAndSetVertexNormals(IndexedFaceSet ifs) |
static double[][] |
calculateFaceNormals(IndexedFaceSet ifs) |
static double[][] |
calculateFaceNormals(IndexedFaceSet ifs,
int metric) |
static double[][] |
calculateFaceNormals(int[][] indices,
double[][] verts,
int metric)
Calculate face normals for the faces defined by the index list indices and
the vertex list verts, with respect to the given metric.
|
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 metric) |
static double[][] |
calculateVertexNormals(int[][] indices,
double[][] vertsAs2D,
double[][] fn,
int metric)
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 double[][] |
calculateVertexTangents(DoubleArrayArray texCoords,
DoubleArrayArray vertexCoordinates,
DoubleArrayArray vertexNormals,
IntArrayArray faceIndices)
calculates face tangents, converted from
http://www.terathon.com/code/tangent.php
|
static IndexedFaceSet |
constructPolygon(double[][] points)
A simple constructor for an IndexedFaceSet with a single face.
|
static IndexedFaceSet |
constructPolygon(IndexedFaceSetFactory ifsf,
double[][] points)
A simple constructor for an IndexedFaceSet with a single face.
|
static IndexedFaceSet |
constructPolygon(IndexedFaceSetFactory ifsf,
double[][] points,
int sig) |
static IndexedFaceSetFactory |
constructPolygonFactory(IndexedFaceSetFactory ifsf,
double[][] points,
int sig) |
static SceneGraphComponent |
displayFaceNormals(IndexedFaceSet ifs,
double scale,
int metric)
Generates an instance of
IndexedLineSet which contains one line segment for each face normal of the
input ifs. |
static IntArrayArray |
edgesFromFaces(int[][] faces) |
static IntArrayArray |
edgesFromFaces(IntArrayArray faces)
TODO optimize in case its a QuadMesh (u+v curves instead of u*v segments)
|
static double[][] |
extractEdge(double[][] curve,
IndexedFaceSet ifs,
int which)
Deprecated.
|
static IndexedFaceSet |
extractFace(IndexedFaceSet ifs,
int which) |
static double[][] |
extractVerticesForFace(IndexedFaceSet ifs,
int which) |
static IndexedFaceSet |
implode(IndexedFaceSet ifs,
double factor)
For each face of ifs, replace it with a face gotten by:
if factor > 0: a shrunken version of the face (factor == 1 gives original face), or
if factor < 0: a hole is cut out of the face, corresponding to the shrunken version with the
same absolute value.
|
static boolean |
makeConsistentOrientation(IndexedFaceSet ifs)
makes a consistent orientated version of the "face Indices" if possible.
|
static IndexedFaceSet |
removeTextureCoordinateJumps(IndexedFaceSet src,
double jumpSize)
A special purpose code for the Buddy-Baer project which might be useful for other situations
where texture coordinates wrap around.
|
static IndexedFaceSet |
removeTextureCoordinateJumps(IndexedFaceSet src,
double ujumpSize,
double vjumpSize) |
static IndexedFaceSet |
representAsSceneGraph(IndexedFaceSet exists,
Rectangle3D box)
Update the vertices of an existing IFS to match the state of box.
|
static IndexedFaceSet |
representAsSceneGraph(Rectangle3D box)
Represent an instance of
Rectangle3D as an instance of IndexedFaceSet . |
static void |
simpleTriangulate(IndexedFaceSet ifs)
Do a simple (dumb) triangulation of the indexed face set
Edit the input IFS; if you want a copy, make it before calling this method.
|
static IndexedFaceSet[] |
splitIfsToPrimitiveFaces(IndexedFaceSet ifs) |
static IndexedFaceSet |
triangulate(IndexedFaceSet fs)
Deprecated.
This mehtod may lead to an infinite loop. Use with care, or use the simpler method
simpleTriangulate(IndexedFaceSet) . |
static void |
triangulateBarycentric(IndexedFaceSet ifs) |
static IndexedFaceSet |
triangulateRectangularPatch(double[][][] levels)
Generates a triangulated sphere from a given set of equally spaced longitude (theta) circles.
|
static IndexedFaceSet |
truncate(IndexedFaceSet ifs)
Truncate the corners of each face of ifs.
|
public static IndexedFaceSet binaryRefine(IndexedFaceSet ifs)
ifs
- public static void calculateAndSetEdgesFromFaces(IndexedFaceSet ifs)
public static IndexedFaceSet constructPolygon(double[][] points)
points
- public static IndexedFaceSet constructPolygon(IndexedFaceSetFactory ifsf, double[][] points)
ifs
- points
- public static IndexedFaceSet constructPolygon(IndexedFaceSetFactory ifsf, double[][] points, int sig)
public static IndexedFaceSetFactory constructPolygonFactory(IndexedFaceSetFactory ifsf, double[][] points, int sig)
public static IntArrayArray edgesFromFaces(int[][] faces)
public static IntArrayArray edgesFromFaces(IntArrayArray faces)
faces
- public static double[][] extractEdge(double[][] curve, IndexedFaceSet ifs, int which)
IndexedLineSetUtility.extractCurve(double[][], IndexedLineSet, int)
.GeometryUtility.QUAD_MESH_SHAPE
), then this will
correspond to a u- or v- parameter curve.curve
- ifs
- which
- public static IndexedFaceSet extractFace(IndexedFaceSet ifs, int which)
public static double[][] extractVerticesForFace(IndexedFaceSet ifs, int which)
public static IndexedFaceSet implode(IndexedFaceSet ifs, double factor)
ifs
- factor
- public static IndexedFaceSet removeTextureCoordinateJumps(IndexedFaceSet src, double jumpSize)
src
- jumpSize
- public static IndexedFaceSet removeTextureCoordinateJumps(IndexedFaceSet src, double ujumpSize, double vjumpSize)
public static IndexedFaceSet representAsSceneGraph(IndexedFaceSet exists, Rectangle3D box)
exists
- box
- public static IndexedFaceSet representAsSceneGraph(Rectangle3D box)
Rectangle3D
as an instance of IndexedFaceSet
.box
- public static IndexedFaceSet[] splitIfsToPrimitiveFaces(IndexedFaceSet ifs)
ifs
- @Deprecated public static IndexedFaceSet triangulate(IndexedFaceSet fs)
simpleTriangulate(IndexedFaceSet)
.fs
- public static void simpleTriangulate(IndexedFaceSet ifs)
ifs
- public static IndexedFaceSet truncate(IndexedFaceSet ifs)
ifs
- public static void assignVertexTangents(IndexedFaceSet ifs)
public static double[][] calculateVertexTangents(DoubleArrayArray texCoords, DoubleArrayArray vertexCoordinates, DoubleArrayArray vertexNormals, IntArrayArray faceIndices)
texCoords
- vertexCoordinates
- vertexNormals
- faceIndices
- public static void assignSmoothVertexNormals(IndexedFaceSet ifs, double maxAngle, int digits)
ifs
- the IndexedFaceSet to changemaxAngle
- the maximum angle in degrees between two normals for being flippeddigits
- the number of digits to respect for comparing coordinatespublic static void assignSmoothVertexNormals(IndexedFaceSet ifs, int digits)
ifs
- digits
- public static void triangulateBarycentric(IndexedFaceSet ifs)
public static IndexedFaceSet triangulateRectangularPatch(double[][][] levels)
public static boolean makeConsistentOrientation(IndexedFaceSet ifs)
numVertices
- faces
- Exception
public static SceneGraphComponent displayFaceNormals(IndexedFaceSet ifs, double scale, int metric)
IndexedLineSet
which contains one line segment for each face normal of the
input ifs. This IndexedLineSet is then stuffed into a SceneGraphComponent
whose appearance
is set with tube drawing disabled, which is then returned. If normals are not provided in ifs,
the metric (see Pn
) metric is respected
in the calculation of the normals.ifs
- scale
- metric
- public static void calculateAndSetFaceNormals(IndexedFaceSet ifs)
public static void calculateAndSetFaceNormals(IndexedFaceSet ifs, int metric)
public static void calculateAndSetNormals(IndexedFaceSet ifs)
public static void calculateAndSetVertexNormals(IndexedFaceSet ifs)
public static double[][] calculateFaceNormals(IndexedFaceSet ifs)
public static double[][] calculateFaceNormals(IndexedFaceSet ifs, int metric)
public static double[][] calculateFaceNormals(int[][] indices, double[][] verts, int metric)
indices
- verts
- metric
- 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 metric)
public static double[][] calculateVertexNormals(int[][] indices, double[][] vertsAs2D, double[][] fn, int metric)
Note: This method currently does not
correctly average vertices lying on the boundary of a closed quad mesh
.
indices
- vertsAs2D
- fn
- metric
- 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
-