mirror of
https://github.com/OrcaSlicer/OrcaSlicer.git
synced 2026-07-25 20:02:17 +00:00
Ensure bed shape is in correct orientation (#9350)
Fix #9345 This also fixes deltamaker's plate logo rendering:  And fix bed rendering issue for custom shaped bed without model:  Also fix rendering of exclusion area that are defined in clockwise: 
This commit is contained in:
@@ -14,6 +14,7 @@ BuildVolume::BuildVolume(const std::vector<Vec2d> &printable_area, const double
|
||||
assert(printable_height >= 0);
|
||||
|
||||
m_polygon = Polygon::new_scale(printable_area);
|
||||
assert(m_polygon.is_counter_clockwise());
|
||||
|
||||
// Calcuate various metrics of the input polygon.
|
||||
m_convex_hull = Geometry::convex_hull(m_polygon.points);
|
||||
|
||||
@@ -1410,4 +1410,14 @@ ExPolygons variable_offset_inner_ex(const ExPolygon &expoly, const std::vector<s
|
||||
return output;
|
||||
}
|
||||
|
||||
Pointfs make_counter_clockwise(const Pointfs& pointfs)
|
||||
{
|
||||
Pointfs ps = pointfs;
|
||||
if (Polygon::new_scale(pointfs).is_clockwise()) {
|
||||
std::reverse(ps.begin(), ps.end());
|
||||
}
|
||||
|
||||
return ps;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -661,6 +661,8 @@ Polygons variable_offset_outer(const ExPolygon &expoly, const std::vector<std::
|
||||
ExPolygons variable_offset_outer_ex(const ExPolygon &expoly, const std::vector<std::vector<float>> &deltas, double miter_limit = 2.);
|
||||
ExPolygons variable_offset_inner_ex(const ExPolygon &expoly, const std::vector<std::vector<float>> &deltas, double miter_limit = 2.);
|
||||
|
||||
Pointfs make_counter_clockwise(const Pointfs& pointfs);
|
||||
|
||||
} // namespace Slic3r
|
||||
|
||||
#endif // slic3r_ClipperUtils_hpp_
|
||||
|
||||
@@ -831,7 +831,7 @@ void GCodeProcessor::apply_config(const DynamicPrintConfig& config)
|
||||
|
||||
const ConfigOptionPoints* printable_area = config.option<ConfigOptionPoints>("printable_area");
|
||||
if (printable_area != nullptr)
|
||||
m_result.printable_area = printable_area->values;
|
||||
m_result.printable_area = make_counter_clockwise(printable_area->values);
|
||||
|
||||
//BBS: add bed_exclude_area
|
||||
const ConfigOptionPoints* bed_exclude_area = config.option<ConfigOptionPoints>("bed_exclude_area");
|
||||
|
||||
@@ -8117,15 +8117,15 @@ Points get_bed_shape(const DynamicPrintConfig &config)
|
||||
return {};
|
||||
}
|
||||
|
||||
return to_points(bed_shape_opt->values);
|
||||
return to_points(make_counter_clockwise(bed_shape_opt->values));
|
||||
}
|
||||
|
||||
Points get_bed_shape(const PrintConfig &cfg)
|
||||
{
|
||||
return to_points(cfg.printable_area.values);
|
||||
return to_points(make_counter_clockwise(cfg.printable_area.values));
|
||||
}
|
||||
|
||||
Points get_bed_shape(const SLAPrinterConfig &cfg) { return to_points(cfg.printable_area.values); }
|
||||
Points get_bed_shape(const SLAPrinterConfig &cfg) { return to_points(make_counter_clockwise(cfg.printable_area.values)); }
|
||||
|
||||
Polygon get_bed_shape_with_excluded_area(const PrintConfig& cfg)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user