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

后端 未结 8 1834
别那么骄傲
别那么骄傲 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:32

    The java.awt.Polygon class has a number of contains(...) methods if you use Polygon objects to represent your polygon.

提交回复
热议问题