add polar function (#3158)

* add polarCoords fn

Signed-off-by: Jess Frazelle <github@jessfraz.com>

* updates;

Signed-off-by: Jess Frazelle <github@jessfraz.com>

* updates

Signed-off-by: Jess Frazelle <github@jessfraz.com>

* updates

Signed-off-by: Jess Frazelle <github@jessfraz.com>

---------

Signed-off-by: Jess Frazelle <github@jessfraz.com>
This commit is contained in:
Jess Frazelle
2024-07-28 22:45:40 -07:00
committed by GitHub
parent 57d4204f47
commit 8fe91259fa
13 changed files with 178 additions and 9 deletions

View File

@ -33,7 +33,7 @@ const example = extrude(10, exampleSketch)
* `data`: `AngledLineData` - Data to draw an angled line. (REQUIRED)
```js
{
// The angle of the line.
// The angle of the line (in degrees).
angle: number,
// The length of the line.
length: number,

View File

@ -32,7 +32,7 @@ const extrusion = extrude(10, sketch001)
* `data`: `AngledLineData` - Data to draw an angled line. (REQUIRED)
```js
{
// The angle of the line.
// The angle of the line (in degrees).
angle: number,
// The length of the line.
length: number,

View File

@ -34,7 +34,7 @@ const example = extrude(10, exampleSketch)
* `data`: `AngledLineData` - Data to draw an angled line. (REQUIRED)
```js
{
// The angle of the line.
// The angle of the line (in degrees).
angle: number,
// The length of the line.
length: number,

View File

@ -62,6 +62,7 @@ layout: manual
* [`patternLinear3d`](kcl/patternLinear3d)
* [`patternTransform`](kcl/patternTransform)
* [`pi`](kcl/pi)
* [`polar`](kcl/polar)
* [`pow`](kcl/pow)
* [`profileStart`](kcl/profileStart)
* [`profileStartX`](kcl/profileStartX)

48
docs/kcl/polar.md Normal file

File diff suppressed because one or more lines are too long

View File

@ -7642,7 +7642,7 @@
],
"properties": {
"angle": {
"description": "The angle of the line.",
"description": "The angle of the line (in degrees).",
"type": "number",
"format": "double"
},
@ -14307,7 +14307,7 @@
],
"properties": {
"angle": {
"description": "The angle of the line.",
"description": "The angle of the line (in degrees).",
"type": "number",
"format": "double"
},
@ -20972,7 +20972,7 @@
],
"properties": {
"angle": {
"description": "The angle of the line.",
"description": "The angle of the line (in degrees).",
"type": "number",
"format": "double"
},
@ -171849,6 +171849,58 @@
"const circumference = 70\n\nconst exampleSketch = startSketchOn(\"XZ\")\n |> circle([0, 0], circumference / (2 * pi()), %)\n\nconst example = extrude(5, exampleSketch)"
]
},
{
"name": "polar",
"summary": "Convert from polar/sphere coordinates to cartesian coordinates.",
"description": "",
"tags": [],
"args": [
{
"name": "data",
"type": "PolarCoordsData",
"schema": {
"description": "Data for polar coordinates.",
"type": "object",
"required": [
"angle",
"length"
],
"properties": {
"angle": {
"description": "The angle of the line (in degrees).",
"type": "number",
"format": "double"
},
"length": {
"description": "The length of the line.",
"type": "number",
"format": "double"
}
}
},
"required": true
}
],
"returnValue": {
"name": "",
"type": "[number]",
"schema": {
"type": "array",
"items": {
"type": "number",
"format": "double"
},
"maxItems": 2,
"minItems": 2
},
"required": true
},
"unpublished": false,
"deprecated": false,
"examples": [
"const exampleSketch = startSketchOn('XZ')\n |> startProfileAt([0, 0], %)\n |> line(polar({ angle: 30, length: 5 }), %, $thing)\n |> line([0, 5], %)\n |> line([segEndX(thing), 0], %)\n |> line([-20, 10], %)\n |> close(%)\n\nconst example = extrude(5, exampleSketch)"
]
},
{
"name": "pow",
"summary": "Computes the number to a power.",