41 : aMin(0.), aMax(0.), bMin(0.), bMax(0.)
54 : aMin(0.), aMax(0.), bMin(0.), bMax(0.)
67 for(
G4int i=0; i < n; ++i, ++rOut, ++zOut, --rIn, --zIn )
89 G4Exception(
"G4ReduciblePolygon::Create()",
"GeomSolids0002",
92 const G4double *anext = a, *bnext = b;
97 newVertex->
a = *anext;
98 newVertex->
b = *bnext;
99 newVertex->
next =
nullptr;
106 prev->
next = newVertex;
110 }
while( ++anext, ++bnext < b+n );
121 : aMin(0.), aMax(0.), bMin(0.), bMax(0.)
132 while( curr !=
nullptr )
150 while( curr !=
nullptr )
165 while( curr !=
nullptr )
179 while( curr !=
nullptr )
194 *prev =
nullptr, *next =
nullptr;
195 while( curr !=
nullptr )
200 if (std::fabs(curr->
a-next->a) < tolerance &&
201 std::fabs(curr->
b-next->b) < tolerance )
253 G4double tolerance2 = tolerance*tolerance;
259 while( curr !=
nullptr )
265 db = next->b - curr->
b;
281 if (test==curr)
break;
287 dbt = test->
b - curr->
b;
289 if (std::fabs(dat*db-dbt*da)>tolerance2)
break;
303 if (curr->
next !=
nullptr)
305 if (next->next !=
nullptr)
308 curr->
next =
nullptr;
313 if ((curr != next) && (next != test))
delete next;
345 if (prev==
nullptr)
return;
348 if (curr==
nullptr)
return;
371 if (save ==
nullptr)
break;
397 while( curr !=
nullptr)
403 while( curr1 !=
nullptr )
409 prev->
next =
nullptr;
424 G4double tolerance2 = tolerance*tolerance;
432 while (curr1->
next !=
nullptr)
436 db1 = next1->b-curr1->
b;
442 while( curr2 !=
nullptr )
447 db2 = next2->
b-curr2->
b;
449 b12 = curr2->
b-curr1->
b;
455 if (std::fabs(deter) > tolerance2)
458 s1 = (a12*db2-b12*da2)/deter;
460 if (s1 >= zero && s1 < one)
462 s2 = -(da1*b12-db1*a12)/deter;
463 if (s2 >= zero && s2 < one)
return true;
481 G4int nNeg = 0, nPos = 0;
484 G4double len12 = std::sqrt( a12*a12 + b12*b12 );
485 a12 /= len12; b12 /= len12;
495 if (cross < -tolerance)
497 if (nPos)
return true;
500 else if (cross > tolerance)
502 if (nNeg)
return true;
506 }
while( curr !=
nullptr );
529 answer += curr->
a*next->b - curr->
b*next->a;
531 }
while( curr !=
nullptr );
545 }
while( curr !=
nullptr );
559 while( curr !=
nullptr )
563 else if (curr->
a >
aMax)
568 else if (curr->
b >
bMax)
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *description)
G4GLOB_DLL std::ostream G4cerr
G4ReduciblePolygon(const G4double a[], const G4double b[], G4int n)
G4bool BisectedBy(G4double a1, G4double b1, G4double a2, G4double b2, G4double tolerance)
void Create(const G4double a[], const G4double b[], G4int n)
void ScaleB(G4double scale)
void CopyVertices(G4double a[], G4double b[]) const
virtual ~G4ReduciblePolygon()
G4bool RemoveDuplicateVertices(G4double tolerance)
G4bool RemoveRedundantVertices(G4double tolerance)
G4bool CrossesItself(G4double tolerance)
void ScaleA(G4double scale)