@@ -129,7 +129,8 @@ function Spherical(r, θ, ϕ)
129
129
end
130
130
131
131
Base. show (io:: IO , x:: Spherical ) = print (io, " Spherical(r=$(x. r) , θ=$(x. θ) rad, ϕ=$(x. ϕ) rad)" )
132
- Base. isapprox (p1:: Spherical , p2:: Spherical ; kwargs... ) = isapprox (p1. r, p2. r; kwargs... ) && isapprox (p1. θ, p2. θ; kwargs... ) && isapprox (p1. ϕ, p2. ϕ; kwargs... )
132
+ Base. isapprox (p1:: Spherical , p2:: Spherical ; kwargs... ) =
133
+ isapprox (p1. r, p2. r; kwargs... ) && isapprox (p1. θ, p2. θ; kwargs... ) && isapprox (p1. ϕ, p2. ϕ; kwargs... )
133
134
134
135
"""
135
136
Cylindrical(r, θ, z)
@@ -151,7 +152,8 @@ function Cylindrical(r, θ, z)
151
152
end
152
153
153
154
Base. show (io:: IO , x:: Cylindrical ) = print (io, " Cylindrical(r=$(x. r) , θ=$(x. θ) rad, z=$(x. z) )" )
154
- Base. isapprox (p1:: Cylindrical , p2:: Cylindrical ; kwargs... ) = isapprox (p1. r, p2. r; kwargs... ) && isapprox (p1. θ, p2. θ; kwargs... ) && isapprox (p1. z, p2. z; kwargs... )
155
+ Base. isapprox (p1:: Cylindrical , p2:: Cylindrical ; kwargs... ) =
156
+ isapprox (p1. r, p2. r; kwargs... ) && isapprox (p1. θ, p2. θ; kwargs... ) && isapprox (p1. z, p2. z; kwargs... )
155
157
156
158
"""
157
159
SphericalFromCartesian()
@@ -217,7 +219,8 @@ function transform_deriv(::SphericalFromCartesian, x::AbstractVector)
217
219
- fxy* cxy cxy zero (T);
218
220
f* x[1 ] f* x[2 ] rxy/ (r* r) ]
219
221
end
220
- transform_deriv_params (:: SphericalFromCartesian , x:: AbstractVector ) = error (" SphericalFromCartesian has no parameters" )
222
+ transform_deriv_params (:: SphericalFromCartesian , x:: AbstractVector ) =
223
+ error (" SphericalFromCartesian has no parameters" )
221
224
222
225
function (:: CartesianFromSpherical )(x:: Spherical )
223
226
sθ, cθ = sincos (x. θ)
@@ -231,7 +234,8 @@ function transform_deriv(::CartesianFromSpherical, x::Spherical{T}) where T
231
234
sθ* cϕ x. r* cθ* cϕ - x. r* sθ* sϕ ;
232
235
sϕ zero (T) x. r * cϕ ]
233
236
end
234
- transform_deriv_params (:: CartesianFromSpherical , x:: Spherical ) = error (" CartesianFromSpherical has no parameters" )
237
+ transform_deriv_params (:: CartesianFromSpherical , x:: Spherical ) =
238
+ error (" CartesianFromSpherical has no parameters" )
235
239
236
240
# Cartesian <-> Cylindrical
237
241
function (:: CylindricalFromCartesian )(x:: AbstractVector )
@@ -251,7 +255,8 @@ function transform_deriv(::CylindricalFromCartesian, x::AbstractVector)
251
255
- f* c c zero (T) ;
252
256
zero (T) zero (T) one (T) ]
253
257
end
254
- transform_deriv_params (:: CylindricalFromCartesian , x:: AbstractVector ) = error (" CylindricalFromCartesian has no parameters" )
258
+ transform_deriv_params (:: CylindricalFromCartesian , x:: AbstractVector ) =
259
+ error (" CylindricalFromCartesian has no parameters" )
255
260
256
261
function (:: CartesianFromCylindrical )(x:: Cylindrical )
257
262
sθ, cθ = sincos (x. θ)
@@ -263,7 +268,8 @@ function transform_deriv(::CartesianFromCylindrical, x::Cylindrical{T}) where {T
263
268
sθ x. r* cθ zero (T) ;
264
269
zero (T) zero (T) one (T) ]
265
270
end
266
- transform_deriv_params (:: CartesianFromPolar , x:: Cylindrical ) = error (" CartesianFromCylindrical has no parameters" )
271
+ transform_deriv_params (:: CartesianFromPolar , x:: Cylindrical ) =
272
+ error (" CartesianFromCylindrical has no parameters" )
267
273
268
274
function (:: CylindricalFromSpherical )(x:: Spherical )
269
275
sϕ, cϕ = sincos (x. ϕ)
@@ -274,7 +280,8 @@ function transform_deriv(::CylindricalFromSpherical, x::Spherical)
274
280
M2 = transform_deriv (CartesianFromSpherical (), x)
275
281
return M1* M2
276
282
end
277
- transform_deriv_params (:: CylindricalFromSpherical , x:: Spherical ) = error (" CylindricalFromSpherical has no parameters" )
283
+ transform_deriv_params (:: CylindricalFromSpherical , x:: Spherical ) =
284
+ error (" CylindricalFromSpherical has no parameters" )
278
285
279
286
function (:: SphericalFromCylindrical )(x:: Cylindrical )
280
287
Spherical (hypot (x. r,x. z),x. θ,atan (x. z,x. r))
@@ -284,7 +291,8 @@ function transform_deriv(::SphericalFromCylindrical, x::Cylindrical)
284
291
M2 = transform_deriv (CartesianFromCylindrical (), x)
285
292
return M1* M2
286
293
end
287
- transform_deriv_params (:: SphericalFromCylindrical , x:: Cylindrical ) = error (" SphericalFromCylindrical has no parameters" )
294
+ transform_deriv_params (:: SphericalFromCylindrical , x:: Cylindrical ) =
295
+ error (" SphericalFromCylindrical has no parameters" )
288
296
289
297
Base. inv (:: SphericalFromCartesian ) = CartesianFromSpherical ()
290
298
Base. inv (:: CartesianFromSpherical ) = SphericalFromCartesian ()
0 commit comments