Re: triangles & aspects

Sanette <[email protected]> Fri, 24 Mar 2017 07:58:11 +0100
Newsgroups gmane.comp.lib.sdl
Message-ID <[email protected]>
This is a multi-part message in MIME format.
--===============8183634492896865277==
Content-Type: multipart/alternative;
 boundary="------------0548F7EFCD319A035FB5C3FE"

This is a multi-part message in MIME format.
--------------0548F7EFCD319A035FB5C3FE
Content-Type: text/plain; charset=iso-8859-15; format=flowed
Content-Transfer-Encoding: 8bit

Le 23/03/2017 à 22:19, speartip a écrit :
> 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


Hi

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


--------------0548F7EFCD319A035FB5C3FE
Content-Type: text/html; charset=iso-8859-15
Content-Transfer-Encoding: 8bit

<html>
  <head>
    <meta content="text/html; charset=iso-8859-15"
      http-equiv="Content-Type">
  </head>
  <body bgcolor="#FFFFFF" text="#000000">
    Le 23/03/2017 à 22:19, speartip a écrit :<br>
    <span style="white-space: pre;">&gt; Hi,
&gt;
&gt; 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.
&gt;
&gt; Before venturing out on some crazy triangle project, just wanted to know whether I was missing some piece of info.
&gt;
&gt;
&gt; _______________________________________________
&gt; SDL mailing list
&gt; <a class="moz-txt-link-abbreviated" href="mailto:[email protected]">[email protected]</a>
&gt; <a class="moz-txt-link-freetext" href="http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org">http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org</a></span><br>
    <br>
    <br>
    Hi<br>
    <br>
    your question is not terribly clear. Mathematically, a triangle is<br>
    just given by 3 points, so there is no problem. (By the way do you
    want<br>
    simple triangles or filled triangles ? Do you want anti-aliasing ?)<br>
    <br>
    Maybe what you mean in fact is an equilateral triangle: all sides
    have<br>
    same length. Then, yes there is some math behind this. There are
    many<br>
    possibilities. Either you compute the position of the third point<br>
    given the first two.  Or it might be easier to draw a horizontal<br>
    segment (the base of the triangle), and then use SDL_RenderCopyEx to<br>
    copy+rotate by 60° to obtain the two other sides.<br>
    <br>
    -- <br>
    sanette -- full_time_linux<br>
    <br>
  </body>
</html>

--------------0548F7EFCD319A035FB5C3FE--

--===============8183634492896865277==
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

--===============8183634492896865277==--