@@ -10,8 +10,8 @@ struct Polar{T}
10
10
end
11
11
Base. show (io:: IO , x:: Polar ) = print (io, " Polar(r=$(x. r) , θ=$(x. θ) rad)" )
12
12
Base. isapprox (p1:: Polar , p2:: Polar ; kwargs... ) = isapprox (p1. r, p2. r; kwargs... ) && isapprox (p1. θ, p2. θ; kwargs... )
13
- Base. eltype {T} (:: Polar{T} ) = T
14
- Base. eltype {T} (:: Type{Polar{T}} ) = T
13
+ Base. eltype (:: Polar{T} ) where {T} = T
14
+ Base. eltype (:: Type{Polar{T}} ) where {T} = T
15
15
16
16
" `PolarFromCartesian()` - transformation from `AbstractVector` of length 2 to `Polar` type"
17
17
struct PolarFromCartesian <: Transformation ; end
@@ -74,8 +74,8 @@ struct Spherical{T}
74
74
end
75
75
Base. show (io:: IO , x:: Spherical ) = print (io, " Spherical(r=$(x. r) , θ=$(x. θ) rad, ϕ=$(x. ϕ) rad)" )
76
76
Base. isapprox (p1:: Spherical , p2:: Spherical ; kwargs... ) = isapprox (p1. r, p2. r; kwargs... ) && isapprox (p1. θ, p2. θ; kwargs... ) && isapprox (p1. ϕ, p2. ϕ; kwargs... )
77
- Base. eltype {T} (:: Spherical{T} ) = T
78
- Base. eltype {T} (:: Type{Spherical{T}} ) = T
77
+ Base. eltype (:: Spherical{T} ) where {T} = T
78
+ Base. eltype (:: Type{Spherical{T}} ) where {T} = T
79
79
80
80
"""
81
81
Cylindrical(r, θ, z) - 3D cylindrical coordinates
@@ -87,8 +87,8 @@ struct Cylindrical{T}
87
87
end
88
88
Base. show (io:: IO , x:: Cylindrical ) = print (io, " Cylindrical(r=$(x. r) , θ=$(x. θ) rad, z=$(x. z) )" )
89
89
Base. isapprox (p1:: Cylindrical , p2:: Cylindrical ; kwargs... ) = isapprox (p1. r, p2. r; kwargs... ) && isapprox (p1. θ, p2. θ; kwargs... ) && isapprox (p1. z, p2. z; kwargs... )
90
- Base. eltype {T} (:: Cylindrical{T} ) = T
91
- Base. eltype {T} (:: Type{Cylindrical{T}} ) = T
90
+ Base. eltype (:: Cylindrical{T} ) where {T} = T
91
+ Base. eltype (:: Type{Cylindrical{T}} ) where {T} = T
92
92
93
93
" `SphericalFromCartesian()` - transformation from 3D point to `Spherical` type"
94
94
struct SphericalFromCartesian <: Transformation ; end
@@ -135,7 +135,7 @@ transform_deriv_params(::SphericalFromCartesian, x::AbstractVector) = error("Sph
135
135
function (:: CartesianFromSpherical )(x:: Spherical )
136
136
SVector (x. r * cos (x. θ) * cos (x. ϕ), x. r * sin (x. θ) * cos (x. ϕ), x. r * sin (x. ϕ))
137
137
end
138
- function transform_deriv {T} (:: CartesianFromSpherical , x:: Spherical{T} )
138
+ function transform_deriv (:: CartesianFromSpherical , x:: Spherical{T} ) where T
139
139
sθ = sin (x. θ)
140
140
cθ = cos (x. θ)
141
141
sϕ = sin (x. ϕ)
0 commit comments