const rose = (centerX, centerY, stepCount, turns, n, d, A) => {
var results = [];
var k = n / d;
var stepSize = turns * 2 * Math.PI / (stepCount);
for (var theta = 0; theta < d * turns * 2 * Math.PI; theta += stepSize) {
var x = centerX + A * Math.cos(k * theta) * Math.cos(theta);
var y = centerY + A * Math.cos(k * theta) * Math.sin(theta);
results.push(x, y);
}
return results;
};
foodini.useIngredient(ingredients[0]);
var X = 80, Y = 60, SIZE = 20, STEPS = 200, TURNS = 1;
[[2,1], [4,1], [5,1]].forEach((nd, i) => {
const pts = rose(X + 2 * (SIZE + 5)* i, Y, STEPS, TURNS, nd[0], nd[1], SIZE);
foodini.drawPolyline(pts,false,false);
});
Y += 2 * (SIZE + 5);
[[3,2],[5,2], [5,4]].forEach((nd, i) => {
const pts = rose(X + 2 * (SIZE + 5)* i, Y, STEPS, TURNS, nd[0], nd[1], SIZE);
foodini.drawPolyline(pts,false,false);
});