45#ifndef LASS_GUARDIAN_OF_INCLUSION_PRIM_IMPL_LINE_2D_CARTESIAN_INL
46#define LASS_GUARDIAN_OF_INCLUSION_PRIM_IMPL_LINE_2D_CARTESIAN_INL
62template<
typename T,
class NP>
79template<
typename T,
class NP>
81 normal_((iPoint - iSupport).perp())
83 NP::normalize(normal_);
84 d_ = -dot(normal_, iSupport.position());
95template<
typename T,
class NP>
97 normal_(iDirection.perp())
99 NP::normalize(normal_);
100 d_ = -dot(normal_, iSupport.position());
111template<
typename T,
class NP>
115 NP::normalize(normal_);
116 d_ = -dot(normal_, iSupport.position());
127template<
typename T,
class NP>
132 NP::normalizeAndScale(normal_, d_);
140template<
typename T,
class NP>
143 return TPoint(normal_ * NP::divideBySquaredNorm(-d_, normal_));
150template<
typename T,
class NP>
153 return -normal_.
perp();
158template<
typename T,
class NP>
159void Line2DCartesian<T, NP>::getCartesian(TVector& oNormal, TReference oD)
const
167template<
typename T,
class NP>
168const typename Line2DCartesian<T, NP>::TVector& Line2DCartesian<T, NP>::normal()
const
175template<
typename T,
class NP>
176typename Line2DCartesian<T, NP>::TParam Line2DCartesian<T, NP>::d()
const
185template<
typename T,
class NP>
186const typename Line2DCartesian<T, NP>::TValue
189 return dot(iPoint.position(), normal_) + d_;
196template<
typename T,
class NP>
197const typename Line2DCartesian<T, NP>::TValue
200 const TValue d = dot(iPoint.position(), normal_);
201 return num::almostEqual(d, -d_, iRelativeTolerance) ? TNumTraits::zero : (d + d_);
209template<
typename T,
class NP>
210const typename Line2DCartesian<T, NP>::TVector
213 return normal_ * NP::divideBySquaredNorm(
equation(iPoint), normal_);
222template<
typename T,
class NP>
223const typename Line2DCartesian<T, NP>::TVector
226 return normal_ * NP::divideBySquaredNorm(dot(normal_, iVector), normal_);
233template<
typename T,
class NP>
234const typename Line2DCartesian<T, NP>::TPoint
237 return iPoint -
reject(iPoint);
244template<
typename T,
class NP>
245const typename Line2DCartesian<T, NP>::TVector
248 return iVector -
reject(iVector);
255template<
typename T,
class NP>
256const typename Line2DCartesian<T, NP>::TPoint
259 return iPoint - T(2) *
reject(iPoint);
266template<
typename T,
class NP>
267const typename Line2DCartesian<T, NP>::TVector
270 return iVector - T(2) *
reject(iVector);
277template<
typename T,
class NP>
278const typename Line2DCartesian<T, NP>::TPoint
288template<
typename T,
class NP>
292 return NP::divideBySquaredNorm(dot(dir, iPoint -
support()), dir);
297template <
typename T,
class NP>
298void Line2DCartesian<T, NP>::flip()
308template<
typename T,
class NP>
311 return !normal_.isZero();
327template<
typename T,
class NP>
330 LASS_ENFORCE(ioOStream) <<
"{N=" << iLine.normal() <<
", d=" << iLine.d() <<
"}";
implementation of 2d line with both cartesian and parametric equation.
const TPoint support() const
return generated support point.
const TVector reject(const TPoint &iPoint) const
return the vector that, if added to the PROJECTION of iPoint, you get iPoint again.
bool isValid() const
return true if line is a valid line (no normal or direction vectors that are zero).
const TPoint point(TParam iT) const
return point by filling in parameter in generated parametric equation
const TValue equation(const TPoint &iPoint) const
Return value of point in equation.
const TVector direction() const
return generated direction vector.
const TValue t(const TPoint &iPoint) const
return parameter along generated paremetric equation.
const TPoint project(const TPoint &iPoint) const
project a point orthogonally onto the line
Line2DCartesian()
initializes to an invalid state.
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).