Skip to content

Commit 789f0c0

Browse files
committed
feat: Implement is_valid algorithm for polyhedral surfaces
1 parent 111f0df commit 789f0c0

File tree

15 files changed

+1315
-19
lines changed

15 files changed

+1315
-19
lines changed

doc/concept/polyhedral_surface.qbk

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ The PolyhedralSurface Concept is defined as following:
2525
* It must behave like a Boost.Range Random Access Range
2626
* The type defined by the metafunction `range_value<...>::type` must fulfill
2727
the [link geometry.reference.concepts.concept_polygon Polygon Concept]
28+
* It must be 3-dimensional and cartesian
2829

2930
[heading Rules]
3031

include/boost/geometry/algorithms/detail/is_valid/implementation.hpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
#include <boost/geometry/algorithms/detail/is_valid/pointlike.hpp>
1515
#include <boost/geometry/algorithms/detail/is_valid/linear.hpp>
1616
#include <boost/geometry/algorithms/detail/is_valid/polygon.hpp>
17+
#include <boost/geometry/algorithms/detail/is_valid/polyhedral_surface.hpp>
1718
#include <boost/geometry/algorithms/detail/is_valid/multipolygon.hpp>
1819
#include <boost/geometry/algorithms/detail/is_valid/ring.hpp>
1920
#include <boost/geometry/algorithms/detail/is_valid/segment.hpp>

include/boost/geometry/algorithms/detail/is_valid/interface.hpp

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,8 @@
2626
#include <boost/geometry/strategies/default_strategy.hpp>
2727
#include <boost/geometry/strategies/detail.hpp>
2828
#include <boost/geometry/strategies/relate/services.hpp>
29-
29+
#include <boost/geometry/strategies/relate3/services.hpp>
30+
#include <boost/geometry/strategies/relate3/cartesian.hpp>
3031

3132
namespace boost { namespace geometry
3233
{
@@ -77,13 +78,15 @@ struct is_valid<default_strategy, false>
7778
default_strategy)
7879
{
7980
// NOTE: Currently the strategy is only used for Areal geometries
80-
typedef typename strategies::relate::services::default_strategy
81+
// Select strategy_type based on Geometry's dimension
82+
using strategy_type = typename std::conditional_t
8183
<
82-
Geometry, Geometry
83-
>::type strategy_type;
84+
geometry::dimension<Geometry>::value == 3,
85+
typename strategies::relate3::services::default_strategy<Geometry, Geometry>,
86+
typename strategies::relate::services::default_strategy<Geometry, Geometry>
87+
>::type;
8488

85-
return dispatch::is_valid<Geometry>::apply(geometry, visitor,
86-
strategy_type());
89+
return dispatch::is_valid<Geometry>::apply(geometry, visitor, strategy_type());
8790
}
8891
};
8992

0 commit comments

Comments
 (0)