当前位置: 首页>>代码示例>>C++>>正文


C++ Bedge类代码示例

本文整理汇总了C++中Bedge的典型用法代码示例。如果您正苦于以下问题:C++ Bedge类的具体用法?C++ Bedge怎么用?C++ Bedge使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了Bedge类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: weak_edge

bool
Bface::get_quad_verts(Bvert*& a, Bvert*& b, Bvert*& c, Bvert*& d) const
{
   //  Return CCW verts a, b, c, d as in the picture, orienting
   //  things so that the weak edge runs NE as shown:
   //
   //    d ---------- c = w->v2()              ^      
   //    |          / |                        |       
   //    |        /   |                        |       
   //    |    w /     |       tan1        tan2 |       
   //    |    /       |    -------->           |       
   //    |  /     f   |                        |       
   //    |/           |                                
   //    a ---------- b                                
   //     = w->v1()
   //
   if (!is_quad())
      return 0;

   Bedge* w = weak_edge();
   Bface* f = w->ccw_face(w->v2());
   a = w->v1();
   b = f->next_vert_ccw(a);
   c = w->v2();
   d = f->quad_vert();

   return true;
}
开发者ID:QuLogic,项目名称:jot-lib,代码行数:28,代码来源:bface.cpp

示例2: push_back

bool
Bface_list::grow_connected(Bface* f, CSimplexFilter& pass)
{
   // Collect all reachable faces whose flag == 1, starting at f,
   // crossing only edges that are accepted by the given filter.

   if (!(f && f->flag() == 1))
      return false;

   f->set_flag(2);
   push_back(f);

   // check each neighboring edge:
   for (int i=1; i<4; i++) {
      Bedge* e = f->e(i);
      if (pass.accept(e)) {
         // check each adjacent face
         // (includes this, but that will be a no-op):
         for (int j=1; j<=e->num_all_faces(); j++)
            grow_connected(e->f(j), pass);
      }
   }

   return true;
}
开发者ID:QuLogic,项目名称:jot-lib,代码行数:25,代码来源:bface.cpp

示例3: assert

/**********************************************************************
 * TriStrip:
 **********************************************************************/
Bface*
TriStrip::backup_strip(Bface* f, Bvert*& a) 
{
   // we'd like to draw a triangle strip starting at the 
   // given triangle and proceeding "forward." but to get 
   // the most bang for the buck, we'll first "backup" over 
   // as many triangles as possible to find a starting place 
   // from which we can generate a longer strip.

   assert(!f->flag());

   mark_face(f);

   Bface* ret = f;
   Bvert* b   = f->next_vert_ccw(a);
   Bedge* e;

   int i = 0;
   while((e = f->edge_from_vert((i%2) ? b : a)) &&
         e->consistent_orientation()            &&
         e->is_crossable()                      &&
         (f = e->other_face(f))                 &&
         is_cleared(f)) {
      mark_face(f);
      ret = f;
      Bvert* d = f->other_vertex(a,b);
      b = a;
      a = d;
      i++;
   }

   _orientation = ((i%2) != 0);

   return ret;
}
开发者ID:QuLogic,项目名称:jot-lib,代码行数:38,代码来源:tri_strip.cpp

示例4: set_adjacent_edges

void
EdgeStrip::build_with_tips(CBedge_list& edges, CSimplexFilter& filter)
{
   // Build the strip from the given pool of edges, with the
   // given filter.  Try to start the edge strip at the "tips" of
   // chains of edges of the desired type. The given filter
   // should just screen for edges of the desired kind;
   // internally this method also screens for edges that have not
   // yet been reached (added to the strip).

   // Clear edge flags to screen for unreached edges:
   set_adjacent_edges(edges.get_verts(), 1);
   edges.clear_flags();

   // Pull out the edge tips:
   Bedge_list tips = edges.filter(ChainTipEdgeFilter(filter));

   // Construct the filter that screens out previously reached
   // edges:
   UnreachedSimplexFilter unreached;
   AndFilter       wanted = unreached + filter;

   int k;

   // Start from all the tips first:
   for (k=0; k<tips.num(); k++) {
      Bedge* e = tips[k];
      Bvert* v = (e->v2()->degree(filter) != 2) ? e->v2() : e->v1();
      build(v, e, wanted);
   }

   // Now check the rest:
   for (k=0; k<edges.num(); k++)
      build(0, edges[k], wanted);
}
开发者ID:ArnaudGastinel,项目名称:jot-lib,代码行数:35,代码来源:edge_strip.C

示例5: find_edge

inline Bedge*
find_edge(CPIXEL& pix)
{
   Wvec bc;
   Bedge* e = near_edge(find_face(pix, 1, bc), bc);
   if (e && e->is_weak())
      return 0;
   return e;
}
开发者ID:ArnaudGastinel,项目名称:jot-lib,代码行数:9,代码来源:select_widget.C

示例6: accept

 virtual bool accept(CBsimplex* s) const {
    if (!is_edge(s))                          // reject if non-edge
       return false;
    Bedge* e = (Bedge*)s;
    if (e->sil_stamp() == _stamp)             // reject if previously checked
       return 0;
    e->set_sil_stamp(_stamp);                 // mark as checked this frame
    if (_skip_secondary && e->is_secondary()) // reject secondary edges as needed
       return false;
    return e->is_sil();                       // accept if silhouette
 }
开发者ID:QuLogic,项目名称:jot-lib,代码行数:11,代码来源:bedge.hpp

示例7: err_adv

bool
OVERSKETCH::find_matching_sil(CGESTUREptr& g)
{
   err_adv(debug, "OVERSKETCH::find_matching_sil");

   const size_t MIN_GEST_PTS = 10;
   if (!(g && g->pts().size() >= MIN_GEST_PTS))
      return false;

   if (BMESH::_freeze_sils)
      return false;

   VisRefImage *vis_ref = VisRefImage::lookup(VIEW::peek());
   if (!vis_ref)
      return false;

   // 1. see if the gesture runs along a silhouette
   //    of a single mesh.

   SilEdgeFilter sil_filter;
   const  PIXEL_list& pts = g->pts();
   BMESHptr mesh = nullptr;
   for (PIXEL_list::size_type i=0; i<pts.size(); i++) {
      Bedge* e = (Bedge*)
         vis_ref->find_near_simplex(pts[i], SIL_SEARCH_RAD, sil_filter);
      if (!(e && e->mesh())) {
         err_adv(debug, "   gesture too far from silhouette");
         return false;
      }
      if (mesh && mesh != e->mesh()) {
         err_adv(debug, "   found a second mesh, rejecting");
         return false;
      }
      mesh = e->mesh();
   }
   if (!dynamic_pointer_cast<LMESH>(mesh)) {
      err_adv(debug, "   found non-LMESH, rejecting");
      return false;
   }

   err_adv(debug, "   gesture aligns with silhouette");
   err_adv(debug, "   mesh level %d", mesh->subdiv_level());

   // 2. extract the portion of the silhouette that matches
   //    the gesture, store in _selected_sils

   return find_matching_sil(pts, mesh->sil_strip());
}
开发者ID:QuLogic,项目名称:jot-lib,代码行数:48,代码来源:oversketch.cpp

示例8:

bool 
Skin::copy_edge(Bedge* a) const
{
   // copy edge attributes, e.g. from skel to skin

   Bedge* b = _mapper.a_to_b(a);
   if (!(a && b))
      return false;

   if (a->is_weak())
      b->set_bit(Bedge::WEAK_BIT);

   // more?

   return true;
}
开发者ID:ArnaudGastinel,项目名称:jot-lib,代码行数:16,代码来源:skin.C

示例9: copy_edge

inline bool 
copy_edge(Bedge* a, CVertMapper& vmap)
{
   // copy edge attributes, e.g. from skel to skin

   Bedge* b = vmap.a_to_b(a);
   if (!(a && b))
      return false;

   if (a->is_weak())
      b->set_bit(Bedge::WEAK_BIT);

   // more?

   return true;
}
开发者ID:QuLogic,项目名称:jot-lib,代码行数:16,代码来源:paper_doll.cpp

示例10: assert

CWvec&
Bface::vert_normal(CBvert* v, Wvec& n) const
{
   // for gouraud shading: return appropriate 
   // normal to use at a vertex of this face 

   assert(this->contains(v));

   if(!v->is_crease()) {
      n = v->norm();
      return n;
   }

   // take average of face normals in star of v,
   // using faces which can be reached from this
   // face without crossing a crease edge

   n = weighted_vnorm(this, v); // add weighted normal from this face
   int count = 1;       // count of faces processed

   // wind around v in clockwise direction
   // but don't cross a crease edge
   CBface* f = this;
   Bedge* e = edge_from_vert(v);
   for (; e&&!e->is_crease() && (f=e->other_face(f)); e=f->edge_from_vert(v)) {
      n += weighted_vnorm(f, v);
      if (++count > v->degree()) {
         // this should never happen, but it does
         // happen on effed up models
         // (i.e. when "3rd faces" get added)
         break;
      }
   }

   // wind around v in counter-clockwise direction;
   // as before, don't cross a crease edge
   f = this;
   e = edge_before_vert(v);
   for(; e&&!e->is_crease()&&(f=e->other_face(f)); e=f->edge_before_vert(v)) {
      n += weighted_vnorm(f, v);
      if(++count > v->degree())
         break;
   }

   n = n.normalized();
   return n;
}
开发者ID:QuLogic,项目名称:jot-lib,代码行数:47,代码来源:bface.cpp

示例11: assert

int
Bedge::redefine(Bvert *v, Bvert *u)
{
    // redefine this edge, replacing v with u

    // precondition:
    //   edge does not already contain u.
    //   v is a vertex of this edge.
    //   faces have already been detached.
    //   can't duplicate an existing edge.

    assert(contains(v) && nfaces() == 0);

    if (contains(u))
        return 0;

    Bedge* dup = 0;
    if (v == _v1) {
        if ((dup = u->lookup_edge(_v2))) {
            // can't redefine, but if this is a crease edge
            // should ensure the duplicated edge is also
            if (is_crease())
                dup->set_crease(crease_val());
            return 0;
        }
        // can redefine:
        *_v1 -= this;     // say bye to old _v1
        _v1 = u;          // record new _v1
        *_v1 += this;     // say hi to new _v1
    } else if (v == _v2) {
        // see comments above
        if ((dup = u->lookup_edge(_v1))) {
            if (is_crease())
                dup->set_crease(crease_val());
            return 0;
        }
        *_v2 -= this;
        _v2 = u;
        *_v2 += this;
    } else assert(0);

    geometry_changed();

    return 1;
}
开发者ID:karmakat,项目名称:jot-lib,代码行数:45,代码来源:bedge.C

示例12: assert

EdgeStrokePool::~EdgeStrokePool()
{
   int i = 0; // loop index
   for (i = 0; i < _strip.edges().num(); i++) {
      Bedge* edge = _strip.edges()[i];
      assert(edge);
      //SimplexData* d = edge->find_data(this->static_name());
      SimplexData* d = edge->find_data((uintptr_t)&(this->foo));

      edge->rem_simplex_data(d);
   }

   i = 0;
   while (i < _num) {
      assert( _array[i]->is_of_type(EdgeStroke::static_name()));
      ((EdgeStroke*)_array[i++])->clear_simplex_data();
   }
}
开发者ID:ArnaudGastinel,项目名称:jot-lib,代码行数:18,代码来源:edge_stroke_pool.C

示例13: return

/*****************************************************************
 * InflateCreaseFilter:
 *****************************************************************/
bool
InflateCreaseFilter::accept(CBsimplex* s) const 
{
   // Reject non-edges:
   if (!is_edge(s))
      return false;
   Bedge* e = (Bedge*)s;

   if (e->nfaces() < 2)
      return false;

   // Accept it if it's labelled a crease, is owned by a
   // Bcurve, or the adjacent faces make a sharp angle:
   return (
      e->is_crease()                 ||
      Bcurve::find_controller(e)     ||
      rad2deg(norm_angle(e)) > 50
      );
}
开发者ID:ArnaudGastinel,项目名称:jot-lib,代码行数:22,代码来源:skin.C

示例14: clear_edge_flags

Bedge_list 
Bface_list::get_edges() const
{
   // Extract a list of the edges found in the given faces.

   // Get clean slate
   clear_edge_flags();

   // Put edges into output array uniquely:
   Bedge_list ret(size()*2);       // pre-allocate plenty
   for (Bface_list::size_type i=0; i<size(); i++) {
      for (int j=1; j<4; j++) {
         Bedge* e = at(i)->e(j);
         if (e->flag() == 0) {
            e->set_flag(1);
            ret.push_back(e);
         }
      }
   }
   return ret;
}
开发者ID:QuLogic,项目名称:jot-lib,代码行数:21,代码来源:bface.cpp

示例15: err_adv

bool
SELECT_WIDGET::select_edges(CPIXEL_list& pts)
{
   err_adv(debug, "SELECT_WIDGET::select_edges:");

   if (pts.num() < 2) {
      err_adv(debug, "  bad gesture: %d points", pts.num());
      return false;
   }

   // Find edit-level vert near start of pixel trail:
   Bvert* v = find_vert(pts[0]);
   if (!v) {
      err_adv(debug, "  can't get starter vertex");
      return false;
   }

   // 2. Extract edge sequence within tolerance of gest

   Bedge_list chain;

   int k = 0;                           // index of cur position in gesture
   Bvert* cur = v;                      // current vertex
   Bedge* e = 0;
   while ((e = match_span(cur, pts, k))) {
      if(!e->is_selected()) chain += e;
      cur = e->other_vertex(cur);
   }

   err_adv(debug, "  got %d edges", chain.num());

   // Confirm gest is sufficiently close to edge chain

   // 3. Select the edges

   WORLD::add_command(new MESH_SELECT_CMD(chain));

   return true;
}
开发者ID:ArnaudGastinel,项目名称:jot-lib,代码行数:39,代码来源:select_widget.C


注:本文中的Bedge类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。