Avoid using auto as type of Eigen expressions. (#8577)

According to https://eigen.tuxfamily.org/dox/TopicPitfalls.html one
should just avoid using `auto` as the type of an Eigen expression.

This PR fixes most of them I could found in the project. There might be
cases that I missed, and I might update those later if I noticed.

This should prevent issues like #7741 and hopefully fix some mysterious
crashes happened inside Eigen calls.
This commit is contained in:
Noisyfox 2025-02-26 23:07:23 +08:00 committed by GitHub
parent 41584cfae3
commit 51916ff058
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
18 changed files with 45 additions and 45 deletions

View file

@ -15,8 +15,8 @@ namespace Slic3r {
namespace Measure {
bool get_point_projection_to_plane(const Vec3d &pt, const Vec3d &plane_origin, const Vec3d &plane_normal, Vec3d &intersection_pt)
{
auto normal = plane_normal.normalized();
auto BA = plane_origin - pt;
Vec3d normal = plane_normal.normalized();
Vec3d BA = plane_origin - pt;
auto length = BA.dot(normal);
intersection_pt = pt + length * normal;
return true;
@ -29,7 +29,7 @@ Vec3d get_one_point_in_plane(const Vec3d &plane_origin, const Vec3d &plane_norma
if (abs(plane_normal.dot(dir)) > 1 - eps) {
dir = Vec3d(0, 1, 0);
}
auto new_pt = plane_origin + dir;
Vec3d new_pt = plane_origin + dir;
Vec3d retult;
get_point_projection_to_plane(new_pt, plane_origin, plane_normal, retult);
return retult;