Import Geant4 11.2.0.beta source tree
This commit is contained in:
@@ -75,7 +75,7 @@ G4double G4GeomTools::QuadArea(const G4TwoVector& A,
|
||||
|
||||
G4double G4GeomTools::PolygonArea(const G4TwoVectorList& p)
|
||||
{
|
||||
G4int n = (G4int)p.size();
|
||||
auto n = (G4int)p.size();
|
||||
if (n < 3) return 0.0; // degenerate polygon
|
||||
G4double area = p[n-1].x()*p[0].y() - p[0].x()*p[n-1].y();
|
||||
for(G4int i=1; i<n; ++i)
|
||||
@@ -145,14 +145,14 @@ G4bool G4GeomTools::PointInTriangle(const G4TwoVector& A,
|
||||
G4bool G4GeomTools::PointInPolygon(const G4TwoVector& p,
|
||||
const G4TwoVectorList& v)
|
||||
{
|
||||
G4int Nv = (G4int)v.size();
|
||||
auto Nv = (G4int)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());
|
||||
in ^= static_cast<int>(p.x() < (p.y()-v[i].y())*ctg + v[i].x());
|
||||
}
|
||||
}
|
||||
return in;
|
||||
@@ -169,7 +169,7 @@ G4bool G4GeomTools::IsConvex(const G4TwoVectorList& polygon)
|
||||
|
||||
G4bool gotNegative = false;
|
||||
G4bool gotPositive = false;
|
||||
G4int n = (G4int)polygon.size();
|
||||
auto n = (G4int)polygon.size();
|
||||
if (n <= 0) return false;
|
||||
for (G4int icur=0; icur<n; ++icur)
|
||||
{
|
||||
@@ -197,7 +197,7 @@ G4bool G4GeomTools::TriangulatePolygon(const G4TwoVectorList& polygon,
|
||||
std::vector<G4int> triangles;
|
||||
G4bool reply = TriangulatePolygon(polygon,triangles);
|
||||
|
||||
G4int n = (G4int)triangles.size();
|
||||
auto n = (G4int)triangles.size();
|
||||
for (G4int i=0; i<n; ++i) result.push_back(polygon[triangles[i]]);
|
||||
return reply;
|
||||
}
|
||||
@@ -213,13 +213,13 @@ G4bool G4GeomTools::TriangulatePolygon(const G4TwoVectorList& polygon,
|
||||
|
||||
// allocate and initialize list of Vertices in polygon
|
||||
//
|
||||
G4int n = (G4int)polygon.size();
|
||||
auto n = (G4int)polygon.size();
|
||||
if (n < 3) return false;
|
||||
|
||||
// we want a counter-clockwise polygon in V
|
||||
//
|
||||
G4double area = G4GeomTools::PolygonArea(polygon);
|
||||
G4int* V = new G4int[n];
|
||||
auto V = new G4int[n];
|
||||
if (area > 0.)
|
||||
for (G4int i=0; i<n; ++i) V[i] = i;
|
||||
else
|
||||
@@ -312,7 +312,7 @@ void G4GeomTools::RemoveRedundantVertices(G4TwoVectorList& polygon,
|
||||
// set special value to mark vertices for removal
|
||||
G4double removeIt = kInfinity;
|
||||
|
||||
G4int nv = (G4int)polygon.size();
|
||||
auto nv = (G4int)polygon.size();
|
||||
|
||||
// Main loop: check every three consecutive points, if the points
|
||||
// are collinear then mark middle point for removal
|
||||
@@ -620,8 +620,8 @@ G4ThreeVector G4GeomTools::QuadAreaNormal(const G4ThreeVector& A,
|
||||
|
||||
G4ThreeVector G4GeomTools::PolygonAreaNormal(const G4ThreeVectorList& p)
|
||||
{
|
||||
G4int n = (G4int)p.size();
|
||||
if (n < 3) return G4ThreeVector(0,0,0); // degerate polygon
|
||||
auto n = (G4int)p.size();
|
||||
if (n < 3) return {0,0,0}; // degerate polygon
|
||||
G4ThreeVector normal = p[n-1].cross(p[0]);
|
||||
for(G4int i=1; i<n; ++i)
|
||||
{
|
||||
@@ -778,7 +778,7 @@ G4GeomTools::ClosestPointOnTriangle(const G4ThreeVector& P,
|
||||
return (tmp1 <= 0) ? B : (( d >= 0) ? A : A + (-d/a)*edge0);
|
||||
}
|
||||
default: // impossible case
|
||||
return G4ThreeVector(kInfinity,kInfinity,kInfinity);
|
||||
return {kInfinity,kInfinity,kInfinity};
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user