Cocos2d-x  v3.10
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Groups
PUPlane Class Reference

Internal classŁ¬defines a plane in 3D space. More...

Public Types

enum  Side
 The "positive side" of the plane is the half space to which the plane normal points. More...
 

Public Member Functions

 PUPlane ()
 Default constructor - sets everything to 0.
 
 PUPlane (const Vec3 &rkNormal, float fConstant)
 Construct a plane through a normal, and a distance to move the plane along the normal. More...
 
 PUPlane (float a, float b, float c, float d)
 Construct a plane using the 4 constants directly.
 
float getDistance (const Vec3 &rkPoint) const
 Returns the side where the alignedBox is. More...
 
void redefine (const Vec3 &rkPoint0, const Vec3 &rkPoint1, const Vec3 &rkPoint2)
 Redefine this plane based on 3 points. More...
 
void redefine (const Vec3 &rkNormal, const Vec3 &rkPoint)
 Redefine this plane based on a normal and a point. More...
 
Vec3 projectVector (const Vec3 &v) const
 Project a vector onto the plane. More...
 
float normalize (void)
 Normalises the plane. More...
 
bool operator== (const PUPlane &rhs) const
 Comparison operator.
 

Detailed Description

Internal classŁ¬defines a plane in 3D space.

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

enum Side

The "positive side" of the plane is the half space to which the plane normal points.

The "negative side" is the other half space. The flag "no side" indicates the plane itself.

var Side

The "positive side" of the plane is the half space to which the plane normal points.

The "negative side" is the other half space. The flag "no side" indicates the plane itself.

local Side

The "positive side" of the plane is the half space to which the plane normal points.

The "negative side" is the other half space. The flag "no side" indicates the plane itself.

Constructor & Destructor Documentation

PUPlane ( const Vec3 rkNormal,
float  fConstant 
)

Construct a plane through a normal, and a distance to move the plane along the normal.

var PUPlane ( var  rkNormal,
var  fConstant 
)

Construct a plane through a normal, and a distance to move the plane along the normal.

local PUPlane ( local  rkNormal,
local  fConstant 
)

Construct a plane through a normal, and a distance to move the plane along the normal.

Member Function Documentation

float getDistance ( const Vec3 rkPoint) const

Returns the side where the alignedBox is.

The flag BOTH_SIDE indicates an intersecting box. One corner ON the plane is sufficient to consider the box and the plane intersecting. Returns which side of the plane that the given box lies on. The box is defined as centre/half-size pairs for effectively.

Parameters
centreThe centre of the box.
halfSizeThe half-size of the box.
Returns
POSITIVE_SIDE if the box complete lies on the "positive side" of the plane, NEGATIVE_SIDE if the box complete lies on the "negative side" of the plane, and BOTH_SIDE if the box intersects the plane.This is a pseudodistance. The sign of the return value is positive if the point is on the positive side of the plane, negative if the point is on the negative side, and zero if the point is on the plane.
Parameters
rkPointThe absolute value of the return value is the true distance only when the plane normal is a unit length vector. Get a pseudodistance,positive if the point is on the positive side of the plane, negative if the point is on the negative side, and zero if the point is on the plane. One point. The pseudodistance.
var getDistance ( var  rkPoint)

Returns the side where the alignedBox is.

The flag BOTH_SIDE indicates an intersecting box. One corner ON the plane is sufficient to consider the box and the plane intersecting. Returns which side of the plane that the given box lies on. The box is defined as centre/half-size pairs for effectively.

Parameters
centreThe centre of the box.
halfSizeThe half-size of the box.
Returns
POSITIVE_SIDE if the box complete lies on the "positive side" of the plane, NEGATIVE_SIDE if the box complete lies on the "negative side" of the plane, and BOTH_SIDE if the box intersects the plane.This is a pseudodistance. The sign of the return value is positive if the point is on the positive side of the plane, negative if the point is on the negative side, and zero if the point is on the plane.
Parameters
rkPointThe absolute value of the return value is the true distance only when the plane normal is a unit length vector. Get a pseudodistance,positive if the point is on the positive side of the plane, negative if the point is on the negative side, and zero if the point is on the plane. One point. The pseudodistance.
local getDistance ( local  rkPoint)

Returns the side where the alignedBox is.

The flag BOTH_SIDE indicates an intersecting box. One corner ON the plane is sufficient to consider the box and the plane intersecting. Returns which side of the plane that the given box lies on. The box is defined as centre/half-size pairs for effectively.

Parameters
centreThe centre of the box.
halfSizeThe half-size of the box.
Returns
POSITIVE_SIDE if the box complete lies on the "positive side" of the plane, NEGATIVE_SIDE if the box complete lies on the "negative side" of the plane, and BOTH_SIDE if the box intersects the plane.This is a pseudodistance. The sign of the return value is positive if the point is on the positive side of the plane, negative if the point is on the negative side, and zero if the point is on the plane.
Parameters
rkPointThe absolute value of the return value is the true distance only when the plane normal is a unit length vector. Get a pseudodistance,positive if the point is on the positive side of the plane, negative if the point is on the negative side, and zero if the point is on the plane. One point. The pseudodistance.
void redefine ( const Vec3 rkPoint0,
const Vec3 rkPoint1,
const Vec3 rkPoint2 
)

Redefine this plane based on 3 points.

The Point 0. The Point 1. The Point 2.

var redefine ( var  rkPoint0,
var  rkPoint1,
var  rkPoint2 
)

Redefine this plane based on 3 points.

The Point 0. The Point 1. The Point 2.

local redefine ( local  rkPoint0,
local  rkPoint1,
local  rkPoint2 
)

Redefine this plane based on 3 points.

The Point 0. The Point 1. The Point 2.

void redefine ( const Vec3 rkNormal,
const Vec3 rkPoint 
)

Redefine this plane based on a normal and a point.

The Normal. The Point.

var redefine ( var  rkNormal,
var  rkPoint 
)

Redefine this plane based on a normal and a point.

The Normal. The Point.

local redefine ( local  rkNormal,
local  rkPoint 
)

Redefine this plane based on a normal and a point.

The Normal. The Point.

Vec3 projectVector ( const Vec3 v) const

Project a vector onto the plane.

The Point.

var projectVector ( var  v)

Project a vector onto the plane.

The Point.

local projectVector ( local  v)

Project a vector onto the plane.

The Point.

float normalize ( void  )

Normalises the plane.

The previous length of the plane's normal.

var normalize (   )

Normalises the plane.

The previous length of the plane's normal.

local normalize (   )

Normalises the plane.

The previous length of the plane's normal.


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