# Spherical to cartesian coordinate transformation

**URL:** https://discourse.julialang.org/t/spherical-to-cartesian-coordinate-transformation/131202
**Category:** Visualization
**Tags:** meshes
**Created:** [July 30, 2025, 1:49pm UTC](https://discourse.julialang.org/t/spherical-to-cartesian-coordinate-transformation/131202 "2025-07-30T13:49:06Z")
**Posts on this page:** 2
**Page:** 1

<div class="post-metadata">

### Author: ![raman\_kumar](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/raman_kumar/32/26782_2.png) [@raman\_kumar](https://discourse.julialang.org/u/raman_kumar)
#### Post date: [July 30, 2025, 1:49pm UTC](https://discourse.julialang.org/t/spherical-to-cartesian-coordinate-transformation/131202/1 "2025-07-30T13:49:06Z")

</div>

How to convert spherical coordinates points to Cartesian coordinates points?

```julia-auto
using Meshes, CoordRefSystems ,GLMakie, LinearAlgebra, Unitful

r = Float32[1.6, 1.754088, 1.9230156, 2.1082115, 2.311243, 2.5338273, 2.7778475, 3.0453684, 3.3386526, 3.6601818, 4.012676, 4.3991165, 4.8227735, 5.287231, 5.7964177, 6.354642, 6.9666257, 7.637547, 8.373081]
θ = Float32[0.0, 0.09817477, 0.19634955, 0.2945243, 0.3926991]
ϕ = Float32[0.0, 0.3926991, 0.7853982, 1.1780972, 1.5707964, 1.9634954, 2.3561945, 2.7488935, 3.1415927, 3.5342917, 3.9269907, 4.3196898, 4.712389, 5.105088, 5.497787, 5.8904862, 6.2831855]

g = RectilinearGrid{𝔼,typeof(Spherical(0,0,0))}(r, θ, ϕ)

```

---

<div class="post-metadata">

### Author: ![raman\_kumar](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/raman_kumar/32/26782_2.png) [@raman\_kumar](https://discourse.julialang.org/u/raman_kumar)
#### Post date: [August 4, 2025, 11:23am UTC](https://discourse.julialang.org/t/spherical-to-cartesian-coordinate-transformation/131202/2 "2025-08-04T11:23:48Z")

</div>

I was able to convert points from Spherical to Cartesian coordinates `using CoordRefSystems`.

```julia-auto
vc = coords.(vertices(g))
cvc = convert.(Cartesian, vc)
points = [Point3f(Float32.(ustrip.((c.x, c.y, c.z)))...) for c in cvc]

```
