Added transform_as_point
This commit is contained in:
parent
efd3403bf2
commit
c13ebf57ab
1 changed files with 6 additions and 2 deletions
|
@ -41,6 +41,11 @@ pub trait Transform
|
||||||
Ray::new( self.transform_point(&ray.origin), self.transform_vec(&ray.direction) )
|
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 concat(&self, other: &Self) -> Self;
|
||||||
fn invert(&self) -> Option<Self>;
|
fn invert(&self) -> Option<Self>;
|
||||||
|
|
||||||
|
@ -95,11 +100,10 @@ Transform<S, Slice, V, P> for Decomposed<S,V,R> {
|
||||||
}
|
}
|
||||||
|
|
||||||
fn concat(&self, other: &Decomposed<S,V,R>) -> Decomposed<S,V,R> {
|
fn concat(&self, other: &Decomposed<S,V,R>) -> Decomposed<S,V,R> {
|
||||||
let p = Point::from_vec( &other.disp );
|
|
||||||
Decomposed {
|
Decomposed {
|
||||||
scale: self.scale * other.scale,
|
scale: self.scale * other.scale,
|
||||||
rot: self.rot.concat( &other.rot ),
|
rot: self.rot.concat( &other.rot ),
|
||||||
disp: self.transform_point( &p ).to_vec(),
|
disp: self.transform_as_point( &other.disp ),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue