mef.cpp

Go to the documentation of this file.
00001 /**
00002  *\file         mef.cpp
00003  *
00004  *\brief        subdivide an edge loop.
00005  *
00006  *              mef(e1, e2): subdivide edge loop (the loop l1 of e1, and the loop l2 of e2,  
00007  *              are assumed to be from the same loop) into v1v2+[e2, e1) (change in place), and v2v1+[e1,e2) (as new edge loop of new face).
00008  *
00009  *              It sets the new half edges to the loop headers, and returns the loop in the new face.
00010  *
00011  *
00012  *\image        html mef.jpg
00013  *
00014  *\author       Xianming Chen\n
00015  *              Computer Science Department\n
00016  *              University of Utah
00017  *
00018  *\date          16 Aug 2006\n
00019  *              Copyright (c) 2006, University of Utah
00020  */
00021 
00022 
00023 #include <cassert>
00024 #include "print.h"
00025 
00026 
00027 namespace euler
00028 {
00029 
00030   loop_t* solid_t :: mef(edge_t* e1, edge_t* e2)
00031   {
00032     pair<edge_t*, edge_t*> p = add_edge_pair(e2->v, e1,
00033                                              e1->v, e2);
00034     edge_t *&ne1 = p.first, *&ne2 = p.second;
00035 
00036     //split the edge cycle
00037     edge_t *ne2__pre = ne2->pre;
00038     ne2->pre = ne1->pre; ne1->pre->nxt = ne2;
00039     ne1->pre = ne2__pre; ne2__pre->nxt = ne1;
00040     
00041     //update hosting face and loop of new edge cycle
00042     face_t *f = new_face();
00043     
00044     loop_t *nl = f->new_loop();
00045     edge_t *e = ne1;
00046     do
00047     {
00048       e->l = nl;
00049     }
00050     while( (e = e->nxt) != ne1 );
00051 
00052     // set both half  edges as first in the cycle.
00053     ne1->l->e = ne1;
00054     ne2->l->e = ne2;
00055     
00056     solid_t::assert_consistent_B_rep();
00057     return nl;
00058   }
00059 
00060 
00061 }//end namespace euler

Generated on Wed Aug 30 16:27:58 2006 for euler by  doxygen 1.4.6