mirror of
https://github.com/SoftFever/OrcaSlicer.git
synced 2025-10-26 18:21:18 -06:00
Merge branch 'master' of https://github.com/prusa3d/PrusaSlicer into et_gcode_viewer
This commit is contained in:
commit
e57bc8afc1
5 changed files with 81 additions and 2 deletions
|
|
@ -234,6 +234,7 @@ add_library(libslic3r STATIC
|
|||
SLA/Contour3D.cpp
|
||||
SLA/EigenMesh3D.hpp
|
||||
SLA/Clustering.hpp
|
||||
SLA/ReprojectPointsOnMesh.hpp
|
||||
)
|
||||
|
||||
if (SLIC3R_STATIC)
|
||||
|
|
|
|||
45
src/libslic3r/SLA/ReprojectPointsOnMesh.hpp
Normal file
45
src/libslic3r/SLA/ReprojectPointsOnMesh.hpp
Normal file
|
|
@ -0,0 +1,45 @@
|
|||
#ifndef REPROJECTPOINTSONMESH_HPP
|
||||
#define REPROJECTPOINTSONMESH_HPP
|
||||
|
||||
#include "libslic3r/Point.hpp"
|
||||
#include "SupportPoint.hpp"
|
||||
#include "Hollowing.hpp"
|
||||
#include "EigenMesh3D.hpp"
|
||||
#include "libslic3r/Model.hpp"
|
||||
|
||||
#include <tbb/parallel_for.h>
|
||||
|
||||
namespace Slic3r { namespace sla {
|
||||
|
||||
template<class Pt> Vec3d pos(const Pt &p) { return p.pos.template cast<double>(); }
|
||||
template<class Pt> void pos(Pt &p, const Vec3d &pp) { p.pos = pp.cast<float>(); }
|
||||
|
||||
template<class PointType>
|
||||
void reproject_support_points(const EigenMesh3D &mesh, std::vector<PointType> &pts)
|
||||
{
|
||||
tbb::parallel_for(size_t(0), pts.size(), [&mesh, &pts](size_t idx) {
|
||||
int junk;
|
||||
Vec3d new_pos;
|
||||
mesh.squared_distance(pos(pts[idx]), junk, new_pos);
|
||||
pos(pts[idx], new_pos);
|
||||
});
|
||||
}
|
||||
|
||||
inline void reproject_points_and_holes(ModelObject *object)
|
||||
{
|
||||
bool has_sppoints = !object->sla_support_points.empty();
|
||||
bool has_holes = !object->sla_drain_holes.empty();
|
||||
|
||||
if (!object || (!has_holes && !has_sppoints)) return;
|
||||
|
||||
EigenMesh3D emesh{object->raw_mesh()};
|
||||
|
||||
if (has_sppoints)
|
||||
reproject_support_points(emesh, object->sla_support_points);
|
||||
|
||||
if (has_holes)
|
||||
reproject_support_points(emesh, object->sla_drain_holes);
|
||||
}
|
||||
|
||||
}}
|
||||
#endif // REPROJECTPOINTSONMESH_HPP
|
||||
Loading…
Add table
Add a link
Reference in a new issue