| 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 | distance(Point3d pnt)Computes the distance of a point | 
| static double | distance(Point3d p0,
        Point3d p1,
        Point3d px)Computes the distance of a point  pxto a line segment defined by pointsp0andp1. | 
| void | getDirection(Vector3d dir)Determine the line segment direction | 
| double | getLength() | 
| Point3d | getPoint(int idx)Returns the  idx-th point associated with this element. | 
| double | getProjectionParameter(Point3d pnt) | 
| void | nearestPoint(Point3d nearest,
            Point3d pnt)Determine nearest point to this feature | 
| static boolean | nearestPointParameters(double[] params,
                      Point3d p0,
                      Point3d p1,
                      Point3d pa,
                      Point3d pb)For two lines defined by the points  p0, p1andpa, pb, computes the parameterssandtsuch that | 
| 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  pxwith respect to a line defined by pointsp0andp1. | 
| void | updateBounds(Vector3d min,
            Vector3d max)Updates the axis-aligned bounds of this element. | 
checkFlag, clearFlag, clearVisited, getType, getTypeName, isVisited, setFlag, setVisitedpublic void computeCentroid(Vector3d centroid)
BoundablecomputeCentroid in interface Boundablecentroid - 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 BoundableC - returns the covariancepublic double getLength()
public void updateBounds(Vector3d min, Vector3d max)
Boundablemin 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 Boundablemin - minimum values to be updatedmax - maximum values to be updatedpublic int numPoints()
Boundablepublic Point3d getPoint(int idx)
Boundableidx-th point associated with this element.getPoint in interface Boundableidx - 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 void getDirection(Vector3d dir)
dir - direction vector to populatepublic 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 static boolean nearestPointParameters(double[] params,
                                             Point3d p0,
                                             Point3d p1,
                                             Point3d pa,
                                             Point3d pb)
p0, p1
 and pa, pb, computes the parameters
 s and t such that
 ps = (1-s) p0 + s p1 pt = (1-t) pa + t pbare the points on the two lines which are nearest to each other. If the two lines are parallel,
s
 and t are both set to 0 and the method returns
 false.params - returns the values of s and tp0 - first point defining the first linep1 - second point defining the first linepa - first point defining the second linepb - second point defining the second linetrue if the lines are
 not parallel and false if they arepublic double distance(Point3d pnt)
pnt - point to compute nearest distance frompublic 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 topublic double getProjectionParameter(Point3d pnt)
public void nearestPoint(Point3d nearest, Point3d pnt)
FeaturenearestPoint in class Featurenearest - populated nearest pointpnt - point to check distance to