Differences
This shows you the differences between two versions of the page.
Both sides previous revision Previous revision Next revision | Previous revision | ||
buzz_syntax_cheatsheet [2016/04/09 22:56] – root | buzz_syntax_cheatsheet [2018/03/23 18:17] (current) – jayam | ||
---|---|---|---|
Line 111: | Line 111: | ||
# creating a lambda | # creating a lambda | ||
- | f = function(a, b) { | + | lambda |
| | ||
- | }</ | + | } |
+ | lambda(1,2)</ | ||
^ Math |<code buzz># all the math functions are part of the ' | ^ Math |<code buzz># all the math functions are part of the ' | ||
Line 131: | Line 132: | ||
v1.y = v1.y + v2.y | v1.y = v1.y + v2.y | ||
} | } | ||
- | v1 = { x=1, y=2 } | + | v1 = { .x=1, .y=2 } |
- | v2 = { x=3, y=1 } | + | v2 = { .x=3, .y=1 } |
vec2_sum(v1, | vec2_sum(v1, | ||
# Getting the angle of a 2D vector | # Getting the angle of a 2D vector | ||
function vec2_angle(v) { | function vec2_angle(v) { | ||
- | | + | |
}</ | }</ | ||
^ Swarm management |<code buzz># creation of a swarm with identifier 1 | ^ Swarm management |<code buzz># creation of a swarm with identifier 1 | ||
Line 180: | Line 181: | ||
function(rid, | function(rid, | ||
log(" | log(" | ||
- | " | + | " |
- | " | + | " |
" | " | ||
Line 193: | Line 194: | ||
math.sin(data.azimuth) | math.sin(data.azimuth) | ||
c.z = data.distance * math.sin(data.elevation) | c.z = data.distance * math.sin(data.elevation) | ||
- | return c }) | + | return c |
+ | | ||
# Reduction (accum is a table) | # Reduction (accum is a table) | ||
Line 202: | Line 204: | ||
accum.z = accum.z + data.z | accum.z = accum.z + data.z | ||
return accum | return accum | ||
- | }, {x=0, y=0, z=0}) | + | }, {.x=0, .y=0, .z=0}) |
# Filtering | # Filtering |