cgal: Update to 4.6

This commit is contained in:
Alexpux
2015-06-27 10:23:48 +03:00
parent 9bc36e4dab
commit a40d397cdd
3 changed files with 15 additions and 256 deletions

View File

@@ -2,52 +2,46 @@
_realname=cgal
pkgname="${MINGW_PACKAGE_PREFIX}-${_realname}"
pkgver=4.5.1
pkgrel=3
_pkgid=34139
pkgver=4.6
pkgrel=1
_pkgid=34705
pkgdesc="Computational Geometry Algorithms Library (mingw-w64)"
arch=('any')
url="http://www.cgal.org"
license=("LGPL, GPL")
makedepends=("${MINGW_PACKAGE_PREFIX}-gcc"
"${MINGW_PACKAGE_PREFIX}-pkg-config"
"${MINGW_PACKAGE_PREFIX}-cmake"
"${MINGW_PACKAGE_PREFIX}-eigen3"
"${MINGW_PACKAGE_PREFIX}-boost")
"${MINGW_PACKAGE_PREFIX}-pkg-config")
depends=("${MINGW_PACKAGE_PREFIX}-gcc-libs"
"${MINGW_PACKAGE_PREFIX}-mpfr"
"${MINGW_PACKAGE_PREFIX}-boost"
"${MINGW_PACKAGE_PREFIX}-gmp")
"${MINGW_PACKAGE_PREFIX}-gmp"
"${MINGW_PACKAGE_PREFIX}-mpfr")
optdepends=("${MINGW_PACKAGE_PREFIX}-eigen3: for some packages, see the CGAL manual"
#"${MINGW_PACKAGE_PREFIX}qt4: for CGAL_Qt4"
)
options=('strip' 'staticlibs')
source=(http://gforge.inria.fr/frs/download.php/$_pkgid/CGAL-$pkgver.tar.xz
cgal-4.4-mingw.patch
convex_hull_fix.patch
source=(http://gforge.inria.fr/frs/download.php/${_pkgid}/CGAL-${pkgver}.tar.xz
msys2-relocate-cmake-config.patch)
sha1sums=('97c60d3b12727b4fbbcce45a0965941bb1d60cbe'
'1d2b06fe6faa0cb1ee748fa14f2de92f9e9e091f'
'a847bc5aab43944429e7da62b5392347bac2fcd8'
sha1sums=('8f0f0351de319306fea7d61f32d6a25381a5310a'
'3742f2bb189f6c53e66e6ba5562c28685f9d1a86')
prepare() {
cd "${srcdir}"/CGAL-${pkgver%.*}
patch -p1 -i "${srcdir}"/cgal-4.4-mingw.patch
patch -p1 -i "${srcdir}"/convex_hull_fix.patch
cd "${srcdir}"/CGAL-${pkgver}
patch -p1 -i "${srcdir}"/msys2-relocate-cmake-config.patch
}
build() {
mkdir $srcdir/build-${MINGW_CHOST}
cd $srcdir/build-${MINGW_CHOST}
[[ -d ${srcdir}/build-${MINGW_CHOST} ]] && rm -rf ${srcdir}/build-${MINGW_CHOST}
mkdir ${srcdir}/build-${MINGW_CHOST}
cd ${srcdir}/build-${MINGW_CHOST}
MSYS2_ARG_CONV_EXCL="-DCMAKE_INSTALL_PREFIX=" \
cmake \
${MINGW_PREFIX}/bin/cmake \
-G"MSYS Makefiles" \
-DCMAKE_INSTALL_PREFIX=${MINGW_PREFIX} \
-DCMAKE_BUILD_TYPE=Release \
../CGAL-${pkgver%.*}
../CGAL-${pkgver}
make
}
@@ -55,7 +49,7 @@ build() {
package() {
cd "${srcdir}/build-${MINGW_CHOST}"
make install DESTDIR=${pkgdir}
MINGW_PREFIX_WIN=$(cygpath -m ${MINGW_PREFIX})
local MINGW_PREFIX_WIN=$(cygpath -am ${MINGW_PREFIX})
sed -s "s|${MINGW_PREFIX_WIN}|\${RELOCATED_INSTALL_PREFIX}|g" -i "${pkgdir}"${MINGW_PREFIX}/lib/CGAL/CGALConfig.cmake
sed -s "s|${MINGW_PREFIX}|\${RELOCATED_INSTALL_PREFIX}|g" -i "${pkgdir}"${MINGW_PREFIX}/lib/CGAL/CGALConfig.cmake
}

View File

@@ -1,12 +0,0 @@
diff -Naur CGAL-4.4-orig/include/CGAL/sse2.h CGAL-4.4/include/CGAL/sse2.h
--- CGAL-4.4-orig/include/CGAL/sse2.h 2012-11-13 17:13:59.000000000 +0400
+++ CGAL-4.4/include/CGAL/sse2.h 2014-06-28 19:05:29.078000000 +0400
@@ -27,7 +27,7 @@
#include <emmintrin.h>
-#if defined ( _MSC_VER )
+#if defined ( _WIN32 )
#define CGAL_ALIGN_16 __declspec(align(16))
#elif defined( __GNU__ )
#define CGAL_ALIGN_16 __attribute__((aligned(16)))

View File

@@ -1,223 +0,0 @@
diff -Naur --ignore-all-space CGAL-4.5-org/include/CGAL/convex_hull_3.h CGAL-4.5/include/CGAL/convex_hull_3.h
--- CGAL-4.5-org/include/CGAL/convex_hull_3.h 2015-01-07 21:08:53.260410300 +0100
+++ CGAL-4.5/include/CGAL/convex_hull_3.h 2015-01-07 09:24:02.000000000 +0100
@@ -69,7 +69,7 @@
//FT is a floating point type and Kernel is a filtered kernel
template <class Point_3>
struct Default_traits_for_Chull_3<Point_3,boost::true_type,Tag_true>{
- typedef Convex_hull_traits_3< typename Kernel_traits<Point_3>::Kernel > type;
+ typedef Convex_hull_traits_3< typename Kernel_traits<Point_3>::Kernel, Tag_true > type;
};
template <class Traits>
@@ -77,9 +77,9 @@
typedef CGAL::Polyhedron_3<Traits> type;
};
-template <class K>
-struct Default_polyhedron_for_Chull_3<Convex_hull_traits_3<K> >{
- typedef typename Convex_hull_traits_3<K>::Polyhedron_3 type;
+template <class K,class Tag>
+struct Default_polyhedron_for_Chull_3<Convex_hull_traits_3<K, Tag> >{
+ typedef typename Convex_hull_traits_3<K, Tag>::Polyhedron_3 type;
};
//utility class to select the right version of internal predicate Is_on_positive_side_of_plane_3
@@ -129,10 +129,10 @@
//interval arithmetic (the protector must be created before using this predicate)
//and in case of failure, exact arithmetic is used.
template <class Kernel>
-class Is_on_positive_side_of_plane_3<Convex_hull_traits_3<Kernel>,Tag_true>{
+class Is_on_positive_side_of_plane_3<Convex_hull_traits_3<Kernel, Tag_true>,Tag_true>{
typedef Simple_cartesian<CGAL::internal::Exact_field_selector<double>::Type> PK;
typedef Simple_cartesian<Interval_nt_advanced > CK;
- typedef Convex_hull_traits_3<Kernel> Traits;
+ typedef Convex_hull_traits_3<Kernel, Tag_true> Traits;
typedef typename Traits::Point_3 Point_3;
Cartesian_converter<Kernel,CK> to_CK;
@@ -312,12 +312,8 @@
template <class InputIterator, class Point_3, class Polyhedron_3, class Traits>
void coplanar_3_hull(InputIterator first, InputIterator beyond,
const Point_3& p1, const Point_3& p2, const Point_3& p3,
- Polyhedron_3& P, const Traits& traits)
+ Polyhedron_3& P, const Traits& /* traits */)
{
- typedef typename Traits::Vector_3 Vector_3;
- typedef typename Traits::Construct_vector_3 Construct_vector_3;
- typedef typename Traits::Orientation_3 Orientation_3;
-
typedef typename internal::Convex_hull_3::Projection_traits<Traits> PTraits;
typedef typename PTraits::Traits_xy_3 Traits_xy_3;
typedef typename PTraits::Traits_yz_3 Traits_yz_3;
@@ -326,31 +322,26 @@
std::list<Point_3> CH_2;
typedef typename std::list<Point_3>::iterator CH_2_iterator;
- Construct_vector_3 vector_3 = traits.construct_vector_3_object();
- Orientation_3 orientation = traits.orientation_3_object();
- Vector_3 v1 = vector_3(p1,p2);
- Vector_3 v2 = vector_3(p1,p3);
-
- Vector_3 vx = vector_3(1,0,0);
-
-
-
- if ( orientation(v1, v2, vx) != COPLANAR )
+ Traits_xy_3 traits_xy;
+ typename Traits_xy_3::Left_turn_2 left_turn_in_xy = traits_xy.left_turn_2_object();
+ if ( left_turn_in_xy(p1,p2,p3) || left_turn_in_xy(p2,p1,p3) )
convex_hull_points_2( first, beyond,
std::back_inserter(CH_2),
- Traits_yz_3() );
+ traits_xy );
else{
- Vector_3 vy = vector_3(0,1,0);
- if ( orientation(v1,v2,vy) != COPLANAR )
+ Traits_yz_3 traits_yz;
+ typename Traits_yz_3::Left_turn_2 left_turn_in_yz = traits_yz.left_turn_2_object();
+ if ( left_turn_in_yz(p1,p2,p3) || left_turn_in_yz(p2,p1,p3) )
convex_hull_points_2( first, beyond,
std::back_inserter(CH_2),
- Traits_xz_3() );
+ traits_yz );
else{
- CGAL_assertion_code( Vector_3 vz = vector_3(0,0,1); )
- CGAL_assertion( orientation(v1,v2,vz) != COPLANAR );
+ Traits_xz_3 traits_xz;
+ CGAL_assertion_code( typename Traits_xz_3::Left_turn_2 left_turn_in_xz = traits_xz.left_turn_2_object(); )
+ CGAL_assertion( left_turn_in_xz(p1,p2,p3) || left_turn_in_xz(p2,p1,p3) );
convex_hull_points_2( first, beyond,
std::back_inserter(CH_2),
- Traits_xy_3() );
+ traits_xz );
}
}
diff -Naur --ignore-all-space CGAL-4.5-org/include/CGAL/Convex_hull_traits_3.h CGAL-4.5/include/CGAL/Convex_hull_traits_3.h
--- CGAL-4.5-org/include/CGAL/Convex_hull_traits_3.h 2015-01-07 21:08:53.188407300 +0100
+++ CGAL-4.5/include/CGAL/Convex_hull_traits_3.h 2015-01-07 09:24:02.000000000 +0100
@@ -27,6 +27,8 @@
#include <CGAL/Projection_traits_xz_3.h>
#include <CGAL/Projection_traits_yz_3.h>
#include <list>
+#include <CGAL/Filtered_predicate.h>
+#include <CGAL/Cartesian_converter.h>
namespace CGAL {
template < class R_ >
@@ -53,18 +55,40 @@
};
+template <class From, class To>
+struct Point_triple_converter{
+ // Point_triple_less_signed_distance_to_plane_3 is only working with a Cartesian Kernel
+ // so I hardcoded the converter type
+ CGAL::Cartesian_converter<From, To> base;
+
+ Point_triple<To>
+ operator()(const Point_triple<From>& t) const{
+ return Point_triple<To>(
+ base(t.p()),
+ base(t.q()),
+ base(t.r()) );
+ }
+
+ typename To::Point_3
+ operator()(const typename From::Point_3& t) const{
+ return base(t);
+ }
+};
+
template <class K>
class Point_triple_has_on_positive_side_3 {
public:
typedef typename K::Point_3 Point_3;
- typedef typename K::Plane_3 Plane_3;
+ typedef Point_triple<K> Plane_3;
bool
operator()( const Plane_3& pl, const Point_3& p) const
{
typename K::Orientation_3 o;
return ( o(pl.p(), pl.q(), pl.r(), p) == CGAL::POSITIVE );
}
+
+ typedef bool result_type;
};
template <class K, class OldK>
class Point_triple_construct_orthogonal_vector_3
@@ -103,12 +127,12 @@
}
};
-template <typename K, typename OldK>
+template <typename K>
class Point_triple_less_signed_distance_to_plane_3
{
public:
typedef typename K::Point_3 Point_3;
- typedef typename K::Plane_3 Plane_3;
+ typedef Point_triple<K> Plane_3;
typedef bool result_type;
@@ -135,14 +159,39 @@
typedef typename GT::Point_3 Point_2;
};
+template <class R_, class Has_filtered_predicates_tag /* = Tag_false */>
+struct Convex_hull_traits_base_3 {
+ typedef Point_triple_has_on_positive_side_3<R_> Has_on_positive_side_3;
+ typedef Point_triple_less_signed_distance_to_plane_3<R_>
+ Less_signed_distance_to_plane_3;
+};
template <class R_>
-class Convex_hull_traits_3
+struct Convex_hull_traits_base_3<R_, Tag_true>{
+ typedef Filtered_predicate<
+ Point_triple_has_on_positive_side_3< typename R_::Exact_kernel_rt >,
+ Point_triple_has_on_positive_side_3< typename R_::Approximate_kernel >,
+ Point_triple_converter<R_,typename R_::Exact_kernel_rt>,
+ Point_triple_converter<R_,typename R_::Approximate_kernel>
+ > Has_on_positive_side_3;
+
+ typedef Filtered_predicate<
+ Point_triple_less_signed_distance_to_plane_3< typename R_::Exact_kernel_rt >,
+ Point_triple_less_signed_distance_to_plane_3< typename R_::Approximate_kernel >,
+ Point_triple_converter<R_,typename R_::Exact_kernel_rt>,
+ Point_triple_converter<R_,typename R_::Approximate_kernel>
+ > Less_signed_distance_to_plane_3;
+};
+
+
+template <class R_, class Has_filtered_predicates_tag = Tag_false>
+class Convex_hull_traits_3 :
+ public Convex_hull_traits_base_3<R_, Has_filtered_predicates_tag>
{
public:
typedef R_ R;
- typedef Convex_hull_traits_3<R> Self;
+ typedef Convex_hull_traits_3<R, Has_filtered_predicates_tag> Self;
typedef typename R::Point_3 Point_3;
typedef typename R::Segment_3 Segment_3;
typedef typename R::Triangle_3 Triangle_3;
@@ -172,10 +221,12 @@
typedef typename R::Collinear_3 Collinear_3;
typedef typename R::Coplanar_3 Coplanar_3;
typedef typename R::Less_distance_to_point_3 Less_distance_to_point_3;
- typedef Point_triple_has_on_positive_side_3<Self> Has_on_positive_side_3;
- typedef Point_triple_less_signed_distance_to_plane_3<Self, R>
- Less_signed_distance_to_plane_3;
+ typedef typename Convex_hull_traits_base_3<R_, Has_filtered_predicates_tag>
+ ::Has_on_positive_side_3 Has_on_positive_side_3;
+
+ typedef typename Convex_hull_traits_base_3<R_, Has_filtered_predicates_tag>
+ ::Less_signed_distance_to_plane_3 Less_signed_distance_to_plane_3;
// required for degenerate case of all points coplanar
typedef CGAL::Projection_traits_xy_3<R> Traits_xy_3;