19 template <
typename Real>
35 template <
typename Real>
54 Real line0Parameter[2], line1Parameter[2];
62 template <
typename Real>
78 Real D0DotPerpD1 =
DotPerp(line0.direction, line1.direction);
79 if (D0DotPerpD1 != (Real)0)
82 result.intersect =
true;
83 result.numIntersections = 1;
89 Real diffNDotPerpD1 =
DotPerp(diff, line1.direction);
90 if (diffNDotPerpD1 != (Real)0)
93 result.intersect =
false;
94 result.numIntersections = 0;
99 result.intersect =
true;
100 result.numIntersections = std::numeric_limits<int>::max();
107 template <
typename Real>
123 Real D0DotPerpD1 =
DotPerp(line0.direction, line1.direction);
124 if (D0DotPerpD1 != (Real)0)
127 result.intersect =
true;
128 result.numIntersections = 1;
129 Real invD0DotPerpD1 = ((Real)1) / D0DotPerpD1;
130 Real diffDotPerpD0 =
DotPerp(diff, line0.direction);
131 Real diffDotPerpD1 =
DotPerp(diff, line1.direction);
132 Real
s0 = diffDotPerpD1*invD0DotPerpD1;
133 Real
s1 = diffDotPerpD0*invD0DotPerpD1;
134 result.line0Parameter[0] =
s0;
135 result.line1Parameter[0] =
s1;
136 result.point = line0.origin + s0 * line0.direction;
142 Real diffNDotPerpD1 =
DotPerp(diff, line1.direction);
143 if (
std::abs(diffNDotPerpD1) != (Real)0)
146 result.intersect =
false;
147 result.numIntersections = 0;
152 result.intersect =
true;
153 result.numIntersections = std::numeric_limits<int>::max();
154 Real maxReal = std::numeric_limits<Real>::max();
155 result.line0Parameter[0] = -maxReal;
156 result.line0Parameter[1] = +maxReal;
157 result.line1Parameter[0] = -maxReal;
158 result.line1Parameter[1] = +maxReal;
gte::BSNumber< UIntegerType > abs(gte::BSNumber< UIntegerType > const &number)
GLuint GLfloat GLfloat GLfloat GLfloat GLfloat GLfloat s0
Real DotPerp(Vector2< Real > const &v0, Vector2< Real > const &v1)
Real Normalize(GVector< Real > &v, bool robust=false)
GLuint GLfloat GLfloat GLfloat GLfloat GLfloat GLfloat GLfloat GLfloat s1
Result operator()(Type0 const &primitive0, Type1 const &primitive1)