K2 Javascript Utilities offers several utilities packages. The geometry package privide several methods to to support geometric calculations.
npm install @k2_tools/utils
import {geomtery} from "@k2_tools/utils";
K2_tools geometry utilities offers a the following geometric calculations support functions.
deg2rad
rad2deg
polar2cartesian
cartesian2polar
The deg2rad(degrees)
method accepts a number of degrees as its argument and returns the angle in radians
The rad2deg(radians)
method accepts a number of radians as its argument and returns the angle in degrees
The polar2cartesian(radius, deg)
method accepts a radius and number of degrees as its argument and returns the same as a cartesian co-ordinate
{x : number, y : nunber}
The cartesian2polar(x, y)
method accepts a cartesian point as x and y and returns the same as a polar co-ordinate
{radius : nuber, deg : number}