- Main Page
- Related Pages
- Modules
- Namespaces
- Classes
- Files
- Directories
- Examples

- Class List
- Class Hierarchy
- Class Members

Public Member Functions | Static Public Member Functions | Friends

# QVector4D Class Reference

Search for all occurrences

## Detailed Description

Definition at line 60 of file qvector4d.h.

`#include <qvector4d.h>`

List of all members.

## Public Member Functions
| QVector4D ()
| QVector4D (qreal xpos, qreal ypos, qreal zpos, qreal wpos)
| QVector4D (const QPoint &point)
| QVector4D (const QPointF &point)
| QVector4D (const QVector2D &vector)
| QVector4D (const QVector2D &vector, qreal zpos, qreal wpos)
| QVector4D (const QVector3D &vector)
| QVector4D (const QVector3D &vector, qreal wpos)
bool | isNull () const
qreal | x () const
qreal | y () const
qreal | z () const
qreal | w () const
void | setX (qreal x)
void | setY (qreal y)
void | setZ (qreal z)
void | setW (qreal w)
qreal | length () const
qreal | lengthSquared () const
QVector4D | normalized () const
void | normalize ()
QVector4D & | operator+= (const QVector4D &vector)
QVector4D & | operator-= (const QVector4D &vector)
QVector4D & | operator*= (qreal factor)
QVector4D & | operator*= (const QVector4D &vector)
QVector4D & | operator/= (qreal divisor)
QVector2D | toVector2D () const
QVector2D | toVector2DAffine () const
QVector3D | toVector3D () const
QVector3D | toVector3DAffine () const
QPoint | toPoint () const
QPointF | toPointF () const
| operator QVariant () const
## Static Public Member Functions
static qreal | dotProduct (const QVector4D &v1, const QVector4D &v2)
## Friends
class | QVector2D
class | QVector3D
bool | operator== (const QVector4D &v1, const QVector4D &v2)
bool | operator!= (const QVector4D &v1, const QVector4D &v2)
const QVector4D | operator+ (const QVector4D &v1, const QVector4D &v2)
const QVector4D | operator- (const QVector4D &v1, const QVector4D &v2)
const QVector4D | operator* (qreal factor, const QVector4D &vector)
const QVector4D | operator* (const QVector4D &vector, qreal factor)
const QVector4D | operator* (const QVector4D &v1, const QVector4D &v2)
const QVector4D | operator- (const QVector4D &vector)
const QVector4D | operator/ (const QVector4D &vector, qreal divisor)
bool | qFuzzyCompare (const QVector4D &v1, const QVector4D &v2)
QVector4D | operator* (const QVector4D &vector, const QMatrix4x4 &matrix)
QVector4D | operator* (const QMatrix4x4 &matrix, const QVector4D &vector)

## Constructor & Destructor Documentation

QVector4D | ( |  | ) | `[inline]`

Definition at line 143 of file qvector4d.h.

    : xp(0.0f), yp(0.0f), zp(0.0f), wp(0.0f) {}

QVector4D | ( | qreal | xpos,
|  | qreal | ypos,
|  | qreal | zpos,
|  | qreal | wpos
| ) |  | `[inline]`

Definition at line 145 of file qvector4d.h.

    : xp(xpos), yp(ypos), zp(zpos), wp(wpos) {}

QVector4D | ( | const QPoint & | point | ) | `[inline, explicit]`

Definition at line 149 of file qvector4d.h.

    : xp(point.x()), yp(point.y()), zp(0.0f), wp(0.0f) {}

QVector4D | ( | const QPointF & | point | ) | `[inline, explicit]`

Definition at line 151 of file qvector4d.h.

    : xp(point.x()), yp(point.y()), zp(0.0f), wp(0.0f) {}

QVector4D | ( | const QVector2D & | vector | ) |

QVector4D | ( | const QVector2D & | vector,
|  | qreal | zpos,
|  | qreal | wpos
| ) |  |

QVector4D | ( | const QVector3D & | vector | ) |

QVector4D | ( | const QVector3D & | vector,
|  | qreal | wpos
| ) |  |

## Member Function Documentation

bool isNull | ( |  | ) | const `[inline]`

Search for all occurrences

Definition at line 153 of file qvector4d.h.

    {
        return qIsNull(xp) && qIsNull(yp) && qIsNull(zp) && qIsNull(wp);
    }

qreal x | ( |  | ) | const `[inline]`

Search for all occurrences

Definition at line 158 of file qvector4d.h.

    { return qreal(xp); }

qreal y | ( |  | ) | const `[inline]`

Search for all occurrences

Definition at line 159 of file qvector4d.h.

    { return qreal(yp); }

qreal z | ( |  | ) | const `[inline]`

Search for all occurrences

Definition at line 160 of file qvector4d.h.

    { return qreal(zp); }

qreal w | ( |  | ) | const `[inline]`

Search for all occurrences

Definition at line 161 of file qvector4d.h.

    { return qreal(wp); }

void setX | ( | qreal | x | ) | `[inline]`

Search for all occurrences

Definition at line 163 of file qvector4d.h.

    { xp = aX; }

void setY | ( | qreal | y | ) | `[inline]`

Search for all occurrences

Definition at line 164 of file qvector4d.h.

    { yp = aY; }

void setZ | ( | qreal | z | ) | `[inline]`

Search for all occurrences

Definition at line 165 of file qvector4d.h.

    { zp = aZ; }

void setW | ( | qreal | w | ) | `[inline]`

Search for all occurrences

Definition at line 166 of file qvector4d.h.

    { wp = aW; }

qreal length | ( |  | ) | const

Search for all occurrences

qreal lengthSquared | ( |  | ) | const

Search for all occurrences

QVector4D normalized | ( |  | ) | const

Search for all occurrences

void normalize | ( |  | ) |

Search for all occurrences

QVector4D & operator+= | ( | const QVector4D & | vector | ) | `[inline]`

Definition at line 168 of file qvector4d.h.

    {
        xp += vector.xp;
        yp += vector.yp;
        zp += vector.zp;
        wp += vector.wp;
        return *this;
    }

QVector4D & operator-= | ( | const QVector4D & | vector | ) | `[inline]`

Definition at line 177 of file qvector4d.h.

    {
        xp -= vector.xp;
        yp -= vector.yp;
        zp -= vector.zp;
        wp -= vector.wp;
        return *this;
    }

QVector4D & operator*= | ( | qreal | factor | ) | `[inline]`

Definition at line 186 of file qvector4d.h.

    {
        xp *= factor;
        yp *= factor;
        zp *= factor;
        wp *= factor;
        return *this;
    }

QVector4D & operator*= | ( | const QVector4D & | vector | ) | `[inline]`

Definition at line 195 of file qvector4d.h.

    {
        xp *= vector.xp;
        yp *= vector.yp;
        zp *= vector.zp;
        wp *= vector.wp;
        return *this;
    }

QVector4D & operator/= | ( | qreal | divisor | ) | `[inline]`

Definition at line 204 of file qvector4d.h.

    {
        xp /= divisor;
        yp /= divisor;
        zp /= divisor;
        wp /= divisor;
        return *this;
    }

static qreal dotProduct | ( | const QVector4D & | v1,
|  | const QVector4D & | v2
| ) |  | `[static]`

Search for all occurrences

QVector2D toVector2D | ( |  | ) | const

Search for all occurrences

QVector2D toVector2DAffine | ( |  | ) | const

Search for all occurrences

QVector3D toVector3D | ( |  | ) | const

Search for all occurrences

QVector3D toVector3DAffine | ( |  | ) | const

Search for all occurrences

QPoint toPoint | ( |  | ) | const `[inline]`

Search for all occurrences

Definition at line 266 of file qvector4d.h.

    {
        return QPoint(qRound(xp), qRound(yp));
    }

QPointF toPointF | ( |  | ) | const `[inline]`

Search for all occurrences

Definition at line 271 of file qvector4d.h.

    {
        return QPointF(qreal(xp), qreal(yp));
    }

operator QVariant | ( |  | ) | const

## Friends And Related Function Documentation

friend class QVector2D `[friend]`

Search for all occurrences

Definition at line 133 of file qvector4d.h.

friend class QVector3D `[friend]`

Search for all occurrences

Definition at line 134 of file qvector4d.h.

bool operator== | ( | const QVector4D & | v1,
|  | const QVector4D & | v2
| ) |  | `[friend]`

Definition at line 213 of file qvector4d.h.

    {
        return v1.xp == v2.xp && v1.yp == v2.yp && v1.zp == v2.zp && v1.wp == v2.wp;
    }

bool operator!= | ( | const QVector4D & | v1,
|  | const QVector4D & | v2
| ) |  | `[friend]`

Definition at line 218 of file qvector4d.h.

    {
        return v1.xp != v2.xp || v1.yp != v2.yp || v1.zp != v2.zp || v1.wp != v2.wp;
    }

const QVector4D operator+ | ( | const QVector4D & | v1,
|  | const QVector4D & | v2
| ) |  | `[friend]`

Definition at line 223 of file qvector4d.h.

    {
        return QVector4D(v1.xp + v2.xp, v1.yp + v2.yp, v1.zp + v2.zp, v1.wp + v2.wp, 1);
    }

const QVector4D operator- | ( | const QVector4D & | v1,
|  | const QVector4D & | v2
| ) |  | `[friend]`

Definition at line 228 of file qvector4d.h.

    {
        return QVector4D(v1.xp - v2.xp, v1.yp - v2.yp, v1.zp - v2.zp, v1.wp - v2.wp, 1);
    }

const QVector4D operator* | ( | qreal | factor,
|  | const QVector4D & | vector
| ) |  | `[friend]`

Definition at line 233 of file qvector4d.h.

    {
        return QVector4D(vector.xp * factor, vector.yp * factor, vector.zp * factor, vector.wp * factor, 1);
    }

const QVector4D operator* | ( | const QVector4D & | vector,
|  | qreal | factor
| ) |  | `[friend]`

Definition at line 238 of file qvector4d.h.

    {
        return QVector4D(vector.xp * factor, vector.yp * factor, vector.zp * factor, vector.wp * factor, 1);
    }

const QVector4D operator* | ( | const QVector4D & | v1,
|  | const QVector4D & | v2
| ) |  | `[friend]`

Definition at line 243 of file qvector4d.h.

    {
        return QVector4D(v1.xp * v2.xp, v1.yp * v2.yp, v1.zp * v2.zp, v1.wp * v2.wp, 1);
    }

const QVector4D operator- | ( | const QVector4D & | vector | ) | `[friend]`

Definition at line 248 of file qvector4d.h.

    {
        return QVector4D(-vector.xp, -vector.yp, -vector.zp, -vector.wp, 1);
    }

const QVector4D operator/ | ( | const QVector4D & | vector,
|  | qreal | divisor
| ) |  | `[friend]`

Definition at line 253 of file qvector4d.h.

    {
        return QVector4D(vector.xp / divisor, vector.yp / divisor, vector.zp / divisor, vector.wp / divisor, 1);
    }

bool qFuzzyCompare | ( | const QVector4D & | v1,
|  | const QVector4D & | v2
| ) |  | `[friend]`

Search for all occurrences

Definition at line 258 of file qvector4d.h.

    {
        return qFuzzyCompare(v1.xp, v2.xp) &&
               qFuzzyCompare(v1.yp, v2.yp) &&
               qFuzzyCompare(v1.zp, v2.zp) &&
               qFuzzyCompare(v1.wp, v2.wp);
    }

QVector4D operator* | ( | const QVector4D & | vector,
|  | const QMatrix4x4 & | matrix
| ) |  | `[friend]`

Definition at line 683 of file qmatrix4x4.h.

    {
        qreal x, y, z, w;
        x = vector.x() * matrix.m[0][0] +
            vector.y() * matrix.m[0][1] +
            vector.z() * matrix.m[0][2] +
            vector.w() * matrix.m[0][3];
        y = vector.x() * matrix.m[1][0] +
            vector.y() * matrix.m[1][1] +
            vector.z() * matrix.m[1][2] +
            vector.w() * matrix.m[1][3];
        z = vector.x() * matrix.m[2][0] +
            vector.y() * matrix.m[2][1] +
            vector.z() * matrix.m[2][2] +
            vector.w() * matrix.m[2][3];
        w = vector.x() * matrix.m[3][0] +
            vector.y() * matrix.m[3][1] +
            vector.z() * matrix.m[3][2] +
            vector.w() * matrix.m[3][3];
        return QVector4D(x, y, z, w);
    }

QVector4D operator* | ( | const QMatrix4x4 & | matrix,
|  | const QVector4D & | vector
| ) |  | `[friend]`

Definition at line 705 of file qmatrix4x4.h.

    {
        qreal x, y, z, w;
        x = vector.x() * matrix.m[0][0] +
            vector.y() * matrix.m[1][0] +
            vector.z() * matrix.m[2][0] +
            vector.w() * matrix.m[3][0];
        y = vector.x() * matrix.m[0][1] +
            vector.y() * matrix.m[1][1] +
            vector.z() * matrix.m[2][1] +
            vector.w() * matrix.m[3][1];
        z = vector.x() * matrix.m[0][2] +
            vector.y() * matrix.m[1][2] +
            vector.z() * matrix.m[2][2] +
            vector.w() * matrix.m[3][2];
        w = vector.x() * matrix.m[0][3] +
            vector.y() * matrix.m[1][3] +
            vector.z() * matrix.m[2][3] +
            vector.w() * matrix.m[3][3];
        return QVector4D(x, y, z, w);
    }

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

- QtGui/qvector4d.h

QVector4D QVector4D QVector4D QVector4D QVector4D QVector4D QVector4D QVector4D QVector4D QVector4D
QVector4D QVector4D QVector4D QVector4D QVector4D QVector4D QVector4D QVector4D QVector4D QVector4D