Represents two doubles as a mathematical 2D vector. More...
Public Functions  
QCPVector2D ()  
QCPVector2D (double x, double y)  
QCPVector2D (const QPoint &point)  
QCPVector2D (const QPointF &point)  
double  x () const 
double  y () const 
double &  rx () 
double &  ry () 
void  setX (double x) 
void  setY (double y) 
double  length () const 
double  lengthSquared () const 
double  angle () const 
QPoint  toPoint () const 
QPointF  toPointF () const 
bool  isNull () const 
void  normalize () 
QCPVector2D  normalized () const 
QCPVector2D  perpendicular () const 
double  dot (const QCPVector2D &vec) const 
double  distanceSquaredToLine (const QCPVector2D &start, const QCPVector2D &end) const 
double  distanceSquaredToLine (const QLineF &line) const 
double  distanceToStraightLine (const QCPVector2D &base, const QCPVector2D &direction) const 
QCPVector2D &  operator*= (double factor) 
QCPVector2D &  operator/= (double divisor) 
QCPVector2D &  operator+= (const QCPVector2D &vector) 
QCPVector2D &  operator= (const QCPVector2D &vector) 
Friends  
const QCPVector2D  operator* (double factor, const QCPVector2D &vec) 
const QCPVector2D  operator* (const QCPVector2D &vec, double factor) 
const QCPVector2D  operator/ (const QCPVector2D &vec, double divisor) 
const QCPVector2D  operator+ (const QCPVector2D &vec1, const QCPVector2D &vec2) 
const QCPVector2D  operator (const QCPVector2D &vec1, const QCPVector2D &vec2) 
const QCPVector2D  operator (const QCPVector2D &vec) 
Related NonMembers  
(Note that these are not member functions.)  
QDebug  operator<< (QDebug d, const QCPVector2D &vec) 
Represents two doubles as a mathematical 2D vector.
This class acts as a replacement for QVector2D with the advantage of double precision instead of single, and some convenience methods tailored for the QCustomPlot library.
QCPVector2D::QCPVector2D  (  ) 
Creates a QCPVector2D object and initializes the x and y coordinates to 0.
QCPVector2D::QCPVector2D  (  double  x, 
double  y  
) 
Creates a QCPVector2D object and initializes the x and y coordinates with the specified values.
QCPVector2D::QCPVector2D  (  const QPoint &  point  ) 
Creates a QCPVector2D object and initializes the x and y coordinates respective coordinates of the specified point.
QCPVector2D::QCPVector2D  (  const QPointF &  point  ) 
Creates a QCPVector2D object and initializes the x and y coordinates respective coordinates of the specified point.

inline 
Sets the x coordinate of this vector to x.

inline 
Sets the y coordinate of this vector to y.

inline 
Returns the length of this vector.

inline 

inline 
Returns the angle of the vector in radians. The angle is measured between the positive x line and the vector, counterclockwise in a mathematical coordinate system (y axis upwards positive). In screen/widget coordinates where the y axis is inverted, the angle appears clockwise.

inline 
Returns a QPoint which has the x and y coordinates of this vector, truncating any floating point information.

inline 
Returns a QPointF which has the x and y coordinates of this vector.

inline 
Returns whether this vector is null. A vector is null if qIsNull
returns true for both x and y coordinates, i.e. if both are binary equal to 0.
void QCPVector2D::normalize  (  ) 
Normalizes this vector. After this operation, the length of the vector is equal to 1.
If the vector has both entries set to zero, this method does nothing.
QCPVector2D QCPVector2D::normalized  (  )  const 
Returns a normalized version of this vector. The length of the returned vector is equal to 1.
If the vector has both entries set to zero, this method returns the vector unmodified.

inline 
Returns a vector perpendicular to this vector, with the same length.

inline 
Returns the dot/scalar product of this vector with the specified vector vec.
double QCPVector2D::distanceSquaredToLine  (  const QCPVector2D &  start, 
const QCPVector2D &  end  
)  const 
This is an overloaded function.
Returns the squared shortest distance of this vector (interpreted as a point) to the finite line segment given by start and end.
double QCPVector2D::distanceSquaredToLine  (  const QLineF &  line  )  const 
This is an overloaded function.
Returns the squared shortest distance of this vector (interpreted as a point) to the finite line segment given by line.
double QCPVector2D::distanceToStraightLine  (  const QCPVector2D &  base, 
const QCPVector2D &  direction  
)  const 
Returns the shortest distance of this vector (interpreted as a point) to the infinite straight line given by a base point and a direction vector.
QCPVector2D & QCPVector2D::operator*=  (  double  factor  ) 
Scales this vector by the given factor, i.e. the x and y components are multiplied by factor.
QCPVector2D & QCPVector2D::operator/=  (  double  divisor  ) 
Scales this vector by the given divisor, i.e. the x and y components are divided by divisor.
QCPVector2D & QCPVector2D::operator+=  (  const QCPVector2D &  vector  ) 
Adds the given vector to this vector componentwise.
QCPVector2D & QCPVector2D::operator=  (  const QCPVector2D &  vector  ) 
subtracts the given vector from this vector componentwise.

related 
Prints vec in a human readable format to the qDebug output.