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

- Alphabetical List
- Class List
- Class Hierarchy
- Class Members

# Exponent::MathTools::CPoint Class Reference

Inheritance diagram for Exponent::MathTools::CPoint:

List of all members.

## Detailed Description

Representation of a position.

Date:
  19/09/2004

Author:
  Paul Chana

Version:
  1.0.0 Initial version

  1.0.1 Added const == operator

  1.0.2 Added isStraightLine method (either x's must match or the y's must match)

Note:
  All contents of this source code are copyright 2005 Exp Digital Uk.
  This source file is covered by the licence conditions of the Infinity API. You should have recieved a copy
  with the source code. If you didnt, please refer to http://www.expdigital.co.uk All content is the Intellectual property of Exp Digital Uk.
  Certain sections of this code may come from other sources. They are credited where applicable.
  If you have comments, suggestions or bug reports please visit http://support.expdigital.co.uk

Id
  CPoint.hpp,v 1.4 2007/02/08 21:06:44 paul Exp

Definition at line 32 of file CPoint.hpp.

## Public Member Functions

- CPoint (const CPoint &point)
- CPoint (const long x=0, const long y=0)
- virtual void getObjectDescription (char *string, const long size) const
- long getXPosition () const
- long getYPosition () const
- void offset (const long x, const long y)
- void offset (const CPoint &point)
- CPoint & operator+= (const CPoint &point)
- CPoint & operator-= (const CPoint &point)
- CPoint & operator= (const CPoint &point)
- bool operator== (const CPoint &point) const
- bool operator== (const CPoint &point)
- void setPoint (const long x, const long y)
- void setXPosition (const long x)
- void setYPosition (const long y)
- virtual ~CPoint ()

## Static Public Member Functions

- static bool isStraightLine (const CPoint &point1, const CPoint &point2)

## Protected Attributes

- long m_x
- long m_y

## Constructor & Destructor Documentation

Exponent::MathTools::CPoint::CPoint | ( | const long | x = `0`,
|  | const long | y = `0` |
| ) |  |  |

Construciton

Parameters:

  | x | The X Position
  | y | The Y Position

Exponent::MathTools::CPoint::CPoint | ( | const CPoint & | point | ) |

Copy construction

Parameters:

  | point | The point to copy

virtual Exponent::MathTools::CPoint::~CPoint | ( |  | ) | `[virtual]`

Destruction

## Member Function Documentation

virtual void Exponent::MathTools::CPoint::getObjectDescription | ( | char * | string,
|  | const long | size |
| ) |  |  | const`[virtual]`

Get a description of the object

Parameters:

  | string | On return is filled with the description
  | size | The size of the stirng

Reimplemented from Exponent::Basics::CCountedObject.

long Exponent::MathTools::CPoint::getXPosition | ( |  | ) | const`[inline]`

Get the x position

Return values:

  | long | The X Position

Definition at line 128 of file CPoint.hpp.

References m_x.

Referenced by Exponent::GUI::Graphics::CGraphics::appendToDrawingAreaOffset(), Exponent::GUI::Graphics::CGraphics::drawAAPixelIncreasingX(), Exponent::GUI::Graphics::CGraphics::drawAAPixelIncreasingY(), Exponent::GUI::Windowing::CMouse::getXPosition(), Exponent::GUI::Graphics::CGraphics::negateFromDrawingArea(), and Exponent::MathTools::CRect::pointIsInside().

long Exponent::MathTools::CPoint::getYPosition | ( |  | ) | const`[inline]`

Get the y position

Return values:

  | long | The Y Position

Definition at line 134 of file CPoint.hpp.

References m_y.

Referenced by Exponent::GUI::Graphics::CGraphics::appendToDrawingAreaOffset(), Exponent::GUI::Graphics::CGraphics::drawAAPixelIncreasingX(), Exponent::GUI::Graphics::CGraphics::drawAAPixelIncreasingY(), Exponent::GUI::Windowing::CMouse::getYPosition(), Exponent::GUI::Graphics::CGraphics::negateFromDrawingArea(), and Exponent::MathTools::CRect::pointIsInside().

static bool Exponent::MathTools::CPoint::isStraightLine | ( | const CPoint & | point1,
|  | const CPoint & | point2 |
| ) |  |  | `[static]`

Is this a straight line

Parameters:

  | point1 | Starting point
  | point2 | Ending point

Return values:

  | bool | True if either p1.x==p2.x or p1.y==p2.y

void Exponent::MathTools::CPoint::offset | ( | const long | x,
|  | const long | y |
| ) |  |  |

Offset by an amount

Parameters:

  | x | Amount to add to x position
  | y | Amount to add to y position

void Exponent::MathTools::CPoint::offset | ( | const CPoint & | point | ) |

Offset the point with another point

Parameters:

  | point | The amount to offset by

Referenced by Exponent::GUI::Graphics::CGraphics::appendToDrawingAreaOffset(), Exponent::GUI::Graphics::CGraphics::drawAAPixelIncreasingX(), Exponent::GUI::Graphics::CGraphics::drawAAPixelIncreasingY(), and Exponent::GUI::Graphics::CGraphics::negateFromDrawingArea().

CPoint& Exponent::MathTools::CPoint::operator+= | ( | const CPoint & | point | ) |

Offset the point with another point

Parameters:

  | point | The amount to offset by

CPoint& Exponent::MathTools::CPoint::operator-= | ( | const CPoint & | point | ) |

Offset the point with another point

Parameters:

  | point | The amount to offset by

CPoint& Exponent::MathTools::CPoint::operator= | ( | const CPoint & | point | ) |

Assignment operator

Parameters:

  | point | The point to copy

Return values:

  | CPoint& | A reference to this

bool Exponent::MathTools::CPoint::operator== | ( | const CPoint & | point | ) | const

Equlity operator

Parameters:

  | point | The point to compare to

Return values:

  | bool | True if the points are the same, false otherwise

bool Exponent::MathTools::CPoint::operator== | ( | const CPoint & | point | ) |

Equlity operator

Parameters:

  | point | The point to compare to

Return values:

  | bool | True if the points are the same, false otherwise

void Exponent::MathTools::CPoint::setPoint | ( | const long | x,
|  | const long | y |
| ) |  |  | `[inline]`

Set the entire position

Parameters:

  | x | The X Position
  | y | The Y Position

Definition at line 104 of file CPoint.hpp.

References setXPosition(), and setYPosition().

Referenced by Exponent::GUI::Graphics::CGraphics::resetDrawingArea().

void Exponent::MathTools::CPoint::setXPosition | ( | const long | x | ) | `[inline]`

Set the X Position

Parameters:

  | x | The X Position

Definition at line 114 of file CPoint.hpp.

References m_x.

Referenced by setPoint().

void Exponent::MathTools::CPoint::setYPosition | ( | const long | y | ) | `[inline]`

Set the Y Position

Parameters:

  | y | The Y Position

Definition at line 120 of file CPoint.hpp.

References m_y.

Referenced by setPoint().

## Member Data Documentation

long Exponent::MathTools::CPoint::m_x`[protected]`

X Position

Definition at line 176 of file CPoint.hpp.

Referenced by getXPosition(), and setXPosition().

long Exponent::MathTools::CPoint::m_y`[protected]`

Y Position

Definition at line 177 of file CPoint.hpp.

Referenced by getYPosition(), and setYPosition().