Pattern transforms now have a new `rotation` parameter, letting you rotate each instance of the shape. Currently only rotation around the local origin (i.e. rotating the object around the center of its own bounding box) works correctly. Rotating around a global origin (i.e. center of the scene) will be fixed on the server side soon.
118 KiB
118 KiB
title, excerpt, layout
| title | excerpt | layout |
|---|---|---|
| int | Convert a number to an integer. | manual |
Convert a number to an integer.
Callers should use floor(), ceil(), or other rounding function first if they care about how numbers with fractional parts are converted. If the number has a fractional part, it's truncated, moving the number towards zero. If the number is NaN or has a magnitude, either positive or negative, that is too large to fit into the internal integer representation, the result is a runtime error.
int(num: number) -> i64
Tags
convert
Examples
const sketch001 = startSketchOn('XZ')
|> circle({ center: [0, 0], radius: 2 }, %)
const extrude001 = extrude(5, sketch001)
let n = int(ceil(5 / 2))
assertEqual(n, 3, 0.0001, "5/2 = 2.5, rounded up makes 3")
const pattern01 = patternTransform(n, (id) => {
return { translate: [4 * id, 0, 0] }
}, extrude001)
Arguments
num:number(REQUIRED)
Returns
i64