mirror of
https://github.com/FULU-Foundation/OrcaSlicer-bambulab.git
synced 2026-07-13 13:04:29 +03:00
Changing the internal representation of Point / Pointf / Point3 / Pointf3 to Eigen Matrix types, first step
This commit is contained in:
@@ -683,7 +683,7 @@ void GCodeAnalyzer::_calc_gcode_preview_extrusion_layers(GCodePreviewData& previ
|
||||
// constructs the polylines while traversing the moves
|
||||
for (const GCodeMove& move : extrude_moves->second)
|
||||
{
|
||||
if ((data != move.data) || (z != move.start_position.z) || (position != move.start_position) || (volumetric_rate != move.data.feedrate * (float)move.data.mm3_per_mm))
|
||||
if ((data != move.data) || (z != move.start_position.z()) || (position != move.start_position) || (volumetric_rate != move.data.feedrate * (float)move.data.mm3_per_mm))
|
||||
{
|
||||
// store current polyline
|
||||
polyline.remove_duplicate_points();
|
||||
@@ -693,12 +693,12 @@ void GCodeAnalyzer::_calc_gcode_preview_extrusion_layers(GCodePreviewData& previ
|
||||
polyline = Polyline();
|
||||
|
||||
// add both vertices of the move
|
||||
polyline.append(Point(scale_(move.start_position.x), scale_(move.start_position.y)));
|
||||
polyline.append(Point(scale_(move.end_position.x), scale_(move.end_position.y)));
|
||||
polyline.append(Point(scale_(move.start_position.x()), scale_(move.start_position.y())));
|
||||
polyline.append(Point(scale_(move.end_position.x()), scale_(move.end_position.y())));
|
||||
|
||||
// update current values
|
||||
data = move.data;
|
||||
z = move.start_position.z;
|
||||
z = move.start_position.z();
|
||||
volumetric_rate = move.data.feedrate * (float)move.data.mm3_per_mm;
|
||||
height_range.update_from(move.data.height);
|
||||
width_range.update_from(move.data.width);
|
||||
@@ -707,7 +707,7 @@ void GCodeAnalyzer::_calc_gcode_preview_extrusion_layers(GCodePreviewData& previ
|
||||
}
|
||||
else
|
||||
// append end vertex of the move to current polyline
|
||||
polyline.append(Point(scale_(move.end_position.x), scale_(move.end_position.y)));
|
||||
polyline.append(Point(scale_(move.end_position.x()), scale_(move.end_position.y())));
|
||||
|
||||
// update current values
|
||||
position = move.end_position;
|
||||
@@ -756,7 +756,7 @@ void GCodeAnalyzer::_calc_gcode_preview_travel(GCodePreviewData& preview_data)
|
||||
for (const GCodeMove& move : travel_moves->second)
|
||||
{
|
||||
GCodePreviewData::Travel::EType move_type = (move.delta_extruder < 0.0f) ? GCodePreviewData::Travel::Retract : ((move.delta_extruder > 0.0f) ? GCodePreviewData::Travel::Extrude : GCodePreviewData::Travel::Move);
|
||||
GCodePreviewData::Travel::Polyline::EDirection move_direction = ((move.start_position.x != move.end_position.x) || (move.start_position.y != move.end_position.y)) ? GCodePreviewData::Travel::Polyline::Generic : GCodePreviewData::Travel::Polyline::Vertical;
|
||||
GCodePreviewData::Travel::Polyline::EDirection move_direction = ((move.start_position.x() != move.end_position.x()) || (move.start_position.y() != move.end_position.y())) ? GCodePreviewData::Travel::Polyline::Generic : GCodePreviewData::Travel::Polyline::Vertical;
|
||||
|
||||
if ((type != move_type) || (direction != move_direction) || (feedrate != move.data.feedrate) || (position != move.start_position) || (extruder_id != move.data.extruder_id))
|
||||
{
|
||||
@@ -768,12 +768,12 @@ void GCodeAnalyzer::_calc_gcode_preview_travel(GCodePreviewData& preview_data)
|
||||
polyline = Polyline3();
|
||||
|
||||
// add both vertices of the move
|
||||
polyline.append(Point3(scale_(move.start_position.x), scale_(move.start_position.y), scale_(move.start_position.z)));
|
||||
polyline.append(Point3(scale_(move.end_position.x), scale_(move.end_position.y), scale_(move.end_position.z)));
|
||||
polyline.append(Point3(scale_(move.start_position.x()), scale_(move.start_position.y()), scale_(move.start_position.z())));
|
||||
polyline.append(Point3(scale_(move.end_position.x()), scale_(move.end_position.y()), scale_(move.end_position.z())));
|
||||
}
|
||||
else
|
||||
// append end vertex of the move to current polyline
|
||||
polyline.append(Point3(scale_(move.end_position.x), scale_(move.end_position.y), scale_(move.end_position.z)));
|
||||
polyline.append(Point3(scale_(move.end_position.x()), scale_(move.end_position.y()), scale_(move.end_position.z())));
|
||||
|
||||
// update current values
|
||||
position = move.end_position;
|
||||
@@ -804,7 +804,7 @@ void GCodeAnalyzer::_calc_gcode_preview_retractions(GCodePreviewData& preview_da
|
||||
for (const GCodeMove& move : retraction_moves->second)
|
||||
{
|
||||
// store position
|
||||
Point3 position(scale_(move.start_position.x), scale_(move.start_position.y), scale_(move.start_position.z));
|
||||
Point3 position(scale_(move.start_position.x()), scale_(move.start_position.y()), scale_(move.start_position.z()));
|
||||
preview_data.retraction.positions.emplace_back(position, move.data.width, move.data.height);
|
||||
}
|
||||
}
|
||||
@@ -818,7 +818,7 @@ void GCodeAnalyzer::_calc_gcode_preview_unretractions(GCodePreviewData& preview_
|
||||
for (const GCodeMove& move : unretraction_moves->second)
|
||||
{
|
||||
// store position
|
||||
Point3 position(scale_(move.start_position.x), scale_(move.start_position.y), scale_(move.start_position.z));
|
||||
Point3 position(scale_(move.start_position.x()), scale_(move.start_position.y()), scale_(move.start_position.z()));
|
||||
preview_data.unretraction.positions.emplace_back(position, move.data.width, move.data.height);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -24,9 +24,9 @@ void CoolingBuffer::reset()
|
||||
{
|
||||
m_current_pos.assign(5, 0.f);
|
||||
Pointf3 pos = m_gcodegen.writer().get_position();
|
||||
m_current_pos[0] = float(pos.x);
|
||||
m_current_pos[1] = float(pos.y);
|
||||
m_current_pos[2] = float(pos.z);
|
||||
m_current_pos[0] = float(pos.x());
|
||||
m_current_pos[1] = float(pos.y());
|
||||
m_current_pos[2] = float(pos.z());
|
||||
m_current_pos[4] = float(m_gcodegen.config().travel_speed.value);
|
||||
}
|
||||
|
||||
|
||||
@@ -19,10 +19,10 @@ static inline BoundingBox extrusion_polyline_extents(const Polyline &polyline, c
|
||||
if (! polyline.points.empty())
|
||||
bbox.merge(polyline.points.front());
|
||||
for (const Point &pt : polyline.points) {
|
||||
bbox.min.x = std::min(bbox.min.x, pt.x - radius);
|
||||
bbox.min.y = std::min(bbox.min.y, pt.y - radius);
|
||||
bbox.max.x = std::max(bbox.max.x, pt.x + radius);
|
||||
bbox.max.y = std::max(bbox.max.y, pt.y + radius);
|
||||
bbox.min.x() = std::min(bbox.min.x(), pt.x() - radius);
|
||||
bbox.min.y() = std::min(bbox.min.y(), pt.y() - radius);
|
||||
bbox.max.x() = std::max(bbox.max.x(), pt.x() + radius);
|
||||
bbox.max.y() = std::max(bbox.max.y(), pt.y() + radius);
|
||||
}
|
||||
return bbox;
|
||||
}
|
||||
@@ -146,10 +146,10 @@ BoundingBoxf get_wipe_tower_extrusions_extents(const Print &print, const coordf_
|
||||
Pointf p2(e.pos.x, e.pos.y);
|
||||
bbox.merge(p1);
|
||||
coordf_t radius = 0.5 * e.width;
|
||||
bbox.min.x = std::min(bbox.min.x, std::min(p1.x, p2.x) - radius);
|
||||
bbox.min.y = std::min(bbox.min.y, std::min(p1.y, p2.y) - radius);
|
||||
bbox.max.x = std::max(bbox.max.x, std::max(p1.x, p2.x) + radius);
|
||||
bbox.max.y = std::max(bbox.max.y, std::max(p1.y, p2.y) + radius);
|
||||
bbox.min.x() = std::min(bbox.min.x(), std::min(p1.x(), p2.x()) - radius);
|
||||
bbox.min.y() = std::min(bbox.min.y(), std::min(p1.y(), p2.y()) - radius);
|
||||
bbox.max.x() = std::max(bbox.max.x(), std::max(p1.x(), p2.x()) + radius);
|
||||
bbox.max.y() = std::max(bbox.max.y(), std::max(p1.y(), p2.y()) + radius);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -170,10 +170,10 @@ BoundingBoxf get_wipe_tower_priming_extrusions_extents(const Print &print)
|
||||
Pointf p2(e.pos.x, e.pos.y);
|
||||
bbox.merge(p1);
|
||||
coordf_t radius = 0.5 * e.width;
|
||||
bbox.min.x = std::min(bbox.min.x, std::min(p1.x, p2.x) - radius);
|
||||
bbox.min.y = std::min(bbox.min.y, std::min(p1.y, p2.y) - radius);
|
||||
bbox.max.x = std::max(bbox.max.x, std::max(p1.x, p2.x) + radius);
|
||||
bbox.max.y = std::max(bbox.max.y, std::max(p1.y, p2.y) + radius);
|
||||
bbox.min.x() = std::min(bbox.min.x(), std::min(p1.x(), p2.x()) - radius);
|
||||
bbox.min.y() = std::min(bbox.min.y(), std::min(p1.y(), p2.y()) - radius);
|
||||
bbox.max.x() = std::max(bbox.max.x(), std::max(p1.x(), p2.x()) + radius);
|
||||
bbox.max.y() = std::max(bbox.max.y(), std::max(p1.y(), p2.y()) + radius);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user