#include <surface_quad.h>
Inheritance diagram for NLPACS::CQuadBranch:
Public Types | |
enum | { NoChild = 0, LeafChild, BranchChild } |
Public Member Functions | |
void | addVertex (const NLMISC::CVector &v) |
bool | check () const |
CQuadBranch (uint8 level=0) | |
CQuadBranch (const CQuadBranch &branch) | |
virtual NLMISC::CAABBox | getBBox () const |
const IQuadNode * | getChild (uint child) const |
virtual uint8 | getLevel () const |
virtual float | getMaxHeight () const |
virtual float | getMinHeight () const |
bool | isLeaf () const |
CQuadBranch & | operator= (const CQuadBranch &branch) |
void | serial (NLMISC::IStream &f) |
void | setChild (uint child, IQuadNode *node) |
void | translate (const NLMISC::CVector &translation) |
~CQuadBranch () | |
Protected Member Functions | |
void | reduceChildren () |
Protected Attributes | |
IQuadNode * | _Children [4] |
float | _HalfSize |
uint8 | _Level |
float | _MaxHeight |
float | _MaxThickness |
float | _MinHeight |
float | _XCenter |
float | _YCenter |
Friends | |
class | CQuadBranch |
class | CQuadLeaf |
class | CSurfaceQuadTree |
|
Definition at line 108 of file surface_quad.h.
00109 { 00110 NoChild = 0, 00111 LeafChild, 00112 BranchChild 00113 }; |
|
Definition at line 142 of file surface_quad.cpp. Referenced by addVertex(), operator=(), and serial().
00142 : NLPACS::IQuadNode(branch) 00143 { 00144 *this = branch; 00145 } |
|
Definition at line 125 of file surface_quad.h. References _Children, level, uint, and uint8.
|
|
Definition at line 126 of file surface_quad.h. References _Children, and uint.
|
|
Reimplemented from NLPACS::IQuadNode. Definition at line 197 of file surface_quad.cpp. References _Children, NLPACS::IQuadNode::_HalfSize, NLPACS::IQuadNode::_MaxHeight, NLPACS::IQuadNode::_MaxThickness, NLPACS::IQuadNode::_MinHeight, NLPACS::IQuadNode::_XCenter, NLPACS::IQuadNode::_YCenter, NLPACS::IQuadNode::addVertex(), CQuadBranch(), NLPACS::IQuadNode::CQuadLeaf, uint, and v.
00198 { 00199 IQuadNode::addVertex(v); 00200 uint child; 00201 if (v.x > _XCenter) 00202 child = (v.y > _YCenter) ? 2 : 1; 00203 else 00204 child = (v.y > _YCenter) ? 3 : 0; 00205 00206 if (_Children[child] == NULL) 00207 { 00208 if (_Level == 2) 00209 { 00210 _Children[child] = new CQuadLeaf(_Level-1); 00211 } 00212 else 00213 { 00214 _Children[child] = new CQuadBranch(_Level-1); 00215 } 00216 00217 _Children[child]->_MaxThickness = _MaxThickness; 00218 _Children[child]->_HalfSize = _HalfSize/2.0f; 00219 _Children[child]->_MinHeight = FLT_MAX; 00220 _Children[child]->_MaxHeight = -FLT_MAX; 00221 _Children[child]->_XCenter = _XCenter+_Children[child]->_HalfSize*((child == 1 || child == 2) ? 1.0f : -1.0f); 00222 _Children[child]->_YCenter = _YCenter+_Children[child]->_HalfSize*((child == 2 || child == 3) ? 1.0f : -1.0f); 00223 } 00224 00225 _Children[child]->addVertex(v); 00226 } |
|
Reimplemented from NLPACS::IQuadNode. Definition at line 228 of file surface_quad.cpp. References _Children, NLPACS::IQuadNode::check(), and uint.
|
|
Definition at line 62 of file surface_quad.h. References NLPACS::IQuadNode::_HalfSize, NLPACS::IQuadNode::_XCenter, NLPACS::IQuadNode::_YCenter, NLMISC::CAABBox::setCenter(), and NLMISC::CAABBox::setHalfSize(). Referenced by NLPACS::CSurfaceQuadTree::getInterpZ(), and NLPACS::CSurfaceQuadTree::getLeaf().
00063 { 00064 NLMISC::CAABBox bbox; 00065 bbox.setCenter(NLMISC::CVector(_XCenter, _YCenter, 0.0f)); 00066 bbox.setHalfSize(NLMISC::CVector(_HalfSize, _HalfSize, 10000.0f)); 00067 return bbox; 00068 } |
|
Implements NLPACS::IQuadNode. Definition at line 129 of file surface_quad.h. References _Children, nlerror, and uint.
|
|
Definition at line 55 of file surface_quad.h. References uint8.
00055 { return _Level; } |
|
Definition at line 54 of file surface_quad.h. References NLPACS::IQuadNode::_MaxHeight. Referenced by NLPACS::CSurfaceQuadTree::compile(), NLPACS::CLocalRetriever::getHeight(), and reduceChildren().
00054 { return _MaxHeight; } |
|
Definition at line 53 of file surface_quad.h. References NLPACS::IQuadNode::_MinHeight. Referenced by NLPACS::CSurfaceQuadTree::compile(), NLPACS::CLocalRetriever::getHeight(), and reduceChildren().
00053 { return _MinHeight; } |
|
Implements NLPACS::IQuadNode. Definition at line 128 of file surface_quad.h.
00128 { return false; } |
|
Definition at line 147 of file surface_quad.cpp. References _Children, CQuadBranch(), NLPACS::IQuadNode::CQuadLeaf, NLPACS::IQuadNode::isLeaf(), and uint.
00148 { 00149 IQuadNode::operator=(branch); 00150 00151 uint child; 00152 for (child=0; child<4; ++child) 00153 { 00154 _Children[child] = NULL; 00155 if (branch._Children[child] != NULL) 00156 { 00157 if (branch._Children[child]->isLeaf()) 00158 { 00159 CQuadLeaf *newLeaf = new CQuadLeaf(); 00160 *newLeaf = *((CQuadLeaf *)(branch._Children[child])); 00161 _Children[child] = newLeaf; 00162 } 00163 else 00164 { 00165 CQuadBranch *newBranch = new CQuadBranch(); 00166 *newBranch = *((CQuadBranch *)(branch._Children[child])); 00167 _Children[child] = newBranch; 00168 } 00169 } 00170 } 00171 return *this; 00172 } |
|
Definition at line 174 of file surface_quad.cpp. References _Children, NLPACS::IQuadNode::CQuadLeaf, NLPACS::IQuadNode::getMaxHeight(), NLPACS::IQuadNode::getMinHeight(), NLPACS::IQuadNode::isLeaf(), and uint.
00175 { 00176 uint i; 00177 00178 for (i=0; i<4; ++i) 00179 { 00180 if (_Children[i] != NULL && 00181 !_Children[i]->isLeaf() && 00182 _Children[i]->getMaxHeight()-_Children[i]->getMinHeight() <= _MaxThickness) 00183 { 00184 CQuadLeaf *leaf = new CQuadLeaf(); 00185 *((IQuadNode *)leaf) = *_Children[i]; 00186 delete _Children[i]; 00187 _Children[i] = leaf; 00188 } 00189 else if (_Children[i] != NULL && 00190 !_Children[i]->isLeaf()) 00191 { 00192 ((CQuadBranch *)_Children[i])->reduceChildren(); 00193 } 00194 } 00195 } |
|
Reimplemented from NLPACS::IQuadNode. Definition at line 246 of file surface_quad.cpp. References _Children, BranchChild, CQuadBranch(), NLPACS::IQuadNode::CQuadLeaf, NLPACS::IQuadNode::isLeaf(), NLMISC::IStream::isReading(), LeafChild, nlerror, NoChild, NLPACS::CQuadLeaf::serial(), NLMISC::IStream::serial(), uint, and uint8. Referenced by NLPACS::CSurfaceQuadTree::serial().
00247 { 00248 IQuadNode::serial(f); 00249 00250 uint child; 00251 for (child=0; child<4; ++child) 00252 { 00253 uint8 childType = 0; 00254 00255 if (f.isReading()) 00256 { 00257 CQuadLeaf *leaf; 00258 CQuadBranch *branch; 00259 f.serial(childType); 00260 switch (childType) 00261 { 00262 case NoChild: 00263 _Children[child] = NULL; 00264 break; 00265 case LeafChild: 00266 leaf = new CQuadLeaf(); 00267 _Children[child] = leaf; 00268 leaf->serial(f); 00269 break; 00270 case BranchChild: 00271 branch = new CQuadBranch();; 00272 _Children[child] = branch; 00273 branch->serial(f); 00274 break; 00275 default: 00276 nlerror("While serializing (read) CQuadBranch: unknown child type"); 00277 break; 00278 } 00279 } 00280 else 00281 { 00282 if (_Children[child] == NULL) 00283 { 00284 childType = NoChild; 00285 f.serial(childType); 00286 } 00287 else 00288 { 00289 childType = (_Children[child]->isLeaf()) ? LeafChild : BranchChild; 00290 f.serial(childType); 00291 _Children[child]->serial(f); 00292 } 00293 } 00294 } 00295 } |
|
Definition at line 134 of file surface_quad.h. References _Children, nlerror, and uint.
|
|
Reimplemented from NLPACS::IQuadNode. Definition at line 142 of file surface_quad.h. References _Children, NLPACS::IQuadNode::translate(), and uint.
|
|
Definition at line 43 of file surface_quad.h. |
|
Definition at line 42 of file surface_quad.h. Referenced by addVertex(), operator=(), reduceChildren(), and serial(). |
|
Reimplemented from NLPACS::IQuadNode. Definition at line 119 of file surface_quad.h. |
|
Definition at line 116 of file surface_quad.h. Referenced by addVertex(), check(), CQuadBranch(), getChild(), operator=(), reduceChildren(), serial(), setChild(), translate(), and ~CQuadBranch(). |
|
Definition at line 48 of file surface_quad.h. Referenced by addVertex(), NLPACS::CSurfaceQuadTree::addVertex(), NLPACS::IQuadNode::getBBox(), and NLPACS::IQuadNode::serial(). |
|
Definition at line 47 of file surface_quad.h. |
|
Definition at line 44 of file surface_quad.h. Referenced by NLPACS::IQuadNode::addVertex(), addVertex(), NLPACS::CSurfaceQuadTree::addVertex(), NLPACS::IQuadNode::check(), NLPACS::IQuadNode::getMaxHeight(), NLPACS::IQuadNode::serial(), and NLPACS::IQuadNode::translate(). |
|
Definition at line 46 of file surface_quad.h. Referenced by addVertex(), NLPACS::CSurfaceQuadTree::addVertex(), and NLPACS::IQuadNode::serial(). |
|
Definition at line 44 of file surface_quad.h. Referenced by NLPACS::IQuadNode::addVertex(), addVertex(), NLPACS::CSurfaceQuadTree::addVertex(), NLPACS::IQuadNode::check(), NLPACS::IQuadNode::getMinHeight(), NLPACS::IQuadNode::serial(), and NLPACS::IQuadNode::translate(). |
|
Definition at line 48 of file surface_quad.h. Referenced by addVertex(), NLPACS::CSurfaceQuadTree::addVertex(), NLPACS::IQuadNode::getBBox(), NLPACS::CSurfaceQuadTree::getInterpZ(), NLPACS::CSurfaceQuadTree::getLeaf(), NLPACS::IQuadNode::serial(), and NLPACS::IQuadNode::translate(). |
|
Definition at line 48 of file surface_quad.h. Referenced by addVertex(), NLPACS::CSurfaceQuadTree::addVertex(), NLPACS::IQuadNode::getBBox(), NLPACS::CSurfaceQuadTree::getInterpZ(), NLPACS::CSurfaceQuadTree::getLeaf(), NLPACS::IQuadNode::serial(), and NLPACS::IQuadNode::translate(). |