FIX:Calculating convex hull without reassembling the matrix
jira: [none] Change-Id: I6defb793d58762837caeaca58d23ce728461ffd7
This commit is contained in:
parent
eba2d94a53
commit
d4a39655b0
|
@ -1089,7 +1089,7 @@ private:
|
||||||
std::shared_ptr<const TriangleMesh> m_convex_hull;
|
std::shared_ptr<const TriangleMesh> m_convex_hull;
|
||||||
//BBS: add convex hull 2d related logic
|
//BBS: add convex hull 2d related logic
|
||||||
mutable Polygon m_convex_hull_2d; //BBS, used for convex_hell_2d acceleration
|
mutable Polygon m_convex_hull_2d; //BBS, used for convex_hell_2d acceleration
|
||||||
mutable Transform3d m_cached_trans_matrix; //BBS, used for convex_hell_2d acceleration
|
mutable Transform3d m_cached_trans_matrix{Transform3d::Identity()}; // BBS, used for convex_hell_2d acceleration
|
||||||
mutable Polygon m_cached_2d_polygon; //BBS, used for convex_hell_2d acceleration
|
mutable Polygon m_cached_2d_polygon; //BBS, used for convex_hell_2d acceleration
|
||||||
Geometry::Transformation m_transformation;
|
Geometry::Transformation m_transformation;
|
||||||
|
|
||||||
|
|
|
@ -5451,8 +5451,9 @@ std::vector<Vec2f> GLCanvas3D::get_empty_cells(const Vec2f start_point, const Ve
|
||||||
ModelObject* model_object = m_model->objects[i];
|
ModelObject* model_object = m_model->objects[i];
|
||||||
auto id = model_object->id().id;
|
auto id = model_object->id().id;
|
||||||
ModelInstance* model_instance0 = model_object->instances.front();
|
ModelInstance* model_instance0 = model_object->instances.front();
|
||||||
Polygon hull_2d = model_object->convex_hull_2d(Geometry::assemble_transform({ 0.0, 0.0, model_instance0->get_offset().z() }, model_instance0->get_rotation(),
|
Geometry::Transformation temp(model_instance0->get_transformation());
|
||||||
model_instance0->get_scaling_factor(), model_instance0->get_mirror()));
|
temp.set_offset(Vec3d(0.0, 0.0, model_instance0->get_offset().z()));
|
||||||
|
Polygon hull_2d = model_object->convex_hull_2d(temp.get_matrix());
|
||||||
if (hull_2d.empty())
|
if (hull_2d.empty())
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
|
@ -5602,8 +5603,9 @@ void GLCanvas3D::update_sequential_clearance()
|
||||||
for (size_t i = 0; i < m_model->objects.size(); ++i) {
|
for (size_t i = 0; i < m_model->objects.size(); ++i) {
|
||||||
ModelObject* model_object = m_model->objects[i];
|
ModelObject* model_object = m_model->objects[i];
|
||||||
ModelInstance* model_instance0 = model_object->instances.front();
|
ModelInstance* model_instance0 = model_object->instances.front();
|
||||||
Polygon hull_no_offset = model_object->convex_hull_2d(Geometry::assemble_transform({ 0.0, 0.0, model_instance0->get_offset().z() }, model_instance0->get_rotation(),
|
Geometry::Transformation temp(model_instance0->get_transformation());
|
||||||
model_instance0->get_scaling_factor(), model_instance0->get_mirror()));
|
temp.set_offset(Vec3d(0.0, 0.0, model_instance0->get_offset().z()));
|
||||||
|
Polygon hull_no_offset = model_object->convex_hull_2d(temp.get_matrix());
|
||||||
auto tmp = offset(hull_no_offset,
|
auto tmp = offset(hull_no_offset,
|
||||||
// Shrink the extruder_clearance_max_radius a tiny bit, so that if the object arrangement algorithm placed the objects
|
// Shrink the extruder_clearance_max_radius a tiny bit, so that if the object arrangement algorithm placed the objects
|
||||||
// exactly by satisfying the extruder_clearance_max_radius, this test will not trigger collision.
|
// exactly by satisfying the extruder_clearance_max_radius, this test will not trigger collision.
|
||||||
|
|
Loading…
Reference in New Issue