void TriMesh2D::setup_mesh(const std::vector<Vec2f>& v, const std::vector<Vec3ui>& t) {
   vertices = v;
   tris = t;

   std::cout << "Setting up mesh data structures." << std::endl;
   
   compute_tris();
   compute_edges();
   compute_nbrs();
   compute_accelerator();
}
Example #2
0
void Viewer::compute_elements()
{
  LCC &lcc = *scene->lcc;

  pos_facets.clear();
  flat_normals.clear();
  smooth_normals.clear();
  colors.clear();
  pos_lines.clear();
  pos_points.clear();

  if ( lcc.is_empty() )
  {
    bb = LCC::Point(CGAL::ORIGIN).bbox();
    bb = bb + LCC::Point(1,1,1).bbox(); // To avoid a warning from Qglviewer
    return;
  }

  bool empty = true;
  for (LCC::Attribute_range<3>::type::iterator it=lcc.attributes<3>().begin(),
         itend=lcc.attributes<3>().end(); it!=itend; ++it )
  {
    if ( it->info().is_visible() )
    {
      if (it->info().is_filled())
        compute_faces(lcc.dart_of_attribute<3>(it));

      compute_edges(lcc.dart_of_attribute<3>(it));
      compute_vertices(lcc.dart_of_attribute<3>(it), empty);
      empty = false;
    }
  }

  if ( empty )
  {
    bb = LCC::Point(CGAL::ORIGIN).bbox();
    bb = bb + LCC::Point(1,1,1).bbox(); // To avoid a warning from Qglviewer
  }
}