public abstract class GeometryUtils extends Object
Modifier and Type | Class and Description |
---|---|
static class |
GeometryUtils.PathSegment
Utility data class for the values of the segments in a geometric shape.
|
Modifier and Type | Field and Description |
---|---|
static double |
EPSILON
Precision.
|
static double |
EPSILON_SQ
Precision squared.
|
Modifier and Type | Method and Description |
---|---|
static List<GeometryUtils.PathSegment> |
getSegments(Shape shape)
Returns a list of a shape's segments as they are returned by its path
iterator.
|
static Shape |
getShape(List<GeometryUtils.PathSegment> segments,
boolean isDouble)
Constructs a geometric shape from a list of path segments.
|
static Area |
grow(Shape s,
double offset)
Expand or shrink a shape in all directions by a defined offset.
|
static Area |
grow(Shape s,
double offset,
int join,
float miterlimit)
Expand or shrink a shape in all directions by a defined offset.
|
static Point2D |
intersection(Line2D l1,
Line2D l2)
Returns the intersection point of two lines.
|
static List<Point2D> |
intersection(Shape s1,
Shape s2)
Returns all intersection points of two shapes.
|
static Area |
punch(Area shapeArea,
double gap,
boolean rounded,
Point2D pointPos,
Shape pointShape)
Subtract a specified geometric area of data points from another shape to yield gaps.
|
static Shape |
reverse(Shape shape)
Returns a clone of a specified shape which has a reversed order of the
points, lines and curves.
|
static Line2D[] |
shapeToLines(Shape path,
boolean swapped)
Returns the line fragments of the specified Shape.
|
public static final double EPSILON
public static final double EPSILON_SQ
public static Line2D[] shapeToLines(Shape path, boolean swapped)
path
- Shape to be divided.swapped
- Invert segment direction.public static List<Point2D> intersection(Shape s1, Shape s2)
s1
- First shapes2
- Second shapepublic static Point2D intersection(Line2D l1, Line2D l2)
l1
- First linel2
- Second linenull
if
no intersection was foundpublic static Area grow(Shape s, double offset)
s
- Shapeoffset
- Offsetpublic static Area grow(Shape s, double offset, int join, float miterlimit)
s
- Shapeoffset
- Offset to expand/shrinkjoin
- Method for handling edges (see BasicStroke)miterlimit
- Limit for miter joining methodpublic static Area punch(Area shapeArea, double gap, boolean rounded, Point2D pointPos, Shape pointShape)
shapeArea
- Shape from which to subtract.gap
- Size of the gap.rounded
- Gap corners will be rounded if true
.pointPos
- Position of the data pointpointShape
- Shape of the data pointpublic static List<GeometryUtils.PathSegment> getSegments(Shape shape)
shape
- Shape to be iterated.public static Shape getShape(List<GeometryUtils.PathSegment> segments, boolean isDouble)
segments
- List of path segments.isDouble
- true
if the shape contents should be stored with
double values, false
if they should be stored as float.Copyright © 2009-2013. All Rights Reserved.