Skip to content

Commit 4062ab9

Browse files
author
Andy Ferris
committed
Update syntax to v0.6+, drop v0.5 support
1 parent 9f3aa6b commit 4062ab9

File tree

8 files changed

+44
-40
lines changed

8 files changed

+44
-40
lines changed

.travis.yml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,11 @@ branches:
77
only:
88
- master
99
julia:
10-
- 0.5
10+
- 0.6
1111
- nightly
12+
matrix:
13+
allow_failures:
14+
- julia: nightly
1215
notifications:
1316
email: false
1417
# uncomment the following lines to override the default test script

REQUIRE

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
julia 0.5
2-
Compat 0.17.0
1+
julia 0.6
32
StaticArrays
43
Rotations 0.3.0

appveyor.yml

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,14 @@
11
environment:
22
matrix:
3-
# - JULIAVERSION: "julialang/bin/winnt/x86/0.4/julia-0.4-latest-win32.exe"
4-
# - JULIAVERSION: "julialang/bin/winnt/x64/0.4/julia-0.4-latest-win64.exe"
5-
- JULIAVERSION: "julianightlies/bin/winnt/x86/julia-latest-win32.exe"
6-
- JULIAVERSION: "julianightlies/bin/winnt/x64/julia-latest-win64.exe"
3+
- JULIA_URL: "https://julialang-s3.julialang.org/bin/winnt/x86/0.6/julia-0.6-latest-win32.exe"
4+
- JULIA_URL: "https://julialang-s3.julialang.org/bin/winnt/x64/0.6/julia-0.6-latest-win64.exe"
5+
- JULIA_URL: "https://julialangnightlies-s3.julialang.org/bin/winnt/x86/julia-latest-win32.exe"
6+
- JULIA_URL: "https://julialangnightlies-s3.julialang.org/bin/winnt/x64/julia-latest-win64.exe"
7+
8+
matrix:
9+
allow_failures:
10+
- JULIA_URL: "https://julialangnightlies-s3.julialang.org/bin/winnt/x86/julia-latest-win32.exe"
11+
- JULIA_URL: "https://julialangnightlies-s3.julialang.org/bin/winnt/x64/julia-latest-win64.exe"
712

813
branches:
914
only:

src/CoordinateTransformations.jl

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,8 @@ __precompile__()
22

33
module CoordinateTransformations
44

5-
using Compat
65
using StaticArrays
76

8-
import Compat.∘
9-
107
using Rotations
118
export RotMatrix, Quat, SpQuat, AngleAxis, RodriguesVec,
129
RotX, RotY, RotZ,

src/affine.jl

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
@compat abstract type AbstractAffineMap <: Transformation end
1+
abstract type AbstractAffineMap <: Transformation end
22

33
"""
44
Translation(v) <: AbstractAffineMap
@@ -8,15 +8,15 @@
88
Construct the `Translation` transformation for translating Cartesian points by
99
an offset `v = (dx, dy, ...)`
1010
"""
11-
immutable Translation{V} <: AbstractAffineMap
11+
struct Translation{V} <: AbstractAffineMap
1212
v::V
1313
end
1414
Translation(x::Tuple) = Translation(SVector(x))
1515
Translation(x,y) = Translation(SVector(x,y))
1616
Translation(x,y,z) = Translation(SVector(x,y,z))
1717
Base.show(io::IO, trans::Translation) = print(io, "Translation$((trans.v...))")
1818

19-
function (trans::Translation{V}){V}(x)
19+
function (trans::Translation{V})(x) where {V}
2020
x + trans.v
2121
end
2222

@@ -41,12 +41,12 @@ end
4141
A general linear transformation, constructed using `LinearMap(M)`
4242
for any matrix-like object `M`.
4343
"""
44-
immutable LinearMap{M} <: AbstractAffineMap
44+
struct LinearMap{M} <: AbstractAffineMap
4545
m::M
4646
end
47-
Base.show(io::IO, trans::LinearMap) = print(io, "LinearMap($(trans.m))") # TODO make this output more petite
47+
Base.show(io::IO, trans::LinearMap) = print(io, "LinearMap($(trans.m))") # TODO make this output more petite
4848

49-
function (trans::LinearMap{M}){M}(x)
49+
function (trans::LinearMap{M})(x) where {M}
5050
trans.m * x
5151
end
5252

@@ -95,12 +95,12 @@ converted into an affine approximation by linearizing about a point `x` using
9595
9696
For transformations which are already affine, `x` may be omitted.
9797
"""
98-
immutable AffineMap{M, V} <: AbstractAffineMap
98+
struct AffineMap{M, V} <: AbstractAffineMap
9999
m::M
100100
v::V
101101
end
102102

103-
function (trans::AffineMap{M,V}){M,V}(x)
103+
function (trans::AffineMap{M, V})(x) where {M, V}
104104
trans.m * x + trans.v
105105
end
106106

src/coordinatesystems.jl

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
"""
55
`Polar{T}(r::T, θ::T)` - 2D polar coordinates
66
"""
7-
immutable Polar{T}
7+
struct Polar{T}
88
r::T
99
θ::T
1010
end
@@ -14,9 +14,9 @@ Base.eltype{T}(::Polar{T}) = T
1414
Base.eltype{T}(::Type{Polar{T}}) = T
1515

1616
"`PolarFromCartesian()` - transformation from `AbstractVector` of length 2 to `Polar` type"
17-
immutable PolarFromCartesian <: Transformation; end
17+
struct PolarFromCartesian <: Transformation; end
1818
"`CartesianFromPolar()` - transformation from `Polar` type to `SVector{2}` type"
19-
immutable CartesianFromPolar <: Transformation; end
19+
struct CartesianFromPolar <: Transformation; end
2020

2121
Base.show(io::IO, trans::PolarFromCartesian) = print(io, "PolarFromCartesian()")
2222
Base.show(io::IO, trans::CartesianFromPolar) = print(io, "CartesianFromPolar()")
@@ -57,8 +57,8 @@ compose(::CartesianFromPolar, ::PolarFromCartesian) = IdentityTransformation()
5757

5858
# For convenience
5959
Base.convert(::Type{Polar}, v::AbstractVector) = PolarFromCartesian()(v)
60-
@inline Base.convert{V <: AbstractVector}(::Type{V}, p::Polar) = convert(V, CartesianFromPolar()(p))
61-
@inline Base.convert{V <: StaticVector}(::Type{V}, p::Polar) = convert(V, CartesianFromPolar()(p))
60+
@inline Base.convert(::Type{V}, p::Polar) where {V <: AbstractVector} = convert(V, CartesianFromPolar()(p))
61+
@inline Base.convert(::Type{V}, p::Polar) where {V <: StaticVector} = convert(V, CartesianFromPolar()(p))
6262

6363

6464
#############################
@@ -67,7 +67,7 @@ Base.convert(::Type{Polar}, v::AbstractVector) = PolarFromCartesian()(v)
6767
"""
6868
Spherical(r, θ, ϕ) - 3D spherical coordinates
6969
"""
70-
immutable Spherical{T}
70+
struct Spherical{T}
7171
r::T
7272
θ::T
7373
ϕ::T
@@ -80,7 +80,7 @@ Base.eltype{T}(::Type{Spherical{T}}) = T
8080
"""
8181
Cylindrical(r, θ, z) - 3D cylindrical coordinates
8282
"""
83-
immutable Cylindrical{T}
83+
struct Cylindrical{T}
8484
r::T
8585
θ::T
8686
z::T
@@ -91,17 +91,17 @@ Base.eltype{T}(::Cylindrical{T}) = T
9191
Base.eltype{T}(::Type{Cylindrical{T}}) = T
9292

9393
"`SphericalFromCartesian()` - transformation from 3D point to `Spherical` type"
94-
immutable SphericalFromCartesian <: Transformation; end
94+
struct SphericalFromCartesian <: Transformation; end
9595
"`CartesianFromSpherical()` - transformation from `Spherical` type to `SVector{3}` type"
96-
immutable CartesianFromSpherical <: Transformation; end
96+
struct CartesianFromSpherical <: Transformation; end
9797
"`CylindricalFromCartesian()` - transformation from 3D point to `Cylindrical` type"
98-
immutable CylindricalFromCartesian <: Transformation; end
98+
struct CylindricalFromCartesian <: Transformation; end
9999
"`CartesianFromCylindrical()` - transformation from `Cylindrical` type to `SVector{3}` type"
100-
immutable CartesianFromCylindrical <: Transformation; end
100+
struct CartesianFromCylindrical <: Transformation; end
101101
"`CylindricalFromSpherical()` - transformation from `Spherical` type to `Cylindrical` type"
102-
immutable CylindricalFromSpherical <: Transformation; end
102+
struct CylindricalFromSpherical <: Transformation; end
103103
"`SphericalFromCylindrical()` - transformation from `Cylindrical` type to `Spherical` type"
104-
immutable SphericalFromCylindrical <: Transformation; end
104+
struct SphericalFromCylindrical <: Transformation; end
105105

106106
Base.show(io::IO, trans::SphericalFromCartesian) = print(io, "SphericalFromCartesian()")
107107
Base.show(io::IO, trans::CartesianFromSpherical) = print(io, "CartesianFromSpherical()")
@@ -170,7 +170,7 @@ transform_deriv_params(::CylindricalFromCartesian, x::AbstractVector) = error("C
170170
function (::CartesianFromCylindrical)(x::Cylindrical)
171171
SVector(x.r * cos(x.θ), x.r * sin(x.θ), x.z)
172172
end
173-
function transform_deriv{T}(::CartesianFromCylindrical, x::Cylindrical{T})
173+
function transform_deriv(::CartesianFromCylindrical, x::Cylindrical{T}) where {T}
174174
= sin(x.θ)
175175
= cos(x.θ)
176176
@SMatrix [cθ -x.r*zero(T) ;
@@ -227,10 +227,10 @@ compose(::SphericalFromCylindrical, ::CylindricalFromCartesian) = SphericalFromC
227227
Base.convert(::Type{Spherical}, v::AbstractVector) = SphericalFromCartesian()(v)
228228
Base.convert(::Type{Cylindrical}, v::AbstractVector) = CylindricalFromCartesian()(v)
229229

230-
Base.convert{V <: AbstractVector}(::Type{V}, s::Spherical) = convert(V, CartesianFromSpherical()(s))
231-
Base.convert{V <: AbstractVector}(::Type{V}, c::Cylindrical) = convert(V, CartesianFromCylindrical()(c))
232-
Base.convert{V <: StaticVector}(::Type{V}, s::Spherical) = convert(V, CartesianFromSpherical()(s))
233-
Base.convert{V <: StaticVector}(::Type{V}, c::Cylindrical) = convert(V, CartesianFromCylindrical()(c))
230+
Base.convert(::Type{V}, s::Spherical) where {V <: AbstractVector} = convert(V, CartesianFromSpherical()(s))
231+
Base.convert(::Type{V}, c::Cylindrical) where {V <: AbstractVector} = convert(V, CartesianFromCylindrical()(c))
232+
Base.convert(::Type{V}, s::Spherical) where {V <: StaticVector} = convert(V, CartesianFromSpherical()(s))
233+
Base.convert(::Type{V}, c::Cylindrical) where {V <: StaticVector} = convert(V, CartesianFromCylindrical()(c))
234234

235235
Base.convert(::Type{Spherical}, c::Cylindrical) = SphericalFromCylindrical()(c)
236236
Base.convert(::Type{Cylindrical}, s::Spherical) = CylindricalFromSpherical()(s)

src/core.jl

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,21 +12,21 @@ transformation on the correct data types by overloading the call method, and
1212
usually would have the corresponding inverse transformation defined by `Base.inv()`.
1313
Efficient compositions can optionally be defined by `compose()` (equivalently `∘`).
1414
"""
15-
@compat abstract type Transformation end
15+
abstract type Transformation end
1616

1717
"""
1818
The `IdentityTransformation` is a singleton `Transformation` that returns the
1919
input unchanged, similar to `identity`.
2020
"""
21-
immutable IdentityTransformation <: Transformation; end
21+
struct IdentityTransformation <: Transformation; end
2222

2323
@inline (::IdentityTransformation)(x) = x
2424

2525
"""
2626
A `ComposedTransformation` simply executes two transformations successively, and
2727
is the fallback output type of `compose()`.
2828
"""
29-
immutable ComposedTransformation{T1 <: Transformation, T2 <: Transformation} <: Transformation
29+
struct ComposedTransformation{T1 <: Transformation, T2 <: Transformation} <: Transformation
3030
t1::T1
3131
t2::T2
3232
end

src/perspective.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ example:
1818
1919
(see also `cameramap`)
2020
"""
21-
immutable PerspectiveMap <: Transformation
21+
struct PerspectiveMap <: Transformation
2222
end
2323

2424
function (::PerspectiveMap)(v::AbstractVector)

0 commit comments

Comments
 (0)