Back to home page

EIC code displayed by LXR

 
 

    


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

0001 #pragma once
0002 
0003 /**
0004 csg_intersect_leaf_templated.h : distance_leaf and intersect_leaf functions
0005 =============================================================================
0006 
0007 **/
0008 
0009 
0010 #if defined(__CUDACC__) || defined(__CUDABE__)
0011 #    define LEAF_FUNC __forceinline__ __device__
0012 #else
0013 #    define LEAF_FUNC inline
0014 #endif
0015 
0016 
0017 #define RT_DEFAULT_MAX 1.e27f
0018 
0019 #if defined(__CUDACC__)
0020 #include "math_constants.h"
0021 #else
0022 
0023 union uif_t 
0024 {
0025     unsigned u ; 
0026     int i ; 
0027     float f ; 
0028 };
0029 
0030 LEAF_FUNC
0031 float __int_as_float(int i)
0032 {
0033     uif_t uif ; 
0034     uif.i = i ; 
0035     return uif.f ; 
0036 }
0037 
0038 #define CUDART_INF_F            __int_as_float(0x7f800000)
0039 #define CUDART_PI_F             3.141592654f
0040 
0041 #endif
0042 
0043 
0044 #include "OpticksCSG.h"
0045 #include "squad.h"
0046 #include "scuda_templated.h"
0047 
0048 #include "CSGNode.h"
0049 #include "CSGPrim.h"
0050 
0051 #include "csg_robust_quadratic_roots.h"
0052 #include "csg_classify.h"
0053 
0054 #ifdef DEBUG_RECORD
0055 #include <csignal>
0056 #endif
0057 
0058 #ifdef DEBUG_CYLINDER
0059 #include "CSGDebug_Cylinder.hh"
0060 #endif
0061 
0062 
0063 template<typename F>
0064 LEAF_FUNC F distance_leaf_sphere(const F3& pos, const Q4& q0 )
0065 {
0066     F3 p ;
0067     p.x = pos.x - q0.f.x ; 
0068     p.y = pos.y - q0.f.y ; 
0069     p.z = pos.z - q0.f.z ; 
0070     F radius = q0.f.w;
0071     F sd = length(p) - radius ; 
0072     return sd ; 
0073 }
0074 
0075