import javafx.application.Application;
import javafx.scene.Scene;
import javafx.scene.layout.Pane;
import javafx.scene.paint.Color;
import javafx.scene.shape.Circle;
import javafx.scene.shape.Rectangle;
import javafx.stage.Stage;

public class Test extends Application {

@Override
    public void start(Stage primaryStage) {

        Rectangle clipedRectangle = new Rectangle(100, 100);
        clipedRectangle.setFill(Color.BLUE);
        
        Circle circle = new Circle(50);
        
        // set circle to share the same bounding box and position than clipedRectangle
        circle.setCenterX(50);
        circle.setCenterY(50);
        
        clipedRectangle.setClip(circle);
        
        Pane root = new Pane();
        root.getChildren().add(clipedRectangle);
        
        clipedRectangle.setLayoutX(100);
        clipedRectangle.setLayoutY(100);
        
        primaryStage.setScene(new Scene(root, 200, 200));
        primaryStage.show();
        
        System.out.println(String.format("Expected circle local bounds %s to have the same local bounds than clipedRectangle %s OK",
         circle.getBoundsInLocal(),
         clipedRectangle.getBoundsInLocal()
         ));
        System.out.println(String.format("Expected circle layout bounds %s to have the same layout bounds than clipedRectangle %s OK",
         circle.getLayoutBounds(),
         clipedRectangle.getLayoutBounds()
         ));
        System.out.println(String.format("Expected circle parent bounds %s to have different parent bounds than clipedRectangle %s OK",
         circle.getBoundsInParent(),
         clipedRectangle.getBoundsInParent()
         ));
        
        
        System.out.println(String.format("Expected circle topLeft corner %s to have the same 'scene relative' position than clipedRectangle topLeft corner %s KO",
         circle.localToScene(0, 0, true),
         clipedRectangle.localToScene(0, 0, true)
         ));
        
        System.out.println(String.format("Expected scene position 100,100 to match toLeft corner of clipedRectangle %s OK",
         clipedRectangle.sceneToLocal(100, 100, true)
         ));
        
        System.out.println(String.format("Expected scene position 100,100 to match toLeft corner of circle %s KO expected 0,0",
         circle.sceneToLocal(100, 100, true)
         ));
        
    }

public static void main(String[] args) {
launch(args);
}

}
