Subject: CGAL users discussion list
List archive
- From: MrVH <>
- To:
- Subject: [cgal-discuss] Re: Screen easely Cells, Facets, Edges, AlphaShape3D Weighted
- Date: Wed, 9 Feb 2011 08:19:54 -0800 (PST)
Thank you for your anwser.
It's really unclear for me.
it doesn't work :( To answer you about point, I just want to now the
belonging of my point to tetraedra/facets/Edge
input
coord
1 x y z w
2 x y z w
....
output
Results (results of Alpha Shape)
edges 1 2
edges 4 24
...
Tetrehedron 1 4 6 2
...
Triangles 78 4 3
...
typedef CGAL::Exact_predicates_inexact_constructions_kernel K;
typedef CGAL::Regular_triangulation_euclidean_traits_3<K> Gt;
typedef CGAL::Alpha_shape_vertex_base_3<Gt> Vb;
typedef CGAL::Alpha_shape_cell_base_3<Gt> Fb;
typedef CGAL::Triangulation_data_structure_3<Vb,Fb> Tds;
typedef CGAL::Regular_triangulation_3<Gt,Tds> Triangulation_3;
typedef CGAL::Alpha_shape_3<Triangulation_3> Alpha_shape_3;
typedef Alpha_shape_3::Cell_handle Cell_handle;
typedef Alpha_shape_3::Vertex_handle Vertex_handle;
typedef Alpha_shape_3::Facet Facet;
typedef Alpha_shape_3::Edge Edge;
typedef Gt::Weighted_point Weighted_point;
typedef Gt::Bare_point Bare_point;
/*TEST AREA*/
typedefTriple<Cell_handle, int, int> Edge; // does not compile
typedef std::pair<Cell_handle, int> Facet;
int main()
{
std::list<Weighted_point> lwp;
ifstream fpdb;
fpdb.open("1GXD.pdb");
string line;
while (getline(fpdb, line)){
/* Get coordinates*/
string type(line.substr(0,4));
if (type != "ATOM"){continue;}
string xstr(line.substr(30,8));
string ystr(line.substr(38,8));
string zstr(line.substr(46,8));
float x = atof(xstr.c_str());
float y = atof(ystr.c_str());
float z = atof(zstr.c_str());
lwp.push_back(Weighted_point(Bare_point( x, y, z), 1.80));
}
fpdb.close();
//build alpha_shape in GENERAL mode and set alpha=0
Alpha_shape_3 as(lwp.begin(), lwp.end(), 0, Alpha_shape_3::GENERAL);
//explore the 0-shape - It is dual to the boundary of the union.
//CGAL::Triangulation_data_structure_3::Cell_handle cells;
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::INTERIOR);
as.get_alpha_shape_facets(std::back_inserter(facets),
Alpha_shape_3::REGULAR);
as.get_alpha_shape_facets(std::back_inserter(facets),
Alpha_shape_3::SINGULAR);
as.get_alpha_shape_edges(std::back_inserter(edges),
Alpha_shape_3::SINGULAR);
std::map<Alpha_shape_3::Vertex*,unsigned int> index;
unsigned int i=0;
for (Alpha_shape_3::Finite_vertices_iterator
vit=as.finite_vertices_begin();vit!=as.finite_vertices_end();++vit)
{index.insert(std::make_pair(&(*vit)),i++); }
for (int k=0;k<4;++k) std::cout << index[ &( *(cells->vertex(k)) ) ];
std::cout <<std::endl;
for (k=0;k<3;++k)
std::cout << index[ &(*(facet.first->vertex( (facets.second+k)%4 )))];
std::cout <<std::endl;
std::cout << index[ &(*(edges.first->vertex( edges.second )))] <<" ";
std::cout << index[ &(*(edges.first->vertex( edges.third )))];
std::cout <<std::endl;
/*
std::list<Edge>::iterator fbeg = edges.begin();
std::list<Edge>::iterator fend = edges.end();
for (fbeg; fbeg != fend; fbeg++){
std::cout << fbeg.first << std::endl;
}*/
/*
for (Alpha_Shape_Edges_Iterator edge_alpha_it=edges.alpha_begin();
edge_alpha_it!=edges.alpha_end(); edge_alpha_it++)
{
Alpha_Edge& edge = *edge_alpha_it;
const Point_2& p1 =
edge.first->vertex(edge.first->ccw(edge.second))->point();
const Point_2& p2 = edge.first->vertex(edge.first->cw
(edge.second))->point();
std::cout << p1 << p2 << endl;
}*/
// std::ifstream iFileT("output",std::ios::in);
//iFileT >> as;
std::cout << "TOTO" << std::endl;
//std::cout << cells.neighbor(1) << std::endl;
std::cout << " The 0-shape has : " << std::endl;
//std::cout << cells.size() << " interior tetrahedra" << std::endl;
std::cout << facets.size() << " boundary facets" << std::endl;
std::cout << edges.size() << " singular edges" << std::endl;
return 1;
}
--
View this message in context:
http://cgal-discuss.949826.n4.nabble.com/Screen-easely-Cells-Facets-Edges-AlphaShape3D-Weighted-tp3297041p3297578.html
Sent from the cgal-discuss mailing list archive at Nabble.com.
- [cgal-discuss] Screen easely Cells, Facets, Edges, AlphaShape3D Weighted, MrVH, 02/09/2011
- Re: [cgal-discuss] Screen easely Cells, Facets, Edges, AlphaShape3D Weighted, Sebastien Loriot (GeometryFactory), 02/09/2011
- [cgal-discuss] Re: Screen easely Cells, Facets, Edges, AlphaShape3D Weighted, MrVH, 02/09/2011
- Re: [cgal-discuss] Re: Screen easely Cells, Facets, Edges, AlphaShape3D Weighted, Sebastien Loriot (GeometryFactory), 02/09/2011
- [cgal-discuss] Re: Screen easely Cells, Facets, Edges, AlphaShape3D Weighted, MrVH, 02/10/2011
- [cgal-discuss] Re: Screen easely Cells, Facets, Edges, AlphaShape3D Weighted, MrVH, 02/10/2011
- Re: [cgal-discuss] Re: Screen easely Cells, Facets, Edges, AlphaShape3D Weighted, Sebastien Loriot (GeometryFactory), 02/10/2011
- [cgal-discuss] Re: Screen easely Cells, Facets, Edges, AlphaShape3D Weighted, MrVH, 02/10/2011
- [cgal-discuss] Re: Screen easely Cells, Facets, Edges, AlphaShape3D Weighted, MrVH, 02/10/2011
- [cgal-discuss] Re: Screen easely Cells, Facets, Edges, AlphaShape3D Weighted, MrVH, 02/11/2011
- Re: [cgal-discuss] Re: Screen easely Cells, Facets, Edges, AlphaShape3D Weighted, Sebastien Loriot (GeometryFactory), 02/11/2011
- [cgal-discuss] Re: Screen easely Cells, Facets, Edges, AlphaShape3D Weighted, MrVH, 02/11/2011
- [cgal-discuss] Re: Screen easely Cells, Facets, Edges, AlphaShape3D Weighted, MrVH, 02/11/2011
- Re: [cgal-discuss] Re: Screen easely Cells, Facets, Edges, AlphaShape3D Weighted, Sebastien Loriot (GeometryFactory), 02/10/2011
- [cgal-discuss] Re: Screen easely Cells, Facets, Edges, AlphaShape3D Weighted, MrVH, 02/10/2011
- [cgal-discuss] Re: Screen easely Cells, Facets, Edges, AlphaShape3D Weighted, MrVH, 02/10/2011
- Re: [cgal-discuss] Re: Screen easely Cells, Facets, Edges, AlphaShape3D Weighted, Sebastien Loriot (GeometryFactory), 02/09/2011
- [cgal-discuss] Re: Screen easely Cells, Facets, Edges, AlphaShape3D Weighted, MrVH, 02/09/2011
- Re: [cgal-discuss] Screen easely Cells, Facets, Edges, AlphaShape3D Weighted, Sebastien Loriot (GeometryFactory), 02/09/2011
Archive powered by MHonArc 2.6.16.