File indexing completed on 2024-05-12 15:58:18

0001 /*
0002  *  SPDX-FileCopyrightText: 2014 Dmitry Kazakov <dimula73@gmail.com>
0003  *
0004  *  SPDX-License-Identifier: GPL-2.0-or-later
0005  */
0006 
0007 #ifndef __KIS_GREEN_COORDINATES_MATH_H
0008 #define __KIS_GREEN_COORDINATES_MATH_H
0009 
0010 #include <QScopedPointer>
0011 #include <QVector>
0012 #include <QPointF>
0013 
0014 #include "kritaimage_export.h"
0015 
0016 class KRITAIMAGE_EXPORT KisGreenCoordinatesMath
0017 {
0018 public:
0019     KisGreenCoordinatesMath();
0020     ~KisGreenCoordinatesMath();
0021 
0022     /**
0023      * Prepare the transformation framework by computing internal
0024      * coordinates of the points in cage.
0025      *
0026      * Please note that the points in \p points will later be accessed
0027      * with indexes only.
0028      */
0029     void precalculateGreenCoordinates(const QVector<QPointF> &originalCage, const QVector<QPointF> &points);
0030 
0031     /**
0032      * Precalculate coefficients of the destination cage. Should be
0033      * called once for every cage change
0034      */
0035     void generateTransformedCageNormals(const QVector<QPointF> &transformedCage);
0036 
0037     /**
0038      * Transform one point according to its index
0039      */
0040     QPointF transformedPoint(int pointIndex, const QVector<QPointF> &transformedCage);
0041 
0042 private:
0043     struct Private;
0044     const QScopedPointer<Private> m_d;
0045 };
0046 
0047 #endif /* __KIS_GREEN_COORDINATES_MATH_H */