Qu

stamp

Builtin index · Plotting

stamp(layer, x, y, [scale=], [rotate=])

Input: layer, x, y, scale, rotate · Output: no output

What it is

Places a transformed copy of a captured layer (the value capture returned) at position (x, y) (numbers, data units). scale= (number, default 1) and rotate= (number, degrees, default 0) transform the copy: translate, then scale, then rotate about the layer's own origin.

Overloads

One call shape — this function is not overloaded.

CodeInputOutputDescription
stamp(layer, x, y, [scale=], [rotate=])
layer numberPlaces a transformed copy of a captured layer (the value capture returned) at position (x, y) (numbers, data units).
x numberPlaces a transformed copy of a captured layer (the value capture returned) at position (x, y) (numbers, data units).
y numberPlaces a transformed copy of a captured layer (the value capture returned) at position (x, y) (numbers, data units).
scale number, optionalscale= (number, default 1) and rotate= (number, degrees, default 0) transform the copy: translate, then scale, then rotate about the layer's own origin.
rotate number, optionalscale= (number, default 1) and rotate= (number, degrees, default 0) transform the copy: translate, then scale, then rotate about the layer's own origin.
no output—

Examples

From the documentation, and run by the build -- the output and the figure below are what the engine actually produced. Simplest first.

function sensor()
    circle(0, 0, 0.28, fill = "#4169e1", alpha = 0.9)
    circle(0, 0, 0.44, color = "#4169e1", width = 1.2)
    plot([0, 0], [-0.44, -0.9], color = "#4169e1", width = 1.2)
end function

s = capture("sensor")
stamp(s, 2, 5)
stamp(s, 6, 5, scale = 0.7)
stamp(s, 10, 5, rotate = 180)

not run by the build — this one needs something the repository cannot supply · from plotting

How it works

stamp(layer, x, y, [scale=, rotate=]) — a copy, placed. Translate, then scale, then rotate about the layer's own origin: the order that makes stamp(l, 3, 4, rotate = 30) mean "put it there, turned", which is what anyone expects.

From the note above this builtin in the interpreter, where the reasoning was written down as it was built.