Commit fd731241 authored by Will Schroeder's avatar Will Schroeder
Browse files

ENH: Efficiency improvements.

parent 362fd0f1
......@@ -228,7 +228,6 @@ void vlTransform::RotateWXYZ ( float angle, float x, float y, float z)
vlMatrix4x4 ctm;
float radians;
float w;
float sum;
float quat[4];
float sinAngle;
float cosAngle;
......@@ -247,14 +246,9 @@ void vlTransform::RotateWXYZ ( float angle, float x, float y, float z)
sinAngle = sin (radians);
// normalize x, y, z
if (sum = quat[1] * quat[1] + quat[2] * quat[2] + quat[3] * quat[3])
{
quat[1] *= sinAngle / sqrt(sum);
quat[2] *= sinAngle / sqrt(sum);
quat[3] *= sinAngle / sqrt(sum);
}
else
if ( math.Normalize(quat+1) == 0.0 )
{
vlErrorMacro(<<"Trying to rotate around zero-length axis");
return;
}
......@@ -263,8 +257,6 @@ void vlTransform::RotateWXYZ ( float angle, float x, float y, float z)
y = quat[2];
z = quat[3];
ctm = 0.0;
// matrix calculation is taken from Ken Shoemake's
// "Animation Rotation with Quaternion Curves",
// Comput. Graphics, vol. 19, No. 3 , p. 253
......@@ -278,7 +270,6 @@ void vlTransform::RotateWXYZ ( float angle, float x, float y, float z)
ctm.Element[2][1] = 2 * y * z + 2 * w * x;
ctm.Element[0][2] = 2 * x * z + 2 * w * y;
ctm.Element[1][2] = 2 * y * z - 2 * w * x;
ctm.Element[3][3] = 1.0;
// concatenate with current transformation matrix
this->Concatenate (ctm);
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment