public static bool Point2dWithPolygon2d(Vector2L pos, Polygon2d polygon2d) { var edgePoint = (polygon2d.m_pointList[1] + polygon2d.m_pointList[0]) * 0.5f; Vector2L outPoint = (edgePoint - pos).normalized * 10000; int count = 0; List <Vector2L> pointList = polygon2d.GetWorldPosList(); for (int i = 0; i < pointList.Count; i++) { var a = pointList[i % pointList.Count]; var b = pointList[(i + 1) % pointList.Count]; var r = IsTwoSegmentIntersection(a, b, pos, outPoint); if (r) { count += 1; } } return(count % 2 == 1); }