PixelLightAPI  .
Public Types | Public Member Functions | Protected Attributes
PLMath::PlaneSet Class Reference

A set of planes defines a convex volume (e.g. the frustum, an event area...) More...

#include <PlaneSet.h>

Inheritance diagram for PLMath::PlaneSet:
Inheritance graph
[legend]

List of all members.

Public Types

enum  EViewPlaneOrder {
  VPNear = 0, VPRight = 1, VPLeft = 2, VPBottom = 3,
  VPTop = 4, VPFar = 5
}
 Default view plane order. More...

Public Member Functions

PLMATH_API PlaneSet ()
 Constructor.
PLMATH_API PlaneSet (const PlaneSet &cSource)
 Copy constructor.
virtual PLMATH_API ~PlaneSet ()
 Destructor.
PLMATH_API PlaneCreate ()
 Creates and adds a new plane to the plane set.
PLMATH_API void CreateBox (const Vector3 &vMin, const Vector3 &vMax)
 Creates 6 planes which enclose a box area.
PLMATH_API void CreateViewPlanes (const Matrix4x4 &mViewProjection, bool bInfProj=false)
 Creates view planes using a view projection matrix.
PLMATH_API bool CreateViewPlanes (const PLCore::Array< Vector3 > &lstVertices, const Vector3 &vViewPosition)
 Creates view planes using vertices and a view position.
PLMATH_API void CreateSelectionPlanes (const Vector2 &vStartPos, const Vector2 &vEndPos, int nX, int nY, int nWidth, int nHeight, const Matrix4x4 &mProjection, const Matrix4x4 &mView, bool bInfProj=false)
 Creates selection planes.
PLMATH_API void CreateSelectionPlanes (const Vector2 &vStartPos, const Vector2 &vEndPos, int nX, int nY, int nWidth, int nHeight, const Matrix4x4 &mProjection, const Matrix3x4 &mView, bool bInfProj=false)
PLMATH_API PLCore::uint32 GetNumOfPlanes () const
 Returns the number of planes.
PLMATH_API const Planeoperator[] (int nID) const
 Returns a plane.
PLMATH_API Planeoperator[] (int nID)
 Returns a plane.
PLMATH_API PLCore::Array< Plane > & GetList ()
 Returns the plane list.
PLMATH_API const PLCore::Array
< Plane > & 
GetList () const
 Returns the plane list.
PLMATH_API bool RemovePlane (PLCore::uint32 nID=0)
 Removes a plane.
PLMATH_API void Clear ()
 Clears the plane set.
PLMATH_API PlaneSetoperator= (const PlaneSet &cSource)
 Copy operator.
PLMATH_API PlaneSetoperator*= (const Matrix3x3 &mRot)
 Plane set transformation.
PLMATH_API PlaneSetoperator*= (const Matrix3x4 &mTrans)
 Plane set transformation.
PLMATH_API PlaneSetoperator*= (const Matrix4x4 &mTrans)
 Plane set transformation.
PLMATH_API bool IsConvex () const
 Checks whether the plane set is convex or not.
PLMATH_API void CalculateSphere (Sphere &cSphere) const
 Calculates the sphere surrounding the enclosed area.
PLMATH_API void CalculateBox (Vector3 &vMin, Vector3 &vMax) const
 Calculates the box surrounding the enclosed area.

Protected Attributes

PLCore::Array< Planem_lstPlane

Detailed Description

A set of planes defines a convex volume (e.g. the frustum, an event area...)

Note:
  • If there are no planes the tests whether something is inside the planes or not will return always 'false'

Member Enumeration Documentation

Default view plane order.

Enumerator:
VPNear 

Near plane

VPRight 

Right plane

VPLeft 

Left plane

VPBottom 

Bottom plane

VPTop 

Top plane

VPFar 

Far plane


Constructor & Destructor Documentation

Constructor.

PLMATH_API PLMath::PlaneSet::PlaneSet ( const PlaneSet cSource)

Copy constructor.

Parameters:
[in]cSourceSource to copy from
virtual PLMATH_API PLMath::PlaneSet::~PlaneSet ( ) [virtual]

Destructor.


Member Function Documentation

Creates and adds a new plane to the plane set.

Returns:
The created and added new plane, a null pointer if there was an error
PLMATH_API void PLMath::PlaneSet::CreateBox ( const Vector3 vMin,
const Vector3 vMax 
)

Creates 6 planes which enclose a box area.

Parameters:
[in]vMinMinimum position of the box
[in]vMaxMaximum position of the box
Remarks:
Plane order:
0 = Left (min x)
1 = Right (max x)
2 = Bottom (min y)
3 = Top (max y)
4 = Back (min z)
5 = Front (max z)
Note:
  • The six enclosing planes corresponding to the box are created automatically
PLMATH_API void PLMath::PlaneSet::CreateViewPlanes ( const Matrix4x4 mViewProjection,
bool  bInfProj = false 
)

Creates view planes using a view projection matrix.

Parameters:
[in]mViewProjectionView projection matrix
[in]bInfProjIs the projection matrix part infinite? In this case, there's no far plane.
Note:
  • If there are not enough planes this function will create it. There are 6 view planes of the projection matrix is not infinite, else there are 5 planes. (no far plane)
  • See EViewPlaneOrder for plane order
PLMATH_API bool PLMath::PlaneSet::CreateViewPlanes ( const PLCore::Array< Vector3 > &  lstVertices,
const Vector3 vViewPosition 
)

Creates view planes using vertices and a view position.

Parameters:
[in]lstVerticesVertices (xyz, counterclockwise) defining a 'portal'-polygon (there must be at least 3 vertices)
[in]vViewPositionView position
Returns:
'true' if all went fine, else 'false' (not enough vertices provided?)
Remarks:
You can for example use this function to create a 'frustum of a portal'.
Note:
  • If there are not enough planes this function will create it. There are 5 planes. (no far plane)
PLMATH_API void PLMath::PlaneSet::CreateSelectionPlanes ( const Vector2 vStartPos,
const Vector2 vEndPos,
int  nX,
int  nY,
int  nWidth,
int  nHeight,
const Matrix4x4 mProjection,
const Matrix4x4 mView,
bool  bInfProj = false 
)

Creates selection planes.

Parameters:
[in]vStartPosSelection rectangle start position
[in]vEndPosSelection rectangle end position
[in]nXX component of the pixel coordinate of the upper-left corner of the viewport
[in]nYY component of the pixel coordinate of the upper-left corner of the viewport
[in]nWidthWidth of the clip volume, in pixels
[in]nHeightHeight of the clip volume, in pixels
[in]mProjectionProjection matrix
[in]mViewView matrix
[in]bInfProjIs the projection matrix infinite? In this case, there's no far plane.
Note:
  • Use this function for instance when dragging a selection rectangle via mouse to receive the scene nodes within it. The start and end positions are within the given viewport.
  • If there are not enough planes this function will create it. There are 6 selection planes.
  • See EViewPlaneOrder for plane order
PLMATH_API void PLMath::PlaneSet::CreateSelectionPlanes ( const Vector2 vStartPos,
const Vector2 vEndPos,
int  nX,
int  nY,
int  nWidth,
int  nHeight,
const Matrix4x4 mProjection,
const Matrix3x4 mView,
bool  bInfProj = false 
)
PLMATH_API PLCore::uint32 PLMath::PlaneSet::GetNumOfPlanes ( ) const

Returns the number of planes.

Returns:
Number of planes in the set
PLMATH_API const Plane* PLMath::PlaneSet::operator[] ( int  nID) const

Returns a plane.

Parameters:
[in]nIDID of the plane which should be returned
Returns:
Plane with the given ID, a null pointer if there was an error
PLMATH_API Plane* PLMath::PlaneSet::operator[] ( int  nID)

Returns a plane.

Parameters:
[in]nIDID of the plane which should be returned
Returns:
Plane with the given ID, a null pointer if there was an error

Returns the plane list.

Returns:
Plane list
PLMATH_API const PLCore::Array<Plane>& PLMath::PlaneSet::GetList ( ) const

Returns the plane list.

Returns:
Plane list
PLMATH_API bool PLMath::PlaneSet::RemovePlane ( PLCore::uint32  nID = 0)

Removes a plane.

Parameters:
[in]nIDID of the plane which should be removed
Returns:
'true' if all went fine, else 'false'
PLMATH_API void PLMath::PlaneSet::Clear ( )

Clears the plane set.

PLMATH_API PlaneSet& PLMath::PlaneSet::operator= ( const PlaneSet cSource)

Copy operator.

Parameters:
[in]cSourceSource to copy from
Returns:
Reference to this instance
PLMATH_API PlaneSet& PLMath::PlaneSet::operator*= ( const Matrix3x3 mRot)

Plane set transformation.

Parameters:
[in]mRot3x3 rotation matrix
Returns:
This instance
PLMATH_API PlaneSet& PLMath::PlaneSet::operator*= ( const Matrix3x4 mTrans)

Plane set transformation.

Parameters:
[in]mTrans3x4 transformation matrix
Returns:
This instance
PLMATH_API PlaneSet& PLMath::PlaneSet::operator*= ( const Matrix4x4 mTrans)

Plane set transformation.

Parameters:
[in]mTrans4x4 transformation matrix
Returns:
This instance
PLMATH_API bool PLMath::PlaneSet::IsConvex ( ) const

Checks whether the plane set is convex or not.

Returns:
'true' if the plane set is convex, else 'false'
Remarks:
A plane set is a convex volume if each plane has at least one 'neighbour' plane 'facing' it.
PLMATH_API void PLMath::PlaneSet::CalculateSphere ( Sphere cSphere) const

Calculates the sphere surrounding the enclosed area.

Parameters:
[out]cSphereWill receive the sphere surrounding the enclosed area
See also:
  • GetSphere()
PLMATH_API void PLMath::PlaneSet::CalculateBox ( Vector3 vMin,
Vector3 vMax 
) const

Calculates the box surrounding the enclosed area.

Parameters:
[out]vMinWill receive the minimum position of the box
[out]vMaxWill receive the maximum position of the box

Member Data Documentation

Plane list


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


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