Fixing corrupted SLA pad
fixes SPE-1157
This commit is contained in:
parent
27ee53b9e3
commit
ce81c02049
@ -47,7 +47,7 @@ inline indexed_triangle_set straight_walls(const Polygon &plate,
|
||||
double lo_z,
|
||||
double hi_z)
|
||||
{
|
||||
return walls(plate, plate, lo_z, hi_z);
|
||||
return wall_strip(plate, hi_z, lo_z); //walls(plate, plate, lo_z, hi_z);
|
||||
}
|
||||
|
||||
// Function to cut tiny connector cavities for a given polygon. The input poly
|
||||
|
@ -2,7 +2,6 @@
|
||||
|
||||
#include "SlicesToTriangleMesh.hpp"
|
||||
|
||||
//#include "libslic3r/MTUtils.hpp"
|
||||
#include "libslic3r/Execution/ExecutionTBB.hpp"
|
||||
#include "libslic3r/ClipperUtils.hpp"
|
||||
#include "libslic3r/Tesselate.hpp"
|
||||
@ -12,39 +11,6 @@
|
||||
|
||||
namespace Slic3r {
|
||||
|
||||
inline indexed_triangle_set wall_strip(const Polygon &poly,
|
||||
double lower_z_mm,
|
||||
double upper_z_mm)
|
||||
{
|
||||
indexed_triangle_set ret;
|
||||
|
||||
size_t startidx = ret.vertices.size();
|
||||
size_t offs = poly.points.size();
|
||||
|
||||
ret.vertices.reserve(ret.vertices.size() + 2 *offs);
|
||||
|
||||
// The expression unscaled(p).cast<float>().eval() is important here
|
||||
// as it ensures identical conversion of 2D scaled coordinates to float 3D
|
||||
// to that used by the tesselation. This way, the duplicated vertices in the
|
||||
// output mesh can be found with the == operator of the points.
|
||||
// its_merge_vertices will then reliably remove the duplicates.
|
||||
for (const Point &p : poly.points)
|
||||
ret.vertices.emplace_back(to_3d(unscaled(p).cast<float>().eval(), float(lower_z_mm)));
|
||||
|
||||
for (const Point &p : poly.points)
|
||||
ret.vertices.emplace_back(to_3d(unscaled(p).cast<float>().eval(), float(upper_z_mm)));
|
||||
|
||||
for (size_t i = startidx + 1; i < startidx + offs; ++i) {
|
||||
ret.indices.emplace_back(i - 1, i, i + offs - 1);
|
||||
ret.indices.emplace_back(i, i + offs, i + offs - 1);
|
||||
}
|
||||
|
||||
ret.indices.emplace_back(startidx + offs - 1, startidx, startidx + 2 * offs - 1);
|
||||
ret.indices.emplace_back(startidx, startidx + offs, startidx + 2 * offs - 1);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
// Same as walls() but with identical higher and lower polygons.
|
||||
indexed_triangle_set inline straight_walls(const Polygon &plate,
|
||||
double lo_z,
|
||||
|
@ -245,4 +245,35 @@ std::vector<Vec2f> triangulate_expolygons_2f(const ExPolygons &polys, bool flip)
|
||||
return out;
|
||||
}
|
||||
|
||||
indexed_triangle_set wall_strip(const Polygon &poly, double lower_z_mm, double upper_z_mm)
|
||||
{
|
||||
indexed_triangle_set ret;
|
||||
|
||||
size_t startidx = ret.vertices.size();
|
||||
size_t offs = poly.points.size();
|
||||
|
||||
ret.vertices.reserve(ret.vertices.size() + 2 *offs);
|
||||
|
||||
// The expression unscaled(p).cast<float>().eval() is important here
|
||||
// as it ensures identical conversion of 2D scaled coordinates to float 3D
|
||||
// to that used by the tesselation. This way, the duplicated vertices in the
|
||||
// output mesh can be found with the == operator of the points.
|
||||
// its_merge_vertices will then reliably remove the duplicates.
|
||||
for (const Point &p : poly.points)
|
||||
ret.vertices.emplace_back(to_3d(unscaled(p).cast<float>().eval(), float(lower_z_mm)));
|
||||
|
||||
for (const Point &p : poly.points)
|
||||
ret.vertices.emplace_back(to_3d(unscaled(p).cast<float>().eval(), float(upper_z_mm)));
|
||||
|
||||
for (size_t i = startidx + 1; i < startidx + offs; ++i) {
|
||||
ret.indices.emplace_back(i - 1, i, i + offs - 1);
|
||||
ret.indices.emplace_back(i, i + offs, i + offs - 1);
|
||||
}
|
||||
|
||||
ret.indices.emplace_back(startidx + offs - 1, startidx, startidx + 2 * offs - 1);
|
||||
ret.indices.emplace_back(startidx, startidx + offs, startidx + 2 * offs - 1);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
} // namespace Slic3r
|
||||
|
@ -2,14 +2,12 @@
|
||||
#define slic3r_Tesselate_hpp_
|
||||
|
||||
#include <vector>
|
||||
#include <admesh/stl.h>
|
||||
|
||||
#include "Point.hpp"
|
||||
#include "ExPolygon.hpp"
|
||||
|
||||
namespace Slic3r {
|
||||
|
||||
class ExPolygon;
|
||||
typedef std::vector<ExPolygon> ExPolygons;
|
||||
|
||||
const bool constexpr NORMALS_UP = false;
|
||||
const bool constexpr NORMALS_DOWN = true;
|
||||
|
||||
@ -20,6 +18,10 @@ extern std::vector<Vec2d> triangulate_expolygons_2d(const ExPolygons &polys, boo
|
||||
extern std::vector<Vec2f> triangulate_expolygon_2f (const ExPolygon &poly, bool flip = NORMALS_UP);
|
||||
extern std::vector<Vec2f> triangulate_expolygons_2f(const ExPolygons &polys, bool flip = NORMALS_UP);
|
||||
|
||||
indexed_triangle_set wall_strip(const Polygon &poly,
|
||||
double lower_z_mm,
|
||||
double upper_z_mm);
|
||||
|
||||
} // namespace Slic3r
|
||||
|
||||
#endif /* slic3r_Tesselate_hpp_ */
|
||||
|
Loading…
Reference in New Issue
Block a user