kstars
#include <qcustomplot.h>
Public Member Functions  
QCPVector2D ()  
QCPVector2D (const QPoint &point)  
QCPVector2D (const QPointF &point)  
QCPVector2D (double x, double y)  
double  angle () 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 
double  dot (const QCPVector2D &vec) const 
bool  isNull () const 
double  length () const 
double  lengthSquared () const 
void  normalize () 
QCPVector2D  normalized () const 
QCPVector2D &  operator*= (double factor) 
QCPVector2D &  operator+= (const QCPVector2D &vector) 
QCPVector2D &  operator= (const QCPVector2D &vector) 
QCPVector2D &  operator/= (double divisor) 
QCPVector2D  perpendicular () const 
double &  rx () 
double &  ry () 
void  setX (double x) 
void  setY (double y) 
QPoint  toPoint () const 
QPointF  toPointF () const 
double  x () const 
double  y () const 
Friends  
const friend QCPVector2D  operator* (const QCPVector2D &vec, double factor) 
const friend QCPVector2D  operator* (double factor, const QCPVector2D &vec) 
const friend QCPVector2D  operator+ (const QCPVector2D &vec1, const QCPVector2D &vec2) 
const friend QCPVector2D  operator (const QCPVector2D &vec) 
const friend QCPVector2D  operator (const QCPVector2D &vec1, const QCPVector2D &vec2) 
const friend QCPVector2D  operator/ (const QCPVector2D &vec, double divisor) 
Related Functions  
(Note that these are not member functions.)  
QDebug  operator<< (QDebug d, const QCPVector2D &vec) 
Detailed Description
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.
Definition at line 387 of file qcustomplot.h.
Constructor & Destructor Documentation
◆ QCPVector2D() [1/4]
QCPVector2D::QCPVector2D  (  ) 
Creates a QCPVector2D object and initializes the x and y coordinates to 0.
Definition at line 100 of file qcustomplot.cpp.
◆ QCPVector2D() [2/4]
QCPVector2D::QCPVector2D  (  double  x, 
double  y  
) 
Creates a QCPVector2D object and initializes the x and y coordinates with the specified values.
Definition at line 110 of file qcustomplot.cpp.
◆ QCPVector2D() [3/4]
QCPVector2D::QCPVector2D  (  const QPoint &  point  ) 
Creates a QCPVector2D object and initializes the x and y coordinates respective coordinates of the specified point.
Definition at line 120 of file qcustomplot.cpp.
◆ QCPVector2D() [4/4]
QCPVector2D::QCPVector2D  (  const QPointF &  point  ) 
Creates a QCPVector2D object and initializes the x and y coordinates respective coordinates of the specified point.
Definition at line 130 of file qcustomplot.cpp.
Member Function Documentation
◆ angle()

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.
Definition at line 408 of file qcustomplot.h.
◆ distanceSquaredToLine() [1/2]
double QCPVector2D::distanceSquaredToLine  (  const QCPVector2D &  start, 
const QCPVector2D &  end  
)  const 
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
Returns the squared shortest distance of this vector (interpreted as a point) to the finite line segment given by start and end.
 See also
 distanceToStraightLine
Definition at line 172 of file qcustomplot.cpp.
◆ distanceSquaredToLine() [2/2]
double QCPVector2D::distanceSquaredToLine  (  const QLineF &  line  )  const 
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
Returns the squared shortest distance of this vector (interpreted as a point) to the finite line segment given by line.
 See also
 distanceToStraightLine
Definition at line 196 of file qcustomplot.cpp.
◆ distanceToStraightLine()
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.
 See also
 distanceSquaredToLine
Definition at line 207 of file qcustomplot.cpp.
◆ dot()

inline 
Returns the dot/scalar product of this vector with the specified vector vec.
Definition at line 416 of file qcustomplot.h.
◆ isNull()

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.
Definition at line 412 of file qcustomplot.h.
◆ length()

inline 
Returns the length of this vector.
 See also
 lengthSquared
Definition at line 406 of file qcustomplot.h.
◆ lengthSquared()

inline 
Returns the squared length of this vector. In some situations, e.g. when just trying to find the shortest vector of a group, this is faster than calculating length, because it avoids calculation of a square root.
 See also
 length
Definition at line 407 of file qcustomplot.h.
◆ normalize()
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.
 See also
 normalized, length, lengthSquared
Definition at line 143 of file qcustomplot.cpp.
◆ normalized()
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.
 See also
 normalize, length, lengthSquared
Definition at line 158 of file qcustomplot.cpp.
◆ operator*=()
QCPVector2D & QCPVector2D::operator*=  (  double  factor  ) 
Scales this vector by the given factor, i.e. the x and y components are multiplied by factor.
Definition at line 216 of file qcustomplot.cpp.
◆ operator+=()
QCPVector2D & QCPVector2D::operator+=  (  const QCPVector2D &  vector  ) 
Adds the given vector to this vector componentwise.
Definition at line 237 of file qcustomplot.cpp.
◆ operator=()
QCPVector2D & QCPVector2D::operator=  (  const QCPVector2D &  vector  ) 
subtracts the given vector from this vector componentwise.
Definition at line 247 of file qcustomplot.cpp.
◆ operator/=()
QCPVector2D & QCPVector2D::operator/=  (  double  divisor  ) 
Scales this vector by the given divisor, i.e. the x and y components are divided by divisor.
Definition at line 227 of file qcustomplot.cpp.
◆ perpendicular()

inline 
Returns a vector perpendicular to this vector, with the same length.
Definition at line 415 of file qcustomplot.h.
◆ rx()

inline 
Definition at line 398 of file qcustomplot.h.
◆ ry()

inline 
Definition at line 399 of file qcustomplot.h.
◆ setX()

inline 
Sets the x coordinate of this vector to x.
 See also
 setY
Definition at line 402 of file qcustomplot.h.
◆ setY()

inline 
Sets the y coordinate of this vector to y.
 See also
 setX
Definition at line 403 of file qcustomplot.h.
◆ toPoint()

inline 
Returns a QPoint which has the x and y coordinates of this vector, truncating any floating point information.
 See also
 toPointF
Definition at line 409 of file qcustomplot.h.
◆ toPointF()

inline 
Returns a QPointF which has the x and y coordinates of this vector.
 See also
 toPoint
Definition at line 410 of file qcustomplot.h.
◆ x()

inline 
Definition at line 396 of file qcustomplot.h.
◆ y()

inline 
Definition at line 397 of file qcustomplot.h.
Friends And Related Function Documentation
◆ operator* [1/2]

friend 
Definition at line 440 of file qcustomplot.h.
◆ operator* [2/2]

friend 
Definition at line 439 of file qcustomplot.h.
◆ operator+

friend 
Definition at line 442 of file qcustomplot.h.
◆ operator [1/2]

friend 
Definition at line 444 of file qcustomplot.h.
◆ operator [2/2]

friend 
Definition at line 443 of file qcustomplot.h.
◆ operator/

friend 
Definition at line 441 of file qcustomplot.h.
◆ operator<<()

related 
Prints vec in a human readable format to the qDebug output.
Definition at line 450 of file qcustomplot.h.
The documentation for this class was generated from the following files:
Documentation copyright © 19962021 The KDE developers.
Generated on Tue Nov 30 2021 23:27:05 by doxygen 1.8.16 written by Dimitri van Heesch, © 19972006
KDE's Doxygen guidelines are available online.