Multiple particles are flying around in my sketch. When the points are close enough to each other, lines are drawn in between. When three points are close to each other, the lines shape a triangle between the points.
Now, I would like to create more round / amorphous shapes in the background of these triangles (see orange shape in the image attached).
I have found the “curveVertex()” function but lack programming skills to make use of it. Any help?
Thanks a lot!
There is this processing library Handy, that helps you create shapes with a hand drawn look that you might find interesting. It even formed part of a scientific paper.
It is actually quite tricky to achieve that effect because the first thing your should do, prior to drawing the outlines, is to detect your shapes.
In your drawing, it is quite simple but what if you had one more point in the middle of your triangle that was connected to all the other points? You don’t want to consider this point as part of your shape. And what about the 3 small triangles that it is forming? Do you also want to count them as shape to outline?
Here is another tutorial that also may help:
One way of doing it might be:
- find a center point of the triangle
- express the three points of the triangle as PVectors relative to that center point with PVector.sub
- increase the magnitude of the PVectors, pushing them out from the center.
Now you have a larger triangle outside your original one.
Next you need some extra points that your curves can go through – you probably want to find 1-3 points between each pair of outer points. Maybe using PVector.lerp to find points between points in your outline?
Okay, now you have a bunch of points in an outline outside your triangle. Try connecting them in a curvy way – for example, start by trying a CLOSEd curvevertex…