For a 2D graph, there are two points, A and B, and a set of rectangles (R0, .., Rk-1).
Starting conditions:
- A and B are not inside any rectangle.
- Edges of each rectangle are parallel to X-Y axes.
I have to develop an algorithm that constructs a stair-climbing (or step function) line.
The line has to satisfy these constraints:
- all parts of step line are parallel to X-Y axes
- the step line doesn't intersect any rectangle
- step line has minimal length
- step line has minimal amount of kinks (corners) among all step lines of minimal length
I've read some books on computational geometry, but did not find an algorithm to solve this problem.