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

@ -26,7 +26,7 @@ void FillRectilinear::_fill_surface_single(
// define flow spacing according to requested density
if (params.density > 0.9999f && !params.dont_adjust) {
this->_line_spacing = this->_adjust_solid_spacing(bounding_box.size().x, this->_line_spacing);
this->_line_spacing = this->_adjust_solid_spacing(bounding_box.size().x(), this->_line_spacing);
this->spacing = unscale(this->_line_spacing);
} else {
// extend bounding box so that our pattern will be aligned with other layers
@ -38,14 +38,14 @@ void FillRectilinear::_fill_surface_single(
}
// generate the basic pattern
coord_t x_max = bounding_box.max.x + SCALED_EPSILON;
coord_t x_max = bounding_box.max.x() + SCALED_EPSILON;
Lines lines;
for (coord_t x = bounding_box.min.x; x <= x_max; x += this->_line_spacing)
lines.push_back(this->_line(lines.size(), x, bounding_box.min.y, bounding_box.max.y));
for (coord_t x = bounding_box.min.x(); x <= x_max; x += this->_line_spacing)
lines.push_back(this->_line(lines.size(), x, bounding_box.min.y(), bounding_box.max.y()));
if (this->_horizontal_lines()) {
coord_t y_max = bounding_box.max.y + SCALED_EPSILON;
for (coord_t y = bounding_box.min.y; y <= y_max; y += this->_line_spacing)
lines.push_back(Line(Point(bounding_box.min.x, y), Point(bounding_box.max.x, y)));
coord_t y_max = bounding_box.max.y() + SCALED_EPSILON;
for (coord_t y = bounding_box.min.y(); y <= y_max; y += this->_line_spacing)
lines.push_back(Line(Point(bounding_box.min.x(), y), Point(bounding_box.max.x(), y)));
}
// clip paths against a slightly larger expolygon, so that the first and last paths
@ -72,10 +72,10 @@ void FillRectilinear::_fill_surface_single(
for (Polylines::iterator it_polyline = polylines.begin(); it_polyline != polylines.end(); ++ it_polyline) {
Point *first_point = &it_polyline->points.front();
Point *last_point = &it_polyline->points.back();
if (first_point->y > last_point->y)
if (first_point->y() > last_point->y())
std::swap(first_point, last_point);
first_point->y -= extra;
last_point->y += extra;
first_point->y() -= extra;
last_point->y() += extra;
}
size_t n_polylines_out_old = polylines_out.size();
@ -106,7 +106,7 @@ void FillRectilinear::_fill_surface_single(
const Vector distance = first_point.vector_to(last_point);
// TODO: we should also check that both points are on a fill_boundary to avoid
// connecting paths on the boundaries of internal regions
if (this->_can_connect(std::abs(distance.x), std::abs(distance.y)) &&
if (this->_can_connect(std::abs(distance.x()), std::abs(distance.y())) &&
expolygon_off.contains(Line(last_point, first_point))) {
// Append the polyline.
pts_end.insert(pts_end.end(), it_polyline->points.begin(), it_polyline->points.end());
@ -122,7 +122,7 @@ void FillRectilinear::_fill_surface_single(
// paths must be rotated back
for (Polylines::iterator it = polylines_out.begin() + n_polylines_out_old; it != polylines_out.end(); ++ it) {
// No need to translate, the absolute position is irrelevant.
// it->translate(- direction.second.x, - direction.second.y);
// it->translate(- direction.second.x(), - direction.second.y());
it->rotate(direction.first);
}
}