Surface* Building::extrude_lod3(double hFloor, double lenHasWin, double lenUnit) const { Surface* bldg = extrude_envelope(); for(int i=0;i<bldg->getNumChildren();++i) { if(bldg->getChild(i)->getType()==SurfaceType::Wall) { Wall* wall = (Wall*)(bldg->getChild(i)); wall->splitFloor(hFloor); double lWall = wall->getLength(); if(lWall>lenHasWin || std::abs(lWall-lenHasWin)<0.001) { for(int j=0;j<wall->getNumChildren();++j) { Floor* floor = (Floor*)(wall->getChild(j)); floor->splitUnit(lenUnit); for(int k=0;k<floor->getNumChildren();++k) { Unit* unit = (Unit*)(floor->getChild(k)); if(j==0 && k%5 == 0 && unit->getLength()>3) { unit->insertDoor(unit->getLength()/3,unit->getHeight()*2/3); continue; } if(unit->getLength()>1) unit->insertWindow(unit->getLength()/3,unit->getHeight()/3); } } } } } return bldg; }