Search code examples
matlabmexcgal

How to solve: error C2039: 'make_normal_of_point_with_normal_pmap': is not a member of 'CGAL'


I am using CGAL 4.12 and eigen 3.3.4 and trying to compile the Poisson_surface_reconstruction_3 example trough a Matlab mex function and am getting the following error:

C:\Users\u0116401\Documents\PRosPeRoS\Matlab_Code\mexTest\CGAL_poisson_reconstruction.cpp(70): error C2039: 'make_normal_of_point_with_normal_pmap': is not a member of 'CGAL'
C:\dev\CGAL-4.12\include\CGAL/IO/read_xyz_points.h(40): note: see declaration of 'CGAL'
C:\Users\u0116401\Documents\PRosPeRoS\Matlab_Code\mexTest\CGAL_poisson_reconstruction.cpp(70): error C3861: 'make_normal_of_point_with_normal_pmap': identifier not found

It seems 'make_normal_of_point_with_normal_pmap' can't be found. Does anyone know what is causing this issue?

The code that produces this error is:

/* mex headers */
#include <mex.h>

/* C++ headers */
#include <vector>
#include <fstream>

/* CGAL headers */
#include <CGAL/trace.h>
#include <CGAL/Exact_predicates_inexact_constructions_kernel.h>
#include <CGAL/Polyhedron_3.h>
#include <CGAL/IO/Polyhedron_iostream.h>
#include <CGAL/Surface_mesh_default_triangulation_3.h>
#include <CGAL/make_surface_mesh.h>
#include <CGAL/Implicit_surface_3.h>
#include <CGAL/IO/output_surface_facets_to_polyhedron.h>
#include <CGAL/Poisson_reconstruction_function.h>
#include <CGAL/Point_with_normal_3.h>
#include <CGAL/property_map.h>
#include <CGAL/IO/read_xyz_points.h>
#include <CGAL/compute_average_spacing.h>

// Types
typedef CGAL::Exact_predicates_inexact_constructions_kernel Kernel;
typedef Kernel::FT FT;
typedef Kernel::Point_3 Point;
typedef CGAL::Point_with_normal_3<Kernel> Point_with_normal;
typedef Kernel::Sphere_3 Sphere;
typedef std::vector<Point_with_normal> PointList;
typedef CGAL::Polyhedron_3<Kernel> Polyhedron;
typedef CGAL::Poisson_reconstruction_function<Kernel>Poisson_reconstruction_function;
typedef CGAL::Surface_mesh_default_triangulation_3 STr;
typedef CGAL::Surface_mesh_complex_2_in_triangulation_3<STr> C2t3;
typedef CGAL::Implicit_surface_3<Kernel, Poisson_reconstruction_function> Surface_3;

void mexFunction(int nlhs, mxArray *plhs[],      /*Output variables */
             int nrhs, const mxArray *prhs[]) /*Input variables */
{
    PointList points;
    std::ifstream stream("kitten.xyz");
    if (!stream ||
        !CGAL::read_xyz_points_and_normals(
                            stream,
                            std::back_inserter(points),
                            CGAL::make_normal_of_point_with_normal_pmap(std::back_inserter(points))))
}

Solution

  • The function is named make_normal_of_point_with_normal_map() (map not pmap) and it takes Point_with_normal as parameter. The call should be:

    CGAL::make_normal_of_point_with_normal_map(Point_with_normal())