-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #11 from BardoBard/trapezoidal_map_v
Trapezoidal map v
- Loading branch information
Showing
37 changed files
with
1,599 additions
and
246 deletions.
There are no files selected for viewing
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,7 +6,7 @@ | |
/out*/ | ||
|
||
#packages ignore | ||
/packages/.*?/* | ||
/packages/ | ||
|
||
#git | ||
.git | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
{ | ||
"configurations": [ | ||
{ | ||
"name": "x64-Debug", | ||
"generator": "Ninja", | ||
"configurationType": "Debug", | ||
"inheritEnvironments": [ "msvc_x64_x64" ], | ||
"buildRoot": "${projectDir}\\out\\build\\${name}", | ||
"installRoot": "${projectDir}\\out\\install\\${name}", | ||
"cmakeCommandArgs": "", | ||
"buildCommandArgs": "", | ||
"ctestCommandArgs": "" | ||
}, | ||
{ | ||
"name": "x64-Release", | ||
"generator": "Ninja", | ||
"configurationType": "RelWithDebInfo", | ||
"buildRoot": "${projectDir}\\out\\build\\${name}", | ||
"installRoot": "${projectDir}\\out\\install\\${name}", | ||
"cmakeCommandArgs": "", | ||
"buildCommandArgs": "", | ||
"ctestCommandArgs": "", | ||
"inheritEnvironments": [ "msvc_x64_x64" ], | ||
"variables": [] | ||
} | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,78 @@ | ||
Everything here incorporates the [Trajectory-Hotspots](https://github.com/NHLStenden-ISAL/Trajectory_Hotspots) library | ||
as a submodule. The visualization is based on the algorithms used in the library. | ||
|
||
--- | ||
## Installation | ||
|
||
1. [Download Latest Version](https://github.com/BardoBard/Trajectory-Hotspots-Visualization/releases/latest) and unzip. | ||
2. Add path to your Trajectory.txt with options to the Config.txt file. | ||
3. Run the executable from the unzipped folder and give location of Config.txt file as argument. | ||
|
||
--- | ||
|
||
# Trajectory-Hotspots-Visualization | ||
|
||
Visualizes trajectories and their hotspots in 2D. | ||
|
||
### Examples: | ||
|
||
<img src=".github/images/simple_example.png" alt="simple_example" style="margin-right: 9%;" width="45%" title="Trajectory"/> <img src=".github/images/large_example.png" alt="simple_example" width="45%" title="Trajectory"/> | ||
|
||
--- | ||
|
||
# Trajectory-Hotspots-Benchmark | ||
|
||
Benchmarking tool for the Trajectory-Hotspots library. The benchmarking tool is | ||
|
||
--- | ||
|
||
## Buttons | ||
|
||
Keyboard: | ||
|
||
--- | ||
![keyboard_buttons.png](.github/images/keyboard_buttons.png) | ||
|
||
Mouse: | ||
|
||
--- | ||
|
||
![mouse_buttons.png](.github/images/mouse_buttons.png) | ||
--- | ||
|
||
## Clone | ||
|
||
clone with submodules | ||
|
||
```bash | ||
git clone --recursive -j8 --branch "master" https://github.com/BardoBard/Trajectory-Hotspots-Visualization.git "Visualization" | ||
``` | ||
|
||
get the latest version of trajectory-hotspots | ||
```bash | ||
git submodule update --remote --merge | ||
``` | ||
|
||
This assumes you have **vcpkg** and **cmake**. If not, follow the instructions on | ||
the [website](https://vcpkg.io/en/getting-started.html). | ||
|
||
#### Install: | ||
|
||
install might take a while | ||
|
||
```bash | ||
vcpkg install qt5 | ||
vcpkg install cgal | ||
vcpkg install opengl | ||
|
||
vcpkg integrate install | ||
``` | ||
|
||
## Dependencies | ||
|
||
- QT5 | ||
- CGAL | ||
- OpenGl32 | ||
| Dependency | Version | | ||
|------------|--------------| | ||
| CGAL | 5.6 | | ||
| CGAL[QT] | - | | ||
| OpenGl | 2022-12-04#3 | | ||
| Nanobench | 4.3.11 | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,72 @@ | ||
int zero = 0; | ||
QApplication app = QApplication(zero, nullptr); | ||
QWidget* active_window = QApplication::activeWindow(); | ||
|
||
void fixed_length_contiguous(const Trajectory& trajectory) | ||
{ | ||
ankerl::nanobench::doNotOptimizeAway(trajectory.get_hotspot_fixed_length_contiguous(5)); | ||
} | ||
|
||
void generate_file_type(const std::string& path, const std::string& type_name, const char* mustache_template, | ||
ankerl::nanobench::Bench const& bench, std::filesystem::path template_path) | ||
{ | ||
template_path = std::filesystem::path(path).append("mustache-template." + type_name); | ||
|
||
if (!parser::file_exists(template_path.string())) | ||
throw std::runtime_error("Mustache template file does not exist"); | ||
|
||
const std::string mustache_template_string = parser::get_file_raw(template_path.string()); | ||
|
||
std::cout << "Generating " << type_name << " file..." << std::endl; | ||
std::cout << mustache_template_string << std::endl; | ||
std::ofstream render_out(path + bench.title() + "-visualization." + type_name); | ||
|
||
ankerl::nanobench::render(template_path.string().c_str(), bench, render_out); | ||
} | ||
|
||
void generate_file_type(const std::string& path, const std::string& type_name, const char* mustache_template, | ||
ankerl::nanobench::Bench const& bench) | ||
{ | ||
generate_file_type(path, type_name, mustache_template, bench, parser::current_path_string); | ||
} | ||
|
||
int main(const int argc, const char* argv[]) | ||
{ | ||
if (argc < 2) | ||
{ | ||
std::cerr << "Please provide a file path to the config file" << std::endl; | ||
return 0; | ||
} | ||
const std::string file_path = argv[1]; | ||
const std::string out_path = argc > 2 ? argv[2] : std::filesystem::current_path().string(); | ||
try | ||
{ | ||
const std::vector<parser::parsed_trajectory> trajectories = parser::parse_config(file_path, ' '); | ||
|
||
ankerl::nanobench::Bench bench; | ||
|
||
bench.performanceCounters(true); | ||
bench.title("benchmark"); | ||
|
||
std::cout << "Benchmarking..." << std::endl; | ||
for (const auto& parsed_trajectory : trajectories) | ||
{ | ||
bench.warmup(10).minEpochIterations(100).run(parsed_trajectory.name, [&] | ||
{ | ||
ankerl::nanobench::doNotOptimizeAway(parsed_trajectory.run_trajectory_function()); | ||
}); | ||
} | ||
|
||
generate_file_type(out_path, "json", ankerl::nanobench::templates::json(), bench, out_path); | ||
|
||
generate_file_type(out_path, "html", ankerl::nanobench::templates::htmlBoxplot(), bench, out_path); | ||
|
||
generate_file_type(out_path, "csv", ankerl::nanobench::templates::csv(), bench, out_path); | ||
} | ||
catch (const std::exception& e) | ||
{ | ||
std::cout << e.what() << std::endl; | ||
return 1; | ||
} | ||
return 0; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
# Project name | ||
project(Trajectory-Hotspots-Benchmark) | ||
|
||
include(FetchContent) | ||
|
||
FetchContent_Declare( | ||
|
||
nanobench | ||
|
||
GIT_REPOSITORY https://github.com/martinus/nanobench.git | ||
|
||
GIT_TAG v4.1.0 | ||
|
||
GIT_SHALLOW TRUE) | ||
|
||
|
||
FetchContent_MakeAvailable(nanobench) | ||
|
||
# Recursive globbing to find all files in a directory | ||
file( | ||
GLOB_RECURSE cppfiles | ||
${CMAKE_CURRENT_SOURCE_DIR}/*.cpp | ||
${CMAKE_CURRENT_SOURCE_DIR}/*.h | ||
) | ||
|
||
# Create the executable target and specify the source files | ||
add_executable(${PROJECT_NAME} ${cppfiles}) | ||
|
||
# Link necessary libraries and include directories | ||
target_link_libraries(${PROJECT_NAME} PRIVATE Trajectory-Hotspots-Visualization_lib) | ||
target_link_libraries(${PROJECT_NAME} PRIVATE Trajectory-Hotspots-Parser_lib) | ||
target_link_libraries(${PROJECT_NAME} PRIVATE nanobench) | ||
|
||
target_precompile_headers(${PROJECT_NAME} PRIVATE pch.h) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
// | ||
// Created by Bardio - NHL_STENDEN | ||
// | ||
#pragma once | ||
|
||
#include <string> | ||
#include <vector> | ||
#include <filesystem> | ||
#include <iostream> | ||
|
||
//nanobench | ||
#include <nanobench.h> | ||
|
||
#include <Trajectory-Hotspots-Visualization/pch.h> | ||
#include <Trajectory_Hotspots/pch.h> | ||
#include <Trajectory_Hotspots/vec2.h> | ||
#include <Trajectory_Hotspots/Float.h> | ||
#include <Trajectory_Hotspots/AABB.h> | ||
#include <Trajectory_Hotspots/segment.h> | ||
#include <Trajectory_Hotspots/segment_search_tree.h> | ||
#include <Trajectory_Hotspots/trapezoidal_map.h> | ||
#include <Trajectory_Hotspots/trajectory.h> | ||
|
||
//parser | ||
#include <Trajectory-Hotspots-Parser/file_parser.h> | ||
|
||
#include "Window/window.h" | ||
#include "Trajectory-Hotspots-Wrappers/drawable_trajectory.h" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
# Project name | ||
project(Trajectory-Hotspots-Parser) | ||
|
||
# Recursive globbing to find all files in a directory | ||
file( | ||
GLOB_RECURSE cppfiles | ||
${CMAKE_CURRENT_SOURCE_DIR}/*.cpp | ||
${CMAKE_CURRENT_SOURCE_DIR}/*.h | ||
) | ||
|
||
# Create the library target and specify the source files | ||
add_library(${PROJECT_NAME}_lib ${cppfiles} ${TRAJECTORY_HOTSPOTS_PACKAGE_CPP_FILES} ${TRAJECTORY_HOTSPOTS_PACKAGE_CPP_FILES} ) | ||
target_include_directories(${PROJECT_NAME}_lib | ||
PUBLIC | ||
.. | ||
${PROJECT_SOURCE_DIR}/ | ||
${TRAJECTORY_HOTSPOTS_SOLUTION_DIR}/) |
Oops, something went wrong.