|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.jhotdraw.util.Geom
public class Geom
Some geometric utilities.
Field Summary | |
---|---|
static int |
EAST
|
static int |
NORTH
|
static int |
SOUTH
|
static int |
WEST
|
Method Summary | |
---|---|
static java.awt.Point |
angleToPoint(java.awt.Rectangle r,
double angle)
Gets the point on a rectangle that corresponds to the given angle. |
static java.awt.Point |
bottomLeftCorner(java.awt.Rectangle r)
Returns the bottom left corner of the rectangle |
static java.awt.Point |
bottomRightCorner(java.awt.Rectangle r)
Returns the bottom right corner of the rectangle. |
static java.awt.Point |
center(java.awt.Rectangle r)
|
static java.awt.Point |
corner(java.awt.Rectangle r)
Returns the corner (bottom right) of the rectangle |
static int |
direction(int x1,
int y1,
int x2,
int y2)
Returns the direction NORTH, SOUTH, WEST, EAST from one point to another one. |
static double |
distanceFromLine(int xa,
int ya,
int xb,
int yb,
int xc,
int yc)
compute distance of point from line segment, or Double.MAX_VALUE if perpendicular projection is outside segment; or If pts on line are same, return distance from point |
static double |
distanceFromLine2D(int xa,
int ya,
int xb,
int yb,
int xc,
int yc)
compute distance of point from line segment. |
static java.awt.Point |
east(java.awt.Rectangle r)
|
static java.awt.Point |
intersect(int xa,
int ya,
int xb,
int yb,
int xc,
int yc,
int xd,
int yd)
Standard line intersection algorithm Return the point of intersection if it exists, else null |
static long |
length(int x1,
int y1,
int x2,
int y2)
Gets the distance between to points |
static long |
length2(int x1,
int y1,
int x2,
int y2)
Gets the square distance between two points. |
static boolean |
lineContainsPoint(int x1,
int y1,
int x2,
int y2,
int px,
int py)
Tests if a point is on a line. |
static java.awt.Point |
north(java.awt.Rectangle r)
|
static java.awt.Point |
ovalAngleToPoint(java.awt.Rectangle r,
double angle)
Gets the point on an oval that corresponds to the given angle. |
static double |
pointToAngle(java.awt.Rectangle r,
java.awt.Point p)
Gets the angle of a point relative to a rectangle. |
static java.awt.Point |
polarToPoint(double angle,
double fx,
double fy)
Converts a polar to a point |
static int |
range(int min,
int max,
int value)
Constains a value to the given range. |
static java.awt.Point |
south(java.awt.Rectangle r)
|
static java.awt.Point |
topLeftCorner(java.awt.Rectangle r)
Returns the top left corner of the rectangle |
static java.awt.Point |
topRightCorner(java.awt.Rectangle r)
Returns the top right corner of the rectangle |
static java.awt.Point |
west(java.awt.Rectangle r)
|
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final int NORTH
public static final int SOUTH
public static final int WEST
public static final int EAST
Method Detail |
---|
public static boolean lineContainsPoint(int x1, int y1, int x2, int y2, int px, int py)
public static int direction(int x1, int y1, int x2, int y2)
public static java.awt.Point south(java.awt.Rectangle r)
public static java.awt.Point center(java.awt.Rectangle r)
public static java.awt.Point west(java.awt.Rectangle r)
public static java.awt.Point east(java.awt.Rectangle r)
public static java.awt.Point north(java.awt.Rectangle r)
public static java.awt.Point corner(java.awt.Rectangle r)
r
- the rectangle
public static java.awt.Point topLeftCorner(java.awt.Rectangle r)
r
- the rectangle
public static java.awt.Point topRightCorner(java.awt.Rectangle r)
r
- the rectangle
public static java.awt.Point bottomLeftCorner(java.awt.Rectangle r)
r
- the rectangle
public static java.awt.Point bottomRightCorner(java.awt.Rectangle r)
r
- the rectangle
public static int range(int min, int max, int value)
public static long length2(int x1, int y1, int x2, int y2)
public static long length(int x1, int y1, int x2, int y2)
public static double pointToAngle(java.awt.Rectangle r, java.awt.Point p)
public static java.awt.Point angleToPoint(java.awt.Rectangle r, double angle)
public static java.awt.Point polarToPoint(double angle, double fx, double fy)
public static java.awt.Point ovalAngleToPoint(java.awt.Rectangle r, double angle)
public static java.awt.Point intersect(int xa, int ya, int xb, int yb, int xc, int yc, int xd, int yd)
public static double distanceFromLine(int xa, int ya, int xb, int yb, int xc, int yc)
public static double distanceFromLine2D(int xa, int ya, int xb, int yb, int xc, int yc)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |