5 #include "GeoModelKernel/GeoPgon.h" 6 #include "GeoModelKernel/GeoShapeAction.h" 10 const std::string GeoPgon::s_classType =
"Pgon";
11 const ShapeType GeoPgon::s_classTypeID = 0x14;
13 GeoPgon::GeoPgon (
double SPhi,
double DPhi,
unsigned int NSides)
24 double GeoPgon::volume ()
const 27 throw std::runtime_error (
"Volume requested for incomplete polygon");
29 int sides = getNSides ();
30 double alpha = m_dPhi/sides;
31 double sinAlpha = sin(alpha);
33 for (
size_t s = 0; s < getNPlanes () - 1; s++) {
34 double z2 = getZPlane (s);;
35 double z1 = getZPlane (s + 1);;
36 double fRmin1 = getRMinPlane (s + 1);
37 double fRmin2 = getRMinPlane (s);
38 double fRmax1 = getRMaxPlane (s + 1);
39 double fRmax2 = getRMaxPlane (s);
41 double b1 = (fRmax1 - fRmax2)/(z1 - z2);
42 double b2 = (fRmin1 - fRmin2)/(z1 - z2);
44 double a1 = fRmax2 - b1 * z2;
45 double a2 = fRmin2 - b2 * z2;
49 v += fabs(z1 - z2) * ((a1 - a2) * (a1 + a2) +
50 (a1*b1 - a2*b2) * (z1 + z2) +
51 (b1 - b2) * (b1 + b2) * (z1*z1+z2*z2+z1*z2)*(1./3));
53 v *= 0.5 * sides * sinAlpha;
57 const std::string & GeoPgon::type ()
const 62 ShapeType GeoPgon::typeID ()
const 67 void GeoPgon::addPlane (
double ZPlane,
double RMinPlane,
double RMaxPlane)
69 m_zPlane.push_back (ZPlane);
70 m_rMinPlane.push_back (RMinPlane);
71 m_rMaxPlane.push_back (RMaxPlane);
76 action->handlePgon(
this);
This class is a visitor for shapes. It allows a navigation of the boolean expression tree for shapes...