mirror of
https://github.com/SoftFever/OrcaSlicer.git
synced 2025-07-16 11:17:51 -06:00
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:
parent
41584cfae3
commit
51916ff058
18 changed files with 45 additions and 45 deletions
|
@ -1447,7 +1447,7 @@ static std::vector<CubeProperties> make_cubes_properties(double max_cube_edge_le
|
|||
static inline bool is_overhang_triangle(const Vec3d &a, const Vec3d &b, const Vec3d &c, const Vec3d &up)
|
||||
{
|
||||
// Calculate triangle normal.
|
||||
auto n = (b - a).cross(c - b);
|
||||
Vec3d n = (b - a).cross(c - b);
|
||||
return n.dot(up) > 0.707 * n.norm();
|
||||
}
|
||||
|
||||
|
@ -1493,9 +1493,9 @@ OctreePtr build_octree(
|
|||
};
|
||||
auto up_vector = support_overhangs_only ? Vec3d(transform_to_octree() * Vec3d(0., 0., 1.)) : Vec3d();
|
||||
for (auto &tri : triangle_mesh.indices) {
|
||||
auto a = triangle_mesh.vertices[tri[0]].cast<double>();
|
||||
auto b = triangle_mesh.vertices[tri[1]].cast<double>();
|
||||
auto c = triangle_mesh.vertices[tri[2]].cast<double>();
|
||||
Vec3d a = triangle_mesh.vertices[tri[0]].cast<double>();
|
||||
Vec3d b = triangle_mesh.vertices[tri[1]].cast<double>();
|
||||
Vec3d c = triangle_mesh.vertices[tri[2]].cast<double>();
|
||||
if (! support_overhangs_only || is_overhang_triangle(a, b, c, up_vector))
|
||||
process_triangle(a, b, c);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue