File indexing completed on 2026-04-09 07:48:57
0001 #pragma once
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014 struct CSGNode ;
0015 struct CSGSolid ;
0016
0017 #include <string>
0018 #include <vector>
0019 #include "CSG_API_EXPORT.hh"
0020 #include "plog/Severity.h"
0021
0022 struct CSGFoundry ;
0023
0024 struct CSG_API CSGMaker
0025 {
0026 static const plog::Severity LEVEL ;
0027
0028 static const char* NAMES ;
0029 static bool StartsWith( const char* n, const char* q );
0030 static bool CanMake( const char* q );
0031 static void GetNames(std::vector<std::string>& names );
0032
0033 static float4 TriPlane( const std::vector<float3>& v, unsigned i, unsigned j, unsigned k );
0034
0035
0036
0037
0038 enum {
0039 SPHE_MIDX, ZSPH_MIDX, CONE_MIDX, HYPE_MIDX, BOX3_MIDX,
0040 PLAN_MIDX, SLAB_MIDX, CYLI_MIDX, DISC_MIDX, VCUB_MIDX,
0041 VTET_MIDX, ELLI_MIDX, UBSP_MIDX, IBSP_MIDX, DBSP_MIDX,
0042 RCYL_MIDX, ICYL_MIDX, IPHI_MIDX, ITHE_MIDX, ITHL_MIDX,
0043 OCYL_MIDX
0044 };
0045
0046 CSGFoundry* fd ;
0047
0048 CSGMaker( CSGFoundry* fd );
0049
0050 void makeDemoGrid();
0051 void makeDemoSolids() ;
0052
0053 CSGSolid* make(const char* name);
0054
0055 CSGSolid* makeLayered( const char* label, float outer_radius, unsigned layers ) ;
0056 CSGSolid* makeBoxedSphere(const char* label);
0057 CSGSolid* makeScaled(const char* label, const char* demo_node_type, float outer_scale, unsigned layers );
0058 CSGSolid* makeClustered(const char* name, int i0, int i1, int is, int j0, int j1, int js, int k0, int k1, int ks, double unit, bool inbox ) ;
0059
0060 CSGSolid* makeSolid11(const char* label, CSGNode nd, const std::vector<float4>* pl=nullptr, int meshIdx=-1, const Tran<double>* tr=nullptr );
0061 CSGSolid* makeBooleanBoxSphere( const char* label, unsigned op, float radius, float fullside, int meshIdx = -1 ) ;
0062 CSGSolid* makeBooleanTriplet( const char* label, unsigned op, const CSGNode& left, const CSGNode& right, int meshIdx=-1 ) ;
0063
0064 CSGSolid* makeOverlapList( const char* label, std::vector<CSGNode>& leaves, const std::vector<const Tran<double>*>* trans );
0065 CSGSolid* makeContiguousList( const char* label, std::vector<CSGNode>& leaves, const std::vector<const Tran<double>*>* trans );
0066 CSGSolid* makeDiscontiguousList( const char* label, std::vector<CSGNode>& leaves, const std::vector<const Tran<double>*>* trans );
0067 CSGSolid* makeList( const char* label, unsigned type, std::vector<CSGNode>& leaves, const std::vector<const Tran<double>*>* trans );
0068
0069
0070 CSGSolid* makeBooleanSeptuplet(
0071 const char* label,
0072 const CSGNode& top,
0073 const CSGNode& l,
0074 const CSGNode& r,
0075 const CSGNode& ll,
0076 const CSGNode& lr,
0077 const CSGNode& rl,
0078 const CSGNode& rr,
0079 const int meshIdx
0080 );
0081
0082 CSGSolid* makeDifferenceCylinder( const char* label="dcyl", float rmax=100.f, float rmin=50.f, float z1=-50.f, float z2=50.f, float z_inner_factor=1.01f );
0083 CSGSolid* makeBoxSubSubCylinder( const char* label="bssc", float fullside=300.f, float rmax=100.f, float rmin=50.f, float z1=-50.f, float z2=50.f, float z_inner_factor=1.01 );
0084
0085 CSGSolid* makeUnionBoxSphere( const char* label="ubsp", float radius=100.f, float fullside=150.f );
0086 CSGSolid* makeUnionListBoxSphere( const char* label="UnionListBoxSphere", float radius=100.f, float fullside=150.f );
0087 CSGSolid* makeIntersectionBoxSphere( const char* label="ibsp", float radius=100.f, float fullside=150.f );
0088 CSGSolid* makeOverlapBoxSphere( const char* label="obsp", float radius=100.f, float fullside=150.f );
0089
0090
0091
0092 CSGSolid* makeUnionLLBoxSphere( const char* label="UnionLLBoxSphere", float radius=100.f, float fullside=100.f );
0093 CSGSolid* makeListTwoBoxTwoSphere( const char* label="ListTwoBoxTwoSphere", float radius=100.f, float fullside=100.f );
0094
0095
0096 CSGSolid* makeBooleanListList( const char* label,
0097 unsigned op,
0098 unsigned ltype,
0099 unsigned rtype,
0100 std::vector<CSGNode>& lhs,
0101 std::vector<CSGNode>& rhs,
0102 const std::vector<const Tran<double>*>* ltran,
0103 const std::vector<const Tran<double>*>* rtran
0104 );
0105
0106
0107 CSGSolid* makeListThreeSphere( const char* label, unsigned type, float radius, float side );
0108 CSGSolid* makeOverlapThreeSphere( const char* label, float radius=100.f, float side=50.f );
0109 CSGSolid* makeContiguousThreeSphere( const char* label, float radius=100.f, float side=50.f );
0110 CSGSolid* makeDiscontiguousThreeSphere( const char* label, float radius=100.f, float side=100.f );
0111
0112
0113 CSGSolid* makeListTwoSphere( const char* label, unsigned type, float radius, float side );
0114 CSGSolid* makeDiscontiguousTwoSphere( const char* label, float radius=100.f, float side=100.f );
0115
0116
0117 CSGSolid* makeContiguousBoxSphere( const char* label="cbsp", float radius=100.f, float fullside=150.f );
0118 CSGSolid* makeDiscontiguousBoxSphere( const char* label="DiscontiguousBoxSphere", float radius=100.f, float fullside=150.f ) ;
0119
0120 CSGSolid* makeDifferenceBoxSphere( const char* label="dbsp", float radius=100.f, float fullside=150.f );
0121
0122 CSGSolid* makeSphere( const char* label="sphe", float r=100.f );
0123 CSGSolid* makeEllipsoid( const char* label="elli", float rx=100.f, float ry=100.f, float rz=50.f );
0124
0125 CSGSolid* makeRotatedCylinder(const char* label="rcyl", float px=0.f, float py=0.f, float radius=100.f, float z1=-50.f, float z2=50.f, float ax=1.f, float ay=0.f, float az=0.f, float angle_deg=45.f );
0126
0127 CSGSolid* makeInfCylinder(const char* label="icyl", float radius=50.f, float hz=25.f );
0128 CSGSolid* makeInfPhiCut( const char* label="iphi", float startPhi_pi=0.25f, float deltaPhi_pi=0.1f );
0129 CSGSolid* makeInfThetaCut( const char* label="ithe", float startTheta_pi=0.25f, float deltaTheta_pi=0.1f );
0130 CSGSolid* makeInfThetaCutL( const char* label="ithl", float startTheta_pi=0.25f, float deltaTheta_pi=0.1f );
0131
0132
0133 CSGSolid* makeZSphere( const char* label="zsph", float r=100.f, float z1=-50.f , float z2=50.f );
0134 CSGSolid* makeCone( const char* label="cone", float r1=300.f, float z1=-300.f, float r2=100.f, float z2=-100.f );
0135 CSGSolid* makeHyperboloid(const char* label="hype", float r0=100.f, float zf=50.f, float z1=-50.f, float z2=50.f );
0136 CSGSolid* makeBox3( const char* label="box3", float fx=100.f, float fy=200.f, float fz=300.f );
0137 CSGSolid* makePlane( const char* label="plan", float nx=1.0f, float ny=0.f, float nz=0.f, float d=0.f );
0138 CSGSolid* makeSlab( const char* label="slab", float nx=1.0f, float ny=0.f, float nz=0.f, float d1=-50.f, float d2=50.f );
0139 CSGSolid* makeCylinder( const char* label="cyli", float r=100.f, float z1=-50.f, float z2=50.f );
0140 CSGSolid* makeOldCylinder(const char* label="ocyl", float r=100.f, float z1=-50.f, float z2=50.f );
0141 CSGSolid* makeDisc( const char* label="disc", float px=0.f, float py=0.f, float ir=50.f, float r=100.f, float z1=-2.f, float z2=2.f);
0142
0143 CSGSolid* makeConvexPolyhedronCube( const char* label="vcub", float extent=100.f );
0144 CSGSolid* makeConvexPolyhedronTetrahedron(const char* label="vtet", float extent=100.f);
0145
0146
0147
0148 static CSGFoundry* MakeGeom(const char* geom);
0149 static CSGFoundry* MakeDemo();
0150
0151
0152
0153 };
0154
0155