本文整理汇总了C++中QuadTree::pushQuadTree方法的典型用法代码示例。如果您正苦于以下问题:C++ QuadTree::pushQuadTree方法的具体用法?C++ QuadTree::pushQuadTree怎么用?C++ QuadTree::pushQuadTree使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QuadTree
的用法示例。
在下文中一共展示了QuadTree::pushQuadTree方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: init
//======================================================================
void LOSManager::init(){
string shpFileName = "sdo_building.shp";
string dbfFileName = "sdo_building.dbf";
// ファイルを読み込んで建造物の形状データを作成
_readFiles(shpFileName, dbfFileName);
// ルートとなる四分木
QuadTree* qt = new QuadTree(0,0);
qt->set(_adfMinBounds[0], _adfMaxBounds[0],
_adfMinBounds[1], _adfMaxBounds[1]);
GeoManager::addTree(qt);
// ポリゴンを四分木に登録
for (int i=0; i<_numPolygons; i++) {
qt->pushQuadTree(GeoManager::polygon(i), i, 0, GeoManager::trees());
}
}
示例2: calcVehicleLOS
//======================================================================
void LOSManager::calcVehicleLOS(vector<Vehicle*>* vehicles){
// これまでの車体用四分木を消去
GeoManager::deleteVTrees();
for (int i=0; i<MAX_VEHICLES*MAX_VEHICLES; i++) {
_los[i] = 0;
}
QuadTree* vqt = new QuadTree();
vqt->set(_adfMinBounds[0], _adfMaxBounds[0],
_adfMinBounds[1], _adfMaxBounds[1]);
GeoManager::addVTree(vqt);
vector<Vehicle*>::iterator itv;
int id = 0;
int numVehiclePolygons = 0;
for (itv=vehicles->begin(); itv!=vehicles->end(); itv++) {
int matesId = atoi((*itv)->id().c_str());
LOSVehicle* vehicle = GeoManager::vehicle(id);
VehicleWall* vehicleBody = GeoManager::vehicleWall(id);
_idMap.insert(map<int,int>::value_type(matesId, id));
vehicle->setAttribute(id, (*itv)->x(), (*itv)->y(), (*itv)->z(),
(*itv)->bodyLength(),
(*itv)->bodyWidth(),
(*itv)->bodyHeight());
// 車体を直方体と見たときの8頂点
// 車体中心を原点とみなしたとき
MyVector3D p,v1,v2,v3,v4,v5,v6,v7,v8;
p.set((*itv)->x(), (*itv)->y(), (*itv)->z());
v1.set(-vehicle->length()*0.5,
-vehicle->width()*0.5,
0);
v2.set( vehicle->length()*0.5,
-vehicle->width()*0.5,
0);
v3.set( vehicle->length()*0.5,
vehicle->width()*0.5,
0);
v4.set(-vehicle->length()*0.5,
vehicle->width()*0.5,
0);
v5.set(-vehicle->length()*0.5,
-vehicle->width()*0.5,
vehicle->height());
v6.set( vehicle->length()*0.5,
-vehicle->width()*0.5,
vehicle->height());
v7.set( vehicle->length()*0.5,
vehicle->width()*0.5,
vehicle->height());
v8.set(-vehicle->length()*0.5,
vehicle->width()*0.5,
vehicle->height());
// 壁面の作成
vehicleBody->setPolygon(0,p+v1, p+v5, p+v2);
vehicleBody->setPolygon(1,v2+p, v6+p, v5+p);
vehicleBody->setPolygon(2,v2+p, v3+p, v6+p);
vehicleBody->setPolygon(3,v3+p, v7+p, v6+p);
vehicleBody->setPolygon(4,v3+p, v4+p, v7+p);
vehicleBody->setPolygon(5,v4+p, v8+p, v7+p);
vehicleBody->setPolygon(6,v4+p, v1+p, v8+p);
vehicleBody->setPolygon(7,v1+p, v5+p, v8+p);
vehicleBody->setPolygon(8,v5+p, v6+p, v7+p);
vehicleBody->setPolygon(9,v5+p, v8+p, v7+p);
for (int i=0; i<10; i++) {
GeoManager::vehiclePolygon(numVehiclePolygons)->setTriangle
(vehicleBody->wall(i).getVector(0),
vehicleBody->wall(i).getVector(1),
vehicleBody->wall(i).getVector(2));
vqt->pushQuadTree(GeoManager::vehiclePolygon(numVehiclePolygons),
id*10+i, 0, GeoManager::vtrees());
numVehiclePolygons++;
/*
cout << "wall:" << i << endl;
for (int j=0; j<3; j++) {
cout << "vector:" << j << "-";
cout << vehicleBody->wall(i).getVector(j).getX() << ","
<< vehicleBody->wall(i).getVector(j).getY() << ","
<< vehicleBody->wall(i).getVector(j).getZ() << endl;
}
*/
}
id++;
}
_numVehicles = id;
GeoManager::setNumVehicles(_numVehicles);
GeoManager::setNumVehiclePolygons(numVehiclePolygons);
//cout << "#vehicles = " << _numVehicles << endl;
for (int t = 0; t<_numVehicles; t++) {
for (int r=t+1; r<_numVehicles; r++) {
LOSVehicle* vt = GeoManager::vehicle(t);
LOSVehicle* vr = GeoManager::vehicle(r);
#ifdef COLLISION_DEBUG
cout << "TRANSMIT:" << vt->id()
<< " RECEIVE:" << vr->id() << endl;
#endif //COLLISION_DEBUG
//.........这里部分代码省略.........