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

A dim dimensional ball. More...

#include <ball.h>

Public Member Functions

 Ball ()
 construct an uninitialized ball More...
 
 Ball (const Point< dim > &center, CoordType radius)
 construct a ball with the given center and radius More...
 
 Ball (const Ball &b)=default
 construct a copy of a ball More...
 
 Ball (const AtlasInType &a)
 Construct a ball from an object passed by Atlas. More...
 
AtlasOutType toAtlas () const
 Create an Atlas object from the box. More...
 
void fromAtlas (const AtlasInType &a)
 Set the box's value to that given by an Atlas object. More...
 
Balloperator= (const Ball &b)=default
 
bool isEqualTo (const Ball &b, CoordType epsilon=numeric_constants< CoordType >::epsilon()) const
 
bool operator== (const Ball &b) const
 
bool operator!= (const Ball &b) const
 
bool isValid () const
 
size_t numCorners () const
 
Point< dim > getCorner (size_t) const
 
Point< dim > getCenter () const
 
const Point< dim > & center () const
 get the center of the ball More...
 
Point< dim > & center ()
 get the center of the ball More...
 
CoordType radius () const
 get the radius of the ball More...
 
CoordTyperadius ()
 get the radius of the ball More...
 
Ballshift (const Vector< dim > &v)
 
BallmoveCornerTo (const Point< dim > &, size_t)
 
BallmoveCenterTo (const Point< dim > &p)
 
BallrotateCorner (const RotMatrix< dim > &, size_t)
 
BallrotateCenter (const RotMatrix< dim > &)
 
BallrotatePoint (const RotMatrix< dim > &m, const Point< dim > &p)
 
BallrotateCorner (const Quaternion &, size_t corner)
 
BallrotateCenter (const Quaternion &)
 
BallrotatePoint (const Quaternion &q, const Point< dim > &p)
 
AxisBox< dim > boundingBox () const
 
Ball boundingSphere () const
 
Ball boundingSphereSloppy () const
 
Ball toParentCoords (const Point< dim > &origin, const RotMatrix< dim > &rotation=RotMatrix< dim >().identity()) const
 
Ball toParentCoords (const AxisBox< dim > &coords) const
 
Ball toParentCoords (const RotBox< dim > &coords) const
 
Ball toLocalCoords (const Point< dim > &origin, const RotMatrix< dim > &rotation=RotMatrix< dim >().identity()) const
 
Ball toLocalCoords (const AxisBox< dim > &coords) const
 
Ball toLocalCoords (const RotBox< dim > &coords) const
 
Ball toParentCoords (const Point< dim > &origin, const Quaternion &rotation) const
 
Ball toLocalCoords (const Point< dim > &origin, const Quaternion &rotation) const
 
Ball< 3 > & rotateCorner (const Quaternion &, size_t)
 
Ball< 3 > & rotateCenter (const Quaternion &)
 
Ball< 3 > & rotatePoint (const Quaternion &q, const Point< 3 > &p)
 
Ball< 3 > toParentCoords (const Point< 3 > &origin, const Quaternion &rotation) const
 
Ball< 3 > toLocalCoords (const Point< 3 > &origin, const Quaternion &rotation) const
 

Friends

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

Detailed Description

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

A dim dimensional ball.

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

This class is called Ball<> instead of Sphere to be more in tune with the usual mathematical naming conventions, where a ball is a filled object, while a sphere is just the outer shell. It also helps that a Ball<n> corresponds to an n-ball, while a Sphere<n> would correspond to an (n-1)-sphere.

Definition at line 34 of file ball.h.

Constructor & Destructor Documentation

◆ Ball() [1/4]

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

construct an uninitialized ball

Definition at line 64 of file ball.h.

◆ Ball() [2/4]

template<int dim = 3>
WFMath::Ball< dim >::Ball ( const Point< dim > &  center,
CoordType  radius 
)
inline

construct a ball with the given center and radius

Definition at line 66 of file ball.h.

References WFMath::Ball< dim >::radius().

◆ Ball() [3/4]

template<int dim = 3>
WFMath::Ball< dim >::Ball ( const Ball< dim > &  b)
default

construct a copy of a ball

◆ Ball() [4/4]

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

Construct a ball from an object passed by Atlas.

Definition at line 318 of file atlasconv.h.

References WFMath::Ball< dim >::fromAtlas().

Member Function Documentation

◆ center() [1/2]

template<int dim = 3>
Point<dim>& WFMath::Ball< dim >::center ( )
inline

get the center of the ball

Definition at line 105 of file ball.h.

◆ center() [2/2]

template<int dim = 3>
const Point<dim>& WFMath::Ball< dim >::center ( ) const
inline

get the center of the ball

Definition at line 103 of file ball.h.

◆ fromAtlas()

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

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

Definition at line 280 of file atlasconv.h.

Referenced by WFMath::Ball< dim >::Ball().

◆ radius() [1/2]

template<int dim = 3>
CoordType& WFMath::Ball< dim >::radius ( )
inline

get the radius of the ball

Definition at line 109 of file ball.h.

◆ radius() [2/2]

template<int dim = 3>
CoordType WFMath::Ball< dim >::radius ( ) const
inline

get the radius of the ball

Definition at line 107 of file ball.h.

Referenced by WFMath::Ball< dim >::Ball().

◆ toAtlas()

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

Create an Atlas object from the box.

Definition at line 309 of file atlasconv.h.


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