java - how to get the coordinates of a transformed shape in javafx2? -
i have 2 ellipses on pane, 1 has rotation transformation applied (the rotation point not being ellipse :)), other doesn't. need draw line center of transformed ellipse center of untransformed ellipse. need coordinates of transformed ellipse, there way retrieve those? (i need them other calculations besides line drawing too)
use localtoparent
method. example:
@override public void start(stage stage) { stage.settitle(versioninfo.getruntimeversion()); group root = new group(); // ellypsis center in 100,100 arc ellypsis = arcbuilder.create().centerx(100).centery(100).length(360).radiusx(100).radiusy(50).fill(color.transparent).stroke(color.red).build(); // rotate ellypsis.gettransforms().add(new rotate(50, 50, 45)); // find out 100,100 in rotated ellypsis point2d localtoparent = ellypsis.localtoparent(100,100); // draw line point line line = new line(localtoparent.getx(), localtoparent.gety(), 200, 200); root.getchildren().addall(ellypsis, line); stage.setscene(new scene(root, 300, 250)); stage.show(); }
Comments
Post a Comment