Blender  V3.3
math_float3.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_FLOAT3_H__
5 #define __UTIL_MATH_FLOAT3_H__
6 
7 #ifndef __UTIL_MATH_H__
8 # error "Do not include this file directly, include util/types.h instead."
9 #endif
10 
12 
13 /*******************************************************************************
14  * Declaration.
15  */
16 
17 #if !defined(__KERNEL_METAL__)
20 ccl_device_inline float3 operator*(const float3 &a, const float f);
21 ccl_device_inline float3 operator*(const float f, const float3 &a);
22 ccl_device_inline float3 operator/(const float f, const float3 &a);
23 ccl_device_inline float3 operator/(const float3 &a, const float f);
25 ccl_device_inline float3 operator+(const float3 &a, const float f);
27 ccl_device_inline float3 operator-(const float3 &a, const float f);
35 
36 ccl_device_inline bool operator==(const float3 &a, const float3 &b);
37 ccl_device_inline bool operator!=(const float3 &a, const float3 &b);
38 
39 ccl_device_inline float distance(const float3 &a, const float3 &b);
40 ccl_device_inline float dot(const float3 &a, const float3 &b);
41 ccl_device_inline float dot_xy(const float3 &a, const float3 &b);
42 ccl_device_inline float3 cross(const float3 &a, const float3 &b);
44 ccl_device_inline float3 min(const float3 &a, const float3 &b);
45 ccl_device_inline float3 max(const float3 &a, const float3 &b);
46 ccl_device_inline float3 clamp(const float3 &a, const float3 &mn, const float3 &mx);
48 ccl_device_inline float3 mix(const float3 &a, const float3 &b, float t);
53 ccl_device_inline float3 reflect(const float3 incident, const float3 normal);
54 #endif /* !defined(__KERNEL_METAL__) */
55 
58 ccl_device_inline float len(const float3 a);
60 
61 ccl_device_inline float3 project(const float3 v, const float3 v_proj);
62 
67 ccl_device_inline float3 safe_divide(const float3 a, const float b);
70 
71 ccl_device_inline bool is_zero(const float3 a);
73 ccl_device_inline float average(const float3 a);
74 ccl_device_inline bool isequal(const float3 a, const float3 b);
75 
76 /*******************************************************************************
77  * Definition.
78  */
79 
81 {
82 #ifdef __KERNEL_SSE__
83  return float3(_mm_setzero_ps());
84 #else
85  return make_float3(0.0f, 0.0f, 0.0f);
86 #endif
87 }
88 
90 {
91  return make_float3(1.0f, 1.0f, 1.0f);
92 }
93 
94 #if defined(__KERNEL_METAL__)
95 
97 {
98  return make_float3(1.0f / a.x, 1.0f / a.y, 1.0f / a.z);
99 }
100 
101 #else
102 
104 {
105 # ifdef __KERNEL_SSE__
106  return float3(_mm_xor_ps(a.m128, _mm_castsi128_ps(_mm_set1_epi32(0x80000000))));
107 # else
108  return make_float3(-a.x, -a.y, -a.z);
109 # endif
110 }
111 
113 {
114 # ifdef __KERNEL_SSE__
115  return float3(_mm_mul_ps(a.m128, b.m128));
116 # else
117  return make_float3(a.x * b.x, a.y * b.y, a.z * b.z);
118 # endif
119 }
120 
121 ccl_device_inline float3 operator*(const float3 &a, const float f)
122 {
123 # ifdef __KERNEL_SSE__
124  return float3(_mm_mul_ps(a.m128, _mm_set1_ps(f)));
125 # else
126  return make_float3(a.x * f, a.y * f, a.z * f);
127 # endif
128 }
129 
130 ccl_device_inline float3 operator*(const float f, const float3 &a)
131 {
132 # if defined(__KERNEL_SSE__)
133  return float3(_mm_mul_ps(_mm_set1_ps(f), a.m128));
134 # else
135  return make_float3(a.x * f, a.y * f, a.z * f);
136 # endif
137 }
138 
139 ccl_device_inline float3 operator/(const float f, const float3 &a)
140 {
141 # if defined(__KERNEL_SSE__)
142  return float3(_mm_div_ps(_mm_set1_ps(f), a.m128));
143 # else
144  return make_float3(f / a.x, f / a.y, f / a.z);
145 # endif
146 }
147 
148 ccl_device_inline float3 operator/(const float3 &a, const float f)
149 {
150 # if defined(__KERNEL_SSE__)
151  return float3(_mm_div_ps(a.m128, _mm_set1_ps(f)));
152 # else
153  return make_float3(a.x / f, a.y / f, a.z / f);
154 # endif
155 }
156 
158 {
159 # if defined(__KERNEL_SSE__)
160  return float3(_mm_div_ps(a.m128, b.m128));
161 # else
162  return make_float3(a.x / b.x, a.y / b.y, a.z / b.z);
163 # endif
164 }
165 
166 ccl_device_inline float3 operator+(const float3 &a, const float f)
167 {
168  return a + make_float3(f, f, f);
169 }
170 
172 {
173 # ifdef __KERNEL_SSE__
174  return float3(_mm_add_ps(a.m128, b.m128));
175 # else
176  return make_float3(a.x + b.x, a.y + b.y, a.z + b.z);
177 # endif
178 }
179 
180 ccl_device_inline float3 operator-(const float3 &a, const float f)
181 {
182  return a - make_float3(f, f, f);
183 }
184 
186 {
187 # ifdef __KERNEL_SSE__
188  return float3(_mm_sub_ps(a.m128, b.m128));
189 # else
190  return make_float3(a.x - b.x, a.y - b.y, a.z - b.z);
191 # endif
192 }
193 
195 {
196  return a = a + b;
197 }
198 
200 {
201  return a = a - b;
202 }
203 
205 {
206  return a = a * b;
207 }
208 
210 {
211  return a = a * f;
212 }
213 
215 {
216  return a = a / b;
217 }
218 
220 {
221  float invf = 1.0f / f;
222  return a = a * invf;
223 }
224 
225 # if !(defined(__KERNEL_METAL__) || defined(__KERNEL_CUDA__))
227 {
228  a = float3(a) * b;
229  return a;
230 }
231 
233 {
234  a = float3(a) * f;
235  return a;
236 }
237 
239 {
240  a = float3(a) / b;
241  return a;
242 }
243 
245 {
246  a = float3(a) / f;
247  return a;
248 }
249 # endif
250 
252 {
253 # ifdef __KERNEL_SSE__
254  return (_mm_movemask_ps(_mm_cmpeq_ps(a.m128, b.m128)) & 7) == 7;
255 # else
256  return (a.x == b.x && a.y == b.y && a.z == b.z);
257 # endif
258 }
259 
261 {
262  return !(a == b);
263 }
264 
265 ccl_device_inline float distance(const float3 &a, const float3 &b)
266 {
267  return len(a - b);
268 }
269 
270 ccl_device_inline float dot(const float3 &a, const float3 &b)
271 {
272 # if defined(__KERNEL_SSE41__) && defined(__KERNEL_SSE__)
273  return _mm_cvtss_f32(_mm_dp_ps(a, b, 0x7F));
274 # else
275  return a.x * b.x + a.y * b.y + a.z * b.z;
276 # endif
277 }
278 
279 ccl_device_inline float dot_xy(const float3 &a, const float3 &b)
280 {
281 # if defined(__KERNEL_SSE41__) && defined(__KERNEL_SSE__)
282  return _mm_cvtss_f32(_mm_hadd_ps(_mm_mul_ps(a, b), b));
283 # else
284  return a.x * b.x + a.y * b.y;
285 # endif
286 }
287 
289 {
290 # ifdef __KERNEL_SSE__
291  return float3(shuffle<1, 2, 0, 3>(
292  msub(ssef(a), shuffle<1, 2, 0, 3>(ssef(b)), shuffle<1, 2, 0, 3>(ssef(a)) * ssef(b))));
293 # else
294  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);
295 # endif
296 }
297 
299 {
300 # if defined(__KERNEL_SSE41__) && defined(__KERNEL_SSE__)
301  __m128 norm = _mm_sqrt_ps(_mm_dp_ps(a.m128, a.m128, 0x7F));
302  return float3(_mm_div_ps(a.m128, norm));
303 # else
304  return a / len(a);
305 # endif
306 }
307 
309 {
310 # ifdef __KERNEL_SSE__
311  return float3(_mm_min_ps(a.m128, b.m128));
312 # else
313  return make_float3(min(a.x, b.x), min(a.y, b.y), min(a.z, b.z));
314 # endif
315 }
316 
318 {
319 # ifdef __KERNEL_SSE__
320  return float3(_mm_max_ps(a.m128, b.m128));
321 # else
322  return make_float3(max(a.x, b.x), max(a.y, b.y), max(a.z, b.z));
323 # endif
324 }
325 
326 ccl_device_inline float3 clamp(const float3 &a, const float3 &mn, const float3 &mx)
327 {
328  return min(max(a, mn), mx);
329 }
330 
332 {
333 # ifdef __KERNEL_SSE__
334 # ifdef __KERNEL_NEON__
335  return float3(vabsq_f32(a.m128));
336 # else
337  __m128 mask = _mm_castsi128_ps(_mm_set1_epi32(0x7fffffff));
338  return float3(_mm_and_ps(a.m128, mask));
339 # endif
340 # else
341  return make_float3(fabsf(a.x), fabsf(a.y), fabsf(a.z));
342 # endif
343 }
344 
346 {
347 # ifdef __KERNEL_SSE__
348  return float3(_mm_sqrt_ps(a));
349 # else
350  return make_float3(sqrtf(a.x), sqrtf(a.y), sqrtf(a.z));
351 # endif
352 }
353 
355 {
356 # ifdef __KERNEL_SSE__
357  return float3(_mm_floor_ps(a));
358 # else
359  return make_float3(floorf(a.x), floorf(a.y), floorf(a.z));
360 # endif
361 }
362 
364 {
365 # ifdef __KERNEL_SSE__
366  return float3(_mm_ceil_ps(a));
367 # else
368  return make_float3(ceilf(a.x), ceilf(a.y), ceilf(a.z));
369 # endif
370 }
371 
372 ccl_device_inline float3 mix(const float3 &a, const float3 &b, float t)
373 {
374  return a + t * (b - a);
375 }
376 
378 {
379 # ifdef __KERNEL_SSE__
380  /* Don't use _mm_rcp_ps due to poor precision. */
381  return float3(_mm_div_ps(_mm_set_ps1(1.0f), a.m128));
382 # else
383  return make_float3(1.0f / a.x, 1.0f / a.y, 1.0f / a.z);
384 # endif
385 }
386 
388 {
389  return make_float3(saturatef(a.x), saturatef(a.y), saturatef(a.z));
390 }
391 
393 {
394  return make_float3(expf(v.x), expf(v.y), expf(v.z));
395 }
396 
398 {
399  return make_float3(logf(v.x), logf(v.y), logf(v.z));
400 }
401 
402 #endif /* !__KERNEL_METAL__ */
403 
405 {
406  return min(min(a.x, a.y), a.z);
407 }
408 
410 {
411  return max(max(a.x, a.y), a.z);
412 }
413 
415 {
416 #if defined(__KERNEL_SSE41__) && defined(__KERNEL_SSE__)
417  return _mm_cvtss_f32(_mm_sqrt_ss(_mm_dp_ps(a.m128, a.m128, 0x7F)));
418 #else
419  return sqrtf(dot(a, a));
420 #endif
421 }
422 
424 {
425  return dot(a, a);
426 }
427 
428 #if !defined(__KERNEL_METAL__)
430 {
431  float3 unit_normal = normalize(normal);
432  return incident - 2.0f * unit_normal * dot(incident, unit_normal);
433 }
434 
435 ccl_device_inline float3 refract(const float3 incident, const float3 normal, const float eta)
436 {
437  float k = 1.0f - eta * eta * (1.0f - dot(normal, incident) * dot(normal, incident));
438  if (k < 0.0f)
439  return zero_float3();
440  else
441  return eta * incident - (eta * dot(normal, incident) + sqrt(k)) * normal;
442 }
443 
445  const float3 incident,
446  const float3 reference)
447 {
448  return (dot(reference, incident) < 0.0f) ? vector : -vector;
449 }
450 #endif
451 
453 {
454  float len_squared = dot(v_proj, v_proj);
455  return (len_squared != 0.0f) ? (dot(v, v_proj) / len_squared) * v_proj : zero_float3();
456 }
457 
459 {
460  *t = len(a);
461  float x = 1.0f / *t;
462  return a * x;
463 }
464 
466 {
467  float t = len(a);
468  return (t != 0.0f) ? a * (1.0f / t) : a;
469 }
470 
472 {
473  *t = len(a);
474  return (*t != 0.0f) ? a / (*t) : a;
475 }
476 
478 {
479  return make_float3((b.x != 0.0f) ? a.x / b.x : 0.0f,
480  (b.y != 0.0f) ? a.y / b.y : 0.0f,
481  (b.z != 0.0f) ? a.z / b.z : 0.0f);
482 }
483 
485 {
486  return (b != 0.0f) ? a / b : zero_float3();
487 }
488 
490 {
491  return a + t * (b - a);
492 }
493 
495 {
496  return a * a;
497 }
498 
500 {
501 #ifdef __KERNEL_SSE__
502  return a == make_float3(0.0f);
503 #else
504  return (a.x == 0.0f && a.y == 0.0f && a.z == 0.0f);
505 #endif
506 }
507 
509 {
510 #if defined(__KERNEL_SSE__) && defined(__KERNEL_NEON__)
511  __m128 t = a.m128;
512  t[3] = 0.0f;
513  return vaddvq_f32(t);
514 #else
515  return (a.x + a.y + a.z);
516 #endif
517 }
518 
520 {
521  return reduce_add(a) * (1.0f / 3.0f);
522 }
523 
525 {
526 #if defined(__KERNEL_METAL__)
527  return all(a == b);
528 #else
529  return a == b;
530 #endif
531 }
532 
534 {
535  return make_float3(powf(v.x, e), powf(v.y, e), powf(v.z, e));
536 }
537 
539 {
540  return isfinite_safe(v.x) && isfinite_safe(v.y) && isfinite_safe(v.z);
541 }
542 
544 {
545  if (!isfinite_safe(v.x))
546  v.x = 0.0f;
547  if (!isfinite_safe(v.y))
548  v.y = 0.0f;
549  if (!isfinite_safe(v.z))
550  v.z = 0.0f;
551  return v;
552 }
553 
555 
556 #endif /* __UTIL_MATH_FLOAT3_H__ */
_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
float float3[3]
in reality light always falls off quadratically Particle Retrieve the data of the particle that spawned the object for example to give variation to multiple instances of an object Point Retrieve information about points in a point cloud Retrieve the edges of an object as it appears to Cycles topology will always appear triangulated Convert a blackbody temperature to an RGB value Normal Generate a perturbed normal from an RGB normal map image Typically used for faking highly detailed surfaces Generate an OSL shader from a file or text data block Image Sample an image file as a texture Sky Generate a procedural sky texture Noise Generate fractal Perlin noise Wave Generate procedural bands or rings with noise Voronoi Generate Worley noise based on the distance to random points Typically used to generate textures such as or biological cells Brick Generate a procedural texture producing bricks Texture Retrieve multiple types of texture coordinates nTypically used as inputs for texture nodes Vector Convert a vector
__forceinline bool all(const avxb &b)
Definition: avxb.h:201
__forceinline const avxf msub(const avxf &a, const avxf &b, const avxf &c)
Definition: avxf.h:338
ATTR_WARN_UNUSED_RESULT const BMVert const BMEdge * e
ATTR_WARN_UNUSED_RESULT const BMVert * v
SIMD_FORCE_INLINE btScalar norm() const
Return the norm (length) of the vector.
Definition: btVector3.h:263
#define logf(x)
Definition: cuda/compat.h:105
#define expf(x)
Definition: cuda/compat.h:106
#define ccl_private
Definition: cuda/compat.h:48
#define ccl_device_inline
Definition: cuda/compat.h:34
#define powf(x, y)
Definition: cuda/compat.h:103
#define CCL_NAMESPACE_END
Definition: cuda/compat.h:9
IconTextureDrawCall normal
ccl_device_inline float dot(const float3 &a, const float3 &b)
Definition: math_float3.h:270
ccl_device_inline float3 operator+(const float3 &a, const float f)
Definition: math_float3.h:166
ccl_device_inline float3 safe_normalize(const float3 a)
Definition: math_float3.h:465
ccl_device_inline bool is_zero(const float3 a)
Definition: math_float3.h:499
ccl_device_inline float3 operator*(const float3 &a, const float3 &b)
Definition: math_float3.h:112
ccl_device_inline bool isequal(const float3 a, const float3 b)
Definition: math_float3.h:524
ccl_device_inline float3 normalize(const float3 &a)
Definition: math_float3.h:298
ccl_device_inline float distance(const float3 &a, const float3 &b)
Definition: math_float3.h:265
ccl_device_inline float3 refract(const float3 incident, const float3 normal, const float eta)
Definition: math_float3.h:435
ccl_device_inline float3 one_float3()
Definition: math_float3.h:89
ccl_device_inline float3 exp(float3 v)
Definition: math_float3.h:392
ccl_device_inline float reduce_min(float3 a)
Definition: math_float3.h:404
ccl_device_inline float3 faceforward(const float3 vector, const float3 incident, const float3 reference)
Definition: math_float3.h:444
ccl_device_inline float3 normalize_len(const float3 a, ccl_private float *t)
Definition: math_float3.h:458
ccl_device_inline float3 operator*=(float3 &a, const float3 &b)
Definition: math_float3.h:204
ccl_device_inline float3 ceil(const float3 &a)
Definition: math_float3.h:363
ccl_device_inline bool operator!=(const float3 &a, const float3 &b)
Definition: math_float3.h:260
ccl_device_inline float3 project(const float3 v, const float3 v_proj)
Definition: math_float3.h:452
ccl_device_inline float3 sqr(float3 a)
Definition: math_float3.h:494
ccl_device_inline float3 max(const float3 &a, const float3 &b)
Definition: math_float3.h:317
ccl_device_inline float3 mix(const float3 &a, const float3 &b, float t)
Definition: math_float3.h:372
ccl_device_inline float3 rcp(const float3 &a)
Definition: math_float3.h:377
ccl_device_inline float3 operator+=(float3 &a, const float3 &b)
Definition: math_float3.h:194
ccl_device_inline float reduce_add(const float3 a)
Definition: math_float3.h:508
ccl_device_inline float reduce_max(float3 a)
Definition: math_float3.h:409
ccl_device_inline float3 zero_float3()
Definition: math_float3.h:80
ccl_device_inline bool operator==(const float3 &a, const float3 &b)
Definition: math_float3.h:251
ccl_device_inline float3 fabs(const float3 &a)
Definition: math_float3.h:331
ccl_device_inline float dot_xy(const float3 &a, const float3 &b)
Definition: math_float3.h:279
ccl_device_inline float average(const float3 a)
Definition: math_float3.h:519
ccl_device_inline float3 min(const float3 &a, const float3 &b)
Definition: math_float3.h:308
ccl_device_inline float3 operator/(const float f, const float3 &a)
Definition: math_float3.h:139
ccl_device_inline float3 saturate(float3 a)
Definition: math_float3.h:387
ccl_device_inline float3 floor(const float3 &a)
Definition: math_float3.h:354
ccl_device_inline float3 safe_divide(const float3 a, const float3 b)
Definition: math_float3.h:477
CCL_NAMESPACE_BEGIN ccl_device_inline float3 operator-(const float3 &a)
Definition: math_float3.h:103
ccl_device_inline float3 sqrt(const float3 &a)
Definition: math_float3.h:345
ccl_device_inline bool isfinite_safe(float3 v)
Definition: math_float3.h:538
ccl_device_inline float3 safe_normalize_len(const float3 a, ccl_private float *t)
Definition: math_float3.h:471
ccl_device_inline float3 operator/=(float3 &a, const float3 &b)
Definition: math_float3.h:214
ccl_device_inline float3 pow(float3 v, float e)
Definition: math_float3.h:533
ccl_device_inline float3 cross(const float3 &a, const float3 &b)
Definition: math_float3.h:288
ccl_device_inline float3 interp(float3 a, float3 b, float t)
Definition: math_float3.h:489
ccl_device_inline float3 operator-=(float3 &a, const float3 &b)
Definition: math_float3.h:199
ccl_device_inline float3 log(float3 v)
Definition: math_float3.h:397
ccl_device_inline float3 clamp(const float3 &a, const float3 &mn, const float3 &mx)
Definition: math_float3.h:326
ccl_device_inline float len_squared(const float3 a)
Definition: math_float3.h:423
ccl_device_inline float len(const float3 a)
Definition: math_float3.h:414
ccl_device_inline float3 ensure_finite(float3 v)
Definition: math_float3.h:543
ccl_device_inline float3 reflect(const float3 incident, const float3 normal)
Definition: math_float3.h:429
ccl_device_inline float4 mask(const int4 &mask, const float4 &a)
Definition: math_float4.h:513
#define ceilf(x)
Definition: metal/compat.h:225
#define floorf(x)
Definition: metal/compat.h:224
#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
static const pxr::TfToken b("b", pxr::TfToken::Immortal)
ccl_device_inline float saturatef(float a)
Definition: util/math.h:404