Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-04-09 07:48:52

0001 /**
0002 CSGFoundry_IntersectPrimTest.cc
0003 ================================
0004 
0005 1. create small CSGFoundry configured via GEOM using CSGMaker
0006 2. pick a prim (maybe using MOI) 
0007 
0008 TODO : 3. intersect_prim on CPU with test rays
0009 TODO : 4. save intersects
0010 
0011 * decided to revive CSGScan initially 
0012 
0013 
0014 HMM : maybe for small geometry tests could instead of operating at 
0015 CSGNode level with CSGMaker
0016 could operate at stree level and do similar to CSGFoundry_CreateFromSimTest.cc ? 
0017 
0018 **/
0019 
0020 #include "ssys.h"
0021 #include "SSim.hh"
0022 #include "CSGFoundry.h"
0023 #include "CSGMaker.h"
0024 #include "OPTICKS_LOG.hh"
0025 
0026 
0027 struct CSGFoundry_IntersectPrimTest
0028 {  
0029     const char* geom ; 
0030     bool   can_make ; 
0031     SSim*      sim ; 
0032     CSGFoundry* fd ; 
0033     CSGSolid*   so ; 
0034  
0035     CSGFoundry_IntersectPrimTest();
0036     void init(); 
0037 }; 
0038 
0039 inline CSGFoundry_IntersectPrimTest::CSGFoundry_IntersectPrimTest()
0040     :
0041     geom(ssys::getenvvar("GEOM", "JustOrb" )),
0042     can_make(CSGMaker::CanMake(geom)),
0043     sim(SSim::Create()),
0044     fd(new CSGFoundry), 
0045     so(nullptr)
0046 {
0047     init(); 
0048 }
0049 
0050 inline void CSGFoundry_IntersectPrimTest::init()
0051 {
0052     if(!can_make) std::cerr << "FATAL : cannot make [" << geom << "]\n" ; 
0053     if(!can_make) return ; 
0054 
0055     so = fd->maker->make(geom); 
0056 
0057     fd->setGeom(geom);  
0058     fd->addTranPlaceholder();  
0059     fd->addInstancePlaceholder(); 
0060 
0061     // avoid tripping some checks 
0062     fd->addMeshName(geom);   
0063     fd->addSolidMMLabel(geom);  
0064     fd->setMeta<std::string>("source", "CSGFoundry_IntersectPrimTest::init" ); 
0065 }
0066 
0067 int main(int argc, char** argv)
0068 {
0069     OPTICKS_LOG(argc, argv); 
0070 
0071     CSGFoundry_IntersectPrimTest t ; 
0072     if(!t.can_make) return 0 ; 
0073 
0074     std::cout << t.fd->desc() << std::endl ; 
0075 
0076     return 0 ; 
0077 }
0078 
0079