A New Algorithm for Determining Whether a Point is Inside of a Polygon
暂无分享,去创建一个
It is a basic problem to determine whether a point is inside of a polygon in many fields.Based on analyzing many traditional methods to solve this problem,a new algorithm is proposed,which improves the ray intersecting method by constructing the ray properly.The two special cases,one of which is that the ray coincides with one of the sides of the polygon,and another is the ray passes one or more of the vertices of the polygon,have been avoided in the new algorithm so that the judging time can be greatly reduced.The algorithm takes not more than 4n subtractions,3n multiplications,and 6n comparisons,where n is the number of the vertices of the polygon.The algorithm is easy to program and the computing quantity is small.