77 location[0] = loc0[0];
78 location[1] = loc0[1];
86 location[0] = loc1[0];
87 location[1] = loc1[1];
91 if ((e0i == 1) && (e1i == 1))
93 if ((loc0[0]-p).mag2() < (loc1[0]-p).mag2())
95 location[0] = loc0[0];
96 location[1] = loc1[0];
100 location[0] = loc1[0];
101 location[1] = loc0[0];
112 location[0] = loc2[0];
113 location[1] = loc2[1];
117 if ((e0i == 0) && (e1i == 0) && (e2i == 0))
return false;
119 if ((e0i == 1) && (e2i == 1))
121 if ((loc0[0]-p).mag2() < (loc2[0]-p).mag2())
123 location[0] = loc0[0];
124 location[1] = loc2[0];
128 location[0] = loc2[0];
129 location[1] = loc0[0];
134 if ((e1i == 1) && (e2i == 1))
136 if ((loc1[0]-p).mag2() < (loc2[0]-p).mag2())
138 location[0] = loc1[0];
139 location[1] = loc2[0];
143 location[0] = loc2[0];
144 location[1] = loc1[0];
196 if (ss < 0)
return 0;
198 if (t < 0 || t > 1)
return 0;
203 location[0] = p0 + ss*d0;
211 sqrKross = kross * kross;
220 G4double s1 = s0 + d0.dot(d1)/sqrLen0;
224 if (s0 < s1) {smin =
s0; smax = s1;}
225 else {smin = s1; smax =
s0;}
227 if (smax < 0.0)
return 0;
231 location[1] = p0 + smax*d0;
236 location[0] = p0 + smin*d0;
237 location[1] = p0 + smax*d0;
253 return v1.x()*v2.y() - v1.y()*v2.x();
static G4double cross(const G4TwoVector &v1, const G4TwoVector &v2)
static G4bool IntersectLineAndTriangle2D(const G4TwoVector &p, const G4TwoVector &v, const G4TwoVector &p0, const G4TwoVector &e0, const G4TwoVector &e1, G4TwoVector location[2])
CLHEP::Hep2Vector G4TwoVector
static G4int IntersectLineAndLineSegment2D(const G4TwoVector &p0, const G4TwoVector &d0, const G4TwoVector &p1, const G4TwoVector &d1, G4TwoVector location[2])