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

Plane class. More...

#include <Plane.h>

List of all members.

Public Types

enum  Component { X = 0, Y = 1, Z = 2, W = 3 }
 Component. More...
enum  ESide { Behind = -1, Coinciding = 0, InFront = 1 }
 Plane/point relation. More...

Public Member Functions

 Plane ()
 Default constructor setting all components to 0.
 Plane (float fA, float fB, float fC, float fD)
 Constructor.
 Plane (const Vector3 &vOrigin, const Vector3 &vNormal)
 Constructor.
 Plane (const Vector3 &vV1, const Vector3 &vV2, const Vector3 &vV3)
 Constructor.
 ~Plane ()
 Destructor.
Planeoperator= (const Plane &cSource)
 Copy operator.
bool operator== (const Plane &cPlane) const
bool operator!= (const Plane &cPlane) const
PLMATH_API Plane operator* (const Matrix3x3 &mRot) const
PLMATH_API Plane operator* (const Matrix3x4 &mTrans) const
PLMATH_API Plane operator* (const Matrix4x4 &mTrans) const
PLMATH_API Planeoperator*= (const Matrix3x3 &mRot)
PLMATH_API Planeoperator*= (const Matrix3x4 &mTrans)
PLMATH_API Planeoperator*= (const Matrix4x4 &mTrans)
PlaneComputeND (const Vector3 &vOrigin, const Vector3 &vNormal)
 Calculates the plane.
PLMATH_API PlaneComputeND (const Vector3 &vV1, const Vector3 &vV2, const Vector3 &vV3)
 Calculates the plane.
PLMATH_API PlaneComputeTangentPlaneOfEllipsoid (const Vector3 &vPointPos, const Vector3 &vEllipsoidPos, const Vector3 &vEllipsoidRadius)
 Computes the tangent plane of an ellipsoid.
PlaneNormalize ()
 Normalizes the plane.
PLMATH_API Plane Lerp (const Plane &cP2, float fFactor)
 Calculates the interpolated plane from two other planes.
ESide GetSide (const Vector3 &vPoint) const
 Returns the side of the plane the given point is on.
float GetDistance (const Vector3 &vPoint) const
 Calculates the distance from a point to the plane.
float GetDistance (const Vector4 &vPoint) const
 Calculates the distance from a point to the plane.
float GetDistance (const Vector3 &vRayPos, const Vector3 &vRayDir) const
 Calculates the distance to the ray/intersection point.
Vector3 GetPointOnPlane () const
 Returns a point on the plane.
Vector3 ClipEdge (const Vector3 &vV1, const Vector3 &vV2) const
 Clips an edge by this plane.

Public Attributes

union {
   float   fVector [4]
   struct {
      float   a
      float   b
      float   c
      float   d
   } 
   struct {
      float   fN [3]
      float   fD
   } 
}; 

Detailed Description

Plane class.

Remarks:
A plane is defined in 3D space by the equation: Ax + By + Cz - D = 0
This equates to a vector - the normal of the plane, whose x, y and z components equate to the coefficients A, B and C respectively, and a constant D which is the distance along the normal you have to go to move the plane back to the origin.

Member Enumeration Documentation

Component.

Enumerator:
X 

X component

Y 

Y component

Z 

Z component

W 

Z component

Plane/point relation.

Enumerator:
Behind 

Behind the plane (distance < 0)

Coinciding 

Lies on the plane (distance = 0)

InFront 

In font of the plane (distance > 0)


Constructor & Destructor Documentation

PLMath::Plane::Plane ( ) [inline]

Default constructor setting all components to 0.

PLMath::Plane::Plane ( float  fA,
float  fB,
float  fC,
float  fD 
) [inline]

Constructor.

Parameters:
[in]fAPlane equation value A
[in]fBPlane equation value B
[in]fCPlane equation value C
[in]fDPlane equation value D
PLMath::Plane::Plane ( const Vector3 vOrigin,
const Vector3 vNormal 
) [inline]

Constructor.

Parameters:
[in]vOriginPlane origin
[in]vNormalPlane normal (will be normalized automatically)
PLMath::Plane::Plane ( const Vector3 vV1,
const Vector3 vV2,
const Vector3 vV3 
) [inline]

Constructor.

Parameters:
[in]vV1First vertex on the plane
[in]vV2Second vertex on the plane
[in]vV3Third vertex on the plane
PLMath::Plane::~Plane ( ) [inline]

Destructor.


Member Function Documentation

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

Copy operator.

Parameters:
[in]cSourceSource to copy from
Returns:
Reference to this instance
bool PLMath::Plane::operator== ( const Plane cPlane) const [inline]
bool PLMath::Plane::operator!= ( const Plane cPlane) const [inline]
PLMATH_API Plane PLMath::Plane::operator* ( const Matrix3x3 mRot) const
PLMATH_API Plane PLMath::Plane::operator* ( const Matrix3x4 mTrans) const
PLMATH_API Plane PLMath::Plane::operator* ( const Matrix4x4 mTrans) const
PLMATH_API Plane& PLMath::Plane::operator*= ( const Matrix3x3 mRot)
PLMATH_API Plane& PLMath::Plane::operator*= ( const Matrix3x4 mTrans)
PLMATH_API Plane& PLMath::Plane::operator*= ( const Matrix4x4 mTrans)
Plane & PLMath::Plane::ComputeND ( const Vector3 vOrigin,
const Vector3 vNormal 
) [inline]

Calculates the plane.

Parameters:
[in]vOriginPlane origin
[in]vNormalPlane normal (will be normalized automatically)
Returns:
This instance
PLMATH_API Plane& PLMath::Plane::ComputeND ( const Vector3 vV1,
const Vector3 vV2,
const Vector3 vV3 
)

Calculates the plane.

Parameters:
[in]vV1First vertex on the plane
[in]vV2Second vertex on the plane
[in]vV3Third vertex on the plane
Returns:
This instance
PLMATH_API Plane& PLMath::Plane::ComputeTangentPlaneOfEllipsoid ( const Vector3 vPointPos,
const Vector3 vEllipsoidPos,
const Vector3 vEllipsoidRadius 
)

Computes the tangent plane of an ellipsoid.

Parameters:
[in]vPointPosPoint on the plane
[in]vEllipsoidPosEllipsoid position
[in]vEllipsoidRadiusEllipsoid radius
Returns:
This instance

Normalizes the plane.

Returns:
This instance
PLMATH_API Plane PLMath::Plane::Lerp ( const Plane cP2,
float  fFactor 
)

Calculates the interpolated plane from two other planes.

Parameters:
[in]cP2Other plane to interpolate with
[in]fFactorInterpolation factor. 0.0 = this plane, 1.0 = cP2
Returns:
The resulting interpolated plane
Plane::ESide PLMath::Plane::GetSide ( const Vector3 vPoint) const [inline]

Returns the side of the plane the given point is on.

Parameters:
[in]vPointPoint to check
Returns:
The side of the plane the given point is on
float PLMath::Plane::GetDistance ( const Vector3 vPoint) const [inline]

Calculates the distance from a point to the plane.

Parameters:
[in]vPointPoint the distance should be calculated
Returns:
The distance from the point to the plane
float PLMath::Plane::GetDistance ( const Vector4 vPoint) const [inline]

Calculates the distance from a point to the plane.

Parameters:
[in]vPointPoint the distance should be calculated
Returns:
The distance from the point to the plane
float PLMath::Plane::GetDistance ( const Vector3 vRayPos,
const Vector3 vRayDir 
) const [inline]

Calculates the distance to the ray/intersection point.

Parameters:
[in]vRayPosRay position
[in]vRayDirRay direction (must be normalized)
Returns:
Distance to ray/plane intersection point (-1.0 if there's no intersection)

Returns a point on the plane.

Returns:
A point on the plane (-D*N)
Vector3 PLMath::Plane::ClipEdge ( const Vector3 vV1,
const Vector3 vV2 
) const [inline]

Clips an edge by this plane.

Parameters:
[in]vV1The first vertex of the edge
[in]vV2The second vertex of the edge
Returns:
The clipped vertex of the edge on this plane

Member Data Documentation

Coefficients

Coefficients

Plane normal

Distance to origin

union { ... }

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:35
The content of this PixelLight document is published under the
Creative Commons Attribution-NonCommercial-ShareAlike 3.0 Unported