|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||

public interface Shape2D
Main interface for all geometric objects, including points, lines, curves, or planar regions... Instances of Shape2D can be either bounded (a point, a line segment, a square...) or unbounded (a parabola, a half-plane...).
Shape2D implementations implements a more specialized interface depending
on the shape inner dimension:
Curve2D,
Domain2D or
PointShape2D.
Shape2D interface provide convenient method to check if the shape
is empty, to transform or to clip the shape, get its
bounding box, or its
distance to a given point.
| Field Summary | |
|---|---|
static double |
ACCURACY
The constant used for testing results. |
| Method Summary | |
|---|---|
Shape2D |
clip(Box2D box)
Clip the shape with the given box, and returns a new shape. |
boolean |
contains(double x,
double y)
Checks if the shape contains the planar point defined by (x,y). |
boolean |
contains(Point2D p)
Checks if the shape contains the given point. |
void |
draw(Graphics2D g2)
Draw the shape on the given graphics. |
Box2D |
getBoundingBox()
Returns the bounding box of the shape. |
double |
getDistance(double x,
double y)
get the distance of the shape to the given point, specified by x and y, or the distance of point to the frontier of the shape in the case of a plain (i.e. |
double |
getDistance(Point2D p)
get the distance of the shape to the given point, or the distance of point to the frontier of the shape in the case of a plain shape. |
boolean |
isBounded()
Returns true if the shape is bounded, that is if we can draw a finite rectangle enclosing the shape. |
boolean |
isEmpty()
Returns true if the shape does not contain any point. |
Shape2D |
transform(AffineTransform2D trans)
Transforms the shape by an affine transform. |
| Field Detail |
|---|
static final double ACCURACY
| Method Detail |
|---|
boolean contains(double x,
double y)
boolean contains(Point2D p)
double getDistance(Point2D p)
double getDistance(double x,
double y)
boolean isBounded()
boolean isEmpty()
Box2D getBoundingBox()
Shape2D clip(Box2D box)
box - the clipping box
Shape2D transform(AffineTransform2D trans)
trans - an affine transform
void draw(Graphics2D g2)
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||