The Vish Visualization Shell 0.3
Vish
Public Member Functions | Protected Member Functions | Friends | List of all members
Eagle::BoundingBall Class Reference

Bounding container implemented by a ball. More...

#include <elementary/aerie/BoundingBall.hpp>

Inheritance diagram for Eagle::BoundingBall:
MemCore::Interface< BoundingBall > MemCore::Ageable MemCore::InterfaceBase MemCore::ReferenceBase< InterfaceBase > Eagle::BoundingBox

Public Member Functions

 BoundingBall ()
 Default bounding ball, sets radius to zero, center to (0,0,0)
 
 BoundingBall (const BoundingBall &BB)
 Copy constructor.
 
 BoundingBall (const point_t &Center, double R)
 Construct with Center and Radius.
 
 BoundingBall (double R, const point_t &Center)
 Construct with Radius and Center.
 
point_tcenter ()
 The center of the bounding ball, lvalue.
 
void expandBall (const BoundingBall &B)
 Expand a ball by another ball.
 
void expandBall (const point_t &point)
 Expand ball by point, using the algorithm http://geometryalgorithms.com/Archive/algorithm_0107/algorithm_0107.htm#fastBall() .
 
const point_tgetCenter () const
 The center of the bounding ball.
 
double getRadius () const
 The radius of the bounding ball.
 
double radius () const
 The radius of the bounding ball.
 
double radius2 () const
 The squared radius of the bounding ball.
 
void setCenter (const point_t &center)
 Set the center of the bounding ball.
 
void setRadius (double R)
 The radius of the bounding ball.
 
- Public Member Functions inherited from MemCore::Interface< BoundingBall >
const type_info & getInterfaceDomain () const
 Run-time information about the type used for InterCube registration.
 
- Public Member Functions inherited from MemCore::InterfaceBase
virtual bool apply (Intercube &I, const RefPtr< InterfaceIterationParameter > &)
 modifyable callback function
 
virtual bool apply_const (const Intercube &I, const RefPtr< InterfaceIterationParameter > &)
 constant callback function
 
 InterfaceBase () throw ()
 Constructor.
 
- Public Member Functions inherited from MemCore::ReferenceBase< InterfaceBase >
auto getObjectCountID () const noexcept
 Get a unique ID for this object in the given domain.
 
bool isIdentical (const WeakPtr< InterfaceBase, InterfaceBase > &PossibleSelf) const noexcept
 Check if this object is identical to the one used by the given pointer.
 
void mkAutoDestructive ()
 Marks this object as being automatically destructed, e.g.
 
refcount_t refcount () const noexcept
 The strong reference count.
 
 ReferenceBase (InterfaceBase *that) noexcept
 Constructor, initializes reference counter to zero.
 
const auto & self () const
 Return weak pointer to the object self.
 
refcount_t wrefcount () const noexcept
 The weak reference count.
 
- Public Member Functions inherited from MemCore::Ageable
 Ageable () noexcept
 Constructor; remembers birth time from current time counter.
 
constexpr Ageable (age_t t) noexcept
 Constructor with explicit time value.
 
constexpr Ageable (const Ageable &A) noexcept
 Copy constructor.
 
 Ageable (const volatile Ageable &A) noexcept
 Copy constructor.
 
constexpr const AgeablegetAge () const
 Return reference to this age, useful for derived classes.
 
bool isNewerThan (const Ageable &a) const noexcept
 Comparison operator.
 
bool isOlderThan (const Ageable &a) const noexcept
 Comparison operator.
 
bool isYoungerThan (const Ageable &a) const noexcept
 Comparison operator (alias to isNewerThan() )
 
bool operator!= (const Ageable &a) const noexcept
 Comparison operator.
 
bool operator< (const Ageable &a) const noexcept
 Comparison operator.
 
bool operator<= (const Ageable &a) const noexcept
 Comparision operator.
 
bool operator<= (const volatile Ageable &a) const volatile noexcept
 Comparision operator.
 
bool operator== (const Ageable &a) const noexcept
 Comparison operator.
 
bool operator> (const Ageable &a) const noexcept
 Comparison operator.
 
bool operator> (const volatile Ageable &a) const volatile throw ()
 Comparision operator.
 
bool operator>= (const Ageable &a) const noexcept
 Comparision operator.
 
bool operator>= (const volatile Ageable &a) const volatile noexcept
 Comparison operator.
 
constexpr void resetAge () noexcept
 Set time value to InfinitelyOld().
 
void setInfinitelyNew () noexcept
 Set time value to InfinitelyOld().
 
age_t time_value () const noexcept
 Return an object's current age.
 
age_t time_value () const volatile noexcept
 Return an object's current age.
 
Ageabletouch () noexcept
 Mark the current object as being modified "now".
 
age_t update (age_t age) noexcept
 Set the age of the current object to a specific age if that is newer than the current one.
 
age_t update (const Ageable &Other) noexcept
 Set the age of the current object to the age of another object if that other one is newer than the current one.
 
age_t update (const volatile Ageable &Other) volatile noexcept
 Set the age of the current object to the age of another object if that other one is newer than the current one.
 
 ~Ageable () noexcept
 Destructor.
 

Protected Member Functions

 ~BoundingBall ()
 Destructor.
 
- Protected Member Functions inherited from MemCore::InterfaceBase
 ~InterfaceBase ()
 Destructor.
 
- Protected Member Functions inherited from MemCore::ReferenceBase< InterfaceBase >
virtual void extremeUnction ()
 A virtual function that will be called just before the object is destroyed.
 
ReferenceBaseoperator= (const ReferenceBase &R)
 Protected assignment operator (should not be called).
 
void suicide ()
 Delete this.
 
virtual ~ReferenceBase ()
 Virtual destructor.
 

Friends

bool operator& (const BoundingBall &A, const BoundingBall &B)
 Operator version to check whether two bounding balls overlap.
 
bool overlap (const BoundingBall &, const BoundingBall &)
 Check whether two bounding balls overlap.
 

Additional Inherited Members

- Public Types inherited from MemCore::Interface< BoundingBall >
using InterfaceDomain_t = BoundingBall
 Compile-time information about the type used for InterCube registration.
 
- Public Types inherited from MemCore::ReferenceBase< InterfaceBase >
using reference_domain_t = InterfaceBase
 The type of the base class.
 
using SelfPtr_t = WeakPtr< InterfaceBase, InterfaceBase >
 Type for a pointer to this object itself.
 
- Static Public Member Functions inherited from MemCore::Ageable
static const AgeableInfinitelyNew () noexcept
 Return a time that is infinitely in the future (well, sort of).
 
static constexpr const AgeableInfinitelyOld () noexcept
 Return a time that is infinitely in the past (well, sort of).
 
static age_t now () noexcept
 Return the current global time.
 

Detailed Description

Bounding container implemented by a ball.

See also http://geometryalgorithms.com/Archive/algorithm_0107/algorithm_0107.htm

Member Function Documentation

◆ expandBall() [1/2]

void Eagle::BoundingBall::expandBall ( const BoundingBall B)

Expand a ball by another ball.

Note that this function is not necessarily the fastest.

Todo:
Check whether there is a faster way to implement void BoundingBall::expandBall(const BoundingBall&B)

References expandBall(), and Eagle::norm().

◆ expandBall() [2/2]

void Eagle::BoundingBall::expandBall ( const point_t point)

Expand ball by point, using the algorithm http://geometryalgorithms.com/Archive/algorithm_0107/algorithm_0107.htm#fastBall() .

This algorithm is pretty slow (even though it is called fastBall ), as it involves a sqrt() function call and several vector operations. If speed is crucial, better use a BoundingBox to expand by points, and then use a global operation BoundingBox::updateBall() to compute the bounding ball. However, the bounding ball computed this way will be not as tight around the points like a ball built from expandBall() calls.

Note
If the point is contained int the ball, then the cost of this function is (6add,3mul) operations. If not, then the cost is increased by (1sqrt, 5add, 6mul).

References Eagle::norm2().

Referenced by expandBall().