A segment in N dimensional space designed for doing math operations. More...
#include <SegmentMath.h>
Public Types | |
| typedef Base::Number | Number |
| The number type. | |
| typedef Base::Point | Point |
| The point type. | |
Public Member Functions | |
Constructors etc. | |
| SegmentMath () | |
| Default constructor. Uninitialized memory. | |
| SegmentMath (const Point &source, const Point &target) | |
| Construct from two points. | |
| SegmentMath (const Segment< N, T > &s) | |
| Construct from a Segment. | |
| SegmentMath (const SegmentMath &other) | |
| Copy constructor. | |
| SegmentMath & | operator= (const SegmentMath &other) |
| Assignment operator. | |
| ~SegmentMath () | |
| Trivial destructor. | |
| void | make (const Point &source, const Point &target) |
| Make from two points. | |
Accesors. | |
| const Point & | getTangent () const |
| Return the unit tangent to the line segment. | |
| T | getLength () const |
| Return the length of the line segment. | |
Translations. | |
| SegmentMath & | operator+= (const Point &p) |
| Translate by p. | |
| SegmentMath & | operator-= (const Point &p) |
| Translate by -p. | |
Validity. | |
| bool | isValid () const |
| Return true if the segment is valid. | |
Related Functions | |
(Note that these are not member functions.) | |
| template<int N, typename T > | |
| const SegmentMath< N, T > & | operator+ (const SegmentMath< N, T > &x) |
| Return the segment. | |
| template<int N, typename T > | |
| SegmentMath< N, T > | operator- (const SegmentMath< N, T > &x) |
| Return a reversed segment. | |
| template<int N, typename T > | |
| SegmentMath< N, T > | operator+ (const SegmentMath< N, T > &s, const typename SegmentMath< N, T >::Point &p) |
| Translate by p. | |
| template<int N, typename T > | |
| SegmentMath< N, T > | operator- (const SegmentMath< N, T > &s, const typename SegmentMath< N, T >::Point &p) |
| Translate by -p. | |
| template<int N, typename T > | |
| bool | operator== (const SegmentMath< N, T > &x, const SegmentMath< N, T > &y) |
| Return true if the segments are equal. | |
| template<int N, typename T > | |
| bool | operator!= (const SegmentMath< N, T > &x, const SegmentMath< N, T > &y) |
| Return true if the segments are not equal. | |
| template<int N, typename T > | |
| T | computeDistance (const SegmentMath< N, T > &segment, const typename SegmentMath< N, T >::Point &x) |
| Compute the unsigned distance to the line segment. | |
| template<int N, typename T > | |
| void | computeClosestPoint (const SegmentMath< N, T > &segment, const typename SegmentMath< N, T >::Point &x, typename SegmentMath< N, T >::Point *closestPoint) |
| Compute closest point on the line segment. | |
| template<int N, typename T > | |
| T | computeDistanceAndClosestPoint (const SegmentMath< N, T > &segment, const typename SegmentMath< N, T >::Point &x, typename SegmentMath< N, T >::Point *closestPoint) |
| Compute the unsigned distance to the line segment and the closest point on it. | |
| template<int N, typename T > | |
| T | computeUnsignedDistanceToSupportingLine (const SegmentMath< N, T > &segment, const typename SegmentMath< N, T >::Point &x) |
| Compute the unsigned distance to the supporting line of the segment. | |
| template<int N, typename T > | |
| T | computeUnsignedDistanceAndClosestPointToSupportingLine (const SegmentMath< N, T > &segment, const typename SegmentMath< N, T >::Point &x, typename SegmentMath< N, T >::Point *closestPoint) |
| Compute the unsigned distance to the supporting line of the segment and the closest point on the line. | |
| template<typename T > | |
| bool | computeZIntersection (const SegmentMath< 3, T > &segment, T *x, T *y, T z) |
| Return true if the segment intersects the plane of constant z. | |
| template<typename T > | |
| bool | computeIntersection (const SegmentMath< 2, T > &s1, const SegmentMath< 2, T > &s2, typename SegmentMath< 2, T >::Point *intersectionPoint) |
| If the two Segments intersect, return true and the point of intersection. Otherwise return false. | |
| template<int N, typename T > | |
| std::istream & | operator>> (std::istream &in, SegmentMath< N, T > &s) |
| File input. | |
| template<int N, typename T > | |
| std::ostream & | operator<< (std::ostream &out, const SegmentMath< N, T > &s) |
| File output. | |
A segment in N dimensional space designed for doing math operations.
| N | is the dimension. | |
| T | is the number type. By default it is double. |
A segment is an ordered doublet of points. This class stores the length of the segment and its tangent.
| void computeClosestPoint | ( | const SegmentMath< N, T > & | segment, | |
| const typename SegmentMath< N, T >::Point & | x, | |||
| typename SegmentMath< N, T >::Point * | closestPoint | |||
| ) | [related] |
Compute closest point on the line segment.
| T computeDistance | ( | const SegmentMath< N, T > & | segment, | |
| const typename SegmentMath< N, T >::Point & | x | |||
| ) | [related] |
Compute the unsigned distance to the line segment.
Referenced by Simplex< N, V, T >::computeUnsignedDistance().
| T computeDistanceAndClosestPoint | ( | const SegmentMath< N, T > & | segment, | |
| const typename SegmentMath< N, T >::Point & | x, | |||
| typename SegmentMath< N, T >::Point * | closestPoint | |||
| ) | [related] |
Compute the unsigned distance to the line segment and the closest point on it.
| bool computeIntersection | ( | const SegmentMath< 2, T > & | s1, | |
| const SegmentMath< 2, T > & | s2, | |||
| typename SegmentMath< 2, T >::Point * | intersectionPoint | |||
| ) | [related] |
If the two Segments intersect, return true and the point of intersection. Otherwise return false.
| T computeUnsignedDistanceAndClosestPointToSupportingLine | ( | const SegmentMath< N, T > & | segment, | |
| const typename SegmentMath< N, T >::Point & | x, | |||
| typename SegmentMath< N, T >::Point * | closestPoint | |||
| ) | [related] |
Compute the unsigned distance to the supporting line of the segment and the closest point on the line.
| T computeUnsignedDistanceToSupportingLine | ( | const SegmentMath< N, T > & | segment, | |
| const typename SegmentMath< N, T >::Point & | x | |||
| ) | [related] |
Compute the unsigned distance to the supporting line of the segment.
| bool computeZIntersection | ( | const SegmentMath< 3, T > & | segment, | |
| T * | x, | |||
| T * | y, | |||
| T | z | |||
| ) | [related] |
Return true if the segment intersects the plane of constant z.
Set x and y to the point of intersection.
| bool operator!= | ( | const SegmentMath< N, T > & | x, | |
| const SegmentMath< N, T > & | y | |||
| ) | [related] |
Return true if the segments are not equal.
| SegmentMath< N, T > operator+ | ( | const SegmentMath< N, T > & | s, | |
| const typename SegmentMath< N, T >::Point & | p | |||
| ) | [related] |
Translate by p.
| const SegmentMath< N, T > & operator+ | ( | const SegmentMath< N, T > & | x | ) | [related] |
Return the segment.
| SegmentMath< N, T > operator- | ( | const SegmentMath< N, T > & | s, | |
| const typename SegmentMath< N, T >::Point & | p | |||
| ) | [related] |
Translate by -p.
| SegmentMath< N, T > operator- | ( | const SegmentMath< N, T > & | x | ) | [related] |
Return a reversed segment.
References Segment< N, T >::getSource(), and Segment< N, T >::getTarget().
| std::ostream & operator<< | ( | std::ostream & | out, | |
| const SegmentMath< N, T > & | s | |||
| ) | [related] |
File output.
| bool operator== | ( | const SegmentMath< N, T > & | x, | |
| const SegmentMath< N, T > & | y | |||
| ) | [related] |
Return true if the segments are equal.
References SegmentMath< N, T >::getLength(), and SegmentMath< N, T >::getTangent().
| std::istream & operator>> | ( | std::istream & | in, | |
| SegmentMath< N, T > & | s | |||
| ) | [related] |
File input.
1.6.3