Log in to post a comment.

// Maurer Rose in TurtleToy

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

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

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

// Function to draw a point
function drawPoint(angle) {
    const k = angle * d * Math.PI / 180;
    const r = size * Math.sin(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;
}