Skip to content

Commit

Permalink
Create Compute_Triangle_Area
Browse files Browse the repository at this point in the history
  • Loading branch information
jsjtzyy authored May 5, 2021
1 parent 2365194 commit cd1c1bf
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions Compute_Triangle_Area
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
Given 3 points A(x1, y1), B(x2, y2), C(x3, y3)
|x1, y1, 1|
S(ABC) = 0.5 * abs(|x2, y2, 1|) = 0.5 * abs(x1*y2 + x3*y1 + x2*y3 - x3*y2 - x1*y3 - x2*y1)
|x3, y3, 1|

How to determine if a point P is within triangle ?

S(PAB) > 0 && S(PAC) > 0 && S(PBC) > 0 && S(PAB) + S(PAC) + S(PBC) == S(ABC)

0 comments on commit cd1c1bf

Please sign in to comment.