1 #ifndef SimTK_SIMMATH_GEO_LINESEG_H_
2 #define SimTK_SIMMATH_GEO_LINESEG_H_
62 { setEndpoints(e0,e1); }
66 { e[0]=e0; e[1]=e1;
return *
this; }
70 { assert(which==0 || which==1); e[which] = p;
return *
this; }
78 { assert(tol >= 0);
return calcLengthSqr() <=
square(tol); }
83 { assert(which==0 || which==1);
return e[which]; }
89 { assert(which==0 || which==1);
return e[which]; }
109 {
return t*e[0] + (1-t)*e[1]; }
114 {
return (e[0]+e[1]) / RealP(2); }
126 "Geo::LineSeg_::findDistanceToPoint(): Not implemented yet.");
127 return Geo::getNaN<P>();}
133 "Geo::LineSeg_::findDistanceToPointSqr(): Not implemented yet.");
134 return Geo::getNaN<P>();}
#define SimTK_ASSERT_ALWAYS(cond, msg)
Definition: ExceptionMacros.h:349
Defines geometric primitive shapes and algorthms.
Defines primitive operations on spheres.
Includes internal headers providing declarations for the basic SimTK Core classes,...
This is the header file that every Simmath compilation unit should include first.
#define SimTK_SIMMATH_EXPORT
Definition: SimTKmath/include/simmath/internal/common.h:64
A 3d line segment primitive represented by its end points in an unspecified frame,...
Definition: Geo_LineSeg.h:50
RealP findDistanceToPointSqr(const Vec3P &p2) const
Find the square of the distance between this line segment and a point expressed in the same frame.
Definition: Geo_LineSeg.h:131
const Vec3P & getEndpoint(int which) const
Get the location of an end point. Order is the same as construction.
Definition: Geo_LineSeg.h:82
RealP calcLength() const
Calculate the length of this line segment (expensive).
Definition: Geo_LineSeg.h:98
Sphere_< P > calcBoundingSphere() const
Calculate a minimal bounding sphere for this line segment.
Definition: Geo_LineSeg.h:119
Vec3P & updEndpoint(int which)
Get a writable reference to the location of an end point. Order is the same as construction.
Definition: Geo_LineSeg.h:88
RealP findDistanceToPoint(const Vec3P &p2) const
Find the distance between this line segment and a point expressed in the same frame.
Definition: Geo_LineSeg.h:124
Vec3P findMidpoint() const
Return the center point of the line segment; this is the same as findPoint(1/2) but faster.
Definition: Geo_LineSeg.h:113
const Vec3P & operator[](int which) const
Access an end point by indexing the line segment.
Definition: Geo_LineSeg.h:92
Vec3P findPoint(RealP t) const
Return a point along the line segment given by its coordinate t, where t==0 gives end point 0,...
Definition: Geo_LineSeg.h:108
LineSeg_()
Construct an uninitialized LineSeg object; the end points will be garbage (NaN in Debug builds).
Definition: Geo_LineSeg.h:57
LineSeg_ & setEndpoint(int which, const Vec3P &p)
Change one end point of this line segment.
Definition: Geo_LineSeg.h:69
LineSeg_(const Vec3P &e0, const Vec3P &e1)
Construct a LineSeg with the given end points.
Definition: Geo_LineSeg.h:61
bool isDegenerate(RealP tol=Geo::getDefaultTol< P >()) const
Determine whether this line segment is degenerate to a given tolerance, meaning that its length is le...
Definition: Geo_LineSeg.h:77
Vec3P & operator[](int which)
Get writable access to an end point by indexing the line segment.
Definition: Geo_LineSeg.h:94
RealP calcLengthSqr() const
Calculate the square of the length of this line segment (cheap).
Definition: Geo_LineSeg.h:102
LineSeg_ & setEndpoints(const Vec3P &e0, const Vec3P &e1)
Change the end points of this line segment.
Definition: Geo_LineSeg.h:65
static Sphere_< P > calcBoundingSphere(const Vec3P &p)
Create a tiny bounding sphere around a single point.
Definition: Geo_Point.h:333
A geometric primitive representing a sphere by its radius and center point, and a collection of spher...
Definition: Geo_Sphere.h:47
The Geo class collects geometric primitives intended to deal with raw, fixed-size geometric shapes oc...
Definition: Geo.h:53
This is the top-level SimTK namespace into which all SimTK names are placed to avoid collision with o...
Definition: Assembler.h:37
unsigned char square(unsigned char u)
Definition: Scalar.h:349