43#ifndef LASS_GUARDIAN_OF_INCLUSION_PRIM_IMPL_INTERSECT_EDGE_2D_H
44#define LASS_GUARDIAN_OF_INCLUSION_PRIM_IMPL_INTERSECT_EDGE_2D_H
57template <
typename Po
int,
typename Vector,
typename T>
inline
58bool intersectEdge2D(
const Point& iSupport,
const Vector& iDirection,
59 const Point& iTail,
const Point& iHead,
60 T& oTNear,
const T& iMinT)
62 typedef typename Point::TNumTraits TNumTraits;
63 typedef num::Consistent<T> TConsistent;
65 LASS_ASSERT(oTNear > iMinT);
67 const Vector edge = iHead - iTail;
68 const T denominator = perpDot(iDirection, -edge);
69 if (denominator != TNumTraits::zero)
71 const Vector difference = iTail - iSupport;
72 const TConsistent tRay = perpDot(difference, -edge) / denominator;
73 const T tEdge = perpDot(iDirection, difference) / denominator;
74 if ((tRay > iMinT && tRay < oTNear) &&
75 (tEdge >= TNumTraits::zero && tEdge <= TNumTraits::one))
77 oTNear = tRay.value();
78 LASS_ASSERT(oTNear > iMinT);
implementation details of lass::prim
set of geometrical primitives
Library for Assembled Shared Sources.