wfmath 1.0.3
A math library for the Worldforge system.
WFMath::Segment< dim > Class Template Reference

A line segment embedded in dim dimensions. More...

#include <segment.h>

Public Member Functions

 Segment ()
 construct an uninitialized segment More...
 
 Segment (const Point< dim > &p1, const Point< dim > &p2)
 construct a segment with endpoints p1 and p2 More...
 
 Segment (const Segment &s)=default
 construct a copy of a segment More...
 
Segmentoperator= (const Segment &s)=default
 
bool isEqualTo (const Segment &s, CoordType epsilon=numeric_constants< CoordType >::epsilon()) const
 
bool operator== (const Segment &b) const
 
bool operator!= (const Segment &b) const
 
bool isValid () const
 
size_t numCorners () const
 
Point< dim > getCorner (size_t i) const
 
Point< dim > getCenter () const
 
const Point< dim > & endpoint (const int i) const
 get one end of the segment More...
 
Point< dim > & endpoint (const int i)
 get one end of the segment More...
 
Segmentshift (const Vector< dim > &v)
 
SegmentmoveCornerTo (const Point< dim > &p, size_t corner)
 
SegmentmoveCenterTo (const Point< dim > &p)
 
SegmentrotateCorner (const RotMatrix< dim > &m, size_t corner)
 
SegmentrotateCenter (const RotMatrix< dim > &m)
 
Segment< dim > & rotatePoint (const RotMatrix< dim > &m, const Point< dim > &p)
 
SegmentrotateCorner (const Quaternion &q, size_t corner)
 
SegmentrotateCenter (const Quaternion &q)
 
SegmentrotatePoint (const Quaternion &q, const Point< dim > &p)
 
AxisBox< dim > boundingBox () const
 
Ball< dim > boundingSphere () const
 
Ball< dim > boundingSphereSloppy () const
 
Segment toParentCoords (const Point< dim > &origin, const RotMatrix< dim > &rotation=RotMatrix< dim >().identity()) const
 
Segment toParentCoords (const AxisBox< dim > &coords) const
 
Segment toParentCoords (const RotBox< dim > &coords) const
 
Segment toLocalCoords (const Point< dim > &origin, const RotMatrix< dim > &rotation=RotMatrix< dim >().identity()) const
 
Segment toLocalCoords (const AxisBox< dim > &coords) const
 
Segment toLocalCoords (const RotBox< dim > &coords) const
 
Segment toParentCoords (const Point< dim > &origin, const Quaternion &rotation) const
 
Segment toLocalCoords (const Point< dim > &origin, const Quaternion &rotation) const
 
Segment< 3 > & rotatePoint (const Quaternion &q, const Point< 3 > &p)
 
Segment< 3 > & rotateCenter (const Quaternion &q)
 
Segment< 3 > toParentCoords (const Point< 3 > &origin, const Quaternion &rotation) const
 
Segment< 3 > toLocalCoords (const Point< 3 > &origin, const Quaternion &rotation) const
 
Segment< 3 > & rotateCorner (const Quaternion &q, size_t corner)
 

Friends

std::ostream & operator (std::ostream &os, const Segment &s)
 
std::istream & operator>> (std::istream &is, Segment &s)
 
bool Intersect (const Segment &s, const Point< dim > &p, bool proper)
 
bool Contains (const Point< dim > &p, const Segment &s, bool proper)
 
bool Intersect (const Segment &s, const AxisBox< dim > &b, bool proper)
 
bool Contains (const AxisBox< dim > &b, const Segment &s, bool proper)
 
bool Intersect (const Segment &s, const Ball< dim > &b, bool proper)
 
bool Contains (const Ball< dim > &b, const Segment &s, bool proper)
 
bool Intersect (const Segment &s1, const Segment &s2, bool proper)
 
bool Contains (const Segment &s1, const Segment &s2, bool proper)
 
bool Intersect (const RotBox< dim > &r, const Segment &s, bool proper)
 
bool Contains (const RotBox< dim > &r, const Segment &s, bool proper)
 
bool Contains (const Segment &s, const RotBox< dim > &r, bool proper)
 
bool Intersect (const Polygon< dim > &r, const Segment &s, bool proper)
 
bool Contains (const Polygon< dim > &p, const Segment &s, bool proper)
 
bool Contains (const Segment &s, const Polygon< dim > &p, bool proper)
 

Detailed Description

template<int dim = 3>
class WFMath::Segment< dim >

A line segment embedded in dim dimensions.

This class implements the full shape interface, as described in the fake class Shape.

Definition at line 45 of file segment.h.

Constructor & Destructor Documentation

◆ Segment() [1/3]

template<int dim = 3>
WFMath::Segment< dim >::Segment ( )
inline

construct an uninitialized segment

Definition at line 49 of file segment.h.

◆ Segment() [2/3]

template<int dim = 3>
WFMath::Segment< dim >::Segment ( const Point< dim > &  p1,
const Point< dim > &  p2 
)
inline

construct a segment with endpoints p1 and p2

Definition at line 51 of file segment.h.

◆ Segment() [3/3]

template<int dim = 3>
WFMath::Segment< dim >::Segment ( const Segment< dim > &  s)
default

construct a copy of a segment

Member Function Documentation

◆ boundingBox()

template<int dim = 3>
AxisBox< dim > WFMath::Segment< dim >::boundingBox ( ) const
inline

Definition at line 101 of file segment.h.

◆ boundingSphere()

template<int dim = 3>
Ball< dim > WFMath::Segment< dim >::boundingSphere ( ) const
inline

Definition at line 102 of file segment.h.

◆ boundingSphereSloppy()

template<int dim = 3>
Ball< dim > WFMath::Segment< dim >::boundingSphereSloppy ( ) const
inline

Definition at line 104 of file segment.h.

◆ endpoint() [1/2]

template<int dim = 3>
Point< dim > & WFMath::Segment< dim >::endpoint ( const int  i)
inline

get one end of the segment

Definition at line 78 of file segment.h.

◆ endpoint() [2/2]

template<int dim = 3>
const Point< dim > & WFMath::Segment< dim >::endpoint ( const int  i) const
inline

get one end of the segment

Definition at line 76 of file segment.h.

◆ getCenter()

template<int dim = 3>
Point< dim > WFMath::Segment< dim >::getCenter ( ) const
inline

Definition at line 73 of file segment.h.

◆ getCorner()

template<int dim = 3>
Point< dim > WFMath::Segment< dim >::getCorner ( size_t  i) const
inline

Definition at line 72 of file segment.h.

◆ isEqualTo()

template<int dim>
bool WFMath::Segment< dim >::isEqualTo ( const Segment< dim > &  s,
CoordType  epsilon = numeric_constants<CoordType>::epsilon() 
) const
inline

Definition at line 161 of file segment.h.

◆ isValid()

template<int dim = 3>
bool WFMath::Segment< dim >::isValid ( ) const
inline

Definition at line 67 of file segment.h.

◆ moveCenterTo()

template<int dim = 3>
Segment & WFMath::Segment< dim >::moveCenterTo ( const Point< dim > &  p)
inline

Definition at line 85 of file segment.h.

◆ moveCornerTo()

template<int dim>
Segment< dim > & WFMath::Segment< dim >::moveCornerTo ( const Point< dim > &  p,
size_t  corner 
)
inline

Definition at line 36 of file segment_funcs.h.

◆ numCorners()

template<int dim = 3>
size_t WFMath::Segment< dim >::numCorners ( ) const
inline

Definition at line 71 of file segment.h.

◆ operator!=()

template<int dim = 3>
bool WFMath::Segment< dim >::operator!= ( const Segment< dim > &  b) const
inline

Definition at line 65 of file segment.h.

◆ operator==()

template<int dim = 3>
bool WFMath::Segment< dim >::operator== ( const Segment< dim > &  b) const
inline

Definition at line 64 of file segment.h.

◆ rotateCenter() [1/2]

Segment< 3 > & WFMath::Segment< 3 >::rotateCenter ( const Quaternion q)

Definition at line 48 of file segment.cpp.

◆ rotateCenter() [2/2]

template<int dim = 3>
Segment & WFMath::Segment< dim >::rotateCenter ( const RotMatrix< dim > &  m)
inline

Definition at line 89 of file segment.h.

◆ rotateCorner() [1/2]

Segment< 3 > & WFMath::Segment< 3 >::rotateCorner ( const Quaternion q,
size_t  corner 
)
inline

Definition at line 68 of file segment_funcs.h.

◆ rotateCorner() [2/2]

template<int dim>
Segment< dim > & WFMath::Segment< dim >::rotateCorner ( const RotMatrix< dim > &  m,
size_t  corner 
)
inline

Definition at line 55 of file segment_funcs.h.

◆ rotatePoint() [1/2]

Segment< 3 > & WFMath::Segment< 3 >::rotatePoint ( const Quaternion q,
const Point< 3 > &  p 
)

Definition at line 40 of file segment.cpp.

◆ rotatePoint() [2/2]

template<int dim = 3>
Segment< dim > & WFMath::Segment< dim >::rotatePoint ( const RotMatrix< dim > &  m,
const Point< dim > &  p 
)
inline

Definition at line 91 of file segment.h.

◆ shift()

template<int dim = 3>
Segment & WFMath::Segment< dim >::shift ( const Vector< dim > &  v)
inline

Definition at line 82 of file segment.h.

◆ toLocalCoords() [1/4]

template<int dim = 3>
Segment WFMath::Segment< dim >::toLocalCoords ( const AxisBox< dim > &  coords) const
inline

Definition at line 124 of file segment.h.

◆ toLocalCoords() [2/4]

Segment< 3 > WFMath::Segment< 3 >::toLocalCoords ( const Point< 3 > &  origin,
const Quaternion rotation 
) const

Definition at line 61 of file segment.cpp.

◆ toLocalCoords() [3/4]

template<int dim = 3>
Segment WFMath::Segment< dim >::toLocalCoords ( const Point< dim > &  origin,
const RotMatrix< dim > &  rotation = RotMatrix<dim>().identity() 
) const
inline

Definition at line 120 of file segment.h.

◆ toLocalCoords() [4/4]

template<int dim = 3>
Segment WFMath::Segment< dim >::toLocalCoords ( const RotBox< dim > &  coords) const
inline

Definition at line 126 of file segment.h.

◆ toParentCoords() [1/4]

template<int dim = 3>
Segment WFMath::Segment< dim >::toParentCoords ( const AxisBox< dim > &  coords) const
inline

Definition at line 111 of file segment.h.

◆ toParentCoords() [2/4]

Segment< 3 > WFMath::Segment< 3 >::toParentCoords ( const Point< 3 > &  origin,
const Quaternion rotation 
) const

Definition at line 54 of file segment.cpp.

◆ toParentCoords() [3/4]

template<int dim = 3>
Segment WFMath::Segment< dim >::toParentCoords ( const Point< dim > &  origin,
const RotMatrix< dim > &  rotation = RotMatrix<dim>().identity() 
) const
inline

Definition at line 107 of file segment.h.

◆ toParentCoords() [4/4]

template<int dim = 3>
Segment WFMath::Segment< dim >::toParentCoords ( const RotBox< dim > &  coords) const
inline

Definition at line 113 of file segment.h.

Friends And Related Function Documentation

◆ Contains [1/8]

template<int dim = 3>
bool Contains ( const AxisBox< dim > &  b,
const Segment< dim > &  s,
bool  proper 
)
friend

Definition at line 275 of file intersect.h.

◆ Contains [2/8]

template<int dim = 3>
bool Contains ( const Ball< dim > &  b,
const Segment< dim > &  s,
bool  proper 
)
friend

Definition at line 307 of file intersect.h.

◆ Contains [3/8]

template<int dim = 3>
bool Contains ( const Point< dim > &  p,
const Segment< dim > &  s,
bool  proper 
)
friend

Definition at line 210 of file intersect.h.

◆ Contains [4/8]

template<int dim = 3>
bool Contains ( const Polygon< dim > &  p,
const Segment< dim > &  s,
bool  proper 
)
friend

Definition at line 555 of file polygon_intersect.cpp.

◆ Contains [5/8]

template<int dim = 3>
bool Contains ( const RotBox< dim > &  r,
const Segment< dim > &  s,
bool  proper 
)
friend

Definition at line 456 of file intersect.h.

◆ Contains [6/8]

template<int dim = 3>
bool Contains ( const Segment< dim > &  s,
const Polygon< dim > &  p,
bool  proper 
)
friend

Definition at line 571 of file polygon_intersect.cpp.

◆ Contains [7/8]

template<int dim = 3>
bool Contains ( const Segment< dim > &  s,
const RotBox< dim > &  r,
bool  proper 
)
friend

Definition at line 466 of file intersect.h.

◆ Contains [8/8]

template<int dim = 3>
bool Contains ( const Segment< dim > &  s1,
const Segment< dim > &  s2,
bool  proper 
)
friend

Definition at line 361 of file intersect.h.

◆ Intersect [1/6]

template<int dim = 3>
bool Intersect ( const Polygon< dim > &  r,
const Segment< dim > &  s,
bool  proper 
)
friend

Definition at line 526 of file polygon_intersect.cpp.

◆ Intersect [2/6]

template<int dim = 3>
bool Intersect ( const RotBox< dim > &  r,
const Segment< dim > &  s,
bool  proper 
)
friend

Definition at line 446 of file intersect.h.

◆ Intersect [3/6]

template<int dim = 3>
bool Intersect ( const Segment< dim > &  s,
const AxisBox< dim > &  b,
bool  proper 
)
friend

Definition at line 216 of file intersect.h.

◆ Intersect [4/6]

template<int dim = 3>
bool Intersect ( const Segment< dim > &  s,
const Ball< dim > &  b,
bool  proper 
)
friend

Definition at line 281 of file intersect.h.

◆ Intersect [5/6]

template<int dim = 3>
bool Intersect ( const Segment< dim > &  s,
const Point< dim > &  p,
bool  proper 
)
friend

Definition at line 194 of file intersect.h.

◆ Intersect [6/6]

template<int dim = 3>
bool Intersect ( const Segment< dim > &  s1,
const Segment< dim > &  s2,
bool  proper 
)
friend

Definition at line 319 of file intersect.h.

◆ operator>>

template<int dim = 3>
std::istream & operator>> ( std::istream &  is,
Segment< dim > &  s 
)
friend

Definition at line 247 of file stream.h.


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