ⓘ This web page is about the old AlgoSim 2 software. Perhaps you are looking for the new Algosim 3 application?
AlgoSim
Homepage | Screenshots | Gallery of Visualisation | User's Guide | Function Reference | Download | FAQ | Support | Bugs and Solutions | Donate

Reference: sphericalCoords

sphericalCoords(S) applies the transformation

x = r⋅sin(θ)⋅cos(φ)
y = r⋅sin(θ)⋅sin(φ)
z = r⋅cos(θ)

to all three-dimensional spherical real vectors (r, θ, φ) in the set S, and returns the new set of Cartesian coordinates (x, y, z).

This is useful for plotting spherical graphs. Simply create a set S of spherical coordinates (r, θ, φ) and then transform it using

S ≔ sphericalCoords(S)

after which it can be plotted using drawSet3, drawLines3, etc.

Example: An illustrative way to draw a grid sphere with radius 4.
         net ≔ createNet(0, π, 0.01, π/12, 0, 2⋅π, 0.01, π/12)
         paramNet ≔ createImage("❨4, r_1, r_2❩", "r", net)
         sphere ≔ sphericalCoords(paramNet)
         drawSet3("sphere")