mirror of
https://github.com/SoftFever/OrcaSlicer.git
synced 2025-07-18 20:28:08 -06:00
Move semantics on MultiPoint, Polygon, Polyline.
Append methods on Polyline. squared length function on point->DistanceTo
This commit is contained in:
parent
50cdf8e6d1
commit
0b90ebd74e
6 changed files with 69 additions and 35 deletions
|
@ -18,7 +18,11 @@ class MultiPoint
|
|||
|
||||
operator Points() const;
|
||||
MultiPoint() {};
|
||||
explicit MultiPoint(const Points &_points): points(_points) {};
|
||||
MultiPoint(const MultiPoint &other) : points(other.points) {}
|
||||
MultiPoint(MultiPoint &&other) : points(std::move(other.points)) {}
|
||||
explicit MultiPoint(const Points &_points): points(_points) {}
|
||||
MultiPoint& operator=(const MultiPoint &other) { points = other.points; return *this; }
|
||||
MultiPoint& operator=(MultiPoint &&other) { points = std::move(other.points); return *this; }
|
||||
void scale(double factor);
|
||||
void translate(double x, double y);
|
||||
void translate(const Point &vector);
|
||||
|
@ -38,9 +42,17 @@ class MultiPoint
|
|||
bool has_duplicate_points() const;
|
||||
// Remove exact duplicates, return true if any duplicate has been removed.
|
||||
bool remove_duplicate_points();
|
||||
void append(const Point &point);
|
||||
void append(const Points &points);
|
||||
void append(const Points::const_iterator &begin, const Points::const_iterator &end);
|
||||
void append(const Point &point) { this->points.push_back(point); }
|
||||
void append(const Points &src) { this->append(src.begin(), src.end()); }
|
||||
void append(const Points::const_iterator &begin, const Points::const_iterator &end) { this->points.insert(this->points.end(), begin, end); }
|
||||
void append(Points &&src)
|
||||
{
|
||||
if (this->points.empty())
|
||||
this->points = std::move(src);
|
||||
else
|
||||
std::move(std::begin(src), std::end(src), std::back_inserter(this->points));
|
||||
}
|
||||
|
||||
bool intersection(const Line& line, Point* intersection) const;
|
||||
std::string dump_perl() const;
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue