Import Geant4 10.4.0 source tree

This commit is contained in:
Gabriele Cosmo
2017-12-08 12:52:30 +01:00
parent 98e455a940
commit fc6af9e721
2166 changed files with 276760 additions and 100873 deletions
@@ -144,6 +144,26 @@ G4bool G4GeomTools::PointInTriangle(const G4TwoVector& A,
return true;
}
///////////////////////////////////////////////////////////////////////
//
// Point inside 2D polygon
G4bool G4GeomTools::PointInPolygon(const G4TwoVector& p,
const G4TwoVectorList& v)
{
G4int Nv = v.size();
G4bool in = false;
for (G4int i = 0, k = Nv - 1; i < Nv; k = i++)
{
if ((v[i].y() > p.y()) != (v[k].y() > p.y()))
{
G4double ctg = (v[k].x()-v[i].x())/(v[k].y()-v[i].y());
in ^= (p.x() < (p.y()-v[i].y())*ctg + v[i].x());
}
}
return in;
}
///////////////////////////////////////////////////////////////////////
//
// Detemine whether 2D polygon is convex or not