Changing the internal representation of Point / Pointf / Point3 / Pointf3 to Eigen Matrix types, first step

This commit is contained in:
bubnikv 2018-08-14 18:33:26 +02:00
parent 077680b806
commit 86da661097
60 changed files with 1228 additions and 1206 deletions

View file

@ -48,10 +48,10 @@ PrintObject::PrintObject(Print* print, ModelObject* model_object, const Bounding
// don't assume it's already aligned and we don't alter the original position in model.
// We store the XY translation so that we can place copies correctly in the output G-code
// (copies are expressed in G-code coordinates and this translation is not publicly exposed).
this->_copies_shift = Point::new_scale(modobj_bbox.min.x, modobj_bbox.min.y);
this->_copies_shift = Point::new_scale(modobj_bbox.min.x(), modobj_bbox.min.y());
// Scale the object size and store it
Pointf3 size = modobj_bbox.size();
this->size = Point3::new_scale(size.x, size.y, size.z);
this->size = Point3::new_scale(size.x(), size.y(), size.z());
}
this->reload_model_instances();
@ -62,7 +62,7 @@ PrintObject::PrintObject(Print* print, ModelObject* model_object, const Bounding
bool PrintObject::add_copy(const Pointf &point)
{
Points points = this->_copies;
points.push_back(Point::new_scale(point.x, point.y));
points.push_back(Point::new_scale(point.x(), point.y()));
return this->set_copies(points);
}
@ -104,7 +104,7 @@ bool PrintObject::reload_model_instances()
for (const ModelInstance *mi : this->_model_object->instances)
{
if (mi->is_printable())
copies.emplace_back(Point::new_scale(mi->offset.x, mi->offset.y));
copies.emplace_back(Point::new_scale(mi->offset.x(), mi->offset.y()));
}
return this->set_copies(copies);
}
@ -1122,7 +1122,7 @@ SlicingParameters PrintObject::slicing_parameters() const
{
return SlicingParameters::create_from_config(
this->print()->config, this->config,
unscale(this->size.z), this->print()->object_extruders());
unscale(this->size.z()), this->print()->object_extruders());
}
bool PrintObject::update_layer_height_profile(std::vector<coordf_t> &layer_height_profile) const
@ -1336,7 +1336,7 @@ std::vector<ExPolygons> PrintObject::_slice_region(size_t region_id, const std::
// consider the first one
this->model_object()->instances.front()->transform_mesh(&mesh, true);
// align mesh to Z = 0 (it should be already aligned actually) and apply XY shift
mesh.translate(- float(unscale(this->_copies_shift.x)), - float(unscale(this->_copies_shift.y)), -float(this->model_object()->bounding_box().min.z));
mesh.translate(- float(unscale(this->_copies_shift.x())), - float(unscale(this->_copies_shift.y())), -float(this->model_object()->bounding_box().min.z()));
// perform actual slicing
TriangleMeshSlicer mslicer(&mesh);
mslicer.slice(z, &layers);