Creative Coding Blog

Maths, coding and art

Creating string art cardioid curves in Processing - variations

In this article, we will continue on from the previous cardioid curve article, and look at some other variants.

Nephroid curves

This is called a nephroid curve because it is shaped a little like a kidney (from the Greek nephros meaning kidney - nephrology is also the branch of medicine concerned with kidney health).

This curve is created in exactly the same way as a cardioid curve, but it is formed by connecting each point n to the point n*3. In code terms, we just change one line in the draw function:

void draw()
{
    clear();
    background(255);
    noFill();
    strokeWeight(1);
    
    stroke(255, 0, 0);
    PVector[] p = circlePoints(300, 300, 250, 200);
    joinPoints(p, 3);  // 3 rather than 2
}

More variants

We can of course increase the multiplier to 4 or more, and you can probably guess what will happen. Here are the cases of 4 and 5: