Пример #1
0
//fill list of edges crossing plane on some z height
void Slice::fillEdgeLayer(){
    QList<Face*> currentLayer;
    Face* currentFace;
    HalfEdge* currentEdge;
    for(int i=0; i<this->triLayer.size(); i++){
        currentLayer=*this->triLayer.at(i);
        //take first face from list
        if(currentLayer.size()>0){
            while(currentLayer.size()>0){
                currentFace=currentLayer.takeFirst();
                currentEdge=currentFace->getEdgesCrossingPlane(this->layerHeight*i).at(0);
                //create list for firts edge loop
                this->edgeLayer.at(i)->append(new QList<HalfEdge*>);
                this->pointLayer.at(i)->append(new QList<QVector3D>);
                this->edgeLayer.at(i)->last()->append(currentEdge);
                //while all faces are processed
                do{
                    currentLayer.removeAt(currentLayer.indexOf(currentFace));
                    //take his twin
                    currentEdge=currentEdge->getTwin();
                    currentFace=currentEdge->getFaces().at(0);
                    //qDebug() << currentFace->getNeighbors().size();
                    if(currentFace->getEdgesCrossingPlane(this->layerHeight*i,currentEdge).size()!=1){
                        //qDebug() << "dupa" <<currentFace->getEdgesCrossingPlane(this->layerHeight*i,currentEdge).size();
                    }
                    currentEdge=currentFace->getEdgesCrossingPlane(this->layerHeight*i,currentEdge).first();
                    this->edgeLayer.at(i)->last()->append(currentEdge);
                }while(currentLayer.contains(currentFace));
            }
        }
    }
}