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

A dim dimensional line. More...

#include <line.h>

Public Member Functions

 Line (const Line< dim > &l)=default
 
 Line (const AtlasInType &a)
 
AtlasOutType toAtlas () const
 Create an Atlas object from the line. More...
 
void fromAtlas (const AtlasInType &a)
 Set the line's value to that given by an Atlas object. More...
 
Lineoperator= (const Line &a)=default
 
bool isEqualTo (const Line &s, CoordType epsilon=numeric_constants< CoordType >::epsilon()) const
 generic: check if two classes are equal, up to a given tolerance More...
 
bool operator== (const Line &s) const
 generic: check if two classes are equal, up to tolerance WFMATH_EPSILON More...
 
bool operator!= (const Line &s) const
 generic: check if two classes are not equal, up to tolerance WFMATH_EPSILON More...
 
bool isValid () const
 generic: returns true if the class instance has been initialized More...
 
size_t numCorners () const
 shape: return the number of corners in the shape. More...
 
Point< dim > getCorner (size_t i) const
 shape: return the position of the i'th corner, where 0 <= i < numCorners() More...
 
Point< dim > getCenter () const
 shape: return the position of the center of the shape More...
 
bool addCorner (size_t i, const Point< dim > &p, CoordType=numeric_constants< CoordType >::epsilon())
 
void removeCorner (size_t i)
 
bool moveCorner (size_t i, const Point< dim > &p, CoordType=numeric_constants< CoordType >::epsilon())
 
Lineshift (const Vector< dim > &v)
 shape: move the shape by an amount given by the Vector v More...
 
LinemoveCornerTo (const Point< dim > &p, size_t corner)
 shape: move the shape, moving the given corner to the Point p More...
 
LinemoveCenterTo (const Point< dim > &p)
 shape: move the shape, moving the center to the Point p More...
 
LinerotateCorner (const RotMatrix< dim > &m, size_t corner)
 shape: rotate the shape while holding the given corner fixed More...
 
LinerotateCenter (const RotMatrix< dim > &m)
 shape: rotate the shape while holding the center fixed More...
 
LinerotatePoint (const RotMatrix< dim > &m, const Point< dim > &p)
 shape: rotate the shape while holding the Point p fixed. More...
 
AxisBox< dim > boundingBox () const
 
Ball< dim > boundingSphere () const
 
Ball< dim > boundingSphereSloppy () const
 

Detailed Description

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

A dim dimensional line.

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

Definition at line 42 of file line.h.

Constructor & Destructor Documentation

◆ Line()

template<int dim>
WFMath::Line< dim >::Line ( const AtlasInType a)
inlineexplicit

Definition at line 447 of file atlasconv.h.

Member Function Documentation

◆ addCorner()

template<int dim = 3>
bool WFMath::Line< dim >::addCorner ( size_t  i,
const Point< dim > &  p,
CoordType  = numeric_constants<CoordType>::epsilon() 
)
inline

Definition at line 87 of file line.h.

◆ boundingBox()

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

Definition at line 135 of file line.h.

◆ boundingSphere()

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

Definition at line 136 of file line.h.

◆ boundingSphereSloppy()

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

Definition at line 137 of file line.h.

◆ fromAtlas()

template<int dim>
void WFMath::Line< dim >::fromAtlas ( const AtlasInType a)
inline

Set the line's value to that given by an Atlas object.

Definition at line 412 of file atlasconv.h.

◆ getCenter()

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

shape: return the position of the center of the shape

Definition at line 84 of file line.h.

References WFMath::Barycenter().

Referenced by WFMath::Line< dim >::moveCenterTo(), and WFMath::Line< dim >::rotateCenter().

◆ getCorner()

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

shape: return the position of the i'th corner, where 0 <= i < numCorners()

Definition at line 82 of file line.h.

Referenced by WFMath::Line< dim >::moveCornerTo(), and WFMath::Line< dim >::rotateCorner().

◆ isEqualTo()

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

generic: check if two classes are equal, up to a given tolerance

Definition at line 34 of file line_funcs.h.

Referenced by WFMath::Line< dim >::operator!=(), and WFMath::Line< dim >::operator==().

◆ isValid()

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

generic: returns true if the class instance has been initialized

Definition at line 70 of file line.h.

◆ moveCenterTo()

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

shape: move the shape, moving the center to the Point p

The center is defined by getCenter()

Definition at line 112 of file line.h.

References WFMath::Line< dim >::getCenter(), and WFMath::Line< dim >::shift().

◆ moveCorner()

template<int dim = 3>
bool WFMath::Line< dim >::moveCorner ( size_t  i,
const Point< dim > &  p,
CoordType  = numeric_constants<CoordType>::epsilon() 
)
inline

Definition at line 93 of file line.h.

◆ moveCornerTo()

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

shape: move the shape, moving the given corner to the Point p

The corner in question is getCorner(corner).

Definition at line 106 of file line.h.

References WFMath::Line< dim >::getCorner(), and WFMath::Line< dim >::shift().

◆ numCorners()

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

shape: return the number of corners in the shape.

For many shape classes, this is a fixed constant

Definition at line 80 of file line.h.

◆ operator!=()

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

generic: check if two classes are not equal, up to tolerance WFMATH_EPSILON

Definition at line 67 of file line.h.

References WFMath::Line< dim >::isEqualTo().

◆ operator==()

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

generic: check if two classes are equal, up to tolerance WFMATH_EPSILON

Definition at line 65 of file line.h.

References WFMath::Line< dim >::isEqualTo().

◆ removeCorner()

template<int dim = 3>
void WFMath::Line< dim >::removeCorner ( size_t  i)
inline

Definition at line 91 of file line.h.

◆ rotateCenter()

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

shape: rotate the shape while holding the center fixed

The center is defined by getCenter()

Definition at line 126 of file line.h.

References WFMath::Line< dim >::getCenter(), and WFMath::Line< dim >::rotatePoint().

◆ rotateCorner()

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

shape: rotate the shape while holding the given corner fixed

The corner in question is getCorner(corner).

Definition at line 120 of file line.h.

References WFMath::Line< dim >::getCorner(), and WFMath::Line< dim >::rotatePoint().

◆ rotatePoint()

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

shape: rotate the shape while holding the Point p fixed.

Note that p can be any Point, it does not have to lie within the shape.

Definition at line 61 of file line_funcs.h.

Referenced by WFMath::Line< dim >::rotateCenter(), and WFMath::Line< dim >::rotateCorner().

◆ shift()

template<int dim>
Line< dim > & WFMath::Line< dim >::shift ( const Vector< dim > &  v)
inline

shape: move the shape by an amount given by the Vector v

Definition at line 51 of file line_funcs.h.

Referenced by WFMath::Line< dim >::moveCenterTo(), and WFMath::Line< dim >::moveCornerTo().

◆ toAtlas()

template<int dim>
AtlasOutType WFMath::Line< dim >::toAtlas
inline

Create an Atlas object from the line.

Definition at line 434 of file atlasconv.h.


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