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
QVector4D Class Reference

The QVector4D class represents a vector or vertex in 4D space. More...

#include <qvectornd.h>

+ Collaboration diagram for QVector4D:

Public Member Functions

constexpr QVector4D () noexcept
 Constructs a null vector, i.e.
 
 QVector4D (Qt::Initialization) noexcept
 
constexpr QVector4D (float xpos, float ypos, float zpos, float wpos) noexcept
 Constructs a vector with coordinates (xpos, ypos, zpos, wpos).
 
constexpr QVector4D (QPoint point) noexcept
 Constructs a vector with x and y coordinates from a 2D point, and z and w coordinates of 0.
 
constexpr QVector4D (QPointF point) noexcept
 Constructs a vector with x and y coordinates from a 2D point, and z and w coordinates of 0.
 
constexpr QVector4D (QVector2D vector) noexcept
 Constructs a 4D vector from the specified 2D vector.
 
constexpr QVector4D (QVector2D vector, float zpos, float wpos) noexcept
 Constructs a 4D vector from the specified 2D vector.
 
constexpr QVector4D (QVector3D vector) noexcept
 Constructs a 4D vector from the specified 3D vector.
 
constexpr QVector4D (QVector3D vector, float wpos) noexcept
 Constructs a 4D vector from the specified 3D vector.
 
constexpr bool isNull () const noexcept
 Returns true if the x, y, z, and w 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 float w () const noexcept
 Returns the w 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 void setW (float w) noexcept
 Sets the w coordinate of this point to the given finite w 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.
 
QVector4D normalized () const noexcept
 Returns the normalized unit vector form of this vector.
 
void normalize () noexcept
 Normalizes the current vector in place.
 
constexpr QVector4Doperator+= (QVector4D vector) noexcept
 Adds the given vector to this vector and returns a reference to this vector.
 
constexpr QVector4Doperator-= (QVector4D vector) noexcept
 Subtracts the given vector from this vector and returns a reference to this vector.
 
constexpr QVector4Doperator*= (float factor) noexcept
 Multiplies this vector's coordinates by the given finite factor, and returns a reference to this vector.
 
constexpr QVector4Doperator*= (QVector4D vector) noexcept
 Multiplies each component of this vector by the corresponding component of vector and returns a reference to this vector.
 
constexpr QVector4Doperator/= (float divisor)
 Divides this vector's coordinates by the given divisor, and returns a reference to this vector.
 
constexpr QVector4Doperator/= (QVector4D vector)
 
constexpr QVector2D toVector2D () const noexcept
 Returns the 2D vector form of this 4D vector, dropping the z and w coordinates.
 
constexpr QVector2D toVector2DAffine () const noexcept
 Returns the 2D vector form of this 4D vector, dividing the x and y coordinates by the w coordinate and dropping the z coordinate.
 
constexpr QVector3D toVector3D () const noexcept
 Returns the 3D vector form of this 4D vector, dropping the w coordinate.
 
constexpr QVector3D toVector3DAffine () const noexcept
 Returns the 3D vector form of this 4D vector, dividing the x, y, and z coordinates by the w coordinate.
 
constexpr QPoint toPoint () const noexcept
 Returns the QPoint form of this 4D vector.
 
constexpr QPointF toPointF () const noexcept
 Returns the QPointF form of this 4D vector.
 
Q_GUI_EXPORT operator QVariant () const
 Returns the 4D vector as a QVariant.
 

Static Public Member Functions

static constexpr float dotProduct (QVector4D v1, QVector4D v2) noexcept
 Returns the dot product of v1 and v2.
 

Friends

class QVector2D
 
class QVector3D
 
class QMatrix4x4
 
QT_WARNING_PUSH QT_WARNING_DISABLE_FLOAT_COMPARE constexpr friend bool operator== (QVector4D v1, QVector4D v2) noexcept
 Returns true if v1 is equal to v2; otherwise returns false.
 
constexpr friend bool operator!= (QVector4D v1, QVector4D v2) noexcept
 Returns true if v1 is not equal to v2; otherwise returns false.
 
QT_WARNING_POP constexpr friend QVector4D operator+ (QVector4D v1, QVector4D v2) noexcept
 //! friend
 
constexpr friend QVector4D operator- (QVector4D v1, QVector4D v2) noexcept
 //! friend
 
constexpr friend QVector4D operator* (float factor, QVector4D vector) noexcept
 //! friend
 
constexpr friend QVector4D operator* (QVector4D vector, float factor) noexcept
 //! friend
 
constexpr friend QVector4D operator* (QVector4D v1, QVector4D v2) noexcept
 //! friend
 
constexpr friend QVector4D operator- (QVector4D 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 QVector4D object that is formed by changing the sign of all three components of the given vector.
 
constexpr friend QVector4D operator/ (QVector4D vector, float divisor)
 //! friend
 
constexpr friend QVector4D operator/ (QVector4D vector, QVector4D divisor)
 //! friend
 
Q_GUI_EXPORT bool qFuzzyCompare (QVector4D v1, QVector4D v2) noexcept
 //! friend
 
QVector4D operator* (const QVector4D &vector, const QMatrix4x4 &matrix)
 
QVector4D operator* (const QMatrix4x4 &matrix, const QVector4D &vector)
 
template<std::size_t I, typename V , std::enable_if_t<(I< 4), bool > = true, std::enable_if_t< std::is_same_v< q20::remove_cvref_t< V >, QVector4D >, bool > = true>
constexpr decltype(auto) get (V &&vec) noexcept
 

Related Symbols

(Note that these are not member symbols.)

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

Detailed Description

The QVector4D class represents a vector or vertex in 4D space.

Since
4.6

\inmodule QtGui

Vectors are one of the main building blocks of 4D affine representations of 3D space. They consist of four finite floating-point coordinates, traditionally called x, y, z and w.

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

See also
QQuaternion, QVector2D, QVector3D

Definition at line 329 of file qvectornd.h.

Constructor & Destructor Documentation

◆ QVector4D() [1/9]

constexpr QVector4D::QVector4D ( )
inlineconstexprnoexcept

Constructs a null vector, i.e.

with coordinates (0, 0, 0, 0).

Definition at line 856 of file qvectornd.h.

Referenced by normalized().

+ Here is the caller graph for this function:

◆ QVector4D() [2/9]

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

Constructs a vector without initializing the contents.

Definition at line 333 of file qvectornd.h.

◆ QVector4D() [3/9]

constexpr QVector4D::QVector4D ( float xpos,
float ypos,
float zpos,
float wpos )
inlineconstexprnoexcept

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

All parameters must be finite.

Definition at line 858 of file qvectornd.h.

◆ QVector4D() [4/9]

constexpr QVector4D::QVector4D ( QPoint point)
inlineexplicitconstexprnoexcept

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

Definition at line 860 of file qvectornd.h.

◆ QVector4D() [5/9]

constexpr QVector4D::QVector4D ( QPointF point)
inlineexplicitconstexprnoexcept

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

Definition at line 862 of file qvectornd.h.

◆ QVector4D() [6/9]

constexpr QVector4D::QVector4D ( QVector2D vector)
explicitconstexprnoexcept

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

The z and w coordinates are set to zero.

See also
toVector2D()

Definition at line 865 of file qvectornd.h.

References vector.

◆ QVector4D() [7/9]

constexpr QVector4D::QVector4D ( QVector2D vector,
float zpos,
float wpos )
constexprnoexcept

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

The z and w coordinates are set to zpos and wpos respectively, each of which must be finite.

See also
toVector2D()

Definition at line 866 of file qvectornd.h.

References vector.

◆ QVector4D() [8/9]

constexpr QVector4D::QVector4D ( QVector3D vector)
explicitconstexprnoexcept

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

The w coordinate is set to zero.

See also
toVector3D()

Definition at line 869 of file qvectornd.h.

References vector.

◆ QVector4D() [9/9]

constexpr QVector4D::QVector4D ( QVector3D vector,
float wpos )
constexprnoexcept

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

The w coordinate is set to wpos, which must be finite.

See also
toVector3D()

Definition at line 870 of file qvectornd.h.

References vector.

Member Function Documentation

◆ dotProduct()

constexpr float QVector4D::dotProduct ( QVector4D v1,
QVector4D v2 )
staticconstexprnoexcept

Returns the dot product of v1 and v2.

Definition at line 988 of file qvectornd.h.

Referenced by QQuickVector4DValueType::dotProduct().

+ Here is the caller graph for this function:

◆ isNull()

constexpr bool QVector4D::isNull ( ) const
inlineconstexprnoexcept

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

Definition at line 873 of file qvectornd.h.

References qIsNull().

+ Here is the call graph for this function:

◆ length()

float QVector4D::length ( ) const
inlinenoexcept

Returns the length of the vector from the origin.

See also
lengthSquared(), normalized()

Definition at line 900 of file qvectornd.h.

References qHypot().

Referenced by QQuickVector4DValueType::length(), normalize(), and normalized().

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

◆ lengthSquared()

constexpr float QVector4D::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 905 of file qvectornd.h.

◆ normalize()

void QVector4D::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 917 of file qvectornd.h.

References length(), and qFuzzyIsNull().

Referenced by QSSGUtils::mat44::normalize().

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

◆ normalized()

QVector4D QVector4D::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 910 of file qvectornd.h.

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

Referenced by QSSGRenderCamera::calculateViewProjectionMatrix(), QSSGRenderCamera::calculateViewProjectionMatrix(), QSSGRenderCamera::calculateViewProjectionWithoutTranslation(), and QQuickVector4DValueType::normalized().

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

◆ operator QVariant()

QVector4D::operator QVariant ( ) const

Returns the 4D vector as a QVariant.

Definition at line 1576 of file qvectornd.cpp.

References QVariant::fromValue().

+ Here is the call graph for this function:

◆ operator*=() [1/2]

constexpr QVector4D & QVector4D::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 947 of file qvectornd.h.

◆ operator*=() [2/2]

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

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

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

Definition at line 956 of file qvectornd.h.

References vector.

◆ operator+=()

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

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

See also
operator-=()

Definition at line 929 of file qvectornd.h.

References vector.

◆ operator-=()

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

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

See also
operator+=()

Definition at line 938 of file qvectornd.h.

References vector.

◆ operator/=() [1/2]

constexpr QVector4D & QVector4D::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*=()

Definition at line 965 of file qvectornd.h.

References Q_ASSERT.

◆ operator/=() [2/2]

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

Divides each component of this vector by the corresponding component of 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 975 of file qvectornd.h.

References Q_ASSERT, and vector.

◆ operator[]() [1/2]

constexpr float & QVector4D::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 < 4).

Definition at line 888 of file qvectornd.h.

References i, and Q_ASSERT.

◆ operator[]() [2/2]

constexpr float QVector4D::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 < 4).

Definition at line 894 of file qvectornd.h.

References i, and Q_ASSERT.

◆ setW()

constexpr void QVector4D::setW ( float w)
inlineconstexprnoexcept

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

See also
w(), setX(), setY(), setZ()

Definition at line 886 of file qvectornd.h.

Referenced by createFeCompositeNode(), QVector3D::project(), and QVector3D::unproject().

+ Here is the caller graph for this function:

◆ setX()

constexpr void QVector4D::setX ( float x)
inlineconstexprnoexcept

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

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

Definition at line 883 of file qvectornd.h.

Referenced by createFeCompositeNode(), QVector3D::project(), QQuick3DParticleShapeDataUtils::readValue(), and QVector3D::unproject().

+ Here is the caller graph for this function:

◆ setY()

constexpr void QVector4D::setY ( float y)
inlineconstexprnoexcept

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

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

Definition at line 884 of file qvectornd.h.

Referenced by createFeCompositeNode(), QVector3D::project(), and QVector3D::unproject().

+ Here is the caller graph for this function:

◆ setZ()

constexpr void QVector4D::setZ ( float z)
inlineconstexprnoexcept

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

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

Definition at line 885 of file qvectornd.h.

Referenced by createFeCompositeNode(), QQuick3DCamera::mapFromViewport(), and QQuick3DCamera::mapToViewport().

+ Here is the caller graph for this function:

◆ toPoint()

constexpr QPoint QVector4D::toPoint ( ) const
inlineconstexprnoexcept

Returns the QPoint form of this 4D vector.

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

See also
toPointF(), toVector2D()

Definition at line 1025 of file qvectornd.h.

References qRound().

+ Here is the call graph for this function:

◆ toPointF()

constexpr QPointF QVector4D::toPointF ( ) const
inlineconstexprnoexcept

Returns the QPointF form of this 4D vector.

The z and w coordinates are dropped.

See also
toPoint(), toVector2D()

Definition at line 1030 of file qvectornd.h.

◆ toVector2D()

constexpr QVector2D QVector4D::toVector2D ( ) const
inlineconstexprnoexcept

Returns the 2D vector form of this 4D vector, dropping the z and w coordinates.

See also
toVector2DAffine(), toVector3D(), toPoint()

Definition at line 995 of file qvectornd.h.

References QVector2D.

◆ toVector2DAffine()

constexpr QVector2D QVector4D::toVector2DAffine ( ) const
inlineconstexprnoexcept

Returns the 2D vector form of this 4D vector, dividing the x and y coordinates by the w coordinate and dropping the z coordinate.

Returns a null vector if w is zero.

See also
toVector2D(), toVector3DAffine(), toPoint()

Definition at line 1000 of file qvectornd.h.

References qIsNull(), and QVector2D.

+ Here is the call graph for this function:

◆ toVector3D()

constexpr QVector3D QVector4D::toVector3D ( ) const
inlineconstexprnoexcept

Returns the 3D vector form of this 4D vector, dropping the w coordinate.

See also
toVector3DAffine(), toVector2D(), toPoint()

Definition at line 1011 of file qvectornd.h.

References QVector3D.

Referenced by QVector3D::project(), QQuick3DRenderLayerHelpers::updateLayerNodeHelper(), QQuick3DAbstractLight::updateSpatialNode(), QQuick3DDefaultMaterial::updateSpatialNode(), QQuick3DPrincipledMaterial::updateSpatialNode(), and QQuick3DSpecularGlossyMaterial::updateSpatialNode().

+ Here is the caller graph for this function:

◆ toVector3DAffine()

constexpr QVector3D QVector4D::toVector3DAffine ( ) const
constexprnoexcept

Returns the 3D vector form of this 4D vector, dividing the x, y, and z coordinates by the w coordinate.

Returns a null vector if w is zero.

See also
toVector3D(), toVector2DAffine(), toPoint()

Definition at line 1016 of file qvectornd.h.

References qIsNull(), and QVector3D.

+ Here is the call graph for this function:

◆ w()

constexpr float QVector4D::w ( ) const
inlineconstexprnoexcept

Returns the w coordinate of this point.

See also
setW(), x(), y(), z()

Definition at line 881 of file qvectornd.h.

Referenced by QSvgFeComposite::apply(), QSSGQmlUtilities::builtinQmlType(), cullLodInstances(), genRandom(), QQuick3DCamera::mapToViewport(), QVector3D::project(), QSGNinePatchNode::rebuildGeometry(), and sortInstances().

+ Here is the caller graph for this function:

◆ x()

constexpr float QVector4D::x ( ) const
inlineconstexprnoexcept

Returns the x coordinate of this point.

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

Definition at line 878 of file qvectornd.h.

Referenced by QSvgFeComposite::apply(), QSSGQmlUtilities::builtinQmlType(), genRandom(), QVector3D::project(), QSGNinePatchNode::rebuildGeometry(), QSSGUtils::mat44::rotate(), toAnimationKey(), toAnimationKey(), QSSGUtils::mat44::transform(), and QVector3D::unproject().

+ Here is the caller graph for this function:

◆ y()

constexpr float QVector4D::y ( ) const
inlineconstexprnoexcept

Returns the y coordinate of this point.

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

Definition at line 879 of file qvectornd.h.

Referenced by QSvgFeComposite::apply(), QSSGQmlUtilities::builtinQmlType(), genRandom(), QVector3D::project(), QSGNinePatchNode::rebuildGeometry(), QSSGUtils::mat44::rotate(), QSSGUtils::mat44::transform(), and QVector3D::unproject().

+ Here is the caller graph for this function:

◆ z()

constexpr float QVector4D::z ( ) const
inlineconstexprnoexcept

Returns the z coordinate of this point.

See also
setZ(), x(), y(), w()

Definition at line 880 of file qvectornd.h.

Referenced by QSvgFeComposite::apply(), QSSGQmlUtilities::builtinQmlType(), genRandom(), QSGNinePatchNode::rebuildGeometry(), QSSGUtils::mat44::rotate(), and QSSGUtils::mat44::transform().

+ Here is the caller graph for this function:

Friends And Related Symbol Documentation

◆ get

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

Definition at line 465 of file qvectornd.h.

◆ operator!=

bool QVector4D::operator!= ( QVector4D v1,
QVector4D 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 383 of file qvectornd.h.

◆ operator* [1/5]

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

Definition at line 759 of file qmatrix4x4.h.

◆ operator* [2/5]

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

Definition at line 737 of file qmatrix4x4.h.

◆ operator* [3/5]

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

//! friend

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

See also
QVector4D::operator*=()

Definition at line 398 of file qvectornd.h.

◆ operator* [4/5]

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

//! friend

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

Note
This is not a cross product of v1 and v2 in any sense. (Its components add up to the dot product of v1 and v2.)
See also
QVector4D::operator*=()

Definition at line 408 of file qvectornd.h.

◆ operator* [5/5]

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

//! friend

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

See also
QVector4D::operator*=()

Definition at line 403 of file qvectornd.h.

◆ operator+

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

//! friend

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

See also
QVector4D::operator+=()

Definition at line 388 of file qvectornd.h.

◆ operator- [1/2]

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

//! friend

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

See also
QVector4D::operator-=()

Definition at line 393 of file qvectornd.h.

◆ operator- [2/2]

const QVector4D QVector4D::operator- ( QVector4D 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 QVector4D object that is formed by changing the sign of all three components of the given vector.

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

Definition at line 413 of file qvectornd.h.

◆ operator/ [1/2]

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

//! friend

Returns the QVector4D 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
QVector4D::operator/=()

Definition at line 418 of file qvectornd.h.

◆ operator/ [2/2]

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

//! friend

Since
5.5

Returns the QVector4D 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
QVector4D::operator/=()

Definition at line 424 of file qvectornd.h.

◆ operator<<()

QDataStream & operator<< ( QDataStream & stream,
QVector4D 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 1606 of file qvectornd.cpp.

References vector.

◆ operator==

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

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

This operator uses an exact floating-point comparison.

Definition at line 378 of file qvectornd.h.

◆ operator>>()

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

Reads a 4D 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 1623 of file qvectornd.cpp.

References Q_ASSERT, qIsFinite(), and vector.

+ Here is the call graph for this function:

◆ qFuzzyCompare

bool QVector4D::qFuzzyCompare ( QVector4D v1,
QVector4D 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 1504 of file qvectornd.cpp.

◆ QMatrix4x4

friend class QMatrix4x4
friend

Definition at line 455 of file qvectornd.h.

◆ QVector2D

friend class QVector2D
friend

Definition at line 453 of file qvectornd.h.

Referenced by toVector2D(), and toVector2DAffine().

◆ QVector3D

friend class QVector3D
friend

Definition at line 454 of file qvectornd.h.

Referenced by toVector3D(), and toVector3DAffine().


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