From ddec73480799f070f5cf9ea238a1688ce1ee111d Mon Sep 17 00:00:00 2001 From: ParkSuMin Date: Wed, 10 Dec 2025 20:55:31 +0300 Subject: [PATCH] =?UTF-8?q?=D0=9F=D0=BE=D0=B4=D0=B3=D0=BE=D1=82=D0=BE?= =?UTF-8?q?=D0=B2=D0=BA=D0=B0=20=D0=BA=20=D1=81=D0=BE=D0=B7=D0=B4=D0=B0?= =?UTF-8?q?=D0=BD=D0=B8=D1=8E=20Arc-=D0=BE=D0=B1=D1=8A=D0=B5=D0=BA=D1=82?= =?UTF-8?q?=D0=BE=D0=B2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Canvas.cpp | 14 +++++++------- GCS/Geo.h | 7 +++++-- 2 files changed, 12 insertions(+), 9 deletions(-) diff --git a/Canvas.cpp b/Canvas.cpp index 832e56a..8978b10 100644 --- a/Canvas.cpp +++ b/Canvas.cpp @@ -34,9 +34,9 @@ Point* Canvas::findPointAt(QPointF pos, qreal tolerance) QPointF p2(*line->p2.x, *line->p2.y); if (dist_P2P(p1, pos) <= tolerance) - temp = line->p1_ref; + temp = line->start_ref; if (dist_P2P(p2, pos) <= tolerance) - temp = line->p2_ref; + temp = line->end_ref; } return temp; } @@ -104,8 +104,8 @@ void Canvas::mousePressEvent(QMouseEvent* event) current_line->p1.y = y1; current_line->p2.x = x2; current_line->p2.y = y2; - current_line->p1_ref = points[points.size() - 2]; - current_line->p2_ref = points[points.size() - 1]; + current_line->start_ref = points[points.size() - 2]; + current_line->end_ref = points[points.size() - 1]; } else { *current_line->p2.x = scene.x(); @@ -214,11 +214,11 @@ void Canvas::mousePressEvent(QMouseEvent* event) Line *l1 = nullptr, *l2 = nullptr; for (Line* l : lines) { - if (l->p1_ref == firstPoint || l->p2_ref == firstPoint) l1 = l; - if (l->p1_ref == clickedPoint || l->p2_ref == clickedPoint) l2 = l; + if (l->start_ref == firstPoint || l->end_ref == firstPoint) l1 = l; + if (l->start_ref == clickedPoint || l->end_ref == clickedPoint) l2 = l; } - if (l1 == l2 || + if (l1 == l2 && l1 && l2 || (areCoincident(firstPoint, clickedPoint, true))) { QMessageBox::warning(this, QString("NO!"), QString("P2P failed")); diff --git a/GCS/Geo.h b/GCS/Geo.h index faf6efa..b822cdd 100644 --- a/GCS/Geo.h +++ b/GCS/Geo.h @@ -174,6 +174,10 @@ public: class Curve { public: + // start in Arc + Point* start_ref; + // end in Arc + Point* end_ref; virtual ~Curve() {} // returns normal vector. The vector should point to the left when one @@ -228,8 +232,7 @@ public: {} Point p1; Point p2; - Point* p1_ref; - Point* p2_ref; + DeriVector2 CalculateNormal(const Point& p, const double* derivparam = nullptr) const override; DeriVector2 Value(double u, double du, const double* derivparam = nullptr) const override; int PushOwnParams(VEC_pD& pvec) override;