plane Struct Reference

Plane structure. More...

#include <3dmath.h>

List of all members.

Public Member Functions

 plane (float _a=0, float _b=0, float _c=0, float _d=0)
 Constructor.
 plane (const plane &p)
 Copy constructor.
planeoperator= (const plane &p)
 Assignment operator.
plane Normalize () const
 Get normalized plane.
float DotCoord (const vector3 &p) const
 Get point distance from plane.
wxString ToString () const
 Get string.
planeClone () const
 Get copy of instance.

Static Public Member Functions

static plane FromPointNorm (const vector3 &point, const vector3 &normal)
 Get plane from point and normal.
static plane FromPoints (const vector3 &p1, const vector3 &p2, const vector3 &p3)
 Get plane from three points.

Public Attributes

union {
   struct {
      float   a
 Components.
      float   b
      float   c
      float   d
   } 
   float   _p [4]
 Components.
}; 

Friends

std::ostream & operator<< (std::ostream &os, const plane &p)
 Output stream operator.


Detailed Description

Plane structure.

Definition at line 344 of file 3dmath.h.


Constructor & Destructor Documentation

plane::plane ( float  _a = 0,
float  _b = 0,
float  _c = 0,
float  _d = 0 
) [inline]

Constructor.

Definition at line 358 of file 3dmath.h.

00358 : a(_a), b(_b), c(_c), d(_d)       {}

plane::plane ( const plane p  )  [inline]

Copy constructor.

Definition at line 361 of file 3dmath.h.

00361 : a(p.a), b(p.b), c(p.c), d(p.d)          {}


Member Function Documentation

plane& plane::operator= ( const plane p  )  [inline]

Assignment operator.

Definition at line 364 of file 3dmath.h.

00365        {
00366               a = p.a;
00367               b = p.b;
00368               c = p.c;
00369               d = p.d;
00370               return *this;
00371        }

plane plane::Normalize (  )  const [inline]

Get normalized plane.

Definition at line 374 of file 3dmath.h.

00375        {
00376               float imag = 1.0f / sqrtf(a*a + b*b + c*c);
00377               return plane(a * imag, b * imag, c * imag, d * imag);
00378        }

static plane plane::FromPointNorm ( const vector3 point,
const vector3 normal 
) [inline, static]

Get plane from point and normal.

Definition at line 381 of file 3dmath.h.

00382        {
00383               return plane(normal.x, normal.y, normal.z, -normal.Dot(point));
00384        }

static plane plane::FromPoints ( const vector3 p1,
const vector3 p2,
const vector3 p3 
) [inline, static]

Get plane from three points.

Definition at line 387 of file 3dmath.h.

00388        {
00389               vector3 v1 = p2 - p1;
00390               vector3 v2 = p3 - p1;
00391               vector3 n = v1.Cross(v2);
00392               return FromPointNorm(p1, n.Normalize());
00393        }

float plane::DotCoord ( const vector3 p  )  const [inline]

Get point distance from plane.

Definition at line 396 of file 3dmath.h.

00397        {
00398               return a * p.x + b * p.y + c * p.z + d;
00399        }

wxString plane::ToString (  )  const [inline]

Get string.

Definition at line 402 of file 3dmath.h.

00403        {
00404               return wxString(wxT("(")) << a << wxT(", ") << b << wxT(", ") << c << wxT(", ") << d << wxT(")");
00405        }

plane* plane::Clone (  )  const [inline]

Get copy of instance.

Definition at line 414 of file 3dmath.h.

00415        {
00416               return new plane(*this);
00417        }


Friends And Related Function Documentation

std::ostream& operator<< ( std::ostream &  os,
const plane p 
) [friend]

Output stream operator.

Definition at line 408 of file 3dmath.h.

00409        {
00410               return os << "(" << p.a << ", " << p.b << ", " << p.c << ", " << p.d << ")";
00411        }


Member Data Documentation

float plane::a

Components.

Definition at line 351 of file 3dmath.h.

float plane::b

Definition at line 351 of file 3dmath.h.

float plane::c

Definition at line 351 of file 3dmath.h.

float plane::d

Definition at line 351 of file 3dmath.h.

float plane::_p[4]

Components.

Definition at line 354 of file 3dmath.h.

union { ... }


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

Generated on Tue Mar 10 14:41:38 2009 for VRUT by  doxygen 1.5.5