Log in to post a comment.

// Forked from "Maurer Rose" by Samolevsky
// https://turtletoy.net/turtle/c25edbd1e5

// Maurer Rose in TurtleToy

// You can adjust these parameters
const n = 160; ; // min=1 max=777 step=1 // The 'n' value in the rose equation, controls the number of petals
const fine_n = 10; // min=0 max = 10 step=1;
const d = 148; ; // min=1 max=666 step=1 // The 'd' value, controls the density of the connecting lines
const fine_d = 1; // min=-10 max = 10 step=1;

// Set up the drawing
Canvas.setpenopacity(1);
const turtle = new Turtle();

// Define the size of the rose
const size = 88; ; // min=0 max=1000 step=1

// Function to draw a point
function drawPoint(angle) {
    const k = angle * (d + fine_d) * Math.PI / 180;
    const r = size * Math.sin((n + fine_n) * k);
    const x = r * Math.cos(k);
    const y = r * Math.sin(k);

    if (angle === 0) {
        turtle.jump(x, y);
    } else {
        turtle.goto(x, y);
    }
}

// Draw the Maurer Rose
for (let i = 0; i <= 360; i++) {
    drawPoint(i);
}

// Return whether to animate (false for static images)
function loop() {
    return false;
}