QPBoundingBox Class Reference

#include <QuonPDefs.h>

List of all members.


Detailed Description

QuonP Definitions.

Definition at line 32 of file QuonPDefs.h.


Public Member Functions

 QPBoundingBox ()
 QPBoundingBox (Vector2D tl, Vector2D br)
 QPBoundingBox (double tlx, double tly, double brx, double bry)
 QPBoundingBox (Vector2D center, double width)
void resize (double width)
bool collide (const Vector2D p) const

Public Attributes

Vector2D tl
Vector2D br

Friends

std::ostream & operator<< (std::ostream &Stream, const QPBoundingBox &box)

Constructor & Destructor Documentation

QPBoundingBox::QPBoundingBox (  ) 

Definition at line 26 of file QuonPDefs.cc.

00026 {}

QPBoundingBox::QPBoundingBox ( Vector2D  tl,
Vector2D  br 
)

Definition at line 28 of file QuonPDefs.cc.

00029 {
00030     this->tl = tl;
00031     this->br = br;
00032 }

QPBoundingBox::QPBoundingBox ( double  tlx,
double  tly,
double  brx,
double  bry 
)

Definition at line 34 of file QuonPDefs.cc.

00035 {
00036     tl.x = tlx;
00037     tl.y = tly;
00038     br.x = brx;
00039     br.y = bry;
00040 }

QPBoundingBox::QPBoundingBox ( Vector2D  center,
double  width 
)

Definition at line 42 of file QuonPDefs.cc.

00043 {
00044     width /= 2.0;
00045     tl.x = center.x - width;
00046     tl.y = center.y + width;
00047     br.x = center.x + width;
00048     br.y = center.y - width;
00049 }


Member Function Documentation

void QPBoundingBox::resize ( double  width  ) 

Definition at line 51 of file QuonPDefs.cc.

00052 {
00053     Vector2D center = (tl + br) / 2.0;
00054     width /= 2.0;
00055     tl.x = center.x - width;
00056     tl.y = center.y + width;
00057     br.x = center.x + width;
00058     br.y = center.y - width;
00059 }

bool QPBoundingBox::collide ( const Vector2D  p  )  const

Definition at line 61 of file QuonPDefs.cc.

00062 {
00063     if(p.x > tl.x && p.x < br.x && p.y < tl.y && p.y > br.y) {
00064         return true;
00065     }
00066     return false;
00067 }


Friends And Related Function Documentation

std::ostream& operator<< ( std::ostream &  Stream,
const QPBoundingBox &  box 
) [friend]

Definition at line 69 of file QuonPDefs.cc.

00070 {
00071     return Stream << box.tl << " - " << box.br;
00072 }


Member Data Documentation

Definition at line 41 of file QuonPDefs.h.

Referenced by collide(), operator<<(), QPBoundingBox(), and resize().

Definition at line 41 of file QuonPDefs.h.

Referenced by collide(), operator<<(), QPBoundingBox(), and resize().


The documentation for this class was generated from the following files:

Generated on Wed Mar 25 16:32:54 2009 for OverSim by  doxygen 1.5.5