40 TGeoMatrix* displacementB)
59 VGM::IDisplacedSolid* displacedSolid =
60 dynamic_cast<VGM::IDisplacedSolid*>(constSolidA);
61 TGeoHMatrix displacement(
62 *RootGM::CreateTransform(displacedSolid->Displacement()));
63 matrixA = matrixA * displacement;
64 constSolidA = displacedSolid->ConstituentSolid();
70 VGM::IDisplacedSolid* displacedSolid =
71 dynamic_cast<VGM::IDisplacedSolid*>(constSolidB);
72 TGeoHMatrix displacement(
73 *RootGM::CreateTransform(displacedSolid->Displacement()));
74 matrixB = matrixB * displacement;
75 constSolidB = displacedSolid->ConstituentSolid();
83 TGeoMatrix* newMatrixA = 0;
84 if (!matrixA.IsIdentity()) newMatrixA =
new TGeoHMatrix(matrixA);
86 TGeoMatrix* newMatrixB = displacementB;
87 if (!matrixB.IsIdentity())
88 newMatrixB =
new TGeoHMatrix(TGeoHMatrix(*displacementB) * matrixB);
90 TGeoBoolNode* boolNode = 0;
94 new TGeoIntersection(rootSolidA, rootSolidB, newMatrixA, newMatrixB);
98 new TGeoSubtraction(rootSolidA, rootSolidB, newMatrixA, newMatrixB);
101 boolNode =
new TGeoUnion(rootSolidA, rootSolidB, newMatrixA, newMatrixB);
105 std::cerr <<
" RootGM::BooleanSolid::BooleanSolid: " << std::endl;
106 std::cerr <<
" Unknown Boolean solid type" << std::endl;
107 std::cerr <<
"*** Error: Aborting execution ***" << std::endl;
111 fCompositeShape =
new TGeoCompositeShape(name.data(), boolNode);
216 TGeoBoolNode* boolNode = fCompositeShape->GetBoolNode();
218 TGeoMatrix* matrixA = boolNode->GetLeftMatrix();
219 TGeoMatrix* matrixB = boolNode->GetRightMatrix();
221 TGeoHMatrix transformA(*matrixA);
222 TGeoHMatrix transformB(*matrixB);
228 TGeoHMatrix totalTransformA(transformA);
229 TGeoShape* shapeA = boolNode->GetLeftShape();
234 while (shapeA->IsComposite()) {
236 TGeoBoolNode* boolNodeAC = ((TGeoCompositeShape*)shapeA)->GetBoolNode();
238 TGeoShape* shapeAC = boolNodeAC->GetLeftShape();
241 TGeoMatrix* matrixAC = boolNodeAC->GetLeftMatrix();
242 TGeoHMatrix transformAC(*matrixAC);
244 totalTransformA = totalTransformA * transformAC;
252 TGeoHMatrix totalTransformB(transformB);
253 TGeoShape* shapeB = boolNode->GetRightShape();
257 while (shapeB->IsComposite()) {
259 TGeoBoolNode* boolNodeBC = ((TGeoCompositeShape*)shapeB)->GetBoolNode();
261 TGeoShape* shapeBC = boolNodeBC->GetLeftShape();
264 TGeoMatrix* matrixBC = boolNodeBC->GetLeftMatrix();
265 TGeoHMatrix transformBC(*matrixBC);
267 totalTransformB = totalTransformB * transformBC;
275 return Transform(totalTransformA.Inverse() * totalTransformB);