I am endeavoring to put some simple triangles in my screen. The SDL wiki gives an example of - yes - connecting 3 drawlines. Am I overlooking something or do these lines have to be arrived at mathematically or hardcoded to know what anchoring coordinates they must belong to form the triangle. I don’t see a function to make the triangle for you. This becomes rather labor intensive to create your triangle. Also once made, if your aspect ratio changes the lines of the triangle will have to be recalculated to maintain the equality of the angles. I can make a function to correct, no prob.
Before venturing out on some crazy triangle project, just wanted to know whether I was missing some piece of info.
your question is not terribly clear. Mathematically, a triangle is
just given by 3 points, so there is no problem. (By the way do you want
simple triangles or filled triangles ? Do you want anti-aliasing ?)
Maybe what you mean in fact is an equilateral triangle: all sides have
same length. Then, yes there is some math behind this. There are many
possibilities. Either you compute the position of the third point
given the first two. Or it might be easier to draw a horizontal
segment (the base of the triangle), and then use SDL_RenderCopyEx to
copy+rotate by 60? to obtain the two other sides.–
sanette – full_time_linux
If anybody can point me to a guide containing a blurb/teach on triangles would appreciate it.
Are you looking for information on trigonometry?
I know the math, its just if I want to place an equilateral triangle
in several different places on the screen I’d like to know what
anybody has done before me in this situation: are there any automated
functions in SDL2?
Most importantly they need to be filled triangles. How do I fill
traingles?? : )–
I didn’t articulate that very well but thats more of what I am needing:
getting the 3rd point.–