oaArc Class Reference

Inheritance diagram for oaArc:

oaShape oaPinFig oaConnFig oaFig oaBlockObject oaDesignObject oaObject


Public Methods

void getEllipseBBox (oaBox &bBox) const
oaDouble getStartAngle () const
oaDouble getStopAngle () const
void getPoints (oaPointArray &points, oaUInt4 numSegs=10) const
void set (const oaBox &ellipseBBox, oaDouble startAngle, oaDouble stopAngle)
oaLineconvertToLine (oaUInt4 numSides=16)

Static Public Methods

oaArc * create (oaBlock *block, oaLayerNum layerNum, oaPurposeNum purposeNum, const oaBox &ellipseBBox, oaDouble startAngle, oaDouble stopAngle)
void calcArc (const oaPoint &p1, const oaPoint &p2, const oaPoint &p3, oaBox &ellipseBBox, oaDouble &startAngle, oaDouble &stopAngle)
void calcArc (const oaBox &ellipseBBox, oaBox &bBox, oaDouble &startAngle, oaDouble &stopAngle)
void calcBBox (const oaBox &ellipseBBox, oaDouble startAngle, oaDouble stopAngle, oaBox &bBox)
void genPoints (const oaBox &ellipseBBox, oaDouble startAngle, oaDouble stopAngle, oaUInt4 numEdges, oaPointArray &boundary)

Detailed Description

The oaArc class implements an arc shape. An arc is a segment on the circumference of an ellipse, and can be defined by three parameters: an ellipse bounding box, a start angle, and a stop angle. The oaArc::create function uses these three input parameters to create and return a pointer to an arc segment.

How Arcs are Specified in OpenAccess

In OpenAccess, arc angles are specified in positive radians, and are defined counterclockwise from a reference line that emanates from the center of the ellipse on which the arc is defined (at the intersection of imaginary x/y axes that pass through the ellipse center point). The positive (right-side) x axis is at 0 radians; the positive (upper) y axis is at pi/2 radians; and the left x axis is at pi radians.

The figures below show two arc segments, each with a sweep angle (stop angle minus start angle) that does not exceed pi radians (180 degrees). Note that the figures also depict a bounding box for each arc segment -- this is a box that fully encloses the arc segment and intersects the arc at its start and stop angles. This arc bounding box, together with the ellipse bounding box, can be input to oaArc::calcArc to obtain the arc start and stop angles for input to the oaArc::create function. Also, oaArc::calcBBox will return the arc bounding box when passed the ellipse bounding box and the arc start and stop angles.

Any arc sweep angle generated from calcArc is equal to or less than pi radians (equal to or less than 180 degrees). This is to avoid ambiguity in the interpretation of the calcArc arguments. However, the start angle and stop angles supplied to oaArc::create can have any values, positive, negative, or zero. These angles are normalized to [0,2pi). The start and stop angles cannot be equivalent (zero length arcs are not allowed).

arcs.gif


Member Function Documentation

void oaArc::calcArc const oaBox &    ellipseBBox,
oaBox &    bBox,
oaDouble &    startAngle,
oaDouble &    stopAngle
[static]
 

This utility function takes the specified ellipse bounding box and arc bounding box as input parameters and fills in the startAngle and stopAngle parameters (these latter two parameters along with the ellipseBBox are needed to create an arc with oaArc::create).

The input parameters are checked to verify that they represent a valid arc.

The arc sweep angle, which is the stop angle minus the start angle, generated from this function is equal to or less than pi radians (equal to or less than 180 degrees). This is to avoid ambiguity in the interpretation of the calcArc arguments.

Parameters:
ellipseBBox Ellipse bounding box.
bBox Arc bounding box, which can be a minimum or larger arc bounding box as long as it intersects the arc at its ellipse start and stop angles; OpenAccess will trim the box to its minimum size.
startAngle Returned starting angle of the arc in radians.
stopAngle Returned stopping angle of the arc in radians.
Exceptions:
oacArcWrongNumIntercepts 

void oaArc::calcArc const oaPoint &    p1,
const oaPoint &    p2,
const oaPoint &    p3,
oaBox &    ellipseBBox,
oaDouble &    startAngle,
oaDouble &    stopAngle
[static]
 

This utility function converts input points, p1, p2, and p3 into return parameters, ellipseBBox, startAngle, and stopAngle. The returned values are needed to create an arc with oaArc::create. OpenAccess verifies that the three input points represent a valid arc.

The order in which the points are supplied is not relevant. OpenAccess determines the appropriate return parameters based on the rules for arc sweep angles. Refer to How Arcs are Specified in OpenAccess for more information.

The arc sweep angle, which is the stop angle minus the start angle, generated from this function is equal to or less than pi radians (equal to or less than 180 degrees). This is to avoid ambiguity in the interpretation of the calcArc arguments.

Parameters:
p1 Location of the first oaPoint on the arc.
p2 Location of the second oaPoint on the arc.
p3 Location of the third oaPoint on the arc.
ellipseBBox Returned ellipse bounding box.
startAngle Returned starting angle of the arc in radians.
stopAngle Returned ending angle of the arc in radians.
Exceptions:
oacArcPointsColinear 
oacArcTooLarge 

void oaArc::calcBBox const oaBox &    ellipseBBox,
oaDouble    startAngle,
oaDouble    stopAngle,
oaBox &    bBox
[static]
 

This utility function calculates and returns the bBox of an arc (the arc bounding box) based on the specified ellipseBBox, startAngle and stopAngle parameters. The input parameters are checked to verify they represent a valid arc.

Parameters:
ellipseBBox Ellipse bounding box.
startAngle Starting angle of the arc in radians.
stopAngle Ending angle of the arc in radians.
bBox Returned arc bounding box; OpenAccess trims the box to its minimum size.

oaLine * oaArc::convertToLine oaUInt4    numSides = 16
 

This function converts this arc to an oaLine using the specified number of sides.

Parameters:
numSides Number of segments used to represent the arc as a line, which must be at least two; the default number of sides is 16.
Exceptions:
oacArcNumSidesInvalid 

oaArc * oaArc::create oaBlock *    block,
oaLayerNum    layerNum,
oaPurposeNum    purposeNum,
const oaBox &    ellipseBBox,
oaDouble    startAngle,
oaDouble    stopAngle
[static]
 

This function creates an arc in the specified block with the specified layer/purpose pair using the specified ellipseBBox, startAngle, and endAngle parameters. The latter three parameters are checked to verify that they represent a valid arc.

Note that the ellipseBBox cannot be arealess. The start angle and stop angle can have any values, positive, negative, or zero. These angles are normalized to [0,2pi). The start and stop angles cannot be equivalent (zero length arcs are not allowed).

Parameters:
block Pointer to the block in which the arc will be created.
layerNum Layer number for the arc.
purposeNum Purpose number for the arc.
ellipseBBox Ellipse bounding box for the arc.
startAngle Starting angle of the arc in radians.
stopAngle Ending angle of the arc in radians.
Exceptions:
oacArcEllipseBBoxInvalid 
oacArcAnglesInvalid 

void oaArc::genPoints const oaBox &    ellipseBBox,
oaDouble    startAngle,
oaDouble    stopAngle,
oaUInt4    numEdges,
oaPointArray &    points
[static]
 

This function calculates and returns a point array in points that delineates the arc specified by the ellipseBBox, startAngle, and stopAngle parameters. The number of edges delineated by the point array are specified by numEdges. The point array delineates the arc by representing it as a sequence of points connecting virtual line segments that approximate the arc.

See oaArc::getPoints for a function that generates and returns a point array that delineates an existing oaArc object.

Parameters:
ellipseBBox Ellipse bounding box.
startAngle Starting angle of the arc in radians.
stopAngle Ending angle of the arc in radians.
numEdges Number of edges to use to delineate the arc.
points Returned point array that represents the delineated arc.

void oaArc::getEllipseBBox oaBox &    bBox const
 

This function returns the ellipse bounding box associated with this arc.

Parameters:
bBox Returned ellipse bounding box.

void oaArc::getPoints oaPointArray &    points,
oaUInt4    numSegs = 10
const
 

This function returns a point array that delineates this arc. numSegs specifies the number of segments to use to delineate the arc, and determines the number of points returned in the pointArray -- specifically, the returned pointArray will contain numSegs+1 points.

See oaArc::genPoints for a static function that generates and returns a point array that delineates an arc for a specified set of arc parameters.

Parameters:
points Returned series of points delineating a line that represents this arc (returned pointArray will contain numSegs+1 points).
numSegs Number of segments to use to delineate the arc.

oaDouble oaArc::getStartAngle   const
 

This function retrieves the start angle of this arc in radians.

oaDouble oaArc::getStopAngle   const
 

This function retrieves the stop angle of this arc in radians.

void oaArc::set const oaBox &    ellipseBBox,
oaDouble    startAngle,
oaDouble    stopAngle
 

This function resets the ellipse bBox and start/stop angles of this arc to the specified values.

Parameters:
ellipseBBox Ellipse bounding box to set on this arc.
startAngle Start angle to set in radians.
stopAngle Stop angle in radians
Exceptions:
oacArcEllipseBBoxInvalid 
oacArcAnglesInvalid 


The documentation for this class was generated from the following files:

Return to top of page