Main Page   Namespace List   Class Hierarchy   Alphabetical List   Compound List   Namespace Members   Compound Members  

PLMRect Class Reference

Simple 2D rectangle, 16 bits integer coordinates. More...

#include <PLMMath.hpp>

List of all members.

Public Methods

 PLMRect ()
 PLMRect (s16 x, s16 y, u16 width, u16 height)
 PLMRect (PLMPoint p, u16 width, u16 height)
 PLMRect (const PLMRect &r)
PLMRect & operator= (const PLMRect &r)
void Move (s16 x, s16 y)
void Move (const PLMPoint &p)
void RelMove (s16 dx, s16 dy)
void Resize (u16 width, u16 height)
void Set (s16 i, s16 j, u16 width, u16 height)
void Shrink (s16 amount=1)
bool Contains (PLMPoint p) const
bool Contains (s16 x, s16 y) const
bool IsInside (const PLMRect &r) const
bool IsIntersect (const PLMRect &r) const
bool IsEmpty () const
PLMRect Union (const PLMRect &r) const
const PLMRect operator+ (const PLMRect &r) const
PLMRect Intersection (const PLMRect &r) const
const PLMRect operator- (const PLMRect &r) const
void Intersect (const PLMRect &r)
bool operator!= (const PLMRect &r) const

Public Attributes

s16 x
s16 y
u16 w
u16 h

Friends

PLMDLL ostream & operator<< (ostream &os, const PLMRect &r)


Detailed Description

Simple 2D rectangle, 16 bits integer coordinates.


Constructor & Destructor Documentation

PLMRect::PLMRect   [inline]
 

Create an empty rectangle (all values are 0).

PLMRect::PLMRect s16    x,
s16    y,
u16    width,
u16    height
[inline]
 

Create and init a rectangle.

PLMRect::PLMRect PLMPoint    p,
u16    width,
u16    height
 

Create and init a rectangle.

PLMRect::PLMRect const PLMRect &    r [inline]
 

Create a copy of rectangle r.


Member Function Documentation

PLMRect & PLMRect::operator= const PLMRect &    r [inline]
 

Copy attribute values from rectangle r.

void PLMRect::Move s16    x,
s16    y
[inline]
 

Change position to (x, y).

void PLMRect::Move const PLMPoint   p [inline]
 

Change position to p.

void PLMRect::RelMove s16    dx,
s16    dy
[inline]
 

Change position relative to current position (x += dx, y += dy).

void PLMRect::Resize u16    width,
u16    height
[inline]
 

Change current size.

void PLMRect::Set s16    i,
s16    j,
u16    width,
u16    height
[inline]
 

Redefine rectangle (position and size).

void PLMRect::Shrink s16    amount = 1 [inline]
 

Reduce size of amount units each side (use negative value to grow).

bool PLMRect::Contains PLMPoint    p const [inline]
 

Check if the point p is inside the rectangle.

bool PLMRect::Contains s16    x,
s16    y
const [inline]
 

Check if the point (x,\a y) is inside the rectangle.

bool PLMRect::IsInside const PLMRect &    r const [inline]
 

Check if this rectangle is completely inside rectangle r.

bool PLMRect::IsIntersect const PLMRect &    r const
 

Check if this rectangle and r intersect.

bool PLMRect::IsEmpty   [inline]
 

Return true if width or height is 0.

PLMRect PLMRect::Union const PLMRect &    r const
 

Return the union (= max) of two rectangles (this and r).

const PLMRect PLMRect::operator+ const PLMRect &    r const [inline]
 

Same as Union().

PLMRect PLMRect::Intersection const PLMRect &    r const
 

Return the intersection (= min) of two rectangles (this and r).

const PLMRect PLMRect::operator- const PLMRect &    r const [inline]
 

Same as Intersection().

void PLMRect::Intersect const PLMRect &    r
 

Reduce current rectangle by making an intersection with r.

bool PLMRect::operator!= const PLMRect &    r const [inline]
 

Check if r is exactly the same as this.


Friends And Related Function Documentation

PLMDLL ostream& operator<< ostream &    os,
const PLMRect &    r
[friend]
 

Print position and size of rectangle r to out-stream os.


Member Data Documentation

s16 PLMRect::x
 

X position.

s16 PLMRect::y
 

Y position.

u16 PLMRect::w
 

width

u16 PLMRect::h
 

height


The documentation for this class was generated from the following file:
  • PLMMath.hpp

Generated by Doxygen 1.2.18 on Tue Oct 26 12:07:44 2004.