Skip to content

Commit

Permalink
fix manifold stuff (without geometry cache changes) (openscad#4993)
Browse files Browse the repository at this point in the history
  • Loading branch information
pca006132 authored Feb 17, 2024
1 parent 55be9cf commit f568899
Show file tree
Hide file tree
Showing 9 changed files with 9 additions and 18 deletions.
1 change: 1 addition & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ option(ENABLE_TBB "Enable support for oneAPI Threading Building Blocks." ON)
option(ENABLE_CGAL "Enable CGAL." ON)
option(ALLOW_BUNDLED_HIDAPI "Allow usage of bundled HIDAPI library (Windows only)." OFF)
option(ENABLE_PYTHON "Enable experimental Python Interpreter" OFF)
option(BUILD_SHARED_LIBS "Build shared library" OFF)
include(CMakeDependentOption)
cmake_dependent_option(APPLE_UNIX "Build OpenSCAD in Unix mode in MacOS X instead of an Apple Bundle" OFF "APPLE" OFF)
cmake_dependent_option(ENABLE_QTDBUS "Enable DBus input driver for Qt5." ON "NOT HEADLESS" OFF)
Expand Down
1 change: 0 additions & 1 deletion src/geometry/GeometryEvaluator.cc
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,6 @@
#include <CGAL/Point_2.h>
#endif
#ifdef ENABLE_MANIFOLD
#include "ManifoldGeometry.h"
#include "manifoldutils.h"
#endif

Expand Down
5 changes: 2 additions & 3 deletions src/geometry/PolySetUtils.cc
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
#include "Polygon2d.h"
#include "printutils.h"
#include "GeometryUtils.h"
#include "Reindexer.h"
#ifdef ENABLE_CGAL
#include "cgalutils.h"
#include "CGALHybridPolyhedron.h"
Expand Down Expand Up @@ -160,8 +159,8 @@ std::shared_ptr<const PolySet> getGeometryAsPolySet(const std::shared_ptr<const
if (auto N = std::dynamic_pointer_cast<const CGAL_Nef_polyhedron>(geom)) {
if (!N->isEmpty()) {
if (auto ps = CGALUtils::createPolySetFromNefPolyhedron3(*N->p3)) {
ps->setConvexity(N->getConvexity());
return ps;
ps->setConvexity(N->getConvexity());
return ps;
}
LOG(message_group::Error, "Nef->PolySet failed.");
}
Expand Down
5 changes: 0 additions & 5 deletions src/geometry/boolean_utils.cc
Original file line number Diff line number Diff line change
Expand Up @@ -23,14 +23,9 @@
#include "progress.h"
#include "node.h"

#include "memory.h"
#include "Reindexer.h"
#include "GeometryUtils.h"

#include <map>
#include <queue>
#include <unordered_set>

#ifdef ENABLE_CGAL
std::unique_ptr<PolySet> applyHull(const Geometry::Geometries& children)
{
Expand Down
4 changes: 1 addition & 3 deletions src/geometry/manifold/ManifoldGeometry.cc
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
#include "PolySetUtils.h"
#include "manifoldutils.h"
#ifdef ENABLE_CGAL
#include "cgal.h"
#include "cgalutils.h"
#endif

Expand All @@ -25,14 +24,13 @@ ManifoldGeometry::ManifoldGeometry(const std::shared_ptr<manifold::Manifold>& ma
if (!manifold_) clear();
}

ManifoldGeometry::ManifoldGeometry(const ManifoldGeometry& other) : manifold_(other.manifold_) {}

std::unique_ptr<Geometry> ManifoldGeometry::copy() const
{
return std::make_unique<ManifoldGeometry>(*this);
}

ManifoldGeometry& ManifoldGeometry::operator=(const ManifoldGeometry& other) {
if (this == &other) return *this;
manifold_ = other.manifold_;
return *this;
}
Expand Down
2 changes: 1 addition & 1 deletion src/geometry/manifold/ManifoldGeometry.h
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ class ManifoldGeometry : public Geometry

ManifoldGeometry();
ManifoldGeometry(const std::shared_ptr<manifold::Manifold>& object);
ManifoldGeometry(const ManifoldGeometry& other);
ManifoldGeometry(const ManifoldGeometry& other) = default;
ManifoldGeometry& operator=(const ManifoldGeometry& other);

[[nodiscard]] bool isEmpty() const override;
Expand Down
5 changes: 3 additions & 2 deletions src/geometry/manifold/manifold-applyops-minkowski.cc
Original file line number Diff line number Diff line change
Expand Up @@ -43,9 +43,9 @@ std::shared_ptr<const Geometry> applyMinkowskiManifold(const Geometry::Geometrie
throw 0;
};

CGAL::Timer t, t_tot;
assert(children.size() >= 2);
auto it = children.begin();
CGAL::Timer t_tot;
t_tot.start();
std::vector<std::shared_ptr<const Geometry>> operands = {it->second, std::shared_ptr<const Geometry>()};

Expand Down Expand Up @@ -81,7 +81,7 @@ std::shared_ptr<const Geometry> applyMinkowskiManifold(const Geometry::Geometrie
part_points.emplace_back(getHullPoints(*poly));
} else {
Nef decomposed_nef(*poly);

CGAL::Timer t;
t.start();
CGAL::convex_decomposition_3(decomposed_nef);

Expand Down Expand Up @@ -186,6 +186,7 @@ std::shared_ptr<const Geometry> applyMinkowskiManifold(const Geometry::Geometrie

if (it != std::next(children.begin())) operands[0].reset();

CGAL::Timer t;
t.start();
PRINTDB("Minkowski: Computing union of %d parts", result_parts.size());
Geometry::Geometries fake_children;
Expand Down
2 changes: 0 additions & 2 deletions src/geometry/manifold/manifold-applyops.cc
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,6 @@
#include "progress.h"
#include "printutils.h"

#include <queue>

namespace ManifoldUtils {

Location getLocation(const std::shared_ptr<const AbstractNode>& node)
Expand Down
2 changes: 1 addition & 1 deletion submodules/manifold
Submodule manifold updated 98 files
+2 −4 .github/workflows/build_wheels.yml
+1 −1 .github/workflows/check_format.yml
+31 −8 .github/workflows/manifold.yml
+0 −3 .gitmodules
+46 −5 CMakeLists.txt
+33 −10 README.md
+12 −0 RELEASE_CHECKLIST.md
+17 −19 bindings/c/CMakeLists.txt
+6 −0 bindings/c/include/manifoldc.h
+11 −2 bindings/c/manifoldc.cpp
+21 −2 bindings/python/CMakeLists.txt
+40 −0 bindings/python/README.md
+121 −0 bindings/python/examples/all_apis.py
+24 −18 bindings/python/examples/bricks.py
+4 −4 bindings/python/examples/cube_with_dents.py
+6 −6 bindings/python/examples/extrude.py
+5 −5 bindings/python/examples/gyroid_module.py
+1 −1 bindings/python/examples/maze.py
+2 −1 bindings/python/examples/scallop.py
+2 −2 bindings/python/examples/split_cube.py
+4 −2 bindings/python/examples/sponge.py
+98 −0 bindings/python/examples/test_torus_knot.py
+1 −1 bindings/python/examples/union_failure.py
+109 −0 bindings/python/gen_docs.py
+416 −794 bindings/python/manifold3d.cpp
+1 −1 bindings/python/third_party/nanobind
+2 −0 bindings/wasm/bindings.cpp
+46 −3 bindings/wasm/examples/editor.css
+50 −9 bindings/wasm/examples/editor.js
+10 −3 bindings/wasm/examples/index.html
+2 −2 bindings/wasm/examples/make-manifold.html
+3 −2 bindings/wasm/examples/model-viewer.html
+26 −3 bindings/wasm/examples/public/editor.d.ts
+69 −60 bindings/wasm/examples/public/examples.js
+ bindings/wasm/examples/public/icons/redo.png
+ bindings/wasm/examples/public/icons/share.png
+ bindings/wasm/examples/public/icons/star.png
+ bindings/wasm/examples/public/icons/undo.png
+ bindings/wasm/examples/public/models/moon.glb
+ bindings/wasm/examples/public/models/space.glb
+3 −2 bindings/wasm/examples/worker.test.js
+136 −14 bindings/wasm/examples/worker.ts
+16 −0 bindings/wasm/manifold-encapsulated-types.d.ts
+1 −1 bindings/wasm/package.json
+2 −1 extras/CMakeLists.txt
+44 −7 flake.lock
+44 −49 flake.nix
+16 −0 format.sh
+4 −0 manifoldConfig.cmake.in
+75 −0 manifoldDeps.cmake
+5 −15 meshIO/CMakeLists.txt
+3 −9 pyproject.toml
+3 −0 pytest.ini
+6 −9 src/collider/CMakeLists.txt
+4 −0 src/collider/src/collider.cpp
+9 −20 src/cross_section/CMakeLists.txt
+3 −0 src/cross_section/include/cross_section.h
+96 −46 src/cross_section/src/cross_section.cpp
+7 −14 src/manifold/CMakeLists.txt
+23 −2 src/manifold/include/manifold.h
+49 −70 src/manifold/src/boolean3.cpp
+22 −11 src/manifold/src/boolean_result.cpp
+21 −23 src/manifold/src/constructors.cpp
+3 −0 src/manifold/src/csg_tree.cpp
+30 −20 src/manifold/src/edge_op.cpp
+115 −23 src/manifold/src/face_op.cpp
+44 −22 src/manifold/src/impl.cpp
+7 −3 src/manifold/src/impl.h
+41 −3 src/manifold/src/manifold.cpp
+4 −3 src/manifold/src/properties.cpp
+1 −1 src/manifold/src/shared.h
+2 −0 src/manifold/src/smoothing.cpp
+8 −0 src/manifold/src/sort.cpp
+8 −8 src/polygon/CMakeLists.txt
+33 −33 src/polygon/src/polygon.cpp
+6 −19 src/sdf/CMakeLists.txt
+6 −4 src/sdf/src/sdf.cpp
+6 −7 src/third_party/CMakeLists.txt
+0 −1 src/third_party/clipper2
+15 −46 src/utilities/CMakeLists.txt
+34 −15 src/utilities/include/hashtable.h
+1 −1 src/utilities/include/par.h
+3 −0 src/utilities/include/public.h
+13 −17 src/utilities/include/sparse.h
+18 −18 src/utilities/include/svd.h
+12 −46 src/utilities/include/utils.h
+24 −113 src/utilities/include/vec.h
+112 −0 src/utilities/include/vec_view.h
+23 −0 test-cmake.sh
+9 −3 test/CMakeLists.txt
+1 −1 test/boolean_test.cpp
+18 −0 test/cross_section_test.cpp
+33 −0 test/manifold_test.cpp
+ test/models/Cray_left.glb
+ test/models/Cray_right.glb
+ test/models/Generic_Twin_7081.1.t0_left.glb
+ test/models/Generic_Twin_7081.1.t0_right.glb
+61 −2 test/samples_test.cpp

0 comments on commit f568899

Please sign in to comment.