96 lines
1.4 KiB
C++
96 lines
1.4 KiB
C++
#ifndef _POINT_HPP_
|
|
#define _POINT_HPP_
|
|
#include <math.h>
|
|
#include <mdiwin/windows.hpp>
|
|
|
|
class Point : public tagPOINT
|
|
{
|
|
public:
|
|
Point(void);
|
|
Point(int x,int y);
|
|
~Point();
|
|
WORD operator==(const Point &somePoint)const;
|
|
WORD operator<(const Point &somePoint)const;
|
|
Point operator=(const Point &somePoint);
|
|
void setPoint(int x,int y);
|
|
void xPoint(int newx);
|
|
void yPoint(int newy);
|
|
int xPoint(void)const;
|
|
int yPoint(void)const;
|
|
private:
|
|
};
|
|
|
|
inline
|
|
Point::Point(void)
|
|
{
|
|
POINT::x=0;
|
|
POINT::y=0;
|
|
}
|
|
|
|
inline
|
|
Point::Point(int x,int y)
|
|
{
|
|
POINT::x=x;
|
|
POINT::y=y;
|
|
}
|
|
|
|
inline
|
|
Point::~Point()
|
|
{
|
|
}
|
|
|
|
inline
|
|
Point Point::operator=(const Point &somePoint)
|
|
{
|
|
POINT::x=somePoint.x;
|
|
POINT::y=somePoint.y;
|
|
return *this;
|
|
}
|
|
|
|
inline
|
|
void Point::xPoint(int newx)
|
|
{
|
|
POINT::x=newx;
|
|
}
|
|
|
|
inline
|
|
void Point::yPoint(int newy)
|
|
{
|
|
POINT::y=newy;
|
|
}
|
|
|
|
inline
|
|
int Point::xPoint(void)const
|
|
{
|
|
return POINT::x;
|
|
}
|
|
|
|
inline
|
|
int Point::yPoint(void)const
|
|
{
|
|
return POINT::y;
|
|
}
|
|
|
|
inline
|
|
void Point::setPoint(int x,int y)
|
|
{
|
|
POINT::x=x;
|
|
POINT::y=y;
|
|
}
|
|
|
|
inline
|
|
WORD Point::operator==(const Point &somePoint)const
|
|
{
|
|
return (POINT::x==somePoint.x &&
|
|
POINT::y==somePoint.y);
|
|
}
|
|
|
|
inline
|
|
WORD Point::operator<(const Point &somePoint)const
|
|
{
|
|
int thisDistance(int(::sqrt(((float)POINT::x*(float)POINT::x)+((float)POINT::y*(float)POINT::y))));
|
|
int someDistance(int(::sqrt(((float)somePoint.x*(float)somePoint.x)+((float)somePoint.y*(float)somePoint.y))));
|
|
return (thisDistance<someDistance);
|
|
}
|
|
#endif
|