45#ifndef LASS_GUARDIAN_OF_INCLUSION_PRIM_IMPL_PLANE_3D_COMBINED_INL
46#define LASS_GUARDIAN_OF_INCLUSION_PRIM_IMPL_PLANE_3D_COMBINED_INL
62template<
typename T,
class NP>
84template<
typename T,
class NP>
86 const TPoint& iPointU,
87 const TPoint& iPointV):
89 directionU_(iPointU - iSupport),
90 directionV_(iPointV - iSupport)
93 NP::normalize(directionU_);
94 NP::normalize(directionV_);
95 NP::normalizeAndScale(normal_, d_);
107template<
typename T,
class NP>
109 const TVector& iDirectionU,
110 const TVector& iDirectionV):
112 directionU_(iDirectionU),
113 directionV_(iDirectionV)
116 NP::normalize(directionU_);
117 NP::normalize(directionV_);
118 NP::normalizeAndScale(normal_, d_);
130template<
typename T,
class NP>
134 d_(-dot(iNormal, iSupport.position()))
137 NP::normalize(directionU_);
138 NP::normalize(directionV_);
139 NP::normalizeAndScale(normal_, d_);
151template<
typename T,
class NP>
153 support_(iNormal * (-iD / iNormal.squaredNorm())),
158 NP::normalize(directionU_);
159 NP::normalize(directionV_);
160 NP::normalizeAndScale(normal_, d_);
168template<
typename T,
class NP>
178template<
typename T,
class NP>
181 oDirectionU = directionU_;
182 oDirectionV = directionV_;
189template<
typename T,
class NP>
199template<
typename T,
class NP>
209template<
typename T,
class NP>
211 TVector& oReciprocalV)
const
213 oReciprocalU = reciprocalU_;
214 oReciprocalV = reciprocalV_;
221template<
typename T,
class NP>
231template<
typename T,
class NP>
239template<
typename T,
class NP>
240void Plane3DCombined<T, NP>::getCartesian(TVector& oNormal, TReference oD)
const
248template<
typename T,
class NP>
249const typename Plane3DCombined<T, NP>::TVector& Plane3DCombined<T, NP>::normal()
const
256template<
typename T,
class NP>
257const typename Plane3DCombined<T, NP>::TParam Plane3DCombined<T, NP>::d()
const
266template<
typename T,
class NP>
267const typename Plane3DCombined<T, NP>::TValue
270 return dot(iPoint.position(), normal_) + d_;
277template<
typename T,
class NP>
278const typename Plane3DCombined<T, NP>::TValue
281 const TValue a = dot(iPoint.position(), normal_);
282 return almostEqual(a, -d_, iRelativeTolerance) ? TNumTraits::zero : (a + d_);
290template<
typename T,
class NP>
291const typename Plane3DCombined<T, NP>::TVector
294 return normal_ * NP::divideBySquaredNorm(
equation(iPoint), normal_);
303template<
typename T,
class NP>
304const typename Plane3DCombined<T, NP>::TVector
307 return normal_ * NP::divideBySquaredNorm(dot(normal_, iVector), normal_);
314template<
typename T,
class NP>
315const typename Plane3DCombined<T, NP>::TPoint
318 return iPoint -
reject(iPoint);
325template<
typename T,
class NP>
326const typename Plane3DCombined<T, NP>::TVector
329 return iVector -
reject(iVector);
336template<
typename T,
class NP>
337const typename Plane3DCombined<T, NP>::TPoint
340 return iPoint - 2 *
reject(iPoint);
347template<
typename T,
class NP>
348const typename Plane3DCombined<T, NP>::TVector
351 return iVector - 2 *
reject(iVector);
358template<
typename T,
class NP>
359const typename Plane3DCombined<T, NP>::TPoint
362 return point(TIndex(iU, iV));
369template<
typename T,
class NP>
370const typename Plane3DCombined<T, NP>::TPoint
373 return support_ + iUV.x * directionU_ + iUV.y * directionV_;
380template<
typename T,
class NP>
381const typename Plane3DCombined<T, NP>::TUV
384 const TVector relative = iPoint - support_;
385 return TUV(dot(relative, reciprocalU_), dot(relative, reciprocalV_));
390template <
typename T,
class NP>
391void Plane3DCombined<T, NP>::flip()
393 directionV_ = -directionV_;
403template<
typename T,
class NP>
406 return !normal_.isZero() && !cross(directionU_, directionV_).isZero();
422template<
typename T,
class NP>
425 LASS_ENFORCE(ioOStream) <<
"{S=" << iPlane.
support() <<
", U=" << iPlane.
directionU() <<
", V="
426 << iPlane.
directionV() <<
", N=" << iPlane.normal() <<
", d=" << iPlane.d() <<
"}";
implementation of plane 3d with both cartesian and parametric equation, and plus extra reciprocal vec...
void getDirections(TVector &oDirectionU, TVector &oDirectionV) const
return U and V direction vectors
const TPoint point(TParam iU, TParam iV) const
return point by filling in the parametric equation: P(u, v) = S + u * U + v * V
const TVector reject(const TPoint &iPoint) const
return the vector that, if added to the PROJECTION of iPoint, you get iPoint again.
const TVector & directionV() const
return V direction vector.
const TVector & directionU() const
return U direction vector.
const TValue equation(const TPoint &iPoint) const
Return value of point in equation.
const TPoint project(const TPoint &iPoint) const
project a point orthogonally onto the plane
const TVector & reciprocalU() const
return reciprocal for U direction vector.
void getReciprocals(TVector &oReciprocalU, TVector &oReciprocalV) const
return reciprocal vectors for U and V direction vectors
Plane3DCombined()
initializes to an invalid state.
const TPoint & support() const
return support point.
bool isValid() const
return true if plane is a valid plane (no normal or direction vectors that are zero).
const TUV uv(const TPoint &iPoint) const
return UV pair of parameters
const TPoint reflect(const TPoint &iPoint) const
reflect a point orthogonally into the plane.
const TVector & reciprocalV() const
return reciprocal for V direction vector.
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.