Plane3¶
#include <Imath/ImathPlane.h>
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));
}
-
template<class T>
class Plane3¶ The
Plane3class represents a half space in 3D, so the normal may point either towards or away from origin.The plane
Pcan be represented by Plane3 as eitherpor-pcorresponding 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
Constructors
-
inline Plane3() noexcept¶
Uninitialized by default.
-
inline constexpr Plane3(const Vec3<T> &normal, T distance) noexcept¶
Initialize with a normal and distance.
Manipulation
Utility Methods
-
inline constexpr bool intersect(const Line3<T> &line, Vec3<T> &intersection) const noexcept¶
Determine if a line intersects the plane.
- Parameters:
line – The line
intersection – [out] The point of intersection
- Returns:
True if the line intersects the plane.
-
inline constexpr bool intersectT(const Line3<T> &line, T ¶meter) const noexcept¶
Determine if a line intersects the plane.
- Parameters:
line – The line
parameter – [out] The parametric value of the point of intersection
- Returns:
True if the line intersects the plane.
-
inline constexpr T distanceTo(const Vec3<T> &point) const noexcept¶
Return the distance from a point to the plane.
-
inline Plane3() noexcept¶