Merge remote-tracking branch 'remotes/origin/master' into vb_optimizations
This commit is contained in:
commit
2eebba82f8
@ -2405,12 +2405,8 @@ void ModelInstance::transform_polygon(Polygon* polygon) const
|
|||||||
arrangement::ArrangePolygon ModelInstance::get_arrange_polygon() const
|
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();
|
|
||||||
rotation.z() = 0.;
|
|
||||||
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,12 +2416,24 @@ 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();
|
||||||
ret.rotation = get_rotation(Z);
|
ret.rotation = 0.;
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void ModelInstance::apply_arrange_result(const Vec2d &offs, double rotation)
|
||||||
|
{
|
||||||
|
// write the transformation data into the model instance
|
||||||
|
auto trafo = get_transformation().get_matrix();
|
||||||
|
auto tr = Transform3d::Identity();
|
||||||
|
tr.translate(to_3d(unscaled(offs), 0.));
|
||||||
|
trafo = tr * Eigen::AngleAxisd(rotation, Vec3d::UnitZ()) * trafo;
|
||||||
|
m_transformation.set_matrix(trafo);
|
||||||
|
|
||||||
|
this->object->invalidate_bounding_box();
|
||||||
|
}
|
||||||
|
|
||||||
indexed_triangle_set FacetsAnnotation::get_facets(const ModelVolume& mv, EnforcerBlockerType type) const
|
indexed_triangle_set FacetsAnnotation::get_facets(const ModelVolume& mv, EnforcerBlockerType type) const
|
||||||
{
|
{
|
||||||
TriangleSelector selector(mv.mesh());
|
TriangleSelector selector(mv.mesh());
|
||||||
|
@ -1167,14 +1167,7 @@ public:
|
|||||||
arrangement::ArrangePolygon get_arrange_polygon() const;
|
arrangement::ArrangePolygon get_arrange_polygon() const;
|
||||||
|
|
||||||
// Apply the arrange result on the ModelInstance
|
// Apply the arrange result on the ModelInstance
|
||||||
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
|
|
||||||
set_rotation(Z, rotation);
|
|
||||||
set_offset(X, unscale<double>(offs(X)));
|
|
||||||
set_offset(Y, unscale<double>(offs(Y)));
|
|
||||||
this->object->invalidate_bounding_box();
|
|
||||||
}
|
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
friend class Print;
|
friend class Print;
|
||||||
|
@ -305,7 +305,7 @@ void SLAPrint::Steps::generate_preview(SLAPrintObject &po, SLAPrintObjectStep st
|
|||||||
|
|
||||||
bench.stop();
|
bench.stop();
|
||||||
|
|
||||||
if (!m.empty())
|
if (!po.m_preview_meshes[step]->empty())
|
||||||
BOOST_LOG_TRIVIAL(trace) << "Preview gen took: " << bench.getElapsedSec();
|
BOOST_LOG_TRIVIAL(trace) << "Preview gen took: " << bench.getElapsedSec();
|
||||||
else
|
else
|
||||||
BOOST_LOG_TRIVIAL(error) << "Preview failed!";
|
BOOST_LOG_TRIVIAL(error) << "Preview failed!";
|
||||||
|
Loading…
Reference in New Issue
Block a user