Blender  V3.3
math_intersect.h
Go to the documentation of this file.
1 /* SPDX-License-Identifier: Apache-2.0
2  * Copyright 2011-2022 Blender Foundation */
3 
4 #ifndef __UTIL_MATH_INTERSECT_H__
5 #define __UTIL_MATH_INTERSECT_H__
6 
8 
9 /* Ray Intersection */
10 
12  float3 ray_D,
13  float ray_tmin,
14  float ray_tmax,
15  float3 sphere_P,
16  float sphere_radius,
17  ccl_private float3 *isect_P,
18  ccl_private float *isect_t)
19 {
20  const float3 d = sphere_P - ray_P;
21  const float radiussq = sphere_radius * sphere_radius;
22  const float tsq = dot(d, d);
23 
24  if (tsq > radiussq) {
25  /* Ray origin outside sphere. */
26  const float tp = dot(d, ray_D);
27  if (tp < 0.0f) {
28  /* Ray points away from sphere. */
29  return false;
30  }
31  const float dsq = tsq - tp * tp; /* Pythagoras. */
32  if (dsq > radiussq) {
33  /* Closest point on ray outside sphere. */
34  return false;
35  }
36  const float t = tp - sqrtf(radiussq - dsq); /* pythagoras */
37  if (t > ray_tmin && t < ray_tmax) {
38  *isect_t = t;
39  *isect_P = ray_P + ray_D * t;
40  return true;
41  }
42  }
43  return false;
44 }
45 
47  float3 ray_D,
48  float ray_tmin,
49  float ray_tmax,
50  float3 disk_P,
51  float disk_radius,
52  ccl_private float3 *isect_P,
53  ccl_private float *isect_t)
54 {
55  /* Aligned disk normal. */
56  float disk_t;
57  const float3 disk_N = normalize_len(ray_P - disk_P, &disk_t);
58  const float div = dot(ray_D, disk_N);
59  if (UNLIKELY(div == 0.0f)) {
60  return false;
61  }
62  /* Compute t to intersection point. */
63  const float t = -disk_t / div;
64  if (!(t > ray_tmin && t < ray_tmax)) {
65  return false;
66  }
67  /* Test if within radius. */
68  float3 P = ray_P + ray_D * t;
69  if (len_squared(P - disk_P) > disk_radius * disk_radius) {
70  return false;
71  }
72  *isect_P = P;
73  *isect_t = t;
74  return true;
75 }
76 
78  float3 ray_D,
79  float ray_tmin,
80  float ray_tmax,
81  float3 disk_P,
82  float3 disk_N,
83  float disk_radius,
84  ccl_private float3 *isect_P,
85  ccl_private float *isect_t)
86 {
87  const float3 vp = ray_P - disk_P;
88  const float dp = dot(vp, disk_N);
89  const float cos_angle = dot(disk_N, -ray_D);
90  if (dp * cos_angle > 0.f) // front of light
91  {
92  float t = dp / cos_angle;
93  if (t < 0.f) { /* Ray points away from the light. */
94  return false;
95  }
96  float3 P = ray_P + t * ray_D;
97  float3 T = P - disk_P;
98 
99  if (dot(T, T) < sqr(disk_radius) && (t > ray_tmin && t < ray_tmax)) {
100  *isect_P = ray_P + t * ray_D;
101  *isect_t = t;
102  return true;
103  }
104  }
105  return false;
106 }
107 
108 /* Custom rcp, cross and dot implementations that match Embree bit for bit. */
110 {
111 #ifdef __KERNEL_NEON__
112  /* Move scalar to vector register and do rcp. */
113  __m128 a;
114  a[0] = x;
115  float32x4_t reciprocal = vrecpeq_f32(a);
116  reciprocal = vmulq_f32(vrecpsq_f32(a, reciprocal), reciprocal);
117  reciprocal = vmulq_f32(vrecpsq_f32(a, reciprocal), reciprocal);
118  return reciprocal[0];
119 #elif defined(__KERNEL_SSE__)
120  const __m128 a = _mm_set_ss(x);
121  const __m128 r = _mm_rcp_ss(a);
122 
123 # ifdef __KERNEL_AVX2_
124  return _mm_cvtss_f32(_mm_mul_ss(r, _mm_fnmadd_ss(r, a, _mm_set_ss(2.0f))));
125 # else
126  return _mm_cvtss_f32(_mm_mul_ss(r, _mm_sub_ss(_mm_set_ss(2.0f), _mm_mul_ss(r, a))));
127 # endif
128 #else
129  return 1.0f / x;
130 #endif
131 }
132 
134 {
135 #if defined(__KERNEL_SSE41__) && defined(__KERNEL_SSE__)
136  return madd(ssef(a.x), ssef(b.x), madd(ssef(a.y), ssef(b.y), ssef(a.z) * ssef(b.z)))[0];
137 #else
138  return a.x * b.x + a.y * b.y + a.z * b.z;
139 #endif
140 }
141 
143 {
144 #if defined(__KERNEL_SSE41__) && defined(__KERNEL_SSE__)
145  return make_float3(msub(ssef(a.y), ssef(b.z), ssef(a.z) * ssef(b.y))[0],
146  msub(ssef(a.z), ssef(b.x), ssef(a.x) * ssef(b.z))[0],
147  msub(ssef(a.x), ssef(b.y), ssef(a.y) * ssef(b.x))[0]);
148 #else
149  return make_float3(a.y * b.z - a.z * b.y, a.z * b.x - a.x * b.z, a.x * b.y - a.y * b.x);
150 #endif
151 }
152 
154  const float3 ray_D,
155  const float ray_tmin,
156  const float ray_tmax,
157  const float3 tri_a,
158  const float3 tri_b,
159  const float3 tri_c,
160  ccl_private float *isect_u,
161  ccl_private float *isect_v,
162  ccl_private float *isect_t)
163 {
164  /* This implementation matches the Plücker coordinates triangle intersection
165  * in Embree. */
166 
167  /* Calculate vertices relative to ray origin. */
168  const float3 v0 = tri_a - ray_P;
169  const float3 v1 = tri_b - ray_P;
170  const float3 v2 = tri_c - ray_P;
171 
172  /* Calculate triangle edges. */
173  const float3 e0 = v2 - v0;
174  const float3 e1 = v0 - v1;
175  const float3 e2 = v1 - v2;
176 
177  /* Perform edge tests. */
178  const float U = ray_triangle_dot(ray_triangle_cross(e0, v2 + v0), ray_D);
179  const float V = ray_triangle_dot(ray_triangle_cross(e1, v0 + v1), ray_D);
180  const float W = ray_triangle_dot(ray_triangle_cross(e2, v1 + v2), ray_D);
181 
182  const float UVW = U + V + W;
183  const float eps = FLT_EPSILON * fabsf(UVW);
184  const float minUVW = min(U, min(V, W));
185  const float maxUVW = max(U, max(V, W));
186 
187  if (!(minUVW >= -eps || maxUVW <= eps)) {
188  return false;
189  }
190 
191  /* Calculate geometry normal and denominator. */
192  const float3 Ng1 = ray_triangle_cross(e1, e0);
193  const float3 Ng = Ng1 + Ng1;
194  const float den = dot(Ng, ray_D);
195  /* Avoid division by 0. */
196  if (UNLIKELY(den == 0.0f)) {
197  return false;
198  }
199 
200  /* Perform depth test. */
201  const float T = dot(v0, Ng);
202  const float t = T / den;
203  if (!(t >= ray_tmin && t <= ray_tmax)) {
204  return false;
205  }
206 
207  const float rcp_uvw = (fabsf(UVW) < 1e-18f) ? 0.0f : ray_triangle_rcp(UVW);
208  *isect_u = min(U * rcp_uvw, 1.0f);
209  *isect_v = min(V * rcp_uvw, 1.0f);
210  *isect_t = t;
211  return true;
212 }
213 
215  const float3 ray_D,
216  const float3 tri_a,
217  const float3 tri_b,
218  const float3 tri_c)
219 {
220  /* Matches logic in ray_triangle_intersect, self intersection test to validate
221  * if a ray is going to hit self or might incorrectly hit a neighboring triangle. */
222 
223  /* Calculate vertices relative to ray origin. */
224  const float3 v0 = tri_a - ray_P;
225  const float3 v1 = tri_b - ray_P;
226  const float3 v2 = tri_c - ray_P;
227 
228  /* Calculate triangle edges. */
229  const float3 e0 = v2 - v0;
230  const float3 e1 = v0 - v1;
231  const float3 e2 = v1 - v2;
232 
233  /* Perform edge tests. */
234  const float U = ray_triangle_dot(ray_triangle_cross(v2 + v0, e0), ray_D);
235  const float V = ray_triangle_dot(ray_triangle_cross(v0 + v1, e1), ray_D);
236  const float W = ray_triangle_dot(ray_triangle_cross(v1 + v2, e2), ray_D);
237 
238  const float eps = FLT_EPSILON * fabsf(U + V + W);
239  const float minUVW = min(U, min(V, W));
240  const float maxUVW = max(U, max(V, W));
241 
242  /* Note the extended epsilon compared to ray_triangle_intersect, to account
243  * for intersections with neighboring triangles that have an epsilon. */
244  return (minUVW >= eps || maxUVW <= -eps);
245 }
246 
247 /* Tests for an intersection between a ray and a quad defined by
248  * its midpoint, normal and sides.
249  * If ellipse is true, hits outside the ellipse that's enclosed by the
250  * quad are rejected.
251  */
253  float3 ray_D,
254  float ray_tmin,
255  float ray_tmax,
256  float3 quad_P,
257  float3 quad_u,
258  float3 quad_v,
259  float3 quad_n,
260  ccl_private float3 *isect_P,
261  ccl_private float *isect_t,
262  ccl_private float *isect_u,
263  ccl_private float *isect_v,
264  bool ellipse)
265 {
266  /* Perform intersection test. */
267  float t = -(dot(ray_P, quad_n) - dot(quad_P, quad_n)) / dot(ray_D, quad_n);
268  if (!(t > ray_tmin && t < ray_tmax)) {
269  return false;
270  }
271  const float3 hit = ray_P + t * ray_D;
272  const float3 inplane = hit - quad_P;
273  const float u = dot(inplane, quad_u) / dot(quad_u, quad_u);
274  if (u < -0.5f || u > 0.5f) {
275  return false;
276  }
277  const float v = dot(inplane, quad_v) / dot(quad_v, quad_v);
278  if (v < -0.5f || v > 0.5f) {
279  return false;
280  }
281  if (ellipse && (u * u + v * v > 0.25f)) {
282  return false;
283  }
284  /* Store the result. */
285  /* TODO(sergey): Check whether we can avoid some checks here. */
286  if (isect_P != NULL)
287  *isect_P = hit;
288  if (isect_t != NULL)
289  *isect_t = t;
290 
291  /* NOTE: Return barycentric coordinates in the same notation as Embree and OptiX. */
292  if (isect_u != NULL)
293  *isect_u = v + 0.5f;
294  if (isect_v != NULL)
295  *isect_v = -u - v;
296 
297  return true;
298 }
299 
301 
302 #endif /* __UTIL_MATH_INTERSECT_H__ */
#define UNLIKELY(x)
_GL_VOID GLfloat value _GL_VOID_RET _GL_VOID const GLuint GLboolean *residences _GL_BOOL_RET _GL_VOID GLsizei GLfloat GLfloat GLfloat GLfloat const GLubyte *bitmap _GL_VOID_RET _GL_VOID GLenum const void *lists _GL_VOID_RET _GL_VOID const GLdouble *equation _GL_VOID_RET _GL_VOID GLdouble GLdouble blue _GL_VOID_RET _GL_VOID GLfloat GLfloat blue _GL_VOID_RET _GL_VOID GLint GLint blue _GL_VOID_RET _GL_VOID GLshort GLshort blue _GL_VOID_RET _GL_VOID GLubyte GLubyte blue _GL_VOID_RET _GL_VOID GLuint GLuint blue _GL_VOID_RET _GL_VOID GLushort GLushort blue _GL_VOID_RET _GL_VOID GLbyte GLbyte GLbyte alpha _GL_VOID_RET _GL_VOID GLdouble GLdouble GLdouble alpha _GL_VOID_RET _GL_VOID GLfloat GLfloat GLfloat alpha _GL_VOID_RET _GL_VOID GLint GLint GLint alpha _GL_VOID_RET _GL_VOID GLshort GLshort GLshort alpha _GL_VOID_RET _GL_VOID GLubyte GLubyte GLubyte alpha _GL_VOID_RET _GL_VOID GLuint GLuint GLuint alpha _GL_VOID_RET _GL_VOID GLushort GLushort GLushort alpha _GL_VOID_RET _GL_VOID GLenum mode _GL_VOID_RET _GL_VOID GLint GLsizei GLsizei GLenum type _GL_VOID_RET _GL_VOID GLsizei GLenum GLenum const void *pixels _GL_VOID_RET _GL_VOID const void *pointer _GL_VOID_RET _GL_VOID GLdouble v _GL_VOID_RET _GL_VOID GLfloat v _GL_VOID_RET _GL_VOID GLint GLint i2 _GL_VOID_RET _GL_VOID GLint j _GL_VOID_RET _GL_VOID GLfloat param _GL_VOID_RET _GL_VOID GLint param _GL_VOID_RET _GL_VOID GLdouble GLdouble GLdouble GLdouble GLdouble zFar _GL_VOID_RET _GL_UINT GLdouble *equation _GL_VOID_RET _GL_VOID GLenum GLint *params _GL_VOID_RET _GL_VOID GLenum GLfloat *v _GL_VOID_RET _GL_VOID GLenum GLfloat *params _GL_VOID_RET _GL_VOID GLfloat *values _GL_VOID_RET _GL_VOID GLushort *values _GL_VOID_RET _GL_VOID GLenum GLfloat *params _GL_VOID_RET _GL_VOID GLenum GLdouble *params _GL_VOID_RET _GL_VOID GLenum GLint *params _GL_VOID_RET _GL_VOID GLsizei const void *pointer _GL_VOID_RET _GL_VOID GLsizei const void *pointer _GL_VOID_RET _GL_BOOL GLfloat param _GL_VOID_RET _GL_VOID GLint param _GL_VOID_RET _GL_VOID GLenum GLfloat param _GL_VOID_RET _GL_VOID GLenum GLint param _GL_VOID_RET _GL_VOID GLushort pattern _GL_VOID_RET _GL_VOID GLdouble GLdouble GLint GLint const GLdouble *points _GL_VOID_RET _GL_VOID GLdouble GLdouble GLint GLint GLdouble GLdouble GLint GLint const GLdouble *points _GL_VOID_RET _GL_VOID GLdouble GLdouble u2 _GL_VOID_RET _GL_VOID GLdouble GLdouble GLint GLdouble GLdouble v2 _GL_VOID_RET _GL_VOID GLenum GLfloat param _GL_VOID_RET _GL_VOID GLenum GLint param _GL_VOID_RET _GL_VOID GLenum mode _GL_VOID_RET _GL_VOID GLdouble GLdouble nz _GL_VOID_RET _GL_VOID GLfloat GLfloat nz _GL_VOID_RET _GL_VOID GLint GLint nz _GL_VOID_RET _GL_VOID GLshort GLshort nz _GL_VOID_RET _GL_VOID GLsizei const void *pointer _GL_VOID_RET _GL_VOID GLsizei const GLfloat *values _GL_VOID_RET _GL_VOID GLsizei const GLushort *values _GL_VOID_RET _GL_VOID GLint param _GL_VOID_RET _GL_VOID const GLuint const GLclampf *priorities _GL_VOID_RET _GL_VOID GLdouble y _GL_VOID_RET _GL_VOID GLfloat y _GL_VOID_RET _GL_VOID GLint y _GL_VOID_RET _GL_VOID GLshort y _GL_VOID_RET _GL_VOID GLdouble GLdouble z _GL_VOID_RET _GL_VOID GLfloat GLfloat z _GL_VOID_RET _GL_VOID GLint GLint z _GL_VOID_RET _GL_VOID GLshort GLshort z _GL_VOID_RET _GL_VOID GLdouble GLdouble GLdouble w _GL_VOID_RET _GL_VOID GLfloat GLfloat GLfloat w _GL_VOID_RET _GL_VOID GLint GLint GLint w _GL_VOID_RET _GL_VOID GLshort GLshort GLshort w _GL_VOID_RET _GL_VOID GLdouble GLdouble GLdouble y2 _GL_VOID_RET _GL_VOID GLfloat GLfloat GLfloat y2 _GL_VOID_RET _GL_VOID GLint GLint GLint y2 _GL_VOID_RET _GL_VOID GLshort GLshort GLshort y2 _GL_VOID_RET _GL_VOID GLdouble GLdouble GLdouble z _GL_VOID_RET _GL_VOID GLdouble GLdouble z _GL_VOID_RET _GL_VOID GLuint *buffer _GL_VOID_RET _GL_VOID GLdouble t _GL_VOID_RET _GL_VOID GLfloat t _GL_VOID_RET _GL_VOID GLint t _GL_VOID_RET _GL_VOID GLshort t _GL_VOID_RET _GL_VOID GLdouble GLdouble r _GL_VOID_RET _GL_VOID GLfloat GLfloat r _GL_VOID_RET _GL_VOID GLint GLint r _GL_VOID_RET _GL_VOID GLshort GLshort r _GL_VOID_RET _GL_VOID GLdouble GLdouble r
_GL_VOID GLfloat value _GL_VOID_RET _GL_VOID const GLuint GLboolean *residences _GL_BOOL_RET _GL_VOID GLsizei GLfloat GLfloat GLfloat GLfloat const GLubyte *bitmap _GL_VOID_RET _GL_VOID GLenum const void *lists _GL_VOID_RET _GL_VOID const GLdouble *equation _GL_VOID_RET _GL_VOID GLdouble GLdouble blue _GL_VOID_RET _GL_VOID GLfloat GLfloat blue _GL_VOID_RET _GL_VOID GLint GLint blue _GL_VOID_RET _GL_VOID GLshort GLshort blue _GL_VOID_RET _GL_VOID GLubyte GLubyte blue _GL_VOID_RET _GL_VOID GLuint GLuint blue _GL_VOID_RET _GL_VOID GLushort GLushort blue _GL_VOID_RET _GL_VOID GLbyte GLbyte GLbyte alpha _GL_VOID_RET _GL_VOID GLdouble GLdouble GLdouble alpha _GL_VOID_RET _GL_VOID GLfloat GLfloat GLfloat alpha _GL_VOID_RET _GL_VOID GLint GLint GLint alpha _GL_VOID_RET _GL_VOID GLshort GLshort GLshort alpha _GL_VOID_RET _GL_VOID GLubyte GLubyte GLubyte alpha _GL_VOID_RET _GL_VOID GLuint GLuint GLuint alpha _GL_VOID_RET _GL_VOID GLushort GLushort GLushort alpha _GL_VOID_RET _GL_VOID GLenum mode _GL_VOID_RET _GL_VOID GLint GLsizei GLsizei GLenum type _GL_VOID_RET _GL_VOID GLsizei GLenum GLenum const void *pixels _GL_VOID_RET _GL_VOID const void *pointer _GL_VOID_RET _GL_VOID GLdouble v _GL_VOID_RET _GL_VOID GLfloat v _GL_VOID_RET _GL_VOID GLint GLint i2 _GL_VOID_RET _GL_VOID GLint j _GL_VOID_RET _GL_VOID GLfloat param _GL_VOID_RET _GL_VOID GLint param _GL_VOID_RET _GL_VOID GLdouble GLdouble GLdouble GLdouble GLdouble zFar _GL_VOID_RET _GL_UINT GLdouble *equation _GL_VOID_RET _GL_VOID GLenum GLint *params _GL_VOID_RET _GL_VOID GLenum GLfloat *v _GL_VOID_RET _GL_VOID GLenum GLfloat *params _GL_VOID_RET _GL_VOID GLfloat *values _GL_VOID_RET _GL_VOID GLushort *values _GL_VOID_RET _GL_VOID GLenum GLfloat *params _GL_VOID_RET _GL_VOID GLenum GLdouble *params _GL_VOID_RET _GL_VOID GLenum GLint *params _GL_VOID_RET _GL_VOID GLsizei const void *pointer _GL_VOID_RET _GL_VOID GLsizei const void *pointer _GL_VOID_RET _GL_BOOL GLfloat param _GL_VOID_RET _GL_VOID GLint param _GL_VOID_RET _GL_VOID GLenum GLfloat param _GL_VOID_RET _GL_VOID GLenum GLint param _GL_VOID_RET _GL_VOID GLushort pattern _GL_VOID_RET _GL_VOID GLdouble GLdouble GLint GLint const GLdouble *points _GL_VOID_RET _GL_VOID GLdouble GLdouble GLint GLint GLdouble GLdouble GLint GLint const GLdouble *points _GL_VOID_RET _GL_VOID GLdouble GLdouble u2 _GL_VOID_RET _GL_VOID GLdouble GLdouble GLint GLdouble GLdouble v2 _GL_VOID_RET _GL_VOID GLenum GLfloat param _GL_VOID_RET _GL_VOID GLenum GLint param _GL_VOID_RET _GL_VOID GLenum mode _GL_VOID_RET _GL_VOID GLdouble GLdouble nz _GL_VOID_RET _GL_VOID GLfloat GLfloat nz _GL_VOID_RET _GL_VOID GLint GLint nz _GL_VOID_RET _GL_VOID GLshort GLshort nz _GL_VOID_RET _GL_VOID GLsizei const void *pointer _GL_VOID_RET _GL_VOID GLsizei const GLfloat *values _GL_VOID_RET _GL_VOID GLsizei const GLushort *values _GL_VOID_RET _GL_VOID GLint param _GL_VOID_RET _GL_VOID const GLuint const GLclampf *priorities _GL_VOID_RET _GL_VOID GLdouble y _GL_VOID_RET _GL_VOID GLfloat y _GL_VOID_RET _GL_VOID GLint y _GL_VOID_RET _GL_VOID GLshort y _GL_VOID_RET _GL_VOID GLdouble GLdouble z _GL_VOID_RET _GL_VOID GLfloat GLfloat z _GL_VOID_RET _GL_VOID GLint GLint z _GL_VOID_RET _GL_VOID GLshort GLshort z _GL_VOID_RET _GL_VOID GLdouble GLdouble GLdouble w _GL_VOID_RET _GL_VOID GLfloat GLfloat GLfloat w _GL_VOID_RET _GL_VOID GLint GLint GLint w _GL_VOID_RET _GL_VOID GLshort GLshort GLshort w _GL_VOID_RET _GL_VOID GLdouble GLdouble GLdouble y2 _GL_VOID_RET _GL_VOID GLfloat GLfloat GLfloat y2 _GL_VOID_RET _GL_VOID GLint GLint GLint y2 _GL_VOID_RET _GL_VOID GLshort GLshort GLshort y2 _GL_VOID_RET _GL_VOID GLdouble GLdouble GLdouble z _GL_VOID_RET _GL_VOID GLdouble GLdouble z _GL_VOID_RET _GL_VOID GLuint *buffer _GL_VOID_RET _GL_VOID GLdouble t _GL_VOID_RET _GL_VOID GLfloat t _GL_VOID_RET _GL_VOID GLint t _GL_VOID_RET _GL_VOID GLshort t _GL_VOID_RET _GL_VOID GLdouble t
_GL_VOID GLfloat value _GL_VOID_RET _GL_VOID const GLuint GLboolean *residences _GL_BOOL_RET _GL_VOID GLsizei GLfloat GLfloat GLfloat GLfloat const GLubyte *bitmap _GL_VOID_RET _GL_VOID GLenum const void *lists _GL_VOID_RET _GL_VOID const GLdouble *equation _GL_VOID_RET _GL_VOID GLdouble GLdouble blue _GL_VOID_RET _GL_VOID GLfloat GLfloat blue _GL_VOID_RET _GL_VOID GLint GLint blue _GL_VOID_RET _GL_VOID GLshort GLshort blue _GL_VOID_RET _GL_VOID GLubyte GLubyte blue _GL_VOID_RET _GL_VOID GLuint GLuint blue _GL_VOID_RET _GL_VOID GLushort GLushort blue _GL_VOID_RET _GL_VOID GLbyte GLbyte GLbyte alpha _GL_VOID_RET _GL_VOID GLdouble GLdouble GLdouble alpha _GL_VOID_RET _GL_VOID GLfloat GLfloat GLfloat alpha _GL_VOID_RET _GL_VOID GLint GLint GLint alpha _GL_VOID_RET _GL_VOID GLshort GLshort GLshort alpha _GL_VOID_RET _GL_VOID GLubyte GLubyte GLubyte alpha _GL_VOID_RET _GL_VOID GLuint GLuint GLuint alpha _GL_VOID_RET _GL_VOID GLushort GLushort GLushort alpha _GL_VOID_RET _GL_VOID GLenum mode _GL_VOID_RET _GL_VOID GLint GLsizei GLsizei GLenum type _GL_VOID_RET _GL_VOID GLsizei GLenum GLenum const void *pixels _GL_VOID_RET _GL_VOID const void *pointer _GL_VOID_RET _GL_VOID GLdouble v _GL_VOID_RET _GL_VOID GLfloat v _GL_VOID_RET _GL_VOID GLint GLint i2 _GL_VOID_RET _GL_VOID GLint j _GL_VOID_RET _GL_VOID GLfloat param _GL_VOID_RET _GL_VOID GLint param _GL_VOID_RET _GL_VOID GLdouble GLdouble GLdouble GLdouble GLdouble zFar _GL_VOID_RET _GL_UINT GLdouble *equation _GL_VOID_RET _GL_VOID GLenum GLint *params _GL_VOID_RET _GL_VOID GLenum GLfloat *v _GL_VOID_RET _GL_VOID GLenum GLfloat *params _GL_VOID_RET _GL_VOID GLfloat *values _GL_VOID_RET _GL_VOID GLushort *values _GL_VOID_RET _GL_VOID GLenum GLfloat *params _GL_VOID_RET _GL_VOID GLenum GLdouble *params _GL_VOID_RET _GL_VOID GLenum GLint *params _GL_VOID_RET _GL_VOID GLsizei const void *pointer _GL_VOID_RET _GL_VOID GLsizei const void *pointer _GL_VOID_RET _GL_BOOL GLfloat param _GL_VOID_RET _GL_VOID GLint param _GL_VOID_RET _GL_VOID GLenum GLfloat param _GL_VOID_RET _GL_VOID GLenum GLint param _GL_VOID_RET _GL_VOID GLushort pattern _GL_VOID_RET _GL_VOID GLdouble GLdouble GLint GLint const GLdouble *points _GL_VOID_RET _GL_VOID GLdouble GLdouble GLint GLint GLdouble v1
__forceinline const avxf madd(const avxf &a, const avxf &b, const avxf &c)
Ternary Operators.
Definition: avxf.h:321
__forceinline const avxf msub(const avxf &a, const avxf &b, const avxf &c)
Definition: avxf.h:338
ATTR_WARN_UNUSED_RESULT const BMVert * v2
ATTR_WARN_UNUSED_RESULT const BMVert * v
unsigned int U
Definition: btGjkEpa3.h:78
#define ccl_device_forceinline
Definition: cuda/compat.h:35
#define ccl_device
Definition: cuda/compat.h:32
#define ccl_private
Definition: cuda/compat.h:48
#define ccl_device_inline
Definition: cuda/compat.h:34
#define CCL_NAMESPACE_END
Definition: cuda/compat.h:9
ccl_device_inline float2 normalize_len(const float2 &a, float *t)
ccl_device_inline float len_squared(const float3 a)
Definition: math_float3.h:423
static float P(float k)
Definition: math_interp.c:25
ccl_device bool ray_disk_intersect(float3 ray_P, float3 ray_D, float ray_tmin, float ray_tmax, float3 disk_P, float3 disk_N, float disk_radius, ccl_private float3 *isect_P, ccl_private float *isect_t)
ccl_device bool ray_quad_intersect(float3 ray_P, float3 ray_D, float ray_tmin, float ray_tmax, float3 quad_P, float3 quad_u, float3 quad_v, float3 quad_n, ccl_private float3 *isect_P, ccl_private float *isect_t, ccl_private float *isect_u, ccl_private float *isect_v, bool ellipse)
ccl_device_forceinline float ray_triangle_rcp(const float x)
CCL_NAMESPACE_BEGIN ccl_device bool ray_sphere_intersect(float3 ray_P, float3 ray_D, float ray_tmin, float ray_tmax, float3 sphere_P, float sphere_radius, ccl_private float3 *isect_P, ccl_private float *isect_t)
ccl_device bool ray_aligned_disk_intersect(float3 ray_P, float3 ray_D, float ray_tmin, float ray_tmax, float3 disk_P, float disk_radius, ccl_private float3 *isect_P, ccl_private float *isect_t)
ccl_device_forceinline bool ray_triangle_intersect(const float3 ray_P, const float3 ray_D, const float ray_tmin, const float ray_tmax, const float3 tri_a, const float3 tri_b, const float3 tri_c, ccl_private float *isect_u, ccl_private float *isect_v, ccl_private float *isect_t)
ccl_device_forceinline bool ray_triangle_intersect_self(const float3 ray_P, const float3 ray_D, const float3 tri_a, const float3 tri_b, const float3 tri_c)
ccl_device_inline float3 ray_triangle_cross(const float3 a, const float3 b)
ccl_device_inline float ray_triangle_dot(const float3 a, const float3 b)
#define T
#define fabsf(x)
Definition: metal/compat.h:219
#define sqrtf(x)
Definition: metal/compat.h:243
#define make_float3(x, y, z)
Definition: metal/compat.h:204
static unsigned a[3]
Definition: RandGen.cpp:78
T dot(const vec_base< T, Size > &a, const vec_base< T, Size > &b)
static const pxr::TfToken b("b", pxr::TfToken::Immortal)
const btScalar eps
Definition: poly34.cpp:11
#define min(a, b)
Definition: sort.c:35
float max
ccl_device_inline float sqr(float a)
Definition: util/math.h:746
CCL_NAMESPACE_BEGIN struct Window V