#include <Plane.hpp>
Public Types | |
enum | VectorPosition { VP_FRONT = 0, VP_BACK, VP_ON } |
Position of a vector compared to the position of a plane. More... | |
Public Member Functions | |
Plane () | |
Constructor 1. | |
Plane (Vector3 normal, double offset) | |
Constructor 2. | |
~Plane () | |
Destructor. | |
const Vector3 & | getNormal () const |
Get the normal. | |
const double | getOffset () const |
Get the translation offset. | |
void | set (const double a, const double b, const double c, const double d) |
Set the (a,b,c) and d components of the plane. | |
void | set (const Vector3 &normal, const double offset) |
Set (a,b,c) and d components of the plane. | |
void | from3Vectors (const Vector3 &vec1, const Vector3 &vec2, const Vector3 &vec3) |
Construct plane from three vectors. | |
const double | calculateDistance (const Vector3 &vec) const |
Calculate the distance the plane and a vector. | |
const VectorPosition | calculatePosition (const Vector3 &vec) const |
Calculate the position of a vector compared to the position of the plane. | |
const Plane | normalize () const |
Normalize the plane. | |
Static Public Member Functions | |
static const bool | getPlanesIntersection (const Plane &plane1, const Plane &plane2, const Plane &plane3, Vector3 &result) |
Get the intersection of three planes. | |
Private Attributes | |
Vector3 | m_normal |
Plane normal. | |
double | m_offset |
Plane translation offset. |
A plane is commonly represented as ax+by+cz+d=0 where (a,b,c) is the normal vector and d is the translation offset.
syBR::map2syBR::Plane::Plane | ( | ) |
Constructor 1.
syBR::map2syBR::Plane::Plane | ( | Vector3 | normal, | |
double | offset | |||
) |
Constructor 2.
syBR::map2syBR::Plane::~Plane | ( | ) |
Destructor.
const bool syBR::map2syBR::Plane::getPlanesIntersection | ( | const Plane & | plane1, | |
const Plane & | plane2, | |||
const Plane & | plane3, | |||
Vector3 & | result | |||
) | [static] |
Get the intersection of three planes.
plane1 | First plane to be checked for intersection | |
plane2 | Second plane to be checked for intersection | |
plane3 | Third plane to be checked for intersection | |
result | Resulting intersection vector will be written here if the three planes are not parallel |
const Vector3 & syBR::map2syBR::Plane::getNormal | ( | ) | const |
Get the normal.
const double syBR::map2syBR::Plane::getOffset | ( | ) | const |
Get the translation offset.
void syBR::map2syBR::Plane::set | ( | const double | a, | |
const double | b, | |||
const double | c, | |||
const double | d | |||
) |
Set the (a,b,c) and d components of the plane.
a | x component of the plane normal | |
b | y component of the plane normal | |
c | z component of the plane normal | |
d | translation offset of the plane |
void syBR::map2syBR::Plane::set | ( | const Vector3 & | normal, | |
const double | offset | |||
) |
Set (a,b,c) and d components of the plane.
normal | plane normal | |
offset | translation offset of the plane |
void syBR::map2syBR::Plane::from3Vectors | ( | const Vector3 & | vec1, | |
const Vector3 & | vec2, | |||
const Vector3 & | vec3 | |||
) |
Construct plane from three vectors.
vec1 | First vector to use to the plane construction | |
vec2 | Second vector to use to the plane construction | |
vec3 | Third vector to use to the plane construction |
const double syBR::map2syBR::Plane::calculateDistance | ( | const Vector3 & | vec | ) | const |
Calculate the distance the plane and a vector.
vec | Vector whose distance to the plane must be calculated |
const Plane::VectorPosition syBR::map2syBR::Plane::calculatePosition | ( | const Vector3 & | vec | ) | const |
Calculate the position of a vector compared to the position of the plane.
vec | Vector whose position compared to the position of this plane must be calculated |
const Plane syBR::map2syBR::Plane::normalize | ( | ) | const |
Normalize the plane.
Vector3 syBR::map2syBR::Plane::m_normal [private] |
Plane normal.
double syBR::map2syBR::Plane::m_offset [private] |
Plane translation offset.
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:34 2008