Spherical Coordinates
A spherical coordinate system is a coordinate system where the position of a point in 3D space is specified by three numbers: a radial distance r an azimuthal angle θ ( theta ) a polar angle φ ( phi ) Spherical coordinates comes in handy to implement an Arcball Camera . Imagine to have a virtual ball behind your screen, by clicking with your mouse you pinch the ball and by dragging the mouse you make the ball spin around its center. We can map the mouse x coordinates to be the θ angle and the mouse y coordinates to be the φ angle. We also assume that our virtual ball is a unit sphere so the radial distance is always 1. The problem is that we can specify the position of our camera only using cartesian coordinates so how do we convert spherical coordinates to cartesian coordinates? Polar Coordinates Polar coordinates are like spherical coordinates but in 2D. We can specify the position of a point using two numbers: a radial distance r an