mirror of https://github.com/CGAL/cgal
example for segmentation algorithm.
This commit is contained in:
parent
e16ef4c0ac
commit
ed6a0b5c36
|
|
@ -4011,6 +4011,8 @@ Surface_mesh_parameterization/test/Surface_mesh_parameterization/extensive_param
|
|||
Surface_mesh_parameterization/test/Surface_mesh_parameterization/quick_test_suite.bat eol=crlf
|
||||
Surface_mesh_parameterization/test/Surface_mesh_parameterization/quick_test_suite.sh eol=lf
|
||||
Surface_mesh_segmentation/example/Surface_mesh_segmentation/CMakeLists.txt -text
|
||||
Surface_mesh_segmentation/example/Surface_mesh_segmentation/camel.off -text
|
||||
Surface_mesh_segmentation/example/Surface_mesh_segmentation/segmentation_example.cpp -text
|
||||
Surface_mesh_segmentation/example/Surface_mesh_segmentation/simple_example.cpp -text
|
||||
Surface_mesh_segmentation/include/CGAL/Surface_mesh_segmentation.h -text
|
||||
Surface_mesh_segmentation/include/CGAL/internal/Surface_mesh_segmentation/Expectation_maximization.h -text
|
||||
|
|
|
|||
|
|
@ -22,7 +22,7 @@ if ( CGAL_FOUND )
|
|||
include( CGAL_CreateSingleSourceCGALProgram )
|
||||
|
||||
create_single_source_cgal_program( "simple_example.cpp" )
|
||||
|
||||
create_single_source_cgal_program( "segmentation_example.cpp" )
|
||||
else()
|
||||
|
||||
message(STATUS "This program requires the CGAL library, and will not be compiled.")
|
||||
|
|
|
|||
File diff suppressed because it is too large
Load Diff
|
|
@ -0,0 +1,33 @@
|
|||
#include <iostream>
|
||||
#include <fstream>
|
||||
#include <cstdlib>
|
||||
|
||||
#include <CGAL/Surface_mesh_segmentation.h>
|
||||
|
||||
#include <CGAL/Simple_cartesian.h>
|
||||
#include <CGAL/Polyhedron_3.h>
|
||||
#include <CGAL/IO/Polyhedron_iostream.h>
|
||||
|
||||
typedef CGAL::Simple_cartesian<double> Kernel;
|
||||
typedef CGAL::Polyhedron_3<Kernel> Polyhedron;
|
||||
typedef CGAL::Surface_mesh_segmentation<Polyhedron> Segmentation;
|
||||
|
||||
int main(int argc, char **argv)
|
||||
{
|
||||
std::ifstream meshFile("camel.off");
|
||||
if(!meshFile)
|
||||
{
|
||||
std::cerr << "Could not open the file!" << std::endl;
|
||||
return EXIT_FAILURE;
|
||||
}
|
||||
|
||||
Polyhedron mesh;
|
||||
meshFile >> mesh;
|
||||
|
||||
int ray_sqrt = 7; // cast (7*7)49 rays per facet
|
||||
int number_of_clusters = 2; // apply gmm fitting with 2 clusters
|
||||
double cone_angle = (2.0 / 3.0) * CGAL_PI;
|
||||
|
||||
Segmentation segmentation(&mesh, ray_sqrt, cone_angle, number_of_clusters);
|
||||
//segmentation.write_sdf_values("sdf_values.txt");
|
||||
}
|
||||
Loading…
Reference in New Issue