From b9a36209f1b16551c3319207ee0d11c159523b8d Mon Sep 17 00:00:00 2001 From: Pierre Gergondet Date: Mon, 10 Jul 2023 14:30:23 +0900 Subject: [PATCH] Fix for geos >= 3.12.0 --- src/mc_rbdyn/Contact.cpp | 13 ++++++++++++- src/mc_rbdyn/PolygonInterpolator.cpp | 14 +++++++++++++- 2 files changed, 25 insertions(+), 2 deletions(-) diff --git a/src/mc_rbdyn/Contact.cpp b/src/mc_rbdyn/Contact.cpp index a01acbdad2..7f486cf6d7 100644 --- a/src/mc_rbdyn/Contact.cpp +++ b/src/mc_rbdyn/Contact.cpp @@ -11,11 +11,14 @@ #include -#include #include #include #include +#if GEOS_VERSION_MAJOR >= 3 && GEOS_VERSION_MINOR < 12 +# include +#endif + namespace mc_rbdyn { @@ -66,7 +69,11 @@ std::vector computePoints(const mc_rbdyn::Surface & robotSurfa const geos::geom::GeometryFactory & factory = *factory_ptr; // Create robot surf polygon +#if GEOS_VERSION_MAJOR >= 3 && GEOS_VERSION_MINOR >= 12 + auto robotPoints2dseq = std::make_unique(static_cast(0), 0); +#else auto robotPoints2dseq = factory.getCoordinateSequenceFactory()->create(static_cast(0), 0); +#endif std::vector points; for(const std::pair & p : robotPoints2d) { @@ -82,7 +89,11 @@ std::vector computePoints(const mc_rbdyn::Surface & robotSurfa #endif // Create env surf polygon +#if GEOS_VERSION_MAJOR >= 3 && GEOS_VERSION_MINOR >= 12 + auto envPoints2dseq = std::make_unique(static_cast(0), 0); +#else auto envPoints2dseq = factory.getCoordinateSequenceFactory()->create(static_cast(0), 0); +#endif points.clear(); for(const std::pair & p : envPoints2d) { diff --git a/src/mc_rbdyn/PolygonInterpolator.cpp b/src/mc_rbdyn/PolygonInterpolator.cpp index 51906148d8..e121f275de 100644 --- a/src/mc_rbdyn/PolygonInterpolator.cpp +++ b/src/mc_rbdyn/PolygonInterpolator.cpp @@ -7,11 +7,14 @@ #include #include -#include #include #include #include +#if GEOS_VERSION_MAJOR >= 3 && GEOS_VERSION_MINOR < 12 +# include +#endif + namespace mc_rbdyn { @@ -42,7 +45,11 @@ std::shared_ptr PolygonInterpolator::fast_interpolate(doub double perc = std::max(std::min(percent, 1.), -1.); if(perc < 0) { perc = 1 + perc; } std::vector points; +#if GEOS_VERSION_MAJOR >= 3 && GEOS_VERSION_MINOR >= 12 + auto seq = std::make_unique(static_cast(0), 0); +#else auto seq = geom_factory.getCoordinateSequenceFactory()->create(static_cast(0), 0); +#endif std::vector seq_points; for(const auto & p : tuple_pairs_) { @@ -77,8 +84,13 @@ std::vector PolygonInterpolator::midpoint_derivati std::vector PolygonInterpolator::normal_derivative(double epsilon_derivative) { std::vector res; +#if GEOS_VERSION_MAJOR >= 3 && GEOS_VERSION_MINOR >= 12 + auto seq_s = std::make_unique(static_cast(0), 2); + auto seq_d = std::make_unique(static_cast(0), 2); +#else auto seq_s = geom_factory.getCoordinateSequenceFactory()->create(static_cast(0), 2); auto seq_d = geom_factory.getCoordinateSequenceFactory()->create(static_cast(0), 2); +#endif std::vector points_s; std::vector points_d; for(const auto & p : tuple_pairs_)