Generalise and simplify offsetPlane (#5429)

* Generalise and simplify offsetPlane

Signed-off-by: Nick Cameron <nrc@ncameron.org>

* A snapshot a day keeps the bugs away! 📷🐛 (OS: namespace-profile-ubuntu-8-cores)

* A snapshot a day keeps the bugs away! 📷🐛 (OS: namespace-profile-ubuntu-8-cores)

---------

Signed-off-by: Nick Cameron <nrc@ncameron.org>
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
This commit is contained in:
Nick Cameron
2025-02-20 15:55:29 +13:00
committed by GitHub
parent 695c432d1e
commit f35cd3ef26
6 changed files with 151 additions and 102 deletions

View File

@ -9,7 +9,7 @@ Offset a plane by a distance along its normal.
For example, if you offset the 'XZ' plane by 10, the new plane will be parallel to the 'XZ' plane and 10 units away from it.
```js
offsetPlane(std_plane: StandardPlane, offset: number) -> Plane
offsetPlane(plane: PlaneData, offset: number) -> Plane
```
@ -17,7 +17,7 @@ offsetPlane(std_plane: StandardPlane, offset: number) -> Plane
| Name | Type | Description | Required |
|----------|------|-------------|----------|
| `std_plane` | [`StandardPlane`](/docs/kcl/types/StandardPlane) | Which standard plane (e.g. XY) should this new plane be created from? | Yes |
| `plane` | [`PlaneData`](/docs/kcl/types/PlaneData) | The plane (e.g. 'XY') which this new plane is created from. | Yes |
| `offset` | `number` | Distance from the standard plane this new plane will be created at. | Yes |
### Returns

View File

@ -147531,12 +147531,12 @@
"keywordArguments": true,
"args": [
{
"name": "std_plane",
"type": "StandardPlane",
"name": "plane",
"type": "PlaneData",
"schema": {
"$schema": "https://spec.openapis.org/oas/3.0/schema/2019-04-02#/definitions/Schema",
"title": "StandardPlane",
"description": "One of the standard planes.",
"title": "PlaneData",
"description": "Orientation data that can be used to construct a plane, not a plane in itself.",
"oneOf": [
{
"description": "The XY plane.",
@ -147579,12 +147579,89 @@
"enum": [
"-YZ"
]
},
{
"description": "A defined plane.",
"type": "object",
"required": [
"plane"
],
"properties": {
"plane": {
"type": "object",
"required": [
"origin",
"xAxis",
"yAxis",
"zAxis"
],
"properties": {
"origin": {
"description": "Origin of the plane.",
"allOf": [
{
"$ref": "#/components/schemas/Point3d"
}
]
},
"xAxis": {
"description": "What should the planes X axis be?",
"allOf": [
{
"$ref": "#/components/schemas/Point3d"
}
]
},
"yAxis": {
"description": "What should the planes Y axis be?",
"allOf": [
{
"$ref": "#/components/schemas/Point3d"
}
]
},
"zAxis": {
"description": "The z-axis (normal).",
"allOf": [
{
"$ref": "#/components/schemas/Point3d"
}
]
}
}
}
},
"additionalProperties": false
}
]
],
"definitions": {
"Point3d": {
"type": "object",
"required": [
"x",
"y",
"z"
],
"properties": {
"x": {
"type": "number",
"format": "double"
},
"y": {
"type": "number",
"format": "double"
},
"z": {
"type": "number",
"format": "double"
}
}
}
}
},
"required": true,
"includeInSnippet": true,
"description": "Which standard plane (e.g. XY) should this new plane be created from?",
"description": "The plane (e.g. 'XY') which this new plane is created from.",
"labelRequired": false
},
{
@ -147594,7 +147671,31 @@
"$schema": "https://spec.openapis.org/oas/3.0/schema/2019-04-02#/definitions/Schema",
"title": "double",
"type": "number",
"format": "double"
"format": "double",
"definitions": {
"Point3d": {
"type": "object",
"required": [
"x",
"y",
"z"
],
"properties": {
"x": {
"type": "number",
"format": "double"
},
"y": {
"type": "number",
"format": "double"
},
"z": {
"type": "number",
"format": "double"
}
}
}
}
},
"required": true,
"includeInSnippet": true,