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.
|
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.
|
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.