GLC_lib  2.5.0
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
Private Attributes | Static Private Attributes | Friends | List of all members
GLC_BoundingBox Class Reference

GLC_BoundingBox : Geometry bounding box. More...

#include <glc_boundingbox.h>

Public Member Functions

Constructor
 GLC_BoundingBox ()
 Construct an empty bounding box.
 
 GLC_BoundingBox (const GLC_BoundingBox &boundingBox)
 Construct a bounding box from the given bounding box.
 
 GLC_BoundingBox (const GLC_Point3d &lower, const GLC_Point3d &upper)
 Construct a bounding box from the given 3d point.
 
Set Functions
GLC_BoundingBoxcombine (const GLC_Point3d &point)
 Combine this bounding Box with the given 3d point and return a reference of this bounding box.
 
GLC_BoundingBoxcombine (const GLC_Point3df &point)
 Combine this bounding Box with the given 3d point and return a reference of this bounding box.
 
GLC_BoundingBoxcombine (const GLC_BoundingBox &box)
 Combine this bounding Box with the given bounding box and return a reference of this bounding box.
 
GLC_BoundingBoxtransform (const GLC_Matrix4x4 &matrix)
 Transform this bounding Box with the given matrix and return a reference of this bounding box.
 

Private Attributes

GLC_Point3d m_Lower
 Lower corner 3d point.
 
GLC_Point3d m_Upper
 Upper corner 3d point.
 
bool m_IsEmpty
 Flag to know if this bounding box is empty.
 

Static Private Attributes

static quint32 m_ChunkId = 0xA707
 This class chunk id.
 

Friends

GLC_LIB_EXPORT QDataStream & operator<< (QDataStream &, const GLC_BoundingBox &)
 Non-member stream operator.
 
GLC_LIB_EXPORT QDataStream & operator>> (QDataStream &, GLC_BoundingBox &)
 

Get Functions

bool isEmpty (void) const
 Return true if this bounding box is empty.
 
bool intersect (const GLC_Point3d &point) const
 Return true if the given 3d point intersect this bounding box.
 
bool intersect (const GLC_BoundingBox &boundingBox) const
 Return true if the given bounding box intersect this bounding box.
 
bool intersectBoundingSphere (const GLC_Point3d &) const
 Return true if the given 3d point intersect this bounding sphere of bounding box.
 
bool intersectBoundingSphere (const GLC_BoundingBox &) const
 Return true if the given bounding sphere of bounding box intersect the bounding sphere of box bounding box.
 
const GLC_Point3dlowerCorner () const
 Return the lower corner of this bounding box.
 
const GLC_Point3dupperCorner () const
 Return the upper corner of this bounding box.
 
GLC_Point3d center () const
 Return the center of this bounding box.
 
double boundingSphereRadius () const
 Return the radius of this bounding sphere of bounding box.
 
bool operator== (const GLC_BoundingBox &boundingBox)
 Return true if this bounding box is equal of the given bounding box.
 
bool operator!= (const GLC_BoundingBox &boundingBox)
 Return true if this bounding box is not equal of the given bounding box.
 
double xLength () const
 Return the length off this bounding box on x axis.
 
double yLength () const
 Return the length off this bounding box on y axis.
 
double zLength () const
 Return the length off this bounding box on z axis.
 
static quint32 chunckID ()
 Return this class Chunk ID.
 

Detailed Description

GLC_BoundingBox : Geometry bounding box.

An GLC_BoundingBox is a non oriented bounding box

Definition at line 43 of file glc_boundingbox.h.

Constructor & Destructor Documentation

GLC_BoundingBox::GLC_BoundingBox ( )

Construct an empty bounding box.

Definition at line 34 of file glc_boundingbox.cpp.

GLC_BoundingBox::GLC_BoundingBox ( const GLC_BoundingBox boundingBox)

Construct a bounding box from the given bounding box.

Definition at line 42 of file glc_boundingbox.cpp.

GLC_BoundingBox::GLC_BoundingBox ( const GLC_Point3d lower,
const GLC_Point3d upper 
)

Construct a bounding box from the given 3d point.

Definition at line 49 of file glc_boundingbox.cpp.

Member Function Documentation

double GLC_BoundingBox::boundingSphereRadius ( ) const
inline

Return the radius of this bounding sphere of bounding box.

Definition at line 101 of file glc_boundingbox.h.

References GLC_Vector3d::length().

Referenced by GLC_3DViewInstance::choseLod(), intersectBoundingSphere(), GLC_Frustum::localizeBoundingBox(), GLC_Viewport::reframe(), and GLC_OctreeNode::updateViewableInstances().

GLC_Point3d GLC_BoundingBox::center ( void  ) const
inline
quint32 GLC_BoundingBox::chunckID ( )
static

Return this class Chunk ID.

Definition at line 61 of file glc_boundingbox.cpp.

References m_ChunkId.

GLC_BoundingBox & GLC_BoundingBox::combine ( const GLC_Point3d point)
GLC_BoundingBox & GLC_BoundingBox::combine ( const GLC_Point3df point)

Combine this bounding Box with the given 3d point and return a reference of this bounding box.

Definition at line 121 of file glc_boundingbox.cpp.

References m_IsEmpty, m_Lower, m_Upper, GLC_Vector3d::setVect(), GLC_Vector3d::x(), GLC_Vector3d::y(), and GLC_Vector3d::z().

GLC_BoundingBox & GLC_BoundingBox::combine ( const GLC_BoundingBox box)

Combine this bounding Box with the given bounding box and return a reference of this bounding box.

Definition at line 145 of file glc_boundingbox.cpp.

References m_IsEmpty, m_Lower, m_Upper, GLC_Vector3d::setVect(), GLC_Vector3d::x(), GLC_Vector3d::y(), and GLC_Vector3d::z().

bool GLC_BoundingBox::intersect ( const GLC_Point3d point) const

Return true if the given 3d point intersect this bounding box.

Definition at line 66 of file glc_boundingbox.cpp.

References m_IsEmpty, m_Lower, m_Upper, GLC_Vector3d::x(), GLC_Vector3d::y(), and GLC_Vector3d::z().

Referenced by GLC_OctreeNode::intersect(), and intersect().

bool GLC_BoundingBox::intersect ( const GLC_BoundingBox boundingBox) const
inline

Return true if the given bounding box intersect this bounding box.

Definition at line 167 of file glc_boundingbox.h.

References center(), intersect(), GLC_Vector3d::x(), xLength(), GLC_Vector3d::y(), yLength(), GLC_Vector3d::z(), and zLength().

bool GLC_BoundingBox::intersectBoundingSphere ( const GLC_Point3d point) const

Return true if the given 3d point intersect this bounding sphere of bounding box.

Definition at line 82 of file glc_boundingbox.cpp.

References boundingSphereRadius(), and center().

Referenced by GLC_OctreeNode::intersect().

bool GLC_BoundingBox::intersectBoundingSphere ( const GLC_BoundingBox boundingSphere) const

Return true if the given bounding sphere of bounding box intersect the bounding sphere of box bounding box.

Definition at line 88 of file glc_boundingbox.cpp.

References boundingSphereRadius(), and center().

bool GLC_BoundingBox::isEmpty ( void  ) const
inline

Return true if this bounding box is empty.

Definition at line 72 of file glc_boundingbox.h.

Referenced by GLC_OctreeNode::addChildren(), GLC_OctreeNode::addInstance(), GLC_Viewport::reframe(), and GLC_Viewport::setDistMinAndMax().

const GLC_Point3d& GLC_BoundingBox::lowerCorner ( ) const
inline

Return the lower corner of this bounding box.

Definition at line 90 of file glc_boundingbox.h.

Referenced by GLC_OctreeNode::addChildren(), and GLC_Factory::createBox().

bool GLC_BoundingBox::operator!= ( const GLC_BoundingBox boundingBox)
inline

Return true if this bounding box is not equal of the given bounding box.

Definition at line 108 of file glc_boundingbox.h.

bool GLC_BoundingBox::operator== ( const GLC_BoundingBox boundingBox)
inline

Return true if this bounding box is equal of the given bounding box.

Definition at line 182 of file glc_boundingbox.h.

References m_Lower, and m_Upper.

GLC_BoundingBox & GLC_BoundingBox::transform ( const GLC_Matrix4x4 matrix)

Transform this bounding Box with the given matrix and return a reference of this bounding box.

Definition at line 169 of file glc_boundingbox.cpp.

References combine(), m_IsEmpty, m_Lower, m_Upper, GLC_Vector3d::x(), GLC_Vector3d::y(), and GLC_Vector3d::z().

Referenced by GLC_3DViewInstance::computeBoundingBox().

const GLC_Point3d& GLC_BoundingBox::upperCorner ( ) const
inline

Return the upper corner of this bounding box.

Definition at line 94 of file glc_boundingbox.h.

Referenced by GLC_OctreeNode::addChildren(), and GLC_Factory::createBox().

double GLC_BoundingBox::xLength ( ) const
inline

Return the length off this bounding box on x axis.

Definition at line 112 of file glc_boundingbox.h.

Referenced by intersect().

double GLC_BoundingBox::yLength ( ) const
inline

Return the length off this bounding box on y axis.

Definition at line 116 of file glc_boundingbox.h.

Referenced by intersect().

double GLC_BoundingBox::zLength ( ) const
inline

Return the length off this bounding box on z axis.

Definition at line 120 of file glc_boundingbox.h.

Referenced by intersect().

Friends And Related Function Documentation

GLC_LIB_EXPORT QDataStream& operator<< ( QDataStream &  ,
const GLC_BoundingBox  
)
friend

Non-member stream operator.

Definition at line 210 of file glc_boundingbox.cpp.

GLC_LIB_EXPORT QDataStream& operator>> ( QDataStream &  ,
GLC_BoundingBox  
)
friend

Definition at line 222 of file glc_boundingbox.cpp.

Member Data Documentation

quint32 GLC_BoundingBox::m_ChunkId = 0xA707
staticprivate

This class chunk id.

Definition at line 159 of file glc_boundingbox.h.

Referenced by chunckID(), operator<<(), and operator>>().

bool GLC_BoundingBox::m_IsEmpty
private

Flag to know if this bounding box is empty.

Definition at line 156 of file glc_boundingbox.h.

Referenced by combine(), intersect(), operator<<(), operator>>(), and transform().

GLC_Point3d GLC_BoundingBox::m_Lower
private

Lower corner 3d point.

Definition at line 150 of file glc_boundingbox.h.

Referenced by center(), combine(), intersect(), operator<<(), operator==(), operator>>(), and transform().

GLC_Point3d GLC_BoundingBox::m_Upper
private

Upper corner 3d point.

Definition at line 153 of file glc_boundingbox.h.

Referenced by center(), combine(), intersect(), operator<<(), operator==(), operator>>(), and transform().


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

©2005-2013 Laurent Ribon