From 4098c6c5e51629ff951cfa63e77e8ff4e33b5db8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Crozet?= Date: Sun, 15 Nov 2015 21:38:35 +0100 Subject: [PATCH] Make Iso::look_at{_z} static. This did not need to access `self`. Fix #161. --- src/structs/iso.rs | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/src/structs/iso.rs b/src/structs/iso.rs index b8e6957e..f42d48d5 100644 --- a/src/structs/iso.rs +++ b/src/structs/iso.rs @@ -69,9 +69,8 @@ impl Iso3 { /// aligned with. /// * up - Vector pointing up. The only requirement of this parameter is to not be colinear /// with `at`. Non-colinearity is not checked. - pub fn look_at(&mut self, eye: &Pnt3, at: &Pnt3, up: &Vec3) { - self.rotation = Rot3::look_at(&(*at - *eye), up); - self.translation = eye.as_vec().clone(); + pub fn look_at(eye: &Pnt3, at: &Pnt3, up: &Vec3) -> Iso3 { + Iso3::new_with_rotmat(eye.as_vec().clone(), Rot3::look_at(&(*at - *eye), up)) } /// Reorient and translate this transformation such that its local `z` axis points to a given @@ -83,9 +82,8 @@ impl Iso3 { /// aligned with /// * up - Vector pointing `up`. The only requirement of this parameter is to not be colinear /// with `at`. Non-colinearity is not checked. - pub fn look_at_z(&mut self, eye: &Pnt3, at: &Pnt3, up: &Vec3) { - self.rotation = Rot3::look_at_z(&(*at - *eye), up); - self.translation = eye.as_vec().clone(); + pub fn look_at_z(eye: &Pnt3, at: &Pnt3, up: &Vec3) -> Iso3 { + Iso3::new_with_rotmat(eye.as_vec().clone(), Rot3::look_at_z(&(*at - *eye), up)) } }