| 
    Simbody
    3.4 (development)
    
   
   | 
  
  
  
 
A 3d line segment primitive represented by its end points in an unspecified frame, and a collection of line segment-related utility methods. More...
#include <Geo_LineSeg.h>
Public Member Functions | |
| LineSeg_ () | |
| Construct an uninitialized LineSeg object; the end points will be garbage (NaN in Debug builds).   | |
| LineSeg_ (const Vec3P &e0, const Vec3P &e1) | |
| Construct a LineSeg with the given end points.   | |
| LineSeg_ & | setEndpoints (const Vec3P &e0, const Vec3P &e1) | 
| Change the end points of this line segment.   | |
| LineSeg_ & | setEndpoint (int which, const Vec3P &p) | 
| Change one end point of this line segment.   | |
| 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.   | |
| const Vec3P & | getEndpoint (int which) const | 
| Get the location of an end point. Order is the same as construction.   | |
| Vec3P & | updEndpoint (int which) | 
| Get a writable reference to the location of an end point. Order is the same as construction.   | |
| const Vec3P & | operator[] (int which) const | 
| Access an end point by indexing the line segment.   | |
| Vec3P & | operator[] (int which) | 
| Get writable access to an end point by indexing the line segment.   | |
| RealP | calcLength () const | 
| Calculate the length of this line segment (expensive).   | |
| RealP | calcLengthSqr () const | 
| Calculate the square of the length of this line segment (cheap).   | |
| 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.   | |
| Vec3P | findMidpoint () const | 
| Return the center point of the line segment; this is the same as findPoint(1/2) but faster.   | |
| Sphere_< P > | calcBoundingSphere () const | 
| Calculate a minimal bounding sphere for this line segment.   | |
| RealP | findDistanceToPoint (const Vec3P &p2) const | 
| Find the distance between this line segment and a point expressed in the same frame.   | |
| RealP | findDistanceToPointSqr (const Vec3P &p2) const | 
| Find the square of the distance between this line segment and a point expressed in the same frame.   | |
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.
| SimTK::Geo::LineSeg_< P >::LineSeg_ | ( | ) |  [inline] | 
        
Construct an uninitialized LineSeg object; the end points will be garbage (NaN in Debug builds).
| SimTK::Geo::LineSeg_< P >::LineSeg_ | ( | const Vec3P & | e0, | 
| const Vec3P & | e1 | ||
| ) |  [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.
| LineSeg_& SimTK::Geo::LineSeg_< P >::setEndpoints | ( | const Vec3P & | e0, | 
| const Vec3P & | e1 | ||
| ) |  [inline] | 
        
Change the end points of this line segment.
| LineSeg_& SimTK::Geo::LineSeg_< P >::setEndpoint | ( | int | which, | 
| const Vec3P & | p | ||
| ) |  [inline] | 
        
Change one end point of this line segment.
| bool SimTK::Geo::LineSeg_< P >::isDegenerate | ( | RealP | tol = Geo::getDefaultTol<P>() | ) |  const [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.
| const Vec3P& SimTK::Geo::LineSeg_< P >::getEndpoint | ( | int | which | ) |  const [inline] | 
        
Get the location of an end point. Order is the same as construction.
You can use operator[] instead for a more compact notation.
| Vec3P& SimTK::Geo::LineSeg_< P >::updEndpoint | ( | int | which | ) |  [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.
| const Vec3P& SimTK::Geo::LineSeg_< P >::operator[] | ( | int | which | ) |  const [inline] | 
        
Access an end point by indexing the line segment.
| Vec3P& SimTK::Geo::LineSeg_< P >::operator[] | ( | int | which | ) |  [inline] | 
        
Get writable access to an end point by indexing the line segment.
| RealP SimTK::Geo::LineSeg_< P >::calcLength | ( | ) |  const [inline] | 
        
Calculate the length of this line segment (expensive).
Cost is about 40 flops.
| RealP SimTK::Geo::LineSeg_< P >::calcLengthSqr | ( | ) |  const [inline] | 
        
Calculate the square of the length of this line segment (cheap).
Cost is 8 flops.
| Vec3P SimTK::Geo::LineSeg_< P >::findPoint | ( | RealP | t | ) |  const [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.
| Vec3P SimTK::Geo::LineSeg_< P >::findMidpoint | ( | ) |  const [inline] | 
        
Return the center point of the line segment; this is the same as findPoint(1/2) but faster.
Cost is 4 flops.
| Sphere_<P> SimTK::Geo::LineSeg_< P >::calcBoundingSphere | ( | ) |  const [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.
| RealP SimTK::Geo::LineSeg_< P >::findDistanceToPoint | ( | const Vec3P & | p2 | ) |  const [inline] | 
        
Find the distance between this line segment and a point expressed in the same frame.
Cost is XXX flops.
| RealP SimTK::Geo::LineSeg_< P >::findDistanceToPointSqr | ( | const Vec3P & | p2 | ) |  const [inline] | 
        
Find the square of the distance between this line segment and a point expressed in the same frame.
Cost is XXX flops.