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
20QT_BEGIN_NAMESPACE
21
22namespace Qt3DAnimation {
23namespace Animation {
24
25struct Keyframe;
26
27class Q_AUTOTEST_EXPORT BezierEvaluator
28{
29public:
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[], float roots[3]);
43
44private:
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
54QT_END_NAMESPACE
55
56#endif // BEZIEREVALUATOR_P_H
57

source code of qt3d/src/animation/backend/bezierevaluator_p.h