kig
#include <coordinate.h>
Public Member Functions  
Coordinate (double x, double y)  
Coordinate (const Coordinate &p)  
Coordinate ()  
~Coordinate ()  
double  distance (const Coordinate &p) const 
double  length () const 
const Coordinate  normalize (double length=1) const 
Coordinate &  operator*= (double r) 
Coordinate &  operator*= (int r) 
Coordinate &  operator+= (const Coordinate &c) 
const Coordinate  operator () const 
Coordinate &  operator= (const Coordinate &c) 
Coordinate &  operator/= (double r) 
Coordinate &  operator= (const Coordinate &c) 
const Coordinate  orthogonal () const 
const Coordinate  round () const 
double  squareLength () const 
QPoint  toQPoint () const 
bool  valid () const 
Static Public Member Functions  
static Coordinate  fromQPoint (const QPoint &p) 
static Coordinate  invalidCoord () 
Public Attributes  
double  x 
double  y 
Friends  
bool  operator!= (const Coordinate &, const Coordinate &) 
const Coordinate  operator* (const Coordinate &a, double r) 
double  operator* (const Coordinate &a, const Coordinate &b) 
const Coordinate  operator+ (const Coordinate &a, const Coordinate &b) 
const Coordinate  operator (const Coordinate &a, const Coordinate &b) 
const Coordinate  operator/ (const Coordinate &a, double r) 
QDebug &  operator<< (QDebug &s, const Coordinate &t) 
bool  operator== (const Coordinate &, const Coordinate &) 
Detailed Description
The Coordinate class is the basic class representing a 2D location by its x and y components.
It has all relevant arithmetic operators properly defined, and should be straightforward to use..
Definition at line 33 of file coordinate.h.
Constructor & Destructor Documentation
Coordinate::Coordinate  (  double  x, 
double  y  
) 
Constructor.
Construct a new Coordinate, with a given x and y value.
Definition at line 80 of file coordinate.cpp.
Coordinate::Coordinate  (  const Coordinate &  p  ) 
Copy Constructor.
Construct a new Coordinate, and give it the same value as p.
Definition at line 86 of file coordinate.cpp.
Coordinate::Coordinate  (  ) 
Default Constructor.
Constructs a new Coordinate, with x and y initialized to 0.
Definition at line 74 of file coordinate.cpp.

inline 
Definition at line 54 of file coordinate.h.
Member Function Documentation
double Coordinate::distance  (  const Coordinate &  p  )  const 
Distance to another Coordinate.
Definition at line 139 of file coordinate.cpp.

static 
Definition at line 28 of file coordinate.cpp.

static 
Create an invalid Coordinate.
This is a special value of a Coordinate that signals that something went wrong..
 See also
 Coordinate::valid
We represent an invalid coordinate by setting x or y to positive or negative infinity. This is handy, since it doesn't require us to adapt most of the functions, it doesn't need extra space, and most of the times that we should get an invalid coord, we get one automatically..
Definition at line 171 of file coordinate.cpp.
double Coordinate::length  (  )  const 
Length.
Returns the length or norm of this coordinate. I.e. return the distance from this Coordinate to the origin.
 See also
 squareLength
Definition at line 144 of file coordinate.cpp.
const Coordinate Coordinate::normalize  (  double  length = 1  )  const 
Normalize.
This sets the length to length, while keeping the x/y ratio untouched...
Definition at line 154 of file coordinate.cpp.
Coordinate & Coordinate::operator*=  (  double  r  ) 
Coordinate & Coordinate::operator*=  (  int  r  ) 
Coordinate & Coordinate::operator+=  (  const Coordinate &  c  ) 
const Coordinate Coordinate::operator  (  )  const 
Coordinate & Coordinate::operator=  (  const Coordinate &  c  ) 
Coordinate & Coordinate::operator/=  (  double  r  ) 
Coordinate & Coordinate::operator=  (  const Coordinate &  c  ) 
Definition at line 97 of file coordinate.cpp.
const Coordinate Coordinate::orthogonal  (  )  const 
Orthogonal.
Returns a vector which is orthogonal on this vector. This relation always holds:
Coordinate a = ...; assert( a*a.orthogonal() ) == 0;
Definition at line 149 of file coordinate.cpp.
const Coordinate Coordinate::round  (  )  const 
Round.
Returns this coordinate, rounded to the nearest integral values.
Definition at line 160 of file coordinate.cpp.

inline 
Square length.
Equivalent to the square of length, but a bit more efficient because no square root has to be calculated.
 See also
 length
Definition at line 163 of file coordinate.h.
QPoint Coordinate::toQPoint  (  )  const 
Definition at line 165 of file coordinate.cpp.
bool Coordinate::valid  (  )  const 
Return whether this is a valid Coordinate.
 See also
 Coordinate::invalidCoord
Definition at line 176 of file coordinate.cpp.
Friends And Related Function Documentation

friend 

friend 

friend 
Scalar Product.
Returns the scalar product of a and b.
Definition at line 181 of file coordinate.cpp.

friend 

friend 

friend 

friend 
Definition at line 33 of file coordinate.cpp.

friend 
Member Data Documentation
double Coordinate::x 
double Coordinate::y 
The documentation for this class was generated from the following files:
Documentation copyright © 19962020 The KDE developers.
Generated on Sat Jan 18 2020 04:14:30 by doxygen 1.8.7 written by Dimitri van Heesch, © 19972006
KDE's Doxygen guidelines are available online.