mirror of
https://github.com/QIDITECH/QIDISlicer.git
synced 2026-01-31 07:58:43 +03:00
add FillConcentricinternal update solidinfill
This commit is contained in:
@@ -81,6 +81,52 @@ Points collect_duplicates(Points pts /* Copy */)
|
||||
}
|
||||
return duplicits;
|
||||
}
|
||||
//w29
|
||||
int Point::nearest_point_index(const Points &points) const
|
||||
{
|
||||
PointConstPtrs p;
|
||||
p.reserve(points.size());
|
||||
for (Points::const_iterator it = points.begin(); it != points.end(); ++it)
|
||||
p.push_back(&*it);
|
||||
return this->nearest_point_index(p);
|
||||
}
|
||||
|
||||
int Point::nearest_point_index(const PointConstPtrs &points) const
|
||||
{
|
||||
int idx = -1;
|
||||
double distance = -1; // double because long is limited to 2147483647 on some platforms and it's not enough
|
||||
|
||||
for (PointConstPtrs::const_iterator it = points.begin(); it != points.end(); ++it) {
|
||||
/* If the X distance of the candidate is > than the total distance of the
|
||||
best previous candidate, we know we don't want it */
|
||||
double d = sqr<double>((*this) (0) - (*it)->x());
|
||||
if (distance != -1 && d > distance)
|
||||
continue;
|
||||
|
||||
/* If the Y distance of the candidate is > than the total distance of the
|
||||
best previous candidate, we know we don't want it */
|
||||
d += sqr<double>((*this) (1) - (*it)->y());
|
||||
if (distance != -1 && d > distance)
|
||||
continue;
|
||||
|
||||
idx = it - points.begin();
|
||||
distance = d;
|
||||
|
||||
if (distance < EPSILON)
|
||||
break;
|
||||
}
|
||||
|
||||
return idx;
|
||||
}
|
||||
|
||||
int Point::nearest_point_index(const PointPtrs &points) const
|
||||
{
|
||||
PointConstPtrs p;
|
||||
p.reserve(points.size());
|
||||
for (PointPtrs::const_iterator it = points.begin(); it != points.end(); ++it)
|
||||
p.push_back(*it);
|
||||
return this->nearest_point_index(p);
|
||||
}
|
||||
|
||||
template<bool IncludeBoundary>
|
||||
BoundingBox get_extents(const Points &pts)
|
||||
|
||||
Reference in New Issue
Block a user