Geant4  10.00.p02
UPolyPhiFace.icc
Go to the documentation of this file.
1 //
2 // ********************************************************************
3 // * This Software is part of the AIDA Unified Solids Library package *
4 // * See: https://aidasoft.web.cern.ch/USolids *
5 // ********************************************************************
6 //
7 // $Id:$
8 //
9 // --------------------------------------------------------------------
10 //
11 // UPolyPhiFace.icc
12 //
13 // 19.10.12 Marek Gayer
14 // Created from original implementation in Geant4
15 // --------------------------------------------------------------------
16 
17 inline
18 UVCSGface* UPolyPhiFace::Clone()
19 {
20  return new UPolyPhiFace(*this);
21 }
22 
23 // ExactZOrder
24 //
25 // Decide precisely whether a trajectory passes to the left, right, or exactly
26 // passes through the z position of a vertex point in our face.
27 //
28 // Result is only determined within an arbitrary (positive) factor.
29 // > 0 to the right
30 // < 0 to the left
31 // = 0 exactly on top of
32 // In 99.9999% of the cases, a trivial calculation is used. In difficult
33 // cases, a precise, compliant calculation is relied on.
34 //
35 inline
36 double UPolyPhiFace::ExactZOrder(double z,
37  double qx, double qy, double qz,
38  const UVector3& v,
39  double normSign,
40  const UPolyPhiFaceVertex* vert) const
41 {
42  double answer = vert->z - z;
43  if (std::fabs(answer) < VUSolid::Tolerance())
44  {
45  UVector3 qa(qx - vert->x + radial.x,
46  qy - vert->y + radial.y, qz - vert->z),
47  qb(qx - vert->x, qy - vert->y, qz - vert->z);
48  UVector3 qacb = qa.Cross(qb);
49 
50  answer = normSign * qacb.Dot(v) * (normal.y * radial.x - normal.x * radial.y);
51  }
52 
53  return answer;
54 }