coordinate.h Source File (Kig Python Scripting API)

| # Kig Python Scripting API Documentation
Overview | Class Hierarchy | Classes | Classes (annotated) | Members

coordinate.h
1
20
21
22#ifndef KIG_MISC_COORDINATE_H
23#define KIG_MISC_COORDINATE_H
24
25class TQPoint;
26class kdbgstream;
27
33 class Coordinate
34{
35public:
36 static Coordinate fromTQPoint( const TQPoint& p );
37
41 Coordinate( double x, double y );
45 Coordinate( const Coordinate& p );
53 Coordinate();
54 ~Coordinate() {}
55
67 static Coordinate invalidCoord();
71 bool valid() const;
72
75 double distance ( const Coordinate& p ) const;
80 double length () const;
85 inline double squareLength() const;
88 const Coordinate operator- () const;
96 const Coordinate orthogonal() const;
100 const Coordinate round() const;
104 const Coordinate normalize( double length = 1 ) const;
105 TQPoint toTQPoint() const;
106
107 Coordinate& operator= ( const Coordinate& c );
110 Coordinate& operator+= ( const Coordinate& c );
113 Coordinate& operator-= ( const Coordinate& c );
116 Coordinate& operator*= ( double r );
119 Coordinate& operator*= ( int r );
122 Coordinate& operator/= ( double r );
123public:
126 double x;
129 double y;
130
131 friend kdbgstream& operator<<( kdbgstream& s, const Coordinate& t );
134 friend const Coordinate operator+ ( const Coordinate& a, const Coordinate& b );
137 friend const Coordinate operator- ( const Coordinate& a, const Coordinate& b );
140 friend const Coordinate operator* ( const Coordinate& a, double r );
143 friend const Coordinate operator/ ( const Coordinate& a, double r );
146 friend double operator*( const Coordinate& a, const Coordinate& b );
149 friend bool operator==( const Coordinate&, const Coordinate& );
152 friend bool operator!=( const Coordinate&, const Coordinate& );
153};
154
155const Coordinate operator/ ( const Coordinate& a, double r );
156kdbgstream& operator<<( kdbgstream& s, const Coordinate& t );
157const Coordinate operator+ ( const Coordinate& a, const Coordinate& b );
158const Coordinate operator- ( const Coordinate& a, const Coordinate& b );
159const Coordinate operator* ( const Coordinate& a, double r );
160const Coordinate operator* ( double r, const Coordinate& a );
161double operator*( const Coordinate& a, const Coordinate& b );
162
163 double Coordinate::squareLength() const
164{
165 return x*x+y*y;
166}
167
168#endif
169
Coordinate
The Coordinate class is the basic class representing a 2D location by its x and y components.
Definition coordinate.h:34
Coordinate::Coordinate
Coordinate(const Coordinate &p)
Copy Constructor.
Coordinate::Coordinate
Coordinate(double x, double y)
Constructor.
Coordinate::distance
double distance(const Coordinate &p) const
Distance to another Coordinate.
Coordinate::orthogonal
const Coordinate orthogonal() const
Orthogonal.
Coordinate::y
double y
Y Component.
Definition coordinate.h:129
Coordinate::operator==
friend bool operator==(const Coordinate &, const Coordinate &)
Equal.
Coordinate::operator/
friend const Coordinate operator/(const Coordinate &a, double r)
Scale.
Coordinate::invalidCoord
static Coordinate invalidCoord()
Create an invalid Coordinate.
Coordinate::operator+=
Coordinate & operator+=(const Coordinate &c)
Add.
Coordinate::x
double x
X Component.
Definition coordinate.h:126
Coordinate::operator*
friend double operator*(const Coordinate &a, const Coordinate &b)
Scalar Product.
Coordinate::operator-=
Coordinate & operator-=(const Coordinate &c)
Subtract.
Coordinate::operator*
friend const Coordinate operator*(const Coordinate &a, double r)
Scale.
Coordinate::length
double length() const
Length.
Coordinate::valid
bool valid() const
Return whether this is a valid Coordinate.
Coordinate::operator!=
friend bool operator!=(const Coordinate &, const Coordinate &)
Not Equal.
Coordinate::operator*=
Coordinate & operator*=(double r)
Scale.
Coordinate::Coordinate
Coordinate()
Coordinate::operator-
const Coordinate operator-() const
Inverse.
Coordinate::operator/=
Coordinate & operator/=(double r)
Scale.
Coordinate::squareLength
double squareLength() const
Square length.
Definition coordinate.h:163
Coordinate::round
const Coordinate round() const
Round.
Coordinate::operator+
friend const Coordinate operator+(const Coordinate &a, const Coordinate &b)
Add.
Coordinate::normalize
const Coordinate normalize(double length=1) const
Normalize.
This file is part of the documentation for tdelibs .
Documentation copyright © 1996-2002 the KDE developers.
Generated on by doxygen 1.16.1 written by Dimitri van Heesch, © 1997-2001