Skip to content

Commit

Permalink
drop 0.3, 0.4 fix deprecation test, 0.6 and nightly (#21)
Browse files Browse the repository at this point in the history
  • Loading branch information
KristofferC committed May 25, 2017
1 parent a2048f5 commit 62200f0
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 25 deletions.
13 changes: 8 additions & 5 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,16 @@ os:
- linux
- osx
julia:
- 0.3
- 0.4
- 0.5
- 0.6
- nightly

matrix:
allow_failures:
- julia: nightly

notifications:
email: false
script:
- if [[ -a .git/shallow ]]; then git fetch --unshallow; fi
- julia -e 'Pkg.clone(pwd()); Pkg.build("Quaternions"); Pkg.test("Quaternions"; coverage=true)'

after_success:
- julia -e 'cd(Pkg.dir("Quaternions")); Pkg.add("Coverage"); using Coverage; Coveralls.submit(Coveralls.process_folder())'
3 changes: 1 addition & 2 deletions REQUIRE
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
julia 0.3

julia 0.5
DualNumbers
Compat 0.7.15
2 changes: 1 addition & 1 deletion src/Quaternions.jl
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
VERSION >= v"0.4.0-dev+6521" && __precompile__()
__precompile__()

module Quaternions
importall Base
Expand Down
32 changes: 15 additions & 17 deletions test/test_Quaternion.jl
Original file line number Diff line number Diff line change
Expand Up @@ -25,44 +25,42 @@ end

let # test rotations
qx = qrotation([1,0,0], pi/4)
@test_approx_eq qx*qx qrotation([1,0,0], pi/2)
@test_approx_eq qx^2 qrotation([1,0,0], pi/2)
@test qx*qx qrotation([1,0,0], pi/2)
@test qx^2 qrotation([1,0,0], pi/2)
theta = pi/8
qx = qrotation([1,0,0], theta)
c = cos(theta); s = sin(theta)
Rx = [1 0 0; 0 c -s; 0 s c]
@test_approx_eq rotationmatrix(qx) Rx
@test rotationmatrix(qx) Rx
theta = pi/6
qy = qrotation([0,1,0], theta)
c = cos(theta); s = sin(theta)
Ry = [c 0 s; 0 1 0; -s 0 c]
@test_approx_eq rotationmatrix(qy) Ry
@test rotationmatrix(qy) Ry
theta = 4pi/3
qz = qrotation([0,0,1], theta)
c = cos(theta); s = sin(theta)
Rz = [c -s 0; s c 0; 0 0 1]
@test_approx_eq rotationmatrix(qz) Rz
@test rotationmatrix(qz) Rz

@test_approx_eq rotationmatrix(qx*qy*qz) Rx*Ry*Rz
@test_approx_eq rotationmatrix(qy*qx*qz) Ry*Rx*Rz
@test_approx_eq rotationmatrix(qz*qx*qy) Rz*Rx*Ry
@test rotationmatrix(qx*qy*qz) Rx*Ry*Rz
@test rotationmatrix(qy*qx*qz) Ry*Rx*Rz
@test rotationmatrix(qz*qx*qy) Rz*Rx*Ry

a, b = qrotation([0,0,1], deg2rad(0)), qrotation([0,0,1], deg2rad(180))
@test_approx_eq slerp(a,b,0.0) a
@test_approx_eq slerp(a,b,1.0) b
@test_approx_eq slerp(a,b,0.5) qrotation([0,0,1], deg2rad(90))

@test_approx_eq angle(qrotation([1,0,0], 0)) 0
@test_approx_eq angle(qrotation([0,1,0], pi/4)) pi/4
@test_approx_eq angle(qrotation([0,0,1], pi/2)) pi/2

@test slerp(a,b,0.0) a
@test slerp(a,b,1.0) b
@test slerp(a,b,0.5) qrotation([0,0,1], deg2rad(90))

@test angle(qrotation([1,0,0], 0)) 0
@test angle(qrotation([0,1,0], pi/4)) pi/4
@test angle(qrotation([0,0,1], pi/2)) pi/2

let # test numerical stability of angle
ax = randn(3)
for θ in [1e-9, π - 1e-9]
q = qrotation(ax, θ)
@test_approx_eq angle(q) θ
@test angle(q) θ
end
end
end
Expand Down

0 comments on commit 62200f0

Please sign in to comment.