226 for (i=0; i<2; i++) {
251 isvalid[0], 0, validate, &gp, &gv);
271 distance[0] = - c /
b;
272 xx[0] = p + distance[0]*
v;
278 if (distance[0] >= 0) isvalid[0] =
true;
283 if (distance[0] >= 0) isvalid[0] =
true;
289 if (distance[0] >= 0) isvalid[0] =
true;
293 areacode[0], isvalid[0],
294 0, validate, &gp, &gv);
300 isvalid[0], 1, validate, &gp, &gv);
312 isvalid[0], 0, validate, &gp, &gv);
324 G4bool tmpisvalid[2] = {
false,
false};
327 for (i=0; i<2; i++) {
333 if ( b * D < 0 && std::fabs(bminusD / D) < protection ) {
335 tmpdist[i] = - c/b * ( 1 - acovbb * (1 + 2*acovbb));
337 tmpdist[i] = factor * bminusD;
341 tmpxx[i] = p + tmpdist[i]*
v;
346 if (tmpdist[i] >= 0) tmpisvalid[i] =
true;
352 if (tmpdist[i] >= 0) tmpisvalid[i] =
true;
357 if (tmpxx[i].
x() > 0) {
359 if (tmpdist[i] >= 0) tmpisvalid[i] =
true;
368 if (tmpdist[0] <= tmpdist[1]) {
369 distance[0] = tmpdist[0];
370 distance[1] = tmpdist[1];
375 areacode[0] = tmpareacode[0];
376 areacode[1] = tmpareacode[1];
377 isvalid[0] = tmpisvalid[0];
378 isvalid[1] = tmpisvalid[1];
380 distance[0] = tmpdist[1];
381 distance[1] = tmpdist[0];
386 areacode[0] = tmpareacode[1];
387 areacode[1] = tmpareacode[0];
388 isvalid[0] = tmpisvalid[1];
389 isvalid[1] = tmpisvalid[0];
393 isvalid[0], 2, validate, &gp, &gv);
395 isvalid[1], 2, validate, &gp, &gv);
399 for (
G4int k=0; k<2; k++) {
400 if (!isvalid[k])
continue;
403 * xx[k].
z() , xx[k].
z());
404 G4double deltaY = (xx[k] - xxonsurface).mag();
411 for (l=0; l<maxcount; l++) {
414 surfacenormal, xx[k]);
415 deltaY = (xx[k] - xxonsurface).mag();
416 if (deltaY > lastdeltaY) {
425 xxonsurface.set(xx[k].
x(),
426 fKappa * std::fabs(xx[k].
x()) * xx[k].
z(),
430 std::ostringstream message;
431 message <<
"Exceeded maxloop count!" <<
G4endl 432 <<
" maxloop count " << maxcount;
433 G4Exception(
"G4TwistTubsFlatSide::DistanceToSurface(p,v)",
445 isvalid[0], 0, validate, &gp, &gv);
void set(double x, double y, double z)
virtual G4ThreeVector GetNormal(const G4ThreeVector &xx, G4bool isGlobal=false)
static const G4double kInfinity
G4double GetDistance(G4int i) const
G4ThreeVector ComputeGlobalPoint(const G4ThreeVector &lp) const
G4int GetAreacode(G4int i) const
G4double DistanceToPlaneWithV(const G4ThreeVector &p, const G4ThreeVector &v, const G4ThreeVector &x0, const G4ThreeVector &n0, G4ThreeVector &xx)
static const G4int sOutside
G4bool IsValid(G4int i) const
void SetCurrentStatus(G4int i, G4ThreeVector &xx, G4double &dist, G4int &areacode, G4bool &isvalid, G4int nxx, EValidate validate, const G4ThreeVector *p, const G4ThreeVector *v=0)
static const G4int sInside
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *comments)
G4bool IsOutside(G4int areacode) const
static const G4double factor
G4ThreeVector GetXX(G4int i) const
G4ThreeVector ComputeLocalPoint(const G4ThreeVector &gp) const
G4ThreeVector ComputeLocalDirection(const G4ThreeVector &gp) const
G4bool IsInside(G4int areacode, G4bool testbitmode=false) const
virtual G4int GetAreaCode(const G4ThreeVector &xx, G4bool withTol=true)
CurrentStatus fCurStatWithV
void ResetfDone(EValidate validate, const G4ThreeVector *p, const G4ThreeVector *v=0)