mirror of
https://github.com/OrcaSlicer/OrcaSlicer.git
synced 2026-09-13 12:07:41 +00: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:
@@ -156,7 +156,7 @@ void ExtrusionLine::simplify(const int64_t smallest_line_segment_squared, const
|
||||
Point intersection_point;
|
||||
bool has_intersection = Line(previous_previous.p, previous.p).intersection_infinite(Line(current.p, next.p), &intersection_point);
|
||||
const auto dist_greater = [](const Point& p1, const Point& p2, const int64_t threshold) {
|
||||
const auto vec = (p1 - p2).cwiseAbs().cast<uint64_t>();
|
||||
const auto vec = (p1 - p2).cwiseAbs().cast<uint64_t>().eval();
|
||||
if(vec.x() > threshold || vec.y() > threshold) {
|
||||
// If this condition is true, the distance is definitely greater than the threshold.
|
||||
// We don't need to calculate the squared norm at all, which avoid potential arithmetic overflow.
|
||||
|
||||
Reference in New Issue
Block a user