00001 #include "mi.H" 00002 00003 Bface_list 00004 leading_faces(CBvert* v, CSimplexFilter& filter) 00005 { 00006 // return a list of faces, one face per sector in the 00007 // "star" around v, where sectors separated by edges 00008 // accpted by the filter (or by border edges): 00009 00010 Bface_list ret; 00011 if (!v) 00012 return ret; 00013 00014 Bface* f = 0; 00015 for (int i=0; i<v->degree(); i++) { 00016 Bedge* e = v->e(i); 00017 if ((e->is_border() || filter.accept(e)) && 00018 (f = e->ccw_face((Bvert*)v))) // XXX - fix Bedge::ccw_face() 00019 ret += f; 00020 00021 } 00022 // if no edges are accepted by the filter and there are no border 00023 // edges, add in any old face: 00024 if (ret.empty() && v->get_face()) 00025 ret += v->get_face(); 00026 00027 return ret; 00028 } 00029 00030 Wvec 00031 vert_normal(CBvert* v, CBface* f, CSimplexFilter& filter) 00032 { 00033 assert(v && f && f->contains(v)); 00034 00035 if (v->degree(filter) < 2) 00036 return v->norm(); 00037 00038 Wvec ret; 00039 Bedge* e=0; 00040 Bface* cur = rewind_cw(v, f, filter); 00041 do { 00042 ret += weighted_vnorm(cur, v); 00043 } while ( 00044 (e = cur->edge_before_vert(v)) && 00045 (cur = e->other_face(cur)) && 00046 !filter.accept(e) 00047 ); 00048 return ret.normalized(); 00049 } 00050 00051 // end of file mi.C