ipoint2.h File Reference

ipoint2.h File Reference
#include "GeomExport.h"
#include "maxheap.h"
#include "strbasic.h"
#include "assert1.h"
#include <iosfwd>
#include <math.h>

Classes

class  IPoint2
 

Functions

int Length (const IPoint2 &)
 
IPoint2 Normalize (const IPoint2 &)
 
IPoint2 operator* (int, const IPoint2 &)
 
IPoint2 operator* (const IPoint2 &, int)
 
IPoint2 operator/ (const IPoint2 &, int)
 
M_STD_OSTREAMoperator<< (M_STD_OSTREAM &, const IPoint2 &)
 
int MaxComponent (const IPoint2 &p)
 
int MinComponent (const IPoint2 &p)
 

Function Documentation

int Length ( const IPoint2 v)
inline
Remarks
Returns the length of the IPoint2, ie:

sqrt(v.x*v.x+v.y*v.y);
124  {
125  double dvx = (double)v.x;
126  double dvy = (double)v.y;
127  return (int)sqrt(dvx * dvx + dvy * dvy);
128  }
int y
Definition: ipoint2.h:36
int x
Definition: ipoint2.h:36
IPoint2 Normalize ( const IPoint2 )
Remarks
Returns a unit vector. This is an IPoint2 with each component divided by the point Length().
IPoint2 operator* ( int  f,
const IPoint2 a 
)
inline
Remarks
Returns an IPoint2 multiplied by a scalar.
173  {
174  return(IPoint2(a.x*f, a.y*f));
175  }
int y
Definition: ipoint2.h:36
Definition: ipoint2.h:32
int x
Definition: ipoint2.h:36
IPoint2 operator* ( const IPoint2 a,
int  f 
)
inline
Remarks
Returns an IPoint2 multiplied by a scalar.
177  {
178  return(IPoint2(a.x*f, a.y*f));
179  }
int y
Definition: ipoint2.h:36
Definition: ipoint2.h:32
int x
Definition: ipoint2.h:36
IPoint2 operator/ ( const IPoint2 a,
int  f 
)
inline
Remarks
Returns an IPoint2 whose x and y members are divided by a scalar.
181  {
182  return(IPoint2(a.x/f, a.y/f));
183  }
int y
Definition: ipoint2.h:36
Definition: ipoint2.h:32
int x
Definition: ipoint2.h:36
M_STD_OSTREAM& operator<< ( M_STD_OSTREAM ,
const IPoint2  
)
int MaxComponent ( const IPoint2 p)
inline
Remarks
Returns the component with the minimum abs value. 0=x, 1=y.
120 { return(p.x>p.y?0:1); }
int y
Definition: ipoint2.h:36
int x
Definition: ipoint2.h:36
int MinComponent ( const IPoint2 p)
inline
Remarks
Returns the component with the minimum abs value. 0=x, 1=y.
122 { return(p.x<p.y?0:1); }
int y
Definition: ipoint2.h:36
int x
Definition: ipoint2.h:36