BPoint Class Reference

The BPoint class defines a point in the plane using integer precision. More...

`#include <BPoint.h>`

Inheritance diagram for BPoint: ## Public Member Functions

BPoint ()
Constructs a BPoint with an X and Y of 0. More...

BPoint (int xpos, int ypos)
Constructs a BPoint with a given X and Y. More...

bool IsNull () const
Determines whether both X and Y are 0. More...

int X () const
Retrieves the X value. More...

int Y () const
Retrieves the Y value. More...

void SetX (int x)
Sets the X value. More...

void SetY (int y)
Sets the Y value. More...

BPointoperator+= (const BPoint &p)

BPointoperator-= (const BPoint &p)
Operator overload for -= (subtract and assign). More...

BPointoperator*= (double c)
Operator overload for *= (multiply and assign). More...

BPointoperator/= (double c)
Operator overload for /= (divide and assign). More...

## Friends

bool operator== (const BPoint &, const BPoint &)
Operator overload for == (equality test). More...

bool operator!= (const BPoint &, const BPoint &)
Operator overload for != (not equal test). More...

const BPoint operator+ (const BPoint &, const BPoint &)

const BPoint operator- (const BPoint &, const BPoint &)
Operator overload for - (subtract). More...

const BPoint operator* (const BPoint &, double)
Operator overload for * (multiply with a double). More...

const BPoint operator* (double, const BPoint &)
Operator overload for * (multiply with a double). More...

const BPoint operator- (const BPoint &)
Operator overload for - (subtract). More...

const BPoint operator/ (const BPoint &, double)
Operator overload for / (divide). More...

## Detailed Description

The BPoint class defines a point in the plane using integer precision.

A point is specified by an X coordinate and a Y coordinate which can be accessed using the X() and Y() functions. The IsNull() function returns true if both x and y are set to 0. The coordinates can be set (or altered) using the SetX() and SetY() functions.

A BPoint object can also be used as a vector: Addition and subtraction are defined as for vectors (each component is added separately). A BPoint object can also be divided or multiplied by an int or a double.

## Constructor & Destructor Documentation

 BPoint ( )

Constructs a BPoint with an X and Y of 0.

 BPoint ( int xpos, int ypos )

Constructs a BPoint with a given X and Y.

## Member Function Documentation

 bool IsNull ( ) const

Determines whether both X and Y are 0.

 BPoint& operator*= ( double c )

Operator overload for *= (multiply and assign).

 BPoint& operator+= ( const BPoint & p )

 BPoint& operator-= ( const BPoint & p )

Operator overload for -= (subtract and assign).

 BPoint& operator/= ( double c )

Operator overload for /= (divide and assign).

 void SetX ( int x )

Sets the X value.

 void SetY ( int y )

Sets the Y value.

 int X ( ) const

Retrieves the X value.

Referenced by operator!=(), operator*(), operator+(), operator-(), operator/(), and operator==().

 int Y ( ) const

Retrieves the Y value.

Referenced by operator!=(), operator*(), operator+(), operator-(), operator/(), and operator==().

## Friends And Related Function Documentation

 bool operator!= ( const BPoint & p1, const BPoint & p2 )
friend

Operator overload for != (not equal test).

 const BPoint operator* ( const BPoint & p, double c )
friend

Operator overload for * (multiply with a double).

 const BPoint operator* ( double c, const BPoint & p )
friend

Operator overload for * (multiply with a double).

 const BPoint operator+ ( const BPoint & p1, const BPoint & p2 )
friend

 const BPoint operator- ( const BPoint & p1, const BPoint & p2 )
friend

 const BPoint operator- ( const BPoint & p )
friend

 const BPoint operator/ ( const BPoint & p, double c )
friend