mirror of
https://github.com/SoftFever/OrcaSlicer.git
synced 2025-08-28 12:31:55 -06:00
Merge branch 'master' of https://github.com/prusa3d/PrusaSlicer into et_sinking_objects_collision
This commit is contained in:
commit
2e779d8594
16 changed files with 166 additions and 67 deletions
|
@ -325,20 +325,24 @@ void TriangleMesh::mirror(const Axis axis)
|
|||
void TriangleMesh::transform(const Transform3d& t, bool fix_left_handed)
|
||||
{
|
||||
its_transform(its, t);
|
||||
if (fix_left_handed && t.matrix().block(0, 0, 3, 3).determinant() < 0.)
|
||||
double det = t.matrix().block(0, 0, 3, 3).determinant();
|
||||
if (fix_left_handed && det < 0.) {
|
||||
its_flip_triangles(its);
|
||||
else
|
||||
m_stats.volume = - m_stats.volume;
|
||||
det = -det;
|
||||
}
|
||||
m_stats.volume *= det;
|
||||
update_bounding_box(this->its, this->m_stats);
|
||||
}
|
||||
|
||||
void TriangleMesh::transform(const Matrix3d& m, bool fix_left_handed)
|
||||
{
|
||||
its_transform(its, m);
|
||||
if (fix_left_handed && m.determinant() < 0.)
|
||||
double det = m.block(0, 0, 3, 3).determinant();
|
||||
if (fix_left_handed && det < 0.) {
|
||||
its_flip_triangles(its);
|
||||
else
|
||||
m_stats.volume = - m_stats.volume;
|
||||
det = -det;
|
||||
}
|
||||
m_stats.volume *= det;
|
||||
update_bounding_box(this->its, this->m_stats);
|
||||
}
|
||||
|
||||
|
@ -486,7 +490,7 @@ TriangleMesh TriangleMesh::convex_hull_3d() const
|
|||
std::vector<int> map_dst_vertices;
|
||||
#ifndef NDEBUG
|
||||
Vec3f centroid = Vec3f::Zero();
|
||||
for (auto pt : this->its.vertices)
|
||||
for (const stl_vertex& pt : this->its.vertices)
|
||||
centroid += pt;
|
||||
centroid /= float(this->its.vertices.size());
|
||||
#endif // NDEBUG
|
||||
|
@ -1282,7 +1286,7 @@ bool its_write_stl_ascii(const char *file, const char *label, const std::vector<
|
|||
|
||||
fprintf(fp, "solid %s\n", label);
|
||||
|
||||
for (const stl_triangle_vertex_indices face : indices) {
|
||||
for (const stl_triangle_vertex_indices& face : indices) {
|
||||
Vec3f vertex[3] = { vertices[face(0)], vertices[face(1)], vertices[face(2)] };
|
||||
Vec3f normal = (vertex[1] - vertex[0]).cross(vertex[2] - vertex[1]).normalized();
|
||||
fprintf(fp, " facet normal % .8E % .8E % .8E\n", normal(0), normal(1), normal(2));
|
||||
|
@ -1322,7 +1326,7 @@ bool its_write_stl_binary(const char *file, const char *label, const std::vector
|
|||
stl_facet f;
|
||||
f.extra[0] = 0;
|
||||
f.extra[1] = 0;
|
||||
for (const stl_triangle_vertex_indices face : indices) {
|
||||
for (const stl_triangle_vertex_indices& face : indices) {
|
||||
f.vertex[0] = vertices[face(0)];
|
||||
f.vertex[1] = vertices[face(1)];
|
||||
f.vertex[2] = vertices[face(2)];
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue