2016-03-08 18:48:10 +01:00
|
|
|
/************************************************************************
|
|
|
|
**
|
|
|
|
** @file vabstractcubicbezier.h
|
|
|
|
** @author Roman Telezhynskyi <dismine(at)gmail.com>
|
|
|
|
** @date 8 3, 2016
|
|
|
|
**
|
|
|
|
** @brief
|
|
|
|
** @copyright
|
2017-10-05 11:20:01 +02:00
|
|
|
** This source code is part of the Valentina project, a pattern making
|
2016-03-08 18:48:10 +01:00
|
|
|
** program, whose allow create and modeling patterns of clothing.
|
|
|
|
** Copyright (C) 2016 Valentina project
|
2020-01-31 07:00:05 +01:00
|
|
|
** <https://gitlab.com/smart-pattern/valentina> All Rights Reserved.
|
2016-03-08 18:48:10 +01:00
|
|
|
**
|
|
|
|
** Valentina is free software: you can redistribute it and/or modify
|
|
|
|
** it under the terms of the GNU General Public License as published by
|
|
|
|
** the Free Software Foundation, either version 3 of the License, or
|
|
|
|
** (at your option) any later version.
|
|
|
|
**
|
|
|
|
** Valentina is distributed in the hope that it will be useful,
|
|
|
|
** but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
** GNU General Public License for more details.
|
|
|
|
**
|
|
|
|
** You should have received a copy of the GNU General Public License
|
|
|
|
** along with Valentina. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
**
|
|
|
|
*************************************************************************/
|
|
|
|
|
|
|
|
#ifndef VABSTRACTCUBICBEZIER_H
|
|
|
|
#define VABSTRACTCUBICBEZIER_H
|
|
|
|
|
2016-08-08 13:44:49 +02:00
|
|
|
#include <qcompilerdetection.h>
|
|
|
|
#include <QPointF>
|
|
|
|
#include <QString>
|
|
|
|
#include <QVector>
|
|
|
|
#include <QtGlobal>
|
|
|
|
|
2016-09-24 19:44:06 +02:00
|
|
|
#include "vabstractbezier.h"
|
2016-08-08 13:44:49 +02:00
|
|
|
#include "vgeometrydef.h"
|
2016-03-08 18:48:10 +01:00
|
|
|
|
|
|
|
class VPointF;
|
|
|
|
|
2021-09-25 14:49:00 +02:00
|
|
|
QT_WARNING_PUSH
|
|
|
|
QT_WARNING_DISABLE_GCC("-Wsuggest-final-types")
|
|
|
|
|
2016-09-24 19:44:06 +02:00
|
|
|
class VAbstractCubicBezier : public VAbstractBezier
|
2016-03-08 18:48:10 +01:00
|
|
|
{
|
|
|
|
public:
|
2022-05-20 16:08:32 +02:00
|
|
|
explicit VAbstractCubicBezier(const GOType &type, const quint32 &idObject = NULL_ID,
|
|
|
|
const Draw &mode = Draw::Calculation);
|
|
|
|
VAbstractCubicBezier(const VAbstractCubicBezier &curve) = default;
|
|
|
|
auto operator= (const VAbstractCubicBezier &curve) -> VAbstractCubicBezier&;
|
2022-08-13 18:26:55 +02:00
|
|
|
~VAbstractCubicBezier() override = default;
|
|
|
|
|
|
|
|
#ifdef Q_COMPILER_RVALUE_REFS
|
|
|
|
VAbstractCubicBezier(VAbstractCubicBezier &&curve) Q_DECL_NOTHROW =default;
|
|
|
|
auto operator=(VAbstractCubicBezier &&curve) Q_DECL_NOTHROW -> VAbstractCubicBezier & =default;
|
|
|
|
#endif
|
2016-03-08 18:48:10 +01:00
|
|
|
|
2022-05-20 16:08:32 +02:00
|
|
|
virtual auto GetP1 () const -> VPointF =0;
|
|
|
|
virtual auto GetP2 () const -> VPointF =0;
|
|
|
|
virtual auto GetP3 () const -> VPointF =0;
|
|
|
|
virtual auto GetP4 () const -> VPointF =0;
|
2016-03-08 18:48:10 +01:00
|
|
|
|
2022-05-20 16:08:32 +02:00
|
|
|
auto CutSpline(qreal length, QPointF &spl1p2, QPointF &spl1p3, QPointF &spl2p2, QPointF &spl2p3,
|
|
|
|
const QString &pointName) const -> QPointF;
|
2016-03-10 17:09:38 +01:00
|
|
|
|
2022-05-20 16:08:32 +02:00
|
|
|
auto NameForHistory(const QString &toolName) const -> QString override;
|
2016-03-17 19:12:48 +01:00
|
|
|
|
2022-05-20 16:08:32 +02:00
|
|
|
auto GetParmT(qreal length) const -> qreal;
|
|
|
|
auto RealLengthByT(qreal t) const -> qreal;
|
2016-03-23 12:23:03 +01:00
|
|
|
|
2016-03-08 18:48:10 +01:00
|
|
|
protected:
|
2022-05-20 16:08:32 +02:00
|
|
|
void CreateName() override;
|
|
|
|
void CreateAlias() override;
|
2016-03-08 18:48:10 +01:00
|
|
|
|
2022-05-20 16:08:32 +02:00
|
|
|
static auto GetCubicBezierPoints(const QPointF &p1, const QPointF &p2, const QPointF &p3,
|
|
|
|
const QPointF &p4, qreal approximationScale) -> QVector<QPointF>;
|
|
|
|
static auto LengthBezier(const QPointF &p1, const QPointF &p2, const QPointF &p3, const QPointF &p4,
|
|
|
|
qreal approximationScale) -> qreal;
|
2016-03-10 17:09:38 +01:00
|
|
|
|
2022-05-20 16:08:32 +02:00
|
|
|
virtual auto GetControlPoint1() const -> QPointF =0;
|
|
|
|
virtual auto GetControlPoint2() const -> QPointF =0;
|
2022-02-03 14:48:52 +01:00
|
|
|
virtual auto GetRealLength() const -> qreal =0;
|
2016-03-08 18:48:10 +01:00
|
|
|
};
|
|
|
|
|
2021-09-25 14:49:00 +02:00
|
|
|
QT_WARNING_POP
|
|
|
|
|
2016-03-08 18:48:10 +01:00
|
|
|
#endif // VABSTRACTCUBICBEZIER_H
|