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


C++ Halfedge_handle::vertex方法代码示例

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


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

示例1: joinFirstAndLast

// 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

示例2: 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

示例3: 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

示例4:

// Récupère la liste de tous les points d'une face
std::vector<Point_3> DegradeAnObject::getAllPointsFromFacet(Facet f) {
	std::vector<Point_3> pts;
	Halfedge_handle hh = f.halfedge();
	pts.push_back(hh->vertex()->point());
	hh = hh->next();
	while(hh->vertex()->point() != pts[0]) {
		pts.push_back(hh->vertex()->point());
		hh = hh->next();
	}
	return pts;
}
开发者ID:guil-prin,项目名称:notreDame,代码行数:12,代码来源:DegradeAnObject.cpp

示例5: barycentricMesh

Halfedge_handle DegradeAnObject::barycentricMesh(Facet fs, int index) {
	std::vector<Point_3> points;
	Halfedge_handle hh = fs.halfedge();
	Point_3 p1 = hh->vertex()->point();
	points.push_back(p1);
	hh = hh->next();
	while(hh->vertex()->point() != p1) {
		points.push_back(hh->vertex()->point());
		hh = hh->next();
	}
	Halfedge_handle h = polys[index].create_center_vertex(fs.halfedge());
	h->vertex()->point() = meanPoints(points);
	return h;
}
开发者ID:guil-prin,项目名称:notreDame,代码行数:14,代码来源:DegradeAnObject.cpp

示例6: 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

示例7: putAPointOnAFacet

// 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

示例8: two_boxes

void two_boxes()
{
  Polyhedron a;
  make_box(0,0,0, 4, 5, 2, a);

  Polyhedron b;
  make_box(1, 1, -1, 2, 2, 1, b);

  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<Halfedge_handle> > a_edges;
  split_facets<Polyhedron, 0>(biggest, polylines, a_edges);
  check_splitting<Polyhedron, 0>(biggest, polylines, a_edges);
  //split_facets<Polyhedron, 1>(smallest, /* smallest, */ polylines);
}
开发者ID:FEniCS,项目名称:mshr,代码行数:46,代码来源:test.cpp

示例9: getExteriorHalfedge

// Recherche les halfedges des - facets du point - qui ne contiennent pas le point
Halfedge_handle DegradeAnObject::getExteriorHalfedge(Point_3 p, Segment_3 s, std::vector<Facet> fcts) {
	Halfedge_handle retHh;
	for(int i = 0 ; i < fcts.size() ; i++) {
		Halfedge_handle hh = fcts[i].halfedge();
		for(int j = 0 ; j < 3 ; j++) {
			if(hh->vertex()->point() != p && hh->opposite()->vertex()->point() != p) {
				Segment_3 seg(hh->opposite()->vertex()->point(), hh->vertex()->point());
				if(!seg.is_degenerate()) {
					if(CGAL::do_intersect(s, seg)) {
						retHh = hh;
					}
				}
			}
			hh = hh->next();
		}
	}
	return retHh;
}
开发者ID:guil-prin,项目名称:notreDame,代码行数:19,代码来源:DegradeAnObject.cpp

示例10: 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

示例11: 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

示例12: splitEdgesOfFacet

void DegradeAnObject::splitEdgesOfFacet(Facet fs, int index) {
	Halfedge_handle hh = fs.halfedge();
	Point_3 p1 = hh->vertex()->point();
	Point_3 p2 = hh->next()->vertex()->point();
	Point_3 p3 = hh->next()->next()->vertex()->point();
	Halfedge_handle hh1 = polys[index].split_edge(hh);
	hh1->vertex()->point() = meanPoints(p1, p3);
	hh = hh->next();
	Halfedge_handle hh2 = polys[index].split_edge(hh);
	hh2->vertex()->point() = meanPoints(p2, p1);
	hh = hh->next();
	Halfedge_handle hh3 = polys[index].split_edge(hh);
	hh3->vertex()->point() = meanPoints(p2, p3);
}
开发者ID:guil-prin,项目名称:notreDame,代码行数:14,代码来源:DegradeAnObject.cpp

示例13: joinTwoPoints

// Relie 2 points dans un polyèdre. p2 est le point PRECEDENT à p1.
Halfedge_handle DegradeAnObject::joinTwoPoints(Point_3 p1, Point_3 p2, int index, std::vector<Point_3> & pts) {
	Halfedge_handle hh;
	std::vector<Facet> fcts;
	std::vector<int> indexes;
	Halfedge_handle prevHalf;
	Facet fs;
	getFacetFromPoint(p1, fs, index);
	if(twoPointsOnTheFacet(p1, p2, fs, index)) {
		prevHalf = putAPointOnAFacet(p1, index);
		pts.push_back(prevHalf->vertex()->point());
	}
	else {
		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 = joinTwoPoints(p1, newEdge->vertex()->point(), index, pts);
	}
	
	return prevHalf;
}
开发者ID:guil-prin,项目名称:notreDame,代码行数:25,代码来源:DegradeAnObject.cpp

示例14: 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

示例15: 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


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