File indexing completed on 2026-04-09 07:48:53
0001
0002
0003 #include "OPTICKS_LOG.hh"
0004
0005
0006 #include "scuda.h"
0007 #include "SSim.hh"
0008 #include "ssys.h"
0009 #include "spath.h"
0010
0011 #include "CSGFoundry.h"
0012 #include "CSGMaker.h"
0013 #include "CSGSolid.h"
0014 #include "CSGScan.h"
0015
0016
0017 struct CSGScanTest
0018 {
0019 const char* geom ;
0020 const char* scan ;
0021 CSGFoundry* fd ;
0022 const CSGSolid* so ;
0023 CSGScan* sc ;
0024
0025 CSGScanTest();
0026 void init();
0027 int intersect();
0028 };
0029
0030 inline CSGScanTest::CSGScanTest()
0031 :
0032 geom(ssys::getenvvar("GEOM")),
0033 scan(ssys::getenvvar("SCAN","axis,rectangle,circle")),
0034 fd(nullptr),
0035 so(nullptr),
0036 sc(nullptr)
0037 {
0038 init();
0039 };
0040
0041 inline void CSGScanTest::init()
0042 {
0043 SSim::Create();
0044
0045 if(CSGMaker::CanMake(geom))
0046 {
0047 fd = CSGMaker::MakeGeom(geom);
0048 if(ssys::getenvbool("CSGScanTest__init_SAVEFOLD"))
0049 {
0050 fd->save("$CSGScanTest__init_SAVEFOLD");
0051 }
0052 }
0053 else
0054 {
0055 fd = CSGFoundry::Load();
0056 }
0057 fd->upload();
0058 so = fd->getSolid(0);
0059
0060
0061 sc = new CSGScan( fd, so, scan );
0062 }
0063
0064 inline int CSGScanTest::intersect()
0065 {
0066 sc->intersect_h();
0067 sc->intersect_d();
0068 std::cout << sc->brief() ;
0069 sc->save("$FOLD");
0070
0071
0072 return 0 ;
0073 }
0074
0075
0076 int main(int argc, char** argv)
0077 {
0078 OPTICKS_LOG(argc, argv);
0079 CSGScanTest t ;
0080 return t.intersect();
0081 }