Engauge Digitizer
2
Toggle main menu visibility
Loading...
Searching...
No Matches
Centipede
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
7
#include "
CentipedeSegmentAbstract.h
"
8
#include "
mmsubs.h
"
9
#include <qdebug.h>
10
#include <qmath.h>
11
#include <QPointF>
12
#include "
Transformation.h
"
13
14
CentipedeSegmentAbstract::CentipedeSegmentAbstract
(
const
DocumentModelGuideline
&
modelGuideline
,
15
const
Transformation
&
transformation
,
16
const
QPointF &
posClickScreen
) :
17
m_modelGuideline (
modelGuideline
),
18
m_transformation (
transformation
),
19
m_posClickScreen (
posClickScreen
)
20
{
21
}
22
23
CentipedeSegmentAbstract::~CentipedeSegmentAbstract
()
24
{
25
}
26
27
double
CentipedeSegmentAbstract::closestAngleToCentralAngle
(
double
angleCenter,
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
43
const
DocumentModelGuideline
&
CentipedeSegmentAbstract::modelGuideline
()
const
44
{
45
return
m_modelGuideline;
46
}
47
48
QPointF
CentipedeSegmentAbstract::posClickScreen
()
const
49
{
50
return
m_posClickScreen;
51
}
52
53
Transformation
CentipedeSegmentAbstract::transformation
()
const
54
{
55
return
m_transformation;
56
}
CentipedeSegmentAbstract.h
Transformation.h
CentipedeSegmentAbstract::posClickScreen
QPointF posClickScreen() const
Center of circle in screen coordinates.
Definition
CentipedeSegmentAbstract.cpp:48
CentipedeSegmentAbstract::closestAngleToCentralAngle
double closestAngleToCentralAngle(double angleCenter, double angleOld) const
Loop to find closest angle to angleCenter.
Definition
CentipedeSegmentAbstract.cpp:27
CentipedeSegmentAbstract::CentipedeSegmentAbstract
CentipedeSegmentAbstract(const DocumentModelGuideline &modelGuideline, const Transformation &transformation, const QPointF &posClickScreen)
Constructor with individual coordinates.
Definition
CentipedeSegmentAbstract.cpp:14
CentipedeSegmentAbstract::~CentipedeSegmentAbstract
virtual ~CentipedeSegmentAbstract()
Definition
CentipedeSegmentAbstract.cpp:23
CentipedeSegmentAbstract::modelGuideline
const DocumentModelGuideline & modelGuideline() const
Settings.
Definition
CentipedeSegmentAbstract.cpp:43
CentipedeSegmentAbstract::transformation
Transformation transformation() const
Transformation which is static through the entire lifetime of the Centipede class instances.
Definition
CentipedeSegmentAbstract.cpp:53
DocumentModelGuideline
Model for managing the coordinate values corresponding Guidelines.
Definition
DocumentModelGuideline.h:22
Transformation
Affine transformation between screen and graph coordinates, based on digitized axis points.
Definition
Transformation.h:32
mmsubs.h
Generated on
for Engauge Digitizer by
1.17.0