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

◆ 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.


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