Public Types | Public Member Functions | Public Attributes | List of all members
ion::SPlane3< T, Vector > Class Template Reference

3D plane More...

#include <SPlane3.h>

Collaboration diagram for ion::SPlane3< T, Vector >:
Collaboration graph
[legend]

Public Types

enum  EIntersectionRelation { Front, Back, Plannar }
 

Public Member Functions

 SPlane3 ()
 
 SPlane3 (const Vector &MPoint, const Vector &Normal)
 
 SPlane3 (T px, T py, T pz, T nx, T ny, T nz)
 
 SPlane3 (Vector const &point1, Vector const &point2, Vector const &point3)
 
 SPlane3 (Vector const &normal, const T d)
 
void SetPlane (Vector const &point, Vector const &nvector)
 
void SetPlane (Vector const &nvect, T d)
 
void SetPlane (Vector const &point1, Vector const &point2, Vector const &point3)
 
bool GetIntersectionWithLine (Vector const &linePoint, Vector const &lineVect, Vector &outIntersection) const
 Get an intersection with a 3d line. More...
 
T GetKnownIntersectionWithLine (Vector const &linePoint1, Vector const &linePoint2) const
 Get percentage of line between two points where an intersection with this plane happens. More...
 
bool GetIntersectionWithLimitedLine (Vector const &linePoint1, Vector const &linePoint2, Vector &outIntersection) const
 Get an intersection with a 3d line, limited between two 3d points. More...
 
EIntersectionRelation ClassifyPointRelation (Vector const &point) const
 Classifies the relation of a point to this plane. More...
 
void RecalculateD (const Vector &MPoint)
 Recalculates the distance from origin by applying a new member point to the plane. More...
 
Vector GetMemberPoint () const
 Gets a member point of the plane. More...
 
bool ExistsIntersection (const SPlane3< T > &other) const
 Tests if there is an intersection with the other plane. More...
 
bool GetIntersectionWithPlane (const SPlane3< T > &other, Vector &outLinePoint, Vector &outLineVect) const
 Intersects this plane with another. More...
 
bool GetIntersectionWithPlanes (const SPlane3< T > &o1, const SPlane3< T > &o2, Vector &outPoint) const
 Get the intersection point with two other planes if there is one. More...
 
bool IsFrontFacing (const Vector &lookDirection) const
 Test if the triangle would be front or backfacing from any point. More...
 
T GetDistanceTo (const Vector &point) const
 Get the distance to a point. More...
 

Public Attributes

Vector Normal
 Normal vector of the plane. More...
 
T D
 Distance from origin. More...
 

Detailed Description

template<typename T, typename Vector = vec3<T>>
class ion::SPlane3< T, Vector >

3D plane

Member Enumeration Documentation

template<typename T, typename Vector = vec3<T>>
enum ion::SPlane3::EIntersectionRelation
Enumerator
Front 
Back 
Plannar 

Constructor & Destructor Documentation

template<typename T, typename Vector = vec3<T>>
ion::SPlane3< T, Vector >::SPlane3 ( )
inline
template<typename T, typename Vector = vec3<T>>
ion::SPlane3< T, Vector >::SPlane3 ( const Vector &  MPoint,
const Vector &  Normal 
)
inline
template<typename T, typename Vector = vec3<T>>
ion::SPlane3< T, Vector >::SPlane3 ( T  px,
T  py,
T  pz,
T  nx,
T  ny,
T  nz 
)
inline
template<typename T, typename Vector = vec3<T>>
ion::SPlane3< T, Vector >::SPlane3 ( Vector const &  point1,
Vector const &  point2,
Vector const &  point3 
)
inline
template<typename T, typename Vector = vec3<T>>
ion::SPlane3< T, Vector >::SPlane3 ( Vector const &  normal,
const T  d 
)
inline

Member Function Documentation

template<typename T, typename Vector = vec3<T>>
EIntersectionRelation ion::SPlane3< T, Vector >::ClassifyPointRelation ( Vector const &  point) const
inline

Classifies the relation of a point to this plane.

Parameters
pointPoint to classify its relation.
Returns
ISREL3D_FRONT if the point is in front of the plane, ISREL3D_BACK if the point is behind of the plane, and ISREL3D_PLANAR if the point is within the plane.
template<typename T, typename Vector = vec3<T>>
bool ion::SPlane3< T, Vector >::ExistsIntersection ( const SPlane3< T > &  other) const
inline

Tests if there is an intersection with the other plane.

Returns
True if there is a intersection.
template<typename T, typename Vector = vec3<T>>
T ion::SPlane3< T, Vector >::GetDistanceTo ( const Vector &  point) const
inline

Get the distance to a point.

Note that this only works if the normal is normalized.

template<typename T, typename Vector = vec3<T>>
bool ion::SPlane3< T, Vector >::GetIntersectionWithLimitedLine ( Vector const &  linePoint1,
Vector const &  linePoint2,
Vector &  outIntersection 
) const
inline

Get an intersection with a 3d line, limited between two 3d points.

Parameters
linePoint1Point 1 of the line.
linePoint2Point 2 of the line.
outIntersectionPlace to store the intersection point, if there is one.
Returns
True if there was an intersection, false if there was not.
template<typename T, typename Vector = vec3<T>>
bool ion::SPlane3< T, Vector >::GetIntersectionWithLine ( Vector const &  linePoint,
Vector const &  lineVect,
Vector &  outIntersection 
) const
inline

Get an intersection with a 3d line.

Parameters
lineVectVector of the line to intersect with.
linePointPoint of the line to intersect with.
outIntersectionPlace to store the intersection point, if there is one.
Returns
True if there was an intersection, false if there was not.
template<typename T, typename Vector = vec3<T>>
bool ion::SPlane3< T, Vector >::GetIntersectionWithPlane ( const SPlane3< T > &  other,
Vector &  outLinePoint,
Vector &  outLineVect 
) const
inline

Intersects this plane with another.

Parameters
otherOther plane to intersect with.
outLinePointBase point of intersection line.
outLineVectVector of intersection.
Returns
True if there is a intersection, false if not.
template<typename T, typename Vector = vec3<T>>
bool ion::SPlane3< T, Vector >::GetIntersectionWithPlanes ( const SPlane3< T > &  o1,
const SPlane3< T > &  o2,
Vector &  outPoint 
) const
inline

Get the intersection point with two other planes if there is one.

template<typename T, typename Vector = vec3<T>>
T ion::SPlane3< T, Vector >::GetKnownIntersectionWithLine ( Vector const &  linePoint1,
Vector const &  linePoint2 
) const
inline

Get percentage of line between two points where an intersection with this plane happens.

Only useful if known that there is an intersection.

Parameters
linePoint1Point1 of the line to intersect with.
linePoint2Point2 of the line to intersect with.
Returns
Where on a line between two points an intersection with this plane happened. For example, 0.5 is returned if the intersection happened exactly in the middle of the two points.
template<typename T, typename Vector = vec3<T>>
Vector ion::SPlane3< T, Vector >::GetMemberPoint ( ) const
inline

Gets a member point of the plane.

template<typename T, typename Vector = vec3<T>>
bool ion::SPlane3< T, Vector >::IsFrontFacing ( const Vector &  lookDirection) const
inline

Test if the triangle would be front or backfacing from any point.

Thus, this method assumes a camera position from which the triangle is definitely visible when looking into the given direction. Note that this only works if the normal is Normalized. Do not use this method with points as it will give wrong results!

Parameters
lookDirectionLook direction.
Returns
True if the plane is front facing and false if it is backfacing.
template<typename T, typename Vector = vec3<T>>
void ion::SPlane3< T, Vector >::RecalculateD ( const Vector &  MPoint)
inline

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

template<typename T, typename Vector = vec3<T>>
void ion::SPlane3< T, Vector >::SetPlane ( Vector const &  point,
Vector const &  nvector 
)
inline
template<typename T, typename Vector = vec3<T>>
void ion::SPlane3< T, Vector >::SetPlane ( Vector const &  nvect,
T  d 
)
inline
template<typename T, typename Vector = vec3<T>>
void ion::SPlane3< T, Vector >::SetPlane ( Vector const &  point1,
Vector const &  point2,
Vector const &  point3 
)
inline

Member Data Documentation

template<typename T, typename Vector = vec3<T>>
T ion::SPlane3< T, Vector >::D

Distance from origin.

template<typename T, typename Vector = vec3<T>>
Vector ion::SPlane3< T, Vector >::Normal

Normal vector of the plane.


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