I need to calculate the area of the overlap area between two triangles in a 2D plane. Oddly enough, I wrote code for the triangle-circle problem and that works pretty well and reliably, but I have problems with the triangle-triangle problem.
I already first check whether it completely contains the other, or the other contains the first, and also get all the intersection points along the edges. These intersection points (up to 6, like the star of David), in combination with the triangular vertices that are contained in another triangle, are the vertices of the intersection region. These points should form a convex polygon.
The solution I'm looking for is the answer to any of these questions:
I looked at question 1 by simply collecting all the areas of all possible triangles, and then dividing by the multiplicity in the count, but that seems dumb, and I'm not sure if this is correct. I feel like there is some sort of sweep algorithm that would do the trick. However, the solution should also be relatively numerically reliable.
, 2, , . , .
. , . , , , , . , , .
1: ? , , . - , (, , ). , , , .
-
2 . , a*x+b*y+c=0; (x, y), a*x+b*y+c <= 0 (, ) "" . , ( , ). , .
a*x+b*y+c=0
a*x+b*y+c <= 0
. . ( ), ; (). , "" , , ; , .
. , , ; , , , . ( !)
, . , , , " ", .
, , , .
/, , , , .
Source: https://habr.com/ru/post/1750776/More articles:Why should I use 1 table instead of two? - sqlCreating an online store - e-commerceHTML: Make Title and Tab Different - htmlКак получить сопоставленное значение регулярного выражения с помощью Boost.Regex? - c++Как разбирать строку в jQuery - javascriptPreventing cars in a 4-channel connection from an accident in java - javaКак получить структуру модуля с помощью ToolsAPI в Delphi? - delphiGames for iPhone - c ++How to apply style for WPF DATAGRID Scroll Bars - wpfdatagridVilla Perl CGI Cloning Request Headers for LWP UserAgent - perlAll Articles