|
Last change
on this file since 373 was 352, checked in by hugh, 26 years ago |
|
Changhed from Isequence to DPA for managing rectangles and surfaces
|
|
File size:
920 bytes
|
| Line | |
|---|
| 1 | #include "rectangle.h"
|
|---|
| 2 |
|
|---|
| 3 | DDRectangle::DDRectangle ( Coord y1,
|
|---|
| 4 | Coord x1,
|
|---|
| 5 | Coord y2,
|
|---|
| 6 | Coord x2 )
|
|---|
| 7 | {
|
|---|
| 8 | lTop = y1;
|
|---|
| 9 | lLeft = x1;
|
|---|
| 10 | lBottom = y2;
|
|---|
| 11 | lRight = x2;
|
|---|
| 12 | }
|
|---|
| 13 |
|
|---|
| 14 | IBase::Boolean DDRectangle::operator == ( const DDRectangle &aRect ) const
|
|---|
| 15 | {
|
|---|
| 16 | return ( lTop == aRect.lTop && lLeft == aRect.lLeft
|
|---|
| 17 | &&
|
|---|
| 18 | lBottom == aRect.lBottom && lRight == aRect.lRight);
|
|---|
| 19 | }
|
|---|
| 20 | IBase::Boolean DDRectangle::operator != ( const DDRectangle& aRect ) const
|
|---|
| 21 | {
|
|---|
| 22 | return !( *this == aRect );
|
|---|
| 23 | }
|
|---|
| 24 | IBase::Boolean DDRectangle::intersects ( const DDRectangle &aRect ) const
|
|---|
| 25 | {
|
|---|
| 26 | return ( lTop < aRect.lBottom && lLeft<aRect.lRight
|
|---|
| 27 | &&
|
|---|
| 28 | aRect.lTop < lBottom && aRect.lLeft < lRight );
|
|---|
| 29 | }
|
|---|
| 30 |
|
|---|
| 31 | DDRectangle::Coord DDRectangle::width ( ) const
|
|---|
| 32 | {
|
|---|
| 33 | return ( lRight - lLeft);
|
|---|
| 34 | }
|
|---|
| 35 |
|
|---|
| 36 | DDRectangle::Coord DDRectangle::height ( ) const
|
|---|
| 37 | {
|
|---|
| 38 | return ( lBottom - lTop);
|
|---|
| 39 | }
|
|---|
| 40 |
|
|---|
Note:
See
TracBrowser
for help on using the repository browser.