Example #1
0
void
Scene_c3t3_item::c3t3_changed()
{
  // Update colors
  // Fill indices map and get max subdomain value
  indices_.clear();

  int max = 0;
  for (C3t3::Cells_in_complex_iterator cit = this->c3t3().cells_in_complex_begin(),
    end = this->c3t3().cells_in_complex_end(); cit != end; ++cit)
  {
    max = (std::max)(max, cit->subdomain_index());
    indices_.insert(cit->subdomain_index());
  }
  for (C3t3::Facets_in_complex_iterator fit = this->c3t3().facets_in_complex_begin(),
    end = this->c3t3().facets_in_complex_end(); fit != end; ++fit)
  {
    max = (std::max)(max, fit->first->surface_patch_index(fit->second));
    indices_.insert(fit->first->surface_patch_index(fit->second));
  }

  d->colors.resize(max + 1);
  compute_color_map(color_);

  // Rebuild histogram
  build_histogram();
  
}
void
Scene_polyhedron_item::
init()
{
    typedef Polyhedron::Facet_iterator Facet_iterator;

    // Fill indices map and get max subdomain value
    int max = 0;
    for(Facet_iterator fit = poly->facets_begin(), end = poly->facets_end() ;
            fit != end; ++fit)
    {
        max = (std::max)(max, fit->patch_id());
    }

    colors_.clear();
    compute_color_map(this->color(), max + 1,
                      std::back_inserter(colors_));
}
void
Scene_polyhedron_item::
init()
{
  typedef Polyhedron::Facet_iterator Facet_iterator;
  
  if ( !plugin_has_set_color_vector_m )
  {
    // Fill indices map and get max subdomain value
    int max = 0;
    for(Facet_iterator fit = poly->facets_begin(), end = poly->facets_end() ;
        fit != end; ++fit)
    {
      max = (std::max)(max, fit->patch_id());
    }
    
    colors_.clear();
    compute_color_map(this->color(), max + 1, 
                      std::back_inserter(colors_));
  }

  volume=-std::numeric_limits<double>::infinity();
  area=-std::numeric_limits<double>::infinity();
  if (poly->is_pure_triangle())
  {
    // compute the volume if the polyhedron is closed
    if (poly->is_closed())
    {
      volume=0;
      Polyhedron::Vertex::Point p(0,0,0);
      Q_FOREACH(Polyhedron::Face_handle fh, faces(*poly))
      {
        volume+=CGAL::volume( p,
                    fh->halfedge()->vertex()->point(),
                    fh->halfedge()->next()->vertex()->point(),
                    fh->halfedge()->prev()->vertex()->point() );
      }
    }
Example #4
0
void
Scene_c3t3_item::c3t3_changed()
{
  // Update colors
  // Fill indices map and get max subdomain value
  indices_.clear();

  int max = 0;
  for (C3t3::Cells_in_complex_iterator cit = this->c3t3().cells_in_complex_begin(),
    end = this->c3t3().cells_in_complex_end(); cit != end; ++cit)
  {
    max = (std::max)(max, cit->subdomain_index());
    indices_.insert(cit->subdomain_index());
  }

  d->colors.resize(max + 1);
  compute_color_map(color_);

  // Rebuild histogram
  build_histogram();
  //compute_elements();
  this->invalidate_buffers();
  need_changed = false;
}