5 #include "GeoModelKernel/GeoPolyhedrizeAction.h" 6 #include "GeoModelKernel/GeoPolyhedron.h" 7 #include "GeoModelKernel/GeoShapeShift.h" 8 #include "GeoModelKernel/GeoShapeIntersection.h" 9 #include "GeoModelKernel/GeoShapeUnion.h" 10 #include "GeoModelKernel/GeoShapeSubtraction.h" 11 #include "GeoModelKernel/GeoBox.h" 12 #include "GeoModelKernel/GeoCons.h" 13 #include "GeoModelKernel/GeoPcon.h" 14 #include "GeoModelKernel/GeoPgon.h" 15 #include "GeoModelKernel/GeoTrap.h" 16 #include "GeoModelKernel/GeoTrd.h" 17 #include "GeoModelKernel/GeoTube.h" 18 #include "GeoModelKernel/GeoTubs.h" 19 #include "GeoModelKernel/GeoPara.h" 21 GeoPolyhedrizeAction::GeoPolyhedrizeAction()
22 : m_polyhedron(nullptr)
27 GeoPolyhedrizeAction::~GeoPolyhedrizeAction()
32 void GeoPolyhedrizeAction::handleShift (
const GeoShapeShift *shift)
34 shift->getOp()->exec(
this);
35 m_polyhedron->Transform (shift->getX().matrix().block<3,3>(0,0), shift->getX().translation());
38 void GeoPolyhedrizeAction::handleUnion (
const GeoShapeUnion *unio)
41 unio->getOpA()->exec(&auxA);
42 unio->getOpB()->exec(&auxB);
43 m_polyhedron =
new GeoPolyhedron(auxA.getPolyhedron()->add(*auxB.getPolyhedron()));
49 isect->getOpA()->exec(&auxA);
50 isect->getOpB()->exec(&auxB);
51 m_polyhedron=
new GeoPolyhedron(auxA.getPolyhedron()->intersect(*auxB.getPolyhedron()));
57 subtract->getOpA()->exec(&auxA);
58 subtract->getOpB()->exec(&auxB);
59 m_polyhedron=
new GeoPolyhedron(auxA.getPolyhedron()->subtract(*auxB.getPolyhedron()));
62 void GeoPolyhedrizeAction::handleBox (
const GeoBox *box)
65 box->getYHalfLength(),
66 box->getZHalfLength());
69 void GeoPolyhedrizeAction::handleCons (
const GeoCons *cons)
80 void GeoPolyhedrizeAction::handlePara (
const GeoPara *para)
83 para->getYHalfLength(),
84 para->getZHalfLength(),
90 void GeoPolyhedrizeAction::handlePcon (
const GeoPcon *pcon)
92 double *z =
new double[pcon->getNPlanes ()];
93 double *rmn =
new double[pcon->getNPlanes ()];
94 double *rmx =
new double[pcon->getNPlanes ()];
96 for (
unsigned int s = 0; s < pcon->getNPlanes (); s++)
98 z[s] = pcon->getZPlane (s);
99 rmn[s] = pcon->getRMinPlane (s);
100 rmx[s] = pcon->getRMaxPlane (s);
102 m_polyhedron =
new GeoPolyhedronPcon (pcon->getSPhi(), pcon->getDPhi(), pcon->getNPlanes (), z, rmn, rmx);
109 void GeoPolyhedrizeAction::handlePgon (
const GeoPgon *pgon)
111 double *z =
new double[pgon->getNPlanes ()];
112 double *rmn =
new double[pgon->getNPlanes ()];
113 double *rmx =
new double[pgon->getNPlanes ()];
115 for (
unsigned int s = 0; s < pgon->getNPlanes (); s++)
117 z[s] = pgon->getZPlane (s);
118 rmn[s] = pgon->getRMinPlane (s);
119 rmx[s] = pgon->getRMaxPlane (s);
121 m_polyhedron =
new GeoPolyhedronPgon (pgon->getSPhi(), pgon->getDPhi(), pgon->getNSides(), pgon->getNPlanes (), z, rmn, rmx);
128 void GeoPolyhedrizeAction::handleTrap (
const GeoTrap *trap)
135 trap->getDxdypdzn(), 0,
138 trap->getDxdypdzp(),0);
141 void GeoPolyhedrizeAction::handleTrd (
const GeoTrd *trd)
144 trd->getXHalfLength2(),
145 trd->getYHalfLength1(),
146 trd->getYHalfLength2(),
147 trd->getZHalfLength());
150 void GeoPolyhedrizeAction::handleTube (
const GeoTube *tube)
154 tube->getZHalfLength());
157 void GeoPolyhedrizeAction::handleTubs (
const GeoTubs *tubs)
161 tubs->getZHalfLength(),
166 const GeoPolyhedron * GeoPolyhedrizeAction::getPolyhedron ()
const
This action polyhedrizes a shape. This includes, for example, boolean shapes. A polhyedral representa...
This shape represents a polycone. Specify the starting angle and delta angle (subtended angle) of the...
This shape represents a very general trapezoid.