making all four corners of the grid sharp instead of round

This commit is contained in:
azio25134 2024-10-02 15:37:49 -07:00
parent 17492c1e5b
commit d52e2cc1b2

View file

@ -2541,59 +2541,9 @@ void PartPlate::generate_print_polygon(ExPolygon &print_polygon)
}
};
int points_count = 8;
if (m_shape.size() == 4)
{
//rectangle case
for (int i = 0; i < 4; i++)
{
const Vec2d& p = m_shape[i];
Vec2d center;
double start_angle, stop_angle, radius_x, radius_y, radius;
switch (i) {
case 0:
radius = 5.f;
center(0) = p(0) + radius;
center(1) = p(1) + radius;
start_angle = PI;
stop_angle = 1.5 * PI;
compute_points(center, radius, start_angle, stop_angle, points_count);
break;
case 1:
print_polygon.contour.append({ scale_(p(0)), scale_(p(1)) });
break;
case 2:
radius_x = (int)(p(0)) % 10;
radius_y = (int)(p(1)) % 10;
radius = (radius_x > radius_y)?radius_y: radius_x;
if (radius < 5.0)
radius = 5.f;
center(0) = p(0) - radius;
center(1) = p(1) - radius;
start_angle = 0;
stop_angle = 0.5 * PI;
compute_points(center, radius, start_angle, stop_angle, points_count);
break;
case 3:
radius_x = (int)(p(0)) % 10;
radius_y = (int)(p(1)) % 10;
radius = (radius_x > radius_y)?radius_y: radius_x;
if (radius < 5.0)
radius = 5.f;
center(0) = p(0) + radius;
center(1) = p(1) - radius;
start_angle = 0.5 * PI;
stop_angle = PI;
compute_points(center, radius, start_angle, stop_angle, points_count);
break;
}
}
}
else {
for (const Vec2d& p : m_shape) {
print_polygon.contour.append({ scale_(p(0)), scale_(p(1)) });
for (const Vec2d& p : m_shape) {
print_polygon.contour.append({scale_(p(0)), scale_(p(1))});
}
}
}
void PartPlate::generate_exclude_polygon(ExPolygon &exclude_polygon)