|
|
When finding intersection of segments (a, b) and (c, d) I am finding t1, t2, such that a + (b - a) * t1 = c + (d - a) * t2, -eps <= t1 <= 1+eps, -eps <= t2 <= 1+eps. This code doesn't work for eps=1e-12, but works for eps=0. THIS IS MINDBLOWING Give me some tests, please... nothing... thats OK.. AC now Edited by author 26.06.2008 19:00 You had WA24 As I now! What changing in your program had effect? Yes! I gone throught test 24. The problem was how use eps=0.00000000001!? Before I used it in many places of program. After I am use eps only in one moment: I make rectangles wider by eps. In other places I accept eps=0. But finally in verification S>=0.5+20*eps I used 20*eps as possible error for wrong 20 intersections after eps- widering. Edited by author 27.01.2009 19:29 What is the most simple way to find an area of two squares' intersection? Find it as intersection of two arbitrary convex polygons, otherwise you'll bury yourself in special cases. To do so get all points of one polygon inside the other, all points of the other polygon inside the first one, and also all their intersections by non-parallel sides. Then find area of their convex hull. Angle/distance sorting step is enough to find that hull. Сразу прошу извинения за то, что пишу на русском... У меня вопрос: как может заполнена клетка, где большая буква? ........ ........ ...aa... ..aA.x.. ..a..x.. ...bb... ........ ........ ведь все те клетки, что с ней пересекаются, симметрические относительно нее. Заранее спасибо за помощь! What do you mean by "symmetric"? It's 45-degrees turn. How to solve it? just do what they ask you. Rotate the field and find intersection of new sqare with old squares. |
|
|