mirror of
https://github.com/SoftFever/OrcaSlicer.git
synced 2025-10-24 09:11:23 -06:00
Eradicated most of Pointf extras compared to pure Eigen::Vector2d.
This commit is contained in:
parent
cb138a20b8
commit
cae0806112
21 changed files with 68 additions and 103 deletions
|
|
@ -79,8 +79,7 @@ void Bed_2D::repaint()
|
|||
auto step = 10; // 1cm grid
|
||||
Polylines polylines;
|
||||
for (auto x = bb.min(0) - fmod(bb.min(0), step) + step; x < bb.max(0); x += step) {
|
||||
Polyline pl = Polyline::new_scale({ Pointf(x, bb.min(1)), Pointf(x, bb.max(1)) });
|
||||
polylines.push_back(pl);
|
||||
polylines.push_back(Polyline::new_scale({ Pointf(x, bb.min(1)), Pointf(x, bb.max(1)) }));
|
||||
}
|
||||
for (auto y = bb.min(1) - fmod(bb.min(1), step) + step; y < bb.max(1); y += step) {
|
||||
polylines.push_back(Polyline::new_scale({ Pointf(bb.min(0), y), Pointf(bb.max(0), y) }));
|
||||
|
|
@ -112,9 +111,7 @@ void Bed_2D::repaint()
|
|||
auto x_end = Pointf(origin_px(0) + axes_len, origin_px(1));
|
||||
dc.DrawLine(wxPoint(origin_px(0), origin_px(1)), wxPoint(x_end(0), x_end(1)));
|
||||
for (auto angle : { -arrow_angle, arrow_angle }){
|
||||
auto end = x_end;
|
||||
end(0) -= arrow_len;
|
||||
end.rotate(angle, x_end);
|
||||
auto end = Eigen::Translation2d(x_end) * Eigen::Rotation2Dd(angle) * Eigen::Translation2d(- x_end) * Eigen::Vector2d(x_end(0) - arrow_len, x_end(1));
|
||||
dc.DrawLine(wxPoint(x_end(0), x_end(1)), wxPoint(end(0), end(1)));
|
||||
}
|
||||
|
||||
|
|
@ -122,9 +119,7 @@ void Bed_2D::repaint()
|
|||
auto y_end = Pointf(origin_px(0), origin_px(1) - axes_len);
|
||||
dc.DrawLine(wxPoint(origin_px(0), origin_px(1)), wxPoint(y_end(0), y_end(1)));
|
||||
for (auto angle : { -arrow_angle, arrow_angle }) {
|
||||
auto end = y_end;
|
||||
end(1) += arrow_len;
|
||||
end.rotate(angle, y_end);
|
||||
auto end = Eigen::Translation2d(y_end) * Eigen::Rotation2Dd(angle) * Eigen::Translation2d(- y_end) * Eigen::Vector2d(y_end(0), y_end(1) + arrow_len);
|
||||
dc.DrawLine(wxPoint(y_end(0), y_end(1)), wxPoint(end(0), end(1)));
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -14,8 +14,8 @@ class Bed_2D : public wxPanel
|
|||
bool m_painted = false;
|
||||
bool m_interactive = false;
|
||||
double m_scale_factor;
|
||||
Pointf m_shift;
|
||||
Pointf m_pos;
|
||||
Pointf m_shift = Vec2d::Zero();
|
||||
Pointf m_pos = Vec2d::Zero();
|
||||
std::function<void(Pointf)> m_on_move = nullptr;
|
||||
|
||||
Point to_pixels(Pointf point);
|
||||
|
|
|
|||
|
|
@ -952,8 +952,8 @@ static void thick_lines_to_indexed_vertex_array(
|
|||
// right, left, top, bottom
|
||||
int idx_prev[4] = { -1, -1, -1, -1 };
|
||||
double bottom_z_prev = 0.;
|
||||
Pointf b1_prev;
|
||||
Vectorf v_prev;
|
||||
Pointf b1_prev(Vec2d::Zero());
|
||||
Vectorf v_prev(Vec2d::Zero());
|
||||
int idx_initial[4] = { -1, -1, -1, -1 };
|
||||
double width_initial = 0.;
|
||||
double bottom_z_initial = 0.0;
|
||||
|
|
@ -1064,7 +1064,7 @@ static void thick_lines_to_indexed_vertex_array(
|
|||
{
|
||||
// Create a sharp corner with an overshot and average the left / right normals.
|
||||
// At the crease angle of 45 degrees, the overshot at the corner will be less than (1-1/cos(PI/8)) = 8.2% over an arc.
|
||||
Pointf intersection;
|
||||
Pointf intersection(Vec2d::Zero());
|
||||
Geometry::ray_ray_intersection(b1_prev, v_prev, a1, v, intersection);
|
||||
a1 = intersection;
|
||||
a2 = 2. * a - intersection;
|
||||
|
|
|
|||
|
|
@ -230,11 +230,13 @@ void BedShapePanel::update_shape()
|
|||
{
|
||||
auto page_idx = m_shape_options_book->GetSelection();
|
||||
if (page_idx == SHAPE_RECTANGULAR) {
|
||||
Pointf rect_size, rect_origin;
|
||||
Pointf rect_size(Vec2d::Zero());
|
||||
Pointf rect_origin(Vec2d::Zero());
|
||||
try{
|
||||
rect_size = boost::any_cast<Pointf>(m_optgroups[SHAPE_RECTANGULAR]->get_value("rect_size")); }
|
||||
catch (const std::exception &e){
|
||||
return;}
|
||||
return;
|
||||
}
|
||||
try{
|
||||
rect_origin = boost::any_cast<Pointf>(m_optgroups[SHAPE_RECTANGULAR]->get_value("rect_origin"));
|
||||
}
|
||||
|
|
|
|||
|
|
@ -667,7 +667,7 @@ void PointCtrl::set_value(const Pointf& value, bool change_event)
|
|||
|
||||
void PointCtrl::set_value(const boost::any& value, bool change_event)
|
||||
{
|
||||
Pointf pt;
|
||||
Pointf pt(Vec2d::Zero());
|
||||
const Pointf *ptf = boost::any_cast<Pointf>(&value);
|
||||
if (!ptf)
|
||||
{
|
||||
|
|
@ -681,13 +681,10 @@ void PointCtrl::set_value(const boost::any& value, bool change_event)
|
|||
|
||||
boost::any& PointCtrl::get_value()
|
||||
{
|
||||
Pointf ret_point;
|
||||
double val;
|
||||
x_textctrl->GetValue().ToDouble(&val);
|
||||
ret_point(0) = val;
|
||||
y_textctrl->GetValue().ToDouble(&val);
|
||||
ret_point(1) = val;
|
||||
return m_value = ret_point;
|
||||
double x, y;
|
||||
x_textctrl->GetValue().ToDouble(&x);
|
||||
y_textctrl->GetValue().ToDouble(&y);
|
||||
return m_value = Pointf(x, y);
|
||||
}
|
||||
|
||||
void StaticText::BUILD()
|
||||
|
|
|
|||
|
|
@ -396,6 +396,7 @@ GLGizmoScale::GLGizmoScale()
|
|||
: GLGizmoBase()
|
||||
, m_scale(1.0f)
|
||||
, m_starting_scale(1.0f)
|
||||
, m_starting_drag_position(Vec2d::Zero())
|
||||
{
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue