Removed the PRUS format parser. WIP: admesh eradication:

stl_stats are newly only accessed by TriangleMesh::stats(),
most of the direct access to TriangleMesh::stl is gone with the exception
of parsing input files (3MF, AMF, obj).
This commit is contained in:
Vojtech Bubnik 2021-09-14 11:58:07 +02:00
parent 1c6ecd9c1a
commit 58d8ab3dea
22 changed files with 149 additions and 159 deletions

View file

@ -35,13 +35,6 @@ legend("tan(a) as cura - topographic lines distance limit", "sqrt(tan(a)) as Pru
namespace Slic3r
{
static inline std::pair<float, float> face_z_span(const stl_facet &f)
{
return std::pair<float, float>(
std::min(std::min(f.vertex[0](2), f.vertex[1](2)), f.vertex[2](2)),
std::max(std::max(f.vertex[0](2), f.vertex[1](2)), f.vertex[2](2)));
}
// By Florens Waserfall aka @platch:
// This constant essentially describes the volumetric error at the surface which is induced
// by stacking "elliptic" extrusion threads. It is empirically determined by
@ -88,10 +81,15 @@ void SlicingAdaptive::prepare(const ModelObject &object)
mesh.transform(first_instance.get_matrix(), first_instance.is_left_handed());
// 1) Collect faces from mesh.
m_faces.reserve(mesh.stl.stats.number_of_facets);
for (const stl_facet &face : mesh.stl.facet_start) {
Vec3f n = face.normal.normalized();
m_faces.emplace_back(FaceZ({ face_z_span(face), std::abs(n.z()), std::sqrt(n.x() * n.x() + n.y() * n.y()) }));
m_faces.reserve(mesh.facets_count());
for (stl_triangle_vertex_indices face : mesh.its.indices) {
stl_vertex vertex[3] = { mesh.its.vertices[face[0]], mesh.its.vertices[face[1]], mesh.its.vertices[face[2]] };
stl_vertex n = (vertex[2] - vertex[1]).cross(vertex[3] - vertex[2]).normalized();
std::pair<float, float> face_z_span {
std::min(std::min(vertex[0].z(), vertex[1].z()), vertex[2].z()),
std::max(std::max(vertex[0].z(), vertex[1].z()), vertex[2].z())
};
m_faces.emplace_back(FaceZ({ face_z_span, std::abs(n.z()), std::sqrt(n.x() * n.x() + n.y() * n.y()) }));
}
// 2) Sort faces lexicographically by their Z span.