Fix failing tests

still the arrange is broken
This commit is contained in:
tamasmeszaros 2023-08-16 18:52:05 +02:00
parent cb3596e90b
commit aea278ab55
3 changed files with 10 additions and 9 deletions

View File

@ -90,12 +90,10 @@ BoundingBoxf3 instance_bounding_box(const ModelInstance &mi, bool dont_translate
bool check_coord_bounds(const BoundingBoxf &bb)
{
constexpr double hi = 1000.;
return std::abs(bb.min.x()) < hi &&
std::abs(bb.min.y()) < hi &&
std::abs(bb.max.x()) < hi &&
std::abs(bb.max.y()) < hi;
return std::abs(bb.min.x()) < UnscaledCoordLimit &&
std::abs(bb.min.y()) < UnscaledCoordLimit &&
std::abs(bb.max.x()) < UnscaledCoordLimit &&
std::abs(bb.max.y()) < UnscaledCoordLimit;
}
ExPolygons extract_full_outline(const ModelInstance &inst, const Transform3d &tr)

View File

@ -381,6 +381,8 @@ BoundingBoxf3 instance_bounding_box(const ModelInstance &mi,
const Transform3d &tr,
bool dont_translate = false);
constexpr double UnscaledCoordLimit = 1000.;
ExPolygons extract_full_outline(const ModelInstance &inst,
const Transform3d &tr = Transform3d::Identity());

View File

@ -49,8 +49,8 @@ static Slic3r::Model get_example_model_with_random_cube_objects(size_t N = 0)
for (size_t i = 0; i < cube_count; ++i) {
ModelInstance *inst = new_object->add_instance();
arr2::transform_instance(*inst,
Vec2d{random_value(-200., 200.),
random_value(-200., 200.)},
Vec2d{random_value(-arr2::UnscaledCoordLimit / 10., arr2::UnscaledCoordLimit / 10.),
random_value(-arr2::UnscaledCoordLimit / 10., arr2::UnscaledCoordLimit / 10.)},
random_value(0., 2 * PI));
}
@ -168,7 +168,8 @@ TEMPLATE_TEST_CASE("Writing arrange transformations into ModelInstance should be
{
auto [tx, ty, rot] = GENERATE(map(
[](int i) {
return std::make_tuple(-500. + i * 20., -500. + i * 20.,
return std::make_tuple(-Slic3r::arr2::UnscaledCoordLimit / 2. + i * Slic3r::arr2::UnscaledCoordLimit / 100.,
-Slic3r::arr2::UnscaledCoordLimit / 2. + i * Slic3r::arr2::UnscaledCoordLimit / 100.,
-PI + i * (2 * PI / 100.));
},
range(0, 100)));