mirror of
https://github.com/OrcaSlicer/OrcaSlicer.git
synced 2026-09-09 18:27:00 +00:00
Add helper functions
This commit is contained in:
@@ -261,7 +261,20 @@ namespace Slic3r {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
double object_size_x(int num_patterns) {
|
||||||
|
return num_patterns * ((m_wall_count - 1) * line_spacing_angle()) +
|
||||||
|
(num_patterns - 1) * (m_pattern_spacing + line_width()) +
|
||||||
|
cos(to_radians(m_corner_angle) / 2) * m_wall_side_length +
|
||||||
|
line_spacing_anchor() * m_anchor_perimeters
|
||||||
|
;
|
||||||
|
}
|
||||||
|
|
||||||
|
double object_size_y(double start_pa, double step_pa, int num_patterns) {
|
||||||
|
return 2 * sin(to_radians(m_corner_angle) / 2) * m_wall_side_length +
|
||||||
|
max_numbering_height(start_pa, step_pa, num_patterns) +
|
||||||
|
m_glyph_padding_vertical * 2 +
|
||||||
|
line_width_anchor()
|
||||||
|
}
|
||||||
|
|
||||||
double max_numbering_height(double start_pa, double step_pa, int count) {
|
double max_numbering_height(double start_pa, double step_pa, int count) {
|
||||||
int max_length = 0;
|
int max_length = 0;
|
||||||
|
|||||||
@@ -79,7 +79,7 @@ class calib_pressure_advance_pattern: public calib_pressure_advance
|
|||||||
|
|
||||||
std::string generate_test(double start_pa = 0, double end_pa = 0.08, double step_pa = 0.005);
|
std::string generate_test(double start_pa = 0, double end_pa = 0.08, double step_pa = 0.005);
|
||||||
|
|
||||||
double to_radians(degrees) { return degrees * (M_PI / 180); }
|
double to_radians(double degrees) { return degrees * (M_PI / 180); }
|
||||||
|
|
||||||
double line_width() { return mp_gcodegen->config().nozzle_diameter.get_at(0) * m_line_ratio / 100; };
|
double line_width() { return mp_gcodegen->config().nozzle_diameter.get_at(0) * m_line_ratio / 100; };
|
||||||
double line_width_anchor() { return mp_gcodegen->config().nozzle_diameter.get_at(0) * m_anchor_layer_line_ratio / 100; };
|
double line_width_anchor() { return mp_gcodegen->config().nozzle_diameter.get_at(0) * m_anchor_layer_line_ratio / 100; };
|
||||||
@@ -89,12 +89,17 @@ class calib_pressure_advance_pattern: public calib_pressure_advance
|
|||||||
double line_spacing_anchor() { return line_width_anchor() - mp_gcodegen->config().initial_layer_print_height.value * (1 - M_PI / 4); };
|
double line_spacing_anchor() { return line_width_anchor() - mp_gcodegen->config().initial_layer_print_height.value * (1 - M_PI / 4); };
|
||||||
double line_spacing_angle() { return line_spacing() / sin(to_radians(m_corner_angle) / 2); };
|
double line_spacing_angle() { return line_spacing() / sin(to_radians(m_corner_angle) / 2); };
|
||||||
|
|
||||||
|
double object_size_x(int num_patterns);
|
||||||
|
double object_size_y(double start_pa, double step_pa, int num_patterns);
|
||||||
|
|
||||||
double max_numbering_height();
|
double max_numbering_height();
|
||||||
|
double pattern_shift();
|
||||||
private:
|
private:
|
||||||
Gcode* mp_gcodegen;
|
Gcode* mp_gcodegen;
|
||||||
int m_anchor_layer_line_ratio {140};
|
int m_anchor_layer_line_ratio {140};
|
||||||
int m_anchor_perimeters {4};
|
int m_anchor_perimeters {4};
|
||||||
int m_corner_angle {90};
|
int m_corner_angle {90};
|
||||||
|
double m_glyph_padding_vertical = 1;
|
||||||
double m_line_ratio {112.5};
|
double m_line_ratio {112.5};
|
||||||
int m_pattern_spacing {2};
|
int m_pattern_spacing {2};
|
||||||
int m_wall_count {3};
|
int m_wall_count {3};
|
||||||
|
|||||||
Reference in New Issue
Block a user