File indexing completed on 2024-05-05 04:35:17
0001 /* This file is part of the TikZKit project. 0002 * 0003 * Copyright (C) 2013-2014 Dominik Haumann <dhaumann@kde.org> 0004 * 0005 * This library is free software; you can redistribute it and/or modify 0006 * it under the terms of the GNU Library General Public License as published 0007 * by the Free Software Foundation, either version 2 of the License, or 0008 * (at your option) any later version. 0009 * 0010 * This library is distributed in the hope that it will be useful, 0011 * but WITHOUT ANY WARRANTY; without even the implied warranty of 0012 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 0013 * GNU Library General Public License for more details. 0014 * 0015 * You should have received a copy of the GNU Library General Public License 0016 * along with this library; see the file COPYING.LIB. If not, see 0017 * <http://www.gnu.org/licenses/>. 0018 */ 0019 0020 #ifndef TIKZ_UI_BEZIER_CURVE_H 0021 #define TIKZ_UI_BEZIER_CURVE_H 0022 0023 #include <QPointF> 0024 #include <QPainterPath> 0025 0026 #include "tikzui_export.h" 0027 0028 class TIKZKITUI_EXPORT BezierCurve 0029 { 0030 public: 0031 /** 0032 * Default constructor 0033 */ 0034 BezierCurve(); 0035 0036 /** 0037 * Default constructor 0038 */ 0039 BezierCurve(const QPointF& p1, 0040 const QPointF& p2, 0041 const QPointF& c1, 0042 const QPointF& c2); 0043 0044 /** 0045 * Default constructor 0046 */ 0047 virtual ~BezierCurve(); 0048 0049 void setP1(const QPointF& p1); 0050 void setP2(const QPointF& p2); 0051 void setC1(const QPointF& c1); 0052 void setC2(const QPointF& c2); 0053 0054 QPointF p1() const; 0055 QPointF p2() const; 0056 QPointF c1() const; 0057 QPointF c2() const; 0058 0059 QPointF pointAtPercent(qreal t) const; 0060 0061 QPainterPath toPath(int samplePoints = 50) const; 0062 QPainterPath toPath(qreal t1, qreal t2, int samplePoints = 50) const; 0063 0064 BezierCurve subPath(qreal t1, qreal t2) const; 0065 0066 qreal intersect(const QPainterPath & path); 0067 0068 private: 0069 QPointF m_p1; 0070 QPointF m_p2; 0071 QPointF m_c1; 0072 QPointF m_c2; 0073 }; 0074 0075 #endif // TIKZ_UI_BEZIER_CURVE_H 0076 0077 // kate: indent-width 4; replace-tabs on;