本文整理汇总了C++中ViewEdge::getNature方法的典型用法代码示例。如果您正苦于以下问题:C++ ViewEdge::getNature方法的具体用法?C++ ViewEdge::getNature怎么用?C++ ViewEdge::getNature使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ViewEdge
的用法示例。
在下文中一共展示了ViewEdge::getNature方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: traverse
int ChainSilhouetteIterator::traverse(const AdjacencyIterator& ait)
{
AdjacencyIterator it(ait);
ViewVertex *nextVertex = getVertex();
// we can't get a NULL nextVertex here, it was intercepted before
if (nextVertex->getNature() & Nature::T_VERTEX) {
TVertex *tvertex = (TVertex *)nextVertex;
ViewEdge *mate = (tvertex)->mate(getCurrentEdge());
while (!it.isEnd()) {
ViewEdge *ve = *it;
if (ve == mate) {
result = ve;
return 0;
}
++it;
}
result = 0;
return 0;
}
if (nextVertex->getNature() & Nature::NON_T_VERTEX) {
//soc NonTVertex *nontvertex = (NonTVertex*)nextVertex;
ViewEdge *newEdge(0);
// we'll try to chain the edges by keeping the same nature...
// the preseance order is : SILHOUETTE, BORDER, CREASE, SUGGESTIVE, VALLEY, RIDGE
Nature::EdgeNature natures[6] = {
Nature::SILHOUETTE,
Nature::BORDER,
Nature::CREASE,
Nature::SUGGESTIVE_CONTOUR,
Nature::VALLEY,
Nature::RIDGE
};
for (unsigned int i = 0; i < 6; ++i) {
if (getCurrentEdge()->getNature() & natures[i]) {
int n = 0;
while (!it.isEnd()) {
ViewEdge *ve = *it;
if (ve->getNature() & natures[i]) {
++n;
newEdge = ve;
}
++it;
}
if (n == 1) {
result = newEdge;
}
else {
result = 0;
}
return 0;
}
}
}
result = 0;
return 0;
}
示例2: while
Nature::EdgeNature CurveNatureF1D::operator()(Interface1D& inter) {
ViewEdge* ve = dynamic_cast<ViewEdge*>(&inter);
if (ve)
return ve->getNature();
else{
// we return a nature that contains every
// natures of the viewedges spanned by the chain.
Nature::EdgeNature nat = Nature::NO_FEATURE;
Interface0DIterator it = inter.verticesBegin();
while(!it.isEnd()){
nat |= _func(it);
++it;
}
return nat;
}
}
示例3: NonTVertex
ViewVertex *ViewMap::InsertViewVertex(SVertex *iVertex, vector<ViewEdge*>& newViewEdges)
{
NonTVertex *vva = dynamic_cast<NonTVertex*>(iVertex->viewvertex());
if (vva)
return vva;
// because it is not already a ViewVertex, this SVertex must have only 2 FEdges. The incoming one still belongs
// to ioEdge, the outgoing one now belongs to newVEdge
const vector<FEdge *>& fedges = iVertex->fedges();
if (fedges.size() != 2) {
cerr << "ViewMap warning: Can't split the ViewEdge" << endl;
return NULL;
}
FEdge *fend(NULL), *fbegin(NULL);
for (vector<FEdge *>::const_iterator fe = fedges.begin(), feend = fedges.end(); fe != feend; ++fe) {
if ((*fe)->vertexB() == iVertex) {
fend = (*fe);
}
if ((*fe)->vertexA() == iVertex) {
fbegin = (*fe);
}
if ((fbegin != NULL) && (fend != NULL))
break;
}
ViewEdge *ioEdge = fbegin->viewedge();
ViewShape *vshape = ioEdge->viewShape();
vva = new NonTVertex(iVertex);
// if the ViewEdge is a closed loop, we don't create a new VEdge
if (ioEdge->A() == 0) {
// closed loop
ioEdge->setA(vva);
ioEdge->setB(vva);
// update sshape
vshape->sshape()->RemoveEdgeFromChain(ioEdge->fedgeA());
vshape->sshape()->RemoveEdgeFromChain(ioEdge->fedgeB());
ioEdge->setFEdgeA(fbegin);
ioEdge->setFEdgeB(fend);
// Update FEdges
fend->setNextEdge(NULL);
fbegin->setPreviousEdge(NULL);
// update new View Vertex:
vva->AddOutgoingViewEdge(ioEdge);
vva->AddIncomingViewEdge(ioEdge);
vshape->sshape()->AddChain(ioEdge->fedgeA());
vshape->sshape()->AddChain(ioEdge->fedgeB());
}
else {
// Create new ViewEdge
ViewEdge *newVEdge = new ViewEdge(vva, ioEdge->B(), fbegin, ioEdge->fedgeB(), vshape);
newVEdge->setId(Id(ioEdge->getId().getFirst(), ioEdge->getId().getSecond() + 1));
newVEdge->setNature(ioEdge->getNature());
//newVEdge->UpdateFEdges(); // done in the ViewEdge constructor
// Update old ViewEdge
ioEdge->setB(vva);
ioEdge->setFEdgeB(fend);
// Update FEdges
fend->setNextEdge(NULL);
fbegin->setPreviousEdge(NULL);
// update new View Vertex:
vva->AddOutgoingViewEdge(newVEdge);
vva->AddIncomingViewEdge(ioEdge);
NonTVertex *vvb = dynamic_cast<NonTVertex*>(newVEdge->B());
if (vvb)
vvb->Replace(ioEdge, newVEdge);
// update ViewShape
//vshape->AddEdge(newVEdge);
// update SShape
vshape->sshape()->AddChain(fbegin);
// update ViewMap
//_VEdges.push_back(newVEdge);
newViewEdges.push_back(newVEdge);
}
// update ViewShape
vshape->AddVertex(vva);
// update ViewMap
_VVertices.push_back(vva);
return vva;
}