All Packages Class Hierarchy This Package Previous Next Index
Class CH.ifa.draw.util.Geom
java.lang.Object
|
+----CH.ifa.draw.util.Geom
- public class Geom
- extends Object
Some geometric utilities.
-
EAST
-
-
NORTH
-
-
SOUTH
-
-
WEST
-
-
angleToPoint(Rectangle, double)
- Gets the point on a rectangle that corresponds to the given angle.
-
center(Rectangle)
-
-
direction(int, int, int, int)
- Returns the direction NORTH, SOUTH, WEST, EAST from
one point to another one.
-
east(Rectangle)
-
-
intersect(int, int, int, int, int, int, int, int)
- Standard line intersection algorithm
Return the point of intersection if it exists, else null
-
length(int, int, int, int)
- Gets the distance between to points
-
length2(int, int, int, int)
- Gets the square distance between two points.
-
lineContainsPoint(int, int, int, int, int, int)
- Tests if a point is on a line.
-
north(Rectangle)
-
-
ovalAngleToPoint(Rectangle, double)
- Gets the point on an oval that corresponds to the given angle.
-
pointToAngle(Rectangle, Point)
- Gets the angle of a point relative to a rectangle.
-
polarToPoint(double, double, double)
- Converts a polar to a point
-
range(int, int, int)
- Constains a value to the given range.
-
south(Rectangle)
-
-
west(Rectangle)
-
NORTH
public static final int NORTH
SOUTH
public static final int SOUTH
WEST
public static final int WEST
EAST
public static final int EAST
lineContainsPoint
public static boolean lineContainsPoint(int x1,
int y1,
int x2,
int y2,
int px,
int py)
- Tests if a point is on a line.
direction
public static int direction(int x1,
int y1,
int x2,
int y2)
- Returns the direction NORTH, SOUTH, WEST, EAST from
one point to another one.
south
public static Point south(Rectangle r)
center
public static Point center(Rectangle r)
west
public static Point west(Rectangle r)
east
public static Point east(Rectangle r)
north
public static Point north(Rectangle r)
range
public static int range(int min,
int max,
int value)
- Constains a value to the given range.
- Returns:
- the constrained value
length2
public static long length2(int x1,
int y1,
int x2,
int y2)
- Gets the square distance between two points.
length
public static long length(int x1,
int y1,
int x2,
int y2)
- Gets the distance between to points
pointToAngle
public static double pointToAngle(Rectangle r,
Point p)
- Gets the angle of a point relative to a rectangle.
angleToPoint
public static Point angleToPoint(Rectangle r,
double angle)
- Gets the point on a rectangle that corresponds to the given angle.
polarToPoint
public static Point polarToPoint(double angle,
double fx,
double fy)
- Converts a polar to a point
ovalAngleToPoint
public static Point ovalAngleToPoint(Rectangle r,
double angle)
- Gets the point on an oval that corresponds to the given angle.
intersect
public static 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
All Packages Class Hierarchy This Package Previous Next Index