An Improved Algorithm for Inside-outside Testing

He Xiu · Journal of Xi'an Petroleum Institute · 2002

Based on the analysis of traditional algorithm of odd ever rule for inside outside testing, an improved algorithm is proposed. In the improved algorithm, the polar radial from the point to be tested is parallel to x axis and its direction is the same as the positive direction of x axis. All the possible crossing states of the polar radial and a side of the regular polygonal domain are enumerated, and they are classified. The crossing points of different type are processed in different method. According to the position relationship between the radial and the side, in a few states their crossing point must be computed to decide whether they cross or not. In most states, it can be determined that they cross or not only by simple comparison. If the radial is through the crossing point of two neighbor sides, only one testing is needed by the rules. Therefore, the times of computing crossing points is reduced, and the total time of testing is saved. An example shows that, when the points to be test are 10 000, the time which to test them takes by the improved algorithm is 23.5% of that by the traditional one, and when the points are 30 000, the former is only 15.4% of the latter.

Cited by 0 works.

Authors