From 967aee62e956bf4a9580a2b559f6a7e42665ce60 Mon Sep 17 00:00:00 2001 From: Andreas Fabri Date: Thu, 18 Sep 2025 09:19:19 +0100 Subject: [PATCH 01/30] Stream_support: Fix for Epeck --- Kernel_23/include/CGAL/Kernel/function_objects.h | 2 +- Stream_support/include/CGAL/IO/STL.h | 8 ++++---- Stream_support/test/Stream_support/issue_9071.cpp | 14 ++++++++++++++ 3 files changed, 19 insertions(+), 5 deletions(-) create mode 100644 Stream_support/test/Stream_support/issue_9071.cpp diff --git a/Kernel_23/include/CGAL/Kernel/function_objects.h b/Kernel_23/include/CGAL/Kernel/function_objects.h index b71470a6262..7d43dbf4c2d 100644 --- a/Kernel_23/include/CGAL/Kernel/function_objects.h +++ b/Kernel_23/include/CGAL/Kernel/function_objects.h @@ -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::sqrt(res.squared_length()); + res = res / CGAL::approximate_sqrt(res.squared_length()); return res; } }; diff --git a/Stream_support/include/CGAL/IO/STL.h b/Stream_support/include/CGAL/IO/STL.h index dfa3ecded7e..1e2850fb994 100644 --- a/Stream_support/include/CGAL/IO/STL.h +++ b/Stream_support/include/CGAL/IO/STL.h @@ -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(n.x()), static_cast(n.y()), static_cast(n.z()), - static_cast(p.x()), static_cast(p.y()), static_cast(p.z()), - static_cast(q.x()), static_cast(q.y()), static_cast(q.z()), - static_cast(r.x()), static_cast(r.y()), static_cast(r.z()) }; + const float coords[12] = { static_cast(to_double(n.x())), static_cast(to_double(n.y())), static_cast(to_double(n.z())), + static_cast(to_double(p.x())), static_cast(to_double(p.y())), static_cast(to_double(p.z())), + static_cast(to_double(q.x())), static_cast(to_double(q.y())), static_cast(to_double(q.z())), + static_cast(to_double(r.x())), static_cast(to_double(r.y())), static_cast(to_double(r.z())) }; for(int i=0; i<12; ++i) os.write(reinterpret_cast(&coords[i]), sizeof(coords[i])); diff --git a/Stream_support/test/Stream_support/issue_9071.cpp b/Stream_support/test/Stream_support/issue_9071.cpp new file mode 100644 index 00000000000..ac166f6ad0b --- /dev/null +++ b/Stream_support/test/Stream_support/issue_9071.cpp @@ -0,0 +1,14 @@ +#include +#include + +#include +#include + +using Kernel = CGAL::Exact_predicates_exact_constructions_kernel; + +int main() { + std::vector points; + std::vector> polygons; + CGAL::IO::write_polygon_soup("xxx.off", points, polygons, CGAL::parameters::stream_precision(17)); + return 0; +} From 6c4aeabb9d130248b6e86e20334e1773111e970e Mon Sep 17 00:00:00 2001 From: Andreas Fabri Date: Fri, 19 Sep 2025 15:38:46 +0100 Subject: [PATCH 02/30] Document the named parameter point_map and use it in the issue --- Kernel_23/include/CGAL/Kernel/function_objects.h | 2 +- Stream_support/include/CGAL/IO/GOCAD.h | 7 +++++++ Stream_support/include/CGAL/IO/OBJ.h | 7 +++++++ Stream_support/include/CGAL/IO/OFF.h | 14 ++++++++++++++ Stream_support/include/CGAL/IO/STL.h | 8 ++++---- Stream_support/include/CGAL/IO/polygon_soup_io.h | 7 +++++++ Stream_support/test/Stream_support/issue_9071.cpp | 5 ++++- 7 files changed, 44 insertions(+), 6 deletions(-) diff --git a/Kernel_23/include/CGAL/Kernel/function_objects.h b/Kernel_23/include/CGAL/Kernel/function_objects.h index 7d43dbf4c2d..1182470f801 100644 --- a/Kernel_23/include/CGAL/Kernel/function_objects.h +++ b/Kernel_23/include/CGAL/Kernel/function_objects.h @@ -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; } }; diff --git a/Stream_support/include/CGAL/IO/GOCAD.h b/Stream_support/include/CGAL/IO/GOCAD.h index 07b4b6dec07..c2e0844d6b1 100644 --- a/Stream_support/include/CGAL/IO/GOCAD.h +++ b/Stream_support/include/CGAL/IO/GOCAD.h @@ -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`} + * \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} diff --git a/Stream_support/include/CGAL/IO/OBJ.h b/Stream_support/include/CGAL/IO/OBJ.h index a856c4e6cbf..f00381a8333 100644 --- a/Stream_support/include/CGAL/IO/OBJ.h +++ b/Stream_support/include/CGAL/IO/OBJ.h @@ -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`} + * \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} diff --git a/Stream_support/include/CGAL/IO/OFF.h b/Stream_support/include/CGAL/IO/OFF.h index ff17f202bba..dc11fb82e31 100644 --- a/Stream_support/include/CGAL/IO/OFF.h +++ b/Stream_support/include/CGAL/IO/OFF.h @@ -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`} + * \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`} + * \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} diff --git a/Stream_support/include/CGAL/IO/STL.h b/Stream_support/include/CGAL/IO/STL.h index 1e2850fb994..dfa3ecded7e 100644 --- a/Stream_support/include/CGAL/IO/STL.h +++ b/Stream_support/include/CGAL/IO/STL.h @@ -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(to_double(n.x())), static_cast(to_double(n.y())), static_cast(to_double(n.z())), - static_cast(to_double(p.x())), static_cast(to_double(p.y())), static_cast(to_double(p.z())), - static_cast(to_double(q.x())), static_cast(to_double(q.y())), static_cast(to_double(q.z())), - static_cast(to_double(r.x())), static_cast(to_double(r.y())), static_cast(to_double(r.z())) }; + const float coords[12] = { static_cast(n.x()), static_cast(n.y()), static_cast(n.z()), + static_cast(p.x()), static_cast(p.y()), static_cast(p.z()), + static_cast(q.x()), static_cast(q.y()), static_cast(q.z()), + static_cast(r.x()), static_cast(r.y()), static_cast(r.z()) }; for(int i=0; i<12; ++i) os.write(reinterpret_cast(&coords[i]), sizeof(coords[i])); diff --git a/Stream_support/include/CGAL/IO/polygon_soup_io.h b/Stream_support/include/CGAL/IO/polygon_soup_io.h index c1239c9f3e1..c9b7eff3b13 100644 --- a/Stream_support/include/CGAL/IO/polygon_soup_io.h +++ b/Stream_support/include/CGAL/IO/polygon_soup_io.h @@ -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`} + * \cgalParamNEnd + * * \cgalParamNBegin{verbose} * \cgalParamDescription{indicates whether output warnings and error messages should be printed or not.} * \cgalParamType{Boolean} diff --git a/Stream_support/test/Stream_support/issue_9071.cpp b/Stream_support/test/Stream_support/issue_9071.cpp index ac166f6ad0b..94b23c4581d 100644 --- a/Stream_support/test/Stream_support/issue_9071.cpp +++ b/Stream_support/test/Stream_support/issue_9071.cpp @@ -2,13 +2,16 @@ #include #include +#include #include using Kernel = CGAL::Exact_predicates_exact_constructions_kernel; +using Epick = CGAL::Exact_predicates_inexact_constructions_kernel; int main() { std::vector points; std::vector> polygons; - CGAL::IO::write_polygon_soup("xxx.off", points, polygons, CGAL::parameters::stream_precision(17)); + auto pm = CGAL::make_cartesian_converter_property_map(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; } From 7d4852a60fde4cee7596de377a2ff275cec096e9 Mon Sep 17 00:00:00 2001 From: Andreas Fabri Date: Fri, 19 Sep 2025 15:46:42 +0100 Subject: [PATCH 03/30] trailing whitespace --- Stream_support/include/CGAL/IO/OFF.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Stream_support/include/CGAL/IO/OFF.h b/Stream_support/include/CGAL/IO/OFF.h index dc11fb82e31..8ca46ca937d 100644 --- a/Stream_support/include/CGAL/IO/OFF.h +++ b/Stream_support/include/CGAL/IO/OFF.h @@ -273,7 +273,7 @@ bool read_OFF(const std::string& fname, * of the iterator of `PointRange` and value type is a point type with floating point coordinates} * \cgalParamDefault{`CGAL::Identity_property_map`} * \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} @@ -321,7 +321,7 @@ bool write_OFF(std::ostream& os, * of the iterator of `PointRange` and value type is a point type with floating point coordinates} * \cgalParamDefault{`CGAL::Identity_property_map`} * \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} From 316c45503449e35ebbd749609405fc5783d54592 Mon Sep 17 00:00:00 2001 From: Andreas Fabri Date: Fri, 19 Sep 2025 15:51:53 +0100 Subject: [PATCH 04/30] Fix Default for the point_map type --- Stream_support/include/CGAL/IO/GOCAD.h | 2 +- Stream_support/include/CGAL/IO/OBJ.h | 2 +- Stream_support/include/CGAL/IO/OFF.h | 2 +- Stream_support/include/CGAL/IO/polygon_soup_io.h | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/Stream_support/include/CGAL/IO/GOCAD.h b/Stream_support/include/CGAL/IO/GOCAD.h index c2e0844d6b1..1394554ab94 100644 --- a/Stream_support/include/CGAL/IO/GOCAD.h +++ b/Stream_support/include/CGAL/IO/GOCAD.h @@ -335,7 +335,7 @@ bool write_GOCAD(std::ostream& os, * \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`} + * \cgalParamDefault{`CGAL::Identity_property_map::value_type>`} * \cgalParamNEnd * * \cgalParamNBegin{stream_precision} diff --git a/Stream_support/include/CGAL/IO/OBJ.h b/Stream_support/include/CGAL/IO/OBJ.h index f00381a8333..6f99927ad7a 100644 --- a/Stream_support/include/CGAL/IO/OBJ.h +++ b/Stream_support/include/CGAL/IO/OBJ.h @@ -318,7 +318,7 @@ bool read_OBJ(const std::string& fname, * \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`} + * \cgalParamDefault{`CGAL::Identity_property_map::value_type>`} * \cgalParamNEnd * * \cgalParamNBegin{stream_precision} diff --git a/Stream_support/include/CGAL/IO/OFF.h b/Stream_support/include/CGAL/IO/OFF.h index 8ca46ca937d..478217cb1b6 100644 --- a/Stream_support/include/CGAL/IO/OFF.h +++ b/Stream_support/include/CGAL/IO/OFF.h @@ -271,7 +271,7 @@ bool read_OFF(const std::string& fname, * \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`} + * \cgalParamDefault{`CGAL::Identity_property_map::value_type>`} * \cgalParamNEnd * * \cgalParamNBegin{stream_precision} diff --git a/Stream_support/include/CGAL/IO/polygon_soup_io.h b/Stream_support/include/CGAL/IO/polygon_soup_io.h index c9b7eff3b13..3cf0fb4189c 100644 --- a/Stream_support/include/CGAL/IO/polygon_soup_io.h +++ b/Stream_support/include/CGAL/IO/polygon_soup_io.h @@ -146,7 +146,7 @@ bool read_polygon_soup(const std::string& fname, * \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`} + * \cgalParamDefault{`CGAL::Identity_property_map::value_type>`} * \cgalParamNEnd * * \cgalParamNBegin{verbose} From d7cfaccfa172005ebe806a45366f6d4cf26ab505 Mon Sep 17 00:00:00 2001 From: Andreas Fabri Date: Fri, 19 Sep 2025 15:55:08 +0100 Subject: [PATCH 05/30] Add Property_map to dependencies --- Stream_support/doc/Stream_support/dependencies | 1 + 1 file changed, 1 insertion(+) diff --git a/Stream_support/doc/Stream_support/dependencies b/Stream_support/doc/Stream_support/dependencies index 55201690c3c..5437858c829 100644 --- a/Stream_support/doc/Stream_support/dependencies +++ b/Stream_support/doc/Stream_support/dependencies @@ -12,6 +12,7 @@ Point_set_processing_3 Polygon Polygon_mesh_processing Polyhedron +Property_map SMDS_3 STL_Extension Surface_mesh From b668fb4b5a9bd9f5628f7b8bcf14c87b01b3634a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mael=20Rouxel-Labb=C3=A9?= Date: Mon, 22 Sep 2025 11:52:46 +0200 Subject: [PATCH 06/30] Fix grammar --- Kernel_23/doc/Kernel_23/CGAL/Cartesian_converter.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Kernel_23/doc/Kernel_23/CGAL/Cartesian_converter.h b/Kernel_23/doc/Kernel_23/CGAL/Cartesian_converter.h index 3294a90c688..4b365aac862 100644 --- a/Kernel_23/doc/Kernel_23/CGAL/Cartesian_converter.h +++ b/Kernel_23/doc/Kernel_23/CGAL/Cartesian_converter.h @@ -48,7 +48,7 @@ Cartesian_converter<>(); /// @{ /*! -returns a `K2::Point_2` which coordinates are those of `p`, +returns a `K2::Point_2` whose coordinates are those of `p`, converted by `NTConverter`. */ K2::Point_2 operator()(const K1::Point_2&p); From 5c058a8c9bc957781f7d7c95146afb54b00a1d9f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mael=20Rouxel-Labb=C3=A9?= Date: Mon, 22 Sep 2025 11:53:06 +0200 Subject: [PATCH 07/30] Fix missing \relates \ingroup for some property maps --- Property_map/include/CGAL/property_map.h | 24 ++++++++++++++++-------- 1 file changed, 16 insertions(+), 8 deletions(-) diff --git a/Property_map/include/CGAL/property_map.h b/Property_map/include/CGAL/property_map.h index 250630763b7..b3caaaf6093 100644 --- a/Property_map/include/CGAL/property_map.h +++ b/Property_map/include/CGAL/property_map.h @@ -105,7 +105,6 @@ make_OR_property_map(const PM1& pm1, const PM2& pm2) /// \cgalModels{ReadablePropertyMap} /// /// \tparam InputIterator an input iterator -/// \endcond template struct Input_iterator_property_map{ typedef InputIterator key_type; @@ -119,6 +118,8 @@ struct Input_iterator_property_map{ get(Input_iterator_property_map, const InputIterator& it){ return *it; } }; +/// \endcond + #ifdef DOXYGEN_RUNNING /// \ingroup PkgPropertyMapRef /// Property map that composes two property maps, @@ -274,8 +275,8 @@ struct Compose_property_map }; #endif /// \ingroup PkgPropertyMapRef -/// \relates Compose_property_map /// returns `Compose_property_maps(km,vm)` +/// \relates Compose_property_map template Compose_property_map make_compose_property_map(const KeyMap& km, const ValueMap& vm) @@ -304,8 +305,8 @@ struct Dereference_property_map reference operator[](const Iter_& it) const { return *it; } }; +/// \ingroup PkgPropertyMapRef /// Free function to create a `Dereference_property_map` property map. -/// /// \relates Dereference_property_map template // Type convertible to `key_type` Dereference_property_map::type> @@ -371,8 +372,8 @@ struct Identity_property_map_no_lvalue }; /// \endcond +/// \ingroup PkgPropertyMapRef /// Free function to create a `Identity_property_map` property map. -/// /// \relates Identity_property_map template // Key and value type Identity_property_map @@ -409,8 +410,8 @@ struct First_of_pair_property_map /// @} }; +/// \ingroup PkgPropertyMapRef /// Free function to create a `First_of_pair_property_map` property map. -/// /// \relates First_of_pair_property_map template // Pair type First_of_pair_property_map @@ -449,8 +450,8 @@ struct Second_of_pair_property_map /// @} }; +/// \ingroup PkgPropertyMapRef /// Free function to create a Second_of_pair_property_map property map. -/// /// \relates Second_of_pair_property_map template // Pair type Second_of_pair_property_map @@ -509,8 +510,8 @@ struct Nth_of_tuple_property_map > friend void put(const Self&, key_type& k, const value_type& v) { std::get(k) = v; } }; +/// \ingroup PkgPropertyMapRef /// Free function to create a Nth_of_tuple_property_map property map. -/// /// \relates Nth_of_tuple_property_map template // Tuple type Nth_of_tuple_property_map @@ -563,6 +564,7 @@ struct Pointer_property_map{ /// This function is a shortcut to the recommended replacement: /// `boost::make_iterator_property_map(, boost::typed_identity_property_map())` /// Note that the property map is a mutable `LvaluePropertyMap` with `std::size_t` as key. +/// \relates Pointer_property_map template inline typename Pointer_property_map::type @@ -574,6 +576,7 @@ make_property_map(T* pointer) /// \ingroup PkgPropertyMapRef /// equivalent to `make_property_map(&v[0])` /// Note that `v` must not be modified while using the property map created +/// \relates Pointer_property_map template inline typename Pointer_property_map::type @@ -587,6 +590,7 @@ make_property_map(std::vector& v) /// \ingroup PkgPropertyMapRef /// Non-mutable version +/// \relates Pointer_property_map template inline typename Pointer_property_map::const_type @@ -598,6 +602,7 @@ make_property_map(const T* pointer) /// \ingroup PkgPropertyMapRef /// equivalent to `make_property_map(&v[0])` /// Note that `v` must not be modified while using the property map created +/// \relates Pointer_property_map template inline typename Pointer_property_map::const_type @@ -674,6 +679,7 @@ struct Boolean_property_map /// \ingroup PkgPropertyMapRef /// returns `Boolean_property_map(set_)` +/// \relates Boolean_property_map template Boolean_property_map make_boolean_property_map(Set& set_) @@ -717,6 +723,7 @@ struct Cartesian_converter_property_map /// \ingroup PkgPropertyMapRef /// returns `Cartesian_converter_property_map(vpm)` +/// \relates Cartesian_converter_property_map template Cartesian_converter_property_map make_cartesian_converter_property_map(Vpm vpm) @@ -766,8 +773,8 @@ public: }; /// \ingroup PkgPropertyMapRef -/// \relates Random_access_property_map /// returns `Random_access_property_map(container)` +/// \relates Random_access_property_map template Random_access_property_map make_random_access_property_map(Container& container) @@ -776,6 +783,7 @@ make_random_access_property_map(Container& container) } /// \cond SKIP_IN_MANUAL + // Syntaxic sugar for transform_iterator+pmap_to_unary_function template typename boost::transform_iterator, Iterator> From 561ec37dc61dcf2279e80f07cea3a8e6ec963423 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mael=20Rouxel-Labb=C3=A9?= Date: Mon, 22 Sep 2025 11:53:21 +0200 Subject: [PATCH 08/30] Remove extra space between NP entries --- Stream_support/include/CGAL/IO/GOCAD.h | 1 - Stream_support/include/CGAL/IO/OBJ.h | 1 - Stream_support/include/CGAL/IO/OFF.h | 2 -- Stream_support/include/CGAL/IO/polygon_soup_io.h | 1 - 4 files changed, 5 deletions(-) diff --git a/Stream_support/include/CGAL/IO/GOCAD.h b/Stream_support/include/CGAL/IO/GOCAD.h index 1394554ab94..f0bab7148bb 100644 --- a/Stream_support/include/CGAL/IO/GOCAD.h +++ b/Stream_support/include/CGAL/IO/GOCAD.h @@ -337,7 +337,6 @@ bool write_GOCAD(std::ostream& os, * of the iterator of `PointRange` and value type is a point type with floating point coordinates} * \cgalParamDefault{`CGAL::Identity_property_map::value_type>`} * \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} diff --git a/Stream_support/include/CGAL/IO/OBJ.h b/Stream_support/include/CGAL/IO/OBJ.h index 6f99927ad7a..924e2353172 100644 --- a/Stream_support/include/CGAL/IO/OBJ.h +++ b/Stream_support/include/CGAL/IO/OBJ.h @@ -320,7 +320,6 @@ bool read_OBJ(const std::string& fname, * of the iterator of `PointRange` and value type is a point type with floating point coordinates} * \cgalParamDefault{`CGAL::Identity_property_map::value_type>`} * \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} diff --git a/Stream_support/include/CGAL/IO/OFF.h b/Stream_support/include/CGAL/IO/OFF.h index 478217cb1b6..e12e2494720 100644 --- a/Stream_support/include/CGAL/IO/OFF.h +++ b/Stream_support/include/CGAL/IO/OFF.h @@ -273,7 +273,6 @@ bool read_OFF(const std::string& fname, * of the iterator of `PointRange` and value type is a point type with floating point coordinates} * \cgalParamDefault{`CGAL::Identity_property_map::value_type>`} * \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} @@ -321,7 +320,6 @@ bool write_OFF(std::ostream& os, * of the iterator of `PointRange` and value type is a point type with floating point coordinates} * \cgalParamDefault{`CGAL::Identity_property_map`} * \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} diff --git a/Stream_support/include/CGAL/IO/polygon_soup_io.h b/Stream_support/include/CGAL/IO/polygon_soup_io.h index 3cf0fb4189c..77e254d9ee3 100644 --- a/Stream_support/include/CGAL/IO/polygon_soup_io.h +++ b/Stream_support/include/CGAL/IO/polygon_soup_io.h @@ -148,7 +148,6 @@ bool read_polygon_soup(const std::string& fname, * of the iterator of `PointRange` and value type is a point type with floating point coordinates} * \cgalParamDefault{`CGAL::Identity_property_map::value_type>`} * \cgalParamNEnd - * * \cgalParamNBegin{verbose} * \cgalParamDescription{indicates whether output warnings and error messages should be printed or not.} * \cgalParamType{Boolean} From 0cf9d434b6c92d81a2e146360d20494184bed9f9 Mon Sep 17 00:00:00 2001 From: Andreas Fabri Date: Fri, 26 Sep 2025 15:22:32 +0100 Subject: [PATCH 09/30] Convert internally to double as required by file format. Document the point property map which is implemented --- Stream_support/include/CGAL/IO/GOCAD.h | 10 ++++- Stream_support/include/CGAL/IO/OBJ.h | 10 ++++- Stream_support/include/CGAL/IO/OFF.h | 8 ++-- Stream_support/include/CGAL/IO/STL.h | 37 +++++++++++++------ .../test/Stream_support/issue_9071.cpp | 3 +- 5 files changed, 47 insertions(+), 21 deletions(-) diff --git a/Stream_support/include/CGAL/IO/GOCAD.h b/Stream_support/include/CGAL/IO/GOCAD.h index f0bab7148bb..5fe66515fe0 100644 --- a/Stream_support/include/CGAL/IO/GOCAD.h +++ b/Stream_support/include/CGAL/IO/GOCAD.h @@ -332,9 +332,9 @@ bool write_GOCAD(std::ostream& os, * * \cgalNamedParamsBegin * \cgalParamNBegin{point_map} - * \cgalParamDescription{a property map associating points with floating point coordinates to the elements of the point set `points`} + * \cgalParamDescription{a property map associating points with %Cartesian 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} + * of the iterator of `PointRange` and value type is a point type with %Cartesian coordinates} * \cgalParamDefault{`CGAL::Identity_property_map::value_type>`} * \cgalParamNEnd * \cgalParamNBegin{stream_precision} @@ -379,6 +379,12 @@ 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 %Cartesian 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 %Cartesian coordinates} + * \cgalParamDefault{`CGAL::Identity_property_map::value_type>`} + * \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} diff --git a/Stream_support/include/CGAL/IO/OBJ.h b/Stream_support/include/CGAL/IO/OBJ.h index 924e2353172..74b46a457ae 100644 --- a/Stream_support/include/CGAL/IO/OBJ.h +++ b/Stream_support/include/CGAL/IO/OBJ.h @@ -315,9 +315,9 @@ bool read_OBJ(const std::string& fname, * * \cgalNamedParamsBegin * \cgalParamNBegin{point_map} - * \cgalParamDescription{a property map associating points with floating point coordinates to the elements of the point set `points`} + * \cgalParamDescription{a property map associating points with %Cartesian 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} + * of the iterator of `PointRange` and value type is a point type with %Cartesian coordinates} * \cgalParamDefault{`CGAL::Identity_property_map::value_type>`} * \cgalParamNEnd * \cgalParamNBegin{stream_precision} @@ -364,6 +364,12 @@ bool write_OBJ(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 %Cartesian 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 %Cartesian coordinates} + * \cgalParamDefault{`CGAL::Identity_property_map::value_type>`} + * \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} diff --git a/Stream_support/include/CGAL/IO/OFF.h b/Stream_support/include/CGAL/IO/OFF.h index e12e2494720..a7fc601ea49 100644 --- a/Stream_support/include/CGAL/IO/OFF.h +++ b/Stream_support/include/CGAL/IO/OFF.h @@ -268,9 +268,9 @@ bool read_OFF(const std::string& fname, * * \cgalNamedParamsBegin * \cgalParamNBegin{point_map} - * \cgalParamDescription{a property map associating points with floating point coordinates to the elements of the point set `points`} + * \cgalParamDescription{a property map associating points with %Cartesian 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} + * of the iterator of `PointRange` and value type is a point type with %Cartesian coordinates} * \cgalParamDefault{`CGAL::Identity_property_map::value_type>`} * \cgalParamNEnd * \cgalParamNBegin{stream_precision} @@ -315,9 +315,9 @@ bool write_OFF(std::ostream& os, * * \cgalNamedParamsBegin * \cgalParamNBegin{point_map} - * \cgalParamDescription{a property map associating points with floating point coordinates to the elements of the point set `points`} + * \cgalParamDescription{a property map associating points with %Cartesian 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} + * of the iterator of `PointRange` and value type is a point type with %Cartesian coordinates} * \cgalParamDefault{`CGAL::Identity_property_map`} * \cgalParamNEnd * \cgalParamNBegin{stream_precision} diff --git a/Stream_support/include/CGAL/IO/STL.h b/Stream_support/include/CGAL/IO/STL.h index dfa3ecded7e..06929db9ccf 100644 --- a/Stream_support/include/CGAL/IO/STL.h +++ b/Stream_support/include/CGAL/IO/STL.h @@ -17,6 +17,9 @@ #include #include +#include +#include + #include #include @@ -296,7 +299,6 @@ bool write_STL(std::ostream& os, typedef typename boost::property_traits::value_type Point; typedef typename CGAL::Kernel_traits::Kernel K; - typedef typename K::Vector_3 Vector_3; K k = choose_parameter(get_parameter(np, internal_np::geom_traits)); @@ -305,6 +307,11 @@ bool write_STL(std::ostream& os, set_stream_precision_from_NP(os, np); + typedef Simple_cartesian SC; + typedef typename SC::Point_3 Point_3; + typedef typename SC::Vector_3 Vector_3; + Cartesian_converter conv; + if(get_mode(os) == BINARY) { os << "FileType: Binary "; @@ -317,12 +324,16 @@ bool write_STL(std::ostream& os, const Point& q = get(point_map, points[face[1]]); const Point& r = get(point_map, points[face[2]]); - const Vector_3 n = collinear(p,q,r) ? Vector_3(1,0,0) : unit_normal(p,q,r); + Point_3 pp = conv(p); + Point_3 qq = conv(q); + Point_3 rr = conv(r); - const float coords[12] = { static_cast(n.x()), static_cast(n.y()), static_cast(n.z()), - static_cast(p.x()), static_cast(p.y()), static_cast(p.z()), - static_cast(q.x()), static_cast(q.y()), static_cast(q.z()), - static_cast(r.x()), static_cast(r.y()), static_cast(r.z()) }; + const Vector_3 nn = collinear(pp,qq,rr) ? Vector_3(1,0,0) : unit_normal(pp,qq,rr); + + const float coords[12] = { static_cast(nn.x()), static_cast(nn.y()), static_cast(nn.z()), + static_cast(pp.x()), static_cast(pp.y()), static_cast(pp.z()), + static_cast(qq.x()), static_cast(qq.y()), static_cast(qq.z()), + static_cast(rr.x()), static_cast(rr.y()), static_cast(rr.z()) }; for(int i=0; i<12; ++i) os.write(reinterpret_cast(&coords[i]), sizeof(coords[i])); @@ -338,11 +349,15 @@ bool write_STL(std::ostream& os, const Point& q = get(point_map, points[face[1]]); const Point& r = get(point_map, points[face[2]]); - const Vector_3 n = internal::construct_normal_of_STL_face(p, q, r, k); - os << "facet normal " << n << "\nouter loop\n"; - os << "vertex " << p << "\n"; - os << "vertex " << q << "\n"; - os << "vertex " << r << "\n"; + Point_3 pp = conv(p); + Point_3 qq = conv(q); + Point_3 rr = conv(r); + + const Vector_3 nn = conv(internal::construct_normal_of_STL_face(p, q, r, k)); + os << "facet normal " << nn << "\nouter loop\n"; + os << "vertex " << pp << "\n"; + os << "vertex " << qq << "\n"; + os << "vertex " << rr << "\n"; os << "endloop\nendfacet\n"; } os << "endsolid"< points; std::vector> polygons; - auto pm = CGAL::make_cartesian_converter_property_map(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)); + CGAL::IO::write_polygon_soup("xxx.off", points, polygons, CGAL::parameters::stream_precision(17)); return 0; } From 61cf55efee571c34fd9169e7105f1ff1c3417d01 Mon Sep 17 00:00:00 2001 From: Andreas Fabri Date: Fri, 26 Sep 2025 15:46:08 +0100 Subject: [PATCH 10/30] Convert internally to double as required by file format. Document the point property map which is implemented --- Stream_support/include/CGAL/IO/STL.h | 2 +- Stream_support/include/CGAL/IO/polygon_soup_io.h | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/Stream_support/include/CGAL/IO/STL.h b/Stream_support/include/CGAL/IO/STL.h index 06929db9ccf..92047e79bea 100644 --- a/Stream_support/include/CGAL/IO/STL.h +++ b/Stream_support/include/CGAL/IO/STL.h @@ -310,7 +310,7 @@ bool write_STL(std::ostream& os, typedef Simple_cartesian SC; typedef typename SC::Point_3 Point_3; typedef typename SC::Vector_3 Vector_3; - Cartesian_converter conv; + Cartesian_converter conv; if(get_mode(os) == BINARY) { diff --git a/Stream_support/include/CGAL/IO/polygon_soup_io.h b/Stream_support/include/CGAL/IO/polygon_soup_io.h index 77e254d9ee3..a6c82f82a3d 100644 --- a/Stream_support/include/CGAL/IO/polygon_soup_io.h +++ b/Stream_support/include/CGAL/IO/polygon_soup_io.h @@ -143,9 +143,9 @@ bool read_polygon_soup(const std::string& fname, * * \cgalNamedParamsBegin * \cgalParamNBegin{point_map} - * \cgalParamDescription{a property map associating points with floating point coordinates to the elements of the point set `points`} + * \cgalParamDescription{a property map associating points with %Cartesian 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} + * of the iterator of `PointRange` and value type is a point type with %Cartesian coordinates} * \cgalParamDefault{`CGAL::Identity_property_map::value_type>`} * \cgalParamNEnd * \cgalParamNBegin{verbose} From 39fe8b3a6d77c88a90a244483a2189ee7394532b Mon Sep 17 00:00:00 2001 From: Andreas Fabri Date: Fri, 26 Sep 2025 16:03:31 +0100 Subject: [PATCH 11/30] convert directly to Simple_cartesian --- Stream_support/include/CGAL/IO/STL.h | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/Stream_support/include/CGAL/IO/STL.h b/Stream_support/include/CGAL/IO/STL.h index 92047e79bea..361e2b81eb7 100644 --- a/Stream_support/include/CGAL/IO/STL.h +++ b/Stream_support/include/CGAL/IO/STL.h @@ -307,7 +307,7 @@ bool write_STL(std::ostream& os, set_stream_precision_from_NP(os, np); - typedef Simple_cartesian SC; + typedef Simple_cartesian SC; typedef typename SC::Point_3 Point_3; typedef typename SC::Vector_3 Vector_3; Cartesian_converter conv; @@ -330,10 +330,10 @@ bool write_STL(std::ostream& os, const Vector_3 nn = collinear(pp,qq,rr) ? Vector_3(1,0,0) : unit_normal(pp,qq,rr); - const float coords[12] = { static_cast(nn.x()), static_cast(nn.y()), static_cast(nn.z()), - static_cast(pp.x()), static_cast(pp.y()), static_cast(pp.z()), - static_cast(qq.x()), static_cast(qq.y()), static_cast(qq.z()), - static_cast(rr.x()), static_cast(rr.y()), static_cast(rr.z()) }; + const float coords[12] = { nn.x(), nn.y(), nn.z(), + pp.x(), pp.y(), pp.z(), + qq.x(), qq.y(), qq.z(), + rr.x(), rr.y(), rr.z() }; for(int i=0; i<12; ++i) os.write(reinterpret_cast(&coords[i]), sizeof(coords[i])); From bdee2836df6e23f7b844c885f5f242941e79ccb2 Mon Sep 17 00:00:00 2001 From: Andreas Fabri Date: Fri, 26 Sep 2025 16:16:27 +0100 Subject: [PATCH 12/30] Fix dependencies --- Stream_support/package_info/Stream_support/dependencies | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/Stream_support/package_info/Stream_support/dependencies b/Stream_support/package_info/Stream_support/dependencies index 86fd53b13ac..ac1d4c1032f 100644 --- a/Stream_support/package_info/Stream_support/dependencies +++ b/Stream_support/package_info/Stream_support/dependencies @@ -1,7 +1,12 @@ Algebraic_foundations BGL +Cartesian_kernel Circulator +Distance_2 +Distance_3 Installation +Intersections_2 +Intersections_3 Interval_support Kernel_23 Modular_arithmetic From fad48f7305419a1e3f31e70d4768e3503fdd35c2 Mon Sep 17 00:00:00 2001 From: Andreas Fabri Date: Fri, 26 Sep 2025 17:00:05 +0100 Subject: [PATCH 13/30] Fix dependencies --- BGL/package_info/BGL/dependencies | 2 ++ 1 file changed, 2 insertions(+) diff --git a/BGL/package_info/BGL/dependencies b/BGL/package_info/BGL/dependencies index 7cf027b2c48..f4078193fd4 100644 --- a/BGL/package_info/BGL/dependencies +++ b/BGL/package_info/BGL/dependencies @@ -6,6 +6,8 @@ Distance_2 Distance_3 Hash_map Installation +Intersections_2 +Intersections_3 Interval_support Kernel_23 Modular_arithmetic From 92dc53c58afa2481ecaa8e7b6311aa64a044ddab Mon Sep 17 00:00:00 2001 From: Andreas Fabri Date: Mon, 29 Sep 2025 14:20:39 +0100 Subject: [PATCH 14/30] Undo change --- Kernel_23/include/CGAL/Kernel/function_objects.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Kernel_23/include/CGAL/Kernel/function_objects.h b/Kernel_23/include/CGAL/Kernel/function_objects.h index 1182470f801..b71470a6262 100644 --- a/Kernel_23/include/CGAL/Kernel/function_objects.h +++ b/Kernel_23/include/CGAL/Kernel/function_objects.h @@ -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 / sqrt(res.squared_length()); + res = res / CGAL::sqrt(res.squared_length()); return res; } }; From a9a60b5a002be5cb61040cc07317f856a9b86727 Mon Sep 17 00:00:00 2001 From: Andreas Fabri Date: Mon, 29 Sep 2025 15:01:00 +0100 Subject: [PATCH 15/30] Fix plugin --- Lab/demo/Lab/Plugins/IO/PLY_io_plugin.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/Lab/demo/Lab/Plugins/IO/PLY_io_plugin.cpp b/Lab/demo/Lab/Plugins/IO/PLY_io_plugin.cpp index 63abb1e5269..a15bf05d2df 100644 --- a/Lab/demo/Lab/Plugins/IO/PLY_io_plugin.cpp +++ b/Lab/demo/Lab/Plugins/IO/PLY_io_plugin.cpp @@ -7,6 +7,8 @@ #include #include #include +#include +#include #include #include @@ -132,8 +134,10 @@ load(QFileInfo fileinfo, bool& ok, bool add_to_scene) { std::vector fcolors; std::vector vcolors; - if (!(CGAL::IO::read_PLY (in, points, polygons, fcolors, vcolors))) + std::string unused_comment; + if (!(CGAL::IO::read_PLY (in, points, polygons, unused_comment, vcolors))) { + CGAL_USE(unused_comment); QApplication::restoreOverrideCursor(); ok = false; return QList(); From 806e65f259c41c1b35767be32b9a0595bd5a70e2 Mon Sep 17 00:00:00 2001 From: Andreas Fabri Date: Mon, 29 Sep 2025 15:05:47 +0100 Subject: [PATCH 16/30] undo --- Lab/demo/Lab/Plugins/IO/PLY_io_plugin.cpp | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/Lab/demo/Lab/Plugins/IO/PLY_io_plugin.cpp b/Lab/demo/Lab/Plugins/IO/PLY_io_plugin.cpp index a15bf05d2df..2762a94e071 100644 --- a/Lab/demo/Lab/Plugins/IO/PLY_io_plugin.cpp +++ b/Lab/demo/Lab/Plugins/IO/PLY_io_plugin.cpp @@ -7,8 +7,6 @@ #include #include #include -#include -#include #include #include @@ -134,10 +132,8 @@ load(QFileInfo fileinfo, bool& ok, bool add_to_scene) { std::vector fcolors; std::vector vcolors; - std::string unused_comment; - if (!(CGAL::IO::read_PLY (in, points, polygons, unused_comment, vcolors))) + if (!(CGAL::IO::read_PLY (in, points, polygons, vcolors))) { - CGAL_USE(unused_comment); QApplication::restoreOverrideCursor(); ok = false; return QList(); From 18f1f65bbfcda51971c064807207ceee738bb4ba Mon Sep 17 00:00:00 2001 From: Andreas Fabri Date: Wed, 1 Oct 2025 10:34:24 +0100 Subject: [PATCH 17/30] Fix plugin --- Lab/demo/Lab/Plugins/IO/PLY_io_plugin.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Lab/demo/Lab/Plugins/IO/PLY_io_plugin.cpp b/Lab/demo/Lab/Plugins/IO/PLY_io_plugin.cpp index 2762a94e071..63abb1e5269 100644 --- a/Lab/demo/Lab/Plugins/IO/PLY_io_plugin.cpp +++ b/Lab/demo/Lab/Plugins/IO/PLY_io_plugin.cpp @@ -132,7 +132,7 @@ load(QFileInfo fileinfo, bool& ok, bool add_to_scene) { std::vector fcolors; std::vector vcolors; - if (!(CGAL::IO::read_PLY (in, points, polygons, vcolors))) + if (!(CGAL::IO::read_PLY (in, points, polygons, fcolors, vcolors))) { QApplication::restoreOverrideCursor(); ok = false; From 0ffa81d3c4b4634e3d8799c9050a427abf76eb55 Mon Sep 17 00:00:00 2001 From: Sven Oesau Date: Wed, 8 Oct 2025 13:36:35 +0200 Subject: [PATCH 18/30] fix warnings --- Stream_support/include/CGAL/IO/STL.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Stream_support/include/CGAL/IO/STL.h b/Stream_support/include/CGAL/IO/STL.h index 361e2b81eb7..b2ef4ebb890 100644 --- a/Stream_support/include/CGAL/IO/STL.h +++ b/Stream_support/include/CGAL/IO/STL.h @@ -308,6 +308,7 @@ bool write_STL(std::ostream& os, set_stream_precision_from_NP(os, np); typedef Simple_cartesian SC; + typedef SC::FT FT; typedef typename SC::Point_3 Point_3; typedef typename SC::Vector_3 Vector_3; Cartesian_converter conv; @@ -328,7 +329,7 @@ bool write_STL(std::ostream& os, Point_3 qq = conv(q); Point_3 rr = conv(r); - const Vector_3 nn = collinear(pp,qq,rr) ? Vector_3(1,0,0) : unit_normal(pp,qq,rr); + const Vector_3 nn = collinear(pp,qq,rr) ? Vector_3(static_cast(1.0),static_cast(0),static_cast(0)) : unit_normal(pp,qq,rr); const float coords[12] = { nn.x(), nn.y(), nn.z(), pp.x(), pp.y(), pp.z(), From c43058de26a9e9369e2c3ac5c3416629dd28fedb Mon Sep 17 00:00:00 2001 From: Andreas Fabri Date: Tue, 14 Oct 2025 09:24:44 +0100 Subject: [PATCH 19/30] Changes after Mael's comments --- Stream_support/include/CGAL/IO/GOCAD.h | 17 +++++++----- .../include/CGAL/IO/Generic_writer.h | 9 +++++-- Stream_support/include/CGAL/IO/OBJ.h | 8 +++--- Stream_support/include/CGAL/IO/OFF.h | 8 +++--- Stream_support/include/CGAL/IO/VTK.h | 6 ++++- Stream_support/include/CGAL/IO/WKT.h | 26 +++++++++---------- 6 files changed, 44 insertions(+), 30 deletions(-) diff --git a/Stream_support/include/CGAL/IO/GOCAD.h b/Stream_support/include/CGAL/IO/GOCAD.h index 5fe66515fe0..c63b7c9b6ab 100644 --- a/Stream_support/include/CGAL/IO/GOCAD.h +++ b/Stream_support/include/CGAL/IO/GOCAD.h @@ -21,6 +21,8 @@ #include #include #include +#include +#include #include #include @@ -295,8 +297,11 @@ bool write_GOCAD(std::ostream& os, "END_ORIGINAL_COORDINATE_SYSTEM\n" "TFACE\n"; + typedef typename Kernel_traits::value_type>::type K; + typedef Simple_cartesian SC; + Cartesian_converter conv; for(std::size_t i=0, end=points.size(); i::value_type>`} * \cgalParamNEnd * \cgalParamNBegin{stream_precision} - * \cgalParamDescription{a parameter used to set the precision (i.e. how many digits are generated) of the output stream} + * \cgalParamDescription{a parameter used to set the precision (i.e., how many digits are generated) of the output stream} * \cgalParamType{int} * \cgalParamDefault{the precision of the stream `os`} * \cgalParamNEnd @@ -380,9 +385,9 @@ bool write_GOCAD(std::ostream& os, * * \cgalNamedParamsBegin * \cgalParamNBegin{point_map} - * \cgalParamDescription{a property map associating points with %Cartesian coordinates to the elements of the point set `points`} + * \cgalParamDescription{a property map associating points to the elements of the range `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 %Cartesian coordinates} + * of the iterator of `PointRange` and value type is a model of the concept `Point_3`} * \cgalParamDefault{`CGAL::Identity_property_map::value_type>`} * \cgalParamNEnd * \cgalParamNBegin{stream_precision} diff --git a/Stream_support/include/CGAL/IO/Generic_writer.h b/Stream_support/include/CGAL/IO/Generic_writer.h index e425fc51866..f56d5b7dc7c 100644 --- a/Stream_support/include/CGAL/IO/Generic_writer.h +++ b/Stream_support/include/CGAL/IO/Generic_writer.h @@ -19,6 +19,8 @@ #include #include +#include +#include #include #include @@ -51,11 +53,14 @@ public: set_stream_precision_from_NP(m_os, np); + typedef typename Kernel_traits::value_type>::type K; + typedef Simple_cartesian SC; + Cartesian_converter conv; m_writer.write_header(m_os, points.size(), 0, polygons.size()); for(std::size_t i=0, end=points.size(); i::value_type& p = get(point_map, points[i]); - m_writer.write_vertex(to_double(p.x()), to_double(p.y()), to_double(p.z())); + typename SC::Point_3 p = conv(get(point_map, points[i])); + m_writer.write_vertex(p.x(), p.y(), p.z()); } m_writer.write_facet_header(); diff --git a/Stream_support/include/CGAL/IO/OBJ.h b/Stream_support/include/CGAL/IO/OBJ.h index 74b46a457ae..cfd3eccacd2 100644 --- a/Stream_support/include/CGAL/IO/OBJ.h +++ b/Stream_support/include/CGAL/IO/OBJ.h @@ -315,9 +315,9 @@ bool read_OBJ(const std::string& fname, * * \cgalNamedParamsBegin * \cgalParamNBegin{point_map} - * \cgalParamDescription{a property map associating points with %Cartesian coordinates to the elements of the point set `points`} + * \cgalParamDescription{a property map associating points to the elements of the range `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 %Cartesian coordinates} + * of the iterator of `PointRange` and value type is a model of the concept `Point_3`} * \cgalParamDefault{`CGAL::Identity_property_map::value_type>`} * \cgalParamNEnd * \cgalParamNBegin{stream_precision} @@ -365,9 +365,9 @@ bool write_OBJ(std::ostream& os, * * \cgalNamedParamsBegin * \cgalParamNBegin{point_map} - * \cgalParamDescription{a property map associating points with %Cartesian coordinates to the elements of the point set `points`} + * \cgalParamDescription{a property map associating points to the elements of the range `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 %Cartesian coordinates} + * of the iterator of `PointRange` and value type is a model of the concept `Point_3`} * \cgalParamDefault{`CGAL::Identity_property_map::value_type>`} * \cgalParamNEnd * \cgalParamNBegin{stream_precision} diff --git a/Stream_support/include/CGAL/IO/OFF.h b/Stream_support/include/CGAL/IO/OFF.h index a7fc601ea49..f23265c8449 100644 --- a/Stream_support/include/CGAL/IO/OFF.h +++ b/Stream_support/include/CGAL/IO/OFF.h @@ -268,9 +268,9 @@ bool read_OFF(const std::string& fname, * * \cgalNamedParamsBegin * \cgalParamNBegin{point_map} - * \cgalParamDescription{a property map associating points with %Cartesian coordinates to the elements of the point set `points`} + * \cgalParamDescription{a property map associating points to the elements of the range`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 %Cartesian coordinates} + * of the iterator of `PointRange` and value type is a model of the concept `Point_3`} * \cgalParamDefault{`CGAL::Identity_property_map::value_type>`} * \cgalParamNEnd * \cgalParamNBegin{stream_precision} @@ -315,9 +315,9 @@ bool write_OFF(std::ostream& os, * * \cgalNamedParamsBegin * \cgalParamNBegin{point_map} - * \cgalParamDescription{a property map associating points with %Cartesian coordinates to the elements of the point set `points`} + * \cgalParamDescription{a property map associating points to the elements of the range `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 %Cartesian coordinates} + * of the iterator of `PointRange` and value type is a model of the concept `Point_3`} * \cgalParamDefault{`CGAL::Identity_property_map`} * \cgalParamNEnd * \cgalParamNBegin{stream_precision} diff --git a/Stream_support/include/CGAL/IO/VTK.h b/Stream_support/include/CGAL/IO/VTK.h index fd8f7accc45..cadbe790410 100644 --- a/Stream_support/include/CGAL/IO/VTK.h +++ b/Stream_support/include/CGAL/IO/VTK.h @@ -20,6 +20,8 @@ #include #include +#include +#include #ifdef CGAL_USE_VTK #include @@ -255,9 +257,11 @@ void write_soup_points_tag(std::ostream& os, } else { + typedef Simple_cartesian SC; + Cartesian_converter conv; os << "\">\n"; for(const Point& p : points) - os << IO::oformat(p.x()) << " " << IO::oformat(p.y()) << " " << IO::oformat(p.z()) << " "; + os << conv(p) << " "; os << " \n"; } os << " \n"; diff --git a/Stream_support/include/CGAL/IO/WKT.h b/Stream_support/include/CGAL/IO/WKT.h index 2706576b47c..c42329b8098 100644 --- a/Stream_support/include/CGAL/IO/WKT.h +++ b/Stream_support/include/CGAL/IO/WKT.h @@ -92,7 +92,7 @@ bool get_a_new_line(std::istream& in, std::string& line) //! //! \tparam Point can be a `CGAL::Point_2` or `CGAL::Point_3`. //! -//! \attention Only %Cartesian Kernels with double or float as `FT` are supported. +//! \attention Only %Cartesian Kernels with `double`or `float` as `FT` are supported. //! //! \see `CGAL::Point_2` //! \see `CGAL::Point_3` @@ -124,7 +124,7 @@ bool read_point_WKT(std::istream& in, //! - a function `resize()` that takes a `size_type` //! - an `operator[]()` that takes a `size_type`. //! -//! \attention Only %Cartesian Kernels with double or float as `FT` are supported. +//! \attention Only %Cartesian Kernels with `double`or `float` as `FT` are supported. //! //! \see `CGAL::Point_2` //! \see `CGAL::Point_3` @@ -159,7 +159,7 @@ bool read_multi_point_WKT(std::istream& in, //! - a function `resize()` that takes a `size_type` //! - an `operator[]()` that takes a `size_type`. //! -//! \attention Only %Cartesian Kernels with double or float as `FT` are supported. +//! \attention Only %Cartesian Kernels with `double`or `float` as `FT` are supported. //! //! \see `CGAL::Point_2` //! \see `CGAL::Point_3` @@ -192,7 +192,7 @@ bool read_linestring_WKT(std::istream& in, //! - a function `resize()` that takes a `size_type` //! - an `operator[]()` that takes a `size_type`. //! -//! \attention Only %Cartesian Kernels with double or float as `FT` are supported. +//! \attention Only %Cartesian Kernels with `double`or `float` as `FT` are supported. //! template bool read_multi_linestring_WKT(std::istream& in, @@ -229,7 +229,7 @@ bool read_multi_linestring_WKT(std::istream& in, //! //! \tparam Polygon is a `CGAL::General_polygon_with_holes_2`. //! -//! \attention Only %Cartesian Kernels with double or float as `FT` are supported. +//! \attention Only %Cartesian Kernels with `double`or `float` as `FT` are supported. //! //! \see `CGAL::General_polygon_with_holes_2` template @@ -260,7 +260,7 @@ bool read_polygon_WKT(std::istream& in, //! - a function `resize()` that takes a `size_type` //! - an `operator[]()` that takes a `size_type`. //! -//! \attention Only %Cartesian Kernels with double or float as `FT` are supported. +//! \attention Only %Cartesian Kernels with `double`or `float` as `FT` are supported. //! //! \see `CGAL::General_polygon_with_holes_2` template @@ -300,7 +300,7 @@ bool read_multi_polygon_WKT(std::istream& in, //! //! \tparam Point is a `CGAL::Point_2` or `CGAL::Point_3` //! -//! \attention Only %Cartesian Kernels with double or float as `FT` are supported. +//! \attention Only %Cartesian Kernels with `double`or `float` as `FT` are supported. //! //! \see `CGAL::Point_2` //! \see `CGAL::Point_3` @@ -321,7 +321,7 @@ std::ostream& write_point_WKT(std::ostream& out, //! //! \tparam Polygon must be a `CGAL::General_polygon_with_holes_2` //! -//! \attention Only %Cartesian Kernels with double or float as `FT` are supported. +//! \attention Only %Cartesian Kernels with `double`or `float` as `FT` are supported. //! //! \see `CGAL::General_polygon_with_holes_2` template @@ -341,7 +341,7 @@ std::ostream& write_polygon_WKT(std::ostream& out, //! //! \tparam LineString must be a `RandomAccessRange` of `CGAL::Point_2` or `CGAL::Point_3`. //! -//! \attention Only %Cartesian Kernels with double or float as `FT` are supported. +//! \attention Only %Cartesian Kernels with `double`or `float` as `FT` are supported. //! //!\see `CGAL::Point_2` //!\see `CGAL::Point_3` @@ -363,7 +363,7 @@ std::ostream& write_linestring_WKT(std::ostream& out, //! //! \tparam MultiPoint must be a `RandomAccessRange` of `CGAL::Point_2` or `CGAL::Point_3`. //! -//! \attention Only %Cartesian Kernels with double or float as `FT` are supported. +//! \attention Only %Cartesian Kernels with `double`or `float` as `FT` are supported. //! //!\see `CGAL::Point_2` //!\see `CGAL::Point_2` @@ -385,7 +385,7 @@ std::ostream& write_multi_point_WKT(std::ostream& out, //! //! \tparam MultiPolygon must be a `RandomAccessRange` of `CGAL::General_polygon_with_holes_2`. //! -//! \attention Only %Cartesian Kernels with double or float as `FT` are supported. +//! \attention Only %Cartesian Kernels with `double`or `float` as `FT` are supported. //! //!\see `CGAL::General_polygon_with_holes_2` template @@ -413,7 +413,7 @@ std::ostream& write_multi_polygon_WKT(std::ostream& out, //! //! \tparam MultiLineString must be a `RandomAccessRange` of `LineString`. //! -//! \attention Only %Cartesian Kernels with double or float as `FT` are supported. +//! \attention Only %Cartesian Kernels with `double`or `float` as `FT` are supported. //! //! \see `CGAL::IO::write_linestring_WKT()` template @@ -448,7 +448,7 @@ std::ostream& write_multi_linestring_WKT(std::ostream& out, //! \tparam MultiLineString must be a `RandomAccessRange` of `Linestring`. //! \tparam MultiPolygon must be a model of `RandomAccessRange` of `CGAL::General_polygon_with_holes_2`. //! -//! \attention Only %Cartesian Kernels with double or float as `FT` are supported. +//! \attention Only %Cartesian Kernels with `double`or `float` as `FT` are supported. //! //! \see `CGAL::IO::read_linestring_WKT()` template Date: Tue, 14 Oct 2025 14:21:39 +0100 Subject: [PATCH 20/30] Deal with binary VTP for non-double kernel --- Stream_support/include/CGAL/IO/VTK.h | 36 ++++++++++----- .../test/Stream_support/CMakeLists.txt | 19 +++++++- .../test/Stream_support/test_VTK.cpp | 44 +++++++++++++++++++ 3 files changed, 88 insertions(+), 11 deletions(-) create mode 100644 Stream_support/test/Stream_support/test_VTK.cpp diff --git a/Stream_support/include/CGAL/IO/VTK.h b/Stream_support/include/CGAL/IO/VTK.h index cadbe790410..6390db8c94e 100644 --- a/Stream_support/include/CGAL/IO/VTK.h +++ b/Stream_support/include/CGAL/IO/VTK.h @@ -243,8 +243,8 @@ void write_soup_points_tag(std::ostream& os, typedef typename Gt::FT FT; std::string format = binary ? "appended" : "ascii"; - std::string type = (sizeof(FT) == 8) ? "Float64" : "Float32"; - + std::string type = (std::is_same_v, float>) ? "Float32" : "Float64"; + std::size_t sizeof_FT = (std::is_same_v, float>) ? 4 : 8; os << " \n" << " \n"; - offset += 3 * points.size() * sizeof(FT) + sizeof(std::size_t); + offset += 3 * points.size() * sizeof_FT + sizeof(std::size_t); // 3 coords per points + length of the encoded data (size_t) } else @@ -387,16 +387,31 @@ void write_soup_polys_points(std::ostream& os, typedef typename CGAL::Kernel_traits::Kernel Gt; typedef typename Gt::FT FT; - std::vector coordinates; + if(std::is_same_v, float> || + std::is_same_v, double>){ + std::vector coordinates; - for(const Point& p : points) - { - coordinates.push_back(p.x()); - coordinates.push_back(p.y()); - coordinates.push_back(p.z()); + for(const Point& p : points) + { + coordinates.push_back(p.x()); + coordinates.push_back(p.y()); + coordinates.push_back(p.z()); + } + + write_vector(os, coordinates); + }else{ + std::vector coordinates; + + for(const Point& p : points) + { + coordinates.push_back(CGAL::to_double(p.x())); + coordinates.push_back(CGAL::to_double(p.y())); + coordinates.push_back(CGAL::to_double(p.z())); + } + + write_vector(os, coordinates); } - write_vector(os, coordinates); } } // namespace internal @@ -487,6 +502,7 @@ bool write_VTP(std::ostream& os, internal::write_soup_polys(os, polygons,size_map, cell_type); } os << "" << std::endl; + return true; } /*! diff --git a/Stream_support/test/Stream_support/CMakeLists.txt b/Stream_support/test/Stream_support/CMakeLists.txt index 0247c46be05..6e8086d9954 100644 --- a/Stream_support/test/Stream_support/CMakeLists.txt +++ b/Stream_support/test/Stream_support/CMakeLists.txt @@ -20,6 +20,15 @@ else() message(STATUS "NOTICE : the LAS reader does not work with your version of Visual Studio 2017.") endif() + +set(CMAKE_POLICY_DEFAULT_CMP0167 NEW) +find_package(VTK 9.0 QUIET COMPONENTS CommonCore IOCore IOLegacy IOXML FiltersCore FiltersSources) +if (VTK_FOUND AND VTK_LIBRARIES) + message(STATUS "VTK ${VTK_VERSION} found ${VTK_LIBRARIES}") +else() + message(STATUS "Tests that use VTK will not be compiled.") +endif() #VTK_FOUND + # create a target per cppfile file( GLOB cppfiles @@ -45,7 +54,15 @@ foreach(cppfile ${cppfiles}) message(STATUS "NOTICE: Some tests require the LASlib library, and will not be compiled.") endif() else() - create_single_source_cgal_program("${cppfile}") + if("${cppfile}" STREQUAL "test_VTK.cpp") + if (VTK_FOUND AND VTK_LIBRARIES) + create_single_source_cgal_program("test_VTK.cpp") + target_link_libraries(test_VTK PRIVATE ${VTK_LIBRARIES}) + target_compile_definitions(test_VTK PRIVATE -DCGAL_USE_VTK -DNOMINMAX) + endif() + else() + create_single_source_cgal_program("${cppfile}") + endif() endif() endif() endforeach() diff --git a/Stream_support/test/Stream_support/test_VTK.cpp b/Stream_support/test/Stream_support/test_VTK.cpp new file mode 100644 index 00000000000..78697284ab9 --- /dev/null +++ b/Stream_support/test/Stream_support/test_VTK.cpp @@ -0,0 +1,44 @@ +#include +#include +#include +#include + +#include + + +template +void test_VTK() +{ + typedef Kernel::Point_3 Point; + typedef std::vector Face; + + const std::vector points = { Point(0,0,0), Point(1,0,0), Point(0,1,0), Point(0,0,1) }; + const std::vector polygons = { Face{0,1,2}, Face{0,1,3}, Face{0,2,3}, Face{1,2,3} }; + + bool ok = CGAL::IO::write_VTP("tmp.vtp", points, polygons, CGAL::parameters::use_binary_mode(true)); + assert(ok); + + std::vector rpoints; + std::vector rpolygons; + ok = CGAL::IO::read_VTP("tmp.vtp", rpoints, rpolygons, CGAL::parameters::use_binary_mode(true)); + assert(points == rpoints); + assert(polygons == rpolygons); + + ok = CGAL::IO::write_VTP("tmp2.vtp", points, polygons, CGAL::parameters::use_binary_mode(false)); + assert(ok); + + rpoints.clear(); + rpolygons.clear(); + ok = CGAL::IO::read_VTP("tmp2.vtp", rpoints, rpolygons, CGAL::parameters::use_binary_mode(false)); + assert(points == rpoints); + assert(polygons == rpolygons); + +} + +int main(int argc, char** argv) +{ + test_VTK>(); + test_VTK>(); + test_VTK(); + return 0; +} \ No newline at end of file From 8215abd980f622419af39bd1de3b114c961d4584 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Loriot?= Date: Wed, 15 Oct 2025 09:57:32 +0200 Subject: [PATCH 21/30] fix compilation and warnings --- Stream_support/test/Stream_support/test_VTK.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Stream_support/test/Stream_support/test_VTK.cpp b/Stream_support/test/Stream_support/test_VTK.cpp index 78697284ab9..93a743ea752 100644 --- a/Stream_support/test/Stream_support/test_VTK.cpp +++ b/Stream_support/test/Stream_support/test_VTK.cpp @@ -9,7 +9,7 @@ template void test_VTK() { - typedef Kernel::Point_3 Point; + typedef typename Kernel::Point_3 Point; typedef std::vector Face; const std::vector points = { Point(0,0,0), Point(1,0,0), Point(0,1,0), Point(0,0,1) }; @@ -35,7 +35,7 @@ void test_VTK() } -int main(int argc, char** argv) +int main() { test_VTK>(); test_VTK>(); From 67349ccbe13937fb7c147b5f466f32cf87c55a4a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Loriot?= Date: Wed, 15 Oct 2025 16:49:15 +0200 Subject: [PATCH 22/30] include for boost range --- Stream_support/include/CGAL/IO/VTK.h | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Stream_support/include/CGAL/IO/VTK.h b/Stream_support/include/CGAL/IO/VTK.h index 6390db8c94e..1342c539210 100644 --- a/Stream_support/include/CGAL/IO/VTK.h +++ b/Stream_support/include/CGAL/IO/VTK.h @@ -23,6 +23,8 @@ #include #include +#include + #ifdef CGAL_USE_VTK #include #include From 62a9c9e04f831489539ce64e37187d2ad31232f7 Mon Sep 17 00:00:00 2001 From: Andreas Fabri Date: Wed, 15 Oct 2025 16:23:59 +0100 Subject: [PATCH 23/30] cleanup --- Stream_support/include/CGAL/IO/OFF.h | 2 +- Stream_support/include/CGAL/IO/polygon_soup_io.h | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/Stream_support/include/CGAL/IO/OFF.h b/Stream_support/include/CGAL/IO/OFF.h index f23265c8449..da1e2598a54 100644 --- a/Stream_support/include/CGAL/IO/OFF.h +++ b/Stream_support/include/CGAL/IO/OFF.h @@ -318,7 +318,7 @@ bool write_OFF(std::ostream& os, * \cgalParamDescription{a property map associating points to the elements of the range `points`} * \cgalParamType{a model of `ReadablePropertyMap` whose key type is the value type * of the iterator of `PointRange` and value type is a model of the concept `Point_3`} - * \cgalParamDefault{`CGAL::Identity_property_map`} + * \cgalParamDefault{`CGAL::Identity_property_map::value_type>`} * \cgalParamNEnd * \cgalParamNBegin{stream_precision} * \cgalParamDescription{a parameter used to set the precision (i.e. how many digits are generated) of the output stream} diff --git a/Stream_support/include/CGAL/IO/polygon_soup_io.h b/Stream_support/include/CGAL/IO/polygon_soup_io.h index a6c82f82a3d..b8216f96c10 100644 --- a/Stream_support/include/CGAL/IO/polygon_soup_io.h +++ b/Stream_support/include/CGAL/IO/polygon_soup_io.h @@ -143,9 +143,9 @@ bool read_polygon_soup(const std::string& fname, * * \cgalNamedParamsBegin * \cgalParamNBegin{point_map} - * \cgalParamDescription{a property map associating points with %Cartesian coordinates to the elements of the point set `points`} + * \cgalParamDescription{a property map associating points to the elements of the range `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 %Cartesian coordinates} + * of the iterator of `PointRange` and value type is a model of concept `Point_3`} * \cgalParamDefault{`CGAL::Identity_property_map::value_type>`} * \cgalParamNEnd * \cgalParamNBegin{verbose} From 5d82eed3ea2d16f102fd9445f440bebb82cdf84c Mon Sep 17 00:00:00 2001 From: Andreas Fabri Date: Tue, 21 Oct 2025 17:26:45 +0200 Subject: [PATCH 24/30] Update Stream_support/include/CGAL/IO/STL.h --- Stream_support/include/CGAL/IO/STL.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Stream_support/include/CGAL/IO/STL.h b/Stream_support/include/CGAL/IO/STL.h index b2ef4ebb890..043ef0c5a3d 100644 --- a/Stream_support/include/CGAL/IO/STL.h +++ b/Stream_support/include/CGAL/IO/STL.h @@ -329,7 +329,7 @@ bool write_STL(std::ostream& os, Point_3 qq = conv(q); Point_3 rr = conv(r); - const Vector_3 nn = collinear(pp,qq,rr) ? Vector_3(static_cast(1.0),static_cast(0),static_cast(0)) : unit_normal(pp,qq,rr); + const Vector_3 nn = collinear(pp,qq,rr) ? Vector_3(static_cast(1),static_cast(0),static_cast(0)) : unit_normal(pp,qq,rr); const float coords[12] = { nn.x(), nn.y(), nn.z(), pp.x(), pp.y(), pp.z(), From 4acccc210b0bdd534dc3b01e122042f336e88fe9 Mon Sep 17 00:00:00 2001 From: Andreas Fabri Date: Tue, 21 Oct 2025 18:11:12 +0100 Subject: [PATCH 25/30] Fix in doc of STL_extension --- STL_Extension/doc/STL_Extension/dependencies | 1 + 1 file changed, 1 insertion(+) diff --git a/STL_Extension/doc/STL_Extension/dependencies b/STL_Extension/doc/STL_Extension/dependencies index a28909c2b4f..04ce3232efc 100644 --- a/STL_Extension/doc/STL_Extension/dependencies +++ b/STL_Extension/doc/STL_Extension/dependencies @@ -5,3 +5,4 @@ Manual Miscellany Number_types Surface_mesh +Triangulation_3 From 4c27d08372eb4390c0e13d30a91dfab0d0f44568 Mon Sep 17 00:00:00 2001 From: Andreas Fabri Date: Wed, 22 Oct 2025 11:17:31 +0200 Subject: [PATCH 26/30] Apply suggestions from code review Co-authored-by: Mael --- Stream_support/include/CGAL/IO/GOCAD.h | 2 +- Stream_support/include/CGAL/IO/Generic_writer.h | 2 +- Stream_support/include/CGAL/IO/OBJ.h | 2 +- Stream_support/include/CGAL/IO/OFF.h | 2 +- Stream_support/include/CGAL/IO/STL.h | 6 +++--- 5 files changed, 7 insertions(+), 7 deletions(-) diff --git a/Stream_support/include/CGAL/IO/GOCAD.h b/Stream_support/include/CGAL/IO/GOCAD.h index c63b7c9b6ab..c95706547cc 100644 --- a/Stream_support/include/CGAL/IO/GOCAD.h +++ b/Stream_support/include/CGAL/IO/GOCAD.h @@ -339,7 +339,7 @@ bool write_GOCAD(std::ostream& os, * \cgalParamNBegin{point_map} * \cgalParamDescription{a property map associating points to the elements of the range `points`} * \cgalParamType{a model of `ReadablePropertyMap` whose key type is the value type - * of the iterator of `PointRange` and value type is a model of the concept`Point_3`} + * of the iterator of `PointRange` and value type is a model of the concept `Kernel::Point_3`} * \cgalParamDefault{`CGAL::Identity_property_map::value_type>`} * \cgalParamNEnd * \cgalParamNBegin{stream_precision} diff --git a/Stream_support/include/CGAL/IO/Generic_writer.h b/Stream_support/include/CGAL/IO/Generic_writer.h index f56d5b7dc7c..afd0b8be5d6 100644 --- a/Stream_support/include/CGAL/IO/Generic_writer.h +++ b/Stream_support/include/CGAL/IO/Generic_writer.h @@ -59,7 +59,7 @@ public: m_writer.write_header(m_os, points.size(), 0, polygons.size()); for(std::size_t i=0, end=points.size(); i::value_type>`} * \cgalParamNEnd * \cgalParamNBegin{stream_precision} diff --git a/Stream_support/include/CGAL/IO/OFF.h b/Stream_support/include/CGAL/IO/OFF.h index da1e2598a54..d2b1b5c9934 100644 --- a/Stream_support/include/CGAL/IO/OFF.h +++ b/Stream_support/include/CGAL/IO/OFF.h @@ -317,7 +317,7 @@ bool write_OFF(std::ostream& os, * \cgalParamNBegin{point_map} * \cgalParamDescription{a property map associating points to the elements of the range `points`} * \cgalParamType{a model of `ReadablePropertyMap` whose key type is the value type - * of the iterator of `PointRange` and value type is a model of the concept `Point_3`} + * of the iterator of `PointRange` and value type is a model of the concept `Kernel::Point_3`} * \cgalParamDefault{`CGAL::Identity_property_map::value_type>`} * \cgalParamNEnd * \cgalParamNBegin{stream_precision} diff --git a/Stream_support/include/CGAL/IO/STL.h b/Stream_support/include/CGAL/IO/STL.h index 043ef0c5a3d..1c7470e1598 100644 --- a/Stream_support/include/CGAL/IO/STL.h +++ b/Stream_support/include/CGAL/IO/STL.h @@ -325,9 +325,9 @@ bool write_STL(std::ostream& os, const Point& q = get(point_map, points[face[1]]); const Point& r = get(point_map, points[face[2]]); - Point_3 pp = conv(p); - Point_3 qq = conv(q); - Point_3 rr = conv(r); + decltype(auto) pp = conv(p); + decltype(auto) qq = conv(q); + decltype(auto) rr = conv(r); const Vector_3 nn = collinear(pp,qq,rr) ? Vector_3(static_cast(1),static_cast(0),static_cast(0)) : unit_normal(pp,qq,rr); From 8623f28bb098fc666d5766f4e8f09c6be094d031 Mon Sep 17 00:00:00 2001 From: Andreas Fabri Date: Wed, 22 Oct 2025 10:32:00 +0100 Subject: [PATCH 27/30] Use internal::construct_normal_of_STL_face() --- Stream_support/include/CGAL/IO/STL.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Stream_support/include/CGAL/IO/STL.h b/Stream_support/include/CGAL/IO/STL.h index 1c7470e1598..3407d2bbefb 100644 --- a/Stream_support/include/CGAL/IO/STL.h +++ b/Stream_support/include/CGAL/IO/STL.h @@ -329,7 +329,7 @@ bool write_STL(std::ostream& os, decltype(auto) qq = conv(q); decltype(auto) rr = conv(r); - const Vector_3 nn = collinear(pp,qq,rr) ? Vector_3(static_cast(1),static_cast(0),static_cast(0)) : unit_normal(pp,qq,rr); + const Vector_3 nn = conv(internal::construct_normal_of_STL_face(p, q, r, k)); const float coords[12] = { nn.x(), nn.y(), nn.z(), pp.x(), pp.y(), pp.z(), From 5050b54bfeda2bc3158e87c74fe94fd609c05e1a Mon Sep 17 00:00:00 2001 From: Andreas Fabri Date: Thu, 30 Oct 2025 12:03:22 +0100 Subject: [PATCH 28/30] robustify normal computation for STL --- Stream_support/include/CGAL/IO/STL.h | 27 ++++++++++++--------------- 1 file changed, 12 insertions(+), 15 deletions(-) diff --git a/Stream_support/include/CGAL/IO/STL.h b/Stream_support/include/CGAL/IO/STL.h index 3407d2bbefb..8c85634485c 100644 --- a/Stream_support/include/CGAL/IO/STL.h +++ b/Stream_support/include/CGAL/IO/STL.h @@ -236,14 +236,12 @@ typename K::Vector_3 construct_normal_of_STL_face(const typename K::Point_3& p, typedef typename K::FT FT; typedef typename K::Vector_3 Vector; - if(k.collinear_3_object()(p, q, r)) + Vector res = k.construct_orthogonal_vector_3_object()(p, q, r); + const FT len = CGAL::approximate_sqrt(k.compute_squared_length_3_object()(res)); + if (is_zero(len)) return k.construct_vector_3_object()(1, 0, 0); - Vector res = k.construct_orthogonal_vector_3_object()(p, q, r); - const FT sql = k.compute_squared_length_3_object()(res); - res = k.construct_divided_vector_3_object()(res, CGAL::approximate_sqrt(sql)); - - return res; + return k.construct_divided_vector_3_object()(res, len); } } // namespace internal @@ -299,6 +297,7 @@ bool write_STL(std::ostream& os, typedef typename boost::property_traits::value_type Point; typedef typename CGAL::Kernel_traits::Kernel K; + typedef typename K::Vector_3 Vector; K k = choose_parameter(get_parameter(np, internal_np::geom_traits)); @@ -308,9 +307,6 @@ bool write_STL(std::ostream& os, set_stream_precision_from_NP(os, np); typedef Simple_cartesian SC; - typedef SC::FT FT; - typedef typename SC::Point_3 Point_3; - typedef typename SC::Vector_3 Vector_3; Cartesian_converter conv; if(get_mode(os) == BINARY) @@ -324,12 +320,12 @@ bool write_STL(std::ostream& os, const Point& p = get(point_map, points[face[0]]); const Point& q = get(point_map, points[face[1]]); const Point& r = get(point_map, points[face[2]]); + const Vector n = internal::construct_normal_of_STL_face(p, q, r, k); decltype(auto) pp = conv(p); decltype(auto) qq = conv(q); decltype(auto) rr = conv(r); - - const Vector_3 nn = conv(internal::construct_normal_of_STL_face(p, q, r, k)); + decltype(auto) nn = conv(n); const float coords[12] = { nn.x(), nn.y(), nn.z(), pp.x(), pp.y(), pp.z(), @@ -349,12 +345,13 @@ bool write_STL(std::ostream& os, const Point& p = get(point_map, points[face[0]]); const Point& q = get(point_map, points[face[1]]); const Point& r = get(point_map, points[face[2]]); + const Vector n = internal::construct_normal_of_STL_face(p, q, r, k); - Point_3 pp = conv(p); - Point_3 qq = conv(q); - Point_3 rr = conv(r); + decltype(auto) pp = conv(p); + decltype(auto) qq = conv(q); + decltype(auto) rr = conv(r); + decltype(auto) nn = conv(n); - const Vector_3 nn = conv(internal::construct_normal_of_STL_face(p, q, r, k)); os << "facet normal " << nn << "\nouter loop\n"; os << "vertex " << pp << "\n"; os << "vertex " << qq << "\n"; From ba17e0bddec14086c47412bf8d37ae04ae68e245 Mon Sep 17 00:00:00 2001 From: Andreas Fabri Date: Thu, 13 Nov 2025 11:05:26 +0000 Subject: [PATCH 29/30] cleanup an example --- .../examples/Snap_rounding_2/snap_rounding_data.cpp | 13 ------------- 1 file changed, 13 deletions(-) diff --git a/Snap_rounding_2/examples/Snap_rounding_2/snap_rounding_data.cpp b/Snap_rounding_2/examples/Snap_rounding_2/snap_rounding_data.cpp index 75577b920ea..443a4eee5fc 100644 --- a/Snap_rounding_2/examples/Snap_rounding_2/snap_rounding_data.cpp +++ b/Snap_rounding_2/examples/Snap_rounding_2/snap_rounding_data.cpp @@ -1,16 +1,3 @@ -// Copyright 2009,2014 Max-Planck-Institute Saarbruecken (Germany). -// All rights reserved. -// -// This file is part of CGAL (www.cgal.org). -// -// $URL$ -// $Id$ -// SPDX-License-Identifier: GPL-3.0-or-later OR LicenseRef-Commercial -// -// -// author(s) : Waqar Khan - - /* Usage * * This example converts arbitrary-precision arrangement into fixed-precision using Snap Rounding and by using INPUT DATA FROM A USER SPECIFIED FILE. From eb992b38ca308ec2b8d2deec4c67ae7d64aa11ce Mon Sep 17 00:00:00 2001 From: Mael Date: Thu, 13 Nov 2025 15:20:23 +0100 Subject: [PATCH 30/30] Fix missing I/O function links --- .../Tutorials/Tutorial_reconstruction.txt | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/Documentation/doc/Documentation/Tutorials/Tutorial_reconstruction.txt b/Documentation/doc/Documentation/Tutorials/Tutorial_reconstruction.txt index be563e0d919..62cadafa51b 100644 --- a/Documentation/doc/Documentation/Tutorials/Tutorial_reconstruction.txt +++ b/Documentation/doc/Documentation/Tutorials/Tutorial_reconstruction.txt @@ -83,12 +83,12 @@ a newline character and each coordinate separated by a white space. Other formats available are 'OFF', 'PLY' and 'LAS'. \cgal provides functions to read such formats: -- `read_XYZ()` -- `read_OFF()` -- `read_PLY()` -- `read_PLY_with_properties()` to read additional PLY properties -- `read_LAS()` -- `read_LAS_with_properties()` to read additional LAS properties +- `CGAL::IO::read_XYZ()` +- `CGAL::IO::read_OFF()` +- `CGAL::IO::read_PLY()` +- `CGAL::IO::read_PLY_with_properties()` to read additional PLY properties +- `CGAL::IO::read_LAS()` +- `CGAL::IO::read_LAS_with_properties()` to read additional LAS properties \cgal also provides a dedicated container `CGAL::Point_set_3` to handle point sets with additional properties such as normal