Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/prusa3d/PrusaSlicer.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authortamasmeszaros <meszaros.q@gmail.com>2019-10-25 14:09:25 +0300
committertamasmeszaros <meszaros.q@gmail.com>2019-10-25 14:15:21 +0300
commit4554da29abc153c48284235ed73f2aa7d4eefc8e (patch)
treef10ab9acc594d933a0278429dccf4c6a9ea44b62 /sandboxes
parenta7c843d2132c39fe699423af1a4fe44a86e4ff8d (diff)
Add OpenVDB to dependencies
* Add Linux openvdb integration * Add Mac openvdb integration and enable in ALL * Create openvdb sandbox to test integration. * Additional fixes in the patches * Remove slabasebed sandbox as it has no relevance now * Provide FindOpenVDB module and fix build issues
Diffstat (limited to 'sandboxes')
-rw-r--r--sandboxes/CMakeLists.txt2
-rw-r--r--sandboxes/openvdb/CMakeLists.txt2
-rw-r--r--sandboxes/openvdb/openvdb_example.cpp37
-rw-r--r--sandboxes/slabasebed/CMakeLists.txt2
-rw-r--r--sandboxes/slabasebed/slabasebed.cpp85
5 files changed, 40 insertions, 88 deletions
diff --git a/sandboxes/CMakeLists.txt b/sandboxes/CMakeLists.txt
index 5905c438e..3372698c3 100644
--- a/sandboxes/CMakeLists.txt
+++ b/sandboxes/CMakeLists.txt
@@ -1,2 +1,2 @@
-add_subdirectory(slabasebed)
add_subdirectory(slasupporttree)
+add_subdirectory(openvdb)
diff --git a/sandboxes/openvdb/CMakeLists.txt b/sandboxes/openvdb/CMakeLists.txt
new file mode 100644
index 000000000..184452e83
--- /dev/null
+++ b/sandboxes/openvdb/CMakeLists.txt
@@ -0,0 +1,2 @@
+add_executable(openvdb_example openvdb_example.cpp)
+target_link_libraries(openvdb_example libslic3r)
diff --git a/sandboxes/openvdb/openvdb_example.cpp b/sandboxes/openvdb/openvdb_example.cpp
new file mode 100644
index 000000000..0df60d8aa
--- /dev/null
+++ b/sandboxes/openvdb/openvdb_example.cpp
@@ -0,0 +1,37 @@
+#include <openvdb/openvdb.h>
+#include <iostream>
+
+int main()
+{
+ // Initialize the OpenVDB library. This must be called at least
+ // once per program and may safely be called multiple times.
+ openvdb::initialize();
+ // Create an empty floating-point grid with background value 0.
+ openvdb::FloatGrid::Ptr grid = openvdb::FloatGrid::create();
+ std::cout << "Testing random access:" << std::endl;
+ // Get an accessor for coordinate-based access to voxels.
+ openvdb::FloatGrid::Accessor accessor = grid->getAccessor();
+ // Define a coordinate with large signed indices.
+ openvdb::Coord xyz(1000, -200000000, 30000000);
+ // Set the voxel value at (1000, -200000000, 30000000) to 1.
+ accessor.setValue(xyz, 1.0);
+ // Verify that the voxel value at (1000, -200000000, 30000000) is 1.
+ std::cout << "Grid" << xyz << " = " << accessor.getValue(xyz) << std::endl;
+ // Reset the coordinates to those of a different voxel.
+ xyz.reset(1000, 200000000, -30000000);
+ // Verify that the voxel value at (1000, 200000000, -30000000) is
+ // the background value, 0.
+ std::cout << "Grid" << xyz << " = " << accessor.getValue(xyz) << std::endl;
+ // Set the voxel value at (1000, 200000000, -30000000) to 2.
+ accessor.setValue(xyz, 2.0);
+ // Set the voxels at the two extremes of the available coordinate space.
+ // For 32-bit signed coordinates these are (-2147483648, -2147483648, -2147483648)
+ // and (2147483647, 2147483647, 2147483647).
+ accessor.setValue(openvdb::Coord::min(), 3.0f);
+ accessor.setValue(openvdb::Coord::max(), 4.0f);
+ std::cout << "Testing sequential access:" << std::endl;
+ // Print all active ("on") voxels by means of an iterator.
+ for (openvdb::FloatGrid::ValueOnCIter iter = grid->cbeginValueOn(); iter; ++iter) {
+ std::cout << "Grid" << iter.getCoord() << " = " << *iter << std::endl;
+ }
+}
diff --git a/sandboxes/slabasebed/CMakeLists.txt b/sandboxes/slabasebed/CMakeLists.txt
deleted file mode 100644
index 9d731a133..000000000
--- a/sandboxes/slabasebed/CMakeLists.txt
+++ /dev/null
@@ -1,2 +0,0 @@
-add_executable(slabasebed EXCLUDE_FROM_ALL slabasebed.cpp)
-target_link_libraries(slabasebed libslic3r ${Boost_LIBRARIES} ${TBB_LIBRARIES} ${Boost_LIBRARIES} ${CMAKE_DL_LIBS})
diff --git a/sandboxes/slabasebed/slabasebed.cpp b/sandboxes/slabasebed/slabasebed.cpp
deleted file mode 100644
index 1996a1eb8..000000000
--- a/sandboxes/slabasebed/slabasebed.cpp
+++ /dev/null
@@ -1,85 +0,0 @@
-#include <iostream>
-#include <fstream>
-#include <string>
-
-#include <libslic3r/libslic3r.h>
-#include <libslic3r/TriangleMesh.hpp>
-#include <libslic3r/Tesselate.hpp>
-#include <libslic3r/ClipperUtils.hpp>
-#include <libslic3r/SLA/SLABasePool.hpp>
-#include <libslic3r/SLA/SLABoilerPlate.hpp>
-#include <libnest2d/tools/benchmark.h>
-
-const std::string USAGE_STR = {
- "Usage: slabasebed stlfilename.stl"
-};
-
-namespace Slic3r { namespace sla {
-
-Contour3D create_pad(const Polygons &ground_layer,
- const ExPolygons &holes = {},
- const PadConfig& cfg = PadConfig());
-
-Contour3D walls(const Polygon& floor_plate, const Polygon& ceiling,
- double floor_z_mm, double ceiling_z_mm,
- double offset_difference_mm, ThrowOnCancel thr);
-
-void offset(ExPolygon& sh, coord_t distance);
-
-}
-}
-
-int main(const int argc, const char *argv[]) {
- using namespace Slic3r;
- using std::cout; using std::endl;
-
- if(argc < 2) {
- cout << USAGE_STR << endl;
- return EXIT_SUCCESS;
- }
-
- TriangleMesh model;
- Benchmark bench;
-
- model.ReadSTLFile(argv[1]);
- model.align_to_origin();
-
- ExPolygons ground_slice;
- sla::pad_plate(model, ground_slice, 0.1f);
- if(ground_slice.empty()) return EXIT_FAILURE;
-
- ground_slice = offset_ex(ground_slice, 0.5);
- ExPolygon gndfirst; gndfirst = ground_slice.front();
- sla::breakstick_holes(gndfirst, 0.5, 10, 0.3);
-
- sla::Contour3D mesh;
-
- bench.start();
-
- sla::PadConfig cfg;
- cfg.min_wall_height_mm = 0;
- cfg.edge_radius_mm = 0;
- mesh = sla::create_pad(to_polygons(ground_slice), {}, cfg);
-
- bench.stop();
-
- cout << "Base pool creation time: " << std::setprecision(10)
- << bench.getElapsedSec() << " seconds." << endl;
-
- for(auto& trind : mesh.indices) {
- Vec3d p0 = mesh.points[size_t(trind[0])];
- Vec3d p1 = mesh.points[size_t(trind[1])];
- Vec3d p2 = mesh.points[size_t(trind[2])];
- Vec3d p01 = p1 - p0;
- Vec3d p02 = p2 - p0;
- auto a = p01.cross(p02).norm() / 2.0;
- if(std::abs(a) < 1e-6) std::cout << "degenerate triangle" << std::endl;
- }
-
- // basepool.write_ascii("out.stl");
-
- std::fstream outstream("out.obj", std::fstream::out);
- mesh.to_obj(outstream);
-
- return EXIT_SUCCESS;
-}