Castor3D 0.16.0
Multiplatform 3D engine
Public Member Functions | Friends | List of all members
castor::PlaneEquation Class Reference

#include <PlaneEquation.hpp>

Public Member Functions

CU_API PlaneEquation ()=default
 Constructor.
 
CU_API PlaneEquation (Point3f const &p1, Point3f const &p2, Point3f const &p3)
 Constructor.
 
CU_API PlaneEquation (Point3f const &normal, Point3f const &point)
 Constructor.
 
CU_API PlaneEquation (Point3f const &normal, float d)
 Constructor.
 
CU_API void set (Point3f const &p1, Point3f const &p2, Point3f const &p3)
 Compute plane's equation from 3 points.
 
CU_API void set (Point3f const &normal, Point3f const &point)
 Defines plane's equation.
 
CU_API void set (Point3f const &normal, float d)
 Defines plane's equation.
 
CU_API bool isParallel (PlaneEquation const &plane) const
 Checks if this plane is parallel to another one, id est if their normals are parallel.
 
CU_API float distance (Point3f const &point) const
 Computes distance of a point from this plane.
 
CU_API Point3f project (Point3f const &point) const
 Retrieves the projection of a point on this plane.
 
CU_API bool intersects (PlaneEquation const &plane, Line3D< float > &line) const
 Checks if this plane intersects another one, gives the intersection line if intersection is not null.
 
CU_API bool intersects (PlaneEquation const &plane1, PlaneEquation const &plane2, Point3f &intersection) const
 Checks the intersection of this plane with 2 other ones, gives the intersection point.
 
Point3f const & getNormal () const
 
float getDistance () const
 

Friends

CU_API bool operator== (PlaneEquation const &, PlaneEquation const &)
 Checks if this plane is equal to another one.
 
CU_API bool operator!= (PlaneEquation const &, PlaneEquation const &)
 Checks if this plane is different from another one.
 

Constructor & Destructor Documentation

◆ PlaneEquation() [1/4]

CU_API castor::PlaneEquation::PlaneEquation ( )
default

Constructor.

◆ PlaneEquation() [2/4]

CU_API castor::PlaneEquation::PlaneEquation ( Point3f const & p1,
Point3f const & p2,
Point3f const & p3 )

Constructor.

Parameters
[in]p1The first point belonging to the plane.
[in]p2The second point belonging to the plane.
[in]p3The third point belonging to the plane.

◆ PlaneEquation() [3/4]

CU_API castor::PlaneEquation::PlaneEquation ( Point3f const & normal,
Point3f const & point )

Constructor.

Parameters
[in]normalThe plane normal.
[in]pointA point belonging to the plane.

◆ PlaneEquation() [4/4]

CU_API castor::PlaneEquation::PlaneEquation ( Point3f const & normal,
float d )

Constructor.

Parameters
[in]normalThe plane normal.
[in]dThe plane distance.

Member Function Documentation

◆ distance()

CU_API float castor::PlaneEquation::distance ( Point3f const & point) const

Computes distance of a point from this plane.

Parameters
[in]pointThe point
Returns
The distance, positive if the point is on the same side as the plane's normal

◆ getDistance()

float castor::PlaneEquation::getDistance ( ) const
inline
Returns
The plane's distance to origin.

◆ getNormal()

Point3f const & castor::PlaneEquation::getNormal ( ) const
inline
Returns
The plane's normal.

◆ intersects() [1/2]

CU_API bool castor::PlaneEquation::intersects ( PlaneEquation const & plane,
Line3D< float > & line ) const

Checks if this plane intersects another one, gives the intersection line if intersection is not null.

Todo
Find origin point
Parameters
[in]planeThe plane to check
[out]lineThe intersection line
Returns
true if there is an intersection, false if not

◆ intersects() [2/2]

CU_API bool castor::PlaneEquation::intersects ( PlaneEquation const & plane1,
PlaneEquation const & plane2,
Point3f & intersection ) const

Checks the intersection of this plane with 2 other ones, gives the intersection point.

Parameters
[in]plane1The first plane to check
[in]plane2The second plane to check
[out]intersectionThe intersection point
Returns
true if there is an intersection point between the 3 planes

◆ isParallel()

CU_API bool castor::PlaneEquation::isParallel ( PlaneEquation const & plane) const

Checks if this plane is parallel to another one, id est if their normals are parallel.

Parameters
[in]planeThe plane to test

◆ project()

CU_API Point3f castor::PlaneEquation::project ( Point3f const & point) const

Retrieves the projection of a point on this plane.

Parameters
[in]pointThe point to project
Returns
The projection result

◆ set() [1/3]

CU_API void castor::PlaneEquation::set ( Point3f const & normal,
float d )

Defines plane's equation.

Parameters
[in]normalThe plane normal.
[in]dThe plane distance.

◆ set() [2/3]

CU_API void castor::PlaneEquation::set ( Point3f const & normal,
Point3f const & point )

Defines plane's equation.

Parameters
[in]normalThe plane normal.
[in]pointA point belonging to the plane.

◆ set() [3/3]

CU_API void castor::PlaneEquation::set ( Point3f const & p1,
Point3f const & p2,
Point3f const & p3 )

Compute plane's equation from 3 points.

Parameters
[in]p1The first point belonging to the plane.
[in]p2The second point belonging to the plane.
[in]p3The third point belonging to the plane.

Friends And Related Symbol Documentation

◆ operator!=

CU_API bool operator!= ( PlaneEquation const & ,
PlaneEquation const &  )
friend

Checks if this plane is different from another one.

◆ operator==

CU_API bool operator== ( PlaneEquation const & ,
PlaneEquation const &  )
friend

Checks if this plane is equal to another one.

Remarks
A plane is equal to another one if it is parallel to it and if normals and d coeff are equal

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