45#ifndef LASS_GUARDIAN_OF_INCLUSION_PRIM_IMPL_LINE_2D_PARAMETRIC_INL
46#define LASS_GUARDIAN_OF_INCLUSION_PRIM_IMPL_LINE_2D_PARAMETRIC_INL
62template<
typename T,
class NP>
77template<
typename T,
class NP>
80 direction_(iPoint - iSupport)
82 NP::normalize(direction_);
91template<
typename T,
class NP>
94 direction_(iDirection)
96 NP::normalize(direction_);
105template<
typename T,
class NP>
108 direction_(-iNormal.perp())
110 NP::normalize(direction_);
119template<
typename T,
class NP>
121 support_(iNormal * (-iD / iNormal.squaredNorm())),
122 direction_(-iNormal.perp())
124 NP::normalize(direction_);
131template<
typename T,
class NP>
141template<
typename T,
class NP>
149template<
typename T,
class NP>
150void Line2DParametric<T, NP>::getCartesian(TVector& oNormal, TReference oD)
const
152 oNormal = direction_.
perp();
153 oD = -dot(oNormal, support_.position());
158template<
typename T,
class NP>
159const typename Line2DParametric<T, NP>::TVector Line2DParametric<T, NP>::normal()
const
163 getCartesian(normal, d);
169template<
typename T,
class NP>
170const typename Line2DParametric<T, NP>::TValue Line2DParametric<T, NP>::d()
const
174 getCartesian(normal, d);
182template<
typename T,
class NP>
183const typename Line2DParametric<T, NP>::TValue
188 getCartesian(normal, d);
189 return dot(iPoint.position(), normal) + d;
196template<
typename T,
class NP>
197const typename Line2DParametric<T, NP>::TValue
202 getCartesian(normal, d);
203 const TValue pn = dot(iPoint.position(), normal);
204 return num::almostEqual(pn, -d, iRelativeTolerance) ? TNumTraits::zero : (pn + d);
212template<
typename T,
class NP>
213const typename Line2DParametric<T, NP>::TVector
216 return reject(iPoint - support_);
225template<
typename T,
class NP>
226const typename Line2DParametric<T, NP>::TVector
230 return iVector -
project(iVector);
237template<
typename T,
class NP>
238const typename Line2DParametric<T, NP>::TPoint
241 return support_ +
project(iPoint - support_);
248template<
typename T,
class NP>
249const typename Line2DParametric<T, NP>::TVector
252 return direction_ * NP::divideBySquaredNorm(dot(iVector, direction_), direction_);
259template<
typename T,
class NP>
260const typename Line2DParametric<T, NP>::TPoint
263 return support_ +
reflect(iPoint - support_);
270template<
typename T,
class NP>
271const typename Line2DParametric<T, NP>::TVector
274 return T(2) *
project(iVector) - iVector;
281template<
typename T,
class NP>
282const typename Line2DParametric<T, NP>::TPoint
285 return support_ + iT * direction_;
292template<
typename T,
class NP>
293const typename Line2DParametric<T, NP>::TValue
296 return NP::divideBySquaredNorm(dot(iPoint - support_, direction_), direction_);
301template <
typename T,
class NP>
302void Line2DParametric<T, NP>::flip()
304 direction_ = -direction_;
311template<
typename T,
class NP>
314 return !direction_.isZero();
330template<
typename T,
class NP>
333 LASS_ENFORCE(ioOStream) <<
"{S=" << iLine.
support() <<
", D=" << iLine.
direction() <<
"}";
LineSegment3D< T, PP > reflect(const Plane3D< T, EP, NP > &plane, const LineSegment3D< T, PP > &lineSegment)
reflect a linesegment in a plane.
LineSegment3D< T, PP > project(const Plane3D< T, EP, NP > &plane, const LineSegment3D< T, PP > &lineSegment)
project a linesegment on a plane.
implementation of 2d line with parametric equation.
const TVector reject(const TPoint &iPoint) const
return the vector that, if added to the PROJECTION of iPoint, you get iPoint again.
const TValue equation(const TPoint &iPoint) const
Return value of point in equation.
const TValue t(const TPoint &iPoint) const
return UV pair of parameters
const TPoint & support() const
return support point.
const TPoint project(const TPoint &iPoint) const
project a point orthogonally onto the line
Line2DParametric()
initializes to an invalid state.
const TVector & direction() const
return direction vector.
const TPoint point(TParam iT) const
return point by filling in the parametric equation: P(t) = S + t * U
bool isValid() const
return true if line is a valid line (no normal or direction vectors that are zero).
const TPoint reflect(const TPoint &iPoint) const
reflect a point orthogonally into the line.
implementation details of lass::prim
set of geometrical primitives
Library for Assembled Shared Sources.
const Vector2D< T > perp() const
return the vector perpendicular to this one, 90° CCW (to the left).