NSMath::TBox2D Struct Reference

TBox2D class. More...

#include <Box2D.h>

Inheritance diagram for NSMath::TBox2D:

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

Collaboration graph
[legend]
List of all members.

Public Member Functions

 TBox2D (void)
 Creates box with center at [0,0] and extents [0.5, 0.5].
 TBox2D (const TBox2D &box)
 Copy constructor.
 TBox2D (const TVector2D &center, const TVector2D &extents)
 Create this box from center and extents.
 TBox2D (const TVector2D &center, const TVector2D &extents, const TVector2D &xAxis)
 Create this box from center, extents and local X-axis that must be NORMALIZED.
 TBox2D (const TVector2D &center, const TVector2D &extents, const float &xAngle)
 Create this box from center, extents and angle (in radians) between local X-axis and principal X-axis - [1,0].
 TBox2D (const TVector2D &center, const TVector2D &extents, const float &xSin, const float &xCos)
 Create this box from center, extents and angle (in radians) between local X-axis and principal X-axis.
const TVector2DGetCenter (void) const
 Returns center of this box.
const TVector2DGetExtents (void) const
 Returns extents of this box.
float GetLocalAxisX_X (void) const
 Returns x-component of local x-axis of this box.
float GetLocalAxisX_Y (void) const
 Returns y-component of local x-axis of this box.
float GetLocalAxisY_X (void) const
 Returns x-component of local y-axis of this box.
float GetLocalAxisY_Y (void) const
 Returns y-component of local y-axis of this box.
float GetMinX (void) const
 Returns minimal x-coordinate contained inside this box.
float GetMinY (void) const
 Returns minimal y-coordinate contained inside this box.
float GetMaxX (void) const
 Returns maximal x-coordinate contained inside this box.
float GetMaxY (void) const
 Returns maximal y-coordinate contained inside this box.
void GetMinMaxX (float &minX, float &maxX) const
 Compute minimal and maximal x-coordinates contained inside this box.
void GetMinMaxY (float &minY, float &maxY) const
 Compute minimal and maximal y-coordinates contained inside this box.
void GetMinMaxXY (float &minX, float &maxX, float &minY, float &maxY) const
 Compute minimal and maximal x-cordinates and y-coordinates contained inside this box.
void Set (const TBox2D &box)
 Set this box according to another box.
void Set (const TVector2D &center, const TVector2D &extents)
 Set this box from center and extents.
void SetDir (const TVector2D &center, const TVector2D &extents, const TVector2D &xAxis)
 Set this box from center, extents and local X-axis that must be NORMALIZED.
void SetAngle (const TVector2D &center, const TVector2D &extents, const float &xAngle)
 Set this box from center, extents and angle (in radians) between local X-axis and principal X-axis - [1,0].
void SetSinCos (const TVector2D &center, const TVector2D &extents, const float &xSin, const float &xCos)
 Set this box from center, extents and angle (in radians) between local X-axis and principal X-axis.
void Translate (const TVector2D &vec)
 Translate this box about specified vector.
void Translate (const float &x, const float &y)
 Translate this box about specified vector [x,y].
void Rotate (const float &angle)
 Rotate with box around origin about specified angle in radians.
void RotateSinCos (const float &tsin, const float &tcos)
 Rotate with box around origin about specified angle that sinus and cosinus are stored in parameters.
void RotateAroundPoint (const float &angle, const TVector2D &origin)
 Rotate this box around specified point about specified angle in radians.
void RotateAroundPointSinCos (const float &tsin, const float &tcos, const TVector2D &origin)
 Rotate this box around specified point about specified angle that sinus and cosinus values are contained in parameters.
void RotateAroundCenter (const float &angle)
 Rotate this box around center about given angle in radians.
void RotateAroundCenterSinCos (const float &tsin, const float &tcos)
 Rotate this box around center about given angle in radians.
void RotateZero (void)
 Set rotation of this box to zero.
float Width (void) const
 Returns width of this box - its length along local X-axis.
float Height (void) const
 Returns height of this box - its length along local Y-axis.
TVector2D LocalAxisX (void) const
 Returns local X-axis for this box.
TVector2D LocalAxisY (void) const
 Returns local Y-axis for this box.
TVector2D ToBoxSpaceGet (const TVector2D &vec) const
 Convert given point from world coordinates to box coordinates.
TVector2D ToBoxSpaceGet (const float &x, const float &y) const
 Convert given point [x,y] from world coordinates to box coordinates.
void ToBoxSpace (TVector2D &vec) const
 Convert given point from world coordinates to box coordinates.
void ToBoxSpace (float &x, float &y) const
 Convert given point [x,y] from world coordinates to box coordinates.
TVector2D FromBoxSpaceGet (const TVector2D &vec) const
 Convert given point from box space to world space.
TVector2D FromBoxSpaceGet (const float &x, const float &y) const
 Convert given point [x,y] from box space to world space.
void FromBoxSpace (TVector2D &vec) const
 Convert given point from box space to world space.
void FromBoxSpace (float &x, float &y) const
 Convert given point [x,y] from world coordinates to box coordinates.
float Radius (void) const
 Compute radius of circumscribed circle.
float RadiusSquare (void) const
 Compute square of radius of circumscribed circle.
float RadiusInner (void) const
 Compute radius of incircle.
float RadiusInnerSquare (void) const
 Compute square of radius of incircle.
float Area (void) const
 Compute area of this box.
BOOL AddPoint (const TVector2D &vec)
 Add specified point to this box.
void ProjectToAxis (const TVector2D &axisDir, float &timeMin, float &timeMax) const
 This method projects box to specified axis which goes through origin [0,0].
void ProjectToLine (const TLine2D &line, float &timeMin, float &timeMax) const
 This method projects this box to specified line.
void ProjectToLineSegment (const TLineSegment2D &seg, float &timeMin, float &timeMax) const
 This method projects this box to specified line segment.
void ProjectToLineSegmentNormalized (const TLineSegment2D &seg, float &timeMin, float &timeMax) const
 This method projects this box to specified line segment and use NORMALIZED time parameters!!!
void ProjectToRay (const TRay2D &ray, float &timeMin, float &timeMax) const
 This method projects this box to specified ray.
float ProjectExtentsToAxis (const TVector2D &axisDir) const
 This method projects extents of this box to specified axis.
float ProjectExtentsToAxis (const float &dirX, const float &dirY) const
 This method projects extents of this box to specified axis determined by directional vector [dirX,dirY].
float ProjectExtentsToX (void) const
 Project extents of this box to X-axis.
float ProjectExtentsToY (void) const
 Project extents of this box to Y-axis.
BOOL Compare (const TBox2D &box) const
 Compare this box with another box with default tolerancy TVector2D::DELTA_COMPARE.
BOOL Compare (const TBox2D &box, const float &delta) const
 Compare this box with another box with given tolerancy.
BOOL ComparePrecise (const TBox2D &box) const
 Compare this box with another box very precisly (bit to bit).
BOOL IsInside (const TVector2D &pt) const
 Determines whether specified point is inside this box.
BOOL IsInside (const float &x, const float &y) const
 Determines whether specified point [x,y] is inside this box.
BOOL IsIntersect (const TBox2D &box) const
 Determines whether this box intersects with another box.
BOOL IsIntersect (const TRectangle2D &rect) const
 This method determines whether given rectangle intersects this box.
BOOL IsIntersect (const TCircle2D &circle) const
 This method determines whether this box intersects with given circle.
BOOL IsIntersect (const TLine2D &line) const
 This method tests whether given line intersects this box.
BOOL IsIntersect (const TLineSegment2D &seg) const
 This method determines whether given line segment intersect this box.
BOOL IsIntersect (const TVector2D &start, const TVector2D &end) const
 This method determines whether given line segment created from two points intersect this box.
BOOL IsIntersect (const TRay2D &ray) const
 This method determines whether given ray intersects this box.
TBox2Doperator= (const TBox2D &box)
 Assignment operator.
BOOL operator== (const TBox2D &box) const
 Compare this box with another box with default tolerancy TVector2D::DELTA_COMPARE.
BOOL operator!= (const TBox2D &box) const
 Compare this box with another box with default tolerancy TVector2D::DELTA_COMPARE.
TBox2Doperator+= (const TVector2D &vec)
 Move this box about specified vector.
TBox2Doperator-= (const TVector2D &vec)
 Move this box about specified vector in inverse direction.

Detailed Description

TBox2D class.

This class represents box in 2D-space (XY space).

Box is represented by center point, extents and orthonormal basis (two orthogonal axis).

Because second Y-axis may be very simply computed from X-axis (it's always perpendicular to left thus YAXIS = [-XAXIS.Y, XAXIS.X]) we don't store it.

Definition at line 55 of file Box2D.h.


Constructor & Destructor Documentation

TBox2D::TBox2D void   )  [inline]
 

Creates box with center at [0,0] and extents [0.5, 0.5].

Box is aligned to axis X=[1,0], Y=[0,1].

Definition at line 203 of file Box2D.h.

TBox2D::TBox2D const TBox2D box  )  [inline]
 

Copy constructor.

Parameters:
box [in] original box

Definition at line 215 of file Box2D.h.

References Set().

Here is the call graph for this function:

TBox2D::TBox2D const TVector2D center,
const TVector2D extents
[inline, explicit]
 

Create this box from center and extents.

Note:
Local axes will be set to [1,0] and [0,1] thus box will be aligned to principal axes.
Parameters:
center [in] center of box
extents [in] HALF of width and height - must be positive values!!!

Definition at line 228 of file Box2D.h.

References Set().

Here is the call graph for this function:

TBox2D::TBox2D const TVector2D center,
const TVector2D extents,
const TVector2D xAxis
[inline, explicit]
 

Create this box from center, extents and local X-axis that must be NORMALIZED.

Note:
Local Y-axis is computed and always point to the left from local X-axis.
Parameters:
center [in] center of box
extents [in] HALF of width and height - must be positive values!!!
xAxis [in] local X-axis - must be normalized!!!

Definition at line 242 of file Box2D.h.

References SetDir().

Here is the call graph for this function:

TBox2D::TBox2D const TVector2D center,
const TVector2D extents,
const float &  xAngle
[inline, explicit]
 

Create this box from center, extents and angle (in radians) between local X-axis and principal X-axis - [1,0].

Local Y-axis is computed and always points to the left from local X-axis.

Note:
Angle is measured in counter-clockwise order.
Parameters:
center [in] center of box
extents [in] HALF of width and height - must be positive values!!!
xAngle [in] angle between axis [1,0] an local X-axis of this box - in radians.

Definition at line 258 of file Box2D.h.

References SetAngle().

Here is the call graph for this function:

TBox2D::TBox2D const TVector2D center,
const TVector2D extents,
const float &  xSin,
const float &  xCos
[inline, explicit]
 

Create this box from center, extents and angle (in radians) between local X-axis and principal X-axis.

Sinus and cosinus of this angle are contained in parameters.

Note:
Local Y-axis is computed and always points to the left from local X-axis.
Parameters:
center [in] center of box
extents [in] HALF of width and height - must be positive values!!!
xSin [in] sinus of angle between X-axis and principal axis [1,0]
xCos [in] cosinus of angle between X-axis and principal axis [1,0]

Definition at line 274 of file Box2D.h.

References SetSinCos().

Here is the call graph for this function:


Member Function Documentation

BOOL TBox2D::AddPoint const TVector2D vec  )  [inline]
 

Add specified point to this box.

If given point don't belong to this box then box is expanded.

Method returns TRUE if box was expanded.

Note:
this method doesn't change locas axis of this box!!!
Parameters:
vec [in] point to add

Definition at line 923 of file Box2D.h.

References NSMath::TVector2D::Add(), NSMath::NSStdMath::fabs(), FALSE, FromBoxSpaceGet(), NSMath::TVector2D::m_x, NSMath::TVector2D::m_y, ToBoxSpaceGet(), and TRUE.

Here is the call graph for this function:

float TBox2D::Area void   )  const [inline]
 

Compute area of this box.

Definition at line 907 of file Box2D.h.

References NSMath::TVector2D::m_x, and NSMath::TVector2D::m_y.

BOOL TBox2D::Compare const TBox2D box,
const float &  delta
const [inline]
 

Compare this box with another box with given tolerancy.

Parameters:
box [in] second box to compare
delta [in] maximall alowed tolerancy between components

Definition at line 1210 of file Box2D.h.

References NSMath::TVector2D::Compare(), m_axisX, m_center, and m_extents.

Here is the call graph for this function:

BOOL TBox2D::Compare const TBox2D box  )  const [inline]
 

Compare this box with another box with default tolerancy TVector2D::DELTA_COMPARE.

Parameters:
box [in] second box to compare

Definition at line 1196 of file Box2D.h.

References NSMath::TVector2D::Compare(), m_axisX, m_center, and m_extents.

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

Here is the call graph for this function:

BOOL TBox2D::ComparePrecise const TBox2D box  )  const [inline]
 

Compare this box with another box very precisly (bit to bit).

Parameters:
box [in] second box to compare

Definition at line 1223 of file Box2D.h.

References NSMath::TVector2D::ComparePrecise(), m_axisX, m_center, and m_extents.

Here is the call graph for this function:

void TBox2D::FromBoxSpace float &  x,
float &  y
const [inline]
 

Convert given point [x,y] from world coordinates to box coordinates.

Warning:
Box coordinates [0,0] are at center of box !!!
Parameters:
x [in out] point's x-coordinate to convert
y [in out] point's y-coordinate to convert

Definition at line 851 of file Box2D.h.

References NSMath::TVector2D::m_x, and NSMath::TVector2D::m_y.

void TBox2D::FromBoxSpace TVector2D vec  )  const [inline]
 

Convert given point from box space to world space.

Warning:
Box coordinates [0,0] are at center of box !!!
Parameters:
vec [in out] point to convert and result too

Definition at line 838 of file Box2D.h.

References NSMath::TVector2D::m_x, and NSMath::TVector2D::m_y.

TVector2D TBox2D::FromBoxSpaceGet const float &  x,
const float &  y
const [inline]
 

Convert given point [x,y] from box space to world space.

Warning:
Box coordinates [0,0] are at center of box !!!
Parameters:
x [in out] point's x-coordinate to convert
y [in out] point's y-coordinate to convert

Definition at line 826 of file Box2D.h.

References FromBoxSpaceGet().

Here is the call graph for this function:

TVector2D TBox2D::FromBoxSpaceGet const TVector2D vec  )  const [inline]
 

Convert given point from box space to world space.

Warning:
Box coordinates [0,0] are at center of box !!!
Parameters:
vec [in out] point to convert

Definition at line 803 of file Box2D.h.

References NSMath::TVector2D::Dot(), NSMath::TVector2D::m_x, and NSMath::TVector2D::m_y.

Referenced by AddPoint(), and FromBoxSpaceGet().

Here is the call graph for this function:

const TVector2D & TBox2D::GetCenter void   )  const [inline]
 

Returns center of this box.

Definition at line 288 of file Box2D.h.

Referenced by NSMath::TLine2D::IsNegative(), and NSMath::TLine2D::IsPositive().

const TVector2D & TBox2D::GetExtents void   )  const [inline]
 

Returns extents of this box.

Note:
Vector with extents contain [width/2 , height/2 ] along local axis of this box.

Definition at line 298 of file Box2D.h.

float TBox2D::GetLocalAxisX_X void   )  const [inline]
 

Returns x-component of local x-axis of this box.

Definition at line 306 of file Box2D.h.

References NSMath::TVector2D::m_x.

float TBox2D::GetLocalAxisX_Y void   )  const [inline]
 

Returns y-component of local x-axis of this box.

Note:
It is always identical with negate of y-component of local x-axis.

Definition at line 316 of file Box2D.h.

References NSMath::TVector2D::m_y.

float TBox2D::GetLocalAxisY_X void   )  const [inline]
 

Returns x-component of local y-axis of this box.

Definition at line 324 of file Box2D.h.

References NSMath::TVector2D::m_y.

Referenced by ProjectToLineSegment(), and ProjectToLineSegmentNormalized().

float TBox2D::GetLocalAxisY_Y void   )  const [inline]
 

Returns y-component of local y-axis of this box.

Note:
It is always identical with x-component of local x-axis.

Definition at line 334 of file Box2D.h.

References NSMath::TVector2D::m_x.

Referenced by ProjectExtentsToAxis(), ProjectToAxis(), ProjectToLine(), ProjectToLineSegment(), ProjectToLineSegmentNormalized(), and ProjectToRay().

float TBox2D::GetMaxX void   )  const [inline]
 

Returns maximal x-coordinate contained inside this box.

Warning:
This value must be computed !!!

Definition at line 382 of file Box2D.h.

References NSMath::NSStdMath::fabs(), NSMath::TVector2D::m_x, and NSMath::TVector2D::m_y.

Here is the call graph for this function:

float TBox2D::GetMaxY void   )  const [inline]
 

Returns maximal y-coordinate contained inside this box.

Warning:
This value must be computed !!!

Definition at line 398 of file Box2D.h.

References NSMath::NSStdMath::fabs(), NSMath::TVector2D::m_x, and NSMath::TVector2D::m_y.

Here is the call graph for this function:

void TBox2D::GetMinMaxX float &  minX,
float &  maxX
const [inline]
 

Compute minimal and maximal x-coordinates contained inside this box.

Parameters:
minX [out] computed minimal x-coordinate
maxX [out] computed maximal x-coordinate

Definition at line 415 of file Box2D.h.

References NSMath::NSStdMath::fabs(), NSMath::TVector2D::m_x, and NSMath::TVector2D::m_y.

Here is the call graph for this function:

void TBox2D::GetMinMaxXY float &  minX,
float &  maxX,
float &  minY,
float &  maxY
const [inline]
 

Compute minimal and maximal x-cordinates and y-coordinates contained inside this box.

Parameters:
minX [out] computed minimal x-coordinate
maxX [out] computed maximal x-coordinate
minY [out] computed minimal y-coordinate
maxY [out] computed maximal y-coordinate

Definition at line 453 of file Box2D.h.

References NSMath::NSStdMath::fabs(), NSMath::TVector2D::m_x, and NSMath::TVector2D::m_y.

Here is the call graph for this function:

void TBox2D::GetMinMaxY float &  minY,
float &  maxY
const [inline]
 

Compute minimal and maximal y-coordinates contained inside this box.

Parameters:
minY [out] computed minimal y-coordinate
maxY [out] computed maximal y-coordinate

Definition at line 433 of file Box2D.h.

References NSMath::NSStdMath::fabs(), NSMath::TVector2D::m_x, and NSMath::TVector2D::m_y.

Here is the call graph for this function:

float TBox2D::GetMinX void   )  const [inline]
 

Returns minimal x-coordinate contained inside this box.

Warning:
This value must be computed !!!

Definition at line 344 of file Box2D.h.

References NSMath::NSStdMath::fabs(), NSMath::TVector2D::m_x, and NSMath::TVector2D::m_y.

Here is the call graph for this function:

float TBox2D::GetMinY void   )  const [inline]
 

Returns minimal y-coordinate contained inside this box.

Warning:
This value must be computed !!!

Definition at line 366 of file Box2D.h.

References NSMath::NSStdMath::fabs(), NSMath::TVector2D::m_x, and NSMath::TVector2D::m_y.

Here is the call graph for this function:

float TBox2D::Height void   )  const [inline]
 

Returns height of this box - its length along local Y-axis.

Definition at line 713 of file Box2D.h.

References NSMath::TVector2D::m_y.

BOOL TBox2D::IsInside const float &  x,
const float &  y
const [inline]
 

Determines whether specified point [x,y] is inside this box.

Parameters:
x [in] point's x-coordinate to test
y [in] point's y-coordinate to test

Definition at line 1249 of file Box2D.h.

References NSMath::NSStdMath::fabs(), NSMath::TVector2D::m_x, NSMath::TVector2D::m_y, and ToBoxSpaceGet().

Here is the call graph for this function:

BOOL TBox2D::IsInside const TVector2D pt  )  const [inline]
 

Determines whether specified point is inside this box.

Parameters:
pt [in] point to test

Definition at line 1238 of file Box2D.h.

References NSMath::TVector2D::m_x, and NSMath::TVector2D::m_y.

BOOL TBox2D::IsIntersect const TRay2D ray  )  const [inline]
 

This method determines whether given ray intersects this box.

Parameters:
ray [in] ray to test

Definition at line 1403 of file Box2D.h.

References NSMath::TVector2D::Dot(), NSMath::NSStdMath::fabs(), FALSE, NSMath::TRay2D::GetDir(), NSMath::TRay2D::GetNormalX(), NSMath::TRay2D::GetNormalY(), NSMath::TRay2D::GetStart(), NSMath::TVector2D::m_x, NSMath::TVector2D::m_y, NSMath::TVector2D::PerpendicularLeft(), and ProjectExtentsToAxis().

Here is the call graph for this function:

BOOL TBox2D::IsIntersect const TVector2D start,
const TVector2D end
const [inline]
 

This method determines whether given line segment created from two points intersect this box.

Parameters:
start [in] start of tested line segment
end [in] end of tested line segment

Definition at line 1338 of file Box2D.h.

References NSMath::TVector2D::Dot(), NSMath::NSStdMath::fabs(), FALSE, NSMath::TVector2D::m_x, and NSMath::TVector2D::PerpendicularLeft().

Here is the call graph for this function:

BOOL TBox2D::IsIntersect const TLineSegment2D seg  )  const [inline]
 

This method determines whether given line segment intersect this box.

Parameters:
seg [in] tested line segment

Definition at line 1283 of file Box2D.h.

References NSMath::TLineSegment2D::Center(), NSMath::TVector2D::Dot(), NSMath::NSStdMath::fabs(), FALSE, NSMath::TLineSegment2D::GetEnd(), NSMath::TVector2D::m_x, and NSMath::TVector2D::PerpendicularLeft().

Here is the call graph for this function:

BOOL TBox2D::IsIntersect const TLine2D line  )  const [inline]
 

This method tests whether given line intersects this box.

Parameters:
line [in] line to test

Definition at line 1264 of file Box2D.h.

References NSMath::TLine2D::AbsDistance(), NSMath::TLine2D::GetNormalX(), NSMath::TLine2D::GetNormalY(), and ProjectExtentsToAxis().

Here is the call graph for this function:

BOOL TBox2D::IsIntersect const TCircle2D circle  )  const
 

This method determines whether this box intersects with given circle.

Parameters:
circle [in] circle to test

Definition at line 164 of file Box2D.cpp.

References NSMath::TVector2D::Abs(), NSMath::TCircle2D::GetCenter(), NSMath::TCircle2D::GetRadiusSquare(), NSMath::TVector2D::m_x, NSMath::TVector2D::m_y, and ToBoxSpaceGet().

Here is the call graph for this function:

BOOL TBox2D::IsIntersect const TRectangle2D rect  )  const
 

This method determines whether given rectangle intersects this box.

Parameters:
rect [in] rectangle to test

Definition at line 94 of file Box2D.cpp.

References NSMath::TRectangle2D::Center(), NSMath::NSStdMath::fabs(), FALSE, NSMath::TRectangle2D::Height(), NSMath::TVector2D::m_x, NSMath::TVector2D::m_y, NSMath::TVector2D::PerpendicularLeft(), NSMath::TRectangle2D::ProjectExtentsToAxis(), ProjectExtentsToX(), ProjectExtentsToY(), TRUE, and NSMath::TRectangle2D::Width().

Here is the call graph for this function:

BOOL TBox2D::IsIntersect const TBox2D box  )  const
 

Determines whether this box intersects with another box.

Parameters:
box [in] second box to test

Definition at line 23 of file Box2D.cpp.

References NSMath::TVector2D::Dot(), NSMath::NSStdMath::fabs(), FALSE, m_axisX, m_center, m_extents, NSMath::TVector2D::m_x, NSMath::TVector2D::m_y, NSMath::TVector2D::PerpendicularLeft(), ProjectExtentsToAxis(), and TRUE.

Referenced by NSMath::TRectangle2D::IsIntersect(), and NSMath::TCircle2D::IsIntersect().

Here is the call graph for this function:

TVector2D TBox2D::LocalAxisX void   )  const [inline]
 

Returns local X-axis for this box.

Warning:
This method creates axis - you can use TBox2D::GetLocalAxisX_X and TBox2D::GetLocalAxisX_Y to get components of axis directly.

Definition at line 724 of file Box2D.h.

TVector2D TBox2D::LocalAxisY void   )  const [inline]
 

Returns local Y-axis for this box.

Warning:
This method creates axis - you can use TBox2D::GetLocalAxisX_X and TBox2D::GetLocalAxisX_Y to get components of axis directly.

Definition at line 735 of file Box2D.h.

References NSMath::TVector2D::PerpendicularLeft().

Here is the call graph for this function:

BOOL TBox2D::operator!= const TBox2D box  )  const [inline]
 

Compare this box with another box with default tolerancy TVector2D::DELTA_COMPARE.

Parameters:
box [in] second box to compare

Definition at line 1504 of file Box2D.h.

References Compare().

Here is the call graph for this function:

TBox2D & TBox2D::operator+= const TVector2D vec  )  [inline]
 

Move this box about specified vector.

Parameters:
vec [in] offset

Definition at line 1514 of file Box2D.h.

TBox2D & TBox2D::operator-= const TVector2D vec  )  [inline]
 

Move this box about specified vector in inverse direction.

Parameters:
vec [in] offset

Definition at line 1526 of file Box2D.h.

TBox2D & TBox2D::operator= const TBox2D box  )  [inline]
 

Assignment operator.

Parameters:
box [in] original box

Definition at line 1482 of file Box2D.h.

References Set().

Here is the call graph for this function:

BOOL TBox2D::operator== const TBox2D box  )  const [inline]
 

Compare this box with another box with default tolerancy TVector2D::DELTA_COMPARE.

Parameters:
box [in] second box to compare

Definition at line 1494 of file Box2D.h.

References Compare().

Here is the call graph for this function:

float TBox2D::ProjectExtentsToAxis const float &  dirX,
const float &  dirY
const [inline]
 

This method projects extents of this box to specified axis determined by directional vector [dirX,dirY].

Note:
Result is always >= 0.
Parameters:
dirX [in] x-component of directional vector
dirY [in] y-component of directional vector

Definition at line 1150 of file Box2D.h.

References NSMath::TVector2D::Dot(), NSMath::NSStdMath::fabs(), GetLocalAxisY_Y(), NSMath::TVector2D::m_x, and NSMath::TVector2D::m_y.

Here is the call graph for this function:

float TBox2D::ProjectExtentsToAxis const TVector2D axisDir  )  const [inline]
 

This method projects extents of this box to specified axis.

Note:
Result is always >= 0.
Parameters:
axisDir [in] axis - must be normalized

Definition at line 1133 of file Box2D.h.

References DBGASSERT_MATH, NSMath::TVector2D::Dot(), NSMath::NSStdMath::fabs(), GetLocalAxisY_Y(), NSMath::TVector2D::IsNormalized(), NSMath::TVector2D::m_x, and NSMath::TVector2D::m_y.

Referenced by IsIntersect(), NSMath::TLine2D::IsNegative(), and NSMath::TLine2D::IsPositive().

Here is the call graph for this function:

float TBox2D::ProjectExtentsToX void   )  const [inline]
 

Project extents of this box to X-axis.

Note:
Result is always >= 0.

Definition at line 1164 of file Box2D.h.

References NSMath::NSStdMath::fabs(), NSMath::TVector2D::m_x, and NSMath::TVector2D::m_y.

Referenced by IsIntersect().

Here is the call graph for this function:

float TBox2D::ProjectExtentsToY void   )  const [inline]
 

Project extents of this box to Y-axis.

Note:
Result is always >= 0.

Definition at line 1180 of file Box2D.h.

References NSMath::NSStdMath::fabs(), NSMath::TVector2D::m_x, and NSMath::TVector2D::m_y.

Referenced by IsIntersect().

Here is the call graph for this function:

void TBox2D::ProjectToAxis const TVector2D axisDir,
float &  timeMin,
float &  timeMax
const [inline]
 

This method projects box to specified axis which goes through origin [0,0].

Axis is determined by its directional vector AXISDIR.

Method computes time parameters for line which is identical with this axis and begin in [0,0] (t=0). You can use these time parameters to compute points on line simply via AXISDIR * TIME.

Parameters:
axisDir [in] axis to projection - must be unit vector!!!
timeMin [out] minimal time value where is box projected
timeMax [out] maximal time value where is box projected

Definition at line 1003 of file Box2D.h.

References NSMath::TVector2D::Dot(), NSMath::NSStdMath::fabs(), GetLocalAxisY_Y(), NSMath::TVector2D::m_x, and NSMath::TVector2D::m_y.

Here is the call graph for this function:

void TBox2D::ProjectToLine const TLine2D line,
float &  timeMin,
float &  timeMax
const [inline]
 

This method projects this box to specified line.

Method computes time parameters for line. You can use these time parameters to compute points on line simply via LINE.CENTER + LINE.DIR * TIME.

Parameters:
line [in] line to projection
timeMin [out] minimal time value where is box projected
timeMax [out] maximal time value where is box projected

Definition at line 1027 of file Box2D.h.

References NSMath::TVector2D::Dot(), NSMath::NSStdMath::fabs(), NSMath::TLine2D::GetDir(), GetLocalAxisY_Y(), NSMath::TVector2D::m_x, NSMath::TVector2D::m_y, and NSMath::TLine2D::Time().

Here is the call graph for this function:

void TBox2D::ProjectToLineSegment const TLineSegment2D seg,
float &  timeMin,
float &  timeMax
const [inline]
 

This method projects this box to specified line segment.

Method computes time parameters for line segment. You can use these time parameters to compute points on segment simply via SEG.START + SEG.DIR * (SEG.LENGTH * TIME).

Parameters:
seg [in] line segment to projection
timeMin [out] minimal time value where is box projected
timeMax [out] maximal time value where is box projected

Definition at line 1054 of file Box2D.h.

References NSMath::TVector2D::Dot(), NSMath::NSStdMath::fabs(), NSMath::TLineSegment2D::GetDir(), GetLocalAxisY_X(), GetLocalAxisY_Y(), NSMath::TLineSegment2D::LengthInverse(), NSMath::TVector2D::m_x, NSMath::TVector2D::m_y, and NSMath::TLineSegment2D::TimeNormalized().

Here is the call graph for this function:

void TBox2D::ProjectToLineSegmentNormalized const TLineSegment2D seg,
float &  timeMin,
float &  timeMax
const [inline]
 

This method projects this box to specified line segment and use NORMALIZED time parameters!!!

Method computes NORMALIZED time parameters for line segment. You can use these time parameters to compute points on segment simply via SEG.START + SEG.DIR * TIME.

Parameters:
seg [in] line segment to projection
timeMin [out] minimal time value where is box projected - its NORMALIZED!!!
timeMax [out] maximal time value where is box projected - its NORMALIZED!!!

Definition at line 1084 of file Box2D.h.

References NSMath::TVector2D::Dot(), NSMath::NSStdMath::fabs(), NSMath::TLineSegment2D::GetDir(), GetLocalAxisY_X(), GetLocalAxisY_Y(), NSMath::TVector2D::m_x, NSMath::TVector2D::m_y, and NSMath::TLineSegment2D::TimeNormalized().

Here is the call graph for this function:

void TBox2D::ProjectToRay const TRay2D ray,
float &  timeMin,
float &  timeMax
const [inline]
 

This method projects this box to specified ray.

Method computes time parameters for ray. You can use these time parameters to compute points on ray simply via RAY.START + RAY.DIR * TIME.

Parameters:
ray [in] ray to projection
timeMin [out] minimal time value where is box projected
timeMax [out] maximal time value where is box projected

Definition at line 1112 of file Box2D.h.

References NSMath::TVector2D::Dot(), NSMath::NSStdMath::fabs(), NSMath::TRay2D::GetDir(), GetLocalAxisY_Y(), NSMath::TVector2D::m_x, NSMath::TVector2D::m_y, and NSMath::TRay2D::Time().

Here is the call graph for this function:

float TBox2D::Radius void   )  const [inline]
 

Compute radius of circumscribed circle.

Note:
It is length of extents vector.

Definition at line 865 of file Box2D.h.

References NSMath::TVector2D::Length().

Here is the call graph for this function:

float TBox2D::RadiusInner void   )  const [inline]
 

Compute radius of incircle.

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

Definition at line 887 of file Box2D.h.

References NSMath::TVector2D::m_x, and NSMath::TVector2D::m_y.

float TBox2D::RadiusInnerSquare void   )  const [inline]
 

Compute square of radius of incircle.

Warning:
This method is slower than TBox2D::RadiusInner !!!

Definition at line 897 of file Box2D.h.

References NSMath::TVector2D::m_x, and NSMath::TVector2D::m_y.

float TBox2D::RadiusSquare void   )  const [inline]
 

Compute square of radius of circumscribed circle.

Note:
This method is faster than TBox2D::Radius because no square root is used.

It is square of length of extents vector.

Definition at line 877 of file Box2D.h.

References NSMath::TVector2D::LengthSq().

Here is the call graph for this function:

void TBox2D::Rotate const float &  angle  )  [inline]
 

Rotate with box around origin about specified angle in radians.

Angle is measured in counter-clockwise order.

Parameters:
angle [in] angle of rotation in radians

Definition at line 598 of file Box2D.h.

References NSMath::TVector2D::RotateSinCos(), and NSMath::NSStdMath::sincos().

Here is the call graph for this function:

void TBox2D::RotateAroundCenter const float &  angle  )  [inline]
 

Rotate this box around center about given angle in radians.

Angle is measured in counter-clockwise order.

Parameters:
angle [in] angle of rotation

Definition at line 672 of file Box2D.h.

References NSMath::TVector2D::RotateSinCos(), and NSMath::NSStdMath::sincos().

Here is the call graph for this function:

void TBox2D::RotateAroundCenterSinCos const float &  tsin,
const float &  tcos
[inline]
 

Rotate this box around center about given angle in radians.

Angle is measured in counter-clockwise order.

Parameters:
tsin [in] sinus of given angle
tcos [in] cosinus of given angle

Definition at line 688 of file Box2D.h.

References NSMath::TVector2D::RotateSinCos().

Here is the call graph for this function:

void TBox2D::RotateAroundPoint const float &  angle,
const TVector2D origin
[inline]
 

Rotate this box around specified point about specified angle in radians.

Angle is measured in counter-clockwise order.

Parameters:
angle [in] angle of rotation in radians
origin [in] point of rotation

Definition at line 629 of file Box2D.h.

References NSMath::TVector2D::RotateSinCos(), and NSMath::NSStdMath::sincos().

Here is the call graph for this function:

void TBox2D::RotateAroundPointSinCos const float &  tsin,
const float &  tcos,
const TVector2D origin
[inline]
 

Rotate this box around specified point about specified angle that sinus and cosinus values are contained in parameters.

Parameters:
tsin [in] sinus of given angle
tcos [in] cosinus of given angle
origin [in] point of rotation

Definition at line 651 of file Box2D.h.

References NSMath::TVector2D::RotateSinCos().

Here is the call graph for this function:

void TBox2D::RotateSinCos const float &  tsin,
const float &  tcos
[inline]
 

Rotate with box around origin about specified angle that sinus and cosinus are stored in parameters.

Parameters:
tsin [in] sinus of given angle
tcos [in] cosinus of given angle

Definition at line 615 of file Box2D.h.

References NSMath::TVector2D::RotateSinCos().

Here is the call graph for this function:

void TBox2D::RotateZero void   )  [inline]
 

Set rotation of this box to zero.

It means local X-axis will be set to [1,0] and Y-axis to [0,1].

Definition at line 697 of file Box2D.h.

References NSMath::TVector2D::Set().

Here is the call graph for this function:

void TBox2D::Set const TVector2D center,
const TVector2D extents
[inline]
 

Set this box from center and extents.

Note:
Local axes will be set to [1,0] and [0,1] thus box will be aligned to principal axes.
Parameters:
center [in] center of box
extents [in] HALF of width and height - must be positive values!!!

Definition at line 490 of file Box2D.h.

References DBGASSERT_MATH, NSMath::TVector2D::m_x, NSMath::TVector2D::m_y, and NSMath::TVector2D::Set().

Here is the call graph for this function:

void TBox2D::Set const TBox2D box  )  [inline]
 

Set this box according to another box.

Parameters:
box [in] original box

Definition at line 475 of file Box2D.h.

References m_axisX, m_center, and m_extents.

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

void TBox2D::SetAngle const TVector2D center,
const TVector2D extents,
const float &  xAngle
[inline]
 

Set this box from center, extents and angle (in radians) between local X-axis and principal X-axis - [1,0].

Note:
Local Y-axis is computed and always points to the left from local X-axis.

Angle is measured in counter-clockwise order.

Parameters:
center [in] center of box
extents [in] HALF of width and height - must be positive values!!!
xAngle [in] angle between axis [1,0] an local X-axis of this box - in radians.

Definition at line 531 of file Box2D.h.

References DBGASSERT_MATH, NSMath::TVector2D::m_x, NSMath::TVector2D::m_y, NSMath::TVector2D::Set(), and NSMath::NSStdMath::sincos().

Referenced by TBox2D().

Here is the call graph for this function:

void TBox2D::SetDir const TVector2D center,
const TVector2D extents,
const TVector2D xAxis
[inline]
 

Set this box from center, extents and local X-axis that must be NORMALIZED.

Note:
Local Y-axis is computed and always point to the left from local X-axis.
Parameters:
center [in] center of box
extents [in] HALF of width and height - must be positive values!!!
xAxis [in] local X-axis - must be normalized!!!

Definition at line 509 of file Box2D.h.

References DBGASSERT_MATH, NSMath::TVector2D::IsNormalized(), NSMath::TVector2D::m_x, and NSMath::TVector2D::m_y.

Referenced by TBox2D().

Here is the call graph for this function:

void TBox2D::SetSinCos const TVector2D center,
const TVector2D extents,
const float &  xSin,
const float &  xCos
[inline]
 

Set this box from center, extents and angle (in radians) between local X-axis and principal X-axis.

Sinus and cosinus of this angle are contained in parameters

Note:
Local Y-axis is computed and always points to the left from local X-axis.
Parameters:
center [in] center of box
extents [in] HALF of width and height - must be positive values!!!
xSin [in] sinus of angle between X-axis and principal axis [1,0]
xCos [in] cosinus of angle between X-axis and principal axis [1,0]

Definition at line 555 of file Box2D.h.

References DBGASSERT_MATH, NSMath::TVector2D::m_x, NSMath::TVector2D::m_y, and NSMath::TVector2D::Set().

Referenced by TBox2D().

Here is the call graph for this function:

void TBox2D::ToBoxSpace float &  x,
float &  y
const [inline]
 

Convert given point [x,y] from world coordinates to box coordinates.

Warning:
Box coordinates [0,0] are at center of box !!!
Parameters:
x [in out] point's x-coordinate to convert
y [in out] point's y-coordinate to convert

Definition at line 787 of file Box2D.h.

References NSMath::TVector2D::m_x, and NSMath::TVector2D::m_y.

void TBox2D::ToBoxSpace TVector2D vec  )  const [inline]
 

Convert given point from world coordinates to box coordinates.

Warning:
Box coordinates [0,0] are at center of box !!!
Parameters:
vec [in out] point to convert and result too

Definition at line 774 of file Box2D.h.

References NSMath::TVector2D::m_x, and NSMath::TVector2D::m_y.

TVector2D TBox2D::ToBoxSpaceGet const float &  x,
const float &  y
const [inline]
 

Convert given point [x,y] from world coordinates to box coordinates.

Warning:
Box coordinates [0,0] are at center of box !!!
Parameters:
x [in] point's x-coordinate to convert
y [in] point's y-coordinate to convert

Definition at line 762 of file Box2D.h.

References ToBoxSpaceGet().

Here is the call graph for this function:

TVector2D TBox2D::ToBoxSpaceGet const TVector2D vec  )  const [inline]
 

Convert given point from world coordinates to box coordinates.

Warning:
Box coordinates [0,0] are at center of box !!!
Parameters:
vec [in] point to convert

Definition at line 747 of file Box2D.h.

References NSMath::TVector2D::Dot(), NSMath::TVector2D::m_x, and NSMath::TVector2D::m_y.

Referenced by AddPoint(), IsInside(), IsIntersect(), and ToBoxSpaceGet().

Here is the call graph for this function:

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

Translate this box about specified vector [x,y].

Parameters:
x [in] offset in x-coordinate
y [in] offset in y-coordinate

Definition at line 586 of file Box2D.h.

References NSMath::TVector2D::Add().

Here is the call graph for this function:

void TBox2D::Translate const TVector2D vec  )  [inline]
 

Translate this box about specified vector.

Parameters:
vec [in] offset

Definition at line 575 of file Box2D.h.

float TBox2D::Width void   )  const [inline]
 

Returns width of this box - its length along local X-axis.

Definition at line 705 of file Box2D.h.

References NSMath::TVector2D::m_x.


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