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
Screenshot of my experiment
Screenshot of my experiment

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:

bezier curve

Interested in reading more? Read [ here – wikipedia ]

So how to draw the surface using multiple bezier curves:

Well there are multiple ways, here’s what I did:

  1. Drew my first Bezier curve (The top one) and kept track of 10 equidistant points on that curve say HP.
  2. Drew first vertical Bezier curve (The left one) and kept track of 10 equidistant points on that curve say VP.
  3. 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.
  4. 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?


update this post soon on how to create this, however if you are too eager – have a look at my github repo: https://github.com/mebjas/my-playground/tree/master/is%20inside%20the%20mesh%3F

Add a Comment

Your email address will not be published. Required fields are marked *