Circle square; How draw/compute w square pixels? Trigonometry, language
Greetings;
I have been out of high school and college for awhile. I struggled through math alot. I was wondering how a circle is drawn on the computer, and how a square is? I can't find the trigonomic equation for a square. Was trying to look into programming languages to draw graphics on the screen. The Wolfram programming language looks intuitive. Also studying video and optics. ?Squaring the Circle :-) Thanks. |
Good evening.
I regret to have mentioned this too often already, but I am not a native English speaker. Now, in your post, I read the words and understand what they say, but I still do not get what you are after... Quote:
Alternatively, is it just the math that is missing and you are already happy with your chosen programming language and -environment? Or.., are you wondering about how others do it? Lastly, what kind of advantage would a “trigonometric equation“ for a square bring you, what would it facilitate? Maybe it is the wrong kind of question and just obstructs your way to drawing a plain ol' square. |
It will depend on the graphics library you're using. Most high level plotting libraries allow you to pass an array of X and Y coordinates, and the library will "connect the dots" so-to-speak. In that case, for a square you would simply pass it the coordinates of the corners, and in the process of connecting the dots, the library will draw your square for you. For a circle you would generate an array of angles from 0 to 2*pi, then your X and Y coordinates would be the cos() and sin() of those angles. The higher the resolution of your angles, the more "circular" your circle will be. Four points will draw a square, 8 will draw an octagon, and so on until it looks more and more round.
|
Quote:
|
Quote:
|
You can also use the (non-trigonomic?) circle equation: x^2 + y^2 = r^2, rearrange as a function of y = ±√(r^2 - x^2), no pi needed.
|
Quote:
This answers many of my questions. Fractal Formula: z = tan(z) made a nice one. Will continue to research... Still have questions not directly related to topic, will mark as solved. Thanks everyone! |
All times are GMT -5. The time now is 09:35 AM. |