Subject: CGAL users discussion list
List archive
- From: neiji93 <>
- To:
- Subject: Re: [cgal-discuss] CGAL Poisson surface reconstruction compilation error
- Date: Fri, 3 Jun 2016 04:24:05 -0700 (PDT)
- Authentication-results: mail2-smtp-roc.national.inria.fr; spf=None ; spf=SoftFail ; spf=None
- Ironport-phdr: 9a23:Gzv64hZt9/mwyrIKKYAcatX/LSx+4OfEezUN459isYplN5qZpc+5bnLW6fgltlLVR4KTs6sC0LqH9f67EjBeqb+681k8M7V0HycfjssXmwFySOWkMmbcaMDQUiohAc5ZX0Vk9XzoeWJcGcL5ekGA6ibqtW1aJBzzOEJPK/jvHcaK1oLsh7H0pcaYP1sArQH+SI0xBS3+lR/WuMgSjNkqAYcK4TyNnEF1ff9Lz3hjP1OZkkW0zM6x+Jl+73YY4Kp5pIYTGZn9Kq83RLgdADU9OH0u/+XqswPCRE2B/CgySGITxxxFAgrEvUqyCpH8syn757FV2C6GOMT3SfY6Q2LxvO9QVBb0hXJfZHYC+2bNh5kogQ==
Microsoft visual studio Express 2012. I'll use it with DirectX. Here there is
the header file :
class MeshGenerator
{
private:
//typedef CGAL::Simple_cartesian<double> Kernel;
typedef CGAL::Exact_predicates_inexact_constructions_kernel Kernel;
typedef Kernel::Point_3 Point_3;
typedef Kernel::FT
FT;
typedef CGAL::Polyhedron_3< Kernel,
CGAL::Polyhedron_items_3,
CGAL::HalfedgeDS_vector> Polyhedron;
Polyhedron output_mesh;
typedef std::vector<CGAL::Point_with_normal_3<Kernel> > PointList;
typedef CGAL::Point_with_normal_3<Kernel> Point;
// Poisson implicit function
typedef CGAL::Poisson_reconstruction_function<Kernel>
Poisson_reconstruction_function;
typedef CGAL::Surface_mesh_default_triangulation_3 STr;
typedef CGAL::Poisson_implicit_surface_3<Kernel,
Poisson_reconstruction_function> Surface_3;
typedef Surface_3::Sphere_3 Sphere;
typedef CGAL::Surface_mesh_complex_2_in_triangulation_3<STr> C2t3;//
SurfaceMeshC2T3 c2t3;
typedef Polyhedron::Vertex_iterator Vertex_iterator;
typedef Polyhedron::Facet_iterator Facet_iterator;
Mesh* mesh;
//firend class Mesh;
ID3D11Device* device;
ID3D11DeviceContext* context;
public:
MeshGenerator(ID3D11Device* dev, ID3D11DeviceContext* cont);
void build_from_mesh(Mesh& mesh, C2t3& cgal_mesh);
int build_from_point_set( DirectX::XMFLOAT3* positions,
DirectX::XMFLOAT3*
normals , UINT numVertices );
int build_from_polyhedron( Polyhedron p);
Polyhedron getPolyhedron();
Mesh* getMesh(){ return mesh; }
};
and here the source code for build_from_point_set, it's the same as the
sample shown here :
http://doc.cgal.org/latest/Poisson_surface_reconstruction_3/
int MeshGenerator::build_from_point_set( DirectX::XMFLOAT3* positions,
DirectX::XMFLOAT3* normals , UINT numVertices ) //VERTEX_PNTTB* vertexes )
{
// Poisson options
FT sm_angle = 20.0; // Min triangle angle in degrees.
FT sm_radius = 30; // Max triangle size w.r.t. point set average
spacing.
FT sm_distance = 0.375; // Surface Approximation error w.r.t. point set
average spacing.
// Reads the point set file in points[].
// Note: read_xyz_points_and_normals() requires an iterator over points
// + property maps to access each point's position and normal.
// The position property map can be omitted here as we use iterators
over Point_3 elements.
PointList points;
//insert vertexes positions and normals into points points list
//points.resize(numVertices);
Point p;
for(UINT i=0; i<numVertices; i++)
{
p=Point(positions[i].x,positions[i].y,positions[i].z);
points.push_back( p );
//points[i].x = positions[i].x;
//points[i].y = positions[i].y;
//points[i].z = positions[i].z;
//points[i].position[0]=positions[i].x;
//points[i].position[1]=positions[i].y;
//points[i].position[2]=positions[i].z;
}
// CGAL::read_xyz_points(positions, back_inserter(points),
CGAL::Identity_property_map<T>());
// Creates implicit function from the read points using the default
solver.
// Note: this method requires an iterator over points
// + property maps to access each point's position and normal.
// The position property map can be omitted here as we use iterators
over Point_3 elements.
CGAL::Poisson_reconstruction_function<Kernel> function(points.begin(),
points.end(),
CGAL::make_normal_of_point_with_normal_pmap(PointList::value_type()) );
// Computes the Poisson indicator function f()
// at each vertex of the triangulation.
if ( ! function.compute_implicit_function() )
return 0; //NULL;
// Computes average spacing
//FT average_spacing =
CGAL::compute_average_spacing<CGAL::Sequential_tag>(points.begin(),
points.end(),
// 6 ); // knn = 1
ring );
FT average_spacing = CGAL::compute_average_spacing(points.begin(),
points.end(), 6);
// Gets one point inside the implicit surface
// and computes implicit function bounding sphere radius.
CGAL::Poisson_reconstruction_function<Kernel>::Point inner_point =
function.get_inner_point();
CGAL::Poisson_reconstruction_function<Kernel>::Sphere bsphere =
function.bounding_sphere();
FT radius = std::sqrt(bsphere.squared_radius());
// Defines the implicit surface: requires defining a
// conservative bounding sphere centered at inner point.
FT sm_sphere_radius = 5.0 * radius;
FT sm_dichotomy_error = sm_distance*average_spacing/1000.0; // Dichotomy
error must be << sm_distance
Surface_3 surface(function,
Sphere(inner_point,sm_sphere_radius*sm_sphere_radius),
sm_dichotomy_error/sm_sphere_radius);
// Defines surface mesh generation criteria
CGAL::Surface_mesh_default_criteria_3<STr> criteria(sm_angle, // Min
triangle angle (degrees)
sm_radius*average_spacing, // Max triangle size
sm_distance*average_spacing); // Approximation error
// Generates surface mesh with manifold option
STr tr; // 3D Delaunay triangulation for surface mesh generation
C2t3 c2t3(tr); // 2D complex in 3D Delaunay triangulation
CGAL::make_surface_mesh(c2t3, //
reconstructed mesh
surface, //
implicit surface
criteria, // meshing
criteria
CGAL::Manifold_with_boundary_tag()); // require
manifold mesh
if(tr.number_of_vertices() == 0)
return 0; //EXIT_FAILURE;
CGAL::output_surface_facets_to_polyhedron(c2t3, output_mesh);
Polyhedron::Facet_iterator facetiterator;
//build_from_mesh( ,c2t3);
build_from_polyhedron(output_mesh);
//everything ok
return 1;
}
When I try to debug the application, putting comments for the methods
make_surface or output_surface_facets_to_polyhedron solve the problem but
don't do any task.
--
View this message in context:
http://cgal-discuss.949826.n4.nabble.com/CGAL-Poisson-surface-reconstruction-compilation-error-tp4661972p4661974.html
Sent from the cgal-discuss mailing list archive at Nabble.com.
- [cgal-discuss] CGAL Poisson surface reconstruction compilation error, neiji93, 06/03/2016
- Re: [cgal-discuss] CGAL Poisson surface reconstruction compilation error, Andreas Fabri, 06/03/2016
- Re: [cgal-discuss] CGAL Poisson surface reconstruction compilation error, neiji93, 06/03/2016
- Re: [cgal-discuss] CGAL Poisson surface reconstruction compilation error, Andreas Fabri, 06/03/2016
Archive powered by MHonArc 2.6.18.