within

# within: detect if a geometry is inside another geometry, a.o. point-in-polygon

boost::geometry::concept::WithinStrategyPolygonal
boost::geometry::strategy::within::services::default_strategy
typename Geometry1
typename Geometry2
bool bool boost::geometry::within (Geometry1 const &geometry1, Geometry2 const &geometry2) within Geometry1 const & geometry1 Geometry2 const & geometry2

Checks if the first geometry is completely inside the second geometry.

The free function within checks if the first geometry is completely inside the second geometry. Geometry1

Any type fulfilling a Geometry Concept

Geometry2

Any type fulfilling a Geometry Concept

geometry1

A model of the specified concept which might be within the second geometry

geometry2

A model of the specified concept which might contain the first geometry

true if geometry1 is completely contained within geometry2, else false

The default strategy is used for within detection

[include reference/algorithms/within.qbk]

[heading Example] [within] [within_output]

typename Geometry1
typename Geometry2
typename Strategy
bool bool boost::geometry::within (Geometry1 const &geometry1, Geometry2 const &geometry2, Strategy const &strategy) within Geometry1 const & geometry1 Geometry2 const & geometry2 Strategy const & strategy

Checks if the first geometry is completely inside the second geometry using the specified strategy.

The free function within checks if the first geometry is completely inside the second geometry, using the specified strategy. Reasons to specify a strategy include: use another coordinate system for calculations; construct the strategy beforehand (e.g. with the radius of the Earth); select a strategy when there are more than one available for a calculation. Geometry1

Any type fulfilling a Geometry Concept

Geometry2

Any type fulfilling a Geometry Concept

geometry1

A model of the specified concept which might be within the second geometry

geometry2

A model of the specified concept which might contain the first geometry

strategy

strategy to be used

true if geometry1 is completely contained within geometry2, else false

with strategy [include reference/algorithms/within.qbk] [heading Available Strategies] \* [link geometry.reference.strategies.strategy_within_winding Winding (coordinate system agnostic)] \* [link geometry.reference.strategies.strategy_within_franklin Franklin (cartesian)] \* [link geometry.reference.strategies.strategy_within_crossings_multiply Crossings Multiply (cartesian)] [heading Example] [within_strategy] [within_strategy_output]