97 const VecBase<T, 3> &
v);
110 return q.
w ==
T(0) && q.
x ==
T(0) && q.
y ==
T(0) && q.
z ==
T(0);
119 const T epsilon =
T(0))
130 const T test_unit = q.
x * q.
x + q.
y * q.
y + q.
z * q.
z + q.
w * q.
w;
169 input_vec[0], input_vec.yzw()[axis.
as_int()]);
201 return a.
w *
b.w + a.
x *
b.x + a.
y *
b.y + a.
z *
b.z;
225 return {a.
w, -a.
x, -a.
y, -a.
z};
231 return (q.
w <
T(0)) ? -q : q;
283 if (abs_cosom < (
T(1) -
eps)) [[likely]] {
325 return {
R.x,
R.y,
R.z};
329 S.w = -q.
x *
v.x - q.
y *
v.y - q.
z *
v.z;
330 S.x = q.
w *
v.x + q.
y *
v.z - q.
z *
v.y;
331 S.y = q.
w *
v.y + q.
z *
v.x - q.
x *
v.z;
332 S.z = q.
w *
v.z + q.
x *
v.y - q.
y *
v.x;
336 R.x = S.w * -q.
x + S.x * q.
w - S.y * q.
z + S.z * q.
y;
337 R.y = S.w * -q.
y + S.y * q.
w - S.z * q.
x + S.x * q.
z;
338 R.z = S.w * -q.
z + S.z * q.
w - S.x * q.
y + S.y * q.
x;
378 a.
quat.w -=
b.quat.w;
379 a.
quat.x -=
b.quat.x;
380 a.
quat.y -=
b.quat.y;
381 a.
quat.z -=
b.quat.z;
389 a.
quat.w +=
b.quat.w;
390 a.
quat.x +=
b.quat.x;
391 a.
quat.y +=
b.quat.y;
392 a.
quat.z +=
b.quat.z;
402 if (
b.scale_weight >
T(0)) {
455 if (norm_weighted ==
T(0)) {
460 const T inv_norm_weighted =
T(1) / norm_weighted;
463 dq.
quat = dq.
quat * inv_norm_weighted;
472 if (missing_uniform_scale >
T(0)) {
473 dq.
scale[0][0] += missing_uniform_scale;
474 dq.
scale[1][1] += missing_uniform_scale;
475 dq.
scale[2][2] += missing_uniform_scale;
476 dq.
scale[3][3] += missing_uniform_scale;
509 t[0] =
T(2) * (-we * x0 + xe * w0 - ye * z0 + ze * y0);
510 t[1] =
T(2) * (-we * y0 + xe * z0 + ye * w0 - ze * x0);
511 t[2] =
T(2) * (-we * z0 - xe * y0 + ye * x0 + ze * w0);
514 M[0][0] = (w0 * w0) + (x0 * x0) - (y0 * y0) - (z0 * z0);
515 M[0][1] =
T(2) * ((x0 * y0) + (w0 * z0));
516 M[0][2] =
T(2) * ((x0 * z0) - (w0 * y0));
518 M[1][0] =
T(2) * ((x0 * y0) - (w0 * z0));
519 M[1][1] = (w0 * w0) + (y0 * y0) - (x0 * x0) - (z0 * z0);
520 M[1][2] =
T(2) * ((y0 * z0) + (w0 * x0));
522 M[2][1] =
T(2) * ((y0 * z0) - (w0 * x0));
523 M[2][2] = (w0 * w0) + (z0 * z0) - (x0 * x0) - (y0 * y0);
524 M[2][0] =
T(2) * ((x0 * z0) + (w0 * y0));
536 if (r_crazy_space_mat !=
nullptr) {
538 *r_crazy_space_mat =
M * dq.
scale.template view<3, 3>();
541 *r_crazy_space_mat =
M;
575 Mat4T baseRS = mat * basemat;
582 const Mat4T baseinv =
invert(basemat);
588 baseR.location() = baseRS.location();
592 const Mat4T S =
invert(baseR) * baseRS;
594 scale = basemat * S * baseinv;
605 const Vec3T &t =
R.location().xyz();
607 d.
w =
T(-0.5) * (+t.x * q.
x + t.y * q.
y + t.z * q.
z);
608 d.
x =
T(+0.5) * (+t.x * q.
w + t.y * q.
z - t.z * q.
y);
609 d.
y =
T(+0.5) * (-t.x * q.
z + t.y * q.
w + t.z * q.
x);
610 d.
z =
T(+0.5) * (+t.x * q.
y - t.y * q.
x + t.z * q.
w);
629template<
typename T,
typename AngleT = AngleRadian>
635 T cos_half_angle = quat.
w;
638 if (sin_half_angle <
T(0.0005)) {
646 axis /= sin_half_angle;
649 AngleT
angle = AngleT(cos_half_angle, sin_half_angle) * 2;
683template<
typename T,
typename AngleT>
684QuaternionBase<T>
to_quaternion(
const AxisAngleBase<T, AngleT> &axis_angle);
692 if (
angle !=
T(0)) [[likely]] {
703 return axis_angle.axis() * axis_angle.angle().radian();
#define IN_RANGE(a, b, c)
#define IN_RANGE_INCL(a, b, c)
SIMD_FORCE_INLINE const btScalar & w() const
Return the w value.
SIMD_FORCE_INLINE btScalar angle(const btVector3 &v) const
Return the angle between this and another vector.
constexpr int as_int() const
Quaternion to_quaternion(EulerXYZ eul)
ccl_device_inline dual1 len(const ccl_private dual< T > &a)
QuaternionBase< T > conjugate(const QuaternionBase< T > &a)
T length_squared(const VecBase< T, Size > &a)
T cos(const AngleRadianBase< T > &a)
T pow(const T &x, const T &power)
bool is_normalized(const DualQuaternionBase< T > &dq)
QuaternionBase< T > to_quaternion(const AxisAngleBase< T, AngleT > &axis_angle)
bool is_negative(const MatBase< T, 3, 3 > &mat)
MatBase< T, NumCol, NumRow > scale(const MatBase< T, NumCol, NumRow > &mat, const VectorT &scale)
bool is_orthonormal(const MatT &mat)
T length(const VecBase< T, Size > &a)
QuaternionBase< T > normalize_and_get_length(const QuaternionBase< T > &q, T &out_length)
bool is_unit_scale(const MatBase< T, NumCol, NumRow > &m)
T dot(const QuaternionBase< T > &a, const QuaternionBase< T > &b)
CartesianBasis invert(const CartesianBasis &basis)
T interpolate(const T &a, const T &b, const FactorT &t)
QuaternionBase< T > invert_normalized(const QuaternionBase< T > &q)
AxisAngleBase< T, AngleT > to_axis_angle(const EulerXYZBase< T > &euler)
MatBase< T, NumCol, NumRow > normalize(const MatBase< T, NumCol, NumRow > &a)
VecBase< T, 3 > to_scale(const MatBase< T, NumCol, NumRow > &mat)
QuaternionBase< T > canonicalize(const QuaternionBase< T > &q)
T distance_squared(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))
T sin(const AngleRadianBase< T > &a)
MatT orthogonalize(const MatT &mat, const Axis axis)
VecBase< T, 2 > interpolate_dot_slerp(const T t, const T cosom)
MatT from_rotation(const RotationT &rotation)
DualQuaternionBase< T > to_dual_quaternion(const MatBase< T, 4, 4 > &mat, const MatBase< T, 4, 4 > &basemat)
Euler3Base< T > to_euler(const AxisAngleBase< T, AngleT > &axis_angle, EulerOrder order)
VecBase< T, 3 > transform_point(const CartesianBasis &basis, const VecBase< T, 3 > &v)
BLI_assert(slot->slot_subtype.map==BMO_OP_SLOT_SUBTYPE_MAP_FLT)
ATTR_WARN_UNUSED_RESULT const BMVert * v
ATTR_WARN_UNUSED_RESULT const BMVert const BMEdge * e
static AngleCartesianBase from_point(const T &x, const T &y)
AngleRadianBase()=default
static AxisAngleBase identity()
VecBase< T, 3 > vec3_type
const vec3_type & axis() const
DualQuaternionBase()=delete
QuaternionBase< T > trans
DualQuaternionBase & operator*=(const T &t) &
DualQuaternionBase & operator+=(const DualQuaternionBase &b) &
static DualQuaternionBase identity()
const VecBase< T, 3 > & imaginary_part() const
QuaternionBase swing(const Axis axis) const
AngleRadianBase< T > twist_angle(const Axis axis) const
static QuaternionBase identity()
QuaternionBase twist(const Axis axis) const
VecBase< T, 3 > expmap() const
QuaternionBase wrapped_around(const QuaternionBase &reference) const
static QuaternionBase expmap(const VecBase< T, 3 > &expmap)
CCL_NAMESPACE_BEGIN struct Window V