GIDForums  

Go Back   GIDForums > Computer Programming Forums > MS Visual C++ / MFC Forum
User Name
Password
Register FAQ Members List Calendar Search Today's Posts Mark Forums Read

 
 
Thread Tools Search this Thread Rate Thread
  #1  
Old 14-May-2008, 11:40
komalwaseem komalwaseem is offline
New Member
 
Join Date: Apr 2008
Posts: 6
komalwaseem is on a distinguished road

drawing circles


In my program I'm taking the centre co-ordinates and the radius from the user ..now how can I use this information to draw a circle. The ellipse function takes four co-ordinates ..how do I use the ellipse to draw the circle and also how can I determine if the given co-ordinates lie inside the cirlce.
  #2  
Old 14-May-2008, 14:17
davekw7x davekw7x is offline
Outstanding Member
 
Join Date: Feb 2004
Location: Left Coast, USA
Posts: 4,720
davekw7x is a splendid one to beholddavekw7x is a splendid one to beholddavekw7x is a splendid one to beholddavekw7x is a splendid one to beholddavekw7x is a splendid one to beholddavekw7x is a splendid one to beholddavekw7x is a splendid one to behold

Re: drawing circles


Quote:
Originally Posted by komalwaseem
In my program I'm taking the centre co-ordinates and the radius from the user ..now how can I use this information to draw a circle.
If you know how to draw an ellipse with a given center and width and height, consider that a circle is an ellipse whose width and height are equal to the diameter of the circle.

So, for example, with the Windows GDI Ellipse() function, if the center coordinates are (cx, cy) and the handle is hDC, then draw a circle with a given radius with:

CPP / C++ / C Code:
        Ellipse(hDC, cx - radius, cy - radius, cx + radius, cy + radius);

Quote:
Originally Posted by komalwaseem
...how can I determine if the given co-ordinates lie inside ...

Given a circle with center at coordinates (cx,cy), and given a point with coordinates (x,y): If the distance from (x,y) to (cx,cy) is less than the radius, the point is inside the circle.

Regards,

Dave
 
 

Recent GIDBlogDeveloping GUIs with wxPython (Part 2) by crystalattice

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
MFC - drawing overlapping circles komalwaseem MS Visual C++ / MFC Forum 1 24-Apr-2008 05:29
Drawing order Z_guy FLTK Forum 6 09-Sep-2007 12:57
Free Hand Drawing in FLTK nimeesh FLTK Forum 2 31-Aug-2007 02:58
Undo Drawing Nelly MS Visual C++ / MFC Forum 3 10-May-2004 21:14
Back to the drawing board... spudtheimpaler C Programming Language 9 15-Mar-2004 10:12

Network Sites: GIDNetwork · GIDWebHosts · GIDSearch · Learning Journal by J de Silva, The

All times are GMT -6. The time now is 18:23.


vBulletin, Copyright © 2000 - 2008, Jelsoft Enterprises Ltd.