From 48f80d99ccee2457029ea349ee37259945f3f21a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Crozet?= Date: Tue, 15 Aug 2017 19:36:38 +0200 Subject: [PATCH] Fix abomonation integration. --- Makefile | 4 ++-- src/geometry/isometry.rs | 6 +++--- src/geometry/point.rs | 4 ++-- src/geometry/quaternion.rs | 2 +- src/geometry/rotation.rs | 2 +- src/geometry/similarity.rs | 4 ++-- src/geometry/translation.rs | 2 +- tests/{ => core}/abomonation.rs | 6 +----- tests/core/mod.rs | 1 + tests/geometry/quaternion.rs | 2 +- tests/geometry/rotation.rs | 6 +++--- tests/geometry/unit_complex.rs | 2 +- tests/lib.rs | 1 + 13 files changed, 20 insertions(+), 22 deletions(-) rename tests/{ => core}/abomonation.rs (94%) diff --git a/Makefile b/Makefile index ad1fafcc..5af4b5a7 100644 --- a/Makefile +++ b/Makefile @@ -2,10 +2,10 @@ all: cargo check --features "debug arbitrary serde-serialize" doc: - cargo doc --no-deps --features "debug arbitrary serde-serialize" + cargo doc --no-deps --features "debug arbitrary serde-serialize abomonation" bench: cargo bench test: - cargo test --features "debug arbitrary serde-serialize" + cargo test --features "debug arbitrary serde-serialize abomonation-serialize" diff --git a/src/geometry/isometry.rs b/src/geometry/isometry.rs index fbde8c79..397aabfe 100644 --- a/src/geometry/isometry.rs +++ b/src/geometry/isometry.rs @@ -46,11 +46,11 @@ pub struct Isometry } #[cfg(feature = "abomonation-serialize")] -impl Abomonation for IsometryBase - where N: Scalar, +impl Abomonation for Isometry + where N: Real, D: DimName, R: Abomonation, - TranslationBase: Abomonation, + Translation: Abomonation, DefaultAllocator: Allocator { unsafe fn entomb(&self, writer: &mut Vec) { diff --git a/src/geometry/point.rs b/src/geometry/point.rs index ec18976c..9fe9b1a5 100644 --- a/src/geometry/point.rs +++ b/src/geometry/point.rs @@ -71,10 +71,10 @@ where DefaultAllocator: Allocator, #[cfg(feature = "abomonation-serialize")] -impl Abomonation for PointBase +impl Abomonation for Point where N: Scalar, D: DimName, - ColumnVector: Abomonation, + VectorN: Abomonation, DefaultAllocator: Allocator { unsafe fn entomb(&self, writer: &mut Vec) { diff --git a/src/geometry/quaternion.rs b/src/geometry/quaternion.rs index 8dc3a99b..6a59329b 100644 --- a/src/geometry/quaternion.rs +++ b/src/geometry/quaternion.rs @@ -29,7 +29,7 @@ pub struct Quaternion { } #[cfg(feature = "abomonation-serialize")] -impl Abomonation for QuaternionBase +impl Abomonation for Quaternion where Vector4: Abomonation { unsafe fn entomb(&self, writer: &mut Vec) { diff --git a/src/geometry/rotation.rs b/src/geometry/rotation.rs index b97597cd..3a598cca 100644 --- a/src/geometry/rotation.rs +++ b/src/geometry/rotation.rs @@ -49,7 +49,7 @@ impl Clone for Rotation } #[cfg(feature = "abomonation-serialize")] -impl Abomonation for RotationBase +impl Abomonation for Rotation where N: Scalar, D: DimName, MatrixN: Abomonation, diff --git a/src/geometry/similarity.rs b/src/geometry/similarity.rs index 75ab6bbc..cc146918 100644 --- a/src/geometry/similarity.rs +++ b/src/geometry/similarity.rs @@ -43,8 +43,8 @@ pub struct Similarity } #[cfg(feature = "abomonation-serialize")] -impl Abomonation for SimilarityBase - where IsometryBase: Abomonation, +impl Abomonation for Similarity + where Isometry: Abomonation, DefaultAllocator: Allocator { unsafe fn entomb(&self, writer: &mut Vec) { diff --git a/src/geometry/translation.rs b/src/geometry/translation.rs index 68d89f42..385e00da 100644 --- a/src/geometry/translation.rs +++ b/src/geometry/translation.rs @@ -48,7 +48,7 @@ impl Clone for Translation } #[cfg(feature = "abomonation-serialize")] -impl Abomonation for TranslationBase +impl Abomonation for Translation where N: Scalar, D: DimName, VectorN: Abomonation, diff --git a/tests/abomonation.rs b/tests/core/abomonation.rs similarity index 94% rename from tests/abomonation.rs rename to tests/core/abomonation.rs index 3ca0adcf..ac53716b 100644 --- a/tests/abomonation.rs +++ b/tests/core/abomonation.rs @@ -1,10 +1,6 @@ -extern crate rand; -extern crate nalgebra; -extern crate abomonation; - use rand::random; use abomonation::{Abomonation, encode, decode}; -use nalgebra::{ +use na::{ DMatrix, Matrix3x4, Point3, Translation3, Rotation3, Isometry3, Quaternion, IsometryMatrix3, Similarity3, SimilarityMatrix3 }; diff --git a/tests/core/mod.rs b/tests/core/mod.rs index aa73d361..71d09757 100644 --- a/tests/core/mod.rs +++ b/tests/core/mod.rs @@ -4,3 +4,4 @@ mod matrix; mod matrix_slice; mod blas; mod serde; +mod abomonation; diff --git a/tests/geometry/quaternion.rs b/tests/geometry/quaternion.rs index eb3a42f2..3000fa9c 100644 --- a/tests/geometry/quaternion.rs +++ b/tests/geometry/quaternion.rs @@ -83,7 +83,7 @@ quickcheck!( /* * - * Quaterion * Vector == RotationBase * Vector + * Quaterion * Vector == Rotation * Vector * */ fn unit_quaternion_mul_vector(q: UnitQuaternion, v: Vector3, p: Point3) -> bool { diff --git a/tests/geometry/rotation.rs b/tests/geometry/rotation.rs index d5fa782c..263577ce 100644 --- a/tests/geometry/rotation.rs +++ b/tests/geometry/rotation.rs @@ -79,7 +79,7 @@ quickcheck!( /* * - * RotationBase matrix between vectors. + * Rotation matrix between vectors. * */ fn rotation_between_is_anticommutative_2(a: Vector2, b: Vector2) -> bool { @@ -132,7 +132,7 @@ quickcheck!( /* * - * RotationBase construction. + * Rotation construction. * */ fn new_rotation_2(angle: f64) -> bool { @@ -159,7 +159,7 @@ quickcheck!( /* * - * RotationBase pow. + * Rotation pow. * */ fn powf_rotation_2(angle: f64, pow: f64) -> bool { diff --git a/tests/geometry/unit_complex.rs b/tests/geometry/unit_complex.rs index ff8d4a66..a5147690 100644 --- a/tests/geometry/unit_complex.rs +++ b/tests/geometry/unit_complex.rs @@ -60,7 +60,7 @@ quickcheck!( /* * - * Quaterion * Vector == RotationBase * Vector + * Quaterion * Vector == Rotation * Vector * */ fn unit_complex_mul_vector(c: UnitComplex, v: Vector2, p: Point2) -> bool { diff --git a/tests/lib.rs b/tests/lib.rs index 5e111eb0..9a1174e7 100644 --- a/tests/lib.rs +++ b/tests/lib.rs @@ -5,6 +5,7 @@ extern crate quickcheck; extern crate approx; extern crate num_traits as num; extern crate serde_json; +extern crate abomonation; extern crate rand; extern crate alga; extern crate nalgebra as na;