[Git][debian-gis-team/sfcgal][upstream] New upstream version 1.3.9

Bas Couwenberg gitlab at salsa.debian.org
Thu Oct 1 16:23:57 BST 2020



Bas Couwenberg pushed to branch upstream at Debian GIS Project / sfcgal


Commits:
a67dbdc1 by Bas Couwenberg at 2020-10-01T15:46:03+02:00
New upstream version 1.3.9
- - - - -


6 changed files:

- + .gitlab-ci.yml
- − .travis.yml
- CGAL_patches/CGAL/intersection_of_Polyhedra_3.h
- + ci/centos/before_install.sh
- travis/linux/before_install.sh → ci/debian/before_install.sh
- test/unit/SFCGAL/algorithm/StraightSkeletonTest.cpp


Changes:

=====================================
.gitlab-ci.yml
=====================================
@@ -0,0 +1,73 @@
+debian_testing_gcc:
+  image: debian:testing
+
+  script:
+    - apt-get update -qq
+    - apt-get install --yes sudo wget build-essential
+    - ./ci/debian/before_install.sh 5.0.2
+    - cd $CI_PROJECT_DIR
+    - CGAL_DIR=$CI_PROJECT_DIR/CGAL cmake -DSFCGAL_BUILD_TESTS=ON -DCMAKE_C_COMPILER=/usr/bin/gcc -DCMAKE_CXX_COMPILER=/usr/bin/g++
+    - make
+    - ctest -VV
+
+debian_buster_gcc:
+  image: debian:buster
+
+  script:
+    - apt-get update -qq
+    - apt-get install --yes sudo wget build-essential
+    - ./ci/debian/before_install.sh 5.0.2
+    - cd $CI_PROJECT_DIR
+    - CGAL_DIR=$CI_PROJECT_DIR/CGAL cmake -DSFCGAL_BUILD_TESTS=ON -DCMAKE_C_COMPILER=/usr/bin/gcc -DCMAKE_CXX_COMPILER=/usr/bin/g++
+    - make
+    - ctest -VV
+
+debian_testing_clang:
+  image: debian:testing
+
+  script:
+    - apt-get update -qq
+    - apt-get install --yes sudo wget clang
+    - ./ci/debian/before_install.sh 5.0.2
+    - cd $CI_PROJECT_DIR
+    - CGAL_DIR=$CI_PROJECT_DIR/CGAL cmake -DSFCGAL_BUILD_TESTS=ON -DCMAKE_C_COMPILER=/usr/bin/clang -DCMAKE_CXX_COMPILER=/usr/bin/clang++
+    - make
+    - ctest -VV
+
+debian_buster_clang:
+  image: debian:buster
+
+  script:
+    - apt-get update -qq
+    - apt-get install --yes sudo wget clang
+    - ./ci/debian/before_install.sh 5.0.2
+    - cd $CI_PROJECT_DIR
+    - CGAL_DIR=$CI_PROJECT_DIR/CGAL cmake -DSFCGAL_BUILD_TESTS=ON -DCMAKE_C_COMPILER=/usr/bin/clang -DCMAKE_CXX_COMPILER=/usr/bin/clang++
+    - make
+    - ctest -VV
+
+centos8_clang:
+  image: centos:centos8
+  
+  script:
+    - yum update -qy
+    - yum install -y sudo wget clang
+    - ./ci/centos/before_install.sh 5.0.2
+    - cd $CI_PROJECT_DIR
+    - ls
+    - find / -name "*CGAL*"
+    - cmake -DSFCGAL_BUILD_TESTS=ON -DCMAKE_C_COMPILER=/usr/bin/clang -DCMAKE_CXX_COMPILER=/usr/bin/clang++ -DCGAL_DIR=$CI_PROJECT_DIR/CGAL-5.0.2
+    - make
+    - ctest -VV
+
+centos8_gcc:
+  image: centos:centos8
+  
+  script:
+    - yum update -qy
+    - yum install -y sudo wget gcc-c++
+    - ./ci/centos/before_install.sh 5.0.2
+    - cd $CI_PROJECT_DIR
+    - cmake -DSFCGAL_BUILD_TESTS=ON -DCMAKE_C_COMPILER=/usr/bin/gcc -DCMAKE_CXX_COMPILER=/usr/bin/g++ -DCGAL_DIR=$CI_PROJECT_DIR/CGAL-5.0.2
+    - make
+    - ctest -VV


=====================================
.travis.yml deleted
=====================================
@@ -1,24 +0,0 @@
-language: cpp 
-dist: xenial 
-sudo: required 
-
-# os:
-#  - linux
-#  - osx
-
-compiler:
-  # - gcc
-  - clang
-
-env:
-  - CGAL_VERSION=5.0.2
-
-before_install:
-  - ./travis/${TRAVIS_OS_NAME}/before_install.sh $CGAL_VERSION
-
-before_script:
-  - CGAL_DIR=/usr/local/lib/CGAL cmake -DSFCGAL_BUILD_TESTS=ON
-
-script:
-  - make
-  - ctest -VV


=====================================
CGAL_patches/CGAL/intersection_of_Polyhedra_3.h
=====================================
@@ -94,6 +94,169 @@ namespace CGAL{
 //
 // -- Sebastien Loriot, 2010/04/07
 
+// hardcopy of the class from CGAL 5.0 that is no longer present in 5.1
+namespace SFCGAL{
+
+template <class TM,//TriangleMesh
+          class Kernel,
+          class Box,
+          class OutputIterator,
+          class VertexPointMap>
+struct Intersect_facets
+{
+  // wrapper to check whether anything is inserted to output iterator
+  struct Output_iterator_with_bool
+  {
+    Output_iterator_with_bool(OutputIterator* out, bool* intersected)
+      : m_iterator(out), m_intersected(intersected) { }
+
+    template<class T>
+    void operator()(const T& t) {
+      *m_intersected = true;
+      *(*m_iterator)++ = t;
+    }
+
+    OutputIterator* m_iterator;
+    bool* m_intersected;
+  };
+// typedefs
+  typedef typename Kernel::Segment_3    Segment;
+  typedef typename Kernel::Triangle_3   Triangle;
+  typedef typename boost::graph_traits<TM>::halfedge_descriptor halfedge_descriptor;
+  typedef typename boost::property_map<TM, boost::vertex_point_t>::const_type Ppmap;
+
+// members
+  const TM& m_tmesh;
+  const VertexPointMap m_vpmap;
+  mutable OutputIterator  m_iterator;
+  mutable bool            m_intersected;
+  mutable boost::function_output_iterator<Output_iterator_with_bool> m_iterator_wrapper;
+
+  typename Kernel::Construct_segment_3  segment_functor;
+  typename Kernel::Construct_triangle_3 triangle_functor;
+  typename Kernel::Do_intersect_3       do_intersect_3_functor;
+
+
+  Intersect_facets(const TM& tmesh, OutputIterator it, VertexPointMap vpmap, const Kernel& kernel)
+    :
+    m_tmesh(tmesh),
+    m_vpmap(vpmap),
+    m_iterator(it),
+    m_intersected(false),
+    m_iterator_wrapper(Output_iterator_with_bool(&m_iterator, &m_intersected)),
+    segment_functor(kernel.construct_segment_3_object()),
+    triangle_functor(kernel.construct_triangle_3_object()),
+    do_intersect_3_functor(kernel.do_intersect_3_object())
+  { }
+
+  void operator()(const Box* b, const Box* c) const
+  {
+    halfedge_descriptor h = halfedge(b->info(), m_tmesh);
+    halfedge_descriptor opp_h;
+
+    // check for shared egde
+    for(unsigned int i=0; i<3; ++i){
+      opp_h = opposite(h, m_tmesh);
+      if(face(opp_h, m_tmesh) == c->info()){
+        // there is an intersection if the four points are coplanar and
+        // the triangles overlap
+        if(CGAL::coplanar(get(m_vpmap, target(h, m_tmesh)),
+                          get(m_vpmap, target(next(h, m_tmesh), m_tmesh)),
+                          get(m_vpmap, source(h, m_tmesh)),
+                          get(m_vpmap, target(next(opp_h, m_tmesh), m_tmesh))) &&
+           CGAL::coplanar_orientation(get(m_vpmap, source(h, m_tmesh)),
+                                      get(m_vpmap, target(h, m_tmesh)),
+                                      get(m_vpmap, target(next(h, m_tmesh), m_tmesh)),
+                                      get(m_vpmap, target(next(opp_h, m_tmesh), m_tmesh)))
+             == CGAL::POSITIVE){
+          *m_iterator_wrapper++ = std::make_pair(b->info(), c->info());
+          return;
+        } else { // there is a shared edge but no intersection
+          return;
+        }
+      }
+      h = next(h, m_tmesh);
+    }
+
+    // check for shared vertex --> maybe intersection, maybe not
+    halfedge_descriptor g = halfedge(c->info(),m_tmesh);
+    halfedge_descriptor v;
+
+    if(target(h,m_tmesh) == target(g,m_tmesh))
+      v = g;
+    if(target(h,m_tmesh) == target(next(g,m_tmesh),m_tmesh))
+      v = next(g,m_tmesh);
+    if(target(h,m_tmesh) == target(next(next(g,m_tmesh),m_tmesh),m_tmesh))
+      v = next(next(g,m_tmesh),m_tmesh);
+
+    if(v == halfedge_descriptor()){
+      h = next(h,m_tmesh);
+      if(target(h,m_tmesh) == target(g,m_tmesh))
+        v = g;
+      if(target(h,m_tmesh) == target(next(g,m_tmesh),m_tmesh))
+        v = next(g,m_tmesh);
+      if(target(h,m_tmesh) == target(next(next(g,m_tmesh),m_tmesh),m_tmesh))
+        v = next(next(g,m_tmesh),m_tmesh);
+      if(v == halfedge_descriptor()){
+        h = next(h,m_tmesh);
+        if(target(h,m_tmesh) == target(g,m_tmesh))
+          v = g;
+        if(target(h,m_tmesh) == target(next(g,m_tmesh),m_tmesh))
+          v = next(g,m_tmesh);
+        if(target(h,m_tmesh) == target(next(next(g,m_tmesh),m_tmesh),m_tmesh))
+          v = next(next(g,m_tmesh),m_tmesh);
+      }
+    }
+
+    if(v != halfedge_descriptor()){
+      // found shared vertex:
+      CGAL_assertion(target(h,m_tmesh) == target(v,m_tmesh));
+      // geometric check if the opposite segments intersect the triangles
+      Triangle t1 = triangle_functor( get(m_vpmap,target(h,m_tmesh)),
+                                      get(m_vpmap, target(next(h,m_tmesh),m_tmesh)),
+                                      get(m_vpmap, target(next(next(h,m_tmesh),m_tmesh),m_tmesh)));
+      Triangle t2 = triangle_functor( get(m_vpmap, target(v,m_tmesh)),
+                                      get(m_vpmap, target(next(v,m_tmesh),m_tmesh)),
+                                      get(m_vpmap, target(next(next(v,m_tmesh),m_tmesh),m_tmesh)));
+
+      Segment s1 = segment_functor( get(m_vpmap, target(next(h,m_tmesh),m_tmesh)),
+                                    get(m_vpmap, target(next(next(h,m_tmesh),m_tmesh),m_tmesh)));
+      Segment s2 = segment_functor( get(m_vpmap, target(next(v,m_tmesh),m_tmesh)),
+                                    get(m_vpmap, target(next(next(v,m_tmesh),m_tmesh),m_tmesh)));
+
+      if(do_intersect_3_functor(t1,s2)){
+        *m_iterator_wrapper++ = std::make_pair(b->info(), c->info());
+      } else if(do_intersect_3_functor(t2,s1)){
+        *m_iterator_wrapper++ = std::make_pair(b->info(), c->info());
+      }
+      return;
+    }
+
+    // check for geometric intersection
+    Triangle t1 = triangle_functor( get(m_vpmap, target(h,m_tmesh)),
+                                    get(m_vpmap, target(next(h,m_tmesh),m_tmesh)),
+                                    get(m_vpmap, target(next(next(h,m_tmesh),m_tmesh),m_tmesh)));
+    Triangle t2 = triangle_functor( get(m_vpmap, target(g,m_tmesh)),
+                                    get(m_vpmap, target(next(g,m_tmesh),m_tmesh)),
+                                    get(m_vpmap, target(next(next(g,m_tmesh),m_tmesh),m_tmesh)));
+    if(do_intersect_3_functor(t1, t2)){
+      *m_iterator_wrapper++ = std::make_pair(b->info(), c->info());
+    }
+  } // end operator ()
+}; // end struct Intersect_facets
+
+struct Throw_at_output {
+  class Throw_at_output_exception: public std::exception
+  { };
+
+  template<class T>
+  void operator()(const T& /* t */) const {
+    throw Throw_at_output_exception();
+  }
+};
+
+} // SFCGAL namespace
+
 template <class Polyhedron>
 struct Default_polyhedron_ppmap{
   typedef typename Polyhedron::Point_3 value_type;
@@ -1058,17 +1221,17 @@ class Intersection_of_Polyhedra_3{
           box_ptr.push_back(&*b);
 
         // compute self-intersections filtered out by boxes
-        typedef boost::function_output_iterator<internal::Throw_at_output> OutputIterator;
+        typedef boost::function_output_iterator<SFCGAL::Throw_at_output> OutputIterator;
         OutputIterator out;
-        internal::Intersect_facets<Polyhedron,Kernel,
-                                   Box,OutputIterator,
-                                   PolyhedronPointPMap>
+        SFCGAL::Intersect_facets<Polyhedron,Kernel,
+                                 Box,OutputIterator,
+                                 PolyhedronPointPMap>
           intersect_facets(polyhedron_triangle, out, ppmap, Kernel());
         std::ptrdiff_t cutoff = 2000;
         CGAL::box_self_intersection_d(box_ptr.begin(), box_ptr.end(),intersect_facets,cutoff);
         return false;
       }
-      catch( internal::Throw_at_output::Throw_at_output_exception& )
+      catch( SFCGAL::Throw_at_output::Throw_at_output_exception& )
       {
         return true;
       }


=====================================
ci/centos/before_install.sh
=====================================
@@ -0,0 +1,10 @@
+sudo yum update -qy
+sudo yum install -y \
+    cmake boost boost-devel gmp gmp-c++ gmp-devel mpfr mpfr-devel make
+
+#CGAL
+wget https://github.com/CGAL/cgal/releases/download/releases/CGAL-"$1"/CGAL-"$1".tar.xz
+tar xJf CGAL-"$1".tar.xz
+cd CGAL-"$1" && mkdir build && cd build && cmake -DCMAKE_INSTALL_PREFIX=$CI_PROJECT_DIR/CGAL .. && make && make install && cd ../..
+
+cmake --version


=====================================
travis/linux/before_install.sh → ci/debian/before_install.sh
=====================================
@@ -1,16 +1,15 @@
 export DEBIAN_FRONTEND=noninteractive
 sudo apt-get update -qq
-sudo apt-get install --force-yes \
-    cmake libboost-chrono1.58-dev libboost-program-options1.58-dev libboost-filesystem1.58-dev libboost-timer1.58-dev \
-    libboost-test1.58-dev libboost-thread1.58-dev \
-    libboost-system1.58-dev libboost-serialization1.58-dev \
+sudo apt-get install --yes \
+    cmake libboost-chrono-dev libboost-program-options-dev libboost-filesystem-dev libboost-timer-dev \
+    libboost-test-dev libboost-thread-dev \
+    libboost-system-dev libboost-serialization-dev \
     libmpfr-dev libgmp-dev \
     cmake
 #CGAL
 
 wget https://github.com/CGAL/cgal/releases/download/releases/CGAL-"$1"/CGAL-"$1".tar.xz
 tar xJf CGAL-"$1".tar.xz
-cd CGAL-"$1" && mkdir build && cd build && cmake -DCMAKE_INSTALL_PREFIX=$HOME/CGAL-"$1" .. && make && make install && cd ../..
+cd CGAL-"$1" && mkdir build && cd build && cmake -DCMAKE_INSTALL_PREFIX=$CI_PROJECT_DIR/CGAL .. && make && make install && cd ../..
 
 cmake --version
-clang --version


=====================================
test/unit/SFCGAL/algorithm/StraightSkeletonTest.cpp
=====================================
@@ -110,8 +110,12 @@ BOOST_AUTO_TEST_CASE( testPolygonWithHole )
                                                                       ")"
                                                      )
                                         );
+    // results for gcc and clang differ due to rounding
+    // To avoid rounding errors in the results (-3730904090310553/9007199254740992 vs -466363011288819/1125899906842624), a text comparison is used. This is not optimal.
+    std::unique_ptr< Geometry > r( io::readWkt( result->asText( 10 ) ) );
+    std::unique_ptr< Geometry > e( io::readWkt( expected->asText( 10 ) ) );
+    BOOST_CHECK( algorithm::covers( *r, *e ) );
 
-    BOOST_CHECK( algorithm::covers( *result, *expected ) );
 }
 
 BOOST_AUTO_TEST_CASE( testPolygonWithHoleTouchingShell )



View it on GitLab: https://salsa.debian.org/debian-gis-team/sfcgal/-/commit/a67dbdc1221527bd9f6145b83843c47e356b7714

-- 
View it on GitLab: https://salsa.debian.org/debian-gis-team/sfcgal/-/commit/a67dbdc1221527bd9f6145b83843c47e356b7714
You're receiving this email because of your account on salsa.debian.org.


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://alioth-lists.debian.net/pipermail/pkg-grass-devel/attachments/20201001/0adf6069/attachment-0001.html>


More information about the Pkg-grass-devel mailing list