29void CentipedeEndpointsCartesian::generatePreviousAndNextPoints (
double radiusAboutClick,
31 QPointF &posGraphPrevious,
32 QPointF &posGraphNext,
33 QPointF &posScreenPrevious)
const
38 posScreenPrevious =
posClickScreen () + QPointF (radiusAboutClick * qCos (angleBefore),
39 radiusAboutClick * qSin (angleBefore));
40 QPointF posScreenNext =
posClickScreen () + QPointF (radiusAboutClick * qCos (angleAfter),
41 radiusAboutClick * qSin (angleAfter));
49QPointF CentipedeEndpointsCartesian::posScreenConstantXCommon (
double radius,
52 QPointF posScreenBest;
56 QPointF posClickGraph;
59 double xClick = posClickGraph.x();
64 QPointF posGraphPrevious, posGraphNext, posScreenPrevious;
65 generatePreviousAndNextPoints (radius,
71 double xGraphPrevious = posGraphPrevious.x();
72 double yGraphPrevious = posGraphPrevious.y();
73 double xGraphNext = posGraphNext.x();
74 double epsilon = qAbs (xGraphPrevious - xGraphNext) / 10.0;
79 bool transitionUp = (xGraphPrevious - epsilon <= xClick) && (xClick < xGraphNext + epsilon);
80 bool transitionDown = (xGraphNext - epsilon <= xClick) && (xClick < xGraphPrevious + epsilon);
82 if (transitionDown || transitionUp) {
97 posScreenBest = posScreenPrevious;
98 yBest = yGraphPrevious;
102 return posScreenBest;
107 return posScreenConstantXCommon (radius,
113 return posScreenConstantXCommon (radius,
117QPointF CentipedeEndpointsCartesian::posScreenConstantYCommon (
double radius,
120 QPointF posScreenBest;
124 QPointF posClickGraph;
127 double yClick = posClickGraph.y();
132 QPointF posGraphPrevious, posGraphNext, posScreenPrevious;
133 generatePreviousAndNextPoints (radius,
139 double xGraphPrevious = posGraphPrevious.x();
140 double yGraphPrevious = posGraphPrevious.y();
141 double yGraphNext = posGraphNext.y();
142 double epsilon = qAbs (yGraphPrevious - yGraphNext) / 10.0;
147 bool transitionUp = (yGraphPrevious - epsilon <= yClick) && (yClick < yGraphNext + epsilon);
148 bool transitionDown = (yGraphNext - epsilon <= yClick) && (yClick < yGraphPrevious + epsilon);
150 if (transitionDown || transitionUp) {
165 posScreenBest = posScreenPrevious;
166 xBest = xGraphPrevious;
170 return posScreenBest;
175 return posScreenConstantYCommon (radius,
181 return posScreenConstantYCommon (radius,
const int NUM_CIRCLE_POINTS
CentipedeIntersectionType
Intersect with one of the following XT or YT coordinates for constant YR or XT respectively.
@ CENTIPEDE_INTERSECTION_HIGH
Intersection along circle perimeter with lowest value of XT or YR.
@ CENTIPEDE_INTERSECTION_LOW
QPointF posClickScreen() const
Center of circle in screen coordinates.
const DocumentModelGuideline & modelGuideline() const
Settings.
const Transformation & transformation() const
Transformation which is static through the entire lifetime of the Centipede class instances.
CentipedeEndpointsAbstract(const DocumentModelGuideline &modelGuideline, const Transformation &transformation, const QPointF &posClickScreen)
Constructor with individual coordinates.
QPointF posScreenConstantYForLowX(double radius) const
Screen point for Y value of circle/coordinate intersection in the decreasing X direction.
virtual ~CentipedeEndpointsCartesian()
QPointF posScreenConstantXForLowY(double radius) const
Screen point for X value of circle/coordinate intersection in the decreasing Y direction.
CentipedeEndpointsCartesian(const DocumentModelGuideline &modelGuideline, const Transformation &transformation, const QPointF &posClickScreen)
Constructor with individual coordinates.
QPointF posScreenConstantYForHighX(double radius) const
Screen point for Y value of circle/coordinate intersection in the increasing X direction.
QPointF posScreenConstantXForHighY(double radius) const
Screen point for X value of circle/coordinate intersection in the increasing Y direction.
Model for managing the coordinate values corresponding Guidelines.