Changed the semantic of the look_at method.

Before, the `look_at` method aligned the `z` axis with the look_at direction.
This will be problematic in the future if we want to generalize that on n-dimension (the z axis
could not axis at all when n < 3).
Now, the `look_at` method aligns the `x` axis with the look_at direction. Thus we have a chance for
it to be generalizable on n-dimension, `n >= 1`.
This commit is contained in:
Sébastien Crozet 2013-07-23 12:12:03 +02:00
parent 4ea1dd92e6
commit 8634b9037d
1 changed files with 2 additions and 2 deletions

View File

@ -78,8 +78,8 @@ impl<N: Clone + DivisionRing + Algebraic> Rotmat<Mat3<N>>
{
pub fn look_at(&mut self, at: &Vec3<N>, up: &Vec3<N>)
{
let zaxis = at.normalized();
let xaxis = up.cross(&zaxis).normalized();
let xaxis = at.normalized();
let zaxis = up.cross(&xaxis).normalized();
let yaxis = zaxis.cross(&xaxis);
self.submat = Mat3::new(xaxis.x.clone(), yaxis.x.clone(), zaxis.x.clone(),