Support calling KCL std KW fns, and move circle to KCL std

Signed-off-by: Nick Cameron <nrc@ncameron.org>
This commit is contained in:
Nick Cameron
2025-03-21 20:22:52 +13:00
parent c545ad71c6
commit 0913d3ebdc
87 changed files with 11737 additions and 9700 deletions

View File

@ -5,7 +5,7 @@
/// ```
/// circumference = 70
///
/// exampleSketch = startSketchOn("XZ")
/// exampleSketch = startSketchOn(XZ)
/// |> circle(center = [0, 0], radius = circumference/ (2 * PI))
///
/// example = extrude(exampleSketch, length = 5)
@ -15,7 +15,7 @@ export PI = 3.14159265358979323846264338327950288_
/// The value of Eulers number `e`.
///
/// ```
/// exampleSketch = startSketchOn("XZ")
/// exampleSketch = startSketchOn(XZ)
/// |> startProfileAt([0, 0], %)
/// |> angledLine({
/// angle = 30,
@ -31,7 +31,7 @@ export E = 2.71828182845904523536028747135266250_
/// The value of `tau`, the full circle constant (τ). Equal to 2π.
///
/// ```
/// exampleSketch = startSketchOn("XZ")
/// exampleSketch = startSketchOn(XZ)
/// |> startProfileAt([0, 0], %)
/// |> angledLine({
/// angle = 50,
@ -47,7 +47,7 @@ export TAU = 6.28318530717958647692528676655900577_
/// Compute the cosine of a number (in radians).
///
/// ```
/// exampleSketch = startSketchOn("XZ")
/// exampleSketch = startSketchOn(XZ)
/// |> startProfileAt([0, 0], %)
/// |> angledLine({
/// angle = 30,
@ -59,12 +59,12 @@ export TAU = 6.28318530717958647692528676655900577_
/// example = extrude(exampleSketch, length = 5)
/// ```
@(impl = std_rust)
export fn cos(num: number(rad)): number(_) {}
export fn cos(@num: number(rad)): number(_) {}
/// Compute the sine of a number (in radians).
///
/// ```
/// exampleSketch = startSketchOn("XZ")
/// exampleSketch = startSketchOn(XZ)
/// |> startProfileAt([0, 0], %)
/// |> angledLine({
/// angle = 50,
@ -76,12 +76,12 @@ export fn cos(num: number(rad)): number(_) {}
/// example = extrude(exampleSketch, length = 5)
/// ```
@(impl = std_rust)
export fn sin(num: number(rad)): number(_) {}
export fn sin(@num: number(rad)): number(_) {}
/// Compute the tangent of a number (in radians).
///
/// ```
/// exampleSketch = startSketchOn("XZ")
/// exampleSketch = startSketchOn(XZ)
/// |> startProfileAt([0, 0], %)
/// |> angledLine({
/// angle = 50,
@ -93,4 +93,4 @@ export fn sin(num: number(rad)): number(_) {}
/// example = extrude(exampleSketch, length = 5)
/// ```
@(impl = std_rust)
export fn tan(num: number(rad)): number(_) {}
export fn tan(@num: number(rad)): number(_) {}

View File

@ -3,6 +3,7 @@
// Note that everything in the prelude is treated as exported.
export import * from "std::math"
export import * from "std::sketch"
/// A number
///

View File

@ -0,0 +1,25 @@
@no_std
/// Construct a 2-dimensional circle, of the specified radius, centered at
/// the provided (x, y) origin point.
///
/// ```
/// exampleSketch = startSketchOn(-XZ)
/// |> circle(center = [0, 0], radius = 10)
///
/// example = extrude(exampleSketch, length = 5)
/// ```
///
/// ```
/// exampleSketch = startSketchOn(XZ)
/// |> startProfileAt([-15, 0], %)
/// |> line(end = [30, 0])
/// |> line(end = [0, 30])
/// |> line(end = [-30, 0])
/// |> close()
/// |> hole(circle(center = [0, 15], radius = 5), %)
///
/// example = extrude(exampleSketch, length = 5)
/// ```
@(impl = std_rust)
export fn circle(@sketch_or_surface: Sketch | Plane | Face, center: Point2d, radius: number, tag?: tag): Sketch {}