• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C++ cdt::Face_handle类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1:

CDT::Face_handle 	TriFanBuilder::GetNextRemainingTriangle(void)
{
	if (queue.empty()) return NULL;
	TriFan_t * f = queue.begin()->second;
#if DEV
	if (f->faces.size() != 1)
		printf("ASSERT FAILED, REMAINING TRI CALLED ON A TRI FAN!!\n");
#endif
	queue.erase(queue.begin());
	CDT::Face_handle	ff = f->faces.front();
	delete f;
#if DEV
	if (!ff->info().flag)
		printf("ERROR - this face was already used once.\n");
#endif
	ff->info().flag = false;

	// OOPS!  We have to nuke all remaining triangles from the queue!!
	for (TriFanQueue::iterator n = queue.begin(); n != queue.end(); )
	{
		if (n->second->faces.front() == ff)
		{
			TriFanQueue::iterator kill = n;
			++n;
			queue.erase(kill);
		} else
			++n;
	}
	return ff;
}
开发者ID:highattack30,项目名称:xptools,代码行数:30,代码来源:TriFan.cpp


示例2: GetNextRemainingTriangle

void		TriFanBuilder::GetRemainingTriangles(list<CDT::Vertex_handle>& out_handles)
{
	out_handles.clear();
	CDT::Face_handle	f;
	while(1)
	{
		f = GetNextRemainingTriangle();
		if(f == NULL)
			break;
		for (int v = 2; v >= 0; --v)
		{
			out_handles.push_back(f->vertex(v));
		}
	}
}
开发者ID:highattack30,项目名称:xptools,代码行数:15,代码来源:TriFan.cpp


示例3: number_of_existing_edge

int number_of_existing_edge(CDT::Face_handle fh)
{
  unsigned res=0;
  for (int i=0; i<3; ++i)
    if (fh->info().exist_edge[i]) ++res;
  return res;
}
开发者ID:BijanZarif,项目名称:mshr,代码行数:7,代码来源:linear_cell_complex_3_triangulation.cpp


示例4: e

void 
mark_domains(CDT& ct, 
             CDT::Face_handle start, 
             int index, 
             std::list<CDT::Edge>& border )
{
  if(start->info().nesting_level != -1){
    return;
  }
  std::list<CDT::Face_handle> queue;
  queue.push_back(start);

  while(! queue.empty()){
    CDT::Face_handle fh = queue.front();
    queue.pop_front();
    if(fh->info().nesting_level == -1){
      fh->info().nesting_level = index;
      for(int i = 0; i < 3; i++){
        CDT::Edge e(fh,i);
        CDT::Face_handle n = fh->neighbor(i);
        if(n->info().nesting_level == -1){
          if(ct.is_constrained(e)) border.push_back(e);
          else queue.push_back(n);
        }
      }
    }
  }
}
开发者ID:Asuzer,项目名称:cgal,代码行数:28,代码来源:polygon_triangulation.cpp


示例5: while

//explore set of facets connected with non constrained edges,
//and attribute to each such set a nesting level.
//We start from facets incident to the infinite vertex, with a nesting
//level of 0. Then we recursively consider the non-explored facets incident 
//to constrained edges bounding the former set and increase the nesting level by 1.
//Facets in the domain are those with an odd nesting level.
void
mark_domains(CDT& cdt)
{
  for(CDT::All_faces_iterator it = cdt.all_faces_begin(); it != cdt.all_faces_end(); ++it){
    it->info().nesting_level = -1;
  }

  std::list<CDT::Edge> border;
  mark_domains(cdt, cdt.infinite_face(), 0, border);
  while(! border.empty()){
    CDT::Edge e = border.front();
    border.pop_front();
    CDT::Face_handle n = e.first->neighbor(e.second);
    if(n->info().nesting_level == -1){
      mark_domains(cdt, n, e.first->info().nesting_level+1, border);
    }
  }
}
开发者ID:Asuzer,项目名称:cgal,代码行数:24,代码来源:polygon_triangulation.cpp


示例6: get_free_edge

int get_free_edge(CDT::Face_handle fh)
{
  CGAL_assertion( number_of_existing_edge(fh)==2 );
  for (int i=0; i<3; ++i)
    if (!fh->info().exist_edge[i]) return i;
  
  CGAL_assertion(false);
  return -1;
}
开发者ID:BijanZarif,项目名称:mshr,代码行数:9,代码来源:linear_cell_complex_3_triangulation.cpp


示例7: triangulate_facet

void Viewer::triangulate_facet()
{


    pos_facets.resize(0);
    flat_normals.resize(0);
    smooth_normals.resize(0);
    colors.resize(0);

    LCC &lcc = *scene->lcc;

    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() )
        {
            for(LCC::One_dart_per_incident_cell_range<2,3>::iterator
                dartIter=lcc.one_dart_per_incident_cell<2,3>
                (lcc.dart_of_attribute<3>(it)).begin(); dartIter.cont(); ++dartIter)
            {

                //Computes the normal of the facet
                Traits::Vector_3 normal = CGAL::compute_normal_of_cell_2(lcc,dartIter);
                normal = normal/(CGAL::sqrt(normal*normal));

                P_traits cdt_traits(normal);
                CDT cdt(cdt_traits);

               LCC::Dart_of_orbit_range<1>::const_iterator
                 he_circ = lcc.darts_of_orbit<1>(dartIter).begin(),
                 he_circ_end = lcc.darts_of_orbit<1>(dartIter).end();

                // Iterates on the vector of facet handles
                CDT::Vertex_handle previous, first;
                do {
                    CDT::Vertex_handle vh = cdt.insert(lcc.point(he_circ));
                    if(first == 0) {
                        first = vh;
                    }
                    //vh->info() = he_circ;
                    if(previous != 0 && previous != vh) {
                        cdt.insert_constraint(previous, vh);
                    }
                    previous = vh;
                } while( ++he_circ != he_circ_end );
                cdt.insert_constraint(previous, first);

                // sets mark is_external
                for(CDT::All_faces_iterator
                    fit = cdt.all_faces_begin(),
                    end = cdt.all_faces_end();
                    fit != end; ++fit)
                {
                    fit->info().is_external = false;
                }
                //check if the facet is external or internal
                std::queue<CDT::Face_handle> face_queue;
                face_queue.push(cdt.infinite_vertex()->face());
                while(! face_queue.empty() ) {
                    CDT::Face_handle fh = face_queue.front();
                    face_queue.pop();
                    if(fh->info().is_external) continue;
                    fh->info().is_external = true;
                    for(int i = 0; i <3; ++i) {
                        if(!cdt.is_constrained(std::make_pair(fh, i)))
                        {
                            face_queue.push(fh->neighbor(i));
                        }
                    }
                }

                //iterates on the internal faces to add the vertices to the positions
                //and the normals to the appropriate vectors
                for(CDT::Finite_faces_iterator
                    ffit = cdt.finite_faces_begin(),
                    end = cdt.finite_faces_end();
                    ffit != end; ++ffit)
                {
                    if(ffit->info().is_external)
                        continue;

                    //compute normals (no smooth for non-triangle facets objects
                    LCC::Vector normal = CGAL::compute_normal_of_cell_2(lcc,dartIter);
                    normal = normal/(CGAL::sqrt(normal*normal));

                     smooth_normals.push_back(normal.x());smooth_normals.push_back(normal.y());smooth_normals.push_back(normal.z());
                     smooth_normals.push_back(normal.x());smooth_normals.push_back(normal.y());smooth_normals.push_back(normal.z());
                     smooth_normals.push_back(normal.x());smooth_normals.push_back(normal.y());smooth_normals.push_back(normal.z());

                     flat_normals.push_back(normal.x());flat_normals.push_back(normal.y());flat_normals.push_back(normal.z());
                     flat_normals.push_back(normal.x());flat_normals.push_back(normal.y());flat_normals.push_back(normal.z());
                     flat_normals.push_back(normal.x());flat_normals.push_back(normal.y());flat_normals.push_back(normal.z());



                    pos_facets.push_back(ffit->vertex(0)->point().x()); pos_facets.push_back(ffit->vertex(0)->point().y()); pos_facets.push_back(ffit->vertex(0)->point().z());
                    pos_facets.push_back(ffit->vertex(1)->point().x()); pos_facets.push_back(ffit->vertex(1)->point().y()); pos_facets.push_back(ffit->vertex(1)->point().z());
                     pos_facets.push_back(ffit->vertex(2)->point().x()); pos_facets.push_back(ffit->vertex(2)->point().y()); pos_facets.push_back(ffit->vertex(2)->point().z());

//.........这里部分代码省略.........
开发者ID:somanypeople,项目名称:cgal,代码行数:101,代码来源:Viewer.cpp


示例8: compute_normals_and_vertices

void Scene_nef_polyhedron_item::compute_normals_and_vertices(void)
{
     int count = 0;
    positions_facets.resize(0);
    positions_points.resize(0);
    color_lines.resize(0);
    color_facets.resize(0);
    color_points.resize(0);
    normals.resize(0);
    positions_lines.resize(0);
    //The Facets
    {
        for(Nef_polyhedron::Halffacet_const_iterator
            f = nef_poly->halffacets_begin (),
            end = nef_poly->halffacets_end();
            f != end; ++f)
        {
            if(f->is_twin()) continue;
            count++;
            Nef_polyhedron::Vector_3 v = f->plane().orthogonal_vector();
            P_traits cdt_traits(v);
            CDT cdt(cdt_traits);

            for(Nef_polyhedron::Halffacet_cycle_const_iterator
                fc = f->facet_cycles_begin(),
                end = f->facet_cycles_end();
                fc != end; ++fc)
            {
                if ( fc.is_shalfedge() )
                {

                    Nef_polyhedron::SHalfedge_const_handle h = fc;
                    Nef_polyhedron::SHalfedge_around_facet_const_circulator hc(h), he(hc);

                    CDT::Vertex_handle previous, first;

                    do {
                        Nef_polyhedron::SVertex_const_handle v = hc->source();
                        const Nef_polyhedron::Point_3& point = v->source()->point();
                        CDT::Vertex_handle vh = cdt.insert(point);
                        if(first == 0) {
                            first = vh;
                        }
                        vh->info() = hc->source();
                        if(previous != 0 && previous != vh) {
                            cdt.insert_constraint(previous, vh);
                        }
                        previous = vh;
                    } while( ++hc != he );

                    cdt.insert_constraint(previous, first);

                    // sets mark is_external
                    for(CDT::All_faces_iterator
                        fit = cdt.all_faces_begin(),
                        end = cdt.all_faces_end();
                        fit != end; ++fit)
                    {
                        fit->info().is_external = false;

                    }
                    //check if the facet is external or internal
                    std::queue<CDT::Face_handle> face_queue;
                    face_queue.push(cdt.infinite_vertex()->face());

                    while(! face_queue.empty() ) {
                        CDT::Face_handle fh = face_queue.front();
                        face_queue.pop();
                        if(fh->info().is_external) continue;
                        fh->info().is_external = true;
                        for(int i = 0; i <3; ++i) {
                            if(!cdt.is_constrained(std::make_pair(fh, i)))
                            {
                                face_queue.push(fh->neighbor(i));
                            }
                        }

                    }
                    //iterates on the internal faces to add the vertices to the positions
                    //and the normals to the appropriate vectors

                    for(CDT::Finite_faces_iterator
                        ffit = cdt.finite_faces_begin(),
                        end = cdt.finite_faces_end();
                        ffit != end; ++ffit)
                    {


                        if(ffit->info().is_external){ continue;}
                        for(int i = 0; i<3; i++)
                        {
                            positions_facets.push_back(CGAL::to_double(ffit->vertex(i)->point().x()));
                            positions_facets.push_back(CGAL::to_double(ffit->vertex(i)->point().y()));
                            positions_facets.push_back(CGAL::to_double(ffit->vertex(i)->point().z()));

                        }



                        Nef_polyhedron::Vector_3 v = f->plane().orthogonal_vector();
//.........这里部分代码省略.........
开发者ID:haozzzzzzzz,项目名称:cgal,代码行数:101,代码来源:Scene_nef_polyhedron_item.cpp


示例9: cdt_traits

void
Scene_polyhedron_item::triangulate_facet_color(Facet_iterator fit) const
{
    Traits::Vector_3 normal =
            CGAL::Polygon_mesh_processing::compute_face_normal(fit, *poly);
    //check if normal contains NaN values
    if (normal.x() != normal.x() || normal.y() != normal.y() || normal.z() != normal.z())
    {
        qDebug()<<"Warning : normal is not valid. Facet not displayed";
        return;
    }

    P_traits cdt_traits(normal);
    CDT cdt(cdt_traits);

    Facet::Halfedge_around_facet_circulator
            he_circ = fit->facet_begin(),
            he_circ_end(he_circ);

    // Iterates on the vector of facet handles
    CDT::Vertex_handle previous, first;
    do {
        CDT::Vertex_handle vh = cdt.insert(he_circ->vertex()->point());
        if(first == 0) {
            first = vh;
        }
        vh->info() = he_circ;
        if(previous != 0 && previous != vh) {
            cdt.insert_constraint(previous, vh);
        }
        previous = vh;
    } while( ++he_circ != he_circ_end );
    cdt.insert_constraint(previous, first);

    // sets mark is_external
    for(CDT::All_faces_iterator
        afit = cdt.all_faces_begin(),
        end = cdt.all_faces_end();
        afit != end; ++afit)
    {
        afit->info().is_external = false;
    }
    //check if the facet is external or internal
    std::queue<CDT::Face_handle> face_queue;
    face_queue.push(cdt.infinite_vertex()->face());
    while(! face_queue.empty() ) {
        CDT::Face_handle fh = face_queue.front();
        face_queue.pop();
        if(fh->info().is_external) continue;
        fh->info().is_external = true;
        for(int i = 0; i <3; ++i) {
            if(!cdt.is_constrained(std::make_pair(fh, i)))
            {
                face_queue.push(fh->neighbor(i));
            }
        }
    }

    //iterates on the internal faces to add the vertices to the positions vector
    for(CDT::Finite_faces_iterator
        ffit = cdt.finite_faces_begin(),
        end = cdt.finite_faces_end();
        ffit != end; ++ffit)
    {
        if(ffit->info().is_external)
            continue;
        //Add Colors
        for(int i = 0; i<3; ++i)
        {
            const int this_patch_id = fit->patch_id();
            color_facets.push_back(colors_[this_patch_id].redF());
            color_facets.push_back(colors_[this_patch_id].greenF());
            color_facets.push_back(colors_[this_patch_id].blueF());

            color_facets.push_back(colors_[this_patch_id].redF());
            color_facets.push_back(colors_[this_patch_id].greenF());
            color_facets.push_back(colors_[this_patch_id].blueF());
        }
    }
}
开发者ID:kriolog,项目名称:cgal,代码行数:80,代码来源:Scene_polyhedron_item.cpp


示例10: compute_face

void Viewer::compute_face(Dart_handle dh, LCC::size_type markface)
{
  LCC &lcc = *scene->lcc;

  CGAL::mark_cell<LCC, 2>(lcc, dh, markface);

  double r = (double)lcc.info<3>(dh).color().r()/255.0;
  double g = (double)lcc.info<3>(dh).color().g()/255.0;
  double b = (double)lcc.info<3>(dh).color().b()/255.0;
  if ( !lcc.is_free(dh, 3) )
  {
    r += (double)lcc.info<3>(lcc.beta(dh,3)).color().r()/255.0;
    g += (double)lcc.info<3>(lcc.beta(dh,3)).color().g()/255.0;
    b += (double)lcc.info<3>(lcc.beta(dh,3)).color().b()/255.0;
    r /= 2; g /= 2; b /= 2;
  }

  //compute flat normals
  LCC::Vector normal = CGAL::compute_normal_of_cell_2(lcc,dh);
  normal = normal/(CGAL::sqrt(normal*normal));

  if (lcc.beta<1,1,1>(dh)!=dh)
  {
    P_traits cdt_traits(normal);
    CDT cdt(cdt_traits);

    // Iterates on the vector of facet handles
    CDT::Vertex_handle previous = NULL, first = NULL;
    for (LCC::Dart_of_orbit_range<1>::const_iterator
           he_circ = lcc.darts_of_orbit<1>(dh).begin(),
           he_circ_end = lcc.darts_of_orbit<1>(dh).end();
         he_circ!=he_circ_end; ++he_circ)
    {
      CDT::Vertex_handle vh = cdt.insert(lcc.point(he_circ));
      if(first == NULL)
      { first = vh; }
      vh->info().v = CGAL::compute_normal_of_cell_0<LCC>(lcc, he_circ);
      if(previous!=NULL && previous != vh)
      { cdt.insert_constraint(previous, vh); }
      previous = vh;
    }
    if (previous!=NULL)
      cdt.insert_constraint(previous, first);

    // sets mark is_external
    for(CDT::All_faces_iterator fit = cdt.all_faces_begin(),
          fitend = cdt.all_faces_end(); fit!=fitend; ++fit)
    {
      fit->info().is_external = true;
      fit->info().is_process = false;
    }
    //check if the facet is external or internal
    std::queue<CDT::Face_handle> face_queue;
    CDT::Face_handle face_internal = NULL;
    face_queue.push(cdt.infinite_vertex()->face());
    while(! face_queue.empty() )
    {
      CDT::Face_handle fh = face_queue.front();
      face_queue.pop();
      if(!fh->info().is_process)
      {
        fh->info().is_process = true;
        for(int i = 0; i <3; ++i)
        {
          if(!cdt.is_constrained(std::make_pair(fh, i)))
          {
            face_queue.push(fh->neighbor(i));
          }
          else if (face_internal==NULL)
          {
            face_internal = fh->neighbor(i);
          }
        }
      }
    }

    if ( face_internal!=NULL )
      face_queue.push(face_internal);

    while(! face_queue.empty() )
    {
      CDT::Face_handle fh = face_queue.front();
      face_queue.pop();
      if(!fh->info().is_process)
      {
        fh->info().is_process = true;
        fh->info().is_external = false;
        for(int i = 0; i <3; ++i)
        {
          if(!cdt.is_constrained(std::make_pair(fh, i)))
          {
            face_queue.push(fh->neighbor(i));
          }
        }
      }
    }

    //iterates on the internal faces to add the vertices to the positions
    //and the normals to the appropriate vectors
    for(CDT::Finite_faces_iterator ffit = cdt.finite_faces_begin(),
//.........这里部分代码省略.........
开发者ID:kriolog,项目名称:cgal,代码行数:101,代码来源:Viewer.cpp


示例11: constrained_delaunay_triangulation

void constrained_delaunay_triangulation(LCC_3 &lcc, Dart_handle d1)
{
  CGAL::set_ascii_mode(std::cout);
  std::cout<<"Vertices: ";
  for (LCC_3::Vertex_attribute_const_range::iterator
         v=lcc.vertex_attributes().begin(),
         vend=lcc.vertex_attributes().end(); v!=vend; ++v)
    std::cout << lcc.point_of_vertex_attribute(v) << "; ";
  std::cout<<std::endl;
 
  LCC_3::Vector normal = CGAL::compute_normal_of_cell_2(lcc,d1);
  P_traits cdt_traits(normal);
  CDT cdt(cdt_traits); 
    
  //inserting the constraints edge by edge
  LCC_3::Dart_of_orbit_range<1>::iterator
    it(lcc.darts_of_orbit<1>(d1).begin());

  CDT::Vertex_handle previous=LCC_3::null_handle, first=LCC_3::null_handle,
    vh=LCC_3::null_handle;

   for (LCC_3::Dart_of_orbit_range<1>::iterator
          itend(lcc.darts_of_orbit<1>(d1).end()); it!=itend; ++it)
   {     
     vh = cdt.insert(lcc.point(it));
     vh->info()=it;
     if( first==NULL ){
       first=vh;
     }
     if( previous!=NULL){
       CGAL_assertion( previous !=vh );
       cdt.insert_constraint(previous,vh);
     }

     previous=vh;
   }
   cdt.insert_constraint(previous,first);
   CGAL_assertion(cdt.is_valid());
   
   // sets mark is_external
   for( CDT::All_faces_iterator fit = cdt.all_faces_begin(),
          fitend = cdt.all_faces_end(); fit != fitend; ++fit)
   {
     fit->info().is_external = false;
     fit->info().exist_edge[0]=false;
     fit->info().exist_edge[1]=false;
     fit->info().exist_edge[2]=false;
   }
	
   std::queue<CDT::Face_handle> face_queue;
      
   face_queue.push(cdt.infinite_vertex()->face());
   while(! face_queue.empty() )
   {
     CDT::Face_handle fh = face_queue.front();
     face_queue.pop();
     if(!fh->info().is_external)
     {
       fh->info().is_external = true;
       for(int i = 0; i <3; ++i)
       {
         if(!cdt.is_constrained(std::make_pair(fh, i)))
         {
           face_queue.push(fh->neighbor(i));
         }
       }
     }
   }

   for( CDT::Finite_edges_iterator eit = cdt.finite_edges_begin(),
          eitend = cdt.finite_edges_end(); eit != eitend; ++eit)
   {
     CDT::Face_handle fh = eit->first;
     int index = eit->second;
     CDT::Face_handle opposite_fh = fh->neighbor(index);
     if(cdt.is_constrained(std::make_pair(fh, index)))
     {
       fh->info().exist_edge[index]=true;
       opposite_fh->info().exist_edge[cdt.mirror_index(fh,index)]=true;
       
       if ( !fh->info().is_external && number_of_existing_edge(fh)==2 )
         face_queue.push(fh);
       if ( !opposite_fh->info().is_external &&
            number_of_existing_edge(opposite_fh)==2 )
         face_queue.push(opposite_fh);
     }
   }
   
   while( !face_queue.empty() )
   {
     CDT::Face_handle fh = face_queue.front();
     face_queue.pop();
     CGAL_assertion( number_of_existing_edge(fh)>=2 ); // i.e. ==2 or ==3
     CGAL_assertion( !fh->info().is_external );
     
     if (number_of_existing_edge(fh)==2)
     {
       int index = get_free_edge(fh);
       CDT::Face_handle opposite_fh = fh->neighbor(index);

//.........这里部分代码省略.........
开发者ID:BijanZarif,项目名称:mshr,代码行数:101,代码来源:linear_cell_complex_3_triangulation.cpp


示例12: is_external

bool is_external(CDT::Face_handle fh)
{
  return fh->info().is_external;
}
开发者ID:BijanZarif,项目名称:mshr,代码行数:4,代码来源:linear_cell_complex_3_triangulation.cpp



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ cdt::Finite_faces_iterator类代码示例发布时间:2022-05-31
下一篇:
C++ cconfigfile::CVar类代码示例发布时间:2022-05-31
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap