mirror of
https://github.com/JustinSDK/dotSCAD.git
synced 2025-08-21 05:52:16 +02:00
add spherical_coordinate
This commit is contained in:
@@ -151,7 +151,7 @@ These examples incubate dotSCAD and dotSCAD refactors these examples. See [examp
|
|||||||
- [util/slice](https://openhome.cc/eGossip/OpenSCAD/lib3x-slice.html)
|
- [util/slice](https://openhome.cc/eGossip/OpenSCAD/lib3x-slice.html)
|
||||||
- [util/some](https://openhome.cc/eGossip/OpenSCAD/lib3x-some.html)
|
- [util/some](https://openhome.cc/eGossip/OpenSCAD/lib3x-some.html)
|
||||||
- [util/sort](https://openhome.cc/eGossip/OpenSCAD/lib3x-sort.html)
|
- [util/sort](https://openhome.cc/eGossip/OpenSCAD/lib3x-sort.html)
|
||||||
- util/spherical_coordinate
|
- [util/spherical_coordinate](https://openhome.cc/eGossip/OpenSCAD/lib3x-spherical_coordinate.html)
|
||||||
- [util/sub_str](https://openhome.cc/eGossip/OpenSCAD/lib3x-sub_str.html)
|
- [util/sub_str](https://openhome.cc/eGossip/OpenSCAD/lib3x-sub_str.html)
|
||||||
- [util/split_str](https://openhome.cc/eGossip/OpenSCAD/lib3x-split_str.html)
|
- [util/split_str](https://openhome.cc/eGossip/OpenSCAD/lib3x-split_str.html)
|
||||||
- [util/sum](https://openhome.cc/eGossip/OpenSCAD/lib3x-sum.html)
|
- [util/sum](https://openhome.cc/eGossip/OpenSCAD/lib3x-sum.html)
|
||||||
|
19
docs/lib3x-spherical_coordinate.md
Normal file
19
docs/lib3x-spherical_coordinate.md
Normal file
@@ -0,0 +1,19 @@
|
|||||||
|
# spherical_coordinate
|
||||||
|
|
||||||
|
Converts from Cartesian to Polar coordinates. It returns `[radius, theta, phi]`.
|
||||||
|
|
||||||
|
**Since:** 3.0
|
||||||
|
|
||||||
|
## Parameters
|
||||||
|
|
||||||
|
- `point` : The Cartesian coordinates of a point.
|
||||||
|
|
||||||
|
## Examples
|
||||||
|
|
||||||
|
use <util/spherical_coordinate.scad>;
|
||||||
|
|
||||||
|
coord = spherical_coordinate([100, 100, 100]);
|
||||||
|
r = round(coord[0]);
|
||||||
|
theta = round(coord[1]);
|
||||||
|
phi = round(coord[2]);
|
||||||
|
assert([r, theta, phi] == [173, 45, 35]);
|
@@ -1,3 +1,13 @@
|
|||||||
|
/**
|
||||||
|
* spherical_coordinate.scad
|
||||||
|
*
|
||||||
|
* @copyright Justin Lin, 2020
|
||||||
|
* @license https://opensource.org/licenses/lgpl-3.0.html
|
||||||
|
*
|
||||||
|
* @see https://openhome.cc/eGossip/OpenSCAD/lib3x-spherical_coordinate.html
|
||||||
|
*
|
||||||
|
**/
|
||||||
|
|
||||||
function spherical_coordinate(point) =
|
function spherical_coordinate(point) =
|
||||||
// mathematics [r, theta, phi]
|
// mathematics [r, theta, phi]
|
||||||
[
|
[
|
||||||
|
Reference in New Issue
Block a user