Reply-To: "netfox" From: "netfox" Newsgroups: borland.public.delphi.graphics References: <3c5fe6d5$1_2@dnews> <3c622dff$1_2@dnews> Subject: Re: Rotate an Ellipse Date: Wed, 13 Feb 2002 23:32:19 +0800 Lines: 44 X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 5.00.2919.6600 X-MimeOLE: Produced By Microsoft MimeOLE V5.00.2919.6600 NNTP-Posting-Host: 211.155.47.17 Message-ID: <3c6a8700_2@dnews> X-Trace: dnews 1013614336 211.155.47.17 (13 Feb 2002 07:32:16 -0800) Path: dnews Xref: dnews borland.public.delphi.graphics:46149 what's degtorad? "Kevin" wrote in message news:3c622dff$1_2@dnews... > > >If anyone has any idea about how to go about doing this I would greatly > appreciate it. > > Below. No Shape component required. > > Kevin > > uses Math; > > ..... > > procedure DrawEllipse(ACanvas: TCanvas; MeanX, MeanY, Rotation, MajorAxis, > MinorAxis: Integer); > const > RotationIncrement = 4; > var > EllipsePoints : Array[0..89] of TPoint; > Total_Tics, cnt : Integer; > phi : Double; > begin > Total_Tics := 360 DIV RotationIncrement; // verticies at 4 degree > increments can change as required > FOR cnt := 0 TO Total_Tics - 2 DO BEGIN > phi := Pi - DegToRad(cnt * RotationIncrement); > EllipsePoints[cnt].X := Round(MeanX - Majoraxis*Cos(phi)*Cos(Rotation)+ > MinorAxis*Sin(phi)*Sin(Rotation)); > EllipsePoints[cnt].Y := Round(MeanY -Majoraxis*Cos(phi)*Sin(Rotation) - > MinorAxis*Sin(phi)*Cos(Rotation)); > END; > EllipsePoints[Total_Tics-1].X := EllipsePoints[0].X; > EllipsePoints[Total_Tics-1].Y := EllipsePoints[0].Y; > ACanvas.Polygon(EllipsePoints); > end; > > > >