Need methods for link layout

When I add a segment on a link, I want to make it avoid other objects in the same document.
I am thinking I may need the following to methods:

First one : To determine whether a segment given by two points is across any other objects in the same document.

Second one: To calculate a series points which form a part of a link avoiding any other objects in the same document given a start point and an end point.

The reason that I cannot use the default CalculateStroke method with AdjustingStyle to be Calculate is because this method recalculates the whole link and all previous points are lost.

I know there are some algorithms for this kind of task, but it would be better that GoWin has some help methods I can use.

By the way, here is another question:
How to make sure that points on a link are snapped to the grid in the view? Points from the built-in CalculateStroke method are not.

If you are trying to avoid intersecting nodes, use GoDocument.IsUnoccupied. This uses the same information that Orthogonal and AvoidsNodes links use for routing.
I assume your search can start from a known position and then try going in some direction(s) incrementally until the IsUnoccupied predicate returns true.

Here is my wordaround.

I make a temporary link connecting the two points (each represented by a one pixel port). After this link is added into the document, CalculateStroke is called. And then I added some of the points in this temporary link into the real link. And finally this temporary is removed from the document.

Of course, I need to set appropriate properties for the link and ports to make the temporary link exactly start from and end on the two points and also make it avoid nodes in the document.