Merge branch 'lm_hollow_gizmo' into lm_tm_hollowing
This commit is contained in:
commit
eaf815ca4b
@ -403,8 +403,10 @@ if(SLIC3R_STATIC)
|
||||
set(USE_BLOSC TRUE)
|
||||
endif()
|
||||
|
||||
#find_package(OpenVDB 5.0 COMPONENTS openvdb)
|
||||
#slic3r_remap_configs(IlmBase::Half RelWithDebInfo Release)
|
||||
find_package(OpenVDB 5.0 COMPONENTS openvdb)
|
||||
if(OpenVDB_FOUND)
|
||||
slic3r_remap_configs(IlmBase::Half RelWithDebInfo Release)
|
||||
endif()
|
||||
|
||||
# libslic3r, PrusaSlicer GUI and the PrusaSlicer executable.
|
||||
add_subdirectory(src)
|
||||
|
@ -108,6 +108,18 @@ if(POLICY CMP0074)
|
||||
cmake_policy(SET CMP0074 NEW)
|
||||
endif()
|
||||
|
||||
if(OpenVDB_FIND_QUIETLY)
|
||||
set (_quiet "QUIET")
|
||||
else()
|
||||
set (_quiet "")
|
||||
endif()
|
||||
|
||||
if(OpenVDB_FIND_REQUIRED)
|
||||
set (_required "REQUIRED")
|
||||
else()
|
||||
set (_required "")
|
||||
endif()
|
||||
|
||||
# Include utility functions for version information
|
||||
include(${CMAKE_CURRENT_LIST_DIR}/OpenVDBUtils.cmake)
|
||||
|
||||
@ -146,7 +158,7 @@ set(_OPENVDB_ROOT_SEARCH_DIR "")
|
||||
|
||||
# Additionally try and use pkconfig to find OpenVDB
|
||||
|
||||
find_package(PkgConfig)
|
||||
find_package(PkgConfig ${_quiet} ${_required})
|
||||
pkg_check_modules(PC_OpenVDB QUIET OpenVDB)
|
||||
|
||||
# ------------------------------------------------------------------------
|
||||
@ -250,7 +262,7 @@ OPENVDB_ABI_VERSION_FROM_PRINT(
|
||||
ABI OpenVDB_ABI
|
||||
)
|
||||
|
||||
if(NOT OpenVDB_FIND_QUIET)
|
||||
if(NOT OpenVDB_FIND_QUIETLY)
|
||||
if(NOT OpenVDB_ABI)
|
||||
message(WARNING "Unable to determine OpenVDB ABI version from OpenVDB "
|
||||
"installation. The library major version \"${OpenVDB_MAJOR_VERSION}\" "
|
||||
@ -268,7 +280,17 @@ endif()
|
||||
|
||||
# Add standard dependencies
|
||||
|
||||
find_package(IlmBase COMPONENTS Half)
|
||||
macro(just_fail msg)
|
||||
set(OpenVDB_FOUND FALSE)
|
||||
if(OpenVDB_FIND_REQUIRED)
|
||||
message(FATAL_ERROR msg)
|
||||
elseif(NOT OpenVDB_FIND_QUIETLY)
|
||||
message(ERROR msg)
|
||||
endif()
|
||||
return()
|
||||
endmacro()
|
||||
|
||||
find_package(IlmBase QUIET COMPONENTS Half)
|
||||
if(NOT IlmBase_FOUND)
|
||||
pkg_check_modules(IlmBase QUIET IlmBase)
|
||||
endif()
|
||||
@ -276,20 +298,20 @@ if (IlmBase_FOUND AND NOT TARGET IlmBase::Half)
|
||||
message(STATUS "Falling back to IlmBase found by pkg-config...")
|
||||
|
||||
find_library(IlmHalf_LIBRARY NAMES Half)
|
||||
if(IlmHalf_LIBRARY-NOTFOUND)
|
||||
message(FATAL_ERROR "IlmBase::Half can not be found!")
|
||||
if(IlmHalf_LIBRARY-NOTFOUND OR NOT IlmBase_INCLUDE_DIRS)
|
||||
just_fail("IlmBase::Half can not be found!")
|
||||
endif()
|
||||
|
||||
add_library(IlmBase::Half UNKNOWN IMPORTED)
|
||||
set_target_properties(IlmBase::Half PROPERTIES
|
||||
IMPORTED_LOCATION "${IlmHalf_LIBRARY}"
|
||||
INTERFACE_INCLUDE_DIRECTORIES ${IlmBase_INCLUDE_DIRS})
|
||||
INTERFACE_INCLUDE_DIRECTORIES "${IlmBase_INCLUDE_DIRS}")
|
||||
elseif(NOT IlmBase_FOUND)
|
||||
message(FATAL_ERROR "IlmBase::Half can not be found!")
|
||||
just_fail("IlmBase::Half can not be found!")
|
||||
endif()
|
||||
find_package(TBB REQUIRED COMPONENTS tbb)
|
||||
find_package(ZLIB REQUIRED)
|
||||
find_package(Boost REQUIRED COMPONENTS iostreams system)
|
||||
find_package(TBB ${_quiet} ${_required} COMPONENTS tbb)
|
||||
find_package(ZLIB ${_quiet} ${_required})
|
||||
find_package(Boost ${_quiet} ${_required} COMPONENTS iostreams system )
|
||||
|
||||
# Use GetPrerequisites to see which libraries this OpenVDB lib has linked to
|
||||
# which we can query for optional deps. This basically runs ldd/otoll/objdump
|
||||
@ -350,7 +372,7 @@ unset(_OPENVDB_PREREQUISITE_LIST)
|
||||
unset(_HAS_DEP)
|
||||
|
||||
if(OpenVDB_USES_BLOSC)
|
||||
find_package(Blosc )
|
||||
find_package(Blosc QUIET)
|
||||
if(NOT Blosc_FOUND OR NOT TARGET Blosc::blosc)
|
||||
message(STATUS "find_package could not find Blosc. Using fallback blosc search...")
|
||||
find_path(Blosc_INCLUDE_DIR blosc.h)
|
||||
@ -362,25 +384,25 @@ if(OpenVDB_USES_BLOSC)
|
||||
IMPORTED_LOCATION "${Blosc_LIBRARY}"
|
||||
INTERFACE_INCLUDE_DIRECTORIES ${Blosc_INCLUDE_DIR})
|
||||
elseif()
|
||||
message(FATAL_ERROR "Blosc library can not be found!")
|
||||
just_fail("Blosc library can not be found!")
|
||||
endif()
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if(OpenVDB_USES_LOG4CPLUS)
|
||||
find_package(Log4cplus REQUIRED)
|
||||
find_package(Log4cplus ${_quiet} ${_required})
|
||||
endif()
|
||||
|
||||
if(OpenVDB_USES_ILM)
|
||||
find_package(IlmBase REQUIRED)
|
||||
find_package(IlmBase ${_quiet} ${_required})
|
||||
endif()
|
||||
|
||||
if(OpenVDB_USES_EXR)
|
||||
find_package(OpenEXR REQUIRED)
|
||||
find_package(OpenEXR ${_quiet} ${_required})
|
||||
endif()
|
||||
|
||||
if(UNIX)
|
||||
find_package(Threads REQUIRED)
|
||||
find_package(Threads ${_quiet} ${_required})
|
||||
endif()
|
||||
|
||||
# Set deps. Note that the order here is important. If we're building against
|
||||
@ -481,7 +503,7 @@ foreach(COMPONENT ${OpenVDB_FIND_COMPONENTS})
|
||||
endif()
|
||||
endforeach()
|
||||
|
||||
if(OpenVDB_FOUND AND NOT ${CMAKE_FIND_PACKAGE_NAME}_FIND_QUIETLY)
|
||||
if(OpenVDB_FOUND AND NOT OpenVDB_FIND_QUIETLY)
|
||||
message(STATUS "OpenVDB libraries: ${OpenVDB_LIBRARIES}")
|
||||
endif()
|
||||
|
||||
|
@ -125,7 +125,9 @@ function(OPENVDB_ABI_VERSION_FROM_PRINT OPENVDB_PRINT)
|
||||
cmake_parse_arguments(_VDB "QUIET" "ABI" "" ${ARGN})
|
||||
|
||||
if(NOT EXISTS ${OPENVDB_PRINT})
|
||||
message(WARNING "vdb_print not found! ${OPENVDB_PRINT}")
|
||||
if(NOT OpenVDB_FIND_QUIETLY)
|
||||
message(WARNING "vdb_print not found! ${OPENVDB_PRINT}")
|
||||
endif()
|
||||
return()
|
||||
endif()
|
||||
|
||||
@ -148,7 +150,9 @@ function(OPENVDB_ABI_VERSION_FROM_PRINT OPENVDB_PRINT)
|
||||
endif()
|
||||
|
||||
if(${_VDB_PRINT_RETURN_STATUS})
|
||||
message(WARNING "vdb_print returned with status ${_VDB_PRINT_RETURN_STATUS}")
|
||||
if(NOT OpenVDB_FIND_QUIETLY)
|
||||
message(WARNING "vdb_print returned with status ${_VDB_PRINT_RETURN_STATUS}")
|
||||
endif()
|
||||
return()
|
||||
endif()
|
||||
|
||||
|
42
resources/icons/hollow.svg
Normal file
42
resources/icons/hollow.svg
Normal file
@ -0,0 +1,42 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!-- Generator: Adobe Illustrator 23.0.2, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
|
||||
<svg version="1.0" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
|
||||
viewBox="0 0 128 128" enable-background="new 0 0 128 128" xml:space="preserve">
|
||||
<g id="SLA_supports">
|
||||
<g>
|
||||
<path fill="#FFFFFF" d="M117.02,121.54H11.12c-1.93,0-3.5-1.57-3.5-3.5v-3.99c0-1.93,1.57-3.5,3.5-3.5h105.9
|
||||
c1.93,0,3.5,1.57,3.5,3.5v3.99C120.52,119.97,118.95,121.54,117.02,121.54z M11.12,113.55c-0.27,0-0.5,0.23-0.5,0.5v3.99
|
||||
c0,0.27,0.23,0.5,0.5,0.5h105.9c0.27,0,0.5-0.23,0.5-0.5v-3.99c0-0.27-0.23-0.5-0.5-0.5H11.12z"/>
|
||||
</g>
|
||||
<g>
|
||||
<path fill="#ED6B21" d="M32.08,108.06c-0.83,0-1.5-0.67-1.5-1.5v-18.8c0-0.83,0.67-1.5,1.5-1.5s1.5,0.67,1.5,1.5v18.8
|
||||
C33.58,107.39,32.9,108.06,32.08,108.06z"/>
|
||||
</g>
|
||||
<g>
|
||||
<path fill="#ED6B21" d="M48.02,108.06c-0.83,0-1.5-0.67-1.5-1.5v-8.14c0-0.83,0.67-1.5,1.5-1.5s1.5,0.67,1.5,1.5v8.14
|
||||
C49.52,107.39,48.85,108.06,48.02,108.06z"/>
|
||||
</g>
|
||||
<g>
|
||||
<path fill="#ED6B21" d="M88.04,108.06c-0.83,0-1.5-0.67-1.5-1.5V93.09c0-0.83,0.67-1.5,1.5-1.5s1.5,0.67,1.5,1.5v13.47
|
||||
C89.54,107.39,88.87,108.06,88.04,108.06z"/>
|
||||
</g>
|
||||
<path fill="#FFFFFF" d="M70.36,95.12l-6.29,4.2l-14.45-9.63l-2.5,2.6l15.96,10.64c0.3,0.2,0.64,0.3,0.99,0.3s0.69-0.1,0.99-0.3
|
||||
l7.9-5.27L70.36,95.12z"/>
|
||||
<polygon fill="#FFFFFF" points="88.97,86.99 86.35,84.46 77.91,90.09 80.5,92.63 "/>
|
||||
<path fill="#FFFFFF" d="M103.99,35.1L65.05,9.14c-0.6-0.4-1.37-0.4-1.97,0L24.14,35.1c-0.49,0.33-0.79,0.88-0.79,1.48v38.91
|
||||
c0,0.59,0.3,1.15,0.79,1.48l15.47,10.32l2.5-2.6L26.9,74.54V37.53l37.16-24.78l37.16,24.78v37.01l-7.32,4.88l2.61,2.53l7.46-4.98
|
||||
c0.49-0.33,0.79-0.88,0.79-1.48V36.58C104.78,35.99,104.49,35.43,103.99,35.1z"/>
|
||||
<g>
|
||||
<path fill="#ED6B21" d="M96.16,108.06c-0.83,0-1.5-0.67-1.5-1.5V87.93L79,73.22c-0.6-0.57-0.63-1.52-0.07-2.12
|
||||
c0.57-0.6,1.52-0.63,2.12-0.07l16.13,15.15c0.3,0.28,0.47,0.68,0.47,1.09v19.27C97.66,107.39,96.99,108.06,96.16,108.06z"/>
|
||||
</g>
|
||||
<g>
|
||||
<path fill="#ED6B21" d="M40.08,108.06c-0.83,0-1.5-0.67-1.5-1.5V93.29c0-0.39,0.15-0.76,0.41-1.04l16.13-16.91
|
||||
c0.57-0.6,1.52-0.62,2.12-0.05c0.6,0.57,0.62,1.52,0.05,2.12L41.58,93.89v12.67C41.58,107.39,40.91,108.06,40.08,108.06z"/>
|
||||
</g>
|
||||
<g>
|
||||
<path fill="#ED6B21" d="M80.13,108.06c-0.83,0-1.5-0.67-1.5-1.5v-7.65L62.94,83.19c-0.59-0.59-0.58-1.54,0-2.12
|
||||
c0.59-0.58,1.54-0.59,2.12,0l16.13,16.15c0.28,0.28,0.44,0.66,0.44,1.06v8.27C81.63,107.39,80.96,108.06,80.13,108.06z"/>
|
||||
</g>
|
||||
</g>
|
||||
</svg>
|
After Width: | Height: | Size: 2.5 KiB |
@ -1,2 +1,7 @@
|
||||
add_executable(openvdb_example openvdb_example.cpp)
|
||||
target_link_libraries(openvdb_example libslic3r)
|
||||
if(TARGET OpenVDB::openvdb)
|
||||
add_executable(openvdb_example openvdb_example.cpp)
|
||||
|
||||
target_link_libraries(openvdb_example libslic3r)
|
||||
target_link_libraries(openvdb_example OpenVDB::openvdb)
|
||||
endif()
|
||||
|
||||
|
@ -9,6 +9,11 @@ if (MINGW)
|
||||
add_compile_options(-Wa,-mbig-obj)
|
||||
endif ()
|
||||
|
||||
set(OpenVDBUtils_SOURCES "")
|
||||
if (TARGET OpenVDB::openvdb)
|
||||
set(OpenVDBUtils_SOURCES OpenVDBUtils.cpp OpenVDBUtils.hpp)
|
||||
endif()
|
||||
|
||||
add_library(libslic3r STATIC
|
||||
pchheader.cpp
|
||||
pchheader.hpp
|
||||
@ -176,7 +181,9 @@ add_library(libslic3r STATIC
|
||||
MinAreaBoundingBox.cpp
|
||||
miniz_extension.hpp
|
||||
miniz_extension.cpp
|
||||
${OpenVDBUtils_SOURCES}
|
||||
SLA/SLACommon.hpp
|
||||
SLA/SLACommon.cpp
|
||||
SLA/SLABoilerPlate.hpp
|
||||
SLA/SLAPad.hpp
|
||||
SLA/SLAPad.cpp
|
||||
@ -224,10 +231,13 @@ target_link_libraries(libslic3r
|
||||
qhull
|
||||
semver
|
||||
TBB::tbb
|
||||
# OpenVDB::openvdb
|
||||
${CMAKE_DL_LIBS}
|
||||
)
|
||||
|
||||
if (TARGET OpenVDB::openvdb)
|
||||
target_link_libraries(libslic3r OpenVDB::openvdb)
|
||||
endif()
|
||||
|
||||
if(WIN32)
|
||||
target_link_libraries(libslic3r Psapi.lib)
|
||||
endif()
|
||||
|
@ -355,6 +355,35 @@ bool objparse(const char *path, ObjData &data)
|
||||
return true;
|
||||
}
|
||||
|
||||
bool objparse(std::istream &stream, ObjData &data)
|
||||
{
|
||||
try {
|
||||
char buf[65536 * 2];
|
||||
size_t len = 0;
|
||||
size_t lenPrev = 0;
|
||||
while ((len = size_t(stream.read(buf + lenPrev, 65536).gcount())) != 0) {
|
||||
len += lenPrev;
|
||||
size_t lastLine = 0;
|
||||
for (size_t i = 0; i < len; ++ i)
|
||||
if (buf[i] == '\r' || buf[i] == '\n') {
|
||||
buf[i] = 0;
|
||||
char *c = buf + lastLine;
|
||||
while (*c == ' ' || *c == '\t')
|
||||
++ c;
|
||||
obj_parseline(c, data);
|
||||
lastLine = i + 1;
|
||||
}
|
||||
lenPrev = len - lastLine;
|
||||
memmove(buf, buf + lastLine, lenPrev);
|
||||
}
|
||||
}
|
||||
catch (std::bad_alloc&) {
|
||||
printf("Out of memory\r\n");
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
bool savevector(FILE *pFile, const std::vector<T> &v)
|
||||
{
|
||||
|
@ -3,6 +3,7 @@
|
||||
|
||||
#include <string>
|
||||
#include <vector>
|
||||
#include <istream>
|
||||
|
||||
namespace ObjParser {
|
||||
|
||||
@ -97,6 +98,7 @@ struct ObjData {
|
||||
};
|
||||
|
||||
extern bool objparse(const char *path, ObjData &data);
|
||||
extern bool objparse(std::istream &stream, ObjData &data);
|
||||
|
||||
extern bool objbinsave(const char *path, const ObjData &data);
|
||||
|
||||
|
121
src/libslic3r/OpenVDBUtils.cpp
Normal file
121
src/libslic3r/OpenVDBUtils.cpp
Normal file
@ -0,0 +1,121 @@
|
||||
#define NOMINMAX
|
||||
#include "OpenVDBUtils.hpp"
|
||||
#include <openvdb/tools/MeshToVolume.h>
|
||||
#include <openvdb/tools/VolumeToMesh.h>
|
||||
|
||||
namespace Slic3r {
|
||||
|
||||
class TriangleMeshDataAdapter {
|
||||
public:
|
||||
const TriangleMesh &mesh;
|
||||
|
||||
size_t polygonCount() const { return mesh.its.indices.size(); }
|
||||
size_t pointCount() const { return mesh.its.vertices.size(); }
|
||||
size_t vertexCount(size_t) const { return 3; }
|
||||
|
||||
// Return position pos in local grid index space for polygon n and vertex v
|
||||
void getIndexSpacePoint(size_t n, size_t v, openvdb::Vec3d& pos) const;
|
||||
};
|
||||
|
||||
class Contour3DDataAdapter {
|
||||
public:
|
||||
const sla::Contour3D &mesh;
|
||||
|
||||
size_t polygonCount() const { return mesh.faces3.size() + mesh.faces4.size(); }
|
||||
size_t pointCount() const { return mesh.points.size(); }
|
||||
size_t vertexCount(size_t n) const { return n < mesh.faces3.size() ? 3 : 4; }
|
||||
|
||||
// Return position pos in local grid index space for polygon n and vertex v
|
||||
void getIndexSpacePoint(size_t n, size_t v, openvdb::Vec3d& pos) const;
|
||||
};
|
||||
|
||||
void TriangleMeshDataAdapter::getIndexSpacePoint(size_t n,
|
||||
size_t v,
|
||||
openvdb::Vec3d &pos) const
|
||||
{
|
||||
auto vidx = size_t(mesh.its.indices[n](Eigen::Index(v)));
|
||||
Slic3r::Vec3d p = mesh.its.vertices[vidx].cast<double>();
|
||||
pos = {p.x(), p.y(), p.z()};
|
||||
}
|
||||
|
||||
void Contour3DDataAdapter::getIndexSpacePoint(size_t n,
|
||||
size_t v,
|
||||
openvdb::Vec3d &pos) const
|
||||
{
|
||||
size_t vidx = 0;
|
||||
if (n < mesh.faces3.size()) vidx = size_t(mesh.faces3[n](Eigen::Index(v)));
|
||||
else vidx = size_t(mesh.faces4[n - mesh.faces3.size()](Eigen::Index(v)));
|
||||
|
||||
Slic3r::Vec3d p = mesh.points[vidx];
|
||||
pos = {p.x(), p.y(), p.z()};
|
||||
}
|
||||
|
||||
openvdb::FloatGrid::Ptr meshToVolume(const TriangleMesh &mesh,
|
||||
float exteriorBandWidth,
|
||||
float interiorBandWidth,
|
||||
int flags,
|
||||
const openvdb::math::Transform &tr)
|
||||
{
|
||||
openvdb::initialize();
|
||||
return openvdb::tools::meshToVolume<openvdb::FloatGrid>(
|
||||
TriangleMeshDataAdapter{mesh}, tr, exteriorBandWidth,
|
||||
interiorBandWidth, flags);
|
||||
}
|
||||
|
||||
// TODO: Do I need to call initialize? Seems to work without it as well but the
|
||||
// docs say it should be called ones. It does a mutex lock-unlock sequence all
|
||||
// even if was called previously.
|
||||
|
||||
openvdb::FloatGrid::Ptr meshToVolume(const sla::Contour3D & mesh,
|
||||
float exteriorBandWidth,
|
||||
float interiorBandWidth,
|
||||
int flags,
|
||||
const openvdb::math::Transform &tr)
|
||||
{
|
||||
openvdb::initialize();
|
||||
return openvdb::tools::meshToVolume<openvdb::FloatGrid>(
|
||||
Contour3DDataAdapter{mesh}, tr, exteriorBandWidth, interiorBandWidth,
|
||||
flags);
|
||||
}
|
||||
|
||||
inline Vec3f to_vec3f(const openvdb::Vec3s &v) { return Vec3f{v.x(), v.y(), v.z()}; }
|
||||
inline Vec3d to_vec3d(const openvdb::Vec3s &v) { return to_vec3f(v).cast<double>(); }
|
||||
inline Vec3i to_vec3i(const openvdb::Vec3I &v) { return Vec3i{int(v[0]), int(v[1]), int(v[2])}; }
|
||||
inline Vec4i to_vec4i(const openvdb::Vec4I &v) { return Vec4i{int(v[0]), int(v[1]), int(v[2]), int(v[3])}; }
|
||||
|
||||
template<class Grid>
|
||||
sla::Contour3D _volumeToMesh(const Grid &grid,
|
||||
double isovalue,
|
||||
double adaptivity,
|
||||
bool relaxDisorientedTriangles)
|
||||
{
|
||||
openvdb::initialize();
|
||||
|
||||
std::vector<openvdb::Vec3s> points;
|
||||
std::vector<openvdb::Vec3I> triangles;
|
||||
std::vector<openvdb::Vec4I> quads;
|
||||
|
||||
openvdb::tools::volumeToMesh(grid, points, triangles, quads, isovalue,
|
||||
adaptivity, relaxDisorientedTriangles);
|
||||
|
||||
sla::Contour3D ret;
|
||||
ret.points.reserve(points.size());
|
||||
ret.faces3.reserve(triangles.size());
|
||||
ret.faces4.reserve(quads.size());
|
||||
|
||||
for (auto &v : points) ret.points.emplace_back(to_vec3d(v));
|
||||
for (auto &v : triangles) ret.faces3.emplace_back(to_vec3i(v));
|
||||
for (auto &v : quads) ret.faces4.emplace_back(to_vec4i(v));
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
sla::Contour3D volumeToMesh(const openvdb::FloatGrid &grid,
|
||||
double isovalue,
|
||||
double adaptivity,
|
||||
bool relaxDisorientedTriangles)
|
||||
{
|
||||
return _volumeToMesh(grid, isovalue, adaptivity, relaxDisorientedTriangles);
|
||||
}
|
||||
|
||||
} // namespace Slic3r
|
29
src/libslic3r/OpenVDBUtils.hpp
Normal file
29
src/libslic3r/OpenVDBUtils.hpp
Normal file
@ -0,0 +1,29 @@
|
||||
#ifndef OPENVDBUTILS_HPP
|
||||
#define OPENVDBUTILS_HPP
|
||||
|
||||
#include <libslic3r/TriangleMesh.hpp>
|
||||
#include <libslic3r/SLA/SLABoilerPlate.hpp>
|
||||
#include <openvdb/openvdb.h>
|
||||
|
||||
namespace Slic3r {
|
||||
|
||||
openvdb::FloatGrid::Ptr meshToVolume(const TriangleMesh &mesh,
|
||||
float exteriorBandWidth = 3.0f,
|
||||
float interiorBandWidth = 3.0f,
|
||||
int flags = 0,
|
||||
const openvdb::math::Transform &tr = {});
|
||||
|
||||
openvdb::FloatGrid::Ptr meshToVolume(const sla::Contour3D &mesh,
|
||||
float exteriorBandWidth = 3.0f,
|
||||
float interiorBandWidth = 3.0f,
|
||||
int flags = 0,
|
||||
const openvdb::math::Transform &tr = {});
|
||||
|
||||
sla::Contour3D volumeToMesh(const openvdb::FloatGrid &grid,
|
||||
double isovalue = 0.0,
|
||||
double adaptivity = 0.0,
|
||||
bool relaxDisorientedTriangles = true);
|
||||
|
||||
} // namespace Slic3r
|
||||
|
||||
#endif // OPENVDBUTILS_HPP
|
@ -12,91 +12,11 @@
|
||||
#include "SLASpatIndex.hpp"
|
||||
|
||||
namespace Slic3r {
|
||||
|
||||
typedef Eigen::Matrix<int, 4, 1, Eigen::DontAlign> Vec4i;
|
||||
|
||||
namespace sla {
|
||||
|
||||
/// Intermediate struct for a 3D mesh
|
||||
struct Contour3D {
|
||||
Pointf3s points;
|
||||
std::vector<Vec3i> indices;
|
||||
|
||||
Contour3D& merge(const Contour3D& ctr)
|
||||
{
|
||||
auto s3 = coord_t(points.size());
|
||||
auto s = indices.size();
|
||||
|
||||
points.insert(points.end(), ctr.points.begin(), ctr.points.end());
|
||||
indices.insert(indices.end(), ctr.indices.begin(), ctr.indices.end());
|
||||
|
||||
for(size_t n = s; n < indices.size(); n++) {
|
||||
auto& idx = indices[n]; idx.x() += s3; idx.y() += s3; idx.z() += s3;
|
||||
}
|
||||
|
||||
return *this;
|
||||
}
|
||||
|
||||
Contour3D& merge(const Pointf3s& triangles)
|
||||
{
|
||||
const size_t offs = points.size();
|
||||
points.insert(points.end(), triangles.begin(), triangles.end());
|
||||
indices.reserve(indices.size() + points.size() / 3);
|
||||
|
||||
for(int i = int(offs); i < int(points.size()); i += 3)
|
||||
indices.emplace_back(i, i + 1, i + 2);
|
||||
|
||||
return *this;
|
||||
}
|
||||
|
||||
// Write the index triangle structure to OBJ file for debugging purposes.
|
||||
void to_obj(std::ostream& stream)
|
||||
{
|
||||
for(auto& p : points) {
|
||||
stream << "v " << p.transpose() << "\n";
|
||||
}
|
||||
|
||||
for(auto& f : indices) {
|
||||
stream << "f " << (f + Vec3i(1, 1, 1)).transpose() << "\n";
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
using ClusterEl = std::vector<unsigned>;
|
||||
using ClusteredPoints = std::vector<ClusterEl>;
|
||||
|
||||
// Clustering a set of points by the given distance.
|
||||
ClusteredPoints cluster(const std::vector<unsigned>& indices,
|
||||
std::function<Vec3d(unsigned)> pointfn,
|
||||
double dist,
|
||||
unsigned max_points);
|
||||
|
||||
ClusteredPoints cluster(const PointSet& points,
|
||||
double dist,
|
||||
unsigned max_points);
|
||||
|
||||
ClusteredPoints cluster(
|
||||
const std::vector<unsigned>& indices,
|
||||
std::function<Vec3d(unsigned)> pointfn,
|
||||
std::function<bool(const PointIndexEl&, const PointIndexEl&)> predicate,
|
||||
unsigned max_points);
|
||||
|
||||
|
||||
// Calculate the normals for the selected points (from 'points' set) on the
|
||||
// mesh. This will call squared distance for each point.
|
||||
PointSet normals(const PointSet& points,
|
||||
const EigenMesh3D& mesh,
|
||||
double eps = 0.05, // min distance from edges
|
||||
std::function<void()> throw_on_cancel = [](){},
|
||||
const std::vector<unsigned>& selected_points = {});
|
||||
|
||||
/// Mesh from an existing contour.
|
||||
inline TriangleMesh mesh(const Contour3D& ctour) {
|
||||
return {ctour.points, ctour.indices};
|
||||
}
|
||||
|
||||
/// Mesh from an evaporating 3D contour
|
||||
inline TriangleMesh mesh(Contour3D&& ctour) {
|
||||
return {std::move(ctour.points), std::move(ctour.indices)};
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
147
src/libslic3r/SLA/SLACommon.cpp
Normal file
147
src/libslic3r/SLA/SLACommon.cpp
Normal file
@ -0,0 +1,147 @@
|
||||
#include "SLACommon.hpp"
|
||||
#include <libslic3r/Format/objparser.hpp>
|
||||
|
||||
namespace Slic3r { namespace sla {
|
||||
|
||||
Contour3D::Contour3D(const TriangleMesh &trmesh)
|
||||
{
|
||||
points.reserve(trmesh.its.vertices.size());
|
||||
faces3.reserve(trmesh.its.indices.size());
|
||||
|
||||
for (auto &v : trmesh.its.vertices)
|
||||
points.emplace_back(v.cast<double>());
|
||||
|
||||
std::copy(trmesh.its.indices.begin(), trmesh.its.indices.end(),
|
||||
std::back_inserter(faces3));
|
||||
}
|
||||
|
||||
Contour3D::Contour3D(TriangleMesh &&trmesh)
|
||||
{
|
||||
points.reserve(trmesh.its.vertices.size());
|
||||
|
||||
for (auto &v : trmesh.its.vertices)
|
||||
points.emplace_back(v.cast<double>());
|
||||
|
||||
faces3.swap(trmesh.its.indices);
|
||||
}
|
||||
|
||||
Contour3D::Contour3D(const EigenMesh3D &emesh) {
|
||||
points.reserve(size_t(emesh.V().rows()));
|
||||
faces3.reserve(size_t(emesh.F().rows()));
|
||||
|
||||
for (int r = 0; r < emesh.V().rows(); r++)
|
||||
points.emplace_back(emesh.V().row(r).cast<double>());
|
||||
|
||||
for (int i = 0; i < emesh.F().rows(); i++)
|
||||
faces3.emplace_back(emesh.F().row(i));
|
||||
}
|
||||
|
||||
Contour3D &Contour3D::merge(const Contour3D &ctr)
|
||||
{
|
||||
auto N = coord_t(points.size());
|
||||
auto N_f3 = faces3.size();
|
||||
auto N_f4 = faces4.size();
|
||||
|
||||
points.insert(points.end(), ctr.points.begin(), ctr.points.end());
|
||||
faces3.insert(faces3.end(), ctr.faces3.begin(), ctr.faces3.end());
|
||||
faces4.insert(faces4.end(), ctr.faces4.begin(), ctr.faces4.end());
|
||||
|
||||
for(size_t n = N_f3; n < faces3.size(); n++) {
|
||||
auto& idx = faces3[n]; idx.x() += N; idx.y() += N; idx.z() += N;
|
||||
}
|
||||
|
||||
for(size_t n = N_f4; n < faces4.size(); n++) {
|
||||
auto& idx = faces4[n]; for (int k = 0; k < 4; k++) idx(k) += N;
|
||||
}
|
||||
|
||||
return *this;
|
||||
}
|
||||
|
||||
Contour3D &Contour3D::merge(const Pointf3s &triangles)
|
||||
{
|
||||
const size_t offs = points.size();
|
||||
points.insert(points.end(), triangles.begin(), triangles.end());
|
||||
faces3.reserve(faces3.size() + points.size() / 3);
|
||||
|
||||
for(int i = int(offs); i < int(points.size()); i += 3)
|
||||
faces3.emplace_back(i, i + 1, i + 2);
|
||||
|
||||
return *this;
|
||||
}
|
||||
|
||||
void Contour3D::to_obj(std::ostream &stream)
|
||||
{
|
||||
for(auto& p : points)
|
||||
stream << "v " << p.transpose() << "\n";
|
||||
|
||||
for(auto& f : faces3)
|
||||
stream << "f " << (f + Vec3i(1, 1, 1)).transpose() << "\n";
|
||||
|
||||
for(auto& f : faces4)
|
||||
stream << "f " << (f + Vec4i(1, 1, 1, 1)).transpose() << "\n";
|
||||
}
|
||||
|
||||
void Contour3D::from_obj(std::istream &stream)
|
||||
{
|
||||
ObjParser::ObjData data;
|
||||
ObjParser::objparse(stream, data);
|
||||
|
||||
points.reserve(data.coordinates.size() / 4 + 1);
|
||||
auto &coords = data.coordinates;
|
||||
for (size_t i = 0; i < coords.size(); i += 4)
|
||||
points.emplace_back(coords[i], coords[i + 1], coords[i + 2]);
|
||||
|
||||
Vec3i triangle;
|
||||
Vec4i quad;
|
||||
size_t v = 0;
|
||||
while(v < data.vertices.size()) {
|
||||
size_t N = 0;
|
||||
size_t i = v;
|
||||
while (data.vertices[v++].coordIdx != -1) ++N;
|
||||
|
||||
std::function<void(int, int)> setfn;
|
||||
if (N < 3 || N > 4) continue;
|
||||
else if (N == 3) setfn = [&triangle](int k, int f) { triangle(k) = f; };
|
||||
else setfn = [&quad](int k, int f) { quad(k) = f; };
|
||||
|
||||
for (size_t j = 0; j < N; ++j)
|
||||
setfn(int(j), data.vertices[i + j].coordIdx);
|
||||
}
|
||||
}
|
||||
|
||||
TriangleMesh to_triangle_mesh(const Contour3D &ctour) {
|
||||
if (ctour.faces4.empty()) return {ctour.points, ctour.faces3};
|
||||
|
||||
std::vector<Vec3i> triangles;
|
||||
|
||||
triangles.reserve(ctour.faces3.size() + 2 * ctour.faces4.size());
|
||||
std::copy(ctour.faces3.begin(), ctour.faces3.end(),
|
||||
std::back_inserter(triangles));
|
||||
|
||||
for (auto &quad : ctour.faces4) {
|
||||
triangles.emplace_back(quad(0), quad(1), quad(2));
|
||||
triangles.emplace_back(quad(2), quad(3), quad(0));
|
||||
}
|
||||
|
||||
return {ctour.points, std::move(triangles)};
|
||||
}
|
||||
|
||||
TriangleMesh to_triangle_mesh(Contour3D &&ctour) {
|
||||
if (ctour.faces4.empty())
|
||||
return {std::move(ctour.points), std::move(ctour.faces3)};
|
||||
|
||||
std::vector<Vec3i> triangles;
|
||||
|
||||
triangles.reserve(ctour.faces3.size() + 2 * ctour.faces4.size());
|
||||
std::copy(ctour.faces3.begin(), ctour.faces3.end(),
|
||||
std::back_inserter(triangles));
|
||||
|
||||
for (auto &quad : ctour.faces4) {
|
||||
triangles.emplace_back(quad(0), quad(1), quad(2));
|
||||
triangles.emplace_back(quad(2), quad(3), quad(0));
|
||||
}
|
||||
|
||||
return {std::move(ctour.points), std::move(triangles)};
|
||||
}
|
||||
|
||||
}} // namespace Slic3r::sla
|
@ -5,6 +5,11 @@
|
||||
#include <vector>
|
||||
#include <Eigen/Geometry>
|
||||
|
||||
#include "SLASpatIndex.hpp"
|
||||
|
||||
#include <libslic3r/ExPolygon.hpp>
|
||||
#include <libslic3r/TriangleMesh.hpp>
|
||||
|
||||
// #define SLIC3R_SLA_NEEDS_WINDTREE
|
||||
|
||||
namespace Slic3r {
|
||||
@ -12,8 +17,7 @@ namespace Slic3r {
|
||||
// Typedefs from Point.hpp
|
||||
typedef Eigen::Matrix<float, 3, 1, Eigen::DontAlign> Vec3f;
|
||||
typedef Eigen::Matrix<double, 3, 1, Eigen::DontAlign> Vec3d;
|
||||
|
||||
class TriangleMesh;
|
||||
typedef Eigen::Matrix<int, 4, 1, Eigen::DontAlign> Vec4i;
|
||||
|
||||
namespace sla {
|
||||
|
||||
@ -59,9 +63,11 @@ struct SupportPoint
|
||||
|
||||
bool operator==(const SupportPoint &sp) const
|
||||
{
|
||||
return (pos == sp.pos) && head_front_radius == sp.head_front_radius &&
|
||||
float rdiff = std::abs(head_front_radius - sp.head_front_radius);
|
||||
return (pos == sp.pos) && rdiff < float(EPSILON) &&
|
||||
is_new_island == sp.is_new_island;
|
||||
}
|
||||
|
||||
bool operator!=(const SupportPoint &sp) const { return !(sp == (*this)); }
|
||||
|
||||
template<class Archive> void serialize(Archive &ar)
|
||||
@ -72,8 +78,11 @@ struct SupportPoint
|
||||
|
||||
using SupportPoints = std::vector<SupportPoint>;
|
||||
|
||||
struct Contour3D;
|
||||
|
||||
/// An index-triangle structure for libIGL functions. Also serves as an
|
||||
/// alternative (raw) input format for the SLASupportTree
|
||||
/// alternative (raw) input format for the SLASupportTree.
|
||||
// Implemented in SLASupportTreeIGL.cpp
|
||||
class EigenMesh3D {
|
||||
class AABBImpl;
|
||||
|
||||
@ -86,6 +95,7 @@ public:
|
||||
|
||||
EigenMesh3D(const TriangleMesh&);
|
||||
EigenMesh3D(const EigenMesh3D& other);
|
||||
EigenMesh3D(const Contour3D &other);
|
||||
EigenMesh3D& operator=(const EigenMesh3D&);
|
||||
|
||||
~EigenMesh3D();
|
||||
@ -180,6 +190,63 @@ public:
|
||||
|
||||
using PointSet = Eigen::MatrixXd;
|
||||
|
||||
|
||||
/// Dumb vertex mesh consisting of triangles (or) quads. Capable of merging with
|
||||
/// other meshes of this type and converting to and from other mesh formats.
|
||||
struct Contour3D {
|
||||
Pointf3s points;
|
||||
std::vector<Vec3i> faces3;
|
||||
std::vector<Vec4i> faces4;
|
||||
|
||||
Contour3D() = default;
|
||||
Contour3D(const TriangleMesh &trmesh);
|
||||
Contour3D(TriangleMesh &&trmesh);
|
||||
Contour3D(const EigenMesh3D &emesh);
|
||||
|
||||
Contour3D& merge(const Contour3D& ctr);
|
||||
Contour3D& merge(const Pointf3s& triangles);
|
||||
|
||||
// Write the index triangle structure to OBJ file for debugging purposes.
|
||||
void to_obj(std::ostream& stream);
|
||||
void from_obj(std::istream &stream);
|
||||
|
||||
inline bool empty() const { return points.empty() || (faces4.empty() && faces3.empty()); }
|
||||
};
|
||||
|
||||
using ClusterEl = std::vector<unsigned>;
|
||||
using ClusteredPoints = std::vector<ClusterEl>;
|
||||
|
||||
// Clustering a set of points by the given distance.
|
||||
ClusteredPoints cluster(const std::vector<unsigned>& indices,
|
||||
std::function<Vec3d(unsigned)> pointfn,
|
||||
double dist,
|
||||
unsigned max_points);
|
||||
|
||||
ClusteredPoints cluster(const PointSet& points,
|
||||
double dist,
|
||||
unsigned max_points);
|
||||
|
||||
ClusteredPoints cluster(
|
||||
const std::vector<unsigned>& indices,
|
||||
std::function<Vec3d(unsigned)> pointfn,
|
||||
std::function<bool(const PointIndexEl&, const PointIndexEl&)> predicate,
|
||||
unsigned max_points);
|
||||
|
||||
|
||||
// Calculate the normals for the selected points (from 'points' set) on the
|
||||
// mesh. This will call squared distance for each point.
|
||||
PointSet normals(const PointSet& points,
|
||||
const EigenMesh3D& convert_mesh,
|
||||
double eps = 0.05, // min distance from edges
|
||||
std::function<void()> throw_on_cancel = [](){},
|
||||
const std::vector<unsigned>& selected_points = {});
|
||||
|
||||
/// Mesh from an existing contour.
|
||||
TriangleMesh to_triangle_mesh(const Contour3D& ctour);
|
||||
|
||||
/// Mesh from an evaporating 3D contour
|
||||
TriangleMesh to_triangle_mesh(Contour3D&& ctour);
|
||||
|
||||
} // namespace sla
|
||||
} // namespace Slic3r
|
||||
|
||||
|
@ -69,7 +69,7 @@ Contour3D walls(
|
||||
|
||||
// Shorthand for the vertex arrays
|
||||
auto& upts = upper.points, &lpts = lower.points;
|
||||
auto& rpts = ret.points; auto& ind = ret.indices;
|
||||
auto& rpts = ret.points; auto& ind = ret.faces3;
|
||||
|
||||
// If the Z levels are flipped, or the offset difference is negative, we
|
||||
// will interpret that as the triangles normals should be inverted.
|
||||
@ -677,7 +677,7 @@ void create_pad(const ExPolygons &sup_blueprint,
|
||||
ThrowOnCancel thr)
|
||||
{
|
||||
Contour3D t = create_pad_geometry(sup_blueprint, model_blueprint, cfg, thr);
|
||||
out.merge(mesh(std::move(t)));
|
||||
out.merge(to_triangle_mesh(std::move(t)));
|
||||
}
|
||||
|
||||
std::string PadConfig::validate() const
|
||||
|
@ -12,7 +12,7 @@ Contour3D sphere(double rho, Portion portion, double fa) {
|
||||
if(rho <= 1e-6 && rho >= -1e-6) return ret;
|
||||
|
||||
auto& vertices = ret.points;
|
||||
auto& facets = ret.indices;
|
||||
auto& facets = ret.faces3;
|
||||
|
||||
// Algorithm:
|
||||
// Add points one-by-one to the sphere grid and form facets using relative
|
||||
@ -102,7 +102,7 @@ Contour3D cylinder(double r, double h, size_t ssteps, const Vec3d &sp)
|
||||
|
||||
auto steps = int(ssteps);
|
||||
auto& points = ret.points;
|
||||
auto& indices = ret.indices;
|
||||
auto& indices = ret.faces3;
|
||||
points.reserve(2*ssteps);
|
||||
double a = 2*PI/steps;
|
||||
|
||||
@ -211,8 +211,8 @@ Head::Head(double r_big_mm,
|
||||
coord_t i1s1 = coord_t(idx1), i1s2 = coord_t(idx2);
|
||||
coord_t i2s1 = i1s1 + 1, i2s2 = i1s2 + 1;
|
||||
|
||||
mesh.indices.emplace_back(i1s1, i2s1, i2s2);
|
||||
mesh.indices.emplace_back(i1s1, i2s2, i1s2);
|
||||
mesh.faces3.emplace_back(i1s1, i2s1, i2s2);
|
||||
mesh.faces3.emplace_back(i1s1, i2s2, i1s2);
|
||||
}
|
||||
|
||||
auto i1s1 = coord_t(s1.points.size()) - coord_t(steps);
|
||||
@ -220,8 +220,8 @@ Head::Head(double r_big_mm,
|
||||
auto i1s2 = coord_t(s1.points.size());
|
||||
auto i2s2 = coord_t(s1.points.size()) + coord_t(steps) - 1;
|
||||
|
||||
mesh.indices.emplace_back(i2s2, i2s1, i1s1);
|
||||
mesh.indices.emplace_back(i1s2, i2s2, i1s1);
|
||||
mesh.faces3.emplace_back(i2s2, i2s1, i1s1);
|
||||
mesh.faces3.emplace_back(i1s2, i2s2, i1s1);
|
||||
|
||||
// To simplify further processing, we translate the mesh so that the
|
||||
// last vertex of the pointing sphere (the pinpoint) will be at (0,0,0)
|
||||
@ -240,7 +240,7 @@ Pillar::Pillar(const Vec3d &jp, const Vec3d &endp, double radius, size_t st):
|
||||
// move the data.
|
||||
Contour3D body = cylinder(radius, height, st, endp);
|
||||
mesh.points.swap(body.points);
|
||||
mesh.indices.swap(body.indices);
|
||||
mesh.faces3.swap(body.faces3);
|
||||
}
|
||||
}
|
||||
|
||||
@ -275,7 +275,7 @@ Pillar &Pillar::add_base(double baseheight, double radius)
|
||||
base.points.emplace_back(endpt);
|
||||
base.points.emplace_back(ep);
|
||||
|
||||
auto& indices = base.indices;
|
||||
auto& indices = base.faces3;
|
||||
auto hcenter = int(base.points.size() - 1);
|
||||
auto lcenter = int(base.points.size() - 2);
|
||||
auto offs = int(steps);
|
||||
@ -466,7 +466,7 @@ const TriangleMesh &SupportTreeBuilder::merged_mesh() const
|
||||
return m_meshcache;
|
||||
}
|
||||
|
||||
m_meshcache = mesh(merged);
|
||||
m_meshcache = to_triangle_mesh(merged);
|
||||
|
||||
// The mesh will be passed by const-pointer to TriangleMeshSlicer,
|
||||
// which will need this.
|
||||
|
@ -228,6 +228,26 @@ EigenMesh3D::EigenMesh3D(const EigenMesh3D &other):
|
||||
m_V(other.m_V), m_F(other.m_F), m_ground_level(other.m_ground_level),
|
||||
m_aabb( new AABBImpl(*other.m_aabb) ) {}
|
||||
|
||||
EigenMesh3D::EigenMesh3D(const Contour3D &other)
|
||||
{
|
||||
m_V.resize(Eigen::Index(other.points.size()), 3);
|
||||
m_F.resize(Eigen::Index(other.faces3.size() + 2 * other.faces4.size()), 3);
|
||||
|
||||
for (Eigen::Index i = 0; i < Eigen::Index(other.points.size()); ++i)
|
||||
m_V.row(i) = other.points[size_t(i)];
|
||||
|
||||
for (Eigen::Index i = 0; i < Eigen::Index(other.faces3.size()); ++i)
|
||||
m_F.row(i) = other.faces3[size_t(i)];
|
||||
|
||||
size_t N = other.faces3.size() + 2 * other.faces4.size();
|
||||
for (size_t i = other.faces3.size(); i < N; i += 2) {
|
||||
size_t quad_idx = (i - other.faces3.size()) / 2;
|
||||
auto & quad = other.faces4[quad_idx];
|
||||
m_F.row(Eigen::Index(i)) = Vec3i{quad(0), quad(1), quad(2)};
|
||||
m_F.row(Eigen::Index(i + 1)) = Vec3i{quad(2), quad(3), quad(0)};
|
||||
}
|
||||
}
|
||||
|
||||
EigenMesh3D &EigenMesh3D::operator=(const EigenMesh3D &other)
|
||||
{
|
||||
m_V = other.m_V;
|
||||
|
@ -47,6 +47,8 @@ set(SLIC3R_GUI_SOURCES
|
||||
GUI/Gizmos/GLGizmoFlatten.hpp
|
||||
GUI/Gizmos/GLGizmoCut.cpp
|
||||
GUI/Gizmos/GLGizmoCut.hpp
|
||||
GUI/Gizmos/GLGizmoHollow.cpp
|
||||
GUI/Gizmos/GLGizmoHollow.hpp
|
||||
GUI/GLSelectionRectangle.cpp
|
||||
GUI/GLSelectionRectangle.hpp
|
||||
GUI/GLTexture.hpp
|
||||
|
@ -486,6 +486,7 @@ public:
|
||||
void set_color_by(const std::string& value);
|
||||
|
||||
const Camera& get_camera() const { return m_camera; }
|
||||
const Shader& get_shader() const { return m_shader; }
|
||||
|
||||
BoundingBoxf3 volumes_bounding_box() const;
|
||||
BoundingBoxf3 scene_bounding_box() const;
|
||||
|
1091
src/slic3r/GUI/Gizmos/GLGizmoHollow.cpp
Normal file
1091
src/slic3r/GUI/Gizmos/GLGizmoHollow.cpp
Normal file
File diff suppressed because it is too large
Load Diff
169
src/slic3r/GUI/Gizmos/GLGizmoHollow.hpp
Normal file
169
src/slic3r/GUI/Gizmos/GLGizmoHollow.hpp
Normal file
@ -0,0 +1,169 @@
|
||||
#ifndef slic3r_GLGizmoHollow_hpp_
|
||||
#define slic3r_GLGizmoHollow_hpp_
|
||||
|
||||
#include "GLGizmoBase.hpp"
|
||||
#include "slic3r/GUI/GLSelectionRectangle.hpp"
|
||||
|
||||
#include "libslic3r/SLA/SLACommon.hpp"
|
||||
#include <wx/dialog.h>
|
||||
|
||||
#include <cereal/types/vector.hpp>
|
||||
|
||||
|
||||
namespace Slic3r {
|
||||
namespace GUI {
|
||||
|
||||
class ClippingPlane;
|
||||
class MeshClipper;
|
||||
class MeshRaycaster;
|
||||
enum class SLAGizmoEventType : unsigned char;
|
||||
|
||||
class GLGizmoHollow : public GLGizmoBase
|
||||
{
|
||||
private:
|
||||
ModelObject* m_model_object = nullptr;
|
||||
ObjectID m_model_object_id = 0;
|
||||
int m_active_instance = -1;
|
||||
float m_active_instance_bb_radius; // to cache the bb
|
||||
mutable double m_z_shift = 0.f;
|
||||
bool unproject_on_mesh(const Vec2d& mouse_pos, std::pair<Vec3f, Vec3f>& pos_and_normal);
|
||||
|
||||
const float RenderPointScale = 1.f;
|
||||
|
||||
GLUquadricObj* m_quadric;
|
||||
|
||||
std::unique_ptr<MeshRaycaster> m_mesh_raycaster;
|
||||
std::unique_ptr<TriangleMesh> m_cavity_mesh;
|
||||
std::unique_ptr<GLVolume> m_volume_with_cavity;
|
||||
const TriangleMesh* m_mesh;
|
||||
const indexed_triangle_set* m_its;
|
||||
mutable const TriangleMesh* m_supports_mesh;
|
||||
mutable std::vector<Vec2f> m_triangles;
|
||||
mutable std::vector<Vec2f> m_supports_triangles;
|
||||
mutable int m_old_timestamp = -1;
|
||||
mutable int m_print_object_idx = -1;
|
||||
mutable int m_print_objects_count = -1;
|
||||
|
||||
class CacheEntry {
|
||||
public:
|
||||
CacheEntry() :
|
||||
support_point(sla::SupportPoint()), selected(false), normal(Vec3f::Zero()) {}
|
||||
|
||||
CacheEntry(const sla::SupportPoint& point, bool sel = false, const Vec3f& norm = Vec3f::Zero()) :
|
||||
support_point(point), selected(sel), normal(norm) {}
|
||||
|
||||
bool operator==(const CacheEntry& rhs) const {
|
||||
return (support_point == rhs.support_point);
|
||||
}
|
||||
|
||||
bool operator!=(const CacheEntry& rhs) const {
|
||||
return ! ((*this) == rhs);
|
||||
}
|
||||
|
||||
sla::SupportPoint support_point;
|
||||
bool selected; // whether the point is selected
|
||||
Vec3f normal;
|
||||
|
||||
template<class Archive>
|
||||
void serialize(Archive & ar)
|
||||
{
|
||||
ar(support_point, selected, normal);
|
||||
}
|
||||
};
|
||||
|
||||
public:
|
||||
GLGizmoHollow(GLCanvas3D& parent, const std::string& icon_filename, unsigned int sprite_id);
|
||||
~GLGizmoHollow() override;
|
||||
void set_sla_support_data(ModelObject* model_object, const Selection& selection);
|
||||
bool gizmo_event(SLAGizmoEventType action, const Vec2d& mouse_position, bool shift_down, bool alt_down, bool control_down);
|
||||
void delete_selected_points(bool force = false);
|
||||
ClippingPlane get_sla_clipping_plane() const;
|
||||
|
||||
bool is_selection_rectangle_dragging() const { return m_selection_rectangle.is_dragging(); }
|
||||
|
||||
private:
|
||||
bool on_init() override;
|
||||
void on_update(const UpdateData& data) override;
|
||||
void on_render() const override;
|
||||
void on_render_for_picking() const override;
|
||||
|
||||
//void render_selection_rectangle() const;
|
||||
void render_points(const Selection& selection, bool picking = false) const;
|
||||
void render_clipping_plane(const Selection& selection) const;
|
||||
bool is_mesh_update_necessary() const;
|
||||
void update_mesh();
|
||||
void hollow_mesh(float offset = 2.f, float adaptability = 1.f);
|
||||
bool unsaved_changes() const;
|
||||
const TriangleMesh* mesh() const;
|
||||
|
||||
bool m_editing_mode = true; // Is editing mode active?
|
||||
bool m_old_editing_state = false; // To keep track of whether the user toggled between the modes (needed for imgui refreshes).
|
||||
float m_new_point_head_diameter; // Size of a new point.
|
||||
float m_new_cone_angle = 0.f;
|
||||
float m_new_cone_height = 5.f;
|
||||
CacheEntry m_point_before_drag; // undo/redo - so we know what state was edited
|
||||
float m_old_point_head_diameter = 0.; // the same
|
||||
float m_minimal_point_distance_stash = 0.f; // and again
|
||||
float m_density_stash = 0.f; // and again
|
||||
mutable std::vector<CacheEntry> m_editing_cache; // a support point and whether it is currently selected
|
||||
std::vector<sla::SupportPoint> m_normal_cache; // to restore after discarding changes or undo/redo
|
||||
|
||||
float m_offset = 2.f;
|
||||
float m_adaptibility = 1.f;
|
||||
|
||||
float m_clipping_plane_distance = 0.f;
|
||||
std::unique_ptr<ClippingPlane> m_clipping_plane;
|
||||
|
||||
// This map holds all translated description texts, so they can be easily referenced during layout calculations
|
||||
// etc. When language changes, GUI is recreated and this class constructed again, so the change takes effect.
|
||||
std::map<std::string, wxString> m_desc;
|
||||
|
||||
GLSelectionRectangle m_selection_rectangle;
|
||||
|
||||
bool m_wait_for_up_event = false;
|
||||
bool m_selection_empty = true;
|
||||
EState m_old_state = Off; // to be able to see that the gizmo has just been closed (see on_set_state)
|
||||
|
||||
mutable std::unique_ptr<MeshClipper> m_object_clipper;
|
||||
mutable std::unique_ptr<MeshClipper> m_supports_clipper;
|
||||
|
||||
std::vector<const ConfigOption*> get_config_options(const std::vector<std::string>& keys) const;
|
||||
bool is_mesh_point_clipped(const Vec3d& point) const;
|
||||
//void find_intersecting_facets(const igl::AABB<Eigen::MatrixXf, 3>* aabb, const Vec3f& normal, double offset, std::vector<unsigned int>& out) const;
|
||||
|
||||
// Methods that do the model_object and editing cache synchronization,
|
||||
// editing mode selection, etc:
|
||||
enum {
|
||||
AllPoints = -2,
|
||||
NoPoints,
|
||||
};
|
||||
void select_point(int i);
|
||||
void unselect_point(int i);
|
||||
void reload_cache();
|
||||
void update_clipping_plane(bool keep_normal = false) const;
|
||||
|
||||
protected:
|
||||
void on_set_state() override;
|
||||
void on_set_hover_id() override
|
||||
|
||||
{
|
||||
if (! m_editing_mode || (int)m_editing_cache.size() <= m_hover_id)
|
||||
m_hover_id = -1;
|
||||
}
|
||||
void on_start_dragging() override;
|
||||
void on_stop_dragging() override;
|
||||
void on_render_input_window(float x, float y, float bottom_limit) override;
|
||||
|
||||
std::string on_get_name() const override;
|
||||
bool on_is_activable() const override;
|
||||
bool on_is_selectable() const override;
|
||||
void on_load(cereal::BinaryInputArchive& ar) override;
|
||||
void on_save(cereal::BinaryOutputArchive& ar) const override;
|
||||
};
|
||||
|
||||
|
||||
|
||||
} // namespace GUI
|
||||
} // namespace Slic3r
|
||||
|
||||
#endif // slic3r_GLGizmoHollow_hpp_
|
@ -32,5 +32,6 @@ enum class SLAGizmoEventType : unsigned char {
|
||||
#include "slic3r/GUI/Gizmos/GLGizmoFlatten.hpp"
|
||||
#include "slic3r/GUI/Gizmos/GLGizmoSlaSupports.hpp"
|
||||
#include "slic3r/GUI/Gizmos/GLGizmoCut.hpp"
|
||||
#include "slic3r/GUI/Gizmos/GLGizmoHollow.hpp"
|
||||
|
||||
#endif //slic3r_GLGizmos_hpp_
|
||||
|
@ -94,6 +94,7 @@ bool GLGizmosManager::init()
|
||||
m_gizmos.emplace_back(new GLGizmoFlatten(m_parent, "place.svg", 3));
|
||||
m_gizmos.emplace_back(new GLGizmoCut(m_parent, "cut.svg", 4));
|
||||
m_gizmos.emplace_back(new GLGizmoSlaSupports(m_parent, "sla_supports.svg", 5));
|
||||
m_gizmos.emplace_back(new GLGizmoHollow(m_parent, "hollow.svg", 6));
|
||||
|
||||
for (auto& gizmo : m_gizmos) {
|
||||
if (! gizmo->init()) {
|
||||
@ -350,6 +351,7 @@ void GLGizmosManager::set_sla_support_data(ModelObject* model_object)
|
||||
return;
|
||||
|
||||
dynamic_cast<GLGizmoSlaSupports*>(m_gizmos[SlaSupports].get())->set_sla_support_data(model_object, m_parent.get_selection());
|
||||
dynamic_cast<GLGizmoHollow*>(m_gizmos[Hollow].get())->set_sla_support_data(model_object, m_parent.get_selection());
|
||||
}
|
||||
|
||||
// Returns true if the gizmo used the event to do something, false otherwise.
|
||||
@ -358,15 +360,22 @@ bool GLGizmosManager::gizmo_event(SLAGizmoEventType action, const Vec2d& mouse_p
|
||||
if (!m_enabled || m_gizmos.empty())
|
||||
return false;
|
||||
|
||||
return dynamic_cast<GLGizmoSlaSupports*>(m_gizmos[SlaSupports].get())->gizmo_event(action, mouse_position, shift_down, alt_down, control_down);
|
||||
if (m_current == SlaSupports)
|
||||
return dynamic_cast<GLGizmoSlaSupports*>(m_gizmos[SlaSupports].get())->gizmo_event(action, mouse_position, shift_down, alt_down, control_down);
|
||||
if (m_current == Hollow)
|
||||
return dynamic_cast<GLGizmoHollow*>(m_gizmos[Hollow].get())->gizmo_event(action, mouse_position, shift_down, alt_down, control_down);
|
||||
return false;
|
||||
}
|
||||
|
||||
ClippingPlane GLGizmosManager::get_sla_clipping_plane() const
|
||||
{
|
||||
if (!m_enabled || m_current != SlaSupports || m_gizmos.empty())
|
||||
if (!m_enabled || (m_current != SlaSupports && m_current != Hollow) || m_gizmos.empty())
|
||||
return ClippingPlane::ClipsNothing();
|
||||
|
||||
return dynamic_cast<GLGizmoSlaSupports*>(m_gizmos[SlaSupports].get())->get_sla_clipping_plane();
|
||||
if (m_current == SlaSupports)
|
||||
return dynamic_cast<GLGizmoSlaSupports*>(m_gizmos[SlaSupports].get())->get_sla_clipping_plane();
|
||||
else
|
||||
return dynamic_cast<GLGizmoHollow*>(m_gizmos[Hollow].get())->get_sla_clipping_plane();
|
||||
}
|
||||
|
||||
bool GLGizmosManager::wants_reslice_supports_on_undo() const
|
||||
@ -406,7 +415,7 @@ bool GLGizmosManager::on_mouse_wheel(wxMouseEvent& evt)
|
||||
{
|
||||
bool processed = false;
|
||||
|
||||
if (m_current == SlaSupports) {
|
||||
if (m_current == SlaSupports || m_current == Hollow) {
|
||||
float rot = (float)evt.GetWheelRotation() / (float)evt.GetWheelDelta();
|
||||
if (gizmo_event((rot > 0.f ? SLAGizmoEventType::MouseWheelUp : SLAGizmoEventType::MouseWheelDown), Vec2d::Zero(), evt.ShiftDown(), evt.AltDown(), evt.ControlDown()))
|
||||
processed = true;
|
||||
@ -464,7 +473,7 @@ bool GLGizmosManager::on_mouse(wxMouseEvent& evt)
|
||||
|
||||
if (evt.LeftDown())
|
||||
{
|
||||
if ((m_current == SlaSupports) && gizmo_event(SLAGizmoEventType::LeftDown, mouse_pos, evt.ShiftDown(), evt.AltDown(), evt.ControlDown()))
|
||||
if ((m_current == SlaSupports || m_current == Hollow) && gizmo_event(SLAGizmoEventType::LeftDown, mouse_pos, evt.ShiftDown(), evt.AltDown(), evt.ControlDown()))
|
||||
// the gizmo got the event and took some action, there is no need to do anything more
|
||||
processed = true;
|
||||
else if (!selection.is_empty() && grabber_contains_mouse()) {
|
||||
@ -489,10 +498,10 @@ bool GLGizmosManager::on_mouse(wxMouseEvent& evt)
|
||||
// event was taken care of by the SlaSupports gizmo
|
||||
processed = true;
|
||||
}
|
||||
else if (evt.Dragging() && (m_parent.get_move_volume_id() != -1) && (m_current == SlaSupports))
|
||||
else if (evt.Dragging() && (m_parent.get_move_volume_id() != -1) && (m_current == SlaSupports || m_current == Hollow))
|
||||
// don't allow dragging objects with the Sla gizmo on
|
||||
processed = true;
|
||||
else if (evt.Dragging() && (m_current == SlaSupports) && gizmo_event(SLAGizmoEventType::Dragging, mouse_pos, evt.ShiftDown(), evt.AltDown(), evt.ControlDown()))
|
||||
else if (evt.Dragging() && (m_current == SlaSupports || m_current == Hollow) && gizmo_event(SLAGizmoEventType::Dragging, mouse_pos, evt.ShiftDown(), evt.AltDown(), evt.ControlDown()))
|
||||
{
|
||||
// the gizmo got the event and took some action, no need to do anything more here
|
||||
m_parent.set_as_dirty();
|
||||
@ -568,7 +577,7 @@ bool GLGizmosManager::on_mouse(wxMouseEvent& evt)
|
||||
|
||||
processed = true;
|
||||
}
|
||||
else if (evt.LeftUp() && (m_current == SlaSupports) && !m_parent.is_mouse_dragging())
|
||||
else if (evt.LeftUp() && (m_current == SlaSupports || m_current == Hollow) && !m_parent.is_mouse_dragging())
|
||||
{
|
||||
// in case SLA gizmo is selected, we just pass the LeftUp event and stop processing - neither
|
||||
// object moving or selecting is suppressed in that case
|
||||
@ -667,7 +676,7 @@ bool GLGizmosManager::on_char(wxKeyEvent& evt)
|
||||
case 'r' :
|
||||
case 'R' :
|
||||
{
|
||||
if ((m_current == SlaSupports) && gizmo_event(SLAGizmoEventType::ResetClippingPlane))
|
||||
if ((m_current == SlaSupports || m_current == Hollow) && gizmo_event(SLAGizmoEventType::ResetClippingPlane))
|
||||
processed = true;
|
||||
|
||||
break;
|
||||
@ -679,7 +688,7 @@ bool GLGizmosManager::on_char(wxKeyEvent& evt)
|
||||
case WXK_DELETE:
|
||||
#endif /* __APPLE__ */
|
||||
{
|
||||
if ((m_current == SlaSupports) && gizmo_event(SLAGizmoEventType::Delete))
|
||||
if ((m_current == SlaSupports || m_current == Hollow) && gizmo_event(SLAGizmoEventType::Delete))
|
||||
processed = true;
|
||||
|
||||
break;
|
||||
|
@ -60,6 +60,7 @@ public:
|
||||
Flatten,
|
||||
Cut,
|
||||
SlaSupports,
|
||||
Hollow,
|
||||
Undefined
|
||||
};
|
||||
|
||||
|
7348
tests/data/extruder_idler_quads.obj
Normal file
7348
tests/data/extruder_idler_quads.obj
Normal file
File diff suppressed because it is too large
Load Diff
@ -1,4 +1,3 @@
|
||||
#define CATCH_CONFIG_MAIN
|
||||
#include <catch_main.hpp>
|
||||
|
||||
TEST_CASE("Is example succesful", "[example]") {
|
||||
|
@ -1,4 +1,5 @@
|
||||
get_filename_component(_TEST_NAME ${CMAKE_CURRENT_LIST_DIR} NAME)
|
||||
|
||||
add_executable(${_TEST_NAME}_tests
|
||||
${_TEST_NAME}_tests.cpp
|
||||
test_3mf.cpp
|
||||
@ -10,6 +11,11 @@ add_executable(${_TEST_NAME}_tests
|
||||
test_polygon.cpp
|
||||
test_stl.cpp
|
||||
)
|
||||
|
||||
if (TARGET OpenVDB::openvdb)
|
||||
target_sources(${_TEST_NAME}_tests PRIVATE test_hollowing.cpp)
|
||||
endif()
|
||||
|
||||
target_link_libraries(${_TEST_NAME}_tests test_common libslic3r)
|
||||
set_property(TARGET ${_TEST_NAME}_tests PROPERTY FOLDER "tests")
|
||||
|
||||
|
78
tests/libslic3r/test_hollowing.cpp
Normal file
78
tests/libslic3r/test_hollowing.cpp
Normal file
@ -0,0 +1,78 @@
|
||||
#include <iostream>
|
||||
#include <fstream>
|
||||
#include <catch2/catch.hpp>
|
||||
|
||||
#include "libslic3r/OpenVDBUtils.hpp"
|
||||
#include "libslic3r/Format/OBJ.hpp"
|
||||
|
||||
#if defined(WIN32) || defined(_WIN32)
|
||||
#define PATH_SEPARATOR R"(\)"
|
||||
#else
|
||||
#define PATH_SEPARATOR R"(/)"
|
||||
#endif
|
||||
|
||||
static Slic3r::TriangleMesh load_model(const std::string &obj_filename)
|
||||
{
|
||||
Slic3r::TriangleMesh mesh;
|
||||
auto fpath = TEST_DATA_DIR PATH_SEPARATOR + obj_filename;
|
||||
Slic3r::load_obj(fpath.c_str(), &mesh);
|
||||
return mesh;
|
||||
}
|
||||
|
||||
static bool _check_normals(const Slic3r::sla::Contour3D &mesh)
|
||||
{
|
||||
for (auto & face : mesh.faces3)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
TEST_CASE("Passing OpenVDB grid conversion produce similar geometry.", "[Hollowing]")
|
||||
{
|
||||
Slic3r::TriangleMesh in_mesh = load_model("20mm_cube.obj");
|
||||
Slic3r::sla::Contour3D imesh = Slic3r::sla::Contour3D{in_mesh};
|
||||
auto ptr = Slic3r::meshToVolume(imesh, {});
|
||||
|
||||
REQUIRE(ptr);
|
||||
|
||||
std::cout << "Grid class = " << ptr->getGridClass() << std::endl;
|
||||
|
||||
Slic3r::sla::Contour3D omesh = Slic3r::volumeToMesh(*ptr, -2.9, 1.0, true);
|
||||
|
||||
std::cout << "Triangle count: " << omesh.faces3.size() << std::endl;
|
||||
std::cout << "Quad count: " << omesh.faces4.size() << std::endl;
|
||||
|
||||
REQUIRE(!omesh.empty());
|
||||
|
||||
SECTION("Converting to Contour3D to TriangleMesh") {
|
||||
Slic3r::TriangleMesh msh = Slic3r::sla::to_triangle_mesh(omesh);
|
||||
|
||||
msh.require_shared_vertices();
|
||||
msh.WriteOBJFile("out_tr.obj");
|
||||
|
||||
REQUIRE(msh.volume() == Approx(in_mesh.volume()));
|
||||
}
|
||||
|
||||
// omesh.faces4.clear();
|
||||
std::fstream outfile{"out.obj", std::ios::out};
|
||||
omesh.to_obj(outfile);
|
||||
|
||||
}
|
||||
|
||||
//TEST_CASE("Negative 3D offset should produce smaller object.", "[Hollowing]")
|
||||
//{
|
||||
// Slic3r::sla::Contour3D imesh = Slic3r::sla::Contour3D{load_model("20mm_cube.obj")};
|
||||
// auto ptr = Slic3r::meshToVolume(imesh, {});
|
||||
|
||||
// REQUIRE(ptr);
|
||||
|
||||
// Slic3r::sla::Contour3D omesh = Slic3r::volumeToMesh(*ptr, -1., 0.0, true);
|
||||
|
||||
// REQUIRE(!omesh.empty());
|
||||
|
||||
// imesh.merge(omesh);
|
||||
// std::fstream merged_outfile("merged_out.obj", std::ios::out);
|
||||
// imesh.to_obj(merged_outfile);
|
||||
//}
|
@ -1,5 +1,5 @@
|
||||
get_filename_component(_TEST_NAME ${CMAKE_CURRENT_LIST_DIR} NAME)
|
||||
add_executable(${_TEST_NAME}_tests ${_TEST_NAME}_tests.cpp)
|
||||
add_executable(${_TEST_NAME}_tests ${_TEST_NAME}_tests_main.cpp sla_print_tests.cpp)
|
||||
target_link_libraries(${_TEST_NAME}_tests test_common libslic3r)
|
||||
set_property(TARGET ${_TEST_NAME}_tests PROPERTY FOLDER "tests")
|
||||
|
||||
|
@ -1,9 +1,9 @@
|
||||
#include <catch_main.hpp>
|
||||
|
||||
#include <unordered_set>
|
||||
#include <unordered_map>
|
||||
#include <random>
|
||||
|
||||
#include <catch2/catch.hpp>
|
||||
|
||||
// Debug
|
||||
#include <fstream>
|
||||
|
||||
@ -50,21 +50,21 @@ void check_validity(const TriangleMesh &input_mesh,
|
||||
ASSUME_NO_REPAIR)
|
||||
{
|
||||
TriangleMesh mesh{input_mesh};
|
||||
|
||||
|
||||
if (flags & ASSUME_NO_EMPTY) {
|
||||
REQUIRE_FALSE(mesh.empty());
|
||||
} else if (mesh.empty())
|
||||
return; // If it can be empty and it is, there is nothing left to do.
|
||||
|
||||
|
||||
REQUIRE(stl_validate(&mesh.stl));
|
||||
|
||||
|
||||
bool do_update_shared_vertices = false;
|
||||
mesh.repair(do_update_shared_vertices);
|
||||
|
||||
|
||||
if (flags & ASSUME_NO_REPAIR) {
|
||||
REQUIRE_FALSE(mesh.needed_repair());
|
||||
}
|
||||
|
||||
|
||||
if (flags & ASSUME_MANIFOLD) {
|
||||
mesh.require_shared_vertices();
|
||||
if (!mesh.is_manifold()) mesh.WriteOBJFile("non_manifold.obj");
|
||||
@ -82,36 +82,36 @@ struct PadByproducts
|
||||
void _test_concave_hull(const Polygons &hull, const ExPolygons &polys)
|
||||
{
|
||||
REQUIRE(polys.size() >=hull.size());
|
||||
|
||||
|
||||
double polys_area = 0;
|
||||
for (const ExPolygon &p : polys) polys_area += p.area();
|
||||
|
||||
|
||||
double cchull_area = 0;
|
||||
for (const Slic3r::Polygon &p : hull) cchull_area += p.area();
|
||||
|
||||
|
||||
REQUIRE(cchull_area >= Approx(polys_area));
|
||||
|
||||
|
||||
size_t cchull_holes = 0;
|
||||
for (const Slic3r::Polygon &p : hull)
|
||||
cchull_holes += p.is_clockwise() ? 1 : 0;
|
||||
|
||||
|
||||
REQUIRE(cchull_holes == 0);
|
||||
|
||||
|
||||
Polygons intr = diff(to_polygons(polys), hull);
|
||||
REQUIRE(intr.empty());
|
||||
}
|
||||
|
||||
void test_concave_hull(const ExPolygons &polys) {
|
||||
sla::PadConfig pcfg;
|
||||
|
||||
|
||||
Slic3r::sla::ConcaveHull cchull{polys, pcfg.max_merge_dist_mm, []{}};
|
||||
|
||||
|
||||
_test_concave_hull(cchull.polygons(), polys);
|
||||
|
||||
|
||||
coord_t delta = scaled(pcfg.brim_size_mm + pcfg.wing_distance());
|
||||
ExPolygons wafflex = sla::offset_waffle_style_ex(cchull, delta);
|
||||
Polygons waffl = sla::offset_waffle_style(cchull, delta);
|
||||
|
||||
|
||||
_test_concave_hull(to_polygons(wafflex), polys);
|
||||
_test_concave_hull(waffl, polys);
|
||||
}
|
||||
@ -121,23 +121,23 @@ void test_pad(const std::string & obj_filename,
|
||||
PadByproducts & out)
|
||||
{
|
||||
REQUIRE(padcfg.validate().empty());
|
||||
|
||||
|
||||
TriangleMesh mesh = load_model(obj_filename);
|
||||
|
||||
|
||||
REQUIRE_FALSE(mesh.empty());
|
||||
|
||||
|
||||
// Create pad skeleton only from the model
|
||||
Slic3r::sla::pad_blueprint(mesh, out.model_contours);
|
||||
|
||||
|
||||
test_concave_hull(out.model_contours);
|
||||
|
||||
|
||||
REQUIRE_FALSE(out.model_contours.empty());
|
||||
|
||||
|
||||
// Create the pad geometry for the model contours only
|
||||
Slic3r::sla::create_pad({}, out.model_contours, out.mesh, padcfg);
|
||||
|
||||
|
||||
check_validity(out.mesh);
|
||||
|
||||
|
||||
auto bb = out.mesh.bounding_box();
|
||||
REQUIRE(bb.max.z() - bb.min.z() == Approx(padcfg.full_height()));
|
||||
}
|
||||
@ -166,42 +166,42 @@ void check_support_tree_integrity(const sla::SupportTreeBuilder &stree,
|
||||
double gnd = stree.ground_level;
|
||||
double H1 = cfg.max_solo_pillar_height_mm;
|
||||
double H2 = cfg.max_dual_pillar_height_mm;
|
||||
|
||||
|
||||
for (const sla::Head &head : stree.heads()) {
|
||||
REQUIRE((!head.is_valid() || head.pillar_id != sla::ID_UNSET ||
|
||||
head.bridge_id != sla::ID_UNSET));
|
||||
}
|
||||
|
||||
|
||||
for (const sla::Pillar &pillar : stree.pillars()) {
|
||||
if (std::abs(pillar.endpoint().z() - gnd) < EPSILON) {
|
||||
double h = pillar.height;
|
||||
|
||||
|
||||
if (h > H1) REQUIRE(pillar.links >= 1);
|
||||
else if(h > H2) { REQUIRE(pillar.links >= 2); }
|
||||
}
|
||||
|
||||
|
||||
REQUIRE(pillar.links <= cfg.pillar_cascade_neighbors);
|
||||
REQUIRE(pillar.bridges <= cfg.max_bridges_on_pillar);
|
||||
}
|
||||
|
||||
|
||||
double max_bridgelen = 0.;
|
||||
auto chck_bridge = [&cfg](const sla::Bridge &bridge, double &max_brlen) {
|
||||
Vec3d n = bridge.endp - bridge.startp;
|
||||
double d = sla::distance(n);
|
||||
max_brlen = std::max(d, max_brlen);
|
||||
|
||||
|
||||
double z = n.z();
|
||||
double polar = std::acos(z / d);
|
||||
double slope = -polar + PI / 2.;
|
||||
REQUIRE(std::abs(slope) >= cfg.bridge_slope - EPSILON);
|
||||
};
|
||||
|
||||
|
||||
for (auto &bridge : stree.bridges()) chck_bridge(bridge, max_bridgelen);
|
||||
REQUIRE(max_bridgelen <= cfg.max_bridge_length_mm);
|
||||
|
||||
|
||||
max_bridgelen = 0;
|
||||
for (auto &bridge : stree.crossbridges()) chck_bridge(bridge, max_bridgelen);
|
||||
|
||||
|
||||
double md = cfg.max_pillar_link_distance_mm / std::cos(-cfg.bridge_slope);
|
||||
REQUIRE(max_bridgelen <= md);
|
||||
}
|
||||
@ -212,35 +212,35 @@ void test_supports(const std::string & obj_filename,
|
||||
{
|
||||
using namespace Slic3r;
|
||||
TriangleMesh mesh = load_model(obj_filename);
|
||||
|
||||
|
||||
REQUIRE_FALSE(mesh.empty());
|
||||
|
||||
|
||||
TriangleMeshSlicer slicer{&mesh};
|
||||
|
||||
|
||||
auto bb = mesh.bounding_box();
|
||||
double zmin = bb.min.z();
|
||||
double zmax = bb.max.z();
|
||||
double gnd = zmin - supportcfg.object_elevation_mm;
|
||||
auto layer_h = 0.05f;
|
||||
|
||||
|
||||
out.slicegrid = grid(float(gnd), float(zmax), layer_h);
|
||||
slicer.slice(out.slicegrid , CLOSING_RADIUS, &out.model_slices, []{});
|
||||
|
||||
|
||||
// Create the special index-triangle mesh with spatial indexing which
|
||||
// is the input of the support point and support mesh generators
|
||||
sla::EigenMesh3D emesh{mesh};
|
||||
|
||||
|
||||
// Create the support point generator
|
||||
sla::SLAAutoSupports::Config autogencfg;
|
||||
autogencfg.head_diameter = float(2 * supportcfg.head_front_radius_mm);
|
||||
sla::SLAAutoSupports point_gen{emesh, out.model_slices, out.slicegrid,
|
||||
autogencfg, [] {}, [](int) {}};
|
||||
|
||||
|
||||
// Get the calculated support points.
|
||||
std::vector<sla::SupportPoint> support_points = point_gen.output();
|
||||
|
||||
|
||||
int validityflags = ASSUME_NO_REPAIR;
|
||||
|
||||
|
||||
// If there is no elevation, support points shall be removed from the
|
||||
// bottom of the object.
|
||||
if (std::abs(supportcfg.object_elevation_mm) < EPSILON) {
|
||||
@ -249,32 +249,32 @@ void test_supports(const std::string & obj_filename,
|
||||
} else {
|
||||
// Should be support points at least on the bottom of the model
|
||||
REQUIRE_FALSE(support_points.empty());
|
||||
|
||||
|
||||
// Also the support mesh should not be empty.
|
||||
validityflags |= ASSUME_NO_EMPTY;
|
||||
}
|
||||
|
||||
|
||||
// Generate the actual support tree
|
||||
sla::SupportTreeBuilder treebuilder;
|
||||
treebuilder.build(sla::SupportableMesh{emesh, support_points, supportcfg});
|
||||
|
||||
|
||||
check_support_tree_integrity(treebuilder, supportcfg);
|
||||
|
||||
|
||||
const TriangleMesh &output_mesh = treebuilder.retrieve_mesh();
|
||||
|
||||
|
||||
check_validity(output_mesh, validityflags);
|
||||
|
||||
|
||||
// Quick check if the dimensions and placement of supports are correct
|
||||
auto obb = output_mesh.bounding_box();
|
||||
|
||||
|
||||
double allowed_zmin = zmin - supportcfg.object_elevation_mm;
|
||||
|
||||
|
||||
if (std::abs(supportcfg.object_elevation_mm) < EPSILON)
|
||||
allowed_zmin = zmin - 2 * supportcfg.head_back_radius_mm;
|
||||
|
||||
|
||||
REQUIRE(obb.min.z() >= allowed_zmin);
|
||||
REQUIRE(obb.max.z() <= zmax);
|
||||
|
||||
|
||||
// Move out the support tree into the byproducts, we can examine it further
|
||||
// in various tests.
|
||||
out.obj_fname = std::move(obj_filename);
|
||||
@ -296,7 +296,7 @@ void export_failed_case(const std::vector<ExPolygons> &support_slices,
|
||||
const ExPolygons &sup_slice = support_slices[n];
|
||||
const ExPolygons &mod_slice = byproducts.model_slices[n];
|
||||
Polygons intersections = intersection(sup_slice, mod_slice);
|
||||
|
||||
|
||||
std::stringstream ss;
|
||||
if (!intersections.empty()) {
|
||||
ss << byproducts.obj_fname << std::setprecision(4) << n << ".svg";
|
||||
@ -307,7 +307,7 @@ void export_failed_case(const std::vector<ExPolygons> &support_slices,
|
||||
svg.Close();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
TriangleMesh m;
|
||||
byproducts.supporttree.retrieve_full_mesh(m);
|
||||
m.merge(byproducts.input_mesh);
|
||||
@ -321,56 +321,56 @@ void test_support_model_collision(
|
||||
const sla::SupportConfig &input_supportcfg = {})
|
||||
{
|
||||
SupportByproducts byproducts;
|
||||
|
||||
|
||||
sla::SupportConfig supportcfg = input_supportcfg;
|
||||
|
||||
|
||||
// Set head penetration to a small negative value which should ensure that
|
||||
// the supports will not touch the model body.
|
||||
supportcfg.head_penetration_mm = -0.15;
|
||||
|
||||
|
||||
// TODO: currently, the tailheads penetrating into the model body do not
|
||||
// respect the penetration parameter properly. No issues were reported so
|
||||
// far but we should definitely fix this.
|
||||
supportcfg.ground_facing_only = true;
|
||||
|
||||
|
||||
test_supports(obj_filename, supportcfg, byproducts);
|
||||
|
||||
|
||||
// Slice the support mesh given the slice grid of the model.
|
||||
std::vector<ExPolygons> support_slices =
|
||||
byproducts.supporttree.slice(byproducts.slicegrid, CLOSING_RADIUS);
|
||||
|
||||
|
||||
// The slices originate from the same slice grid so the numbers must match
|
||||
|
||||
|
||||
bool support_mesh_is_empty =
|
||||
byproducts.supporttree.retrieve_mesh(sla::MeshType::Pad).empty() &&
|
||||
byproducts.supporttree.retrieve_mesh(sla::MeshType::Support).empty();
|
||||
|
||||
|
||||
if (support_mesh_is_empty)
|
||||
REQUIRE(support_slices.empty());
|
||||
else
|
||||
REQUIRE(support_slices.size() == byproducts.model_slices.size());
|
||||
|
||||
|
||||
bool notouch = true;
|
||||
for (size_t n = 0; notouch && n < support_slices.size(); ++n) {
|
||||
const ExPolygons &sup_slice = support_slices[n];
|
||||
const ExPolygons &mod_slice = byproducts.model_slices[n];
|
||||
|
||||
|
||||
Polygons intersections = intersection(sup_slice, mod_slice);
|
||||
|
||||
|
||||
notouch = notouch && intersections.empty();
|
||||
}
|
||||
|
||||
|
||||
if (!notouch) export_failed_case(support_slices, byproducts);
|
||||
|
||||
|
||||
REQUIRE(notouch);
|
||||
}
|
||||
|
||||
const char * const BELOW_PAD_TEST_OBJECTS[] = {
|
||||
const char *const BELOW_PAD_TEST_OBJECTS[] = {
|
||||
"20mm_cube.obj",
|
||||
"V.obj",
|
||||
};
|
||||
|
||||
const char * const AROUND_PAD_TEST_OBJECTS[] = {
|
||||
const char *const AROUND_PAD_TEST_OBJECTS[] = {
|
||||
"20mm_cube.obj",
|
||||
"V.obj",
|
||||
"frog_legs.obj",
|
||||
@ -392,46 +392,46 @@ template <class I, class II> void test_pairhash()
|
||||
I A[nums] = {0}, B[nums] = {0};
|
||||
std::unordered_set<I> CH;
|
||||
std::unordered_map<II, std::pair<I, I>> ints;
|
||||
|
||||
|
||||
std::random_device rd;
|
||||
std::mt19937 gen(rd());
|
||||
|
||||
|
||||
const I Ibits = int(sizeof(I) * CHAR_BIT);
|
||||
const II IIbits = int(sizeof(II) * CHAR_BIT);
|
||||
|
||||
|
||||
int bits = IIbits / 2 < Ibits ? Ibits / 2 : Ibits;
|
||||
if (std::is_signed<I>::value) bits -= 1;
|
||||
const I Imin = 0;
|
||||
const I Imax = I(std::pow(2., bits) - 1);
|
||||
|
||||
|
||||
std::uniform_int_distribution<I> dis(Imin, Imax);
|
||||
|
||||
|
||||
for (size_t i = 0; i < nums;) {
|
||||
I a = dis(gen);
|
||||
if (CH.find(a) == CH.end()) { CH.insert(a); A[i] = a; ++i; }
|
||||
}
|
||||
|
||||
|
||||
for (size_t i = 0; i < nums;) {
|
||||
I b = dis(gen);
|
||||
if (CH.find(b) == CH.end()) { CH.insert(b); B[i] = b; ++i; }
|
||||
}
|
||||
|
||||
|
||||
for (size_t i = 0; i < nums; ++i) {
|
||||
I a = A[i], b = B[i];
|
||||
|
||||
|
||||
REQUIRE(a != b);
|
||||
|
||||
|
||||
II hash_ab = sla::pairhash<I, II>(a, b);
|
||||
II hash_ba = sla::pairhash<I, II>(b, a);
|
||||
REQUIRE(hash_ab == hash_ba);
|
||||
|
||||
|
||||
auto it = ints.find(hash_ab);
|
||||
|
||||
|
||||
if (it != ints.end()) {
|
||||
REQUIRE((
|
||||
(it->second.first == a && it->second.second == b) ||
|
||||
(it->second.first == b && it->second.second == a)
|
||||
));
|
||||
));
|
||||
} else
|
||||
ints[hash_ab] = std::make_pair(a, b);
|
||||
}
|
||||
@ -446,72 +446,72 @@ TEST_CASE("Pillar pairhash should be unique", "[SLASupportGeneration]") {
|
||||
|
||||
TEST_CASE("Flat pad geometry is valid", "[SLASupportGeneration]") {
|
||||
sla::PadConfig padcfg;
|
||||
|
||||
|
||||
// Disable wings
|
||||
padcfg.wall_height_mm = .0;
|
||||
|
||||
|
||||
for (auto &fname : BELOW_PAD_TEST_OBJECTS) test_pad(fname, padcfg);
|
||||
}
|
||||
|
||||
TEST_CASE("WingedPadGeometryIsValid", "[SLASupportGeneration]") {
|
||||
sla::PadConfig padcfg;
|
||||
|
||||
|
||||
// Add some wings to the pad to test the cavity
|
||||
padcfg.wall_height_mm = 1.;
|
||||
|
||||
|
||||
for (auto &fname : BELOW_PAD_TEST_OBJECTS) test_pad(fname, padcfg);
|
||||
}
|
||||
|
||||
TEST_CASE("FlatPadAroundObjectIsValid", "[SLASupportGeneration]") {
|
||||
sla::PadConfig padcfg;
|
||||
|
||||
|
||||
// Add some wings to the pad to test the cavity
|
||||
padcfg.wall_height_mm = 0.;
|
||||
// padcfg.embed_object.stick_stride_mm = 0.;
|
||||
padcfg.embed_object.enabled = true;
|
||||
padcfg.embed_object.everywhere = true;
|
||||
|
||||
|
||||
for (auto &fname : AROUND_PAD_TEST_OBJECTS) test_pad(fname, padcfg);
|
||||
}
|
||||
|
||||
TEST_CASE("WingedPadAroundObjectIsValid", "[SLASupportGeneration]") {
|
||||
sla::PadConfig padcfg;
|
||||
|
||||
|
||||
// Add some wings to the pad to test the cavity
|
||||
padcfg.wall_height_mm = 1.;
|
||||
padcfg.embed_object.enabled = true;
|
||||
padcfg.embed_object.everywhere = true;
|
||||
|
||||
|
||||
for (auto &fname : AROUND_PAD_TEST_OBJECTS) test_pad(fname, padcfg);
|
||||
}
|
||||
|
||||
TEST_CASE("ElevatedSupportGeometryIsValid", "[SLASupportGeneration]") {
|
||||
sla::SupportConfig supportcfg;
|
||||
supportcfg.object_elevation_mm = 5.;
|
||||
|
||||
|
||||
for (auto fname : SUPPORT_TEST_MODELS) test_supports(fname);
|
||||
}
|
||||
|
||||
TEST_CASE("FloorSupportGeometryIsValid", "[SLASupportGeneration]") {
|
||||
sla::SupportConfig supportcfg;
|
||||
supportcfg.object_elevation_mm = 0;
|
||||
|
||||
|
||||
for (auto &fname: SUPPORT_TEST_MODELS) test_supports(fname, supportcfg);
|
||||
}
|
||||
|
||||
TEST_CASE("ElevatedSupportsDoNotPierceModel", "[SLASupportGeneration]") {
|
||||
|
||||
|
||||
sla::SupportConfig supportcfg;
|
||||
|
||||
|
||||
for (auto fname : SUPPORT_TEST_MODELS)
|
||||
test_support_model_collision(fname, supportcfg);
|
||||
}
|
||||
|
||||
TEST_CASE("FloorSupportsDoNotPierceModel", "[SLASupportGeneration]") {
|
||||
|
||||
|
||||
sla::SupportConfig supportcfg;
|
||||
supportcfg.object_elevation_mm = 0;
|
||||
|
||||
|
||||
for (auto fname : SUPPORT_TEST_MODELS)
|
||||
test_support_model_collision(fname, supportcfg);
|
||||
}
|
||||
@ -525,7 +525,7 @@ TEST_CASE("InitializedRasterShouldBeNONEmpty", "[SLARasterOutput]") {
|
||||
// Default Prusa SL1 display parameters
|
||||
sla::Raster::Resolution res{2560, 1440};
|
||||
sla::Raster::PixelDim pixdim{120. / res.width_px, 68. / res.height_px};
|
||||
|
||||
|
||||
sla::Raster raster;
|
||||
raster.reset(res, pixdim);
|
||||
REQUIRE_FALSE(raster.empty());
|
||||
@ -547,54 +547,54 @@ static void check_raster_transformations(sla::Raster::Orientation o,
|
||||
double disp_w = 120., disp_h = 68.;
|
||||
sla::Raster::Resolution res{2560, 1440};
|
||||
sla::Raster::PixelDim pixdim{disp_w / res.width_px, disp_h / res.height_px};
|
||||
|
||||
|
||||
auto bb = BoundingBox({0, 0}, {scaled(disp_w), scaled(disp_h)});
|
||||
sla::Raster::Trafo trafo{o, mirroring};
|
||||
trafo.origin_x = bb.center().x();
|
||||
trafo.origin_y = bb.center().y();
|
||||
|
||||
|
||||
sla::Raster raster{res, pixdim, trafo};
|
||||
|
||||
|
||||
// create box of size 32x32 pixels (not 1x1 to avoid antialiasing errors)
|
||||
coord_t pw = 32 * coord_t(std::ceil(scaled<double>(pixdim.w_mm)));
|
||||
coord_t ph = 32 * coord_t(std::ceil(scaled<double>(pixdim.h_mm)));
|
||||
ExPolygon box;
|
||||
box.contour.points = {{-pw, -ph}, {pw, -ph}, {pw, ph}, {-pw, ph}};
|
||||
|
||||
|
||||
double tr_x = scaled<double>(20.), tr_y = tr_x;
|
||||
|
||||
|
||||
box.translate(tr_x, tr_y);
|
||||
ExPolygon expected_box = box;
|
||||
|
||||
|
||||
// Now calculate the position of the translated box according to output
|
||||
// trafo.
|
||||
if (o == sla::Raster::Orientation::roPortrait) expected_box.rotate(PI / 2.);
|
||||
|
||||
|
||||
if (mirroring[X])
|
||||
for (auto &p : expected_box.contour.points) p.x() = -p.x();
|
||||
|
||||
|
||||
if (mirroring[Y])
|
||||
for (auto &p : expected_box.contour.points) p.y() = -p.y();
|
||||
|
||||
|
||||
raster.draw(box);
|
||||
|
||||
|
||||
Point expected_coords = expected_box.contour.bounding_box().center();
|
||||
double rx = unscaled(expected_coords.x() + bb.center().x()) / pixdim.w_mm;
|
||||
double ry = unscaled(expected_coords.y() + bb.center().y()) / pixdim.h_mm;
|
||||
auto w = size_t(std::floor(rx));
|
||||
auto h = res.height_px - size_t(std::floor(ry));
|
||||
|
||||
|
||||
REQUIRE((w < res.width_px && h < res.height_px));
|
||||
|
||||
|
||||
auto px = raster.read_pixel(w, h);
|
||||
|
||||
|
||||
if (px != FullWhite) {
|
||||
sla::PNGImage img;
|
||||
std::fstream outf("out.png", std::ios::out);
|
||||
|
||||
|
||||
outf << img.serialize(raster);
|
||||
}
|
||||
|
||||
|
||||
REQUIRE(px == FullWhite);
|
||||
}
|
||||
|
||||
@ -603,7 +603,7 @@ TEST_CASE("MirroringShouldBeCorrect", "[SLARasterOutput]") {
|
||||
sla::Raster::MirrorX,
|
||||
sla::Raster::MirrorY,
|
||||
sla::Raster::MirrorXY};
|
||||
|
||||
|
||||
sla::Raster::Orientation orientations[] = {sla::Raster::roLandscape,
|
||||
sla::Raster::roPortrait};
|
||||
for (auto orientation : orientations)
|
||||
@ -615,7 +615,7 @@ static ExPolygon square_with_hole(double v)
|
||||
{
|
||||
ExPolygon poly;
|
||||
coord_t V = scaled(v / 2.);
|
||||
|
||||
|
||||
poly.contour.points = {{-V, -V}, {V, -V}, {V, V}, {-V, V}};
|
||||
poly.holes.emplace_back();
|
||||
V = V / 2;
|
||||
@ -631,16 +631,16 @@ static double pixel_area(TPixel px, const sla::Raster::PixelDim &pxdim)
|
||||
static double raster_white_area(const sla::Raster &raster)
|
||||
{
|
||||
if (raster.empty()) return std::nan("");
|
||||
|
||||
|
||||
auto res = raster.resolution();
|
||||
double a = 0;
|
||||
|
||||
|
||||
for (size_t x = 0; x < res.width_px; ++x)
|
||||
for (size_t y = 0; y < res.height_px; ++y) {
|
||||
auto px = raster.read_pixel(x, y);
|
||||
a += pixel_area(px, raster.pixel_dimensions());
|
||||
}
|
||||
|
||||
|
||||
return a;
|
||||
}
|
||||
|
||||
@ -648,15 +648,15 @@ static double predict_error(const ExPolygon &p, const sla::Raster::PixelDim &pd)
|
||||
{
|
||||
auto lines = p.lines();
|
||||
double pix_err = pixel_area(FullWhite, pd) / 2.;
|
||||
|
||||
|
||||
// Worst case is when a line is parallel to the shorter axis of one pixel,
|
||||
// when the line will be composed of the max number of pixels
|
||||
double pix_l = std::min(pd.h_mm, pd.w_mm);
|
||||
|
||||
|
||||
double error = 0.;
|
||||
for (auto &l : lines)
|
||||
error += (unscaled(l.length()) / pix_l) * pix_err;
|
||||
|
||||
|
||||
return error;
|
||||
}
|
||||
|
||||
@ -664,28 +664,42 @@ TEST_CASE("RasterizedPolygonAreaShouldMatch", "[SLARasterOutput]") {
|
||||
double disp_w = 120., disp_h = 68.;
|
||||
sla::Raster::Resolution res{2560, 1440};
|
||||
sla::Raster::PixelDim pixdim{disp_w / res.width_px, disp_h / res.height_px};
|
||||
|
||||
|
||||
sla::Raster raster{res, pixdim};
|
||||
auto bb = BoundingBox({0, 0}, {scaled(disp_w), scaled(disp_h)});
|
||||
|
||||
|
||||
ExPolygon poly = square_with_hole(10.);
|
||||
poly.translate(bb.center().x(), bb.center().y());
|
||||
raster.draw(poly);
|
||||
|
||||
|
||||
double a = poly.area() / (scaled<double>(1.) * scaled(1.));
|
||||
double ra = raster_white_area(raster);
|
||||
double diff = std::abs(a - ra);
|
||||
|
||||
|
||||
REQUIRE(diff <= predict_error(poly, pixdim));
|
||||
|
||||
|
||||
raster.clear();
|
||||
poly = square_with_hole(60.);
|
||||
poly.translate(bb.center().x(), bb.center().y());
|
||||
raster.draw(poly);
|
||||
|
||||
|
||||
a = poly.area() / (scaled<double>(1.) * scaled(1.));
|
||||
ra = raster_white_area(raster);
|
||||
diff = std::abs(a - ra);
|
||||
|
||||
|
||||
REQUIRE(diff <= predict_error(poly, pixdim));
|
||||
}
|
||||
|
||||
TEST_CASE("Triangle mesh conversions should be correct", "[SLAConversions]")
|
||||
{
|
||||
sla::Contour3D cntr;
|
||||
|
||||
{
|
||||
std::fstream infile{"extruder_idler_quads.obj", std::ios::in};
|
||||
cntr.from_obj(infile);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
1
tests/sla_print/sla_print_tests_main.cpp
Normal file
1
tests/sla_print/sla_print_tests_main.cpp
Normal file
@ -0,0 +1 @@
|
||||
#include <catch_main.hpp>
|
Loading…
Reference in New Issue
Block a user