Document the named parameter point_map and use it in the issue

This commit is contained in:
Andreas Fabri 2025-09-19 15:38:46 +01:00
parent 967aee62e9
commit 6c4aeabb9d
7 changed files with 44 additions and 6 deletions

View File

@ -2650,7 +2650,7 @@ namespace CommonKernelFunctors {
{
CGAL_kernel_precondition(! K().collinear_3_object()(p,q,r) );
Vector_3 res = CGAL::cross_product(q-p, r-p);
res = res / CGAL::approximate_sqrt(res.squared_length());
res = res / sqrt(res.squared_length());
return res;
}
};

View File

@ -331,6 +331,13 @@ bool write_GOCAD(std::ostream& os,
* \param np optional sequence of \ref bgl_namedparameters "Named Parameters" among the ones listed below
*
* \cgalNamedParamsBegin
* \cgalParamNBegin{point_map}
* \cgalParamDescription{a property map associating points with floating point coordinates to the elements of the point set `points`}
* \cgalParamType{a model of `ReadablePropertyMap` whose key type is the value type
* of the iterator of `PointRange` and value type is a point type with floating point coordinates}
* \cgalParamDefault{`CGAL::Identity_property_map<geom_traits::Point_3>`}
* \cgalParamNEnd
*
* \cgalParamNBegin{stream_precision}
* \cgalParamDescription{a parameter used to set the precision (i.e. how many digits are generated) of the output stream}
* \cgalParamType{int}

View File

@ -314,6 +314,13 @@ bool read_OBJ(const std::string& fname,
* \param np optional sequence of \ref bgl_namedparameters "Named Parameters" among the ones listed below
*
* \cgalNamedParamsBegin
* \cgalParamNBegin{point_map}
* \cgalParamDescription{a property map associating points with floating point coordinates to the elements of the point set `points`}
* \cgalParamType{a model of `ReadablePropertyMap` whose key type is the value type
* of the iterator of `PointRange` and value type is a point type with floating point coordinates}
* \cgalParamDefault{`CGAL::Identity_property_map<geom_traits::Point_3>`}
* \cgalParamNEnd
*
* \cgalParamNBegin{stream_precision}
* \cgalParamDescription{a parameter used to set the precision (i.e. how many digits are generated) of the output stream}
* \cgalParamType{int}

View File

@ -267,6 +267,13 @@ bool read_OFF(const std::string& fname,
* \param np optional sequence of \ref bgl_namedparameters "Named Parameters" among the ones listed below
*
* \cgalNamedParamsBegin
* \cgalParamNBegin{point_map}
* \cgalParamDescription{a property map associating points with floating point coordinates to the elements of the point set `points`}
* \cgalParamType{a model of `ReadablePropertyMap` whose key type is the value type
* of the iterator of `PointRange` and value type is a point type with floating point coordinates}
* \cgalParamDefault{`CGAL::Identity_property_map<geom_traits::Point_3>`}
* \cgalParamNEnd
*
* \cgalParamNBegin{stream_precision}
* \cgalParamDescription{a parameter used to set the precision (i.e. how many digits are generated) of the output stream}
* \cgalParamType{int}
@ -308,6 +315,13 @@ bool write_OFF(std::ostream& os,
* \param np optional sequence of \ref bgl_namedparameters "Named Parameters" among the ones listed below
*
* \cgalNamedParamsBegin
* \cgalParamNBegin{point_map}
* \cgalParamDescription{a property map associating points with floating point coordinates to the elements of the point set `points`}
* \cgalParamType{a model of `ReadablePropertyMap` whose key type is the value type
* of the iterator of `PointRange` and value type is a point type with floating point coordinates}
* \cgalParamDefault{`CGAL::Identity_property_map<geom_traits::Point_3>`}
* \cgalParamNEnd
*
* \cgalParamNBegin{stream_precision}
* \cgalParamDescription{a parameter used to set the precision (i.e. how many digits are generated) of the output stream}
* \cgalParamType{int}

View File

@ -319,10 +319,10 @@ bool write_STL(std::ostream& os,
const Vector_3 n = collinear(p,q,r) ? Vector_3(1,0,0) : unit_normal(p,q,r);
const float coords[12] = { static_cast<float>(to_double(n.x())), static_cast<float>(to_double(n.y())), static_cast<float>(to_double(n.z())),
static_cast<float>(to_double(p.x())), static_cast<float>(to_double(p.y())), static_cast<float>(to_double(p.z())),
static_cast<float>(to_double(q.x())), static_cast<float>(to_double(q.y())), static_cast<float>(to_double(q.z())),
static_cast<float>(to_double(r.x())), static_cast<float>(to_double(r.y())), static_cast<float>(to_double(r.z())) };
const float coords[12] = { static_cast<float>(n.x()), static_cast<float>(n.y()), static_cast<float>(n.z()),
static_cast<float>(p.x()), static_cast<float>(p.y()), static_cast<float>(p.z()),
static_cast<float>(q.x()), static_cast<float>(q.y()), static_cast<float>(q.z()),
static_cast<float>(r.x()), static_cast<float>(r.y()), static_cast<float>(r.z()) };
for(int i=0; i<12; ++i)
os.write(reinterpret_cast<const char *>(&coords[i]), sizeof(coords[i]));

View File

@ -142,6 +142,13 @@ bool read_polygon_soup(const std::string& fname,
* \param np optional \ref bgl_namedparameters "Named Parameters" described below
*
* \cgalNamedParamsBegin
* \cgalParamNBegin{point_map}
* \cgalParamDescription{a property map associating points with floating point coordinates to the elements of the point set `points`}
* \cgalParamType{a model of `ReadablePropertyMap` whose key type is the value type
* of the iterator of `PointRange` and value type is a point type with floating point coordinates}
* \cgalParamDefault{`CGAL::Identity_property_map<geom_traits::Point_3>`}
* \cgalParamNEnd
*
* \cgalParamNBegin{verbose}
* \cgalParamDescription{indicates whether output warnings and error messages should be printed or not.}
* \cgalParamType{Boolean}

View File

@ -2,13 +2,16 @@
#include <vector>
#include <CGAL/Exact_predicates_exact_constructions_kernel.h>
#include <CGAL/Exact_predicates_inexact_constructions_kernel.h>
#include <CGAL/IO/polygon_soup_io.h>
using Kernel = CGAL::Exact_predicates_exact_constructions_kernel;
using Epick = CGAL::Exact_predicates_inexact_constructions_kernel;
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));
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));
return 0;
}