#processing insight of the day: if you want curved shapes using curveVertex, you have to iter twice over the points

in this thread I'll share how I came to this hacky conclusion and I'll love to learn about better solutions

#creativecoding
the first thing I noticed is that when you change from vertex to curveVertex, you don't end up with the same shape

oh, and just to be clear, I'm using #python mode
after that, I realized that when I repeat the first 3 points, I got the curved square as I wished. but notice that if I only repeat the first 2 points, I end up with a square with one straight side
this is explained in the docs, but it's still confusing for me to get it. in a short summary, when using curveVertex, the first and the last points are only used as control points for the curve. thanks to @villares for the contribution here!
so, I came to the conclusion that, if I want to have a curve shaped object I'd have to repeat the n-1 points. that was true until I tried using triangles =S

for the triangles, I had to repeat the whole list of points and that's make sense accordingly to what the docs says
but, the last tricky thing was about the endShape(CLOSE). when I changed my 4-vertex shape code to iter over all the points, I ended up with a straight line on top of the curved shape. to fix that, you just have to remove the CLOSE

#processing #creativecoding
You can follow @bbfontes.
Tip: mention @twtextapp on a Twitter thread with the keyword “unroll” to get a link to it.

Latest Threads Unrolled: