In computing geometry there is a problem of definition of accessory of a point to a polygon. On the plane it is set points and a polygon and it is required to prove or disprove that the first belongs to the second. The most various geometrical methods and algorithms are for this purpose used.
1. Use method of trace of a beam taking into account number of crossings. In this case from the set point in any direction the beam then it is counted how many times it will cross polygon edges is issued. The cyclic algorithm which checks each edge of a figure for crossing is for this purpose used. If the number of crossings is even, the point lies outside of a polygon if odd - inside.
2. Solve a problem about accessories by method of trace of a beam taking into account the speed which are done by the focused polygon border concerning the set point. In this case from a point the beam in any direction is also issued and edges with which it was crossed are considered. If the beam crosses an edge clockwise (from left to right), number "+1" is appropriated to it if counterclockwise (from right to left) – that number "-1". After that there is a sum of the received sizes. If it is equal to zero, then the point is outside of a polygon and if it is more or less than zero – that inside.
3. Define accessory by use of a method of summation of corners. The set point connects beams to all tops of a polygon then the sum of corners between each beam in radians and decides on the sign. If the sum is equal to zero, then the point lies outside of a polygon, otherwise – inside. This algorithm is considered the most difficult as demands rather large volume of calculations with application of the inverse trigonometrical functions therefore it is not used in computer models.
4. Calculate the areas of the triangles formed at connection of the set point with polygon corners. If the sum received sizes is equal to the area of an initial polygon, then the point is in it, otherwise – outside.