85 lines
1.5 KiB
C++
85 lines
1.5 KiB
C++
#ifndef _ENGINE_LINE2D_HPP_
|
|
#define _ENGINE_LINE2D_HPP_
|
|
#ifndef _COMMON_POINT_HPP_
|
|
#include <common/point.hpp>
|
|
#endif
|
|
|
|
class Line2D
|
|
{
|
|
public:
|
|
Line2D(void);
|
|
Line2D(const Line2D &someLine2D);
|
|
Line2D(const Point &firstPoint,const Point &secondPoint);
|
|
virtual ~Line2D();
|
|
Line2D &operator=(const Line2D &someLine2D);
|
|
BOOL operator==(const Line2D &someLine2D)const;
|
|
const Point &firstPoint(void)const;
|
|
void firstPoint(const Point &firstPoint);
|
|
const Point &secondPoint(void)const;
|
|
void secondPoint(const Point &secondPoint);
|
|
private:
|
|
Point mFirstPoint;
|
|
Point mSecondPoint;
|
|
};
|
|
|
|
inline
|
|
Line2D::Line2D(void)
|
|
{
|
|
}
|
|
|
|
inline
|
|
Line2D::Line2D(const Line2D &someLine2D)
|
|
{
|
|
*this=someLine2D;
|
|
}
|
|
|
|
inline
|
|
Line2D::Line2D(const Point &firstPoint,const Point &secondPoint)
|
|
: mFirstPoint(firstPoint), mSecondPoint(secondPoint)
|
|
{
|
|
}
|
|
|
|
inline
|
|
Line2D::~Line2D()
|
|
{
|
|
}
|
|
|
|
inline
|
|
Line2D &Line2D::operator=(const Line2D &someLine2D)
|
|
{
|
|
firstPoint(someLine2D.firstPoint());
|
|
secondPoint(someLine2D.secondPoint());
|
|
return *this;
|
|
}
|
|
|
|
inline
|
|
BOOL Line2D::operator==(const Line2D &someLine2D)const
|
|
{
|
|
return (firstPoint()==someLine2D.firstPoint()&&
|
|
secondPoint()==someLine2D.secondPoint());
|
|
}
|
|
|
|
inline
|
|
const Point &Line2D::firstPoint(void)const
|
|
{
|
|
return mFirstPoint;
|
|
}
|
|
|
|
inline
|
|
void Line2D::firstPoint(const Point &firstPoint)
|
|
{
|
|
mFirstPoint=firstPoint;
|
|
}
|
|
|
|
inline
|
|
const Point &Line2D::secondPoint(void)const
|
|
{
|
|
return mSecondPoint;
|
|
}
|
|
|
|
inline
|
|
void Line2D::secondPoint(const Point &secondPoint)
|
|
{
|
|
mSecondPoint=secondPoint;
|
|
}
|
|
#endif |