| 1 | // Copyright (C) 2017 Klaralvdalens Datakonsult AB (KDAB). | 
| 2 | // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only | 
| 3 |  | 
| 4 | #ifndef BEZIEREVALUATOR_P_H | 
| 5 | #define BEZIEREVALUATOR_P_H | 
| 6 |  | 
| 7 | // | 
| 8 | //  W A R N I N G | 
| 9 | //  ------------- | 
| 10 | // | 
| 11 | // This file is not part of the Qt API.  It exists for the convenience | 
| 12 | // of other Qt classes.  This header file may change from version to | 
| 13 | // version without notice, or even be removed. | 
| 14 | // | 
| 15 | // We mean it. | 
| 16 | // | 
| 17 |  | 
| 18 | #include <QtCore/private/qglobal_p.h> | 
| 19 |  | 
| 20 | QT_BEGIN_NAMESPACE | 
| 21 |  | 
| 22 | namespace Qt3DAnimation { | 
| 23 | namespace Animation { | 
| 24 |  | 
| 25 | struct Keyframe; | 
| 26 |  | 
| 27 | class Q_AUTOTEST_EXPORT BezierEvaluator | 
| 28 | { | 
| 29 | public: | 
| 30 |     explicit BezierEvaluator(float time0, const Keyframe &keyframe0, | 
| 31 |                              float time1, const Keyframe &keyframe1) | 
| 32 |         : m_time0(time0) | 
| 33 |         , m_time1(time1) | 
| 34 |         , m_keyframe0(keyframe0) | 
| 35 |         , m_keyframe1(keyframe1) | 
| 36 |     { | 
| 37 |     } | 
| 38 |  | 
| 39 |     float valueForTime(float time) const; | 
| 40 |     float parameterForTime(float time) const; | 
| 41 |  | 
| 42 |     static int findCubicRoots(const float coefficients[4], float roots[3]); | 
| 43 |  | 
| 44 | private: | 
| 45 |     float m_time0; | 
| 46 |     float m_time1; | 
| 47 |     const Keyframe &m_keyframe0; | 
| 48 |     const Keyframe &m_keyframe1; | 
| 49 | }; | 
| 50 |  | 
| 51 | } // namespace Animation | 
| 52 | } // namespace Qt3DAnimation | 
| 53 |  | 
| 54 | QT_END_NAMESPACE | 
| 55 |  | 
| 56 | #endif // BEZIEREVALUATOR_P_H | 
| 57 |  |