#include <Coord.h>
Class for a double-tuple storing a position / two-dimensional vector. Some comparison and basic arithmetic operators on Coord structures are implemented.
Public Member Functions | |
Coord (double _x=0, double _y=0) | |
Coord (const Coord &pos) | |
Coord (const Coord *pos) | |
std::string | info () const |
Coord | operator+= (Coord a) |
Coord | operator= (Coord a) |
Coord | operator-= (Coord a) |
double | distance (const Coord a) const |
double | sqrdist (const Coord a) const |
Public Attributes | |
double | x |
x and y coordinates of the position | |
double | y |
x and y coordinates of the position | |
Friends | |
Coord | operator+ (Coord a, Coord b) |
Coord | operator- (Coord a, Coord b) |
Coord | operator * (Coord a, double f) |
Coord | operator/ (Coord a, double f) |
bool | operator== (Coord a, Coord b) |
bool | operator!= (Coord a, Coord b) |
|
Initializes coordinates.
|
|
Initializes coordinates.
|
|
Initializes coordinates.
|
|
Returns the distance to Coord a
|
|
00060 { 00061 std::stringstream os; 00062 os << "(" << x << "," << y << ")"; 00063 return os.str(); 00064 }
|
|
Adds coordinate vector b to a.
|
|
Subtracts coordinate vector b from a.
|
|
Assigns a this.
|
|
Returns distance^2 to Coord a (omits square root).
|
|
Multiplies a coordinate vector by a real number.
|
|
Tests whether two coordinate vectors are not equal. Negation of the operator==. 00120 {
00121 return !(a==b);
00122 }
|
|
Adds two coordinate vectors.
|
|
Subtracts two coordinate vectors.
|
|
Divides a coordinate vector by a real number.
|
|
Tests whether two coordinate vectors are equal. Because coordinates are of type double, this is done through the FWMath::close function. 00112 { 00113 return FWMath::close(a.x,b.x) && FWMath::close(a.y,b.y); 00114 }
|
|
x and y coordinates of the position
|
|
x and y coordinates of the position
|