Abstract
A method for accurately determining whether two given line segments intersect is presented. This method uses the standard floating-point arithmetic that conforms to IEEE 754 standard. If three or four ending points of the two given line segments are on a same vertical or horizontal line, the intersection testing result is obtained directly. Otherwise, the ending points and their connections are mapped onto a 3×3 grid, and the intersection testing falls into one of the five testing classes. The intersection testing method is based on our method for floating-point dot product summation, whose error bound is 1ulp. Our method does not have the limitation in the method of Gavrilova and Rokne (2000) that the product of two floating-point numbers is calculated by a twice higher precision floating-point arithmetic than that of the multipliers. Furthermore, this method requires less than one-fifth of the running time used by the method of Gavrilova and Rokne (2000), and our new method for calculating the sign of a sum of n floating-point numbers requires less than one-fifteenth of the running time used by ESSA.
Similar content being viewed by others
References
I. J. Anderson (1999) ArticleTitleA distillation algorithm for floating-point summation SIAM J. Sci. Comput. 20 IssueID5 1797–1806 Occurrence Handle10.1137/S1064827596314200
ANSI/IEEE (New York): IEEE Standard for Binary Floating-Point Arithmetic, Standard 754–1985, 1985.
J. Demmel Y. Hida (2003) ArticleTitleAccurate and efficient floating point summation SIAM J. Sci. Comput. 25 IssueID4 1214–1248 Occurrence Handle10.1137/S1064827502407627
Fortune, S., Wyk, C.: Efficient exact arithmetic for computational geometry. In: Proc. 9th Annual ACM Symp. on Computational Geometry, pp. 163–172 (1993).
S. Fortune C. Wyk (1996) ArticleTitleStatic analysis yields efficient exact integer arithmetic for computational geometry ACM Trans. Graph 15 IssueID3 223–248 Occurrence Handle10.1145/231731.231735
M. Gavrilova J. G. Rokne (2000) ArticleTitleReliable line segment intersection testing Comput. Aided Des. 32 737–745 Occurrence Handle10.1016/S0010-4485(00)00050-6
N. J. Higham (1993) ArticleTitleThe accuracy of floating point summation SIAM J. Sci. Comput. 14 IssueID4 783–799 Occurrence Handle10.1137/0914050
Higham, N. J.: Accuracy and stability of numerical algorithms, 2nd ed. Philadelphia: SIAM 2002.
W. Kahan (1965) ArticleTitleFurther remarks on reducing truncation error Commun. ACM 8 IssueID1 40 Occurrence Handle10.1145/363707.363723
Knuth, D. E.: The art of computer programming, 3rd ed., vol 2: Seminumerical algorithms. Addison-Wesley 1998.
P. Linz (1970) ArticleTitleAccurate floating-point summation Commun. ACM 13 IssueID6 361–362 Occurrence Handle10.1145/362384.362498
G. Masotti (1993) ArticleTitleFloating-point numbers with error estimates Comput. Aided Des. 25 IssueID9 524–538 Occurrence Handle10.1016/0010-4485(93)90069-Z
Milenkovic, V.: Double precision geometry: a general technique for calculating line and segment intersections using rounded arithmetic. In: Proc. 30th Annual Symp. on the Foundations of Computer Science, pp. 500–506 (1989).
Moore, R. E.: Interval analysis. Englewood Cliffs, NJ: Prentice-Hall 1966.
D. M. Priest (1991) Algorithms for arbitrary precision floating point arithmetic P. Kornerup D. W. Matula (Eds) Proc. 10th IEEE Symp. on computer arithmetic IEEE Computer Society Press Los Alamitos, CA 132–143
Priest, D. M.: On properties of floating point arithmetics: numerical stability and the cost of accurate computations. PhD thesis, Mathematics Department, University of California, Berkeley, CA, 1992.
Ramshaw, L.: CSL notebook entry: The braiding of floating point lines. Unpublished note. Xerox PARC, October 1982.
H. Ratschek J. Rokne (1999) ArticleTitleExact computation of the sign of a finite sum Appl. Math. Comput. 99 99–127 Occurrence Handle10.1016/S0096-3003(98)00010-1
H. Ratschek J. Rokne (2000) ArticleTitleExact and optimal convex hulls in 2D Int. J. Comput. Geom. Appl. 10 109–129
H. Ratschek J. Rokne (2000) ArticleTitleHow trivial are reliable box-plane intersections Comput. Aided Des. 32 643–648 Occurrence Handle10.1016/S0010-4485(00)00052-X
H. Ratschek J. Rokne (2003) Geometric computations with interval and new robust methods: with applications in computer graphics, Gis and computational geometry Horwood Publishing Chichester
H. Ratschek J. Rokne M. Leriger (2001) ArticleTitleRobustness in GIS algorithm implementation with application to line simplification Int. J. Geogr. Inf. Sci. 15 707–720 Occurrence Handle10.1080/13658810110053107
Zhu, Y.-K.: Yong, J.-H., Zheng, G.-Q.: A new distillation algorithm for floating-point summation. SIAM J. Sci. Comput. (2005) (accepted).
Author information
Authors and Affiliations
Corresponding author
Rights and permissions
About this article
Cite this article
Zhu, YK., Yong, JH. & Zheng, GQ. Line Segment Intersection Testing. Computing 75, 337–357 (2005). https://doi.org/10.1007/s00607-005-0120-8
Received:
Revised:
Published:
Issue Date:
DOI: https://doi.org/10.1007/s00607-005-0120-8