arif_pasha wrote: I pass all the input except this one.
Can you explain this input?
Can you give me more test input/output?
thx
0 0 10 0 LS
2 2 8 8 LS0.00000
10709 - Intersection is Not that Easy
Moderator: Board moderators
-
- New poster
- Posts: 42
- Joined: Fri Jun 13, 2003 3:47 pm
- Location: Dhaka , Bangladesh
- Contact:
10709 definition
What it the correct definition for distance between two non-intersecting line segments? Is it the length of shortest perpendicular dropped from segment endpoint to another segment?
Finally got AC.
There are some problems that I have confronted:
1. Segment-intersection
I made mistake checking two co-linear segments.
2. Distance from a point to a line
At first I use the formula " |ax+by+c| / sqrt(a^2+b^2) " to calculate the distance, but this may cause precision error when calculating a, b, and c.
I tried to use "vector cross operation", and it works correctly.
3. Distance from a point to a segment
I used "vector dot operation" to determine if perpendicular distance is proper.
If not, the proper distance is just distance between the point and one endpoint of the segment.
Hope it helps someone getting WA.
--
DJWS, a newbie in programming

There are some problems that I have confronted:
1. Segment-intersection
I made mistake checking two co-linear segments.
2. Distance from a point to a line
At first I use the formula " |ax+by+c| / sqrt(a^2+b^2) " to calculate the distance, but this may cause precision error when calculating a, b, and c.
I tried to use "vector cross operation", and it works correctly.

3. Distance from a point to a segment
I used "vector dot operation" to determine if perpendicular distance is proper.
If not, the proper distance is just distance between the point and one endpoint of the segment.
Hope it helps someone getting WA.

--
DJWS, a newbie in programming

10709(Intersection is not that Easy) Wrong answer
I am getting wrong answer again and again.
Please Give me some critical Input.
Please Give me some critical Input.
Mr. Arithmetic logic Unit