Beispiel #1
0
inline void
debug_check_verts(const string& msg, CBvert_list& verts, CBvert_list& dirty_verts)
{
   Bvert_list A = verts.filter(BitSetSimplexFilter(Lvert::DIRTY_VERT_LIST_BIT));
   if (!dirty_verts.contains_all(A)) {
      Bvert_list bad = A.minus(dirty_verts);
      cerr << msg << ": found " << bad.size()
           << " vertices missing from dirty list" << endl;
      WORLD::show_pts(bad.pts(), 8, Color::red);
   }
   Bvert_list B = verts.filter(BitClearSimplexFilter(Lvert::DIRTY_VERT_LIST_BIT));
   if (dirty_verts.contains_any(B)) {
      Bvert_list bad = dirty_verts.minus(B);
      cerr << msg << ": found " << bad.size()
           << " unexpected vertices in dirty list" << endl;
      WORLD::show_pts(bad.pts(), 8, Color::blue);
   }
}
Beispiel #2
0
void 
Skin::draw_debug()
{
   if (!_show_memes)
      return;

   //if (!debug)
   //   return;

   // frozen: blue
   // sticky: orange
   // unglued: grey

   Skin* cur = upcast(cur_subdiv_bbase());
   if (!cur) return;
   Bvert_list    verts = cur->skin_verts();
   Bvert_list   frozen = cur->frozen_verts(verts);
   verts = verts.minus(frozen);
   Bvert_list   sticky = cur->sticky_verts(verts);
   Bvert_list  unglued = verts.minus(sticky);
   GL_VIEW::draw_pts(frozen.pts(),  Color::blue,   0.8, 8);
   GL_VIEW::draw_pts(sticky.pts(),  Color::orange, 0.8, 8);
   GL_VIEW::draw_pts(unglued.pts(), Color::grey6,  0.8, 8);

   if (debug) GL_VIEW::draw_lines(
      bundle_lines(verts.pts(), cur->track_points(verts)),
      Color::yellow,
      0.8,
      1,
      false
      );
   if (debug) GL_VIEW::draw_lines(
      bundle_lines(verts.pts(), centroids(verts)),
      Color::red,
      0.8,
      1,
      false
      );
}
Beispiel #3
0
inline VertMapper
subdiv_mapper(CVertMapper& pmap)
{
   Bedge_list a_edges = pmap.a_edges();
   Bedge_list b_edges = pmap.a_to_b(a_edges);
   assert(a_edges.num() == b_edges.num());

   if (0 && debug) {
      err_msg("parents: verts: %d --> %d, edges: %d --> %d",
              pmap.A().num(), pmap.B().num(), a_edges.num(), b_edges.num());
      err_msg("children: verts: %d --> %d",
              (child_verts<Bvert_list,Lvert>(pmap.A()) +
               child_verts<Bedge_list,Ledge>(a_edges)).num(),
              (child_verts<Bvert_list,Lvert>(pmap.B()) +
               child_verts<Bedge_list,Ledge>(b_edges)).num());

      Bvert_list c = (child_verts<Bvert_list,Lvert>(pmap.A()) +
                      child_verts<Bedge_list,Ledge>(a_edges));
      if (c.has_duplicates()) {
         err_msg("*** child verts have duplicates ***");
         if (pmap.A().has_duplicates()) {
            err_msg("  A verts have duplicates");
         }
         if (pmap.a_edges().has_duplicates()) {
            err_msg("  A edges have duplicates");
         }
         if (child_verts<Bvert_list,Lvert>(pmap.A()).has_duplicates()) {
            err_msg("  vert children have duplicates");
         }
         if (child_verts<Bedge_list,Ledge>(pmap.a_edges()).has_duplicates()) {
            err_msg("  edge children have duplicates");
         }
         WORLD::show_pts(c.pts());
      }
   }

   return VertMapper(
      child_verts<Bvert_list,Lvert>(pmap.A()) +
      child_verts<Bedge_list,Ledge>(a_edges),
      child_verts<Bvert_list,Lvert>(pmap.B()) +
      child_verts<Bedge_list,Ledge>(b_edges)
      );
}
Beispiel #4
0
bool
OVERSKETCH::compute_offsets(CPIXEL_list& pts, CEdgeStrip& sils)
{
   double yardstick = compute_yardstick(sils.edges(), debug);

   assert(sils.num_line_strips() == 1);
   Bvert_list chain;
   int k = 0;
   sils.get_chain(k, chain);
   int count = 0;
   vector<double> offsets;
   Wpt_list new_locs = chain.pts();
   for (Bvert_list::size_type i=0; i<chain.size(); i++) {
      offsets.push_back(compute_offset(chain[i], pts, yardstick));
      if (offsets.back() > 0) {
         count++;
      }
   }
   err_adv(debug, "found %d/%d offsets", count, chain.size());

   apply_offsets(chain, offsets);

   return true;
}