15 return ::sqrtf(
v.x() *
v.x() +
v.y() *
v.y());
25 return sqrtf(
v.x() *
v.x() +
v.y() *
v.y() +
v.z() *
v.z());
30 return v.x() *
v.x() +
v.y() *
v.y() +
v.z() *
v.z();
48 return c0 *
v.
x() + c1 *
v.
y() +
c2 *
v.z();
53 const float values[9] = {
m(0, 0),
m(0, 1),
m(0, 2),
m(1, 0),
m(1, 1),
m(1, 2),
m(2, 0),
m(2, 1),
m(2, 2) };
83 return m.column(0) *
v.
x() +
m.column(1) *
v.y() +
m.column(2) *
v.z();
94 return m.column(0) *
v.
x() +
m.column(1) *
v.y() +
m.column(2) *
v.z() +
m.column(3) *
v.w();
104 const float scaleX =
m.column(0).
length();
105 const float scaleY =
m.column(1).length();
106 const float scaleZ =
m.column(2).length();
107 return QVector3D(scaleX, scaleY, scaleZ);
117 return std::sqrt(
q.x() *
q.x() +
q.y() *
q.y() +
q.z() *
q.z() +
q.scalar() *
q.scalar());
122 const float unitTolerance = float(1
e-2);
123 return isFinite(
q) &&
qAbs(magnitude(
q) - 1) < unitTolerance;
128 const float unitTolerance = float(1
e-4);
129 return isFinite(
q) &&
qAbs(magnitude(
q) - 1) < unitTolerance;
134 const float vx = 2.0f *
v.
x();
135 const float vy = 2.0f *
v.y();
136 const float vz = 2.0f *
v.z();
137 const float w2 =
q.scalar() *
q.scalar() - 0.5f;
138 const float dot2 = (
q.x() * vx +
q.y() * vy +
q.z() * vz);
139 return QVector3D((vx *
w2 + (
q.y() * vz -
q.z() * vy) *
q.scalar() +
q.x() * dot2),
140 (vy *
w2 + (
q.z() * vx -
q.x() * vz) *
q.scalar() +
q.y() * dot2),
141 (vz *
w2 + (
q.x() * vy -
q.y() * vx) *
q.scalar() +
q.z() * dot2));
146 const float vx = 2.0f *
v.
x();
147 const float vy = 2.0f *
v.y();
148 const float vz = 2.0f *
v.z();
149 const float w2 =
q.scalar() *
q.scalar() - 0.5f;
150 const float dot2 = (
q.x() * vx +
q.y() * vy +
q.z() * vz);
151 return QVector3D((vx *
w2 - (
q.y() * vz -
q.z() * vy) *
q.scalar() +
q.x() * dot2),
152 (vy *
w2 - (
q.z() * vx -
q.x() * vz) *
q.scalar() +
q.y() * dot2),
153 (vz *
w2 - (
q.x() * vy -
q.y() * vx) *
q.scalar() +
q.z() * dot2));
158 return src ==
nullptr ?
"" :
src;
164 const float C1 = 0.305306011f;
165 const QVector3D C2(0.682171111f, 0.682171111f, 0.682171111f);
166 const QVector3D C3(0.012522878f, 0.012522878f, 0.012522878f);
The QColor class provides colors based on RGB, HSV or CMYK values.
static QColor fromRgbF(float r, float g, float b, float a=1.0)
Static convenience function that returns a QColor constructed from the RGB color values,...
The QMatrix4x4 class represents a 4x4 transformation matrix in 3D space.
The QQuaternion class represents a quaternion consisting of a vector and scalar.
The QVector2D class represents a vector or vertex in 2D space.
The QVector3D class represents a vector or vertex in 3D space.
float length() const noexcept
Returns the length of the vector from the origin.
constexpr float y() const noexcept
Returns the y coordinate of this point.
constexpr float x() const noexcept
Returns the x coordinate of this point.
The QVector4D class represents a vector or vertex in 4D space.
constexpr float x() const noexcept
Returns the x coordinate of this point.
void normalize() noexcept
Normalizes the current vector in place.
constexpr float y() const noexcept
Returns the y coordinate of this point.
constexpr float z() const noexcept
Returns the z coordinate of this point.
Combined button and popup list for selecting options.
QVector4D Q_QUICK3DUTILS_EXPORT sRGBToLinear(const QColor &color)
QColor Q_QUICK3DUTILS_EXPORT sRGBToLinearColor(const QColor &color)
QVector3D Q_QUICK3DUTILS_EXPORT transform(const QMatrix3x3 &m, const QVector3D &v)
QMatrix3x3 Q_QUICK3DUTILS_EXPORT getUpper3x3(const QMatrix4x4 &m)
void Q_QUICK3DUTILS_EXPORT normalize(QMatrix4x4 &m)
QVector3D Q_QUICK3DUTILS_EXPORT transform(const QMatrix4x4 &m, const QVector3D &v)
QVector3D Q_QUICK3DUTILS_EXPORT rotate(const QMatrix4x4 &m, const QVector3D &v)
QVector3D Q_QUICK3DUTILS_EXPORT getScale(const QMatrix4x4 &m)
QVector3D Q_QUICK3DUTILS_EXPORT getPosition(const QMatrix4x4 &m)
QVector3D Q_QUICK3DUTILS_EXPORT rotated(const QQuaternion &q, const QVector3D &v)
bool Q_QUICK3DUTILS_EXPORT isFinite(const QQuaternion &q)
bool Q_QUICK3DUTILS_EXPORT isSane(const QQuaternion &q)
bool Q_QUICK3DUTILS_EXPORT isUnit(const QQuaternion &q)
float Q_QUICK3DUTILS_EXPORT magnitude(const QQuaternion &q)
QVector3D Q_QUICK3DUTILS_EXPORT inverseRotated(const QQuaternion &q, const QVector3D &v)
float Q_QUICK3DUTILS_EXPORT magnitude(const QVector2D &v)
float Q_QUICK3DUTILS_EXPORT magnitude(const QVector3D &v)
float Q_QUICK3DUTILS_EXPORT magnitudeSquared(const QVector3D &v)
float Q_QUICK3DUTILS_EXPORT normalize(QVector3D &v)
bool Q_QUICK3DUTILS_EXPORT isFinite(const QVector3D &v)
bool qIsFinite(qfloat16 f) noexcept
QGenericMatrix< 3, 3, float > QMatrix3x3
constexpr T qAbs(const T &t)
GLenum GLsizei GLsizei GLint * values
[15]
GLsizei const GLfloat * v
[13]
GLdouble GLdouble GLint GLint GLdouble GLdouble GLint GLint GLdouble GLdouble w2
GLdouble GLdouble GLdouble GLdouble q
const char * nonNull(const char *src)