Qt 6.x
The Qt SDK
Loading...
Searching...
No Matches
qquickangledirection.cpp
Go to the documentation of this file.
1// Copyright (C) 2016 The Qt Company Ltd.
2// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
3
5#include <QRandomGenerator>
6#include <qmath.h>
7
9const qreal CONV = 0.017453292519943295;
63 , m_angle(0)
64 , m_magnitude(0)
65 , m_angleVariation(0)
66 , m_magnitudeVariation(0)
67{
68
69}
70
72{
73 Q_UNUSED(from);
75 qreal theta = m_angle*CONV - m_angleVariation*CONV + QRandomGenerator::global()->generateDouble() * m_angleVariation*CONV * 2;
76 qreal mag = m_magnitude- m_magnitudeVariation + QRandomGenerator::global()->generateDouble() * m_magnitudeVariation * 2;
77 ret.setX(mag * qCos(theta));
78 ret.setY(mag * qSin(theta));
79 return ret;
80}
81
83
84#include "moc_qquickangledirection_p.cpp"
\inmodule QtCore
Definition qobject.h:90
\inmodule QtCore\reentrant
Definition qpoint.h:214
QQuickAngleDirection(QObject *parent=nullptr)
\qmltype AngleDirection \instantiates QQuickAngleDirection \inqmlmodule QtQuick.Particles\inherits Di...
QPointF sample(const QPointF &from) override
double generateDouble()
Generates one random qreal in the canonical range [0, 1) (that is, inclusive of zero and exclusive of...
Definition qrandom.h:58
static Q_DECL_CONST_FUNCTION QRandomGenerator * global()
\threadsafe
Definition qrandom.h:275
Combined button and popup list for selecting options.
return ret
auto qCos(T v)
Definition qmath.h:60
auto qSin(T v)
Definition qmath.h:54
QT_BEGIN_NAMESPACE const qreal CONV
#define Q_UNUSED(x)
double qreal
Definition qtypes.h:92
IUIAutomationTreeWalker __RPC__deref_out_opt IUIAutomationElement ** parent