File indexing completed on 2026-04-09 07:48:54
0001
0002
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 int main(int argc, char** argv)
0020 {
0021 OPTICKS_LOG(argc, argv);
0022
0023 quad q0, q1 ;
0024 q0.f.x = 0.f ;
0025 q0.f.y = 0.f ;
0026 q0.f.z = 0.f ;
0027 q0.f.w = 10.f ;
0028
0029 q1.f.x = -5.f ;
0030 q1.f.y = 5.f ;
0031 q1.f.z = 0.f ;
0032 q1.f.w = 0.f ;
0033
0034 float4 isect = make_float4(0.f, 0.f, 0.f, 0.f );
0035 float t_min = 0.f ;
0036
0037 float3 ray_origin = make_float3( 0.f, 0.f, 0.f );
0038 float3 ray_direction = make_float3( 0.f, 0.f, 1.f );
0039
0040 bool valid_isect(false) ;
0041 intersect_leaf_cylinder( valid_isect, isect, q0, q1, t_min, ray_origin, ray_direction );
0042 float3 pos = make_float3( 0.f , 0.f, 0.f );
0043
0044 if(valid_isect)
0045 {
0046 float t = isect.w ;
0047 pos = ray_origin + t*ray_direction ;
0048
0049 float sd = distance_leaf_cylinder(pos, q0, q1) ;
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