0

I have a requirement to plot a few Nodes (Circles) and connect them with a link (Cubic Curve) based on some logic (somewhat like in the image link below)

I've a GridPane with circles drawn in 2 columns (doesn't matter for how many rows). The GridPane is then added to an AnchorPane. I've been able to do this part.

Now, I want to connect the circles present in the same row with a cubic curve. The curve should start and end on the circle boundaries (not center, as shown in the image below). However, I'm not able to get the curve start and end at the circle boundaries. I'm using Circle.getlayoutX, Circle.getlayoutY for generating the start and end points of the cubic curve. I guess this is where I'm wrong.

Please note that there is no requirement for dragging the nodes around on the pane, I only need to draw them. Thanks!

Please click on the image requirement

Ulkurz
  • 73
  • 1
  • 10
  • Related, but different: [CubicCurve JavaFX](http://stackoverflow.com/questions/13056795/cubiccurve-javafx) – jewelsea Apr 04 '17 at 21:42
  • It looks like the curves should start at `circle.getCenterX()+circle.getRadius(), circle.gerCenterY()`, and similarly end on the other side of the circle. – James_D Apr 04 '17 at 21:43
  • @James_D - yes, I just tried that. However the curves start somewhere outside the boundary of circles. Also, circle.getCenterX() gives me 0.0, which is not the actual translated co-ordinate I believe. – Ulkurz Apr 04 '17 at 21:44
  • @jewelsea - yes, I saw that example. However, I need to use the Circles to generate the start and end points of the cubic curve. – Ulkurz Apr 04 '17 at 21:48
  • You can't do it with just start and end points, you also need control points. – jewelsea Apr 04 '17 at 21:50
  • @jewelsea - Yes, I get that. I am able to use some control points . However, the start and end points don't generate from the Circle boundaries which is where the problem lies. – Ulkurz Apr 04 '17 at 21:53
  • You need to supply an [mcve](https://stackoverflow.com/help/mcve), to get assistance with something like this (minimal and complete, can be copy and pasted to compile, run and replicate). – jewelsea Apr 04 '17 at 21:54
  • Also, if the circles are opaque, you can just generate the start and end points from their centers and place the path behind the circles, and it will appear that the path is originating from the boundaries, even though its not. – jewelsea Apr 04 '17 at 21:55

0 Answers0