Re: BEZIER CURVES
- Posted by Les Rogers <selgor1 at verizonma?l.com> May 13, 2008
- 683 views
Hi, Thanks to all who answered !! I obviously was very vague. My System is :- SIV - System Information Viewer V3.29 LES::Les Windows XP Professional (Single User) V5.01 Build 2600 Service Pack 2 SiS-741 LES::Les English (0x0C09) Australia (61) Workgroup WORKGROUP up: 00 00:23:54 2008-05-13 22:50:52 [BIOS 6.00 PG] Powered by Mains Resource Usage 43% Current MB (KB) Maximum MB (KB) Free MB (KB) [528] System Physical Memory 450 (460,464) 1,024 (1,048,576) 189 (193,832) System Paging File 350 (357,592) 2,464 (2,523,232) 2,114 (2,165,640) System File Cache 484 (496,564) 485 (496,652) 0 (88) Sensor ITE/SiS IT8712F/950 MB 60.0°C (56-61) I/O +2.90 PSU +5.19 +7.66 -2.99 -3.07 Fans 3,515 0 0 Sempron 3000+ (Thorton) Family 6 (7) Model 10 (0A) Stepping 0 (0) PAS 16GB 2.00GHz Processor [A2] Socket A L1 Code Cache 2-way 64-byte 64KB Core 1.58 volts 166MHz System Bus (FSB) x12.0 Mask 1.0.11 L1 Data Cache 2-way 64-byte 64KB 2.00GHz Level 2 Cache Technology 0.13µm L2 Unified Cache 16-way 64-byte 512KB Fan 3,515 RPM AuthenticAMD [ MMX+ 3D!+ SSE ] AMD Sempron(tm) 3000+ [ Cache Latency ] and this program (my re-hash of "polygon" in demo Euphoria) is what I would like the curve to do -- BkCl3Bst.ex Polygons 2 -- ----------------------------- include graphics.e include select.e include machine.e include mouse.e use_vesa(1) if graphics_mode(18) then end if constant X = 1, Y = 2 sequence config integer nlines, npoints, spacing, solid,klr,kol,kolr procedure stall() for i = 1 to 2750000 do end for end procedure procedure colour() klr=rand(14) kol=rand(14) kolr=rand(14) if klr=kol or klr=kolr then colour() elsif kol=kolr or kol=klr then colour() elsif kolr=klr or kolr=kol then colour() end if bk_color(kolr) end procedure colour() procedure dun() if get_key() = 27 then abort(0) end if mouse_pointer(0) mouse_events(2) if sequence(get_mouse()) then abort(1) end if end procedure procedure poly_pattern() sequence points,pts,deltas,dels,history,his config = video_config() pts=rand(repeat(config[VC_XPIXELS..VC_YPIXELS],npoints))+2 points = rand(repeat(config[VC_XPIXELS..VC_YPIXELS], npoints))+2 deltas = rand(repeat({2*spacing-1, 2*spacing-1}, npoints)) - spacing dels=rand(repeat({2*spacing-1,2*spacing-1},npoints))-spacing history = {} his={} dun() clear_screen() while get_key() != 27 do if length(history) >= nlines then polygon(0, solid, history[1]) history = history[2..nlines] end if dun() if length(his) >= nlines then polygon(0,solid,his[1]) his=his[2..nlines] end if polygon(klr,solid,pts) polygon(kol, solid, points) dun() history = append(history, points) his=append(his,pts) points += deltas pts+=dels dun() for j = 1 to npoints do if points[j][X] <= 0 or points[j][X] >= config[VC_XPIXELS] then deltas[j][X] = -deltas[j][X] end if if points[j][Y] <= 0 or points[j][Y] >= config[VC_YPIXELS] then deltas[j][Y] = -deltas[j][Y] end if end for for j = 1 to npoints do if pts[j][X] <= 0 or pts[j][X] >= config[VC_XPIXELS] then dels[j][X] = -dels[j][X] end if if pts[j][Y] <= 0 or pts[j][Y] >= config[VC_YPIXELS] then dels[j][Y] = -dels[j][Y] end if dun() end for if rand(101) = 1 then colour() end if -- was 201 dun() stall() end while end procedure while get_key() != 27 do nlines = 6 npoints = 4 spacing = 15 solid=0 dun() poly_pattern() end while and this program is one I wrote. Turns at certain points to form Kaleidoscope effect !! include graphics.e include machine.e include mouse.e use_vesa(1) if graphics_mode(18) then end if atom a,b,c,d, a1,b1,c1,d1, a2,b2,c2,d2, a3,b3,c3,d3, x,y,x1,y1, xx,yy,xx1,yy1, xxx,yyy,xxx1,yyy1, xxxx,yyyy,xxxx1,yyyy1, lt,tp,rt,bt, lt1,tp1,rt1,bt1, lt2,tp2,rt2,bt2, lt3,tp3,rt3,bt3, kount,kcol,endit kount=0 kcol=1 endit=0 lt=0 tp=0 bt=240 rt=315 lt1=315 tp1=0 bt1=240 rt1=630 lt2=0 tp2=240 bt2=480 rt2=315 lt3=315 tp3=240 bt3=480 rt3=630 x=235 x1=205 y=200 y1=140 xx=392 xx1=422 yy=200 yy1=140 xxx=235 xxx1=205 yyy=280 yyy1=340 xxxx=392 xxxx1=422 yyyy=280 yyyy1=340 a=1 b=2 c=2 d=1 a1=a b1=b c1=c d1=d a2=a b2=b c2=c d2=d a3=a b3=b c3=c d3=d procedure dun() mouse_pointer(0) mouse_events(2) if sequence(get_mouse()) then abort(1) end if end procedure procedure kullar() if kcol>=16 then kcol = rand(15) end if if kcol= GRAY then kcol=YELLOW end if if kount=50 then kcol=rand(16) end if if kount=60 then kcol+=1 kount=0 end if end procedure procedure val() x-=a y-=b x1-=c y1-=d xx+=a1 yy-=b1 xx1+=c1 yy1-=d1 xxx-=a2 yyy+=b2 xxx1-=c2 yyy1+=d2 xxxx+=a3 yyyy+=b3 xxxx1+=c3 yyyy1+=d3 end procedure procedure xyopp() if x<lt or x>rt then a=-a end if if y<tp or y>bt then b=-b end if if x1<lt or x1>rt then c=-c end if if y1<tp or y1>bt then d=-d end if end procedure procedure xyopp2() if xx<lt1 or xx>rt1 then a1=-a1 end if if yy<tp1 or yy>bt1 then b1=-b1 end if if xx1<lt1 or xx1>rt1 then c1=-c1 end if if yy1<tp1 or yy1>bt1 then d1=-d1 end if end procedure procedure xyopp3() if xxx<lt2 or xxx>rt2 then a2=-a2 end if if yyy<tp2 or yyy>bt2 then b2=-b2 end if if xxx1<lt2 or xxx1>rt2 then c2=-c2 end if if yyy1<tp2 or yyy1>bt2 then d2=-d2 end if end procedure procedure xyopp4() if xxxx<lt3 or xxxx>rt3 then a3=-a3 end if if yyyy<tp3 or yyyy>bt3 then b3=-b3 end if if xxxx1<lt3 or xxxx1>rt3 then c3=-c3 end if if yyyy1<tp3 or yyyy1>bt3 then d3=-d3 end if end procedure procedure stl() for i=1 to 1500000 do end for end procedure procedure draw_it() for i= 1 to 500 do kount+=1 kullar() draw_line(kcol,{{x+a,y+b},{x1+c,y1+d}}) draw_line(kcol,{{(xxx+a2),(yyy+b2)},{(xxx1+c2),(yyy1+d2)}}) draw_line(kcol,{{xx+a1,yy+b1},{xx1+c1,yy1+d1}}) draw_line(kcol,{{xxxx+a3,yyyy+b3},{xxxx1+c3,yyyy1+d3}}) if get_key()=27 then abort(0) end if if get_key()=27 then abort(0) end if dun() stl() val() xyopp() xyopp2() xyopp3() xyopp4() end for clear_screen() end procedure while endit != 15 do draw_it() endit+=1 end while -- if system_exec("ex \\euphoria\\uze\\a.ex",0) then end if 1.0 and this is a bezier curve program include graphics.e include machine.e include mouse.e -- include truecolr.e use_vesa(1) if graphics_mode(18) then end if atom b1,b2,b3,b4 ,x1,x2,x3,x4,y1,y2,y3,y4 x1=50 x2=150 x3=200 x4=250 y1=400 y2=50 y3=300 y4=350 procedure stall() for time_lag = 1 to 2500000 do end for end procedure procedure dun() if get_key()=27 then abort(0) end if mouse_pointer(0) mouse_events(2) if sequence(get_mouse()) then abort(1) end if if get_key()=27 then abort(0) end if end procedure procedure draw_it() for u = .01 to 1.52 by .001 do ---- was 0 to 1 by .01 if get_key()=27 then abort(0) end if dun() pixel(rand(5),{u*u*u*(x4+3*(x2-x3)-x1)+3*u*u*(x1-2*x2+x3)+3*u*(x2-x1)+x1, u*u*u*(y4+3*(y2-y3)-y1)+3*u*u*(y1-2*y2+y3)+3*u*(y2-y1)+y1}) dun() stall() if get_key() = 27 then abort(0) end if end for end procedure while get_key() != 27 do dun() draw_it() end while and this is a program with many beziers . Bezier Curves is a Windows XP Screen Saver Program. I am trying to write "it" in the Euphoria language !! include graphics.e include machine.e include mouse.e --include truecolr.e use_vesa(1) if graphics_mode(18) then end if atom x1,x2,x3,x4,y1,y2,y3,y4 x1=50 x2=20 x3=150 x4=400 y1=100 y2=200 y3=400 y4=300 procedure stall() for time_lag = 1 to 225000000 do end for end procedure procedure dun() if get_key()=27 then abort(1) end if mouse_pointer(0) mouse_events(2) if sequence(get_mouse()) then abort(1) end if if get_key()=27 then abort(1) end if end procedure procedure draw_it() for t = 0 to 1.0952 by .0001 do dun() if get_key() = 27 then abort(1) end if pixel(rand(15),{((1-t)*(1-t)*(1-t)*x1+.123*(1-t)*(1-t)*t*x2+3*(1-t)*t*t*x3+t*t*t*x4), (1-t)*(1-t)*(1-t)*y1+3*(1-t)*(1-t)*t*y2+.53*(1-t)*t*t*y3+t*t*t*y4}) dun() if get_key() = 27 then abort(1) end if end for stall() x1=rand(600) x2=rand(600) x3=rand(600) x4=rand(600) y1=rand(500) y2=rand(500) y3=rand(500) y4=rand(500) end procedure while get_key() != 27 do if get_key() = 27 then abort(1) end if draw_it() end while Any help ? I just would like to have a turning point when the curve reaches a top bottom ?? Hope the above proves I am not mucking around !! Les.R.