Back to home page

EIC code displayed by LXR

 
 

    


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

0001 /**
0002 intersect_leaf_cylinder_midlevel_test.cc
0003 =========================================
0004 
0005 **/
0006 
0007 #include "OPTICKS_LOG.hh"
0008 #include <cmath>
0009 
0010 
0011 #include "scuda.h"
0012 #include "squad.h"
0013 #include "sqat4.h"
0014 
0015 #define DEBUG 1 
0016 #include "csg_intersect_leaf.h"
0017 
0018 
0019 
0020 
0021 void midlevel_test()
0022 {
0023     CSGNode nd = CSGNode::Cylinder( 100.f , -1.f, 1.f ) ; 
0024 
0025     bool valid_isect(false); 
0026     float4 isect = make_float4( 0.f, 0.f, 0.f, 0.f ); 
0027 
0028     float t_min = 2.f ; 
0029     float3 ray_origin    = make_float3(  0.f, 0.f, 0.f ); 
0030     float3 ray_direction = make_float3(  0.f, 0.f, 1.f ); 
0031 
0032     float3& o = ray_origin ; 
0033     float3& v = ray_direction ; 
0034 
0035     for( float x=-150.f ; x <= 150.f ; x += 10.f )
0036     {
0037         o.x = x ; 
0038         valid_isect = intersect_leaf( isect, &nd , nullptr, nullptr, t_min, o, v ); 
0039 
0040         printf("//midlevel_test: o (%10.4f %10.4f %10.4f) v (%10.4f %10.4f %10.4f) valid_isect %d i ( %10.4f %10.4f %10.4f %10.4f ) \n", 
0041              o.x, o.y, o.z,
0042              v.x, v.y, v.z,
0043              valid_isect, 
0044              isect.x, isect.y, isect.z, isect.w ); 
0045     }
0046 }
0047 
0048 int main(int argc, char** argv)
0049 {
0050     OPTICKS_LOG(argc, argv); 
0051 
0052     midlevel_test(); 
0053 
0054     return 0 ; 
0055 }
0056 
0057 
0058