@technobuddha > library > Geometry > Coordinates
Function: toCartesian()
ts
function toCartesian(point: Polar, options: UnitOptions): Cartesian;Defined in: to-cartesian.ts:18
Convert polar coordinates to cartesian
Parameters
| Parameter | Type | Description |
|---|---|---|
point | Polar | radius, angle in radians (zero points in +X direction). |
options | UnitOptions | see UnitOptions |
Returns
Object containing the X and Y-distance for the angle and radius.
Example
typescript
toCartesian({ r: 1, φ: Math.PI / 4 }); // { x: √2/2, y: √2/2 }
toCartesian({ r: 1, φ: 90 }, 'degrees'); // { x: 0, y: 1 }