Qt 4.8
Classes | Functions
qvector4d.h File Reference
#include <QtCore/qpoint.h>
#include <QtCore/qmetatype.h>

Go to the source code of this file.

Classes

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

Functions

bool 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 &v1, const QVector4D &v2)
 
const QVector4D operator- (const QVector4D &v1, const QVector4D &v2)
 
const QVector4D operator- (const QVector4D &vector)
 
const QVector4D operator/ (const QVector4D &vector, qreal divisor)
 
Q_GUI_EXPORT QDebug operator<< (QDebug dbg, const QVector4D &vector)
 
Q_GUI_EXPORT QDataStreamoperator<< (QDataStream &, const QVector4D &)
 
bool operator== (const QVector4D &v1, const QVector4D &v2)
 
Q_GUI_EXPORT QDataStreamoperator>> (QDataStream &, QVector4D &)
 
 Q_DECLARE_TYPEINFO (QVector4D, Q_MOVABLE_TYPE)
 
bool qFuzzyCompare (const QVector4D &v1, const QVector4D &v2)
 

Function Documentation

◆ operator!=()

bool operator!= ( const QVector4D v1,
const QVector4D v2 
)
inline

Definition at line 218 of file qvector4d.h.

219 {
220  return v1.xp != v2.xp || v1.yp != v2.yp || v1.zp != v2.zp || v1.wp != v2.wp;
221 }
float yp
Definition: qvector4d.h:129
float wp
Definition: qvector4d.h:129
float zp
Definition: qvector4d.h:129
float xp
Definition: qvector4d.h:129

◆ operator*() [1/3]

const QVector4D operator* ( qreal  factor,
const QVector4D vector 
)
inline

Definition at line 233 of file qvector4d.h.

234 {
235  return QVector4D(vector.xp * factor, vector.yp * factor, vector.zp * factor, vector.wp * factor, 1);
236 }
The QVector4D class represents a vector or vertex in 4D space.
Definition: qvector4d.h:60
float yp
Definition: qvector4d.h:129
float wp
Definition: qvector4d.h:129
float zp
Definition: qvector4d.h:129
float xp
Definition: qvector4d.h:129

◆ operator*() [2/3]

const QVector4D operator* ( const QVector4D vector,
qreal  factor 
)
inline

Definition at line 238 of file qvector4d.h.

239 {
240  return QVector4D(vector.xp * factor, vector.yp * factor, vector.zp * factor, vector.wp * factor, 1);
241 }
The QVector4D class represents a vector or vertex in 4D space.
Definition: qvector4d.h:60
float yp
Definition: qvector4d.h:129
float wp
Definition: qvector4d.h:129
float zp
Definition: qvector4d.h:129
float xp
Definition: qvector4d.h:129

◆ operator*() [3/3]

const QVector4D operator* ( const QVector4D v1,
const QVector4D v2 
)
inline

Definition at line 243 of file qvector4d.h.

244 {
245  return QVector4D(v1.xp * v2.xp, v1.yp * v2.yp, v1.zp * v2.zp, v1.wp * v2.wp, 1);
246 }
The QVector4D class represents a vector or vertex in 4D space.
Definition: qvector4d.h:60
float yp
Definition: qvector4d.h:129
float wp
Definition: qvector4d.h:129
float zp
Definition: qvector4d.h:129
float xp
Definition: qvector4d.h:129

◆ operator+()

const QVector4D operator+ ( const QVector4D v1,
const QVector4D v2 
)
inline

Definition at line 223 of file qvector4d.h.

224 {
225  return QVector4D(v1.xp + v2.xp, v1.yp + v2.yp, v1.zp + v2.zp, v1.wp + v2.wp, 1);
226 }
The QVector4D class represents a vector or vertex in 4D space.
Definition: qvector4d.h:60
float yp
Definition: qvector4d.h:129
float wp
Definition: qvector4d.h:129
float zp
Definition: qvector4d.h:129
float xp
Definition: qvector4d.h:129

◆ operator-() [1/2]

const QVector4D operator- ( const QVector4D v1,
const QVector4D v2 
)
inline

Definition at line 228 of file qvector4d.h.

229 {
230  return QVector4D(v1.xp - v2.xp, v1.yp - v2.yp, v1.zp - v2.zp, v1.wp - v2.wp, 1);
231 }
The QVector4D class represents a vector or vertex in 4D space.
Definition: qvector4d.h:60
float yp
Definition: qvector4d.h:129
float wp
Definition: qvector4d.h:129
float zp
Definition: qvector4d.h:129
float xp
Definition: qvector4d.h:129

◆ operator-() [2/2]

const QVector4D operator- ( const QVector4D vector)
inline

Definition at line 248 of file qvector4d.h.

249 {
250  return QVector4D(-vector.xp, -vector.yp, -vector.zp, -vector.wp, 1);
251 }
The QVector4D class represents a vector or vertex in 4D space.
Definition: qvector4d.h:60
float yp
Definition: qvector4d.h:129
float wp
Definition: qvector4d.h:129
float zp
Definition: qvector4d.h:129
float xp
Definition: qvector4d.h:129

◆ operator/()

const QVector4D operator/ ( const QVector4D vector,
qreal  divisor 
)
inline

Definition at line 253 of file qvector4d.h.

254 {
255  return QVector4D(vector.xp / divisor, vector.yp / divisor, vector.zp / divisor, vector.wp / divisor, 1);
256 }
The QVector4D class represents a vector or vertex in 4D space.
Definition: qvector4d.h:60
float yp
Definition: qvector4d.h:129
float wp
Definition: qvector4d.h:129
float zp
Definition: qvector4d.h:129
float xp
Definition: qvector4d.h:129

◆ operator<<() [1/2]

Q_GUI_EXPORT QDebug operator<< ( QDebug  dbg,
const QVector4D vector 
)

Definition at line 602 of file qvector4d.cpp.

603 {
604  dbg.nospace() << "QVector4D("
605  << vector.x() << ", " << vector.y() << ", "
606  << vector.z() << ", " << vector.w() << ')';
607  return dbg.space();
608 }
QDebug & nospace()
Clears the stream&#39;s internal flag that records whether the last character was a space and returns a r...
Definition: qdebug.h:92
qreal w() const
Returns the w coordinate of this point.
Definition: qvector4d.h:161
qreal x() const
Returns the x coordinate of this point.
Definition: qvector4d.h:158
qreal z() const
Returns the z coordinate of this point.
Definition: qvector4d.h:160
QDebug & space()
Writes a space character to the debug stream and returns a reference to the stream.
Definition: qdebug.h:91
qreal y() const
Returns the y coordinate of this point.
Definition: qvector4d.h:159

◆ operator<<() [2/2]

Q_GUI_EXPORT QDataStream& operator<< ( QDataStream ,
const QVector4D  
)
related

Definition at line 627 of file qvector4d.cpp.

628 {
629  stream << double(vector.x()) << double(vector.y())
630  << double(vector.z()) << double(vector.w());
631  return stream;
632 }
static FILE * stream

◆ operator==()

bool operator== ( const QVector4D v1,
const QVector4D v2 
)
inline

Definition at line 213 of file qvector4d.h.

214 {
215  return v1.xp == v2.xp && v1.yp == v2.yp && v1.zp == v2.zp && v1.wp == v2.wp;
216 }
float yp
Definition: qvector4d.h:129
float wp
Definition: qvector4d.h:129
float zp
Definition: qvector4d.h:129
float xp
Definition: qvector4d.h:129

◆ operator>>()

Q_GUI_EXPORT QDataStream& operator>> ( QDataStream ,
QVector4D  
)
related

Definition at line 647 of file qvector4d.cpp.

648 {
649  double x, y, z, w;
650  stream >> x;
651  stream >> y;
652  stream >> z;
653  stream >> w;
654  vector.setX(qreal(x));
655  vector.setY(qreal(y));
656  vector.setZ(qreal(z));
657  vector.setW(qreal(w));
658  return stream;
659 }
double qreal
Definition: qglobal.h:1193
static FILE * stream

◆ Q_DECLARE_TYPEINFO()

Q_DECLARE_TYPEINFO ( QVector4D  ,
Q_MOVABLE_TYPE   
)

◆ qFuzzyCompare()

bool qFuzzyCompare ( const QVector4D v1,
const QVector4D v2 
)
inline

Definition at line 258 of file qvector4d.h.

259 {
260  return qFuzzyCompare(v1.xp, v2.xp) &&
261  qFuzzyCompare(v1.yp, v2.yp) &&
262  qFuzzyCompare(v1.zp, v2.zp) &&
263  qFuzzyCompare(v1.wp, v2.wp);
264 }
float yp
Definition: qvector4d.h:129
float wp
Definition: qvector4d.h:129
float zp
Definition: qvector4d.h:129
bool qFuzzyCompare(const QMatrix &m1, const QMatrix &m2)
The qFuzzyCompare function is for comparing two matrices using a fuzziness factor.
Definition: qmatrix.h:172
float xp
Definition: qvector4d.h:129