Added Line, Vector, Point utility classes
This commit is contained in:
@@ -0,0 +1,7 @@
|
||||
add_library(Utils utils.cpp)
|
||||
set_target_properties(Utils PROPERTIES VERSION ${PROJECT_VERSION})
|
||||
target_include_directories(Utils PRIVATE .)
|
||||
|
||||
set(CPACK_PROJECT_NAME ${PROJECT_NAME})
|
||||
set(CPACK_PROJECT_VERSION ${PROJECT_VERSION})
|
||||
include(CPack)
|
||||
@@ -0,0 +1,47 @@
|
||||
#include "utils.h"
|
||||
|
||||
LFRPoint::LFRPoint(/* args */) : x(0.0), y(0.0)
|
||||
{
|
||||
}
|
||||
|
||||
LFRPoint::LFRPoint(double x, double y): x(x), y(y)
|
||||
{
|
||||
}
|
||||
|
||||
LFRPoint::~LFRPoint()
|
||||
{
|
||||
}
|
||||
|
||||
LFRVector::LFRVector(/* args */) : LFRPoint()
|
||||
{
|
||||
}
|
||||
|
||||
LFRVector::LFRVector(double x, double y) : LFRPoint(x, y)
|
||||
{
|
||||
}
|
||||
|
||||
LFRVector::LFRVector(const LFRPoint& pt) : LFRPoint(pt)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
LFRVector::~LFRVector()
|
||||
{
|
||||
}
|
||||
|
||||
LFRLine::LFRLine(/* args */) : start(), dir()
|
||||
{
|
||||
}
|
||||
|
||||
LFRLine::LFRLine(LFRPoint start, LFRVector dir) : start(start), dir(dir)
|
||||
{
|
||||
}
|
||||
|
||||
LFRLine::LFRLine(LFRPoint start, LFRPoint end) : start(start)
|
||||
{
|
||||
dir = end - start;
|
||||
}
|
||||
|
||||
LFRLine::~LFRLine()
|
||||
{
|
||||
}
|
||||
@@ -0,0 +1,40 @@
|
||||
class LFRPoint
|
||||
{
|
||||
private:
|
||||
/* data */
|
||||
public:
|
||||
double x, y;
|
||||
LFRPoint(/* args */);
|
||||
LFRPoint(double x, double y);
|
||||
~LFRPoint();
|
||||
|
||||
LFRPoint operator-(const LFRPoint& pt){return LFRPoint(x-pt.x, y-pt.y);}
|
||||
LFRPoint operator+(const LFRPoint& pt){return LFRPoint(x+pt.x, y+pt.y);}
|
||||
};
|
||||
|
||||
class LFRVector : public LFRPoint
|
||||
{
|
||||
private:
|
||||
/* data */
|
||||
public:
|
||||
LFRVector(/* args */);
|
||||
LFRVector(double x, double y);
|
||||
LFRVector(const LFRPoint& pt);
|
||||
~LFRVector();
|
||||
|
||||
};
|
||||
|
||||
class LFRLine
|
||||
{
|
||||
private:
|
||||
/* data */
|
||||
|
||||
public:
|
||||
LFRPoint start;
|
||||
LFRVector dir;
|
||||
|
||||
LFRLine(/* args */);
|
||||
LFRLine(LFRPoint start, LFRVector dir);
|
||||
LFRLine(LFRPoint start, LFRPoint end);
|
||||
~LFRLine();
|
||||
};
|
||||
Reference in New Issue
Block a user