Trying to fix transformation assembly problem for arrange polyogon
This commit is contained in:
parent
03608580c0
commit
6831b7094a
@ -2406,11 +2406,12 @@ arrangement::ArrangePolygon ModelInstance::get_arrange_polygon() const
|
|||||||
{
|
{
|
||||||
// static const double SIMPLIFY_TOLERANCE_MM = 0.1;
|
// static const double SIMPLIFY_TOLERANCE_MM = 0.1;
|
||||||
|
|
||||||
Vec3d rotation = get_rotation();
|
// Vec3d rotation = get_rotation();
|
||||||
rotation.z() = 0.;
|
// rotation.z() = 0.;
|
||||||
Transform3d trafo_instance = Geometry::assemble_transform(get_offset().z() * Vec3d::UnitZ(), rotation, get_scaling_factor(), get_mirror());
|
// Transform3d trafo_instance = Geometry::assemble_transform(get_offset().z() * Vec3d::UnitZ(), rotation, get_scaling_factor(), get_mirror());
|
||||||
|
|
||||||
Polygon p = get_object()->convex_hull_2d(trafo_instance);
|
|
||||||
|
Polygon p = get_object()->convex_hull_2d(this->get_matrix());
|
||||||
|
|
||||||
// if (!p.points.empty()) {
|
// if (!p.points.empty()) {
|
||||||
// Polygons pp{p};
|
// Polygons pp{p};
|
||||||
@ -2420,8 +2421,8 @@ arrangement::ArrangePolygon ModelInstance::get_arrange_polygon() const
|
|||||||
|
|
||||||
arrangement::ArrangePolygon ret;
|
arrangement::ArrangePolygon ret;
|
||||||
ret.poly.contour = std::move(p);
|
ret.poly.contour = std::move(p);
|
||||||
ret.translation = Vec2crd{scaled(get_offset(X)), scaled(get_offset(Y))};
|
ret.translation = Vec2crd::Zero(); //Vec2crd{scaled(get_offset(X)), scaled(get_offset(Y))};
|
||||||
ret.rotation = get_rotation(Z);
|
ret.rotation = 0.;
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
@ -1170,9 +1170,16 @@ public:
|
|||||||
void apply_arrange_result(const Vec2d& offs, double rotation)
|
void apply_arrange_result(const Vec2d& offs, double rotation)
|
||||||
{
|
{
|
||||||
// write the transformation data into the model instance
|
// write the transformation data into the model instance
|
||||||
set_rotation(Z, rotation);
|
// set_rotation(Z, rotation);
|
||||||
set_offset(X, unscale<double>(offs(X)));
|
// set_offset(X, unscale<double>(offs(X)));
|
||||||
set_offset(Y, unscale<double>(offs(Y)));
|
// set_offset(Y, unscale<double>(offs(Y)));
|
||||||
|
auto trafo = get_transformation().get_matrix();
|
||||||
|
trafo.translate(to_3d(unscaled(offs), 0.));
|
||||||
|
trafo.rotate(Eigen::AngleAxisd(rotation, Vec3d::UnitZ()));
|
||||||
|
m_transformation.set_matrix(trafo);
|
||||||
|
|
||||||
|
// set_rotation(Z, get_rotation().z() + rotation);
|
||||||
|
// set_offset(get_offset() + to_3d(unscaled(offs), 0.));
|
||||||
this->object->invalidate_bounding_box();
|
this->object->invalidate_bounding_box();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user