Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r84522 - in trunk/boost/geometry/extensions: ball ball/algorithms ball/core ball/geometries ball/geometries/concepts nsphere/algorithms
From: adam.wulkiewicz_at_[hidden]
Date: 2013-05-26 19:11:00


Author: awulkiew
Date: 2013-05-26 19:10:58 EDT (Sun, 26 May 2013)
New Revision: 84522
URL: http://svn.boost.org/trac/boost/changeset/84522

Log:
geometry extensions: fixed error in nsphere num_points, added ball concept implementation - nsphere using indexed access.
Added:
   trunk/boost/geometry/extensions/ball/
   trunk/boost/geometry/extensions/ball/algorithms/
   trunk/boost/geometry/extensions/ball/algorithms/append.hpp (contents, props changed)
   trunk/boost/geometry/extensions/ball/algorithms/area.hpp (contents, props changed)
   trunk/boost/geometry/extensions/ball/algorithms/assign.hpp (contents, props changed)
   trunk/boost/geometry/extensions/ball/algorithms/clear.hpp (contents, props changed)
   trunk/boost/geometry/extensions/ball/algorithms/envelope.hpp (contents, props changed)
   trunk/boost/geometry/extensions/ball/algorithms/num_points.hpp (contents, props changed)
   trunk/boost/geometry/extensions/ball/algorithms/within.hpp (contents, props changed)
   trunk/boost/geometry/extensions/ball/ball.hpp (contents, props changed)
   trunk/boost/geometry/extensions/ball/core/
   trunk/boost/geometry/extensions/ball/core/access.hpp (contents, props changed)
   trunk/boost/geometry/extensions/ball/core/geometry_id.hpp (contents, props changed)
   trunk/boost/geometry/extensions/ball/core/radius_type.hpp (contents, props changed)
   trunk/boost/geometry/extensions/ball/core/replace_point_type.hpp (contents, props changed)
   trunk/boost/geometry/extensions/ball/core/tags.hpp (contents, props changed)
   trunk/boost/geometry/extensions/ball/core/topological_dimension.hpp (contents, props changed)
   trunk/boost/geometry/extensions/ball/geometries/
   trunk/boost/geometry/extensions/ball/geometries/ball.hpp (contents, props changed)
   trunk/boost/geometry/extensions/ball/geometries/concepts/
   trunk/boost/geometry/extensions/ball/geometries/concepts/ball_concept.hpp (contents, props changed)
   trunk/boost/geometry/extensions/ball/geometries/concepts/check.hpp (contents, props changed)
Text files modified:
   trunk/boost/geometry/extensions/nsphere/algorithms/num_points.hpp | 2 +-
   1 files changed, 1 insertions(+), 1 deletions(-)

Added: trunk/boost/geometry/extensions/ball/algorithms/append.hpp
==============================================================================
--- (empty file)
+++ trunk/boost/geometry/extensions/ball/algorithms/append.hpp 2013-05-26 19:10:58 EDT (Sun, 26 May 2013)
@@ -0,0 +1,45 @@
+// Boost.Geometry (aka GGL, Generic Geometry Library)
+
+// Copyright (c) 2007-2012 Barend Gehrels, Amsterdam, the Netherlands.
+// Copyright (c) 2008-2012 Bruno Lalande, Paris, France.
+// Copyright (c) 2009-2012 Mateusz Loskot, London, UK.
+
+// Parts of Boost.Geometry are redesigned from Geodan's Geographic Library
+// (geolib/GGL), copyright (c) 1995-2010 Geodan, Amsterdam, the Netherlands.
+
+// Use, modification and distribution is subject to the Boost Software License,
+// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+
+#ifndef BOOST_GEOMETRY_EXTENSIONS_BALL_ALGORITHMS_APPEND_HPP
+#define BOOST_GEOMETRY_EXTENSIONS_BALL_ALGORITHMS_APPEND_HPP
+
+
+#include <boost/geometry/algorithms/append.hpp>
+
+#include <boost/geometry/extensions/ball/core/tags.hpp>
+
+
+namespace boost { namespace geometry
+{
+
+
+
+
+#ifndef DOXYGEN_NO_DISPATCH
+namespace dispatch
+{
+
+// This file is probably obsolete
+
+//template <typename TagRoP, typename N, typename RoP, bool Std>
+//struct append<ball_tag, TagRoP, N, RoP, Std> {};
+
+
+} // namespace dispatch
+#endif // DOXYGEN_NO_DISPATCH
+
+
+}} // namespace boost::geometry
+
+#endif // BOOST_GEOMETRY_EXTENSIONS_BALL_ALGORITHMS_APPEND_HPP

Added: trunk/boost/geometry/extensions/ball/algorithms/area.hpp
==============================================================================
--- (empty file)
+++ trunk/boost/geometry/extensions/ball/algorithms/area.hpp 2013-05-26 19:10:58 EDT (Sun, 26 May 2013)
@@ -0,0 +1,82 @@
+// Boost.Geometry (aka GGL, Generic Geometry Library)
+
+// Copyright (c) 2007-2012 Barend Gehrels, Amsterdam, the Netherlands.
+// Copyright (c) 2008-2012 Bruno Lalande, Paris, France.
+// Copyright (c) 2009-2012 Mateusz Loskot, London, UK.
+
+// Parts of Boost.Geometry are redesigned from Geodan's Geographic Library
+// (geolib/GGL), copyright (c) 1995-2010 Geodan, Amsterdam, the Netherlands.
+
+// Use, modification and distribution is subject to the Boost Software License,
+// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+
+#ifndef BOOST_GEOMETRY_EXTENSIONS_BALL_ALGORITHMS_AREA_HPP
+#define BOOST_GEOMETRY_EXTENSIONS_BALL_ALGORITHMS_AREA_HPP
+
+#include <boost/math/constants/constants.hpp>
+
+#include <boost/geometry/algorithms/area.hpp>
+#include <boost/geometry/extensions/nsphere/core/tags.hpp>
+
+
+
+namespace boost { namespace geometry
+{
+
+#ifndef DOXYGEN_NO_DETAIL
+namespace detail { namespace area
+{
+
+template<typename C>
+struct circle_area
+{
+ typedef typename coordinate_type<C>::type coordinate_type;
+
+ // Returning the coordinate precision, but if integer, returning a double
+ typedef typename boost::mpl::if_c
+ <
+ boost::is_integral<coordinate_type>::type::value,
+ double,
+ coordinate_type
+ >::type return_type;
+
+ template <typename S>
+ static inline return_type apply(C const& c, S const&)
+ {
+ // Currently only works for Cartesian circles
+ // Todo: use strategy
+ // Todo: use concept
+ assert_dimension<C, 2>();
+
+ return_type r = get<radius_value, 0>(c);
+ r *= r * boost::math::constants::pi<return_type>();
+ return r;
+ }
+};
+
+
+
+}} // namespace detail::area
+
+#endif // DOXYGEN_NO_DETAIL
+
+#ifndef DOXYGEN_NO_DISPATCH
+namespace dispatch
+{
+
+
+template <typename Geometry>
+struct area<Geometry, ball_tag>
+ : detail::area::circle_area<Geometry>
+{};
+
+
+} // namespace dispatch
+#endif // DOXYGEN_NO_DISPATCH
+
+
+
+}} // namespace boost::geometry
+
+#endif // BOOST_GEOMETRY_EXTENSIONS_BALL_ALGORITHMS_AREA_HPP

Added: trunk/boost/geometry/extensions/ball/algorithms/assign.hpp
==============================================================================
--- (empty file)
+++ trunk/boost/geometry/extensions/ball/algorithms/assign.hpp 2013-05-26 19:10:58 EDT (Sun, 26 May 2013)
@@ -0,0 +1,92 @@
+// Boost.Geometry (aka GGL, Generic Geometry Library)
+
+// Copyright (c) 2007-2012 Barend Gehrels, Amsterdam, the Netherlands.
+// Copyright (c) 2008-2012 Bruno Lalande, Paris, France.
+// Copyright (c) 2009-2012 Mateusz Loskot, London, UK.
+
+// Parts of Boost.Geometry are redesigned from Geodan's Geographic Library
+// (geolib/GGL), copyright (c) 1995-2010 Geodan, Amsterdam, the Netherlands.
+
+// Use, modification and distribution is subject to the Boost Software License,
+// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+
+#ifndef BOOST_GEOMETRY_EXTENSIONS_BALL_ALGORITHMS_ASSIGN_HPP
+#define BOOST_GEOMETRY_EXTENSIONS_BALL_ALGORITHMS_ASSIGN_HPP
+
+#include <boost/geometry/algorithms/assign.hpp>
+
+#include <boost/geometry/extensions/ball/core/tags.hpp>
+
+
+
+namespace boost { namespace geometry
+{
+
+
+#ifndef DOXYGEN_NO_DISPATCH
+namespace dispatch
+{
+
+
+template <typename S>
+struct assign<ball_tag, S, 2>
+{
+ typedef typename coordinate_type<S>::type coordinate_type;
+ typedef typename radius_type<S>::type radius_type;
+
+ /// 2-value version for an n-sphere is valid for circle and sets the center
+ template <typename T>
+ static inline void apply(S& sphercle, T const& c1, T const& c2)
+ {
+ set<center_point, 0>(sphercle, boost::numeric_cast<coordinate_type>(c1));
+ set<center_point, 1>(sphercle, boost::numeric_cast<coordinate_type>(c2));
+ }
+
+ template <typename T, typename R>
+ static inline void apply(S& sphercle, T const& c1,
+ T const& c2, R const& radius)
+ {
+ set<center_point, 0>(sphercle, boost::numeric_cast<coordinate_type>(c1));
+ set<center_point, 1>(sphercle, boost::numeric_cast<coordinate_type>(c2));
+ set<radius_value, 0>(sphercle, boost::numeric_cast<radius_type>(radius));
+ }
+};
+
+template <typename S>
+struct assign<ball_tag, S, 3>
+{
+ typedef typename coordinate_type<S>::type coordinate_type;
+ typedef typename radius_type<S>::type radius_type;
+
+ /// 4-value version for an n-sphere is valid for a sphere and sets the center and the radius
+ template <typename T>
+ static inline void apply(S& sphercle, T const& c1, T const& c2, T const& c3)
+ {
+ set<center_point, 0>(sphercle, boost::numeric_cast<coordinate_type>(c1));
+ set<center_point, 1>(sphercle, boost::numeric_cast<coordinate_type>(c2));
+ set<center_point, 2>(sphercle, boost::numeric_cast<coordinate_type>(c3));
+ }
+
+ /// 4-value version for an n-sphere is valid for a sphere and sets the center and the radius
+ template <typename T, typename R>
+ static inline void apply(S& sphercle, T const& c1,
+ T const& c2, T const& c3, R const& radius)
+ {
+
+ set<center_point, 0>(sphercle, boost::numeric_cast<coordinate_type>(c1));
+ set<center_point, 1>(sphercle, boost::numeric_cast<coordinate_type>(c2));
+ set<center_point, 2>(sphercle, boost::numeric_cast<coordinate_type>(c3));
+ set<radius_value, 0>(sphercle, boost::numeric_cast<radius_type>(radius));
+ }
+
+};
+
+
+} // namespace dispatch
+#endif // DOXYGEN_NO_DISPATCH
+
+
+}} // namespace boost::geometry
+
+#endif // BOOST_GEOMETRY_EXTENSIONS_BALL_ALGORITHMS_ASSIGN_HPP

Added: trunk/boost/geometry/extensions/ball/algorithms/clear.hpp
==============================================================================
--- (empty file)
+++ trunk/boost/geometry/extensions/ball/algorithms/clear.hpp 2013-05-26 19:10:58 EDT (Sun, 26 May 2013)
@@ -0,0 +1,47 @@
+// Boost.Geometry (aka GGL, Generic Geometry Library)
+
+// Copyright (c) 2007-2012 Barend Gehrels, Amsterdam, the Netherlands.
+// Copyright (c) 2008-2012 Bruno Lalande, Paris, France.
+// Copyright (c) 2009-2012 Mateusz Loskot, London, UK.
+
+// Parts of Boost.Geometry are redesigned from Geodan's Geographic Library
+// (geolib/GGL), copyright (c) 1995-2010 Geodan, Amsterdam, the Netherlands.
+
+// Use, modification and distribution is subject to the Boost Software License,
+// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+
+#ifndef BOOST_GEOMETRY_EXTENSIONS_BALL_ALGORITHMS_CLEAR_HPP
+#define BOOST_GEOMETRY_EXTENSIONS_BALL_ALGORITHMS_CLEAR_HPP
+
+
+#include <boost/geometry/algorithms/clear.hpp>
+
+#include <boost/geometry/extensions/nsphere/core/tags.hpp>
+
+
+
+namespace boost { namespace geometry
+{
+
+
+#ifndef DOXYGEN_NO_DISPATCH
+namespace dispatch
+{
+
+
+
+template <typename Geometry>
+struct clear<ball_tag, Geometry>
+ : detail::clear::no_action<Geometry>
+{};
+
+
+
+} // namespace dispatch
+#endif // DOXYGEN_NO_DISPATCH
+
+
+}} // namespace boost::geometry
+
+#endif // BOOST_GEOMETRY_EXTENSIONS_BALL_ALGORITHMS_CLEAR_HPP

Added: trunk/boost/geometry/extensions/ball/algorithms/envelope.hpp
==============================================================================
--- (empty file)
+++ trunk/boost/geometry/extensions/ball/algorithms/envelope.hpp 2013-05-26 19:10:58 EDT (Sun, 26 May 2013)
@@ -0,0 +1,75 @@
+// Boost.Geometry (aka GGL, Generic Geometry Library)
+
+// Copyright (c) 2007-2012 Barend Gehrels, Amsterdam, the Netherlands.
+// Copyright (c) 2008-2012 Bruno Lalande, Paris, France.
+// Copyright (c) 2009-2012 Mateusz Loskot, London, UK.
+
+// Parts of Boost.Geometry are redesigned from Geodan's Geographic Library
+// (geolib/GGL), copyright (c) 1995-2010 Geodan, Amsterdam, the Netherlands.
+
+// Use, modification and distribution is subject to the Boost Software License,
+// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+
+#ifndef BOOST_GEOMETRY_EXTENSIONS_BALL_ALGORITHMS_ENVELOPE_HPP
+#define BOOST_GEOMETRY_EXTENSIONS_BALL_ALGORITHMS_ENVELOPE_HPP
+
+
+#include <boost/geometry/algorithms/envelope.hpp>
+
+#include <boost/geometry/extensions/ball/core/tags.hpp>
+
+
+namespace boost { namespace geometry
+{
+
+#ifndef DOXYGEN_NO_DETAIL
+namespace detail { namespace envelope
+{
+
+/// Calculate envelope of an n-sphere, circle or sphere (currently only for Cartesian 2D points)
+struct envelope_ball
+{
+ template <typename Ball, typename Box, typename Strategy>
+ static inline void apply(Ball const& nsphere, Box& mbr, Strategy const&)
+ {
+ apply(nsphere, mbr);
+ }
+
+ template <typename Ball, typename Box>
+ static inline void apply(Ball const& nsphere, Box& mbr)
+ {
+ assert_dimension<Ball, 2>();
+ assert_dimension<Box, 2>();
+
+ typename radius_type<Ball>::type radius = get<radius_value, 0>(nsphere);
+ set<min_corner, 0>(mbr, get<center_point, 0>(nsphere) - radius);
+ set<min_corner, 1>(mbr, get<center_point, 1>(nsphere) - radius);
+ set<max_corner, 0>(mbr, get<center_point, 0>(nsphere) + radius);
+ set<max_corner, 1>(mbr, get<center_point, 1>(nsphere) + radius);
+ }
+};
+
+
+}} // namespace detail::envelope
+#endif // DOXYGEN_NO_DETAIL
+
+#ifndef DOXYGEN_NO_DISPATCH
+namespace dispatch
+{
+
+
+template <typename Ball>
+struct envelope<Ball, ball_tag>
+ : detail::envelope::envelope_ball
+{};
+
+
+} // namespace dispatch
+#endif
+
+
+
+}} // namespace boost::geometry
+
+#endif // BOOST_GEOMETRY_EXTENSIONS_BALL_ALGORITHMS_ENVELOPE_HPP

Added: trunk/boost/geometry/extensions/ball/algorithms/num_points.hpp
==============================================================================
--- (empty file)
+++ trunk/boost/geometry/extensions/ball/algorithms/num_points.hpp 2013-05-26 19:10:58 EDT (Sun, 26 May 2013)
@@ -0,0 +1,46 @@
+// Boost.Geometry (aka GGL, Generic Geometry Library)
+
+// Copyright (c) 2007-2012 Barend Gehrels, Amsterdam, the Netherlands.
+// Copyright (c) 2008-2012 Bruno Lalande, Paris, France.
+// Copyright (c) 2009-2012 Mateusz Loskot, London, UK.
+
+// Parts of Boost.Geometry are redesigned from Geodan's Geographic Library
+// (geolib/GGL), copyright (c) 1995-2010 Geodan, Amsterdam, the Netherlands.
+
+// Use, modification and distribution is subject to the Boost Software License,
+// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+
+#ifndef BOOST_GEOMETRY_EXTENSIONS_BALL_ALGORITHMS_NUM_POINTS_HPP
+#define BOOST_GEOMETRY_EXTENSIONS_BALL_ALGORITHMS_NUM_POINTS_HPP
+
+#include <boost/geometry/algorithms/num_points.hpp>
+
+#include <boost/geometry/extensions/ball/core/tags.hpp>
+
+
+namespace boost { namespace geometry
+{
+
+
+
+#ifndef DOXYGEN_NO_DISPATCH
+namespace dispatch
+{
+
+
+template <typename Geometry>
+struct num_points<ball_tag, Geometry>
+ : detail::num_points::other_count<1>
+{};
+
+
+
+} // namespace dispatch
+#endif
+
+
+}} // namespace boost::geometry
+
+
+#endif // BOOST_GEOMETRY_EXTENSIONS_BALL_ALGORITHMS_NUM_POINTS_HPP

Added: trunk/boost/geometry/extensions/ball/algorithms/within.hpp
==============================================================================
--- (empty file)
+++ trunk/boost/geometry/extensions/ball/algorithms/within.hpp 2013-05-26 19:10:58 EDT (Sun, 26 May 2013)
@@ -0,0 +1,215 @@
+// Boost.Geometry (aka GGL, Generic Geometry Library)
+
+// Copyright (c) 2007-2012 Barend Gehrels, Amsterdam, the Netherlands.
+// Copyright (c) 2008-2012 Bruno Lalande, Paris, France.
+// Copyright (c) 2009-2012 Mateusz Loskot, London, UK.
+
+// Parts of Boost.Geometry are redesigned from Geodan's Geographic Library
+// (geolib/GGL), copyright (c) 1995-2010 Geodan, Amsterdam, the Netherlands.
+
+// Use, modification and distribution is subject to the Boost Software License,
+// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+
+#ifndef BOOST_GEOMETRY_EXTENSIONS_BALL_ALGORITHMS_WITHIN_HPP
+#define BOOST_GEOMETRY_EXTENSIONS_BALL_ALGORITHMS_WITHIN_HPP
+
+
+#include <boost/geometry/algorithms/distance.hpp>
+#include <boost/geometry/algorithms/make.hpp>
+#include <boost/geometry/algorithms/within.hpp>
+#include <boost/geometry/strategies/distance.hpp>
+
+#include <boost/geometry/multi/core/tags.hpp>
+
+#include <boost/geometry/extensions/ball/core/access.hpp>
+#include <boost/geometry/extensions/ball/core/tags.hpp>
+#include <boost/geometry/extensions/ball/algorithms/assign.hpp>
+
+
+namespace boost { namespace geometry
+{
+
+#ifndef DOXYGEN_NO_DETAIL
+namespace detail { namespace within
+{
+
+
+
+//-------------------------------------------------------------------------------------------------------
+// Implementation for n-spheres. Supports circles or spheres, in 2 or 3 dimensions, in Euclidian system
+// Circle center might be of other point-type as geometry
+// Todo: implement as strategy
+//-------------------------------------------------------------------------------------------------------
+template<typename P, typename C>
+inline bool point_in_circle(P const& p, C const& c)
+{
+ namespace services = strategy::distance::services;
+
+ assert_dimension<C, 2>();
+
+ typedef typename point_type<C>::type point_type;
+ typedef typename services::default_strategy
+ <
+ point_tag, P, point_type
+ >::type strategy_type;
+ typedef typename services::return_type<strategy_type>::type return_type;
+
+ strategy_type strategy;
+
+ P const center = geometry::make<P>(get<center_point, 0>(c), get<center_point, 1>(c));
+ return_type const r = geometry::distance(p, center, strategy);
+ return_type const rad = services::result_from_distance
+ <
+ strategy_type
+ >::apply(strategy, get<radius_value, 0>(c));
+
+ return r < rad;
+}
+/// 2D version
+template<typename T, typename C>
+inline bool point_in_circle(T const& c1, T const& c2, C const& c)
+{
+ typedef typename point_type<C>::type point_type;
+
+ point_type p = geometry::make<point_type>(c1, c2);
+ return point_in_circle(p, c);
+}
+
+template<typename B, typename C>
+inline bool box_in_circle(B const& b, C const& c)
+{
+ typedef typename point_type<B>::type point_type;
+
+ // Currently only implemented for 2d geometries
+ assert_dimension<point_type, 2>();
+ assert_dimension<C, 2>();
+
+ // Box: all four points must lie within circle
+
+ // Check points lower-left and upper-right, then lower-right and upper-left
+ return point_in_circle(get<min_corner, 0>(b), get<min_corner, 1>(b), c)
+ && point_in_circle(get<max_corner, 0>(b), get<max_corner, 1>(b), c)
+ && point_in_circle(get<min_corner, 0>(b), get<max_corner, 1>(b), c)
+ && point_in_circle(get<max_corner, 0>(b), get<min_corner, 1>(b), c);
+}
+
+// Generic "range-in-circle", true if all points within circle
+template<typename R, typename C>
+inline bool range_in_circle(R const& range, C const& c)
+{
+ assert_dimension<R, 2>();
+ assert_dimension<C, 2>();
+
+ for (typename boost::range_iterator<R const>::type it = boost::begin(range);
+ it != boost::end(range); ++it)
+ {
+ if (! point_in_circle(*it, c))
+ {
+ return false;
+ }
+ }
+
+ return true;
+}
+
+template<typename Y, typename C>
+inline bool polygon_in_circle(Y const& poly, C const& c)
+{
+ return range_in_circle(exterior_ring(poly), c);
+}
+
+
+
+template<typename I, typename C>
+inline bool multi_polygon_in_circle(I const& m, C const& c)
+{
+ for (typename I::const_iterator i = m.begin(); i != m.end(); i++)
+ {
+ if (! polygon_in_circle(*i, c))
+ {
+ return false;
+ }
+ }
+ return true;
+}
+
+
+
+}} // namespace detail::within
+#endif // DOXYGEN_NO_DETAIL
+
+
+#ifndef DOXYGEN_NO_DISPATCH
+namespace dispatch
+{
+
+
+template <typename P, typename Circle>
+struct within<P, Circle, point_tag, nsphere_tag>
+{
+ template <typename Strategy>
+ static inline bool apply(P const& p, Circle const& c, Strategy const&)
+ {
+ return detail::within::point_in_circle(p, c);
+ }
+};
+
+template <typename Box, typename Circle>
+struct within<Box, Circle, box_tag, nsphere_tag>
+{
+ template <typename Strategy>
+ static inline bool apply(Box const& b, Circle const& c, Strategy const&)
+ {
+ return detail::within::box_in_circle(b, c);
+ }
+};
+
+template <typename Linestring, typename Circle>
+struct within<Linestring, Circle, linestring_tag, nsphere_tag>
+{
+ template <typename Strategy>
+ static inline bool apply(Linestring const& ln, Circle const& c, Strategy const&)
+ {
+ return detail::within::range_in_circle(ln, c);
+ }
+};
+
+template <typename Ring, typename Circle>
+struct within<Ring, Circle, ring_tag, nsphere_tag>
+{
+ template <typename Strategy>
+ static inline bool apply(Ring const& r, Circle const& c, Strategy const&)
+ {
+ return detail::within::range_in_circle(r, c);
+ }
+};
+
+template <typename Polygon, typename Circle>
+struct within<Polygon, Circle, polygon_tag, nsphere_tag>
+{
+ template <typename Strategy>
+ static inline bool apply(Polygon const& poly, Circle const& c, Strategy const&)
+ {
+ return detail::within::polygon_in_circle(poly, c);
+ }
+};
+
+template <typename M, typename C>
+struct within<M, C, multi_polygon_tag, nsphere_tag>
+{
+ template <typename Strategy>
+ static inline bool apply(M const& m, C const& c, Strategy const&)
+ {
+ return detail::within::multi_polygon_in_circle(m, c);
+ }
+};
+
+
+} // namespace dispatch
+#endif // DOXYGEN_NO_DISPATCH
+
+
+}} // namespace boost::geometry
+
+#endif // BOOST_GEOMETRY_EXTENSIONS_BALL_ALGORITHMS_WITHIN_HPP

Added: trunk/boost/geometry/extensions/ball/ball.hpp
==============================================================================
--- (empty file)
+++ trunk/boost/geometry/extensions/ball/ball.hpp 2013-05-26 19:10:58 EDT (Sun, 26 May 2013)
@@ -0,0 +1,37 @@
+// Boost.Geometry (aka GGL, Generic Geometry Library)
+
+// Copyright (c) 2007-2012 Barend Gehrels, Amsterdam, the Netherlands.
+// Copyright (c) 2008-2012 Bruno Lalande, Paris, France.
+// Copyright (c) 2009-2012 Mateusz Loskot, London, UK.
+
+// Parts of Boost.Geometry are redesigned from Geodan's Geographic Library
+// (geolib/GGL), copyright (c) 1995-2010 Geodan, Amsterdam, the Netherlands.
+
+// Use, modification and distribution is subject to the Boost Software License,
+// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+
+#ifndef BOOST_GEOMETRY_EXTENSIONS_BALL_HPP
+#define BOOST_GEOMETRY_EXTENSIONS_BALL_HPP
+
+#include <boost/geometry/extensions/ball/core/access.hpp>
+#include <boost/geometry/extensions/ball/core/geometry_id.hpp>
+#include <boost/geometry/extensions/ball/core/radius_type.hpp>
+#include <boost/geometry/extensions/ball/core/replace_point_type.hpp>
+#include <boost/geometry/extensions/ball/core/tags.hpp>
+#include <boost/geometry/extensions/ball/core/topological_dimension.hpp>
+
+#include <boost/geometry/extensions/ball/geometries/concepts/check.hpp>
+#include <boost/geometry/extensions/ball/geometries/concepts/ball_concept.hpp>
+
+#include <boost/geometry/extensions/ball/geometries/ball.hpp>
+
+#include <boost/geometry/extensions/ball/algorithms/append.hpp>
+#include <boost/geometry/extensions/ball/algorithms/area.hpp>
+#include <boost/geometry/extensions/ball/algorithms/assign.hpp>
+#include <boost/geometry/extensions/ball/algorithms/clear.hpp>
+#include <boost/geometry/extensions/ball/algorithms/envelope.hpp>
+#include <boost/geometry/extensions/ball/algorithms/num_points.hpp>
+#include <boost/geometry/extensions/ball/algorithms/within.hpp>
+
+#endif // BOOST_GEOMETRY_EXTENSIONS_BALL_HPP

Added: trunk/boost/geometry/extensions/ball/core/access.hpp
==============================================================================
--- (empty file)
+++ trunk/boost/geometry/extensions/ball/core/access.hpp 2013-05-26 19:10:58 EDT (Sun, 26 May 2013)
@@ -0,0 +1,96 @@
+// Boost.Geometry (aka GGL, Generic Geometry Library)
+
+// Copyright (c) 2007-2012 Barend Gehrels, Amsterdam, the Netherlands.
+// Copyright (c) 2008-2012 Bruno Lalande, Paris, France.
+// Copyright (c) 2009-2012 Mateusz Loskot, London, UK.
+
+// Parts of Boost.Geometry are redesigned from Geodan's Geographic Library
+// (geolib/GGL), copyright (c) 1995-2010 Geodan, Amsterdam, the Netherlands.
+
+// Use, modification and distribution is subject to the Boost Software License,
+// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+
+#ifndef BOOST_GEOMETRY_EXTENSIONS_BALL_CORE_ACCESS_HPP
+#define BOOST_GEOMETRY_EXTENSIONS_BALL_CORE_ACCESS_HPP
+
+
+
+#include <boost/geometry/core/access.hpp>
+
+#include <boost/geometry/extensions/ball/core/tags.hpp>
+
+
+namespace boost { namespace geometry
+{
+
+int const center_point = 2;
+
+int const radius_value = 3;
+
+#ifndef DOXYGEN_NO_DISPATCH
+namespace core_dispatch
+{
+
+template
+<
+ typename Ball,
+ typename CoordinateType,
+ std::size_t Dimension
+>
+struct indexed_access<ball_tag, Ball, CoordinateType, center_point, Dimension, boost::false_type>
+{
+ static inline CoordinateType get(Ball const& b)
+ {
+ return traits::indexed_access<Ball, center_point, Dimension>::get(b);
+ }
+ static inline void set(Ball& b, CoordinateType const& value)
+ {
+ traits::indexed_access<Ball, center_point, Dimension>::set(b, value);
+ }
+};
+
+
+/*!
+ \brief Traits class to get/set radius of a circle/sphere/(ellipse)
+ \details the radius access meta-functions give read/write access to the radius of a circle or a sphere,
+ or to the major/minor axis or an ellipse, or to one of the 3 equatorial radii of an ellipsoid.
+
+ It should be specialized per geometry, in namespace core_dispatch. Those specializations should
+ forward the call via traits to the geometry class, which could be specified by the user.
+
+ There is a corresponding generic radius_get and radius_set function
+ \par Geometries:
+ - n-sphere (circle,sphere)
+ - upcoming ellipse
+ \par Specializations should provide:
+ - inline static T get(G const& geometry)
+ - inline static void set(G& geometry, T const& radius)
+ \ingroup traits
+*/
+template
+<
+ typename Ball,
+ typename RadiusType,
+ std::size_t Dimension
+>
+struct indexed_access<ball_tag, Ball, RadiusType, radius_value, Dimension, boost::false_type>
+{
+ static inline RadiusType get(Ball const& b)
+ {
+ return traits::indexed_access<Ball, radius_value, Dimension>::get(b);
+ }
+ static inline void set(Ball& b, RadiusType const& value)
+ {
+ traits::indexed_access<Ball, radius_value, Dimension>::set(b, value);
+ }
+};
+
+
+} // namespace core_dispatch
+#endif // DOXYGEN_NO_DISPATCH
+
+
+}} // namespace boost::geometry
+
+#endif // BOOST_GEOMETRY_EXTENSIONS_BALL_CORE_ACCESS_HPP

Added: trunk/boost/geometry/extensions/ball/core/geometry_id.hpp
==============================================================================
--- (empty file)
+++ trunk/boost/geometry/extensions/ball/core/geometry_id.hpp 2013-05-26 19:10:58 EDT (Sun, 26 May 2013)
@@ -0,0 +1,47 @@
+// Boost.Geometry (aka GGL, Generic Geometry Library)
+
+// Copyright (c) 2007-2012 Barend Gehrels, Amsterdam, the Netherlands.
+// Copyright (c) 2008-2012 Bruno Lalande, Paris, France.
+// Copyright (c) 2009-2012 Mateusz Loskot, London, UK.
+
+// Parts of Boost.Geometry are redesigned from Geodan's Geographic Library
+// (geolib/GGL), copyright (c) 1995-2010 Geodan, Amsterdam, the Netherlands.
+
+// Use, modification and distribution is subject to the Boost Software License,
+// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+
+
+#ifndef BOOST_GEOMETRY_EXTENSIONS_BALL_CORE_GEOMETRY_ID_HPP
+#define BOOST_GEOMETRY_EXTENSIONS_BALL_CORE_GEOMETRY_ID_HPP
+
+
+#include <boost/geometry/core/geometry_id.hpp>
+
+#include <boost/geometry/extensions/nsphere/core/tags.hpp>
+
+
+namespace boost { namespace geometry
+{
+
+
+#ifndef DOXYGEN_NO_DISPATCH
+namespace core_dispatch
+{
+
+
+template <>
+struct geometry_id<ball_tag> : boost::mpl::int_<92> {};
+
+
+
+} // namespace core_dispatch
+#endif
+
+
+
+
+}} // namespace boost::geometry
+
+
+#endif // BOOST_GEOMETRY_EXTENSIONS_BALL_CORE_GEOMETRY_ID_HPP

Added: trunk/boost/geometry/extensions/ball/core/radius_type.hpp
==============================================================================
--- (empty file)
+++ trunk/boost/geometry/extensions/ball/core/radius_type.hpp 2013-05-26 19:10:58 EDT (Sun, 26 May 2013)
@@ -0,0 +1,81 @@
+// Boost.Geometry (aka GGL, Generic Geometry Library)
+
+// Copyright (c) 2007-2012 Barend Gehrels, Amsterdam, the Netherlands.
+// Copyright (c) 2008-2012 Bruno Lalande, Paris, France.
+// Copyright (c) 2009-2012 Mateusz Loskot, London, UK.
+
+// Parts of Boost.Geometry are redesigned from Geodan's Geographic Library
+// (geolib/GGL), copyright (c) 1995-2010 Geodan, Amsterdam, the Netherlands.
+
+// Use, modification and distribution is subject to the Boost Software License,
+// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+
+
+#ifndef BOOST_GEOMETRY_EXTENSIONS_BALL_CORE_RADIUS_TYPE_HPP
+#define BOOST_GEOMETRY_EXTENSIONS_BALL_CORE_RADIUS_TYPE_HPP
+
+
+#include <cstddef>
+
+
+#include <boost/type_traits/remove_const.hpp>
+
+#include <boost/geometry/core/tag.hpp>
+
+#include <boost/geometry/extensions/ball/core/tags.hpp>
+
+
+namespace boost { namespace geometry
+{
+
+namespace traits
+{
+
+/*!
+ \brief Traits class indicating the type (double,float,...) of the radius of a circle or a sphere
+ \par Geometries:
+ - n-sphere (circle,sphere)
+ - upcoming ellipse
+ \par Specializations should provide:
+ - typedef T type (double,float,int,etc)
+ \ingroup traits
+*/
+template <typename G>
+struct radius_type {};
+
+} // namespace traits
+
+
+#ifndef DOXYGEN_NO_DISPATCH
+namespace core_dispatch
+{
+
+template <typename Tag, typename G>
+struct radius_type
+{
+ //typedef core_dispatch_specialization_required type;
+};
+
+template <typename S>
+struct radius_type<ball_tag, S>
+{
+ typedef typename traits::radius_type<S>::type type;
+};
+
+} // namespace core_dispatch
+#endif // DOXYGEN_NO_DISPATCH
+
+
+template <typename G>
+struct radius_type
+{
+ typedef typename boost::remove_const<G>::type rconst;
+ typedef typename core_dispatch::radius_type<typename tag<G>::type, rconst>::type type;
+};
+
+
+}} // namespace boost::geometry
+
+
+#endif // BOOST_GEOMETRY_EXTENSIONS_BALL_CORE_RADIUS_TYPE_HPP

Added: trunk/boost/geometry/extensions/ball/core/replace_point_type.hpp
==============================================================================
--- (empty file)
+++ trunk/boost/geometry/extensions/ball/core/replace_point_type.hpp 2013-05-26 19:10:58 EDT (Sun, 26 May 2013)
@@ -0,0 +1,50 @@
+// Boost.Geometry (aka GGL, Generic Geometry Library)
+
+// Copyright (c) 2007-2012 Barend Gehrels, Amsterdam, the Netherlands.
+// Copyright (c) 2008-2012 Bruno Lalande, Paris, France.
+// Copyright (c) 2009-2012 Mateusz Loskot, London, UK.
+
+// Parts of Boost.Geometry are redesigned from Geodan's Geographic Library
+// (geolib/GGL), copyright (c) 1995-2010 Geodan, Amsterdam, the Netherlands.
+
+// Use, modification and distribution is subject to the Boost Software License,
+// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+
+
+#ifndef BOOST_GEOMETRY_EXTENSIONS_BALL_CORE_REPLACE_POINT_TYPE_HPP
+#define BOOST_GEOMETRY_EXTENSIONS_BALL_CORE_REPLACE_POINT_TYPE_HPP
+
+
+#include <boost/geometry/extensions/ball/core/tags.hpp>
+#include <boost/geometry/extensions/ball/geometries/ball.hpp>
+#include <boost/geometry/extensions/util/replace_point_type.hpp>
+
+
+namespace boost { namespace geometry
+{
+
+#ifndef DOXYGEN_NO_DISPATCH
+namespace core_dispatch
+{
+
+
+template <typename Geometry, typename NewPointType>
+struct replace_point_type<ball_tag, Geometry, NewPointType>
+{
+ // WARNING!
+ // shouldn't radius_type be used instead of coordinate_type for radius?
+
+ typedef typename geometry::coordinate_type<Geometry>::type coortype;
+ typedef model::ball<NewPointType, coortype> type;
+};
+
+
+} // namespace core_dispatch
+#endif // DOXYGEN_NO_DISPATCH
+
+
+
+}} // namespace boost::geometry
+
+#endif // BOOST_GEOMETRY_EXTENSIONS_BALL_CORE_REPLACE_POINT_TYPE_HPP

Added: trunk/boost/geometry/extensions/ball/core/tags.hpp
==============================================================================
--- (empty file)
+++ trunk/boost/geometry/extensions/ball/core/tags.hpp 2013-05-26 19:10:58 EDT (Sun, 26 May 2013)
@@ -0,0 +1,29 @@
+// Boost.Geometry (aka GGL, Generic Geometry Library)
+
+// Copyright (c) 2007-2012 Barend Gehrels, Amsterdam, the Netherlands.
+// Copyright (c) 2008-2012 Bruno Lalande, Paris, France.
+// Copyright (c) 2009-2012 Mateusz Loskot, London, UK.
+
+// Parts of Boost.Geometry are redesigned from Geodan's Geographic Library
+// (geolib/GGL), copyright (c) 1995-2010 Geodan, Amsterdam, the Netherlands.
+
+// Use, modification and distribution is subject to the Boost Software License,
+// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+
+#ifndef BOOST_GEOMETRY_EXTENSIONS_BALL_CORE_TAGS_HPP
+#define BOOST_GEOMETRY_EXTENSIONS_BALL_CORE_TAGS_HPP
+
+
+namespace boost { namespace geometry
+{
+
+
+/// Convenience 2D (circle) or 3D (sphere) - ball/n-sphere identifying tag
+struct ball_tag {};
+
+
+
+}} // namespace boost::geometry
+
+#endif // BOOST_GEOMETRY_EXTENSIONS_BALL_CORE_TAGS_HPP

Added: trunk/boost/geometry/extensions/ball/core/topological_dimension.hpp
==============================================================================
--- (empty file)
+++ trunk/boost/geometry/extensions/ball/core/topological_dimension.hpp 2013-05-26 19:10:58 EDT (Sun, 26 May 2013)
@@ -0,0 +1,50 @@
+// Boost.Geometry (aka GGL, Generic Geometry Library)
+
+// Copyright (c) 2007-2012 Barend Gehrels, Amsterdam, the Netherlands.
+// Copyright (c) 2008-2012 Bruno Lalande, Paris, France.
+// Copyright (c) 2009-2012 Mateusz Loskot, London, UK.
+
+// Parts of Boost.Geometry are redesigned from Geodan's Geographic Library
+// (geolib/GGL), copyright (c) 1995-2010 Geodan, Amsterdam, the Netherlands.
+
+// Use, modification and distribution is subject to the Boost Software License,
+// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+
+
+#ifndef BOOST_GEOMETRY_EXTENSIONS_BALL_CORE_TOPOLOGICAL_DIMENSION_HPP
+#define BOOST_GEOMETRY_EXTENSIONS_BALL_CORE_TOPOLOGICAL_DIMENSION_HPP
+
+
+#include <boost/geometry/core/topological_dimension.hpp>
+
+#include <boost/geometry/extensions/nsphere/core/tags.hpp>
+
+
+namespace boost { namespace geometry
+{
+
+
+#ifndef DOXYGEN_NO_DISPATCH
+namespace core_dispatch
+{
+
+
+
+// ball: 2, but there is discussion. Is it CLOSED? Then 2, but
+// then it should be called "disk"...
+template <>
+struct top_dim<ball_tag> : boost::mpl::int_<2> {};
+
+
+
+
+} // namespace core_dispatch
+#endif
+
+
+
+}} // namespace boost::geometry
+
+
+#endif // BOOST_GEOMETRY_EXTENSIONS_BALL_CORE_TOPOLOGICAL_DIMENSION_HPP

Added: trunk/boost/geometry/extensions/ball/geometries/ball.hpp
==============================================================================
--- (empty file)
+++ trunk/boost/geometry/extensions/ball/geometries/ball.hpp 2013-05-26 19:10:58 EDT (Sun, 26 May 2013)
@@ -0,0 +1,146 @@
+// Boost.Geometry (aka GGL, Generic Geometry Library)
+
+// Copyright (c) 2007-2012 Barend Gehrels, Amsterdam, the Netherlands.
+// Copyright (c) 2008-2012 Bruno Lalande, Paris, France.
+// Copyright (c) 2009-2012 Mateusz Loskot, London, UK.
+
+// Parts of Boost.Geometry are redesigned from Geodan's Geographic Library
+// (geolib/GGL), copyright (c) 1995-2010 Geodan, Amsterdam, the Netherlands.
+
+// Use, modification and distribution is subject to the Boost Software License,
+// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+
+#ifndef BOOST_GEOMETRY_EXTENSIONS_BALL_GEOMETRIES_BALL_HPP
+#define BOOST_GEOMETRY_EXTENSIONS_BALL_GEOMETRIES_BALL_HPP
+
+#include <cstddef>
+
+#include <boost/geometry/algorithms/assign.hpp>
+#include <boost/geometry/algorithms/convert.hpp>
+#include <boost/geometry/geometries/concepts/point_concept.hpp>
+
+
+#include <boost/geometry/extensions/ball/core/tags.hpp>
+#include <boost/geometry/extensions/ball/algorithms/assign.hpp>
+#include <boost/geometry/extensions/ball/geometries/concepts/ball_concept.hpp>
+
+namespace boost { namespace geometry
+{
+
+namespace model
+{
+
+
+/*!
+ \brief Class nsphere: defines a circle or a sphere: a point with radius
+ \ingroup Geometry
+ \details It can be a circle (2D), a sphere (3D), or higher (hypersphere) or lower.
+ According to Wikipedia this name is the most appropriate. It was mentioned on the Boost list.
+ An alternative is the more fancy name "sphercle" but that might be a bit too much an invention.
+ \note Circle is currently used for selections, for example polygon_in_circle. Currently not all
+ algorithms are implemented for n-spheres.
+ \tparam P point type of the center
+ \tparam T number type of the radius
+ */
+template <typename P,
+ typename R = typename traits::coordinate_type<P>::type>
+class ball
+{
+ BOOST_CONCEPT_ASSERT( (concept::Point<P>) );
+
+public:
+
+ typedef R radius_type;
+ typedef typename coordinate_type<P>::type coordinate_type;
+
+ ball()
+ : m_radius(0)
+ {
+ assign_value(m_center, coordinate_type());
+ }
+
+ ball(P const& center, R const& radius)
+ : m_radius(radius)
+ {
+ geometry::convert(center, m_center);
+ }
+
+ inline P const& center() const { return m_center; }
+ inline R const& radius() const { return m_radius; }
+
+ inline P& center() { return m_center; }
+ inline R& radius() { return m_radius; }
+
+private:
+
+ P m_center;
+ R m_radius;
+};
+
+
+} // namespace model
+
+// Traits specializations for n-sphere above
+#ifndef DOXYGEN_NO_TRAITS_SPECIALIZATIONS
+namespace traits
+{
+
+template <typename Point, typename RadiusType>
+struct tag<model::ball<Point, RadiusType> >
+{
+ typedef ball_tag type;
+};
+
+template <typename Point, typename RadiusType>
+struct point_type<model::ball<Point, RadiusType> >
+{
+ typedef Point type;
+};
+
+template <typename Point, typename RadiusType>
+struct radius_type<model::ball<Point, RadiusType> >
+{
+ typedef RadiusType type;
+};
+
+template <typename Point, typename Radius, std::size_t Dimension>
+struct indexed_access<model::ball<Point, Radius>, center_point, Dimension>
+{
+ typedef typename geometry::coordinate_type<Point>::type coordinate_type;
+ typedef coordinate_type type;
+
+ static inline coordinate_type get(model::ball<Point, Radius> const& b)
+ {
+ return geometry::get<Dimension>(b.center());
+ }
+
+ static inline void set(model::ball<Point, Radius>& b, coordinate_type const& value)
+ {
+ geometry::set<Dimension>(b.center(), value);
+ }
+};
+
+template <typename Point, typename Radius, std::size_t Dimension>
+struct indexed_access<model::ball<Point, Radius>, radius_value, Dimension>
+{
+ typedef Radius radius_type;
+ typedef radius_type type;
+
+ static inline radius_type get(model::ball<Point, Radius> const& b)
+ {
+ return b.radius();
+ }
+
+ static inline void set(model::ball<Point, Radius>& b, radius_type const& value)
+ {
+ b.radius() = value;
+ }
+};
+
+} // namespace traits
+#endif // DOXYGEN_NO_TRAITS_SPECIALIZATIONS
+
+}} // namespace boost::geometry
+
+#endif // BOOST_GEOMETRY_EXTENSIONS_BALL_GEOMETRIES_BALL_HPP

Added: trunk/boost/geometry/extensions/ball/geometries/concepts/ball_concept.hpp
==============================================================================
--- (empty file)
+++ trunk/boost/geometry/extensions/ball/geometries/concepts/ball_concept.hpp 2013-05-26 19:10:58 EDT (Sun, 26 May 2013)
@@ -0,0 +1,121 @@
+// Boost.Geometry (aka GGL, Generic Geometry Library)
+
+// Copyright (c) 2007-2012 Barend Gehrels, Amsterdam, the Netherlands.
+// Copyright (c) 2008-2012 Bruno Lalande, Paris, France.
+// Copyright (c) 2009-2012 Mateusz Loskot, London, UK.
+
+// Parts of Boost.Geometry are redesigned from Geodan's Geographic Library
+// (geolib/GGL), copyright (c) 1995-2010 Geodan, Amsterdam, the Netherlands.
+
+// Use, modification and distribution is subject to the Boost Software License,
+// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+
+#ifndef BOOST_GEOMETRY_EXTENSIONS_BALL_GEOMETRIES_CONCEPTS_BALL_CONCEPT_HPP
+#define BOOST_GEOMETRY_EXTENSIONS_BALL_GEOMETRIES_CONCEPTS_BALL_CONCEPT_HPP
+
+#include <boost/concept_check.hpp>
+
+#include <boost/geometry/core/coordinate_dimension.hpp>
+#include <boost/geometry/core/access.hpp>
+#include <boost/geometry/core/point_type.hpp>
+
+namespace boost { namespace geometry { namespace concept {
+
+/*!
+ \brief Checks Ball concept (const version)
+ \ingroup concepts
+ \details The ConstBall concept check the same as the Ball concept,
+ but does not check write access.
+*/
+template <typename Geometry>
+class ConstBall
+{
+ typedef typename point_type<Geometry>::type point_type;
+ typedef typename radius_type<Geometry>::type radius_type;
+
+
+ template <size_t Dimension, size_t DimensionCount>
+ struct dimension_checker
+ {
+ static void apply()
+ {
+ typedef typename coordinate_type<Geometry>::type coordinate_type;
+ const Geometry* s = 0;
+ coordinate_type coord(geometry::get<center_point, Dimension>(*s));
+ boost::ignore_unused_variable_warning(coord);
+ dimension_checker<Dimension + 1, DimensionCount>::apply();
+ }
+ };
+
+ template <size_t DimensionCount>
+ struct dimension_checker<DimensionCount, DimensionCount>
+ {
+ static void apply() {}
+ };
+
+public :
+
+ BOOST_CONCEPT_USAGE(ConstBall)
+ {
+ static const size_t n = dimension<Geometry>::value;
+ dimension_checker<0, n>::apply();
+ dimension_checker<0, n>::apply();
+
+ // Check radius access
+ Geometry const* s = 0;
+ radius_type coord(geometry::get<radius_value, 0>(*s));
+ boost::ignore_unused_variable_warning(coord);
+ }
+};
+
+
+/*!
+ \brief Checks Ball concept
+ \ingroup concepts
+*/
+template <typename Geometry>
+class Ball
+{
+ BOOST_CONCEPT_ASSERT( (concept::ConstBall<Geometry>) );
+
+ typedef typename point_type<Geometry>::type point_type;
+ typedef typename radius_type<Geometry>::type radius_type;
+
+
+ template <size_t Dimension, size_t DimensionCount>
+ struct dimension_checker
+ {
+ static void apply()
+ {
+ Geometry* s;
+ geometry::set<center_point, Dimension>(*s, geometry::get<center_point, Dimension>(*s));
+ dimension_checker<Dimension + 1, DimensionCount>::apply();
+ }
+ };
+
+ template <size_t DimensionCount>
+ struct dimension_checker<DimensionCount, DimensionCount>
+ {
+ static void apply() {}
+ };
+
+public :
+
+ BOOST_CONCEPT_USAGE(Ball)
+ {
+ static const size_t n = dimension<Geometry>::type::value;
+ dimension_checker<0, n>::apply();
+ dimension_checker<0, n>::apply();
+
+ // Check radius access
+ Geometry* s = 0;
+ geometry::set<radius_value, 0>(*s, geometry::get<radius_value, 0>(*s));
+ }
+};
+
+
+
+}}} // namespace boost::geometry::concept
+
+#endif // BOOST_GEOMETRY_EXTENSIONS_BALL_GEOMETRIES_CONCEPTS_BALL_CONCEPT_HPP

Added: trunk/boost/geometry/extensions/ball/geometries/concepts/check.hpp
==============================================================================
--- (empty file)
+++ trunk/boost/geometry/extensions/ball/geometries/concepts/check.hpp 2013-05-26 19:10:58 EDT (Sun, 26 May 2013)
@@ -0,0 +1,49 @@
+// Boost.Geometry (aka GGL, Generic Geometry Library)
+
+// Copyright (c) 2007-2012 Barend Gehrels, Amsterdam, the Netherlands.
+// Copyright (c) 2008-2012 Bruno Lalande, Paris, France.
+// Copyright (c) 2009-2012 Mateusz Loskot, London, UK.
+
+// Parts of Boost.Geometry are redesigned from Geodan's Geographic Library
+// (geolib/GGL), copyright (c) 1995-2010 Geodan, Amsterdam, the Netherlands.
+
+// Use, modification and distribution is subject to the Boost Software License,
+// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+
+
+#ifndef BOOST_GEOMETRY_EXTENSIONS_BALL_GEOMETRIES_CONCEPTS_CHECK_HPP
+#define BOOST_GEOMETRY_EXTENSIONS_BALL_GEOMETRIES_CONCEPTS_CHECK_HPP
+
+
+#include <boost/geometry/geometries/concepts/check.hpp>
+
+
+namespace boost { namespace geometry
+{
+
+
+#ifndef DOXYGEN_NO_DISPATCH
+namespace dispatch
+{
+
+template <typename Geometry>
+struct check<Geometry, ball_tag, true>
+ : detail::concept_check::check<concept::ConstBall<Geometry> >
+{};
+
+template <typename Geometry>
+struct check<Geometry, ball_tag, false>
+ : detail::concept_check::check<concept::Ball<Geometry> >
+{};
+
+} // namespace dispatch
+#endif
+
+
+
+
+}} // namespace boost::geometry
+
+
+#endif // BOOST_GEOMETRY_EXTENSIONS_BALL_GEOMETRIES_CONCEPTS_CHECK_HPP

Modified: trunk/boost/geometry/extensions/nsphere/algorithms/num_points.hpp
==============================================================================
--- trunk/boost/geometry/extensions/nsphere/algorithms/num_points.hpp (original)
+++ trunk/boost/geometry/extensions/nsphere/algorithms/num_points.hpp 2013-05-26 19:10:58 EDT (Sun, 26 May 2013)
@@ -31,7 +31,7 @@
 
 template <typename Geometry>
 struct num_points<nsphere_tag, Geometry>
- : detail::num_points::other_count<Geometry, 1>
+ : detail::num_points::other_count<1>
 {};
 
 


Boost-Commit list run by bdawes at acm.org, david.abrahams at rcn.com, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk