mirror of
https://github.com/OrcaSlicer/OrcaSlicer.git
synced 2026-05-14 00:52:04 +00:00
Fix ZAA test failure in test_extrusion_entity.cpp
This commit is contained in:
@@ -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<typename OtherDerived>
|
||||
explicit Point3(const Eigen::MatrixBase<OtherDerived> &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)));
|
||||
|
||||
@@ -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<float>();
|
||||
return pt.cast<coord_t>();
|
||||
Vec3f pt = Vec3f(LO, LO, LO) + (Vec3d(rand(), rand(), rand()) * (HI-LO) / RAND_MAX).cast<float>();
|
||||
return Point3(pt.cast<coord_t>());
|
||||
}
|
||||
|
||||
|
||||
// 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;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user