diff --git a/src/lib.rs b/src/lib.rs index 4b2d2ac7..11726249 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -1,6 +1,8 @@ /*! # nalgebra +[![Build Status](https://travis-ci.org/sebcrozet/nalgebra.png?branch=master)](https://travis-ci.org/sebcrozet/nalgebra) + **nalgebra** is a linear algebra library written for Rust targeting: * general-purpose linear algebra (still misses a lot of features…). @@ -106,6 +108,7 @@ Feel free to add your project to this list if you happen to use **nalgebra**! */ #[link(name = "nalgebra" + , package_id = "nalgebra" , vers = "0.1" , author = "Sébastien Crozet" , uuid = "1e96070f-4778-4ec1-b080-bf69f7048216")]; diff --git a/src/structs/iso.rs b/src/structs/iso.rs index c2fc5ceb..c73cbd25 100644 --- a/src/structs/iso.rs +++ b/src/structs/iso.rs @@ -4,13 +4,13 @@ use std::num::{Zero, One}; use std::rand::{Rand, Rng}; -use structs::mat::{Mat3, Mat4}; +use structs::mat::{Mat3, Mat4, Mat5}; use traits::structure::{Cast, Dim, Col}; use traits::operations::{Inv}; use traits::geometry::{RotationMatrix, Rotation, Rotate, AbsoluteRotate, Transform, Transformation, Translate, Translation, ToHomogeneous}; -use structs::vec::{Vec1, Vec2, Vec3, Vec4, Vec2MulRhs, Vec3MulRhs}; +use structs::vec::{Vec1, Vec2, Vec3, Vec4, Vec2MulRhs, Vec3MulRhs, Vec4MulRhs}; use structs::rot::{Rot2, Rot3, Rot4}; mod metal; @@ -82,6 +82,18 @@ impl Iso3 { } } +impl Iso4 { + // XXX remove that when iso_impl works for Iso4 + /// Creates a new isometry from a rotation matrix and a vector. + #[inline] + pub fn new_with_rotmat(translation: Vec4, rotation: Rot4) -> Iso4 { + Iso4 { + rotation: rotation, + translation: translation + } + } +} + iso_impl!(Iso2, Rot2, Vec2, Vec1) double_dispatch_binop_decl_trait!(Iso2, Iso2MulRhs) mul_redispatch_impl!(Iso2, Iso2MulRhs) @@ -124,25 +136,23 @@ iso_mul_iso_impl!(Iso3, Iso3MulRhs) iso_mul_vec_impl!(Iso3, Vec3, Iso3MulRhs) vec_mul_iso_impl!(Iso3, Vec3, Vec3MulRhs) -/* -iso_impl!(Iso4, Rot4, Vec4, Vec4) +// iso_impl!(Iso4, Rot4, Vec4, Vec4) double_dispatch_binop_decl_trait!(Iso4, Iso4MulRhs) mul_redispatch_impl!(Iso4, Iso4MulRhs) // rotation_matrix_impl!(Iso4, Rot4, Vec4, Vec4) // rotation_impl!(Iso4, Rot4, Vec4) dim_impl!(Iso4, 4) one_impl!(Iso4) -// absolute_rotate_impl!(Iso4, Vec4) +absolute_rotate_impl!(Iso4, Vec4) // rand_impl!(Iso4) approx_eq_impl!(Iso4) to_homogeneous_impl!(Iso4, Mat5) inv_impl!(Iso4) transform_impl!(Iso4, Vec4) transformation_impl!(Iso4) -// rotate_impl!(Iso4, Vec4) +rotate_impl!(Iso4, Vec4) translation_impl!(Iso4, Vec4) translate_impl!(Iso4, Vec4) iso_mul_iso_impl!(Iso4, Iso4MulRhs) iso_mul_vec_impl!(Iso4, Vec4, Iso4MulRhs) vec_mul_iso_impl!(Iso4, Vec4, Vec4MulRhs) -*/ diff --git a/src/structs/rot.rs b/src/structs/rot.rs index 88595c00..e0684884 100644 --- a/src/structs/rot.rs +++ b/src/structs/rot.rs @@ -269,6 +269,28 @@ pub struct Rot4 { priv submat: Mat4 } +// impl Rot4 { +// pub fn new(left_iso: Quat, right_iso: Quat) -> Rot4 { +// assert!(left_iso.is_unit()); +// assert!(right_iso.is_unright); +// +// let mat_left_iso = Mat4::new( +// left_iso.x, -left_iso.y, -left_iso.z, -left_iso.w, +// left_iso.y, left_iso.x, -left_iso.w, left_iso.z, +// left_iso.z, left_iso.w, left_iso.x, -left_iso.y, +// left_iso.w, -left_iso.z, left_iso.y, left_iso.x); +// let mat_right_iso = Mat4::new( +// right_iso.x, -right_iso.y, -right_iso.z, -right_iso.w, +// right_iso.y, right_iso.x, right_iso.w, -right_iso.z, +// right_iso.z, -right_iso.w, right_iso.x, right_iso.y, +// right_iso.w, right_iso.z, -right_iso.y, right_iso.x); +// +// Rot4 { +// submat: mat_left_iso * mat_right_iso +// } +// } +// } + impl AbsoluteRotate> for Rot4 { #[inline] fn absolute_rotate(&self, v: &Vec4) -> Vec4 { @@ -287,6 +309,44 @@ impl AbsoluteRotate> for Rot4 { } } +impl +Rotation> for Rot4 { + #[inline] + fn rotation(&self) -> Vec4 { + fail!("Not yet implemented") + } + + #[inline] + fn inv_rotation(&self) -> Vec4 { + fail!("Not yet implemented") + } + + #[inline] + fn append_rotation(&mut self, _: &Vec4) { + fail!("Not yet implemented") + } + + #[inline] + fn append_rotation_cpy(_: &Rot4, _: &Vec4) -> Rot4 { + fail!("Not yet implemented") + } + + #[inline] + fn prepend_rotation(&mut self, _: &Vec4) { + fail!("Not yet implemented") + } + + #[inline] + fn prepend_rotation_cpy(_: &Rot4, _: &Vec4) -> Rot4 { + fail!("Not yet implemented") + } + + #[inline] + fn set_rotation(&mut self, _: Vec4) { + fail!("Not yet implemented") + } +} + /* * Common implementations. @@ -340,7 +400,7 @@ rot_mul_rot_impl!(Rot4, Rot4MulRhs) rot_mul_vec_impl!(Rot4, Vec4, Rot4MulRhs) vec_mul_rot_impl!(Rot4, Vec4, Vec4MulRhs) one_impl!(Rot4) -// rotation_matrix_impl!(Rot4, Vec4, Vec4) +rotation_matrix_impl!(Rot4, Vec4, Vec4) col_impl!(Rot4, Vec4) row_impl!(Rot4, Vec4) absolute_impl!(Rot4, Mat4)