public class CoordinateUtil
extends java.lang.Object
Modifier and Type | Class and Description |
---|---|
protected static class |
CoordinateUtil.Line
A class which represents a geometric line.
|
Constructor and Description |
---|
CoordinateUtil() |
Modifier and Type | Method and Description |
---|---|
static Coordinates |
add(Coordinates a,
double x,
double y) |
static double |
angleBetween(Coordinates c,
double x,
double y) |
static double |
distance(Coordinates a,
Coordinates b)
Computes the euclidean distance between two coordinates
|
static double |
distance(Coordinates a,
double x,
double y) |
static Coordinates |
getClosestIntersection(Coordinates source,
Coordinates dest,
java.awt.geom.Rectangle2D bounds)
Returns the closest intersection to
source of the
line defined by source and target ,
and the bounding box bounds , or null
if there is no intersection. |
static java.util.Collection |
getIntersections(Coordinates source,
Coordinates dest,
java.awt.geom.Rectangle2D bounds) |
static double |
getSquareDistance(Coordinates u,
double x,
double y)
returns the square of the distance between two points.
|
static Coordinates |
midpoint(Coordinates a,
Coordinates b)
Computes the midpoint between the two coordinates
|
static Coordinates |
scale(Coordinates a,
double x,
double y) |
static double |
squareDistanceLineToPoint(Coordinates front,
Coordinates back,
double x,
double y)
Calculates the square of the distance from a segment running (x1, y1) to
(x2, y2) to a point (x,y)
|
public static double distance(Coordinates a, Coordinates b)
public static double distance(Coordinates a, double x, double y)
coordinates
- x
- y
- public static Coordinates midpoint(Coordinates a, Coordinates b)
o
- another coordinatespublic static Coordinates scale(Coordinates a, double x, double y)
public static Coordinates add(Coordinates a, double x, double y)
public static double squareDistanceLineToPoint(Coordinates front, Coordinates back, double x, double y)
x1
- The front x of a liney1
- The front y of a linex2
- The back x of a liney2
- The back y of a linex
- The point to check distancey
- The point to check distancepublic static double getSquareDistance(Coordinates u, double x, double y)
x1
- y1
- x
- y
- public static double angleBetween(Coordinates c, double x, double y)
coordinates
- d
- e
- public static Coordinates getClosestIntersection(Coordinates source, Coordinates dest, java.awt.geom.Rectangle2D bounds)
source
of the
line defined by source
and target
,
and the bounding box bounds
, or null
if there is no intersection.public static java.util.Collection getIntersections(Coordinates source, Coordinates dest, java.awt.geom.Rectangle2D bounds)