Skip to Content.
Sympa Menu

cgal-discuss - Re: [cgal-discuss] [cgal discuss] How to insert a vertex normal to an added point for use Enriched_polyhedron_incremental_builder_3 ?

Subject: CGAL users discussion list

List archive

Re: [cgal-discuss] [cgal discuss] How to insert a vertex normal to an added point for use Enriched_polyhedron_incremental_builder_3 ?


Chronological Thread 
  • From: "Sebastien Loriot (GeometryFactory)" <>
  • To:
  • Subject: Re: [cgal-discuss] [cgal discuss] How to insert a vertex normal to an added point for use Enriched_polyhedron_incremental_builder_3 ?
  • Date: Mon, 05 Jul 2010 09:13:32 +0200

Hello,

An alternative is to use the Polyhedron itself and the member function create_center_vertex as documented here:
http://www.cgal.org/Manual/latest/doc_html/cgal_manual/Polyhedron_ref/Class_Polyhedron_3.html#Function_Halfedge_handle_create_center_vertex6_Halfedge_handle_h9;

Then to update the new point coordinates use the vertex member function Point& point().

ex:

Halfedge_handle h=P.create_center_vertex(what_ever_halfedge);
h->vertex()->point()=Point_3(1,2,3);

S.


Kwangtaek Kim wrote:
Hello,

I like to add arbitrary points into each triangle and then store vertex normals directly to the points. Could you let me know how to do it in the source code below when I use Enriched_polyhedron_incremental_builder_3<HDS> builder?



builder B(hds,true);


Polyhedron::Halfedge_iterator pHalfedge;

for(pHalfedge = m_pMesh->halfedges_begin();

pHalfedge != m_pMesh->halfedges_end();

pHalfedge++)

{

const Point& p1 = pHalfedge->vertex()->point();

const Point& p2 = pHalfedge->opposite()->vertex()->point();


// division of each edge

Point point1 = Point(0.2f*(p1.x()+p2.x()),0.2f*(p1.y()+p2.y()),0.2f*(p1.z()+p2.z()));

B.add_vertex(point1);

index++;

Point point2 = Point(0.4f*(p1.x()+p2.x()),0.4f*(p1.y()+p2.y()),0.4f*(p1.z()+p2.z()));

B.add_vertex(point2);

index++;


// insert vertex normals to the new points. How?

}


Thank you.


Samuel Kim





Archive powered by MHonArc 2.6.16.

Top of Page