mirror of
https://git.mirrors.martin98.com/https://github.com/slic3r/Slic3r.git
synced 2025-08-05 20:16:05 +08:00
quaternions take half the angle the represent
This commit is contained in:
parent
b46383a089
commit
293a6bfe10
@ -311,13 +311,13 @@ TransformationMatrix TransformationMatrix::mat_rotation(double q1, double q2, do
|
|||||||
TransformationMatrix TransformationMatrix::mat_rotation(double angle_rad, const Pointf3 &axis)
|
TransformationMatrix TransformationMatrix::mat_rotation(double angle_rad, const Pointf3 &axis)
|
||||||
{
|
{
|
||||||
double s, factor, q1, q2, q3, q4;
|
double s, factor, q1, q2, q3, q4;
|
||||||
s = sin(angle_rad);
|
s = sin(angle_rad/2);
|
||||||
factor = axis.x*axis.x + axis.y*axis.y + axis.z*axis.z;
|
factor = axis.x*axis.x + axis.y*axis.y + axis.z*axis.z;
|
||||||
factor = s / sqrt(factor);
|
factor = s / sqrt(factor);
|
||||||
q1 = factor*axis.x;
|
q1 = factor*axis.x;
|
||||||
q2 = factor*axis.y;
|
q2 = factor*axis.y;
|
||||||
q3 = factor*axis.z;
|
q3 = factor*axis.z;
|
||||||
q4 = cos(angle_rad);
|
q4 = cos(angle_rad/2);
|
||||||
return mat_rotation(q1, q2, q3, q4);
|
return mat_rotation(q1, q2, q3, q4);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user