$include_dir="/home/hyper-archives/boost-commit/include"; include("$include_dir/msg-header.inc") ?>
Subject: [Boost-commit] svn:boost r65082 - sandbox/geometry/boost/geometry/algorithms
From: barend.gehrels_at_[hidden]
Date: 2010-08-28 10:26:47
Author: barendgehrels
Date: 2010-08-28 10:26:45 EDT (Sat, 28 Aug 2010)
New Revision: 65082
URL: http://svn.boost.org/trac/boost/changeset/65082
Log:
Added disjoint option for segment/segment and linestring/linestring
Text files modified: 
   sandbox/geometry/boost/geometry/algorithms/disjoint.hpp |    69 ++++++++++++++++++++++++++++++++++----- 
   1 files changed, 59 insertions(+), 10 deletions(-)
Modified: sandbox/geometry/boost/geometry/algorithms/disjoint.hpp
==============================================================================
--- sandbox/geometry/boost/geometry/algorithms/disjoint.hpp	(original)
+++ sandbox/geometry/boost/geometry/algorithms/disjoint.hpp	2010-08-28 10:26:45 EDT (Sat, 28 Aug 2010)
@@ -40,9 +40,8 @@
 namespace detail { namespace disjoint
 {
 
-
 template <typename Geometry1, typename Geometry2>
-struct general
+struct disjoint_linear
 {
     static inline bool apply(Geometry1 const& geometry1, Geometry2 const& geometry2)
     {
@@ -62,6 +61,46 @@
             return false;
         }
 
+        return true;
+    }
+};
+
+template <typename Segment1, typename Segment2>
+struct disjoint_segment
+{
+    static inline bool apply(Segment1 const& segment1, Segment2 const& segment2)
+    {
+        typedef typename point_type<Segment1>::type point_type;
+
+        segment_intersection_points<point_type> is
+            = strategy::intersection::relate_cartesian_segments
+            <
+                policies::relate::segments_intersection_points
+                    <
+                        Segment1,
+                        Segment2,
+                        segment_intersection_points<point_type>
+                    >
+            >::apply(segment1, segment2);
+
+        return is.count == 0;
+    }
+};
+
+
+
+template <typename Geometry1, typename Geometry2>
+struct general_areal
+{
+    static inline bool apply(Geometry1 const& geometry1, Geometry2 const& geometry2)
+    {
+        if (! disjoint_linear<Geometry1, Geometry2>::apply(geometry1, geometry2))
+        {
+            return false;
+        }
+
+        typedef typename geometry::point_type<Geometry1>::type point_type;
+
         // If there is no intersection of segments, they might located
         // inside each other
         point_type p1;
@@ -100,7 +139,7 @@
     std::size_t DimensionCount
 >
 struct disjoint
-    : detail::disjoint::general<Geometry1, Geometry2>
+    : detail::disjoint::general_areal<Geometry1, Geometry2>
 {};
 
 
@@ -121,6 +160,16 @@
     : detail::disjoint::point_box<Point, Box, 0, DimensionCount>
 {};
 
+template <typename Linestring1, typename Linestring2>
+struct disjoint<linestring_tag, linestring_tag, Linestring1, Linestring2, false, false, 2>
+    : detail::disjoint::disjoint_linear<Linestring1, Linestring2>
+{};
+
+template <typename Linestring1, typename Linestring2>
+struct disjoint<segment_tag, segment_tag, Linestring1, Linestring2, false, false, 2>
+    : detail::disjoint::disjoint_segment<Linestring1, Linestring2>
+{};
+
 
 template
 <
@@ -150,13 +199,13 @@
 
 
 /*!
-    \brief Calculate if two geometries are disjoint
-    \ingroup disjoint
-    \tparam Geometry1 first geometry type
-    \tparam Geometry2 second geometry type
-    \param geometry1 first geometry
-    \param geometry2 second geometry
-    \return true if disjoint, else false
+\brief \brief_check2{are disjoint}
+\ingroup disjoint
+\tparam Geometry1 \tparam_geometry
+\tparam Geometry2 \tparam_geometry
+\param geometry1 \param_geometry
+\param geometry2 \param_geometry
+\return \return_check2{are disjoint}
  */
 template <typename Geometry1, typename Geometry2>
 inline bool disjoint(Geometry1 const& geometry1,