2 // ********************************************************************
3 // * This Software is part of the AIDA Unified Solids Library package *
4 // * See: https://aidasoft.web.cern.ch/USolids *
5 // ********************************************************************
9 // --------------------------------------------------------------------
13 // 19.10.12 Marek Gayer
14 // Created from original implementation in Geant4
15 // --------------------------------------------------------------------
18 UVCSGface* UPolyPhiFace::Clone()
20 return new UPolyPhiFace(*this);
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.
28 // Result is only determined within an arbitrary (positive) factor.
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.
36 double UPolyPhiFace::ExactZOrder(double z,
37 double qx, double qy, double qz,
40 const UPolyPhiFaceVertex* vert) const
42 double answer = vert->z - z;
43 if (std::fabs(answer) < VUSolid::Tolerance())
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);
50 answer = normSign * qacb.Dot(v) * (normal.y() * radial.x() - normal.x() * radial.y());