Difference between revisions of "Recti"
Jump to navigation
Jump to search
(4 intermediate revisions by the same user not shown) | |||
Line 27: | Line 27: | ||
|height | |height | ||
|Rectangle height (bottom - top) | |Rectangle height (bottom - top) | ||
+ | |- | ||
+ | |size | ||
+ | |The size as a tuple of (width, height) | ||
|- | |- | ||
|valid | |valid | ||
Line 38: | Line 41: | ||
! scope="col" class="unsortable" | Description | ! scope="col" class="unsortable" | Description | ||
|- | |- | ||
− | |Recti(left, top, right | + | |Recti(left, top, right, bottom) |
− | | | + | |The default constructor |
+ | |- | ||
+ | |Recti(left, top, width, height) | ||
+ | |Use arguments names to specify which constructor to use. | ||
|- | |- | ||
|clip(other) | |clip(other) | ||
|Returns a new Recti with this clipped to other | |Returns a new Recti with this clipped to other | ||
+ | |- | ||
+ | |union(other) | ||
+ | |Returns a new Recti with the union of the two | ||
+ | |- | ||
+ | |intersect(other) | ||
+ | |Returns a new Recti with the intersection of the two | ||
+ | |- | ||
+ | |} | ||
+ | |||
+ | === Operators === | ||
+ | |||
+ | {| class="wikitable" | ||
+ | ! scope="col" | Name | ||
+ | ! scope="col" class="unsortable" | Description | ||
+ | |- | ||
+ | |and | ||
+ | |The intersecton | ||
+ | |- | ||
+ | |or | ||
+ | |The union | ||
|- | |- | ||
|} | |} |
Latest revision as of 17:27, 1 December 2016
A Recti is a 2D integer rectangle, usually in pixel coordinates.
Attributes
Name | Description |
---|---|
empty | True if right=left and bottom=top (read-only) |
left | Left edge |
top | Top edge |
right | Right edge |
bottom | Bottom edge |
width | Rectangle width (right - left) |
height | Rectangle height (bottom - top) |
size | The size as a tuple of (width, height) |
valid | True if the rectangle is valid (right>left, bottom>top) (read-only) |
Methods
Name | Description |
---|---|
Recti(left, top, right, bottom) | The default constructor |
Recti(left, top, width, height) | Use arguments names to specify which constructor to use. |
clip(other) | Returns a new Recti with this clipped to other |
union(other) | Returns a new Recti with the union of the two |
intersect(other) | Returns a new Recti with the intersection of the two |
Operators
Name | Description |
---|---|
and | The intersecton |
or | The union |