Edge * splitFace(Face *fl, Vertex *v1, Vertex *v2) {

	Face *fr = new Face();

	//cout << "  split vertices: " << v1->p << "-" << v2->p << endl;
	Edge *a = v1->getEdge();
	Edge *b = v2->getEdge();
	Edge *c = Edge::makeEdge(v1, v2, fl, fr);

	while (a->Left() != fl) { a = a->Onext(); }
	while (b->Left() != fl) { b = b->Onext(); }

	Edge::splice(a, c);
	Edge::splice(b, c->Sym());

	Edge *cIter = c->Lnext();
	while (cIter != c) {
		cIter->setLeft(fl);
		cIter = cIter->Lnext();
	}
	cIter = c->Rnext();
	while (cIter != c) {
		cIter->setRight(fr);
		cIter = cIter->Rnext();
	}

	return c;
}
int getFaceOrder(Edge *e, vector<Vertex>& pts) {
	int count = 1;
	Edge *iter = e->Lnext();

	if (iter->Left() == NULL) {
		return -1;
	}
	if (iter == NULL) {
		cout << "Erro: ponteiro next == NULL\n";
		return -1;
	}

	pts.clear();
	pts.push_back(*e->Orig());

	while (iter != e && count < 100) {
		count++;
		pts.push_back(*iter->Orig());
		iter = iter->Lnext();
	}

	if (count == 100) {
		cout << "Erro: loop infinito\n";
		return -1;
	}

	return count;
}
Example #3
0
Edge *Cell::getOrbitLeft(Edge *edge, Face *left) {
    assert(edge != 0);
    assert(left != 0);

    // traverse the Onext orbit of _edge_ looking for an edge whose left face is
    // _left
    Edge *scan = edge;

    do {
        if (scan->Left() == left) {
            return scan;
        }

        scan = scan->Onext();
    } while (scan != edge);

    return 0;
}
int getFaceOrder(Edge *e) {
	int count = 1;
	Edge *iter = e->Lnext();

	if (iter->Left() == NULL) {
		return -1;
	}
	if (iter == NULL) {
		cout << "Erro: ponteiro next == NULL\n";
		return -1;
	}

	while (iter != e && count < 100) {
		count++;
		iter = iter->Lnext();
	}

	if (count == 100) {
		cout << "Erro: loop infinito\n";
		return -1;
	}

	return count;
}