ycoordinates. These coordinates are known as Cartesian coordinates, named for René Descartes, the French mathematician who developed the ideas behind Cartesian space.
- Cartesian coordinate—the x,y components of a vector
- Polar coordinate—the magnitude (length) and direction (angle) of a vector
sine(theta) = y/r → y = r * sine(theta)cosine(theta) = x/r → x = r * cosine(theta)
ris 75 and
thetais 45 degrees (or PI/4 radians), we can calculate
yas below. The functions for sine and cosine in ProcessingJS are
cos(), respectively. They each take one argument, an angle measured in degrees.
var r = 75; var theta = 45; // Convert polar to cartesian var x = r * cos(theta); var y = r * sin(theta);