knightss27 / BezierCurve

A Processing program for visualizing Bezier Curves.
0 stars 0 forks source link

Show on screen coordinates to improve understanding #1

Open Cowboynoon opened 4 years ago

Cowboynoon commented 4 years ago

Dear knightss27

I'm new to processing, and very new to github.

Your visualizer is so elegant! Well done. I am going to refer to it constantly when I draw curves! May I add coordinates to the node points that change as they move? I'm not exactly sure how yet, but I'd like to try.

This will certainly help beginners like me to visualise these tricky curves much better as code when I can see how the coordinates need to change e.g when I'd like to animate a leaf shape to appear as if it is turning in 3D..

Looking forward to hearing from you

Cowboynoon

knightss27 commented 4 years ago

Glad you enjoyed my work!

If you'd like to try and add coordinate points, go for it, although I think that an understanding of how the curves are determined might be more useful for what you'd like to do in the future.

With this program the curve based on two equations, one for each the x and y coordinates of each point on the line. This site: https://javascript.info/bezier-curve, has a great explanation on how the curves work, and is where I derived the equations from.

For each x and y point I used the equation: P = (1−t)^3 P1 + 3(1−t)^2 t P2 +3(1−t)t^2 P3 + t^3 P4 where each P1,P2, etc is one of the anchor points, and P is a point on the curve.

It seems you're pretty new so I'd thought I'd link you to some videos about Processing, that will specifically help you understand how my program works as well. Here is a playlist of videos by Daniel Shiffman (The Coding Train) who basically teaches you Processing from the ground up. https://www.youtube.com/user/shiffman/playlists?view=50&sort=dd&shelf_id=2

Also if you do add coordinates, you'll want the code you write to all be in the display() function of the Bpoint class.

Cowboynoon commented 4 years ago

Thank you for the wonderful feedback, and useful comments! I really appreciate your effort. I can't wait to dig into the bezier curve resources you sent.

As for my enhancement suggestion, it'll have to wait until I've learned how to work with classes and objects (I've just started), but I'm excited to try it out as soon as I understand a bit more.

Thanks again!