Public Member Functions | Public Attributes

Plane Class Reference

Determines a 3D plane. More...

List of all members.

Public Member Functions

OZCOLLIDE_API Plane ()
 Constructs an uninitialised plane.
OZCOLLIDE_API Plane (float a, float b, float c, float d)
 Constructs an initialised plane.
OZCOLLIDE_API void fromPoints (const Vec3f &p0, const Vec3f &p1, const Vec3f &p2)
 Constructs a plane from three points.
OZCOLLIDE_API void fromPointsNN (const Vec3f &p0, const Vec3f &p1, const Vec3f &p2)
 Constructs a plane from three points and don't normalize the equation.
OZCOLLIDE_API void fromPointAndNormal (const Vec3f &p, const Vec3f &n)
 Constructs a plane from a point and a normal.
ozinline float dot (const Vec3f &p) const
 Makes a dot product between a point and the plane.
ozinline float dist (const Vec3f &p) const
 Calculates the distance between a point and the plane.
ozinline Vec3f reflect (const Vec3f &vec)
 Reflects a vector on the plane.
ozinline Vec3f project (const Vec3f &p)
 Projects a point onto the plane.
ozinline bool isOnPlane (const Vec3f &p, float threshold=0.001f)
 Tells if a point is on the plane or not.
ozinline bool intersectWithLine (const Vec3f &p0, const Vec3f &p1, float &t)
 Determines if a line and the place intersect.

Public Attributes

float a
 The a factor of the plane.
float b
 The b factor of the plane.
float c
 The c factor of the plane.
float d
 The d factor of the plane.

Detailed Description

Determines a 3D plane.

A plane is defined by the equation ax+by+cz+d = 0


Constructor & Destructor Documentation

OZCOLLIDE_API Plane::Plane (  ) 

Constructs an uninitialised plane.

OZCOLLIDE_API Plane::Plane ( float  a,
float  b,
float  c,
float  d 
)

Constructs an initialised plane.

Parameters:
a The a factor.
b The b factor.
c The c factor.
d The d factor.

Member Function Documentation

ozinline float Plane::dist ( const Vec3f p  )  const [inline]

Calculates the distance between a point and the plane.

Parameters:
p The point.
Returns:
The distance.
ozinline float Plane::dot ( const Vec3f p  )  const [inline]

Makes a dot product between a point and the plane.

Result becomes closer to d's factor as the point is near to the plane.

Parameters:
p The point.
Returns:
The dot product.
OZCOLLIDE_API void Plane::fromPointAndNormal ( const Vec3f p,
const Vec3f n 
)

Constructs a plane from a point and a normal.

Parameters:
p The point that lies on the plane.
n The normal of the plane.
OZCOLLIDE_API void Plane::fromPoints ( const Vec3f p0,
const Vec3f p1,
const Vec3f p2 
)

Constructs a plane from three points.

Parameters:
p0 1th point.
p1 2nd point.
p2 3th point.
OZCOLLIDE_API void Plane::fromPointsNN ( const Vec3f p0,
const Vec3f p1,
const Vec3f p2 
)

Constructs a plane from three points and don't normalize the equation.

Parameters:
p0 1th point.
p1 2nd point.
p2 3th point.
ozinline bool Plane::intersectWithLine ( const Vec3f p0,
const Vec3f p1,
float &  t 
) [inline]

Determines if a line and the place intersect.

Parameters:
p0 The first point of the line.
p1 The second point of the line.
t A value that will be filled with the distance to travel to get the intersection.
Returns:
If the plane and the line are parallel false is returned, true otherwhise since the line obviously intersects with the plane.
ozinline bool Plane::isOnPlane ( const Vec3f p,
float  threshold = 0.001f 
) [inline]

Tells if a point is on the plane or not.

Parameters:
p The point to test.
(optional) The threshold to use to determine if the point is on the plane or not. Indeed we couldn't just test if the distance from the point to the plane is zero because of potential numerical error. Default is 10^-3.
Returns:
true if the point is on the plane, false otherwhise.
ozinline Vec3f Plane::project ( const Vec3f p  )  [inline]

Projects a point onto the plane.

Parameters:
p The point to be projected. the projected point.
ozinline Vec3f Plane::reflect ( const Vec3f vec  )  [inline]

Reflects a vector on the plane.

Parameters:
p The vector to be reflected.
Returns:
The reflected vector.

Member Data Documentation

float Plane::a

The a factor of the plane.

float Plane::b

The b factor of the plane.

float Plane::c

The c factor of the plane.

float Plane::d

The d factor of the plane.


The documentation for this class was generated from the following file:
 All Classes Files Functions Variables Enumerations Enumerator