判断点在直线的哪一边
Determine which side of a line a point is
http://www.gamedev.net/topic/542870-determine-which-side-of-a-line-a-point-is/
Assuming the points are (Ax,Ay) (Bx,By) and (Cx,Cy), you need to compute:
(Bx - Ax) * (Cy - Ay) - (By - Ay) * (Cx - Ax)
This will equal zero if the point C is on the line formed by points A and B, and will have a different sign depending on the side.
Which side this is depends on the orientation of your (x,y) coordinates,
but you can plug test values for A,B and C into this formula to determine whether negative values are to the left or to the right.
Points, lines, and planes
http://paulbourke.net/geometry/pointlineplane/

浙公网安备 33010602011771号