45#ifndef LASS_GUARDIAN_OF_INCLUSION_PRIM_LINE_2D_INL
46#define LASS_GUARDIAN_OF_INCLUSION_PRIM_LINE_2D_INL
61template<
typename T,
typename EP,
typename NP>
62Line2D<T, EP, NP>::Line2D():
70template<
typename T,
typename EP,
typename NP>
71Line2D<T, EP, NP>::Line2D(
const TPoint& iSupport,
const TPoint& iPoint):
72 TImpl(iSupport, iPoint)
78template<
typename T,
typename EP,
typename NP>
79Line2D<T, EP, NP>::Line2D(
const TPoint& iSupport,
const TVector& iDirection):
80 TImpl(iSupport, iDirection)
86template<
typename T,
typename EP,
typename NP>
87Line2D<T, EP, NP>::Line2D(
const TVector& iNormal,
const TPoint& iSupport):
88 TImpl(iNormal, iSupport)
94template<
typename T,
typename EP,
typename NP>
95Line2D<T, EP, NP>::Line2D(
const TVector& iNormal, TParam iD):
104template<
typename T,
typename EP,
typename NP>
107 const TValue eq = this->
equation(iPoint);
116template<
typename T,
typename EP,
typename NP>
117const typename Line2D<T, EP, NP>::TValue
120 return NP::divideByNorm(this->
equation(iPoint), this->normal());
128template<
typename T,
typename EP,
typename NP>
129const typename Line2D<T, EP, NP>::TValue
139template<
typename T,
typename EP,
typename NP>
142 const TValue eq = this->
equation(iPoint, iRelativeTolerance);
151template<
typename T,
typename EP,
typename NP>
152const typename Line2D<T, EP, NP>::TValue
155 return NP::divideByNorm(this->
equation(iPoint, iRelativeTolerance), this->normal());
163template<
typename T,
typename EP,
typename NP>
164const typename Line2D<T, EP, NP>::TValue
188template <
typename T,
class EP,
class NP>
189T
distance(
const Point2D<T>& iA,
const Line2D<T, EP, NP>& iB)
202template <
typename T,
class EPa,
class NPa,
class EPb,
class NPb>
203T
distance(
const Line2D<T, EPa, NPa>& iA,
const Line2D<T, EPb, NPb>& iB)
207 typedef typename Line2D<T, EPa, NPa>::TNumTraits TNumTraits;
215 return TNumTraits::zero;
234template <
typename T,
class EPa,
class NPa,
class EPb,
class NPb>
240 typedef typename Line2D<T, EPa, NPa>::TVector TVector;
241 typedef typename Line2D<T, EPa, NPa>::TValue TValue;
242 typedef typename Line2D<T, EPa, NPa>::TNumTraits TNumTraits;
247 const TValue denominator = -perpDot(dirA, dirB);
248 if (denominator == TNumTraits::zero)
264 oTa = -perpDot(difference, dirB) / denominator;
265 oTb = perpDot(dirA, difference) / denominator;
284template <
typename T,
class EPa,
class NPa,
class EPb,
class NPb>
293 oPoint = (iA.
point(tA) + iB.
point(tB)).affine();
305 LASS_ENFORCE_STREAM(ioOStream)
307 <<
"<normal>" << iLine.normal() <<
"</normal>\n"
308 <<
"<d>" << iLine.d() <<
"</d>\n"
321 LASS_ENFORCE_STREAM(ioOStream)
323 <<
"<support>" << iLine.support() <<
"</support>\n"
324 <<
"<direction>" << iLine.direction() <<
"</direction>\n"
337 LASS_ENFORCE_STREAM(ioOStream)
339 <<
"<support>" << iLine.
support() <<
"</support>\n"
340 <<
"<direction>" << iLine.
direction() <<
"</direction>\n"
341 <<
"<normal>" << iLine.normal() <<
"</normal>\n"
342 <<
"<d>" << iLine.d() <<
"</d>\n"
Output stream for writing a selection of geometric primitives to XML files.
const TValue signedDistance(const TPoint &iPoint) const
Return signed distance of point to line.
const TValue squaredDistance(const TPoint &iPoint) const
Return signed distance of point to line.
Side classify(const TPoint &iPoint) const
Return on what side a point is located.
Result intersect(const Line2D< T, EPa, NPa > &iA, const Line2D< T, EPb, NPb > &iB, T &oTa, T &oTb)
intersection of two lines
Result intersect(const Line2D< T, EPa, NPa > &iA, const Line2D< T, EPb, NPb > &iB, Point2D< T > &oPoint)
intersection of two lines
T distance(const Line2D< T, EPa, NPa > &iA, const Line2D< T, EPb, NPb > &iB)
absolute distance between two lines
T distance(const Point2D< T > &iA, const Line2D< T, EP, NP > &iB)
absolute distance between point and line.
const TPoint support() const
return generated support point.
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
const TVector direction() const
return generated direction vector.
T sqr(const T &x)
return x * x
T abs(const T &x)
if x < 0 return -x, else return x.
set of geometrical primitives
Side
Different sides of a surface.
@ sFront
in front of the surface
@ sBack
in back of the surface
@ sSurface
right on the surface
Result
meta information on the result you have from an operation like an intersection ...
@ rInfinite
there are infinite many solutions, output arguments are meaningless
@ rInvalid
0 is an invalid value, nothing is known.
@ rNone
operation has no answer, output arguments are meaningless
@ rOne
there's exactly one answer, 1 output argument contains the answer
Library for Assembled Shared Sources.