Skip to content

@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

ParameterTypeDescription
pointPolarradius, angle in radians (zero points in +X direction).
optionsUnitOptionssee UnitOptions

Returns

Cartesian

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 }