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


C++ Facet_iterator类代码示例

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


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

示例1: Init

  void VSA_Component::Init(int NbProxy)
	{
		////Creation of the initial proxies by random seed triangle picking 
		m_Table_Proxy.clear();

		m_NbProxy=NbProxy;
		int NbFacet=m_Poly->size_of_facets();
		int offset=NbFacet/NbProxy;
		int i=0; 
		for(Facet_iterator	pface	=	m_Poly->facets_begin();
				pface	!= m_Poly->facets_end();
				pface++)
		{

			if(i%offset==0)///this triangle is chosen
			{
				//a proxy is created
				Proxy NewProxy;
				NewProxy.Normal=pface->normal();

				NewProxy.Seed=pface;
				///the proxy is added
				m_Table_Proxy.push_back(NewProxy);


			}

			pface->LabelVSA=-1;
			i++;
		}

		m_Poly->NbFaceLabel=m_NbProxy;

	}
开发者ID:151706061,项目名称:MEPP,代码行数:34,代码来源:VSA_Component.cpp

示例2: renewAttrs

void renewAttrs( Polyhedron & poly )
{
    // assign IDs to vertices
    for ( Vertex_iterator vi = poly.vertices_begin(); vi != poly.vertices_end(); ++vi ) {
	vi->nCuts()	= 0;
    }

    // assign IDs to faces: the dual vertex and the dual coordinates-the center coordinates
    for ( Facet_iterator fi = poly.facets_begin(); fi != poly.facets_end(); ++fi ) {
	fi->piece()	= NO_INDEX;
	Vector3 sum( 0.0, 0.0, 0.0 );
	Halfedge_facet_circulator hfc = fi->facet_begin();
	do {
	    sum = sum + ( hfc->vertex()->point() - CGAL::ORIGIN );
	} while ( ++hfc != fi->facet_begin() );
	sum = sum / ( double )CGAL::circulator_size( hfc );
	fi->center() = CGAL::ORIGIN + sum;
    }

    // assign the same IDs to the identical/ opposite halfedges
    for ( Halfedge_iterator hi = poly.halfedges_begin(); hi != poly.halfedges_end(); ++hi ) {
	hi->label()		= DEFAULT_LABEL;
	hi->match()		= DEFAULT_LABEL;
	hi->cycle()		= NO_INDEX;
	hi->connect()		= true;
	hi->visit()		= false;
	hi->path()		= NO_INDEX;
	hi->orient()		= true;
	// We individually handle hi->fixed
    }
}
开发者ID:tohyongcheng,项目名称:Paper3D,代码行数:31,代码来源:dual.cpp

示例3: apply_function_object_polyhedron

F& apply_function_object_polyhedron (Polyhedron &P,
                                     F &f) {
    typedef typename Polyhedron::Halfedge_around_facet_circulator Hafc;
    typedef typename Polyhedron::Facet_iterator Facet_iterator;

    f.reset();

    for (Facet_iterator fit = P.facets_begin();
         fit != P.facets_end();
         fit++) {
        Hafc h0 = fit->facet_begin(), hf = h0--, hs = hf;
        hs ++;

        while (1) {
            // Apply 'f' on each triangle of the polyhedron's facet
            f ( h0->vertex()->point(),
                hf->vertex()->point(),
                hs->vertex()->point() );

            if (hs == h0)
                break;

            hs++; hf++;
        }
    }

    f.end();

    return f;
}
开发者ID:freehawkzk,项目名称:cgal,代码行数:30,代码来源:lloyd_algorithm.cpp

示例4: CGALPolyhedronToVTKPolydata_converter

  void CGALPolyhedronToVTKPolydata_converter(Polyhedron *polyhedron, vtkSmartPointer<vtkPolyData> polydata)
  {
	  //convert from cgal polyhedron to vtk poly data
	  //first the points
	  vtkSmartPointer<vtkPoints> points = vtkSmartPointer<vtkPoints>::New();
	  vtkSmartPointer<vtkCellArray> faces = vtkSmartPointer<vtkCellArray>::New();

	  //iterator over all vertices in  polyhedron, add them as points
	  std::map<Vertex_handle, vtkIdType> V;
	  vtkIdType inum = 0;
	  for ( Vertex_iterator v = polyhedron->vertices_begin(); v != polyhedron->vertices_end(); ++v)
	  {
		   points->InsertNextPoint(v->point()[0],v->point()[1],v->point()[2]);
		   V[v] = inum++;
	  }
	  //now iterate over all faces in polyhedron
	  for ( Facet_iterator i = polyhedron->facets_begin(); i != polyhedron->facets_end(); ++i)
	  {
		  Halfedge_around_facet_circulator j = i->facet_begin();
		  faces->InsertNextCell(CGAL::circulator_size(j));
		  do
		  {
			  //get indice of vertex, insert new cell point into faces
			  faces->InsertCellPoint(V[j->vertex()]);

		  } while(++j != i->facet_begin());
	  }

	  // Set the points and faces of the polydata
	  polydata->SetPoints(points);
	  polydata->SetPolys(faces);
  }
开发者ID:CognitionGuidedSurgery,项目名称:msml,代码行数:32,代码来源:CGALOperators.cpp

示例5: main

int main()
{
    std::vector<Point_3> points;

    points.push_back(Point_3(2.0f, 3.535533905932738f, 3.535533905932737f));
    points.push_back(Point_3(4.0f, 2.0f, 0.0f));
    points.push_back(Point_3(0.0f, 2.0f, 0.0f));
    points.push_back(Point_3(1.0f, 0.0f, 0.0f));
    points.push_back(Point_3(4.0f, 1.414213562373095f, 1.414213562373095f));
    points.push_back(Point_3(0.0f, 1.414213562373095f, 1.414213562373095f));
    points.push_back(Point_3(3.0f, 0.0f, 0.0f));
    points.push_back(Point_3(2.0f, 5.0f, 0.0f));

    Polyhedron P;

    CGAL::convex_hull_3(points.begin(), points.end(), P);

    std::cout << "- Number of vertices  = " << P.size_of_vertices()    << std::endl;
    std::cout << "- Number of edges     = " << P.size_of_halfedges()/2 << std::endl;
    std::cout << "- Number of faces     = " << P.size_of_facets()      << std::endl;

    for ( Facet_iterator i = P.facets_begin(); i != P.facets_end(); ++i)
    {
        Halfedge_facet_circulator j = i->facet_begin();
        CGAL_assertion( CGAL::circulator_size(j) >= 3);
        std::cout << CGAL::circulator_size(j) << ' ';
        do{
            //std::cout << ' ' << std::distance(P.vertices_begin(), j->vertex());
            std::cout << " (" << j->vertex()->point().x() << ' ' << j->vertex()->point().y() << ' ' << j->vertex()->point().z() << ')' << ", ";
        } while ( ++j != i->facet_begin());

        std::cout << std::endl;
    }
    return 0;
}
开发者ID:4DGameEngine,项目名称:opengl-examples,代码行数:35,代码来源:main.cpp

示例6: getFacetFromPoint

// Récupère la face de travail du point d'impact
int DegradeAnObject::getFacetFromPoint(Point_3 p, Facet &fs, int index) {
	for(Facet_iterator fi = polys[index].facets_begin(); fi != polys[index].facets_end() ; ++fi) {
		Point_3 p1 = fi->halfedge()->vertex()->point();
		Point_3 p2 = fi->halfedge()->next()->vertex()->point();
		Point_3 p3 = fi->halfedge()->next()->next()->vertex()->point();
		if(isAPointInATriangle(p, p1, p2, p3)) { 
			fs = *fi;
			return 1;
		}
	}
	return 0;
}
开发者ID:guil-prin,项目名称:notreDame,代码行数:13,代码来源:DegradeAnObject.cpp

示例7: subdivide_create_center_vertex

void geometryUtils::subdivide_create_center_vertex(Polyhedron& P, Facet_iterator f) {
    Vector_3 vec(0.0, 0.0, 0.0);
    std::size_t order = 0;
    HF_circulator h = f->facet_begin();
    do {
        vec = vec + (h->vertex()->point() - CGAL::ORIGIN);
        ++order;
    } while (++h != f->facet_begin());
    CGAL_assertion(order >= 3); // guaranteed by definition of polyhedron
    Point_3 center = CGAL::ORIGIN + (vec / static_cast<double> (order));
    Halfedge_handle new_center = P.create_center_vertex(f->halfedge());
    new_center->vertex()->point() = center;
}
开发者ID:johannes-riesterer,项目名称:Curvature,代码行数:13,代码来源:Utils.cpp

示例8: getFacetsFromPoint

// Warning : only for triangle mesh. NO. QUAD. MESH.
// Récupère les faces correspondantes au point d'impact et retourne leurs nombres.
int DegradeAnObject::getFacetsFromPoint(Point_3 p, std::vector<Facet> &fs, std::vector<int> &index) {
	for(int i = 0 ; i < polys.size() ; i++) {
		for(Facet_iterator fi = polys[i].facets_begin(); fi != polys[i].facets_end() ; ++fi) {
			Point_3 p1 = fi->halfedge()->vertex()->point();
			Point_3 p2 = fi->halfedge()->next()->vertex()->point();
			Point_3 p3 = fi->halfedge()->next()->next()->vertex()->point();
			if(isAPointInATriangle(p, p1, p2, p3)) {
				index.push_back(i);
				fs.push_back(*fi);
			}
		}
	}
	return fs.size();
}
开发者ID:guil-prin,项目名称:notreDame,代码行数:16,代码来源:DegradeAnObject.cpp

示例9: computeDual

//------------------------------------------------------------------------------
//	Compute and store the results of dual graphs into appropriate variables
//
//  computeDual( mesh, whole, bary, mid ); 
//------------------------------------------------------------------------------
void computeDual( Polyhedron & poly, Graph & dual,
		  vector< Point3 > & bary, vector< Point3 > & mid )
{
    // initialize the array of face barycenters: refer to the point at which the gravitational forces exerted by 2 objects are equal

    bary.clear();
    bary.resize( poly.size_of_facets() );

    // initialize the dual graph with dual vertices
    dual.clear();
    int fid = 0;
    for ( Facet_iterator fi = poly.facets_begin(); fi != poly.facets_end(); ++fi ) {
	// add a vertex: each face equals to each dual vertex
	add_vertex( dual );
	bary[ fid++ ] = fi->center(); 
	// cerr << " Barycenter No. " << fid-1 << " : " << bary[ fid-1 ] << endl;
    }

    int size_of_edges = poly.size_of_halfedges() / 2; //redundant

    // initialize the array of midpoints
    mid.clear();
    mid.resize( size_of_edges );

    // initialize the array of lengths
    // length.clear();
    // length.resize( size_of_edges );

    // construct the connecitivity of the dual graph
    for ( Halfedge_iterator hi = poly.halfedges_begin(); hi != poly.halfedges_end(); ++hi ) {
	int origID = hi->facet()->id(); // the face
	int destID = hi->opposite()->facet()->id(); // the neighbor face
	Point3 origCoord = hi->vertex()->point();
	Point3 destCoord = hi->opposite()->vertex()->point();
	Vector3 dispVec = origCoord - destCoord;
	Point3 midCoord = destCoord + 0.5 * dispVec;
	// double curLength = sqrt( dispVec.squared_length() ); // the length between two connected vertices
#ifdef DEBUG
	cerr << origID << " -- " << destID << endl;
#endif	// DEBUG	
	
	if ( origID < destID )
		add_edge( origID, destID, hi->id(), dual );  
		
	mid[ hi->id() ] = midCoord;
	hi->mid() = hi->opposite()->mid() = midCoord;
	hi->weight() = hi->opposite()->weight() = 1.0;
    }
}
开发者ID:tohyongcheng,项目名称:Paper3D,代码行数:54,代码来源:dual.cpp

示例10: DistorsionError

	double VSA_Component::DistorsionError(Facet_iterator f,Proxy p)
	{
		Vector v=f->normal()-p.Normal;
		double nrm=v*v;
		double area=AreaFacetTriangleSeg(f);
		return nrm*area;
	}
开发者ID:151706061,项目名称:MEPP,代码行数:7,代码来源:VSA_Component.cpp

示例11: ConstructFaceColorMap

	void VSA_Component::ConstructFaceColorMap(PolyhedronPtr pMesh)
{
		
                //Vertex_iterator pVertex = NULL; // MT

		Facet_iterator pFacet	=	pMesh->facets_begin();
		for(;pFacet	!= pMesh->facets_end();pFacet++)
		{

			double R=(double)(pFacet->LabelVSA)/(double)pMesh->NbFaceLabel*255.;
			int indiceLut=floor(R);

			pFacet->color(LUT_Seg[3*indiceLut],LUT_Seg[3*indiceLut+1],LUT_Seg[3*indiceLut+2]);

		}
}
开发者ID:151706061,项目名称:MEPP,代码行数:16,代码来源:VSA_Component.cpp

示例12: compute_elements

void Scene_polyhedron_item::compute_elements()
{

    v_poly.resize(0);
    v_edge.resize(0);
    normal_flat.resize(0);
    normal_smooth.resize(0);
    Polyhedron& polyhedron =*poly;
    //FACETS

    typedef Polyhedron::Traits	    Kernel;
    typedef Kernel::Point_3	    Point;
    typedef Kernel::Vector_3	    Vector;
    typedef Polyhedron::Facet_iterator Facet_iterator;
    typedef Polyhedron::Halfedge_around_facet_circulator HF_circulator;



    Facet_iterator f;
    for(f = polyhedron.facets_begin();
      f != polyhedron.facets_end();
      f++)
    {

      // If Flat shading: 1 normal per polygon

        Vector n = CGAL::Polygon_mesh_processing::compute_face_normal(f, polyhedron);

        normal_flat.push_back(n.x()); normal_flat.push_back(n.y()); normal_flat.push_back(n.z());
        normal_flat.push_back(n.x()); normal_flat.push_back(n.y()); normal_flat.push_back(n.z());
        normal_flat.push_back(n.x()); normal_flat.push_back(n.y()); normal_flat.push_back(n.z());


      // revolve around current face to get vertices
      HF_circulator he = f->facet_begin();
      HF_circulator end = he;
      CGAL_For_all(he,end)
      {

          Vector n = CGAL::Polygon_mesh_processing::compute_vertex_normal(he->vertex(), polyhedron);
          normal_smooth.push_back(n.x()); normal_smooth.push_back(n.y()); normal_smooth.push_back(n.z());

        const Point& p = he->vertex()->point();
        v_poly.push_back(p.x()); v_poly.push_back(p.y()); v_poly.push_back(p.z());
      }
    }
开发者ID:somanypeople,项目名称:cgal,代码行数:46,代码来源:Scene_polyhedron_item.cpp

示例13: init

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_));
}
开发者ID:swarbhanu,项目名称:CGAL-Mesh,代码行数:18,代码来源:Scene_polyhedron_item.cpp

示例14: glBegin

void geometryUtils::renderPolyhedron(Polyhedron * pmesh) {

    glBegin(GL_TRIANGLES);
    for (Facet_iterator i = pmesh->facets_begin(); i != pmesh->facets_end(); i++) {


        Halfedge_around_facet_circulator j = i->facet_begin();
        glColor3d(i->color[0].R, i->color[0].G, i->color[0].B);
        glVertex3d(CGAL::to_double(j->vertex()->point().x()), CGAL::to_double(j->vertex()->point().y()), CGAL::to_double(j->vertex()->point().z()));

        glColor3d(i->color[1].R, i->color[1].G, i->color[1].B);
        glVertex3d(CGAL::to_double(j->next()->vertex()->point().x()), CGAL::to_double(j->next()->vertex()->point().y()), CGAL::to_double(j->next()->vertex()->point().z()));

        glColor3d(i->color[2].R, i->color[2].G, i->color[2].B);
        glVertex3d(CGAL::to_double(j->next()->next()->vertex()->point().x()), CGAL::to_double(j->next()->next()->vertex()->point().y()), CGAL::to_double(j->next()->next()->vertex()->point().z()));
    }
    glEnd();
}
开发者ID:johannes-riesterer,项目名称:Curvature,代码行数:18,代码来源:Utils.cpp

示例15: main

 int main(int argc, const char **argv )
 {
   std::vector<Point> points;
   CGAL::Random_points_on_sphere_3<Point> g;

   size_t N = 0;
   if (argc > 1)
     N = atof(argv[1]);
   N = std::max(size_t(100), N);

   for (size_t i = 0; i < N; ++i)
     points.push_back(rescale(*g++));

   for (size_t n = 0; n < 100; ++n)
     {
       std::cerr << "step " << n << ":\n\t";
       lloyd_step(points);
     }

   Polyhedron P;
   CGAL::convex_hull_3(points.begin(), points.end(), P);

   CGAL::set_ascii_mode( std::cout);
   std::cout << "OFF" << std::endl << P.size_of_vertices() << ' '
	     << P.size_of_facets() << " 0" << std::endl;
   std::copy( P.points_begin(), P.points_end(),
	      std::ostream_iterator<Point>( std::cout, "\n"));
   for (  Facet_iterator i = P.facets_begin(); i != P.facets_end(); ++i) {
     Halfedge_facet_circulator j = i->facet_begin();
     // Facets in polyhedral surfaces are at least triangles.
     CGAL_assertion( CGAL::circulator_size(j) >= 3);
     std::cout << CGAL::circulator_size(j) << ' ';
     do {
       std::cout << ' ' << std::distance(P.vertices_begin(), j->vertex());
     } while ( ++j != i->facet_begin());
     std::cout << std::endl;
   }

   std::ofstream os ("test.cloud");
   std::copy(points.begin(), points.end(),
	     std::ostream_iterator<Point>(os, "\n"));
}
开发者ID:mrgt,项目名称:voronoi_covariance,代码行数:42,代码来源:sphere.cpp


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