Class GeometryUtil

java.lang.Object
javafx.geometry.GeometryUtil

public final class GeometryUtil extends Object
Author:
Bruno Salmon
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    static double
    angle(double x, double y)
    Computes the angle (in degrees) between the vector and the X axis
    static double
    angle(double pivotX, double pivotY, double x, double y)
    Computes the angle (in degrees) between the vector and the X axis
    static double
    angleRadian(double x, double y)
    Computes the angle (in radian) between the vector and the X axis
    static double
    distance(double x, double y)
    Computes the length of the vector represented by invalid input: '{@code (x, y). @param x the X magnitude of the vector @param y the Y magnitude of the vector @return the length of the vector.'
    static double
    distance(double x1, double y1, double x2, double y2)
    Computes the distance between point 1 and point 2.
    static double
    distance(Point2D point1, double x2, double y2)
    Computes the distance between point 1 and point 2.
    static double
    distance(Point2D point1, Point2D point2)
    Computes the distance between point 1 and point 2.
    static Point2D
    pivot(double pivotX, double pivotY, double angleDeg, double distance)
     
    static Point2D
    pivotRadian(double pivotX, double pivotY, double angleRad, double distance)
     
    static Point2D
    rotate(double pivotX, double pivotY, double x, double y, double angleDeg)
     

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • GeometryUtil

      public GeometryUtil()
  • Method Details

    • distance

      public static double distance(double x, double y)
      Computes the length of the vector represented by invalid input: '{@code (x, y). @param x the X magnitude of the vector @param y the Y magnitude of the vector @return the length of the vector.'
    • distance

      public static double distance(double x1, double y1, double x2, double y2)
      Computes the distance between point 1 and point 2.
      Parameters:
      x1 - the x coordinate of point 1
      y1 - the y coordinate of point 1
      x2 - the x coordinate of point 2
      y2 - the y coordinate of point 2
      Returns:
      the distance between point 1 and point 2.
    • distance

      public static double distance(Point2D point1, double x2, double y2)
      Computes the distance between point 1 and point 2.
      Parameters:
      point1 - x and y coordinate of point 1
      x2 - the x coordinate of point 2
      y2 - the y coordinate of point 2
      Returns:
      the distance between point 1 and point 2.
    • distance

      public static double distance(Point2D point1, Point2D point2)
      Computes the distance between point 1 and point 2.
      Parameters:
      point1 - x and y coordinate of point 1
      point2 - x and y coordinate of point 2
      Returns:
      the distance between point 1 and point 2.
    • angleRadian

      public static double angleRadian(double x, double y)
      Computes the angle (in radian) between the vector and the X axis
      Parameters:
      x - the X magnitude of the vector
      y - the Y magnitude of the vector
      Returns:
      the angle (in radian) between the vector and the X axis
    • angle

      public static double angle(double x, double y)
      Computes the angle (in degrees) between the vector and the X axis
      Parameters:
      x - the X magnitude of the vector
      y - the Y magnitude of the vector
      Returns:
      the angle (in degrees) between the vector and the X axis
    • angle

      public static double angle(double pivotX, double pivotY, double x, double y)
      Computes the angle (in degrees) between the vector and the X axis
      Parameters:
      x - the X magnitude of the vector
      y - the Y magnitude of the vector
      Returns:
      the angle (in degrees) between the vector and the X axis
    • pivot

      public static Point2D pivot(double pivotX, double pivotY, double angleDeg, double distance)
    • pivotRadian

      public static Point2D pivotRadian(double pivotX, double pivotY, double angleRad, double distance)
    • rotate

      public static Point2D rotate(double pivotX, double pivotY, double x, double y, double angleDeg)