mercredi 23 mars 2011

Plotting Bezier curves

In the post about the Processing plotter library we practiced drawing straight lines. In fact we could spend a lifetime making exiting things with abstract patterns like this and many artist do this with great results.

But then, maybe, we would like to make a curve...

Processing has functions like arc and curve, but the curve which is used in most other software is the Bezier curve. There is a great tutorial about the Bezier curve on the Processing site:

bezier curve in processing http://processing.org/learning/curves/

But making a Bezier curve on the screen is different from plotting the Bezier curve. We need points, to plot the lines between the points on the Bezier curve.

Processing also has a solution for this:

points for plotting http://processing.org/reference/bezierPoint_.html

Having the points we can simple plot the line connecting the sequence of points.

We first master this on the screen and then proceed to plot the shapes.

Now we can do real drawing, designing letters and fonts and plot them.



You can find an example with the current lib here, the colored Bezier points can be changed like this: press the spacebar when you are near a Bezier anchor point or a control point and gently drag it along with the cursor. The curve is updated immediately.

Aucun commentaire:

Enregistrer un commentaire