public class Geom extends Object
Constructor and Description |
---|
Geom() |
Modifier and Type | Method and Description |
---|---|
static Line2D.Double |
arrowEdges(Point2D arrowpoint,
Point2D comesfrom,
double len,
double width)
Calculate points for drawing arrow heads.
|
protected static Point2D.Double |
calcCut(double tan,
double centerx,
double centery,
double limitx,
double limity)
calculate:
|
static Point2D.Double |
center(Point2D p1,
Point2D p2)
Find the center between two points.
|
static Line2D.Double |
connectCenters(Rectangle2D from,
Rectangle2D to,
int xoff,
int yoff)
Calculate the segment of the straight line connecting the centers
of two rectangles which end at their borders.
|
static int |
findEdgeOrCorner(Rectangle2D rect,
Point2D p,
double eps)
Find the edge or corner of a given rectangle, the given point is part of.
|
protected static void |
LINE(GeneralPath gp,
Point2D p) |
static GeneralPath |
makeDiamond(Rectangle2D rect)
Deliver a path wich connects the centers of the borders of the rectangle
|
static GeneralPath |
makeRoundedPath(double radius,
double eps_collinear,
Point2D... points0)
Creates a path with rounded edges which connect the given points.
|
static GeneralPath |
makeSquare(float cx,
float cy,
float radius) |
static GeneralPath |
makeSquare(Point2D center,
float radius) |
protected static void |
MOVE(GeneralPath gp,
Point2D p) |
static Point2D.Double |
movePoint(Point2D p,
double dx,
double dy)
Add a difference vector to a point.
|
static Point2D.Double |
movePoint(Point2D p,
int dx,
int dy)
Add a difference vector to a point.
|
static Point2D.Double |
point2pointd(Point2D p)
convert a
Point2D to a Point2D.Double |
static Point |
pointd2point(Point2D dp)
|
static Point2D.Double |
rectangle_p1(Rectangle2D rect)
Get the lower left point of a
Rectangle2D |
static Point2D.Double |
rectangle_p2(Rectangle2D rect)
Get the upper right point of a
Rectangle2D |
static double |
rectangle_x1(Rectangle2D rect)
Get the lower x coordinate of a
Rectangle2D |
static double |
rectangle_x2(Rectangle2D rect)
Get the upper x coordinate of a
Rectangle2D |
static double |
rectangle_y1(Rectangle2D rect)
Get the lower y coordinate of a
Rectangle2D |
static double |
rectangle_y2(Rectangle2D rect)
Get the upper y coordinate of a
Rectangle2D |
protected static void |
SPLINE(GeneralPath gp,
Point2D paux,
Point2D p) |
static Point2D.Double |
towardsPoint(Point2D from,
double len,
Point2D to) |
static float |
transposeCoordinate(float coordinate,
float sourcemin,
float sourcemax,
float targetmin,
float targetmax) |
public static Point2D.Double point2pointd(Point2D p)
Point2D
to a Point2D.Double
public static Point2D.Double movePoint(Point2D p, int dx, int dy)
public static Point2D.Double movePoint(Point2D p, double dx, double dy)
public static Point2D.Double center(Point2D p1, Point2D p2)
public static double rectangle_x1(Rectangle2D rect)
Rectangle2D
public static double rectangle_x2(Rectangle2D rect)
Rectangle2D
public static double rectangle_y1(Rectangle2D rect)
Rectangle2D
public static double rectangle_y2(Rectangle2D rect)
Rectangle2D
public static Point2D.Double rectangle_p1(Rectangle2D rect)
Rectangle2D
public static Point2D.Double rectangle_p2(Rectangle2D rect)
Rectangle2D
public static int findEdgeOrCorner(Rectangle2D rect, Point2D p, double eps)
int
index according to the following number assignment:
3=nw 2=n 1=ne +--------+ | p2| 4=w | | 0=e |p1 | +--------+ 5=sw 6=s 7=se
rect
- the rectanglep
- the pointeps
- the granularity of the equality testpublic static Line2D.Double connectCenters(Rectangle2D from, Rectangle2D to, int xoff, int yoff)
+---------+ | * pt | +---. --- + / / / / +---------+/ | .| | . | | * | | pf | | | +-------- +
from
- one rectangleto
- the otherxoff
- offset to the x coordinate, for both pointsyoff
- offset to the y coordinate, for both pointsprotected static Point2D.Double calcCut(double tan, double centerx, double centery, double limitx, double limity)
| * +---. --- + / / == OR == / ---------+/ .| . | |
public static Line2D.Double arrowEdges(Point2D arrowpoint, Point2D comesfrom, double len, double width)
/ / p1 / |. / | . / w | ./ i | /p0 d | /=len . t |/ . h v----------p2 =len(Please note that this algorith is "analytical" and does not employ trigonometric functions !-)
arrowpoint
- where the tip of the arrowhead lies.comesfrom
- the other point of the linelen
- the length of the arrowheads side lines ???(VERIFY FIXME ??)width
- the opening width of half the arrow head (VERIFY FIXME ??)public static Point2D.Double towardsPoint(Point2D from, double len, Point2D to)
protected static void MOVE(GeneralPath gp, Point2D p)
protected static void LINE(GeneralPath gp, Point2D p)
protected static void SPLINE(GeneralPath gp, Point2D paux, Point2D p)
public static GeneralPath makeRoundedPath(double radius, double eps_collinear, Point2D... points0)
radius
- the radius of the rounded edgeseps_collinear
- when two lines are considered "not an edge"points0
- the sequence of points.public static GeneralPath makeDiamond(Rectangle2D rect)
+------+ | /\ | | / \ | |/ \| |\ /| | \ / | | \/ | +------+
public static GeneralPath makeSquare(float cx, float cy, float radius)
public static GeneralPath makeSquare(Point2D center, float radius)
public static float transposeCoordinate(float coordinate, float sourcemin, float sourcemax, float targetmin, float targetmax)
see also the complete user documentation .