From e8357f60d55130d639a2af275c2da7066f0642b3 Mon Sep 17 00:00:00 2001 From: Aleksandr Dobkin Date: Wed, 11 Mar 2026 00:28:14 -0700 Subject: [PATCH] Fix ZAA test failure in test_extrusion_entity.cpp --- src/libslic3r/Point.hpp | 3 +++ tests/fff_print/test_extrusion_entity.cpp | 9 +++++---- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/src/libslic3r/Point.hpp b/src/libslic3r/Point.hpp index f75bbb9a46..bde79076ef 100644 --- a/src/libslic3r/Point.hpp +++ b/src/libslic3r/Point.hpp @@ -280,6 +280,9 @@ public: Point3(const Point3 &rhs) { *this = rhs; } explicit Point3(const Point &rhs, coord_t z = 0) : Vec3crd(rhs.x(), rhs.y(), z) {} explicit Point3(const Vec3crd &vec3crd) : Vec3crd(vec3crd) {} + // This constructor allows you to construct Point from Eigen expressions + template + explicit Point3(const Eigen::MatrixBase &other) : Vec3crd(other) {} static Point3 new_scale(coordf_t x, coordf_t y, coordf_t z) { return Point3(coord_t(scale_(x)), coord_t(scale_(y)), coord_t(scale_(z))); diff --git a/tests/fff_print/test_extrusion_entity.cpp b/tests/fff_print/test_extrusion_entity.cpp index 4c41c2dc8d..f568825baf 100644 --- a/tests/fff_print/test_extrusion_entity.cpp +++ b/tests/fff_print/test_extrusion_entity.cpp @@ -11,18 +11,19 @@ using namespace Slic3r; -static inline Slic3r::Point random_point(float LO=-50, float HI=50) +static inline Slic3r::Point3 random_point3(float LO=-50, float HI=50) { - Vec2f pt = Vec2f(LO, LO) + (Vec2d(rand(), rand()) * (HI-LO) / RAND_MAX).cast(); - return pt.cast(); + Vec3f pt = Vec3f(LO, LO, LO) + (Vec3d(rand(), rand(), rand()) * (HI-LO) / RAND_MAX).cast(); + return Point3(pt.cast()); } + // build a sample extrusion entity collection with random start and end points. static Slic3r::ExtrusionPath random_path(size_t length = 20, float LO = -50, float HI = 50) { ExtrusionPath t {erPerimeter, 1.0, 1.0, 1.0}; for (size_t j = 0; j < length; ++ j) - t.polyline.append(random_point(LO, HI)); + t.polyline.append(random_point3(LO, HI)); return t; }