Blender  V3.3
math_vector.c
Go to the documentation of this file.
1 /* SPDX-License-Identifier: GPL-2.0-or-later
2  * Copyright 2001-2002 NaN Holding BV. All rights reserved. */
3 
8 #include "BLI_math.h"
9 
10 #include "BLI_strict_flags.h"
11 
12 //******************************* Interpolation *******************************/
13 
14 void interp_v2_v2v2(float r[2], const float a[2], const float b[2], const float t)
15 {
16  const float s = 1.0f - t;
17 
18  r[0] = s * a[0] + t * b[0];
19  r[1] = s * a[1] + t * b[1];
20 }
21 
23  float r[2], const float a[2], const float b[2], const float c[2], const float t[3])
24 {
25  r[0] = a[0] * t[0] + b[0] * t[1] + c[0] * t[2];
26  r[1] = a[1] * t[0] + b[1] * t[1] + c[1] * t[2];
27 }
28 
29 void interp_v3_v3v3(float r[3], const float a[3], const float b[3], const float t)
30 {
31  const float s = 1.0f - t;
32 
33  r[0] = s * a[0] + t * b[0];
34  r[1] = s * a[1] + t * b[1];
35  r[2] = s * a[2] + t * b[2];
36 }
37 
38 void interp_v4_v4v4(float r[4], const float a[4], const float b[4], const float t)
39 {
40  const float s = 1.0f - t;
41 
42  r[0] = s * a[0] + t * b[0];
43  r[1] = s * a[1] + t * b[1];
44  r[2] = s * a[2] + t * b[2];
45  r[3] = s * a[3] + t * b[3];
46 }
47 
48 bool interp_v3_v3v3_slerp(float target[3], const float a[3], const float b[3], const float t)
49 {
50  float cosom, w[2];
51 
54 
55  cosom = dot_v3v3(a, b);
56 
57  /* direct opposites */
58  if (UNLIKELY(cosom < (-1.0f + FLT_EPSILON))) {
59  return false;
60  }
61 
62  interp_dot_slerp(t, cosom, w);
63 
64  target[0] = w[0] * a[0] + w[1] * b[0];
65  target[1] = w[0] * a[1] + w[1] * b[1];
66  target[2] = w[0] * a[2] + w[1] * b[2];
67 
68  return true;
69 }
70 bool interp_v2_v2v2_slerp(float target[2], const float a[2], const float b[2], const float t)
71 {
72  float cosom, w[2];
73 
76 
77  cosom = dot_v2v2(a, b);
78 
79  /* direct opposites */
80  if (UNLIKELY(cosom < (1.0f + FLT_EPSILON))) {
81  return false;
82  }
83 
84  interp_dot_slerp(t, cosom, w);
85 
86  target[0] = w[0] * a[0] + w[1] * b[0];
87  target[1] = w[0] * a[1] + w[1] * b[1];
88 
89  return true;
90 }
91 
92 void interp_v3_v3v3_slerp_safe(float target[3], const float a[3], const float b[3], const float t)
93 {
94  if (UNLIKELY(!interp_v3_v3v3_slerp(target, a, b, t))) {
95  /* Axis are aligned so any orthogonal vector is acceptable. */
96  float ab_ortho[3];
97  ortho_v3_v3(ab_ortho, a);
98  normalize_v3(ab_ortho);
99  if (t < 0.5f) {
100  if (UNLIKELY(!interp_v3_v3v3_slerp(target, a, ab_ortho, t * 2.0f))) {
101  BLI_assert(0);
102  copy_v3_v3(target, a);
103  }
104  }
105  else {
106  if (UNLIKELY(!interp_v3_v3v3_slerp(target, ab_ortho, b, (t - 0.5f) * 2.0f))) {
107  BLI_assert(0);
108  copy_v3_v3(target, b);
109  }
110  }
111  }
112 }
113 void interp_v2_v2v2_slerp_safe(float target[2], const float a[2], const float b[2], const float t)
114 {
115  if (UNLIKELY(!interp_v2_v2v2_slerp(target, a, b, t))) {
116  /* Axis are aligned so any orthogonal vector is acceptable. */
117  float ab_ortho[2];
118  ortho_v2_v2(ab_ortho, a);
119  // normalize_v2(ab_ortho);
120  if (t < 0.5f) {
121  if (UNLIKELY(!interp_v2_v2v2_slerp(target, a, ab_ortho, t * 2.0f))) {
122  BLI_assert(0);
123  copy_v2_v2(target, a);
124  }
125  }
126  else {
127  if (UNLIKELY(!interp_v2_v2v2_slerp(target, ab_ortho, b, (t - 0.5f) * 2.0f))) {
128  BLI_assert(0);
129  copy_v2_v2(target, b);
130  }
131  }
132  }
133 }
134 
135 /* -------------------------------------------------------------------- */
139 void interp_v2_v2v2v2v2_cubic(float p[2],
140  const float v1[2],
141  const float v2[2],
142  const float v3[2],
143  const float v4[2],
144  const float u)
145 {
146  float q0[2], q1[2], q2[2], r0[2], r1[2];
147 
148  interp_v2_v2v2(q0, v1, v2, u);
149  interp_v2_v2v2(q1, v2, v3, u);
150  interp_v2_v2v2(q2, v3, v4, u);
151 
152  interp_v2_v2v2(r0, q0, q1, u);
153  interp_v2_v2v2(r1, q1, q2, u);
154 
155  interp_v2_v2v2(p, r0, r1, u);
156 }
157 
161  float p[3], const float v1[3], const float v2[3], const float v3[3], const float w[3])
162 {
163  p[0] = v1[0] * w[0] + v2[0] * w[1] + v3[0] * w[2];
164  p[1] = v1[1] * w[0] + v2[1] * w[1] + v3[1] * w[2];
165  p[2] = v1[2] * w[0] + v2[2] * w[1] + v3[2] * w[2];
166 }
167 
168 void interp_v3_v3v3v3v3(float p[3],
169  const float v1[3],
170  const float v2[3],
171  const float v3[3],
172  const float v4[3],
173  const float w[4])
174 {
175  p[0] = v1[0] * w[0] + v2[0] * w[1] + v3[0] * w[2] + v4[0] * w[3];
176  p[1] = v1[1] * w[0] + v2[1] * w[1] + v3[1] * w[2] + v4[1] * w[3];
177  p[2] = v1[2] * w[0] + v2[2] * w[1] + v3[2] * w[2] + v4[2] * w[3];
178 }
179 
181  float p[4], const float v1[4], const float v2[4], const float v3[4], const float w[3])
182 {
183  p[0] = v1[0] * w[0] + v2[0] * w[1] + v3[0] * w[2];
184  p[1] = v1[1] * w[0] + v2[1] * w[1] + v3[1] * w[2];
185  p[2] = v1[2] * w[0] + v2[2] * w[1] + v3[2] * w[2];
186  p[3] = v1[3] * w[0] + v2[3] * w[1] + v3[3] * w[2];
187 }
188 
189 void interp_v4_v4v4v4v4(float p[4],
190  const float v1[4],
191  const float v2[4],
192  const float v3[4],
193  const float v4[4],
194  const float w[4])
195 {
196  p[0] = v1[0] * w[0] + v2[0] * w[1] + v3[0] * w[2] + v4[0] * w[3];
197  p[1] = v1[1] * w[0] + v2[1] * w[1] + v3[1] * w[2] + v4[1] * w[3];
198  p[2] = v1[2] * w[0] + v2[2] * w[1] + v3[2] * w[2] + v4[2] * w[3];
199  p[3] = v1[3] * w[0] + v2[3] * w[1] + v3[3] * w[2] + v4[3] * w[3];
200 }
201 
203  float p[3], const float v1[3], const float v2[3], const float v3[3], const float uv[2])
204 {
205  p[0] = v1[0] + ((v2[0] - v1[0]) * uv[0]) + ((v3[0] - v1[0]) * uv[1]);
206  p[1] = v1[1] + ((v2[1] - v1[1]) * uv[0]) + ((v3[1] - v1[1]) * uv[1]);
207  p[2] = v1[2] + ((v2[2] - v1[2]) * uv[0]) + ((v3[2] - v1[2]) * uv[1]);
208 }
209 
210 void interp_v3_v3v3_uchar(uchar target[3], const uchar a[3], const uchar b[3], const float t)
211 {
212  const float s = 1.0f - t;
213 
214  target[0] = (char)floorf(s * a[0] + t * b[0]);
215  target[1] = (char)floorf(s * a[1] + t * b[1]);
216  target[2] = (char)floorf(s * a[2] + t * b[2]);
217 }
218 void interp_v3_v3v3_char(char target[3], const char a[3], const char b[3], const float t)
219 {
220  interp_v3_v3v3_uchar((uchar *)target, (const uchar *)a, (const uchar *)b, t);
221 }
222 
223 void interp_v4_v4v4_uchar(uchar target[4], const uchar a[4], const uchar b[4], const float t)
224 {
225  const float s = 1.0f - t;
226 
227  target[0] = (char)floorf(s * a[0] + t * b[0]);
228  target[1] = (char)floorf(s * a[1] + t * b[1]);
229  target[2] = (char)floorf(s * a[2] + t * b[2]);
230  target[3] = (char)floorf(s * a[3] + t * b[3]);
231 }
232 void interp_v4_v4v4_char(char target[4], const char a[4], const char b[4], const float t)
233 {
234  interp_v4_v4v4_uchar((uchar *)target, (const uchar *)a, (const uchar *)b, t);
235 }
236 
237 void mid_v3_v3v3(float r[3], const float a[3], const float b[3])
238 {
239  r[0] = 0.5f * (a[0] + b[0]);
240  r[1] = 0.5f * (a[1] + b[1]);
241  r[2] = 0.5f * (a[2] + b[2]);
242 }
243 
244 void mid_v2_v2v2(float r[2], const float a[2], const float b[2])
245 {
246  r[0] = 0.5f * (a[0] + b[0]);
247  r[1] = 0.5f * (a[1] + b[1]);
248 }
249 
250 void mid_v2_v2v2v2(float v[2], const float v1[2], const float v2[2], const float v3[2])
251 {
252  v[0] = (v1[0] + v2[0] + v3[0]) / 3.0f;
253  v[1] = (v1[1] + v2[1] + v3[1]) / 3.0f;
254 }
255 
256 void mid_v3_v3v3v3(float v[3], const float v1[3], const float v2[3], const float v3[3])
257 {
258  v[0] = (v1[0] + v2[0] + v3[0]) / 3.0f;
259  v[1] = (v1[1] + v2[1] + v3[1]) / 3.0f;
260  v[2] = (v1[2] + v2[2] + v3[2]) / 3.0f;
261 }
262 
264  float v[3], const float v1[3], const float v2[3], const float v3[3], const float v4[3])
265 {
266  v[0] = (v1[0] + v2[0] + v3[0] + v4[0]) / 4.0f;
267  v[1] = (v1[1] + v2[1] + v3[1] + v4[1]) / 4.0f;
268  v[2] = (v1[2] + v2[2] + v3[2] + v4[2]) / 4.0f;
269 }
270 
271 void mid_v3_v3_array(float r[3], const float (*vec_arr)[3], const uint vec_arr_num)
272 {
273  const float factor = 1.0f / (float)vec_arr_num;
274  zero_v3(r);
275 
276  for (uint i = 0; i < vec_arr_num; i++) {
277  madd_v3_v3fl(r, vec_arr[i], factor);
278  }
279 }
280 
281 void mid_v3_v3v3_angle_weighted(float r[3], const float a[3], const float b[3])
282 {
283  /* trick, we want the middle of 2 normals as well as the angle between them
284  * avoid multiple calculations by */
285  float angle;
286 
287  /* double check they are normalized */
290 
291  add_v3_v3v3(r, a, b);
292  angle = ((float)M_2_PI *
293  /* normally we would only multiply by 2,
294  * but instead of an angle make this 0-1 factor */
295  2.0f) *
296  acosf(normalize_v3(r) / 2.0f);
297  mul_v3_fl(r, angle);
298 }
299 void mid_v3_angle_weighted(float r[3])
300 {
301  /* trick, we want the middle of 2 normals as well as the angle between them
302  * avoid multiple calculations by */
303  float angle;
304 
305  /* double check they are normalized */
306  BLI_assert(len_squared_v3(r) <= 1.0f + FLT_EPSILON);
307 
308  angle = ((float)M_2_PI *
309  /* normally we would only multiply by 2,
310  * but instead of an angle make this 0-1 factor */
311  2.0f) *
312  acosf(normalize_v3(r));
313  mul_v3_fl(r, angle);
314 }
315 
321 void flip_v4_v4v4(float v[4], const float v1[4], const float v2[4])
322 {
323  v[0] = v1[0] + (v1[0] - v2[0]);
324  v[1] = v1[1] + (v1[1] - v2[1]);
325  v[2] = v1[2] + (v1[2] - v2[2]);
326  v[3] = v1[3] + (v1[3] - v2[3]);
327 }
328 
329 void flip_v3_v3v3(float v[3], const float v1[3], const float v2[3])
330 {
331  v[0] = v1[0] + (v1[0] - v2[0]);
332  v[1] = v1[1] + (v1[1] - v2[1]);
333  v[2] = v1[2] + (v1[2] - v2[2]);
334 }
335 
336 void flip_v2_v2v2(float v[2], const float v1[2], const float v2[2])
337 {
338  v[0] = v1[0] + (v1[0] - v2[0]);
339  v[1] = v1[1] + (v1[1] - v2[1]);
340 }
341 
342 /********************************* Comparison ********************************/
343 
344 bool is_finite_v2(const float v[2])
345 {
346  return (isfinite(v[0]) && isfinite(v[1]));
347 }
348 
349 bool is_finite_v3(const float v[3])
350 {
351  return (isfinite(v[0]) && isfinite(v[1]) && isfinite(v[2]));
352 }
353 
354 bool is_finite_v4(const float v[4])
355 {
356  return (isfinite(v[0]) && isfinite(v[1]) && isfinite(v[2]) && isfinite(v[3]));
357 }
358 
359 /********************************** Angles ***********************************/
360 
361 float angle_v3v3v3(const float a[3], const float b[3], const float c[3])
362 {
363  float vec1[3], vec2[3];
364 
365  sub_v3_v3v3(vec1, b, a);
366  sub_v3_v3v3(vec2, b, c);
367  normalize_v3(vec1);
368  normalize_v3(vec2);
369 
370  return angle_normalized_v3v3(vec1, vec2);
371 }
372 
373 float cos_v3v3v3(const float p1[3], const float p2[3], const float p3[3])
374 {
375  float vec1[3], vec2[3];
376 
377  sub_v3_v3v3(vec1, p2, p1);
378  sub_v3_v3v3(vec2, p2, p3);
379  normalize_v3(vec1);
380  normalize_v3(vec2);
381 
382  return dot_v3v3(vec1, vec2);
383 }
384 
385 float angle_v3v3(const float a[3], const float b[3])
386 {
387  float vec1[3], vec2[3];
388 
389  normalize_v3_v3(vec1, a);
390  normalize_v3_v3(vec2, b);
391 
392  return angle_normalized_v3v3(vec1, vec2);
393 }
394 
395 float angle_v2v2v2(const float a[2], const float b[2], const float c[2])
396 {
397  float vec1[2], vec2[2];
398 
399  vec1[0] = b[0] - a[0];
400  vec1[1] = b[1] - a[1];
401 
402  vec2[0] = b[0] - c[0];
403  vec2[1] = b[1] - c[1];
404 
405  normalize_v2(vec1);
406  normalize_v2(vec2);
407 
408  return angle_normalized_v2v2(vec1, vec2);
409 }
410 
411 float cos_v2v2v2(const float p1[2], const float p2[2], const float p3[2])
412 {
413  float vec1[2], vec2[2];
414 
415  sub_v2_v2v2(vec1, p2, p1);
416  sub_v2_v2v2(vec2, p2, p3);
417  normalize_v2(vec1);
418  normalize_v2(vec2);
419 
420  return dot_v2v2(vec1, vec2);
421 }
422 
423 float angle_v2v2(const float a[2], const float b[2])
424 {
425  float vec1[2], vec2[2];
426 
427  vec1[0] = a[0];
428  vec1[1] = a[1];
429 
430  vec2[0] = b[0];
431  vec2[1] = b[1];
432 
433  normalize_v2(vec1);
434  normalize_v2(vec2);
435 
436  return angle_normalized_v2v2(vec1, vec2);
437 }
438 
439 float angle_signed_v2v2(const float v1[2], const float v2[2])
440 {
441  const float perp_dot = (v1[1] * v2[0]) - (v1[0] * v2[1]);
442  return atan2f(perp_dot, dot_v2v2(v1, v2));
443 }
444 
445 float angle_normalized_v3v3(const float v1[3], const float v2[3])
446 {
447  /* double check they are normalized */
450 
451  /* this is the same as acos(dot_v3v3(v1, v2)), but more accurate */
452  if (dot_v3v3(v1, v2) >= 0.0f) {
453  return 2.0f * saasin(len_v3v3(v1, v2) / 2.0f);
454  }
455 
456  float v2_n[3];
457  negate_v3_v3(v2_n, v2);
458  return (float)M_PI - 2.0f * saasin(len_v3v3(v1, v2_n) / 2.0f);
459 }
460 
461 float angle_normalized_v2v2(const float a[2], const float b[2])
462 {
463  /* double check they are normalized */
466 
467  /* this is the same as acos(dot_v3v3(v1, v2)), but more accurate */
468  if (dot_v2v2(a, b) >= 0.0f) {
469  return 2.0f * saasin(len_v2v2(a, b) / 2.0f);
470  }
471 
472  float v2_n[2];
473  negate_v2_v2(v2_n, b);
474  return (float)M_PI - 2.0f * saasin(len_v2v2(a, v2_n) / 2.0f);
475 }
476 
477 float angle_on_axis_v3v3_v3(const float v1[3], const float v2[3], const float axis[3])
478 {
479  float v1_proj[3], v2_proj[3];
480 
481  /* project the vectors onto the axis */
482  project_plane_normalized_v3_v3v3(v1_proj, v1, axis);
483  project_plane_normalized_v3_v3v3(v2_proj, v2, axis);
484 
485  return angle_v3v3(v1_proj, v2_proj);
486 }
487 
488 float angle_signed_on_axis_v3v3_v3(const float v1[3], const float v2[3], const float axis[3])
489 {
490  float v1_proj[3], v2_proj[3], tproj[3];
491  float angle;
492 
493  /* project the vectors onto the axis */
494  project_plane_normalized_v3_v3v3(v1_proj, v1, axis);
495  project_plane_normalized_v3_v3v3(v2_proj, v2, axis);
496 
497  angle = angle_v3v3(v1_proj, v2_proj);
498 
499  /* calculate the sign (reuse 'tproj') */
500  cross_v3_v3v3(tproj, v2_proj, v1_proj);
501  if (dot_v3v3(tproj, axis) < 0.0f) {
502  angle = ((float)(M_PI * 2.0)) - angle;
503  }
504 
505  return angle;
506 }
507 
508 float angle_on_axis_v3v3v3_v3(const float v1[3],
509  const float v2[3],
510  const float v3[3],
511  const float axis[3])
512 {
513  float vec1[3], vec2[3];
514 
515  sub_v3_v3v3(vec1, v1, v2);
516  sub_v3_v3v3(vec2, v3, v2);
517 
518  return angle_on_axis_v3v3_v3(vec1, vec2, axis);
519 }
520 
521 float angle_signed_on_axis_v3v3v3_v3(const float v1[3],
522  const float v2[3],
523  const float v3[3],
524  const float axis[3])
525 {
526  float vec1[3], vec2[3];
527 
528  sub_v3_v3v3(vec1, v1, v2);
529  sub_v3_v3v3(vec2, v3, v2);
530 
531  return angle_signed_on_axis_v3v3_v3(vec1, vec2, axis);
532 }
533 
534 void angle_tri_v3(float angles[3], const float v1[3], const float v2[3], const float v3[3])
535 {
536  float ed1[3], ed2[3], ed3[3];
537 
538  sub_v3_v3v3(ed1, v3, v1);
539  sub_v3_v3v3(ed2, v1, v2);
540  sub_v3_v3v3(ed3, v2, v3);
541 
542  normalize_v3(ed1);
543  normalize_v3(ed2);
544  normalize_v3(ed3);
545 
546  angles[0] = (float)M_PI - angle_normalized_v3v3(ed1, ed2);
547  angles[1] = (float)M_PI - angle_normalized_v3v3(ed2, ed3);
548  // face_angles[2] = M_PI - angle_normalized_v3v3(ed3, ed1);
549  angles[2] = (float)M_PI - (angles[0] + angles[1]);
550 }
551 
553  float angles[4], const float v1[3], const float v2[3], const float v3[3], const float v4[3])
554 {
555  float ed1[3], ed2[3], ed3[3], ed4[3];
556 
557  sub_v3_v3v3(ed1, v4, v1);
558  sub_v3_v3v3(ed2, v1, v2);
559  sub_v3_v3v3(ed3, v2, v3);
560  sub_v3_v3v3(ed4, v3, v4);
561 
562  normalize_v3(ed1);
563  normalize_v3(ed2);
564  normalize_v3(ed3);
565  normalize_v3(ed4);
566 
567  angles[0] = (float)M_PI - angle_normalized_v3v3(ed1, ed2);
568  angles[1] = (float)M_PI - angle_normalized_v3v3(ed2, ed3);
569  angles[2] = (float)M_PI - angle_normalized_v3v3(ed3, ed4);
570  angles[3] = (float)M_PI - angle_normalized_v3v3(ed4, ed1);
571 }
572 
573 void angle_poly_v3(float *angles, const float *verts[3], int len)
574 {
575  int i;
576  float vec[3][3];
577 
578  sub_v3_v3v3(vec[2], verts[len - 1], verts[0]);
579  normalize_v3(vec[2]);
580  for (i = 0; i < len; i++) {
581  sub_v3_v3v3(vec[i % 3], verts[i % len], verts[(i + 1) % len]);
582  normalize_v3(vec[i % 3]);
583  angles[i] = (float)M_PI - angle_normalized_v3v3(vec[(i + 2) % 3], vec[i % 3]);
584  }
585 }
586 
587 /********************************* Geometry **********************************/
588 
589 void project_v2_v2v2(float out[2], const float p[2], const float v_proj[2])
590 {
591  if (UNLIKELY(is_zero_v2(v_proj))) {
592  zero_v2(out);
593  return;
594  }
595 
596  const float mul = dot_v2v2(p, v_proj) / dot_v2v2(v_proj, v_proj);
597  mul_v2_v2fl(out, v_proj, mul);
598 }
599 
600 void project_v3_v3v3(float out[3], const float p[3], const float v_proj[3])
601 {
602  if (UNLIKELY(is_zero_v3(v_proj))) {
603  zero_v3(out);
604  return;
605  }
606 
607  const float mul = dot_v3v3(p, v_proj) / dot_v3v3(v_proj, v_proj);
608  mul_v3_v3fl(out, v_proj, mul);
609 }
610 
611 void project_v3_v3v3_db(double out[3], const double p[3], const double v_proj[3])
612 {
613  if (UNLIKELY(is_zero_v3_db(v_proj))) {
614  zero_v3_db(out);
615  return;
616  }
617 
618  const double mul = dot_v3v3_db(p, v_proj) / dot_v3v3_db(v_proj, v_proj);
619  mul_v3_v3db_db(out, v_proj, mul);
620 }
621 
622 void project_v2_v2v2_normalized(float out[2], const float p[2], const float v_proj[2])
623 {
624  BLI_ASSERT_UNIT_V2(v_proj);
625 
626  const float mul = dot_v2v2(p, v_proj);
627  mul_v2_v2fl(out, v_proj, mul);
628 }
629 
630 void project_v3_v3v3_normalized(float out[3], const float p[3], const float v_proj[3])
631 {
632  BLI_ASSERT_UNIT_V3(v_proj);
633 
634  const float mul = dot_v3v3(p, v_proj);
635  mul_v3_v3fl(out, v_proj, mul);
636 }
637 
638 void project_plane_v3_v3v3(float out[3], const float p[3], const float v_plane[3])
639 {
640  const float mul = dot_v3v3(p, v_plane) / dot_v3v3(v_plane, v_plane);
641  /* out[x] = p[x] - (mul * v_plane[x]) */
642  madd_v3_v3v3fl(out, p, v_plane, -mul);
643 }
644 
645 void project_plane_v2_v2v2(float out[2], const float p[2], const float v_plane[2])
646 {
647  const float mul = dot_v2v2(p, v_plane) / dot_v2v2(v_plane, v_plane);
648  /* out[x] = p[x] - (mul * v_plane[x]) */
649  madd_v2_v2v2fl(out, p, v_plane, -mul);
650 }
651 
652 void project_plane_normalized_v3_v3v3(float out[3], const float p[3], const float v_plane[3])
653 {
654  BLI_ASSERT_UNIT_V3(v_plane);
655  const float mul = dot_v3v3(p, v_plane);
656  /* out[x] = p[x] - (mul * v_plane[x]) */
657  madd_v3_v3v3fl(out, p, v_plane, -mul);
658 }
659 
660 void project_plane_normalized_v2_v2v2(float out[2], const float p[2], const float v_plane[2])
661 {
662  BLI_ASSERT_UNIT_V2(v_plane);
663  const float mul = dot_v2v2(p, v_plane);
664  /* out[x] = p[x] - (mul * v_plane[x]) */
665  madd_v2_v2v2fl(out, p, v_plane, -mul);
666 }
667 
668 void project_v3_plane(float out[3], const float plane_no[3], const float plane_co[3])
669 {
670  float vector[3];
671  float mul;
672 
673  sub_v3_v3v3(vector, out, plane_co);
674  mul = dot_v3v3(vector, plane_no) / len_squared_v3(plane_no);
675 
676  /* out[x] = out[x] - (mul * plane_no[x]) */
677  madd_v3_v3fl(out, plane_no, -mul);
678 }
679 
680 void bisect_v3_v3v3v3(float r[3], const float a[3], const float b[3], const float c[3])
681 {
682  float d_12[3], d_23[3];
683  sub_v3_v3v3(d_12, b, a);
684  sub_v3_v3v3(d_23, c, b);
685  normalize_v3(d_12);
686  normalize_v3(d_23);
687  add_v3_v3v3(r, d_12, d_23);
688  normalize_v3(r);
689 }
690 
691 void reflect_v3_v3v3(float out[3], const float v[3], const float normal[3])
692 {
694  const float dot2 = 2.0f * dot_v3v3(v, normal);
695  /* out[x] = v[x] - (dot2 * normal[x]) */
696  madd_v3_v3v3fl(out, v, normal, -dot2);
697 }
698 
699 void reflect_v3_v3v3_db(double out[3], const double v[3], const double normal[3])
700 {
702  const double dot2 = 2.0 * dot_v3v3_db(v, normal);
703  /* out[x] = v[x] - (dot2 * normal[x]) */
704  madd_v3_v3v3db_db(out, v, normal, -dot2);
705 }
706 
707 void ortho_basis_v3v3_v3(float r_n1[3], float r_n2[3], const float n[3])
708 {
709  const float eps = FLT_EPSILON;
710  const float f = len_squared_v2(n);
711 
712  if (f > eps) {
713  const float d = 1.0f / sqrtf(f);
714 
715  BLI_assert(isfinite(d));
716 
717  r_n1[0] = n[1] * d;
718  r_n1[1] = -n[0] * d;
719  r_n1[2] = 0.0f;
720  r_n2[0] = -n[2] * r_n1[1];
721  r_n2[1] = n[2] * r_n1[0];
722  r_n2[2] = n[0] * r_n1[1] - n[1] * r_n1[0];
723  }
724  else {
725  /* degenerate case */
726  r_n1[0] = (n[2] < 0.0f) ? -1.0f : 1.0f;
727  r_n1[1] = r_n1[2] = r_n2[0] = r_n2[2] = 0.0f;
728  r_n2[1] = 1.0f;
729  }
730 }
731 
732 void ortho_v3_v3(float out[3], const float v[3])
733 {
734  const int axis = axis_dominant_v3_single(v);
735 
736  BLI_assert(out != v);
737 
738  switch (axis) {
739  case 0:
740  out[0] = -v[1] - v[2];
741  out[1] = v[0];
742  out[2] = v[0];
743  break;
744  case 1:
745  out[0] = v[1];
746  out[1] = -v[0] - v[2];
747  out[2] = v[1];
748  break;
749  case 2:
750  out[0] = v[2];
751  out[1] = v[2];
752  out[2] = -v[0] - v[1];
753  break;
754  }
755 }
756 
757 void ortho_v2_v2(float out[2], const float v[2])
758 {
759  BLI_assert(out != v);
760 
761  out[0] = -v[1];
762  out[1] = v[0];
763 }
764 
765 void rotate_v2_v2fl(float r[2], const float p[2], const float angle)
766 {
767  const float co = cosf(angle);
768  const float si = sinf(angle);
769 
770  BLI_assert(r != p);
771 
772  r[0] = co * p[0] - si * p[1];
773  r[1] = si * p[0] + co * p[1];
774 }
775 
777  const float p[3],
778  const float axis[3],
779  const float angle)
780 {
781  const float costheta = cosf(angle);
782  const float sintheta = sinf(angle);
783 
784  /* double check they are normalized */
785  BLI_ASSERT_UNIT_V3(axis);
786 
787  out[0] = ((costheta + (1 - costheta) * axis[0] * axis[0]) * p[0]) +
788  (((1 - costheta) * axis[0] * axis[1] - axis[2] * sintheta) * p[1]) +
789  (((1 - costheta) * axis[0] * axis[2] + axis[1] * sintheta) * p[2]);
790 
791  out[1] = (((1 - costheta) * axis[0] * axis[1] + axis[2] * sintheta) * p[0]) +
792  ((costheta + (1 - costheta) * axis[1] * axis[1]) * p[1]) +
793  (((1 - costheta) * axis[1] * axis[2] - axis[0] * sintheta) * p[2]);
794 
795  out[2] = (((1 - costheta) * axis[0] * axis[2] - axis[1] * sintheta) * p[0]) +
796  (((1 - costheta) * axis[1] * axis[2] + axis[0] * sintheta) * p[1]) +
797  ((costheta + (1 - costheta) * axis[2] * axis[2]) * p[2]);
798 }
799 
800 void rotate_v3_v3v3fl(float r[3], const float p[3], const float axis[3], const float angle)
801 {
802  BLI_assert(r != p);
803 
804  float axis_n[3];
805 
806  normalize_v3_v3(axis_n, axis);
807 
808  rotate_normalized_v3_v3v3fl(r, p, axis_n, angle);
809 }
810 
811 /*********************************** Other ***********************************/
812 
813 void print_v2(const char *str, const float v[2])
814 {
815  printf("%s: %.8f %.8f\n", str, v[0], v[1]);
816 }
817 
818 void print_v3(const char *str, const float v[3])
819 {
820  printf("%s: %.8f %.8f %.8f\n", str, v[0], v[1], v[2]);
821 }
822 
823 void print_v4(const char *str, const float v[4])
824 {
825  printf("%s: %.8f %.8f %.8f %.8f\n", str, v[0], v[1], v[2], v[3]);
826 }
827 
828 void print_vn(const char *str, const float v[], const int n)
829 {
830  int i = 0;
831  printf("%s[%d]:", str, n);
832  while (i < n) {
833  printf(" %.8f", v[i++]);
834  }
835  printf("\n");
836 }
837 
838 void minmax_v4v4_v4(float min[4], float max[4], const float vec[4])
839 {
840  if (min[0] > vec[0]) {
841  min[0] = vec[0];
842  }
843  if (min[1] > vec[1]) {
844  min[1] = vec[1];
845  }
846  if (min[2] > vec[2]) {
847  min[2] = vec[2];
848  }
849  if (min[3] > vec[3]) {
850  min[3] = vec[3];
851  }
852 
853  if (max[0] < vec[0]) {
854  max[0] = vec[0];
855  }
856  if (max[1] < vec[1]) {
857  max[1] = vec[1];
858  }
859  if (max[2] < vec[2]) {
860  max[2] = vec[2];
861  }
862  if (max[3] < vec[3]) {
863  max[3] = vec[3];
864  }
865 }
866 
867 void minmax_v3v3_v3(float min[3], float max[3], const float vec[3])
868 {
869  if (min[0] > vec[0]) {
870  min[0] = vec[0];
871  }
872  if (min[1] > vec[1]) {
873  min[1] = vec[1];
874  }
875  if (min[2] > vec[2]) {
876  min[2] = vec[2];
877  }
878 
879  if (max[0] < vec[0]) {
880  max[0] = vec[0];
881  }
882  if (max[1] < vec[1]) {
883  max[1] = vec[1];
884  }
885  if (max[2] < vec[2]) {
886  max[2] = vec[2];
887  }
888 }
889 
890 void minmax_v2v2_v2(float min[2], float max[2], const float vec[2])
891 {
892  if (min[0] > vec[0]) {
893  min[0] = vec[0];
894  }
895  if (min[1] > vec[1]) {
896  min[1] = vec[1];
897  }
898 
899  if (max[0] < vec[0]) {
900  max[0] = vec[0];
901  }
902  if (max[1] < vec[1]) {
903  max[1] = vec[1];
904  }
905 }
906 
907 void minmax_v3v3_v3_array(float r_min[3],
908  float r_max[3],
909  const float (*vec_arr)[3],
910  int var_arr_num)
911 {
912  while (var_arr_num--) {
913  minmax_v3v3_v3(r_min, r_max, *vec_arr++);
914  }
915 }
916 
917 void dist_ensure_v3_v3fl(float v1[3], const float v2[3], const float dist)
918 {
919  if (!equals_v3v3(v2, v1)) {
920  float nor[3];
921 
922  sub_v3_v3v3(nor, v1, v2);
923  normalize_v3(nor);
924  madd_v3_v3v3fl(v1, v2, nor, dist);
925  }
926 }
927 
928 void dist_ensure_v2_v2fl(float v1[2], const float v2[2], const float dist)
929 {
930  if (!equals_v2v2(v2, v1)) {
931  float nor[2];
932 
933  sub_v2_v2v2(nor, v1, v2);
934  normalize_v2(nor);
935  madd_v2_v2v2fl(v1, v2, nor, dist);
936  }
937 }
938 
939 void axis_sort_v3(const float axis_values[3], int r_axis_order[3])
940 {
941  float v[3];
942  copy_v3_v3(v, axis_values);
943 
944 #define SWAP_AXIS(a, b) \
945  { \
946  SWAP(float, v[a], v[b]); \
947  SWAP(int, r_axis_order[a], r_axis_order[b]); \
948  } \
949  (void)0
950 
951  if (v[0] < v[1]) {
952  if (v[2] < v[0]) {
953  SWAP_AXIS(0, 2);
954  }
955  }
956  else {
957  if (v[1] < v[2]) {
958  SWAP_AXIS(0, 1);
959  }
960  else {
961  SWAP_AXIS(0, 2);
962  }
963  }
964  if (v[2] < v[1]) {
965  SWAP_AXIS(1, 2);
966  }
967 
968 #undef SWAP_AXIS
969 }
970 
971 /***************************** Array Functions *******************************/
972 
973 MINLINE double sqr_db(double f)
974 {
975  return f * f;
976 }
977 
978 double dot_vn_vn(const float *array_src_a, const float *array_src_b, const int size)
979 {
980  double d = 0.0f;
981  const float *array_pt_a = array_src_a + (size - 1);
982  const float *array_pt_b = array_src_b + (size - 1);
983  int i = size;
984  while (i--) {
985  d += (double)(*(array_pt_a--) * *(array_pt_b--));
986  }
987  return d;
988 }
989 
990 double len_squared_vn(const float *array, const int size)
991 {
992  double d = 0.0f;
993  const float *array_pt = array + (size - 1);
994  int i = size;
995  while (i--) {
996  d += sqr_db((double)(*(array_pt--)));
997  }
998  return d;
999 }
1000 
1001 float normalize_vn_vn(float *array_tar, const float *array_src, const int size)
1002 {
1003  const double d = len_squared_vn(array_src, size);
1004  float d_sqrt;
1005  if (d > 1.0e-35) {
1006  d_sqrt = (float)sqrt(d);
1007  mul_vn_vn_fl(array_tar, array_src, size, 1.0f / d_sqrt);
1008  }
1009  else {
1010  copy_vn_fl(array_tar, size, 0.0f);
1011  d_sqrt = 0.0f;
1012  }
1013  return d_sqrt;
1014 }
1015 
1016 float normalize_vn(float *array_tar, const int size)
1017 {
1018  return normalize_vn_vn(array_tar, array_tar, size);
1019 }
1020 
1021 void range_vn_i(int *array_tar, const int size, const int start)
1022 {
1023  int *array_pt = array_tar + (size - 1);
1024  int j = start + (size - 1);
1025  int i = size;
1026  while (i--) {
1027  *(array_pt--) = j--;
1028  }
1029 }
1030 
1031 void range_vn_u(uint *array_tar, const int size, const uint start)
1032 {
1033  uint *array_pt = array_tar + (size - 1);
1034  uint j = start + (uint)(size - 1);
1035  int i = size;
1036  while (i--) {
1037  *(array_pt--) = j--;
1038  }
1039 }
1040 
1041 void range_vn_fl(float *array_tar, const int size, const float start, const float step)
1042 {
1043  float *array_pt = array_tar + (size - 1);
1044  int i = size;
1045  while (i--) {
1046  *(array_pt--) = start + step * (float)(i);
1047  }
1048 }
1049 
1050 void negate_vn(float *array_tar, const int size)
1051 {
1052  float *array_pt = array_tar + (size - 1);
1053  int i = size;
1054  while (i--) {
1055  *(array_pt--) *= -1.0f;
1056  }
1057 }
1058 
1059 void negate_vn_vn(float *array_tar, const float *array_src, const int size)
1060 {
1061  float *tar = array_tar + (size - 1);
1062  const float *src = array_src + (size - 1);
1063  int i = size;
1064  while (i--) {
1065  *(tar--) = -*(src--);
1066  }
1067 }
1068 
1069 void mul_vn_vn(float *array_tar, const float *array_src, const int size)
1070 {
1071  float *tar = array_tar + (size - 1);
1072  const float *src = array_src + (size - 1);
1073  int i = size;
1074  while (i--) {
1075  *(tar--) *= *(src--);
1076  }
1077 }
1078 
1079 void mul_vn_vnvn(float *array_tar,
1080  const float *array_src_a,
1081  const float *array_src_b,
1082  const int size)
1083 {
1084  float *tar = array_tar + (size - 1);
1085  const float *src_a = array_src_a + (size - 1);
1086  const float *src_b = array_src_b + (size - 1);
1087  int i = size;
1088  while (i--) {
1089  *(tar--) = *(src_a--) * *(src_b--);
1090  }
1091 }
1092 
1093 void mul_vn_fl(float *array_tar, const int size, const float f)
1094 {
1095  float *array_pt = array_tar + (size - 1);
1096  int i = size;
1097  while (i--) {
1098  *(array_pt--) *= f;
1099  }
1100 }
1101 
1102 void mul_vn_vn_fl(float *array_tar, const float *array_src, const int size, const float f)
1103 {
1104  float *tar = array_tar + (size - 1);
1105  const float *src = array_src + (size - 1);
1106  int i = size;
1107  while (i--) {
1108  *(tar--) = *(src--) * f;
1109  }
1110 }
1111 
1112 void add_vn_vn(float *array_tar, const float *array_src, const int size)
1113 {
1114  float *tar = array_tar + (size - 1);
1115  const float *src = array_src + (size - 1);
1116  int i = size;
1117  while (i--) {
1118  *(tar--) += *(src--);
1119  }
1120 }
1121 
1122 void add_vn_vnvn(float *array_tar,
1123  const float *array_src_a,
1124  const float *array_src_b,
1125  const int size)
1126 {
1127  float *tar = array_tar + (size - 1);
1128  const float *src_a = array_src_a + (size - 1);
1129  const float *src_b = array_src_b + (size - 1);
1130  int i = size;
1131  while (i--) {
1132  *(tar--) = *(src_a--) + *(src_b--);
1133  }
1134 }
1135 
1136 void madd_vn_vn(float *array_tar, const float *array_src, const float f, const int size)
1137 {
1138  float *tar = array_tar + (size - 1);
1139  const float *src = array_src + (size - 1);
1140  int i = size;
1141  while (i--) {
1142  *(tar--) += *(src--) * f;
1143  }
1144 }
1145 
1146 void madd_vn_vnvn(float *array_tar,
1147  const float *array_src_a,
1148  const float *array_src_b,
1149  const float f,
1150  const int size)
1151 {
1152  float *tar = array_tar + (size - 1);
1153  const float *src_a = array_src_a + (size - 1);
1154  const float *src_b = array_src_b + (size - 1);
1155  int i = size;
1156  while (i--) {
1157  *(tar--) = *(src_a--) + (*(src_b--) * f);
1158  }
1159 }
1160 
1161 void sub_vn_vn(float *array_tar, const float *array_src, const int size)
1162 {
1163  float *tar = array_tar + (size - 1);
1164  const float *src = array_src + (size - 1);
1165  int i = size;
1166  while (i--) {
1167  *(tar--) -= *(src--);
1168  }
1169 }
1170 
1171 void sub_vn_vnvn(float *array_tar,
1172  const float *array_src_a,
1173  const float *array_src_b,
1174  const int size)
1175 {
1176  float *tar = array_tar + (size - 1);
1177  const float *src_a = array_src_a + (size - 1);
1178  const float *src_b = array_src_b + (size - 1);
1179  int i = size;
1180  while (i--) {
1181  *(tar--) = *(src_a--) - *(src_b--);
1182  }
1183 }
1184 
1185 void msub_vn_vn(float *array_tar, const float *array_src, const float f, const int size)
1186 {
1187  float *tar = array_tar + (size - 1);
1188  const float *src = array_src + (size - 1);
1189  int i = size;
1190  while (i--) {
1191  *(tar--) -= *(src--) * f;
1192  }
1193 }
1194 
1195 void msub_vn_vnvn(float *array_tar,
1196  const float *array_src_a,
1197  const float *array_src_b,
1198  const float f,
1199  const int size)
1200 {
1201  float *tar = array_tar + (size - 1);
1202  const float *src_a = array_src_a + (size - 1);
1203  const float *src_b = array_src_b + (size - 1);
1204  int i = size;
1205  while (i--) {
1206  *(tar--) = *(src_a--) - (*(src_b--) * f);
1207  }
1208 }
1209 
1210 void interp_vn_vn(float *array_tar, const float *array_src, const float t, const int size)
1211 {
1212  const float s = 1.0f - t;
1213  float *tar = array_tar + (size - 1);
1214  const float *src = array_src + (size - 1);
1215  int i = size;
1216  while (i--) {
1217  *(tar) = (s * *(tar)) + (t * *(src));
1218  tar--;
1219  src--;
1220  }
1221 }
1222 
1223 void copy_vn_i(int *array_tar, const int size, const int val)
1224 {
1225  int *tar = array_tar + (size - 1);
1226  int i = size;
1227  while (i--) {
1228  *(tar--) = val;
1229  }
1230 }
1231 
1232 void copy_vn_short(short *array_tar, const int size, const short val)
1233 {
1234  short *tar = array_tar + (size - 1);
1235  int i = size;
1236  while (i--) {
1237  *(tar--) = val;
1238  }
1239 }
1240 
1241 void copy_vn_ushort(ushort *array_tar, const int size, const ushort val)
1242 {
1243  ushort *tar = array_tar + (size - 1);
1244  int i = size;
1245  while (i--) {
1246  *(tar--) = val;
1247  }
1248 }
1249 
1250 void copy_vn_uchar(uchar *array_tar, const int size, const uchar val)
1251 {
1252  uchar *tar = array_tar + (size - 1);
1253  int i = size;
1254  while (i--) {
1255  *(tar--) = val;
1256  }
1257 }
1258 
1259 void copy_vn_fl(float *array_tar, const int size, const float val)
1260 {
1261  float *tar = array_tar + (size - 1);
1262  int i = size;
1263  while (i--) {
1264  *(tar--) = val;
1265  }
1266 }
1267 
1268 /* -------------------------------------------------------------------- */
1272 void add_vn_vn_d(double *array_tar, const double *array_src, const int size)
1273 {
1274  double *tar = array_tar + (size - 1);
1275  const double *src = array_src + (size - 1);
1276  int i = size;
1277  while (i--) {
1278  *(tar--) += *(src--);
1279  }
1280 }
1281 
1282 void add_vn_vnvn_d(double *array_tar,
1283  const double *array_src_a,
1284  const double *array_src_b,
1285  const int size)
1286 {
1287  double *tar = array_tar + (size - 1);
1288  const double *src_a = array_src_a + (size - 1);
1289  const double *src_b = array_src_b + (size - 1);
1290  int i = size;
1291  while (i--) {
1292  *(tar--) = *(src_a--) + *(src_b--);
1293  }
1294 }
1295 
1296 void mul_vn_db(double *array_tar, const int size, const double f)
1297 {
1298  double *array_pt = array_tar + (size - 1);
1299  int i = size;
1300  while (i--) {
1301  *(array_pt--) *= f;
1302  }
1303 }
1304 
1305 void interp_v3_v3v3_db(double target[3], const double a[3], const double b[3], const double t)
1306 {
1307  const double s = 1.0f - t;
1308 
1309  target[0] = s * a[0] + t * b[0];
1310  target[1] = s * a[1] + t * b[1];
1311  target[2] = s * a[2] + t * b[2];
1312 }
1313 
1314 void interp_v2_v2v2_db(double target[2], const double a[2], const double b[2], const double t)
1315 {
1316  const double s = 1.0f - t;
1317 
1318  target[0] = s * a[0] + t * b[0];
1319  target[1] = s * a[1] + t * b[1];
1320 }
1321 
typedef float(TangentPoint)[2]
#define BLI_assert(a)
Definition: BLI_assert.h:46
sqrt(x)+1/max(0
#define BLI_ASSERT_UNIT_V3_DB(v)
#define BLI_ASSERT_UNIT_V2(v)
MINLINE float saasin(float fac)
#define BLI_ASSERT_UNIT_V3(v)
#define M_PI
Definition: BLI_math_base.h:20
MINLINE int axis_dominant_v3_single(const float vec[3])
#define MINLINE
void interp_dot_slerp(float t, float cosom, float r_w[2])
MINLINE bool is_zero_v3_db(const double a[3]) ATTR_WARN_UNUSED_RESULT
MINLINE float len_squared_v2(const float v[2]) ATTR_WARN_UNUSED_RESULT
MINLINE float len_squared_v3(const float v[3]) ATTR_WARN_UNUSED_RESULT
MINLINE float len_v3v3(const float a[3], const float b[3]) ATTR_WARN_UNUSED_RESULT
MINLINE void madd_v3_v3fl(float r[3], const float a[3], float f)
MINLINE void madd_v2_v2v2fl(float r[2], const float a[2], const float b[2], float f)
MINLINE void madd_v3_v3v3db_db(double r[3], const double a[3], const double b[3], double f)
MINLINE float normalize_v3(float r[3])
MINLINE void sub_v3_v3v3(float r[3], const float a[3], const float b[3])
MINLINE void copy_v2_v2(float r[2], const float a[2])
MINLINE void mul_v3_fl(float r[3], float f)
MINLINE void mul_v3_v3db_db(double r[3], const double a[3], double f)
MINLINE void copy_v3_v3(float r[3], const float a[3])
MINLINE void negate_v3_v3(float r[3], const float a[3])
MINLINE double dot_v3v3_db(const double a[3], const double b[3]) ATTR_WARN_UNUSED_RESULT
MINLINE bool is_zero_v3(const float a[3]) ATTR_WARN_UNUSED_RESULT
MINLINE float dot_v3v3(const float a[3], const float b[3]) ATTR_WARN_UNUSED_RESULT
MINLINE void negate_v2_v2(float r[2], const float a[2])
MINLINE void add_v3_v3v3(float r[3], const float a[3], const float b[3])
MINLINE void cross_v3_v3v3(float r[3], const float a[3], const float b[3])
MINLINE bool equals_v2v2(const float v1[2], const float v2[2]) ATTR_WARN_UNUSED_RESULT
MINLINE float normalize_v3_v3(float r[3], const float a[3])
MINLINE void sub_v2_v2v2(float r[2], const float a[2], const float b[2])
MINLINE void zero_v2(float r[2])
MINLINE float dot_v2v2(const float a[2], const float b[2]) ATTR_WARN_UNUSED_RESULT
MINLINE bool equals_v3v3(const float a[3], const float b[3]) ATTR_WARN_UNUSED_RESULT
MINLINE bool is_zero_v2(const float a[2]) ATTR_WARN_UNUSED_RESULT
MINLINE void madd_v3_v3v3fl(float r[3], const float a[3], const float b[3], float f)
MINLINE float len_v2v2(const float a[2], const float b[2]) ATTR_WARN_UNUSED_RESULT
MINLINE void zero_v3(float r[3])
MINLINE void mul_v3_v3fl(float r[3], const float a[3], float f)
MINLINE float normalize_v2(float r[2])
MINLINE void mul_v2_v2fl(float r[2], const float a[2], float f)
MINLINE void zero_v3_db(double r[3])
Strict compiler flags for areas of code we want to ensure don't do conversions without us knowing abo...
unsigned char uchar
Definition: BLI_sys_types.h:70
unsigned int uint
Definition: BLI_sys_types.h:67
unsigned short ushort
Definition: BLI_sys_types.h:68
#define UNLIKELY(x)
typedef double(DMatrix)[4][4]
_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
ATTR_WARN_UNUSED_RESULT const BMVert * v2
ATTR_WARN_UNUSED_RESULT const BMVert * v
static DBVT_INLINE btScalar size(const btDbvtVolume &a)
Definition: btDbvt.cpp:52
SIMD_FORCE_INLINE const btScalar & w() const
Return the w value.
Definition: btQuadWord.h:119
static void mul(btAlignedObjectArray< T > &items, const Q &value)
SIMD_FORCE_INLINE btScalar angle(const btVector3 &v) const
Return the angle between this and another vector.
Definition: btVector3.h:356
#define sinf(x)
Definition: cuda/compat.h:102
#define cosf(x)
Definition: cuda/compat.h:101
SyclQueue void void * src
int len
Definition: draw_manager.c:108
#define str(s)
static float verts[][3]
uint nor
IconTextureDrawCall normal
void mid_v3_v3v3v3v3(float v[3], const float v1[3], const float v2[3], const float v3[3], const float v4[3])
Definition: math_vector.c:263
void copy_vn_fl(float *array_tar, const int size, const float val)
Definition: math_vector.c:1259
void project_v2_v2v2_normalized(float out[2], const float p[2], const float v_proj[2])
Definition: math_vector.c:622
void madd_vn_vn(float *array_tar, const float *array_src, const float f, const int size)
Definition: math_vector.c:1136
void add_vn_vn_d(double *array_tar, const double *array_src, const int size)
Definition: math_vector.c:1272
void minmax_v3v3_v3_array(float r_min[3], float r_max[3], const float(*vec_arr)[3], int var_arr_num)
Definition: math_vector.c:907
void negate_vn(float *array_tar, const int size)
Definition: math_vector.c:1050
void interp_v2_v2v2(float r[2], const float a[2], const float b[2], const float t)
Definition: math_vector.c:14
void reflect_v3_v3v3_db(double out[3], const double v[3], const double normal[3])
Definition: math_vector.c:699
void angle_quad_v3(float angles[4], const float v1[3], const float v2[3], const float v3[3], const float v4[3])
Definition: math_vector.c:552
void axis_sort_v3(const float axis_values[3], int r_axis_order[3])
Definition: math_vector.c:939
void interp_v3_v3v3(float r[3], const float a[3], const float b[3], const float t)
Definition: math_vector.c:29
void sub_vn_vn(float *array_tar, const float *array_src, const int size)
Definition: math_vector.c:1161
void mul_vn_db(double *array_tar, const int size, const double f)
Definition: math_vector.c:1296
void minmax_v3v3_v3(float min[3], float max[3], const float vec[3])
Definition: math_vector.c:867
void rotate_v2_v2fl(float r[2], const float p[2], const float angle)
Definition: math_vector.c:765
void mul_vn_vn_fl(float *array_tar, const float *array_src, const int size, const float f)
Definition: math_vector.c:1102
void copy_vn_i(int *array_tar, const int size, const int val)
Definition: math_vector.c:1223
void print_v3(const char *str, const float v[3])
Definition: math_vector.c:818
void madd_vn_vnvn(float *array_tar, const float *array_src_a, const float *array_src_b, const float f, const int size)
Definition: math_vector.c:1146
bool is_finite_v2(const float v[2])
Definition: math_vector.c:344
void project_plane_normalized_v2_v2v2(float out[2], const float p[2], const float v_plane[2])
Definition: math_vector.c:660
void interp_v4_v4v4_char(char target[4], const char a[4], const char b[4], const float t)
Definition: math_vector.c:232
float angle_on_axis_v3v3_v3(const float v1[3], const float v2[3], const float axis[3])
Definition: math_vector.c:477
float normalize_vn(float *array_tar, const int size)
Definition: math_vector.c:1016
float angle_v3v3v3(const float a[3], const float b[3], const float c[3])
Definition: math_vector.c:361
void reflect_v3_v3v3(float out[3], const float v[3], const float normal[3])
Definition: math_vector.c:691
bool is_finite_v4(const float v[4])
Definition: math_vector.c:354
void interp_v3_v3v3v3(float p[3], const float v1[3], const float v2[3], const float v3[3], const float w[3])
Definition: math_vector.c:160
float angle_normalized_v3v3(const float v1[3], const float v2[3])
Definition: math_vector.c:445
void interp_v4_v4v4v4v4(float p[4], const float v1[4], const float v2[4], const float v3[4], const float v4[4], const float w[4])
Definition: math_vector.c:189
#define SWAP_AXIS(a, b)
void sub_vn_vnvn(float *array_tar, const float *array_src_a, const float *array_src_b, const int size)
Definition: math_vector.c:1171
void interp_v3_v3v3_db(double target[3], const double a[3], const double b[3], const double t)
Definition: math_vector.c:1305
double dot_vn_vn(const float *array_src_a, const float *array_src_b, const int size)
Definition: math_vector.c:978
void angle_tri_v3(float angles[3], const float v1[3], const float v2[3], const float v3[3])
Definition: math_vector.c:534
void add_vn_vnvn(float *array_tar, const float *array_src_a, const float *array_src_b, const int size)
Definition: math_vector.c:1122
void interp_v3_v3v3_char(char target[3], const char a[3], const char b[3], const float t)
Definition: math_vector.c:218
void mid_v3_angle_weighted(float r[3])
Definition: math_vector.c:299
float angle_v3v3(const float a[3], const float b[3])
Definition: math_vector.c:385
void interp_v4_v4v4(float r[4], const float a[4], const float b[4], const float t)
Definition: math_vector.c:38
void mid_v2_v2v2v2(float v[2], const float v1[2], const float v2[2], const float v3[2])
Definition: math_vector.c:250
void project_v3_plane(float out[3], const float plane_no[3], const float plane_co[3])
Definition: math_vector.c:668
float cos_v3v3v3(const float p1[3], const float p2[3], const float p3[3])
Definition: math_vector.c:373
void add_vn_vn(float *array_tar, const float *array_src, const int size)
Definition: math_vector.c:1112
void project_v3_v3v3_normalized(float out[3], const float p[3], const float v_proj[3])
Definition: math_vector.c:630
void interp_v2_v2v2v2(float r[2], const float a[2], const float b[2], const float c[2], const float t[3])
Definition: math_vector.c:22
void print_v4(const char *str, const float v[4])
Definition: math_vector.c:823
bool interp_v3_v3v3_slerp(float target[3], const float a[3], const float b[3], const float t)
Definition: math_vector.c:48
float normalize_vn_vn(float *array_tar, const float *array_src, const int size)
Definition: math_vector.c:1001
bool is_finite_v3(const float v[3])
Definition: math_vector.c:349
void negate_vn_vn(float *array_tar, const float *array_src, const int size)
Definition: math_vector.c:1059
void project_v3_v3v3(float out[3], const float p[3], const float v_proj[3])
Definition: math_vector.c:600
void minmax_v2v2_v2(float min[2], float max[2], const float vec[2])
Definition: math_vector.c:890
void project_plane_v3_v3v3(float out[3], const float p[3], const float v_plane[3])
Definition: math_vector.c:638
void interp_v3_v3v3_slerp_safe(float target[3], const float a[3], const float b[3], const float t)
Definition: math_vector.c:92
void copy_vn_short(short *array_tar, const int size, const short val)
Definition: math_vector.c:1232
void project_plane_normalized_v3_v3v3(float out[3], const float p[3], const float v_plane[3])
Definition: math_vector.c:652
void msub_vn_vnvn(float *array_tar, const float *array_src_a, const float *array_src_b, const float f, const int size)
Definition: math_vector.c:1195
void interp_v3_v3v3_uchar(uchar target[3], const uchar a[3], const uchar b[3], const float t)
Definition: math_vector.c:210
void print_v2(const char *str, const float v[2])
Definition: math_vector.c:813
void mid_v3_v3v3_angle_weighted(float r[3], const float a[3], const float b[3])
Definition: math_vector.c:281
void rotate_v3_v3v3fl(float r[3], const float p[3], const float axis[3], const float angle)
Definition: math_vector.c:800
void ortho_v3_v3(float out[3], const float v[3])
Definition: math_vector.c:732
float angle_v2v2(const float a[2], const float b[2])
Definition: math_vector.c:423
void interp_v2_v2v2_db(double target[2], const double a[2], const double b[2], const double t)
Definition: math_vector.c:1314
void interp_v4_v4v4v4(float p[4], const float v1[4], const float v2[4], const float v3[4], const float w[3])
Definition: math_vector.c:180
void flip_v2_v2v2(float v[2], const float v1[2], const float v2[2])
Definition: math_vector.c:336
float cos_v2v2v2(const float p1[2], const float p2[2], const float p3[2])
Definition: math_vector.c:411
void print_vn(const char *str, const float v[], const int n)
Definition: math_vector.c:828
void interp_v3_v3v3v3v3(float p[3], const float v1[3], const float v2[3], const float v3[3], const float v4[3], const float w[4])
Definition: math_vector.c:168
void minmax_v4v4_v4(float min[4], float max[4], const float vec[4])
Definition: math_vector.c:838
void dist_ensure_v2_v2fl(float v1[2], const float v2[2], const float dist)
Definition: math_vector.c:928
void mid_v2_v2v2(float r[2], const float a[2], const float b[2])
Definition: math_vector.c:244
void range_vn_u(uint *array_tar, const int size, const uint start)
Definition: math_vector.c:1031
void interp_v4_v4v4_uchar(uchar target[4], const uchar a[4], const uchar b[4], const float t)
Definition: math_vector.c:223
void ortho_v2_v2(float out[2], const float v[2])
Definition: math_vector.c:757
void mul_vn_vnvn(float *array_tar, const float *array_src_a, const float *array_src_b, const int size)
Definition: math_vector.c:1079
void interp_v2_v2v2_slerp_safe(float target[2], const float a[2], const float b[2], const float t)
Definition: math_vector.c:113
void angle_poly_v3(float *angles, const float *verts[3], int len)
Definition: math_vector.c:573
void range_vn_fl(float *array_tar, const int size, const float start, const float step)
Definition: math_vector.c:1041
void interp_vn_vn(float *array_tar, const float *array_src, const float t, const int size)
Definition: math_vector.c:1210
double len_squared_vn(const float *array, const int size)
Definition: math_vector.c:990
void mid_v3_v3v3(float r[3], const float a[3], const float b[3])
Definition: math_vector.c:237
void ortho_basis_v3v3_v3(float r_n1[3], float r_n2[3], const float n[3])
Definition: math_vector.c:707
void mul_vn_vn(float *array_tar, const float *array_src, const int size)
Definition: math_vector.c:1069
void msub_vn_vn(float *array_tar, const float *array_src, const float f, const int size)
Definition: math_vector.c:1185
void add_vn_vnvn_d(double *array_tar, const double *array_src_a, const double *array_src_b, const int size)
Definition: math_vector.c:1282
void mid_v3_v3_array(float r[3], const float(*vec_arr)[3], const uint vec_arr_num)
Definition: math_vector.c:271
void range_vn_i(int *array_tar, const int size, const int start)
Definition: math_vector.c:1021
void flip_v4_v4v4(float v[4], const float v1[4], const float v2[4])
Definition: math_vector.c:321
void flip_v3_v3v3(float v[3], const float v1[3], const float v2[3])
Definition: math_vector.c:329
void project_plane_v2_v2v2(float out[2], const float p[2], const float v_plane[2])
Definition: math_vector.c:645
float angle_v2v2v2(const float a[2], const float b[2], const float c[2])
Definition: math_vector.c:395
float angle_normalized_v2v2(const float a[2], const float b[2])
Definition: math_vector.c:461
bool interp_v2_v2v2_slerp(float target[2], const float a[2], const float b[2], const float t)
Definition: math_vector.c:70
void dist_ensure_v3_v3fl(float v1[3], const float v2[3], const float dist)
Definition: math_vector.c:917
void project_v3_v3v3_db(double out[3], const double p[3], const double v_proj[3])
Definition: math_vector.c:611
float angle_on_axis_v3v3v3_v3(const float v1[3], const float v2[3], const float v3[3], const float axis[3])
Definition: math_vector.c:508
void mul_vn_fl(float *array_tar, const int size, const float f)
Definition: math_vector.c:1093
void copy_vn_uchar(uchar *array_tar, const int size, const uchar val)
Definition: math_vector.c:1250
void interp_v3_v3v3v3_uv(float p[3], const float v1[3], const float v2[3], const float v3[3], const float uv[2])
Definition: math_vector.c:202
float angle_signed_on_axis_v3v3v3_v3(const float v1[3], const float v2[3], const float v3[3], const float axis[3])
Definition: math_vector.c:521
void rotate_normalized_v3_v3v3fl(float out[3], const float p[3], const float axis[3], const float angle)
Definition: math_vector.c:776
MINLINE double sqr_db(double f)
Definition: math_vector.c:973
float angle_signed_on_axis_v3v3_v3(const float v1[3], const float v2[3], const float axis[3])
Definition: math_vector.c:488
void mid_v3_v3v3v3(float v[3], const float v1[3], const float v2[3], const float v3[3])
Definition: math_vector.c:256
void interp_v2_v2v2v2v2_cubic(float p[2], const float v1[2], const float v2[2], const float v3[2], const float v4[2], const float u)
Definition: math_vector.c:139
void project_v2_v2v2(float out[2], const float p[2], const float v_proj[2])
Definition: math_vector.c:589
void bisect_v3_v3v3v3(float r[3], const float a[3], const float b[3], const float c[3])
Definition: math_vector.c:680
void copy_vn_ushort(ushort *array_tar, const int size, const ushort val)
Definition: math_vector.c:1241
float angle_signed_v2v2(const float v1[2], const float v2[2])
Definition: math_vector.c:439
#define atan2f(x, y)
Definition: metal/compat.h:227
#define floorf(x)
Definition: metal/compat.h:224
#define acosf(x)
Definition: metal/compat.h:222
#define sqrtf(x)
Definition: metal/compat.h:243
bool isfinite(uchar)
Definition: scene/image.cpp:31
static unsigned c
Definition: RandGen.cpp:83
static unsigned a[3]
Definition: RandGen.cpp:78
static const pxr::TfToken out("out", pxr::TfToken::Immortal)
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