diff --git a/src/transform.rs b/src/transform.rs index 5427b69..4c9c7a6 100644 --- a/src/transform.rs +++ b/src/transform.rs @@ -13,8 +13,6 @@ // See the License for the specific language governing permissions and // limitations under the License. -use std::fmt; - use structure::*; use approx::ApproxEq; @@ -155,54 +153,3 @@ impl> From, R>> for Matrix4< impl> Transform2 for Decomposed, R> {} impl> Transform3 for Decomposed, R> {} - -/// A homogeneous transformation matrix. -#[derive(Copy, Clone, RustcEncodable, RustcDecodable)] -pub struct AffineMatrix3 { - pub mat: Matrix4, -} - -impl Transform> for AffineMatrix3 { - #[inline] - fn one() -> AffineMatrix3 { - AffineMatrix3 { mat: Matrix4::identity() } - } - - #[inline] - fn look_at(eye: Point3, center: Point3, up: Vector3) -> AffineMatrix3 { - AffineMatrix3 { mat: Matrix4::look_at(eye, center, up) } - } - - #[inline] - fn transform_vector(&self, vec: Vector3) -> Vector3 { - (self.mat * vec.extend(S::zero())).truncate() - } - - #[inline] - fn transform_point(&self, point: Point3) -> Point3 { - Point3::from_homogeneous(self.mat * point.to_homogeneous()) - } - - #[inline] - fn concat(&self, other: &AffineMatrix3) -> AffineMatrix3 { - AffineMatrix3 { mat: self.mat * other.mat } - } - - #[inline] - fn inverse_transform(&self) -> Option> { - SquareMatrix::invert(& self.mat).map(|m| AffineMatrix3{ mat: m }) - } -} - -impl From> for Matrix4 { - #[inline] fn from(aff: AffineMatrix3) -> Matrix4 { aff.mat } -} - -impl Transform3 for AffineMatrix3 {} - -impl fmt::Debug for AffineMatrix3 { - fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { - try!(write!(f, "AffineMatrix3 ")); - <[[S; 4]; 4] as fmt::Debug>::fmt(self.mat.as_ref(), f) - } -}