title: JavaFX - Get Coordinates of Node Relative to its Parent
body: <p>I am making a simple graphical interface for saving previously generated images. All images come to me square but I want to allow for some cropping functionality (more precisely cutting off equal parts from the bottom and top of the image). I want to do this by allowing the user to drag a shaded region over the image which will tell the user that this region will be cropped out. See the below image for details. To enable this drag functionality I have added small triangles that I want the user to drag which in turn will move the shaded regions about. However the coordinates for the triangles are all weird and seem nonsensical. Therefor I was wondering what the best way is to get the coordinates of the triangles in relation to the ImageView (or their first common parent node) in terms of ImageView-side-lengths. So if the triangle is in the center its coordinates are [0.5, 0.5] for instance. </p>
  
  <p><a href="https://i.stack.imgur.com/lLEOQ.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/lLEOQ.png" alt="enter image description here"></a></p>
  
  <p>The Image view will be moving around inside the scene and will also be changing size so it is vital that I can get the coordinates relative to not only the ImageView but also to the size of the ImageView.</p>
  
  <p>Here is also the surrounding hierarchy of nodes if that helps. The Polygons are the triangles and the regions are the rectangles.</p>
  
  <p><a href="https://i.stack.imgur.com/Szs66.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/Szs66.png" alt="enter image description here"></a></p>
  
  <p>Thanks for all forms of help!</p>