Lars Clausen wrote:
>
>
>>It would be possible to place numerous anchors on the outside of the
>>components so that they could be connected with arrows. The problem
>>with this is that if the shape is moved around, the arrows might end
>>up going through the center of the component. This problem could be
>>solved in the following general way that could be useful for other
>>diagrams: The components would have a single anchor in the middle, and
>>all bonds (arrows/lines) would point to that single anchor. Arrows
>>could have a 'gap' parameter so that arrows with this parameter
>>non-null would not connect their end points completely, but either
>>leave a gap between the arrow tip and the anchor (if the gap were
>>positive), or extend past the anchor (if the gap were negative). This
>>way, all bonds would point to the center of components, and moving
>>components would still work correctly.
>>
>>
>
>This came up in another context recently, and now we have a compelling
>argument why it's not just a creation thing. We already have some code
>that adjusts the line length and arrow placement to account for the extent
>of the arrow. It would be possible to add such a gap there.
>
>Just one problem I see with the gap: How do we calculate how big it
should
>be? Objects don't currently have any method that asks for intersection
>points. The closest they get is the method asking for distance from a
>point -- I guess in a pinch that could be used for a binary search. Not
>pretty, but workable.
>
>
>
The arrows on a bond graph are not supposed to touch the object. The
simplest implementation would be for a user-specified gap to indicate
simply the distance between the end of the arrow and the anchor.
Problems would occur if the object pointed to is not 'circular' in
shape. I think the best implementation would be the following:
User has two attributes to specify. First, the user specifies the gap
which defaults to 0.
Second, the user specifies with a checkbox if
(a) the given gap is to be measured between the arrow tip and
the anchor point, or
(b) the given gap is to be measured between the arrow tip and
the intersection with the object pointed to (via Lars' binary search,
for ex.).
This way, a gap of zero with (b) can be used for most situations where,
for instance, a bunch of arrows or lines converge to a box/circle/etc.,
and a positive gap can be used for bond graphs. Somebody might need a
negative gap so that a line/arrow would pierce the center of an object
and go through. It seems important that a user be able to specify
whether (a) or (b) be used because a user might wish to have
lines/arrows which go through the sides of an object, almost reaching
the center, but leaving a certain gap nevertheless.
I am glad to see that this proposal has shown some interest. I'm going
to take a look at the code and see if I am able to understand anything.
I am a programmer with little experience hacking on other peoples'
programs.
Dave.