From c13ebf57ab5493140b1e6b72ecb7d022d01ebea1 Mon Sep 17 00:00:00 2001 From: kvark Date: Sat, 2 Nov 2013 10:18:37 -0400 Subject: [PATCH] Added transform_as_point --- src/cgmath/transform.rs | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/cgmath/transform.rs b/src/cgmath/transform.rs index 7dd2bbe..c6bf6b1 100644 --- a/src/cgmath/transform.rs +++ b/src/cgmath/transform.rs @@ -41,6 +41,11 @@ pub trait Transform Ray::new( self.transform_point(&ray.origin), self.transform_vec(&ray.direction) ) } + #[inline] + fn transform_as_point(&self, vec: &V)-> V { + self.transform_point( &Point::from_vec(vec) ).to_vec() + } + fn concat(&self, other: &Self) -> Self; fn invert(&self) -> Option; @@ -95,11 +100,10 @@ Transform for Decomposed { } fn concat(&self, other: &Decomposed) -> Decomposed { - let p = Point::from_vec( &other.disp ); Decomposed { scale: self.scale * other.scale, rot: self.rot.concat( &other.rot ), - disp: self.transform_point( &p ).to_vec(), + disp: self.transform_as_point( &other.disp ), } }