Drawing an arc is already easy, using the Canvas.Arc() method that you have already identified. J
You simply need to derive the values required to input to that method. J Given that you have the start/end points and it seems from the way you have put it that these are known to be on the arc, all you are missing is the bounding rectangle for the ellipse. You have the center point, so if you know the axial dimensions of the ellipse (width/height) then calculating the bounding rectangle is a simple matter of: bound.Left := center.x - (width div 2); bound.Top := center.y - (height div 2); bound.Right := center.x + (width div 2); bound.Bottom := center.y + (height div 2); Canvas.Arc( bound.Left, bound.Top, bound.Right, bound.Bottom, start.X, start.Y, end.X, end.Y ); If the ellipse is (or could be) rotated then things are more complicated I think. I forget which is the default direction for arc drawing (clockwise or counter-clockwise) but if you need to adjust that then I think you can either simply swap your start/end points or explicitly set the arc direction using the SetArcDirection() GDI call: http://msdn.microsoft.com/en-us/library/dd162961(v=VS.85).aspx If the start/end points are not actually ON the arc, then you will need to calculate the intersection of the lines defined by those points w.r.t the ellipse center. This is basic trig tho, and any number of online sources should provide the formulae for these calculations, should you need them. From: delphi-boun...@delphi.org.nz [mailto:delphi-boun...@delphi.org.nz] On Behalf Of Marshland Engineering Sent: Tuesday, 18 January 2011 21:03 To: delphi@delphi.org.nz Subject: [DUG] Arc's Is there an easy way of drawing an arc ? I have center, start and end co-ordinates as XY. >From what I can see, I need to look at least 16 combinations to work out the perimeter size depending in which quadrant the start and ends are in. procedure Arc(X1, Y1, X2, Y2, X3, Y3, X4, Y4: Integer); Use Arc to draw an elliptically curved line with the current Pen. The arc traverses the perimeter of an ellipse that is bounded by the points (X1,Y1) and (X2,Y2). The arc is drawn following the perimeter of the ellipse, counterclockwise, from the starting point to the ending point. The starting point is defined by the intersection of the ellipse and a line defined by the center of the ellipse and (X3,Y3). The ending point is defined by the intersection of the ellipse and a line defined by the center of the ellipse and (X4, Y4). DISCLAIMER: This electronic message together with any attachments is confidential. If you are not the intended recipient, do not copy, disclose or use the contents in any way. Please also advise us by return e-mail that you have received the message and then please destroy. Carter Holt Harvey is not responsible for any changes made to this message and / or any attachments after sending by Carter Holt Harvey. We use virus scanning software but exclude all liability for viruses or anything similar in this email or any attachment.
_______________________________________________ NZ Borland Developers Group - Delphi mailing list Post: delphi@delphi.org.nz Admin: http://delphi.org.nz/mailman/listinfo/delphi Unsubscribe: send an email to delphi-requ...@delphi.org.nz with Subject: unsubscribe