- Main Page
- Modules
- Classes
- Namespaces
- Files
- Related Pages

- Class List
- Class Index
- Class Hierarchy
- Class Members

All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
List of all members | Public Member Functions | Public Attributes | Related Functions
Point< T > Class Template Reference
Geometric Data Structures

## Detailed Description

### template<typename T>
class lemon::dim2::Point< T >

A simple two dimensional vector (plain vector) implementation with the usual vector operations.

`#include <lemon/dim2.h>`

## Public Member Functions
| Point ()
| Default constructor.
| Point (T a, T b)
| Construct an instance from coordinates.
int | size () const
| Returns the dimension of the vector (i.e. returns 2). More...
T & | operator[] (int idx)
| Subscripting operator. More...
const T & | operator[] (int idx) const
| Const subscripting operator. More...
template<class TT >
| Point (const Point< TT > &p)
| Conversion constructor.
T | normSquare () const
| Give back the square of the norm of the vector.
Point< T > & | operator+= (const Point< T > &u)
| Increment the left hand side by `u`.
Point< T > & | operator-= (const Point< T > &u)
| Decrement the left hand side by `u`.
Point< T > & | operator*= (const T &u)
| Multiply the left hand side with a scalar.
Point< T > & | operator/= (const T &u)
| Divide the left hand side by a scalar.
T | operator* (const Point< T > &u) const
| Return the scalar product of two vectors.
Point< T > | operator+ (const Point< T > &u) const
| Return the sum of two vectors.
Point< T > | operator- () const
| Return the negative of the vector.
Point< T > | operator- (const Point< T > &u) const
| Return the difference of two vectors.
Point< T > | operator* (const T &u) const
| Return a vector multiplied by a scalar.
Point< T > | operator/ (const T &u) const
| Return a vector divided by a scalar.
bool | operator== (const Point< T > &u) const
| Test equality.
bool | operator!= (Point u) const
| Test inequality.

## Public Attributes
T | x
| First coordinate.
T | y
| Second coordinate.

## Related Functions
(Note that these are not member functions.)
template<typename T >
Point< T > | makePoint (const T &x, const T &y)
| Return a Point. More...
template<typename T >
Point< T > | operator* (const T &u, const Point< T > &x)
| Return a vector multiplied by a scalar. More...
template<typename T >
std::istream & | operator>> (std::istream &is, Point< T > &z)
| Read a plain vector from a stream. More...
template<typename T >
std::ostream & | operator<< (std::ostream &os, const Point< T > &z)
| Write a plain vector to a stream. More...
template<typename T >
Point< T > | rot90 (const Point< T > &z)
| Rotate by 90 degrees. More...
template<typename T >
Point< T > | rot180 (const Point< T > &z)
| Rotate by 180 degrees. More...
template<typename T >
Point< T > | rot270 (const Point< T > &z)
| Rotate by 270 degrees. More...

## Member Function Documentation

int size | ( |  | ) | const
| inline

The dimension of the vector. This function always returns 2.

T& operator[] | ( | int | idx | ) |
| inline

`p`[0] is `p.x` and `p`[1] is `p.y`

const T& operator[] | ( | int | idx | ) | const
| inline

`p`[0] is `p.x` and `p`[1] is `p.y`