It's problem from the book:
"Computational Geometry: Algorithms and Applications", Springer-Verlag.
Given two simple and disjoint polygons P and Q, where P lies strictly to the left of Q, computes the first points on the polygons that will collide if P is translated horizontally and in the positive x-direction, or determines that they do not collide.
I have a quadratic solution, but it should be O((n+m) log(n+m))
Probably not the answer you are looking for, but the simple, quick and easy to develop solution would be to draw the polygons, fill them and do bitwise masking AND function to determine the bits that overlap on a bitmap.
Looping with increments of 1 bit on the x-scale and performing the AND masking test each iteration gives you the perfect contact point in exact pixels.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.