mirror of
https://github.com/SoftFever/OrcaSlicer.git
synced 2025-07-14 02:07:54 -06:00
Add additional parameters to openvdbutils
This commit is contained in:
parent
7808d09d06
commit
d9d11e5686
3 changed files with 76 additions and 18 deletions
|
@ -50,18 +50,32 @@ void Contour3DDataAdapter::getIndexSpacePoint(size_t n,
|
|||
pos = {p.x(), p.y(), p.z()};
|
||||
}
|
||||
|
||||
openvdb::FloatGrid::Ptr meshToVolume(const TriangleMesh & mesh,
|
||||
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);
|
||||
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);
|
||||
Contour3DDataAdapter{mesh}, tr, exteriorBandWidth, interiorBandWidth,
|
||||
flags);
|
||||
}
|
||||
|
||||
inline Vec3f to_vec3f(const openvdb::Vec3s &v) { return Vec3f{v.x(), v.y(), v.z()}; }
|
||||
|
@ -69,11 +83,14 @@ 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])}; }
|
||||
|
||||
sla::Contour3D volumeToMesh(const openvdb::FloatGrid &grid,
|
||||
double isovalue,
|
||||
double adaptivity,
|
||||
bool relaxDisorientedTriangles)
|
||||
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;
|
||||
|
@ -93,4 +110,12 @@ sla::Contour3D volumeToMesh(const openvdb::FloatGrid &grid,
|
|||
return ret;
|
||||
}
|
||||
|
||||
sla::Contour3D volumeToMesh(const openvdb::FloatGrid &grid,
|
||||
double isovalue,
|
||||
double adaptivity,
|
||||
bool relaxDisorientedTriangles)
|
||||
{
|
||||
return _volumeToMesh(grid, isovalue, adaptivity, relaxDisorientedTriangles);
|
||||
}
|
||||
|
||||
} // namespace Slic3r
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue