185 if (sh1->typeID() != sh2->typeID())
188 if (sh1->type() ==
"Pgon") {
189 const GeoPgon* pgon1 =
static_cast<const GeoPgon*
>(sh1);
190 const GeoPgon* pgon2 =
static_cast<const GeoPgon*
>(sh2);
191 if (!pgon1 || !pgon2)
194 if (pgon1->getNPlanes() != pgon2->getNPlanes())
196 if (pgon1->getNSides() != pgon2->getNSides())
198 if (std::abs(pgon1->getSPhi() - pgon2->getSPhi()) > tol)
200 if (std::abs(pgon1->getDPhi() - pgon2->getDPhi()) > tol)
205 }
else if (sh1->type() ==
"Trd") {
206 const GeoTrd* trd1 =
static_cast<const GeoTrd*
>(sh1);
207 const GeoTrd* trd2 =
static_cast<const GeoTrd*
>(sh2);
209 if (std::abs(trd1->getXHalfLength1() - trd2->getXHalfLength1()) > tol)
211 if (std::abs(trd1->getXHalfLength2() - trd2->getXHalfLength2()) > tol)
213 if (std::abs(trd1->getYHalfLength1() - trd2->getYHalfLength1()) > tol)
215 if (std::abs(trd1->getYHalfLength2() - trd2->getYHalfLength2()) > tol)
217 if (std::abs(trd1->getZHalfLength() - trd2->getZHalfLength()) > tol)
222 }
else if (sh1->type() ==
"Box") {
223 const GeoBox* box1 =
static_cast<const GeoBox*
>(sh1);
224 const GeoBox* box2 =
static_cast<const GeoBox*
>(sh2);
226 if (std::abs(box1->getXHalfLength() - box2->getXHalfLength()) > tol)
228 if (std::abs(box1->getYHalfLength() - box2->getYHalfLength()) > tol)
230 if (std::abs(box1->getZHalfLength() - box2->getZHalfLength()) > tol)
235 }
else if (sh1->type() ==
"Tube") {
236 const GeoTube* tube1 =
static_cast<const GeoTube*
>(sh1);
237 const GeoTube* tube2 =
static_cast<const GeoTube*
>(sh2);
239 if (std::abs(tube1->getRMin() - tube2->getRMin()) > tol)
241 if (std::abs(tube1->getRMax() - tube2->getRMax()) > tol)
243 if (std::abs(tube1->getZHalfLength() - tube2->getZHalfLength()) > tol)
248 }
else if (sh1->type() ==
"Tubs") {
249 const GeoTubs* tubs1 =
static_cast<const GeoTubs*
>(sh1);
250 const GeoTubs* tubs2 =
static_cast<const GeoTubs*
>(sh2);
252 if (std::abs(tubs1->getRMin() - tubs2->getRMin()) > tol)
254 if (std::abs(tubs1->getRMax() - tubs2->getRMax()) > tol)
256 if (std::abs(tubs1->getZHalfLength() - tubs2->getZHalfLength()) > tol)
258 if (std::abs(tubs1->getSPhi() - tubs2->getSPhi()) > tol)
260 if (std::abs(tubs1->getDPhi() - tubs2->getDPhi()) > tol)
265 }
else if (sh1->type() ==
"Cons") {
266 const GeoCons* cons1 =
static_cast<const GeoCons*
>(sh1);
267 const GeoCons* cons2 =
static_cast<const GeoCons*
>(sh2);
269 if (std::abs(cons1->getRMin1() - cons2->getRMin1()) > tol)
271 if (std::abs(cons1->getRMin2() - cons2->getRMin2()) > tol)
273 if (std::abs(cons1->getRMax1() - cons2->getRMax1()) > tol)
275 if (std::abs(cons1->getRMax2() - cons2->getRMax2()) > tol)
277 if (std::abs(cons1->getDZ() - cons2->getDZ()) > tol)
279 if (std::abs(cons1->getSPhi() - cons2->getSPhi()) > tol)
281 if (std::abs(cons1->getDPhi() - cons2->getDPhi()) > tol)
286 }
else if (sh1->type() ==
"SimplePolygonBrep") {
287 const GeoSimplePolygonBrep* spb1 =
288 static_cast<const GeoSimplePolygonBrep*
>(sh1);
289 const GeoSimplePolygonBrep* spb2 =
290 static_cast<const GeoSimplePolygonBrep*
>(sh2);
294 unsigned int nv1 = spb1->getNVertices();
295 unsigned int nv2 = spb2->getNVertices();
298 if (std::abs(spb1->getDZ() - spb2->getDZ()) > tol)
301 for (
unsigned int iv = 0; iv < nv1; iv++) {
303 if (std::abs(spb1->getXVertex(iv) - spb2->getXVertex(iv)) > tol)
305 if (std::abs(spb1->getYVertex(iv) - spb2->getYVertex(iv)) > tol)
311 }
else if (sh1->type() ==
"Pcon") {
312 const GeoPcon* pc1 =
static_cast<const GeoPcon*
>(sh1);
313 const GeoPcon* pc2 =
static_cast<const GeoPcon*
>(sh2);
317 if (std::abs(pc1->getSPhi() - pc2->getSPhi()) > tol)
319 if (std::abs(pc1->getDPhi() - pc2->getDPhi()) > tol)
322 unsigned int nv1 = pc1->getNPlanes();
323 unsigned int nv2 = pc2->getNPlanes();
327 for (
unsigned int iv = 0; iv < nv1; iv++) {
329 if (std::abs(pc1->getZPlane(iv) - pc2->getZPlane(iv)) > tol)
331 if (std::abs(pc1->getRMinPlane(iv) - pc2->getRMinPlane(iv)) > tol)
333 if (std::abs(pc1->getRMaxPlane(iv) - pc2->getRMaxPlane(iv)) > tol)
339 }
else if (sh1->type() ==
"Subtraction") {
340 const GeoShapeSubtraction* sub1 =
341 static_cast<const GeoShapeSubtraction*
>(sh1);
342 const GeoShapeSubtraction* sub2 =
343 static_cast<const GeoShapeSubtraction*
>(sh2);
355 }
else if (sh1->type() ==
"Union") {
356 const GeoShapeUnion* sub1 =
static_cast<const GeoShapeUnion*
>(sh1);
357 const GeoShapeUnion* sub2 =
static_cast<const GeoShapeUnion*
>(sh2);
369 }
else if (sh1->type() ==
"Shift") {
370 const GeoShapeShift* shift1 =
static_cast<const GeoShapeShift*
>(sh1);
371 const GeoShapeShift* shift2 =
static_cast<const GeoShapeShift*
>(sh2);
373 if (!shift1 || !shift2)
382 if ((transf1.translation() - transf2.translation()).
norm() > tol)
386 if (!
identity_check(transf1.rotation() * transf2.rotation().transpose(),
393 std::cout <<
"unknown shape to compare:" << sh1->type() << std::endl;