Vec3d F (center-eye );
F. normalize ();
Vec3d S (f ^ up );
S. normalize ();
Vec3d U (s ^ F );
U. normalize ();
Set (
S [0], U [0],-f [0], 0.0,
S [1], U [1],-f [1], 0.0,
S [2], U [2],-f [2], 0.0,
0.0, 0.0, 0.0, 1.0); // rotating component
Premulttranslate (-eye); // translation component
// ------ Linear correlation is supported.
E (x, y, z) = E (eye1, eye2, eye3) + (S, U,-f) (x1, Y1, Z1 );
(X1, Y1, Z1) = (X-eye1, Y-eye2, Z-eye3) * (S, U,-F );
X1, Y1, Z1 are the coordinates of a point in the right-hand observation coordinate system consisting of (S, U,-f). X, Y, and Z are the coordinates of a point in Unit E.
Influenced by the eye position, the fourth line is OSG: vec3d v =-eye;
Mm [4] [0] = V [0] * s [0] + V [1] * s [1] + V [2] * s [3];
Mm [4] [1] = V [0] * U [0] + V [1] * U [1] + V [2] * U [3];
Mm [4] [2] = V [0] * f [0] + V [1] * f [1] + V [2] * f [3];
Void matrix_implementation: getlookat (vec3f & eye, vec3f & Center, vec3f & up, value_type lookdistance) const
{
Matrix_implementation inv;
Inv. Invert (* This );
Eye = OSG: vec3f (0.0, 0.0, 0.0) * inv;
Up = transform3x3 (* This, OSG: vec3f (0.0, 1.0, 0.0 ));
Center = transform3x3 (* This, OSG: vec3f (0.0, 0.0,-1 ));
Center. normalize ();
Center = eye + center * lookdistance;
}