24template<
typename T,
int Size>
27 const T &epsilon_factor)
29 for (
int i = 0;
i < Size;
i++) {
30 const float epsilon = epsilon_factor *
math::abs(a[
i]);
41 for (
int i = 0;
i < Size;
i++) {
50template<
typename T,
int Size>
56template<
typename T,
int Size>
65template<
typename T,
int Size>
81template<
typename T,
int Size>
87template<
typename T,
int Size>
96template<
typename T,
int Size>
112template<
typename T,
int Size>
118template<
typename T,
int Size>
124 for (
int i = 0;
i < Size;
i++) {
130template<
typename T,
int Size>
134 for (
int i = 0;
i < Size;
i++) {
140template<
typename T,
int Size>
147template<
typename T,
int Size>
151 for (
int i = 0;
i < Size;
i++) {
157template<
typename T,
int Size>
163template<
typename T,
int Size>
168 for (
int i = 0;
i < Size;
i++) {
177template<
typename T,
int Size>
187template<
typename T,
int Size>
194 for (
int i = 0;
i < Size;
i++) {
204template<
typename T,
int Size>
208 for (
int i = 0;
i < Size;
i++) {
218template<
typename T,
int Size>
222 for (
int i = 0;
i < Size;
i++) {
232template<
typename T,
int Size>
238 for (
int i = 0;
i < Size;
i++) {
248template<
typename T,
int Size>
255template<
typename T,
int Size>
272template<
typename T,
int Size>
277 for (
int i = 0;
i < Size;
i++) {
289template<
typename T,
int Size>
294 for (
int i = 0;
i < Size;
i++) {
302template<
typename T,
int Size>
312template<
typename T,
int Size>
322template<
typename T,
int Size>
328template<
typename T,
int Size>
334template<
typename T,
int Size>
340template<
typename T,
int Size>
350template<
typename T,
int Size>
360template<
typename T,
int Size>
364 for (
int i = 0;
i < Size;
i++) {
365 result[
i] = a[
i] >=
T(0) ? math ::sqrt(a[
i]) :
T(0);
383template<
typename T,
int Size>
389template<
typename T,
int Size>
401template<
typename T,
int Size>
405 for (
int i = 1;
i < Size;
i++) {
417 for (
int i = 1;
i < Size;
i++) {
444template<
typename T,
int Size>
450template<
typename T,
int Size>
456template<
typename T,
int Size>
462template<
typename T,
int Size>
467 return incident - 2.0 *
dot(normal, incident) * normal;
470template<
typename T,
int Size>
475 float dot_ni =
dot(normal, incident);
476 float k = 1.0f - eta * eta * (1.0f - dot_ni * dot_ni);
480 return eta * incident - (eta * dot_ni +
sqrt(k)) * normal;
487template<
typename T,
int Size>
494 return v_proj * (
dot(p, v_proj) /
dot(v_proj, v_proj));
497template<
typename T,
int Size>
503 constexpr T threshold = std::is_same_v<T, double> ? 1.0e-70 : 1.0e-35f;
504 if (out_length > threshold) {
505 out_length =
sqrt(out_length);
506 return v / out_length;
513template<
typename T,
int Size>
531 return {a.y *
b.z - a.z *
b.y, a.z *
b.x - a.x *
b.z, a.x *
b.y - a.y *
b.x};
540 return {float(
double(a.y) *
double(
b.z) -
double(a.z) *
double(
b.y)),
541 float(
double(a.z) *
double(
b.x) -
double(a.x) *
double(
b.z)),
542 float(
double(a.x) *
double(
b.y) -
double(a.y) *
double(
b.x))};
553 int nv = int(poly.size());
560 for (
int i = 0;
i < nv;) {
561 n[0] = n[0] + ((*v_prev)[1] - (*v_curr)[1]) * ((*v_prev)[2] + (*v_curr)[2]);
562 n[1] = n[1] + ((*v_prev)[2] - (*v_curr)[2]) * ((*v_prev)[0] + (*v_curr)[0]);
563 n[2] = n[2] + ((*v_prev)[0] - (*v_curr)[0]) * ((*v_prev)[1] + (*v_curr)[1]);
602template<
typename T,
typename FactorT,
int Size>
607 return a * (1 - t) +
b * t;
613template<
typename T,
int Size>
617 return (a +
b) * 0.5;
623template<
typename T,
int Size>
637 return ((
b.x >
b.y) ? ((
b.x >
b.z) ? 0 : 2) : ((
b.y >
b.z) ? 1 : 2));
646 for (
int i = 1;
i < Size;
i++) {
660 for (
int i = 1;
i < Size;
i++) {
674 for (
int i = 1;
i < Size;
i++) {
686 for (
int i = 1;
i < Size;
i++) {
710 return {-
v.y -
v.z,
v.x,
v.x};
712 return {
v.y, -
v.x -
v.z,
v.y};
714 return {
v.z,
v.z, -
v.x -
v.y};
731template<
typename T,
int Size>
734 const T epsilon =
T(0))
736 for (
int i = 0;
i < Size;
i++) {
750template<
typename T,
int Size>
753 for (
int i = 0;
i < Size;
i++) {
766 for (
int i = 0;
i < Size;
i++) {
778template<
typename T,
int Size>
780 const T epsilon =
T(10) * std::numeric_limits<T>::epsilon())
798template<
typename T,
int Size>
#define BLI_UNROLL_MATH_VEC_FUNC_VEC_VEC(op, a, b)
#define BLI_UNROLL_MATH_VEC_OP_VEC(op, a)
ATTR_WARN_UNUSED_RESULT const BMVert * v2
ATTR_WARN_UNUSED_RESULT const BMVert * v
SIMD_FORCE_INLINE btScalar length() const
Return the length of the vector.
VecBase< T, D > reflect(VecOp< T, D >, VecOp< T, D >) RET
VecBase< float, D > normalize(VecOp< float, D >) RET
VecBase< T, D > faceforward(VecOp< T, D >, VecOp< T, D >, VecOp< T, D >) RET
VecBase< float, D > constexpr mod(VecOp< float, D >, VecOp< float, D >) RET
VecBase< float, D > step(VecOp< float, D >, VecOp< float, D >) RET
VecBase< float, 3 > cross(VecOp< float, 3 >, VecOp< float, 3 >) RET
T length_squared(const VecBase< T, Size > &a)
VecBase< T, 3 > normal_tri(const VecBase< T, 3 > &v1, const VecBase< T, 3 > &v2, const VecBase< T, 3 > &v3)
T pow(const T &x, const T &power)
T clamp(const T &a, const T &min, const T &max)
bool is_any_zero(const T &a)
T safe_divide(const T &a, const T &b)
VecBase< T, Size > project(const VecBase< T, Size > &p, const VecBase< T, Size > &v_proj)
T reduce_max(const VecBase< T, Size > &a)
isect_result< VecBase< T, Size > > isect_seg_seg(const VecBase< T, Size > &v1, const VecBase< T, Size > &v2, const VecBase< T, Size > &v3, const VecBase< T, Size > &v4)
T distance(const T &a, const T &b)
VecBase< T, Size > divide_ceil(const VecBase< T, Size > &a, const VecBase< T, Size > &b)
T length(const VecBase< T, Size > &a)
VecBase< float, 3 > cross_high_precision(const VecBase< float, 3 > &a, const VecBase< float, 3 > &b)
QuaternionBase< T > normalize_and_get_length(const QuaternionBase< T > &q, T &out_length)
bool is_unit_scale(const MatBase< T, NumCol, NumRow > &m)
T length_manhattan(const VecBase< T, Size > &a)
T reduce_min(const VecBase< T, Size > &a)
T dot(const QuaternionBase< T > &a, const QuaternionBase< T > &b)
T average(const VecBase< T, Size > &a)
T min(const T &a, const T &b)
T step(const T &edge, const T &value)
T midpoint(const T &a, const T &b)
T safe_mod(const T &a, const T &b)
T interpolate(const T &a, const T &b, const FactorT &t)
T safe_pow(const T &x, const T &power)
T fallback_pow(const T &x, const T &power, const T &fallback)
VecBase< T, 3 > cross_tri(const VecBase< T, 3 > &v1, const VecBase< T, 3 > &v2, const VecBase< T, 3 > &v3)
void min_max(const T &value, T &min, T &max)
T reduce_mul(const VecBase< T, Size > &a)
VecBase< T, Size > refract(const VecBase< T, Size > &incident, const VecBase< T, Size > &normal, const T &eta)
bool almost_equal_relative(const VecBase< T, Size > &a, const VecBase< T, Size > &b, const T &epsilon_factor)
T distance_squared(const VecBase< T, Size > &a, const VecBase< T, Size > &b)
T distance_manhattan(const VecBase< T, Size > &a, const VecBase< T, Size > &b)
bool is_equal(const MatBase< T, NumCol, NumRow > &a, const MatBase< T, NumCol, NumRow > &b, const T epsilon=T(0))
VecBase< T, 3 > orthogonal(const VecBase< T, 3 > &v)
int dominant_axis(const VecBase< T, 3 > &a)
VecBase< T, Size > ceil_to_multiple(const VecBase< T, Size > &a, const VecBase< T, Size > &b)
T max(const T &a, const T &b)
T mod(const T &a, const T &b)
bool is_unit(const VecBase< T, Size > &a, const T epsilon=T(10) *std::numeric_limits< T >::epsilon())
VecBase< T, 3 > cross_poly(Span< VecBase< T, 3 > > poly)
T reduce_add(const VecBase< T, Size > &a)
VecBase< T, Size > safe_sqrt(const VecBase< T, Size > &a)
enum blender::math::isect_result::@136170313254001351336034272000065360020172147157 kind