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

Go to the source code of this file.

Classes

class  QVector2D
 The QVector2D class represents a vector or vertex in 2D space. More...
 

Functions

bool operator!= (const QVector2D &v1, const QVector2D &v2)
 
const QVector2D operator* (qreal factor, const QVector2D &vector)
 
const QVector2D operator* (const QVector2D &vector, qreal factor)
 
const QVector2D operator* (const QVector2D &v1, const QVector2D &v2)
 
const QVector2D operator+ (const QVector2D &v1, const QVector2D &v2)
 
const QVector2D operator- (const QVector2D &v1, const QVector2D &v2)
 
const QVector2D operator- (const QVector2D &vector)
 
const QVector2D operator/ (const QVector2D &vector, qreal divisor)
 
Q_GUI_EXPORT QDebug operator<< (QDebug dbg, const QVector2D &vector)
 
Q_GUI_EXPORT QDataStreamoperator<< (QDataStream &, const QVector2D &)
 
bool operator== (const QVector2D &v1, const QVector2D &v2)
 
Q_GUI_EXPORT QDataStreamoperator>> (QDataStream &, QVector2D &)
 
 Q_DECLARE_TYPEINFO (QVector2D, Q_MOVABLE_TYPE)
 
bool qFuzzyCompare (const QVector2D &v1, const QVector2D &v2)
 

Function Documentation

◆ operator!=()

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

Definition at line 192 of file qvector2d.h.

193 {
194  return v1.xp != v2.xp || v1.yp != v2.yp;
195 }
float xp
Definition: qvector2d.h:121
float yp
Definition: qvector2d.h:121

◆ operator*() [1/3]

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

Definition at line 207 of file qvector2d.h.

208 {
209  return QVector2D(vector.xp * factor, vector.yp * factor, 1);
210 }
float xp
Definition: qvector2d.h:121
The QVector2D class represents a vector or vertex in 2D space.
Definition: qvector2d.h:60
float yp
Definition: qvector2d.h:121

◆ operator*() [2/3]

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

Definition at line 212 of file qvector2d.h.

213 {
214  return QVector2D(vector.xp * factor, vector.yp * factor, 1);
215 }
float xp
Definition: qvector2d.h:121
The QVector2D class represents a vector or vertex in 2D space.
Definition: qvector2d.h:60
float yp
Definition: qvector2d.h:121

◆ operator*() [3/3]

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

Definition at line 217 of file qvector2d.h.

218 {
219  return QVector2D(v1.xp * v2.xp, v1.yp * v2.yp, 1);
220 }
float xp
Definition: qvector2d.h:121
The QVector2D class represents a vector or vertex in 2D space.
Definition: qvector2d.h:60
float yp
Definition: qvector2d.h:121

◆ operator+()

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

Definition at line 197 of file qvector2d.h.

198 {
199  return QVector2D(v1.xp + v2.xp, v1.yp + v2.yp, 1);
200 }
float xp
Definition: qvector2d.h:121
The QVector2D class represents a vector or vertex in 2D space.
Definition: qvector2d.h:60
float yp
Definition: qvector2d.h:121

◆ operator-() [1/2]

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

Definition at line 202 of file qvector2d.h.

203 {
204  return QVector2D(v1.xp - v2.xp, v1.yp - v2.yp, 1);
205 }
float xp
Definition: qvector2d.h:121
The QVector2D class represents a vector or vertex in 2D space.
Definition: qvector2d.h:60
float yp
Definition: qvector2d.h:121

◆ operator-() [2/2]

const QVector2D operator- ( const QVector2D vector)
inline

Definition at line 222 of file qvector2d.h.

223 {
224  return QVector2D(-vector.xp, -vector.yp, 1);
225 }
float xp
Definition: qvector2d.h:121
The QVector2D class represents a vector or vertex in 2D space.
Definition: qvector2d.h:60
float yp
Definition: qvector2d.h:121

◆ operator/()

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

Definition at line 227 of file qvector2d.h.

228 {
229  return QVector2D(vector.xp / divisor, vector.yp / divisor, 1);
230 }
float xp
Definition: qvector2d.h:121
The QVector2D class represents a vector or vertex in 2D space.
Definition: qvector2d.h:60
float yp
Definition: qvector2d.h:121

◆ operator<<() [1/2]

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

Definition at line 488 of file qvector2d.cpp.

489 {
490  dbg.nospace() << "QVector2D(" << vector.x() << ", " << vector.y() << ')';
491  return dbg.space();
492 }
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 x() const
Returns the x coordinate of this point.
Definition: qvector2d.h:146
qreal y() const
Returns the y coordinate of this point.
Definition: qvector2d.h:147
QDebug & space()
Writes a space character to the debug stream and returns a reference to the stream.
Definition: qdebug.h:91

◆ operator<<() [2/2]

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

Definition at line 511 of file qvector2d.cpp.

512 {
513  stream << double(vector.x()) << double(vector.y());
514  return stream;
515 }
static FILE * stream

◆ operator==()

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

Definition at line 187 of file qvector2d.h.

188 {
189  return v1.xp == v2.xp && v1.yp == v2.yp;
190 }
float xp
Definition: qvector2d.h:121
float yp
Definition: qvector2d.h:121

◆ operator>>()

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

Definition at line 530 of file qvector2d.cpp.

531 {
532  double x, y;
533  stream >> x;
534  stream >> y;
535  vector.setX(qreal(x));
536  vector.setY(qreal(y));
537  return stream;
538 }
double qreal
Definition: qglobal.h:1193
static FILE * stream

◆ Q_DECLARE_TYPEINFO()

Q_DECLARE_TYPEINFO ( QVector2D  ,
Q_MOVABLE_TYPE   
)

◆ qFuzzyCompare()

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

Definition at line 232 of file qvector2d.h.

233 {
234  return qFuzzyCompare(v1.xp, v2.xp) && qFuzzyCompare(v1.yp, v2.yp);
235 }
float xp
Definition: qvector2d.h:121
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 yp
Definition: qvector2d.h:121