Class Points

java.lang.Object
org.jhotdraw8.geom.Points

public class Points extends Object
  • Method Details

    • squaredDistance

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

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

      public static float distanceF(double x1, double y1, double x2, double y2)
      Computes the distance between the points (x1,y1) and (x2,y2) with float precision.

      Computing the sqrt of a float is twice as fast as computing the sqrt of a double.

      Parameters:
      x1 - x-coordinate of point 1
      y1 - y-coordinate of point 1
      x2 - x-coordinate of point 2
      y2 - y-coordinate of point 2
      Returns:
    • almostEqual

      public static boolean almostEqual(Point2D v1, Point2D v2)
    • almostEqual

      public static boolean almostEqual(Point2D v1, Point2D v2, double epsilon)
    • almostEqual

      public static boolean almostEqual(double x0, double y0, double x1, double y1)
    • almostEqual

      public static boolean almostEqual(double x0, double y0, double x1, double y1, double epsilon)
    • almostZero

      public static boolean almostZero(Point2D.Double v)
    • almostZero

      public static boolean almostZero(Point2D.Double v, double epsilon)
    • almostEqual

      public static boolean almostEqual(double a, double b)
    • almostEqual

      public static boolean almostEqual(double a, double b, double epsilon)
    • almostZero

      public static boolean almostZero(double a)
    • almostZero

      public static boolean almostZero(double a, double epsilon)
    • distanceFromShape

      public static double distanceFromShape(Shape awtShape, double x, double y)
      Computes the distance from the given shape to the given point.
      Parameters:
      awtShape - a shape
      x - x-coordinate of the point
      y - y-coordinate of the point
      Returns:
      the distance
    • squaredDistanceFromShape

      public static double squaredDistanceFromShape(Shape awtShape, double x, double y)