26 lines
824 B
Plaintext
26 lines
824 B
Plaintext
Find if a point is within a triangle.
|
|
|
|
|
|
;Task:
|
|
|
|
::* Assume points are on a plane defined by (x, y) real number coordinates.
|
|
|
|
::* Given a point P(x, y) and a triangle formed by points A, B, and C, determine if P is within triangle ABC.
|
|
|
|
::* You may use any algorithm.
|
|
|
|
::* Bonus: explain why the algorithm you chose works.
|
|
|
|
|
|
;Related tasks:
|
|
* [[Determine_if_two_triangles_overlap]]
|
|
|
|
|
|
;Also see:
|
|
:* Discussion of several methods. [[http://totologic.blogspot.com/2014/01/accurate-point-in-triangle-test.html]]
|
|
:* Determine if a point is in a polygon [[https://en.wikipedia.org/wiki/Point_in_polygon]]
|
|
:* Triangle based coordinate systems [[https://en.wikipedia.org/wiki/Barycentric_coordinate_system]]
|
|
:* Wolfram entry [[https://mathworld.wolfram.com/TriangleInterior.html]]
|
|
<br><br>
|
|
|