| Modifier | Constructor and Description |
|---|---|
|
BasicShape(BasicShape
Clones a BasicShape.
|
|
BasicShape(PathIterator
Creates a
BasicShape from a path.
|
protected |
BasicShape(PathIterator
Creates a
BasicShape from a path.
|
|
BasicShape(Shape
Creates a
BasicShape from a shape.
|
|
BasicShape(Shape
Creates a
BasicShape from a shape.
|
|
BasicShape(String
Creates a BasicShape from a serialized string.
|
| Modifier and Type | Method and Description |
|---|---|
void |
add(BasicShape
Adds the argument shape to this shape.
|
protected static boolean |
contains(com
|
boolean |
contains(double x, double y)
|
boolean |
contains(double x, double y, double w, double h)
|
protected boolean |
contains(double x, double y, int windingRule)
|
boolean |
contains(Point2D
|
boolean |
contains(Rectangle2D
|
protected void |
convertToWindEvenOdd()
|
protected static int |
countCrossings(com
This counts the number of crossings from (-infinity,y) to (x,y).
|
Rectangle |
getBounds()
|
Rectangle |
getBounds(Rectangle
|
Rectangle2D |
getBounds2D()
|
Rectangle2D |
getBounds2D(Rectangle2D
|
PathIterator |
getPathIterator(AffineTransform
Creates a
PathIterator for the outline of this object.
|
PathIterator |
getPathIterator(AffineTransform
Creates a
FlatteningPathIterator for the outline of this object.
|
protected boolean |
identifyCrossings(double x, double y, double w, double h)
This checks 2 things: 1.
|
protected com |
identifyIntersections(BasicShape
This identifies all the intersections of this shape and the argument.
|
void |
intersect(BasicShape
Intersects the argument shape with this shape.
|
boolean |
intersects(double x, double y, double w, double h)
|
boolean |
intersects(Rectangle2D
|
protected static boolean |
near(double v1, double v2, double tolerance)
Return true if two values are near each other.
|
protected void |
releaseIterators()
When we are about to modify this object we need to synch on this object and call this method.
|
void |
subtract(BasicShape
Subtracts the argument shape from this shape.
|
String |
toString()
A
java.lang.String representation of this shape.
|
protected static String |
toString(double[] array)
|
protected static String |
toString(double[] array, int offset, int len)
This lists an array of double values as a String.
|
void |
transform(AffineTransform
Transforms this shape through the
AffineTransform provided.
|
protected void |
updateBounds()
This method should be called when this shape has undergone a transformation.
|
public BasicShape(Shapeshape)
BasicShape from a shape.
If the shape is a simple shape in the java.awt.geom package, then you should use a constructor that accepts a Shape argument instead of a PathIterator argument.
shape - the shape data to copy.
public BasicShape(Shapeshape, AffineTransform transform)
BasicShape from a shape.
If the shape is a simple shape in the java.awt.geom package, then you should use a constructor that accepts a Shape argument instead of a PathIterator argument.
shape - the shape data to copy.
transform - an optional transform to apply to the incoming shape.
public BasicShape(PathIteratori)
BasicShape from a path.
i - path data.
protected BasicShape(PathIteratori, boolean ignoreWinding)
BasicShape from a path.
i - path data.
ignoreWinding - if a path is WIND_NON_ZERO, then it normally will be converted. However some shapes (rectangles, circles, etc) don't need to be converted, so if you pass
true here then that conversion will be skipped. By default you should pass
false if you don't know the nature of the
PathIterator you're working with.
public BasicShape(Strings)
s - this string should be the result of a former call to:
myBasicShape.toString()
public BasicShape(BasicShapes)
protected static boolean near(double v1,
double v2,
double tolerance)
v1 - the first value
v2 - the second value
tolerance - the acceptable tolerance. Must be positive.
protected static StringtoString(double[] array)
protected static StringtoString(double[] array, int offset, int len)
array -
offset -
len -
protected void convertToWindEvenOdd()
protected void updateBounds()
public boolean contains(Point2Dp)
public boolean contains(Rectangle2Dr)
public boolean contains(double x,
double y)protected static boolean contains(com.bric .geom .BasicShapeSegment path, double x, double y, int windingRule, boolean includeEdges)
protected boolean contains(double x,
double y,
int windingRule)public void add(BasicShapeshape)
If shape B is added to shape A, then the resulting shape will contain points in either A or B.
shape - the shape to add.
public void subtract(BasicShapeshape)
If shape B is subtracted from shape A, then the resulting shape will contain only points in A that do not also lie in B.
shape - the shape to subtract. For best performance this should be a BasicShape.
public void intersect(BasicShapeshape)
If shape A is intersected with shape B, then the resulting shape will contain only points in both A and B.
shape - the shape to intersect with. For best performance this should be a BasicShape.
protected static int countCrossings(com.bric .geom .BasicShapeSegment t, double x, double y, boolean includeEdges)
This total is used in combination with the winding rule to determine when a point is inside a shape.
includeEdges - whether a point exactly on the edge of the shape counts.
public boolean contains(double x,
double y,
double w,
double h)protected boolean identifyCrossings(double x,
double y,
double w,
double h)
public RectanglegetBounds()
protected com.bric .geom .Intersection identifyIntersections(BasicShape shape)
IntersectionIdentifier to find those intersections.
This replaces any previously existing intersection information in the two BasicShapes, so you cannot call this method on different threads simultaneously for the same shapes.
shape - the other shape to identify intersections with.
public Rectangle2DgetBounds2D()
public Rectangle2DgetBounds2D(Rectangle2D dest)
public PathIteratorgetPathIterator(AffineTransform at)
PathIterator for the outline of this object.
getPathIterator in interface
Shape
at - an optional
AffineTransform to apply to this shape data
public PathIteratorgetPathIterator(AffineTransform at, double flatness)
FlatteningPathIterator for the outline of this object.
getPathIterator in interface
Shape
at - an optional
AffineTransform to apply to this shape data
flatness - the maximum amount that the control points for a given curve can vary from colinear before a subdivided curve is replaced by a straight line connecting the endpoints
public boolean intersects(Rectangle2Dr)
public boolean intersects(double x,
double y,
double w,
double h)public void transform(AffineTransformtransform)
AffineTransform provided.
transform - the transform to apply to this shape.
public StringtoString()
java.lang.String representation of this shape.
Note that this String can later be passed as an argument to the constructor to re-create this shape, so this is a very efficient way to serialize this data.
protected void releaseIterators()