From c9bdf838a56826fe28cd597e31716c2cd719fc7c Mon Sep 17 00:00:00 2001 From: Corey Richardson Date: Sun, 22 Jun 2014 20:35:40 -0700 Subject: [PATCH 1/2] Update for Cargo --- .travis.yml | 3 +++ Cargo.toml | 18 ++++++++++++++++++ Makefile | 2 +- src/{cgmath => }/aabb.rs | 0 src/{cgmath => }/angle.rs | 0 src/{cgmath => }/approx.rs | 0 src/{cgmath => }/array.rs | 0 src/{cgmath/lib.rs => cgmath.rs} | 0 src/{cgmath => }/cylinder.rs | 0 src/{cgmath => }/frustum.rs | 0 src/{cgmath => }/intersect.rs | 0 src/{cgmath => }/line.rs | 0 src/{cgmath => }/matrix.rs | 0 src/{cgmath => }/num.rs | 0 src/{cgmath => }/obb.rs | 0 src/{cgmath => }/plane.rs | 0 src/{cgmath => }/point.rs | 0 src/{cgmath => }/projection.rs | 0 src/{cgmath => }/quaternion.rs | 0 src/{cgmath => }/ray.rs | 0 src/{cgmath => }/rotation.rs | 0 src/{cgmath => }/sphere.rs | 0 src/{cgmath => }/transform.rs | 0 src/{cgmath => }/vector.rs | 0 24 files changed, 22 insertions(+), 1 deletion(-) create mode 100644 Cargo.toml rename src/{cgmath => }/aabb.rs (100%) rename src/{cgmath => }/angle.rs (100%) rename src/{cgmath => }/approx.rs (100%) rename src/{cgmath => }/array.rs (100%) rename src/{cgmath/lib.rs => cgmath.rs} (100%) rename src/{cgmath => }/cylinder.rs (100%) rename src/{cgmath => }/frustum.rs (100%) rename src/{cgmath => }/intersect.rs (100%) rename src/{cgmath => }/line.rs (100%) rename src/{cgmath => }/matrix.rs (100%) rename src/{cgmath => }/num.rs (100%) rename src/{cgmath => }/obb.rs (100%) rename src/{cgmath => }/plane.rs (100%) rename src/{cgmath => }/point.rs (100%) rename src/{cgmath => }/projection.rs (100%) rename src/{cgmath => }/quaternion.rs (100%) rename src/{cgmath => }/ray.rs (100%) rename src/{cgmath => }/rotation.rs (100%) rename src/{cgmath => }/sphere.rs (100%) rename src/{cgmath => }/transform.rs (100%) rename src/{cgmath => }/vector.rs (100%) diff --git a/.travis.yml b/.travis.yml index 1e9623c..350ab03 100644 --- a/.travis.yml +++ b/.travis.yml @@ -17,13 +17,16 @@ env: global: - secure: N41M4QTWbez7FRMh2HQqB3Z051FcruoRGLTdMdQJNMaZRqJiAfUBTO5NGXS5XGjIofknE4r/+WLv7KED2rTf6nvLFOHmGY2pL+agABcyD0DU0ltRLckjONWTxFN+SMTB0l38v3XIXxXX5y977Hl6wk3++kYZgCNVG3OTkJwWzQg= before_install: + - yes | sudo add-apt-repository ppa:cmrx64/cargo - sudo apt-get update install: + - sudo apt-get install cargo - wget http://static.rust-lang.org/dist/rust-nightly-x86_64-unknown-linux-gnu.tar.gz - tar xzf rust-nightly-x86_64-unknown-linux-gnu.tar.gz - export PATH=$PATH:$(pwd)/rust-nightly-x86_64-unknown-linux-gnu/bin - rustc -v script: + - cargo build - make # - make check # bench is too slow - make test diff --git a/Cargo.toml b/Cargo.toml new file mode 100644 index 0000000..e505281 --- /dev/null +++ b/Cargo.toml @@ -0,0 +1,18 @@ +[package] + +name = "cgmath-rs" +version = "0.0.1" +authors = ["Brendan Zabarauskas ", + "Brian Heylin", + "Colin Sherratt", + "Dzmitry Malyshau", + "Erick Tryzelaar", + "Luqman Aden", + "Maik Klein", + "Mikko Perttunen", + "Tomasz Stachowiak" +] + +[[lib]] + +name = "cgmath" diff --git a/Makefile b/Makefile index edf0ac8..1e6e468 100644 --- a/Makefile +++ b/Makefile @@ -17,7 +17,7 @@ RUSTC = rustc RUSTDOC = rustdoc SRC_DIR = src -LIB_FILE = $(SRC_DIR)/cgmath/lib.rs +LIB_FILE = $(SRC_DIR)/cgmath.rs TEST_FILE = $(SRC_DIR)/test/test.rs BENCH_FILE = $(SRC_DIR)/bench/bench.rs diff --git a/src/cgmath/aabb.rs b/src/aabb.rs similarity index 100% rename from src/cgmath/aabb.rs rename to src/aabb.rs diff --git a/src/cgmath/angle.rs b/src/angle.rs similarity index 100% rename from src/cgmath/angle.rs rename to src/angle.rs diff --git a/src/cgmath/approx.rs b/src/approx.rs similarity index 100% rename from src/cgmath/approx.rs rename to src/approx.rs diff --git a/src/cgmath/array.rs b/src/array.rs similarity index 100% rename from src/cgmath/array.rs rename to src/array.rs diff --git a/src/cgmath/lib.rs b/src/cgmath.rs similarity index 100% rename from src/cgmath/lib.rs rename to src/cgmath.rs diff --git a/src/cgmath/cylinder.rs b/src/cylinder.rs similarity index 100% rename from src/cgmath/cylinder.rs rename to src/cylinder.rs diff --git a/src/cgmath/frustum.rs b/src/frustum.rs similarity index 100% rename from src/cgmath/frustum.rs rename to src/frustum.rs diff --git a/src/cgmath/intersect.rs b/src/intersect.rs similarity index 100% rename from src/cgmath/intersect.rs rename to src/intersect.rs diff --git a/src/cgmath/line.rs b/src/line.rs similarity index 100% rename from src/cgmath/line.rs rename to src/line.rs diff --git a/src/cgmath/matrix.rs b/src/matrix.rs similarity index 100% rename from src/cgmath/matrix.rs rename to src/matrix.rs diff --git a/src/cgmath/num.rs b/src/num.rs similarity index 100% rename from src/cgmath/num.rs rename to src/num.rs diff --git a/src/cgmath/obb.rs b/src/obb.rs similarity index 100% rename from src/cgmath/obb.rs rename to src/obb.rs diff --git a/src/cgmath/plane.rs b/src/plane.rs similarity index 100% rename from src/cgmath/plane.rs rename to src/plane.rs diff --git a/src/cgmath/point.rs b/src/point.rs similarity index 100% rename from src/cgmath/point.rs rename to src/point.rs diff --git a/src/cgmath/projection.rs b/src/projection.rs similarity index 100% rename from src/cgmath/projection.rs rename to src/projection.rs diff --git a/src/cgmath/quaternion.rs b/src/quaternion.rs similarity index 100% rename from src/cgmath/quaternion.rs rename to src/quaternion.rs diff --git a/src/cgmath/ray.rs b/src/ray.rs similarity index 100% rename from src/cgmath/ray.rs rename to src/ray.rs diff --git a/src/cgmath/rotation.rs b/src/rotation.rs similarity index 100% rename from src/cgmath/rotation.rs rename to src/rotation.rs diff --git a/src/cgmath/sphere.rs b/src/sphere.rs similarity index 100% rename from src/cgmath/sphere.rs rename to src/sphere.rs diff --git a/src/cgmath/transform.rs b/src/transform.rs similarity index 100% rename from src/cgmath/transform.rs rename to src/transform.rs diff --git a/src/cgmath/vector.rs b/src/vector.rs similarity index 100% rename from src/cgmath/vector.rs rename to src/vector.rs From 82529eec250516cd6e50d6708d3dd29e2979e68c Mon Sep 17 00:00:00 2001 From: Corey Richardson Date: Tue, 24 Jun 2014 00:25:57 -0700 Subject: [PATCH 2/2] Update transform test to use Decomposed instead of Transform3D --- src/test/transform.rs | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/src/test/transform.rs b/src/test/transform.rs index aa1dc49..ed9df02 100644 --- a/src/test/transform.rs +++ b/src/test/transform.rs @@ -22,9 +22,13 @@ use cgmath::approx::ApproxEq; #[test] fn test_invert() { let v = Vector3::new(1.0, 2.0, 3.0); - let t = Transform3D::new(1.5, Quaternion::new(0.5,0.5,0.5,0.5), Vector3::new(6.0,-7.0,8.0)); - let ti = t.get().invert().expect("Expected successful inversion"); - let vt = t.get().transform_vector( &v ); + let t = Decomposed { + scale: 1.5, + rot: Quaternion::new(0.5,0.5,0.5,0.5), + disp: Vector3::new(6.0,-7.0,8.0) + }; + let ti = t.invert().expect("Expected successful inversion"); + let vt = t.transform_vector( &v ); assert!(v.approx_eq( &ti.transform_vector( &vt ) )); }