B***y 发帖数: 83 | 1
Let's say we have a triangular ABC, with
A = (a1,a2), B= (b1,b2), C= (c1,c2),
also we have a point D = (d1,d2).
then the simplest way to detect whether D lies in the interior of ABC is:
calculate the determinent of the matrix:
( 1 1 1 ) (1 1 1) (1 1 1)
a1 b1 d1 b1 c1 d1 c1 a1 d1
a2 b2 d2 b2 c2 d2 c2 a2 d2 ,
if all three determinents are of the same sigh, all positive or all negative.
then D is in the interior of ABC.
Otherwise it is not. |
|