Gray C++ Libraries  0.0.2
A set of C++ libraries for MSVC, GNU on Windows, WinCE, Linux
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
GrayLib::cPlanef Class Reference

#include <cPlane.h>

Inheritance diagram for GrayLib::cPlanef:
GrayLib::cVector4f GrayLib::cVecT4< float > GrayLib::cVecTC< float, 4, cVecT4< float > >

Public Types

enum  REL_TYPE { REL_BACK = -1 , REL_PLANAR = 0 , REL_FRONT = 1 }
 
- Public Types inherited from GrayLib::cVecTC< float, 4, cVecT4< float > >
typedef float DVALUE_t
 Dimension value type. More...
 
typedef cVecTC< float, _IQTY, cVecT4< float > > THIS_t
 

Public Member Functions

 cPlanef ()
 
 cPlanef (const SUPER_t &v) noexcept
 
 cPlanef (const DVALUE_t *pVals) noexcept
 
 cPlanef (const cVector3f &vNormal, DVALUE_t fDistFromOrigin)
 
 cPlanef (DVALUE_t a, DVALUE_t b, DVALUE_t c, DVALUE_t d) noexcept
 
 cPlanef (const cVector3f &v1, const cVector3f &v2, const cVector3f &v3)
 
 cPlanef (const cVector3f &vPoint, const cVector3f &vNormal)
 
void InitPlane (const cVector3f &vNormal, float fDistFromOrigin)
 
void InitPointNormal (const cVector3f &vPoint, const cVector3f &vNormal)
 
void InitPointVector (const cVector3f &vPoint, const cVector3f &vVector)
 
void InitPlanePoints (const cVector3f &v1, const cVector3f &v2, const cVector3f &v3)
 
void InitTransformPlane (const cPlanef &plane, const cMatrix4x4f &m1)
 
void InitNormalized (const cPlanef &plane)
 
const cVector3fget_Normal () const noexcept
 Getters. More...
 
DVALUE_t get_DistFromOrigin () const noexcept
 
cVector3f get_MemberPoint () const noexcept
 
DVALUE_t GetDotCoord (const cVector3f &v) const
 
cPlanef GetTransformPlane (const cMatrix4x4f &m1) const
 
cPlanef get_Normalized () const
 
bool IsFrontFacing (const cVector3f &vLookDir) const
 
float GetDistanceTo (const cVector3f &vPoint) const
 
REL_TYPE GetPointRelation (const cVector3f &vPoint) const
 
cVector3fref_Normal ()
 
void RecalculateD (const cVector3f &vMember)
 
void SetNormalized ()
 
void TransformNormals (const cMatrix4x4f &m)
 
 UNITTEST_FRIEND (cPlane)
 
- Public Member Functions inherited from GrayLib::cVector4f
 cVector4f ()
 
 cVector4f (const DVALUE_t *pVals)
 
 cVector4f (const SUPER_t &v)
 
 cVector4f (DVALUE_t _x, DVALUE_t _y, DVALUE_t _z=0, DVALUE_t _w=0) noexcept
 
 cVector4f (const cVecT3< DVALUE_t > &v, DVALUE_t w)
 
void InitCross4 (const cVector4f &v1, const cVector4f &v2, const cVector4f &v3)
 
- Public Member Functions inherited from GrayLib::cVecT4< float >
 cVecT4 () noexcept
 
 cVecT4 (const SUPER_t &v) noexcept
 
 cVecT4 (const float *pVals) noexcept
 
 cVecT4 (float n0, float n1, float n2=0, float n3=0) noexcept
 
 cVecT4 (const cVecT3< float > &v2, float _w=0)
 
const float & get_X () const noexcept
 
const float & get_Y () const noexcept
 
const float & get_Z () const noexcept
 
const float & get_W () const noexcept
 
const cVecT3< float > & get_V3 () const noexcept
 
cVecT3< float > & ref_V3 () noexcept
 
void InitCross (const THIS_t &v1, const THIS_t &v2, const THIS_t &v3)
 
- Public Member Functions inherited from GrayLib::cVecTC< float, 4, cVecT4< float > >
float * get_T () noexcept
 
const float * get_CT () const noexcept
 
const cVecT4< float > & get_CR () const noexcept
 
 operator const float * () const noexcept
 
float GetElem (int i) const noexcept
 
float operator[] (int i) const noexcept
 
float & operator[] (int i)
 
bool isZero () const noexcept
 
COMPARE_t Compare (const THIS_t &v2) const noexcept
 
bool operator== (const THIS_t &v2) const noexcept
 
bool operator!= (const THIS_t &v2) const noexcept
 
bool IsNear (const THIS_t &v2, float fDist=(float) k_FLT_MIN2) const
 
float get_MagnitudeSq () const noexcept
 
float get_Magnitude () const noexcept
 
cVecT4< float > operator- () const
 
cVecT4< float > operator- (const THIS_t &v2) const
 
cVecT4< float > get_Abs () const
 
cVecT4< float > GetSum (const THIS_t &v2) const
 
cVecT4< float > operator+ (const THIS_t &v2) const
 
cVecT4< float > GetDiff (const THIS_t &v2) const
 
cVecT4< float > GetScaled (float nScale) const
 
cVecT4< float > operator* (float nScale) const
 
cVecT4< float > operator/ (float nScale) const
 
cVecT4< float > GetMul (const THIS_t &v2) const
 
cVecT4< float > GetDiv (const THIS_t &v2) const
 
float GetDistSq (const THIS_t &v2) const
 
float GetDist (const THIS_t &v2) const
 
float GetDot (const THIS_t &v2) const
 
cVecT4< float > get_Normalized () const
 
 operator float * ()
 
float & RefElem (int i) noexcept
 
void Set (const THIS_t &v)
 
void SetZero () noexcept
 
float SetNormalized (void) noexcept
 
bool put_Magnitude (float nLength)
 
void SetLerp (const THIS_t &a, const THIS_t &b, DVALUE_t t)
 
const cVecT4< float > & operator+= (const THIS_t &v2)
 
const cVecT4< float > & operator+= (float n)
 
const cVecT4< float > & operator-= (const THIS_t &v2) noexcept
 
const cVecT4< float > & operator-= (float n) noexcept
 
void DoScale (float n) noexcept
 
const cVecT4< float > & operator*= (float nScale) noexcept
 
cVecT4< float > & operator*= (const THIS_t &v2) noexcept
 
const cVecT4< float > & operator/= (float nScale)
 
cVecT4< float > & operator/= (const THIS_t &v2)
 
void DoMul (const THIS_t &v2) noexcept
 
void DoDiv (const THIS_t &v2)
 

Additional Inherited Members

- Static Public Member Functions inherited from GrayLib::cVecTC< float, 4, cVecT4< float > >
static float GetDot (const THIS_t &v1, const THIS_t &v2)
 
- Public Attributes inherited from GrayLib::cVecT4< float >
float m_a [4]
 
float m_x
 
float m_y
 
float m_z
 
float m_w
 
float x
 
float y
 
float z
 
float w
 
float r
 
float g
 
float b
 
float a
 
union {
   TYPE   m_a [4]
 
   struct {
      TYPE   m_x
 
      TYPE   m_y
 
      TYPE   m_z
 
      TYPE   m_w
 
   } 
 
   struct {
      TYPE   x
 
      TYPE   y
 
      TYPE   z
 
      TYPE   w
 
   } 
 
   struct {
      TYPE   r
 
      TYPE   g
 
      TYPE   b
 
      TYPE   a
 
   } 
 
}; 
 
- Static Public Attributes inherited from GrayLib::cVecTC< float, 4, cVecT4< float > >
static const int k_nDim
 
- Protected Member Functions inherited from GrayLib::cVecTC< float, 4, cVecT4< float > >
 cVecTC ()
 

Detailed Description

A plane in 3d space = half space x,y,z = normal vector from plane, w (or d)=distance from origin, w negative=normal points at origin. like D3DXPLANE. can assume storage of XMFLOAT4 a*x + b*y + c*z + d = 0

Member Enumeration Documentation

◆ REL_TYPE

Enumeration for intersection relations of 3d objects. like COMPARE_TYPE. not like GINTERSECT_TYPE half spaces.

Enumerator
REL_BACK 

in back of plane.

REL_PLANAR 

a point on the plane. or intersects plane.

REL_FRONT 

in front of the plane.

Constructor & Destructor Documentation

◆ cPlanef() [1/7]

GrayLib::cPlanef::cPlanef ( )
inline

◆ cPlanef() [2/7]

GrayLib::cPlanef::cPlanef ( const SUPER_t v)
inlinenoexcept

◆ cPlanef() [3/7]

GrayLib::cPlanef::cPlanef ( const DVALUE_t pVals)
inlinenoexcept

◆ cPlanef() [4/7]

GrayLib::cPlanef::cPlanef ( const cVector3f vNormal,
DVALUE_t  fDistFromOrigin 
)
inline

fDistFromOrigin = distance from origin.

◆ cPlanef() [5/7]

GrayLib::cPlanef::cPlanef ( DVALUE_t  a,
DVALUE_t  b,
DVALUE_t  c,
DVALUE_t  d 
)
inlinenoexcept

◆ cPlanef() [6/7]

GrayLib::cPlanef::cPlanef ( const cVector3f v1,
const cVector3f v2,
const cVector3f v3 
)
inline

make a plane from 3 points.

◆ cPlanef() [7/7]

GrayLib::cPlanef::cPlanef ( const cVector3f vPoint,
const cVector3f vNormal 
)
inline

Member Function Documentation

◆ get_DistFromOrigin()

DVALUE_t GrayLib::cPlanef::get_DistFromOrigin ( ) const
inlinenoexcept

◆ get_MemberPoint()

cVector3f GrayLib::cPlanef::get_MemberPoint ( ) const
inlinenoexcept
Returns
a member point of the plane.

◆ get_Normal()

const cVector3f& GrayLib::cPlanef::get_Normal ( ) const
inlinenoexcept

Getters.

◆ get_Normalized()

cPlanef GrayLib::cPlanef::get_Normalized ( ) const
inline

◆ GetDistanceTo()

float GrayLib::cPlanef::GetDistanceTo ( const cVector3f vPoint) const
inline
Returns
The distance to a point.
Note
This only works if the normal is Normalized.

◆ GetDotCoord()

DVALUE_t GrayLib::cPlanef::GetDotCoord ( const cVector3f v) const
inline

D3DXPlaneDotCoord = D3DXPlaneDotNormal(v) + m_a[3] expand second to (v, 1)

◆ GetPointRelation()

REL_TYPE GrayLib::cPlanef::GetPointRelation ( const cVector3f vPoint) const
inline

Classifies the relation of a point to this plane.

  • vPoint to classify its relation.
    Returns
    REL_FRONT if the point is in front of the plane, REL_BACK if the point is behind of the plane, and REL_PLANAR if the point is within the plane.

◆ GetTransformPlane()

cPlanef GrayLib::cPlanef::GetTransformPlane ( const cMatrix4x4f m1) const
inline

◆ InitNormalized()

void GrayLib::cPlanef::InitNormalized ( const cPlanef plane)
inline

usually following is not needed unless you want normalized plane normals all plane checks work perfectly without normalization not exactly the same as normalize for 3d vector.

◆ InitPlane()

void GrayLib::cPlanef::InitPlane ( const cVector3f vNormal,
float  fDistFromOrigin 
)
inline

◆ InitPlanePoints()

void GrayLib::cPlanef::InitPlanePoints ( const cVector3f v1,
const cVector3f v2,
const cVector3f v3 
)
inline

make a plane from 3 points.

◆ InitPointNormal()

void GrayLib::cPlanef::InitPointNormal ( const cVector3f vPoint,
const cVector3f vNormal 
)
inline

◆ InitPointVector()

void GrayLib::cPlanef::InitPointVector ( const cVector3f vPoint,
const cVector3f vVector 
)
inline

◆ InitTransformPlane()

void GrayLib::cPlanef::InitTransformPlane ( const cPlanef plane,
const cMatrix4x4f m1 
)
inline

like D3DXVec4Transform or D3DXPlaneTransform 4x4 mult

◆ IsFrontFacing()

bool GrayLib::cPlanef::IsFrontFacing ( const cVector3f vLookDir) const
inline

Returns if the plane is front of back facing.

Note
that this only works if the get_Normal is Normalized.
  • vLookDir: Look direction.
Returns
Returns true if the plane is front facing, which mean it would be visible, and false if it is back facing.

◆ RecalculateD()

void GrayLib::cPlanef::RecalculateD ( const cVector3f vMember)
inline

Recalculates the distance from origin by applying a new member point to the plane.

◆ ref_Normal()

cVector3f& GrayLib::cPlanef::ref_Normal ( )
inline

◆ SetNormalized()

void GrayLib::cPlanef::SetNormalized ( void  )
inline

◆ TransformNormals()

void GrayLib::cPlanef::TransformNormals ( const cMatrix4x4f m)
inline

3x3 mult

◆ UNITTEST_FRIEND()

GrayLib::cPlanef::UNITTEST_FRIEND ( cPlane  )

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