mirror of
https://github.com/SoftFever/OrcaSlicer.git
synced 2025-07-18 20:28:08 -06:00
Limit the object movement to the vincinity of the print bed.
This commit is contained in:
parent
dabcff1c07
commit
8b5f7f0fb2
8 changed files with 142 additions and 25 deletions
|
@ -13,7 +13,7 @@ class BoundingBox;
|
|||
|
||||
class MultiPoint
|
||||
{
|
||||
public:
|
||||
public:
|
||||
Points points;
|
||||
|
||||
operator Points() const;
|
||||
|
@ -35,8 +35,24 @@ class MultiPoint
|
|||
double length() const;
|
||||
bool is_valid() const { return this->points.size() >= 2; }
|
||||
|
||||
int find_point(const Point &point) const;
|
||||
int find_point(const Point &point) const;
|
||||
bool has_boundary_point(const Point &point) const;
|
||||
int closest_point_index(const Point &point) const {
|
||||
int idx = -1;
|
||||
if (! this->points.empty()) {
|
||||
idx = 0;
|
||||
double dist_min = this->points.front().distance_to(point);
|
||||
for (int i = 1; i < int(this->points.size()); ++ i) {
|
||||
double d = this->points[i].distance_to(point);
|
||||
if (d < dist_min) {
|
||||
dist_min = d;
|
||||
idx = i;
|
||||
}
|
||||
}
|
||||
}
|
||||
return idx;
|
||||
}
|
||||
const Point* closest_point(const Point &point) const { return this->points.empty() ? nullptr : &this->points[this->closest_point_index(point)]; }
|
||||
BoundingBox bounding_box() const;
|
||||
// Return true if there are exact duplicates.
|
||||
bool has_duplicate_points() const;
|
||||
|
@ -56,6 +72,7 @@ class MultiPoint
|
|||
}
|
||||
|
||||
bool intersection(const Line& line, Point* intersection) const;
|
||||
bool first_intersection(const Line& line, Point* intersection) const;
|
||||
std::string dump_perl() const;
|
||||
|
||||
static Points _douglas_peucker(const Points &points, const double tolerance);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue