Limit the object movement to the vincinity of the print bed.

This commit is contained in:
bubnikv 2017-06-08 11:02:29 +02:00
parent dabcff1c07
commit 8b5f7f0fb2
8 changed files with 142 additions and 25 deletions

View file

@ -140,6 +140,29 @@ MultiPoint::intersection(const Line& line, Point* intersection) const
return false;
}
bool MultiPoint::first_intersection(const Line& line, Point* intersection) const
{
bool found = false;
double dmin = 0.;
for (const Line &l : this->lines()) {
Point ip;
if (l.intersection(line, &ip)) {
if (! found) {
found = true;
dmin = ip.distance_to(line.a);
*intersection = ip;
} else {
double d = ip.distance_to(line.a);
if (d < dmin) {
dmin = d;
*intersection = ip;
}
}
}
}
return found;
}
std::string
MultiPoint::dump_perl() const
{