Simbody
3.7
|
A 3d line segment primitive represented by its end points in an unspecified frame, and a collection of line segment-related utility methods. More...
Public Member Functions | |
LineSeg_ () | |
Construct an uninitialized LineSeg object; the end points will be garbage (NaN in Debug builds). More... | |
LineSeg_ (const Vec3P &e0, const Vec3P &e1) | |
Construct a LineSeg with the given end points. More... | |
LineSeg_ & | setEndpoints (const Vec3P &e0, const Vec3P &e1) |
Change the end points of this line segment. More... | |
LineSeg_ & | setEndpoint (int which, const Vec3P &p) |
Change one end point of this line segment. More... | |
bool | isDegenerate (RealP tol=Geo::getDefaultTol< P >()) const |
Determine whether this line segment is degenerate to a given tolerance, meaning that its length is less than or equal to the tolerance. More... | |
const Vec3P & | getEndpoint (int which) const |
Get the location of an end point. Order is the same as construction. More... | |
Vec3P & | updEndpoint (int which) |
Get a writable reference to the location of an end point. Order is the same as construction. More... | |
const Vec3P & | operator[] (int which) const |
Access an end point by indexing the line segment. More... | |
Vec3P & | operator[] (int which) |
Get writable access to an end point by indexing the line segment. More... | |
RealP | calcLength () const |
Calculate the length of this line segment (expensive). More... | |
RealP | calcLengthSqr () const |
Calculate the square of the length of this line segment (cheap). More... | |
Vec3P | findPoint (RealP t) const |
Return a point along the line segment given by its coordinate t, where t==0 gives end point 0, t==1 gives end point 1 and other values interpolate or extrapolate linearly. More... | |
Vec3P | findMidpoint () const |
Return the center point of the line segment; this is the same as findPoint(1/2) but faster. More... | |
Sphere_< P > | calcBoundingSphere () const |
Calculate a minimal bounding sphere for this line segment. More... | |
RealP | findDistanceToPoint (const Vec3P &p2) const |
Find the distance between this line segment and a point expressed in the same frame. More... | |
RealP | findDistanceToPointSqr (const Vec3P &p2) const |
Find the square of the distance between this line segment and a point expressed in the same frame. More... | |
A 3d line segment primitive represented by its end points in an unspecified frame, and a collection of line segment-related utility methods.
We support a one-parameter t representation of the line segment, where t=0 gives the first end point and t=1 gives the second end point.
|
inline |
Construct an uninitialized LineSeg object; the end points will be garbage (NaN in Debug builds).
|
inline |
Construct a LineSeg with the given end points.
When an orientation is needed we define the line segment to go from e0 to e1.
|
inline |
Change the end points of this line segment.
|
inline |
Change one end point of this line segment.
|
inline |
Determine whether this line segment is degenerate to a given tolerance, meaning that its length is less than or equal to the tolerance.
Use a tolerance of zero if you want to check only for exact degeneracy. By default the tolerance is SignificantReal for the precision in use, about 2e-14 in double, 9e-7 in float. Cost is 10 flops.
|
inline |
Get the location of an end point. Order is the same as construction.
You can use operator[] instead for a more compact notation.
|
inline |
Get a writable reference to the location of an end point. Order is the same as construction.
You can use operator[] instead for a more compact notation.
|
inline |
Access an end point by indexing the line segment.
|
inline |
Get writable access to an end point by indexing the line segment.
|
inline |
Calculate the length of this line segment (expensive).
Cost is about 40 flops.
|
inline |
Calculate the square of the length of this line segment (cheap).
Cost is 8 flops.
|
inline |
Return a point along the line segment given by its coordinate t, where t==0 gives end point 0, t==1 gives end point 1 and other values interpolate or extrapolate linearly.
Note that values outside the range [0,1] are not on the line segment. Cost is 10 flops.
|
inline |
Return the center point of the line segment; this is the same as findPoint(1/2) but faster.
Cost is 4 flops.
|
inline |
Calculate a minimal bounding sphere for this line segment.
This is the sphere whose center is the segment midpoint and whose radius is half the segment length, plus a little slop. Cost is about 45 flops.
|
inline |
Find the distance between this line segment and a point expressed in the same frame.
Cost is XXX flops.
|
inline |
Find the square of the distance between this line segment and a point expressed in the same frame.
Cost is XXX flops.