Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/supermerill/SuperSlicer.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'xs/src/libslic3r/Polyline.cpp')
-rw-r--r--xs/src/libslic3r/Polyline.cpp20
1 files changed, 8 insertions, 12 deletions
diff --git a/xs/src/libslic3r/Polyline.cpp b/xs/src/libslic3r/Polyline.cpp
index c94421922..53f59c026 100644
--- a/xs/src/libslic3r/Polyline.cpp
+++ b/xs/src/libslic3r/Polyline.cpp
@@ -194,23 +194,19 @@ Polyline::split_at(const Point &point, Polyline* p1, Polyline* p2) const
}
}
-bool
-Polyline::is_straight() const
+bool Polyline::is_straight() const
{
- /* Check that each segment's direction is equal to the line connecting
- first point and last point. (Checking each line against the previous
- one would cause the error to accumulate.) */
+ // Check that each segment's direction is equal to the line connecting
+ // first point and last point. (Checking each line against the previous
+ // one would cause the error to accumulate.)
double dir = Line(this->first_point(), this->last_point()).direction();
-
- Lines lines = this->lines();
- for (Lines::const_iterator line = lines.begin(); line != lines.end(); ++line) {
- if (!line->parallel_to(dir)) return false;
- }
+ for (const auto &line: this->lines())
+ if (! line.parallel_to(dir))
+ return false;
return true;
}
-std::string
-Polyline::wkt() const
+std::string Polyline::wkt() const
{
std::ostringstream wkt;
wkt << "LINESTRING((";