Re: pathing

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

Hello Barbarella once more,   smile

See please one EU-like attempt 
more, just type not function now.

Results are:
38.23
38.23
38.23
38.23

-- type_bb.ex

global sequence curve
global integer points
global type Bezier_curve(sequence p)
    atom t, tsq, omt, omtsq, delta
   points = p[1]
    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
   curve[i] = p[2] * (omtsq * omt)
	      + p[3] * (3 * omtsq * t)
	      + p[4] * (3 * omt * tsq)
	      + p[5] * (t * tsq)
	    t += delta
    end for
    return 1
end type

if machine_func(5,18) then
     puts(2, "Gfx problems.\n")
     abort(1)
end if

machine_proc(35,12) -- set_rand(12)

sequence s, WH
WH={640,480}
s = {rand(WH), rand(WH), rand(WH), rand(WH)}

Bezier_curve x_y

atom T
T=time()
for i=1 to 1000 do
    x_y={1000, s[1], s[2], s[3], s[4]}
    for j = 1 to points do
	pixel(1,curve[j])
    end for
    s[1] = s[4]
    s[2] = s[1] + (s[4] - s[3]) / 2
    s[3] = rand(WH)
    s[4] = rand(WH)
end for
T=time()-T
?T
-- end of code

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

Search



Quick Links

User menu

Not signed in.

Misc Menu