2019-11-01 14:31:26 +00:00
|
|
|
#ifndef OPENVDBUTILS_HPP
|
|
|
|
#define OPENVDBUTILS_HPP
|
2019-10-31 13:36:33 +00:00
|
|
|
|
|
|
|
#include <libslic3r/TriangleMesh.hpp>
|
2019-11-11 10:41:14 +00:00
|
|
|
#include <libslic3r/SLA/Common.hpp>
|
|
|
|
#include <libslic3r/SLA/Contour3D.hpp>
|
2019-10-31 13:36:33 +00:00
|
|
|
#include <openvdb/openvdb.h>
|
|
|
|
|
|
|
|
namespace Slic3r {
|
|
|
|
|
2019-11-08 15:51:43 +00:00
|
|
|
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])}; }
|
|
|
|
|
|
|
|
openvdb::FloatGrid::Ptr mesh_to_grid(const TriangleMesh & mesh,
|
2019-11-05 13:48:00 +00:00
|
|
|
const openvdb::math::Transform &tr = {},
|
2019-11-05 08:43:42 +00:00
|
|
|
float exteriorBandWidth = 3.0f,
|
|
|
|
float interiorBandWidth = 3.0f,
|
2019-11-05 13:48:00 +00:00
|
|
|
int flags = 0);
|
2019-10-31 13:36:33 +00:00
|
|
|
|
2019-11-08 15:51:43 +00:00
|
|
|
openvdb::FloatGrid::Ptr mesh_to_grid(const sla::Contour3D & mesh,
|
2019-11-05 13:48:00 +00:00
|
|
|
const openvdb::math::Transform &tr = {},
|
2019-11-05 08:43:42 +00:00
|
|
|
float exteriorBandWidth = 3.0f,
|
|
|
|
float interiorBandWidth = 3.0f,
|
2019-11-05 13:48:00 +00:00
|
|
|
int flags = 0);
|
2019-10-31 13:36:33 +00:00
|
|
|
|
2019-11-08 15:51:43 +00:00
|
|
|
sla::Contour3D grid_to_contour3d(const openvdb::FloatGrid &grid,
|
|
|
|
double isovalue,
|
|
|
|
double adaptivity,
|
|
|
|
bool relaxDisorientedTriangles = true);
|
|
|
|
|
|
|
|
TriangleMesh grid_to_mesh(const openvdb::FloatGrid &grid,
|
2019-11-06 12:38:43 +00:00
|
|
|
double isovalue = 0.0,
|
|
|
|
double adaptivity = 0.0,
|
|
|
|
bool relaxDisorientedTriangles = true);
|
|
|
|
|
2019-11-08 15:51:43 +00:00
|
|
|
openvdb::FloatGrid::Ptr redistance_grid(const openvdb::FloatGrid &grid,
|
|
|
|
double iso,
|
|
|
|
double ext_range = 3.,
|
|
|
|
double int_range = 3.);
|
2019-10-31 13:36:33 +00:00
|
|
|
|
|
|
|
} // namespace Slic3r
|
|
|
|
|
2019-11-01 14:31:26 +00:00
|
|
|
#endif // OPENVDBUTILS_HPP
|