Back to home page

EIC code displayed by LXR

 
 

    


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

0001 /**
0002 intersect_leaf_phicut_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_head.h"
0020 #include "csg_intersect_leaf_phicut.h"
0021 
0022 
0023 int main(int argc, char** argv)
0024 {
0025     OPTICKS_LOG(argc, argv); 
0026 
0027     double startPhi = 0.25 ; 
0028     double deltaPhi = 0.1 ; 
0029 
0030     double phi0 = startPhi ; 
0031     double phi1 = startPhi + deltaPhi  ; 
0032 
0033     double pi = M_PI ; 
0034     double cosPhi0 = cos(phi0*pi ); 
0035     double sinPhi0 = sin(phi0*pi ); 
0036     double cosPhi1 = cos(phi1*pi ); 
0037     double sinPhi1 = sin(phi1*pi ); 
0038 
0039     quad q0 ; 
0040     q0.f.x = cosPhi0 ;  
0041     q0.f.y = sinPhi0 ; 
0042     q0.f.z = cosPhi1 ; 
0043     q0.f.w = sinPhi1 ; 
0044     
0045     float4 isect = make_float4(0.f, 0.f, 0.f, 0.f ); 
0046     float t_min = 0.f ; 
0047 
0048     float3 ray_origin    = make_float3( 10.f, 0.f, 0.f ); 
0049     float3 ray_direction = make_float3(  0.f, 1.f, 0.f ); 
0050  
0051     bool valid_isect(false) ; 
0052     intersect_leaf_phicut( valid_isect, isect, q0, t_min, ray_origin, ray_direction ); 
0053     float4 post = make_float4( 0.f , 0.f, 0.f , 0.f ); 
0054 
0055     if(valid_isect)
0056     {
0057         float t = isect.w ; 
0058         post.x = ray_origin.x + t*ray_direction.x ; 
0059         post.y = ray_origin.y + t*ray_direction.y ; 
0060         post.z = ray_origin.z + t*ray_direction.z ; 
0061         post.w = t ; 
0062 
0063         printf("//post %10.4f %10.4f %10.4f %10.4f \n", post.x, post.y, post.z, post.w ); 
0064     }
0065 
0066     return 0 ; 
0067 }
0068 
0069 
0070