PDA

View Full Version : سوال: الگوريتم ترسيم چند ضلعي محدب به همرا سورس



uploader
چهارشنبه 09 اردیبهشت 1388, 09:00 صبح
سلام و خسته نباشيد . الگوريتم رسم چند ضلعي محدب رو لطفا برايم توضيح بديد .اگه سورسش هم باشه ممنون ميشم.

abiking
چهارشنبه 17 تیر 1388, 19:55 عصر
procedure TForm1.Button2Click(Sender: TObject);
const max =20;
pi=3.14;
var
n,i,x,y,j:integer;
x1,y1:real ;
st:String ;
Parr: array [1..max] of TPoint ;
xarr : array[1..max] of Integer ;
yarr : array[1..max] of Integer ;
begin
n:=StrToInt(Edit1.Text);
if n<3 then n:=3;
if n>max then n:=max ;
for i:= 1 to n+1 do
begin
x1:= (sin((2*pi)*i/n )*120)+(Form1.Width div 2) + 25;
y1:= (cos((2*pi)*i/n )*120)+(form1.Height div 2) -10 ;
str(x1 :7:0,st);
x:=StrToInt(st) ;
str(y1 :7:0,st);
y:=StrToInt(st) ;
xarr[i]:=X;
yarr[i]:=y;
Parr[i]:=Point(X,Y) ;
end;
for i:=n+1 to max do
begin
Parr[i]:=parr[1] ;
end;
Canvas.Brush.Style :=bsDiagCross ;
Canvas.Polyline(parr);
end;

end.

abiking
چهارشنبه 17 تیر 1388, 19:59 عصر
prg asli oooooooooooooooooooooo

hossein taghi zadeh
چهارشنبه 17 تیر 1388, 20:04 عصر
با سلام

لينك پياده سازي رسم حفره محدب با زبان دلفي (الگوريتم گراهام) (http://sd.h.t.azeri.googlepages.com/ConvexHull.rar)