Skip to content

Commit 481186b

Browse files
authored
Remove fast-csg (openscad#5529)
1 parent 5ab27e0 commit 481186b

39 files changed

+6
-2003
lines changed

CMakeLists.txt

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -935,13 +935,9 @@ endif()
935935
set(CGAL_SOURCES
936936
src/geometry/cgal/cgalutils.cc
937937
src/geometry/cgal/cgalutils-applyops.cc
938-
src/geometry/cgal/cgalutils-applyops-hybrid.cc
939-
src/geometry/cgal/cgalutils-applyops-hybrid-minkowski.cc
940938
src/geometry/cgal/cgalutils-closed.cc
941939
src/geometry/cgal/cgalutils-convex.cc
942-
src/geometry/cgal/cgalutils-corefine.cc
943940
src/geometry/cgal/cgalutils-kernel.cc
944-
src/geometry/cgal/cgalutils-hybrid.cc
945941
src/geometry/cgal/cgalutils-mesh.cc
946942
src/geometry/cgal/cgalutils-minkowski.cc
947943
src/geometry/cgal/cgalutils-nef.cc
@@ -950,7 +946,6 @@ set(CGAL_SOURCES
950946
src/geometry/cgal/cgalutils-project.cc
951947
src/geometry/cgal/cgalutils-tess.cc
952948
src/geometry/cgal/cgalutils-triangulate.cc
953-
src/geometry/cgal/CGALHybridPolyhedron.cc
954949
src/geometry/cgal/CGAL_Nef_polyhedron.cc
955950
src/geometry/cgal/CGALCache.cc
956951
src/io/export_nef.cc

src/Feature.cc

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,9 +25,6 @@ Feature::list_t Feature::feature_list; // Double-listed values. --^
2525
* (well-defined) order of object construction, matching the order of the
2626
* const Features listed below.
2727
*/
28-
const Feature Feature::ExperimentalFastCsg("fast-csg", "Enable much faster CSG operations with corefinement instead of nef when possible.", /*hidden=*/true);
29-
const Feature Feature::ExperimentalFastCsgSafer("fast-csg-safer", "Don't use corefinement in cases it doesn't supports and risks crashing. This will fallback to slower operations on Nef polyhedra.", /*hidden=*/true);
30-
const Feature Feature::ExperimentalFastCsgDebug("fast-csg-debug", "Debug mode for fast-csg: adds logs with extra costly checks and dumps .off files with the last corefinement operands.", /*hidden=*/true);
3128
const Feature Feature::ExperimentalRoof("roof", "Enable <code>roof</code>");
3229
const Feature Feature::ExperimentalInputDriverDBus("input-driver-dbus", "Enable DBus input drivers (requires restart)");
3330
const Feature Feature::ExperimentalLazyUnion("lazy-union", "Enable lazy unions.");

src/Feature.h

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,6 @@ class Feature
1313
using list_t = std::vector<Feature *>;
1414
using iterator = list_t::iterator;
1515

16-
static const Feature ExperimentalFastCsg;
17-
static const Feature ExperimentalFastCsgSafer;
18-
static const Feature ExperimentalFastCsgDebug;
1916
static const Feature ExperimentalRoof;
2017
static const Feature ExperimentalInputDriverDBus;
2118
static const Feature ExperimentalLazyUnion;

src/RenderStatistic.cc

Lines changed: 0 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,6 @@
4343
#include "geometry/Polygon2d.h"
4444
#ifdef ENABLE_CGAL
4545
#include "geometry/cgal/CGAL_Nef_polyhedron.h"
46-
#include "geometry/cgal/CGALHybridPolyhedron.h"
4746
#include "geometry/cgal/CGALCache.h"
4847
#endif // ENABLE_CGAL
4948

@@ -83,7 +82,6 @@ struct LogVisitor : public StatisticVisitor
8382
void visit(const Polygon2d& node) override;
8483
#ifdef ENABLE_CGAL
8584
void visit(const CGAL_Nef_polyhedron& node) override;
86-
void visit(const CGALHybridPolyhedron& node) override;
8785
#endif // ENABLE_CGAL
8886
#ifdef ENABLE_MANIFOLD
8987
void visit(const ManifoldGeometry& node) override;
@@ -108,7 +106,6 @@ struct StreamVisitor : public StatisticVisitor
108106
void visit(const Polygon2d& node) override;
109107
#ifdef ENABLE_CGAL
110108
void visit(const CGAL_Nef_polyhedron& node) override;
111-
void visit(const CGALHybridPolyhedron& node) override;
112109
#endif // ENABLE_CGAL
113110
#ifdef ENABLE_MANIFOLD
114111
void visit(const ManifoldGeometry& node) override;
@@ -279,18 +276,6 @@ void LogVisitor::visit(const CGAL_Nef_polyhedron& nef)
279276
printBoundingBox3(nef.getBoundingBox());
280277
}
281278
}
282-
void LogVisitor::visit(const CGALHybridPolyhedron& poly)
283-
{
284-
bool simple = poly.isManifold();
285-
LOG(" Top level object is a 3D object (fast-csg):");
286-
LOG(" Simple: %1$s", (simple ? "yes" : "no"));
287-
LOG(" Vertices: %1$6d", poly.numVertices());
288-
LOG(" Facets: %1$6d", poly.numFacets());
289-
if (!simple) {
290-
LOG(message_group::UI_Warning, "Object may not be a valid 2-manifold and may need repair!");
291-
}
292-
printBoundingBox3(poly.getBoundingBox());
293-
}
294279
#endif // ENABLE_CGAL
295280

296281
#ifdef ENABLE_MANIFOLD
@@ -392,20 +377,6 @@ void StreamVisitor::visit(const CGAL_Nef_polyhedron& nef)
392377
json["geometry"] = geometryJson;
393378
}
394379
}
395-
void StreamVisitor::visit(const CGALHybridPolyhedron& poly)
396-
{
397-
if (is_enabled(RenderStatistic::GEOMETRY)) {
398-
nlohmann::json geometryJson;
399-
geometryJson["dimensions"] = 3;
400-
geometryJson["simple"] = poly.isManifold();
401-
geometryJson["vertices"] = poly.numVertices();
402-
geometryJson["facets"] = poly.numFacets();
403-
if (is_enabled(RenderStatistic::BOUNDING_BOX)) {
404-
geometryJson["bounding_box"] = getBoundingBox3(poly);
405-
}
406-
json["geometry"] = geometryJson;
407-
}
408-
}
409380
#endif // ENABLE_CGAL
410381

411382
#ifdef ENABLE_MANIFOLD

src/geometry/Geometry.h

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@
1111

1212
class AbstractNode;
1313
class CGAL_Nef_polyhedron;
14-
class CGALHybridPolyhedron;
1514
class GeometryList;
1615
class GeometryVisitor;
1716
class Polygon2d;
@@ -65,7 +64,6 @@ class GeometryVisitor
6564
virtual void visit(const Polygon2d& node) = 0;
6665
#ifdef ENABLE_CGAL
6766
virtual void visit(const CGAL_Nef_polyhedron& node) = 0;
68-
virtual void visit(const CGALHybridPolyhedron& node) = 0;
6967
#endif
7068
#ifdef ENABLE_MANIFOLD
7169
virtual void visit(const ManifoldGeometry& node) = 0;

src/geometry/GeometryEvaluator.cc

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,6 @@
3838
#include "geometry/boolean_utils.h"
3939
#ifdef ENABLE_CGAL
4040
#include "geometry/cgal/CGALCache.h"
41-
#include "geometry/cgal/CGALHybridPolyhedron.h"
4241
#include "geometry/cgal/cgalutils.h"
4342
#include <CGAL/convex_hull_2.h>
4443
#include <CGAL/Point_2.h>
@@ -63,7 +62,7 @@ GeometryEvaluator::GeometryEvaluator(const Tree& tree) : tree(tree) { }
6362
There are some guarantees on the returned geometry:
6463
* 2D and 3D geometry cannot be mixed; we will return either _only_ 2D or _only_ 3D geometries
6564
* PolySet geometries are always 3D. 2D Polysets are only created for special-purpose rendering operations downstream from here.
66-
* Needs validation: Implementation-specific geometries shouldn't be mixed (Nef polyhedron, Manifold, CGAL Hybrid polyhedrons)
65+
* Needs validation: Implementation-specific geometries shouldn't be mixed (Nef polyhedron, Manifold)
6766
*/
6867
std::shared_ptr<const Geometry> GeometryEvaluator::evaluateGeometry(const AbstractNode& node,
6968
bool allownef)
@@ -169,9 +168,6 @@ GeometryEvaluator::ResultObject GeometryEvaluator::applyToChildren3D(const Abstr
169168
}
170169
#endif
171170
#ifdef ENABLE_CGAL
172-
else if (Feature::ExperimentalFastCsg.is_enabled()) {
173-
return ResultObject::mutableResult(std::shared_ptr<Geometry>(CGALUtils::applyUnion3DHybrid(actualchildren.begin(), actualchildren.end())));
174-
}
175171
return ResultObject::constResult(std::shared_ptr<const Geometry>(CGALUtils::applyUnion3D(actualchildren.begin(), actualchildren.end())));
176172
#else
177173
assert(false && "No boolean backend available");
@@ -186,10 +182,6 @@ GeometryEvaluator::ResultObject GeometryEvaluator::applyToChildren3D(const Abstr
186182
}
187183
#endif
188184
#ifdef ENABLE_CGAL
189-
if (Feature::ExperimentalFastCsg.is_enabled()) {
190-
// FIXME: It's annoying to have to disambiguate here:
191-
return ResultObject::mutableResult(std::shared_ptr<Geometry>(CGALUtils::applyOperator3DHybrid(children, op)));
192-
}
193185
return ResultObject::constResult(CGALUtils::applyOperator3D(children, op));
194186
#else
195187
assert(false && "No boolean backend available");

src/geometry/GeometryUtils.cc

Lines changed: 5 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@
2121

2222
#ifdef ENABLE_CGAL
2323
#include "geometry/cgal/cgalutils.h"
24-
#include "geometry/cgal/CGALHybridPolyhedron.h"
2524
#endif
2625

2726
#ifdef ENABLE_MANIFOLD
@@ -536,22 +535,12 @@ std::shared_ptr<const Geometry> GeometryUtils::getBackendSpecificGeometry(const
536535
}
537536
#endif
538537
#if ENABLE_CGAL
539-
if (Feature::ExperimentalFastCsg.is_enabled()) {
540-
if (auto ps = std::dynamic_pointer_cast<const PolySet>(geom)) {
541-
return CGALUtils::createHybridPolyhedronFromPolySet(*ps);
542-
} else if (auto poly = std::dynamic_pointer_cast<const CGALHybridPolyhedron>(geom)) {
543-
return geom;
544-
} else {
545-
assert(false && "Unexpected geometry");
546-
}
538+
if (auto ps = std::dynamic_pointer_cast<const PolySet>(geom)) {
539+
return CGALUtils::createNefPolyhedronFromPolySet(*ps);
540+
} else if (auto poly = std::dynamic_pointer_cast<const CGAL_Nef_polyhedron>(geom)) {
541+
return geom;
547542
} else {
548-
if (auto ps = std::dynamic_pointer_cast<const PolySet>(geom)) {
549-
return CGALUtils::createNefPolyhedronFromPolySet(*ps);
550-
} else if (auto poly = std::dynamic_pointer_cast<const CGAL_Nef_polyhedron>(geom)) {
551-
return geom;
552-
} else {
553-
assert(false && "Unexpected geometry");
554-
}
543+
assert(false && "Unexpected geometry");
555544
}
556545
#endif
557546
return nullptr;

src/geometry/PolySetBuilder.cc

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,6 @@
3131
#ifdef ENABLE_CGAL
3232
#include "geometry/cgal/cgalutils.h"
3333
#include "geometry/cgal/CGAL_Nef_polyhedron.h"
34-
#include "geometry/cgal/CGALHybridPolyhedron.h"
3534
#endif
3635
#ifdef ENABLE_MANIFOLD
3736
#include "geometry/manifold/ManifoldGeometry.h"
@@ -89,9 +88,6 @@ void PolySetBuilder::appendGeometry(const std::shared_ptr<const Geometry>& geom)
8988
else {
9089
LOG(message_group::Error, "Nef->PolySet failed");
9190
}
92-
} else if (const auto hybrid = std::dynamic_pointer_cast<const CGALHybridPolyhedron>(geom)) {
93-
// TODO(ochafik): Implement appendGeometry(Surface_mesh) instead of converting to PolySet
94-
appendPolySet(*hybrid->toPolySet());
9591
#endif // ifdef ENABLE_CGAL
9692
#ifdef ENABLE_MANIFOLD
9793
} else if (const auto mani = std::dynamic_pointer_cast<const ManifoldGeometry>(geom)) {

src/geometry/PolySetUtils.cc

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@
1616
#include "geometry/GeometryUtils.h"
1717
#ifdef ENABLE_CGAL
1818
#include "geometry/cgal/cgalutils.h"
19-
#include "geometry/cgal/CGALHybridPolyhedron.h"
2019
#endif
2120
#ifdef ENABLE_MANIFOLD
2221
#include "geometry/manifold/ManifoldGeometry.h"
@@ -194,9 +193,6 @@ std::shared_ptr<const PolySet> getGeometryAsPolySet(const std::shared_ptr<const
194193
}
195194
return PolySet::createEmpty();
196195
}
197-
if (auto hybrid = std::dynamic_pointer_cast<const CGALHybridPolyhedron>(geom)) {
198-
return hybrid->toPolySet();
199-
}
200196
#endif
201197
#ifdef ENABLE_MANIFOLD
202198
if (auto mani = std::dynamic_pointer_cast<const ManifoldGeometry>(geom)) {

src/geometry/boolean_utils.cc

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@
1010

1111
#ifdef ENABLE_CGAL
1212
#include "geometry/cgal/cgal.h"
13-
#include "geometry/cgal/CGALHybridPolyhedron.h"
1413
#include "geometry/cgal/CGAL_Nef_polyhedron.h"
1514
#include <CGAL/Exact_predicates_inexact_constructions_kernel.h>
1615
#include <CGAL/normal_vector_newell_3.h>
@@ -60,12 +59,6 @@ std::unique_ptr<PolySet> applyHull(const Geometry::Geometries& children)
6059
addPoint(CGALUtils::vector_convert<K::Point_3>(i->point()));
6160
}
6261
}
63-
} else if (const auto *hybrid = dynamic_cast<const CGALHybridPolyhedron*>(chgeom.get())) {
64-
addCapacity(hybrid->numVertices());
65-
hybrid->foreachVertexUntilTrue([&](auto& p) {
66-
addPoint(CGALUtils::vector_convert<K::Point_3>(p));
67-
return false;
68-
});
6962
#endif // ENABLE_CGAL
7063
#ifdef ENABLE_MANIFOLD
7164
} else if (const auto *mani = dynamic_cast<const ManifoldGeometry*>(chgeom.get())) {
@@ -119,9 +112,6 @@ std::shared_ptr<const Geometry> applyMinkowski(const Geometry::Geometries& child
119112
return ManifoldUtils::applyMinkowskiManifold(children);
120113
}
121114
#endif // ENABLE_MANIFOLD
122-
if (Feature::ExperimentalFastCsg.is_enabled()) {
123-
return CGALUtils::applyMinkowskiHybrid(children);
124-
}
125115
CGAL::Timer t, t_tot;
126116
assert(children.size() >= 2);
127117
auto it = children.begin();

0 commit comments

Comments
 (0)