CGAL/cgal

write_polygon_soup() fails to compile with EPEC Kernel

Opened this issue · 7 comments

Issue Details

The title says it all.

Source Code

#include <array>
#include <vector>

#if 1
#include <CGAL/Exact_predicates_exact_constructions_kernel.h>
using Kernel = CGAL::Exact_predicates_exact_constructions_kernel;
#else
#include <CGAL/Exact_predicates_inexact_constructions_kernel.h>
using Kernel = CGAL::Exact_predicates_inexact_constructions_kernel;
#endif
#include <CGAL/IO/polygon_soup_io.h>
int main() {
  std::vector<Kernel::Point_3> points;
  std::vector<std::array<std::size_t, 3>> polygons;
  CGAL::IO::write_polygon_soup("xxx.off", points, polygons, CGAL::parameters::stream_precision(17));
  return 0;
}

Environment

  • Operating system (Windows/Mac/Linux, 32/64 bits):
  • Compiler:
  • Release or debug mode:
  • Specific flags used (if any):
  • CGAL version: latest
  • Boost version:
  • Other libraries versions if used (Eigen, TBB, etc.):

Do you expect it to be written as exact numbers or as doubles? With Epeck it will be a double, that is my question is more general, e.g. in case of Simple_cartesian<Gmpq>. It should be double as otherwise we store something in files with misleading file extensions.

@MaelRL in the effort to unify header file names, should that not be <CGAL/IO/write_polygon_soup.h>

I will have a look.

@MaelRL in the effort to unify header file names, should that not be <CGAL/IO/write_polygon_soup.h>

polygon_soup_io.h contains both read and write.

The function CGAL::IO::write_polygon_soup() has a named parameter point_map which is not documented.
Used as below fixes the issue.

auto pm = CGAL::make_cartesian_converter_property_map<Epick::Point_3>(CGAL::make_identity_property_map(Kernel::Point_3()));
CGAL::IO::write_polygon_soup("xxx.off", points, polygons, CGAL::parameters::stream_precision(17).point_map(pm));

Do you expect it to be written as exact numbers or as doubles? With Epeck it will be a double, that is my question is more general, e.g. in case of Simple_cartesian<Gmpq>. It should be double as otherwise we store something in files with misleading file extensions.

@efifogel ping on your expectations

For the property map I think the function should always internally create a double or float as required by the specification of the file format, and there should not be a need for a property map.
The property map is still useful in case the user has an array<pair<Point,string>> or similar.