1

I am writing a program in java using the jogl opengl bindings. I need to create a bezier curve that varies in thickness along the curve. So far I've only managed a thin bezier curve of single points. I'm pretty sure that this isnt going to be an easy thing to do, but i I have no idea where to even begin looking for the solution. If anyone could point me in the right direction as to how to solve this, it'd be greatly appreciated!

James

user371085
  • 11
  • 1
  • 2

1 Answers1

4

Sample the curve and for each sample point compute two points, one on each side of the curve, along the normal line at the sample point and at a distance equal to the desired width at the sample point. This creates a polygon, which you draw as filled.

lhf
  • 70,581
  • 9
  • 108
  • 149
  • Thanks for the reply! Just a few questions: - would this not create collisions on the inside of the curve? - Would it be possible to use a gradient along the curve with this method? - Would it be possible to use textures with this method? Thanks in advance :) – user371085 Jun 20 '10 at 21:04
  • If the width is small then no self collisions arise. Yes, you can use textures, as with any filled polygon. – lhf Jun 21 '10 at 00:00
  • You will have collisions if your curve bends too tightly, based on the width of the curve (wider has more collisions). Slick2D has a Java implementation you can use to plot the points. – NateS Jul 24 '12 at 02:41