Back to home page

EIC code displayed by LXR

 
 

    


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

0001 /**
0002 intersect_prim_test.cc
0003 ========================
0004 
0005 ~/opticks/CSG/tests/intersect_prim_test.sh
0006 
0007 
0008 TODO: replace Sphere with boolean tree, listnode, tree with listnode, ...  
0009 
0010 TODO: come up with cleaner way to do ring intersects 
0011 
0012 HMM: maybe incorporate some of what CSGImport::importPrim_ does 
0013 such that can start from sn* nodes convert to CSGNode and get the 
0014 intersects... so can source geometry from its sn tree 
0015 
0016 **/
0017 
0018 
0019 #include <cstdio>
0020 
0021 #include "ssys.h"
0022 #include "scuda.h"
0023 #include "squad.h"
0024 #include "sqat4.h"
0025 #include "csg_intersect_leaf.h"
0026 #include "csg_intersect_node.h"
0027 #include "csg_intersect_tree.h"
0028 
0029 #include "CSGNode.h"
0030 
0031 void test_intersect_prim()
0032 {
0033     CSGNode nd = CSGNode::Sphere(100.f); 
0034 
0035     const CSGNode* node = &nd ; 
0036     const float4* plan = nullptr ; 
0037     const qat4* itra = nullptr ; 
0038     const float t_min = 0.f ; 
0039 
0040     float3 ray_origin    = {0.f, 0.f, -50.f }; 
0041     float3 ray_direction = {0.f, 0.f, -1.f }; 
0042     float4 isect = {0.f, 0.f, 0.f, 0.f } ; 
0043 
0044     bool is = intersect_prim(isect, node, plan, itra, t_min, ray_origin, ray_direction );
0045 
0046     printf("// is = %d ; isect = np.array([%10.5f,%10.5f,%10.5f,%10.5f]) \n", is, isect.x, isect.y, isect.z, isect.w ) ;  
0047 }
0048 
0049 int main()
0050 {
0051     test_intersect_prim() ; 
0052     return 0 ; 
0053 }
0054