13 #ifndef OGLPLUS_PLANE_1107121519_HPP
14 #define OGLPLUS_PLANE_1107121519_HPP
34 : _equation(a, b, c, d)
42 struct FromTriangle_ { };
46 const Vector<T, 3>& p0,
47 const Vector<T, 3>& p1,
48 const Vector<T, 3>& p2
50 Normalized(Cross(p1-p0, p2-p0)),
51 -Dot(Normalized(Cross(p1-p0, p2-p0)), p0)
69 struct FromPointAndVectors_ { };
73 const Vector<T, 3>& p,
74 const Vector<T, 3>& v1,
75 const Vector<T, 3>& v2
77 Normalized(Cross(v1, v2)),
78 -Dot(Normalized(Cross(v1, v2)), p)
90 FromPointAndVectors_(),
95 struct FromNormal_ { };
97 Plane(FromNormal_,
const Vector<T, 3>& normal)
98 : _equation(normal,
T(0))
104 return Plane(FromNormal_(), normal);
107 struct FromPointAndNormal_ { };
111 const Vector<T, 3>& point,
112 const Vector<T, 3>& normal
113 ): _equation(normal, -Dot(normal, point))
122 return Plane(FromPointAndNormal_(), point, normal);
132 #if OGLPLUS_DOCUMENTATION_ONLY || defined(GL_FLOAT)
133 typedef Plane<GLfloat>
Planef;
139 #endif // include guard
Definition: vector.hpp:14
Plane(T a, T b, T c, T d)
construction from parameters
Definition: plane.hpp:33
Class implementing plane-related functionality.
Definition: plane.hpp:27
const Vector< T, 4 > & Equation(void) const
Retuns the plane's equation parameters.
Definition: plane.hpp:126
Plane(const Vector< T, 4 > &v)
Constructions from parameter vector.
Definition: plane.hpp:38
static Plane FromTriangle(const Vector< T, 3 > &p0, const Vector< T, 3 > &p1, const Vector< T, 3 > &p2)
Constructs a plane defined by points p0, p1, p2.
Definition: plane.hpp:57
static Plane FromPointAndNormal(const Vector< T, 3 > &point, const Vector< T, 3 > &normal)
Constructs a plane from a point on in and its normal vector.
Definition: plane.hpp:117
static Plane FromNormal(const Vector< T, 3 > &normal)
Constructs a plane going through the origin from its normal vector.
Definition: plane.hpp:102
static Plane FromPointAndVectors(const Vector< T, 3 > &p, const Vector< T, 3 > &v1, const Vector< T, 3 > &v2)
Constructs a plane defined by point p0 and vectors v1 and v2.
Definition: plane.hpp:83
Definition: vector.hpp:14
Plane< GLfloat > Planef
Instantiation of Plane using GL floating-point as underlying type.
Definition: plane.hpp:134