polar static method

GPoint polar(
  1. double length,
  2. double angle
)

Returns a new GPoint object in polar coordinates based on a length and an angle.

The length parameter specifies the distance from the origin (0,0), and the angle parameter specifies the angle of the vector in radians, with 0 pointing to the right and increasing in the counterclockwise direction. Returns a GPoint object with x and y coordinates calculated from the polar coordinates.

Implementation

static GPoint polar(double length, double angle) {
  return GPoint(Math.cos(angle) * length, Math.sin(angle) * length);
}