Struct Rect
2D rectangle
Constructors
Name | Description |
---|---|
this
|
constructs rectangle using left , top , right , bottom coordinates
|
Fields
Name | Type | Description |
---|---|---|
bottom
|
int |
y coordinate of bottom right corner
|
left
|
int |
x coordinate of top left corner
|
right
|
int |
x coordinate of bottom right corner
|
top
|
int |
y coordinate of top left corner
|
Properties
Name | Type | Description |
---|---|---|
bottomRight
[get]
|
Point |
returns bottom right point of rectangle
|
empty
[get]
|
bool |
returns true if rectangle is empty (right <= left || bottom <= top )
|
height
[get]
|
int |
returns height of rectangle (bottom - top )
|
middle
[get]
|
Point |
returns middle point
|
middlex
[get]
|
int |
returns average of left , right
|
middley
[get]
|
int |
returns average of top , bottom
|
topLeft
[get]
|
Point |
returns top left point of rectangle
|
width
[get]
|
int |
returns width of rectangle (right - left )
|
Methods
Name | Description |
---|---|
expand
|
expand rectangle dimensions
|
intersect
|
updates this rect to intersection with rc , returns true if result is non empty
|
intersects
|
returns true if this rect has nonempty intersection with rc
|
isInsideOf
|
this rectangle is completely inside rc
|
isPointInside
|
returns true if point is inside of this rectangle |
moveToFit
|
moves this rect to fit rc bounds, retaining the same size
|
offset
|
add offset to horizontal and vertical coordinates
|
opEquals
|
|
setMax
|
for all fields, sets this.field to rc.field if rc.field > this.field |
shrink
|
shrink rectangle dimensions
|
Aliases
Name | Description |
---|---|
moveBy
|
translate rectangle coordinates by (x,y) - add deltax to x coordinates, and deltay to y coordinates |
Authors
Vadim Lopatin, coolreader.org@gmail.com
Copyright
Vadim Lopatin, 2014
License
Boost License 1.0