Arrowheads for link lines?

15 afișări
Accesați primul mesaj necitit

jles...@gmx.de

necitită,
17 apr. 2014, 05:35:4917.04.2014
– piccolo...@googlegroups.com
Hello everybody
I am planning to build something like a graph editor supporting directed links between square-shaped nodes. I started with the nice little GraphEditorExample from the Piccolo distribution, but know I'd like to introduce arrorheads for the link lines. The heads should be placed at the point where the line crosses a node border (see attached figure). From my first design steps, it seems to become a pretty complecated mathematical challenge to calculate the coordinates of these points. Is there any kind of support for these kinds of calculations?

Regards,
Jan

arrowhead.png

Martin Klussmann

necitită,
18 apr. 2014, 01:54:2018.04.2014
– piccolo...@googlegroups.com
Hi Jan.

> Is there any kind of support for these kinds of calculations?

As far as I know, in Piccolo2D there is not.

If you are restricted to square-shaped nodes, you should accept the
mathematical challenge (think of atan2). For arbitrary shapes the
intersection can become a tough task. For example, see:
http://stackoverflow.com/questions/15545496/get-intersection-points-of-line-and-shape

Martin

jles...@gmx.de

necitită,
18 apr. 2014, 13:38:1418.04.2014
– piccolo...@googlegroups.com
Hi Martin
Thanks for your answer. Yes, I only have to care for sqares. Funny that AWT's Rectangle2D.Double class, which PBounds derives from, has functions to find out, *if* a line intersects with a rectangle, but not *where* they intersect ;-)

Anyway. I copied some code from the net which does the job.

Regards,
Jan
Răspundeți tuturor
Răspundeți autorului
Redirecționați
0 mesaje noi