Subject: CGAL users discussion list
List archive
- From: Monique Teillaud <>
- To:
- Subject: Re: [cgal-discuss] get vertex handle from a facet
- Date: Mon, 15 Jan 2007 10:02:14 +0100
well, I am not familiar with Alpha_shape_3, but at least I am afraid
there is no Face_handle in Triangulation_3...
Still, you can get the vertices of a facet, see the user and ref manual
of TriangulationDataStructure_3:
typedef std::pair<Cell_handle, int> Facet;
(c,i) is the facet of c opposite to the vertex of index i.
So, f.first->vertex( (i+1)&3 ) gives the first vertex of facet f.
Same with (1+2) and (1+3) for the next two vertices.
Monique Teillaud
Mariette Yvinec wrote:
> use fh->vertex(int i)
> where fh is a Face_handle.
> See the doc of Triangulation_3 and Trriangulation_data_structure_3
>
> chen wenyu wrote:
>
>> Hi,
>>
>> How can I get the vertex handle from a facet.
>>
>> Facet f = ....;
>>
>> // how to get the three vertex handles of this facet f
>>
>>
>> For example:
>>
>> -------------------------------------------------------
>>
>>// examples/Alpha_shapes_3/example_weight.C
>>
>>#include <CGAL/Exact_predicates_inexact_constructions_kernel
>><file:///C:/Program%20Files/CGAL-3.2.1/doc_html/cgal_manual/Kernel_23_ref/Class_Exact_predicates_inexact_constructions_kernel.html#Cross_link_anchor_17>.h>
>>#include <CGAL/Weighted_alpha_shape_euclidean_traits_3
>><file:///C:/Program%20Files/CGAL-3.2.1/doc_html/cgal_manual/Alpha_shapes_3_ref/Class_Weighted_alpha_shape_euclidean_traits_3.html#Cross_link_anchor_804>.h>
>>#include <CGAL/Regular_triangulation_3
>><file:///C:/Program%20Files/CGAL-3.2.1/doc_html/cgal_manual/Triangulation_3_ref/Class_Regular_triangulation_3.html#Cross_link_anchor_762>.h>
>>#include <CGAL/Alpha_shape_3
>><file:///C:/Program%20Files/CGAL-3.2.1/doc_html/cgal_manual/Alpha_shapes_3_ref/Class_Alpha_shape_3.html#Cross_link_anchor_799>.h>
>>#include <list>
>>
>>typedef CGAL::Exact_predicates_inexact_constructions_kernel
>><file:///C:/Program%20Files/CGAL-3.2.1/doc_html/cgal_manual/Kernel_23_ref/Class_Exact_predicates_inexact_constructions_kernel.html#Cross_link_anchor_17>
>> K;
>>
>>typedef CGAL::Weighted_alpha_shape_euclidean_traits_3<K>
>><file:///C:/Program%20Files/CGAL-3.2.1/doc_html/cgal_manual/Alpha_shapes_3_ref/Class_Weighted_alpha_shape_euclidean_traits_3.html#Cross_link_anchor_804>
>> Gt;
>>
>>typedef CGAL::Alpha_shape_vertex_base_3
>><file:///C:/Program%20Files/CGAL-3.2.1/doc_html/cgal_manual/Alpha_shapes_3_ref/Class_Alpha_shape_vertex_base_3.html#Cross_link_anchor_801><Gt>
>> Vb;
>>typedef CGAL::Alpha_shape_cell_base_3
>><file:///C:/Program%20Files/CGAL-3.2.1/doc_html/cgal_manual/Alpha_shapes_3_ref/Class_Alpha_shape_cell_base_3.html#Cross_link_anchor_800><Gt>
>> Fb;
>>typedef CGAL::Triangulation_data_structure_3
>><file:///C:/Program%20Files/CGAL-3.2.1/doc_html/cgal_manual/TriangulationDS_3_ref/Class_Triangulation_data_structure_3.html#Cross_link_anchor_785><Vb,Fb>
>> Tds;
>>typedef CGAL::Regular_triangulation_3
>><file:///C:/Program%20Files/CGAL-3.2.1/doc_html/cgal_manual/Triangulation_3_ref/Class_Regular_triangulation_3.html#Cross_link_anchor_762><Gt,Tds>
>> Triangulation_3
>><file:///C:/Program%20Files/CGAL-3.2.1/doc_html/cgal_manual/Triangulation_3_ref/Class_Triangulation_3.html#Cross_link_anchor_759>;
>>typedef CGAL::Alpha_shape_3
>><file:///C:/Program%20Files/CGAL-3.2.1/doc_html/cgal_manual/Alpha_shapes_3_ref/Class_Alpha_shape_3.html#Cross_link_anchor_799><Triangulation_3
>>
>><file:///C:/Program%20Files/CGAL-3.2.1/doc_html/cgal_manual/Triangulation_3_ref/Class_Triangulation_3.html#Cross_link_anchor_759>>
>> Alpha_shape_3
>><file:///C:/Program%20Files/CGAL-3.2.1/doc_html/cgal_manual/Alpha_shapes_3_ref/Class_Alpha_shape_3.html#Cross_link_anchor_799>;
>>
>>typedef Alpha_shape_3
>><file:///C:/Program%20Files/CGAL-3.2.1/doc_html/cgal_manual/Alpha_shapes_3_ref/Class_Alpha_shape_3.html#Cross_link_anchor_799>::Cell_handle
>> Cell_handle;
>>typedef Alpha_shape_3
>><file:///C:/Program%20Files/CGAL-3.2.1/doc_html/cgal_manual/Alpha_shapes_3_ref/Class_Alpha_shape_3.html#Cross_link_anchor_799>::Vertex_handle
>> Vertex_handle;
>>typedef Alpha_shape_3
>><file:///C:/Program%20Files/CGAL-3.2.1/doc_html/cgal_manual/Alpha_shapes_3_ref/Class_Alpha_shape_3.html#Cross_link_anchor_799>::Facet
>> Facet;
>>typedef Alpha_shape_3
>><file:///C:/Program%20Files/CGAL-3.2.1/doc_html/cgal_manual/Alpha_shapes_3_ref/Class_Alpha_shape_3.html#Cross_link_anchor_799>::Edge
>> Edge;
>>typedef Gt::Weighted_point
>><file:///C:/Program%20Files/CGAL-3.2.1/doc_html/cgal_manual/Triangulation_2_ref/Class_Weighted_point.html#Cross_link_anchor_750>
>> Weighted_point
>><file:///C:/Program%20Files/CGAL-3.2.1/doc_html/cgal_manual/Triangulation_2_ref/Class_Weighted_point.html#Cross_link_anchor_750>;
>>typedef Gt::Bare_point Bare_point;
>>
>>int main()
>>{
>> std::list<Weighted_point
>> <file:///C:/Program%20Files/CGAL-3.2.1/doc_html/cgal_manual/Triangulation_2_ref/Class_Weighted_point.html#Cross_link_anchor_750>>
>> lwp;
>>
>> //input : a small molecule
>> lwp.push_back(Weighted_point
>> <file:///C:/Program%20Files/CGAL-3.2.1/doc_html/cgal_manual/Triangulation_2_ref/Class_Weighted_point.html#Cross_link_anchor_750>(Bare_point(
>> 1, -1, -1), 4));
>> lwp.push_back(Weighted_point
>> <file:///C:/Program%20Files/CGAL-3.2.1/doc_html/cgal_manual/Triangulation_2_ref/Class_Weighted_point.html#Cross_link_anchor_750>(Bare_point(-1,
>> 1, -1), 4));
>> lwp.push_back(Weighted_point
>> <file:///C:/Program%20Files/CGAL-3.2.1/doc_html/cgal_manual/Triangulation_2_ref/Class_Weighted_point.html#Cross_link_anchor_750>(Bare_point(-1,
>> -1, 1), 4));
>> lwp.push_back(Weighted_point
>> <file:///C:/Program%20Files/CGAL-3.2.1/doc_html/cgal_manual/Triangulation_2_ref/Class_Weighted_point.html#Cross_link_anchor_750>(Bare_point(
>> 1, 1, 1), 4));
>> lwp.push_back(Weighted_point
>> <file:///C:/Program%20Files/CGAL-3.2.1/doc_html/cgal_manual/Triangulation_2_ref/Class_Weighted_point.html#Cross_link_anchor_750>(Bare_point(
>> 2, 2, 2), 1));
>>
>> //build alpha_shape in GENERAL
>> <file:///C:/Program%20Files/CGAL-3.2.1/doc_html/cgal_manual/Alpha_shapes_2_ref/Class_Alpha_shape_2.html#Enum_Mode>
>> mode and set alpha=0
>> Alpha_shape_3
>> <file:///C:/Program%20Files/CGAL-3.2.1/doc_html/cgal_manual/Alpha_shapes_3_ref/Class_Alpha_shape_3.html#Cross_link_anchor_799>
>> as(lwp.begin(), lwp.end(), 0, Alpha_shape_3
>> <file:///C:/Program%20Files/CGAL-3.2.1/doc_html/cgal_manual/Alpha_shapes_3_ref/Class_Alpha_shape_3.html#Cross_link_anchor_799>::GENERAL
>>
>> <file:///C:/Program%20Files/CGAL-3.2.1/doc_html/cgal_manual/Alpha_shapes_2_ref/Class_Alpha_shape_2.html#Enum_Mode>);
>>
>> //explore the 0-shape - It is dual to the boundary of the union.
>> std::list<Cell_handle> cells;
>> std::list<Facet> facets;
>> std::list<Edge> edges;
>> as.get_alpha_shape_cells(std::back_inserter(cells),
>> Alpha_shape_3
>> <file:///C:/Program%20Files/CGAL-3.2.1/doc_html/cgal_manual/Alpha_shapes_3_ref/Class_Alpha_shape_3.html#Cross_link_anchor_799>::INTERIOR
>>
>> <file:///C:/Program%20Files/CGAL-3.2.1/doc_html/cgal_manual/Alpha_shapes_2_ref/Class_Alpha_shape_2.html#Enum_Classification_type>);
>> as.get_alpha_shape_facets(std::back_inserter(facets),
>> Alpha_shape_3
>> <file:///C:/Program%20Files/CGAL-3.2.1/doc_html/cgal_manual/Alpha_shapes_3_ref/Class_Alpha_shape_3.html#Cross_link_anchor_799>::REGULAR
>>
>> <file:///C:/Program%20Files/CGAL-3.2.1/doc_html/cgal_manual/Alpha_shapes_2_ref/Class_Alpha_shape_2.html#Enum_Classification_type>);
>> as.get_alpha_shape_facets(std::back_inserter(facets),
>> Alpha_shape_3
>> <file:///C:/Program%20Files/CGAL-3.2.1/doc_html/cgal_manual/Alpha_shapes_3_ref/Class_Alpha_shape_3.html#Cross_link_anchor_799>::SINGULAR
>>
>> <file:///C:/Program%20Files/CGAL-3.2.1/doc_html/cgal_manual/Alpha_shapes_2_ref/Class_Alpha_shape_2.html#Enum_Classification_type>);
>> as.get_alpha_shape_edges(std::back_inserter(edges),
>> Alpha_shape_3
>> <file:///C:/Program%20Files/CGAL-3.2.1/doc_html/cgal_manual/Alpha_shapes_3_ref/Class_Alpha_shape_3.html#Cross_link_anchor_799>::SINGULAR
>>
>> <file:///C:/Program%20Files/CGAL-3.2.1/doc_html/cgal_manual/Alpha_shapes_2_ref/Class_Alpha_shape_2.html#Enum_Classification_type>);
>>
>>//start here
>>
>> std::list<Facet>::iterator fbeg = facetr.begin();
>> std::list<Facet>::iterator fend = facetr.end();
>>
>> for (int i = 0; fbeg != fend; fbeg++)
>> {
>> Facet f = (Facet)fbeg;
>>
>> ........................
>>
>> // how to get the three vertex handles of this facet
>> }
>>
>>}
>>
>>
>>
>> ------------------------------------------------------------------------
>> 请使用 下载 Live Messenger 8.0
>> <http://g.msn.com/8HMACN/2728??PS=47575> 与联机的朋友进行交流
>
>
- get vertex handle from a facet, chen wenyu, 01/14/2007
- Re: [cgal-discuss] get vertex handle from a facet, Mariette Yvinec, 01/15/2007
- Re: [cgal-discuss] get vertex handle from a facet, Monique Teillaud, 01/15/2007
- Re: [cgal-discuss] get vertex handle from a facet, chen wenyu, 01/15/2007
- Re: [cgal-discuss] get vertex handle from a facet, Monique Teillaud, 01/15/2007
- Re:[cgal-discuss] get vertex handle from a facet, 聂志峰, 01/16/2007
- Re: [cgal-discuss] get vertex handle from a facet, Mariette Yvinec, 01/15/2007
Archive powered by MHonArc 2.6.16.