bezier splines

Started by
1 comment, last by FVIRTMAN 18 years, 9 months ago
I've been reading up on bezier splines, and I'm assuming that's what photoshop uses for it's "pen tool". I can't, however, figure out how they get their little control bars to work. Is it actually a different kind of spline? Any information on the math behind that nifty little tool would be appreciated.
----------------------------------------------------------No matter how eloquently you state your argument, the fact remains that the toilet seat is a bistable device. Therefore it's natural position is no more down than it is up.[SDL Smooth Tile Scrolling]
Advertisement
I don't know for sure that they're using Bezier splines, but they probably are. The way it would work is every curve is a piecewise 3rd order Bezier curve. That is, each set of 4 points is a convex hull for the Bezier curve. The two interior points are the control bar points, one attached to each endpoint. The two endpoints are, well, the endpoints. When you have, say, 3 points that the piecewise curve passes through...what you actually have internally is two 3rd order Bezier curves. One that joins the first 2 of the piecewise curve points----which adds two control bar points between the first 2 points, and a second Bezier curve that joins the middle and last piecewise curve points, adding an additional two control bar points beween the last 2 piecewise curve points. Now, with the 2 Bezier curves, notice that the middle piecewise curve point is attached to 2 control points. You can do cool constraints with those 2 control points to get the different controls in Photoshop. For example, if you require that the 2 control points be colinear with the middle piecewise curve point, then your overall curve will be smooth/continuous at that middle point and it'll look like you have just one big smooth curve. Or, you can free up the control points and let them move freely, in which case the overall curve will have a discontinuous point---a corner---in the middle of it at that middle point.

Hope this helps!
Graham Rhodes Moderator, Math & Physics forum @ gamedev.net
Bezier curves can be easyly computed with the recursive DE CASTELJAU 's algorithm.

This topic is closed to new replies.

Advertisement