Top Description Fields Constructors Methods
com.sun.javafx.geom

public Class Arc2D

extends RectangularShape
Class Inheritance
Imports
com.sun.javafx.geom.transform.BaseTransform

The arc is a partial section of a full ellipse which inscribes the framing rectangle of its parent RectangularShape. The angles are specified relative to the non-square framing rectangle such that 45 degrees always falls on the line from the center of the ellipse to the upper right corner of the framing rectangle. As a result, if the framing rectangle is noticeably longer along one axis than the other, the angles to the start and end of the arc segment will be skewed farther along the longer axis of the frame.
Version
10 Feb 1997

Field Summary

Modifier and TypeField and Description
public static final int
CHORD

The closure type for an arc closed by drawing a straight line segment from the start of the arc segment to the end of the arc segment.

public float
extent

The angular extent of the arc in degrees.

public float
height

The overall height of the full ellipse of which this arc is a partial section (not considering the angular extents).

public static final int
OPEN

The closure type for an open arc with no path segments connecting the two ends of the arc segment.

public static final int
PIE

The closure type for an arc closed by drawing straight line segments from the start of the arc segment to the center of the full ellipse and from that point to the end of the arc segment.

public float
start

The starting angle of the arc in degrees.

private int
public float
width

The overall width of the full ellipse of which this arc is a partial section (not considering the angular extents).

public float
x

The X coordinate of the upper-left corner of the framing rectangle of the arc.

public float
y

The Y coordinate of the upper-left corner of the framing rectangle of the arc.

Constructor Summary

AccessConstructor and Description
public
Arc2D()

Constructs a new OPEN arc, initialized to location (0, 0), size (0, 0), angular extents (start = 0, extent = 0).

public
Arc2D(int
The closure type for the arc: OPEN, CHORD, or PIE.
type
)

Constructs a new arc, initialized to location (0, 0), size (0, 0), angular extents (start = 0, extent = 0), and the specified closure type.

public
Arc2D(float
The X coordinate of the upper-left corner of the arc's framing rectangle.
x
,
float
The Y coordinate of the upper-left corner of the arc's framing rectangle.
y
,
float
The overall width of the full ellipse of which this arc is a partial section.
w
,
float
The overall height of the full ellipse of which this arc is a partial section.
h
,
float
The starting angle of the arc in degrees.
start
,
float
The angular extent of the arc in degrees.
extent
,
int
The closure type for the arc: OPEN, CHORD, or PIE.
type
)

Constructs a new arc, initialized to the specified location, size, angular extents, and closure type.

Method Summary

Modifier and TypeMethod and Description
public boolean

Returns:

true if the point lies within the bound of the arc, false if the point lies outside of the arc's bounds.
contains
(float
The X coordinate of the point to test.
x
,
float
The Y coordinate of the point to test.
y
)

Implements abstract com.sun.javafx.geom.Shape.contains.

Determines whether or not the specified point is inside the boundary of the arc.

public boolean

Returns:

true if the arc contains the rectangle, false if the arc doesn't contain the rectangle.
contains
(float
The X coordinate of the rectangle's upper-left corner.
x
,
float
The Y coordinate of the rectangle's upper-left corner.
y
,
float
The width of the rectangle.
w
,
float
The height of the rectangle.
h
)

Implements abstract com.sun.javafx.geom.Shape.contains.

Determines whether or not the interior of the arc entirely contains the specified rectangle.

public boolean

Returns:

true if the arc contains the angle, false if the arc doesn't contain the angle.
containsAngle
(float
The angle to test.
angle
)

Determines whether or not the specified angle is within the angular extents of the arc.

public Arc2D
copy()

Implements abstract com.sun.javafx.geom.Shape.copy.

Returns a new copy of this Shape instance.

public boolean

Returns:

true if obj is an instance of Arc2D and has the same values; false otherwise.
equals
(Object
an Object to be compared with this Arc2D.
obj
)

Overrides java.lang.Object.equals.

Determines whether or not the specified Object is equal to this Arc2D.

public int

Returns:

One of the integer constant closure types defined in this class.
getArcType
()

Returns the arc closure type of the arc: OPEN, CHORD, or PIE.

public RectBounds

Returns:

the RectBounds that represents the arc's framing rectangle.
getBounds
()

Overrides com.sun.javafx.geom.RectangularShape.getBounds.

Returns the high-precision framing rectangle of the arc.

public Point2D

Returns:

A Point2D object representing the x,y coordinates of the ending point of the arc.
getEndPoint
()

Returns the ending point of the arc.

public float
getHeight()

Implements abstract com.sun.javafx.geom.RectangularShape.getHeight.

Returns the height of the framing rectangle in double precision.

public PathIterator

Returns:

A PathIterator that defines the arc's boundary.
getPathIterator
(BaseTransform
an optional BaseTransform to be applied to the coordinates as they are returned in the iteration, or null if the untransformed coordinates are desired.
tx
)

Implements abstract com.sun.javafx.geom.Shape.getPathIterator.

Returns an iteration object that defines the boundary of the arc.

public Point2D

Returns:

A Point2D object representing the x,y coordinates of the starting point of the arc.
getStartPoint
()

Returns the starting point of the arc.

public float
getWidth()

Implements abstract com.sun.javafx.geom.RectangularShape.getWidth.

Returns the width of the framing rectangle in double precision.

public float
getX()

Implements abstract com.sun.javafx.geom.RectangularShape.getX.

Returns the X coordinate of the upper-left corner of the framing rectangle in double precision.

public float
getY()

Implements abstract com.sun.javafx.geom.RectangularShape.getY.

Returns the Y coordinate of the upper-left corner of the framing rectangle in double precision.

public int

Returns:

the hashcode for this Arc2D.
hashCode
()

Overrides java.lang.Object.hashCode.

Returns the hashcode for this Arc2D.

public boolean

Returns:

true if the arc intersects the rectangle, false if the arc doesn't intersect the rectangle.
intersects
(float
The X coordinate of the rectangle's upper-left corner.
x
,
float
The Y coordinate of the rectangle's upper-left corner.
y
,
float
The width of the rectangle.
w
,
float
The height of the rectangle.
h
)

Implements abstract com.sun.javafx.geom.Shape.intersects.

Determines whether or not the interior of the arc intersects the interior of the specified rectangle.

public boolean
isEmpty()

Implements abstract com.sun.javafx.geom.RectangularShape.isEmpty.

Determines whether the RectangularShape is empty.

pack-priv static float
normalizeDegrees(double angle)

public void
setAngles(float
The X coordinate of the arc's starting point.
x1
,
float
The Y coordinate of the arc's starting point.
y1
,
float
The X coordinate of the arc's ending point.
x2
,
float
The Y coordinate of the arc's ending point.
y2
)

Sets the starting angle and angular extent of this arc using two sets of coordinates.

public void
setAngles(Point2D
The Point2D that defines the arc's starting point.
p1
,
Point2D
The Point2D that defines the arc's ending point.
p2
)

Sets the starting angle and angular extent of this arc using two points.

public void
setAngleStart(Point2D
The Point2D that defines the starting angle.
p
)

Sets the starting angle of this arc to the angle that the specified point defines relative to the center of this arc.

public void
setArc(float x, float y, float w, float h, float angSt, float angExt, int closure)

public void
setArc(Point2D
The Point2D representing the coordinates of the upper-left corner of the arc.
loc
,
Dimension2D
The Dimension2D representing the width and height of the full ellipse of which this arc is a partial section.
size
,
float
The starting angle of the arc in degrees.
angSt
,
float
The angular extent of the arc in degrees.
angExt
,
int
The closure type for the arc: OPEN, CHORD, or PIE.
closure
)

Sets the location, size, angular extents, and closure type of this arc to the specified values.

public void
setArc(Arc2D
The Arc2D to use to set the arc's values.
a
)

Sets this arc to be the same as the specified arc.

public void
setArcByCenter(float
The X coordinate of the center of the arc.
x
,
float
The Y coordinate of the center of the arc.
y
,
float
The radius of the arc.
radius
,
float
The starting angle of the arc in degrees.
angSt
,
float
The angular extent of the arc in degrees.
angExt
,
int
The closure type for the arc: OPEN, CHORD, or PIE.
closure
)

Sets the position, bounds, angular extents, and closure type of this arc to the specified values.

public void
setArcByTangent(Point2D
The first point that defines the arc. The starting angle of the arc is tangent to the line specified by points (p1, p2).
p1
,
Point2D
The second point that defines the arc. The starting angle of the arc is tangent to the line specified by points (p1, p2). The ending angle of the arc is tangent to the line specified by points (p2, p3).
p2
,
Point2D
The third point that defines the arc. The ending angle of the arc is tangent to the line specified by points (p2, p3).
p3
,
float
The radius of the arc.
radius
)

Sets the position, bounds, and angular extents of this arc to the specified value.

public void
setArcType(int
The integer constant that represents the closure type of this arc: OPEN, CHORD, or PIE.
type
)

Sets the closure type of this arc to the specified value: OPEN, CHORD, or PIE.

public void
setFrame(float x, float y, float w, float h)

Implements abstract com.sun.javafx.geom.RectangularShape.setFrame.

Sets the location and size of the framing rectangle of this Shape to the specified rectangular values.

Inherited from com.sun.javafx.geom.RectangularShape:
containsgetCenterXgetCenterYgetMaxXgetMaxYgetMinXgetMinYgetPathIteratorsetFramesetFrameFromCentersetFrameFromCentersetFrameFromDiagonalsetFrameFromDiagonaltoString

Field Detail

CHORDback to summary
public static final int CHORD

The closure type for an arc closed by drawing a straight line segment from the start of the arc segment to the end of the arc segment.

extentback to summary
public float extent

The angular extent of the arc in degrees.

heightback to summary
public float height

The overall height of the full ellipse of which this arc is a partial section (not considering the angular extents).

OPENback to summary
public static final int OPEN

The closure type for an open arc with no path segments connecting the two ends of the arc segment.

PIEback to summary
public static final int PIE

The closure type for an arc closed by drawing straight line segments from the start of the arc segment to the center of the full ellipse and from that point to the end of the arc segment.

startback to summary
public float start

The starting angle of the arc in degrees.

typeback to summary
private int type
widthback to summary
public float width

The overall width of the full ellipse of which this arc is a partial section (not considering the angular extents).

xback to summary
public float x

The X coordinate of the upper-left corner of the framing rectangle of the arc.

yback to summary
public float y

The Y coordinate of the upper-left corner of the framing rectangle of the arc.

Constructor Detail

Arc2Dback to summary
public Arc2D()

Constructs a new OPEN arc, initialized to location (0, 0), size (0, 0), angular extents (start = 0, extent = 0).

Arc2Dback to summary
public Arc2D(int type)

Constructs a new arc, initialized to location (0, 0), size (0, 0), angular extents (start = 0, extent = 0), and the specified closure type.

Parameters
type:int

The closure type for the arc: OPEN, CHORD, or PIE.

Arc2Dback to summary
public Arc2D(float x, float y, float w, float h, float start, float extent, int type)

Constructs a new arc, initialized to the specified location, size, angular extents, and closure type.

Parameters
x:float

The X coordinate of the upper-left corner of the arc's framing rectangle.

y:float

The Y coordinate of the upper-left corner of the arc's framing rectangle.

w:float

The overall width of the full ellipse of which this arc is a partial section.

h:float

The overall height of the full ellipse of which this arc is a partial section.

start:float

The starting angle of the arc in degrees.

extent:float

The angular extent of the arc in degrees.

type:int

The closure type for the arc: OPEN, CHORD, or PIE.

Method Detail

containsback to summary
public boolean contains(float x, float y)

Implements abstract com.sun.javafx.geom.Shape.contains.

Determines whether or not the specified point is inside the boundary of the arc.

Parameters
x:float

The X coordinate of the point to test.

y:float

The Y coordinate of the point to test.

Returns:boolean

true if the point lies within the bound of the arc, false if the point lies outside of the arc's bounds.

Annotations
@Override
containsback to summary
public boolean contains(float x, float y, float w, float h)

Implements abstract com.sun.javafx.geom.Shape.contains.

Determines whether or not the interior of the arc entirely contains the specified rectangle.

Parameters
x:float

The X coordinate of the rectangle's upper-left corner.

y:float

The Y coordinate of the rectangle's upper-left corner.

w:float

The width of the rectangle.

h:float

The height of the rectangle.

Returns:boolean

true if the arc contains the rectangle, false if the arc doesn't contain the rectangle.

Annotations
@Override
containsAngleback to summary
public boolean containsAngle(float angle)

Determines whether or not the specified angle is within the angular extents of the arc.

Parameters
angle:float

The angle to test.

Returns:boolean

true if the arc contains the angle, false if the arc doesn't contain the angle.

copyback to summary
public Arc2D copy()

Implements abstract com.sun.javafx.geom.Shape.copy.

Doc from com.sun.javafx.geom.Shape.copy.

Returns a new copy of this Shape instance.

Annotations
@Override
equalsback to summary
public boolean equals(Object obj)

Overrides java.lang.Object.equals.

Determines whether or not the specified Object is equal to this Arc2D. The specified Object is equal to this Arc2D if it is an instance of Arc2D and if its location, size, arc extents and type are the same as this Arc2D.

Parameters
obj:Object

an Object to be compared with this Arc2D.

Returns:boolean

true if obj is an instance of Arc2D and has the same values; false otherwise.

Annotations
@Override
getArcTypeback to summary
public int getArcType()

Returns the arc closure type of the arc: OPEN, CHORD, or PIE.

Returns:int

One of the integer constant closure types defined in this class.

See Also
setArcType
getBoundsback to summary
public RectBounds getBounds()

Overrides com.sun.javafx.geom.RectangularShape.getBounds.

Returns the high-precision framing rectangle of the arc. The framing rectangle contains only the part of this Arc2D that is in between the starting and ending angles and contains the pie wedge, if this Arc2D has a PIE closure type.

This method differs from the getBounds in that the getBounds method only returns the bounds of the enclosing ellipse of this Arc2D without considering the starting and ending angles of this Arc2D.

Returns:RectBounds

the RectBounds that represents the arc's framing rectangle.

Annotations
@Override
getEndPointback to summary
public Point2D getEndPoint()

Returns the ending point of the arc. This point is the intersection of the ray from the center defined by the starting angle plus the angular extent of the arc and the elliptical boundary of the arc.

Returns:Point2D

A Point2D object representing the x,y coordinates of the ending point of the arc.

getHeightback to summary
public float getHeight()

Implements abstract com.sun.javafx.geom.RectangularShape.getHeight.

Doc from com.sun.javafx.geom.RectangularShape.getHeight.

Returns the height of the framing rectangle in double precision.

Annotations
@Override
getPathIteratorback to summary
public PathIterator getPathIterator(BaseTransform tx)

Implements abstract com.sun.javafx.geom.Shape.getPathIterator.

Returns an iteration object that defines the boundary of the arc. This iterator is multithread safe. Arc2D guarantees that modifications to the geometry of the arc do not affect any iterations of that geometry that are already in process.

Parameters
tx:BaseTransform

an optional BaseTransform to be applied to the coordinates as they are returned in the iteration, or null if the untransformed coordinates are desired.

Returns:PathIterator

A PathIterator that defines the arc's boundary.

Annotations
@Override
getStartPointback to summary
public Point2D getStartPoint()

Returns the starting point of the arc. This point is the intersection of the ray from the center defined by the starting angle and the elliptical boundary of the arc.

Returns:Point2D

A Point2D object representing the x,y coordinates of the starting point of the arc.

getWidthback to summary
public float getWidth()

Implements abstract com.sun.javafx.geom.RectangularShape.getWidth.

Doc from com.sun.javafx.geom.RectangularShape.getWidth.

Returns the width of the framing rectangle in double precision.

Annotations
@Override
getXback to summary
public float getX()

Implements abstract com.sun.javafx.geom.RectangularShape.getX.

Doc from com.sun.javafx.geom.RectangularShape.getX.

Returns the X coordinate of the upper-left corner of the framing rectangle in double precision.

Annotations
@Override
getYback to summary
public float getY()

Implements abstract com.sun.javafx.geom.RectangularShape.getY.

Doc from com.sun.javafx.geom.RectangularShape.getY.

Returns the Y coordinate of the upper-left corner of the framing rectangle in double precision.

Annotations
@Override
hashCodeback to summary
public int hashCode()

Overrides java.lang.Object.hashCode.

Returns the hashcode for this Arc2D.

Returns:int

the hashcode for this Arc2D.

Annotations
@Override
intersectsback to summary
public boolean intersects(float x, float y, float w, float h)

Implements abstract com.sun.javafx.geom.Shape.intersects.

Determines whether or not the interior of the arc intersects the interior of the specified rectangle.

Parameters
x:float

The X coordinate of the rectangle's upper-left corner.

y:float

The Y coordinate of the rectangle's upper-left corner.

w:float

The width of the rectangle.

h:float

The height of the rectangle.

Returns:boolean

true if the arc intersects the rectangle, false if the arc doesn't intersect the rectangle.

Annotations
@Override
isEmptyback to summary
public boolean isEmpty()

Implements abstract com.sun.javafx.geom.RectangularShape.isEmpty.

Doc from com.sun.javafx.geom.RectangularShape.isEmpty.

Determines whether the RectangularShape is empty. When the RectangularShape is empty, it encloses no area.

Annotations
@Override
normalizeDegreesback to summary
pack-priv static float normalizeDegrees(double angle)
setAnglesback to summary
public void setAngles(float x1, float y1, float x2, float y2)

Sets the starting angle and angular extent of this arc using two sets of coordinates. The first set of coordinates is used to determine the angle of the starting point relative to the arc's center. The second set of coordinates is used to determine the angle of the end point relative to the arc's center. The arc will always be non-empty and extend counterclockwise from the first point around to the second point.

Parameters
x1:float

The X coordinate of the arc's starting point.

y1:float

The Y coordinate of the arc's starting point.

x2:float

The X coordinate of the arc's ending point.

y2:float

The Y coordinate of the arc's ending point.

setAnglesback to summary
public void setAngles(Point2D p1, Point2D p2)

Sets the starting angle and angular extent of this arc using two points. The first point is used to determine the angle of the starting point relative to the arc's center. The second point is used to determine the angle of the end point relative to the arc's center. The arc will always be non-empty and extend counterclockwise from the first point around to the second point.

Parameters
p1:Point2D

The Point2D that defines the arc's starting point.

p2:Point2D

The Point2D that defines the arc's ending point.

setAngleStartback to summary
public void setAngleStart(Point2D p)

Sets the starting angle of this arc to the angle that the specified point defines relative to the center of this arc. The angular extent of the arc will remain the same.

Parameters
p:Point2D

The Point2D that defines the starting angle.

See Also
start
setArcback to summary
public void setArc(float x, float y, float w, float h, float angSt, float angExt, int closure)
setArcback to summary
public void setArc(Point2D loc, Dimension2D size, float angSt, float angExt, int closure)

Sets the location, size, angular extents, and closure type of this arc to the specified values.

Parameters
loc:Point2D

The Point2D representing the coordinates of the upper-left corner of the arc.

size:Dimension2D

The Dimension2D representing the width and height of the full ellipse of which this arc is a partial section.

angSt:float

The starting angle of the arc in degrees.

angExt:float

The angular extent of the arc in degrees.

closure:int

The closure type for the arc: OPEN, CHORD, or PIE.

setArcback to summary
public void setArc(Arc2D a)

Sets this arc to be the same as the specified arc.

Parameters
a:Arc2D

The Arc2D to use to set the arc's values.

setArcByCenterback to summary
public void setArcByCenter(float x, float y, float radius, float angSt, float angExt, int closure)

Sets the position, bounds, angular extents, and closure type of this arc to the specified values. The arc is defined by a center point and a radius rather than a framing rectangle for the full ellipse.

Parameters
x:float

The X coordinate of the center of the arc.

y:float

The Y coordinate of the center of the arc.

radius:float

The radius of the arc.

angSt:float

The starting angle of the arc in degrees.

angExt:float

The angular extent of the arc in degrees.

closure:int

The closure type for the arc: OPEN, CHORD, or PIE.

setArcByTangentback to summary
public void setArcByTangent(Point2D p1, Point2D p2, Point2D p3, float radius)

Sets the position, bounds, and angular extents of this arc to the specified value. The starting angle of the arc is tangent to the line specified by points (p1, p2), the ending angle is tangent to the line specified by points (p2, p3), and the arc has the specified radius.

Parameters
p1:Point2D

The first point that defines the arc. The starting angle of the arc is tangent to the line specified by points (p1, p2).

p2:Point2D

The second point that defines the arc. The starting angle of the arc is tangent to the line specified by points (p1, p2). The ending angle of the arc is tangent to the line specified by points (p2, p3).

p3:Point2D

The third point that defines the arc. The ending angle of the arc is tangent to the line specified by points (p2, p3).

radius:float

The radius of the arc.

setArcTypeback to summary
public void setArcType(int type)

Sets the closure type of this arc to the specified value: OPEN, CHORD, or PIE.

Parameters
type:int

The integer constant that represents the closure type of this arc: OPEN, CHORD, or PIE.

Exceptions
IllegalArgumentException:
if type is not 0, 1, or 2.+
See Also
getArcType
setFrameback to summary
public void setFrame(float x, float y, float w, float h)

Implements abstract com.sun.javafx.geom.RectangularShape.setFrame.

Doc from com.sun.javafx.geom.RectangularShape.setFrame.

Sets the location and size of the framing rectangle of this Shape to the specified rectangular values. Note that the arc partially inscribes the framing rectangle of this RectangularShape.

Annotations
@Override