Changeset 1315 for trunk/source/geometry/solids/Boolean/src
- Timestamp:
- Jun 18, 2010, 11:42:07 AM (15 years ago)
- Location:
- trunk/source/geometry/solids/Boolean/src
- Files:
-
- 4 edited
-
G4BooleanSolid.cc (modified) (3 diffs)
-
G4IntersectionSolid.cc (modified) (3 diffs)
-
G4SubtractionSolid.cc (modified) (3 diffs)
-
G4UnionSolid.cc (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/source/geometry/solids/Boolean/src/G4BooleanSolid.cc
r1228 r1315 25 25 // 26 26 // 27 // $Id: G4BooleanSolid.cc,v 1.2 1 2006/10/19 15:34:49gcosmo Exp $28 // GEANT4 tag $Name: geant4-09-0 3$27 // $Id: G4BooleanSolid.cc,v 1.23 2010/05/11 15:03:45 gcosmo Exp $ 28 // GEANT4 tag $Name: geant4-09-04-beta-cand-01 $ 29 29 // 30 30 // Implementation for the abstract base class for solids created by boolean … … 40 40 #include "G4VSolid.hh" 41 41 #include "G4Polyhedron.hh" 42 #include "HepPolyhedronProcessor.h" 42 43 #include "Randomize.hh" 43 44 … … 231 232 return fpPolyhedron; 232 233 } 234 235 ////////////////////////////////////////////////////////////////////////// 236 // 237 // Stacks polyhedra for processing. Returns top polyhedron. 238 239 G4Polyhedron* 240 G4BooleanSolid::StackPolyhedron(HepPolyhedronProcessor& processor, 241 const G4VSolid* solid) const 242 { 243 HepPolyhedronProcessor::Operation operation; 244 const G4String& type = solid->GetEntityType(); 245 if (type == "G4UnionSolid") 246 { operation = HepPolyhedronProcessor::UNION; } 247 else if (type == "G4IntersectionSolid") 248 { operation = HepPolyhedronProcessor::INTERSECTION; } 249 else if (type == "G4SubtractionSolid") 250 { operation = HepPolyhedronProcessor::SUBTRACTION; } 251 else 252 { 253 std::ostringstream oss; 254 oss << "Solid - " << solid->GetName() 255 << " - Unrecognised composite solid" 256 << "\n Returning NULL !"; 257 G4Exception("StackPolyhedron()", "InvalidSetup", 258 JustWarning, oss.str().c_str()); 259 return 0; 260 } 261 262 G4Polyhedron* top = 0; 263 const G4VSolid* solidA = solid->GetConstituentSolid(0); 264 const G4VSolid* solidB = solid->GetConstituentSolid(1); 265 266 if (solidA->GetConstituentSolid(0)) 267 { 268 top = StackPolyhedron(processor, solidA); 269 } 270 else 271 { 272 top = solidA->GetPolyhedron(); 273 } 274 G4Polyhedron* operand = solidB->GetPolyhedron(); 275 processor.push_back (operation, *operand); 276 277 return top; 278 } -
trunk/source/geometry/solids/Boolean/src/G4IntersectionSolid.cc
r1228 r1315 25 25 // 26 26 // 27 // $Id: G4IntersectionSolid.cc,v 1.3 0 2006/11/08 09:37:41gcosmo Exp $28 // GEANT4 tag $Name: geant4-09-0 3$27 // $Id: G4IntersectionSolid.cc,v 1.32 2010/05/11 15:03:45 gcosmo Exp $ 28 // GEANT4 tag $Name: geant4-09-04-beta-cand-01 $ 29 29 // 30 30 // Implementation of methods for the class G4IntersectionSolid … … 50 50 #include "G4VGraphicsScene.hh" 51 51 #include "G4Polyhedron.hh" 52 #include "HepPolyhedronProcessor.h" 52 53 #include "G4NURBS.hh" 53 54 // #include "G4NURBSbox.hh" … … 502 503 G4IntersectionSolid::CreatePolyhedron () const 503 504 { 504 G4Polyhedron* pA = fPtrSolidA->GetPolyhedron(); 505 G4Polyhedron* pB = fPtrSolidB->GetPolyhedron(); 506 if (pA && pB) 507 { 508 G4Polyhedron* resultant = new G4Polyhedron (pA->intersect(*pB)); 509 return resultant; 510 } 511 else 512 { 513 std::ostringstream oss; 514 oss << "Solid - " << GetName() 515 << " - one of the Boolean components has no" << G4endl 516 << " corresponding polyhedron. Returning NULL !"; 517 G4Exception("G4IntersectionSolid::CreatePolyhedron()", "InvalidSetup", 518 JustWarning, oss.str().c_str()); 519 return 0; 520 } 505 HepPolyhedronProcessor processor; 506 // Stack components and components of components recursively 507 // See G4BooleanSolid::StackPolyhedron 508 G4Polyhedron* top = StackPolyhedron(processor, this); 509 G4Polyhedron* result = new G4Polyhedron(*top); 510 if (processor.execute(*result)) { return result; } 511 else { return 0; } 521 512 } 522 513 -
trunk/source/geometry/solids/Boolean/src/G4SubtractionSolid.cc
r1228 r1315 25 25 // 26 26 // 27 // $Id: G4SubtractionSolid.cc,v 1.3 1 2007/10/23 14:42:31 grichineExp $28 // GEANT4 tag $Name: geant4-09-0 3$27 // $Id: G4SubtractionSolid.cc,v 1.33 2010/05/11 15:03:45 gcosmo Exp $ 28 // GEANT4 tag $Name: geant4-09-04-beta-cand-01 $ 29 29 // 30 30 // Implementation of methods for the class G4IntersectionSolid … … 48 48 #include "G4VGraphicsScene.hh" 49 49 #include "G4Polyhedron.hh" 50 #include "HepPolyhedronProcessor.h" 50 51 #include "G4NURBS.hh" 51 52 // #include "G4NURBSbox.hh" … … 463 464 G4SubtractionSolid::CreatePolyhedron () const 464 465 { 465 G4Polyhedron* pA = fPtrSolidA->GetPolyhedron(); 466 G4Polyhedron* pB = fPtrSolidB->GetPolyhedron(); 467 if (pA && pB) 468 { 469 G4Polyhedron* resultant = new G4Polyhedron (pA->subtract(*pB)); 470 return resultant; 471 } 472 else 473 { 474 std::ostringstream oss; 475 oss << "Solid - " << GetName() 476 << " - one of the Boolean components has no" << G4endl 477 << " corresponding polyhedron. Returning NULL !"; 478 G4Exception("G4SubtractionSolid::CreatePolyhedron()", "InvalidSetup", 479 JustWarning, oss.str().c_str()); 480 return 0; 481 } 466 HepPolyhedronProcessor processor; 467 // Stack components and components of components recursively 468 // See G4BooleanSolid::StackPolyhedron 469 G4Polyhedron* top = StackPolyhedron(processor, this); 470 G4Polyhedron* result = new G4Polyhedron(*top); 471 if (processor.execute(*result)) { return result; } 472 else { return 0; } 482 473 } 483 474 -
trunk/source/geometry/solids/Boolean/src/G4UnionSolid.cc
r1228 r1315 25 25 // 26 26 // 27 // $Id: G4UnionSolid.cc,v 1.3 5 2007/10/23 14:42:31 grichineExp $28 // GEANT4 tag $Name: geant4-09-0 3$27 // $Id: G4UnionSolid.cc,v 1.37 2010/05/11 15:03:45 gcosmo Exp $ 28 // GEANT4 tag $Name: geant4-09-04-beta-cand-01 $ 29 29 // 30 30 // Implementation of methods for the class G4IntersectionSolid … … 49 49 #include "G4VGraphicsScene.hh" 50 50 #include "G4Polyhedron.hh" 51 #include "HepPolyhedronProcessor.h" 51 52 #include "G4NURBS.hh" 52 53 // #include "G4NURBSbox.hh" … … 454 455 G4UnionSolid::CreatePolyhedron () const 455 456 { 456 G4Polyhedron* pA = fPtrSolidA->GetPolyhedron(); 457 G4Polyhedron* pB = fPtrSolidB->GetPolyhedron(); 458 if (pA && pB) { 459 G4Polyhedron* resultant = new G4Polyhedron (pA->add(*pB)); 460 return resultant; 461 } else { 462 std::ostringstream oss; 463 oss << GetName() << 464 ": one of the Boolean components has no corresponding polyhedron."; 465 G4Exception("G4UnionSolid::CreatePolyhedron", 466 "", JustWarning, oss.str().c_str()); 467 return 0; 468 } 457 HepPolyhedronProcessor processor; 458 // Stack components and components of components recursively 459 // See G4BooleanSolid::StackPolyhedron 460 G4Polyhedron* top = StackPolyhedron(processor, this); 461 G4Polyhedron* result = new G4Polyhedron(*top); 462 if (processor.execute(*result)) { return result; } 463 else { return 0; } 469 464 } 470 465
Note:
See TracChangeset
for help on using the changeset viewer.
