Modifier and Type | Field and Description |
---|---|
static boolean |
debugIntersect |
static int |
EDGE_01 |
static int |
EDGE_12 |
static int |
EDGE_20 |
static int |
FIRST_QUAD_TRIANGLE |
int |
idx |
static double |
insideTriangleTolerance |
static int |
VERTEX_0 |
static int |
VERTEX_1 |
static int |
VERTEX_2 |
Constructor and Description |
---|
Face(int idx)
Creates an empty face with a specified index value.
|
Modifier and Type | Method and Description |
---|---|
void |
clearNormal()
Clears the normal vector for this face.
|
double |
computeArea()
Computes the area of this face.
|
void |
computeCentroid(Vector3d centroid)
Computes centroid of this face.
|
double |
computeCircumference()
Computes the circumference of this face.
|
void |
computeCoords(Point3d pnt,
Vector2d coords)
Computes the barycentric coordinates of a point to the plane
|
double |
computeCovariance(Matrix3d C)
Computes covariance of this face and returns its area.
|
double |
computeNormal()
Computes the normal for this face, and returns the planar area.
|
double |
computeNormal(Vector3d normal)
Computes the normal for this face, and returns the planar area.
|
static double |
computeNormal(Vector3d nrm,
Point3d... pnts)
Compute the normal of a face given by a set of points arranged
counter-clockwise.
|
void |
computePoint(Point3d pnt,
Vector2d coords)
Computes a point on this face as described by barycentric
coordinates.
|
void |
computeRenderNormal() |
static double |
computeTriangleArea(Point3d p0,
Point3d p1,
Point3d p2) |
void |
computeWorldCentroid(Point3d pnt) |
static Face |
create(Vertex3d... vtxs) |
java.util.Iterator<HalfEdge> |
edgeIterator()
Iterator for looping over edges
|
HalfEdge |
firstHalfEdge()
Returns the first half-edge associated with this face.
|
void |
flip(boolean connect)
Flips the face, disconnecting HEdges as required
|
HalfEdge |
getEdge(int idx)
Returns a specific edge associated with this face, or null is the edge
does not exist.
|
int |
getFlags() |
int |
getIndex()
Returns the index value for this faces.
|
static int[] |
getIndices(java.util.Collection<Face> faces) |
PolygonalMesh |
getMesh() |
Vector3d |
getNormal()
Returns the normal computed from the most recent call to
computeNormal() . |
double |
getPlanarArea()
Returns the planar area computed from the most recent call to
computeNormal() . |
Point3d |
getPoint(int idx)
Returns the
idx -th point associated with this element. |
double |
getPoint0DotNormal() |
Vector3d |
getRenderNormal() |
Vertex3d[] |
getTriVertices()
Returns the vertices of this Face, using a priori knowledge that the
the face is a triangle and therefore has three vertices.
|
Vertex3d |
getVertex(int idx) |
int[] |
getVertexIndices()
Returns an array of the vertex indices associated with this face.
|
Vertex3d[] |
getVertices() |
Vector3d |
getWorldNormal() |
void |
getWorldNormal(Vector3d nrm) |
int |
indexOfEdge(HalfEdge halfEdge)
Returns the index of a specified HalfEdge, or -1 if the half edge
does not belong to this face.
|
int |
indexOfVertex(Vertex3d vtx)
Returns the vertex associated with a specified vertex, or -1
if the vertex is not found in this face.
|
boolean |
isFirstQuadTriangle()
Check to see if this face is the first triangle of a triangulated quad.
|
boolean |
isPointInside(double x,
double y,
double z) |
boolean |
isTriangle() |
void |
nearestPoint(Point3d pc,
Point3d p1)
Computes the closest point on this face to a specified point.
|
int |
nearestPointTriangle(Point3d pn,
Point3d p1) |
int |
nearestWorldPointTriangle(Point3d pn,
Point3d p1) |
int |
numEdges()
Returns the number of edges associated with the face.
|
int |
numPoints()
Returns the number of points associated with this element, if any, or
zero otherwise.
|
int |
numVertices() |
boolean |
set(Vertex3d[] vtxs,
int numVtxs,
boolean connect)
Creates a face from a counter-clockwise list of vertices.
|
void |
setFirstQuadTriangle(boolean firstQuad)
Sets a flag indicating that this face is the first triangle of a
triangulated quad.
|
void |
setFlags(int flags) |
void |
setIndex(int i)
Sets the index value for this face.
|
void |
triangulate(java.util.ArrayList<Vertex3d[]> tris)
Returns a list of Vertex3d[3] representing the
triangulated faces.
|
void |
updateBounds(Vector3d min,
Vector3d max)
Updates the axis-aligned bounds of this element.
|
void |
updateNormalAndEdges()
Called to update normal and edge data when vertices have been transformed
|
java.util.Iterator<Vertex3d> |
vertexIterator()
Iterator for looping over vertices
|
java.lang.String |
vertexStr()
Returns a string identifying this face using the indices of
its vertices.
|
checkFlag, clearFlag, clearVisited, getType, getTypeName, isVisited, setFlag, setVisited
public int idx
public static int FIRST_QUAD_TRIANGLE
public static final int EDGE_01
public static final int EDGE_12
public static final int EDGE_20
public static final int VERTEX_0
public static final int VERTEX_1
public static final int VERTEX_2
public static boolean debugIntersect
public static double insideTriangleTolerance
public Face(int idx)
idx
- desired index valuepublic int getIndex()
public void setIndex(int i)
i
- new index valuepublic boolean isTriangle()
public boolean isFirstQuadTriangle()
setFirstQuadTriangle(boolean)
public void setFirstQuadTriangle(boolean firstQuad)
firstQuad
- True if this face is the first triangle of a
triangulated quad.public int[] getVertexIndices()
public java.util.Iterator<Vertex3d> vertexIterator()
public java.util.Iterator<HalfEdge> edgeIterator()
public Vector3d getWorldNormal()
public void getWorldNormal(Vector3d nrm)
public double getPoint0DotNormal()
public void flip(boolean connect)
public boolean set(Vertex3d[] vtxs, int numVtxs, boolean connect)
If connect is true, then these half-edges will also be added to the list of half-edges incident on each vertex, and connected, when possible, to half-edges pointing in the opposite direction. Opposite half-edges are found by searhing the existing half-edges which are incident on each vertex. If an opposite half-edge is already connected to another half-edge, then the current half-edge is considered redundant, no connection is made and the method returns false. A redundant half edge implies that the mesh structure containing this face is non-manifold.
vtxs
- vertices to connectnumVtxs
- number of vertices to connectconnect
- connect to opposite half-edgespublic void computeCentroid(Vector3d centroid)
computeCentroid
in interface Boundable
centroid
- returns the centroidpublic void computeWorldCentroid(Point3d pnt)
public double computeCovariance(Matrix3d C)
computeCovariance
in interface Boundable
C
- returns the covariancepublic void computePoint(Point3d pnt, Vector2d coords)
coords
, then the
point is computed from
pnt = (1-s1-s2)*p0 + s1*p1 + s2*p2This method is most often used for triangular faces, but that does not have to be the case.
pnt
- returns the computed pointcoords
- specifies s0 and s0public void computeCoords(Point3d pnt, Vector2d coords)
pnt
- the point to considercoords
- the returned coordinatespublic double computeNormal()
getNormal()
and
getPlanarArea()
.public Vector3d getNormal()
computeNormal()
. If the normal has been cleared,
computeNormal()
is called to recompute it.public double getPlanarArea()
computeNormal()
. The planar area is the area computed assuming
that all sub-triangles are perpendicular to the normal. If the normal
has been cleared, computeNormal()
is called to recompute it.public double computeNormal(Vector3d normal)
normal
- returns the normalgetNormal()
public static double computeNormal(Vector3d nrm, Point3d... pnts)
nrm
- computed normal vector.pnts
- array of points (must have at least three)public double computeArea()
public double computeCircumference()
public Vector3d getRenderNormal()
public void computeRenderNormal()
public void nearestPoint(Point3d pc, Point3d p1)
nearestPoint
in class Feature
pc
- returns the closest pointp1
- point for which closest point is computedpublic void clearNormal()
getNormal
will cause the normal vector to be reallocated and
recomputed.public int numEdges()
public HalfEdge getEdge(int idx)
idx
- index of the desired edgepublic int indexOfEdge(HalfEdge halfEdge)
public HalfEdge firstHalfEdge()
public void updateBounds(Vector3d min, Vector3d max)
Boundable
min
and max
should be decreased or increased,
respectively, so that all spatial points associated with this element lie
within the axis-aligned box defined by min
and
max
.updateBounds
in interface Boundable
min
- minimum values to be updatedmax
- maximum values to be updatedpublic int numVertices()
public PolygonalMesh getMesh()
public Vertex3d[] getVertices()
public Vertex3d[] getTriVertices()
public Vertex3d getVertex(int idx)
public int indexOfVertex(Vertex3d vtx)
public void updateNormalAndEdges()
public int numPoints()
Boundable
public Point3d getPoint(int idx)
Boundable
idx
-th point associated with this element.getPoint
in interface Boundable
idx
- index of the point (must be on the range 0 to
Boundable.numPoints()
).idx
-th point associated with this element.
Must not be modified.public boolean isPointInside(double x, double y, double z)
public void triangulate(java.util.ArrayList<Vertex3d[]> tris)
public int getFlags()
public void setFlags(int flags)
public static int[] getIndices(java.util.Collection<Face> faces)
public java.lang.String vertexStr()