Pyrogenesis  13997
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
Public Member Functions | Public Attributes | Static Public Attributes | List of all members
CBoundingBoxOriented Class Reference

#include <BoundingBoxOriented.h>

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()
 

Detailed Description

Definition at line 30 of file BoundingBoxOriented.h.

Constructor & Destructor Documentation

CBoundingBoxOriented::CBoundingBoxOriented ( )
inline

Empty constructor; creates an empty box.

Definition at line 35 of file BoundingBoxOriented.h.

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.

Definition at line 43 of file BoundingBoxOriented.h.

CBoundingBoxOriented::CBoundingBoxOriented ( const CBoundingBoxAligned bound)
explicit

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

Definition at line 27 of file BoundingBoxOriented.cpp.

Member Function Documentation

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.

Definition at line 76 of file BoundingBoxOriented.h.

bool CBoundingBoxOriented::IsEmpty ( ) const
inline

Definition at line 91 of file BoundingBoxOriented.h.

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-Möller, 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.

Definition at line 47 of file BoundingBoxOriented.cpp.

void CBoundingBoxOriented::SetEmpty ( )
inline

Definition at line 81 of file BoundingBoxOriented.h.

Member Data Documentation

const CBoundingBoxOriented CBoundingBoxOriented::EMPTY = CBoundingBoxOriented()
static

Definition at line 108 of file BoundingBoxOriented.h.

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.

Definition at line 106 of file BoundingBoxOriented.h.

CVector3D CBoundingBoxOriented::m_Center

Centroid location of the box.

Definition at line 102 of file BoundingBoxOriented.h.

CVector3D CBoundingBoxOriented::m_HalfSizes

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

Positive values are expected.

Definition at line 103 of file BoundingBoxOriented.h.


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