Browse Source

Added Line, Vector, Point utility classes

pull/1/head
Tim Zeuner 2 years ago
parent
commit
035bcfb253
4 changed files with 99 additions and 1 deletions
  1. 5
    1
      CMakeLists.txt
  2. 7
    0
      Utils/CMakeLists.txt
  3. 47
    0
      Utils/utils.cpp
  4. 40
    0
      Utils/utils.h

+ 5
- 1
CMakeLists.txt View File

${CMAKE_CURRENT_SOURCE_DIR}/ControlModule ${CMAKE_CURRENT_SOURCE_DIR}/ControlModule
${CMAKE_CURRENT_SOURCE_DIR}/Interpreter ${CMAKE_CURRENT_SOURCE_DIR}/Interpreter
${CMAKE_CURRENT_SOURCE_DIR}/IntersectionHandler ${CMAKE_CURRENT_SOURCE_DIR}/IntersectionHandler
${CMAKE_CURRENT_SOURCE_DIR}/Utils
) )


link_directories( ${Input_SOURCE_DIRS} link_directories( ${Input_SOURCE_DIRS}
${ControlModule_SOURCE_DIRS} ${ControlModule_SOURCE_DIRS}
${Interpreter_SOURCE_DIRS} ${Interpreter_SOURCE_DIRS}
${IntersectionHandler_SOURCE_DIRS} ${IntersectionHandler_SOURCE_DIRS}
${Utils_SOURCE_DIRS}
) )


add_subdirectory(Input) add_subdirectory(Input)
add_subdirectory(ControlModule) add_subdirectory(ControlModule)
add_subdirectory(Interpreter) add_subdirectory(Interpreter)
add_subdirectory(IntersectionHandler) add_subdirectory(IntersectionHandler)
add_subdirectory(Utils)


target_include_directories(Input PRIVATE .) target_include_directories(Input PRIVATE .)
target_include_directories(Processing PRIVATE .) target_include_directories(Processing PRIVATE .)
target_include_directories(ControlModule PRIVATE .) target_include_directories(ControlModule PRIVATE .)
target_include_directories(Interpreter PRIVATE .) target_include_directories(Interpreter PRIVATE .)
target_include_directories(IntersectionHandler PRIVATE .) target_include_directories(IntersectionHandler PRIVATE .)
target_include_directories(Utils PRIVATE .)


add_executable(lfr_image_processing lfr.cpp autonomous_mode_main.cpp) add_executable(lfr_image_processing lfr.cpp autonomous_mode_main.cpp)


target_link_libraries( lfr_image_processing ${OpenCV_LIBS} Input Processing ControlModule Interpreter IntersectionHandler Threads::Threads)
target_link_libraries( lfr_image_processing ${OpenCV_LIBS} Input Processing ControlModule Interpreter IntersectionHandler Utils Threads::Threads)


set(CPACK_PROJECT_NAME ${PROJECT_NAME}) set(CPACK_PROJECT_NAME ${PROJECT_NAME})
set(CPACK_PROJECT_VERSION ${PROJECT_VERSION}) set(CPACK_PROJECT_VERSION ${PROJECT_VERSION})

+ 7
- 0
Utils/CMakeLists.txt View File

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)

+ 47
- 0
Utils/utils.cpp View File

#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()
{
}

+ 40
- 0
Utils/utils.h View File

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();
};

Loading…
Cancel
Save