@@ -55,6 +55,12 @@ Base.inv(::CartesianFromPolar) = PolarFromCartesian()
55
55
compose (:: PolarFromCartesian , :: CartesianFromPolar ) = IdentityTransformation ()
56
56
compose (:: CartesianFromPolar , :: PolarFromCartesian ) = IdentityTransformation ()
57
57
58
+ # For convenience
59
+ 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))
62
+
63
+
58
64
# ############################
59
65
# ## 3D Coordinate Systems ###
60
66
# ############################
@@ -216,3 +222,15 @@ compose(::CylindricalFromCartesian, ::CartesianFromSpherical) = CylindricalFro
216
222
compose (:: CartesianFromCylindrical , :: CylindricalFromSpherical ) = CartesianFromSpherical ()
217
223
compose (:: CylindricalFromSpherical , :: SphericalFromCartesian ) = CylindricalFromCartesian ()
218
224
compose (:: SphericalFromCylindrical , :: CylindricalFromCartesian ) = SphericalFromCartesian ()
225
+
226
+ # For convenience
227
+ Base. convert (:: Type{Spherical} , v:: AbstractVector ) = SphericalFromCartesian ()(v)
228
+ Base. convert (:: Type{Cylindrical} , v:: AbstractVector ) = CylindricalFromCartesian ()(v)
229
+
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))
234
+
235
+ Base. convert (:: Type{Spherical} , c:: Cylindrical ) = SphericalFromCylindrical ()(c)
236
+ Base. convert (:: Type{Cylindrical} , s:: Spherical ) = CylindricalFromSpherical ()(s)
0 commit comments