mirror of
https://github.com/SoftFever/OrcaSlicer.git
synced 2025-07-12 09:17:52 -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
|
@ -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
|
||||
{
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue