C++ (Draw Circle)
How to use C++ to write a program for drawing a circle??
回答 (2)
This should be a homework, as a graphic programmer,
I used OpenGL with C++ ..., I cannot give you code, since it is all
different, and in C++, we use classes and virtual functions.
All you need to think about the design is :
1. A circle has 360 degree.
2. Think the circle like the clock, when the radius/arm turn a complete 360 degree,
it draw a circle ...
3. now for each degree, we put a dot at one end of the radius away from the center.
4. you will have all the 360 dots connected together and form a circle ... just the shape of it.
5. if you want a DISC, a filled circle, you need to think a circle as a lot of triangle combined together like a slice of a pie !
There is also a cos and sin TRI. formula for circle, that you can use like
the reference below, but that need math.h (math library), I like my primitive way of thinking in Computer science without using math library, except a graphic function to write a DOT (X,Y) in the 2D screen.
Hope all help la. :)
收錄日期: 2021-04-22 00:29:35
原文連結 [永久失效]:
https://hk.answers.yahoo.com/question/index?qid=20070418000051KK01588
檢視 Wayback Machine 備份