<?xml version="1.0" encoding="iso-8859-1"?>
<rss version="2.0">
<channel>
  <title>Molly Rocket</title>
  <link>https://www.mollyrocket.com/forums/index.php</link>
  <description>Molly Rocket games and everything even tangentially related</description>
  <language>english</language>
  <copyright>(c) Copyright 2012 by Molly Rocket</copyright>
  <managingEditor>forums@mollyrocket.com</managingEditor>
  <webMaster>forums@mollyrocket.com</webMaster>
  <pubDate>Thu May 17, 2012 1:16 pm</pubDate>
  <lastBuildDate>Thu May 17, 2012 1:16 pm</lastBuildDate>
  <docs>http://backend.userland.com/rss</docs>
  <generator>phpBB2 RSS Syndication Mod by Lucas</generator>
  <ttl>1</ttl>

  <image>
    <title>Molly Rocket</title>
    <url></url>
    <link>https://www.mollyrocket.com/forums/</link>
    <description>Molly Rocket games and everything even tangentially related</description>
  </image>

                                      <item>
                                        <title>New CUDA LLVM compiler</title>
                                        <link>https://www.mollyrocket.com/forums/viewtopic.php?p=7469#7469</link>
                                        <description>&lt;br /&gt;
                                      &lt;b&gt;Author:&lt;/b&gt; &lt;a href='https://www.mollyrocket.com/forums/profile.php?mode=viewprofile&amp;u=21'&gt;NeARAZ&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;
                                      &lt;b&gt;Posted:&lt;/b&gt; Fri May 11, 2012 2:25 pm&lt;br /&gt;&lt;br /&gt;
                                      &lt;br /&gt;&lt;br /&gt;
                                      CUDA is very much like OpenCL. Except CUDA works on NVIDIA hardware only; but that gives it a bit more control in some places.</description>
                                        <comments>https://www.mollyrocket.com/forums/viewtopic.php?p=7469#7469</comments>
                                        <author>NeARAZ</author>
                                        <pubDate>Fri May 11, 2012 2:25 pm</pubDate>
                                        <guid isPermaLink="true">https://www.mollyrocket.com/forums/viewtopic.php?p=7469#7469</guid>
                                      </item>
                                      <item>
                                        <title>Can one write a pure function in C?</title>
                                        <link>https://www.mollyrocket.com/forums/viewtopic.php?p=7464#7464</link>
                                        <description>&lt;br /&gt;
                                      &lt;b&gt;Author:&lt;/b&gt; &lt;a href='https://www.mollyrocket.com/forums/profile.php?mode=viewprofile&amp;u=394'&gt;jai&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;
                                      &lt;b&gt;Posted:&lt;/b&gt; Fri Apr 27, 2012 8:47 pm&lt;br /&gt;&lt;br /&gt;
                                      &lt;br /&gt;&lt;br /&gt;
                                      Here's John Carmack talking about functional approaches to C++ and pure functions:&lt;br /&gt;
&lt;br /&gt;
&lt;a href=&quot;http://www.altdevblogaday.com/2012/04/26/functional-programming-in-c/&quot; target=&quot;_blank&quot; class=&quot;postlink&quot;&gt;http://www.altdevblogaday.com/2012/04/26/functional-programming-in-c/&lt;/a&gt;</description>
                                        <comments>https://www.mollyrocket.com/forums/viewtopic.php?p=7464#7464</comments>
                                        <author>jai</author>
                                        <pubDate>Fri Apr 27, 2012 8:47 pm</pubDate>
                                        <guid isPermaLink="true">https://www.mollyrocket.com/forums/viewtopic.php?p=7464#7464</guid>
                                      </item>
                                      <item>
                                        <title>Is this Ryg's blog? [answered: yes]</title>
                                        <link>https://www.mollyrocket.com/forums/viewtopic.php?p=7463#7463</link>
                                        <description>&lt;br /&gt;
                                      &lt;b&gt;Author:&lt;/b&gt; &lt;a href='https://www.mollyrocket.com/forums/profile.php?mode=viewprofile&amp;u=394'&gt;jai&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;
                                      &lt;b&gt;Posted:&lt;/b&gt; Wed Apr 25, 2012 6:27 pm&lt;br /&gt;&lt;br /&gt;
                                      &lt;br /&gt;&lt;br /&gt;
                                      Cool. Was working on my matrix multiplication code and stumbled on his article. At the end of it I was like: &quot;Hey let's see what else this guy has,&quot; and low and behold there was 'ryg' at the top. Small internet.[/list]</description>
                                        <comments>https://www.mollyrocket.com/forums/viewtopic.php?p=7463#7463</comments>
                                        <author>jai</author>
                                        <pubDate>Wed Apr 25, 2012 6:27 pm</pubDate>
                                        <guid isPermaLink="true">https://www.mollyrocket.com/forums/viewtopic.php?p=7463#7463</guid>
                                      </item>
                                      <item>
                                        <title>if you can use this, enjoy</title>
                                        <link>https://www.mollyrocket.com/forums/viewtopic.php?p=7458#7458</link>
                                        <description>&lt;br /&gt;
                                      &lt;b&gt;Author:&lt;/b&gt; &lt;a href='https://www.mollyrocket.com/forums/profile.php?mode=viewprofile&amp;u=394'&gt;jai&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;
                                      &lt;b&gt;Posted:&lt;/b&gt; Wed Apr 18, 2012 2:52 am&lt;br /&gt;&lt;br /&gt;
                                      &lt;br /&gt;&lt;br /&gt;
                                      Was updating some old artwork. Thought some of the folks here might like to use this, so I'd like to share. It's yours! It's free! It's handy.&lt;br /&gt;
&lt;br /&gt;
&lt;img src=&quot;http://i.imgur.com/8Qpzv.png&quot; border=&quot;0&quot; /&gt;&lt;br /&gt;
&lt;br /&gt;
Uploaded a 2048 but it disappeared.</description>
                                        <comments>https://www.mollyrocket.com/forums/viewtopic.php?p=7458#7458</comments>
                                        <author>jai</author>
                                        <pubDate>Wed Apr 18, 2012 2:52 am</pubDate>
                                        <guid isPermaLink="true">https://www.mollyrocket.com/forums/viewtopic.php?p=7458#7458</guid>
                                      </item>
                                      <item>
                                        <title>Are the interactive dev tools we were talking about here now</title>
                                        <link>https://www.mollyrocket.com/forums/viewtopic.php?p=7444#7444</link>
                                        <description>&lt;br /&gt;
                                      &lt;b&gt;Author:&lt;/b&gt; &lt;a href='https://www.mollyrocket.com/forums/profile.php?mode=viewprofile&amp;u=585'&gt;jetro&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;
                                      &lt;b&gt;Posted:&lt;/b&gt; Mon Mar 26, 2012 9:59 am&lt;br /&gt;&lt;br /&gt;
                                      &lt;br /&gt;&lt;br /&gt;
                                      My approach so far has been to use the &quot;style objects&quot; what NeARAZ suggested. I have a Style base which has these things: is key focus allowed?, activates from up / down event?, hit testing for given x &amp;amp; y, render this widget. A style object is then always passed to imgui, e.g.: if (imgui.button(id, x, y, style)) { ... }. This way the actual UI core is pretty small and doesn't actually draw anything.&lt;br /&gt;
&lt;br /&gt;
About the state thing for transitions etc, I have just shoved up some of that stuff to a customized style object, or in the app side. At times that has ended up in a bit messy code at the place which needs the UI, having some animating stuff and state conditions where it feels like it is annoying fluff.&lt;br /&gt;
&lt;br /&gt;
I have thought about the ability to be data-driven from UI config, and mix that with custom IMGUI driven from code. I have an idea that it could work out just nicely by using string ids and maybe some default cfg in code: if (imgui.button(&quot;main.options&quot;, defaultX, defaultY)) { ... }&lt;br /&gt;
And then have the imgui system check if there is loaded definition for &quot;main.options&quot; - if there is, use all the info from there, or otherwise put that button right at the default X,Y. But I haven't actually done &amp;amp; tested this approach in a project yet to have actual experiences.</description>
                                        <comments>https://www.mollyrocket.com/forums/viewtopic.php?p=7444#7444</comments>
                                        <author>jetro</author>
                                        <pubDate>Mon Mar 26, 2012 9:59 am</pubDate>
                                        <guid isPermaLink="true">https://www.mollyrocket.com/forums/viewtopic.php?p=7444#7444</guid>
                                      </item>
                                      <item>
                                        <title>Frameless Rendering</title>
                                        <link>https://www.mollyrocket.com/forums/viewtopic.php?p=7443#7443</link>
                                        <description>&lt;br /&gt;
                                      &lt;b&gt;Author:&lt;/b&gt; &lt;a href='https://www.mollyrocket.com/forums/profile.php?mode=viewprofile&amp;u=13'&gt;sean&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;
                                      &lt;b&gt;Posted:&lt;/b&gt; Sat Mar 24, 2012 12:17 am&lt;br /&gt;&lt;br /&gt;
                                      &lt;br /&gt;&lt;br /&gt;
                                      I don't hear graphics programmers saying that at all; I hear them saying 'our image quality is so far from film quality it's embarassing, let's fix that'. But maybe we listen to different graphics programmers.</description>
                                        <comments>https://www.mollyrocket.com/forums/viewtopic.php?p=7443#7443</comments>
                                        <author>sean</author>
                                        <pubDate>Sat Mar 24, 2012 12:17 am</pubDate>
                                        <guid isPermaLink="true">https://www.mollyrocket.com/forums/viewtopic.php?p=7443#7443</guid>
                                      </item>
                                      <item>
                                        <title>my indie games site SloppyNinja.com</title>
                                        <link>https://www.mollyrocket.com/forums/viewtopic.php?p=7434#7434</link>
                                        <description>&lt;br /&gt;
                                      &lt;b&gt;Author:&lt;/b&gt; &lt;a href='https://www.mollyrocket.com/forums/profile.php?mode=viewprofile&amp;u=757'&gt;sloppyninja&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;
                                      &lt;b&gt;Posted:&lt;/b&gt; Tue Mar 13, 2012 11:55 pm&lt;br /&gt;&lt;br /&gt;
                                      &lt;br /&gt;&lt;br /&gt;
                                      Hi guys,&lt;br /&gt;
&lt;br /&gt;
I opened a new site for my independent games at :&lt;br /&gt;
&lt;a href=&quot;http://sloppyninja.com&quot; target=&quot;_blank&quot; class=&quot;postlink&quot;&gt;http://sloppyninja.com&lt;/a&gt;&lt;br /&gt;
&lt;br /&gt;
i'd appreciate comments and suggestions.&lt;br /&gt;
&lt;br /&gt;
thanks</description>
                                        <comments>https://www.mollyrocket.com/forums/viewtopic.php?p=7434#7434</comments>
                                        <author>sloppyninja</author>
                                        <pubDate>Tue Mar 13, 2012 11:55 pm</pubDate>
                                        <guid isPermaLink="true">https://www.mollyrocket.com/forums/viewtopic.php?p=7434#7434</guid>
                                      </item>
                                      <item>
                                        <title>GJK and EPA in C++ &amp;amp; SFML (2D)</title>
                                        <link>https://www.mollyrocket.com/forums/viewtopic.php?p=7431#7431</link>
                                        <description>&lt;br /&gt;
                                      &lt;b&gt;Author:&lt;/b&gt; &lt;a href='https://www.mollyrocket.com/forums/profile.php?mode=viewprofile&amp;u=755'&gt;Zylinski&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;
                                      &lt;b&gt;Posted:&lt;/b&gt; Tue Mar 06, 2012 2:00 am&lt;br /&gt;&lt;br /&gt;
                                      &lt;br /&gt;&lt;br /&gt;
                                      Hi fourms!&lt;br /&gt;
I made an 2D implementation of GJK and EPA (Expanding Polytope Algorithm, for handling collision response, goes great with GJK) in C++. It's made to work out of the box with SFML 2.0! It's complete with a &quot;test application&quot;.&lt;br /&gt;
&lt;br /&gt;
It's based one these two great guides:&lt;br /&gt;
&lt;a href=&quot;http://www.codezealot.org/archives/88&quot; target=&quot;_blank&quot; class=&quot;postlink&quot;&gt;http://www.codezealot.org/archives/88&lt;/a&gt;&lt;br /&gt;
&lt;a href=&quot;http://www.codezealot.org/archives/180&quot; target=&quot;_blank&quot; class=&quot;postlink&quot;&gt;http://www.codezealot.org/archives/180&lt;/a&gt;&lt;br /&gt;
&lt;br /&gt;
You can find a post about the algorithms, a more in-depth description and links to the actual code on my blog: &lt;a href=&quot;http://blog.zylinski.se/?p=251&quot; target=&quot;_blank&quot; class=&quot;postlink&quot;&gt;http://blog.zylinski.se/?p=251&lt;/a&gt;. Direct link to just the code: &lt;a href=&quot;http://files.zylinski.se/KarlZylinskiGJKandEPA.cpp&quot; target=&quot;_blank&quot; class=&quot;postlink&quot;&gt;http://files.zylinski.se/KarlZylinskiGJKandEPA.cpp&lt;/a&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;/span&gt;&lt;table width=&quot;90%&quot; cellspacing=&quot;1&quot; cellpadding=&quot;3&quot; border=&quot;0&quot; align=&quot;center&quot;&gt;&lt;tr&gt; 	  &lt;td&gt;&lt;span class=&quot;genmed&quot;&gt;&lt;b&gt;Code:&lt;/b&gt;&lt;/span&gt;&lt;/td&gt;	&lt;/tr&gt;	&lt;tr&gt;	  &lt;td class=&quot;code&quot;&gt;/*&lt;br /&gt;
GJK &amp;amp; EPA algorithm for 2D SFML.&lt;br /&gt;
Written by Karl Zylinski, use it however you want!&lt;br /&gt;
Follow me on twitter&amp;#58; http&amp;#58;//twitter.com/KarlZylinski and on my programming blog&amp;#58; http&amp;#58;//zylinski.se&lt;br /&gt;
Got questions? Email &lt;a href=&quot;mailto:karl@zylinski.se&quot;&gt;karl@zylinski.se&lt;/a&gt; or add karl.zylinski on Skype!&lt;br /&gt;
&lt;br /&gt;
Written with the help of these excellent tutorials&amp;#58;&lt;br /&gt;
http&amp;#58;//www.codezealot.org/archives/88 &amp;#40;GJK&amp;#41;&lt;br /&gt;
http&amp;#58;//www.codezealot.org/archives/180 &amp;#40;EPA&amp;#41;&lt;br /&gt;
*/&lt;br /&gt;
&lt;br /&gt;
#include &amp;lt;SFML/Graphics.hpp&amp;gt;&lt;br /&gt;
#include &amp;lt;SFML/Graphics/ConvexShape.hpp&amp;gt;&lt;br /&gt;
#include &amp;lt;iostream&amp;gt;&lt;br /&gt;
&lt;br /&gt;
// We need these two static and global to be able to modify them from our handle-function!&lt;br /&gt;
static sf&amp;#58;&amp;#58;ConvexShape B;&lt;br /&gt;
// Velocity of moveable rectangle &amp;#40;B&amp;#41;&lt;br /&gt;
static sf&amp;#58;&amp;#58;Vector2f vel;&lt;br /&gt;
&lt;br /&gt;
/*&lt;br /&gt;
FUNCTIONS SHARED BY GJK&amp;amp;EPA BEGINS HERE&lt;br /&gt;
*/&lt;br /&gt;
&lt;br /&gt;
float dot&amp;#40;const sf&amp;#58;&amp;#58;Vector2f&amp;amp; v1, const sf&amp;#58;&amp;#58;Vector2f&amp;amp; v2&amp;#41;&amp;#123;&lt;br /&gt;
&amp;nbsp; &amp;nbsp;return &amp;#40;v1.x * v2.x + v1.y * v2.y&amp;#41;;&lt;br /&gt;
&amp;#125;&lt;br /&gt;
&lt;br /&gt;
// A simplex is just a list of points. It contains 2-3 points for GJK algorithm and 3+ for EPA.&lt;br /&gt;
typedef std&amp;#58;&amp;#58;vector&amp;lt;sf&amp;#58;&amp;#58;Vector2f&amp;gt; Simplex;&lt;br /&gt;
&lt;br /&gt;
// Find point furthest away in a particular direction in a shape&lt;br /&gt;
size_t GetFurthestInDirection&amp;#40;const sf&amp;#58;&amp;#58;ConvexShape&amp;amp; shape, const sf&amp;#58;&amp;#58;Vector2f&amp;amp; direction&amp;#41;&amp;#123;&lt;br /&gt;
&amp;nbsp; &amp;nbsp;// transform is needed to get correct position from rectangleshapes, otherwise you just end up with points at the origin&lt;br /&gt;
&amp;nbsp; &amp;nbsp;// if the algorithm is modified to use another form of shapes which, this can probably be removed&lt;br /&gt;
&amp;nbsp; &amp;nbsp;const sf&amp;#58;&amp;#58;Transform&amp;amp; shapeTrans = shape.GetTransform&amp;#40;&amp;#41;;&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp; &amp;nbsp;float furthestDot = dot&amp;#40;shapeTrans.TransformPoint&amp;#40;shape.GetPoint&amp;#40;0&amp;#41;&amp;#41;, direction&amp;#41;;&lt;br /&gt;
&amp;nbsp; &amp;nbsp;size_t furthestIndex = 0;&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp; &amp;nbsp;for&amp;#40;size_t i = 0; i &amp;lt; shape.GetPointCount&amp;#40;&amp;#41;; ++i&amp;#41;&amp;#123;&lt;br /&gt;
&amp;nbsp; &amp;nbsp;&amp;nbsp; &amp;nbsp;// if the dot product between the point and the diretion is larger than any other point in the shape, it's furthest away&lt;br /&gt;
&amp;nbsp; &amp;nbsp;&amp;nbsp; &amp;nbsp;float curDot = dot&amp;#40;shapeTrans.TransformPoint&amp;#40;shape.GetPoint&amp;#40;i&amp;#41;&amp;#41;, direction&amp;#41;;&lt;br /&gt;
&amp;nbsp; &amp;nbsp;&amp;nbsp; &amp;nbsp;if&amp;#40;curDot &amp;gt; furthestDot&amp;#41;&amp;#123;&lt;br /&gt;
&amp;nbsp; &amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp; &amp;nbsp;furthestDot = curDot;&lt;br /&gt;
&amp;nbsp; &amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp; &amp;nbsp;furthestIndex = i;&lt;br /&gt;
&amp;nbsp; &amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;#125;&lt;br /&gt;
&amp;nbsp; &amp;nbsp;&amp;#125;&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp; &amp;nbsp;return furthestIndex;&lt;br /&gt;
&amp;#125;&lt;br /&gt;
&lt;br /&gt;
// This returns a single vector in the minkowski sum which also is furthest away in the specified direction &amp;#40;this avoids using points which aren't part of the minkowski difference hull&amp;#41;. Used by both EPA &amp;amp; GJK algorithm&lt;br /&gt;
sf&amp;#58;&amp;#58;Vector2f Support&amp;#40;const sf&amp;#58;&amp;#58;ConvexShape&amp;amp; shape1, const sf&amp;#58;&amp;#58;ConvexShape&amp;amp; shape2, const sf&amp;#58;&amp;#58;Vector2f&amp;amp; direction&amp;#41;&amp;#123;&lt;br /&gt;
&amp;nbsp; &amp;nbsp;sf&amp;#58;&amp;#58;Vector2f p1 = shape1.GetTransform&amp;#40;&amp;#41;.TransformPoint&amp;#40;shape1.GetPoint&amp;#40;GetFurthestInDirection&amp;#40;shape1, direction&amp;#41;&amp;#41;&amp;#41;;&lt;br /&gt;
&amp;nbsp; &amp;nbsp;sf&amp;#58;&amp;#58;Vector2f p2 = shape2.GetTransform&amp;#40;&amp;#41;.TransformPoint&amp;#40;shape2.GetPoint&amp;#40;GetFurthestInDirection&amp;#40;shape2, -direction&amp;#41;&amp;#41;&amp;#41;;&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp; &amp;nbsp;sf&amp;#58;&amp;#58;Vector2f p3 = p1 - p2;&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp; &amp;nbsp;return p3;&lt;br /&gt;
&amp;#125;&lt;br /&gt;
&lt;br /&gt;
/*&lt;br /&gt;
FUNCTIONS SHARED BY GJK&amp;amp;EPA ENDS HERE&lt;br /&gt;
*/&lt;br /&gt;
&lt;br /&gt;
/*&lt;br /&gt;
EPA ALGORITHM BEGINS HERE&lt;br /&gt;
epa begins with the simplex from the GJK-algorithm which was used to find the collision. It then expands it until it finds the edge of the polygon!&lt;br /&gt;
*/&lt;br /&gt;
&lt;br /&gt;
// A edge described using a normal, used by EPA algorithm&lt;br /&gt;
struct Edge &amp;#123;&lt;br /&gt;
&amp;nbsp; &amp;nbsp;sf&amp;#58;&amp;#58;Vector2f normal;&lt;br /&gt;
&amp;nbsp; &amp;nbsp;float distance;&lt;br /&gt;
&amp;nbsp; &amp;nbsp;size_t index;&amp;nbsp; &amp;nbsp;&lt;br /&gt;
&amp;#125;;&lt;br /&gt;
&lt;br /&gt;
// Finds the edge closest to the origin in the simplex&lt;br /&gt;
Edge FindClosestEdge&amp;#40;const Simplex&amp;amp; simplex&amp;#41;&amp;#123;&lt;br /&gt;
&amp;nbsp; &amp;nbsp;Edge closest;&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp; &amp;nbsp;// set distance to maximum of a float&lt;br /&gt;
&amp;nbsp; &amp;nbsp;closest.distance = FLT_MAX;&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp; &amp;nbsp;for&amp;#40;size_t i = 0; i &amp;lt; simplex.size&amp;#40;&amp;#41;; ++i&amp;#41;&amp;#123;&lt;br /&gt;
&amp;nbsp; &amp;nbsp;&amp;nbsp; &amp;nbsp;size_t j = i + 1 == simplex.size&amp;#40;&amp;#41; ? 0 &amp;#58; i + 1;&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp; &amp;nbsp;&amp;nbsp; &amp;nbsp;// i is the current point in the simplex and j is the next&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp; &amp;nbsp;&amp;nbsp; &amp;nbsp;const sf&amp;#58;&amp;#58;Vector2f&amp;amp; a = simplex.at&amp;#40;i&amp;#41;;&lt;br /&gt;
&amp;nbsp; &amp;nbsp;&amp;nbsp; &amp;nbsp;const sf&amp;#58;&amp;#58;Vector2f&amp;amp; b = simplex.at&amp;#40;j&amp;#41;;&lt;br /&gt;
&amp;nbsp; &amp;nbsp;&amp;nbsp; &amp;nbsp;&lt;br /&gt;
&amp;nbsp; &amp;nbsp;&amp;nbsp; &amp;nbsp;// find our edge&lt;br /&gt;
&amp;nbsp; &amp;nbsp;&amp;nbsp; &amp;nbsp;sf&amp;#58;&amp;#58;Vector2f e = b - a;&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp; &amp;nbsp;&amp;nbsp; &amp;nbsp;// find the normal of the edge&lt;br /&gt;
&amp;nbsp; &amp;nbsp;&amp;nbsp; &amp;nbsp;sf&amp;#58;&amp;#58;Vector2f n&amp;#40;-e.y, e.x&amp;#41;;&lt;br /&gt;
&amp;nbsp; &amp;nbsp;&amp;nbsp; &amp;nbsp;n *= 1/sqrt&amp;#40;dot&amp;#40;n,n&amp;#41;&amp;#41;; // normalize!&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp; &amp;nbsp;&amp;nbsp; &amp;nbsp;float d = dot&amp;#40;a,n&amp;#41;; // distance between orgin and normal &amp;#40;a is the vector between origin and a since&amp;#58; a - origin = a - &amp;#91;0,0&amp;#93; = a&amp;#41;&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp; &amp;nbsp;&amp;nbsp; &amp;nbsp;// if d is less than the previously closest&lt;br /&gt;
&amp;nbsp; &amp;nbsp;&amp;nbsp; &amp;nbsp;if&amp;#40;d &amp;lt; closest.distance&amp;#41;&amp;#123;&lt;br /&gt;
&amp;nbsp; &amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp; &amp;nbsp;closest.distance = d;&lt;br /&gt;
&amp;nbsp; &amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp; &amp;nbsp;closest.normal = n;&lt;br /&gt;
&amp;nbsp; &amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp; &amp;nbsp;closest.index = j; // we use an index for performance reasons, so we can just look it up in the simplex later&lt;br /&gt;
&amp;nbsp; &amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;#125;&lt;br /&gt;
&amp;nbsp; &amp;nbsp;&amp;#125;&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp; &amp;nbsp;return closest;&lt;br /&gt;
&amp;#125;&lt;br /&gt;
&lt;br /&gt;
// Main function for handling the collision. The shapes passed to this function MUST BE COLLIDING. The simplex is the simplex which was used to find the collision, that is the terminating simplex of the GJK-algorithm&lt;br /&gt;
void Handle&amp;#40;const sf&amp;#58;&amp;#58;ConvexShape&amp;amp; shape1, const sf&amp;#58;&amp;#58;ConvexShape&amp;amp; shape2, Simplex&amp;amp; simplex&amp;#41;&amp;#123;&lt;br /&gt;
&amp;nbsp; &amp;nbsp;int i = 0; // i is just for security, preventing infinit loop &amp;#40;shouldn't happen though&amp;#41;&lt;br /&gt;
&amp;nbsp; &amp;nbsp;while&amp;#40;++i &amp;lt; 100&amp;#41;&amp;#123;&lt;br /&gt;
&amp;nbsp; &amp;nbsp;&amp;nbsp; &amp;nbsp;// find the edge closest to the origin in the simplex&lt;br /&gt;
&amp;nbsp; &amp;nbsp;&amp;nbsp; &amp;nbsp;Edge e = FindClosestEdge&amp;#40;simplex&amp;#41;;&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp; &amp;nbsp;&amp;nbsp; &amp;nbsp;// find the furthest minkowski difference point in the direction of the normal&lt;br /&gt;
&amp;nbsp; &amp;nbsp;&amp;nbsp; &amp;nbsp;const sf&amp;#58;&amp;#58;Vector2f&amp;amp; p = Support&amp;#40;shape1, shape2, e.normal&amp;#41;;&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp; &amp;nbsp;&amp;nbsp; &amp;nbsp;// find the distance between the point and the edge&lt;br /&gt;
&amp;nbsp; &amp;nbsp;&amp;nbsp; &amp;nbsp;float d = dot&amp;#40;p, e.normal&amp;#41;;&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp; &amp;nbsp;&amp;nbsp; &amp;nbsp;// find if we've hit the border of the minkowski difference!&lt;br /&gt;
&amp;nbsp; &amp;nbsp;&amp;nbsp; &amp;nbsp;if&amp;#40;d - e.distance &amp;lt; 0.1&amp;#41;&amp;#123;&lt;br /&gt;
&amp;nbsp; &amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp; &amp;nbsp;// handle the collision here, this is just an example. The normal direction can be used to to special tricks depending on angle&lt;br /&gt;
&amp;nbsp; &amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp; &amp;nbsp;std&amp;#58;&amp;#58;cout &amp;lt;&amp;lt; &amp;quot;move&amp;#58; &amp;quot; &amp;lt;&amp;lt; d &amp;lt;&amp;lt; &amp;quot; in direction&amp;#58; &amp;quot; &amp;lt;&amp;lt; e.normal.x &amp;lt;&amp;lt; &amp;quot; &amp;quot; &amp;lt;&amp;lt; e.normal.y &amp;lt;&amp;lt; std&amp;#58;&amp;#58;endl;&lt;br /&gt;
&amp;nbsp; &amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp; &amp;nbsp;vel += &amp;#40;d + 0.001f&amp;#41; * e.normal; // pushes the velocity back in the oppsite direction&lt;br /&gt;
&amp;nbsp; &amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp; &amp;nbsp;return;&lt;br /&gt;
&amp;nbsp; &amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;#125; else &amp;#123;&lt;br /&gt;
&amp;nbsp; &amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp; &amp;nbsp;// add the point inbetween the points where it was found &amp;#40;due to the need of correct winding&amp;#41;&lt;br /&gt;
&amp;nbsp; &amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp; &amp;nbsp;simplex.insert&amp;#40;simplex.begin&amp;#40;&amp;#41; + e.index, p&amp;#41;;&lt;br /&gt;
&amp;nbsp; &amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;#125;&lt;br /&gt;
&amp;nbsp; &amp;nbsp;&amp;#125;&lt;br /&gt;
&amp;#125;&lt;br /&gt;
&lt;br /&gt;
/*&lt;br /&gt;
END OF EPA ALGORITHM&lt;br /&gt;
*/&lt;br /&gt;
&lt;br /&gt;
/*&lt;br /&gt;
GJK ALGORITHM BEGINS HERE&lt;br /&gt;
GJK tries to find a tringle in the minkowski difference of two convex shapes which includes the origin.&lt;br /&gt;
*/&lt;br /&gt;
&lt;br /&gt;
// finds out if our simplex contains the origin or not! also modifies the search direction &amp;#40;the direction in which we should further expand our simplex&amp;#41;&lt;br /&gt;
// note that the parameters are references, making it possible to modify them&lt;br /&gt;
bool ContainsOrigin&amp;#40;std&amp;#58;&amp;#58;vector&amp;lt;sf&amp;#58;&amp;#58;Vector2f&amp;gt;&amp;amp; simplex, sf&amp;#58;&amp;#58;Vector2f&amp;amp; direction&amp;#41;&amp;#123;&lt;br /&gt;
&amp;nbsp; &amp;nbsp;// a is the newest point&lt;br /&gt;
&amp;nbsp; &amp;nbsp;// b&amp;amp;c are the &amp;quot;old points&amp;quot;&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp; &amp;nbsp;const sf&amp;#58;&amp;#58;Vector2f&amp;amp; a = simplex.back&amp;#40;&amp;#41;;&lt;br /&gt;
&amp;nbsp; &amp;nbsp;sf&amp;#58;&amp;#58;Vector2f ao = -a; // vector from newest point in simplex to the origin&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp; &amp;nbsp;// triangular simplex, will check if the triangle includes the origin. If it does not it removes the &amp;quot;last&amp;quot; points from the simplex&lt;br /&gt;
&amp;nbsp; &amp;nbsp;if&amp;#40;simplex.size&amp;#40;&amp;#41; == 3&amp;#41;&amp;#123;&lt;br /&gt;
&amp;nbsp; &amp;nbsp;&amp;nbsp; &amp;nbsp;const sf&amp;#58;&amp;#58;Vector2f&amp;amp; b = simplex.at&amp;#40;0&amp;#41;;&lt;br /&gt;
&amp;nbsp; &amp;nbsp;&amp;nbsp; &amp;nbsp;const sf&amp;#58;&amp;#58;Vector2f&amp;amp; c = simplex.at&amp;#40;1&amp;#41;;&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp; &amp;nbsp;&amp;nbsp; &amp;nbsp;sf&amp;#58;&amp;#58;Vector2f ab = b - a; // vector between a and b&lt;br /&gt;
&amp;nbsp; &amp;nbsp;&amp;nbsp; &amp;nbsp;sf&amp;#58;&amp;#58;Vector2f abPerp&amp;#40;-ab.y, ab.x&amp;#41;; // the perpendicular vector to ab, possibly becomes new search direction if collision is not found&lt;br /&gt;
&amp;nbsp; &amp;nbsp;&amp;nbsp; &amp;nbsp;if&amp;#40;dot&amp;#40;abPerp,c&amp;#41; &amp;gt;= 0&amp;#41;&amp;#123; // new direction might &amp;quot;wrong way&amp;quot;, check against other side&lt;br /&gt;
&amp;nbsp; &amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp; &amp;nbsp;abPerp = -abPerp;&lt;br /&gt;
&amp;nbsp; &amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;#125;&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp; &amp;nbsp;&amp;nbsp; &amp;nbsp;if&amp;#40;dot&amp;#40;abPerp, ao&amp;#41; &amp;gt; 0&amp;#41;&amp;#123; // we are in area of direction abPerp&lt;br /&gt;
&amp;nbsp; &amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp; &amp;nbsp;simplex.erase&amp;#40;std&amp;#58;&amp;#58;find&amp;#40;simplex.begin&amp;#40;&amp;#41;, simplex.end&amp;#40;&amp;#41;, c&amp;#41;&amp;#41;; // remove point in simplex, making it a line&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp; &amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp; &amp;nbsp;direction = abPerp; // set a new search direction, where we should look for an new third point&lt;br /&gt;
&amp;nbsp; &amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;#125; else &amp;#123; // we are in area of direction acPerp&lt;br /&gt;
&amp;nbsp; &amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp; &amp;nbsp;sf&amp;#58;&amp;#58;Vector2f ac = c - a; // sme as for ab and abPerp but between a and c&lt;br /&gt;
&amp;nbsp; &amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp; &amp;nbsp;sf&amp;#58;&amp;#58;Vector2f acPerp&amp;#40;-ac.y, ac.x&amp;#41;;&lt;br /&gt;
&amp;nbsp; &amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp; &amp;nbsp;if&amp;#40;dot&amp;#40;acPerp,b&amp;#41; &amp;gt;= 0&amp;#41;&amp;#123; &lt;br /&gt;
&amp;nbsp; &amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp; &amp;nbsp;acPerp = -acPerp;&lt;br /&gt;
&amp;nbsp; &amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;#125;&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp; &amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp; &amp;nbsp;if&amp;#40;dot&amp;#40;acPerp, ao&amp;#41; &amp;lt;= 0&amp;#41; // the origin isn't in the direction of acPerp, we just detected a collision! This is true since we already know that it isn't int the direction of abPerp&lt;br /&gt;
&amp;nbsp; &amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp; &amp;nbsp;return true; // fast exit&lt;br /&gt;
&amp;nbsp; &amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp; &amp;nbsp;&lt;br /&gt;
&amp;nbsp; &amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp; &amp;nbsp;// does the following only if collision is not found. Erases a point, making the simplex a line and sets a new serach direction in the direction perpendicular to the one between a and c.&lt;br /&gt;
&amp;nbsp; &amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp; &amp;nbsp;simplex.erase&amp;#40;std&amp;#58;&amp;#58;find&amp;#40;simplex.begin&amp;#40;&amp;#41;, simplex.end&amp;#40;&amp;#41;, b&amp;#41;&amp;#41;;&lt;br /&gt;
&amp;nbsp; &amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp; &amp;nbsp;direction = acPerp;&lt;br /&gt;
&amp;nbsp; &amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;#125;&lt;br /&gt;
&amp;nbsp; &amp;nbsp;&amp;#125;else if&amp;#40;simplex.size&amp;#40;&amp;#41; == 2&amp;#41;&amp;#123; // simplex is a line&lt;br /&gt;
&amp;nbsp; &amp;nbsp;&amp;nbsp; &amp;nbsp;const sf&amp;#58;&amp;#58;Vector2f&amp;amp; b = simplex.at&amp;#40;0&amp;#41;;&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp; &amp;nbsp;&amp;nbsp; &amp;nbsp;// find the vector between the two points&lt;br /&gt;
&amp;nbsp; &amp;nbsp;&amp;nbsp; &amp;nbsp;sf&amp;#58;&amp;#58;Vector2f ab = b - a;&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp; &amp;nbsp;&amp;nbsp; &amp;nbsp;// find the perpendicular vector in the direction of the origin&lt;br /&gt;
&amp;nbsp; &amp;nbsp;&amp;nbsp; &amp;nbsp;sf&amp;#58;&amp;#58;Vector2f abPerp&amp;#40;-ab.y, ab.x&amp;#41;;&lt;br /&gt;
&amp;nbsp; &amp;nbsp;&amp;nbsp; &amp;nbsp;if&amp;#40;dot&amp;#40;abPerp,ao&amp;#41; &amp;gt;= 0&amp;#41;&amp;#123;&lt;br /&gt;
&amp;nbsp; &amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp; &amp;nbsp;abPerp = -abPerp;&lt;br /&gt;
&amp;nbsp; &amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;#125;&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp; &amp;nbsp;&amp;nbsp; &amp;nbsp;// set direction to the perpendicular vector, this is the direction where we want to look for a third point&lt;br /&gt;
&amp;nbsp; &amp;nbsp;&amp;nbsp; &amp;nbsp;direction = abPerp;&lt;br /&gt;
&amp;nbsp; &amp;nbsp;&amp;#125;&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp; &amp;nbsp;// no collision this iteration&lt;br /&gt;
&amp;nbsp; &amp;nbsp;return false;&lt;br /&gt;
&amp;#125;&lt;br /&gt;
&lt;br /&gt;
// Main GJK functionm, starts EPA algorithm &amp;#40;Handle-function&amp;#41; in case it finds a collision&lt;br /&gt;
void DetectIntersectionAndHandle&amp;#40;const sf&amp;#58;&amp;#58;ConvexShape&amp;amp; shape1, const sf&amp;#58;&amp;#58;ConvexShape&amp;amp; shape2&amp;#41;&amp;#123;&lt;br /&gt;
&amp;nbsp; &amp;nbsp;// create an empty simplex&lt;br /&gt;
&amp;nbsp; &amp;nbsp;Simplex simplex;&lt;br /&gt;
&amp;nbsp; &amp;nbsp;&lt;br /&gt;
&amp;nbsp; &amp;nbsp;// look in any direction, &amp;#40;1,1&amp;#41; is just an example&lt;br /&gt;
&amp;nbsp; &amp;nbsp;sf&amp;#58;&amp;#58;Vector2f direction = sf&amp;#58;&amp;#58;Vector2f&amp;#40;1,1&amp;#41;;&lt;br /&gt;
&amp;nbsp; &amp;nbsp;// find a point in minkowski difference in the direction&lt;br /&gt;
&amp;nbsp; &amp;nbsp;simplex.push_back&amp;#40;Support&amp;#40;shape1, shape2, direction&amp;#41;&amp;#41;;&lt;br /&gt;
&amp;nbsp; &amp;nbsp;// look in the opposite direction&lt;br /&gt;
&amp;nbsp; &amp;nbsp;direction = -direction;&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp; &amp;nbsp;int i = 0;&lt;br /&gt;
&amp;nbsp; &amp;nbsp;while&amp;#40;++i &amp;lt; 100&amp;#41;&amp;#123;&lt;br /&gt;
&amp;nbsp; &amp;nbsp;&amp;nbsp; &amp;nbsp;// find a new vector in the search direction&lt;br /&gt;
&amp;nbsp; &amp;nbsp;&amp;nbsp; &amp;nbsp;sf&amp;#58;&amp;#58;Vector2f newVec = Support&amp;#40;shape1,shape2, direction&amp;#41;;&lt;br /&gt;
&amp;nbsp; &amp;nbsp;&amp;nbsp; &amp;nbsp;if&amp;#40;dot&amp;#40;newVec, direction&amp;#41; &amp;lt; 0&amp;#41;&amp;#123; // if we couldn't find a new point in the direction, we stop&lt;br /&gt;
&amp;nbsp; &amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp; &amp;nbsp;return; &lt;br /&gt;
&amp;nbsp; &amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;#125; else &amp;#123; // we found a new point!&lt;br /&gt;
&amp;nbsp; &amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp; &amp;nbsp;simplex.push_back&amp;#40;newVec&amp;#41;; // add to simplex&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp; &amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp; &amp;nbsp;// if the simplex contains the origin, send it to the EPA Handle-function and then exit the function.&lt;br /&gt;
&amp;nbsp; &amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp; &amp;nbsp;if&amp;#40;ContainsOrigin&amp;#40;simplex, direction&amp;#41;&amp;#41;&amp;#123;&lt;br /&gt;
&amp;nbsp; &amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp; &amp;nbsp;Handle&amp;#40;shape1, shape2, simplex&amp;#41;;&lt;br /&gt;
&amp;nbsp; &amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp; &amp;nbsp;return;&lt;br /&gt;
&amp;nbsp; &amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;#125;&lt;br /&gt;
&amp;nbsp; &amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;#125;&lt;br /&gt;
&amp;nbsp; &amp;nbsp;&amp;#125;&lt;br /&gt;
&amp;#125;&lt;br /&gt;
&lt;br /&gt;
/*&lt;br /&gt;
END OF GJK ALGORITHM&lt;br /&gt;
*/&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
// test program, renders two boxes, makes one of them movable with arrow keys, makes them rotatable with I &amp;amp; O-keys and then uses the GJK&amp;amp;EPA algorithms on them&lt;br /&gt;
int main&amp;#40;&amp;#41;&amp;#123;&lt;br /&gt;
&amp;nbsp; &amp;nbsp;sf&amp;#58;&amp;#58;RenderWindow window&amp;#40;sf&amp;#58;&amp;#58;VideoMode&amp;#40;1024,768&amp;#41;, &amp;quot;GJK&amp;amp;EPA test!&amp;quot;&amp;#41;;&lt;br /&gt;
&amp;nbsp; &amp;nbsp;sf&amp;#58;&amp;#58;Event evt;&lt;br /&gt;
&amp;nbsp; &amp;nbsp;window.SetFramerateLimit&amp;#40;30&amp;#41;;&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp; &amp;nbsp;// the static Shape &amp;#40;can only be rotated, not moved&amp;#41;&lt;br /&gt;
&amp;nbsp; &amp;nbsp;sf&amp;#58;&amp;#58;ConvexShape A&amp;#40;4&amp;#41;;&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp; &amp;nbsp;// Declartion of B is at the top of this file&lt;br /&gt;
&amp;nbsp; &amp;nbsp;B.SetPointCount&amp;#40;4&amp;#41;;&lt;br /&gt;
&amp;nbsp; &amp;nbsp;B.SetPoint&amp;#40;0, sf&amp;#58;&amp;#58;Vector2f&amp;#40;0,0&amp;#41;&amp;#41;;&lt;br /&gt;
&amp;nbsp; &amp;nbsp;B.SetPoint&amp;#40;1, sf&amp;#58;&amp;#58;Vector2f&amp;#40;50,0&amp;#41;&amp;#41;;&lt;br /&gt;
&amp;nbsp; &amp;nbsp;B.SetPoint&amp;#40;2, sf&amp;#58;&amp;#58;Vector2f&amp;#40;50,80&amp;#41;&amp;#41;;&lt;br /&gt;
&amp;nbsp; &amp;nbsp;B.SetPoint&amp;#40;3, sf&amp;#58;&amp;#58;Vector2f&amp;#40;0,80&amp;#41;&amp;#41;;&lt;br /&gt;
&amp;nbsp; &amp;nbsp;B.SetFillColor&amp;#40;sf&amp;#58;&amp;#58;Color&amp;#58;&amp;#58;Green&amp;#41;;&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp; &amp;nbsp;A.SetPoint&amp;#40;0, sf&amp;#58;&amp;#58;Vector2f&amp;#40;0,0&amp;#41;&amp;#41;;&lt;br /&gt;
&amp;nbsp; &amp;nbsp;A.SetPoint&amp;#40;1, sf&amp;#58;&amp;#58;Vector2f&amp;#40;200,0&amp;#41;&amp;#41;;&lt;br /&gt;
&amp;nbsp; &amp;nbsp;A.SetPoint&amp;#40;2, sf&amp;#58;&amp;#58;Vector2f&amp;#40;200,120&amp;#41;&amp;#41;;&lt;br /&gt;
&amp;nbsp; &amp;nbsp;A.SetPoint&amp;#40;3, sf&amp;#58;&amp;#58;Vector2f&amp;#40;0,120&amp;#41;&amp;#41;;&lt;br /&gt;
&amp;nbsp; &amp;nbsp;A.SetPosition&amp;#40;300,300&amp;#41;;&lt;br /&gt;
&amp;nbsp; &amp;nbsp;A.SetFillColor&amp;#40;sf&amp;#58;&amp;#58;Color&amp;#58;&amp;#58;Red&amp;#41;;&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp; &amp;nbsp;while&amp;#40;window.IsOpen&amp;#40;&amp;#41;&amp;#41;&amp;#123;&lt;br /&gt;
&amp;nbsp; &amp;nbsp;&amp;nbsp; &amp;nbsp;while&amp;#40;window.PollEvent&amp;#40;evt&amp;#41;&amp;#41;&amp;#123;&lt;br /&gt;
&amp;nbsp; &amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp; &amp;nbsp;if&amp;#40;evt.Type == sf&amp;#58;&amp;#58;Event&amp;#58;&amp;#58;Closed&amp;#41;&lt;br /&gt;
&amp;nbsp; &amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp; &amp;nbsp;window.Close&amp;#40;&amp;#41;;&lt;br /&gt;
&amp;nbsp; &amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;#125;&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp; &amp;nbsp;&amp;nbsp; &amp;nbsp;// Movmement stuff&lt;br /&gt;
&amp;nbsp; &amp;nbsp;&amp;nbsp; &amp;nbsp;if&amp;#40;sf&amp;#58;&amp;#58;Keyboard&amp;#58;&amp;#58;IsKeyPressed&amp;#40;sf&amp;#58;&amp;#58;Keyboard&amp;#58;&amp;#58;Left&amp;#41;&amp;#41;&amp;#123;&lt;br /&gt;
&amp;nbsp; &amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp; &amp;nbsp;vel.x -= 1;&lt;br /&gt;
&amp;nbsp; &amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;#125; else if&amp;#40;sf&amp;#58;&amp;#58;Keyboard&amp;#58;&amp;#58;IsKeyPressed&amp;#40;sf&amp;#58;&amp;#58;Keyboard&amp;#58;&amp;#58;Right&amp;#41;&amp;#41;&amp;#123;&lt;br /&gt;
&amp;nbsp; &amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp; &amp;nbsp;vel.x += 1;&lt;br /&gt;
&amp;nbsp; &amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;#125; else &amp;#123;&lt;br /&gt;
&amp;nbsp; &amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp; &amp;nbsp;vel.x *= 0.2f;&lt;br /&gt;
&amp;nbsp; &amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;#125;&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp; &amp;nbsp;&amp;nbsp; &amp;nbsp;if&amp;#40;sf&amp;#58;&amp;#58;Keyboard&amp;#58;&amp;#58;IsKeyPressed&amp;#40;sf&amp;#58;&amp;#58;Keyboard&amp;#58;&amp;#58;Up&amp;#41;&amp;#41;&amp;#123;&lt;br /&gt;
&amp;nbsp; &amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp; &amp;nbsp;vel.y -= 1;&lt;br /&gt;
&amp;nbsp; &amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;#125; else if&amp;#40;sf&amp;#58;&amp;#58;Keyboard&amp;#58;&amp;#58;IsKeyPressed&amp;#40;sf&amp;#58;&amp;#58;Keyboard&amp;#58;&amp;#58;Down&amp;#41;&amp;#41;&amp;#123;&lt;br /&gt;
&amp;nbsp; &amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp; &amp;nbsp;vel.y += 1;&lt;br /&gt;
&amp;nbsp; &amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;#125; else &amp;#123;&lt;br /&gt;
&amp;nbsp; &amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp; &amp;nbsp;vel.y *= 0.2f;&lt;br /&gt;
&amp;nbsp; &amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;#125;&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp; &amp;nbsp;&amp;nbsp; &amp;nbsp;if&amp;#40;vel.x &amp;gt; 1&amp;#41;&amp;#123;&lt;br /&gt;
&amp;nbsp; &amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp; &amp;nbsp;vel.x = 1;&lt;br /&gt;
&amp;nbsp; &amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;#125;&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp; &amp;nbsp;&amp;nbsp; &amp;nbsp;if&amp;#40;vel.x &amp;lt; -1&amp;#41;&amp;#123;&lt;br /&gt;
&amp;nbsp; &amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp; &amp;nbsp;vel.x = -1;&lt;br /&gt;
&amp;nbsp; &amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;#125;&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp; &amp;nbsp;&amp;nbsp; &amp;nbsp;if&amp;#40;vel.y &amp;gt; 1&amp;#41;&amp;#123;&lt;br /&gt;
&amp;nbsp; &amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp; &amp;nbsp;vel.y = 1;&lt;br /&gt;
&amp;nbsp; &amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;#125;&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp; &amp;nbsp;&amp;nbsp; &amp;nbsp;if&amp;#40;vel.y &amp;lt; -1&amp;#41;&amp;#123;&lt;br /&gt;
&amp;nbsp; &amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp; &amp;nbsp;vel.y = -1;&lt;br /&gt;
&amp;nbsp; &amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;#125;&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp; &amp;nbsp;&amp;nbsp; &amp;nbsp;if&amp;#40;sf&amp;#58;&amp;#58;Keyboard&amp;#58;&amp;#58;IsKeyPressed&amp;#40;sf&amp;#58;&amp;#58;Keyboard&amp;#58;&amp;#58;O&amp;#41;&amp;#41;&lt;br /&gt;
&amp;nbsp; &amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp; &amp;nbsp;A.Rotate&amp;#40;0.25f&amp;#41;;&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp; &amp;nbsp;&amp;nbsp; &amp;nbsp;if&amp;#40;sf&amp;#58;&amp;#58;Keyboard&amp;#58;&amp;#58;IsKeyPressed&amp;#40;sf&amp;#58;&amp;#58;Keyboard&amp;#58;&amp;#58;I&amp;#41;&amp;#41;&lt;br /&gt;
&amp;nbsp; &amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp; &amp;nbsp;B.Rotate&amp;#40;0.25f&amp;#41;;&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp; &amp;nbsp;&amp;nbsp; &amp;nbsp;B.Move&amp;#40;vel&amp;#41;;&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp; &amp;nbsp;&amp;nbsp; &amp;nbsp;// Do GJK &amp;amp; possibly EPA&lt;br /&gt;
&amp;nbsp; &amp;nbsp;&amp;nbsp; &amp;nbsp;DetectIntersectionAndHandle&amp;#40;A,B&amp;#41;;&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp; &amp;nbsp;&amp;nbsp; &amp;nbsp;window.Clear&amp;#40;&amp;#41;;&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp; &amp;nbsp;&amp;nbsp; &amp;nbsp;window.Draw&amp;#40;B&amp;#41;;&lt;br /&gt;
&amp;nbsp; &amp;nbsp;&amp;nbsp; &amp;nbsp;window.Draw&amp;#40;A&amp;#41;;&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp; &amp;nbsp;&amp;nbsp; &amp;nbsp;window.Display&amp;#40;&amp;#41;;&lt;br /&gt;
&amp;nbsp; &amp;nbsp;&amp;#125;&lt;br /&gt;
&amp;#125;&lt;br /&gt;
&lt;/td&gt;	&lt;/tr&gt;&lt;/table&gt;&lt;span class=&quot;postbody&quot;&gt;&lt;br /&gt;
&lt;br /&gt;
I warmly welcome criticism!&lt;br /&gt;
&lt;br /&gt;
/Karl Zylinski</description>
                                        <comments>https://www.mollyrocket.com/forums/viewtopic.php?p=7431#7431</comments>
                                        <author>Zylinski</author>
                                        <pubDate>Tue Mar 06, 2012 2:00 am</pubDate>
                                        <guid isPermaLink="true">https://www.mollyrocket.com/forums/viewtopic.php?p=7431#7431</guid>
                                      </item>
                                      <item>
                                        <title>public domain truetype font rendering</title>
                                        <link>https://www.mollyrocket.com/forums/viewtopic.php?p=7429#7429</link>
                                        <description>&lt;br /&gt;
                                      &lt;b&gt;Author:&lt;/b&gt; &lt;a href='https://www.mollyrocket.com/forums/profile.php?mode=viewprofile&amp;u=13'&gt;sean&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;
                                      &lt;b&gt;Posted:&lt;/b&gt; Fri Mar 02, 2012 12:09 pm&lt;br /&gt;&lt;br /&gt;
                                      &lt;br /&gt;&lt;br /&gt;
                                      I have no idea, which is why I don't offer any guidance on that sort of thing.&lt;br /&gt;
&lt;br /&gt;
I'm not aware of any anchor information in the TrueType specification, but I didn't look at every table so I'm not 100% sure. However, you certianly have one anchor, the character &quot;origin&quot;; when stb_truetype returns you a font bitmap, it doesn't just give you a width and a height, it gives you a bounding box relative to a (0,0) origin. So it's &lt;span style=&quot;font-style: italic&quot;&gt;possible&lt;/span&gt; that you're just supposed to position the characters relative to that same origin. In a best possible world, the combining characters would come first, and they would have a 0 advance, which would cause you to draw each character in the same place until you reached a regular character which then advances. Maybe they did that? I have no idea.</description>
                                        <comments>https://www.mollyrocket.com/forums/viewtopic.php?p=7429#7429</comments>
                                        <author>sean</author>
                                        <pubDate>Fri Mar 02, 2012 12:09 pm</pubDate>
                                        <guid isPermaLink="true">https://www.mollyrocket.com/forums/viewtopic.php?p=7429#7429</guid>
                                      </item>
                                      <item>
                                        <title>public domain jpeg/png decompressor</title>
                                        <link>https://www.mollyrocket.com/forums/viewtopic.php?p=7427#7427</link>
                                        <description>&lt;br /&gt;
                                      &lt;b&gt;Author:&lt;/b&gt; &lt;a href='https://www.mollyrocket.com/forums/profile.php?mode=viewprofile&amp;u=21'&gt;NeARAZ&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;
                                      &lt;b&gt;Posted:&lt;/b&gt; Tue Feb 28, 2012 2:57 pm&lt;br /&gt;&lt;br /&gt;
                                      &lt;br /&gt;&lt;br /&gt;
                                      Only tangentially related to stb_image_write: I needed to quickly write OpenEXR files (think &quot;HDR screenshots&quot;) and integrating whole official OpenEXR library seemed like overkill. So here's a small (and very limited!) code to write simplest possible .exr files: &lt;a href=&quot;https://github.com/aras-p/miniexr/blob/master/miniexr.cpp&quot; target=&quot;_blank&quot;&gt;https://github.com/aras-p/miniexr/blob/master/miniexr.cpp&lt;/a&gt;&lt;br /&gt;
&lt;br /&gt;
RGBA FP16 in (i.e. what you get in D3D10/11 from DXGI_FORMAT_R16G16B16A16_FLOAT resources), uncompressed BGR half-precision .exr out. Most of the code is just spelling out quite verbose .exr header structure.&lt;br /&gt;
&lt;br /&gt;
This is all.</description>
                                        <comments>https://www.mollyrocket.com/forums/viewtopic.php?p=7427#7427</comments>
                                        <author>NeARAZ</author>
                                        <pubDate>Tue Feb 28, 2012 2:57 pm</pubDate>
                                        <guid isPermaLink="true">https://www.mollyrocket.com/forums/viewtopic.php?p=7427#7427</guid>
                                      </item>
                                      <item>
                                        <title>How long is a nanosecond?</title>
                                        <link>https://www.mollyrocket.com/forums/viewtopic.php?p=7426#7426</link>
                                        <description>&lt;br /&gt;
                                      &lt;b&gt;Author:&lt;/b&gt; &lt;a href='https://www.mollyrocket.com/forums/profile.php?mode=viewprofile&amp;u=46'&gt;Won&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;
                                      &lt;b&gt;Posted:&lt;/b&gt; Mon Feb 27, 2012 7:04 pm&lt;br /&gt;&lt;br /&gt;
                                      &lt;br /&gt;&lt;br /&gt;
                                      Also: don't forget that pi seconds is a nanocentury.</description>
                                        <comments>https://www.mollyrocket.com/forums/viewtopic.php?p=7426#7426</comments>
                                        <author>Won</author>
                                        <pubDate>Mon Feb 27, 2012 7:04 pm</pubDate>
                                        <guid isPermaLink="true">https://www.mollyrocket.com/forums/viewtopic.php?p=7426#7426</guid>
                                      </item>
                                      <item>
                                        <title>Immediate mode physics engine?</title>
                                        <link>https://www.mollyrocket.com/forums/viewtopic.php?p=7424#7424</link>
                                        <description>&lt;br /&gt;
                                      &lt;b&gt;Author:&lt;/b&gt; &lt;a href='https://www.mollyrocket.com/forums/profile.php?mode=viewprofile&amp;u=488'&gt;mariocaprino&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;
                                      &lt;b&gt;Posted:&lt;/b&gt; Mon Feb 13, 2012 10:15 am&lt;br /&gt;&lt;br /&gt;
                                      &lt;br /&gt;&lt;br /&gt;
                                      Here are my ramblings about &lt;a href=&quot;http://chipmunk-physics.net/forum/viewtopic.php?t=1434&quot; target=&quot;_blank&quot; class=&quot;postlink&quot;&gt;Immediate Mode Physics in the Chipmunk forums&lt;/a&gt;. Maybe it might be of interest to you if you are considering this approach.&lt;br /&gt;
&lt;br /&gt;
I never did more then test the approach - but I still believe an IM Physics API would be better suited for some projects.</description>
                                        <comments>https://www.mollyrocket.com/forums/viewtopic.php?p=7424#7424</comments>
                                        <author>mariocaprino</author>
                                        <pubDate>Mon Feb 13, 2012 10:15 am</pubDate>
                                        <guid isPermaLink="true">https://www.mollyrocket.com/forums/viewtopic.php?p=7424#7424</guid>
                                      </item>
                                      <item>
                                        <title>new open source DXTn texture compression library</title>
                                        <link>https://www.mollyrocket.com/forums/viewtopic.php?p=7404#7404</link>
                                        <description>&lt;br /&gt;
                                      &lt;b&gt;Author:&lt;/b&gt; &lt;a href='https://www.mollyrocket.com/forums/profile.php?mode=viewprofile&amp;u=603'&gt;random task&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;
                                      &lt;b&gt;Posted:&lt;/b&gt; Wed Jan 11, 2012 3:15 pm&lt;br /&gt;&lt;br /&gt;
                                      &lt;br /&gt;&lt;br /&gt;
                                      Interesting! I'll give it a try as soon as I get a free evening...</description>
                                        <comments>https://www.mollyrocket.com/forums/viewtopic.php?p=7404#7404</comments>
                                        <author>random task</author>
                                        <pubDate>Wed Jan 11, 2012 3:15 pm</pubDate>
                                        <guid isPermaLink="true">https://www.mollyrocket.com/forums/viewtopic.php?p=7404#7404</guid>
                                      </item>
                                      <item>
                                        <title>S3TC patent maybe invalid</title>
                                        <link>https://www.mollyrocket.com/forums/viewtopic.php?p=7398#7398</link>
                                        <description>&lt;br /&gt;
                                      &lt;b&gt;Author:&lt;/b&gt; &lt;a href='https://www.mollyrocket.com/forums/profile.php?mode=viewprofile&amp;u=46'&gt;Won&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;
                                      &lt;b&gt;Posted:&lt;/b&gt; Thu Jan 05, 2012 7:53 pm&lt;br /&gt;&lt;br /&gt;
                                      &lt;br /&gt;&lt;br /&gt;
                                      &lt;a href=&quot;http://www.phoronix.com/scan.php?page=news_item&amp;amp;px=OTkxMQ&quot; target=&quot;_blank&quot;&gt;http://www.phoronix.com/scan.php?page=news_item&amp;amp;px=OTkxMQ&lt;/a&gt;</description>
                                        <comments>https://www.mollyrocket.com/forums/viewtopic.php?p=7398#7398</comments>
                                        <author>Won</author>
                                        <pubDate>Thu Jan 05, 2012 7:53 pm</pubDate>
                                        <guid isPermaLink="true">https://www.mollyrocket.com/forums/viewtopic.php?p=7398#7398</guid>
                                      </item>
                                      <item>
                                        <title>t += dt</title>
                                        <link>https://www.mollyrocket.com/forums/viewtopic.php?p=7389#7389</link>
                                        <description>&lt;br /&gt;
                                      &lt;b&gt;Author:&lt;/b&gt; &lt;a href='https://www.mollyrocket.com/forums/profile.php?mode=viewprofile&amp;u=2'&gt;casey&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;
                                      &lt;b&gt;Posted:&lt;/b&gt; Wed Dec 21, 2011 6:26 pm&lt;br /&gt;&lt;br /&gt;
                                      &lt;br /&gt;&lt;br /&gt;
                                      &lt;/span&gt;&lt;table width=&quot;90%&quot; cellspacing=&quot;1&quot; cellpadding=&quot;3&quot; border=&quot;0&quot; align=&quot;center&quot;&gt;&lt;tr&gt; 	  &lt;td&gt;&lt;span class=&quot;genmed&quot;&gt;&lt;b&gt;jai wrote:&lt;/b&gt;&lt;/span&gt;&lt;/td&gt;	&lt;/tr&gt;	&lt;tr&gt;	  &lt;td class=&quot;quote&quot;&gt;On a related fantasy/OCD note: Is there a way, mathematically, to construct a set of instructions on a CPU which takes a fixed/and known amount of time? Sort of like how they redid the meter standard by defining it by the speed of light. If you had a set of instructions for say x86 that hypothetically would take exactly X ms to execute, could you use it as some kind of reference to see how off the timer is, and therefore adjust it, or use it to sync somehow? Maybe that doesn't make sense.&lt;/td&gt;	&lt;/tr&gt;&lt;/table&gt;&lt;span class=&quot;postbody&quot;&gt;&lt;br /&gt;
Not on the CPU specifically, for the by-definition reason that the CPU executes via its own internal clocking, so anything executed on it can't be isolated from problems with said internal clocking.&lt;br /&gt;
&lt;br /&gt;
Hard-core people (RAD, for example &lt;img src=&quot;images/smiles/icon_smile.gif&quot; alt=&quot;Smile&quot; border=&quot;0&quot; /&gt;) already do use multiple system timers to try to detect errors, however.  Since the CPU is not the only clocked device in the system, it is possible to sample many clocks (audio, vblank, bus, etc.) and write some &quot;expert system&quot; logic which will try to guess about what sorts of timing bugs might be happening.&lt;br /&gt;
&lt;br /&gt;
It's totally ad hoc, though, obviously, since there's truly no way to ever know which clocks are right, except in obvious cases such as clocks going backwards (which does, in fact, happen, sadly).&lt;br /&gt;
&lt;br /&gt;
- Casey</description>
                                        <comments>https://www.mollyrocket.com/forums/viewtopic.php?p=7389#7389</comments>
                                        <author>casey</author>
                                        <pubDate>Wed Dec 21, 2011 6:26 pm</pubDate>
                                        <guid isPermaLink="true">https://www.mollyrocket.com/forums/viewtopic.php?p=7389#7389</guid>
                                      </item></channel></rss>
