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


C++ Halfedge_handle类代码示例

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


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

示例1: h

// Dessine la couronne intérieure
std::vector<Point_3> DegradeAnObject::drawInsideImpactOnFacet(std::vector<Point_3> points, std::vector<Halfedge_handle> hhs, Facet f, int index) {
	std::vector<Point_3> pts;
	for(int i = 0 ; i < points.size() ; i++) {
		int j;
		if(i == points.size()-1) {
			j = 0;
		}
		else {
			j = i+1;
		}
		Vector_3 h(hhs[i]->opposite()->vertex()->point(), hhs[i]->vertex()->point());
		Vector_3 g(hhs[j]->opposite()->vertex()->point(), hhs[j]->vertex()->point());
		Vector_3 norm = getNormalOfFacet(f);
		Vector_3 rh = normalizeVector(rotationVector(h, norm, M_PI/2));
		Vector_3 rg = normalizeVector(rotationVector(g, norm, M_PI/2));
		Vector_3 comb = 0.01*normalizeVector(rh+rg);
		Point_3 newPoint = hhs[i]->vertex()->point() + comb;
		Halfedge_handle hh = polys[index].split_vertex(hhs[j]->opposite(), hhs[i]);
		hh->vertex()->point() = newPoint;
		polys[index].split_facet(hh->opposite()->next()->next(), hh->opposite());
		polys[index].split_facet(hh->next()->next(), hh);
		pts.push_back(newPoint);
	}
	return pts;
}
开发者ID:guil-prin,项目名称:notreDame,代码行数:26,代码来源:DegradeAnObject.cpp

示例2: getFacetFromPoint

// Place un point p sur la face fs, et relie p aux sommets de fs.
Halfedge_handle DegradeAnObject::putAPointOnAFacet(Point_3 p, int index) {
	Facet fs;
	getFacetFromPoint(p, fs, index);
	Halfedge_handle h = polys[index].create_center_vertex(fs.halfedge());
	h->vertex()->point() = p;
	return h;
}
开发者ID:guil-prin,项目名称:notreDame,代码行数:8,代码来源:DegradeAnObject.cpp

示例3: flip_edge

void flip_edge( Polyhedron& P, Halfedge_handle e) {
    if ( e->is_border_edge())
        return;
    Halfedge_handle h = e->next();
    P.join_facet( e);
    P.split_facet( h, h->next()->next());
}
开发者ID:lrineau,项目名称:cgal,代码行数:7,代码来源:polyhedron_prog_subdiv_with_boundary.cpp

示例4: getFacetsFromPoint

// Relie le premier et le dernier point
Halfedge_handle DegradeAnObject::joinFirstAndLast(Point_3 p1, Point_3 p2, int index, std::vector<Point_3> & pts) {
	Halfedge_handle hh;
	bool chk = false;
	std::vector<Facet> fcts;
	std::vector<int> indexes;
	Halfedge_handle prevHalf;
	Facet fs;
	getFacetsFromPoint(p1, fcts, indexes);
	for(int i = 0 ; i < fcts.size() ; i++) {
		if(twoPointsOnTheFacet(p1, p2, fcts[i], index)) {
			chk = true;
		}
	}
	if(!chk) {
		fcts.clear();
		Segment_3 s(p1, p2);
		getFacetsFromPoint(p2, fcts, indexes);
		hh = getExteriorHalfedge(p2, s, fcts);
		Halfedge_handle previousHalfedge = hh->next();
		Halfedge_handle newEdge = addAndJoinNewPoint(p2, previousHalfedge, hh, s, index);
		pts.push_back(newEdge->vertex()->point());
		prevHalf = joinFirstAndLast(p1, newEdge->vertex()->point(), index, pts);
	}
	
	return prevHalf;
}
开发者ID:guil-prin,项目名称:notreDame,代码行数:27,代码来源:DegradeAnObject.cpp

示例5: trace_up_once

/**
 * Trace up one face and modify h to be ready for the next trace.
 *
 * h must have the next face to be traced on its left, and its point must be the
 * next point to be traced from.
 */
void trace_up_once(Halfedge_handle& h, TraceFlag& flag)
{
    if (flag == TRACE_POINT) {
        assert(!is_saddle(h->vertex()));
        h = find_steepest_path(h->vertex());
    }
    Point_3 intersect_point = find_upslope_intersection(h, flag);
}
开发者ID:codonnell,项目名称:cgal-watershedtin,代码行数:14,代码来源:watershed.cpp

示例6: print_endpoint

void print_endpoint(Halfedge_handle e, bool is_src) {
    std::cout << "\t";
    if ( is_src ) {
        if ( e->has_source() )  std::cout << e->source()->point() << std::endl;
        else  std::cout << "point at infinity" << std::endl;
    } else {
        if ( e->has_target() )  std::cout << e->target()->point() << std::endl;
        else  std::cout << "point at infinity" << std::endl;
    }
}
开发者ID:ahmadyan,项目名称:RRT,代码行数:10,代码来源:cgal_adapter.cpp

示例7: smooth_border_vertices

void smooth_border_vertices( Halfedge_handle e, OutputIterator out) {
    CGAL_precondition( e->is_border());
    // We know that the vertex at this edge is from the unrefined mesh.
    // Get the locus vectors of the unrefined vertices in the neighborhood.
    Vector v0 = e->prev()->prev()->opposite()->vertex()->point() -CGAL::ORIGIN;
    Vector v1 = e->vertex()->point() - CGAL::ORIGIN;
    Vector v2 = e->next()->next()->next()->vertex()->point() - CGAL::ORIGIN;
    *out++ = CGAL::ORIGIN + (10.0 * v0 + 16.0 * v1 +        v2) / 27.0;
    *out++ = CGAL::ORIGIN + ( 4.0 * v0 + 19.0 * v1 +  4.0 * v2) / 27.0;
    *out++ = CGAL::ORIGIN + (       v0 + 16.0 * v1 + 10.0 * v2) / 27.0;
}
开发者ID:lrineau,项目名称:cgal,代码行数:11,代码来源:polyhedron_prog_subdiv_with_boundary.cpp

示例8: Area_Facet_Triangle

//Description : Gives an area of the triangle which contain the halfedge_handle h
double Area_Facet_Triangle(const Halfedge_handle &h)
{

	Point3d P = h->vertex()->point();
	Point3d Q = h->next()->vertex()->point();
	Point3d R = h->next()->next()->vertex()->point();

	Vector PQ=Q-P;
        //Vector PR=R-P; // MT
	Vector QR=R-Q;

	Vector normal =	CGAL::cross_product(PQ,QR);
	double area=0.5*sqrt(normal*normal);

	return area;
}
开发者ID:151706061,项目名称:MEPP,代码行数:17,代码来源:Canonical_Component.cpp

示例9: Triangle_Normal

//Description : Gives a normal vector of the triangle which contain the halfedge_handle h
Vector Triangle_Normal(const Halfedge_handle &h)
{
	Point3d P = h->vertex()->point();
	Point3d Q = h->next()->vertex()->point();
	Point3d R = h->next()->next()->vertex()->point();

	Vector PQ=Q-P;
        //Vector PR=R-P; // MT
	Vector QR=R-Q;

	Vector normal = CGAL::cross_product(PQ,QR);
	double length = std::sqrt(normal*normal);
	if (length != 0.0)
		normal = normal / length;

	return normal;
}
开发者ID:151706061,项目名称:MEPP,代码行数:18,代码来源:Canonical_Component.cpp

示例10: two_tetrahedrons

void two_tetrahedrons()
{
  Polyhedron a;

  make_tetrahedron(a, 
                   Point(1.0, 0.0, 0.0),
                   Point(2.0, 0.0, 0.0),
                   Point(1.5, 1.0, 0.0),
                   Point(1.5, .5, 10.0));

  Polyhedron b;
  make_tetrahedron(b,
                   Point(0.0, 0., .5),
                   Point(0.0, 0.0, 1.5),
                   Point(0.0, 1.0, 1.0),
                   Point(10.0, .5, 1.0));

  if (a.is_pure_triangle())
    std::cout << "a is pure triangle" << std::endl;

  if (b.is_pure_triangle())
    std::cout << "b is pure triangle" << std::endl;

  Polyhedron &biggest = a.size_of_facets() > b.size_of_facets() ? a : b;
  Polyhedron &smallest = a.size_of_facets() > b.size_of_facets() ? b : a;

  std::list<std::list<boost::tuple<Facet_handle, Facet_handle, Segment> > > polylines;
  {
    std::list<boost::tuple<Facet_handle, Facet_handle, Segment> > intersections;
    compute_intersections(biggest, smallest, std::back_inserter(intersections));

    for (std::list<boost::tuple<Facet_handle, Facet_handle, Segment> >::iterator it = intersections.begin();
         it != intersections.end(); it++)
    {
      {
        Halfedge_handle h = it->get<0>()->halfedge();
        Triangle t(h->vertex()->point(), h->next()->vertex()->point(), h->next()->next()->vertex()->point());
        assert(t.has_on(it->get<2>().source()));
        assert(t.has_on(it->get<2>().target()));
      }
      {
        Halfedge_handle h = it->get<1>()->halfedge();
        Triangle t(h->vertex()->point(), h->next()->vertex()->point(), h->next()->next()->vertex()->point());
        assert(t.has_on(it->get<2>().source()));
        assert(t.has_on(it->get<2>().target()));
      }
    }
    sort_polylines<Polyhedron>(biggest, smallest, intersections, polylines);
  }

  std::list<std::vector<typename Polyhedron::Halfedge_handle> > intersection_list;

  split_facets<Polyhedron, 0>(biggest,  polylines, intersection_list);
  //split_facets<Polyhedron, 1>(smallest, polylines);

}
开发者ID:FEniCS,项目名称:mshr,代码行数:56,代码来源:test.cpp

示例11: drawImpactOnFacet

// Dessine tous les points qui déterminent l'impact à réaliser, en plusieurs couronnes.
void DegradeAnObject::drawImpactOnFacet(Point_3 p, double ray, std::vector<Point_3> pts, Facet initFs, int index, int nbCouronnes) {
	std::vector< std::vector<Point_3> > points;
	std::vector<Point_3> tmp;
	std::vector<Halfedge_handle> hhs;
	Halfedge_handle hh;
	hh = putAPointOnAFacet(pts[0], index);
	tmp.push_back(hh->vertex()->point());
	for(int i = 1 ; i < pts.size() ; i++) {
		hh = joinTwoPoints(pts[i], pts[i-1], index, tmp);
	}
	joinFirstAndLast(pts[0], pts[pts.size()-1], index, tmp);
	for(int i = 1 ; i < nbCouronnes ; i++) {
		hhs = getHalfedgesOfPoints(tmp, index);
		tmp = drawInsideImpactOnFacet(tmp, hhs, initFs, index);
		points.push_back(tmp);
	}
	impactTheFacetArea(points, initFs, ray, index);
}
开发者ID:guil-prin,项目名称:notreDame,代码行数:19,代码来源:DegradeAnObject.cpp

示例12: Check_Manifold_Property

//Description :: Check if removal of this vertex would violate the manifold_property or not.
bool Check_Manifold_Property(Halfedge_handle h, const int &type,const int &valence)
{
	bool check = false;
	Halfedge_handle g = h;
	int* Points_index = new int[valence];

	// if valence is 3, no new edge is inserted, so always safe to remove.
	if(valence == 3)
	{
		return false;
	}

	else
	{
		// Points_index[] contains all boundary vertices' indices (ordered in counterclockwise)

		Points_index[0] = g->vertex()->Vertex_Number_S;
		g = g->next(); // g points center vertex;

		for(int i=1; i<valence; i++)
		{
			g = g->prev_on_vertex();// around the vertex in the counterclockwise way.
			Points_index[i] = g->opposite()->vertex()->Vertex_Number_S;
		}

		// quadrangle
		if (valence == 4)
		{
			if ((type == 5) || (type == 8))
			{
				g = h->opposite();
				Halfedge_around_vertex_circulator Hvc = g->vertex_begin();
				Halfedge_around_vertex_circulator Hvc_end = Hvc;

				CGAL_For_all(Hvc,Hvc_end)
				{
					if (Hvc->opposite()->vertex()->Vertex_Number_S == Points_index[1])
						check = true;
				}
			}

			else if (( type == 6) || (type == 7))
			{
				g = h;
				Halfedge_around_vertex_circulator Hvc = g->vertex_begin();
				Halfedge_around_vertex_circulator Hvc_end = Hvc;

				CGAL_For_all(Hvc,Hvc_end)
				{
					if (Hvc->opposite()->vertex()->Vertex_Number_S == Points_index[2])
						check = true;;
				}

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

示例13: Convert

void Convert ( OffSurface_mesh& off, char const* gts_name )
{
  std::ofstream gts(gts_name);  
  if ( gts )
  {
    std::cout << "Writting " << gts_name << std::endl ;
    
    gts << off.size_of_vertices() << " " << (off.size_of_halfedges()/2) << " " << off.size_of_facets() << std::endl ;
    
    int vid = 1 ;
    for ( Vertex_iterator vit = off.vertices_begin() ; vit != off.vertices_end() ; ++ vit )
    {
      Vertex_handle v = vit ;
      gts << v->point().x() << " " << v->point().y() << " " << v->point().z() << std::endl ;
      v->id() = vid ++ ;
    }
    
    int eid = 1 ;
    for ( Edge_iterator eit = off.edges_begin(); eit != off.edges_end() ; ++ eit )
    {
      Halfedge_handle e = eit ;
      Vertex_handle s = e->opposite()->vertex();
      Vertex_handle t = e->vertex();
      gts << s->id() << " " << t->id() << std::endl ;
      e            ->id() = eid ;
      e->opposite()->id() = eid ;
      ++ eid ;
    }
    
    for ( Facet_iterator fit = off.facets_begin(); fit != off.facets_end() ; ++ fit )
    {
      Facet_handle f = fit ;
      Halfedge_handle e0 = f->halfedge();
      Halfedge_handle e1 = e0->next();
      Halfedge_handle e2 = e1->next();
      gts << e0->id() << " " << e1->id() << " " << e2->id() << std::endl ;
    }
    
    
  }
  else std::cerr << "Unable to open output file: " << gts_name << std::endl ;
}
开发者ID:Fox-Heracles,项目名称:cgal,代码行数:42,代码来源:off2gts.cpp

示例14: Map_CreateWithLineData

void	Map_CreateWithLineData(
					Pmwx&									out_map,
					const vector<Segment_2>&				input_curves,
					const vector<GIS_halfedge_data>&		input_data)
{
	DebugAssert(input_curves.size() == input_data.size());

	out_map.clear();

	int n;

	vector<Curve_2>	curves;
	curves.resize(input_curves.size());

	for(n = 0; n < input_curves.size(); ++n)
		curves[n] = Curve_2(input_curves[n], n);

	CGAL::insert(out_map, curves.begin(), curves.end());

	for(Pmwx::Edge_iterator eit = out_map.edges_begin(); eit != out_map.edges_end(); ++eit)
	{
		DebugAssert(eit->curve().data().size() >= 1);

		// CGAL maintains a lot of information for us that makes life easy:
		// 1.	The underlying curve of an edge is a sub-curve of the input curve - it is NEVER flipped.  is_directed_right tells whether
		//		it is lex-right.*
		// 2.	Each half-edge's direction tells us if the half-edge is lex-right...strangely, "SMALLER" means lex-right.
		// Putting these two things together, we can easily detect which of two half-edges is in the same vs. opposite direction of the input
		// curve.
		// * lex-right means lexicographically x-y larger...means target is to the right of source UNLESS it's vertical (then UP = true, down = false).
		Halfedge_handle he = he_is_same_direction(eit) ? eit : eit->twin();

		int cid = eit->curve().data().front();
		DebugAssert(cid >= 0 && cid < input_data.size());
		he->set_data(input_data[cid]);
//		he->data().mDominant = true;
//		he->twin()->data().mDominant = false;

		// Do NOT leave the keys in the map...
		eit->curve().data().clear();
	}
}
开发者ID:highattack30,项目名称:xptools,代码行数:42,代码来源:MapCreate.cpp

示例15: after_split_edge

 virtual void after_split_edge (Halfedge_handle h1, Halfedge_handle h2)
 {
     std::string str = h1->data();
     if (str.compare("") == 0)
         str = h2->data();
     if (str.compare("") == 0)
         str = h1->twin()->data();
     if (str.compare("") == 0)
         str = h2->twin()->data();
     h1->set_data(str);
     h2->set_data(str);
     h1->twin()->set_data(str);
     h2->twin()->set_data(str);
 }
开发者ID:apiot,项目名称:pianoMoverProblem,代码行数:14,代码来源:arrangement.cpp


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