[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [43295] branches/carve_booleans: Carve booleans: update to most recent version of Carve from mercurial

Sergey Sharybin sergey.vfx at gmail.com
Wed Jan 11 15:43:23 CET 2012


Revision: 43295
          http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=43295
Author:   nazgul
Date:     2012-01-11 14:43:20 +0000 (Wed, 11 Jan 2012)
Log Message:
-----------
Carve booleans: update to most recent version of Carve from mercurial

- Updated bundled version of Carve library
- Updated patches applying on Carve to make it compiling nicely
- Switched CarveInterface to half-edge data structures

Modified Paths:
--------------
    branches/carve_booleans/extern/carve/CMakeLists.txt
    branches/carve_booleans/extern/carve/SConscript
    branches/carve_booleans/extern/carve/bundle.sh
    branches/carve_booleans/extern/carve/files.txt
    branches/carve_booleans/extern/carve/include/carve/aabb.hpp
    branches/carve_booleans/extern/carve/include/carve/aabb_impl.hpp
    branches/carve_booleans/extern/carve/include/carve/carve.hpp
    branches/carve_booleans/extern/carve/include/carve/classification.hpp
    branches/carve_booleans/extern/carve/include/carve/collection/unordered/fallback_impl.hpp
    branches/carve_booleans/extern/carve/include/carve/collection/unordered/libstdcpp_impl.hpp
    branches/carve_booleans/extern/carve/include/carve/collection/unordered/tr1_impl.hpp
    branches/carve_booleans/extern/carve/include/carve/collection/unordered/vcpp_impl.hpp
    branches/carve_booleans/extern/carve/include/carve/collection_types.hpp
    branches/carve_booleans/extern/carve/include/carve/config.h
    branches/carve_booleans/extern/carve/include/carve/csg.hpp
    branches/carve_booleans/extern/carve/include/carve/csg_triangulator.hpp
    branches/carve_booleans/extern/carve/include/carve/debug_hooks.hpp
    branches/carve_booleans/extern/carve/include/carve/exact.hpp
    branches/carve_booleans/extern/carve/include/carve/faceloop.hpp
    branches/carve_booleans/extern/carve/include/carve/geom.hpp
    branches/carve_booleans/extern/carve/include/carve/interpolator.hpp
    branches/carve_booleans/extern/carve/include/carve/intersection.hpp
    branches/carve_booleans/extern/carve/include/carve/iobj.hpp
    branches/carve_booleans/extern/carve/include/carve/matrix.hpp
    branches/carve_booleans/extern/carve/include/carve/mesh.hpp
    branches/carve_booleans/extern/carve/include/carve/mesh_impl.hpp
    branches/carve_booleans/extern/carve/include/carve/mesh_simplify.hpp
    branches/carve_booleans/extern/carve/include/carve/polyhedron_decl.hpp
    branches/carve_booleans/extern/carve/include/carve/rtree.hpp
    branches/carve_booleans/extern/carve/include/carve/tree.hpp
    branches/carve_booleans/extern/carve/include/carve/triangulator_impl.hpp
    branches/carve_booleans/extern/carve/include/carve/vcpp_config.h
    branches/carve_booleans/extern/carve/include/carve/win32.h
    branches/carve_booleans/extern/carve/lib/csg.cpp
    branches/carve_booleans/extern/carve/lib/csg_collector.cpp
    branches/carve_booleans/extern/carve/lib/csg_collector.hpp
    branches/carve_booleans/extern/carve/lib/csg_data.hpp
    branches/carve_booleans/extern/carve/lib/csg_detail.hpp
    branches/carve_booleans/extern/carve/lib/intersect.cpp
    branches/carve_booleans/extern/carve/lib/intersect_classify_common_impl.hpp
    branches/carve_booleans/extern/carve/lib/intersect_classify_edge.cpp
    branches/carve_booleans/extern/carve/lib/intersect_classify_group.cpp
    branches/carve_booleans/extern/carve/lib/intersect_common.hpp
    branches/carve_booleans/extern/carve/lib/intersect_face_division.cpp
    branches/carve_booleans/extern/carve/lib/intersect_group.cpp
    branches/carve_booleans/extern/carve/lib/intersect_half_classify_group.cpp
    branches/carve_booleans/extern/carve/lib/intersection.cpp
    branches/carve_booleans/extern/carve/lib/math.cpp
    branches/carve_booleans/extern/carve/lib/mesh.cpp
    branches/carve_booleans/extern/carve/lib/polyhedron.cpp
    branches/carve_booleans/extern/carve/patches/series
    branches/carve_booleans/intern/boolop/SConscript
    branches/carve_booleans/intern/boolop/intern/BOP_CarveInterface.cpp

Added Paths:
-----------
    branches/carve_booleans/extern/carve/include/carve/external/
    branches/carve_booleans/extern/carve/include/carve/external/boost/
    branches/carve_booleans/extern/carve/include/carve/external/boost/random.hpp
    branches/carve_booleans/extern/carve/patches/files/
    branches/carve_booleans/extern/carve/patches/files/config.h
    branches/carve_booleans/extern/carve/patches/files/random.hpp
    branches/carve_booleans/extern/carve/patches/includes.patch
    branches/carve_booleans/extern/carve/patches/strict_flags.patch

Removed Paths:
-------------
    branches/carve_booleans/extern/carve/include/carve/boost/random.hpp
    branches/carve_booleans/extern/carve/patches/boost.patch
    branches/carve_booleans/extern/carve/patches/collections.patch
    branches/carve_booleans/extern/carve/patches/config.patch
    branches/carve_booleans/extern/carve/patches/warning_fix.patch
    branches/carve_booleans/extern/carve/patches/win32.patch

Modified: branches/carve_booleans/extern/carve/CMakeLists.txt
===================================================================
--- branches/carve_booleans/extern/carve/CMakeLists.txt	2012-01-11 14:23:54 UTC (rev 43294)
+++ branches/carve_booleans/extern/carve/CMakeLists.txt	2012-01-11 14:43:20 UTC (rev 43295)
@@ -1,4 +1,3 @@
-# $Id$
 # ***** BEGIN GPL LICENSE BLOCK *****
 #
 # This program is free software; you can redistribute it and/or
@@ -24,6 +23,10 @@
 #
 # ***** END GPL LICENSE BLOCK *****
 
+# NOTE: This file is automatically generated by bundle.sh script
+#       If you're doing changes in this file, please update template
+#       in that script too
+
 set(INC
 	include
 )
@@ -93,7 +96,6 @@
 	include/carve/rtree.hpp
 	include/carve/math.hpp
 	include/carve/math_constants.hpp
-	include/carve/boost/random.hpp
 	include/carve/octree_decl.hpp
 	include/carve/input.hpp
 	include/carve/mesh_ops.hpp
@@ -118,7 +120,6 @@
 	include/carve/matrix.hpp
 	include/carve/poly.hpp
 	include/carve/vector.hpp
-	include/carve/config.h
 	include/carve/intersection.hpp
 	include/carve/faceloop.hpp
 	include/carve/geom_impl.hpp

Modified: branches/carve_booleans/extern/carve/SConscript
===================================================================
--- branches/carve_booleans/extern/carve/SConscript	2012-01-11 14:23:54 UTC (rev 43294)
+++ branches/carve_booleans/extern/carve/SConscript	2012-01-11 14:43:20 UTC (rev 43295)
@@ -1,4 +1,9 @@
 #!/usr/bin/python
+
+# NOTE: This file is automatically generated by bundle.sh script
+#       If you're doing changes in this file, please update template
+#       in that script too
+
 Import ('env')
 
 sources = env.Glob('lib/*.cpp')

Modified: branches/carve_booleans/extern/carve/bundle.sh
===================================================================
--- branches/carve_booleans/extern/carve/bundle.sh	2012-01-11 14:23:54 UTC (rev 43294)
+++ branches/carve_booleans/extern/carve/bundle.sh	2012-01-11 14:43:20 UTC (rev 43295)
@@ -1,5 +1,10 @@
 #!/bin/sh
 
+if [ -d ./.svn ]; then
+  echo "This script is supposed to work only when using git-svn"
+  exit 1
+fi
+
 tmp=`mktemp -d`
 
 hg clone https://code.google.com/p/carve/ $tmp/carve
@@ -23,8 +28,11 @@
 headers=`find ./lib -type f -iname '*.h' -or -iname '*.hpp' | sed -r 's/^\.\//\t/'`
 includes=`find ./include -type f -iname '*.h' -or -iname '*.hpp' | sed -r 's/^\.\//\t/'`
 
+mkdir -p include/carve/external/boost
+cp patches/files/random.hpp include/carve/external/boost/random.hpp
+cp patches/files/config.h include/carve/config.h
+
 cat > CMakeLists.txt << EOF
-# \$Id\$
 # ***** BEGIN GPL LICENSE BLOCK *****
 #
 # This program is free software; you can redistribute it and/or
@@ -50,6 +58,10 @@
 #
 # ***** END GPL LICENSE BLOCK *****
 
+# NOTE: This file is automatically generated by bundle.sh script
+#       If you're doing changes in this file, please update template
+#       in that script too
+
 set(INC
 	include
 )
@@ -65,17 +77,38 @@
 ${includes}
 )
 
+if(WITH_BOOST)
+	add_definitions(
+		-DHAVE_BOOST_UNORDERED_COLLECTIONS
+		-DCARVE_SYSTEM_BOOST
+	)
+
+	list(APPEND INC
+		\${BOOST_INCLUDE_DIR}
+	)
+endif()
+
 blender_add_lib(extern_carve "\${SRC}" "\${INC}" "\${INC_SYS}")
 EOF
 
 cat > SConscript << EOF
 #!/usr/bin/python
+
+# NOTE: This file is automatically generated by bundle.sh script
+#       If you're doing changes in this file, please update template
+#       in that script too
+
 Import ('env')
 
 sources = env.Glob('lib/*.cpp')
 
-defs = ''
-incs = 'include'
+defs = []
+incs = ['include']
 
-env.BlenderLib ('extern_carve', Split(sources), Split(incs), Split(defs), libtype=['extern'], priority=[40] )
+if env['WITH_BF_BOOST']:
+    defs.append('HAVE_BOOST_UNORDERED_COLLECTIONS')
+    defs.append('CARVE_SYSTEM_BOOST')
+    incs.append(env['BF_BOOST_INC'])
+
+env.BlenderLib ('extern_carve', Split(sources), incs, defs, libtype=['extern'], priority=[40] )
 EOF

Modified: branches/carve_booleans/extern/carve/files.txt
===================================================================
--- branches/carve_booleans/extern/carve/files.txt	2012-01-11 14:23:54 UTC (rev 43294)
+++ branches/carve_booleans/extern/carve/files.txt	2012-01-11 14:43:20 UTC (rev 43295)
@@ -24,7 +24,6 @@
 include/carve/rtree.hpp
 include/carve/math.hpp
 include/carve/math_constants.hpp
-include/carve/boost/random.hpp
 include/carve/octree_decl.hpp
 include/carve/input.hpp
 include/carve/mesh_ops.hpp
@@ -49,7 +48,6 @@
 include/carve/matrix.hpp
 include/carve/poly.hpp
 include/carve/vector.hpp
-include/carve/config.h
 include/carve/intersection.hpp
 include/carve/faceloop.hpp
 include/carve/geom_impl.hpp

Modified: branches/carve_booleans/extern/carve/include/carve/aabb.hpp
===================================================================
--- branches/carve_booleans/extern/carve/include/carve/aabb.hpp	2012-01-11 14:23:54 UTC (rev 43294)
+++ branches/carve_booleans/extern/carve/include/carve/aabb.hpp	2012-01-11 14:43:20 UTC (rev 43295)
@@ -69,6 +69,10 @@
 
       bool intersectsLineSegment(const vector_t &v1, const vector_t &v2) const;
 
+      double axisSeparation(const aabb<ndim> &other, unsigned axis) const;
+
+      double maxAxisSeparation(const aabb<ndim> &other) const;
+
       bool intersects(const aabb<ndim> &other) const;
       bool intersects(const sphere<ndim> &s) const;
       bool intersects(const plane<ndim> &plane) const;
@@ -76,6 +80,8 @@
       bool intersects(tri<ndim> tri) const;
       bool intersects(const linesegment<ndim> &ls) const;
 
+      std::pair<double, double> rangeInDirection(const carve::geom::vector<ndim> &v) const;
+
       vector_t min() const;
       vector_t mid() const;
       vector_t max() const;

Modified: branches/carve_booleans/extern/carve/include/carve/aabb_impl.hpp
===================================================================
--- branches/carve_booleans/extern/carve/include/carve/aabb_impl.hpp	2012-01-11 14:23:54 UTC (rev 43294)
+++ branches/carve_booleans/extern/carve/include/carve/aabb_impl.hpp	2012-01-11 14:43:20 UTC (rev 43295)
@@ -175,12 +175,23 @@
     }
 
     template<unsigned ndim>
-    bool aabb<ndim>::intersects(const aabb<ndim> &other) const {
-      for (unsigned i = 0; i < ndim; ++i) {
-        if (fabs(other.pos.v[i] - pos.v[i]) > (extent.v[i] + other.extent.v[i])) return false;
+    double aabb<ndim>::axisSeparation(const aabb<ndim> &other, unsigned axis) const {
+      return fabs(other.pos.v[axis] - pos.v[axis]) - extent.v[axis] - other.extent.v[axis];
+    }
+
+    template<unsigned ndim>
+    double aabb<ndim>::maxAxisSeparation(const aabb<ndim> &other) const {
+      double m = axisSeparation(other, 0);
+      for (unsigned i = 1; i < ndim; ++i) {
+        m = std::max(m, axisSeparation(other, i));
       }
-      return true;
+      return m;
     }
+
+    template<unsigned ndim>
+    bool aabb<ndim>::intersects(const aabb<ndim> &other) const {
+      return maxAxisSeparation(other) <= 0.0;
+    }
  
     template<unsigned ndim>
     bool aabb<ndim>::intersects(const sphere<ndim> &s) const {
@@ -204,6 +215,14 @@
     }
 
     template<unsigned ndim>
+    std::pair<double, double> aabb<ndim>::rangeInDirection(const carve::geom::vector<ndim> &v) const {
+      double d1 = dot(v, pos);
+      double d2 = dot(abs(v), extent);
+
+      return std::make_pair(d1 - d2, d1 + d2);
+    }
+
+    template<unsigned ndim>
     typename aabb<ndim>::vector_t aabb<ndim>::min() const { return pos - extent; }
 
     template<unsigned ndim>

Deleted: branches/carve_booleans/extern/carve/include/carve/boost/random.hpp
===================================================================
--- branches/carve_booleans/extern/carve/include/carve/boost/random.hpp	2012-01-11 14:23:54 UTC (rev 43294)
+++ branches/carve_booleans/extern/carve/include/carve/boost/random.hpp	2012-01-11 14:43:20 UTC (rev 43295)
@@ -1,773 +0,0 @@
-#pragma once
-
-#include <iostream>
-#include <vector>
-#include <limits>
-#include <stdexcept>
-#include <cmath>
-#include <algorithm>
-
-#if !defined(_MSC_VER)
-#include <stdint.h>
-#endif
-
-namespace boost {
-
-// type_traits could help here, but I don't want to depend on type_traits.
-template<class T>
-struct ptr_helper
-{
-  typedef T value_type;
-  typedef T& reference_type;
-  typedef const T& rvalue_type;
-  static reference_type ref(T& r) { return r; }
-  static const T& ref(const T& r) { return r; }
-};
-
-template<class T>
-struct ptr_helper<T&>
-{
-  typedef T value_type;
-  typedef T& reference_type;
-  typedef T& rvalue_type;
-  static reference_type ref(T& r) { return r; }
-  static const T& ref(const T& r) { return r; }
-};
-
-template<class T>
-struct ptr_helper<T*>
-{
-  typedef T value_type;
-  typedef T& reference_type;
-  typedef T* rvalue_type;
-  static reference_type ref(T * p) { return *p; }
-  static const T& ref(const T * p) { return *p; }
-};
-
-template<class UniformRandomNumberGenerator>
-class pass_through_engine
-{
-private:
-  typedef ptr_helper<UniformRandomNumberGenerator> helper_type;
-
-public:
-  typedef typename helper_type::value_type base_type;
-  typedef typename base_type::result_type result_type;
-
-  explicit pass_through_engine(UniformRandomNumberGenerator rng)
-    // make argument an rvalue to avoid matching Generator& constructor
-    : _rng(static_cast<typename helper_type::rvalue_type>(rng))
-  { }
-
-  result_type min () const { return (base().min)(); }
-  result_type max () const { return (base().max)(); }
-  base_type& base() { return helper_type::ref(_rng); }
-  const base_type& base() const { return helper_type::ref(_rng); }
-
-  result_type operator()() { return base()(); }
-
-private:
-  UniformRandomNumberGenerator _rng;
-};
-
-template<class RealType>
-class new_uniform_01
-{
-public:
-  typedef RealType input_type;
-  typedef RealType result_type;
-  // compiler-generated copy ctor and copy assignment are fine
-  result_type min () const { return result_type(0); }
-  result_type max () const { return result_type(1); }
-  void reset() { }
-
-  template<class Engine>
-  result_type operator()(Engine& eng) {
-    for (;;) {
-      typedef typename Engine::result_type base_result;
-      result_type factor = result_type(1) /
-              (result_type((eng.max)()-(eng.min)()) +
-               result_type(std::numeric_limits<base_result>::is_integer ? 1 : 0));
-      result_type result = result_type(eng() - (eng.min)()) * factor;
-      if (result < result_type(1))
-        return result;
-    }
-  }
-
-  template<class CharT, class Traits>
-  friend std::basic_ostream<CharT,Traits>&

@@ Diff output truncated at 10240 characters. @@


More information about the Bf-blender-cvs mailing list