Adds an `arrayReduce` function to KCL stdlib. Right now, it can only reduce SketchGroup values because my implementation of higher-order KCL functions sucks. But we will generalize it in the future to be able to reduce any type. This simplifies sketching polygons, e.g. ``` fn decagon = (radius) => { let step = (1/10) * tau() let sketch = startSketchAt([ (cos(0) * radius), (sin(0) * radius), ]) return arrayReduce([1..10], sketch, (i, sg) => { let x = cos(step * i) * radius let y = sin(step * i) * radius return lineTo([x, y], sg) }) } ``` Part of #3842
2.9 KiB
2.9 KiB
title, excerpt, layout
title | excerpt | layout |
---|---|---|
KCL Standard Library | Documentation for the KCL standard library for the Zoo Modeling App. | manual |
Table of Contents
- Types
- Known Issues
abs
acos
angleToMatchLengthX
angleToMatchLengthY
angledLine
angledLineOfXLength
angledLineOfYLength
angledLineThatIntersects
angledLineToX
angledLineToY
arc
arrayReduce
asin
assert
assertEqual
assertGreaterThan
assertGreaterThanOrEq
assertLessThan
assertLessThanOrEq
atan
bezierCurve
ceil
chamfer
circle
close
cm
cos
e
extrude
fillet
floor
ft
getNextAdjacentEdge
getOppositeEdge
getPreviousAdjacentEdge
helix
hole
hollow
import
inch
int
lastSegX
lastSegY
legAngX
legAngY
legLen
line
lineTo
ln
loft
log
log10
log2
m
max
min
mm
offsetPlane
patternCircular2d
patternCircular3d
patternLinear2d
patternLinear3d
patternTransform
pi
polar
pow
profileStart
profileStartX
profileStartY
revolve
segAng
segEndX
segEndY
segLen
shell
sin
sqrt
startProfileAt
startSketchAt
startSketchOn
tan
tangentialArc
tangentialArcTo
tangentialArcToRelative
tau
toDegrees
toRadians
xLine
xLineTo
yLine
yLineTo
yd