Add math functions back to the prelude (#6595)
* Add math functions back to the prelude * Update output * Update docs
This commit is contained in:
@ -5,7 +5,7 @@
|
||||
|
||||
fn cond(bools) {
|
||||
return fn(a, b) {
|
||||
x = math::min([math::max([-1, a-b]), 1]) + 1
|
||||
x = min([max([-1, a-b]), 1]) + 1
|
||||
return bools[x]
|
||||
}
|
||||
}
|
||||
@ -75,8 +75,8 @@ fn setLength(state, q) {
|
||||
|
||||
fn Gt2(state) { return setLength(state, state.currentLength * state.factor) }
|
||||
fn Lt2(state) { return setLength(state, state.currentLength / state.factor) }
|
||||
fn Add(state) { return setAngle(state, math::rem(state.currentAngle - state.angle, divisor = 360)) }
|
||||
fn Sub(state) { return setAngle(state, math::rem(state.currentAngle + state.angle, divisor = 360)) }
|
||||
fn Add(state) { return setAngle(state, rem(state.currentAngle - state.angle, divisor = 360)) }
|
||||
fn Sub(state) { return setAngle(state, rem(state.currentAngle + state.angle, divisor = 360)) }
|
||||
|
||||
// Only necessary to get around recursion limitations...
|
||||
fn F(state, F) {
|
||||
|
||||
@ -5,7 +5,7 @@ t = 0.005 // taper factor [0-1)
|
||||
// Defines how to modify each layer of the vase.
|
||||
// Each replica is shifted up the Z axis, and has a smoothly-varying radius
|
||||
fn transform(replicaId) {
|
||||
scale = r * math::abs(1 - (t * replicaId)) * (5 + math::cos((replicaId / 8): number(rad)))
|
||||
scale = r * abs(1 - (t * replicaId)) * (5 + cos((replicaId / 8): number(rad)))
|
||||
return {
|
||||
translate = [0, 0, replicaId * 10],
|
||||
scale = [scale, scale, 0],
|
||||
|
||||
Reference in New Issue
Block a user