dim2::Point

Declared in lemon/dim2.h, in the group Geometric Data Structures; the same class on the Doxygen site.

template< typename T >
class Point

Two dimensional vector (plain vector).

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

Public Types

typedef T Value

Public Functions

inline Point()

Default constructor.

inline Point( T a , T b )

Construct an instance from coordinates.

inline int size() const

Returns the dimension of the vector (i.e. returns 2).

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

inline T & operator[]( int idx )

Subscripting operator.

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

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

Const subscripting operator.

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

template< class TT >
inline Point( const Point< TT > & p )

Conversion constructor.

inline T normSquare() const

Give back the square of the norm of the vector.

inline Point< T > & operator+=( const Point< T > & u )

Increment the left hand side by u.

inline Point< T > & operator-=( const Point< T > & u )

Decrement the left hand side by u.

inline Point< T > & operator*=( const T & u )

Multiply the left hand side with a scalar.

inline Point< T > & operator/=( const T & u )

Divide the left hand side by a scalar.

inline T operator*( const Point< T > & u ) const

Return the scalar product of two vectors.

inline Point< T > operator+( const Point< T > & u ) const

Return the sum of two vectors.

inline Point< T > operator-() const

Return the negative of the vector.

inline Point< T > operator-( const Point< T > & u ) const

Return the difference of two vectors.

inline Point< T > operator*( const T & u ) const

Return a vector multiplied by a scalar.

inline Point< T > operator/( const T & u ) const

Return a vector divided by a scalar.

inline bool operator==( const Point< T > & u ) const

Test equality.

inline bool operator!=( Point u ) const

Test inequality.

Public Members

T x

First coordinate.

T y

Second coordinate.