Point< ValueType > Class Template Reference

A pair of (x, y) co-ordinates. More...

List of all members.

Public Member Functions

 Point () throw ()
 Creates a point with co-ordinates (0, 0).
 Point (const Point &other) throw ()
 Creates a copy of another point.
 Point (const ValueType initialX, const ValueType initialY) throw ()
 Creates a point from an (x, y) position.
 ~Point () throw ()
 Destructor.
Pointoperator= (const Point &other) throw ()
 Copies this point from another one.
ValueType getX () const throw ()
 Returns the point's x co-ordinate.
ValueType getY () const throw ()
 Returns the point's y co-ordinate.
bool operator== (const Point &other) const throw ()
bool operator!= (const Point &other) const throw ()
bool isOrigin () const throw ()
 Returns true if the point is (0, 0).
void setXY (const ValueType newX, const ValueType newY) throw ()
 Changes the point's x and y co-ordinates.
void addXY (const ValueType xToAdd, const ValueType yToAdd) throw ()
 Adds a pair of co-ordinates to this value.
const Point operator+ (const Point &other) const throw ()
 Adds two points together.
Pointoperator+= (const Point &other) throw ()
 Adds another point's co-ordinates to this one.
const Point operator- (const Point &other) const throw ()
 Subtracts one points from another.
Pointoperator-= (const Point &other) throw ()
 Subtracts another point's co-ordinates to this one.
const Point operator- () const throw ()
 Returns the inverse of this point.
ValueType getDistanceFrom (const Point &other) const throw ()
 Returns the straight-line distance between this point and another one.
void applyTransform (const AffineTransform &transform) throw ()
 Uses a transform to change the point's co-ordinates.
const String toString () const
 Returns the point as a string in the form "x, y".

Detailed Description

template<typename ValueType>
class Point< ValueType >

A pair of (x, y) co-ordinates.

The ValueType template should be a primitive type such as int, float, double, rather than a class.

See also:
Line, Path, AffineTransform

Constructor & Destructor Documentation

template<typename ValueType>
Point< ValueType >::Point (  )  throw ()

Creates a point with co-ordinates (0, 0).

Referenced by Point< int >::operator+(), and Point< int >::operator-().

template<typename ValueType>
Point< ValueType >::Point ( const Point< ValueType > &  other  )  throw ()

Creates a copy of another point.

template<typename ValueType>
Point< ValueType >::Point ( const ValueType  initialX,
const ValueType  initialY 
) throw ()

Creates a point from an (x, y) position.

template<typename ValueType>
Point< ValueType >::~Point (  )  throw ()

Destructor.


Member Function Documentation

template<typename ValueType>
Point& Point< ValueType >::operator= ( const Point< ValueType > &  other  )  throw ()

Copies this point from another one.

template<typename ValueType>
ValueType Point< ValueType >::getX (  )  const throw ()

Returns the point's x co-ordinate.

template<typename ValueType>
ValueType Point< ValueType >::getY (  )  const throw ()

Returns the point's y co-ordinate.

template<typename ValueType>
bool Point< ValueType >::operator== ( const Point< ValueType > &  other  )  const throw ()
template<typename ValueType>
bool Point< ValueType >::operator!= ( const Point< ValueType > &  other  )  const throw ()
template<typename ValueType>
bool Point< ValueType >::isOrigin (  )  const throw ()

Returns true if the point is (0, 0).

template<typename ValueType>
void Point< ValueType >::setXY ( const ValueType  newX,
const ValueType  newY 
) throw ()

Changes the point's x and y co-ordinates.

template<typename ValueType>
void Point< ValueType >::addXY ( const ValueType  xToAdd,
const ValueType  yToAdd 
) throw ()

Adds a pair of co-ordinates to this value.

template<typename ValueType>
const Point Point< ValueType >::operator+ ( const Point< ValueType > &  other  )  const throw ()

Adds two points together.

template<typename ValueType>
Point& Point< ValueType >::operator+= ( const Point< ValueType > &  other  )  throw ()

Adds another point's co-ordinates to this one.

template<typename ValueType>
const Point Point< ValueType >::operator- ( const Point< ValueType > &  other  )  const throw ()

Subtracts one points from another.

template<typename ValueType>
Point& Point< ValueType >::operator-= ( const Point< ValueType > &  other  )  throw ()

Subtracts another point's co-ordinates to this one.

template<typename ValueType>
const Point Point< ValueType >::operator- (  )  const throw ()

Returns the inverse of this point.

template<typename ValueType>
ValueType Point< ValueType >::getDistanceFrom ( const Point< ValueType > &  other  )  const throw ()

Returns the straight-line distance between this point and another one.

template<typename ValueType>
void Point< ValueType >::applyTransform ( const AffineTransform transform  )  throw ()

Uses a transform to change the point's co-ordinates.

This will only compile if ValueType = float!

See also:
AffineTransform::transformPoint
template<typename ValueType>
const String Point< ValueType >::toString (  )  const

Returns the point as a string in the form "x, y".


The documentation for this class was generated from the following file:
 All Classes Files Functions Variables Typedefs Enumerations Enumerator Friends Defines
Generated on Mon Apr 26 11:42:15 2010 for JUCE by  doxygen 1.6.3