Fixed computeLocalTransform to generate correct orientation of local coordinate
frame.
This commit is contained in:
parent
fe0fd07f36
commit
eedfe44a1c
@ -180,8 +180,10 @@ inline void EllipsoidModel::computeLocalToWorldTransformFromXYZ(double X, double
|
||||
{
|
||||
localToWorld.makeTranslate(X,Y,Z);
|
||||
|
||||
|
||||
// normalize X,Y,Z
|
||||
double inverse_length = 1.0/sqrt(X*X + Y*Y + Z*Z);
|
||||
|
||||
X *= inverse_length;
|
||||
Y *= inverse_length;
|
||||
Z *= inverse_length;
|
||||
@ -191,21 +193,21 @@ inline void EllipsoidModel::computeLocalToWorldTransformFromXYZ(double X, double
|
||||
|
||||
// Vx = |(-Y,X,0)|
|
||||
localToWorld(0,0) = -Y*inverse_length_XY;
|
||||
localToWorld(1,0) = X*inverse_length_XY;
|
||||
localToWorld(2,0) = 0.0;
|
||||
localToWorld(0,1) = X*inverse_length_XY;
|
||||
localToWorld(0,2) = 0.0;
|
||||
|
||||
// Vy = /(-Z*X/(sqrt(X*X+Y*Y), -Z*Y/(sqrt(X*X+Y*Y),sqrt(X*X+Y*Y))|
|
||||
double Vy_x = -Z*X*inverse_length_XY;
|
||||
double Vy_y = -Z*Y*inverse_length_XY;
|
||||
double Vy_z = length_XY;
|
||||
inverse_length = 1.0/sqrt(Vy_x*Vy_x + Vy_y*Vy_y + Vy_z*Vy_z);
|
||||
localToWorld(0,1) = Vy_x*inverse_length;
|
||||
localToWorld(1,0) = Vy_x*inverse_length;
|
||||
localToWorld(1,1) = Vy_y*inverse_length;
|
||||
localToWorld(2,1) = Vy_z*inverse_length;
|
||||
localToWorld(1,2) = Vy_z*inverse_length;
|
||||
|
||||
// Vz = (X,Y,Z)
|
||||
localToWorld(0,2) = X;
|
||||
localToWorld(1,2) = Y;
|
||||
localToWorld(2,0) = X;
|
||||
localToWorld(2,1) = Y;
|
||||
localToWorld(2,2) = Z;
|
||||
}
|
||||
|
||||
|
@ -49,7 +49,7 @@ CoordinateFrame CoordinateSystemNode::computeLocalCoordinateFrame(double X, doub
|
||||
}
|
||||
else
|
||||
{
|
||||
return Matrixd();
|
||||
return Matrixd::translate(X,Y,Z);
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user