Point inside the rectangle - On which side of the diagonal is it?

So, I have a rectangle divided into two triangles, and I have a point:

Rectangle

I know the coordinates of the four vertices of the rectangle (A, B, C and D), and I know the coordinates of P. I need to know which of the two triangles has a point.

I think this is a very simple thing, but apparently I cannot figure it out myself.

Any help?

+4
source share
2 answers

There are several ways to solve this problem. But the simplest and most direct is to check the slope.

, AP AD, P AD . , .

Edit:

,

A -> (0,3)
B -> (3,3)
C -> (0,0)
D -> (3,0)

AD (3-0)/(3-0) = 1. , P (2,2), AP (2-3)/(2-0) = -1/2.

AD > AP, P AD. , P AD, , , , .

+3

All Articles