Fix ZAA test failure in test_extrusion_entity.cpp

This commit is contained in:
Aleksandr Dobkin
2026-03-11 00:28:14 -07:00
parent 52d33853cb
commit e8357f60d5
2 changed files with 8 additions and 4 deletions

View File

@@ -280,6 +280,9 @@ public:
Point3(const Point3 &rhs) { *this = rhs; } Point3(const Point3 &rhs) { *this = rhs; }
explicit Point3(const Point &rhs, coord_t z = 0) : Vec3crd(rhs.x(), rhs.y(), z) {} explicit Point3(const Point &rhs, coord_t z = 0) : Vec3crd(rhs.x(), rhs.y(), z) {}
explicit Point3(const Vec3crd &vec3crd) : Vec3crd(vec3crd) {} explicit Point3(const Vec3crd &vec3crd) : Vec3crd(vec3crd) {}
// This constructor allows you to construct Point from Eigen expressions
template<typename OtherDerived>
explicit Point3(const Eigen::MatrixBase<OtherDerived> &other) : Vec3crd(other) {}
static Point3 new_scale(coordf_t x, coordf_t y, coordf_t z) { 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))); return Point3(coord_t(scale_(x)), coord_t(scale_(y)), coord_t(scale_(z)));

View File

@@ -11,18 +11,19 @@
using namespace Slic3r; 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<float>(); Vec3f pt = Vec3f(LO, LO, LO) + (Vec3d(rand(), rand(), rand()) * (HI-LO) / RAND_MAX).cast<float>();
return pt.cast<coord_t>(); return Point3(pt.cast<coord_t>());
} }
// build a sample extrusion entity collection with random start and end points. // 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) static Slic3r::ExtrusionPath random_path(size_t length = 20, float LO = -50, float HI = 50)
{ {
ExtrusionPath t {erPerimeter, 1.0, 1.0, 1.0}; ExtrusionPath t {erPerimeter, 1.0, 1.0, 1.0};
for (size_t j = 0; j < length; ++ j) for (size_t j = 0; j < length; ++ j)
t.polyline.append(random_point(LO, HI)); t.polyline.append(random_point3(LO, HI));
return t; return t;
} }