Java examples for JavaFX:Rectangle
constrained Union JavaFX Point2D and return Rectangle
//package com.java2s; import javafx.geometry.Point2D; import javafx.scene.shape.Rectangle; public class Main { static public Rectangle constrainedUnion(Point2D a, Point2D b, double aspectRatio) { double x = Math.min(a.getX(), b.getX()); double y = Math.min(a.getY(), b.getY()); double width = Math.abs(a.getX() - b.getX()); double height = width / aspectRatio; return new Rectangle(x, y, width, height); }//from www . j a v a 2 s . c om }