10 #ifndef INCLUDED_IMATHPLANE_H
11 #define INCLUDED_IMATHPLANE_H
19 IMATH_INTERNAL_NAMESPACE_HEADER_ENTER
139 normal = (point2 - point1) % (point3 - point1);
173 return normal * distanceTo (point) * -2.0 + point;
180 return normal * (normal ^
v) * 2.0 -
v;
187 T d = normal ^ line.dir;
199 T d = normal ^ line.dir;
202 t = -((normal ^ line.pos) -
distance) / d;
209 operator<< (std::ostream& o, const Plane3<T>& plane)
211 return o <<
"(" << plane.normal <<
", " << plane.distance <<
")";
225 T dir1Len = dir1 ^ dir1;
228 T tmpLen = tmp ^ tmp;
230 if (tmpLen > dir1Len)
236 tmp =
Vec3<T> (0, 0, 1) % plane.normal;
239 if (tmpLen > dir1Len)
244 Vec3<T> dir2 = dir1 % plane.normal;
245 Vec3<T> point = plane.distance * plane.normal;
247 return Plane3<T> (point * M, (point + dir2) * M, (point + dir1) * M);
255 return Plane3<T> (-plane.normal, -plane.distance);
258 IMATH_INTERNAL_NAMESPACE_HEADER_EXIT
260 #endif // INCLUDED_IMATHPLANE_H
IMATH_HOSTDEVICE constexpr Vec3< T > reflectPoint(const Vec3< T > &point) const IMATH_NOEXCEPT
Reflect the given point around the plane.
Mat3< typename promote< S, T >::type > operator*(S scalar, const Mat3< T > &m)
Multiply each element of the given matrix by scalar and return the result.
IMATH_HOSTDEVICE IMATH_CONSTEXPR14 bool intersect(const Line3< T > &line, Vec3< T > &intersection) const IMATH_NOEXCEPT
IMATH_HOSTDEVICE constexpr Vec3< T > reflectVector(const Vec3< T > &vec) const IMATH_NOEXCEPT
Reflect the direction vector around the plane.
T distance
The distance from the origin to the plane.
Mat3< typename promote< T0, T1 >::type > operator-(const Mat3< T0 > &m0, const Mat3< T1 > &m1)
Subtract corresponding elements of m0 and m1 and return the result.
IMATH_HOSTDEVICE void set(const Vec3< T > &normal, T distance) IMATH_NOEXCEPT
Set via a given normal and distance.
Plane3< double > Plane3d
Plane of type double.
Plane3< float > Plane3f
Plane of type float.
IMATH_HOSTDEVICE constexpr T distanceTo(const Vec3< T > &point) const IMATH_NOEXCEPT
Return the distance from a point to the plane.
#define IMATH_EXPORT_TEMPLATE_TYPE
IMATH_CONSTEXPR14 bool intersect(const Line3< T > &line, const Vec3< T > &v0, const Vec3< T > &v1, const Vec3< T > &v2, Vec3< T > &pt, Vec3< T > &barycentric, bool &front) IMATH_NOEXCEPT
SIM_API const UT_StringHolder distance
IMATH_HOSTDEVICE Plane3() IMATH_NOEXCEPT
Uninitialized by default.
Vec3< T > normal
The normal to the plane.
IMATH_HOSTDEVICE IMATH_CONSTEXPR14 bool intersectT(const Line3< T > &line, T ¶meter) const IMATH_NOEXCEPT