#include <Plane.hpp>
Public Types | |
| enum | Classify { CLASSIFY_FRONT_OF_PLANE = 0, CLASSIFY_BACK_OF_PLANE, CLASSIFY_ON_PLANE } |
| Position of a vector comparing to a plane. More... | |
Public Member Functions | |
| Plane () | |
| Constructor #1. | |
| Plane (const Vector3D &normal, const float d) | |
| Constructor #2. | |
| Plane (const Plane &plane) | |
| Copy constructor. | |
| const float | getNormalX () const |
| Get the x coordinate of the normal. | |
| const float | getNormalY () const |
| Get the y coordinate of the normal. | |
| const float | getNormalZ () const |
| Get the z coordinate of the normal. | |
| const Vector3D & | getNormal () const |
| Get the normal. | |
| const float | getD () const |
| Get the d parametre. | |
| void | set (const float a, const float b, const float c, const float d) |
| Set the coordinates of the plane. | |
| void | set (const Vector3D &normal, const float d) |
| Set the coordinates of the plane. | |
| void | from3Vertices (const Vector3D &vec1, const Vector3D &vec2, const Vector3D &vec3) |
| Build the plane from three vertices. | |
| float | calculateDistanceToVector (const Vector3D &vec) const |
| Calculate the distance between the plane and a vector. | |
| Classify | classifyVector (const Vector3D &vec) const |
| Classify a vector against the plane. | |
| Plane | normalize () const |
| Return a normalized plane which has the same normal as this plane. | |
Private Attributes | |
| Vector3D | m_normal |
| Parametre of the ax+by+cz+d=0 equation of the plane. | |
| float | m_d |
| Parametre of the ax+by+cz+d=0 equation of the plane. | |
A plane is represented using the ax+by+cz+d=0 equation where (a,b,c) is the normal and d is the translation parametre.
| syBR::Core::Plane::Plane | ( | ) |
Constructor #1.
| syBR::Core::Plane::Plane | ( | const Vector3D & | normal, | |
| const float | d | |||
| ) |
Constructor #2.
| normal | Vector to be used a the normal | |
| d | d parametre of the plane |
| syBR::Core::Plane::Plane | ( | const Plane & | plane | ) |
| const float syBR::Core::Plane::getNormalX | ( | ) | const |
Get the x coordinate of the normal.
| const float syBR::Core::Plane::getNormalY | ( | ) | const |
Get the y coordinate of the normal.
| const float syBR::Core::Plane::getNormalZ | ( | ) | const |
Get the z coordinate of the normal.
| const Vector3D & syBR::Core::Plane::getNormal | ( | ) | const |
Get the normal.
| const float syBR::Core::Plane::getD | ( | ) | const |
Get the d parametre.
| void syBR::Core::Plane::set | ( | const float | a, | |
| const float | b, | |||
| const float | c, | |||
| const float | d | |||
| ) |
Set the coordinates of the plane.
| a | x coordinate of the normal | |
| b | y coordinate of the normal | |
| c | z coordinate of the normal | |
| d | d parametre of the plane |
| void syBR::Core::Plane::set | ( | const Vector3D & | normal, | |
| const float | d | |||
| ) |
Set the coordinates of the plane.
| normal | Vector to be used a the normal | |
| d | d parametre of the plane |
| void syBR::Core::Plane::from3Vertices | ( | const Vector3D & | vec1, | |
| const Vector3D & | vec2, | |||
| const Vector3D & | vec3 | |||
| ) |
Build the plane from three vertices.
The calculation are quite the same as in MathHelpers::getFaceNormal(). It calculates the normal of the face made of the three vectors and then, get the d parametre by doing the dot product of the normal and one of the three vectors.
| vec1 | Vector #1 to be used for building | |
| vec2 | Vector #2 to be used for building | |
| vec3 | Vector #3 to be used for building |
| float syBR::Core::Plane::calculateDistanceToVector | ( | const Vector3D & | vec | ) | const |
Calculate the distance between the plane and a vector.
| vec | Vector for which the distance must be calculated |
| Plane::Classify syBR::Core::Plane::classifyVector | ( | const Vector3D & | vec | ) | const |
Classify a vector against the plane.
Check the position of the vector comparing to the plane.
| vec | Vector to be classified |
| Plane syBR::Core::Plane::normalize | ( | ) | const |
Return a normalized plane which has the same normal as this plane.
It gets the length of the normal and divide each of its coordinates by this length (even the d parametre).
Vector3D syBR::Core::Plane::m_normal [private] |
Parametre of the ax+by+cz+d=0 equation of the plane.
float syBR::Core::Plane::m_d [private] |
Parametre of the ax+by+cz+d=0 equation of the plane.
Copyright © 2008 by Sebastien Frippiat

This work is licensed under a Creative Commons Attribution-ShareAlike 3.0 License.
Last modified Tue Dec 30 17:57:33 2008