95 const VecBase<T, 3> &
v);
108 return q.
w ==
T(0) && q.
x ==
T(0) && q.
y ==
T(0) && q.
z ==
T(0);
117 const T epsilon =
T(0))
128 const T test_unit = q.
x * q.
x + q.
y * q.
y + q.
z * q.
z + q.
w * q.
w;
167 input_vec[0], input_vec.
yzw()[axis.
as_int()]);
199 return a.
w *
b.w + a.
x *
b.x + a.
y *
b.y + a.
z *
b.z;
223 return {a.
w, -a.
x, -a.
y, -a.
z};
229 return (q.
w <
T(0)) ? -q : q;
319 return {
R.x,
R.y,
R.z};
323 S.w = -q.
x *
v.x - q.
y *
v.y - q.
z *
v.z;
324 S.x = q.
w *
v.x + q.
y *
v.z - q.
z *
v.y;
325 S.y = q.
w *
v.y + q.
z *
v.x - q.
x *
v.z;
326 S.z = q.
w *
v.z + q.
x *
v.y - q.
y *
v.x;
330 R.x = S.w * -q.
x + S.x * q.
w - S.y * q.
z + S.z * q.
y;
331 R.y = S.w * -q.
y + S.y * q.
w - S.z * q.
x + S.x * q.
z;
332 R.z = S.w * -q.
z + S.z * q.
w - S.x * q.
y + S.y * q.
x;
372 a.
quat.w -=
b.quat.w;
373 a.
quat.x -=
b.quat.x;
374 a.
quat.y -=
b.quat.y;
375 a.
quat.z -=
b.quat.z;
383 a.
quat.w +=
b.quat.w;
384 a.
quat.x +=
b.quat.x;
385 a.
quat.y +=
b.quat.y;
386 a.
quat.z +=
b.quat.z;
396 if (
b.scale_weight >
T(0)) {
449 if (norm_weighted ==
T(0)) {
454 const T inv_norm_weighted =
T(1) / norm_weighted;
457 dq.
quat = dq.
quat * inv_norm_weighted;
466 if (missing_uniform_scale >
T(0)) {
467 dq.
scale[0][0] += missing_uniform_scale;
468 dq.
scale[1][1] += missing_uniform_scale;
469 dq.
scale[2][2] += missing_uniform_scale;
470 dq.
scale[3][3] += missing_uniform_scale;
503 t[0] =
T(2) * (-we * x0 + xe * w0 - ye * z0 + ze * y0);
504 t[1] =
T(2) * (-we * y0 + xe * z0 + ye * w0 - ze * x0);
505 t[2] =
T(2) * (-we * z0 - xe * y0 + ye * x0 + ze * w0);
508 M[0][0] = (w0 * w0) + (x0 * x0) - (y0 * y0) - (z0 * z0);
509 M[0][1] =
T(2) * ((x0 * y0) + (w0 * z0));
510 M[0][2] =
T(2) * ((x0 * z0) - (w0 * y0));
512 M[1][0] =
T(2) * ((x0 * y0) - (w0 * z0));
513 M[1][1] = (w0 * w0) + (y0 * y0) - (x0 * x0) - (z0 * z0);
514 M[1][2] =
T(2) * ((y0 * z0) + (w0 * x0));
516 M[2][1] =
T(2) * ((y0 * z0) - (w0 * x0));
517 M[2][2] = (w0 * w0) + (z0 * z0) - (x0 * x0) - (y0 * y0);
518 M[2][0] =
T(2) * ((x0 * z0) + (w0 * y0));
530 if (r_crazy_space_mat !=
nullptr) {
535 *r_crazy_space_mat =
M;
569 Mat4T baseRS = mat * basemat;
576 const Mat4T baseinv =
invert(basemat);
582 baseR.location() = baseRS.location();
586 const Mat4T S =
invert(baseR) * baseRS;
588 scale = basemat * S * baseinv;
599 const Vec3T &t =
R.location().xyz();
601 d.
w =
T(-0.5) * (+t.x * q.
x + t.y * q.
y + t.z * q.
z);
602 d.
x =
T(+0.5) * (+t.x * q.
w + t.y * q.
z - t.z * q.
y);
603 d.
y =
T(+0.5) * (-t.x * q.
z + t.y * q.
w + t.z * q.
x);
604 d.
z =
T(+0.5) * (+t.x * q.
y - t.y * q.
x + t.z * q.
w);
623template<
typename T,
typename AngleT = AngleRadian>
629 T cos_half_angle = quat.
w;
632 if (sin_half_angle <
T(0.0005)) {
640 axis /= sin_half_angle;
643 AngleT
angle = AngleT(cos_half_angle, sin_half_angle) * 2;
677template<
typename T,
typename AngleT>
678QuaternionBase<T> to_quaternion(
const AxisAngleBase<T, AngleT> &axis_angle);
697 return axis_angle.axis() * axis_angle.angle().radian();
#define IN_RANGE_INCL(a, b, c)
static double angle(const Eigen::Vector3d &v1, const Eigen::Vector3d &v2)
ATTR_WARN_UNUSED_RESULT const BMVert const BMEdge * e
ATTR_WARN_UNUSED_RESULT const BMVert * v
SIMD_FORCE_INLINE const btScalar & w() const
Return the w value.
constexpr int as_int() const
VecBase< float, D > normalize(VecOp< float, D >) RET
QuaternionBase< T > conjugate(const QuaternionBase< T > &a)
T length_squared(const VecBase< T, Size > &a)
T cos(const AngleRadianBase< T > &a)
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)
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)
VecBase< T, 3 > yzw() const
static AngleCartesianBase from_point(const T &x, const T &y)
static AxisAngleBase identity()
VecBase< T, 3 > vec3_type
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
QuaternionBase wrapped_around(const QuaternionBase &reference) const
static QuaternionBase expmap(const VecBase< T, 3 > &expmap)
CCL_NAMESPACE_BEGIN struct Window V