Esempio n. 1
0
/* 
 * Add an edge to a ring of edges. 
 */
static void splice(edge * a, edge * b, point * v)
{
    edge *next;


    /* b must be the unnattached edge and a must be the previous 
       ccw edge to b. */

    if (Org(a) == v) {
        next = Onext(a);
        Onext(a) = b;
    } else {
        next = Dnext(a);
        Dnext(a) = b;
    }
    if (Org(next) == v)
        Oprev(next) = b;
    else
        Dprev(next) = b;
    if (Org(b) == v) {
        Onext(b) = next;
        Oprev(b) = a;
    } else {
        Dnext(b) = next;
        Dprev(b) = a;
    }
}
Esempio n. 2
0
void Edge::Draw(unsigned int stamp)
// This is a recursive drawing routine that uses time stamps to
// determine if the edge has already been drawn. This is given
// here for testing purposes only: it is not efficient, and for
// large triangulations the stack might overflow. A better way
// of doing this (and other traversals of the edges) is to maintain
// a list of edges in the corresponding Subdivision object. This
// list should be updated every time an edge is created or destroyed.
{
	if (Qedge()->TimeStamp(stamp)) {

		// Draw the edge
		Point2d a = Org2d();
		Point2d b = Dest2d();
		bgnline();
		v2d((double*)&a);
		v2d((double*)&b);
		endline();

		// visit neighbors
		Onext()->Draw(stamp);
		Oprev()->Draw(stamp);
		Dnext()->Draw(stamp);
		Dprev()->Draw(stamp);
	}
}