Pyrogenesis HEAD
Pyrogenesis, a RTS Engine
CBoundingBoxOriented Class Reference

#include <BoundingBoxOriented.h>

Collaboration diagram for CBoundingBoxOriented:

Public Member Functions

 CBoundingBoxOriented ()
 Empty constructor; creates an empty box. More...
 
 CBoundingBoxOriented (const CVector3D &center, const CVector3D &u, const CVector3D &v, const CVector3D &w, const CVector3D &halfSizes)
 Constructs a new oriented box centered at center and with normalized side vectors u, v and w. More...
 
 CBoundingBoxOriented (const CBoundingBoxAligned &bound)
 Constructs a new box from an axis-aligned bounding box (AABB). More...
 
bool RayIntersect (const CVector3D &origin, const CVector3D &dir, float &tMin, float &tMax) const
 Check if a given ray intersects this box. More...
 
void GetCorner (int u, int v, int w, CVector3D &out) const
 Returns the corner at coordinate (u, v, w). More...
 
void SetEmpty ()
 
bool IsEmpty () const
 

Public Attributes

CVector3D m_Center
 Centroid location of the box. More...
 
CVector3D m_HalfSizes
 Half the sizes of the box in each dimension (u,v,w). More...
 
CVector3D m_Basis [3]
 Basis vectors (u,v,w) of the sides. More...
 

Static Public Attributes

static const CBoundingBoxOriented EMPTY = CBoundingBoxOriented()
 

Constructor & Destructor Documentation

◆ CBoundingBoxOriented() [1/3]

CBoundingBoxOriented::CBoundingBoxOriented ( )
inline

Empty constructor; creates an empty box.

◆ CBoundingBoxOriented() [2/3]

CBoundingBoxOriented::CBoundingBoxOriented ( const CVector3D center,
const CVector3D u,
const CVector3D v,
const CVector3D w,
const CVector3D halfSizes 
)
inline

Constructs a new oriented box centered at center and with normalized side vectors u, v and w.

These vectors should be mutually orthonormal for a proper rectangular box. The half-widths of the box in each dimension are given by the corresponding components of halfSizes.

◆ CBoundingBoxOriented() [3/3]

CBoundingBoxOriented::CBoundingBoxOriented ( const CBoundingBoxAligned bound)
explicit

Constructs a new box from an axis-aligned bounding box (AABB).

Member Function Documentation

◆ GetCorner()

void CBoundingBoxOriented::GetCorner ( int  u,
int  v,
int  w,
CVector3D out 
) const
inline

Returns the corner at coordinate (u, v, w).

Each of u, v and w must be exactly 1 or -1. Must not be used if IsEmpty() is true.

◆ IsEmpty()

bool CBoundingBoxOriented::IsEmpty ( ) const
inline

◆ RayIntersect()

bool CBoundingBoxOriented::RayIntersect ( const CVector3D origin,
const CVector3D dir,
float &  tMin,
float &  tMax 
) const

Check if a given ray intersects this box.

Must not be used if IsEmpty() is true. See Real-Time Rendering, Third Edition by T. Akenine-Moller, p. 741–744.

Parameters
[in]originOrigin of the ray.
[in]dirDirection vector of the ray, defining the positive direction of the ray. Must be of unit length.
[out]tMin,tMaxDistance in the positive direction from the origin of the ray to the entry and exit points in the box, provided that the ray intersects the box. if the ray does not intersect the box, no values are written to these variables. If the origin is inside the box, then this is counted as an intersection and one of tMin and tMax may be negative.
Returns
true If the ray originating in origin and with unit direction vector dir intersects this box, false otherwise.

◆ SetEmpty()

void CBoundingBoxOriented::SetEmpty ( )
inline

Member Data Documentation

◆ EMPTY

const CBoundingBoxOriented CBoundingBoxOriented::EMPTY = CBoundingBoxOriented()
static

◆ m_Basis

CVector3D CBoundingBoxOriented::m_Basis[3]

Basis vectors (u,v,w) of the sides.

Must always be normalized, and should be orthogonal for a proper rectangular cuboid.

◆ m_Center

CVector3D CBoundingBoxOriented::m_Center

Centroid location of the box.

◆ m_HalfSizes

CVector3D CBoundingBoxOriented::m_HalfSizes

Half the sizes of the box in each dimension (u,v,w).

Positive values are expected.


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