本文整理汇总了C++中WOEdge::setaVertex方法的典型用法代码示例。如果您正苦于以下问题:C++ WOEdge::setaVertex方法的具体用法?C++ WOEdge::setaVertex怎么用?C++ WOEdge::setaVertex使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类WOEdge
的用法示例。
在下文中一共展示了WOEdge::setaVertex方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1:
WShape::WShape(WShape& iBrother)
{
_Id = iBrother.GetId();
_Name = iBrother._Name;
_FrsMaterials = iBrother._FrsMaterials;
_meanEdgeSize = iBrother._meanEdgeSize;
iBrother.bbox(_min, _max);
vector<WVertex *>& vertexList = iBrother.getVertexList();
vector<WVertex *>::iterator v = vertexList.begin(), vend = vertexList.end();
for (; v != vend; ++v) {
//WVertex *newVertex = new WVertex(*(*v));
WVertex *newVertex = (*v)->duplicate();
newVertex->setShape(this);
AddVertex(newVertex);
}
vector<WEdge *>& edgeList = iBrother.getEdgeList();
vector<WEdge *>::iterator e = edgeList.begin(), eend = edgeList.end();
for (; e != eend; ++e) {
//WEdge *newEdge = new WEdge(*(*e));
WEdge *newEdge = (*e)->duplicate();
AddEdge(newEdge);
}
vector<WFace *>& faceList = iBrother.GetFaceList();
vector<WFace *>::iterator f = faceList.begin(), fend = faceList.end();
for (; f != fend; ++f) {
//WFace *newFace = new WFace(*(*f));
WFace *newFace = (*f)->duplicate();
AddFace(newFace);
}
// update all pointed addresses thanks to the newly created objects:
vend = _VertexList.end();
for (v = _VertexList.begin(); v != vend; ++v) {
const vector<WEdge *>& vedgeList = (*v)->GetEdges();
vector<WEdge *> newvedgelist;
unsigned int i;
for (i = 0; i < vedgeList.size(); i++) {
WEdge *current = vedgeList[i];
edgedata *currentvedata = (edgedata *)current->userdata;
newvedgelist.push_back(currentvedata->_copy);
}
(*v)->setEdges(newvedgelist);
}
eend = _EdgeList.end();
for (e = _EdgeList.begin(); e != eend; ++e) {
// update aOedge:
WOEdge *aoEdge = (*e)->GetaOEdge();
aoEdge->setaVertex(((vertexdata *)(aoEdge->GetaVertex()->userdata))->_copy);
aoEdge->setbVertex(((vertexdata *)(aoEdge->GetbVertex()->userdata))->_copy);
if (aoEdge->GetaFace())
aoEdge->setaFace(((facedata *)(aoEdge->GetaFace()->userdata))->_copy);
aoEdge->setbFace(((facedata *)(aoEdge->GetbFace()->userdata))->_copy);
aoEdge->setOwner(((edgedata *)(aoEdge->GetOwner()->userdata))->_copy);
// update bOedge:
WOEdge *boEdge = (*e)->GetbOEdge();
if (boEdge) {
boEdge->setaVertex(((vertexdata *)(boEdge->GetaVertex()->userdata))->_copy);
boEdge->setbVertex(((vertexdata *)(boEdge->GetbVertex()->userdata))->_copy);
if (boEdge->GetaFace())
boEdge->setaFace(((facedata *)(boEdge->GetaFace()->userdata))->_copy);
boEdge->setbFace(((facedata *)(boEdge->GetbFace()->userdata))->_copy);
boEdge->setOwner(((edgedata *)(boEdge->GetOwner()->userdata))->_copy);
}
}
fend = _FaceList.end();
for (f = _FaceList.begin(); f != fend; ++f) {
unsigned int i;
const vector<WOEdge *>& oedgeList = (*f)->getEdgeList();
vector<WOEdge *> newoedgelist;
unsigned int n = oedgeList.size();
for (i = 0; i < n; i++) {
WOEdge *current = oedgeList[i];
oedgedata *currentoedata = (oedgedata *)current->userdata;
newoedgelist.push_back(currentoedata->_copy);
//oedgeList[i] = currentoedata->_copy;
//oedgeList[i] = ((oedgedata *)(oedgeList[i]->userdata))->_copy;
}
(*f)->setEdgeList(newoedgelist);
}
// Free all memory (arghh!)
// Vertex
vend = iBrother.getVertexList().end();
for (v = iBrother.getVertexList().begin(); v != vend; ++v) {
delete (vertexdata *)((*v)->userdata);
(*v)->userdata = NULL;
}
// Edges and OEdges:
eend = iBrother.getEdgeList().end();
for (e = iBrother.getEdgeList().begin(); e != eend; ++e) {
delete (edgedata *)((*e)->userdata);
(*e)->userdata = NULL;
//.........这里部分代码省略.........
示例2: instanciateEdge
WOEdge *WFace::MakeEdge(WVertex *v1, WVertex *v2)
{
// First check whether the same oriented edge already exists or not:
vector<WEdge *>& v1Edges = v1->GetEdges();
for (vector<WEdge*>::iterator it1 = v1Edges.begin(), end = v1Edges.end(); it1 != end; it1++) {
WEdge *we = (*it1);
WOEdge *woea = we->GetaOEdge();
//if ((*it1)->GetbVertex() == v2) {
if ((woea->GetaVertex() == v1) && (woea->GetbVertex() == v2)) {
// The oriented edge already exists
cerr << "Warning: edge " << v1->GetId() << " - " << v2->GetId() << " appears twice, correcting" << endl;
// Adds the edge to the face
//AddEdge((*it1)->GetaOEdge());
AddEdge(woea);
(*it1)->setNumberOfOEdges((*it1)->GetNumberOfOEdges() + 1);
//sets these vertices as border:
v1->setBorder(true);
v2->setBorder(true);
//return (*it1)->GetaOEdge();
return woea;
}
WOEdge *woeb = we->GetbOEdge();
//if ((*it1)->GetbVertex() == v2)
if (woeb && (woeb->GetaVertex() == v1) && (woeb->GetbVertex() == v2)) {
// The oriented edge already exists
cerr << "Warning: edge " << v1->GetId() << " - " << v2->GetId() << " appears twice, correcting" << endl;
// Adds the edge to the face
//AddEdge((*it1)->GetaOEdge());
AddEdge(woeb);
(*it1)->setNumberOfOEdges((*it1)->GetNumberOfOEdges() + 1);
//sets these vertices as border:
v1->setBorder(true);
v2->setBorder(true);
//return (*it1)->GetaOEdge();
return woeb;
}
}
// the oriented edge we're about to build
WOEdge *pOEdge = new WOEdge;
// The edge containing the oriented edge.
WEdge *edge;
// checks whether this edge already exists or not
// If it exists, it points outward v2
bool exist = false;
WOEdge *pInvertEdge = NULL; // The inverted edge if it exists
vector<WEdge *>& v2Edges = v2->GetEdges();
vector<WEdge *>::iterator it;
for (it = v2Edges.begin(); it != v2Edges.end(); it++) {
if ((*it)->GetbVertex() == v1) {
// The invert edge already exists
exist = true;
pInvertEdge = (*it)->GetaOEdge();
break;
}
}
//DEBUG:
if (true == exist) { // The invert edge already exists
// Retrieves the corresponding edge
edge = pInvertEdge->GetOwner();
// Sets the a Face (retrieved from pInvertEdge
pOEdge->setaFace(pInvertEdge->GetbFace());
// Updates the invert edge:
pInvertEdge->setaFace(this);
}
else { // The invert edge does not exist yet
// we must create a new edge
//edge = new WEdge;
edge = instanciateEdge();
// updates the a,b vertex edges list:
v1->AddEdge(edge);
v2->AddEdge(edge);
}
pOEdge->setOwner(edge);
// Add the vertices:
pOEdge->setaVertex(v1);
pOEdge->setbVertex(v2);
// Debug:
if (v1->GetId() == v2->GetId())
cerr << "Warning: edge " << this << " null with vertex " << v1->GetId() << endl;
edge->AddOEdge(pOEdge);
//edge->setNumberOfOEdges(edge->GetNumberOfOEdges() + 1);
// Add this face (the b face)
pOEdge->setbFace(this);
// Adds the edge to the face
AddEdge(pOEdge);
return pOEdge;
//.........这里部分代码省略.........