PixelLightAPI  .
Public Member Functions | Public Attributes
PLMath::Rectangle Class Reference

Rectangle (2D axis aligned bounding box) class. More...

#include <Rectangle.h>

List of all members.

Public Member Functions

 Rectangle ()
 Default constructor setting all minimum and maximum components to 0.
 Rectangle (const Rectangle &cSource)
 Copy constructor.
 Rectangle (const Vector2 &vMin, const Vector2 &vMax)
 Constructor.
 Rectangle (float fMinX, float fMinY, float fMaxX, float fMaxY)
 Constructor.
 ~Rectangle ()
 Destructor.
Rectangleoperator= (const Rectangle &cSource)
 Copy operator.
Vector2 GetCenter () const
 Returns the center of the rectangle.
float GetX () const
 Returns the x position.
float GetY () const
 Returns the y position.
float GetWidth () const
 Returns the width.
float GetHeight () const
 Returns the height.
float CalculateSurface () const
 Calculates the surface of the rectangle.
void ClipByRectangle (const Rectangle &cEnclosed)
 Clips this rectangle with another one.
void AppendToRectangle (const Vector2 &vV)
 Appends a vertex to the rectangle.
void CombineRectangles (const Rectangle &cRectangle)
 Combines two rectangles.
PLMATH_API bool ScreenRectangle (const PLCore::Array< Vector3 > &lstPoints, bool bZCull, const Matrix4x4 &mMVP, PLCore::uint32 nX, PLCore::uint32 nY, PLCore::uint32 nWidth, PLCore::uint32 nHeight)
 Calculates the screen-space bounding rectangle of the given array of points.
PLMATH_API bool ScreenRectangle (const PLCore::Array< Vector4 > &lstPoints, bool bZCull, const Matrix4x4 &mMVP, PLCore::uint32 nX, PLCore::uint32 nY, PLCore::uint32 nWidth, PLCore::uint32 nHeight)
 Calculates the screen-space bounding rectangle of the given array of points.

Public Attributes

Vector2 vMin
Vector2 vMax

Detailed Description

Rectangle (2D axis aligned bounding box) class.


Constructor & Destructor Documentation

Default constructor setting all minimum and maximum components to 0.

PLMath::Rectangle::Rectangle ( const Rectangle cSource) [inline]

Copy constructor.

Parameters:
[in]cSourceSource to copy from
PLMath::Rectangle::Rectangle ( const Vector2 vMin,
const Vector2 vMax 
) [inline]

Constructor.

Parameters:
[in]vMinMinimum position
[in]vMaxMaximum position
PLMath::Rectangle::Rectangle ( float  fMinX,
float  fMinY,
float  fMaxX,
float  fMaxY 
) [inline]

Constructor.

Parameters:
[in]fMinXX component of the minimum position
[in]fMinYY component of the minimum position
[in]fMaxXX component of the maximum position
[in]fMaxYY component of the maximum position

Destructor.


Member Function Documentation

Rectangle & PLMath::Rectangle::operator= ( const Rectangle cSource) [inline]

Copy operator.

Parameters:
[in]cSourceSource to copy from
Returns:
Reference to this instance

Returns the center of the rectangle.

Returns:
Center of the rectangle ((vMax+vMin)/2)
float PLMath::Rectangle::GetX ( ) const [inline]

Returns the x position.

Returns:
X position
float PLMath::Rectangle::GetY ( ) const [inline]

Returns the y position.

Returns:
Y position
float PLMath::Rectangle::GetWidth ( ) const [inline]

Returns the width.

Returns:
Width
float PLMath::Rectangle::GetHeight ( ) const [inline]

Returns the height.

Returns:
Height
float PLMath::Rectangle::CalculateSurface ( ) const [inline]

Calculates the surface of the rectangle.

Returns:
Surface of the rectangle
void PLMath::Rectangle::ClipByRectangle ( const Rectangle cEnclosed) [inline]

Clips this rectangle with another one.

Parameters:
[in]cEnclosedRectangle to clip this rectangle with
void PLMath::Rectangle::AppendToRectangle ( const Vector2 vV) [inline]

Appends a vertex to the rectangle.

Parameters:
[in]vVVertex to append
void PLMath::Rectangle::CombineRectangles ( const Rectangle cRectangle) [inline]

Combines two rectangles.

Parameters:
[in]cRectangleRectangle to combine with this rectangle
PLMATH_API bool PLMath::Rectangle::ScreenRectangle ( const PLCore::Array< Vector3 > &  lstPoints,
bool  bZCull,
const Matrix4x4 mMVP,
PLCore::uint32  nX,
PLCore::uint32  nY,
PLCore::uint32  nWidth,
PLCore::uint32  nHeight 
)

Calculates the screen-space bounding rectangle of the given array of points.

Parameters:
[in]lstPointsArray of points
[in]bZCullDetermines whether or not the function should also return 'false' if the rectangle lies outside the depth range
[in]mMVPConcatenated modelview/projection matrix
[in]nXX screen position
[in]nYY screen position
[in]nWidthScreen width
[in]nHeightScreen height
Remarks:
If all went fine, this rectangle will receive the screen-space bounding rectangle of the given array of points.
Returns:
'false' if the rectangle is entirely off-screen, else 'true'
PLMATH_API bool PLMath::Rectangle::ScreenRectangle ( const PLCore::Array< Vector4 > &  lstPoints,
bool  bZCull,
const Matrix4x4 mMVP,
PLCore::uint32  nX,
PLCore::uint32  nY,
PLCore::uint32  nWidth,
PLCore::uint32  nHeight 
)

Calculates the screen-space bounding rectangle of the given array of points.

Parameters:
[in]lstPointsArray of points
[in]bZCullDetermines whether or not the function should also return 'false' if the rectangle lies outside the depth range
[in]mMVPConcatenated modelview/projection matrix
[in]nXX screen position
[in]nYY screen position
[in]nWidthScreen width
[in]nHeightScreen height
Remarks:
If all went fine, this rectangle will receive the screen-space bounding rectangle of the given array of points.
Returns:
'false' if the rectangle is entirely off-screen, else 'true'

Member Data Documentation

Minimum position

Maximum position


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


PixelLight PixelLight 0.9.11-R1
Copyright (C) 2002-2012 by The PixelLight Team
Last modified Thu Feb 23 2012 14:09:36
The content of this PixelLight document is published under the
Creative Commons Attribution-NonCommercial-ShareAlike 3.0 Unported