Tech ENABLE_OUT_OF_BED_DETECTION_IMPROVEMENTS - Reworked detection of collision with printbed. The detection uses now different algorithms in dependence of the printbed type (rectangular, circular, convex) to improve performance.
This commit is contained in:
parent
982172b878
commit
4ff13a5d63
10 changed files with 209 additions and 74 deletions
|
@ -282,9 +282,11 @@ bool Bed3D::is_circle(const Pointfs& shape, Vec2d* center, double* radius)
|
|||
|
||||
avg_dist /= vertex_distances.size();
|
||||
|
||||
double tolerance = avg_dist * 0.01;
|
||||
|
||||
bool defined_value = true;
|
||||
for (double el : vertex_distances) {
|
||||
if (fabs(el - avg_dist) > 10.0 * SCALED_EPSILON)
|
||||
if (fabs(el - avg_dist) > tolerance)
|
||||
defined_value = false;
|
||||
break;
|
||||
}
|
||||
|
@ -298,6 +300,11 @@ bool Bed3D::is_circle(const Pointfs& shape, Vec2d* center, double* radius)
|
|||
return defined_value;
|
||||
}
|
||||
|
||||
bool Bed3D::is_convex(const Pointfs& shape)
|
||||
{
|
||||
return Polygon::new_scale(shape).convex_points().size() == shape.size();
|
||||
}
|
||||
|
||||
Bed3D::EShapeType Bed3D::detect_shape_type(const Pointfs& shape)
|
||||
{
|
||||
if (shape.size() < 3)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue