From 8634b9037d512a1af7bc82f1bd11c6b432880459 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Crozet?= Date: Tue, 23 Jul 2013 12:12:03 +0200 Subject: [PATCH] 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`. --- src/adaptors/rotmat.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/adaptors/rotmat.rs b/src/adaptors/rotmat.rs index 6d678639..1bef1a86 100644 --- a/src/adaptors/rotmat.rs +++ b/src/adaptors/rotmat.rs @@ -78,8 +78,8 @@ impl Rotmat> { pub fn look_at(&mut self, at: &Vec3, up: &Vec3) { - 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(),