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
18 changed files with 45 additions and 45 deletions

View File

@@ -2991,11 +2991,11 @@ bool Model::obj_import_vertex_color_deal(const std::vector<unsigned char> &verte
auto v0 = volume->mesh().its.vertices[face[0]];
auto v1 = volume->mesh().its.vertices[face[1]];
auto v2 = volume->mesh().its.vertices[face[2]];
auto dir_0_1 = (v1 - v0).normalized();
auto dir_0_2 = (v2 - v0).normalized();
auto dir_0_1 = (v1 - v0).normalized().eval();
auto dir_0_2 = (v2 - v0).normalized().eval();
float sita0 = acos(dir_0_1.dot(dir_0_2));
auto dir_1_0 = -dir_0_1;
auto dir_1_2 = (v2 - v1).normalized();
auto dir_1_0 = (-dir_0_1).eval();
auto dir_1_2 = (v2 - v1).normalized().eval();
float sita1 = acos(dir_1_0.dot(dir_1_2));
float sita2 = PI - sita0 - sita1;
std::array<float, 3> sitas = {sita0, sita1, sita2};