本文整理汇总了C++中HalfEdge::getProx方法的典型用法代码示例。如果您正苦于以下问题:C++ HalfEdge::getProx方法的具体用法?C++ HalfEdge::getProx怎么用?C++ HalfEdge::getProx使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类HalfEdge
的用法示例。
在下文中一共展示了HalfEdge::getProx方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: adicionaface
void Interface::adicionaface(HalfEdge* e, Face* f)
{
HalfEdge *ori = e;
HalfEdge *ant = NULL;
HalfEdge *nova = NULL;
HalfEdge *first;
bool sai = false;
nova = new HalfEdge();
nova->setFace(f);
nova->setTwin(ori);
ori->setTwin(nova);
nova->setOrigem(ori->getDestino());
f->setOuterComp(nova);
ant = nova;
first = nova;
ori = ori->getProx();
while(true)
{
while(ori->getTwin() != NULL)
{
if(ori == e)
{
sai = true;
break;
}
ori = ori->getTwin()->getProx();
}
if(sai)
break;
nova = new HalfEdge();
nova->setFace(f);
nova->setTwin(ori);
ori->setTwin(nova);
nova->setProx(ant);
ant->setAnt(nova);
nova->setOrigem(ori->getDestino());
ori = ori->getProx();
ant = nova;
}
ori->getTwin()->setProx(ant);
ant->setAnt(ori->getTwin());
}
示例2: writePly
void writePly(Interface& interface) {
QFile file(saveToFileName);
file.open(QIODevice::WriteOnly | QIODevice::Text);
QTextStream out(&file);
QVector<Face *> faces = interface.getFaces();
out << "ply" << "\n";
out << "format ascii 1.0" << "\n";
int vertex_count = interface.getVertices().size();
int faces_count = faces.size();
out << "element vertex " << vertex_count << "\n";
out << "property float x" << "\n";
out << "property float y" << "\n";
out << "element face " << faces_count << "\n";
out << "property list uchar int vertex_index" << "\n";
out << "end_header" << "\n";
QList<Vertex*> points = interface.getVertices().values();
for (int i = 0; i < points.size(); i++) {
QPointF p = points[i]->getPoint();
qDebug() << "adicionando ponto: (" << p.x() << "," << p.y() << ")\n";
//out << i << " ";
out << p.x() << " " << p.y() << "\n";
}
for (int i = 0; i < faces.size(); i++) {
HalfEdge* start = faces.at(i)->getOuterComp();
HalfEdge* aux = start;
//out << i << " ";
qDebug() << "### Face: " << i << "\n";
int vertex_per_face_counter = 0;
QString tempStr;
do {
QTextStream tempStream(&tempStr);
Vertex* vertex = aux->getOrigem();
int index = points.indexOf(vertex);
tempStream << index << " ";
aux = aux->getProx();
vertex_per_face_counter++;
} while (aux != start);
out << vertex_per_face_counter << " " << tempStr << "\n";
}
}
示例3: save
void PlyWritter::save(){
//stream.setString(&caminho);
// stream<<"oi";
// QFile *file=new QFile(caminho);
QFile file(caminho);
if (!file.open(QIODevice::WriteOnly | QIODevice::Text))
exit(15);
QTextStream out(&file);
QString line = "ply\nformat ascii 1.0\nobj_info malha 2D\n";
out<<line;
//QMap<QPair<QPointF,QPointF>, HalfEdge *> & mapHalfEdge = interface->getMap();
QVector<Face *> & vetorFaces = interface->getFaces();
QMap<Vertex *,int> mapPontos= QMap<Vertex *,int>();
for(int i=0;i<vetorFaces.size();i++){
HalfEdge * inicio;
HalfEdge * it;
inicio = vetorFaces.at(i)->getOuterComp();
it=inicio;
do{
mapPontos[it->getOrigem()]=0;
it=it->getProx();
}
while(it!=inicio);
}
out<<"element vertex "<<mapPontos.size()<<"\n";
out<<"property float x\nproperty float y\n";
out<<"element face "<<vetorFaces.size()<<"\n";
out<<"property list uchar int vertex_indices\nend_header\n";
QMapIterator<Vertex *,int> it(mapPontos);
//imprime pontos
int j = 0;
while(it.hasNext()){
Vertex * chave = it.next().key();
out<<chave->getPoint().x()<<" "<<chave->getPoint().y()<<"\n";
mapPontos.insert(chave,j);
//out<<mapPontos[chave]<<"\n";
j++;
}
//imprime faces
for(int i=0;i<vetorFaces.size();i++){
HalfEdge * inicio;
HalfEdge * it;
inicio = vetorFaces.at(i)->getOuterComp();
int j=0;
QVector<int> vetor=QVector<int>();
it=inicio;
do{
vetor.append(mapPontos[it->getOrigem()]);
it=it->getProx();
j++;
}
while(it!=inicio);
out<<j<<" ";
foreach(int value,vetor){
out<<value<<" ";
}
out<<"\n";
vetor.clear();
}
}