RE: SV: pathing.
- Posted by cetaylor at compuserve.com Sep 12, 2002
- 366 views
Personally, I think b-spline produces a nicer curve than Bezier. The math isn't as elegant, but the result is better. Colin Taylor OthelloVivaldi at hotmail.com wrote: > > Colin, > > Vega.e is just beautiful. The explode_spline() routine was much faster > than my Bezier curve. When drawn on a pixel screen, the two curves > almost exactly overwrite each other. The following compares the two > routines (numbers in seconds on a 350MHz PII, code is appended below): > > Spline BB_graph > > 0.660000 1.040000 > 0.660000 1.100000 > 0.710000 1.050000 > 0.710000 1.100000 > 0.770000 1.040000 > > In addition to this, your 'splines' can also deal with any number of > coordinates as input, not just 4 points. I take my hat off. > > To improve on this, I guess one would have to look for some way to do it > with only integers. Hmmmmm... > > > -- Test code: > > include vega.e > include bb_graph.e > > sequence s, p > constant WH = {800, 600}, NUM = 100, RESO = 1000 > constant TEST_SET = rand(repeat(repeat(WH, 4), NUM)) - 1 > atom t > set_curve_res(RESO) > puts(1, "\nSpline\t\tBB_graph\n\n") > for k = 1 to 5 do > t = time() > for j = 1 to NUM do > p = TEST_SET[j] > s = explode_spline(p) > end for > t = time() - t printf(1, "%f\t", t) > t = time() > > for j = 1 to NUM do > p = TEST_SET[j] > s = Bezier_curve(RESO, p[1], p[2], p[3], p[4]) > end for > t = time() - t printf(1, "%f\n", t) > end for > > > Yours Sincerely, > Barabarella > >