RosettaCodeData/Task/Determine-if-two-triangles-overlap/00-TASK.txt
2023-08-01 14:31:52 -07:00

23 lines
1,004 B
Text

Determining if two triangles in the same plane overlap is an important topic in collision detection.
;Task:
Determine which of these pairs of triangles overlap in 2D:
:::*   (0,0),(5,0),(0,5)     and   (0,0),(5,0),(0,6)
:::*   (0,0),(0,5),(5,0)     and   (0,0),(0,5),(5,0)
:::*   (0,0),(5,0),(0,5)     and   (-10,0),(-5,0),(-1,6)
:::*   (0,0),(5,0),(2.5,5)   and   (0,4),(2.5,-1),(5,4)
:::*   (0,0),(1,1),(0,2)     and   (2,1),(3,0),(3,2)
:::*   (0,0),(1,1),(0,2)     and   (2,1),(3,-2),(3,4)
Optionally, see what the result is when only a single corner is in contact (there is no definitive correct answer):
:::*   (0,0),(1,0),(0,1)   and   (1,0),(2,0),(1,1)
<br><br>
;Related tasks
* [[Check_if_two_polygons_overlap|Check if two polygons overlap]]
* [[Check_if_a_polygon_overlaps_with_a_rectangle|Check if a polygon overlaps with a rectangle]]
<br><br>