point2.h File Reference

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

Classes

class  Point2
 

Functions

Point2 operator+ (const Point2 &a, float f)
 
float Length (const Point2 &)
 
int MaxComponent (const Point2 &)
 
int MinComponent (const Point2 &)
 
Point2 Normalize (const Point2 &)
 
Point2 operator* (float, const Point2 &)
 
Point2 operator* (const Point2 &, float)
 
Point2 operator/ (const Point2 &, float)
 
M_STD_OSTREAMoperator<< (M_STD_OSTREAM &, const Point2 &)
 
float LengthSquared (const Point2 &v)
 

Function Documentation

Point2 operator+ ( const Point2 a,
float  f 
)
inline
Remarks
Returns a copy of the Point2 argument offset by (f, f).
191  {
192  return(Point2(a.x+f, a.y+f));
193  }
float x
Definition: point2.h:47
float y
Definition: point2.h:47
Definition: point2.h:43
float Length ( const Point2 v)
inline
Remarks
Returns the length of the Point2, ie:

sqrt(v.x*v.x+v.y*v.y);
220  {
221  return (float)sqrt(v.x*v.x+v.y*v.y);
222  }
float x
Definition: point2.h:47
float y
Definition: point2.h:47
int MaxComponent ( const Point2 )
Remarks
Returns the component with the maximum absolute value. 0=x, 1=y.
int MinComponent ( const Point2 )
Remarks
Returns the component with the minimum absolute value. 0=x, 1=y.
Point2 Normalize ( const Point2 )
Remarks
Returns a unit vector. This is a Point2 with each component divided by the point Length().
Point2 operator* ( float  f,
const Point2 a 
)
inline
Remarks
Returns a Point2 multiplied by a scalar.
284  {
285  return(Point2(a.x*f, a.y*f));
286  }
float x
Definition: point2.h:47
float y
Definition: point2.h:47
Definition: point2.h:43
Point2 operator* ( const Point2 a,
float  f 
)
inline
Remarks
Returns a Point2 multiplied by a scalar.
288  {
289  return(Point2(a.x*f, a.y*f));
290  }
float x
Definition: point2.h:47
float y
Definition: point2.h:47
Definition: point2.h:43
Point2 operator/ ( const Point2 a,
float  f 
)
inline
Remarks
Returns a Point2 whose x and y members are divided by a scalar.
292  {
293  DbgAssert(f != 0.0f);
294  float invF = 1.0f / f; // Mimic 2019 behavior
295  return(Point2(a.x * invF, a.y * invF));
296  }
float x
Definition: point2.h:47
float y
Definition: point2.h:47
Definition: point2.h:43
#define DbgAssert(expr)
Definition: assert1.h:72
M_STD_OSTREAM& operator<< ( M_STD_OSTREAM ,
const Point2  
)
float LengthSquared ( const Point2 v)
inline
Remarks
The 'Length' squared of the point. This is v.x*v.x+v.y*v.y.
230  {
231  return (float)(v.x*v.x+v.y*v.y);
232  }
float x
Definition: point2.h:47
float y
Definition: point2.h:47