Package com.sun.javafx.geom

Examples of com.sun.javafx.geom.Point2D


   * Gets the center of the specified rectangle.
   * @param rect
   * @return
   */
  public static Point2D center(Rectangle2D rect) {
    Point2D c = new Point2D(
        (float) (rect.getMinX() + rect.getWidth() / 2),
        (float) (rect.getMinY() + rect.getHeight() / 2));
   
    return c;
  }
View Full Code Here


   * @param rect1
   * @param rect2
   * @return
   */
  public static Rectangle2D center(Rectangle2D rect1, Rectangle2D rect2) {
    Point2D c2 = GeoFx.center(rect2);
    return GeoFx.center(rect1, c2);
  }
View Full Code Here

public class GeoFxTest {
  @Test
  public void centerRectangle2D() {
    Rectangle2D r1 = new Rectangle2D(0, 0, 5, 10);
    Rectangle2D r2 = GeoFx.center(r1, new Point2D(10, 10));
   
    Assert.assertEquals(new Rectangle2D(7.5, 5, 5, 10), r2);
  }
View Full Code Here

 
  @Test
  public void centerPoint2D() {
    Rectangle2D r1 = new Rectangle2D(0, 0, 5, 10);
   
    Assert.assertEquals(new Point2D(2.5f, 5f), GeoFx.center(r1));
  }
View Full Code Here

TOP

Related Classes of com.sun.javafx.geom.Point2D

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.