Re: Calculating Control Points For Bsplines
Bernhard Fischer <[email protected]>
| Newsgroups | gmane.comp.lib.cairo |
|---|---|
| Message-ID | <2198719.tW10NWhQcs@winnie> |
On Monday 14 December 2015 10:41:04 Bill Spitzak wrote: > You can usually avoid working with angles entirely, by using vector math. > > For instance it is very common to make the handle slope for P1 be equal to > the slope between P0 and P2. This means the distance from P1 to the handle > ends is some multiple of (P2-P0), all done with xy pairs and no angles or > trig needed. > > Making the two handles for a point equal-length and parallel is a > requirement if you want the second derivative of the curve to be > continuous. Though it is not clear whether this results in the most > attractive curve. There are several methods and each creates a different curve. I implemented the variant you suggested above (parallel to P2-P0) and a second variant where I take the mean angle (I calculate this with x/y pairs as you suggested but I finally use the angle to find the control points along this line respectively). Here's the difference: P2-P0 parallel https://www.cypherpunk.at/download/eagle/bspline_eq.png Mean angle https://www.cypherpunk.at/download/eagle/bspline_iso.png Regards, Bernhard -- cairo mailing list [email protected] http://lists.cairographics.org/mailman/listinfo/cairo