Skip to content

Commit 0fc82d3

Browse files
authored
Merge pull request #11 from BardoBard/trapezoidal_map_v
Trapezoidal map v
2 parents 22b064f + 71da1e8 commit 0fc82d3

37 files changed

+1599
-246
lines changed
15.8 KB
Loading

.github/images/large_example.png

6.34 KB
Loading

.github/images/mouse_buttons.png

7.03 KB
Loading

.github/images/simple_example.png

6.05 KB
Loading

.gitignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
/out*/
77

88
#packages ignore
9-
/packages/.*?/*
9+
/packages/
1010

1111
#git
1212
.git

CMakeLists.txt

Lines changed: 16 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,15 +3,28 @@ cmake_minimum_required(VERSION 3.1...3.23)
33

44
# c++ 20
55
set(CMAKE_CXX_STANDARD 20)
6+
set(CMAKE_CXX_STANDARD_REQUIRED YES)
67

78
# Project name
89
project(Visualization)
910

1011
set(PACKAGE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/packages)
12+
set(TRAJECTORY_HOTSPOTS_SOLUTION_DIR ${PACKAGE_DIR}/Trajectory_Hotspots/Trajectory_Hotspots)
13+
set(TRAJECTORY_HOTSPOTS_DIR ${PACKAGE_DIR}/Trajectory_Hotspots/Trajectory_Hotspots/Trajectory_Hotspots)
1114

15+
set(TRAJECTORY_HOTSPOTS_PACKAGE_CPP_FILES
16+
"${TRAJECTORY_HOTSPOTS_SOLUTION_DIR}/Trajectory_Hotspots/aabb.cpp"
17+
"${TRAJECTORY_HOTSPOTS_SOLUTION_DIR}/Trajectory_Hotspots/float.cpp"
18+
"${TRAJECTORY_HOTSPOTS_SOLUTION_DIR}/Trajectory_Hotspots/segment.cpp"
19+
"${TRAJECTORY_HOTSPOTS_SOLUTION_DIR}/Trajectory_Hotspots/segment_search_tree.cpp"
20+
"${TRAJECTORY_HOTSPOTS_SOLUTION_DIR}/Trajectory_Hotspots/trajectory.cpp"
21+
"${TRAJECTORY_HOTSPOTS_SOLUTION_DIR}/Trajectory_Hotspots/vec2.cpp"
22+
"${TRAJECTORY_HOTSPOTS_SOLUTION_DIR}/Trajectory_Hotspots/trapezoidal_map.cpp"
23+
)
1224
include_directories(
13-
${PACKAGE_DIR}/packages/.?*/
25+
${PACKAGE_DIR}/packages/.?*/
1426
)
15-
1627
# Add subdirectories
17-
add_subdirectory(Trajectory-Hotspots-Visualization)
28+
add_subdirectory(Trajectory-Hotspots-Parser)
29+
add_subdirectory(Trajectory-Hotspots-Visualization)
30+
add_subdirectory(Trajectory-Hotspots-Benchmark)

CMakeSettings.json

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
{
2+
"configurations": [
3+
{
4+
"name": "x64-Debug",
5+
"generator": "Ninja",
6+
"configurationType": "Debug",
7+
"inheritEnvironments": [ "msvc_x64_x64" ],
8+
"buildRoot": "${projectDir}\\out\\build\\${name}",
9+
"installRoot": "${projectDir}\\out\\install\\${name}",
10+
"cmakeCommandArgs": "",
11+
"buildCommandArgs": "",
12+
"ctestCommandArgs": ""
13+
},
14+
{
15+
"name": "x64-Release",
16+
"generator": "Ninja",
17+
"configurationType": "RelWithDebInfo",
18+
"buildRoot": "${projectDir}\\out\\build\\${name}",
19+
"installRoot": "${projectDir}\\out\\install\\${name}",
20+
"cmakeCommandArgs": "",
21+
"buildCommandArgs": "",
22+
"ctestCommandArgs": "",
23+
"inheritEnvironments": [ "msvc_x64_x64" ],
24+
"variables": []
25+
}
26+
]
27+
}

README.md

Lines changed: 69 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,78 @@
1+
Everything here incorporates the [Trajectory-Hotspots](https://github.com/NHLStenden-ISAL/Trajectory_Hotspots) library
2+
as a submodule. The visualization is based on the algorithms used in the library.
3+
4+
---
5+
## Installation
6+
7+
1. [Download Latest Version](https://github.com/BardoBard/Trajectory-Hotspots-Visualization/releases/latest) and unzip.
8+
2. Add path to your Trajectory.txt with options to the Config.txt file.
9+
3. Run the executable from the unzipped folder and give location of Config.txt file as argument.
10+
11+
---
12+
113
# Trajectory-Hotspots-Visualization
214

15+
Visualizes trajectories and their hotspots in 2D.
16+
17+
### Examples:
18+
19+
<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"/>
20+
21+
---
22+
23+
# Trajectory-Hotspots-Benchmark
24+
25+
Benchmarking tool for the Trajectory-Hotspots library. The benchmarking tool is
26+
27+
---
28+
29+
## Buttons
30+
31+
Keyboard:
32+
33+
---
34+
![keyboard_buttons.png](.github/images/keyboard_buttons.png)
35+
36+
Mouse:
37+
38+
---
39+
40+
![mouse_buttons.png](.github/images/mouse_buttons.png)
41+
---
42+
343
## Clone
44+
45+
clone with submodules
46+
447
```bash
548
git clone --recursive -j8 --branch "master" https://github.com/BardoBard/Trajectory-Hotspots-Visualization.git "Visualization"
649
```
750

51+
get the latest version of trajectory-hotspots
52+
```bash
53+
git submodule update --remote --merge
54+
```
55+
56+
This assumes you have **vcpkg** and **cmake**. If not, follow the instructions on
57+
the [website](https://vcpkg.io/en/getting-started.html).
58+
59+
#### Install:
60+
61+
install might take a while
62+
63+
```bash
64+
vcpkg install qt5
65+
vcpkg install cgal
66+
vcpkg install opengl
67+
68+
vcpkg integrate install
69+
```
70+
871
## Dependencies
972

10-
- QT5
11-
- CGAL
12-
- OpenGl32
73+
| Dependency | Version |
74+
|------------|--------------|
75+
| CGAL | 5.6 |
76+
| CGAL[QT] | - |
77+
| OpenGl | 2022-12-04#3 |
78+
| Nanobench | 4.3.11 |
Lines changed: 72 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,72 @@
1+
int zero = 0;
2+
QApplication app = QApplication(zero, nullptr);
3+
QWidget* active_window = QApplication::activeWindow();
4+
5+
void fixed_length_contiguous(const Trajectory& trajectory)
6+
{
7+
ankerl::nanobench::doNotOptimizeAway(trajectory.get_hotspot_fixed_length_contiguous(5));
8+
}
9+
10+
void generate_file_type(const std::string& path, const std::string& type_name, const char* mustache_template,
11+
ankerl::nanobench::Bench const& bench, std::filesystem::path template_path)
12+
{
13+
template_path = std::filesystem::path(path).append("mustache-template." + type_name);
14+
15+
if (!parser::file_exists(template_path.string()))
16+
throw std::runtime_error("Mustache template file does not exist");
17+
18+
const std::string mustache_template_string = parser::get_file_raw(template_path.string());
19+
20+
std::cout << "Generating " << type_name << " file..." << std::endl;
21+
std::cout << mustache_template_string << std::endl;
22+
std::ofstream render_out(path + bench.title() + "-visualization." + type_name);
23+
24+
ankerl::nanobench::render(template_path.string().c_str(), bench, render_out);
25+
}
26+
27+
void generate_file_type(const std::string& path, const std::string& type_name, const char* mustache_template,
28+
ankerl::nanobench::Bench const& bench)
29+
{
30+
generate_file_type(path, type_name, mustache_template, bench, parser::current_path_string);
31+
}
32+
33+
int main(const int argc, const char* argv[])
34+
{
35+
if (argc < 2)
36+
{
37+
std::cerr << "Please provide a file path to the config file" << std::endl;
38+
return 0;
39+
}
40+
const std::string file_path = argv[1];
41+
const std::string out_path = argc > 2 ? argv[2] : std::filesystem::current_path().string();
42+
try
43+
{
44+
const std::vector<parser::parsed_trajectory> trajectories = parser::parse_config(file_path, ' ');
45+
46+
ankerl::nanobench::Bench bench;
47+
48+
bench.performanceCounters(true);
49+
bench.title("benchmark");
50+
51+
std::cout << "Benchmarking..." << std::endl;
52+
for (const auto& parsed_trajectory : trajectories)
53+
{
54+
bench.warmup(10).minEpochIterations(100).run(parsed_trajectory.name, [&]
55+
{
56+
ankerl::nanobench::doNotOptimizeAway(parsed_trajectory.run_trajectory_function());
57+
});
58+
}
59+
60+
generate_file_type(out_path, "json", ankerl::nanobench::templates::json(), bench, out_path);
61+
62+
generate_file_type(out_path, "html", ankerl::nanobench::templates::htmlBoxplot(), bench, out_path);
63+
64+
generate_file_type(out_path, "csv", ankerl::nanobench::templates::csv(), bench, out_path);
65+
}
66+
catch (const std::exception& e)
67+
{
68+
std::cout << e.what() << std::endl;
69+
return 1;
70+
}
71+
return 0;
72+
}
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
# Project name
2+
project(Trajectory-Hotspots-Benchmark)
3+
4+
include(FetchContent)
5+
6+
FetchContent_Declare(
7+
8+
nanobench
9+
10+
GIT_REPOSITORY https://github.com/martinus/nanobench.git
11+
12+
GIT_TAG v4.1.0
13+
14+
GIT_SHALLOW TRUE)
15+
16+
17+
FetchContent_MakeAvailable(nanobench)
18+
19+
# Recursive globbing to find all files in a directory
20+
file(
21+
GLOB_RECURSE cppfiles
22+
${CMAKE_CURRENT_SOURCE_DIR}/*.cpp
23+
${CMAKE_CURRENT_SOURCE_DIR}/*.h
24+
)
25+
26+
# Create the executable target and specify the source files
27+
add_executable(${PROJECT_NAME} ${cppfiles})
28+
29+
# Link necessary libraries and include directories
30+
target_link_libraries(${PROJECT_NAME} PRIVATE Trajectory-Hotspots-Visualization_lib)
31+
target_link_libraries(${PROJECT_NAME} PRIVATE Trajectory-Hotspots-Parser_lib)
32+
target_link_libraries(${PROJECT_NAME} PRIVATE nanobench)
33+
34+
target_precompile_headers(${PROJECT_NAME} PRIVATE pch.h)

0 commit comments

Comments
 (0)