oaBox Class Reference


Public Methods

 oaBox ()
 oaBox (oaCoord leftIn, oaCoord bottomIn, oaCoord rightIn, oaCoord topIn)
 oaBox (const oaPoint &lowerLeftIn, const oaPoint &upperRightIn)
 oaBox (const oaPoint &center, const oaUInt4 size)
 oaBox (const oaBox &box, const oaTransform &xform)
oaPointlowerLeft ()
oaPointupperRight ()
oaCoordleft ()
oaCoordbottom ()
oaCoordright ()
oaCoordtop ()
const oaPointlowerLeft () const
const oaPointupperRight () const
oaCoord left () const
oaCoord bottom () const
oaCoord right () const
oaCoord top () const
void set (oaCoord leftIn=INT_MAX, oaCoord bottomIn=INT_MAX, oaCoord rightIn=INT_MIN, oaCoord topIn=INT_MIN)
void set (const oaPoint &lowerLeftIn, const oaPoint &upperRightIn)
void set (const oaPoint &center, const oaUInt4 size)
void set (const oaBox &box, const oaTransform &xform)
oaUInt4 getWidth () const
oaUInt4 getHeight () const
void getCenter (oaPoint &result) const
void getLowerRight (oaPoint &result) const
void getUpperLeft (oaPoint &result) const
oaBoolean hasNoArea () const
oaBoolean isInverted () const
oaBoolean overlaps (const oaBox &box, oaBoolean incEdges=true) const
oaBoolean overlaps (const oaSegment &seg, oaBoolean incEdges=true) const
oaBoolean contains (const oaBox &box, oaBoolean incEdges=true) const
oaBoolean contains (const oaPoint &point, oaBoolean incEdges=true) const
oaDouble distanceFrom2 (const oaPoint &point) const
void fix (oaBox &result) const
void fix ()
void transform (const oaTransform &xform, oaBox &result) const
void transform (const oaTransform &xform)
void transform (const oaPoint &offset, oaBox &result) const
void transform (const oaPoint &offset)
void transform (oaDouble scale, oaDouble angle, oaBox &result) const
void transform (oaDouble scale, oaDouble angle)
void scale (oaFloat scale)
void merge (const oaBox &box, oaBox &result) const
void merge (const oaBox &box)
void merge (const oaPoint &point, oaBox &result) const
void merge (const oaPoint &point)
void intersection (const oaBox &box, oaBox &result) const
void intersection (const oaBox &box)
void makeZero ()
void makeInvertedZero ()
void init ()
void toPoints (oaPoint *points) const
oaBoolean operator== (const oaBox &bBox) const
oaBoolean operator!= (const oaBox &bBox) const

Friends

class oaChecker< oaBox >

Detailed Description

The oaBox utility class implements a two-dimensional rectangular region with integer coordinates. This class is used throughout the database to represent the bounding boxes of objects.

If coordinates are stored in a bounding box such that the left value is greater than the right value, or the bottom value is greater than the top value, then the bounding box is referred to as inverted. Inverted bounding boxes are used to indicate that no valid bounding coordinates are present.

The coordinates are in integer data base units (DBUs) which get mapped to defined distances by settings in the technology data base. See oaTech::getDBUPerUU for more. When the data base units are set to 1000 per micron, the coordinate range for OpenAccess is +/-2.147 meters.


Constructor & Destructor Documentation

oaBox::oaBox   [inline]
 

This function constructs an uninitialized oaBox object. Accessing the coordinates in a box at this point has indeterminate results.

oaBox::oaBox oaCoord    leftIn,
oaCoord    bottomIn,
oaCoord    rightIn,
oaCoord    topIn
[inline]
 

This function constructs a box from individual left, bottom, right, and top side coordinates of the box.

Parameters:
leftIn The left side location of the box
bottomIn The bottom side location of the box
rightIn The right side location of the box
topIn The top right side location of the box

oaBox::oaBox const oaPoint &    lowerLeftIn,
const oaPoint &    upperRightIn
[inline]
 

This function constructs a box from two oaPoint values. The two oaPoint values define the lower-left and upper right corners of the box.

Parameters:
lowerLeftIn The lower-left oaPoint for the box
upperRightIn The upper right oaPoint for the box

oaBox::oaBox const oaPoint &    center,
const oaUInt4    size
[inline]
 

This function constructs a square box centered about the specified oaPoint with each side set to the specified size from the center.

Parameters:
center The oaPoint at which the box is centered
size The spacing from each side to the center of the box

oaBox::oaBox const oaBox &    box,
const oaTransform &    xform
[inline]
 

This function creates a transformed copy of the specified box.

Parameters:
box The box to copy
xform The transform to apply to the copy


Member Function Documentation

oaInt4 oaBox::bottom   const [inline]
 

This function returns the value of the bottom coordinate attribute of this box. This is an accessor function, and you cannot modify the attribute.

oaInt4 & oaBox::bottom   [inline]
 

This function returns a reference to the bottom coordinate attribute of this box. You can change the value of the attribute bottom.

oaBoolean oaBox::contains const oaPoint &    point,
oaBoolean    incEdges = true
const
 

This function returns a boolean value indicating whether the specified point is within or touching the box. The incEdges argument determines if the specified point is considered within this box if the point is on the edge of this box.

Parameters:
point The point to check
incEdges A boolean value that determines if the function returns true if the point touches the edge of this box
Returns:
true if the point is within the box
false if the point is not within the box; if incEdges is set to true, a value of true is also returned if the point is on the edge of the box

oaBoolean oaBox::contains const oaBox &    box,
oaBoolean    incEdges = true
const
 

This function returns a boolean value indicating whether this box completely overlaps the specified box. The incEdges argument determines if the specified box is considered contained in this box if the edges are touching.

Parameters:
box The box to check
incEdges A boolean value that determines if the box is considered contained if the box is fully enclosed but touches the edge of this box
Returns:
true if the boxes overlap
false if the boxes do not overlap; if incEdges is set to true, a value of true is also returned if the box is fully enclosed but touches the edge of this box.

oaDouble oaBox::distanceFrom2 const oaPoint &    point const
 

This function returns the square of the distance from the specified point to the closest point on the boundary of this box.

Note: The result of this function is meaningful only for non-inverted boxes.

Parameters:
point The point to check
Returns:
The square of the distance from the specified point to the closest point on the boundary of this box

void oaBox::fix  
 

This function verifies this box is not inverted by checking that the left coordinate is less than or equal to the right coordinate, and the bottom coordinate is less than or equal to the top coordinate. If the box is inverted, the coordinates are swapped. The original box is modified to reflect the new coordinates.

void oaBox::fix oaBox &    result const
 

This function verifies that this box is not inverted by checking that the left coordinate is less than or equal to the right coordinate, and that the bottom coordinate is less than or equal to the top coordinate. If the box is inverted, the coordinates are swapped and the corrected box is stored in result, which must not be the original box. The original box is not changed.

Parameters:
result The updated version of this box

void oaBox::getCenter oaPoint &    result const [inline]
 

This function calculates the center of this box and stores the resulting point in the specified location.

Parameters:
result The storage location of the oaPoint that represents the center of this box

oaUInt4 oaBox::getHeight   const [inline]
 

This function returns the height of this oaBox.

Note: The result of this function is meaningful only for non-inverted boxes.

void oaBox::getLowerRight oaPoint &    result const [inline]
 

This function calculates the lower right corner of this box and stores the resulting point in the specified location.

Parameters:
result The storage location of the oaPoint that represents the lower-right corner of this box

void oaBox::getUpperLeft oaPoint &    result const [inline]
 

This function calculates the upper-left corner of this box and stores the resulting point in the specified location.

Parameters:
result The storage location of the oaPoint that represents the upper-left corner of this box

oaUInt4 oaBox::getWidth   const [inline]
 

This function returns the width of this oaBox.

Note: The result of this function is meaningful only for non-inverted boxes.

oaBoolean oaBox::hasNoArea   const [inline]
 

This function returns a boolean value indicating whether this box has a zero area. This value is true if either the left and right coordinates are equal, or the bottom and top coordinates are equal.

Returns:
true if this box has a zero area
false if this box has a non-zero area

void oaBox::init   [inline]
 

This function sets the left and bottom coordinates of this bounding box to the extreme positive values and the right and top coordinates to the extreme negative values. This inverted value is useful as an initial condition when you want to merge several boxes.

void oaBox::intersection const oaBox &    box [inline]
 

This function calculates the intersection between this box and the specified box. The result is stored in place of the original. If the boxes do not intersect, the result is an inverted box.

Note: The result of this function is meaningful only for non-inverted boxes.

Parameters:
box The box to check

void oaBox::intersection const oaBox &    box,
oaBox &    result
const
 

This function calculates the intersection between this box and the specified box. The result is stored in the specified location. If the boxes do not intersect, the result is an inverted value.

Note: The result of this function is meaningful only for non-inverted boxes.

Parameters:
box The box to check for an intersection
result The storage location for the resulting box

oaBoolean oaBox::isInverted   const [inline]
 

This function returns a boolean value indicating whether this box has an inverted height or width value.

Returns:
true if this box has either an inverted height or width value
false if both the height and width values are not inverted

oaInt4 oaBox::left   const [inline]
 

This function returns the value of the left coordinate attribute of this box. This is an accessor function, and you cannot modify the attribute.

oaInt4 & oaBox::left   [inline]
 

This function returns a reference to the left coordinate attribute of this box. You can change the value of the attribute left.

const oaPoint & oaBox::lowerLeft   const [inline]
 

This function returns the value of the lower-left point of this box. This is an accessor function, and you cannot modify the attributes.

oaPoint & oaBox::lowerLeft   [inline]
 

This function returns a reference to the lower-left point of this box. You can change the value of the left and bottom attributes.

void oaBox::makeInvertedZero   [inline]
 

This function sets all coordinates of this box to zero if the box was inverted.

void oaBox::makeZero   [inline]
 

This function sets all coordinates of this box to zero.

void oaBox::merge const oaPoint &    point [inline]
 

This function calculates the union of this box with the specified point and stores the result in the original box.

Parameters:
point The oaPoint to merge

void oaBox::merge const oaPoint &    point,
oaBox &    result
const
 

This function calculates the union of this box with the specified point and stores the result in the specified location.

Parameters:
point The oaPoint to merge
result The storage location of the result

void oaBox::merge const oaBox &    box [inline]
 

This function calculates the union of this box with the specified box and stores the result in place of the original box.

Parameters:
box The box to merge

void oaBox::merge const oaBox &    box,
oaBox &    result
const
 

This function calculates the union of this box with the specified box and stores the result in the specified location.

Parameters:
box The box to merge
result The storage location of the merge result

oaBoolean oaBox::operator!= const oaBox &    bBox const [inline]
 

This is the inequality operator for the oaBox class. It compares this box with the specified bBox, and returns true if the boxes are unequal.

oaBoolean oaBox::operator== const oaBox &    bBox const [inline]
 

This is the equality operator for the oaBox class. It compares this box with the specified bBox, and returns true if the boxes are equal.

oaBoolean oaBox::overlaps const oaSegment &    seg,
oaBoolean    incEdges = true
const
 

This function returns a boolean value indicating whether this box overlaps, touches, or contains the specified segment. The argument 'incEdges' specifies whether the segment is considered to overlap this box if it touches the edge.

Returns:
true if this box overlaps the specified segment.

oaBoolean oaBox::overlaps const oaBox &    box,
oaBoolean    incEdges = true
const
 

This function returns a boolean value indicating whether or not this box overlaps or touches the specified box. The argument 'incEdges' specifies whether the box is considered to overlap this box if it touches the edge.

Returns:
true if this box overlaps the specified box.

oaInt4 oaBox::right   const [inline]
 

This function returns the value of the right coordinate attribute of this box. This is an accessor function, and you cannot modify the attribute.

oaInt4 & oaBox::right   [inline]
 

This function returns a reference to the right coordinate attribute of this box. You can change the value of the attribute right.

void oaBox::scale oaFloat    scale
 

This function scales this box, keeping its center the same. The resulting box will be scaled as precisely as it can be presented by integer coordinates. The original box is modified to reflect this change.

Note: The result of this function is valid only for non-inverted boxes.

Parameters:
scale The scale factor by which the box dimensions are multiplied

void oaBox::set const oaBox &    box,
const oaTransform &    xform
[inline]
 

This function sets this box to a transformed copy of the specified box.

Parameters:
box The box to copy
xform The transform to apply to the specified box

void oaBox::set const oaPoint &    center,
const oaUInt4    size
[inline]
 

This function sets this box to a square that is centered about the specified oaPoint with each side set to the specified size from the center.

Parameters:
center The oaPoint at which the box is centered
size The spacing from each side to the center of the box

void oaBox::set const oaPoint &    lowerLeftIn,
const oaPoint &    upperRightIn
[inline]
 

This function sets this box to the specified lower-left and upper-right points.

Parameters:
lowerLeftIn The new lower-left point
upperRightIn The new upper-right point

void oaBox::set oaCoord    leftIn = INT_MAX,
oaCoord    bottomIn = INT_MAX,
oaCoord    rightIn = INT_MIN,
oaCoord    topIn = INT_MIN
[inline]
 

This function sets this box to the specified coordinates. The coordinates specify the left, bottom, right, and top sides of the box. All coordinates have default values that set the left and bottom coordinates to the most extreme positive values, and the right and top coordinates to the most extreme negative values. This is known as an inverted box and can be used to indicate a box that is uninitialized.

Note: The isInverted() function returns true after calling set() without any arguments.

Parameters:
leftIn The new left side coordinate
bottomIn The new bottom side coordinate
rightIn The new right side coordinate
topIn The new top side coordinate

oaInt4 oaBox::top   const [inline]
 

This function returns the value of the top coordinate attribute of this box. This is an accessor function, and you cannot modify the attribute.

oaInt4 & oaBox::top   [inline]
 

This function returns a reference to the top coordinate attribute of this box. You can change the value of the attribute top.

void oaBox::toPoints oaPoint *    points const [inline]
 

This function fills out points with the four points that define this box. It is assumed that points are already allocated and the points are at least four points in length. The points are written in clockwise order starting from the lower left point.

Parameters:
points A pre-allocated array in which the points are stored

void oaBox::transform oaDouble    scale,
oaDouble    angle
[inline]
 

This function transforms this box by the specified scale factor and rotation angle. The angle can be an arbitrary angle, and the result of the transform will be exact if the angle specified is orthogonal. If the angle is non-orthogonal, the resulting transform will be as precise as can possibly be presented by integer coordinates. The original box is modified to reflect this transform.

void oaBox::transform oaDouble    scale,
oaDouble    angle,
oaBox &    result
const
 

This function transforms this box by the specified scale factor and rotation angle and stores the resulting transform in result, which may be the original box. The angle can be an arbitrary angle, and the result of the transform will be exact if the angle specified is orthogonal. If the angle is non-orthogonal, the resulting transform will be as precise as can possibly be presented by integer coordinates.

void oaBox::transform const oaPoint &    offset [inline]
 

This function transforms this box by the specified offset. The original box is modified to reflect this transform.

Parameters:
offset The offset to apply

void oaBox::transform const oaPoint &    offset,
oaBox &    result
const [inline]
 

This function transforms this box by the specified offset and stores the result in the specified location, which may be the original box.

Parameters:
offset The offset to apply
result The storage location for the transformed box

void oaBox::transform const oaTransform &    xform [inline]
 

This function transforms this box by the specified transform. The original box is modified to reflect this transform.

Parameters:
xform The transform to apply

void oaBox::transform const oaTransform &    xform,
oaBox &    result
const
 

This function transforms this box by the specified transform and stores the result in the specified location, which may be the original box.

Parameters:
xform The transform to apply
result The storage location for the transformed box

const oaPoint & oaBox::upperRight   const [inline]
 

This function returns the value of the upper-right point of this box. This is an accessor function, and you cannot modify the attributes.

oaPoint & oaBox::upperRight   [inline]
 

This function returns a reference to the upper-right point of this box. You can change the value of the attributes right and top.


Friends And Related Function Documentation

friend class oaChecker< oaBox > [friend]
 


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

Return to top of page