|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectmaspack.geometry.Feature
maspack.geometry.Face
public class Face
Field Summary | |
---|---|
int |
idx
|
static double |
insideTriangleTolerance
|
Fields inherited from class maspack.geometry.Feature |
---|
CELL, EDGE, FACE, FACET, HALF_EDGE, TYPE_MASK, UNKNOWN, VERTEX_2D, VERTEX_3D, VISITED |
Constructor Summary | |
---|---|
Face(int idx)
Creates an empty face with a specified index value. |
Method Summary | |
---|---|
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. |
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. |
void |
computeNormal()
Computes the normal for this face. |
void |
computeNormal(Vector3d normal)
Computes the normal for this face. |
void |
computePoint(Point3d pnt,
Vector2d coords)
Computes a point on this face as described by barycentric coordinates. |
void |
computeRenderNormal()
|
void |
computeWorldCentroid(Point3d pnt)
|
static Face |
create(Vertex3d... vtxs)
|
HalfEdge |
firstHalfEdge()
Returns the first half-edge associated with this face. |
HalfEdge |
getEdge(int idx)
Returns a specific edge associated with this face, or null is the edge does not exist. |
int |
getIndex()
Returns the index value for this faces. |
MeshBase |
getMesh()
|
Vector3d |
getNormal()
Returns a normal vector for this face. |
Point3d |
getPoint(int idx)
Returns the idx -th point associated with this element. |
double |
getPoint0DotNormal()
|
Vector3d |
getRenderNormal()
|
Vertex3d |
getVertex(int idx)
|
int[] |
getVertexIndices()
Returns an array of the vertex indices associated with this face. |
Vertex3d[] |
getVertices()
|
Vector3d |
getWorldNormal()
|
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 |
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 |
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(Point3d min,
Point3d max)
Updates the axis-aligned bounds of this element. |
void |
updateNormalAndEdges()
Called to update normal and edge data when vertices have been transformed |
Methods inherited from class maspack.geometry.Feature |
---|
checkFlag, clearFlag, clearVisited, getType, getTypeName, isVisited, setFlag, setVisited, voronoiCheck |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public int idx
public static double insideTriangleTolerance
Constructor Detail |
---|
public Face(int idx)
idx
- desired index valueMethod Detail |
---|
public 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 Vector3d getWorldNormal()
public double getPoint0DotNormal()
public static Face create(Vertex3d... vtxs)
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-edges
public 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 covariance
public void computePoint(Point3d pnt, Vector2d coords)
coords
, then the
point is computed from
pnt
- returns the computed pointcoords
- specifies s0 and s0public void computeCoords(Point3d pnt, Vector2d coords)
pnt
- the point to considercoords
- the returned coordinatespublic void computeNormal()
public void computeNormal(Vector3d normal)
normal
- returns the normalgetNormal()
public double computeArea()
public Vector3d getRenderNormal()
public void computeRenderNormal()
public void nearestPoint(Point3d pc, Point3d p1)
pc
- returns the closest pointp1
- point for which closest point is computedpublic Vector3d getNormal()
computeNormal
. In order to have the normal vector recomputed, one should
first clear it using clearNormal
.
public 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 edge
public int indexOfEdge(HalfEdge halfEdge)
public HalfEdge firstHalfEdge()
public void updateBounds(Point3d min, Point3d 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 MeshBase getMesh()
public Vertex3d[] getVertices()
public Vertex3d getVertex(int idx)
public int indexOfVertex(Vertex3d vtx)
public void updateNormalAndEdges()
public int numPoints()
Boundable
numPoints
in interface 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)
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |