Public Member Functions | Public Attributes

IPoint2 Class Reference

Search for all occurrences

Detailed Description

See also:
Class Point2.

Description:
This class describes a 2D point using int x and y coordinates. Methods are provided to add and subtract points, multiply and divide by scalars, normalize and compute the dot product of two IPoint2s. All methods are implemented by the system.
Data Members:
int x,y;

#include <ipoint2.h>

Inheritance diagram for IPoint2:
Inheritance graph
[legend]

List of all members.

Public Member Functions

  IPoint2 ()
  IPoint2 (int X, int Y)
  IPoint2 (const IPoint2 &a)
  IPoint2 (int af[2])
int &  operator[] (int i)
const int &  operator[] (int i) const
  operator int * ()
IPoint2  operator- () const
IPoint2  operator+ () const
IPoint2 operator-= (const IPoint2 &)
IPoint2 operator+= (const IPoint2 &)
GEOMEXPORT IPoint2 operator*= (int)
GEOMEXPORT IPoint2 operator/= (int)
GEOMEXPORT IPoint2  operator- (const IPoint2 &) const
GEOMEXPORT IPoint2  operator+ (const IPoint2 &) const
GEOMEXPORT int  DotProd (const IPoint2 &) const
GEOMEXPORT int  operator* (const IPoint2 &) const
int  operator== (const IPoint2 &p) const
int  operator!= (const IPoint2 &p) const

Public Attributes

int  x
int  y

Constructor & Destructor Documentation

IPoint2 ( ) [inline]
Remarks:
Constructor.
{}
IPoint2 ( int  X,
int  Y 
) [inline]
Remarks:
Constructor. Data members are initialized to X and Y.
{ x = X; y = Y;  }
IPoint2 ( const IPoint2 a ) [inline]
Remarks:
Constructor. Data members are initialized to a.x and a.y.
{ x = a.x; y = a.y; } 
IPoint2 ( int  af[2] ) [inline]
Remarks:
Constructor. Data members are initialized as x = af[0] and y = af[1].
{ x = af[0]; y = af[1]; }

Member Function Documentation

int& operator[] ( int  i ) [inline]
Remarks:
Allows access to x, y using the subscript operator.
Returns:
An index of 0 will return x, 1 will return y.
{ return (&x)[i]; }     
const int& operator[] ( int  i ) const [inline]
Remarks:
Allows access to x, y using the subscript operator.
Returns:
An index of 0 will return x, 1 will return y.
{ return (&x)[i]; }  
operator int * ( ) [inline]
Remarks:
Returns the address of the IPoint2.x.
{ return(&x); }
IPoint2 operator- ( ) const [inline]
Remarks:
Unary -. Negates both x and y.
{ return(IPoint2(-x,-y)); } 
IPoint2 operator+ ( ) const [inline]
Remarks:
Unary +. Returns the Ipoint2 unaltered.
{ return *this; } 
IPoint2 & operator-= ( const IPoint2 a ) [inline]
Remarks:
Subtracts a IPoint2 from this IPoint2.
                                                    {   
    x -= a.x;   y -= a.y;  
    return *this;
    }
IPoint2 & operator+= ( const IPoint2 a ) [inline]
Remarks:
Adds a IPoint2 to this IPoint2.
                                                    {
    x += a.x;   y += a.y;  
    return *this;
    }
IPoint2 & operator*= ( int  f ) [inline]
Remarks:
Multiplies this IPoint2 by an integer value.
                                         {
    x *= f;   y *= f;   
    return *this;
    }
IPoint2 & operator/= ( int  f ) [inline]
Remarks:
Divides this IPoint2 by an integer value.
                                         { 
    x /= f; y /= f;     
    return *this; 
    }
IPoint2 operator- ( const IPoint2 b ) const [inline]
Remarks:
Subtracts a IPoint2 from a IPoint2.
                                                       {
    return(IPoint2(x-b.x,y-b.y));
    }
IPoint2 operator+ ( const IPoint2 b ) const [inline]
Remarks:
Adds a IPoint2 to a IPoint2.
                                                        {
    return(IPoint2(x+b.x,y+b.y));
    }
int DotProd ( const IPoint2 b ) const [inline]
Remarks:
Returns the dot product of two IPoint2's. This is the sum of both x values multiplied together and both y values multiplied together.
Operators:
                                                 {
    return(x*b.x+y*b.y);
    }
int operator* ( const IPoint2 b ) const [inline]
Remarks:
Returns the dot product of two IPoint2's. This is the sum of both x values multiplied together and both y values multiplied together.
                                                   {
    return(x*b.x+y*b.y);
    }
int operator== ( const IPoint2 p ) const [inline]
Remarks:
Equality operator. Compare two IPoint2's.
Returns:
Nonzero if the IPoint2's are equal; otherwise 0.

{ return (x == p.x && y == p.y); }
int operator!= ( const IPoint2 p ) const [inline]
{ return (x != p.x || y != p.y); }

Member Data Documentation

int x
int y

IPoint2 IPoint2 IPoint2 IPoint2 IPoint2 IPoint2 IPoint2 IPoint2 IPoint2 IPoint2
IPoint2 IPoint2 IPoint2 IPoint2 IPoint2 IPoint2 IPoint2 IPoint2 IPoint2 IPoint2