Coordinate Systems
The Mechanica universe uses a Cartesian coordinate system to describe the position of objects in the universe. For spherical coordinates, Mechanica uses the spherical coordinates \((r, \theta, \phi)\) as often used in mathematics: radial distance \(r\), azimuthal angle \(\theta\), and polar angle \(\phi\).
The cartesian coordinates of every particle are accessible
via the particle property position
p = MyParticleType.items()[0]
print('Particle position:', p.position)
Spherical coordinates of a particle can be accessed with respect to
the frame of the universe, to the position of another particle, or to
the position of an arbitrary point, using the particle method
sphericalPosition
# Report some spherical coordinates in various frames of particle "p"
print('Spherical coordinates (global) :', p.sphericalPosition())
print('Spherical coordinates (particle):', p.sphericalPosition(particle=p_other))
print('Spherical coordinates (point) :', p.sphericalPosition(origin=[0.0, 1.0, 2.0])