oaPointArray Class Reference
Inheritance diagram for oaPointArray:
 |
|
Public Methods |
| oaPointArray (oaUInt4 sizeIn=0) |
| oaPointArray (const oaPointArray &pointsIn) |
| oaPointArray (const oaPointArray &pointsIn, const oaTransform &xform) |
| oaPointArray (const oaPointArray &pointsIn, const oaPoint &offset) |
| oaPointArray (const oaPoint pointsIn[], oaUInt4 numPointsIn) |
| oaPointArray (const oaBox &rectIn) |
oaBoolean | isSelfIntersecting (oaBoolean isClosed=true) const |
oaBoolean | isOrthogonal (oaBoolean isClosed=true) const |
oaBoolean | isRectangle () const |
oaBoolean | onEdge (const oaPoint &point, oaBoolean isClosed=true) const |
oaBoolean | contains (const oaPoint &point, oaBoolean includeEdges=true) const |
oaBoolean | contains (const oaBox &box) const |
oaBoolean | overlaps (const oaBox &box, oaBoolean closed=true) const |
oaDouble | distanceFrom2 (const oaPoint &point) const |
oaDouble | getArea () const |
oaBoolean | hasExtraPoints (oaBoolean isClosed=true) const |
void | compress (oaPointArray &pointsOut, oaBoolean isClosed=true) const |
void | compress (oaBoolean isClosed=true) |
void | transform (const oaTransform &xform, oaPointArray &result) const |
void | transform (const oaTransform &xform) |
void | transform (const oaPoint &offset, oaPointArray &result) const |
void | transform (const oaPoint &offset) |
void | transform (oaDouble scale, oaDouble angle, oaPointArray &result) const |
void | transform (oaDouble scale, oaDouble angle) |
void | getBBox (oaBox &bBox) const |
Friends |
class | oaUndoData |
Detailed Description
The oaPointArray class represents an array of two-dimensional integer points. These are used in the API to specify a number of figures such as oaPolygons and oaPaths. See oaPolygon::create for an example.
PointArrays can be used either to indicate a closed figure, such as a polygon, or an open set of points such as a line. When used to describe a closed figure, the connection between the first and last point is always implicit. In such usage it is an error to have the first and last point be the same. Some member functions of oaPointArray have an isClosed flag to indicate whether the array is intended to describe a closed figure or an open line. Many functions that use PointArrays only apply to closed figures, and a flag is not needed for these functions.
PointArrays used as arguments to member functions of oaFig classes should always be well-formed such that they do not contain duplicate or collinear points. oaPointArray::compress() can be used to remove such points from the array.
Like all oaArray classes, oaPointArrays have separate counts for their allocated size and for the number of elements currently in use. For good performance be sure to avoid small incremental allocations as elements are added to an array.
Constructor & Destructor Documentation
oaPointArray::oaPointArray |
( |
oaUInt4 |
sizeIn = 0 |
) |
[inline] |
|
|
This function constructs an oaPointArray object and allocates storage for as many points as specified by numPoints. |
oaPointArray::oaPointArray |
( |
const oaPointArray & |
pointArray |
) |
[inline] |
|
|
This function constructs an oaPointArray object, creating a copy of the specified pointArray. |
oaPointArray::oaPointArray |
( |
const oaPointArray & |
pointArray, |
|
|
const oaTransform & |
xform |
|
) |
[inline] |
|
|
This function constructs an oaPointArray object, creating a copy of the specified pointArray after it is transformed using the specified xform oaTransform. |
oaPointArray::oaPointArray |
( |
const oaPointArray & |
pointArray, |
|
|
const oaPoint & |
offset |
|
) |
[inline] |
|
|
This function constructs an oaPointArray object, creating a copy of the specified pointArray, and applying an offset contained in the specified oaPoint object. |
oaPointArray::oaPointArray |
( |
const oaPoint |
pointsIn[], |
|
|
oaUInt4 |
numPointsIn |
|
) |
[inline] |
|
|
This function constructs an oaPointArray object by copying in an array of oaPoint. The number of elements in the array is indicated by numPointsIn. |
oaPointArray::oaPointArray |
( |
const oaBox & |
rectIn |
) |
[inline] |
|
|
This oaPointArray constructor function creates an array consisting of the four corners of the specified rectIn rectangle, starting at the lower-left and moving clockwise.
- Parameters:
-
rectIn | oaBox input parameter used for point array construction |
|
Member Function Documentation
void oaPointArray::compress |
( |
oaBoolean |
isClosed = true |
) |
[inline] |
|
|
This function removes all collinear and coincident points from this oaPointArray.
An oaPointArray contains coincident points if two adjacent points are identical. An oaPointArray contains collinear points if three adjacent points lie on the same line. For closed oaPointArrays (isClosed = true), the first and last point are considered adjacent.
The result of this function is not valid for oaPointArrays containing two adjacent edges that overlap. Such oaPointArrays are considered illegal for use in figures.
Note: compress() will produce incorrect results if the edges connected by the points in the point array cross.
- Parameters:
-
isClosed | Specify true if the first and last points in the array should be treated as connected (the figure described by the point array is closed); specify false if the first and last points should be treated as unconnected (the figure described by the point array is open) |
|
void oaPointArray::compress |
( |
oaPointArray & |
pointsOut, |
|
|
oaBoolean |
isClosed = true |
|
) |
const |
|
|
This function returns in pointsOut the point array that is created by removing all collinear and coincident points from this oaPointArray.
The result of this function is not valid for oaPointArrays containing two adjacent edges that overlap. Such oaPointArrays are considered illegal for use in figures.
Note: compress() will produce incorrect results if the edges connected by the points in the point array cross.
- Parameters:
-
pointsOut | a reference to the compressed oaPointArray produced by this function |
isClosed | specify true if the first and last points in the array should be treated as connected (the figure described by the point array is closed); specify false if the first and last points should be treated as unconnected (the figure described by the point array is open) |
|
|
This function returns a boolean indicating whether or not this pointArray, which is assumed to be closed, contains the specified oaBox.
- Parameters:
-
box | the oaBox to test against |
|
|
This function returns a boolean indicating whether or not the specified point is inside or on the edge of this pointArray.
Note: the point array is assumed to be closed--that is, the first and last points in the array are treated as connected.
- Parameters:
-
point | the point to test |
includeEdges | boolean that specifies whether or not points on the edge of the point array are assumed to be contained. |
|
double oaPointArray::distanceFrom2 |
( |
const oaPoint & |
point |
) |
const |
|
|
This function returns the square of the distance from the specified point to the closest point on this oaPointArray.
Note: the point array is assumed to be closed--that is, the first and last points in the array are treated as connected. |
oaDouble oaPointArray::getArea |
( |
|
) |
const |
|
|
This function returns the area in DBUU contained by the oaPointArray. The PointArray is assumed to be closed.
Note: The points in the array can either be a clockwise or a counter-clockwise enclosure. However they must not be self-intersecting. |
void oaPointArray::getBBox |
( |
oaBox & |
bBox |
) |
const |
|
|
This function calculates the bounding box of the points in this oaPointArray. |
|
This function returns true if this pointArray has any collinear or coincident points. Also returns true if isClosed = true (see below) and the last and first points of the array specify the same point.
- Parameters:
-
isClosed | specify true if the first and last points in the array should be treated as connected (the figure described by the point array is closed); specify false if the first and last points should be treated as unconnected (the figure described by the point array is open) |
|
|
This function returns a boolean value that indicates if all of the angles in this oaPointArray are multiples of 90 degrees.
- Parameters:
-
isClosed | specify true if the first and last points in the array should be treated as connected (the figure described by the point array is closed); specify false if the first and last points should be treated as unconnected (the figure described by the point array is open) |
|
oaBoolean oaPointArray::isRectangle |
( |
|
) |
const |
|
|
This function returns true if this oaPointArray describes a rectangle that could be created as an oaRect. Specifically, to return true the point array must have four points after collinear and coincident points have been removed, and those points must be the corners of a rectangle with horizontal and vertical sides. |
|
This function returns a boolean value that indicates if this oaPointArray intersects itself. This does not include self-touching oaPointArrays.
- Parameters:
-
isClosed | specify true if the first and last points in the array should be treated as connected (the figure described by the point array is closed); specify false if the first and last points should be treated as unconnected (the figure described by the point array is open) |
|
|
This function returns a boolean value that indicates if the specified point is on this oaPointArray.
- Parameters:
-
point | the point to look for on this oaPointArray |
isClosed | specify true if the first and last points in the array should be treated as connected (the figure described by the point array is closed); specify false if the first and last points should be treated as unconnected (the figure described by the point array is open) |
|
|
This function returns a boolean value that indicates if the specified box overlaps or touches this oaPointArray.
Note: overlaps() assumes that the points in the array are specified in clockwise order.
- Parameters:
-
box | the oaBox to test against |
closed | indicates whether the pointArray is closed. |
|
|
This function transforms this oaPointArray by the specified scale factor and rotation angle. The points are rotated about the origin. |
void oaPointArray::transform |
( |
oaDouble |
scale, |
|
|
oaDouble |
angle, |
|
|
oaPointArray & |
result |
|
) |
const |
|
|
This function transforms this oaPointArray by the specified scale factor and rotation angle. The points are rotated about the origin. The result is stored in result, which can be the same point. |
void oaPointArray::transform |
( |
const oaPoint & |
offset |
) |
[inline] |
|
|
This function transforms this oaPointArray with the specified offset. |
void oaPointArray::transform |
( |
const oaPoint & |
offset, |
|
|
oaPointArray & |
result |
|
) |
const |
|
|
This function transforms this oaPointArray with the specified offset and stores the result in result, which can be the same oaPointArray. The result is assumed the same size as the pointArray. |
void oaPointArray::transform |
( |
const oaTransform & |
xform |
) |
[inline] |
|
|
This function transforms this oaPointArray with the specified transform. |
void oaPointArray::transform |
( |
const oaTransform & |
xform, |
|
|
oaPointArray & |
result |
|
) |
const |
|
|
This function transforms this oaPointArray with the specified transform and stores the result in result, which can be the same oaPointArray. The result is assumed the same size as the oaPointArray. |
Friends And Related Function Documentation
friend class oaUndoData [friend]
|
|
The documentation for this class was generated from the following files:
Return to top of page
Copyright © 2002 - 2010 Cadence Design Systems, Inc.
All Rights Reserved.