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 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); diff --git a/Property_map/include/CGAL/property_map.h b/Property_map/include/CGAL/property_map.h index 1306cf24c2c..113b46dda7f 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_) @@ -716,6 +722,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) @@ -765,8 +772,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) @@ -775,6 +782,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> 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 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. 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 diff --git a/Stream_support/include/CGAL/IO/GOCAD.h b/Stream_support/include/CGAL/IO/GOCAD.h index 07b4b6dec07..c95706547cc 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 @@ -373,6 +384,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 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::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/Generic_writer.h b/Stream_support/include/CGAL/IO/Generic_writer.h index e425fc51866..afd0b8be5d6 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())); + decltype(auto) 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 d1228f47e23..f0adf99c4ca 100644 --- a/Stream_support/include/CGAL/IO/OBJ.h +++ b/Stream_support/include/CGAL/IO/OBJ.h @@ -320,6 +320,12 @@ 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 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::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} @@ -364,6 +370,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 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 `Kernel::Point_3`} + * \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 ff17f202bba..d2b1b5c9934 100644 --- a/Stream_support/include/CGAL/IO/OFF.h +++ b/Stream_support/include/CGAL/IO/OFF.h @@ -267,6 +267,12 @@ 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 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::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} @@ -308,6 +314,12 @@ 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 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 `Kernel::Point_3`} + * \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/STL.h b/Stream_support/include/CGAL/IO/STL.h index 5b4f2de052d..8c85634485c 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 @@ -233,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 @@ -296,7 +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_3; + typedef typename K::Vector_3 Vector; K k = choose_parameter(get_parameter(np, internal_np::geom_traits)); @@ -305,6 +306,9 @@ bool write_STL(std::ostream& os, set_stream_precision_from_NP(os, np); + typedef Simple_cartesian SC; + Cartesian_converter conv; + if(get_mode(os) == BINARY) { os << "FileType: Binary "; @@ -316,13 +320,17 @@ 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); - const Vector_3 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); + decltype(auto) nn = conv(n); - 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] = { 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])); @@ -337,12 +345,17 @@ 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); - 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"; + decltype(auto) pp = conv(p); + decltype(auto) qq = conv(q); + decltype(auto) rr = conv(r); + decltype(auto) nn = conv(n); + + 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"< #include +#include +#include + +#include #ifdef CGAL_USE_VTK #include @@ -241,8 +245,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 { + 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"; @@ -383,16 +389,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 @@ -483,6 +504,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/include/CGAL/IO/WKT.h b/Stream_support/include/CGAL/IO/WKT.h index 206d1a5eecc..1a37098d874 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` @@ -162,7 +162,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` @@ -199,7 +199,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, @@ -239,7 +239,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 @@ -274,7 +274,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 @@ -317,7 +317,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` @@ -338,7 +338,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 @@ -358,7 +358,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` @@ -380,7 +380,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` @@ -402,7 +402,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 @@ -430,7 +430,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 @@ -465,7 +465,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::value_type>`} + * \cgalParamNEnd * \cgalParamNBegin{verbose} * \cgalParamDescription{indicates whether output warnings and error messages should be printed or not.} * \cgalParamType{Boolean} 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 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/issue_9071.cpp b/Stream_support/test/Stream_support/issue_9071.cpp new file mode 100644 index 00000000000..271dff3a6b2 --- /dev/null +++ b/Stream_support/test/Stream_support/issue_9071.cpp @@ -0,0 +1,16 @@ +#include +#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)); + return 0; +} 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..93a743ea752 --- /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 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) }; + 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() +{ + test_VTK>(); + test_VTK>(); + test_VTK(); + return 0; +} \ No newline at end of file