diff options
Diffstat (limited to 'xs/src/libslic3r/Model.cpp')
-rw-r--r-- | xs/src/libslic3r/Model.cpp | 118 |
1 files changed, 59 insertions, 59 deletions
diff --git a/xs/src/libslic3r/Model.cpp b/xs/src/libslic3r/Model.cpp index e22f87f65..dc0a462c0 100644 --- a/xs/src/libslic3r/Model.cpp +++ b/xs/src/libslic3r/Model.cpp @@ -335,11 +335,11 @@ std::string toString(const Model& model, bool holes = true) { ss << "\t\t{\n"; for(auto v : expoly.contour.points) ss << "\t\t\t{" - << v.x() << ", " - << v.y() << "},\n"; + << v(0) << ", " + << v(1) << "},\n"; { auto v = expoly.contour.points.front(); - ss << "\t\t\t{" << v.x() << ", " << v.y() << "},\n"; + ss << "\t\t\t{" << v(0) << ", " << v(1) << "},\n"; } ss << "\t\t},\n"; @@ -348,11 +348,11 @@ std::string toString(const Model& model, bool holes = true) { if(holes) for(auto h : expoly.holes) { ss << "\t\t\t{\n"; for(auto v : h.points) ss << "\t\t\t\t{" - << v.x() << ", " - << v.y() << "},\n"; + << v(0) << ", " + << v(1) << "},\n"; { auto v = h.points.front(); - ss << "\t\t\t\t{" << v.x() << ", " << v.y() << "},\n"; + ss << "\t\t\t\t{" << v(0) << ", " << v(1) << "},\n"; } ss << "\t\t\t},\n"; } @@ -427,8 +427,8 @@ ShapeData2D projectModelFromTop(const Slic3r::Model &model) { if(item.vertexCount() > 3) { item.rotation(objinst->rotation); item.translation( { - ClipperLib::cInt(objinst->offset.x()/SCALING_FACTOR), - ClipperLib::cInt(objinst->offset.y()/SCALING_FACTOR) + ClipperLib::cInt(objinst->offset(0)/SCALING_FACTOR), + ClipperLib::cInt(objinst->offset(1)/SCALING_FACTOR) }); ret.emplace_back(objinst, item); } @@ -499,12 +499,12 @@ bool arrange(Model &model, coordf_t dist, const Slic3r::BoundingBoxf* bb, bbb.scale(1.0/SCALING_FACTOR); bin = Box({ - static_cast<libnest2d::Coord>(bbb.min.x()), - static_cast<libnest2d::Coord>(bbb.min.y()) + static_cast<libnest2d::Coord>(bbb.min(0)), + static_cast<libnest2d::Coord>(bbb.min(1)) }, { - static_cast<libnest2d::Coord>(bbb.max.x()), - static_cast<libnest2d::Coord>(bbb.max.y()) + static_cast<libnest2d::Coord>(bbb.max(0)), + static_cast<libnest2d::Coord>(bbb.max(1)) }); } @@ -718,8 +718,8 @@ void Model::duplicate_objects_grid(size_t x, size_t y, coordf_t dist) for (size_t x_copy = 1; x_copy <= x; ++x_copy) { for (size_t y_copy = 1; y_copy <= y; ++y_copy) { ModelInstance* instance = object->add_instance(); - instance->offset.x() = (size.x() + dist) * (x_copy-1); - instance->offset.y() = (size.y() + dist) * (y_copy-1); + instance->offset(0) = (size(0) + dist) * (x_copy-1); + instance->offset(1) = (size(1) + dist) * (y_copy-1); } } } @@ -733,7 +733,7 @@ bool Model::looks_like_multipart_object() const if (obj->volumes.size() > 1 || obj->config.keys().size() > 1) return false; for (const ModelVolume *vol : obj->volumes) { - double zmin_this = vol->mesh.bounding_box().min.z(); + double zmin_this = vol->mesh.bounding_box().min(2); if (zmin == std::numeric_limits<double>::max()) zmin = zmin_this; else if (std::abs(zmin - zmin_this) > EPSILON) @@ -777,13 +777,13 @@ void Model::adjust_min_z() if (objects.empty()) return; - if (bounding_box().min.z() < 0.0) + if (bounding_box().min(2) < 0.0) { for (ModelObject* obj : objects) { if (obj != nullptr) { - coordf_t obj_min_z = obj->bounding_box().min.z(); + coordf_t obj_min_z = obj->bounding_box().min(2); if (obj_min_z < 0.0) obj->translate(0.0, 0.0, -obj_min_z); } @@ -983,19 +983,19 @@ BoundingBoxf3 ModelObject::tight_bounding_box(bool include_modifiers) const Pointf3 p((double)v.x, (double)v.y, (double)v.z); // scale - p.x() *= inst->scaling_factor; - p.y() *= inst->scaling_factor; - p.z() *= inst->scaling_factor; + p(0) *= inst->scaling_factor; + p(1) *= inst->scaling_factor; + p(2) *= inst->scaling_factor; // rotate Z - double x = p.x(); - double y = p.y(); - p.x() = c * x - s * y; - p.y() = s * x + c * y; + double x = p(0); + double y = p(1); + p(0) = c * x - s * y; + p(1) = s * x + c * y; // translate - p.x() += inst->offset.x(); - p.y() += inst->offset.y(); + p(0) += inst->offset(0); + p(1) += inst->offset(1); bb.merge(p); } @@ -1065,12 +1065,12 @@ void ModelObject::center_around_origin() bb.merge(v->mesh.bounding_box()); // first align to origin on XYZ - Vectorf3 vector(-bb.min.x(), -bb.min.y(), -bb.min.z()); + Vectorf3 vector(-bb.min(0), -bb.min(1), -bb.min(2)); // then center it on XY Sizef3 size = bb.size(); - vector.x() -= size.x()/2; - vector.y() -= size.y()/2; + vector(0) -= size(0)/2; + vector(1) -= size(1)/2; this->translate(vector); this->origin_translation += vector; @@ -1256,19 +1256,19 @@ void ModelObject::check_instances_print_volume_state(const BoundingBoxf3& print_ Pointf3 p((double)v.x, (double)v.y, (double)v.z); // scale - p.x() *= inst->scaling_factor; - p.y() *= inst->scaling_factor; - p.z() *= inst->scaling_factor; + p(0) *= inst->scaling_factor; + p(1) *= inst->scaling_factor; + p(2) *= inst->scaling_factor; // rotate Z - double x = p.x(); - double y = p.y(); - p.x() = c * x - s * y; - p.y() = s * x + c * y; + double x = p(0); + double y = p(1); + p(0) = c * x - s * y; + p(1) = s * x + c * y; // translate - p.x() += inst->offset.x(); - p.y() += inst->offset.y(); + p(0) += inst->offset(0); + p(1) += inst->offset(1); bb.merge(p); } @@ -1295,15 +1295,15 @@ void ModelObject::print_info() const mesh.check_topology(); BoundingBoxf3 bb = mesh.bounding_box(); Sizef3 size = bb.size(); - cout << "size_x = " << size.x() << endl; - cout << "size_y = " << size.y() << endl; - cout << "size_z = " << size.z() << endl; - cout << "min_x = " << bb.min.x() << endl; - cout << "min_y = " << bb.min.y() << endl; - cout << "min_z = " << bb.min.z() << endl; - cout << "max_x = " << bb.max.x() << endl; - cout << "max_y = " << bb.max.y() << endl; - cout << "max_z = " << bb.max.z() << endl; + cout << "size_x = " << size(0) << endl; + cout << "size_y = " << size(1) << endl; + cout << "size_z = " << size(2) << endl; + cout << "min_x = " << bb.min(0) << endl; + cout << "min_y = " << bb.min(1) << endl; + cout << "min_z = " << bb.min(2) << endl; + cout << "max_x = " << bb.max(0) << endl; + cout << "max_y = " << bb.max(1) << endl; + cout << "max_z = " << bb.max(2) << endl; cout << "number_of_facets = " << mesh.stl.stats.number_of_facets << endl; cout << "manifold = " << (mesh.is_manifold() ? "yes" : "no") << endl; @@ -1394,7 +1394,7 @@ void ModelInstance::transform_mesh(TriangleMesh* mesh, bool dont_translate) cons mesh->rotate_z(this->rotation); // rotate around mesh origin mesh->scale(this->scaling_factor); // scale around mesh origin if (!dont_translate) - mesh->translate(this->offset.x(), this->offset.y(), 0); + mesh->translate(this->offset(0), this->offset(1), 0); } BoundingBoxf3 ModelInstance::transform_mesh_bounding_box(const TriangleMesh* mesh, bool dont_translate) const @@ -1417,19 +1417,19 @@ BoundingBoxf3 ModelInstance::transform_mesh_bounding_box(const TriangleMesh* mes if (! empty(bbox)) { // Scale the bounding box uniformly. if (std::abs(this->scaling_factor - 1.) > EPSILON) { - bbox.min.x() *= float(this->scaling_factor); - bbox.min.y() *= float(this->scaling_factor); - bbox.min.z() *= float(this->scaling_factor); - bbox.max.x() *= float(this->scaling_factor); - bbox.max.y() *= float(this->scaling_factor); - bbox.max.z() *= float(this->scaling_factor); + bbox.min(0) *= float(this->scaling_factor); + bbox.min(1) *= float(this->scaling_factor); + bbox.min(2) *= float(this->scaling_factor); + bbox.max(0) *= float(this->scaling_factor); + bbox.max(1) *= float(this->scaling_factor); + bbox.max(2) *= float(this->scaling_factor); } // Translate the bounding box. if (! dont_translate) { - bbox.min.x() += float(this->offset.x()); - bbox.min.y() += float(this->offset.y()); - bbox.max.x() += float(this->offset.x()); - bbox.max.y() += float(this->offset.y()); + bbox.min(0) += float(this->offset(0)); + bbox.min(1) += float(this->offset(1)); + bbox.max(0) += float(this->offset(0)); + bbox.max(1) += float(this->offset(1)); } } return bbox; @@ -1439,7 +1439,7 @@ BoundingBoxf3 ModelInstance::transform_bounding_box(const BoundingBoxf3 &bbox, b { auto matrix = Transform3f::Identity(); if (!dont_translate) - matrix.translate(Vec3f((float)offset.x(), (float)offset.y(), 0.0f)); + matrix.translate(Vec3f((float)offset(0), (float)offset(1), 0.0f)); matrix.rotate(Eigen::AngleAxisf(rotation, Vec3f::UnitZ())); matrix.scale(scaling_factor); return bbox.transformed(matrix); |