|
|
back to boardShow all messages Hide all messages Edited by author 15.10.2006 11:24 Check each region by x and y, e.g. if (b+c<=y && y<=b+c+b && c <= x && x<=c+a) // bottom region I had some mistakes like If y>=a+b+c ... but must be If y>=b+b+c I have one check per one side. For example If y<=b - the point is on the lowest side (on the picture). If x<=c - the point is on the leftest side. etc. So, it is enough to check, you see, but WA#7. Thanks for help but still need it. ) You need check y > b+b+c and y < b+c.. because when point on the edge .... You can do mistake ... (I was wrong in this) I have AC, so thank U very much! But I still don't understand my mistake. It is guaranted that the point is in the picture, so I can only check one coordinate... Cann't understand... be careful when you do checks like if (x <= a) then ... it can produce WA, becouse if x = a, point can lie on another side Yes, that is true. Thank you. The test that makes the difference is: ------- 2 2 2 0 4 4 0 ------- before this correction the answer was 4.8989794856 (wrong!) but the right answer is 2.8284271247 (verifyed with AC program). This is great test. Thank you! TY, Paul Diac! Edited by author 30.10.2017 01:21 no mes SuperLight 26 Jun 2009 19:31 If you use real numbers, you can get situation, when point lies on none of 6 sides. So you should work with epsilon. Or you can use exact arithmetic, just multiply numbers by 100! It means 100 and !, not 100! :) Edited by author 26.06.2009 17:41 |
|
|