Planar Kirigami
Draw planar kirigami pattern. The stiffness of the sheet can vary with the spacing, the length (l) and the number of cuts (n).
Log in to post a comment.
Canvas.setpenopacity(1);
const turtle = new Turtle();
// ----------------------
// PARAMETERS
// ----------------------
const scale = 1 // scaling factor
const spacing = 2*scale; // distance between columns
const L = 200; // rectangle length (horizontal)
const W = 100; // rectangle width (vertical)
const n = 4; // number of segments in full column
const l = 21; // length of each vertical segment
const left_clamp = 25*scale
const right_clamp = 25*scale
// ----------------------
// DERIVED VALUES
// ----------------------
const d = (W - n*l)/(n-1); // Overlapping length
const e = (d + l) / 2 // Offset of the second raw of cuts
// bottom-left corner of centered rectangle
const x0 = -L / 2;
const y0 = -W / 2;
// ----------------------
// DRAW RECTANGLE
// ----------------------
turtle.penup();
turtle.goto(x0, y0);
turtle.setheading(0);
turtle.pendown();
turtle.forward(L);
turtle.right(90);
turtle.forward(W);
turtle.right(90);
turtle.forward(L);
turtle.right(90);
turtle.forward(W);
turtle.right(90);
// ----------------------
// DRAW COLUMN FUNCTION
// ----------------------
function drawColumn(x, yStart, count) {
turtle.penup();
turtle.goto(x, yStart);
turtle.setheading(90); // vertical up
for (let i = 0; i < count; i++) {
turtle.pendown();
turtle.forward(l);
turtle.penup();
turtle.forward(d);
}
}
// ----------------------
// DRAW PATTERN
// ----------------------
let x = x0 + left_clamp;
while (x <= x0 + L - right_clamp) {
// full column (n segments) starting at y = -W/2
drawColumn(x, -W/2, n);
// offset column (n-1 segments) at x + spacing, starting at y = e -W/2
const x2 = x + spacing;
if (x2 <= x0 + L - right_clamp) {
drawColumn(x2, e -W/2, n - 1);
}
// move to next pair
x += spacing * 2;
}