Back to home page

EIC code displayed by LXR

 
 

    


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

0001 /**
0002 intersect_leaf_box3_test.cc
0003 ===================================
0004 
0005 This is for very low level testing of csg_intersect_node.h intersect functions.
0006 For a slightly higher level test see CSGNodeScanTest.cc
0007 
0008 **/
0009 
0010 #include "OPTICKS_LOG.hh"
0011 #include <cmath>
0012 
0013 
0014 #include "scuda.h"
0015 #include "squad.h"
0016 #include "sqat4.h"
0017 
0018 #define DEBUG 1 
0019 #include "csg_intersect_leaf.h"
0020 //#include "csg_intersect_node.h"
0021 //#include "csg_intersect_tree.h"
0022 
0023 
0024 
0025 int main(int argc, char** argv)
0026 {
0027     OPTICKS_LOG(argc, argv); 
0028 
0029     quad q0 ; 
0030     q0.f.x = 2.f*5.f ;  
0031     q0.f.y = 2.f*10.f ; 
0032     q0.f.z = 2.f*15.f ; 
0033     q0.f.w = 0.f ; 
0034     
0035     float4 isect = make_float4(0.f, 0.f, 0.f, 0.f ); 
0036     float t_min = 0.f ; 
0037 
0038     float3 ray_origin    = make_float3(  0.f, 0.f, 0.f ); 
0039     float3 ray_direction = make_float3(  0.f, 0.f, 1.f ); 
0040  
0041     bool valid_isect(false) ; 
0042     intersect_leaf_box3( valid_isect, isect, q0, t_min, ray_origin, ray_direction ); 
0043 
0044     float3 pos = make_float3( 0.f, 0.f, 0.f ); 
0045     if(valid_isect)
0046     {
0047         float t = isect.w ; 
0048         pos = ray_origin + t*ray_direction ; 
0049         float sd = distance_leaf_box3(pos, q0) ; 
0050 
0051         printf("//pos %10.4f %10.4f %10.4f    sd %10.4f \n", pos.x, pos.y, pos.z, sd ); 
0052     }
0053 
0054     return 0 ; 
0055 }
0056 
0057 
0058