Engauge Digitizer 2
Loading...
Searching...
No Matches
CentipedeSegmentAbstract.cpp
Go to the documentation of this file.
1/******************************************************************************************************
2 * (C) 2020 markummitchell@github.com. This file is part of Engauge Digitizer, which is released *
3 * under GNU General Public License version 2 (GPLv2) or (at your option) any later version. See file *
4 * LICENSE or go to gnu.org/licenses for details. Distribution requires prior written permission. *
5 ******************************************************************************************************/
6
8#include "mmsubs.h"
9#include <qdebug.h>
10#include <qmath.h>
11#include <QPointF>
12#include "Transformation.h"
13
16 const QPointF &posClickScreen) :
17 m_modelGuideline (modelGuideline),
18 m_transformation (transformation),
19 m_posClickScreen (posClickScreen)
20{
21}
22
26
28 double angleOld) const
29{
30 bool isFirst = true;
31 double angleNew = angleOld;
32 for (int delta = -360; delta <= 360; delta += 360) {
33 double angleNext = angleOld + qDegreesToRadians ((double) delta);
34 if (isFirst || (qAbs (angleNext - angleCenter) < qAbs (angleNew - angleCenter))) {
35 isFirst = false;
36 angleNew = angleNext;
37 }
38 }
39
40 return angleNew;
41}
42
44{
45 return m_modelGuideline;
46}
47
49{
50 return m_posClickScreen;
51}
52
54{
55 return m_transformation;
56}
QPointF posClickScreen() const
Center of circle in screen coordinates.
double closestAngleToCentralAngle(double angleCenter, double angleOld) const
Loop to find closest angle to angleCenter.
CentipedeSegmentAbstract(const DocumentModelGuideline &modelGuideline, const Transformation &transformation, const QPointF &posClickScreen)
Constructor with individual coordinates.
const DocumentModelGuideline & modelGuideline() const
Settings.
Transformation transformation() const
Transformation which is static through the entire lifetime of the Centipede class instances.
Model for managing the coordinate values corresponding Guidelines.
Affine transformation between screen and graph coordinates, based on digitized axis points.