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

A coordinate-parallel bounding box in three dimensions. More...

#include <elementary/aerie/BoundingBox.hpp>

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

Public Member Functions

 BoundingBox ()
 Default constructor, initializes the bounding box to be placed at (0,0,0) with size zero.
 
 BoundingBox (const point_t &Center, double EdgeLength)
 Initialize a bounding box from a center point and extent.
 
 BoundingBox (const point_t &minCoord, const point_t &maxCoord)
 Initialize a bounding box from two corner points.
 
void buffer (const tvector_t &buf)
 Expand the bounding box range by the given tvector.
 
tvector_t diagonal () const
 Compute the diagonal vector, max - min.
 
void embrace (const point_t &crd)
 Expand the bounding box range to encompass the given coordinate.
 
point_t findClosestPoint (const point_t &P) const
 Find the point on the box that is closest to the given point.
 
point3 getCornerPoint (int N) const
 Get the Nth point of the bounding box, where N is a number between zero and seven.
 
point_t getLocation (double x, double y, double z) const
 Compute a point relative to the given bounding box, the coordinates are in values 0.0 to 1.0 for points within the box.
 
point_t getLocation11 (double x, double y, double z) const
 Compute a point relative to the given bounding box, the coordinates are in values -1.0 to 1.0 for points within the box.
 
void grow (const double &buf)
 Expand the bounding box range by the given ratio.
 
void insert (const BoundingBox &BB)
 Expand the bounding box range to encompass the given bounding box.
 
bool inside (const BoundingBox &bb) const
 Check whether another bounding box resides within the bounding box.
 
bool inside (const BoundingBox &bb, const char &normal_direction) const
 Check whether another bounding box resides within the bounding box.
 
bool inside (const point_t &p) const
 Check whether a specific point resides within the bounding box.
 
bool inside (const point_t &p, const char &normal_direction) const
 Check whether a specific point resides within the bounding box.
 
const point_tmaxcoord () const
 The maximal coordinate, upper right back corner.
 
const point_tmincoord () const
 The minimal coordinate, lower left front corner.
 
bool operator!= (const BoundingBox &Other) const
 Check bounding boxes for inequality.
 
MemCore::RefPtr< BoundingBoxoperator& (const BoundingBox &Other) const
 return intersection of two bboxes
 
bool operator== (const BoundingBox &Other) const
 Check bounding boxes for equality.
 
void setMinMax (const point_t &minCoord, const point_t &maxCoord)
 Overwrite the current values and set new ones. Updates the bounding ball automaticall.
 
void updateBall ()
 Compute the bounding sphere parameters of the base class.
 
- Public Member Functions inherited from Eagle::BoundingBall
 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.
 
- Public Member Functions inherited from Eagle::PhysicalSpace::AABB
tvector diagonal () const
 Compute the diagonal vector, max - min.
 
point findClosestPoint (const point &P) const
 Find the point on the box that is closest to the given point.
 
point getLocation (double x, double y, double z) const
 Compute a point relative to the given bounding box, the coordinates are in values 0.0 to 1.0 for points within the box.
 
bool isInside (const AABB &bb) const
 Check whether another bounding box resides within the bounding box.
 
bool isInside (const point &p) const
 Check whether a specific point resides within the bounding box.
 
pointmax ()
 The maximal coordinate, upper right back corner (by convention, second element)
 
const pointmax () const
 The maximal coordinate, upper right back corner (by convention, second element)
 
pointmin ()
 The minimal coordinate, lower left front corner (by convention, first element)
 
const pointmin () const
 The minimal coordinate, lower left front corner (by convention, first element)
 
void resort ()
 Ensure min() < max() for all components by checking and resorting.
 

Protected Member Functions

 ~BoundingBox ()
 Destructor made protected such that there are no explicit instances of BoundingBox objects allowed.
 
- Protected Member Functions inherited from Eagle::BoundingBall
 ~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.
 

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.
 
- Static Public Member Functions inherited from Eagle::PhysicalSpace::AABB
static point getBoundingBoxVertex (point vertex, const point &max_values, const bivector &normal)
 Get BoundingBox vertex that is further along normal’s direction of the plane.
 

Detailed Description

A coordinate-parallel bounding box in three dimensions.

Bounding boxes are derived from bounding balls, which may be used as base classes providing simpler, and more symmetric information. Consequently, any time a bounding box is updated, also the bounding ball information needs to be updated, because such is not computed on demand for performance reasons. Do so by explictely calling updateBall() after a set of points as been included in the bounding box.

Examples
QuadDemo.cpp.

Constructor & Destructor Documentation

◆ BoundingBox()

Eagle::BoundingBox::BoundingBox ( )

Default constructor, initializes the bounding box to be placed at (0,0,0) with size zero.

The empty() member function will return true, like in any case of a bounding box having volume zero.

Referenced by operator&().

Member Function Documentation

◆ buffer()

void Eagle::BoundingBox::buffer ( const tvector_t buf)
inline

Expand the bounding box range by the given tvector.

Need to call updateBall() afterwards.

◆ embrace()

void Eagle::BoundingBox::embrace ( const point_t crd)
inline

Expand the bounding box range to encompass the given coordinate.

Need to call updateBall() afterwards.

◆ getCornerPoint()

point3 Eagle::BoundingBox::getCornerPoint ( int  N) const
inline

Get the Nth point of the bounding box, where N is a number between zero and seven.

This is a fast bit operation. Numerical values larger than N are not relevant, only the lower three bits are taken into consideration.

◆ grow()

void Eagle::BoundingBox::grow ( const double &  buf)
inline

Expand the bounding box range by the given ratio.

Need to call updateBall() afterwards.

◆ insert()

void Eagle::BoundingBox::insert ( const BoundingBox BB)
inline

Expand the bounding box range to encompass the given bounding box.

Need to call updateBall() afterwards.

◆ inside() [1/2]

bool Eagle::BoundingBox::inside ( const BoundingBox bb,
const char &  normal_direction 
) const

Check whether another bounding box resides within the bounding box.

Attention: one dimension ('x', 'y' or 'z' is skipped)

◆ inside() [2/2]

bool Eagle::BoundingBox::inside ( const point_t p,
const char &  normal_direction 
) const

Check whether a specific point resides within the bounding box.

Attention: one dimension ('x', 'y' or 'z' is skipped)

◆ operator!=()

bool Eagle::BoundingBox::operator!= ( const BoundingBox Other) const

Check bounding boxes for inequality.

Todo:
: implement this function (also in AABB.hpp) return union of two bboxes