Qt
Internal/Contributor docs for the Qt SDK. <b>Note:</b> These are NOT official API docs; those are found <a href='https://doc.qt.io/'>here</a>.
Loading...
Searching...
No Matches
QVector3D Class Reference

The QVector3D class represents a vector or vertex in 3D space. More...

#include <qvectornd.h>

+ Collaboration diagram for QVector3D:

Public Member Functions

constexpr QVector3D () noexcept
 Constructs a null vector, i.e.
 
 QVector3D (Qt::Initialization) noexcept
 
constexpr QVector3D (float xpos, float ypos, float zpos) noexcept
 Constructs a vector with coordinates (xpos, ypos, zpos).
 
constexpr QVector3D (QPoint point) noexcept
 Constructs a vector with x and y coordinates from a 2D point, and a z coordinate of 0.
 
constexpr QVector3D (QPointF point) noexcept
 Constructs a vector with x and y coordinates from a 2D point, and a z coordinate of 0.
 
constexpr QVector3D (QVector2D vector) noexcept
 Constructs a 3D vector from the specified 2D vector.
 
constexpr QVector3D (QVector2D vector, float zpos) noexcept
 Constructs a 3D vector from the specified 2D vector.
 
constexpr QVector3D (QVector4D vector) noexcept
 Constructs a 3D vector from the specified 4D vector.
 
constexpr bool isNull () const noexcept
 Returns true if the x, y, and z coordinates are set to 0.0, otherwise returns false.
 
constexpr float x () const noexcept
 Returns the x coordinate of this point.
 
constexpr float y () const noexcept
 Returns the y coordinate of this point.
 
constexpr float z () const noexcept
 Returns the z coordinate of this point.
 
constexpr void setX (float x) noexcept
 Sets the x coordinate of this point to the given finite x coordinate.
 
constexpr void setY (float y) noexcept
 Sets the y coordinate of this point to the given finite y coordinate.
 
constexpr void setZ (float z) noexcept
 Sets the z coordinate of this point to the given finite z coordinate.
 
constexpr float & operator[] (int i)
 
constexpr float operator[] (int i) const
 
float length () const noexcept
 Returns the length of the vector from the origin.
 
constexpr float lengthSquared () const noexcept
 Returns the squared length of the vector from the origin.
 
QVector3D normalized () const noexcept
 Returns the normalized unit vector form of this vector.
 
void normalize () noexcept
 Normalizes the current vector in place.
 
constexpr QVector3Doperator+= (QVector3D vector) noexcept
 Adds the given vector to this vector and returns a reference to this vector.
 
constexpr QVector3Doperator-= (QVector3D vector) noexcept
 Subtracts the given vector from this vector and returns a reference to this vector.
 
constexpr QVector3Doperator*= (float factor) noexcept
 Multiplies this vector's coordinates by the given finite factor and returns a reference to this vector.
 
constexpr QVector3Doperator*= (QVector3D vector) noexcept
 This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.Multiplies each component of this vector by the corresponding component in vector and returns a reference to this vector.
 
constexpr QVector3Doperator/= (float divisor)
 Divides this vector's coordinates by the given divisor, and returns a reference to this vector.
 
constexpr QVector3Doperator/= (QVector3D vector)
 
Q_GUI_EXPORT QVector3D project (const QMatrix4x4 &modelView, const QMatrix4x4 &projection, const QRect &viewport) const
 
Q_GUI_EXPORT QVector3D unproject (const QMatrix4x4 &modelView, const QMatrix4x4 &projection, const QRect &viewport) const
 
QT_WARNING_POP float distanceToPoint (QVector3D point) const noexcept
 
constexpr float distanceToPlane (QVector3D plane, QVector3D normal) const noexcept
 Returns the distance from this vertex to a plane defined by the vertex plane and a normal unit vector.
 
float distanceToPlane (QVector3D plane1, QVector3D plane2, QVector3D plane3) const noexcept
 Returns the distance from this vertex to a plane defined by the vertices plane1, plane2 and plane3.
 
float distanceToLine (QVector3D point, QVector3D direction) const noexcept
 Returns the distance that this vertex is from a line defined by point and the unit vector direction.
 
constexpr QVector2D toVector2D () const noexcept
 Returns the 2D vector form of this 3D vector, dropping the z coordinate.
 
constexpr QVector4D toVector4D () const noexcept
 Returns the 4D form of this 3D vector, with the w coordinate set to zero.
 
constexpr QPoint toPoint () const noexcept
 Returns the QPoint form of this 3D vector.
 
constexpr QPointF toPointF () const noexcept
 Returns the QPointF form of this 3D vector.
 
Q_GUI_EXPORT operator QVariant () const
 Returns the 3D vector as a QVariant.
 

Static Public Member Functions

static constexpr float dotProduct (QVector3D v1, QVector3D v2) noexcept
 Returns the dot product of v1 and v2.
 
static constexpr QVector3D crossProduct (QVector3D v1, QVector3D v2) noexcept
 Returns the cross-product of vectors v1 and v2, which is normal to the plane spanned by v1 and v2.
 
static QVector3D normal (QVector3D v1, QVector3D v2) noexcept
 Returns the unit normal vector of a plane spanned by vectors v1 and v2, which must not be parallel to one another.
 
static QVector3D normal (QVector3D v1, QVector3D v2, QVector3D v3) noexcept
 Returns the unit normal vector of a plane spanned by vectors v2 - v1 and v3 - v1, which must not be parallel to one another.
 

Friends

class QVector2D
 
class QVector4D
 
QT_WARNING_PUSH QT_WARNING_DISABLE_FLOAT_COMPARE constexpr friend bool operator== (QVector3D v1, QVector3D v2) noexcept
 Returns true if v1 is equal to v2; otherwise returns false.
 
constexpr friend bool operator!= (QVector3D v1, QVector3D v2) noexcept
 Returns true if v1 is not equal to v2; otherwise returns false.
 
constexpr friend QVector3D operator+ (QVector3D v1, QVector3D v2) noexcept
 //! friend
 
constexpr friend QVector3D operator- (QVector3D v1, QVector3D v2) noexcept
 //! friend
 
constexpr friend QVector3D operator* (float factor, QVector3D vector) noexcept
 //! friend
 
constexpr friend QVector3D operator* (QVector3D vector, float factor) noexcept
 //! friend
 
constexpr friend QVector3D operator* (QVector3D v1, QVector3D v2) noexcept
 //! friend
 
constexpr friend QVector3D operator- (QVector3D vector) noexcept
 //! friendThis is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.Returns a QVector3D object that is formed by changing the sign of each component of the given vector.
 
constexpr friend QVector3D operator/ (QVector3D vector, float divisor)
 //! friend
 
constexpr friend QVector3D operator/ (QVector3D vector, QVector3D divisor)
 //! friend
 
Q_GUI_EXPORT bool qFuzzyCompare (QVector3D v1, QVector3D v2) noexcept
 //! friend
 
QVector3D operator* (const QVector3D &vector, const QMatrix4x4 &matrix)
 
QVector3D operator* (const QMatrix4x4 &matrix, const QVector3D &vector)
 
template<std::size_t I, typename V , std::enable_if_t<(I< 3), bool > = true, std::enable_if_t< std::is_same_v< q20::remove_cvref_t< V >, QVector3D >, bool > = true>
constexpr decltype(auto) get (V &&vec) noexcept
 

Related Symbols

(Note that these are not member symbols.)

QDataStreamoperator<< (QDataStream &stream, QVector3D vector)
 Writes the given vector to the given stream and returns a reference to the stream.
 
QDataStreamoperator>> (QDataStream &stream, QVector3D &vector)
 Reads a 3D vector from the given stream into the given vector and returns a reference to the stream.
 

Detailed Description

The QVector3D class represents a vector or vertex in 3D space.

Since
4.6

\inmodule QtGui

Vectors are one of the main building blocks of 3D representation and drawing. They consist of three finite floating-point coordinates, traditionally called x, y, and z.

The QVector3D class can also be used to represent vertices in 3D space. We therefore do not need to provide a separate vertex class.

See also
QVector2D, QVector4D, QQuaternion

Definition at line 170 of file qvectornd.h.

Constructor & Destructor Documentation

◆ QVector3D() [1/8]

constexpr QVector3D::QVector3D ( )
inlineconstexprnoexcept

Constructs a null vector, i.e.

with coordinates (0, 0, 0).

Definition at line 650 of file qvectornd.h.

Referenced by normalized().

+ Here is the caller graph for this function:

◆ QVector3D() [2/8]

QVector3D::QVector3D ( Qt::Initialization )
inlineexplicitnoexcept
Since
5.5

Constructs a vector without initializing the contents.

Definition at line 174 of file qvectornd.h.

◆ QVector3D() [3/8]

QVector3D::QVector3D ( float xpos,
float ypos,
float zpos )
inlineconstexprnoexcept

Constructs a vector with coordinates (xpos, ypos, zpos).

All parameters must be finite.

Definition at line 175 of file qvectornd.h.

◆ QVector3D() [4/8]

constexpr QVector3D::QVector3D ( QPoint point)
inlineexplicitconstexprnoexcept

Constructs a vector with x and y coordinates from a 2D point, and a z coordinate of 0.

Definition at line 652 of file qvectornd.h.

◆ QVector3D() [5/8]

constexpr QVector3D::QVector3D ( QPointF point)
inlineexplicitconstexprnoexcept

Constructs a vector with x and y coordinates from a 2D point, and a z coordinate of 0.

Definition at line 654 of file qvectornd.h.

◆ QVector3D() [6/8]

constexpr QVector3D::QVector3D ( QVector2D vector)
inlineexplicitconstexprnoexcept

Constructs a 3D vector from the specified 2D vector.

The z coordinate is set to zero.

See also
toVector2D()

Definition at line 657 of file qvectornd.h.

References vector.

◆ QVector3D() [7/8]

constexpr QVector3D::QVector3D ( QVector2D vector,
float zpos )
inlineconstexprnoexcept

Constructs a 3D vector from the specified 2D vector.

The z coordinate is set to zpos, which must be finite.

See also
toVector2D()

Definition at line 658 of file qvectornd.h.

References vector.

◆ QVector3D() [8/8]

constexpr QVector3D::QVector3D ( QVector4D vector)
inlineexplicitconstexprnoexcept

Constructs a 3D vector from the specified 4D vector.

The w coordinate is dropped.

See also
toVector4D()

Definition at line 662 of file qvectornd.h.

References vector.

Member Function Documentation

◆ crossProduct()

constexpr QVector3D QVector3D::crossProduct ( QVector3D v1,
QVector3D v2 )
inlinestaticconstexprnoexcept

Returns the cross-product of vectors v1 and v2, which is normal to the plane spanned by v1 and v2.

It will be zero if the two vectors are parallel.

See also
normal()

Definition at line 775 of file qvectornd.h.

Referenced by QSSGPlane::QSSGPlane(), QQuickVector3DValueType::crossProduct(), QT_BEGIN_NAMESPACE::generateMeshLevelsOfDetail(), getViewportHalfExtents(), QMatrix4x4::lookAt(), QQuick3DQuaternionUtils::lookAt(), rotationQuaternionForLookAt(), setupCameraForShadowMap(), QSSGRenderRay::triangleIntersect(), QWavefrontMesh::updateGeometry(), and QQuickFlipablePrivate::updateSide().

+ Here is the caller graph for this function:

◆ distanceToLine()

float QVector3D::distanceToLine ( QVector3D point,
QVector3D direction ) const
inlinenoexcept

Returns the distance that this vertex is from a line defined by point and the unit vector direction.

If direction is a null vector, then it does not define a line. In that case, the distance from point to this vertex is returned.

See also
distanceToPlane()

Definition at line 808 of file qvectornd.h.

References direction, dotProduct, and length().

+ Here is the call graph for this function:

◆ distanceToPlane() [1/2]

constexpr float QVector3D::distanceToPlane ( QVector3D plane,
QVector3D normal ) const
inlineconstexprnoexcept

Returns the distance from this vertex to a plane defined by the vertex plane and a normal unit vector.

The normal parameter is assumed to have been normalized to a unit vector.

The return value will be negative if the vertex is below the plane, or zero if it is on the plane.

See also
normal(), distanceToLine()

Definition at line 797 of file qvectornd.h.

References dotProduct.

◆ distanceToPlane() [2/2]

float QVector3D::distanceToPlane ( QVector3D plane1,
QVector3D plane2,
QVector3D plane3 ) const
inlinenoexcept

Returns the distance from this vertex to a plane defined by the vertices plane1, plane2 and plane3.

The return value will be negative if the vertex is below the plane, or zero if it is on the plane.

The two vectors that define the plane are plane2 - plane1 and plane3 - plane1.

See also
normal(), distanceToLine()

Definition at line 802 of file qvectornd.h.

References dotProduct.

◆ distanceToPoint()

float QVector3D::distanceToPoint ( QVector3D point) const
inlinenoexcept
Since
5.1

Returns the distance from this vertex to a point defined by the vertex point.

See also
distanceToPlane(), distanceToLine()

Definition at line 792 of file qvectornd.h.

Referenced by QSSGLayerRenderData::prepareReflectionProbesForRender().

+ Here is the caller graph for this function:

◆ dotProduct()

◆ isNull()

constexpr bool QVector3D::isNull ( ) const
inlineconstexprnoexcept

Returns true if the x, y, and z coordinates are set to 0.0, otherwise returns false.

Definition at line 665 of file qvectornd.h.

References qIsNull().

Referenced by QQuick3DParticleAttractor::affectParticle(), QQuick3DParticleEmitter::emitParticle(), and QWavefrontMesh::updateGeometry().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ length()

float QVector3D::length ( ) const
inlinenoexcept

Returns the length of the vector from the origin.

See also
lengthSquared(), normalized()

Definition at line 690 of file qvectornd.h.

References qHypot().

Referenced by distanceToLine(), QQuick3DInstancing::InstanceTableEntry::getScale(), QSSGUtils::mat44::getScale(), QQuickVector3DValueType::length(), normalize(), normalized(), and QQuick3DParticleVectorDirection::sample().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ lengthSquared()

constexpr float QVector3D::lengthSquared ( ) const
inlineconstexprnoexcept

Returns the squared length of the vector from the origin.

This is equivalent to the dot product of the vector with itself.

See also
length(), dotProduct()

Definition at line 713 of file qvectornd.h.

◆ normal() [1/2]

QVector3D QVector3D::normal ( QVector3D v1,
QVector3D v2 )
inlinestaticnoexcept

Returns the unit normal vector of a plane spanned by vectors v1 and v2, which must not be parallel to one another.

Use crossProduct() to compute the cross-product of v1 and v2 if you do not need the result to be normalized to a unit vector.

See also
crossProduct(), distanceToPlane()

Definition at line 782 of file qvectornd.h.

References crossProduct().

Referenced by QT_BEGIN_NAMESPACE::generateMeshLevelsOfDetail().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ normal() [2/2]

QVector3D QVector3D::normal ( QVector3D v1,
QVector3D v2,
QVector3D v3 )
inlinestaticnoexcept

Returns the unit normal vector of a plane spanned by vectors v2 - v1 and v3 - v1, which must not be parallel to one another.

Use crossProduct() to compute the cross-product of v2 - v1 and v3 - v1 if you do not need the result to be normalized to a unit vector.

See also
crossProduct(), distanceToPlane()

Definition at line 787 of file qvectornd.h.

References crossProduct().

+ Here is the call graph for this function:

◆ normalize()

void QVector3D::normalize ( )
inlinenoexcept

Normalizes the current vector in place.

Nothing happens if this vector is a null vector or the length of the vector is very close to 1.

See also
length(), normalized()

Definition at line 702 of file qvectornd.h.

References length(), and qFuzzyIsNull().

Referenced by fillPrefilterValues(), QMatrix4x4::lookAt(), QQuick3DQuaternionUtils::lookAt(), rotationQuaternionForLookAt(), and QWavefrontMesh::updateGeometry().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ normalized()

QVector3D QVector3D::normalized ( ) const
inlinenoexcept

Returns the normalized unit vector form of this vector.

If this vector is null, then a null vector is returned. If the length of the vector is very close to 1, then the vector will be returned as-is. Otherwise the normalized form of the vector of length 1 will be returned.

See also
length(), normalize()

Definition at line 695 of file qvectornd.h.

References QVector3D(), length(), qFuzzyIsNull(), and this.

Referenced by QSSGRenderRay::createRayData(), QQuick3DNodePrivate::emitChangesToSceneTransform(), QQuick3DNode::forward(), QCharacterController::getDisplacement(), QQuick3DInstancing::InstanceTableEntry::getRotation(), QSSGRenderCamera::lookAt(), QQuick3DQuaternionUtils::lookAt(), QQuickVector3DValueType::normalized(), QQuick3DNode::right(), rotationQuaternionForLookAt(), QQuick3DParticleGravity::setDirection(), QQuick3DParticlePointRotator::setDirection(), setupCameraForShadowMap(), QQuick3DNode::up(), and QWavefrontMesh::updateGeometry().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ operator QVariant()

QVector3D::operator QVariant ( ) const

Returns the 3D vector as a QVariant.

Definition at line 1033 of file qvectornd.cpp.

References QVariant::fromValue().

+ Here is the call graph for this function:

◆ operator*=() [1/2]

constexpr QVector3D & QVector3D::operator*= ( float factor)
inlineconstexprnoexcept

Multiplies this vector's coordinates by the given finite factor and returns a reference to this vector.

See also
operator/=(), operator*()

Definition at line 734 of file qvectornd.h.

◆ operator*=() [2/2]

constexpr QVector3D & QVector3D::operator*= ( QVector3D vector)
inlineconstexprnoexcept

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.Multiplies each component of this vector by the corresponding component in vector and returns a reference to this vector.

Note: this is not the same as the crossProduct() of this vector and vector. (Its components add up to the dot product of this vector and vector.)

See also
crossProduct(), operator/=(), operator*()

Definition at line 742 of file qvectornd.h.

References vector.

◆ operator+=()

constexpr QVector3D & QVector3D::operator+= ( QVector3D vector)
inlineconstexprnoexcept

Adds the given vector to this vector and returns a reference to this vector.

See also
operator-=()

Definition at line 718 of file qvectornd.h.

References vector.

◆ operator-=()

constexpr QVector3D & QVector3D::operator-= ( QVector3D vector)
inlineconstexprnoexcept

Subtracts the given vector from this vector and returns a reference to this vector.

See also
operator+=()

Definition at line 726 of file qvectornd.h.

References vector.

◆ operator/=() [1/2]

constexpr QVector3D & QVector3D::operator/= ( float divisor)
inlineconstexpr

Divides this vector's coordinates by the given divisor, and returns a reference to this vector.

The divisor must not be either zero or NaN.

See also
operator*=(), operator/()

Definition at line 750 of file qvectornd.h.

References Q_ASSERT.

◆ operator/=() [2/2]

constexpr QVector3D & QVector3D::operator/= ( QVector3D vector)
inlineconstexpr
Since
5.5

Divides each component of this vector by the corresponding component in vector and returns a reference to this vector.

The vector must have no component that is either zero or NaN.

See also
operator*=(), operator/()

Definition at line 759 of file qvectornd.h.

References Q_ASSERT, and vector.

◆ operator[]() [1/2]

constexpr float & QVector3D::operator[] ( int i)
inlineconstexpr
Since
5.2

Returns the component of the vector at index position i as a modifiable reference.

i must be a valid index position in the vector (i.e., 0 <= i < 3).

Definition at line 678 of file qvectornd.h.

References i, and Q_ASSERT.

◆ operator[]() [2/2]

constexpr float QVector3D::operator[] ( int i) const
inlineconstexpr
Since
5.2

Returns the component of the vector at index position i.

i must be a valid index position in the vector (i.e., 0 <= i < 3).

Definition at line 684 of file qvectornd.h.

References i, and Q_ASSERT.

◆ project()

QVector3D QVector3D::project ( const QMatrix4x4 & modelView,
const QMatrix4x4 & projection,
const QRect & viewport ) const
Since
5.5

Returns the window coordinates of this vector initially in object/model coordinates using the model view matrix modelView, the projection matrix projection and the viewport dimensions viewport.

When transforming from clip to normalized space, a division by the w component on the vector components takes place. To prevent dividing by 0 if w equals to 0, it is set to 1.

Note
the returned y coordinates are in OpenGL orientation. OpenGL expects the bottom to be 0 whereas for Qt top is 0.
See also
unproject()

Definition at line 784 of file qvectornd.cpp.

References qFuzzyIsNull(), QVector4D, QVector4D::setW(), QVector4D::setX(), QVector4D::setY(), QVector4D::toVector3D(), viewport(), QVector4D::w(), QVector4D::x(), and QVector4D::y().

+ Here is the call graph for this function:

◆ setX()

constexpr void QVector3D::setX ( float x)
inlineconstexprnoexcept

Sets the x coordinate of this point to the given finite x coordinate.

See also
x(), setY(), setZ()

Definition at line 674 of file qvectornd.h.

Referenced by QSSGBounds3::basisExtent(), QQuick3DParticleShapeDataUtils::readValue(), and QQuick3DParticleSpriteParticle::setOffsetX().

+ Here is the caller graph for this function:

◆ setY()

constexpr void QVector3D::setY ( float y)
inlineconstexprnoexcept

Sets the y coordinate of this point to the given finite y coordinate.

See also
y(), setX(), setZ()

Definition at line 675 of file qvectornd.h.

Referenced by QQuick3DParticleSpriteParticle::setOffsetY().

+ Here is the caller graph for this function:

◆ setZ()

constexpr void QVector3D::setZ ( float z)
inlineconstexprnoexcept

Sets the z coordinate of this point to the given finite z coordinate.

See also
z(), setX(), setY()

Definition at line 676 of file qvectornd.h.

◆ toPoint()

constexpr QPoint QVector3D::toPoint ( ) const
inlineconstexprnoexcept

Returns the QPoint form of this 3D vector.

The z coordinate is dropped. The x and y coordinates are rounded to nearest integers.

See also
toPointF(), toVector2D()

Definition at line 829 of file qvectornd.h.

References qRound().

+ Here is the call graph for this function:

◆ toPointF()

constexpr QPointF QVector3D::toPointF ( ) const
inlineconstexprnoexcept

Returns the QPointF form of this 3D vector.

The z coordinate is dropped.

See also
toPoint(), toVector2D()

Definition at line 834 of file qvectornd.h.

◆ toVector2D()

constexpr QVector2D QVector3D::toVector2D ( ) const
inlineconstexprnoexcept

Returns the 2D vector form of this 3D vector, dropping the z coordinate.

See also
toVector4D(), toPoint()

Definition at line 817 of file qvectornd.h.

References QVector2D.

◆ toVector4D()

constexpr QVector4D QVector3D::toVector4D ( ) const
inlineconstexprnoexcept

Returns the 4D form of this 3D vector, with the w coordinate set to zero.

See also
toVector2D(), toPoint()

Definition at line 823 of file qvectornd.h.

References QVector4D.

◆ unproject()

QVector3D QVector3D::unproject ( const QMatrix4x4 & modelView,
const QMatrix4x4 & projection,
const QRect & viewport ) const
Since
5.5

Returns the object/model coordinates of this vector initially in window coordinates using the model view matrix modelView, the projection matrix projection and the viewport dimensions viewport.

When transforming from clip to normalized space, a division by the w component of the vector components takes place. To prevent dividing by 0 if w equals to 0, it is set to 1.

Note
y coordinates in viewport should use OpenGL orientation. OpenGL expects the bottom to be 0 whereas for Qt top is 0.
See also
project()

Definition at line 815 of file qvectornd.cpp.

References QMatrix4x4::inverted(), qFuzzyIsNull(), QVector4D, QVector4D::setW(), QVector4D::setX(), QVector4D::setY(), viewport(), QVector4D::x(), and QVector4D::y().

+ Here is the call graph for this function:

◆ x()

constexpr float QVector3D::x ( ) const
inlineconstexprnoexcept

Returns the x coordinate of this point.

See also
setX(), y(), z()

Definition at line 670 of file qvectornd.h.

Referenced by QT_BEGIN_NAMESPACE::VertexBufferDataExt::addVertexAttributeData(), QQuick3DParticleAttractor::affectParticle(), QQuick3DParticleWander::affectParticle(), QSGCurveFillNode::appendTriangle(), QSGCurveFillNode::appendTriangle(), QSSGBounds3::basisExtent(), QSSGQmlUtilities::builtinQmlType(), QQuick3DNodePrivate::calculateGlobalVariables(), QSSGBounds3::contains(), QSSGRenderRay::createIntersectionResult(), cullLodInstances(), QQuick3DParticleEmitter::emitParticle(), QDebugDrawHelper::generateBoxGeometry(), QCollisionDebugMeshBuilder::generateVertexArray(), genRandom(), QCharacterController::getDisplacement(), QSSGBounds3::getSupport(), getViewportHalfExtents(), QQuickPinchHandler::handlePointerEventImpl(), QSSGBounds3::intersects(), QSSGUtils::quat::inverseRotated(), QSSGBounds3::isEmpty(), QSSGBounds3::isInside(), QMatrix4x4::lookAt(), QMatrix4x4::map(), QQuick3DParticleSpriteParticle::offsetX(), qt_fromEulerRotation(), qt_normalFromRotation(), QSSGUtils::mat44::rotate(), QSSGUtils::quat::rotated(), QQuick3DParticleTargetDirection::sample(), QQuick3DParticleVectorDirection::sample(), setNodeProperties(), QQuick3DParticleSpriteParticle::setOffsetX(), QQuick3DNode::setPosition(), QSSGMaterialShaderGenerator::setRhiMaterialProperties(), QQuickGeoCoordinateAnimation::setTo(), QPhysXCharacterController::sync(), OpenXRHelpers::toQVector(), QSSGUtils::mat44::transform(), QSpatialSoundPrivate::updateRoomEffects(), QAudioEnginePrivate::updateRooms(), QQuickFlipablePrivate::updateSide(), and QSSGMesh::MeshInternal::writeMeshData().

+ Here is the caller graph for this function:

◆ y()

constexpr float QVector3D::y ( ) const
inlineconstexprnoexcept

Returns the y coordinate of this point.

See also
setY(), x(), z()

Definition at line 671 of file qvectornd.h.

Referenced by QT_BEGIN_NAMESPACE::VertexBufferDataExt::addVertexAttributeData(), QQuick3DParticleAttractor::affectParticle(), QQuick3DParticleWander::affectParticle(), QSGCurveFillNode::appendTriangle(), QSGCurveFillNode::appendTriangle(), QSSGBounds3::basisExtent(), QSSGQmlUtilities::builtinQmlType(), QQuick3DNodePrivate::calculateGlobalVariables(), QSSGBounds3::contains(), QSSGRenderRay::createIntersectionResult(), cullLodInstances(), QQuick3DParticleEmitter::emitParticle(), QDebugDrawHelper::generateBoxGeometry(), QCollisionDebugMeshBuilder::generateVertexArray(), genRandom(), QCharacterController::getDisplacement(), QSSGBounds3::getSupport(), getViewportHalfExtents(), QQuickPinchHandler::handlePointerEventImpl(), QPhysXCharacterController::init(), QSSGBounds3::intersects(), QSSGBounds3::isEmpty(), QSSGBounds3::isInside(), QMatrix4x4::lookAt(), QMatrix4x4::map(), QQuick3DParticleSpriteParticle::offsetY(), qt_fromEulerRotation(), qt_normalFromRotation(), QQuick3DParticleTargetDirection::sample(), QQuick3DParticleVectorDirection::sample(), QQuick3DParticleSpriteParticle::setOffsetY(), QQuick3DNode::setPosition(), QSSGMaterialShaderGenerator::setRhiMaterialProperties(), QQuickGeoCoordinateAnimation::setTo(), setupCameraForShadowMap(), QPhysXCharacterController::sync(), QSSGUtils::mat33::transform(), QSpatialSoundPrivate::updateRoomEffects(), and QSSGMesh::MeshInternal::writeMeshData().

+ Here is the caller graph for this function:

◆ z()

Friends And Related Symbol Documentation

◆ get

template<std::size_t I, typename V , std::enable_if_t<(I< 3), bool > = true, std::enable_if_t< std::is_same_v< q20::remove_cvref_t< V >, QVector3D >, bool > = true>
constexpr decltype(auto) get ( V && vec)
friend

Definition at line 313 of file qvectornd.h.

◆ operator!=

bool QVector3D::operator!= ( QVector3D v1,
QVector3D v2 )
friend

Returns true if v1 is not equal to v2; otherwise returns false.

This operator uses an exact floating-point comparison.

Definition at line 229 of file qvectornd.h.

◆ operator* [1/5]

QVector3D operator* ( const QMatrix4x4 & matrix,
const QVector3D & vector )
friend

◆ operator* [2/5]

QVector3D operator* ( const QVector3D & vector,
const QMatrix4x4 & matrix )
friend

◆ operator* [3/5]

const QVector3D QVector3D::operator* ( float factor,
QVector3D vector )
friend

//! friend

Returns a copy of the given vector, multiplied by the given finite factor.

See also
QVector3D::operator*=()

Definition at line 250 of file qvectornd.h.

◆ operator* [4/5]

const QVector3D QVector3D::operator* ( QVector3D v1,
QVector3D v2 )
friend

//! friend

Returns the QVector3D object formed by multiplying each component of v1 by the corresponding component of v2.

Note
This is not the same as the crossProduct() of v1 and v2. (Its components add up to the dot product of v1 and v2.)
See also
QVector3D::crossProduct()

Definition at line 260 of file qvectornd.h.

◆ operator* [5/5]

const QVector3D QVector3D::operator* ( QVector3D vector,
float factor )
friend

//! friend

Returns a copy of the given vector, multiplied by the given finite factor.

See also
QVector3D::operator*=()

Definition at line 255 of file qvectornd.h.

◆ operator+

const QVector3D QVector3D::operator+ ( QVector3D v1,
QVector3D v2 )
friend

//! friend

Returns a QVector3D object that is the sum of the given vectors, v1 and v2; each component is added separately.

See also
QVector3D::operator+=()

Definition at line 240 of file qvectornd.h.

◆ operator- [1/2]

const QVector3D QVector3D::operator- ( QVector3D v1,
QVector3D v2 )
friend

//! friend

Returns a QVector3D object that is formed by subtracting v2 from v1; each component is subtracted separately.

See also
QVector3D::operator-=()

Definition at line 245 of file qvectornd.h.

◆ operator- [2/2]

const QVector3D QVector3D::operator- ( QVector3D vector)
friend

//! friendThis is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.Returns a QVector3D object that is formed by changing the sign of each component of the given vector.

Equivalent to {QVector3D(0,0,0) - vector}.

Definition at line 265 of file qvectornd.h.

◆ operator/ [1/2]

const QVector3D QVector3D::operator/ ( QVector3D vector,
float divisor )
friend

//! friend

Returns the QVector3D object formed by dividing each component of the given vector by the given divisor.

The divisor must not be either zero or NaN.

See also
QVector3D::operator/=()

Definition at line 270 of file qvectornd.h.

◆ operator/ [2/2]

const QVector3D QVector3D::operator/ ( QVector3D vector,
QVector3D divisor )
friend

//! friend

Since
5.5

Returns the QVector3D object formed by dividing each component of the given vector by the corresponding component of the given divisor.

The divisor must have no component that is either zero or NaN.

See also
QVector3D::operator/=()

Definition at line 276 of file qvectornd.h.

◆ operator<<()

QDataStream & operator<< ( QDataStream & stream,
QVector3D vector )
related

Writes the given vector to the given stream and returns a reference to the stream.

See also
{Serializing Qt Data Types}

Definition at line 1079 of file qvectornd.cpp.

References vector.

◆ operator==

bool QVector3D::operator== ( QVector3D v1,
QVector3D v2 )
friend

Returns true if v1 is equal to v2; otherwise returns false.

This operator uses an exact floating-point comparison.

Definition at line 224 of file qvectornd.h.

◆ operator>>()

QDataStream & operator>> ( QDataStream & stream,
QVector3D & vector )
related

Reads a 3D vector from the given stream into the given vector and returns a reference to the stream.

See also
{Serializing Qt Data Types}

Definition at line 1095 of file qvectornd.cpp.

References Q_ASSERT, qIsFinite(), and vector.

+ Here is the call graph for this function:

◆ qFuzzyCompare

bool QVector3D::qFuzzyCompare ( QVector3D v1,
QVector3D v2 )
friend

//! friend

Returns true if v1 and v2 are equal, allowing for a small fuzziness factor for floating-point comparisons; false otherwise.

Definition at line 981 of file qvectornd.cpp.

◆ QVector2D

friend class QVector2D
friend

Definition at line 302 of file qvectornd.h.

Referenced by toVector2D().

◆ QVector4D

friend class QVector4D
friend

Definition at line 303 of file qvectornd.h.

Referenced by project(), toVector4D(), and unproject().


The documentation for this class was generated from the following files: