|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectsamples.preview_new_graphdraw.CoordinateUtil
public class CoordinateUtil
Nested Class Summary | |
---|---|
protected static class |
CoordinateUtil.Line
A class which represents a geometric line. |
Constructor Summary | |
---|---|
CoordinateUtil()
|
Method Summary | |
---|---|
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,
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 Collection |
getIntersections(Coordinates source,
Coordinates dest,
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) |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public CoordinateUtil()
Method Detail |
---|
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 coordinates
public 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 distance
public 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, 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 Collection getIntersections(Coordinates source, Coordinates dest, Rectangle2D bounds)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |