polarTranslate(point: PP.Point, radius: Number, angle: Number);
point. Point in Cartesian coordinate system.
radius. Polar radius.
angle. Polar angle in radians.
The polarTranslate method translates a point in Cartesian coordinate system to polar system with the center in the initial point.
This method returns an object of the PP.Point type.
To execute the example, the HTML page must contain links to the PP.js and PP.GraphicsBase.js scenario files. Map a point with Cartesian coordinates (10, 5) from Cartesian coordinate system to polar system that has the center in this point:
// Set start point with the coordinates (10, 5) var point = new PP.Point(10, 5); // Set polar angle equal to 90 degrees var angle = PP.g2r(90); // Set polar radius var radius = 5; // Determine point coordinates in the polar coordinate system var polarPoint = PP.polarTranslate(point, radius, angle); console.log("X: " + polarPoint.getX() + ", Y: " + polarPoint.getY());
After executing the example a point with the coordinates (10, 5) is mapped from Cartesian coordinates system is mapped to the polar system to the center in this point, with polar angle equal to 90 degrees and polar radius equal to 5. Coordinates of the new point are shown in the browser console:
X: 15, Y: 5
See also: