How to determine if a point is inside a 2D convex polygon?

后端 未结 8 1853
别那么骄傲
别那么骄傲 2020-11-27 12:58

I have a convex polygon (typically just a rotated square), and I know all of 4 points. How do I determine if a given point (yellow/green) is inside the polygon?

8条回答
  •  忘掉有多难
    2020-11-27 13:45

    Check to see if it's on the same side of the 4 half-planes defined by the lines that contain the line segments that make up the sides of the quad.

    Here is a good explanation.

提交回复
热议问题