polarToCartesian.php
Table of Contents
Functions
- polarToCartesian() : array{x: float, y: float}
- Converts a polar coordinate to a cartesian vector.
Functions
polarToCartesian()
Converts a polar coordinate to a cartesian vector.
polarToCartesian(array{angle?: float, radius?: float} $vector[, bool $degrees = true ][, bool $throwable = false ]) : array{x: float, y: float}
Parameters
- $vector : array{angle?: float, radius?: float}
-
Polar coordinates with keys 'angle' and 'radius'. Both are optional — a missing one defaults to
0, or throws when$throwableis true. - $degrees : bool = true
-
Whether the angle is in degrees (default: true).
- $throwable : bool = false
-
Whether to throw when the 'angle'/'radius' keys are missing (default: false).
Tags
Return values
array{x: float, y: float} —Cartesian representation with keys 'x' and 'y'.