Modifier and Type | Field and Description |
---|---|
static int |
ELEM_EDGE
Flag indicating that a HalfEdge corresponds to the edge of
an underlying ``element''.
|
Vertex3d |
head |
HalfEdge |
opposite |
Vertex3d |
tail |
Constructor and Description |
---|
HalfEdge() |
HalfEdge(Vertex3d head,
HalfEdge opp,
Face face)
Creates a new half-edge with a specified head vertex, opposite half-edge,
and face.
|
HalfEdge(Vertex3d head,
Vertex3d tail,
Face face)
Creates a new half-edge with a specified head vertex, tail vertex, and
face.
|
Modifier and Type | Method and Description |
---|---|
void |
addAngleWeightedNormal(Vector3d res,
HalfEdge he) |
void |
computeCentroid(Vector3d p)
Computed the centroid of this element.
|
double |
computeCovariance(Matrix3d C)
Computes covariance of this half edge and returns its length.
|
double |
computeEdgeUnitVec(Vector3d u)
Computes a unit vector for the edge associated with this half-edge,
and returns the edge's length.
|
void |
computeUnitVec(Vector3d u)
Computes a unit vector in the direction of this edge, and returns
the edge's length.
|
void |
computeVertexNormal(Vector3d nrm,
boolean useRenderNormals)
Computes a normal for the head vertex of this half-edge, by averaging
all the surrounding face normals starting with the face corresponding
to this half edge, and ending when either a hard edge is encountered,
or when all faces have been traversed.
|
boolean |
connectsFaces(Face f0,
Face f1)
Returns
true if this HalfEdge and its opposite connects
faces f0 and f1 . |
static HalfEdge |
createLineSegment(Vertex3d v1,
Vertex3d v2)
Creates a pair of adjacent half-edges that together define a line segment
connecting two vertices.
|
double |
dotDirection(Vector3d v1)
Computes the dot product between a vector v1 and a non-normalized vector
in the direction of this half-edge.
|
java.lang.String |
faceStr()
Returns a string identifying this HalfEdge using the indices of
its primary and opposite faces.
|
Face |
getFace()
Returns the face associated with this half-edge.
|
Vertex3d |
getHead() |
int |
getIndex()
Returns an index for this half-edge, computed as
|
HalfEdge |
getNext() |
Face |
getOppositeFace()
Returns the face opposite to this half-edge, if any
|
Point3d |
getPoint(int idx)
Returns the
idx -th point associated with this element. |
HalfEdge |
getPrimary() |
double |
getProjectionParameter(Point3d pnt) |
Vertex3d |
getTail() |
boolean |
isHard() |
boolean |
isPrimary() |
HalfEdge |
lastHardEdge()
Returns the last hard edge (if any) incident on this half-edge's head
vertex, relative to this half-edge in a counter-clockwise direction about
the vertex.
|
double |
length()
Returns the length of this half-edge.
|
double |
lengthSquared()
Returns the length squared of this half-edge.
|
void |
nearestPoint(Point3d nearest,
Point3d pnt)
Determine nearest point to this feature
|
int |
numPoints()
Returns the number of points associated with this element, if any, or
zero otherwise.
|
java.lang.String |
pointList() |
static double |
projectionParameter(Point3d p0,
Point3d p1,
Point3d px)
Computes the projection parameter of a point
px
with respect to a line defined by points p0 and
p1 . |
void |
setHard(boolean hard) |
void |
setNext(HalfEdge heNext)
Sets the next half-edge adjacent to this one (in a counter-clockwise
sense).
|
void |
setPrimary(boolean primary) |
double |
sideProductDirection(Vector3d v1,
Vector3d v2)
Computes the dot product of (v1 X dir) and v2, where dir is the vector
from the head to the tail of this half-edge.
|
void |
updateBounds(Vector3d min,
Vector3d max)
Updates the axis-aligned bounds of this element.
|
java.lang.String |
vertexStr()
Returns a string identifying this HalfEdge using the indices of
its tail and head vertices.
|
checkFlag, clearFlag, clearVisited, getType, getTypeName, isVisited, setFlag, setVisited
public static final int ELEM_EDGE
public Vertex3d head
public Vertex3d tail
public HalfEdge opposite
public HalfEdge()
public HalfEdge(Vertex3d head, Vertex3d tail, Face face)
head
- head vertextail
- head vertexface
- associated facepublic HalfEdge(Vertex3d head, HalfEdge opp, Face face)
head
- head vertexopp
- opposite half-edgeface
- associated facepublic boolean isHard()
public void setHard(boolean hard)
public void setNext(HalfEdge heNext)
heNext
- next half-edgepublic static HalfEdge createLineSegment(Vertex3d v1, Vertex3d v2)
v1
- first vertex on the line segmentv2
- second vertex on the line segmentpublic double computeEdgeUnitVec(Vector3d u)
isPrimary()
returns true
), and from the head to the tail otherwise.
If the length of the edge is 0, all elements of the vector are
set to 0.u
- returns the edge unit vectorpublic void computeUnitVec(Vector3d u)
u
- returns the normalized direction vectorpublic Face getFace()
public int getIndex()
3 * faceIdx + edgeNumwhere
faceIdx
is the index of its face, and edgeNum
is
the edge number with respect to the face (with face.firstHalfEdge()
corresponding to 0).public Face getOppositeFace()
null
.public HalfEdge lastHardEdge()
public void computeVertexNormal(Vector3d nrm, boolean useRenderNormals)
public double dotDirection(Vector3d v1)
v1
- vector to dot with direction vectorpublic double length()
public double lengthSquared()
public double sideProductDirection(Vector3d v1, Vector3d v2)
v1
- first vectorv2
- second vectorpublic final Vertex3d getHead()
public final HalfEdge getNext()
public final Vertex3d getTail()
public java.lang.String pointList()
public boolean isPrimary()
public HalfEdge getPrimary()
public void setPrimary(boolean primary)
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 void computeCentroid(Vector3d p)
Boundable
computeCentroid
in interface Boundable
p
- returns the computed centroid value.public double computeCovariance(Matrix3d C)
The formula was determined by substituting the the parametric form for x
x = (1-s) p0 + s p1into the general formula for C
C = \int_V \rho x x^T dVand evaluating the integral over the s interval [0,1].
computeCovariance
in interface Boundable
C
- returns the covariancepublic 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 java.lang.String vertexStr()
public java.lang.String faceStr()
public boolean connectsFaces(Face f0, Face f1)
true
if this HalfEdge and its opposite connects
faces f0
and f1
.public static double projectionParameter(Point3d p0, Point3d p1, Point3d px)
px
with respect to a line defined by points p0
and
p1
. This is the value s such that
pp = (1-s) p0 + s p1gives the projection of
px-p0
onto the line. If
p0
and p1
are identical, the
method returns positive infinity.p0
- first point defining the linep1
- second point defining the libepx
- point for which the project parameter should be computedpublic double getProjectionParameter(Point3d pnt)
public void nearestPoint(Point3d nearest, Point3d pnt)
Feature
nearestPoint
in class Feature
nearest
- populated nearest pointpnt
- point to check distance to