SegmentMath< N, T > Class Template Reference

A segment in N dimensional space designed for doing math operations. More...

#include <SegmentMath.h>

Inheritance diagram for SegmentMath< N, T >:
Segment< N, T >

List of all members.

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.
SegmentMathoperator= (const SegmentMath &other)
 Assignment operator.
 ~SegmentMath ()
 Trivial destructor.
void make (const Point &source, const Point &target)
 Make from two points.
Accesors.

const PointgetTangent () const
 Return the unit tangent to the line segment.
getLength () const
 Return the length of the line segment.
Translations.

SegmentMathoperator+= (const Point &p)
 Translate by p.
SegmentMathoperator-= (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 >
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 >
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 >
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 >
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.

Detailed Description

template<int N, typename T = double>
class SegmentMath< N, T >

A segment in N dimensional space designed for doing math operations.

Parameters:
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.


Friends And Related Function Documentation

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 
) [related]

Compute closest point on the line segment.

template<int N, typename T >
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().

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 
) [related]

Compute the unsigned distance to the line segment and the closest point on it.

template<typename T >
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.

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 
) [related]

Compute the unsigned distance to the supporting line of the segment and the closest point on the line.

template<int N, typename T >
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.

template<typename T >
bool computeZIntersection ( const SegmentMath< 3, T > &  segment,
T *  x,
T *  y,
z 
) [related]

Return true if the segment intersects the plane of constant z.

Set x and y to the point of intersection.

template<int N, typename T >
bool operator!= ( const SegmentMath< N, T > &  x,
const SegmentMath< N, T > &  y 
) [related]

Return true if the segments are not equal.

template<int N, typename T >
SegmentMath< N, T > operator+ ( const SegmentMath< N, T > &  s,
const typename SegmentMath< N, T >::Point p 
) [related]

Translate by p.

template<int N, typename T >
const SegmentMath< N, T > & operator+ ( const SegmentMath< N, T > &  x  )  [related]

Return the segment.

template<int N, typename T >
SegmentMath< N, T > operator- ( const SegmentMath< N, T > &  s,
const typename SegmentMath< N, T >::Point p 
) [related]

Translate by -p.

template<int N, typename T >
SegmentMath< N, T > operator- ( const SegmentMath< N, T > &  x  )  [related]

Return a reversed segment.

References Segment< N, T >::getSource(), and Segment< N, T >::getTarget().

template<int N, typename T >
std::ostream & operator<< ( std::ostream &  out,
const SegmentMath< N, T > &  s 
) [related]

File output.

template<int N, typename T >
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().

template<int N, typename T >
std::istream & operator>> ( std::istream &  in,
SegmentMath< N, T > &  s 
) [related]

File input.


The documentation for this class was generated from the following file:
Generated on Thu Jun 30 02:14:58 2016 for Computational Geometry Package by  doxygen 1.6.3