Make Iso::look_at{_z} static.

This did not need to access `self`.

Fix #161.
This commit is contained in:
Sébastien Crozet 2015-11-15 21:38:35 +01:00
parent 58000e4838
commit 4098c6c5e5
1 changed files with 4 additions and 6 deletions

View File

@ -69,9 +69,8 @@ impl<N: Clone + BaseFloat> Iso3<N> {
/// aligned with. /// aligned with.
/// * up - Vector pointing up. The only requirement of this parameter is to not be colinear /// * up - Vector pointing up. The only requirement of this parameter is to not be colinear
/// with `at`. Non-colinearity is not checked. /// with `at`. Non-colinearity is not checked.
pub fn look_at(&mut self, eye: &Pnt3<N>, at: &Pnt3<N>, up: &Vec3<N>) { pub fn look_at(eye: &Pnt3<N>, at: &Pnt3<N>, up: &Vec3<N>) -> Iso3<N> {
self.rotation = Rot3::look_at(&(*at - *eye), up); Iso3::new_with_rotmat(eye.as_vec().clone(), Rot3::look_at(&(*at - *eye), up))
self.translation = eye.as_vec().clone();
} }
/// Reorient and translate this transformation such that its local `z` axis points to a given /// Reorient and translate this transformation such that its local `z` axis points to a given
@ -83,9 +82,8 @@ impl<N: Clone + BaseFloat> Iso3<N> {
/// aligned with /// aligned with
/// * up - Vector pointing `up`. The only requirement of this parameter is to not be colinear /// * up - Vector pointing `up`. The only requirement of this parameter is to not be colinear
/// with `at`. Non-colinearity is not checked. /// with `at`. Non-colinearity is not checked.
pub fn look_at_z(&mut self, eye: &Pnt3<N>, at: &Pnt3<N>, up: &Vec3<N>) { pub fn look_at_z(eye: &Pnt3<N>, at: &Pnt3<N>, up: &Vec3<N>) -> Iso3<N> {
self.rotation = Rot3::look_at_z(&(*at - *eye), up); Iso3::new_with_rotmat(eye.as_vec().clone(), Rot3::look_at_z(&(*at - *eye), up))
self.translation = eye.as_vec().clone();
} }
} }