Represents the far extremeties of another GeometricObject (except for Vector).
It is totally defined by two points. For convenience it also has left, top, right and bottom attributes.
| Parameters : | obj : geometric object
|
|---|
Attributes
| bottom | [scalar] |
| height | [scalar] |
| left | [scalar] |
| p1 | (point-like) Get the bottom-left Point. |
| p2 | (point-like) Get the top-right Point. |
| right | [scalar] |
| top | [scalar] |
| width | [scalar] |
Methods
| __contains__(x) | Searches for x in “itself”. |
| __getitem__(idx) | Get points through index. |
| __len__() | The BoundingBox is made of 2 points so it’s length is 2. |
| intersection(obj) | Return points of intersection if any. |
| rotate(theta[, point, angle]) | Rotate self around pivot point. |
| translate(dx, dy) | Translate self by given amounts on x and y. |
Detailed description
Represents the far extremeties of another GeometricObject (except for Vector).
It is totally defined by two points. For convenience it also has left, top, right and bottom attributes.
| Parameters : | obj : geometric object
|
|---|
Searches for x in “itself”. If we’re talking about a Point or a Vector then this searches within their components (x, y). For everything else it searches within the list of points (vertices).
| Parameters : | x : {point, scalar}
|
|---|---|
| Returns : | out : {True, False}
|
Get points through index.
| Parameters : | idx : scalar
|
|---|---|
| Returns : | out : point
|
The BoundingBox is made of 2 points so it’s length is 2.
Return points of intersection if any.
This method just calls the intersection method on the other objects that have it implemented.
| Parameters : | obj : geometric object
|
|---|---|
| Returns : | ret : {point, None}
|
Rotate self around pivot point.
| Parameters : | theta : scalar
point : {point-like}, optional
angle : {‘degrees’, ‘radians’}, optional
|
|---|
Translate self by given amounts on x and y.
| Parameters : | dx, dy : scalar
|
|---|
| [Arnon1983] | Arnon et al., A Linear Time Algorithm for the Minimum Area Rectangle Enclosing a Convex Polygon” (1983), Computer Science Technical Reports. Paper 382 |
| [WPolygon] | http://en.wikipedia.org/wiki/Polygon |