NSMath::TAABBox Struct Reference

TAABBox class. More...

#include <AABBox.h>

Inheritance diagram for NSMath::TAABBox:

Inheritance graph
[legend]
Collaboration diagram for NSMath::TAABBox:

Collaboration graph
[legend]
List of all members.

Public Member Functions

 TAABBox (void)
 Creates AABB with points [0,0,0] - [1,1,1].
 TAABBox (const TAABBox &aabb)
 Copy constructor.
 TAABBox (const TVector3 &lb, const TVector3 &rt)
 Create this AABB from two points.
 TAABBox (const TVector3 &p1, const TVector3 &p2, bool)
 Create this AABB from two arbitrary points.
 TAABBox (const TVector3 &lb, const float &widthX, const float &lengthY, const float &heightZ)
 Create this AABB from left-bottom point and width, length and height.
 TAABBox (const TSphere &sphere)
 Create box from sphere.
 TAABBox (const TBox &box)
 Create box from OBB.
const TVector3GetLB (void) const
 Returns left-bottom point from this AABB.
const TVector3GetRT (void) const
 Returns right-top point from this AABB.
float GetMinX (void) const
 Returns minimal X-coordinate that exists in this box.
float GetMinY (void) const
 Returns minimal Y-coordinate that exists in this box.
float GetMinZ (void) const
 Returns minimal Z-coordinate that exists in this box.
float GetMaxX (void) const
 Returns maximal X-coordinate that exists in this box.
float GetMaxY (void) const
 Returns maximal Y-coordinate that exists in this box.
float GetMaxZ (void) const
 Returns maximal Z-coordinate that exists in this box.
void GetMinXYZ (TVector3 &cmin) const
 Return minimal coordinates contained inside this box.
void GetMaxXYZ (TVector3 &cmax) const
 Return maximal coordinates contained inside this box.
void GetMinMaxXYZ (TVector3 &cmin, TVector3 &cmax) const
 Return minimal and maximal coordinates contained inside this box.
void Set (const TAABBox &aabb)
 Set this box according to another box.
void Set (const TVector3 &lb, const TVector3 &rt)
 Set this AABB from two points.
void Set (const TVector3 &lb, const float &widthX, const float &lengthY, const float &heightZ)
 Set this AABB from left-bottom point and width, length and height.
void SetFromPoints (const TVector3 &p1, const TVector3 &p2)
 This method sets AABB from two points.
void SetFromPoints (const TVector3 *points, const DWORD &count)
 Set this box from array of points.
TPlane GetPlaneLeft (void) const
 Returns left plane of this AABB.
void GetPlaneLeft (TPlane &res) const
 Compute left plane of this AABB and store it in parameter.
TPlane GetPlaneRight (void) const
 Returns right plane of this AABB.
void GetPlaneRight (TPlane &res) const
 Compute right plane of this AABB and store it in parameter.
TPlane GetPlaneFront (void) const
 Returns front plane of this AABB.
void GetPlaneFront (TPlane &res) const
 Compute front plane of this AABB and store it in parameter.
TPlane GetPlaneBack (void) const
 Returns back plane of this AABB.
void GetPlaneBack (TPlane &res) const
 Compute back plane of this AABB and store it in parameter.
TPlane GetPlaneBottom (void) const
 Returns bottom plane of this AABB.
void GetPlaneBottom (TPlane &res) const
 Compute bottom plane of this AABB and store it in parameter.
TPlane GetPlaneTop (void) const
 Returns top plane of this AABB.
void GetPlaneTop (TPlane &res) const
 Compute top plane of this AABB and store it in parameter.
void GetPointsAll (TVector3 points[8]) const
 Method creates and return all points which represent this AABB.
void GetPointsAllRelativeTo (TVector3 points[8], const TVector3 &origin) const
 Method creates and return all points which represent this AABB.
void GetPointsRequired (TVector3 points[6]) const
 Method creates and return required points which represent this AABB.
void GetPointsRequiredRelativeTo (TVector3 points[6], const TVector3 &origin) const
 Method creates and return required points which represent this AABB.
TBox ToBox (void) const
 Convert this box to OBB.
TSphere ToSphere (void) const
 Convert this box to sphere.
void Translate (const TVector3 &vec)
 Translate this AABB about specified vector.
void Translate (const float &x, const float &y, const float &z)
 Translate this AABB about specified vector [x,y,z].
void MoveToLB (const TVector3 &vec)
 Translate this AABB to position where LEFT-BOTTOM point will have coordinates VEC.
void MoveToLB (const float &x, const float &y, const float &z)
 Translate this AABB to position where LEFT-BOTTOM point will have coordinates [x,y,z].
void ScaleFromCenter (const float &scale)
 Scale this AABB from center thus all definition point will be moved.
void ScaleFromLB (const float &scale)
 Scale this AABB from left-bottom corner thus this point will not change.
float DistanceSurface (const TVector3 &vec) const
 Compute smallest distance between given point and surface of this box.
float DistanceSurfaceSquare (const TVector3 &vec) const
 Compute square of smallest distance between given point and surface of this box.
float Width (void) const
 Compute width - size in X-axis.
float Length (void) const
 Compute length - size in Y-axis.
float Height (void) const
 Compute height - size in Z-axis.
TVector3 Extents (void) const
 Compute extents of this box.
TVector3 Center (void) const
 Compute center of this AABB.
float Radius (void) const
 Compute radius of this AABB.
float RadiusSquare (void) const
 Compute square of radius of this AABB.
float RadiusInner (void) const
 Compute inner radius of this AABB.
float RadiusInnerSquare (void) const
 Compute square of inner radius of this AABB.
float Surface (void) const
 Compute surface area of this box.
float Volume (void) const
 Compute volume of this box.
BOOL AddPoint (const TVector3 &vec)
 "Add" point to this box and if point don't belong to this box then is box expanded.
BOOL AddAABBox (const TAABBox &aabb)
 "Add" another AABB to this box and expand this box if second box don't belongs entire into this box.
float ProjectExtentsToAxis (const TVector3 &axisDir) const
 This method projects extents of this box to specified axis that is determined only via its directional vector (thus it goes through origin of space).
void ProjectToAxis (const TVector3 &axisDir, float &timeMin, float &timeMax) const
 This method projects AABB to specified axis determined only directional vector (thus axis goes through origin of space.
void ProjectToLine (const TLine &line, float &timeMin, float &timeMax) const
 This method projects AABB to specified line.
void ProjectToLineSegment (const TLineSegment &seg, float &timeMin, float &timeMax) const
 This method projects AABB to specified line segment.
void ProjectToLineSegmentNormalized (const TLineSegment &seg, float &timeMin, float &timeMax) const
 This method projects AABB to specified line segment in NORMALIZED coordinated!!!
void ProjectToRay (const TRay &ray, float &timeMin, float &timeMax) const
 This method projects AABB to specified ray.
BOOL Compare (const TAABBox &aabb) const
 Compare this AABB with another one with default tolerancy TVector3::DELTA_COMPARE.
BOOL Compare (const TAABBox &aabb, const float &delta) const
 Compare this AABB with another one with given tolerancy.
BOOL ComparePrecise (const TAABBox &aabb) const
 Compare this AABB with another one very precisly (bit to bit).
BOOL IsInside (const TVector3 &pt) const
 This method determines whether specified point is inside this box.
BOOL IsInside (const TAABBox &aabb) const
 Determines whether specified AABB is entire inside this AABB.
BOOL IsInside (const TSphere &sphere) const
 This method determines whether given sphere is entire contained inside this AABB.
BOOL IsInside (const TBox &box) const
 This method determines whether given OBB is entire contained inside this AABB.
BOOL IsIntersect (const TLineSegment &seg) const
 This method tests whether given line segment intersects this AABB.
BOOL IsIntersect (const TVector3 &start, const TVector3 &end) const
 This class determines whether given line segment represented by START and STOP point intersects this box.
BOOL IsIntersect (const TRay &ray) const
 This method tests whether given ray intersects this AABB.
BOOL IsIntersect (const TLine &line) const
 This method determines whether specified line intersects this AABB.
BOOL IsIntersect (const TPlane &plane) const
 Determines whether this box has intersection with plane.
BOOL IsIntersect (const TAABBox &aabb) const
 Determines whether specified AABB has intersection with this AABB.
BOOL IsIntersect (const TSphere &sphere) const
 Determines whether given sphere intersects this AABB.
BOOL IsIntersect (const TBox &box) const
 Determines whether given OBB intersects this AABB.
BOOL IsIntersectAABB (const TAABBox &aabb, TAABBox &res) const
 Method determines whether this box intersects with another box and if so then return TRUE and new box created as result of intersection.
TAABBoxoperator= (const TAABBox &aabb)
 Assignment operator.
BOOL operator== (const TAABBox &aabb) const
 Equality operator.
BOOL operator!= (const TAABBox &aabb) const
 Inequality operator.
TAABBoxoperator+= (const TVector3 &vec)
 Move this box about specified offset.
TAABBoxoperator-= (const TVector3 &vec)
 Move this box about specified offset in opposite direction.

Detailed Description

TAABBox class.

This class represents axis aligned bounding box (AABB). It's represented by two points - LB and RT.

LB is left-bottom point - it contain minimal values for X,Y and Z axis. RT is right-top point - it contain maximal values for X,Y and Z axis.

Dimension of TAABBox are named as WIDTH (for X-axis), LENGTH (for Y-axis) and HEIGHT (for Z-axis).

Definition at line 58 of file AABBox.h.


Constructor & Destructor Documentation

TAABBox::TAABBox void   )  [inline]
 

Creates AABB with points [0,0,0] - [1,1,1].

Definition at line 222 of file AABBox.h.

TAABBox::TAABBox const TAABBox aabb  )  [inline]
 

Copy constructor.

Parameters:
aabb [in] original AABB

Definition at line 233 of file AABBox.h.

References m_lb, m_rt, and Set().

Here is the call graph for this function:

TAABBox::TAABBox const TVector3 lb,
const TVector3 rt
[inline, explicit]
 

Create this AABB from two points.

Warning:
All components of LB point must be less than corresponding components in RT point!!!
Parameters:
lb [in] left-bottom point (it contains minimal coordinates)
rt [in] right-top point (it contains maximal coordinates)

Definition at line 246 of file AABBox.h.

References Set().

Here is the call graph for this function:

TAABBox::TAABBox const TVector3 p1,
const TVector3 p2,
bool 
[inline, explicit]
 

Create this AABB from two arbitrary points.

Constructor automatically finds minimal and maximal coordinates.

Parameters:
p1 [in] first point
p2 [in] second point

Definition at line 258 of file AABBox.h.

References SetFromPoints().

Here is the call graph for this function:

TAABBox::TAABBox const TVector3 lb,
const float &  widthX,
const float &  lengthY,
const float &  heightZ
[inline, explicit]
 

Create this AABB from left-bottom point and width, length and height.

Warning:
Width, length and height must be positive values ( >= 0)!!!
Parameters:
lb [in] left-bottom point
widthX [in] width of box - size in X-axis
lengthY [in] length of box - size in Y-axis
heightZ [in] height of box - size in Z-axis

Definition at line 273 of file AABBox.h.

References Set().

Here is the call graph for this function:

TAABBox::TAABBox const TSphere sphere  )  [explicit]
 

Create box from sphere.

Note:
Box will be set from minimal and maximal coordinates contained inside given sphere.
Parameters:
sphere [in] original sphere

Definition at line 25 of file AABBox.cpp.

References NSMath::TSphere::GetMinMaxXYZ().

Here is the call graph for this function:

TAABBox::TAABBox const TBox box  )  [explicit]
 

Create box from OBB.

Note:
Box will be set from minimal and maximal coordinates contained inside given OBB.
Parameters:
box [in] original box

Definition at line 37 of file AABBox.cpp.

References NSMath::TBox::GetMinMaxXYZ().

Here is the call graph for this function:


Member Function Documentation

BOOL TAABBox::AddAABBox const TAABBox aabb  )  [inline]
 

"Add" another AABB to this box and expand this box if second box don't belongs entire into this box.

If box was expanded then TRUE is returned.

Parameters:
aabb [in] AABB to add

Definition at line 837 of file AABBox.h.

References FALSE, m_lb, m_rt, TRUE, NSMath::TVector3::x, NSMath::TVector3::y, and NSMath::TVector3::z.

BOOL TAABBox::AddPoint const TVector3 vec  )  [inline]
 

"Add" point to this box and if point don't belong to this box then is box expanded.

If box was expanded then TRUE is returned.

Parameters:
vec [in] point to add

Definition at line 779 of file AABBox.h.

References FALSE, TRUE, NSMath::TVector3::x, NSMath::TVector3::y, and NSMath::TVector3::z.

TVector3 TAABBox::Center void   )  const [inline]
 

Compute center of this AABB.

Definition at line 682 of file AABBox.h.

Referenced by NSMath::TBox::IsInside(), NSMath::TBox::IsIntersect(), IsIntersect(), NSMath::TPlane::IsNegative(), NSMath::TPlane::IsPositive(), ProjectToAxis(), and ScaleFromCenter().

BOOL TAABBox::Compare const TAABBox aabb,
const float &  delta
const [inline]
 

Compare this AABB with another one with given tolerancy.

Parameters:
aabb [in] second box to compare
delta [in] specified tolerancy for compare definition points

Definition at line 1390 of file AABBox.h.

References NSMath::TVector3::Compare(), m_lb, and m_rt.

Here is the call graph for this function:

BOOL TAABBox::Compare const TAABBox aabb  )  const [inline]
 

Compare this AABB with another one with default tolerancy TVector3::DELTA_COMPARE.

Parameters:
aabb [in] second box to compare

Definition at line 1379 of file AABBox.h.

References NSMath::TVector3::Compare(), m_lb, and m_rt.

Referenced by TMathTest::CalcAABBoxAABBoxIntersection(), operator!=(), and operator==().

Here is the call graph for this function:

BOOL TAABBox::ComparePrecise const TAABBox aabb  )  const [inline]
 

Compare this AABB with another one very precisly (bit to bit).

Parameters:
aabb [in] second box to compare

Definition at line 1400 of file AABBox.h.

References NSMath::TVector3::ComparePrecise(), m_lb, and m_rt.

Here is the call graph for this function:

float TAABBox::DistanceSurface const TVector3 vec  )  const [inline]
 

Compute smallest distance between given point and surface of this box.

Warning:
If point is inside of box then distance is always 0 !!!
Parameters:
vec [in] point to test

Definition at line 566 of file AABBox.h.

References NSMath::NSStdMath::sqrt().

Here is the call graph for this function:

float TAABBox::DistanceSurfaceSquare const TVector3 vec  )  const [inline]
 

Compute square of smallest distance between given point and surface of this box.

Note:
This method is faster than TAABBox::DistanceSurface because no squre root is used
Warning:
If point is inside of box then distance is always 0 !!!
Parameters:
vec [in] point to test

Definition at line 579 of file AABBox.h.

References NSMath::TVector3::x, NSMath::TVector3::y, and NSMath::TVector3::z.

Referenced by IsIntersect().

TVector3 TAABBox::Extents void   )  const [inline]
 

Compute extents of this box.

Note:
Returned vector contains [ width/2 , length/2 , height/2 ]

Definition at line 675 of file AABBox.h.

const TVector3 & TAABBox::GetLB void   )  const [inline]
 

Returns left-bottom point from this AABB.

Definition at line 286 of file AABBox.h.

float TAABBox::GetMaxX void   )  const [inline]
 

Returns maximal X-coordinate that exists in this box.

Definition at line 326 of file AABBox.h.

References NSMath::TVector3::x.

void TAABBox::GetMaxXYZ TVector3 cmax  )  const [inline]
 

Return maximal coordinates contained inside this box.

Note:
Result is identical with RIGHT-TOP point from this box.
Parameters:
cmax [in] vector to store maximal coordinates

Definition at line 365 of file AABBox.h.

References NSMath::TVector3::Set().

Here is the call graph for this function:

float TAABBox::GetMaxY void   )  const [inline]
 

Returns maximal Y-coordinate that exists in this box.

Definition at line 334 of file AABBox.h.

References NSMath::TVector3::y.

float TAABBox::GetMaxZ void   )  const [inline]
 

Returns maximal Z-coordinate that exists in this box.

Definition at line 342 of file AABBox.h.

References NSMath::TVector3::z.

void TAABBox::GetMinMaxXYZ TVector3 cmin,
TVector3 cmax
const [inline]
 

Return minimal and maximal coordinates contained inside this box.

Note:
Result is identical with LEFT-BOTTOM and RIGHT-TOP points from this box.
Parameters:
cmin [in] vector to store minimal coordinates
cmax [in] vector to store maximal coordinates

Definition at line 377 of file AABBox.h.

References NSMath::TVector3::Set().

Here is the call graph for this function:

float TAABBox::GetMinX void   )  const [inline]
 

Returns minimal X-coordinate that exists in this box.

Definition at line 302 of file AABBox.h.

References NSMath::TVector3::x.

void TAABBox::GetMinXYZ TVector3 cmin  )  const [inline]
 

Return minimal coordinates contained inside this box.

Note:
Result is identical with LEFT-BOTTOM point from this box.
Parameters:
cmin [in] vector to store minimal coordinates

Definition at line 354 of file AABBox.h.

References NSMath::TVector3::Set().

Here is the call graph for this function:

float TAABBox::GetMinY void   )  const [inline]
 

Returns minimal Y-coordinate that exists in this box.

Definition at line 310 of file AABBox.h.

References NSMath::TVector3::y.

float TAABBox::GetMinZ void   )  const [inline]
 

Returns minimal Z-coordinate that exists in this box.

Definition at line 318 of file AABBox.h.

References NSMath::TVector3::z.

void TAABBox::GetPlaneBack TPlane res  )  const [inline]
 

Compute back plane of this AABB and store it in parameter.

Note:
Its normal vector is equal to vector (0,1,0).
Parameters:
res [out] computed plane

Definition at line 1199 of file AABBox.h.

References NSMath::TPlane::Set().

Here is the call graph for this function:

TPlane TAABBox::GetPlaneBack void   )  const [inline]
 

Returns back plane of this AABB.

Note:
Its normal vector is equal to vector (0,1,0).

Definition at line 1187 of file AABBox.h.

void TAABBox::GetPlaneBottom TPlane res  )  const [inline]
 

Compute bottom plane of this AABB and store it in parameter.

Note:
Its normal vector is equal to vector (0,0,-1).
Parameters:
res [out] computed plane

Definition at line 1221 of file AABBox.h.

References NSMath::TPlane::Set().

Here is the call graph for this function:

TPlane TAABBox::GetPlaneBottom void   )  const [inline]
 

Returns bottom plane of this AABB.

Note:
Its normal vector is equal to vector (0,0,-1).

Definition at line 1209 of file AABBox.h.

void TAABBox::GetPlaneFront TPlane res  )  const [inline]
 

Compute front plane of this AABB and store it in parameter.

Note:
Its normal vector is equal to vector (0,-1,0).
Parameters:
res [out] computed plane

Definition at line 1177 of file AABBox.h.

References NSMath::TPlane::Set().

Here is the call graph for this function:

TPlane TAABBox::GetPlaneFront void   )  const [inline]
 

Returns front plane of this AABB.

Note:
Its normal vector is equal to vector (0,-1,0).

Definition at line 1165 of file AABBox.h.

void TAABBox::GetPlaneLeft TPlane res  )  const [inline]
 

Compute left plane of this AABB and store it in parameter.

Note:
Its normal vector is equal to vector (-1,0,0).
Parameters:
res [out] computed plane

Definition at line 1133 of file AABBox.h.

References NSMath::TPlane::Set().

Here is the call graph for this function:

TPlane TAABBox::GetPlaneLeft void   )  const [inline]
 

Returns left plane of this AABB.

Note:
Its normal vector is equal to vector (-1,0,0).

Definition at line 1121 of file AABBox.h.

void TAABBox::GetPlaneRight TPlane res  )  const [inline]
 

Compute right plane of this AABB and store it in parameter.

Note:
Its normal vector is equal to vector (1,0,0).
Parameters:
res [out] computed plane

Definition at line 1155 of file AABBox.h.

References NSMath::TPlane::Set().

Here is the call graph for this function:

TPlane TAABBox::GetPlaneRight void   )  const [inline]
 

Returns right plane of this AABB.

Note:
Its normal vector is equal to vector (1,0,0).

Definition at line 1143 of file AABBox.h.

void TAABBox::GetPlaneTop TPlane res  )  const [inline]
 

Compute top plane of this AABB and store it in parameter.

Note:
Its normal vector is equal to vector (0,0,1).
Parameters:
res [out] computed plane

Definition at line 1243 of file AABBox.h.

References NSMath::TPlane::Set().

Here is the call graph for this function:

TPlane TAABBox::GetPlaneTop void   )  const [inline]
 

Returns top plane of this AABB.

Note:
Its normal vector is equal to vector (0,0,1).

Definition at line 1231 of file AABBox.h.

void TAABBox::GetPointsAll TVector3  points[8]  )  const [inline]
 

Method creates and return all points which represent this AABB.

Points are stored in array in this order:

FLB,FLT,FRT,FRB,BLB,BLT,BRT,BRB

It is encoded in format <FRONT|BACK><LEFT|RIGHT><TOP|BOTTOM>

Parameters:
points [out] array to store points

Definition at line 1259 of file AABBox.h.

References NSMath::TVector3::Set(), NSMath::TVector3::x, NSMath::TVector3::y, and NSMath::TVector3::z.

Referenced by GetPointsAllRelativeTo().

Here is the call graph for this function:

void TAABBox::GetPointsAllRelativeTo TVector3  points[8],
const TVector3 origin
const [inline]
 

Method creates and return all points which represent this AABB.

Points are in coordinate system related to given point ORIGIN.

Points are stored in array in this order:

FLB,FLT,FRT,FRB,BLB,BLT,BRT,BRB

It is encoded in format <FRONT|BACK><LEFT|RIGHT><TOP|BOTTOM>

Note:
Given coordinate system has axis identical with world coordinate system - only origin is translated.
Parameters:
points [out] array to store points
origin [in] origin of coordinate system where output points are stored

Definition at line 1296 of file AABBox.h.

References GetPointsAll().

Referenced by NSMath::TSphere::IsInside().

Here is the call graph for this function:

void TAABBox::GetPointsRequired TVector3  points[6]  )  const [inline]
 

Method creates and return required points which represent this AABB.

Note:
Points FLB and BRT are not contained in this array because they can be obtained directly.
Points are stored in array in this order:

FLT,FRT,FRB,BLB,BLT,BRB

It is encoded in format <FRONT|BACK><LEFT|RIGHT><TOP|BOTTOM>

Parameters:
points [out] array to store points

Definition at line 1322 of file AABBox.h.

References NSMath::TVector3::Set(), NSMath::TVector3::x, NSMath::TVector3::y, and NSMath::TVector3::z.

Referenced by GetPointsRequiredRelativeTo(), and IsIntersect().

Here is the call graph for this function:

void TAABBox::GetPointsRequiredRelativeTo TVector3  points[6],
const TVector3 origin
const [inline]
 

Method creates and return required points which represent this AABB.

Points are in coordinate system related to given point ORIGIN.

Note:
Points FLB and BRT are not contained in this array because they can be obtained directly.

Given coordinate system has axis identical with world coordinate system - only origin is translated.

Points are stored in array in this order:

FLT,FRT,FRB,BLB,BLT,BRB

It is encoded in format <FRONT|BACK><LEFT|RIGHT><TOP|BOTTOM>

Parameters:
points [out] array to store points
origin [in] origin of coordinate system where output points are stored

Definition at line 1361 of file AABBox.h.

References GetPointsRequired().

Here is the call graph for this function:

const TVector3 & TAABBox::GetRT void   )  const [inline]
 

Returns right-top point from this AABB.

Definition at line 294 of file AABBox.h.

float TAABBox::Height void   )  const [inline]
 

Compute height - size in Z-axis.

Definition at line 665 of file AABBox.h.

References NSMath::TVector3::z.

Referenced by NSMath::TBox::IsIntersect(), IsIntersect(), NSMath::TPlane::IsNegative(), NSMath::TPlane::IsPositive(), MoveToLB(), ProjectExtentsToAxis(), ProjectToAxis(), Surface(), and Volume().

BOOL TAABBox::IsInside const TBox box  )  const
 

This method determines whether given OBB is entire contained inside this AABB.

Parameters:
box [in] box to test

Definition at line 77 of file AABBox.cpp.

References NSMath::TBox::GetMinMaxXYZ().

Here is the call graph for this function:

BOOL TAABBox::IsInside const TSphere sphere  )  const
 

This method determines whether given sphere is entire contained inside this AABB.

Parameters:
sphere [in] sphere to test

Definition at line 61 of file AABBox.cpp.

References NSMath::TSphere::GetCenter(), and NSMath::TSphere::GetRadius().

Here is the call graph for this function:

BOOL TAABBox::IsInside const TAABBox aabb  )  const [inline]
 

Determines whether specified AABB is entire inside this AABB.

Parameters:
aabb [in] second box to test

Definition at line 1423 of file AABBox.h.

References m_lb, m_rt, NSMath::TVector3::x, NSMath::TVector3::y, and NSMath::TVector3::z.

BOOL TAABBox::IsInside const TVector3 pt  )  const [inline]
 

This method determines whether specified point is inside this box.

Parameters:
pt [in] point to test

Definition at line 1410 of file AABBox.h.

References NSMath::TVector3::x, NSMath::TVector3::y, and NSMath::TVector3::z.

BOOL TAABBox::IsIntersect const TBox box  )  const
 

Determines whether given OBB intersects this AABB.

Parameters:
box [in] box to test

Definition at line 272 of file AABBox.cpp.

References NSMath::TBox::IsIntersect().

Here is the call graph for this function:

BOOL TAABBox::IsIntersect const TSphere sphere  )  const
 

Determines whether given sphere intersects this AABB.

Parameters:
sphere [in] sphere to test

Definition at line 259 of file AABBox.cpp.

References DistanceSurfaceSquare(), NSMath::TSphere::GetCenter(), and NSMath::TSphere::GetRadiusSquare().

Here is the call graph for this function:

BOOL TAABBox::IsIntersect const TAABBox aabb  )  const [inline]
 

Determines whether specified AABB has intersection with this AABB.

Parameters:
aabb [in] second box to test

Definition at line 1500 of file AABBox.h.

References FALSE, m_lb, m_rt, TRUE, NSMath::TVector3::x, NSMath::TVector3::y, and NSMath::TVector3::z.

BOOL TAABBox::IsIntersect const TPlane plane  )  const [inline]
 

Determines whether this box has intersection with plane.

Parameters:
plane [in] plane to test

Definition at line 1439 of file AABBox.h.

References NSMath::TPlane::AbsDistance(), NSMath::NSStdMath::fabs(), NSMath::TPlane::GetNormalX(), NSMath::TPlane::GetNormalY(), NSMath::TPlane::GetNormalZ(), GetPointsRequired(), NSMath::TPlane::IsPositive(), and Width().

Here is the call graph for this function:

BOOL TAABBox::IsIntersect const TLine line  )  const
 

This method determines whether specified line intersects this AABB.

Parameters:
line [in] line to test

Definition at line 201 of file AABBox.cpp.

References Center(), NSMath::TVector3::Cross(), NSMath::NSStdMath::fabs(), FALSE, NSMath::TLine::GetDirX(), NSMath::TLine::GetDirY(), NSMath::TLine::GetDirZ(), NSMath::TLine::GetPoint(), NSMath::TLine::GetVector(), Height(), Length(), TRUE, Width(), NSMath::TVector3::x, NSMath::TVector3::y, and NSMath::TVector3::z.

Here is the call graph for this function:

BOOL TAABBox::IsIntersect const TRay ray  )  const
 

This method tests whether given ray intersects this AABB.

Parameters:
ray [in] ray to test

Definition at line 105 of file AABBox.cpp.

References Center(), NSMath::TVector3::Cross(), NSMath::NSStdMath::fabs(), FALSE, NSMath::TRay::GetDirX(), NSMath::TRay::GetDirY(), NSMath::TRay::GetDirZ(), NSMath::TRay::GetStart(), NSMath::TRay::GetVector(), Height(), Length(), TRUE, Width(), NSMath::TVector3::x, NSMath::TVector3::y, and NSMath::TVector3::z.

Here is the call graph for this function:

BOOL TAABBox::IsIntersect const TVector3 start,
const TVector3 end
const [inline]
 

This class determines whether given line segment represented by START and STOP point intersects this box.

Parameters:
start [in] starting point of line segment
end [in] end point of line segment

Definition at line 1528 of file AABBox.h.

References Center(), NSMath::TVector3::Cross(), NSMath::NSStdMath::fabs(), FALSE, Height(), Length(), TRUE, Width(), NSMath::TVector3::x, NSMath::TVector3::y, and NSMath::TVector3::z.

Here is the call graph for this function:

BOOL TAABBox::IsIntersect const TLineSegment seg  )  const
 

This method tests whether given line segment intersects this AABB.

Parameters:
seg [in] line segment to test

Definition at line 93 of file AABBox.cpp.

References NSMath::TLineSegment::GetEnd(), and NSMath::TLineSegment::GetStart().

Referenced by NSMath::TSphere::IsIntersect().

Here is the call graph for this function:

BOOL TAABBox::IsIntersectAABB const TAABBox aabb,
TAABBox res
const [inline]
 

Method determines whether this box intersects with another box and if so then return TRUE and new box created as result of intersection.

Parameters:
aabb [in] second box to test intersection
res [in] result of intersection when method returns TRUE (if returns FALSE parameter won't be changed)

Definition at line 1644 of file AABBox.h.

References FALSE, m_lb, m_rt, NSMath::TVector3::Set(), TRUE, NSMath::TVector3::x, NSMath::TVector3::y, and NSMath::TVector3::z.

Referenced by TMathTest::CalcAABBoxAABBoxIntersection().

Here is the call graph for this function:

float TAABBox::Length void   )  const [inline]
 

Compute length - size in Y-axis.

Definition at line 657 of file AABBox.h.

References NSMath::TVector3::y.

Referenced by NSMath::TBox::IsIntersect(), IsIntersect(), NSMath::TPlane::IsNegative(), NSMath::TPlane::IsPositive(), MoveToLB(), ProjectExtentsToAxis(), ProjectToAxis(), Surface(), and Volume().

void TAABBox::MoveToLB const float &  x,
const float &  y,
const float &  z
[inline]
 

Translate this AABB to position where LEFT-BOTTOM point will have coordinates [x,y,z].

Note:
It means method doesnt change width, height and length of this AABB.
Parameters:
x [in] new x-coordinates for LEFT-BOTTOM point.
y [in] new y-coordinates for LEFT-BOTTOM point.
z [in] new z-coordinates for LEFT-BOTTOM point.

Definition at line 514 of file AABBox.h.

References Height(), Length(), NSMath::TVector3::Set(), Width(), NSMath::TVector3::x, NSMath::TVector3::y, and NSMath::TVector3::z.

Here is the call graph for this function:

void TAABBox::MoveToLB const TVector3 vec  )  [inline]
 

Translate this AABB to position where LEFT-BOTTOM point will have coordinates VEC.

Note:
It means method doesnt change width, height and length of this AABB.
Parameters:
vec [in] new coordinates for LEFT-BOTTOM point.

Definition at line 496 of file AABBox.h.

References Height(), Length(), Width(), NSMath::TVector3::x, NSMath::TVector3::y, and NSMath::TVector3::z.

Referenced by TMathTest::CalcAABBoxAABBoxIntersection().

Here is the call graph for this function:

BOOL TAABBox::operator!= const TAABBox aabb  )  const [inline]
 

Inequality operator.

Compare this box with another box with default tolerancy.

Parameters:
aabb [in] second box to compare

Definition at line 1708 of file AABBox.h.

References Compare().

Here is the call graph for this function:

TAABBox & TAABBox::operator+= const TVector3 vec  )  [inline]
 

Move this box about specified offset.

Parameters:
vec [in] offset

Definition at line 1718 of file AABBox.h.

References NSMath::TVector3::Add().

Here is the call graph for this function:

TAABBox & TAABBox::operator-= const TVector3 vec  )  [inline]
 

Move this box about specified offset in opposite direction.

Parameters:
vec [in] offset

Definition at line 1729 of file AABBox.h.

References NSMath::TVector3::Sub().

Here is the call graph for this function:

TAABBox & TAABBox::operator= const TAABBox aabb  )  [inline]
 

Assignment operator.

Parameters:
aabb [in] original box

Definition at line 1686 of file AABBox.h.

References Set().

Here is the call graph for this function:

BOOL TAABBox::operator== const TAABBox aabb  )  const [inline]
 

Equality operator.

Compare this box with another box with default tolerancy.

Parameters:
aabb [in] second box to compare

Definition at line 1698 of file AABBox.h.

References Compare().

Here is the call graph for this function:

float TAABBox::ProjectExtentsToAxis const TVector3 axisDir  )  const [inline]
 

This method projects extents of this box to specified axis that is determined only via its directional vector (thus it goes through origin of space).

Note:
Method always returns non-negative value.
Parameters:
axisDir [in] directional (normalized) vector

Definition at line 886 of file AABBox.h.

References DBGASSERT_MATH, NSMath::NSStdMath::fabs(), Height(), NSMath::TVector3::IsNormalized(), Length(), Width(), NSMath::TVector3::x, NSMath::TVector3::y, and NSMath::TVector3::z.

Referenced by NSMath::TBox::IsInside(), and NSMath::TBox::IsIntersect().

Here is the call graph for this function:

void TAABBox::ProjectToAxis const TVector3 axisDir,
float &  timeMin,
float &  timeMax
const [inline]
 

This method projects AABB to specified axis determined only directional vector (thus axis goes through origin of space.

Method computes time values which bound projection of AABB to axis. You can use these time values to compute point of projection simply via ORIGIN + DIR * TIME where ORIGIN = [0,0,0].

Parameters:
axisDir [in] directional vector (normalized) for axis
timeMin [out] first computed time value - always less or equal than second
timeMax [out] second computed time value - always greater or equal than second

Definition at line 911 of file AABBox.h.

References Center(), DBGASSERT_MATH, NSMath::NSStdMath::fabs(), Height(), NSMath::TVector3::IsNormalized(), Length(), Width(), NSMath::TVector3::x, NSMath::TVector3::y, and NSMath::TVector3::z.

Here is the call graph for this function:

void TAABBox::ProjectToLine const TLine line,
float &  timeMin,
float &  timeMax
const [inline]
 

This method projects AABB to specified line.

Method computes time values which bound projection of AABB to line. You can use these time values to compute point of projection simply via ORIGIN + DIR * TIME.

Time t==0 is returned for points "above" line definition point.

Parameters:
line [in] line for projection
timeMin [out] first computed time value - always less or equal than second
timeMax [out] second computed time value - always greater or equal than second

Definition at line 960 of file AABBox.h.

References NSMath::NSStdMath::fabs(), NSMath::TLine::GetDirX(), NSMath::TLine::GetDirY(), NSMath::TLine::GetDirZ(), NSMath::TLine::Time(), and Width().

Here is the call graph for this function:

void TAABBox::ProjectToLineSegment const TLineSegment seg,
float &  timeMin,
float &  timeMax
const [inline]
 

This method projects AABB to specified line segment.

Method computes time values which bound projection of AABB to line segment. You can use these time values to compute point of projection simply via ORIGIN + DIR * SEG_LENGTH * TIME.

Time t==0 is returned for points "above" start of line segment. Time t==1 is returned for points "above" end of line segment.

Parameters:
seg [in] line segment for projection
timeMin [out] first computed time value - always less or equal than second
timeMax [out] second computed time value - always greater or equal than second

Definition at line 1002 of file AABBox.h.

References NSMath::NSStdMath::fabs(), NSMath::TLineSegment::GetDirX(), NSMath::TLineSegment::GetDirY(), NSMath::TLineSegment::GetDirZ(), NSMath::TLineSegment::InvLength(), NSMath::TLineSegment::TimeNormalized(), and Width().

Referenced by TMathTest::CalcAABBoxLineSegmentProjection().

Here is the call graph for this function:

void TAABBox::ProjectToLineSegmentNormalized const TLineSegment seg,
float &  timeMin,
float &  timeMax
const [inline]
 

This method projects AABB to specified line segment in NORMALIZED coordinated!!!

Method computes time values which bound projection of AABB to line segment. You can use these time values to compute point of projection simply via ORIGIN + DIR * TIME.

Time t==0 is returned for points "above" start of line segment.

Warning:
NORMALIZED time value t==1 is point in distance 1 from START of segment!!! Its not point above END point of line segment!!!
Parameters:
seg [in] line segment for projection
timeMin [out] first computed time value - always less or equal than second
timeMax [out] second computed time value - always greater or equal than second

Definition at line 1049 of file AABBox.h.

References NSMath::NSStdMath::fabs(), NSMath::TLineSegment::GetDirX(), NSMath::TLineSegment::GetDirY(), NSMath::TLineSegment::GetDirZ(), NSMath::TLineSegment::TimeNormalized(), and Width().

Here is the call graph for this function:

void TAABBox::ProjectToRay const TRay ray,
float &  timeMin,
float &  timeMax
const [inline]
 

This method projects AABB to specified ray.

Method computes time values which bound projection of AABB to ray. You can use these time values to compute point of projection simply via ORIGIN + DIR * TIME.

Time t==0 is returned for points "above" start of ray.

Parameters:
ray [in] ray for projection
timeMin [out] first computed time value - always less or equal than second
timeMax [out] second computed time value - always greater or equal than second

Definition at line 1087 of file AABBox.h.

References NSMath::NSStdMath::fabs(), NSMath::TRay::GetDirX(), NSMath::TRay::GetDirY(), NSMath::TRay::GetDirZ(), NSMath::TRay::Time(), and Width().

Here is the call graph for this function:

float TAABBox::Radius void   )  const [inline]
 

Compute radius of this AABB.

Note:
It is distance from center to LB or RT point, thus radius of circumsphere of this AABB.

Definition at line 692 of file AABBox.h.

float TAABBox::RadiusInner void   )  const [inline]
 

Compute inner radius of this AABB.

It is distance from center to nearest plane of this AABB, thus radius of insphere of this AABB.

Warning:
This method is faster than TAABBox::RadiusInnerSquare!!!

Definition at line 717 of file AABBox.h.

References NSMath::TVector3::x, NSMath::TVector3::y, and NSMath::TVector3::z.

float TAABBox::RadiusInnerSquare void   )  const [inline]
 

Compute square of inner radius of this AABB.

It is square of distance from center to nearest plane of this AABB, thus square of radius of insphere of this AABB.

Warning:
This method is slower than TAABBox::RadiusInner - only one more multiply is used!!!

Definition at line 738 of file AABBox.h.

References NSMath::TVector3::x, NSMath::TVector3::y, and NSMath::TVector3::z.

float TAABBox::RadiusSquare void   )  const [inline]
 

Compute square of radius of this AABB.

Note:
It is square of distance from center to LB or RT point, thus square of radius of circumsphere of this AABB.

This method is faster than TAABBox::Radius because no square root is used!!!

Definition at line 705 of file AABBox.h.

Referenced by NSMath::TSphere::TSphere().

void TAABBox::ScaleFromCenter const float &  scale  )  [inline]
 

Scale this AABB from center thus all definition point will be moved.

Warning:
Scale factor must be greater or equal to 0!!!
Parameters:
scale [in] scale factor - must be >= 0 !!!

Definition at line 530 of file AABBox.h.

References Center(), and DBGASSERT_MATH.

Referenced by TMathTest::CalcAABBoxAABBoxIntersection().

Here is the call graph for this function:

void TAABBox::ScaleFromLB const float &  scale  )  [inline]
 

Scale this AABB from left-bottom corner thus this point will not change.

Warning:
Scale factor must be greater or equal to 0!!!
Parameters:
scale [in] scale factor - must be >= 0 !!!

Definition at line 550 of file AABBox.h.

References DBGASSERT_MATH.

void TAABBox::Set const TVector3 lb,
const float &  widthX,
const float &  lengthY,
const float &  heightZ
[inline]
 

Set this AABB from left-bottom point and width, length and height.

Warning:
Width, length and height must be positive values ( >= 0)!!!
Parameters:
lb [in] left-bottom point
widthX [in] width of box - size in X-axis
lengthY [in] length of box - size in Y-axis
heightZ [in] height of box - size in Z-axis

Definition at line 419 of file AABBox.h.

References NSMath::TVector3::Add(), and DBGASSERT_MATH.

Here is the call graph for this function:

void TAABBox::Set const TVector3 lb,
const TVector3 rt
[inline]
 

Set this AABB from two points.

Warning:
All components of LB point must be less than corresponding components in RT point!!!
Parameters:
lb [in] left-bottom point (it contains minimal coordinates)
rt [in] right-top point (it contains maximal coordinates)

Definition at line 401 of file AABBox.h.

References DBGASSERT_MATH.

void TAABBox::Set const TAABBox aabb  )  [inline]
 

Set this box according to another box.

Parameters:
aabb [in] original box

Definition at line 387 of file AABBox.h.

References m_lb, and m_rt.

Referenced by operator=(), and TAABBox().

void TAABBox::SetFromPoints const TVector3 points,
const DWORD count
[inline]
 

Set this box from array of points.

Warning:
At least one point must be contained in array!!!
Parameters:
points [in] array with points
count [in] number of points in array - must be > 0 !!!

Definition at line 458 of file AABBox.h.

References DBGASSERT_MATH, DBGASSERT_MATHLOW, NSMath::TMathCPU::FindMinMax(), and TGlobalsMath::GetCPU().

Here is the call graph for this function:

void TAABBox::SetFromPoints const TVector3 p1,
const TVector3 p2
[inline]
 

This method sets AABB from two points.

Method finds minimal and maximal values and set it to LB a RT points.

Parameters:
p1 [in] first point
p2 [in] second point

Definition at line 442 of file AABBox.h.

References NSMath::TVector3::x, NSMath::TVector3::y, and NSMath::TVector3::z.

Referenced by TAABBox().

float TAABBox::Surface void   )  const [inline]
 

Compute surface area of this box.

Definition at line 754 of file AABBox.h.

References Height(), Length(), and Width().

Referenced by TMathTest::CalcAABBoxAABBoxIntersection().

Here is the call graph for this function:

TBox TAABBox::ToBox void   )  const
 

Convert this box to OBB.

Definition at line 44 of file AABBox.cpp.

TSphere TAABBox::ToSphere void   )  const
 

Convert this box to sphere.

Definition at line 51 of file AABBox.cpp.

void TAABBox::Translate const float &  x,
const float &  y,
const float &  z
[inline]
 

Translate this AABB about specified vector [x,y,z].

Parameters:
x [in] translation in x-axis
y [in] translation in y-axis
z [in] translation in z-axis

Definition at line 483 of file AABBox.h.

References NSMath::TVector3::Add().

Here is the call graph for this function:

void TAABBox::Translate const TVector3 vec  )  [inline]
 

Translate this AABB about specified vector.

Parameters:
vec [in] translation vector.

Definition at line 470 of file AABBox.h.

Referenced by TMathTest::CalcAABBoxAABBoxIntersection(), and TMathTest::CalcAABBoxLineSegmentProjection().

float TAABBox::Volume void   )  const [inline]
 

Compute volume of this box.

Definition at line 766 of file AABBox.h.

References Height(), Length(), and Width().

Referenced by TMathTest::CalcAABBoxAABBoxIntersection().

Here is the call graph for this function:

float TAABBox::Width void   )  const [inline]
 

Compute width - size in X-axis.

Definition at line 649 of file AABBox.h.

References NSMath::TVector3::x.

Referenced by NSMath::TBox::IsIntersect(), IsIntersect(), NSMath::TPlane::IsNegative(), NSMath::TPlane::IsPositive(), MoveToLB(), ProjectExtentsToAxis(), ProjectToAxis(), ProjectToLine(), ProjectToLineSegment(), ProjectToLineSegmentNormalized(), ProjectToRay(), Surface(), and Volume().


The documentation for this struct was generated from the following files:
Generated on Wed Nov 28 22:46:13 2007 for Joy4D by  doxygen 1.4.6-NO