library of assembled shared sources

http://lass.cocamware.com

lass::prim::LineSegment2D< T, ParameterPolicy > Class Template Reference

2D Line Segment More...

#include <line_segment_2d.h>


Data Structures

struct  Rebind

Public Types

enum  { dimension = TPoint::dimension }
typedef LineSegment2D< T,
ParameterPolicy > 
TSelf
typedef ParameterPolicy TParameterPolicy
typedef Point2D< T > TPoint
typedef TPoint::TVector TVector
typedef TPoint::TNumTraits TNumTraits
typedef TPoint::TValue TValue
typedef TPoint::TParam TParam
typedef TPoint::TReference TReference
typedef TPoint::TConstReference TConstReference

Public Member Functions

 LineSegment2D ()
 LineSegment2D (const TPoint &tail, const TPoint &head)
const TPointtail () const
TPointtail ()
const TPointhead () const
TPointhead ()
const TPoint point (TParam t) const
 Return point on ray by it's parameter.
const TValue t (const TPoint &point) const
 Return parameter of projection of iPoint on line segment.
const TVector vector () const
 Return vector from tail to head.
const TValue length () const
 Return length of line segment.

Private Attributes

TPoint tail_
TPoint head_

Related Functions

(Note that these are not member functions.)

template<typename T , class PPa , class PPb >
Result intersect (const LineSegment2D< T, PPa > &a, const LineSegment2D< T, PPb > &b, T &tA, T &tB)
 intersection of two line segments
template<typename T , class PPa , class PPb >
bool operator== (const LineSegment2D< T, PPa > &a, const LineSegment2D< T, PPb > &b)
template<typename T , class PPa , class PPb >
bool operator!= (const LineSegment2D< T, PPa > &a, const LineSegment2D< T, PPb > &b)
template<typename T , class PP >
std::ostream & operator<< (std::ostream &stream, const LineSegment2D< T, PP > &segment)
template<typename T , class PP >
io::XmlOStreamoperator<< (io::XmlOStream &stream, const LineSegment2D< T, PP > &segment)
template<typename T , class PP >
lass::io::MatlabOStreamoperator<< (lass::io::MatlabOStream &stream, const LineSegment2D< T, PP > &segment)


Detailed Description

template<typename T, class ParameterPolicy = Bounded>
class lass::prim::LineSegment2D< T, ParameterPolicy >

2D Line Segment

Author:
Bram de Greve [BdG]
Date:
2003

Definition at line 74 of file line_segment_2d.h.


Member Typedef Documentation

template<typename T , class ParameterPolicy = Bounded>
typedef LineSegment2D<T, ParameterPolicy> lass::prim::LineSegment2D< T, ParameterPolicy >::TSelf

Definition at line 78 of file line_segment_2d.h.

template<typename T , class ParameterPolicy = Bounded>
typedef ParameterPolicy lass::prim::LineSegment2D< T, ParameterPolicy >::TParameterPolicy

Definition at line 79 of file line_segment_2d.h.

template<typename T , class ParameterPolicy = Bounded>
typedef Point2D<T> lass::prim::LineSegment2D< T, ParameterPolicy >::TPoint

Definition at line 81 of file line_segment_2d.h.

template<typename T , class ParameterPolicy = Bounded>
typedef TPoint::TVector lass::prim::LineSegment2D< T, ParameterPolicy >::TVector

Definition at line 82 of file line_segment_2d.h.

template<typename T , class ParameterPolicy = Bounded>
typedef TPoint::TNumTraits lass::prim::LineSegment2D< T, ParameterPolicy >::TNumTraits

Definition at line 83 of file line_segment_2d.h.

template<typename T , class ParameterPolicy = Bounded>
typedef TPoint::TValue lass::prim::LineSegment2D< T, ParameterPolicy >::TValue

Definition at line 84 of file line_segment_2d.h.

template<typename T , class ParameterPolicy = Bounded>
typedef TPoint::TParam lass::prim::LineSegment2D< T, ParameterPolicy >::TParam

Definition at line 85 of file line_segment_2d.h.

template<typename T , class ParameterPolicy = Bounded>
typedef TPoint::TReference lass::prim::LineSegment2D< T, ParameterPolicy >::TReference

Definition at line 86 of file line_segment_2d.h.

template<typename T , class ParameterPolicy = Bounded>
typedef TPoint::TConstReference lass::prim::LineSegment2D< T, ParameterPolicy >::TConstReference

Definition at line 87 of file line_segment_2d.h.


Member Enumeration Documentation

template<typename T , class ParameterPolicy = Bounded>
anonymous enum

Enumerator:
dimension 

Definition at line 89 of file line_segment_2d.h.


Constructor & Destructor Documentation

template<typename T , class PP >
lass::prim::LineSegment2D< T, PP >::LineSegment2D (  )  [inline]

template<typename T , class PP >
lass::prim::LineSegment2D< T, PP >::LineSegment2D ( const TPoint tail,
const TPoint head 
) [inline]

Definition at line 67 of file line_segment_2d.inl.


Member Function Documentation

template<typename T , class PP >
const LineSegment2D< T, PP >::TPoint & lass::prim::LineSegment2D< T, PP >::tail (  )  const [inline]

template<typename T , class PP >
LineSegment2D< T, PP >::TPoint & lass::prim::LineSegment2D< T, PP >::tail (  )  [inline]

template<typename T , class PP >
const LineSegment2D< T, PP >::TPoint & lass::prim::LineSegment2D< T, PP >::head (  )  const [inline]

template<typename T , class PP >
LineSegment2D< T, PP >::TPoint & lass::prim::LineSegment2D< T, PP >::head (  )  [inline]

template<typename T , class PP >
const LineSegment2D< T, PP >::TPoint lass::prim::LineSegment2D< T, PP >::point ( TParam  t  )  const [inline]

template<typename T , class PP >
const LineSegment2D< T, PP >::TValue lass::prim::LineSegment2D< T, PP >::t ( const TPoint point  )  const [inline]

Return parameter of projection of iPoint on line segment.

Warning:
the result can be out of bound [0, 1] regardless the parameter policy used.

Definition at line 129 of file line_segment_2d.inl.

References lass::prim::dot(), lass::prim::LineSegment2D< T, ParameterPolicy >::head_, lass::num::NumTraits< C >::one, lass::prim::LineSegment2D< T, ParameterPolicy >::tail_, and lass::prim::LineSegment2D< T, ParameterPolicy >::vector().

Referenced by lass::prim::LineSegment2D< T, ParameterPolicy >::intersect(), and lass::spat::PlanarMesh::onEdge().

template<typename T , class PP >
const LineSegment2D< T, PP >::TVector lass::prim::LineSegment2D< T, PP >::vector (  )  const [inline]

template<typename T , class PP >
const LineSegment2D< T, PP >::TValue lass::prim::LineSegment2D< T, PP >::length (  )  const [inline]

Return length of line segment.

Definition at line 155 of file line_segment_2d.inl.

References lass::prim::Vector2D< T >::norm(), and lass::prim::LineSegment2D< T, ParameterPolicy >::vector().


Friends And Related Function Documentation

template<typename T , class PPa , class PPb >
Result intersect ( const LineSegment2D< T, PPa > &  a,
const LineSegment2D< T, PPb > &  b,
T &  tA,
T &  tB 
) [related]

intersection of two line segments

Parameters:
a [in] line segment A
b [in] line segment B
aT [out] parameter of intersection point on line segment A
bT [out] parameter of intersection point on line segment B
Returns:
  • rNone the line segments don't intersect, they have no points in common. tA and tB are not assigned.
  • rOne both line segments have exactly one point in common. tA and tB contain parameters of intersection point.
  • rInfinite the line segments have more than one point in common, they overlap. tA and tB are not assigned.

Definition at line 208 of file line_segment_2d.inl.

References lass::prim::doubleTriangleArea(), lass::prim::LineSegment2D< T, ParameterPolicy >::head(), lass::prim::perpDot(), lass::prim::rInfinite, lass::prim::rNone, lass::prim::rOne, lass::prim::LineSegment2D< T, ParameterPolicy >::t(), lass::prim::LineSegment2D< T, ParameterPolicy >::tail(), and lass::prim::LineSegment2D< T, ParameterPolicy >::vector().

template<typename T , class PPa , class PPb >
bool operator== ( const LineSegment2D< T, PPa > &  a,
const LineSegment2D< T, PPb > &  b 
) [related]

template<typename T , class PPa , class PPb >
bool operator!= ( const LineSegment2D< T, PPa > &  a,
const LineSegment2D< T, PPb > &  b 
) [related]

Definition at line 300 of file line_segment_2d.inl.

template<typename T , class PP >
std::ostream & operator<< ( std::ostream &  stream,
const LineSegment2D< T, PP > &  segment 
) [related]

Definition at line 309 of file line_segment_2d.inl.

References LASS_ENFORCE_STREAM.

template<typename T , class PP >
io::XmlOStream & operator<< ( io::XmlOStream stream,
const LineSegment2D< T, PP > &  segment 
) [related]

Definition at line 320 of file line_segment_2d.inl.

References LASS_ENFORCE_STREAM.

template<typename T , class PP >
lass::io::MatlabOStream & operator<< ( lass::io::MatlabOStream stream,
const LineSegment2D< T, PP > &  segment 
) [related]

Definition at line 335 of file line_segment_2d.inl.

References LASS_ENFORCE_STREAM.


Field Documentation

template<typename T , class ParameterPolicy = Bounded>
TPoint lass::prim::LineSegment2D< T, ParameterPolicy >::tail_ [private]

template<typename T , class ParameterPolicy = Bounded>
TPoint lass::prim::LineSegment2D< T, ParameterPolicy >::head_ [private]


The documentation for this class was generated from the following files:

Generated on Mon Nov 10 14:22:13 2008 for Library of Assembled Shared Sources by doxygen 1.5.7.1
SourceForge.net Logo