13 #ifndef __UT_PLANEIMPL_H_INCLUDED__
14 #define __UT_PLANEIMPL_H_INCLUDED__
54 if (norm) myNormal.normalize();
60 , myNormal(p.
x(), p.
y(), p.
z())
63 myPoint.z() = -p.
w()/p.
z();
65 myPoint.y() = -p.
w()/p.
y();
67 myPoint.x() = -p.
w()/p.
x();
94 T tnom =
dot( (myPoint-p), myNormal );
95 T tden =
dot( v, myNormal );
98 UT_ASSERT( !
"Line segment does not intersect with plane" );
103 return (p + tnom/tden * v);
107 template <
typename T>
115 T tnom =
dot( (myPoint-p), myNormal );
116 T tden =
dot( v, myNormal );
127 hit = (p + tnom/tden *
v);
132 template <
typename T>
140 T tnom =
dot( (myPoint-p), myNormal );
141 T tden =
dot( v, myNormal );
152 hit = (p + tnom/tden *
v);
157 template <
typename T>
166 T tnom =
dot( (offset_pt-p), myNormal );
167 T tden =
dot( v, myNormal );
176 hit = (p + tnom/tden *
v);
181 template <
typename T>
190 T tnom =
dot( (offset_pt-p), myNormal );
191 T tden =
dot( v, myNormal );
202 hit = (p + tnom/tden *
v);
207 template <
typename T>
214 template <
typename T>
218 T tnom =
dot( (myPoint-p), myNormal );
219 p += 2.0 * tnom/myNormal.
length2() * myNormal;
222 template <
typename T>
226 T tnom =
dot( (myPoint-p), myNormal );
227 return (p + tnom/myNormal.
length2() * myNormal);
230 template <
typename T>
234 T tnom =
dot( (myPoint-p), myNormal );
235 projection = p + tnom/myNormal.
length2() * myNormal;
239 template <
typename T>
248 myNormal.normalize();
251 template <
typename T>
260 myNormal.normalize();
263 template <
typename T>
270 myNormal *= nml_matx;
271 myNormal.normalize();
274 template <
typename T>
281 myNormal.normalize();
284 template <
typename T>
291 myNormal *= nml_matx;
292 myNormal.normalize();
295 template <
typename T>
302 myNormal.normalize();
305 template <
typename T>
312 template <
typename T>
316 return dot(p-myPoint, myNormal);
319 template <
typename T>
323 return (
dot(p-myPoint, myNormal) > 0) ? 1 : 0;
326 #endif // __UT_PLANEIMPL_H_INCLUDED__
constexpr SYS_FORCE_INLINE T length2() const noexcept
UT_Vector3T< T > project(const UT_Vector3T< T > &p) const
static UT_Matrix3T< float > rotationMat(UT_Vector3T< S > &axis, floattheta, int norm=1)
constexpr SYS_FORCE_INLINE T & y() noexcept
GLdouble GLdouble GLdouble z
GLboolean GLboolean GLboolean GLboolean a
void transform(const UT_Matrix4F &matx)
UT_Vector3T< T > intersect(const UT_Vector3T< T > &p, const UT_Vector3T< T > &v) const
constexpr SYS_FORCE_INLINE T & x() noexcept
constexpr SYS_FORCE_INLINE T & z() noexcept
bool contains(const UT_Vector3T< T > &p) const
void setNormal(const UT_Vector3T< T > &n)
fpreal64 dot(const CE_VectorT< T > &a, const CE_VectorT< T > &b)
int intersectLine(const UT_Vector3T< T > &p, const UT_Vector3T< T > &v, UT_Vector3T< T > &hit) const
void rotate(UT_Vector3T< T > &axis, T theta, bool norm=true)
void transformAndReturnNormalXform(UT_Matrix4F &matx)
bool SYSequalZero(const UT_Vector3T< T > &v)
int side(const UT_Vector3T< T > &p) const
int intersectRay(const UT_Vector3T< T > &p, const UT_Vector3T< T > &v, UT_Vector3T< T > &hit) const
void symmetry(UT_Vector3T< T > &p) const
constexpr SYS_FORCE_INLINE T & w() noexcept
ImageBuf OIIO_API max(Image_or_Const A, Image_or_Const B, ROI roi={}, int nthreads=0)
UT_PlaneT(UT_PlaneType plane_type=UT_PLANE_XY)
T distance(const UT_Vector3T< T > &p) const