Algorithm for Point and Line in Polygon Test
Caiquan Xiong
Abstract
Caiquan Xiong
Abstract
A convenience algorithm for point and line in polygon test,sloping line method is provided,the characteristic of this method is that the sloping line is not match together with any peak or edge of polygon,no special situation is needed processing,the computation is decreased.The prepared algorithm of line in polygon is not perfect,a new algorithm is presented.First,identify whether there are crossing points in line and polygon by a quick method,if there are crossing points,calculate the crossing points of line and polygon,put these points in order,and then make the line into several segments by these crossing points.If there is not crossing point,the line is only one segment.Test the center of every segment in polygon.If its center is in the polygon,then this segment is in the polygon,else,it is not.This algorithm is simple and effective in programming,and it is suitable for most case.
A significance statement is not available in the OpenAlex record.
A contribution statement is not available in the OpenAlex record.
Method details are not available in the OpenAlex metadata.
Findings are not separately available in the OpenAlex metadata.
Limitations are not available in the OpenAlex metadata.
Application details are not available in the OpenAlex metadata.
A convenience algorithm for point and line in polygon test,sloping line method is provided,the characteristic of this method is that the sloping line is not match together with any peak or edge of polygon,no special situation is needed processing,the computation is decreased.The prepared algorithm of line in polygon is not perfect,a new algorithm is presented.First,identify whether there are crossing points in line and polygon by a quick method,if there are crossing points,calculate the crossing points of line and polygon,put these points in order,and then make the line into several segments by these crossing points.If there is not crossing point,the line is only one segment.Test the center of every segment in polygon.If its center is in the polygon,then this segment is in the polygon,else,it is not.This algorithm is simple and effective in programming,and it is suitable for most case.
Key concepts: Polygon (computer graphics), Visibility polygon, Simple polygon, Polygon covering, Rectilinear polygon, Star-shaped polygon, Computer science, Line (geometry)