File indexing completed on 2024-05-12 03:47:30

0001 /*
0002     File                 : Transform.h
0003     Project              : LabPlot
0004     Description          : transformation for mapping between scene and
0005     logical coordinates of Datapicker-image
0006     --------------------------------------------------------------------
0007     SPDX-FileCopyrightText: 2015 Ankit Wagadre <wagadre.ankit@gmail.com>
0008     SPDX-License-Identifier: GPL-2.0-or-later
0009 */
0010 
0011 #ifndef TRANSFORM_H
0012 #define TRANSFORM_H
0013 
0014 #include "backend/datapicker/DatapickerImage.h"
0015 
0016 class Transform {
0017 public:
0018     Transform() = default;
0019     Vector3D mapSceneToLogical(QPointF, const DatapickerImage::ReferencePoints&);
0020     Vector3D mapSceneLengthToLogical(QPointF, const DatapickerImage::ReferencePoints&);
0021 
0022 private:
0023     bool mapTypeToCartesian(const DatapickerImage::ReferencePoints&);
0024     Vector3D mapCartesianToType(QPointF, const DatapickerImage::ReferencePoints&) const;
0025 
0026     // logical coordinates
0027     double x[4]{0};
0028     double y[4]{0};
0029 
0030     // Scene coordinates
0031     double X[4]{0};
0032     double Y[4]{0};
0033 
0034     friend class DatapickerTest;
0035 };
0036 
0037 #endif // TRANSFORM_H