Drawing a 3d surface patch using Bezier equations
This post covers
- What’s a bezier equation?
- Creating a 3d surface patch using Bezier curves
- Making it interactive
So what’s a Bezier curve?
Its a cubic parametric curve used to draw smooth curves, we can draw a bezier curve using two endpoints and two control points. It looks something like:
So how to draw the surface using multiple bezier curves:
Well there are multiple ways, here’s what I did
- Drew my first Bezier curve (The top one) and kept track of 10 equidistant points on that curve say HP.
- Drew first vertical Bezier curve (The left one) and kept track of 10 equidistant points on that curve say VP.
- Now for each point in HP draw a vertical bezier with same control points. Similarly for all points in VP draw horizontal Bezier curves with same control points.
- In the meanwhile you can draw points at equidistant points on each bezier curve.
- The code looks something like:
How to make it interactive: Simply change the control points according to input (mouse move, key press in my case)
Complete code available at my github repo: My-Playground/inside-the-mesh
How about we add a star to it?
Want to read more such similar contents?
If you found this article useful, please feel free to share feedbacks - it's a great incentive to see happy readers. If you found some inaccurate information please report that as well - I'd be very happy to update and give you credits!
I like to write articles on topic less covered on internet. They revolve around writing fast algorithms, image processing as well as general software engineering.
I publish many of them on Medium.
If you are already on medium - Please join 4200+ other members and Subscribe to my articles to get updates as I publish.
If you are not on Medium - Medium has millions of amazing articles from 100K+ authors. To get access to those, please join using my referral link. This will give you access to all the benefits of Medium and Medium shall pay me a piece to support my writing!
Thanks!
I like to write articles on topic less covered on internet. They revolve around writing fast algorithms, image processing as well as general software engineering.
I publish many of them on Medium.
If you are already on medium - Please join 4200+ other members and Subscribe to my articles to get updates as I publish.
If you are not on Medium - Medium has millions of amazing articles from 100K+ authors. To get access to those, please join using my referral link. This will give you access to all the benefits of Medium and Medium shall pay me a piece to support my writing!
Thanks!