#include <QuonPRDefs.h>
Definition at line 38 of file QuonPRDefs.h.
Public Member Functions | |
| QPRBoundingBox () | |
| QPRBoundingBox (Vector2D tl, Vector2D br) | |
| QPRBoundingBox (double tlx, double tly, double brx, double bry) | |
| QPRBoundingBox (Vector2D center, double width) | |
| void | resize (double width) |
| bool | collide (const QPRBoundingBox box) const |
| bool | collide (const Vector2D p) const |
| int | getChildNum (const Vector2D p) const |
| QPRBoundingBox | getQuadrant (int i) const |
| Vector2D | shiftCenter (PRDirection direction) const |
Public Attributes | |
| Vector2D | tl |
| Vector2D | br |
| Vector2D | center |
Friends | |
| std::ostream & | operator<< (std::ostream &Stream, const QPRBoundingBox &box) |
| QPRBoundingBox::QPRBoundingBox | ( | ) |
Definition at line 28 of file QuonPRDefs.cc.
00029 { 00030 this->tl = tl; 00031 this->br = br; 00032 center = (tl + br) * 0.5; 00033 }
| QPRBoundingBox::QPRBoundingBox | ( | double | tlx, | |
| double | tly, | |||
| double | brx, | |||
| double | bry | |||
| ) |
| QPRBoundingBox::QPRBoundingBox | ( | Vector2D | center, | |
| double | width | |||
| ) |
| void QPRBoundingBox::resize | ( | double | width | ) |
| bool QPRBoundingBox::collide | ( | const QPRBoundingBox | box | ) | const |
Definition at line 63 of file QuonPRDefs.cc.
Referenced by QuonPR::classifySites(), PRTreeNode::findBindingNeighbor(), and QuonPR::updateThisSite().
00064 { 00065 if(tl.x > box.br.x) { 00066 return false; 00067 } 00068 if(tl.y < box.br.y) { 00069 return false; 00070 } 00071 if(br.x < box.tl.x) { 00072 return false; 00073 } 00074 if(br.y > box.tl.y) { 00075 return false; 00076 } 00077 00078 return true; 00079 }
| bool QPRBoundingBox::collide | ( | const Vector2D | p | ) | const |
| int QPRBoundingBox::getChildNum | ( | const Vector2D | p | ) | const |
Definition at line 91 of file QuonPRDefs.cc.
Referenced by PRTreeNode::add(), PRTreeNode::findBindingNeighbor(), PRTreeNode::getDepth(), and PRTreeNode::remove().
00092 { 00093 int childnum; 00094 if(p.x > center.x) { 00095 if(p.y < center.y) { 00096 childnum = 2; 00097 } 00098 else { 00099 childnum = 1; 00100 } 00101 } 00102 else { 00103 if(p.y < center.y) { 00104 childnum = 3; 00105 } 00106 else { 00107 childnum = 0; 00108 } 00109 } 00110 return childnum; 00111 }
| QPRBoundingBox QPRBoundingBox::getQuadrant | ( | int | i | ) | const |
Definition at line 113 of file QuonPRDefs.cc.
Referenced by PRTreeNode::add(), and PRTreeNode::findBindingNeighbor().
00114 { 00115 Vector2D quadTl = tl; 00116 Vector2D quadBr = center; 00117 double width = center.x - tl.x; 00118 if(i == 1 || i == 2) { 00119 quadTl.x += width; 00120 quadBr.x += width; 00121 } 00122 if(i == 2 || i == 3) { 00123 quadTl.y -= width; 00124 quadBr.y -= width; 00125 } 00126 00127 return QPRBoundingBox(quadTl, quadBr); 00128 }
| Vector2D QPRBoundingBox::shiftCenter | ( | PRDirection | direction | ) | const |
Definition at line 130 of file QuonPRDefs.cc.
Referenced by QuonPR::classifySites(), and PRTreeNode::findBindingNeighbor().
00131 { 00132 Vector2D temp = center; 00133 double width = br.x - tl.x; 00134 switch(direction) { 00135 case NW: 00136 temp.x -= width; 00137 temp.y += width; 00138 break; 00139 case N: 00140 temp.y += width; 00141 break; 00142 case NE: 00143 temp.x += width; 00144 temp.y += width; 00145 break; 00146 case E: 00147 temp.x += width; 00148 break; 00149 case SE: 00150 temp.x += width; 00151 temp.y -= width; 00152 break; 00153 case S: 00154 temp.y -= width; 00155 break; 00156 case SW: 00157 temp.x -= width; 00158 temp.y -= width; 00159 break; 00160 case W: 00161 temp.x -= width; 00162 break; 00163 } 00164 return temp; 00165 }
| std::ostream& operator<< | ( | std::ostream & | Stream, | |
| const QPRBoundingBox & | box | |||
| ) | [friend] |
Definition at line 51 of file QuonPRDefs.h.
Referenced by collide(), getQuadrant(), operator<<(), QPRBoundingBox(), resize(), and shiftCenter().
Definition at line 51 of file QuonPRDefs.h.
Referenced by collide(), operator<<(), QPRBoundingBox(), resize(), and shiftCenter().
Definition at line 51 of file QuonPRDefs.h.
Referenced by getChildNum(), PRTreeNode::getDepth(), getQuadrant(), QPRBoundingBox(), resize(), and shiftCenter().
1.5.5