45#ifndef LASS_GUARDIAN_OF_INCLUSION_PRIM_IMPL_PLANE_3D_PARAMETRIC_INL
46#define LASS_GUARDIAN_OF_INCLUSION_PRIM_IMPL_PLANE_3D_PARAMETRIC_INL
62template<
typename T,
class NP>
78template<
typename T,
class NP>
80 const TPoint& iPointU,
81 const TPoint& iPointV):
83 directionU_(iPointU - iSupport),
84 directionV_(iPointV - iSupport)
86 NP::normalize(directionU_);
87 NP::normalize(directionV_);
96template<
typename T,
class NP>
98 const TVector& iDirectionU,
99 const TVector& iDirectionV):
101 directionU_(iDirectionU),
102 directionV_(iDirectionV)
104 NP::normalize(directionU_);
105 NP::normalize(directionV_);
114template<
typename T,
class NP>
119 NP::normalize(directionU_);
120 NP::normalize(directionV_);
129template<
typename T,
class NP>
131 support_(iNormal * (-iD / iNormal.squaredNorm()))
134 NP::normalize(directionU_);
135 NP::normalize(directionV_);
142template<
typename T,
class NP>
152template<
typename T,
class NP>
155 oDirectionU = directionU_;
156 oDirectionV = directionV_;
163template<
typename T,
class NP>
173template<
typename T,
class NP>
183template<
typename T,
class NP>
185 TVector& oReciprocalV)
const
194template<
typename T,
class NP>
207template<
typename T,
class NP>
218template<
typename T,
class NP>
219void Plane3DParametric<T, NP>::getCartesian(TVector& oNormal, TReference oD)
const
222 NP::normalizeAndScale(oNormal, oD);
227template<
typename T,
class NP>
228const typename Plane3DParametric<T, NP>::TVector Plane3DParametric<T, NP>::normal()
const
232 getCartesian(normal, d);
238template<
typename T,
class NP>
239const typename Plane3DParametric<T, NP>::TValue Plane3DParametric<T, NP>::d()
const
243 getCartesian(normal, d);
251template<
typename T,
class NP>
252const typename Plane3DParametric<T, NP>::TValue
257 getCartesian(normal, d);
258 return dot(iPoint.position(), normal) + d;
265template<
typename T,
class NP>
266const typename Plane3DParametric<T, NP>::TValue
271 getCartesian(normal, d);
272 const TValue a = dot(iPoint.position(), normal);
273 return almostEqual(a, -d, iRelativeTolerance) ? TNumTraits::zero : (a + d);
281template<
typename T,
class NP>
282const typename Plane3DParametric<T, NP>::TVector
287 getCartesian(normal, d);
288 return normal * NP::divideBySquaredNorm(dot(iPoint.position(), normal) + d, normal);
297template<
typename T,
class NP>
298const typename Plane3DParametric<T, NP>::TVector
303 getCartesian(normal, d);
304 return normal * NP::divideBySquaredNorm(dot(iVector, normal), normal);
311template<
typename T,
class NP>
312const typename Plane3DParametric<T, NP>::TPoint
315 return iPoint -
reject(iPoint);
322template<
typename T,
class NP>
323const typename Plane3DParametric<T, NP>::TVector
326 return iVector -
reject(iVector);
333template<
typename T,
class NP>
334const typename Plane3DParametric<T, NP>::TPoint
337 return iPoint - 2 *
reject(iPoint);
344template<
typename T,
class NP>
345const typename Plane3DParametric<T, NP>::TVector
348 return iVector - 2 *
reject(iVector);
355template<
typename T,
class NP>
356const typename Plane3DParametric<T, NP>::TPoint
359 return point(TIndex(iU, iV));
366template<
typename T,
class NP>
367const typename Plane3DParametric<T, NP>::TPoint
370 return support_ + iUV.x * directionU_ + iUV.y * directionV_;
377template<
typename T,
class NP>
378const typename Plane3DParametric<T, NP>::TUV
384 const TVector relative = iPoint - support_;
390template <
typename T,
class NP>
391void Plane3DParametric<T, NP>::flip()
393 directionV_ = -directionV_;
401template<
typename T,
class NP>
404 return !cross(directionU_, directionV_).isZero();
420template<
typename T,
class NP>
423 LASS_ENFORCE(ioOStream) <<
"{S=" << iPlane.
support() <<
", U=" << iPlane.
directionU() <<
", V="
implementation of lass::prim::Plane3D with a parametric equation
const TPoint point(TParam iU, TParam iV) const
return point by filling in the parametric equation: P(u, v) = S + u * U + v * V
void getDirections(TVector &oDirectionU, TVector &oDirectionV) const
return U and V direction vectors
void getReciprocals(TVector &oReciprocalU, TVector &oReciprocalV) const
return reciprocal vectors for U and V direction vectors
const TPoint project(const TPoint &iPoint) const
project a point orthogonally onto the plane
const TVector reciprocalU() const
return reciprocal for U direction vector.
const TPoint reflect(const TPoint &iPoint) const
reflect a point orthogonally into the plane.
const TUV uv(const TPoint &iPoint) const
return UV pair of parameters
const TValue equation(const TPoint &iPoint) const
Return value of point in equation.
const TVector & directionU() const
return U direction vector.
const TPoint & support() const
return support point.
const TVector & directionV() const
return V direction vector.
Plane3DParametric()
initializes to an invalid state.
const TVector reciprocalV() const
return reciprocal for V direction vector.
bool isValid() const
return true if plane is a valid plane (no direction vector is zero and they're not colinear.
const TVector reject(const TPoint &iPoint) const
return the vector that, if added to the PROJECTION of iPoint, you get iPoint again.
implementation details of lass::prim
set of geometrical primitives
Library for Assembled Shared Sources.
static void generateReciprocal(const Vector3D< T > &iDirU, const Vector3D< T > &iDirV, Vector3D< T > &oReciprocalDirU, Vector3D< T > &oReciprocalDirV)
generate reciprocal direction vectors Ur and Vr given directions U and V.
static void generateDirections(const Vector3D< T > &iNormal, Vector3D< T > &oDirU, Vector3D< T > &oDirV)
Generate directions vectors U and V of parametric equation P = S + x*U + y*V, based on the normal vec...
static void generateCartesian(const Point3D< T > &iSupport, const Vector3D< T > &iDirU, const Vector3D< T > &iDirV, Vector3D< T > &oNormal, T &oD)
Generate cartesian equation out of parametric equation.