Plane3¶
The Plane3
class template represents a plane in 3D space, with
predefined typedefs for planes of type float
and double
.
Example:
#include <Imath/ImathPlane.h>
#include <cassert>
void
plane3_example()
{
Imath::V3f a (1.0f, 0.0f, 0.0f);
Imath::V3f b (0.0f, 1.0f, 0.0f);
Imath::V3f c (0.0f, 0.0f, 1.0f);
Imath::Plane3f p (a, b, c);
Imath::V3f n (1.0f, 1.0f, 1.0f);
n.normalize();
assert (p.normal == n);
Imath::V3f o (0.0f, 0.0f, 0.0f);
float d = p.distanceTo (o);
assert (Imath::equalWithAbsError (d, -0.57735f, 1e-6f));
}
-
typedef Plane3<float>
Imath
::
Plane3f
¶ Plane of type float.
-
typedef Plane3<double>
Imath
::
Plane3d
¶ Plane of type double.
-
template<class
T
>
classPlane3
¶ The
Plane3
class represents a half space in 3D, so the normal may point either towards or away from origin.The plane
P
can be represented by Plane3 as eitherp
or-p
corresponding to the two half-spaces on either side of the plane. Any function which computes a distance will return either negative or positive values for the distance indicating which half-space the point is in. Note that reflection, and intersection functions will operate as expected.Direct access to member fields
-
Vec3<T>
normal
¶ The normal to the plane.
-
T
distance
¶ The distance from the origin to the plane.
Constructors
-
Plane3
()¶ Uninitialized by default.
-
constexpr
Plane3
(const Vec3<T> &normal, T distance)¶ Initialize with a normal and distance.
-
constexpr
Plane3
(const Vec3<T> &point, const Vec3<T> &normal)¶ Initialize with a point and a normal.
-
constexpr
Plane3
(const Vec3<T> &point1, const Vec3<T> &point2, const Vec3<T> &point3)¶ Initialize with three points.
Manipulation
-
void
set
(const Vec3<T> &normal, T distance)¶ Set via a given normal and distance.
-
void
set
(const Vec3<T> &point, const Vec3<T> &normal)¶ Set via a given point and normal.
-
void
set
(const Vec3<T> &point1, const Vec3<T> &point2, const Vec3<T> &point3)¶ Set via three points.
Utility Methods
-
constexpr bool
intersect
(const Line3<T> &line, Vec3<T> &intersection) const¶ Determine if a line intersects the plane.
- Return
- True if the line intersects the plane.
- Parameters
line
: The lineintersection
: The point of intersection
-
constexpr bool
intersectT
(const Line3<T> &line, T ¶meter) const¶ Determine if a line intersects the plane.
- Return
- True if the line intersects the plane.
- Parameters
line
: The lineparameter
: The parametric value of the point of intersection
-
constexpr T
distanceTo
(const Vec3<T> &point) const¶ Return the distance from a point to the plane.
-
constexpr Vec3<T>
reflectPoint
(const Vec3<T> &point) const¶ Reflect the given point around the plane.
-
constexpr Vec3<T>
reflectVector
(const Vec3<T> &vec) const¶ Reflect the direction vector around the plane.
-
Vec3<T>
Warning
doxygenfunction: Unable to resolve multiple matches for function “operator<<” with arguments (std::ostream& s, const Plane3<T>& plane) in doxygen xml output for project “Imath” from directory: /build/ilmbase-pisqTC/ilmbase-3.1.11/obj-x86_64-linux-gnu/website/doxygen/xml. Potential matches:
- std::ostream &operator<<(std::ostream&, Imath::half)
- template<class T>
std::ostream &Imath::operator<<(std::ostream&, const Color4<T>&)
- template<class T>
std::ostream &Imath::operator<<(std::ostream&, const Euler<T>&)
- template<class T>
std::ostream &Imath::operator<<(std::ostream&, const Interval<T>&)
- template<class T>
std::ostream &Imath::operator<<(std::ostream&, const Line3<T>&)
- template<class T>
std::ostream &Imath::operator<<(std::ostream&, const Matrix22<T>&)
- template<class T>
std::ostream &Imath::operator<<(std::ostream&, const Matrix33<T>&)
- template<class T>
std::ostream &Imath::operator<<(std::ostream&, const Matrix44<T>&)
- template<class T>
std::ostream &Imath::operator<<(std::ostream&, const Plane3<T>&)
- template<class T>
std::ostream &Imath::operator<<(std::ostream&, const Quat<T>&)
- template<class T>
std::ostream &Imath::operator<<(std::ostream&, const Shear6<T>&)
- template<class T>
std::ostream &Imath::operator<<(std::ostream&, const Vec2<T>&)
- template<class T>
std::ostream &Imath::operator<<(std::ostream&, const Vec3<T>&)
- template<class T>
std::ostream &Imath::operator<<(std::ostream&, const Vec4<T>&)