![]() |
|
#1
|
|||
|
|||
Is ellipse only way to do circle?Hi, my name is Juned Wahab.
When I draw a circle or ellipse, i use CPP / C++ / C Code:
The problem is, I do not know the detail of how the computer actually draws the circle from that command. I just presumed it was something to do with Pi, which is why I made the statement SINE VS. PYTHAGARUS (sorry about my spelling). Let me explain. When I draw a circle using my sine formula - let's just say, they do not look exactly the same shape, but they are both circles. When you look close up and analyse the pixel positions, they are slighlty different. It could apply to embedded systems i.e., digital to analogue converters. I'll give you a little bit more code: CIRCLE WITH SINE CPP / C++ / C Code:
Maybe the title should have been:- ELLIPSE VS. SINE Also, when I said "manipulate a cirlce", I meant cirlces to ellipses. Oval shapes. Displaying a circle from different perspectives, as well as moving sprites in a circlular wave form, which to the best of my knowledge cannot be done simply with the 'Ellipse' command. Which leads to the 'SPIRAL'. Altering the code for 'circle with sine', slightly, you generate a spiral. You can display the spiral from many angles. Can you do a spiral shape from a C++ command, like; CPP / C++ / C Code:
CPP / C++ / C Code:
To apply the code, you need to SetPixel. CPP / C++ / C Code:
Again, when I alter the values in the sine program, you can see the circle from various angles - perspective. It looks to have more offsets than using the 'Ellipse' command. If you would like to see a free demo, please email: junedwahab@yahoo.co.uk Cheers. |
|||
|
#2
|
||||
|
||||
Re: Is ellipse only way to do circle?Quote:
Quote:
Quote:
Who cares? Furthermore, what the heck does anything in any of your posts have to do with Pythagoras? Quote:
If you would plot sinarrayy[i] versus sinarrayx[i] as i goes from 0 to 199, you get, roughly, two and a half cycles of a sinusoid, not a circle. If you want specific advice, I respectfully suggest that you post the exact code that you are having problems with. (Or having problems understanding.) If you want to plot a circle (or any other continuous curve) point-by-point, you can use the GDI function MoveToEx() followed by any number of LineTo() function calls. For a complete example: CPP / C++ / C Code:
By using Windows GDI pens to plot the lines (rather than trying explicitly to set the pixels) you can easily adjust pen width and other attributes. Furthermore, you can use a fairly small number of points since the LineTo() function fills in the pixels between the points. (The "smoothness" is determined by the number of points, obviously, since it plots the stuff in piece-wise linear fashion, but the output will be a continuous figure.) Regards, Dave Last edited by davekw7x : 26-Dec-2008 at 11:36.
|
|
#3
|
|||
|
|||
Re: Is ellipse only way to do circle?Quote:
What I should have written would indicate the following: Actually, the way you wrote the code that would be a straight line. If you plot sinarrayy[i] versus i you get two and a half cycles of sinusoid. My point remains the same: If you would like some help with some code, then I think it would be better if you showed us the actual code. Dave |
|
#4
|
|||
|
|||
Re: Is ellipse only way to do circle?Quote:
CPP / C++ / C Code:
See attachment for screen shot. Regards, Dave |
Recent GIDBlog
Install Adobe Flash - Without Administrator Rights by LocalTech
| Thread Tools | Search this Thread |
| Rate This Thread | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Need Help on Dealing with Archives. | VersEtreOuNe | C++ Forum | 15 | 14-Feb-2008 05:31 |
| Inheritance and classes | mortomarty | C++ Forum | 2 | 29-Sep-2007 06:09 |
| Help on homework! | kemmal | C Programming Language | 1 | 06-Nov-2006 11:22 |
| coordinates of a circle | IRONMAN | C++ Forum | 2 | 02-Jun-2006 13:31 |
Network Sites: GIDNetwork · GIDWebHosts · GIDSearch · Learning Journal by J de Silva, The