Re: triangles & aspects
Clangray <[email protected]> Fri, 24 Mar 2017 17:48:01 -0400
| Newsgroups | gmane.comp.lib.sdl |
|---|---|
| Message-ID | <1490392081.1263795.922707120.2E8371F4@webmail.messagingengine.com> |
This is a multi-part message in MIME format. --===============0397617127210640262== Content-Transfer-Encoding: 7bit Content-Type: multipart/alternative; boundary="_----------=_149039208112637956" This is a multi-part message in MIME format. --_----------=_149039208112637956 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" I didn't articulate that very well but thats more of what I am needing: getting the 3rd point. -- Gray Family [email protected] On Fri, Mar 24, 2017, at 05:03 PM, Clangray wrote: > 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? >=20 > *Most importantly they need to be filled triangles. How do I fill > traingles?? : )* >=20 > -- > Gray Family > [email protected] >=20 >=20 >=20 > On Fri, Mar 24, 2017, at 02:58 AM, Sanette wrote: >> Le 23/03/2017 =C3=A0 22:19, speartip a =C3=A9crit : >> > Hi, > > 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. > > > >> > _______________________________________________ > SDL mailing list >> > > [email protected] > >> > http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org >>=20 >>=20 >> Hi >>=20 >> 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 ?) >>=20 >> 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=C2=B0 to obtain the two other sides. >>=20 >> --=20 >> sanette -- full_time_linux >>=20 >>=20 >> _________________________________________________ >> SDL mailing list >> [email protected] >> http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org >=20 > _________________________________________________ > SDL mailing list > [email protected] > http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org --_----------=_149039208112637956 Content-Transfer-Encoding: quoted-printable Content-Type: text/html; charset="utf-8" <!DOCTYPE html> <html> <head> <title></title> </head> <body><div>I didn't articulate that very well but thats more of what I am n= eeding: getting the 3rd point.</div> <div><br></div> <div id=3D"sig43414442"><div class=3D"signature">--<br></div> <div class=3D"signature"> Gray Family<br></div> <div class=3D"signature"> [email protected]<br></div> <div class=3D"signature"><br></div> </div> <div><br></div> <div><br></div> <div>On Fri, Mar 24, 2017, at 05:03 PM, Clangray wrote:<br></div> <blockquote type=3D"cite"><div>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 a= utomated functions in SDL2?<br></div> <div><br></div> <div><b>Most importantly they need to be filled triangles. How do I fill tr= aingles?? : )</b><br></div> <div><br></div> <div><div>--<br></div> <div> Gray Family<br></div> <div> [email protected]<br></div> <div><br></div> </div> <div><br></div> <div><br></div> <div>On Fri, Mar 24, 2017, at 02:58 AM, Sanette wrote:<br></div> <blockquote type=3D"cite"><div>Le 23/03/2017 =C3=A0 22:19, speartip a =C3= =A9crit :<br></div> <div><span style=3D"white-space:pre;">> Hi, > > I am endeavoring to put some simple triangles in my screen. The SDL wi= ki gives an example of - yes - connecting 3 drawlines. Am I overlooking som= ething 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 lab= or 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 kn= ow whether I was missing some piece of info. > > > _______________________________________________ > SDL mailing list > <a href=3D"mailto:[email protected]">[email protected]</a> > = <a href=3D"http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org">http://list= s.libsdl.org/listinfo.cgi/sdl-libsdl.org</a></span><br></div> <div><br></div> <div><br></div> <div>Hi<br></div> <div><br></div> <div>your question is not terribly clear. Mathematically, a triangle is<br>= </div> <div>just given by 3 points, so there is no problem. (By the way do you want<br></div> <div>simple triangles or filled triangles ? Do you want anti-aliasing ?)<br= ></div> <div><br></div> <div>Maybe what you mean in fact is an equilateral triangle: all sides have<br></div> <div>same length. Then, yes there is some math behind this. There are many<br></div> <div>possibilities. Either you compute the position of the third point<br><= /div> <div>given the first two. Or it might be easier to draw a horizontal<= br></div> <div>segment (the base of the triangle), and then use SDL_RenderCopyEx to<b= r></div> <div>copy+rotate by 60=C2=B0 to obtain the two other sides.<br></div> <div><br></div> <div>-- <br></div> <div>sanette -- full_time_linux<br></div> <div><br></div> <div><br></div> <div><u>_______________________________________________</u><br></div> <div>SDL mailing list<br></div> <div><a href=3D"mailto:[email protected]">[email protected]</a><br></= div> <div><a href=3D"http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org">http:/= /lists.libsdl.org/listinfo.cgi/sdl-libsdl.org</a><br></div> </blockquote><div><br></div> <div><u>_______________________________________________</u><br></div> <div>SDL mailing list<br></div> <div><a href=3D"mailto:[email protected]">[email protected]</a><br></= div> <div><a href=3D"http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org">http:/= /lists.libsdl.org/listinfo.cgi/sdl-libsdl.org</a><br></div> </blockquote><div><br></div> </body> </html> --_----------=_149039208112637956-- --===============0397617127210640262== Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ SDL mailing list [email protected] http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org --===============0397617127210640262==--