Subject: CGAL users discussion list
List archive
- From: mbletry <>
- To:
- Subject: [cgal-discuss] tetrahedralization of random set of point
- Date: Tue, 10 Feb 2015 05:10:58 -0800 (PST)
Hello,
I am very new to cgal and I am trying to use it to produce all the
tetrahedra that would connect all spheres to all their nearest neighbours
(and not further !) of a set of random points, covering all space, and I
then want to go through all tetrahedra of the mesh to compute some
distortion value.
For the time being, I am doing this :
#include <CGAL/Exact_predicates_inexact_constructions_kernel.h>
#include <CGAL/Triangulation_3.h>
#include <iostream>
#include <fstream>
#include <cassert>
#include <list>
#include <vector>
#include "agregat.h"
typedef CGAL::Exact_predicates_inexact_constructions_kernel K;
typedef CGAL::Triangulation_3<K> Triangulation;
typedef Triangulation::Cell_handle Cell_handle;
typedef Triangulation::Vertex_handle Vertex_handle;
typedef Triangulation::Locate_type Locate_type;
typedef Triangulation::Point Point;
int main(int argc, char *argv[])
{
std::string mystr(argv[1]);
//Container of the random points from a file
Agregat myag(mystr);
// construction from a list of points :
std::list<Point> L;
for (int i = 1 ; i < myag.Nbt() ; i++){
L.push_front(Point(myag.X(i) , myag.Y(i) ,myag.Z(i) ));
//build the tetrahedra
Triangulation T(L.begin(), L.end());
//perfection index of the tetrahedra
vector<double> ind_perf;
ind_perf.reserve( T.number_of_cells() );
//go through each tetrahedra and compute its perfection index and store it
Triangulation::Finite_cells_iterator mycell;
for( mycell = T.finite_cells_begin() ; mycell != T.finite_cells_end() ;
++mycell ){
ind_perf.push_back(
(mycell->vertex(0)->point()[0]-mycell->vertex(1)->point()[0]) *
(mycell->vertex(0)->point()[0]-mycell->vertex(1)->point()[0])
);
}
return 0;
}
I have very basic questions : does this method provide the set of tetrahedra
I want to get ? Am I actually iterating through all of them ? The perfection
index I have on a small set of points gives rather large values that seem
odd to me but I don't really trust my instinct on that one and I was
wondering if I had made an obvious mistake...
Thank you very much for any help !!
Marc
--
View this message in context:
http://cgal-discuss.949826.n4.nabble.com/tetrahedralization-of-random-set-of-point-tp4660424.html
Sent from the cgal-discuss mailing list archive at Nabble.com.
- [cgal-discuss] tetrahedralization of random set of point, mbletry, 02/10/2015
- Re: [cgal-discuss] tetrahedralization of random set of point, mbletry, 02/10/2015
- Re: [cgal-discuss] tetrahedralization of random set of point, Sebastien Loriot (GeometryFactory), 02/10/2015
- Re: [cgal-discuss] tetrahedralization of random set of point, mbletry, 02/10/2015
- Re: [cgal-discuss] tetrahedralization of random set of point, Sebastien Loriot (GeometryFactory), 02/10/2015
- Re: [cgal-discuss] tetrahedralization of random set of point, mbletry, 02/10/2015
Archive powered by MHonArc 2.6.18.