java.lang.Object
org.jhotdraw8.geom.Points
-
Method Summary
Modifier and TypeMethodDescriptionstatic booleanalmostEqual(double a, double b) static booleanalmostEqual(double a, double b, double epsilon) static booleanalmostEqual(double x0, double y0, double x1, double y1) static booleanalmostEqual(double x0, double y0, double x1, double y1, double epsilon) static booleanalmostEqual(Point2D v1, Point2D v2) static booleanalmostEqual(Point2D v1, Point2D v2, double epsilon) static booleanalmostZero(double a) static booleanalmostZero(double a, double epsilon) static booleanstatic booleanalmostZero(Point2D.Double v, double epsilon) static doubledistance(double x1, double y1, double x2, double y2) Computes the distance between the points (x1,y1) and (x2,y2).static floatdistanceF(double x1, double y1, double x2, double y2) Computes the distance between the points (x1,y1) and (x2,y2) with float precision.static doubledistanceFromShape(@NonNull Shape awtShape, double x, double y) Computes the distance from the given shape to the given point.static doublesquaredDistance(double x1, double y1, double x2, double y2) Gets the squared distance between the points (x1,y1) and (x2,y2).static doublesquaredDistanceFromShape(@NonNull Shape awtShape, double x, double y)
-
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 1y1- y-coordinate of point 1x2- x-coordinate of point 2y2- 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 1y1- y-coordinate of point 1x2- x-coordinate of point 2y2- 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 1y1- y-coordinate of point 1x2- x-coordinate of point 2y2- y-coordinate of point 2- Returns:
-
almostEqual
-
almostEqual
-
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
-
almostZero
-
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
Computes the distance from the given shape to the given point.- Parameters:
awtShape- a shapex- x-coordinate of the pointy- y-coordinate of the point- Returns:
- the distance
-
squaredDistanceFromShape
-