forked from blender/blender
main sync #3
@ -30,8 +30,8 @@ AxisAngle<T, AngleT>::AxisAngle(const VecBase<T, 3> &axis, const AngleT &angle)
|
||||
template<typename T, typename AngleT>
|
||||
AxisAngle<T, AngleT>::AxisAngle(const AxisSigned axis, const AngleT &angle)
|
||||
{
|
||||
this->axis_ = VecBase<T, 3>(axis);
|
||||
this->angle_ = angle;
|
||||
axis_ = to_vector<VecBase<T, 3>>(axis);
|
||||
angle_ = angle;
|
||||
}
|
||||
|
||||
template<typename T, typename AngleT>
|
||||
|
@ -455,8 +455,8 @@ struct CartesianBasis {
|
||||
const AxisSigned b_forward)
|
||||
{
|
||||
/* Pick predictable next axis. */
|
||||
AxisSigned a_up = AxisSigned(abs(a_forward.next_after()));
|
||||
AxisSigned b_up = AxisSigned(abs(b_forward.next_after()));
|
||||
AxisSigned a_up = abs(a_forward.next_after());
|
||||
AxisSigned b_up = abs(b_forward.next_after());
|
||||
|
||||
if (sign(a_forward) != sign(b_forward)) {
|
||||
/* Flip both axis (up and right) so resulting rotation matrix sign remains positive. */
|
||||
|
@ -316,6 +316,10 @@ TEST(math_rotation, AxisAngleConstructors)
|
||||
EXPECT_NEAR(b.angle().sin(), 1.0f, 1e-4);
|
||||
EXPECT_NEAR(b.angle().cos(), 0.0f, 1e-4);
|
||||
|
||||
AxisAngle axis_angle_basis = AxisAngle(AxisSigned::Y_NEG, M_PI);
|
||||
EXPECT_EQ(axis_angle_basis.axis(), float3(0.0f, -1.0f, 0.0f));
|
||||
EXPECT_EQ(axis_angle_basis.angle(), M_PI);
|
||||
|
||||
AxisAngle c({1.0f, 0.0f, 0.0f}, {0.0f, 1.0f, 0.0f});
|
||||
EXPECT_V3_NEAR(c.axis(), float3(0, 0, 1), 1e-4);
|
||||
EXPECT_NEAR(float(c.angle()), M_PI_2, 1e-4);
|
||||
|
@ -308,6 +308,7 @@ TEST(math_rotation_types, AngleFraction)
|
||||
EXPECT_EQ(AngleCartesian(-pi * 1 / 4).sin(), T(-M_SQRT1_2));
|
||||
EXPECT_EQ(AngleCartesian(-pi * 3 / 4).sin(), T(-M_SQRT1_2));
|
||||
}
|
||||
|
||||
TEST(math_rotation_types, TypeConversion)
|
||||
{
|
||||
/* All the same rotation. */
|
||||
|
Loading…
Reference in New Issue
Block a user