From 28d0d84638ba1ba45696f3fa86cb18e694f280a5 Mon Sep 17 00:00:00 2001 From: Matthew Kosarek Date: Thu, 24 Jun 2021 15:57:05 -0400 Subject: Prettifying images --- 2d/_collisions/polygon_polygon.html | 5 +++++ 1 file changed, 5 insertions(+) (limited to '2d/_collisions/polygon_polygon.html') diff --git a/2d/_collisions/polygon_polygon.html b/2d/_collisions/polygon_polygon.html index c1c3a2e..5d360af 100644 --- a/2d/_collisions/polygon_polygon.html +++ b/2d/_collisions/polygon_polygon.html @@ -83,6 +83,7 @@ Images two shapes A and B as shown below (they are triangles here, but they can be anything really).
+
@@ -91,6 +92,7 @@
We know inutitively that if we were able to draw a line between the two objects, that means that they're not intersecting. In this case, that line is a vertical-ish line:
+
@@ -104,6 +106,7 @@ To do separating axis theorem, we iterate all of the edges of both shapes. For each edge, we get the normal at that edge (In two-dimensions, this amounts to getting the perpendicular of the line segment defined by the two points of the edge).
+
@@ -121,6 +124,7 @@ At this point, you will see that I named the three vertices on each of the triangles. Triangle A is made of vertices a1, a2, a3 and triangle B is made of vertices b1, b2, b3. At this point, we project the shape onto the axis. To do this, we project the vertices of each shape onto the axis to figure out which one maximizes the dot product and which one minimizes the dot product. The projection of the shape is then the range defined by this min and max value. +

@@ -131,6 +135,7 @@ Finally, we check if the two ranges overlap. If they don't overlap, then the shapes do not intersect. If they do overlap, we repeat the process for all of the other edges. If all of these ranges overlap, then the shape overlaps, and there is no separating line between them. +

-- cgit v1.2.1