Re: pathing

new topic     » topic index » view thread      » older message » newer message

Hello Barbarella,

> >Igor Kachan, kinz at peterlink.ru
> >Is this bb_graphs.e lib the new one just posted to Rob?
> >Sorry please, can not find in the contrib's and 
> >archive's zips.
> 
> Yes, Igor, I have not checked, but I hope it 
> has turned up there by now.

<snip>

> A question to the list: has anyone of you guys 
> written a faster Bezier curve function in Euphoria?
> The one in my library is very slow and I know that 
> Bezier curves CAN be written using only integers,
> but how?

Thanks, see please below more simple variant 
of Bezier function, based on yours one:

global function Bezier_curve(integer points, sequence p)
    sequence curve,q
        atom t,tsq,omt,omtsq,delta
          q = {0,0,0,0}
      curve = repeat({0,0}, points)
      delta = 1 / (points - 1)
          t = 0.0
      for i = 1 to points do
           omt = 1.0 - t
         omtsq = omt * omt
           tsq = t * t
          q[1] = omtsq * omt
          q[2] = 3 * omtsq * t
          q[3] = 3 * omt * tsq
          q[4] = t * tsq
          for j=1 to 4 do
               curve[i] += floor(p[j] * q[j])
--             curve[i] += (p[j] * q[j])
          end for
        t += delta
      end for
    return curve
end function

It is not tested for speed in comparison with
yours one, but works for me.

Regards,
Igor Kachan
kinz at peterlink.ru

new topic     » topic index » view thread      » older message » newer message

Search



Quick Links

User menu

Not signed in.

Misc Menu