45#ifndef LASS_GUARDIAN_OF_INCLUSION_PRIM_IMPL_LINE_2D_COMBINED_INL
46#define LASS_GUARDIAN_OF_INCLUSION_PRIM_IMPL_LINE_2D_COMBINED_INL
62template<
typename T,
class NP>
81template<
typename T,
class NP>
84 direction_(iPoint - iSupport)
86 NP::normalize(direction_);
87 normal_ = direction_.perp();
88 d_ = -dot(normal_, iSupport.position());
99template<
typename T,
class NP>
102 direction_(iDirection)
104 NP::normalize(direction_);
105 normal_ = direction_.perp();
106 d_ = -dot(normal_, iSupport.position());
117template<
typename T,
class NP>
122 NP::normalize(normal_);
123 direction_ = -normal_.perp();
124 d_ = -dot(normal_, iSupport.position());
135template<
typename T,
class NP>
137 support_(iNormal * (-iD / iNormal.squaredNorm())),
141 NP::normalizeAndScale(normal_, d_);
142 direction_ = -normal_.perp();
149template<
typename T,
class NP>
159template<
typename T,
class NP>
167template<
typename T,
class NP>
168void Line2DCombined<T, NP>::getCartesian(TVector& oNormal, TReference oD)
const
176template<
typename T,
class NP>
177const typename Line2DCombined<T, NP>::TVector& Line2DCombined<T, NP>::normal()
const
184template<
typename T,
class NP>
185const typename Line2DCombined<T, NP>::TParam Line2DCombined<T, NP>::d()
const
194template<
typename T,
class NP>
195const typename Line2DCombined<T, NP>::TValue
198 return dot(iPoint.position(), normal_) + d_;
205template<
typename T,
class NP>
206const typename Line2DCombined<T, NP>::TValue
209 const TValue d = dot(iPoint.position(), normal_);
210 return num::almostEqual(d, -d_, iRelativeTolerance) ? TNumTraits::zero : (d + d_);
218template<
typename T,
class NP>
219const typename Line2DCombined<T, NP>::TVector
222 return normal_ * NP::divideBySquaredNorm(
equation(iPoint), normal_);
231template<
typename T,
class NP>
232const typename Line2DCombined<T, NP>::TVector
235 return normal_ * NP::divideBySquaredNorm(dot(normal_, iVector), normal_);
242template<
typename T,
class NP>
243const typename Line2DCombined<T, NP>::TPoint
246 return iPoint -
reject(iPoint);
253template<
typename T,
class NP>
254const typename Line2DCombined<T, NP>::TVector
257 return iVector -
reject(iVector);
264template<
typename T,
class NP>
265const typename Line2DCombined<T, NP>::TPoint
268 return support_ +
reflect(iPoint - support_);
275template<
typename T,
class NP>
276const typename Line2DCombined<T, NP>::TVector
279 return iVector - T(2) *
reject(iVector);
286template<
typename T,
class NP>
287const typename Line2DCombined<T, NP>::TPoint
290 return support_ + iT * direction_;
297template<
typename T,
class NP>
298const typename Line2DCombined<T, NP>::TValue
301 return NP::divideBySquaredNorm(dot(direction_, iPoint - support_), direction_);
306template <
typename T,
class NP>
307void Line2DCombined<T, NP>::flip()
309 direction_ = -direction_;
318template<
typename T,
class NP>
321 return !normal_.isZero() && !direction_.isZero();
337template<
typename T,
class NP>
340 LASS_ENFORCE(ioOStream) <<
"{S=" << iLine.
support() <<
", D=" << iLine.
direction()
341 <<
", N=" << iLine.normal() <<
", d=" << iLine.d() <<
"}";
LineSegment3D< T, PP > reflect(const Plane3D< T, EP, NP > &plane, const LineSegment3D< T, PP > &lineSegment)
reflect a linesegment in a plane.
implementation of 2d line with both cartesian and parametric equation.
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 line
const TPoint point(TParam iT) const
return point by filling in the parametric equation: P(t) = S + t * U
Line2DCombined()
initializes to an invalid state.
const TValue t(const TPoint &iPoint) const
return UV pair of parameters
const TPoint & support() const
return support point.
const TVector reject(const TPoint &iPoint) const
return the vector that, if added to the PROJECTION of iPoint, you get iPoint again.
const TVector & direction() const
return direction vector.
const TPoint reflect(const TPoint &iPoint) const
reflect a point orthogonally into the line.
bool isValid() const
return true if line is a valid line (no normal or direction vectors that are zero).
implementation details of lass::prim
set of geometrical primitives
Library for Assembled Shared Sources.