fixed bug: wrong estimation of angles inside holes

This commit is contained in:
PavelMikus 2022-02-16 16:11:47 +01:00
parent 356ed93ad7
commit 5a03f60c31
2 changed files with 4 additions and 4 deletions

View file

@ -293,7 +293,7 @@ Polygons extract_perimeter_polygons(const Layer *layer) {
void process_perimeter_polygon(const Polygon &orig_polygon, float z_coord, std::vector<SeamCandidate> &result_vec,
const GlobalModelInfo &global_model_info) {
Polygon polygon = orig_polygon;
polygon.make_counter_clockwise();
bool was_clockwise = polygon.make_counter_clockwise();
std::vector<float> lengths = polygon.parameter_by_length();
std::vector<float> angles = calculate_polygon_angles_at_vertices(polygon, lengths,
SeamPlacer::polygon_angles_arm_distance);
@ -308,8 +308,6 @@ void process_perimeter_polygon(const Polygon &orig_polygon, float z_coord, std::
Vec3f unscaled_position = Vec3f { unscaled_p.x(), unscaled_p.y(), z_coord };
EnforcedBlockedSeamPoint type = EnforcedBlockedSeamPoint::NONE;
float ccw_angle = angles[index];
if (enforcer_dist_sqr >= 0) { // if enforcer dist < 0, it means there are no enforcers, skip
//if there is enforcer, any other enforcer cannot be in a sphere defined by last check point and enforcer distance
// so as long as we are at least enforcer_blocker_distance_tolerance deep in that area, and the enforcer distance is greater than
@ -340,6 +338,8 @@ void process_perimeter_polygon(const Polygon &orig_polygon, float z_coord, std::
}
}
float ccw_angle = was_clockwise ? -angles[index] : angles[index];
result_vec.emplace_back(unscaled_position, polygon.size() - index - 1, ccw_angle, type);
}
}