Interface IFxShape
public interface IFxShape extends Shape
{
// Methods
public boolean contains(Point p);
public void draw(FxGraphics g);
public int getBorderLength();
public Rectangle getBounds();
public Point getOrigin();
public Point getPoint(int pt);
public int[] getPointAndAngle(int pt);
public int getPointAngle(int pt);
public boolean includes(Point p);
public boolean setOrigin(Point p);
public void translate(int deltaX, int deltaY);
public void updateBounds(int x, int y);
}
This interface defines methods for objects that represent a geometric shape.
Shape
|
+--IFxShape
public boolean contains(Point p);
Determines whether a specific Point lies on or within the curve.
Return Value:
Returns true if the point is on or within the curve; otherwise, returns false.
Parameter | Description |
p
| The point to be tested.
|
Remarks:
If this is a closed shape, the method will return true for points contained within the curve.
public void draw(FxGraphics g);
Draws a curve with the current graphics.
Return Value:
No return value.
Parameter | Description |
g
| The graphics object to use.
|
public int getBorderLength();
Retrieves the length of the entire border of the shape.
Return Value:
Returns the length of the border.
Remarks:
For example, the border length of a circle is its circumference, and the border length of a rectangle is ((y1 - y2) x 2) + ((x1 - x2) x 2), and so on.
public Rectangle getBounds();
Retrieves the bounding box of the shape.
Return Value:
Returns a Rectangle that defines the bounding box of the shape.
public Point getOrigin();
Locates the origin of a curve.
Return Value:
Returns the point used as the origin.
Remarks:
Use this method to locate the origin of a curve and use the returned Point as a basis for the getPoint method.
public Point getPoint(int pt);
Locates a point that is n pixels from the origin of the curve.
Return Value:
Returns the point that is n pixels from the origin.
Parameter | Description |
pt
| The point to locate.
|
public int[] getPointAndAngle(int pt);
Retrieves the coordinates and angle of the base of the normal vector at the requested point.
Return Value:
Returns an array of three integers: the x, y, and degrees values.
Parameter | Description |
pt
| The point to calculate the vector from.
|
public int getPointAngle(int pt);
Locates the angle of the normal vector at this point.
Return Value:
Returns the angle of the normal vector at point pt.
Parameter | Description |
pt
| The point to calculate the angle from.
|
public boolean includes(Point p);
Determines whether the specified point is on the curve.
Return Value:
Returns true if the point is on the curve; otherwise, returns false.
Parameter | Description |
p
| The point to be tested.
|
Remarks:
If the curve represents a closed area, the method will not return true for a point within the enclosed boundaries. Under these circumstances, the contains method should be used.
public boolean setOrigin(Point p);
Sets a new origin for the curve.
Return Value:
Returns true if successful; otherwise, returns false.
Parameter | Description |
p
| The point to set as the new origin.
|
Remarks:
If the point is not on the curve, the curve may not be set to the new origin. The origin, which is used for plotting operations on the curve, is not equivalent to the point nearest the origin (0,0).
public void translate(int deltaX, int deltaY);
Translates the vertices by deltaX and deltaY.
Return Value:
No return value.
Parameter | Description |
deltaX
| The amount to move the x coordinates.
|
deltaY
| The amount to move the y coordinates.
|
public void updateBounds(int x, int y);
Updates the boundaries.
Return Value:
No return value.
Parameter | Description |
x
| The new x coordinate of the boundary.
|
y
| The new y coordinate of the boundary.
|