diff options
Diffstat (limited to 'extern/carve/patches')
-rw-r--r-- | extern/carve/patches/clang_is_heap_fix.patch | 32 | ||||
-rw-r--r-- | extern/carve/patches/face_hole_merge_workaround.patch | 14 | ||||
-rw-r--r-- | extern/carve/patches/files/config.h | 30 | ||||
-rw-r--r-- | extern/carve/patches/files/random.h | 61 | ||||
-rw-r--r-- | extern/carve/patches/gcc46.patch | 11 | ||||
-rw-r--r-- | extern/carve/patches/includes.patch | 84 | ||||
-rw-r--r-- | extern/carve/patches/interpolator_reorder.patch | 12 | ||||
-rw-r--r-- | extern/carve/patches/memory_leak_fix.patch | 11 | ||||
-rw-r--r-- | extern/carve/patches/mesh_iterator.patch | 21 | ||||
-rw-r--r-- | extern/carve/patches/mesh_simplify_dissolve_edges.patch | 64 | ||||
-rw-r--r-- | extern/carve/patches/mesh_simplify_uninitialized_var.patch | 12 | ||||
-rw-r--r-- | extern/carve/patches/mingw.patch | 15 | ||||
-rw-r--r-- | extern/carve/patches/mingw_w64.patch | 13 | ||||
-rw-r--r-- | extern/carve/patches/msvc_fix.patch | 14 | ||||
-rw-r--r-- | extern/carve/patches/random.patch | 16 | ||||
-rw-r--r-- | extern/carve/patches/series | 14 | ||||
-rw-r--r-- | extern/carve/patches/strict_flags.patch | 439 | ||||
-rw-r--r-- | extern/carve/patches/win32.patch | 37 |
18 files changed, 0 insertions, 900 deletions
diff --git a/extern/carve/patches/clang_is_heap_fix.patch b/extern/carve/patches/clang_is_heap_fix.patch deleted file mode 100644 index 524a8e0420c..00000000000 --- a/extern/carve/patches/clang_is_heap_fix.patch +++ /dev/null @@ -1,32 +0,0 @@ -diff -r e82d852e4fb0 include/carve/mesh_ops.hpp ---- a/include/carve/mesh_ops.hpp Wed Jan 15 13:16:14 2014 +1100 -+++ b/include/carve/mesh_ops.hpp Fri Mar 28 14:34:04 2014 +0600 -@@ -580,7 +580,7 @@ - std::vector<VertexInfo *> queue; - - void checkheap() { --#ifdef __GNUC__ -+#if defined(HAVE_IS_HEAP) - CARVE_ASSERT(std::__is_heap(queue.begin(), queue.end(), order_by_score())); - #endif - } -diff -r e82d852e4fb0 lib/triangulator.cpp ---- a/lib/triangulator.cpp Wed Jan 15 13:16:14 2014 +1100 -+++ b/lib/triangulator.cpp Fri Mar 28 14:34:04 2014 +0600 -@@ -27,7 +27,6 @@ - - #include <algorithm> - -- - namespace { - // private code related to hole patching. - -@@ -122,7 +121,7 @@ - std::vector<vertex_info *> queue; - - void checkheap() { --#ifdef __GNUC__ -+#if defined(HAVE_IS_HEAP) - CARVE_ASSERT(std::__is_heap(queue.begin(), queue.end(), vertex_info_ordering())); - #endif - } diff --git a/extern/carve/patches/face_hole_merge_workaround.patch b/extern/carve/patches/face_hole_merge_workaround.patch deleted file mode 100644 index 834e03a4b12..00000000000 --- a/extern/carve/patches/face_hole_merge_workaround.patch +++ /dev/null @@ -1,14 +0,0 @@ -diff -r e82d852e4fb0 lib/intersect_face_division.cpp ---- a/lib/intersect_face_division.cpp Wed Jan 15 13:16:14 2014 +1100 -+++ b/lib/intersect_face_division.cpp Thu Mar 13 15:39:26 2014 +0600 -@@ -719,6 +719,10 @@ - unassigned--; - } - } -+ -+ if (!removed.size()) -+ throw carve::exception("Failed to merge holes"); -+ - for (std::set<int>::iterator f = removed.begin(); f != removed.end(); ++f) { - for (unsigned i = 0; i < containing_faces.size(); ++i) { - containing_faces[i].erase(std::remove(containing_faces[i].begin(), diff --git a/extern/carve/patches/files/config.h b/extern/carve/patches/files/config.h deleted file mode 100644 index 3533c1a6710..00000000000 --- a/extern/carve/patches/files/config.h +++ /dev/null @@ -1,30 +0,0 @@ -#define CARVE_VERSION "2.0.0a" - -#undef CARVE_DEBUG -#undef CARVE_DEBUG_WRITE_PLY_DATA - -#if defined(__GNUC__) -# if !defined(HAVE_BOOST_UNORDERED_COLLECTIONS) -# define HAVE_TR1_UNORDERED_COLLECTIONS -# endif - -# define HAVE_STDINT_H -#endif - -// Support for latest Clang/LLVM on FreeBSD which does have different libcxx. -// -// TODO(sergey): Move it some some more generic header with platform-specific -// declarations. - -// Indicates whether __is_heap is available -#undef HAVE_IS_HEAP - -#ifdef __GNUC__ -// NeyBSD doesn't have __is_heap -# ifndef __NetBSD__ -# define HAVE_IS_HEAP -# ifdef _LIBCPP_VERSION -# define __is_heap is_heap -# endif // _LIBCPP_VERSION -# endif // !__NetBSD__ -#endif // __GNUC__ diff --git a/extern/carve/patches/files/random.h b/extern/carve/patches/files/random.h deleted file mode 100644 index 634063cb90c..00000000000 --- a/extern/carve/patches/files/random.h +++ /dev/null @@ -1,61 +0,0 @@ -#include <cassert> -#include <cmath> -#include <vector> - -namespace boost { -#if __cplusplus > 199711L -# include <random> -typedef std::mt19937 mt19937; -#else -# include <stdlib.h> -struct mt19937 { - int operator()() { - return rand(); - } - - int max() { - return RAND_MAX; - } -}; -#endif - -template<typename T> -struct uniform_on_sphere { - typedef std::vector<T> result_type; - - uniform_on_sphere(int dimension) { - assert(dimension == 3); - } - - std::vector<T> - operator()(float u1, float u2) { - T z = 1.0 - 2.0*u1; - T r = std::sqrt(std::max(0.0, 1.0 - z*z)); - T phi = 2.0*M_PI*u2; - T x = r*std::cos(phi); - T y = r*std::sin(phi); - std::vector<T> result; - result.push_back(x); - result.push_back(y); - result.push_back(z); - return result; - } -}; - -template<typename RNG, typename DISTR> -struct variate_generator { - - variate_generator(RNG rng, DISTR distr) - : rng_(rng), distr_(distr) {} - - typename DISTR::result_type - operator()() { - float rng_max_inv = 1.0 / rng_.max(); - return distr_(rng_() * rng_max_inv, rng_() * rng_max_inv); - } - - RNG rng_; - DISTR distr_; -}; - -} diff --git a/extern/carve/patches/gcc46.patch b/extern/carve/patches/gcc46.patch deleted file mode 100644 index a8384dcdab8..00000000000 --- a/extern/carve/patches/gcc46.patch +++ /dev/null @@ -1,11 +0,0 @@ -diff -r 525472fb477a include/carve/polyline_iter.hpp ---- a/include/carve/polyline_iter.hpp Sun Jan 15 23:07:40 2012 -0500 -+++ b/include/carve/polyline_iter.hpp Wed Jan 18 00:41:13 2012 +0600 -@@ -20,6 +20,7 @@ - #include <list> - #include <iterator> - #include <limits> -+#include <cstddef> - - #include <carve/polyline_decl.hpp> - diff --git a/extern/carve/patches/includes.patch b/extern/carve/patches/includes.patch deleted file mode 100644 index bdf97c846e7..00000000000 --- a/extern/carve/patches/includes.patch +++ /dev/null @@ -1,84 +0,0 @@ -diff -r c8cbec41cd35 include/carve/exact.hpp ---- a/include/carve/exact.hpp Thu Dec 01 15:51:44 2011 -0500 -+++ b/include/carve/exact.hpp Wed Jan 11 18:48:16 2012 +0600 -@@ -21,7 +21,7 @@ - - #include <vector> - #include <numeric> -- -+#include <algorithm> - - - namespace carve { -diff -r c8cbec41cd35 include/carve/geom2d.hpp ---- a/include/carve/geom2d.hpp Thu Dec 01 15:51:44 2011 -0500 -+++ b/include/carve/geom2d.hpp Wed Jan 11 18:48:16 2012 +0600 -@@ -25,6 +25,7 @@ - #include <carve/geom.hpp> - - #include <vector> -+#include <algorithm> - - #include <math.h> - -diff -r c8cbec41cd35 include/carve/mesh_impl.hpp ---- a/include/carve/mesh_impl.hpp Thu Dec 01 15:51:44 2011 -0500 -+++ b/include/carve/mesh_impl.hpp Wed Jan 11 18:48:16 2012 +0600 -@@ -24,6 +24,8 @@ - #include <iostream> - #include <deque> - -+#include <stddef.h> -+ - namespace carve { - namespace mesh { - -diff -r c8cbec41cd35 include/carve/polyhedron_base.hpp ---- a/include/carve/polyhedron_base.hpp Thu Dec 01 15:51:44 2011 -0500 -+++ b/include/carve/polyhedron_base.hpp Wed Jan 11 18:48:16 2012 +0600 -@@ -25,6 +25,8 @@ - #include <carve/edge_decl.hpp> - #include <carve/face_decl.hpp> - -+#include <stddef.h> -+ - namespace carve { - namespace poly { - -diff -r c8cbec41cd35 include/carve/rtree.hpp ---- a/include/carve/rtree.hpp Thu Dec 01 15:51:44 2011 -0500 -+++ b/include/carve/rtree.hpp Wed Jan 11 18:48:16 2012 +0600 -@@ -27,6 +27,10 @@ - #include <cmath> - #include <limits> - -+#if defined(HAVE_STDINT_H) -+# include <stdint.h> -+#endif -+ - namespace carve { - namespace geom { - -diff -r c8cbec41cd35 include/carve/vector.hpp ---- a/include/carve/vector.hpp Thu Dec 01 15:51:44 2011 -0500 -+++ b/include/carve/vector.hpp Wed Jan 11 18:48:16 2012 +0600 -@@ -24,6 +24,7 @@ - #include <carve/geom3d.hpp> - - #include <sstream> -+#include <algorithm> - - #include <math.h> - -diff -r c8cbec41cd35 src/extrude.cpp ---- a/src/extrude.cpp Thu Dec 01 15:51:44 2011 -0500 -+++ b/src/extrude.cpp Wed Jan 11 18:48:16 2012 +0600 -@@ -34,6 +34,8 @@ - #include <cctype> - #include <stdexcept> - -+#include <stdexcept> -+ - template<unsigned ndim> - carve::geom::vector<ndim> lerp( - double t, diff --git a/extern/carve/patches/interpolator_reorder.patch b/extern/carve/patches/interpolator_reorder.patch deleted file mode 100644 index 867297fef7d..00000000000 --- a/extern/carve/patches/interpolator_reorder.patch +++ /dev/null @@ -1,12 +0,0 @@ -diff -r e82d852e4fb0 include/carve/interpolator.hpp ---- a/include/carve/interpolator.hpp Wed Jan 15 13:16:14 2014 +1100 -+++ b/include/carve/interpolator.hpp Fri Jan 31 18:55:05 2014 +0600 -@@ -219,7 +219,7 @@ - interpolator->edgeDivision(csg, orig_edge, orig_edge_idx, v1, v2); - } - -- Hook(Interpolator *_interpolator, const carve::csg::CSG &_csg) : interpolator(_interpolator), csg(_csg) { -+ Hook(Interpolator *_interpolator, const carve::csg::CSG &_csg) : csg(_csg), interpolator(_interpolator) { - } - - virtual ~Hook() { diff --git a/extern/carve/patches/memory_leak_fix.patch b/extern/carve/patches/memory_leak_fix.patch deleted file mode 100644 index c6aff1bf837..00000000000 --- a/extern/carve/patches/memory_leak_fix.patch +++ /dev/null @@ -1,11 +0,0 @@ -diff -r e82d852e4fb0 include/carve/csg_triangulator.hpp ---- a/include/carve/csg_triangulator.hpp Wed Jan 15 13:16:14 2014 +1100 -+++ b/include/carve/csg_triangulator.hpp Wed Mar 05 14:43:56 2014 +0600 -@@ -426,6 +426,7 @@ - findPerimeter(grp_tris, vloop, grp_perim); - out_faces.push_back(face->create(grp_perim.begin(), grp_perim.end(), false)); - } -+ delete face; - } - std::swap(faces, out_faces); - } diff --git a/extern/carve/patches/mesh_iterator.patch b/extern/carve/patches/mesh_iterator.patch deleted file mode 100644 index 1b9e12866bf..00000000000 --- a/extern/carve/patches/mesh_iterator.patch +++ /dev/null @@ -1,21 +0,0 @@ -diff -r c8cbec41cd35 include/carve/mesh.hpp ---- a/include/carve/mesh.hpp Thu Dec 01 15:51:44 2011 -0500 -+++ b/include/carve/mesh.hpp Thu Jan 12 00:19:58 2012 +0600 -@@ -719,13 +719,13 @@ - void rev(size_t n); - void adv(int n); - -- FaceIter operator++(int) { FaceIter tmp = *this; fwd(1); return tmp; } -- FaceIter operator+(int v) { FaceIter tmp = *this; adv(v); return tmp; } -+ FaceIter operator++(int) { FaceIter tmp = *this; tmp.fwd(1); return tmp; } -+ FaceIter operator+(int v) { FaceIter tmp = *this; tmp.adv(v); return tmp; } - FaceIter &operator++() { fwd(1); return *this; } - FaceIter &operator+=(int v) { adv(v); return *this; } - -- FaceIter operator--(int) { FaceIter tmp = *this; rev(1); return tmp; } -- FaceIter operator-(int v) { FaceIter tmp = *this; adv(-v); return tmp; } -+ FaceIter operator--(int) { FaceIter tmp = *this; tmp.rev(1); return tmp; } -+ FaceIter operator-(int v) { FaceIter tmp = *this; tmp.adv(-v); return tmp; } - FaceIter &operator--() { rev(1); return *this; } - FaceIter &operator-=(int v) { adv(-v); return *this; } - diff --git a/extern/carve/patches/mesh_simplify_dissolve_edges.patch b/extern/carve/patches/mesh_simplify_dissolve_edges.patch deleted file mode 100644 index 27406a4912a..00000000000 --- a/extern/carve/patches/mesh_simplify_dissolve_edges.patch +++ /dev/null @@ -1,64 +0,0 @@ -diff -r e82d852e4fb0 include/carve/mesh_simplify.hpp ---- a/include/carve/mesh_simplify.hpp Wed Jan 15 13:16:14 2014 +1100 -+++ b/include/carve/mesh_simplify.hpp Fri Feb 28 19:09:02 2014 +0600 -@@ -32,8 +32,6 @@ - #include <algorithm> - #include <vector> - --#include "write_ply.hpp" -- - - namespace carve { - namespace mesh { -@@ -1184,6 +1182,33 @@ - return modifications; - } - -+ void dissolveMeshEdges(mesh_t *mesh, std::unordered_set<edge_t *> dissolve_edges) { -+ while (dissolve_edges.size()) { -+ MeshSet<3>::edge_t *edge = *dissolve_edges.begin(); -+ if (edge->face == edge->rev->face) { -+ dissolve_edges.erase(edge); -+ continue; -+ } -+ -+ MeshSet<3>::edge_t *removed = edge->mergeFaces(); -+ if (removed == NULL) { -+ dissolve_edges.erase(edge); -+ } else { -+ MeshSet<3>::edge_t *e = removed; -+ do { -+ MeshSet<3>::edge_t *n = e->next; -+ dissolve_edges.erase(std::min(e, e->rev)); -+ delete e->rev; -+ delete e; -+ e = n; -+ } while (e != removed); -+ } -+ } -+ -+ removeRemnantFaces(mesh); -+ cleanFaceEdges(mesh); -+ mesh->cacheEdges(); -+ } - - - size_t improveMesh(meshset_t *meshset, -@@ -1445,7 +1470,7 @@ - heapval_t last; - std::vector<heapval_t> heap; - -- point_enumerator_t(vector_t _origin, int _base, int _n_dp) : origin(_origin), rounding_fac(pow(_base, _n_dp)), last(-1.0, _origin), heap() { -+ point_enumerator_t(vector_t _origin, int _base, int _n_dp) : origin(_origin), rounding_fac(pow((double)_base, _n_dp)), last(-1.0, _origin), heap() { - for (size_t i = 0; i < (1 << 3); ++i) { - vector_t t = origin; - for (size_t j = 0; j < 3; ++j) { -@@ -1502,7 +1527,7 @@ - } - - aabb_t getAABB() const { -- std::set<face_t *>::iterator i = faces.begin(); -+ std::set<face_t *>::const_iterator i = faces.begin(); - aabb_t aabb = (*i)->getAABB(); - while (++i != faces.end()) { - aabb.unionAABB((*i)->getAABB()); diff --git a/extern/carve/patches/mesh_simplify_uninitialized_var.patch b/extern/carve/patches/mesh_simplify_uninitialized_var.patch deleted file mode 100644 index 592c6db0b68..00000000000 --- a/extern/carve/patches/mesh_simplify_uninitialized_var.patch +++ /dev/null @@ -1,12 +0,0 @@ -diff -r e82d852e4fb0 include/carve/mesh_simplify.hpp ---- a/include/carve/mesh_simplify.hpp Wed Jan 15 13:16:14 2014 +1100 -+++ b/include/carve/mesh_simplify.hpp Wed Jun 11 13:13:09 2014 +0600 -@@ -1414,7 +1414,7 @@ - - - size_t removeLowVolumeManifolds(meshset_t *meshset, double min_abs_volume) { -- size_t n_removed; -+ size_t n_removed = 0; - for (size_t i = 0; i < meshset->meshes.size(); ++i) { - if (fabs(meshset->meshes[i]->volume()) < min_abs_volume) { - delete meshset->meshes[i]; diff --git a/extern/carve/patches/mingw.patch b/extern/carve/patches/mingw.patch deleted file mode 100644 index c237edf18e9..00000000000 --- a/extern/carve/patches/mingw.patch +++ /dev/null @@ -1,15 +0,0 @@ -diff -r 525472fb477a include/carve/win32.h ---- a/include/carve/win32.h Sun Jan 15 23:07:40 2012 -0500 -+++ b/include/carve/win32.h Wed Jan 18 00:40:10 2012 +0600 -@@ -8,9 +8,11 @@ - #include <string.h> - #include <stdlib.h> - -+#if !defined(__MINGW32__) - inline int strcasecmp(const char *a, const char *b) { - return _stricmp(a,b); - } -+#endif - - inline void srandom(unsigned long input) { - srand(input); diff --git a/extern/carve/patches/mingw_w64.patch b/extern/carve/patches/mingw_w64.patch deleted file mode 100644 index 26a30be84c3..00000000000 --- a/extern/carve/patches/mingw_w64.patch +++ /dev/null @@ -1,13 +0,0 @@ -Index: bundle.sh -=================================================================== ---- bundle.sh (revision 45912) -+++ bundle.sh (working copy) -@@ -114,7 +114,7 @@ - if env['WITH_BF_BOOST']: - if env['OURPLATFORM'] not in ('win32-vc', 'win64-vc'): - # Boost is setting as preferred collections library in the Carve code when using MSVC compiler -- if env['OURPLATFORM'] != 'win32-mingw': -+ if env['OURPLATFORM'] not in ('win32-mingw', 'win64-mingw'): - defs.append('HAVE_BOOST_UNORDERED_COLLECTIONS') - - defs.append('CARVE_SYSTEM_BOOST') diff --git a/extern/carve/patches/msvc_fix.patch b/extern/carve/patches/msvc_fix.patch deleted file mode 100644 index 67431ecac75..00000000000 --- a/extern/carve/patches/msvc_fix.patch +++ /dev/null @@ -1,14 +0,0 @@ -diff -r e82d852e4fb0 lib/intersect_face_division.cpp ---- a/lib/intersect_face_division.cpp Wed Jan 15 13:16:14 2014 +1100 -+++ b/lib/intersect_face_division.cpp Wed Mar 12 23:09:19 2014 +0600 -@@ -1121,7 +1121,9 @@ - } - - // copy up to the end of the path. -- std::copy(base_loop.begin() + pos, base_loop.begin() + e1_1, std::back_inserter(out)); -+ if (pos < e1_1) { -+ std::copy(base_loop.begin() + pos, base_loop.begin() + e1_1, std::back_inserter(out)); -+ } - - CARVE_ASSERT(base_loop[e1_1] == p1.back()); - std::copy(p1.rbegin(), p1.rend() - 1, std::back_inserter(out)); diff --git a/extern/carve/patches/random.patch b/extern/carve/patches/random.patch deleted file mode 100644 index 36cc8d10430..00000000000 --- a/extern/carve/patches/random.patch +++ /dev/null @@ -1,16 +0,0 @@ -diff -r 9a85d733a43d lib/polyhedron.cpp ---- a/lib/polyhedron.cpp Tue Jun 24 11:15:23 2014 +1000 -+++ b/lib/polyhedron.cpp Thu Nov 13 17:36:06 2014 +0500 -@@ -36,7 +36,11 @@ - - #include <carve/mesh.hpp> - --#include BOOST_INCLUDE(random.hpp) -+#ifdef HAVE_BOOST_LIBRARY -+# include BOOST_INCLUDE(random.hpp) -+#else -+# include <carve/random/random.h> -+#endif - - namespace { - bool emb_test(carve::poly::Polyhedron *poly, diff --git a/extern/carve/patches/series b/extern/carve/patches/series deleted file mode 100644 index b7e97d68c4c..00000000000 --- a/extern/carve/patches/series +++ /dev/null @@ -1,14 +0,0 @@ -includes.patch -win32.patch -mesh_iterator.patch -mingw.patch -gcc46.patch -clang_is_heap_fix.patch -strict_flags.patch -interpolator_reorder.patch -mesh_simplify_dissolve_edges.patch -mesh_simplify_uninitialized_var.patch -memory_leak_fix.patch -msvc_fix.patch -face_hole_merge_workaround.patch -random.patch diff --git a/extern/carve/patches/strict_flags.patch b/extern/carve/patches/strict_flags.patch deleted file mode 100644 index a40eecb25a4..00000000000 --- a/extern/carve/patches/strict_flags.patch +++ /dev/null @@ -1,439 +0,0 @@ -diff -r e82d852e4fb0 lib/csg_collector.cpp ---- a/lib/csg_collector.cpp Wed Jan 15 13:16:14 2014 +1100 -+++ b/lib/csg_collector.cpp Mon Jan 27 17:01:46 2014 +0600 -@@ -21,6 +21,7 @@ - - #include <carve/csg.hpp> - #include <iostream> -+#include "csg_collector.hpp" - #include "intersect_debug.hpp" - - #if defined(CARVE_DEBUG_WRITE_PLY_DATA) -diff -r e82d852e4fb0 lib/face.cpp ---- a/lib/face.cpp Wed Jan 15 13:16:14 2014 +1100 -+++ b/lib/face.cpp Mon Jan 27 17:01:46 2014 +0600 -@@ -21,61 +21,69 @@ - - #include <carve/poly.hpp> - --double CALC_X(const carve::geom::plane<3> &p, double y, double z) { return -(p.d + p.N.y * y + p.N.z * z) / p.N.x; } --double CALC_Y(const carve::geom::plane<3> &p, double x, double z) { return -(p.d + p.N.x * x + p.N.z * z) / p.N.y; } --double CALC_Z(const carve::geom::plane<3> &p, double x, double y) { return -(p.d + p.N.x * x + p.N.y * y) / p.N.z; } -+namespace { -+ -+ double CALC_X(const carve::geom::plane<3> &p, double y, double z) { return -(p.d + p.N.y * y + p.N.z * z) / p.N.x; } -+ double CALC_Y(const carve::geom::plane<3> &p, double x, double z) { return -(p.d + p.N.x * x + p.N.z * z) / p.N.y; } -+ double CALC_Z(const carve::geom::plane<3> &p, double x, double y) { return -(p.d + p.N.x * x + p.N.y * y) / p.N.z; } -+ -+} // namespace - - namespace carve { - namespace poly { - -- carve::geom2d::P2 _project_1(const carve::geom3d::Vector &v) { -- return carve::geom::VECTOR(v.z, v.y); -- } -+ namespace { - -- carve::geom2d::P2 _project_2(const carve::geom3d::Vector &v) { -- return carve::geom::VECTOR(v.x, v.z); -- } -+ carve::geom2d::P2 _project_1(const carve::geom3d::Vector &v) { -+ return carve::geom::VECTOR(v.z, v.y); -+ } - -- carve::geom2d::P2 _project_3(const carve::geom3d::Vector &v) { -- return carve::geom::VECTOR(v.y, v.x); -- } -+ carve::geom2d::P2 _project_2(const carve::geom3d::Vector &v) { -+ return carve::geom::VECTOR(v.x, v.z); -+ } - -- carve::geom2d::P2 _project_4(const carve::geom3d::Vector &v) { -- return carve::geom::VECTOR(v.y, v.z); -- } -+ carve::geom2d::P2 _project_3(const carve::geom3d::Vector &v) { -+ return carve::geom::VECTOR(v.y, v.x); -+ } - -- carve::geom2d::P2 _project_5(const carve::geom3d::Vector &v) { -- return carve::geom::VECTOR(v.z, v.x); -- } -+ carve::geom2d::P2 _project_4(const carve::geom3d::Vector &v) { -+ return carve::geom::VECTOR(v.y, v.z); -+ } - -- carve::geom2d::P2 _project_6(const carve::geom3d::Vector &v) { -- return carve::geom::VECTOR(v.x, v.y); -- } -+ carve::geom2d::P2 _project_5(const carve::geom3d::Vector &v) { -+ return carve::geom::VECTOR(v.z, v.x); -+ } - -+ carve::geom2d::P2 _project_6(const carve::geom3d::Vector &v) { -+ return carve::geom::VECTOR(v.x, v.y); -+ } - -- carve::geom3d::Vector _unproject_1(const carve::geom2d::P2 &p, const carve::geom3d::Plane &plane_eqn) { -- return carve::geom::VECTOR(CALC_X(plane_eqn, p.y, p.x), p.y, p.x); -- } - -- carve::geom3d::Vector _unproject_2(const carve::geom2d::P2 &p, const carve::geom3d::Plane &plane_eqn) { -- return carve::geom::VECTOR(p.x, CALC_Y(plane_eqn, p.x, p.y), p.y); -- } -+ carve::geom3d::Vector _unproject_1(const carve::geom2d::P2 &p, const carve::geom3d::Plane &plane_eqn) { -+ return carve::geom::VECTOR(CALC_X(plane_eqn, p.y, p.x), p.y, p.x); -+ } - -- carve::geom3d::Vector _unproject_3(const carve::geom2d::P2 &p, const carve::geom3d::Plane &plane_eqn) { -- return carve::geom::VECTOR(p.y, p.x, CALC_Z(plane_eqn, p.y, p.x)); -- } -+ carve::geom3d::Vector _unproject_2(const carve::geom2d::P2 &p, const carve::geom3d::Plane &plane_eqn) { -+ return carve::geom::VECTOR(p.x, CALC_Y(plane_eqn, p.x, p.y), p.y); -+ } - -- carve::geom3d::Vector _unproject_4(const carve::geom2d::P2 &p, const carve::geom3d::Plane &plane_eqn) { -- return carve::geom::VECTOR(CALC_X(plane_eqn, p.x, p.y), p.x, p.y); -- } -+ carve::geom3d::Vector _unproject_3(const carve::geom2d::P2 &p, const carve::geom3d::Plane &plane_eqn) { -+ return carve::geom::VECTOR(p.y, p.x, CALC_Z(plane_eqn, p.y, p.x)); -+ } - -- carve::geom3d::Vector _unproject_5(const carve::geom2d::P2 &p, const carve::geom3d::Plane &plane_eqn) { -- return carve::geom::VECTOR(p.y, CALC_Y(plane_eqn, p.y, p.x), p.x); -- } -+ carve::geom3d::Vector _unproject_4(const carve::geom2d::P2 &p, const carve::geom3d::Plane &plane_eqn) { -+ return carve::geom::VECTOR(CALC_X(plane_eqn, p.x, p.y), p.x, p.y); -+ } - -- carve::geom3d::Vector _unproject_6(const carve::geom2d::P2 &p, const carve::geom3d::Plane &plane_eqn) { -- return carve::geom::VECTOR(p.x, p.y, CALC_Z(plane_eqn, p.x, p.y)); -- } -+ carve::geom3d::Vector _unproject_5(const carve::geom2d::P2 &p, const carve::geom3d::Plane &plane_eqn) { -+ return carve::geom::VECTOR(p.y, CALC_Y(plane_eqn, p.y, p.x), p.x); -+ } -+ -+ carve::geom3d::Vector _unproject_6(const carve::geom2d::P2 &p, const carve::geom3d::Plane &plane_eqn) { -+ return carve::geom::VECTOR(p.x, p.y, CALC_Z(plane_eqn, p.x, p.y)); -+ } -+ -+ } // namespace - - static carve::geom2d::P2 (*project_tab[2][3])(const carve::geom3d::Vector &) = { - { &_project_1, &_project_2, &_project_3 }, -diff -r e82d852e4fb0 lib/geom2d.cpp ---- a/lib/geom2d.cpp Wed Jan 15 13:16:14 2014 +1100 -+++ b/lib/geom2d.cpp Mon Jan 27 17:01:46 2014 +0600 -@@ -157,9 +157,9 @@ - return pointInPoly(points, p2_adapt_ident(), p); - } - -- int lineSegmentPolyIntersections(const P2Vector &points, -- LineSegment2 line, -- std::vector<PolyIntersectionInfo> &out) { -+ static int lineSegmentPolyIntersections(const P2Vector &points, -+ LineSegment2 line, -+ std::vector<PolyIntersectionInfo> &out) { - int count = 0; - - if (line.v2 < line.v1) { line.flip(); } -@@ -239,9 +239,9 @@ - } - }; - -- int sortedLineSegmentPolyIntersections(const P2Vector &points, -- LineSegment2 line, -- std::vector<PolyIntersectionInfo> &out) { -+ static int sortedLineSegmentPolyIntersections(const P2Vector &points, -+ LineSegment2 line, -+ std::vector<PolyIntersectionInfo> &out) { - - bool swapped = line.v2 < line.v1; - -diff -r e82d852e4fb0 lib/intersect.cpp ---- a/lib/intersect.cpp Wed Jan 15 13:16:14 2014 +1100 -+++ b/lib/intersect.cpp Mon Jan 27 17:01:46 2014 +0600 -@@ -1378,9 +1378,9 @@ - * @param result_list - * @param shared_edge_ptr - */ --void returnSharedEdges(carve::csg::V2Set &shared_edges, -- std::list<carve::mesh::MeshSet<3> *> &result_list, -- carve::csg::V2Set *shared_edge_ptr) { -+static void returnSharedEdges(carve::csg::V2Set &shared_edges, -+ std::list<carve::mesh::MeshSet<3> *> &result_list, -+ carve::csg::V2Set *shared_edge_ptr) { - // need to convert shared edges to point into result - typedef std::map<carve::geom3d::Vector, carve::mesh::MeshSet<3>::vertex_t *> remap_type; - remap_type remap; -diff -r e82d852e4fb0 lib/intersect_face_division.cpp ---- a/lib/intersect_face_division.cpp Wed Jan 15 13:16:14 2014 +1100 -+++ b/lib/intersect_face_division.cpp Mon Jan 27 17:01:46 2014 +0600 -@@ -1455,7 +1455,7 @@ - std::vector<carve::mesh::MeshSet<3>::vertex_t *> base_loop; - std::list<std::vector<carve::mesh::MeshSet<3>::vertex_t *> > hole_loops; - -- bool face_edge_intersected = assembleBaseLoop(face, data, base_loop, hooks); -+ /*bool face_edge_intersected = */assembleBaseLoop(face, data, base_loop, hooks); - - detail::FV2SMap::const_iterator fse_iter = data.face_split_edges.find(face); - -diff -r e82d852e4fb0 lib/math.cpp ---- a/lib/math.cpp Wed Jan 15 13:16:14 2014 +1100 -+++ b/lib/math.cpp Mon Jan 27 17:01:46 2014 +0600 -@@ -42,20 +42,21 @@ - Root(double r, int m) : root(r), multiplicity(m) {} - }; - -- void cplx_sqrt(double re, double im, -- double &re_1, double &im_1, -- double &re_2, double &im_2) { -- if (re == 0.0 && im == 0.0) { -- re_1 = re_2 = re; -- im_1 = im_2 = im; -- } else { -- double d = sqrt(re * re + im * im); -- re_1 = sqrt((d + re) / 2.0); -- re_2 = re_1; -- im_1 = fabs(sqrt((d - re) / 2.0)); -- im_2 = -im_1; -+ namespace { -+ void cplx_sqrt(double re, double im, -+ double &re_1, double &im_1, -+ double &re_2, double &im_2) { -+ if (re == 0.0 && im == 0.0) { -+ re_1 = re_2 = re; -+ im_1 = im_2 = im; -+ } else { -+ double d = sqrt(re * re + im * im); -+ re_1 = sqrt((d + re) / 2.0); -+ re_2 = re_1; -+ im_1 = fabs(sqrt((d - re) / 2.0)); -+ im_2 = -im_1; -+ } - } -- } - - void cplx_cbrt(double re, double im, - double &re_1, double &im_1, -@@ -76,109 +77,110 @@ - } - } - -- void add_root(std::vector<Root> &roots, double root) { -- for (size_t i = 0; i < roots.size(); ++i) { -- if (roots[i].root == root) { -- roots[i].multiplicity++; -+ void add_root(std::vector<Root> &roots, double root) { -+ for (size_t i = 0; i < roots.size(); ++i) { -+ if (roots[i].root == root) { -+ roots[i].multiplicity++; -+ return; -+ } -+ } -+ roots.push_back(Root(root)); -+ } -+ -+ void linear_roots(double c1, double c0, std::vector<Root> &roots) { -+ roots.push_back(Root(c0 / c1)); -+ } -+ -+ void quadratic_roots(double c2, double c1, double c0, std::vector<Root> &roots) { -+ if (fabs(c2) < EPS) { -+ linear_roots(c1, c0, roots); - return; - } -- } -- roots.push_back(Root(root)); -- } - -- void linear_roots(double c1, double c0, std::vector<Root> &roots) { -- roots.push_back(Root(c0 / c1)); -- } -+ double p = 0.5 * c1 / c2; -+ double dis = p * p - c0 / c2; - -- void quadratic_roots(double c2, double c1, double c0, std::vector<Root> &roots) { -- if (fabs(c2) < EPS) { -- linear_roots(c1, c0, roots); -- return; -+ if (dis > 0.0) { -+ dis = sqrt(dis); -+ if (-p - dis != -p + dis) { -+ roots.push_back(Root(-p - dis)); -+ roots.push_back(Root(-p + dis)); -+ } else { -+ roots.push_back(Root(-p, 2)); -+ } -+ } - } - -- double p = 0.5 * c1 / c2; -- double dis = p * p - c0 / c2; -+ void cubic_roots(double c3, double c2, double c1, double c0, std::vector<Root> &roots) { -+ int n_sol = 0; -+ double _r[3]; - -- if (dis > 0.0) { -- dis = sqrt(dis); -- if (-p - dis != -p + dis) { -- roots.push_back(Root(-p - dis)); -- roots.push_back(Root(-p + dis)); -+ if (fabs(c3) < EPS) { -+ quadratic_roots(c2, c1, c0, roots); -+ return; -+ } -+ -+ if (fabs(c0) < EPS) { -+ quadratic_roots(c3, c2, c1, roots); -+ add_root(roots, 0.0); -+ return; -+ } -+ -+ double xN = -c2 / (3.0 * c3); -+ double yN = c0 + xN * (c1 + xN * (c2 + c3 * xN)); -+ -+ double delta_sq = (c2 * c2 - 3.0 * c3 * c1) / (9.0 * c3 * c3); -+ double h_sq = 4.0 / 9.0 * (c2 * c2 - 3.0 * c3 * c1) * (delta_sq * delta_sq); -+ double dis = yN * yN - h_sq; -+ -+ if (dis > EPS) { -+ // One real root, two complex roots. -+ -+ double dis_sqrt = sqrt(dis); -+ double r_p = yN - dis_sqrt; -+ double r_q = yN + dis_sqrt; -+ double p = cbrt(fabs(r_p)/(2.0 * c3)); -+ double q = cbrt(fabs(r_q)/(2.0 * c3)); -+ -+ if (r_p > 0.0) p = -p; -+ if (r_q > 0.0) q = -q; -+ -+ _r[0] = xN + p + q; -+ n_sol = 1; -+ -+ double re = xN - p * .5 - q * .5; -+ double im = p * M_SQRT_3_4 - q * M_SQRT_3_4; -+ -+ // root 2: xN + p * exp(M_2PI_3.i) + q * exp(-M_2PI_3.i); -+ // root 3: complex conjugate of root 2 -+ -+ if (im < EPS) { -+ _r[1] = _r[2] = re; -+ n_sol += 2; -+ } -+ } else if (dis < -EPS) { -+ // Three distinct real roots. -+ double theta = acos(-yN / sqrt(h_sq)) / 3.0; -+ double delta = sqrt(c2 * c2 - 3.0 * c3 * c1) / (3.0 * c3); -+ -+ _r[0] = xN + (2.0 * delta) * cos(theta); -+ _r[1] = xN + (2.0 * delta) * cos(M_2PI_3 - theta); -+ _r[2] = xN + (2.0 * delta) * cos(M_2PI_3 + theta); -+ n_sol = 3; - } else { -- roots.push_back(Root(-p, 2)); -+ // Three real roots (two or three equal). -+ double r = yN / (2.0 * c3); -+ double delta = cbrt(r); -+ -+ _r[0] = xN + delta; -+ _r[1] = xN + delta; -+ _r[2] = xN - 2.0 * delta; -+ n_sol = 3; - } -- } -- } - -- void cubic_roots(double c3, double c2, double c1, double c0, std::vector<Root> &roots) { -- int n_sol = 0; -- double _r[3]; -- -- if (fabs(c3) < EPS) { -- quadratic_roots(c2, c1, c0, roots); -- return; -- } -- -- if (fabs(c0) < EPS) { -- quadratic_roots(c3, c2, c1, roots); -- add_root(roots, 0.0); -- return; -- } -- -- double xN = -c2 / (3.0 * c3); -- double yN = c0 + xN * (c1 + xN * (c2 + c3 * xN)); -- -- double delta_sq = (c2 * c2 - 3.0 * c3 * c1) / (9.0 * c3 * c3); -- double h_sq = 4.0 / 9.0 * (c2 * c2 - 3.0 * c3 * c1) * (delta_sq * delta_sq); -- double dis = yN * yN - h_sq; -- -- if (dis > EPS) { -- // One real root, two complex roots. -- -- double dis_sqrt = sqrt(dis); -- double r_p = yN - dis_sqrt; -- double r_q = yN + dis_sqrt; -- double p = cbrt(fabs(r_p)/(2.0 * c3)); -- double q = cbrt(fabs(r_q)/(2.0 * c3)); -- -- if (r_p > 0.0) p = -p; -- if (r_q > 0.0) q = -q; -- -- _r[0] = xN + p + q; -- n_sol = 1; -- -- double re = xN - p * .5 - q * .5; -- double im = p * M_SQRT_3_4 - q * M_SQRT_3_4; -- -- // root 2: xN + p * exp(M_2PI_3.i) + q * exp(-M_2PI_3.i); -- // root 3: complex conjugate of root 2 -- -- if (im < EPS) { -- _r[1] = _r[2] = re; -- n_sol += 2; -+ for (int i=0; i < n_sol; i++) { -+ add_root(roots, _r[i]); - } -- } else if (dis < -EPS) { -- // Three distinct real roots. -- double theta = acos(-yN / sqrt(h_sq)) / 3.0; -- double delta = sqrt(c2 * c2 - 3.0 * c3 * c1) / (3.0 * c3); -- -- _r[0] = xN + (2.0 * delta) * cos(theta); -- _r[1] = xN + (2.0 * delta) * cos(M_2PI_3 - theta); -- _r[2] = xN + (2.0 * delta) * cos(M_2PI_3 + theta); -- n_sol = 3; -- } else { -- // Three real roots (two or three equal). -- double r = yN / (2.0 * c3); -- double delta = cbrt(r); -- -- _r[0] = xN + delta; -- _r[1] = xN + delta; -- _r[2] = xN - 2.0 * delta; -- n_sol = 3; -- } -- -- for (int i=0; i < n_sol; i++) { -- add_root(roots, _r[i]); - } - } - -diff -r e82d852e4fb0 lib/triangulator.cpp ---- a/lib/triangulator.cpp Wed Jan 15 13:16:14 2014 +1100 -+++ b/lib/triangulator.cpp Mon Jan 27 17:01:46 2014 +0600 -@@ -718,10 +718,10 @@ - - - --bool testCandidateAttachment(const std::vector<std::vector<carve::geom2d::P2> > &poly, -- std::vector<std::pair<size_t, size_t> > ¤t_f_loop, -- size_t curr, -- carve::geom2d::P2 hole_min) { -+static bool testCandidateAttachment(const std::vector<std::vector<carve::geom2d::P2> > &poly, -+ std::vector<std::pair<size_t, size_t> > ¤t_f_loop, -+ size_t curr, -+ carve::geom2d::P2 hole_min) { - const size_t SZ = current_f_loop.size(); - - if (!carve::geom2d::internalToAngle(pvert(poly, current_f_loop[(curr+1) % SZ]), diff --git a/extern/carve/patches/win32.patch b/extern/carve/patches/win32.patch deleted file mode 100644 index 680bceb2421..00000000000 --- a/extern/carve/patches/win32.patch +++ /dev/null @@ -1,37 +0,0 @@ -diff -r e82d852e4fb0 include/carve/win32.h ---- a/include/carve/win32.h Wed Jan 15 13:16:14 2014 +1100 -+++ b/include/carve/win32.h Fri Jan 31 15:32:01 2014 +0600 -@@ -32,17 +32,27 @@ - - # if _MSC_VER < 1600 - // stdint.h is not available before VS2010 --typedef char int8_t; --typedef short int16_t; --typedef long int32_t; -+#if defined(_WIN32) && !defined(__MINGW32__) -+/* The __intXX are built-in types of the visual complier! So we don't -+ need to include anything else here. -+ This typedefs should be in sync with types from MEM_sys_types.h */ - --typedef unsigned char uint8_t; --typedef unsigned short uint16_t; --typedef unsigned long uint32_t; -+typedef signed __int8 int8_t; -+typedef signed __int16 int16_t; -+typedef signed __int32 int32_t; - -+typedef unsigned __int8 uint8_t; -+typedef unsigned __int16 uint16_t; -+typedef unsigned __int32 uint32_t; -+#endif - typedef __int64 int64_t; - typedef unsigned __int64 uint64_t; - # else - # include <stdint.h> - # endif - #endif -+ -+#if defined(_MSC_VER) -+# include <BaseTsd.h> -+typedef SSIZE_T ssize_t; -+#endif |