Archive

Posts Tagged ‘Maths’

Drawing Bezier Curves

April 8th, 2011 7 comments

For the un-initiated, Bezier Curves are curves defined by a set of (at least 2) points in space (usually defined by x and y coordinates). By setting appropriate sets of points, complex curving paths can easily be defined. These could be simply drawn to the screen or used as paths for visual objects (eg a game character) to follow.

The simplest case is a curve defined by 2 points – which is just a straight line. As more points are added the curvature can become more complex. The curveTo method of the Graphics class uses a Bezier Curve of 3 points (1 point defined by the current drawing position and 2 points passed into the method).

So, if we want to draw a 2 or 3 point Bezier Curve, Flash can do the work for us, but for 4 points or more we need to handle it ourselves. Also, if we are using a Bezier Curve as a path for an object to follow, we need to know the coordinates at all positions along the path and the drawing methods of Flash wont help us with that.
Read more…