Constructor and Description |
---|
LineSegment(Vertex3d vtx0,
Vertex3d vtx1) |
Modifier and Type | Method and Description |
---|---|
void |
computeCentroid(Vector3d centroid)
Computed the centroid of this element.
|
double |
computeCovariance(Matrix3d C)
Computes covariance of this line segment and returns its length.
|
static double |
distance(Point3d p0,
Point3d p1,
Point3d px)
Computes the distance of a point
px
to a line segment defined by points p0 and
p1 . |
double |
getLength() |
Point3d |
getPoint(int idx)
Returns the
idx -th point associated with this element. |
int |
numPoints()
Returns the number of points associated with this element, if any, or
zero otherwise.
|
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 |
updateBounds(Point3d min,
Point3d max)
Updates the axis-aligned bounds of this element.
|
public void computeCentroid(Vector3d centroid)
Boundable
computeCentroid
in interface Boundable
centroid
- 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 double getLength()
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 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 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
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 static double distance(Point3d p0, Point3d p1, Point3d px)
px
to a line segment defined by points p0
and
p1
.p0
- first point defining the segmentp1
- second point defining the segmentpx
- point to compute distance to