Roses specified by the sinusoid

r=cos(k * theta) for various rational numbered values of the angular frequency k=n/d.

Roses specified by r=sin(k * theta ) are rotations of these roses by one-quarter period of the sinusoid in a counter-clockwise direction about the pole (origin). For proper mathematical analysis, k must be expressed in irreducible form.

Log in to post a comment.

// Rose Curve // From Python Turtle - Lissajous Curve - www.101computing.net/python-turtle-lissajous-curve/ // See: https://en.wikipedia.org/wiki/Rose_(mathematics) // Released under the MIT licence // https://mit-license.org/ // you can use this for commercial gain if you like eg you can sell artworks with this image. // You can find the Turtle API reference here: https://turtletoy.net/syntax Canvas.setpenopacity(1); // Global code will be evaluated once. const turtle = new Turtle(); const scale = 95; //min=10 max=100 step=1 const A = scale; const B = scale; const n = 6; //min=1 max=100 step=0.1 const d = 1; //min=1 max=100 step=0.1 const delta = 3.14/2; const steps = 630; //min=10 max=4800 step=1 const stepsize = 0.01; //min=0.006 max=1 step=0.01 var t=0; turtle.penup(); // The walk function will be called until it returns false. function walk(i) { if(i >0){ turtle.pendown(); } t += stepsize; k = n/d; // Apply Lissajous Parametric Equations x = A * Math.cos(k*t) * Math.cos(t); y = A * Math.cos(k*t) * Math.sin(t); turtle.goto(x,y) return i < steps; }