mirror of
https://git.mirrors.martin98.com/https://github.com/prusa3d/PrusaSlicer.git
synced 2025-07-31 22:22:00 +08:00
Auto support painting: Don't paint on upwards pointing surfaces.
This commit is contained in:
parent
35195dc03e
commit
96551233e0
@ -11,6 +11,9 @@ TriangleSelectorWrapper::TriangleSelectorWrapper(const TriangleMesh &mesh, const
|
|||||||
void TriangleSelectorWrapper::enforce_spot(const Vec3f &point, const Vec3f &origin, float radius) {
|
void TriangleSelectorWrapper::enforce_spot(const Vec3f &point, const Vec3f &origin, float radius) {
|
||||||
std::vector<igl::Hit> hits;
|
std::vector<igl::Hit> hits;
|
||||||
Vec3f dir = (point - origin).normalized();
|
Vec3f dir = (point - origin).normalized();
|
||||||
|
static constexpr const auto eps_angle = 89.99f;
|
||||||
|
Transform3d trafo_no_translate = mesh_transform;
|
||||||
|
trafo_no_translate.translation() = Vec3d::Zero();
|
||||||
if (AABBTreeIndirect::intersect_ray_all_hits(mesh.its.vertices, mesh.its.indices, triangles_tree,
|
if (AABBTreeIndirect::intersect_ray_all_hits(mesh.its.vertices, mesh.its.indices, triangles_tree,
|
||||||
Vec3d(origin.cast<double>()),
|
Vec3d(origin.cast<double>()),
|
||||||
Vec3d(dir.cast<double>()),
|
Vec3d(dir.cast<double>()),
|
||||||
@ -22,8 +25,8 @@ void TriangleSelectorWrapper::enforce_spot(const Vec3f &point, const Vec3f &orig
|
|||||||
if ((point - pos).norm() < radius && face_normal.dot(dir) < 0) {
|
if ((point - pos).norm() < radius && face_normal.dot(dir) < 0) {
|
||||||
std::unique_ptr<TriangleSelector::Cursor> cursor = std::make_unique<TriangleSelector::Sphere>(
|
std::unique_ptr<TriangleSelector::Cursor> cursor = std::make_unique<TriangleSelector::Sphere>(
|
||||||
pos, origin, radius, this->mesh_transform, TriangleSelector::ClippingPlane { });
|
pos, origin, radius, this->mesh_transform, TriangleSelector::ClippingPlane { });
|
||||||
selector.select_patch(hit.id, std::move(cursor), EnforcerBlockerType::ENFORCER, Transform3d::Identity(),
|
selector.select_patch(hit.id, std::move(cursor), EnforcerBlockerType::ENFORCER, trafo_no_translate,
|
||||||
true, 0.0f);
|
true, eps_angle);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -36,8 +39,8 @@ void TriangleSelectorWrapper::enforce_spot(const Vec3f &point, const Vec3f &orig
|
|||||||
std::unique_ptr<TriangleSelector::Cursor> cursor = std::make_unique<TriangleSelector::Sphere>(
|
std::unique_ptr<TriangleSelector::Cursor> cursor = std::make_unique<TriangleSelector::Sphere>(
|
||||||
point, origin, radius, this->mesh_transform, TriangleSelector::ClippingPlane { });
|
point, origin, radius, this->mesh_transform, TriangleSelector::ClippingPlane { });
|
||||||
selector.select_patch(hit_idx_out, std::move(cursor), EnforcerBlockerType::ENFORCER,
|
selector.select_patch(hit_idx_out, std::move(cursor), EnforcerBlockerType::ENFORCER,
|
||||||
Transform3d::Identity(),
|
trafo_no_translate,
|
||||||
true, 0.0f);
|
true, eps_angle);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user