|
tgen
|
Point on the plane. More...
Public Member Functions | |
| point (T x=0, T y=0) | |
| Constructs a point. | |
| T | x () const |
| x coordinate. | |
| T | y () const |
| y coordinate. | |
| bool | operator< (const point &p) const |
| Lexicographic order. | |
| bool | operator== (const point &p) const |
| Coordinate-wise equality. | |
| point | operator+ (const point &p) const |
| Vector addition. | |
| point | operator- (const point &p) const |
| Vector subtraction. | |
| point | operator* (T c) const |
| Scalar multiplication. | |
| product_t | operator* (const point &p) const |
| Dot product. | |
| product_t | operator^ (const point &p) const |
| Cross product. | |
Friends | |
| std::ostream & | operator<< (std::ostream &out, const point &p) |
| Prints the coordinates separated by a space. | |
Point on the plane.
| T | Arithmetic coordinate type (int, double, ...). |
Dot and cross products return product_t, widened to avoid overflow: __int128 when T is long long, long long for other integral T, and T for floating-point T.
For floating-point T, operator== and lexicographic operator< compare coordinates with tolerance 1e-9.
|
inline |
|
inline |
|
inline |
|
inline |
Vector addition.
|
inline |
Vector subtraction.
|
inline |
|
inline |
|
inline |
|
inline |
x coordinate.
|
inline |
y coordinate.
|
friend |
Prints the coordinates separated by a space.