Represents two doubles as a mathematical 2D vector. More...
(Note that these are not member functions.)
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.
Creates a QCPVector2D object and initializes the x and y coordinates to 0.
Creates a QCPVector2D object and initializes the x and y coordinates with the specified values.
Creates a QCPVector2D object and initializes the x and y coordinates respective coordinates of the specified point.
Creates a QCPVector2D object and initializes the x and y coordinates respective coordinates of the specified point.
Sets the x coordinate of this vector to x.
Sets the y coordinate of this vector to y.
Returns the length of this vector.
Returns the angle of the vector in radians. The angle is measured between the positive x line and the vector, counter-clockwise in a mathematical coordinate system (y axis upwards positive). In screen/widget coordinates where the y axis is inverted, the angle appears clockwise.
Returns a QPoint which has the x and y coordinates of this vector, truncating any floating point information.
Returns a QPointF which has the x and y coordinates of this vector.
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.
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.
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.
Returns a vector perpendicular to this vector, with the same length.
Returns the dot/scalar product of this vector with the specified vector vec.
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.
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.
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.
Scales this vector by the given factor, i.e. the x and y components are multiplied by factor.
Scales this vector by the given divisor, i.e. the x and y components are divided by divisor.
Adds the given vector to this vector component-wise.
subtracts the given vector from this vector component-wise.
Prints vec in a human readable format to the qDebug output.