Fix compile error

This commit is contained in:
Noisyfox
2025-09-12 16:42:29 +08:00
parent a5ae552512
commit b55a0226b5
4 changed files with 26 additions and 26 deletions

View File

@@ -62,7 +62,7 @@ static bool is_valid_gcode(const std::string &gcode)
return is_valid; return is_valid;
} }
Polygon chamfer_polygon(Polygon &polygon, double chamfer_dis = 2., double angle_tol = 30. / 180. * PI) static Polygon chamfer_polygon(Polygon &polygon, double chamfer_dis = 2., double angle_tol = 30. / 180. * PI)
{ {
if (polygon.points.size() < 3) return polygon; if (polygon.points.size() < 3) return polygon;
Polygon res; Polygon res;
@@ -96,7 +96,7 @@ Polygon chamfer_polygon(Polygon &polygon, double chamfer_dis = 2., double angle_
return res; return res;
} }
Polygon rounding_polygon(Polygon &polygon, double rounding = 2., double angle_tol = 30. / 180. * PI) static Polygon rounding_polygon(Polygon &polygon, double rounding = 2., double angle_tol = 30. / 180. * PI)
{ {
if (polygon.points.size() < 3) return polygon; if (polygon.points.size() < 3) return polygon;
Polygon res; Polygon res;
@@ -164,7 +164,7 @@ Polygon rounding_polygon(Polygon &polygon, double rounding = 2., double angle_to
return res; return res;
} }
Polygon rounding_rectangle(Polygon &polygon, double rounding = 2., double angle_tol = 30. / 180. * PI) { static Polygon rounding_rectangle(Polygon &polygon, double rounding = 2., double angle_tol = 30. / 180. * PI) {
if (polygon.points.size() < 3) return polygon; if (polygon.points.size() < 3) return polygon;
Polygon res; Polygon res;
res.points.reserve(polygon.points.size() * 2); res.points.reserve(polygon.points.size() * 2);
@@ -222,7 +222,7 @@ Polygon rounding_rectangle(Polygon &polygon, double rounding = 2., double angle_
return res; return res;
} }
std::pair<bool, Vec2f> ray_intersetion_line(const Vec2f &a, const Vec2f &v1, const Vec2f &b, const Vec2f &c) static std::pair<bool, Vec2f> ray_intersetion_line(const Vec2f &a, const Vec2f &v1, const Vec2f &b, const Vec2f &c)
{ {
const Vec2f v2 = c - b; const Vec2f v2 = c - b;
double denom = cross2(v1, v2); double denom = cross2(v1, v2);
@@ -239,19 +239,19 @@ std::pair<bool, Vec2f> ray_intersetion_line(const Vec2f &a, const Vec2f &v1, con
} }
return std::pair<bool, Vec2f>(false, Vec2f{0, 0}); return std::pair<bool, Vec2f>(false, Vec2f{0, 0});
} }
Polygon scale_polygon(const std::vector<Vec2f> &points) { static Polygon scale_polygon(const std::vector<Vec2f> &points) {
Polygon res; Polygon res;
for (const auto &p : points) res.points.push_back(scaled(p)); for (const auto &p : points) res.points.push_back(scaled(p));
return res; return res;
} }
std::vector<Vec2f> unscale_polygon(const Polygon& polygon) static std::vector<Vec2f> unscale_polygon(const Polygon& polygon)
{ {
std::vector<Vec2f> res; std::vector<Vec2f> res;
for (const auto &p : polygon.points) res.push_back(unscaled<float>(p)); for (const auto &p : polygon.points) res.push_back(unscaled<float>(p));
return res; return res;
} }
Polygon generate_rectange(const Line &line, coord_t offset) static Polygon generate_rectange(const Line &line, coord_t offset)
{ {
Point p1 = line.a; Point p1 = line.a;
Point p2 = line.b; Point p2 = line.b;
@@ -329,7 +329,7 @@ struct PointWithFlag
int pair_idx; // gap_pair idx int pair_idx; // gap_pair idx
bool is_forward; bool is_forward;
}; };
IntersectionInfo move_point_along_polygon(const std::vector<Vec2f> &points, const Vec2f &startPoint, int startIdx, float offset, bool forward, int pair_idx) static IntersectionInfo move_point_along_polygon(const std::vector<Vec2f> &points, const Vec2f &startPoint, int startIdx, float offset, bool forward, int pair_idx)
{ {
float remainingDistance = offset; float remainingDistance = offset;
IntersectionInfo res; IntersectionInfo res;
@@ -391,7 +391,7 @@ IntersectionInfo move_point_along_polygon(const std::vector<Vec2f> &points, cons
return res; return res;
}; };
void insert_points(std::vector<PointWithFlag> &pl, int idx, Vec2f pos, int pair_idx, bool is_forward) static void insert_points(std::vector<PointWithFlag> &pl, int idx, Vec2f pos, int pair_idx, bool is_forward)
{ {
int next = (idx + 1) % pl.size(); int next = (idx + 1) % pl.size();
Vec2f pos1 = pl[idx].pos; Vec2f pos1 = pl[idx].pos;
@@ -407,7 +407,7 @@ void insert_points(std::vector<PointWithFlag> &pl, int idx, Vec2f pos, int pair_
} }
} }
Polylines remove_points_from_polygon(const Polygon &polygon, const std::vector<Vec2f> &skip_points, double range, bool is_left ,Polygon& insert_skip_pg) static Polylines remove_points_from_polygon(const Polygon &polygon, const std::vector<Vec2f> &skip_points, double range, bool is_left ,Polygon& insert_skip_pg)
{ {
Polylines result; Polylines result;
std::vector<PointWithFlag> new_pl; // add intersection points for gaps, where bool indicates whether it's a gap point. std::vector<PointWithFlag> new_pl; // add intersection points for gaps, where bool indicates whether it's a gap point.
@@ -500,7 +500,7 @@ Polylines remove_points_from_polygon(const Polygon &polygon, const std::vector<V
return result; return result;
} }
Polylines contrust_gap_for_skip_points(const Polygon &polygon, const std::vector<Vec2f> & skip_points ,float wt_width,float gap_length,Polygon& insert_skip_polygon) static Polylines contrust_gap_for_skip_points(const Polygon &polygon, const std::vector<Vec2f> & skip_points ,float wt_width,float gap_length,Polygon& insert_skip_polygon)
{ {
if (skip_points.empty()) { if (skip_points.empty()) {
insert_skip_polygon = polygon; insert_skip_polygon = polygon;
@@ -515,7 +515,7 @@ Polylines contrust_gap_for_skip_points(const Polygon &polygon, const std::vector
}; };
Polygon generate_rectange_polygon(const Vec2f &wt_box_min ,const Vec2f & wt_box_max) { static Polygon generate_rectange_polygon(const Vec2f &wt_box_min ,const Vec2f & wt_box_max) {
Polygon res; Polygon res;
res.points.push_back(scaled(wt_box_min)); res.points.push_back(scaled(wt_box_min));
res.points.push_back(scaled(Vec2f{wt_box_max[0], wt_box_min[1]})); res.points.push_back(scaled(Vec2f{wt_box_max[0], wt_box_min[1]}));

View File

@@ -69,7 +69,7 @@ static bool is_valid_gcode(const std::string& gcode)
return is_valid; return is_valid;
} }
Polygon chamfer_polygon(Polygon& polygon, double chamfer_dis = 2., double angle_tol = 30. / 180. * PI) static Polygon chamfer_polygon(Polygon& polygon, double chamfer_dis = 2., double angle_tol = 30. / 180. * PI)
{ {
if (polygon.points.size() < 3) if (polygon.points.size() < 3)
return polygon; return polygon;
@@ -104,7 +104,7 @@ Polygon chamfer_polygon(Polygon& polygon, double chamfer_dis = 2., double angle_
return res; return res;
} }
Polygon rounding_polygon(Polygon& polygon, double rounding = 2., double angle_tol = 30. / 180. * PI) static Polygon rounding_polygon(Polygon& polygon, double rounding = 2., double angle_tol = 30. / 180. * PI)
{ {
if (polygon.points.size() < 3) if (polygon.points.size() < 3)
return polygon; return polygon;
@@ -174,7 +174,7 @@ Polygon rounding_polygon(Polygon& polygon, double rounding = 2., double angle_to
return res; return res;
} }
Polygon rounding_rectangle(Polygon& polygon, double rounding = 2., double angle_tol = 30. / 180. * PI) static Polygon rounding_rectangle(Polygon& polygon, double rounding = 2., double angle_tol = 30. / 180. * PI)
{ {
if (polygon.points.size() < 3) if (polygon.points.size() < 3)
return polygon; return polygon;
@@ -234,7 +234,7 @@ Polygon rounding_rectangle(Polygon& polygon, double rounding = 2., double angle_
return res; return res;
} }
std::pair<bool, Vec2f> ray_intersetion_line(const Vec2f& a, const Vec2f& v1, const Vec2f& b, const Vec2f& c) static std::pair<bool, Vec2f> ray_intersetion_line(const Vec2f& a, const Vec2f& v1, const Vec2f& b, const Vec2f& c)
{ {
const Vec2f v2 = c - b; const Vec2f v2 = c - b;
double denom = cross2(v1, v2); double denom = cross2(v1, v2);
@@ -252,14 +252,14 @@ std::pair<bool, Vec2f> ray_intersetion_line(const Vec2f& a, const Vec2f& v1, con
} }
return std::pair<bool, Vec2f>(false, Vec2f{0, 0}); return std::pair<bool, Vec2f>(false, Vec2f{0, 0});
} }
Polygon scale_polygon(const std::vector<Vec2f>& points) static Polygon scale_polygon(const std::vector<Vec2f>& points)
{ {
Polygon res; Polygon res;
for (const auto& p : points) for (const auto& p : points)
res.points.push_back(scaled(p)); res.points.push_back(scaled(p));
return res; return res;
} }
std::vector<Vec2f> unscale_polygon(const Polygon& polygon) static std::vector<Vec2f> unscale_polygon(const Polygon& polygon)
{ {
std::vector<Vec2f> res; std::vector<Vec2f> res;
for (const auto& p : polygon.points) for (const auto& p : polygon.points)
@@ -267,7 +267,7 @@ std::vector<Vec2f> unscale_polygon(const Polygon& polygon)
return res; return res;
} }
Polygon generate_rectange(const Line& line, coord_t offset) static Polygon generate_rectange(const Line& line, coord_t offset)
{ {
Point p1 = line.a; Point p1 = line.a;
Point p2 = line.b; Point p2 = line.b;
@@ -349,7 +349,7 @@ struct PointWithFlag
int pair_idx; // gap_pair idx int pair_idx; // gap_pair idx
bool is_forward; bool is_forward;
}; };
IntersectionInfo move_point_along_polygon( static IntersectionInfo move_point_along_polygon(
const std::vector<Vec2f>& points, const Vec2f& startPoint, int startIdx, float offset, bool forward, int pair_idx) const std::vector<Vec2f>& points, const Vec2f& startPoint, int startIdx, float offset, bool forward, int pair_idx)
{ {
float remainingDistance = offset; float remainingDistance = offset;
@@ -412,7 +412,7 @@ IntersectionInfo move_point_along_polygon(
return res; return res;
}; };
void insert_points(std::vector<PointWithFlag>& pl, int idx, Vec2f pos, int pair_idx, bool is_forward) static void insert_points(std::vector<PointWithFlag>& pl, int idx, Vec2f pos, int pair_idx, bool is_forward)
{ {
int next = (idx + 1) % pl.size(); int next = (idx + 1) % pl.size();
Vec2f pos1 = pl[idx].pos; Vec2f pos1 = pl[idx].pos;
@@ -428,7 +428,7 @@ void insert_points(std::vector<PointWithFlag>& pl, int idx, Vec2f pos, int pair_
} }
} }
Polylines remove_points_from_polygon( static Polylines remove_points_from_polygon(
const Polygon& polygon, const std::vector<Vec2f>& skip_points, double range, bool is_left, Polygon& insert_skip_pg) const Polygon& polygon, const std::vector<Vec2f>& skip_points, double range, bool is_left, Polygon& insert_skip_pg)
{ {
assert(polygon.size() > 2); assert(polygon.size() > 2);
@@ -519,7 +519,7 @@ Polylines remove_points_from_polygon(
return result; return result;
} }
Polylines contrust_gap_for_skip_points( static Polylines contrust_gap_for_skip_points(
const Polygon& polygon, const std::vector<Vec2f>& skip_points, float wt_width, float gap_length, Polygon& insert_skip_polygon) const Polygon& polygon, const std::vector<Vec2f>& skip_points, float wt_width, float gap_length, Polygon& insert_skip_polygon)
{ {
if (skip_points.empty()) { if (skip_points.empty()) {
@@ -534,7 +534,7 @@ Polylines contrust_gap_for_skip_points(
return remove_points_from_polygon(polygon, skip_points, gap_length, is_left, insert_skip_polygon); return remove_points_from_polygon(polygon, skip_points, gap_length, is_left, insert_skip_polygon);
}; };
Polygon generate_rectange_polygon(const Vec2f& wt_box_min, const Vec2f& wt_box_max) static Polygon generate_rectange_polygon(const Vec2f& wt_box_min, const Vec2f& wt_box_max)
{ {
Polygon res; Polygon res;
res.points.push_back(scaled(wt_box_min)); res.points.push_back(scaled(wt_box_min));

View File

@@ -2873,7 +2873,7 @@ void GLCanvas3D::reload_scene(bool refresh_immediately, bool force_full_scene_re
float a = dynamic_cast<const ConfigOptionFloat*>(proj_cfg.option("wipe_tower_rotation_angle"))->value; float a = dynamic_cast<const ConfigOptionFloat*>(proj_cfg.option("wipe_tower_rotation_angle"))->value;
float tower_brim_width = dynamic_cast<const ConfigOptionFloat*>(m_config->option("prime_tower_brim_width"))->value; float tower_brim_width = dynamic_cast<const ConfigOptionFloat*>(m_config->option("prime_tower_brim_width"))->value;
// BBS // BBS
// float v = dynamic_cast<const ConfigOptionFloat*>(m_config->option("prime_volume"))->value; float v = dynamic_cast<const ConfigOptionFloat*>(m_config->option("prime_volume"))->value;
Vec3d plate_origin = ppl.get_plate(plate_id)->get_origin(); Vec3d plate_origin = ppl.get_plate(plate_id)->get_origin();
const Print* print = m_process->fff_print(); const Print* print = m_process->fff_print();

View File

@@ -1821,7 +1821,7 @@ Vec3d PartPlate::calculate_wipe_tower_size(const DynamicPrintConfig &config, con
if (!use_global_objects && !contain_instance_totally(obj_idx, 0)) if (!use_global_objects && !contain_instance_totally(obj_idx, 0))
continue; continue;
BoundingBoxf3 bbox = m_model->objects[obj_idx]->bounding_box(); BoundingBoxf3 bbox = m_model->objects[obj_idx]->bounding_box_exact();
max_height = std::max(bbox.size().z(), max_height); max_height = std::max(bbox.size().z(), max_height);
} }
wipe_tower_size(2) = max_height; wipe_tower_size(2) = max_height;