graphics project about drawing circle in C++

Please support our C++ advertiser: Intel Parallel Studio Home
Reply

Join Date: Apr 2009
Posts: 28
Reputation: thebluestar is an unknown quantity at this point 
Solved Threads: 0
thebluestar thebluestar is offline Offline
Light Poster

graphics project about drawing circle in C++

 
0
  #1
Apr 24th, 2009
Hi all,
I have to make a graphics project about drawing a circle like:
1/Draw the circle on the screen with yellow pen color and dark blue background. (Note: yellow
color: 0xFFFF00, dark blue color: 0x191970).
2/ Rotate the circle counterclockwise around the center I with the speed 10 degree per second, the
rotating will stop when user press ‘q’.
but I just did the first requirement.
Here is my work, can you help me with the second requirement!
Attached Files
File Type: zip prac1.zip (150.6 KB, 34 views)
Reply With Quote Quick reply to this message  
Join Date: Feb 2009
Posts: 1,968
Reputation: tux4life has a reputation beyond repute tux4life has a reputation beyond repute tux4life has a reputation beyond repute tux4life has a reputation beyond repute tux4life has a reputation beyond repute tux4life has a reputation beyond repute tux4life has a reputation beyond repute tux4life has a reputation beyond repute tux4life has a reputation beyond repute tux4life has a reputation beyond repute tux4life has a reputation beyond repute 
Solved Threads: 214
tux4life's Avatar
tux4life tux4life is offline Offline
Posting Virtuoso

Re: graphics project about drawing circle in C++

 
0
  #2
Apr 24th, 2009
Originally Posted by thebluestar View Post
Here is my work, can you help me with the second requirement!
Sure we can help you, but that's such a vague question ...
Where are you having problems with ?
"Never argue with idiots, they just drag you down to their level and then beat you with experience."
Reply With Quote Quick reply to this message  
Join Date: Nov 2007
Posts: 390
Reputation: skatamatic will become famous soon enough skatamatic will become famous soon enough 
Solved Threads: 39
skatamatic skatamatic is offline Offline
Posting Whiz

Re: graphics project about drawing circle in C++

 
0
  #3
Apr 24th, 2009
Hmmm seems like you need to bust out the math book. I honestly dont remember the math functions in CMath, but you should probably look it up. I also don't know how the library you are using supports key entry for stopping, so I'll just say its called GetKey() and returns a character. Also I don't know anything about your circle class, but I will assume it accepts 2 coordinates and a radius.

  1. double fX = 0;
  2. double fY = 0;
  3. double fAngle = 0; //in radians
  4. const int ciRadius = 10;
  5. const double cfPi = 3.14159;
  6. const int ciAngularVelocity = 10; //in degrees
  7. const int ciAmplitude = 100;
  8. while (GetKey() != 'q')
  9. {
  10. fX = SIN(fAngle) * ciAmplitude;
  11. fY = COS(fAngle) * ciAmplitude;
  12. DrawCircle(iX, iY, ciRadius)
  13. sleep(1000); //pause for a second
  14. fAngle += (ciAngularVelocity * (cfPi / 180.0f));
  15. }

Something like that should do the trick. Probably not the exact code you need for your specific application, but it should give you a damn good idea.
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:



Similar Threads
Other Threads in the C++ Forum
Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC