|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectnet.sf.jaxodraw.util.JaxoGeometry
public final class JaxoGeometry
Utility methods for Java2D geometry.
| Method Summary | |
|---|---|
static void |
add(java.awt.geom.Rectangle2D r,
java.awt.geom.Rectangle2D s)
Add 's' to 'r', but respect isEmpty: is 's' is empty, do nothing; if 'r' is empty, 'r' is set to 's'. |
static void |
add(java.awt.Rectangle r,
int x,
int y,
int width,
int height)
See add(Rectangle2D, Rectangle2D). |
static double |
bezierLength(java.awt.geom.Point2D[] p,
double error)
Returns the approximate length of a Bezier curve. |
static java.awt.geom.Point2D |
bezierPoint(java.awt.geom.Point2D[] p,
double u)
Returns a point of a Bezier curve at parameter u. |
static double |
bezierSlope(java.awt.geom.Point2D[] p,
double u)
Returns the first derivative of a Bezier curve at parameter u. |
static void |
bezierSplit(java.awt.geom.Point2D[] controlPoints,
java.awt.geom.Point2D[] left,
java.awt.geom.Point2D[] right)
Splits a Bezier into half and calculates the control points of the two parts. |
static void |
clear(java.awt.geom.Rectangle2D r)
Clear: Ensure 'r.isEmpty()'. |
static double |
curveParameter(double u)
Checks that a curve parameter value is in range, within errors. |
static java.awt.Rectangle |
getBounds(java.util.Collection objects)
Bounding box of a Collection of Shapes: the union of all the object's ones). |
static void |
grow(java.awt.Dimension d,
java.awt.Insets n)
Increase the Dimension 'd' by the amount given in each direction in 'n'. |
static void |
grow(java.awt.Rectangle r,
java.awt.Insets n)
Increase the Rectangle 'r' by the amount given in each direction in 'n'. |
static java.awt.geom.Point2D |
scaledPoint(double orx,
double ory,
double scale,
double px,
double py)
Returns a point that is obtained from a point (px, py) after a scale transformation scale, keeping the point (orx, ory) fixed. |
static void |
setLocationRelativeToAvoiding(java.awt.Window w,
java.awt.Component comp,
java.awt.Rectangle avoidme)
Put Window into a nice place - in principle as setLocationRelativeTo(c), but try to avoid covering the given Rectangle. |
static void |
shrink(java.awt.Dimension d,
java.awt.Insets n)
Decrease the Dimension 'd' by the amount given in each direction in 'n'. |
static void |
shrink(java.awt.Rectangle r,
java.awt.Insets n)
Decrease the Rectangle 'r' by the amount given in each direction in 'n'. |
static void |
translate(java.awt.geom.Point2D p,
double dx,
double dy)
Translate a point. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Method Detail |
|---|
public static void add(java.awt.geom.Rectangle2D r,
java.awt.geom.Rectangle2D s)
r - The first Rectangle.s - The rectangle to add.Rectangle.add(Rectangle),
Rectangle.isEmpty()
public static void add(java.awt.Rectangle r,
int x,
int y,
int width,
int height)
add(Rectangle2D, Rectangle2D).
r - The first rectangle.x - The x coordinate of the rectangle to add.y - The y coordinate of the rectangle to add.width - The width of the rectangle to add.height - The height of the rectangle to add.public static void clear(java.awt.geom.Rectangle2D r)
r - The rectangle to clear.Rectangle.isEmpty()
public static void grow(java.awt.Rectangle r,
java.awt.Insets n)
r - The rectangle to grow.n - The insets to add.
public static void shrink(java.awt.Rectangle r,
java.awt.Insets n)
r - The rectangle to shrink.n - The insets to subtract.
public static void grow(java.awt.Dimension d,
java.awt.Insets n)
d - The dimension to grow.n - The insets to add.
public static void shrink(java.awt.Dimension d,
java.awt.Insets n)
d - The dimension to shrink.n - The insets to subtract.public static java.awt.Rectangle getBounds(java.util.Collection objects)
objects - A collection of objects,
only Shapes contribute to the result.
public static java.awt.geom.Point2D scaledPoint(double orx,
double ory,
double scale,
double px,
double py)
orx - The x-coordinate of the fixed point.ory - The y-coordinate of the fixed point.scale - The scale factor.px - The x-coordinate of the point to be transformed.py - The y-coordinate of the point to be transformed.
public static double bezierLength(java.awt.geom.Point2D[] p,
double error)
p - the four control points of the Bezier curve.error - An absolute value for an error estimate
public static void bezierSplit(java.awt.geom.Point2D[] controlPoints,
java.awt.geom.Point2D[] left,
java.awt.geom.Point2D[] right)
controlPoints - the four control points of the Bezier.left - (output) the four control points of the left half.right - (output) the four control points of the right half.
public static java.awt.geom.Point2D bezierPoint(java.awt.geom.Point2D[] p,
double u)
p - the four control points of the Bezier curve.u - the parameter value, needs to be between 0 and 1.
public static double bezierSlope(java.awt.geom.Point2D[] p,
double u)
p - the four control points of the Bezier curve.u - the parameter value, needs to be between 0 and 1.
public static double curveParameter(double u)
u - the parameter value, needs to be between 0 and 1.
public static void translate(java.awt.geom.Point2D p,
double dx,
double dy)
p - the point to move.dx - the translation in x direction.dy - the translation in y direction.
public static void setLocationRelativeToAvoiding(java.awt.Window w,
java.awt.Component comp,
java.awt.Rectangle avoidme)
w - The window to set.comp - A compponent.avoidme - The region to avoid.
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||