├── .vscode
├── launch.json
├── settings.json
└── tasks.json
├── CMakeLists.txt
├── CrowdNavigation
├── CMakeLists.txt
├── CrowdNavigation.sln
├── CrowdNavigation.vcxproj
├── GL
│ ├── glut.def
│ ├── glut.h
│ ├── glut32.dll
│ └── glut32.lib
├── PathFinding.cpp
├── PathFinding.h
├── main.cpp
└── makefile
├── README.md
├── build.sh
├── main.cpp
└── src
├── LQR
├── LQR.cpp
└── LQR.h
├── PID
├── PID.cpp
└── PID.h
└── spline
├── Spline.cpp
└── Spline.h
/.vscode/launch.json:
--------------------------------------------------------------------------------
1 | {
2 | // Use IntelliSense to learn about possible attributes.
3 | // Hover to view descriptions of existing attributes.
4 | // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
5 | "version": "0.2.0",
6 | "configurations": [
7 | {
8 | "name": "g++_ubuntu",
9 | "type": "cppdbg",
10 | "request": "launch",
11 | "program": "${workspaceFolder}/build/PathTracking",
12 | "args": [],
13 | "stopAtEntry": true,
14 | "cwd": "${workspaceFolder}",
15 | "environment": [],
16 | "externalConsole": false,
17 | "MIMode": "gdb",
18 | "setupCommands": [
19 | {
20 | "description": "Enable pretty-printing for gdb",
21 | "text": "-enable-pretty-printing",
22 | "ignoreFailures": true
23 | }
24 | ],
25 | "preLaunchTask": "build_sh",
26 | "miDebuggerPath": "/usr/bin/gdb"
27 | }
28 | ]
29 | }
--------------------------------------------------------------------------------
/.vscode/settings.json:
--------------------------------------------------------------------------------
1 | {
2 | "cmake.configureOnOpen": true,
3 | "files.associations": {
4 | "cctype": "cpp",
5 | "clocale": "cpp",
6 | "cmath": "cpp",
7 | "cstdarg": "cpp",
8 | "cstddef": "cpp",
9 | "cstdio": "cpp",
10 | "cstdlib": "cpp",
11 | "cstring": "cpp",
12 | "ctime": "cpp",
13 | "cwchar": "cpp",
14 | "cwctype": "cpp",
15 | "array": "cpp",
16 | "atomic": "cpp",
17 | "strstream": "cpp",
18 | "*.tcc": "cpp",
19 | "bitset": "cpp",
20 | "chrono": "cpp",
21 | "complex": "cpp",
22 | "cstdint": "cpp",
23 | "deque": "cpp",
24 | "list": "cpp",
25 | "unordered_map": "cpp",
26 | "vector": "cpp",
27 | "exception": "cpp",
28 | "algorithm": "cpp",
29 | "functional": "cpp",
30 | "ratio": "cpp",
31 | "system_error": "cpp",
32 | "tuple": "cpp",
33 | "type_traits": "cpp",
34 | "fstream": "cpp",
35 | "initializer_list": "cpp",
36 | "iomanip": "cpp",
37 | "iosfwd": "cpp",
38 | "iostream": "cpp",
39 | "istream": "cpp",
40 | "limits": "cpp",
41 | "memory": "cpp",
42 | "mutex": "cpp",
43 | "new": "cpp",
44 | "ostream": "cpp",
45 | "numeric": "cpp",
46 | "sstream": "cpp",
47 | "stdexcept": "cpp",
48 | "streambuf": "cpp",
49 | "thread": "cpp",
50 | "cfenv": "cpp",
51 | "cinttypes": "cpp",
52 | "regex": "cpp",
53 | "utility": "cpp",
54 | "typeindex": "cpp",
55 | "typeinfo": "cpp",
56 | "condition_variable": "cpp",
57 | "optional": "cpp",
58 | "string_view": "cpp",
59 | "iterator": "cpp",
60 | "map": "cpp",
61 | "memory_resource": "cpp",
62 | "random": "cpp",
63 | "set": "cpp",
64 | "string": "cpp",
65 | "core": "cpp"
66 | },
67 | "editor.formatOnSave": true,
68 | "C_Cpp.default.configurationProvider": "ms-vscode.cmake-tools"
69 | }
--------------------------------------------------------------------------------
/.vscode/tasks.json:
--------------------------------------------------------------------------------
1 | {
2 | "version": "2.0.0",
3 | "tasks": [
4 | {
5 | "type": "shell",
6 | "label": "build_sh",
7 | "command": "./build.sh",
8 | "args": [
9 | "Debug"
10 | ],
11 | "options": {
12 | "cwd": "${workspaceFolder}"
13 | },
14 | "problemMatcher": [
15 | "$gcc"
16 | ],
17 | "group": {
18 | "kind": "build",
19 | "isDefault": true
20 | },
21 | }
22 | ]
23 | }
--------------------------------------------------------------------------------
/CMakeLists.txt:
--------------------------------------------------------------------------------
1 | cmake_minimum_required(VERSION 3.0.0)
2 | project(PathTracking VERSION 0.1.0)
3 |
4 | if(CMAKE_BUILD_TYPE MATCHES Debug)
5 | set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11 -fexceptions -frtti -pthread -O0 -march=core2 -Wno-ignored-attributes")
6 | else()
7 | set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11 -fexceptions -frtti -pthread -O2 -march=core2 -Wno-ignored-attributes")
8 | endif()
9 |
10 | find_package(OpenCV REQUIRED)
11 | find_package(Eigen3 REQUIRED)
12 | include_directories()
13 | message("Found Eigen3 in: ${EIGEN3_INCLUDE_DIR}")
14 |
15 | set(CMAKE_INCLUDE_CURRENT_DIR ON)
16 |
17 | include_directories(
18 | ./PID
19 | ./LEQ
20 | ./Spline
21 | ${OpenCV_INCLUDE_DIRS}
22 | ${EIGEN3_INCLUDE_DIR}
23 | )
24 |
25 | file(GLOB SOURCES
26 | "*.cpp"
27 | "*.cxx"
28 | "./PID/*.cpp"
29 | "./LEQ/*.cpp"
30 | "./Spline/*.cpp"
31 | )
32 |
33 | set( PROJECT_LINK_LIBS
34 | ${OpenCV_LIBRARIES}
35 | glog
36 | )
37 |
38 | add_executable(PathTracking ${SOURCES})
39 | target_link_libraries(PathTracking ${PROJECT_LINK_LIBS})
40 |
41 | add_library(libPathTracking ${SOURCES})
42 |
43 |
44 |
--------------------------------------------------------------------------------
/CrowdNavigation/CMakeLists.txt:
--------------------------------------------------------------------------------
1 | set(CMAKE_CXX_COMPILER "g++")
2 | set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11 -g -DDEBUG -DGLUT_DISABLE_ATEXIT_HACK -L./LG -lopengl32 -lglu32 -lglut32")
3 |
4 | set(CMAKE_INCLUDE_CURRENT_DIR ON)
5 |
6 | include_directories("./LG")
7 |
8 | file(GLOB SOURCES "*.cpp")
9 |
10 | add_executable(CrowdNavigation ${SOURCES})
--------------------------------------------------------------------------------
/CrowdNavigation/CrowdNavigation.sln:
--------------------------------------------------------------------------------
1 |
2 | Microsoft Visual Studio Solution File, Format Version 12.00
3 | # Visual Studio Version 16
4 | VisualStudioVersion = 16.0.30114.105
5 | MinimumVisualStudioVersion = 10.0.40219.1
6 | Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "CrowdNavigation", "CrowdNavigation.vcxproj", "{424605EE-DBB1-4184-803F-E6BF2BC95123}"
7 | EndProject
8 | Global
9 | GlobalSection(SolutionConfigurationPlatforms) = preSolution
10 | Debug|x86 = Debug|x86
11 | Release|x86 = Release|x86
12 | EndGlobalSection
13 | GlobalSection(ProjectConfigurationPlatforms) = postSolution
14 | {424605EE-DBB1-4184-803F-E6BF2BC95123}.Debug|x86.ActiveCfg = Debug|Win32
15 | {424605EE-DBB1-4184-803F-E6BF2BC95123}.Debug|x86.Build.0 = Debug|Win32
16 | {424605EE-DBB1-4184-803F-E6BF2BC95123}.Release|x86.ActiveCfg = Release|Win32
17 | {424605EE-DBB1-4184-803F-E6BF2BC95123}.Release|x86.Build.0 = Release|Win32
18 | EndGlobalSection
19 | GlobalSection(SolutionProperties) = preSolution
20 | HideSolutionNode = FALSE
21 | EndGlobalSection
22 | GlobalSection(ExtensibilityGlobals) = postSolution
23 | SolutionGuid = {51E2755F-081C-45F3-82F5-0F2260F9852B}
24 | EndGlobalSection
25 | EndGlobal
26 |
--------------------------------------------------------------------------------
/CrowdNavigation/CrowdNavigation.vcxproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | x64
5 |
6 |
7 |
8 | Debug
9 | x64
10 |
11 |
12 | Release
13 | x64
14 |
15 |
16 | MinSizeRel
17 | x64
18 |
19 |
20 | RelWithDebInfo
21 | x64
22 |
23 |
24 |
25 | {03C86358-9122-3F38-95FF-0559A46231B8}
26 | 10.0.18362.0
27 | Win32Proj
28 | x64
29 | CrowdNavigation
30 | NoUpgrade
31 |
32 |
33 |
34 | Application
35 | MultiByte
36 | v142
37 |
38 |
39 | Application
40 | MultiByte
41 | v142
42 |
43 |
44 | Application
45 | MultiByte
46 | v142
47 |
48 |
49 | Application
50 | MultiByte
51 | v142
52 |
53 |
54 |
55 |
56 |
57 |
58 |
59 |
60 |
61 | <_ProjectFileVersion>10.0.20506.1
62 | D:\workspace_vs\PathTracking\CrowdNavigation\Debug\
63 | CrowdNavigation.dir\Debug\
64 | CrowdNavigation
65 | .exe
66 | true
67 | true
68 | D:\workspace_vs\PathTracking\CrowdNavigation\Release\
69 | CrowdNavigation.dir\Release\
70 | CrowdNavigation
71 | .exe
72 | false
73 | true
74 | D:\workspace_vs\PathTracking\CrowdNavigation\MinSizeRel\
75 | CrowdNavigation.dir\MinSizeRel\
76 | CrowdNavigation
77 | .exe
78 | false
79 | true
80 | D:\workspace_vs\PathTracking\CrowdNavigation\RelWithDebInfo\
81 | CrowdNavigation.dir\RelWithDebInfo\
82 | CrowdNavigation
83 | .exe
84 | true
85 | true
86 |
87 |
88 |
89 | D:\workspace_vs\PathTracking\CrowdNavigation;D:\workspace_vs\PathTracking\CrowdNavigation\.\LG;%(AdditionalIncludeDirectories)
90 | %(AdditionalOptions) -std=c++11 -g -L./LG -lopengl32 -lglu32 -lglut32
91 | $(IntDir)
92 | EnableFastChecks
93 | CompileAsCpp
94 | ProgramDatabase
95 | Sync
96 | Disabled
97 | Disabled
98 | NotUsing
99 | MultiThreadedDebugDLL
100 | true
101 | false
102 | Level3
103 | WIN32;_WINDOWS;DEBUG;GLUT_DISABLE_ATEXIT_HACK;CMAKE_INTDIR="Debug";%(PreprocessorDefinitions)
104 | $(IntDir)
105 |
106 |
107 | WIN32;_DEBUG;_WINDOWS;DEBUG;GLUT_DISABLE_ATEXIT_HACK;CMAKE_INTDIR=\"Debug\";%(PreprocessorDefinitions)
108 | D:\workspace_vs\PathTracking\CrowdNavigation;D:\workspace_vs\PathTracking\CrowdNavigation\.\LG;%(AdditionalIncludeDirectories)
109 |
110 |
111 | D:\workspace_vs\PathTracking\CrowdNavigation;D:\workspace_vs\PathTracking\CrowdNavigation\.\LG;%(AdditionalIncludeDirectories)
112 | $(ProjectDir)/$(IntDir)
113 | %(Filename).h
114 | %(Filename).tlb
115 | %(Filename)_i.c
116 | %(Filename)_p.c
117 |
118 |
119 | kernel32.lib;user32.lib;gdi32.lib;winspool.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;comdlg32.lib;advapi32.lib
120 | %(AdditionalLibraryDirectories)
121 | %(AdditionalOptions) /machine:x64
122 | true
123 | %(IgnoreSpecificDefaultLibraries)
124 | D:/workspace_vs/PathTracking/CrowdNavigation/Debug/CrowdNavigation.lib
125 | D:/workspace_vs/PathTracking/CrowdNavigation/Debug/CrowdNavigation.pdb
126 | Console
127 |
128 |
129 | false
130 |
131 |
132 |
133 |
134 | D:\workspace_vs\PathTracking\CrowdNavigation;D:\workspace_vs\PathTracking\CrowdNavigation\.\LG;%(AdditionalIncludeDirectories)
135 | %(AdditionalOptions) -std=c++11 -g -L./LG -lopengl32 -lglu32 -lglut32
136 | $(IntDir)
137 | CompileAsCpp
138 | Sync
139 | AnySuitable
140 | MaxSpeed
141 | NotUsing
142 | MultiThreadedDLL
143 | true
144 | false
145 | Level3
146 | WIN32;_WINDOWS;DEBUG;GLUT_DISABLE_ATEXIT_HACK;NDEBUG;CMAKE_INTDIR="Release";%(PreprocessorDefinitions)
147 | $(IntDir)
148 |
149 |
150 |
151 |
152 | WIN32;_WINDOWS;DEBUG;GLUT_DISABLE_ATEXIT_HACK;NDEBUG;CMAKE_INTDIR=\"Release\";%(PreprocessorDefinitions)
153 | D:\workspace_vs\PathTracking\CrowdNavigation;D:\workspace_vs\PathTracking\CrowdNavigation\.\LG;%(AdditionalIncludeDirectories)
154 |
155 |
156 | D:\workspace_vs\PathTracking\CrowdNavigation;D:\workspace_vs\PathTracking\CrowdNavigation\.\LG;%(AdditionalIncludeDirectories)
157 | $(ProjectDir)/$(IntDir)
158 | %(Filename).h
159 | %(Filename).tlb
160 | %(Filename)_i.c
161 | %(Filename)_p.c
162 |
163 |
164 | kernel32.lib;user32.lib;gdi32.lib;winspool.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;comdlg32.lib;advapi32.lib
165 | %(AdditionalLibraryDirectories)
166 | %(AdditionalOptions) /machine:x64
167 | false
168 | %(IgnoreSpecificDefaultLibraries)
169 | D:/workspace_vs/PathTracking/CrowdNavigation/Release/CrowdNavigation.lib
170 | D:/workspace_vs/PathTracking/CrowdNavigation/Release/CrowdNavigation.pdb
171 | Console
172 |
173 |
174 | false
175 |
176 |
177 |
178 |
179 | D:\workspace_vs\PathTracking\CrowdNavigation;D:\workspace_vs\PathTracking\CrowdNavigation\.\LG;%(AdditionalIncludeDirectories)
180 | %(AdditionalOptions) -std=c++11 -g -L./LG -lopengl32 -lglu32 -lglut32
181 | $(IntDir)
182 | CompileAsCpp
183 | Sync
184 | OnlyExplicitInline
185 | MinSpace
186 | NotUsing
187 | MultiThreadedDLL
188 | true
189 | false
190 | Level3
191 | WIN32;_WINDOWS;DEBUG;GLUT_DISABLE_ATEXIT_HACK;NDEBUG;CMAKE_INTDIR="MinSizeRel";%(PreprocessorDefinitions)
192 | $(IntDir)
193 |
194 |
195 |
196 |
197 | WIN32;_WINDOWS;DEBUG;GLUT_DISABLE_ATEXIT_HACK;NDEBUG;CMAKE_INTDIR=\"MinSizeRel\";%(PreprocessorDefinitions)
198 | D:\workspace_vs\PathTracking\CrowdNavigation;D:\workspace_vs\PathTracking\CrowdNavigation\.\LG;%(AdditionalIncludeDirectories)
199 |
200 |
201 | D:\workspace_vs\PathTracking\CrowdNavigation;D:\workspace_vs\PathTracking\CrowdNavigation\.\LG;%(AdditionalIncludeDirectories)
202 | $(ProjectDir)/$(IntDir)
203 | %(Filename).h
204 | %(Filename).tlb
205 | %(Filename)_i.c
206 | %(Filename)_p.c
207 |
208 |
209 | kernel32.lib;user32.lib;gdi32.lib;winspool.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;comdlg32.lib;advapi32.lib
210 | %(AdditionalLibraryDirectories)
211 | %(AdditionalOptions) /machine:x64
212 | false
213 | %(IgnoreSpecificDefaultLibraries)
214 | D:/workspace_vs/PathTracking/CrowdNavigation/MinSizeRel/CrowdNavigation.lib
215 | D:/workspace_vs/PathTracking/CrowdNavigation/MinSizeRel/CrowdNavigation.pdb
216 | Console
217 |
218 |
219 | false
220 |
221 |
222 |
223 |
224 | D:\workspace_vs\PathTracking\CrowdNavigation;D:\workspace_vs\PathTracking\CrowdNavigation\.\LG;%(AdditionalIncludeDirectories)
225 | %(AdditionalOptions) -std=c++11 -g -L./LG -lopengl32 -lglu32 -lglut32
226 | $(IntDir)
227 | CompileAsCpp
228 | ProgramDatabase
229 | Sync
230 | OnlyExplicitInline
231 | MaxSpeed
232 | NotUsing
233 | MultiThreadedDLL
234 | true
235 | false
236 | Level3
237 | WIN32;_WINDOWS;DEBUG;GLUT_DISABLE_ATEXIT_HACK;NDEBUG;CMAKE_INTDIR="RelWithDebInfo";%(PreprocessorDefinitions)
238 | $(IntDir)
239 |
240 |
241 | WIN32;_WINDOWS;DEBUG;GLUT_DISABLE_ATEXIT_HACK;NDEBUG;CMAKE_INTDIR=\"RelWithDebInfo\";%(PreprocessorDefinitions)
242 | D:\workspace_vs\PathTracking\CrowdNavigation;D:\workspace_vs\PathTracking\CrowdNavigation\.\LG;%(AdditionalIncludeDirectories)
243 |
244 |
245 | D:\workspace_vs\PathTracking\CrowdNavigation;D:\workspace_vs\PathTracking\CrowdNavigation\.\LG;%(AdditionalIncludeDirectories)
246 | $(ProjectDir)/$(IntDir)
247 | %(Filename).h
248 | %(Filename).tlb
249 | %(Filename)_i.c
250 | %(Filename)_p.c
251 |
252 |
253 | kernel32.lib;user32.lib;gdi32.lib;winspool.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;comdlg32.lib;advapi32.lib
254 | %(AdditionalLibraryDirectories)
255 | %(AdditionalOptions) /machine:x64
256 | true
257 | %(IgnoreSpecificDefaultLibraries)
258 | D:/workspace_vs/PathTracking/CrowdNavigation/RelWithDebInfo/CrowdNavigation.lib
259 | D:/workspace_vs/PathTracking/CrowdNavigation/RelWithDebInfo/CrowdNavigation.pdb
260 | Console
261 |
262 |
263 | false
264 |
265 |
266 |
267 |
268 | Building Custom Rule D:/workspace_vs/PathTracking/CrowdNavigation/CMakeLists.txt
269 | setlocal
270 | "D:\Program Files\CMake\bin\cmake.exe" -SD:/workspace_vs/PathTracking/CrowdNavigation -BD:/workspace_vs/PathTracking/CrowdNavigation --check-stamp-file D:/workspace_vs/PathTracking/CrowdNavigation/CMakeFiles/generate.stamp
271 | if %errorlevel% neq 0 goto :cmEnd
272 | :cmEnd
273 | endlocal & call :cmErrorLevel %errorlevel% & goto :cmDone
274 | :cmErrorLevel
275 | exit /b %1
276 | :cmDone
277 | if %errorlevel% neq 0 goto :VCEnd
278 | D:\Program Files\CMake\share\cmake-3.17\Modules\CMakeCCompiler.cmake.in;D:\Program Files\CMake\share\cmake-3.17\Modules\CMakeCCompilerABI.c;D:\Program Files\CMake\share\cmake-3.17\Modules\CMakeCInformation.cmake;D:\Program Files\CMake\share\cmake-3.17\Modules\CMakeCXXCompiler.cmake.in;D:\Program Files\CMake\share\cmake-3.17\Modules\CMakeCXXCompilerABI.cpp;D:\Program Files\CMake\share\cmake-3.17\Modules\CMakeCXXInformation.cmake;D:\Program Files\CMake\share\cmake-3.17\Modules\CMakeCommonLanguageInclude.cmake;D:\Program Files\CMake\share\cmake-3.17\Modules\CMakeCompilerIdDetection.cmake;D:\Program Files\CMake\share\cmake-3.17\Modules\CMakeDetermineCCompiler.cmake;D:\Program Files\CMake\share\cmake-3.17\Modules\CMakeDetermineCXXCompiler.cmake;D:\Program Files\CMake\share\cmake-3.17\Modules\CMakeDetermineCompileFeatures.cmake;D:\Program Files\CMake\share\cmake-3.17\Modules\CMakeDetermineCompiler.cmake;D:\Program Files\CMake\share\cmake-3.17\Modules\CMakeDetermineCompilerABI.cmake;D:\Program Files\CMake\share\cmake-3.17\Modules\CMakeDetermineCompilerId.cmake;D:\Program Files\CMake\share\cmake-3.17\Modules\CMakeDetermineRCCompiler.cmake;D:\Program Files\CMake\share\cmake-3.17\Modules\CMakeDetermineSystem.cmake;D:\Program Files\CMake\share\cmake-3.17\Modules\CMakeFindBinUtils.cmake;D:\Program Files\CMake\share\cmake-3.17\Modules\CMakeGenericSystem.cmake;D:\Program Files\CMake\share\cmake-3.17\Modules\CMakeInitializeConfigs.cmake;D:\Program Files\CMake\share\cmake-3.17\Modules\CMakeLanguageInformation.cmake;D:\Program Files\CMake\share\cmake-3.17\Modules\CMakeParseImplicitIncludeInfo.cmake;D:\Program Files\CMake\share\cmake-3.17\Modules\CMakeParseImplicitLinkInfo.cmake;D:\Program Files\CMake\share\cmake-3.17\Modules\CMakeRCCompiler.cmake.in;D:\Program Files\CMake\share\cmake-3.17\Modules\CMakeRCInformation.cmake;D:\Program Files\CMake\share\cmake-3.17\Modules\CMakeSystem.cmake.in;D:\Program Files\CMake\share\cmake-3.17\Modules\CMakeSystemSpecificInformation.cmake;D:\Program Files\CMake\share\cmake-3.17\Modules\CMakeSystemSpecificInitialize.cmake;D:\Program Files\CMake\share\cmake-3.17\Modules\CMakeTestCCompiler.cmake;D:\Program Files\CMake\share\cmake-3.17\Modules\CMakeTestCXXCompiler.cmake;D:\Program Files\CMake\share\cmake-3.17\Modules\CMakeTestCompilerCommon.cmake;D:\Program Files\CMake\share\cmake-3.17\Modules\CMakeTestRCCompiler.cmake;D:\Program Files\CMake\share\cmake-3.17\Modules\Compiler\ADSP-DetermineCompiler.cmake;D:\Program Files\CMake\share\cmake-3.17\Modules\Compiler\ARMCC-DetermineCompiler.cmake;D:\Program Files\CMake\share\cmake-3.17\Modules\Compiler\ARMClang-DetermineCompiler.cmake;D:\Program Files\CMake\share\cmake-3.17\Modules\Compiler\AppleClang-DetermineCompiler.cmake;D:\Program Files\CMake\share\cmake-3.17\Modules\Compiler\Borland-DetermineCompiler.cmake;D:\Program Files\CMake\share\cmake-3.17\Modules\Compiler\Bruce-C-DetermineCompiler.cmake;D:\Program Files\CMake\share\cmake-3.17\Modules\Compiler\CMakeCommonCompilerMacros.cmake;D:\Program Files\CMake\share\cmake-3.17\Modules\Compiler\Clang-DetermineCompiler.cmake;D:\Program Files\CMake\share\cmake-3.17\Modules\Compiler\Clang-DetermineCompilerInternal.cmake;D:\Program Files\CMake\share\cmake-3.17\Modules\Compiler\Comeau-CXX-DetermineCompiler.cmake;D:\Program Files\CMake\share\cmake-3.17\Modules\Compiler\Compaq-C-DetermineCompiler.cmake;D:\Program Files\CMake\share\cmake-3.17\Modules\Compiler\Compaq-CXX-DetermineCompiler.cmake;D:\Program Files\CMake\share\cmake-3.17\Modules\Compiler\Cray-DetermineCompiler.cmake;D:\Program Files\CMake\share\cmake-3.17\Modules\Compiler\Embarcadero-DetermineCompiler.cmake;D:\Program Files\CMake\share\cmake-3.17\Modules\Compiler\Fujitsu-DetermineCompiler.cmake;D:\Program Files\CMake\share\cmake-3.17\Modules\Compiler\GHS-DetermineCompiler.cmake;D:\Program Files\CMake\share\cmake-3.17\Modules\Compiler\GNU-C-DetermineCompiler.cmake;D:\Program Files\CMake\share\cmake-3.17\Modules\Compiler\GNU-CXX-DetermineCompiler.cmake;D:\Program Files\CMake\share\cmake-3.17\Modules\Compiler\HP-C-DetermineCompiler.cmake;D:\Program Files\CMake\share\cmake-3.17\Modules\Compiler\HP-CXX-DetermineCompiler.cmake;D:\Program Files\CMake\share\cmake-3.17\Modules\Compiler\IAR-DetermineCompiler.cmake;D:\Program Files\CMake\share\cmake-3.17\Modules\Compiler\IBMCPP-C-DetermineVersionInternal.cmake;D:\Program Files\CMake\share\cmake-3.17\Modules\Compiler\IBMCPP-CXX-DetermineVersionInternal.cmake;D:\Program Files\CMake\share\cmake-3.17\Modules\Compiler\Intel-DetermineCompiler.cmake;D:\Program Files\CMake\share\cmake-3.17\Modules\Compiler\MSVC-C.cmake;D:\Program Files\CMake\share\cmake-3.17\Modules\Compiler\MSVC-CXX.cmake;D:\Program Files\CMake\share\cmake-3.17\Modules\Compiler\MSVC-DetermineCompiler.cmake;D:\Program Files\CMake\share\cmake-3.17\Modules\Compiler\NVIDIA-DetermineCompiler.cmake;D:\Program Files\CMake\share\cmake-3.17\Modules\Compiler\OpenWatcom-DetermineCompiler.cmake;D:\Program Files\CMake\share\cmake-3.17\Modules\Compiler\PGI-DetermineCompiler.cmake;D:\Program Files\CMake\share\cmake-3.17\Modules\Compiler\PathScale-DetermineCompiler.cmake;D:\Program Files\CMake\share\cmake-3.17\Modules\Compiler\SCO-DetermineCompiler.cmake;D:\Program Files\CMake\share\cmake-3.17\Modules\Compiler\SDCC-C-DetermineCompiler.cmake;D:\Program Files\CMake\share\cmake-3.17\Modules\Compiler\SunPro-C-DetermineCompiler.cmake;D:\Program Files\CMake\share\cmake-3.17\Modules\Compiler\SunPro-CXX-DetermineCompiler.cmake;D:\Program Files\CMake\share\cmake-3.17\Modules\Compiler\TI-DetermineCompiler.cmake;D:\Program Files\CMake\share\cmake-3.17\Modules\Compiler\TinyCC-C-DetermineCompiler.cmake;D:\Program Files\CMake\share\cmake-3.17\Modules\Compiler\VisualAge-C-DetermineCompiler.cmake;D:\Program Files\CMake\share\cmake-3.17\Modules\Compiler\VisualAge-CXX-DetermineCompiler.cmake;D:\Program Files\CMake\share\cmake-3.17\Modules\Compiler\Watcom-DetermineCompiler.cmake;D:\Program Files\CMake\share\cmake-3.17\Modules\Compiler\XL-C-DetermineCompiler.cmake;D:\Program Files\CMake\share\cmake-3.17\Modules\Compiler\XL-CXX-DetermineCompiler.cmake;D:\Program Files\CMake\share\cmake-3.17\Modules\Compiler\XLClang-C-DetermineCompiler.cmake;D:\Program Files\CMake\share\cmake-3.17\Modules\Compiler\XLClang-CXX-DetermineCompiler.cmake;D:\Program Files\CMake\share\cmake-3.17\Modules\Compiler\zOS-C-DetermineCompiler.cmake;D:\Program Files\CMake\share\cmake-3.17\Modules\Compiler\zOS-CXX-DetermineCompiler.cmake;D:\Program Files\CMake\share\cmake-3.17\Modules\CompilerId\VS-10.vcxproj.in;D:\Program Files\CMake\share\cmake-3.17\Modules\Internal\FeatureTesting.cmake;D:\Program Files\CMake\share\cmake-3.17\Modules\Platform\Windows-Determine-CXX.cmake;D:\Program Files\CMake\share\cmake-3.17\Modules\Platform\Windows-MSVC-C.cmake;D:\Program Files\CMake\share\cmake-3.17\Modules\Platform\Windows-MSVC-CXX.cmake;D:\Program Files\CMake\share\cmake-3.17\Modules\Platform\Windows-MSVC.cmake;D:\Program Files\CMake\share\cmake-3.17\Modules\Platform\Windows.cmake;D:\Program Files\CMake\share\cmake-3.17\Modules\Platform\WindowsPaths.cmake;D:\workspace_vs\PathTracking\CrowdNavigation\CMakeFiles\3.17.2\CMakeCCompiler.cmake;D:\workspace_vs\PathTracking\CrowdNavigation\CMakeFiles\3.17.2\CMakeCXXCompiler.cmake;D:\workspace_vs\PathTracking\CrowdNavigation\CMakeFiles\3.17.2\CMakeRCCompiler.cmake;D:\workspace_vs\PathTracking\CrowdNavigation\CMakeFiles\3.17.2\CMakeSystem.cmake;%(AdditionalInputs)
279 | D:\workspace_vs\PathTracking\CrowdNavigation\CMakeFiles\generate.stamp
280 | false
281 | Building Custom Rule D:/workspace_vs/PathTracking/CrowdNavigation/CMakeLists.txt
282 | setlocal
283 | "D:\Program Files\CMake\bin\cmake.exe" -SD:/workspace_vs/PathTracking/CrowdNavigation -BD:/workspace_vs/PathTracking/CrowdNavigation --check-stamp-file D:/workspace_vs/PathTracking/CrowdNavigation/CMakeFiles/generate.stamp
284 | if %errorlevel% neq 0 goto :cmEnd
285 | :cmEnd
286 | endlocal & call :cmErrorLevel %errorlevel% & goto :cmDone
287 | :cmErrorLevel
288 | exit /b %1
289 | :cmDone
290 | if %errorlevel% neq 0 goto :VCEnd
291 | D:\Program Files\CMake\share\cmake-3.17\Modules\CMakeCCompiler.cmake.in;D:\Program Files\CMake\share\cmake-3.17\Modules\CMakeCCompilerABI.c;D:\Program Files\CMake\share\cmake-3.17\Modules\CMakeCInformation.cmake;D:\Program Files\CMake\share\cmake-3.17\Modules\CMakeCXXCompiler.cmake.in;D:\Program Files\CMake\share\cmake-3.17\Modules\CMakeCXXCompilerABI.cpp;D:\Program Files\CMake\share\cmake-3.17\Modules\CMakeCXXInformation.cmake;D:\Program Files\CMake\share\cmake-3.17\Modules\CMakeCommonLanguageInclude.cmake;D:\Program Files\CMake\share\cmake-3.17\Modules\CMakeCompilerIdDetection.cmake;D:\Program Files\CMake\share\cmake-3.17\Modules\CMakeDetermineCCompiler.cmake;D:\Program Files\CMake\share\cmake-3.17\Modules\CMakeDetermineCXXCompiler.cmake;D:\Program Files\CMake\share\cmake-3.17\Modules\CMakeDetermineCompileFeatures.cmake;D:\Program Files\CMake\share\cmake-3.17\Modules\CMakeDetermineCompiler.cmake;D:\Program Files\CMake\share\cmake-3.17\Modules\CMakeDetermineCompilerABI.cmake;D:\Program Files\CMake\share\cmake-3.17\Modules\CMakeDetermineCompilerId.cmake;D:\Program Files\CMake\share\cmake-3.17\Modules\CMakeDetermineRCCompiler.cmake;D:\Program Files\CMake\share\cmake-3.17\Modules\CMakeDetermineSystem.cmake;D:\Program Files\CMake\share\cmake-3.17\Modules\CMakeFindBinUtils.cmake;D:\Program Files\CMake\share\cmake-3.17\Modules\CMakeGenericSystem.cmake;D:\Program Files\CMake\share\cmake-3.17\Modules\CMakeInitializeConfigs.cmake;D:\Program Files\CMake\share\cmake-3.17\Modules\CMakeLanguageInformation.cmake;D:\Program Files\CMake\share\cmake-3.17\Modules\CMakeParseImplicitIncludeInfo.cmake;D:\Program Files\CMake\share\cmake-3.17\Modules\CMakeParseImplicitLinkInfo.cmake;D:\Program Files\CMake\share\cmake-3.17\Modules\CMakeRCCompiler.cmake.in;D:\Program Files\CMake\share\cmake-3.17\Modules\CMakeRCInformation.cmake;D:\Program Files\CMake\share\cmake-3.17\Modules\CMakeSystem.cmake.in;D:\Program Files\CMake\share\cmake-3.17\Modules\CMakeSystemSpecificInformation.cmake;D:\Program Files\CMake\share\cmake-3.17\Modules\CMakeSystemSpecificInitialize.cmake;D:\Program Files\CMake\share\cmake-3.17\Modules\CMakeTestCCompiler.cmake;D:\Program Files\CMake\share\cmake-3.17\Modules\CMakeTestCXXCompiler.cmake;D:\Program Files\CMake\share\cmake-3.17\Modules\CMakeTestCompilerCommon.cmake;D:\Program Files\CMake\share\cmake-3.17\Modules\CMakeTestRCCompiler.cmake;D:\Program Files\CMake\share\cmake-3.17\Modules\Compiler\ADSP-DetermineCompiler.cmake;D:\Program Files\CMake\share\cmake-3.17\Modules\Compiler\ARMCC-DetermineCompiler.cmake;D:\Program Files\CMake\share\cmake-3.17\Modules\Compiler\ARMClang-DetermineCompiler.cmake;D:\Program Files\CMake\share\cmake-3.17\Modules\Compiler\AppleClang-DetermineCompiler.cmake;D:\Program Files\CMake\share\cmake-3.17\Modules\Compiler\Borland-DetermineCompiler.cmake;D:\Program Files\CMake\share\cmake-3.17\Modules\Compiler\Bruce-C-DetermineCompiler.cmake;D:\Program Files\CMake\share\cmake-3.17\Modules\Compiler\CMakeCommonCompilerMacros.cmake;D:\Program Files\CMake\share\cmake-3.17\Modules\Compiler\Clang-DetermineCompiler.cmake;D:\Program Files\CMake\share\cmake-3.17\Modules\Compiler\Clang-DetermineCompilerInternal.cmake;D:\Program Files\CMake\share\cmake-3.17\Modules\Compiler\Comeau-CXX-DetermineCompiler.cmake;D:\Program Files\CMake\share\cmake-3.17\Modules\Compiler\Compaq-C-DetermineCompiler.cmake;D:\Program Files\CMake\share\cmake-3.17\Modules\Compiler\Compaq-CXX-DetermineCompiler.cmake;D:\Program Files\CMake\share\cmake-3.17\Modules\Compiler\Cray-DetermineCompiler.cmake;D:\Program Files\CMake\share\cmake-3.17\Modules\Compiler\Embarcadero-DetermineCompiler.cmake;D:\Program Files\CMake\share\cmake-3.17\Modules\Compiler\Fujitsu-DetermineCompiler.cmake;D:\Program Files\CMake\share\cmake-3.17\Modules\Compiler\GHS-DetermineCompiler.cmake;D:\Program Files\CMake\share\cmake-3.17\Modules\Compiler\GNU-C-DetermineCompiler.cmake;D:\Program Files\CMake\share\cmake-3.17\Modules\Compiler\GNU-CXX-DetermineCompiler.cmake;D:\Program Files\CMake\share\cmake-3.17\Modules\Compiler\HP-C-DetermineCompiler.cmake;D:\Program Files\CMake\share\cmake-3.17\Modules\Compiler\HP-CXX-DetermineCompiler.cmake;D:\Program Files\CMake\share\cmake-3.17\Modules\Compiler\IAR-DetermineCompiler.cmake;D:\Program Files\CMake\share\cmake-3.17\Modules\Compiler\IBMCPP-C-DetermineVersionInternal.cmake;D:\Program Files\CMake\share\cmake-3.17\Modules\Compiler\IBMCPP-CXX-DetermineVersionInternal.cmake;D:\Program Files\CMake\share\cmake-3.17\Modules\Compiler\Intel-DetermineCompiler.cmake;D:\Program Files\CMake\share\cmake-3.17\Modules\Compiler\MSVC-C.cmake;D:\Program Files\CMake\share\cmake-3.17\Modules\Compiler\MSVC-CXX.cmake;D:\Program Files\CMake\share\cmake-3.17\Modules\Compiler\MSVC-DetermineCompiler.cmake;D:\Program Files\CMake\share\cmake-3.17\Modules\Compiler\NVIDIA-DetermineCompiler.cmake;D:\Program Files\CMake\share\cmake-3.17\Modules\Compiler\OpenWatcom-DetermineCompiler.cmake;D:\Program Files\CMake\share\cmake-3.17\Modules\Compiler\PGI-DetermineCompiler.cmake;D:\Program Files\CMake\share\cmake-3.17\Modules\Compiler\PathScale-DetermineCompiler.cmake;D:\Program Files\CMake\share\cmake-3.17\Modules\Compiler\SCO-DetermineCompiler.cmake;D:\Program Files\CMake\share\cmake-3.17\Modules\Compiler\SDCC-C-DetermineCompiler.cmake;D:\Program Files\CMake\share\cmake-3.17\Modules\Compiler\SunPro-C-DetermineCompiler.cmake;D:\Program Files\CMake\share\cmake-3.17\Modules\Compiler\SunPro-CXX-DetermineCompiler.cmake;D:\Program Files\CMake\share\cmake-3.17\Modules\Compiler\TI-DetermineCompiler.cmake;D:\Program Files\CMake\share\cmake-3.17\Modules\Compiler\TinyCC-C-DetermineCompiler.cmake;D:\Program Files\CMake\share\cmake-3.17\Modules\Compiler\VisualAge-C-DetermineCompiler.cmake;D:\Program Files\CMake\share\cmake-3.17\Modules\Compiler\VisualAge-CXX-DetermineCompiler.cmake;D:\Program Files\CMake\share\cmake-3.17\Modules\Compiler\Watcom-DetermineCompiler.cmake;D:\Program Files\CMake\share\cmake-3.17\Modules\Compiler\XL-C-DetermineCompiler.cmake;D:\Program Files\CMake\share\cmake-3.17\Modules\Compiler\XL-CXX-DetermineCompiler.cmake;D:\Program Files\CMake\share\cmake-3.17\Modules\Compiler\XLClang-C-DetermineCompiler.cmake;D:\Program Files\CMake\share\cmake-3.17\Modules\Compiler\XLClang-CXX-DetermineCompiler.cmake;D:\Program Files\CMake\share\cmake-3.17\Modules\Compiler\zOS-C-DetermineCompiler.cmake;D:\Program Files\CMake\share\cmake-3.17\Modules\Compiler\zOS-CXX-DetermineCompiler.cmake;D:\Program Files\CMake\share\cmake-3.17\Modules\CompilerId\VS-10.vcxproj.in;D:\Program Files\CMake\share\cmake-3.17\Modules\Internal\FeatureTesting.cmake;D:\Program Files\CMake\share\cmake-3.17\Modules\Platform\Windows-Determine-CXX.cmake;D:\Program Files\CMake\share\cmake-3.17\Modules\Platform\Windows-MSVC-C.cmake;D:\Program Files\CMake\share\cmake-3.17\Modules\Platform\Windows-MSVC-CXX.cmake;D:\Program Files\CMake\share\cmake-3.17\Modules\Platform\Windows-MSVC.cmake;D:\Program Files\CMake\share\cmake-3.17\Modules\Platform\Windows.cmake;D:\Program Files\CMake\share\cmake-3.17\Modules\Platform\WindowsPaths.cmake;D:\workspace_vs\PathTracking\CrowdNavigation\CMakeFiles\3.17.2\CMakeCCompiler.cmake;D:\workspace_vs\PathTracking\CrowdNavigation\CMakeFiles\3.17.2\CMakeCXXCompiler.cmake;D:\workspace_vs\PathTracking\CrowdNavigation\CMakeFiles\3.17.2\CMakeRCCompiler.cmake;D:\workspace_vs\PathTracking\CrowdNavigation\CMakeFiles\3.17.2\CMakeSystem.cmake;%(AdditionalInputs)
292 | D:\workspace_vs\PathTracking\CrowdNavigation\CMakeFiles\generate.stamp
293 | false
294 | Building Custom Rule D:/workspace_vs/PathTracking/CrowdNavigation/CMakeLists.txt
295 | setlocal
296 | "D:\Program Files\CMake\bin\cmake.exe" -SD:/workspace_vs/PathTracking/CrowdNavigation -BD:/workspace_vs/PathTracking/CrowdNavigation --check-stamp-file D:/workspace_vs/PathTracking/CrowdNavigation/CMakeFiles/generate.stamp
297 | if %errorlevel% neq 0 goto :cmEnd
298 | :cmEnd
299 | endlocal & call :cmErrorLevel %errorlevel% & goto :cmDone
300 | :cmErrorLevel
301 | exit /b %1
302 | :cmDone
303 | if %errorlevel% neq 0 goto :VCEnd
304 | D:\Program Files\CMake\share\cmake-3.17\Modules\CMakeCCompiler.cmake.in;D:\Program Files\CMake\share\cmake-3.17\Modules\CMakeCCompilerABI.c;D:\Program Files\CMake\share\cmake-3.17\Modules\CMakeCInformation.cmake;D:\Program Files\CMake\share\cmake-3.17\Modules\CMakeCXXCompiler.cmake.in;D:\Program Files\CMake\share\cmake-3.17\Modules\CMakeCXXCompilerABI.cpp;D:\Program Files\CMake\share\cmake-3.17\Modules\CMakeCXXInformation.cmake;D:\Program Files\CMake\share\cmake-3.17\Modules\CMakeCommonLanguageInclude.cmake;D:\Program Files\CMake\share\cmake-3.17\Modules\CMakeCompilerIdDetection.cmake;D:\Program Files\CMake\share\cmake-3.17\Modules\CMakeDetermineCCompiler.cmake;D:\Program Files\CMake\share\cmake-3.17\Modules\CMakeDetermineCXXCompiler.cmake;D:\Program Files\CMake\share\cmake-3.17\Modules\CMakeDetermineCompileFeatures.cmake;D:\Program Files\CMake\share\cmake-3.17\Modules\CMakeDetermineCompiler.cmake;D:\Program Files\CMake\share\cmake-3.17\Modules\CMakeDetermineCompilerABI.cmake;D:\Program Files\CMake\share\cmake-3.17\Modules\CMakeDetermineCompilerId.cmake;D:\Program Files\CMake\share\cmake-3.17\Modules\CMakeDetermineRCCompiler.cmake;D:\Program Files\CMake\share\cmake-3.17\Modules\CMakeDetermineSystem.cmake;D:\Program Files\CMake\share\cmake-3.17\Modules\CMakeFindBinUtils.cmake;D:\Program Files\CMake\share\cmake-3.17\Modules\CMakeGenericSystem.cmake;D:\Program Files\CMake\share\cmake-3.17\Modules\CMakeInitializeConfigs.cmake;D:\Program Files\CMake\share\cmake-3.17\Modules\CMakeLanguageInformation.cmake;D:\Program Files\CMake\share\cmake-3.17\Modules\CMakeParseImplicitIncludeInfo.cmake;D:\Program Files\CMake\share\cmake-3.17\Modules\CMakeParseImplicitLinkInfo.cmake;D:\Program Files\CMake\share\cmake-3.17\Modules\CMakeRCCompiler.cmake.in;D:\Program Files\CMake\share\cmake-3.17\Modules\CMakeRCInformation.cmake;D:\Program Files\CMake\share\cmake-3.17\Modules\CMakeSystem.cmake.in;D:\Program Files\CMake\share\cmake-3.17\Modules\CMakeSystemSpecificInformation.cmake;D:\Program Files\CMake\share\cmake-3.17\Modules\CMakeSystemSpecificInitialize.cmake;D:\Program Files\CMake\share\cmake-3.17\Modules\CMakeTestCCompiler.cmake;D:\Program Files\CMake\share\cmake-3.17\Modules\CMakeTestCXXCompiler.cmake;D:\Program Files\CMake\share\cmake-3.17\Modules\CMakeTestCompilerCommon.cmake;D:\Program Files\CMake\share\cmake-3.17\Modules\CMakeTestRCCompiler.cmake;D:\Program Files\CMake\share\cmake-3.17\Modules\Compiler\ADSP-DetermineCompiler.cmake;D:\Program Files\CMake\share\cmake-3.17\Modules\Compiler\ARMCC-DetermineCompiler.cmake;D:\Program Files\CMake\share\cmake-3.17\Modules\Compiler\ARMClang-DetermineCompiler.cmake;D:\Program Files\CMake\share\cmake-3.17\Modules\Compiler\AppleClang-DetermineCompiler.cmake;D:\Program Files\CMake\share\cmake-3.17\Modules\Compiler\Borland-DetermineCompiler.cmake;D:\Program Files\CMake\share\cmake-3.17\Modules\Compiler\Bruce-C-DetermineCompiler.cmake;D:\Program Files\CMake\share\cmake-3.17\Modules\Compiler\CMakeCommonCompilerMacros.cmake;D:\Program Files\CMake\share\cmake-3.17\Modules\Compiler\Clang-DetermineCompiler.cmake;D:\Program Files\CMake\share\cmake-3.17\Modules\Compiler\Clang-DetermineCompilerInternal.cmake;D:\Program Files\CMake\share\cmake-3.17\Modules\Compiler\Comeau-CXX-DetermineCompiler.cmake;D:\Program Files\CMake\share\cmake-3.17\Modules\Compiler\Compaq-C-DetermineCompiler.cmake;D:\Program Files\CMake\share\cmake-3.17\Modules\Compiler\Compaq-CXX-DetermineCompiler.cmake;D:\Program Files\CMake\share\cmake-3.17\Modules\Compiler\Cray-DetermineCompiler.cmake;D:\Program Files\CMake\share\cmake-3.17\Modules\Compiler\Embarcadero-DetermineCompiler.cmake;D:\Program Files\CMake\share\cmake-3.17\Modules\Compiler\Fujitsu-DetermineCompiler.cmake;D:\Program Files\CMake\share\cmake-3.17\Modules\Compiler\GHS-DetermineCompiler.cmake;D:\Program Files\CMake\share\cmake-3.17\Modules\Compiler\GNU-C-DetermineCompiler.cmake;D:\Program Files\CMake\share\cmake-3.17\Modules\Compiler\GNU-CXX-DetermineCompiler.cmake;D:\Program Files\CMake\share\cmake-3.17\Modules\Compiler\HP-C-DetermineCompiler.cmake;D:\Program Files\CMake\share\cmake-3.17\Modules\Compiler\HP-CXX-DetermineCompiler.cmake;D:\Program Files\CMake\share\cmake-3.17\Modules\Compiler\IAR-DetermineCompiler.cmake;D:\Program Files\CMake\share\cmake-3.17\Modules\Compiler\IBMCPP-C-DetermineVersionInternal.cmake;D:\Program Files\CMake\share\cmake-3.17\Modules\Compiler\IBMCPP-CXX-DetermineVersionInternal.cmake;D:\Program Files\CMake\share\cmake-3.17\Modules\Compiler\Intel-DetermineCompiler.cmake;D:\Program Files\CMake\share\cmake-3.17\Modules\Compiler\MSVC-C.cmake;D:\Program Files\CMake\share\cmake-3.17\Modules\Compiler\MSVC-CXX.cmake;D:\Program Files\CMake\share\cmake-3.17\Modules\Compiler\MSVC-DetermineCompiler.cmake;D:\Program Files\CMake\share\cmake-3.17\Modules\Compiler\NVIDIA-DetermineCompiler.cmake;D:\Program Files\CMake\share\cmake-3.17\Modules\Compiler\OpenWatcom-DetermineCompiler.cmake;D:\Program Files\CMake\share\cmake-3.17\Modules\Compiler\PGI-DetermineCompiler.cmake;D:\Program Files\CMake\share\cmake-3.17\Modules\Compiler\PathScale-DetermineCompiler.cmake;D:\Program Files\CMake\share\cmake-3.17\Modules\Compiler\SCO-DetermineCompiler.cmake;D:\Program Files\CMake\share\cmake-3.17\Modules\Compiler\SDCC-C-DetermineCompiler.cmake;D:\Program Files\CMake\share\cmake-3.17\Modules\Compiler\SunPro-C-DetermineCompiler.cmake;D:\Program Files\CMake\share\cmake-3.17\Modules\Compiler\SunPro-CXX-DetermineCompiler.cmake;D:\Program Files\CMake\share\cmake-3.17\Modules\Compiler\TI-DetermineCompiler.cmake;D:\Program Files\CMake\share\cmake-3.17\Modules\Compiler\TinyCC-C-DetermineCompiler.cmake;D:\Program Files\CMake\share\cmake-3.17\Modules\Compiler\VisualAge-C-DetermineCompiler.cmake;D:\Program Files\CMake\share\cmake-3.17\Modules\Compiler\VisualAge-CXX-DetermineCompiler.cmake;D:\Program Files\CMake\share\cmake-3.17\Modules\Compiler\Watcom-DetermineCompiler.cmake;D:\Program Files\CMake\share\cmake-3.17\Modules\Compiler\XL-C-DetermineCompiler.cmake;D:\Program Files\CMake\share\cmake-3.17\Modules\Compiler\XL-CXX-DetermineCompiler.cmake;D:\Program Files\CMake\share\cmake-3.17\Modules\Compiler\XLClang-C-DetermineCompiler.cmake;D:\Program Files\CMake\share\cmake-3.17\Modules\Compiler\XLClang-CXX-DetermineCompiler.cmake;D:\Program Files\CMake\share\cmake-3.17\Modules\Compiler\zOS-C-DetermineCompiler.cmake;D:\Program Files\CMake\share\cmake-3.17\Modules\Compiler\zOS-CXX-DetermineCompiler.cmake;D:\Program Files\CMake\share\cmake-3.17\Modules\CompilerId\VS-10.vcxproj.in;D:\Program Files\CMake\share\cmake-3.17\Modules\Internal\FeatureTesting.cmake;D:\Program Files\CMake\share\cmake-3.17\Modules\Platform\Windows-Determine-CXX.cmake;D:\Program Files\CMake\share\cmake-3.17\Modules\Platform\Windows-MSVC-C.cmake;D:\Program Files\CMake\share\cmake-3.17\Modules\Platform\Windows-MSVC-CXX.cmake;D:\Program Files\CMake\share\cmake-3.17\Modules\Platform\Windows-MSVC.cmake;D:\Program Files\CMake\share\cmake-3.17\Modules\Platform\Windows.cmake;D:\Program Files\CMake\share\cmake-3.17\Modules\Platform\WindowsPaths.cmake;D:\workspace_vs\PathTracking\CrowdNavigation\CMakeFiles\3.17.2\CMakeCCompiler.cmake;D:\workspace_vs\PathTracking\CrowdNavigation\CMakeFiles\3.17.2\CMakeCXXCompiler.cmake;D:\workspace_vs\PathTracking\CrowdNavigation\CMakeFiles\3.17.2\CMakeRCCompiler.cmake;D:\workspace_vs\PathTracking\CrowdNavigation\CMakeFiles\3.17.2\CMakeSystem.cmake;%(AdditionalInputs)
305 | D:\workspace_vs\PathTracking\CrowdNavigation\CMakeFiles\generate.stamp
306 | false
307 | Building Custom Rule D:/workspace_vs/PathTracking/CrowdNavigation/CMakeLists.txt
308 | setlocal
309 | "D:\Program Files\CMake\bin\cmake.exe" -SD:/workspace_vs/PathTracking/CrowdNavigation -BD:/workspace_vs/PathTracking/CrowdNavigation --check-stamp-file D:/workspace_vs/PathTracking/CrowdNavigation/CMakeFiles/generate.stamp
310 | if %errorlevel% neq 0 goto :cmEnd
311 | :cmEnd
312 | endlocal & call :cmErrorLevel %errorlevel% & goto :cmDone
313 | :cmErrorLevel
314 | exit /b %1
315 | :cmDone
316 | if %errorlevel% neq 0 goto :VCEnd
317 | D:\Program Files\CMake\share\cmake-3.17\Modules\CMakeCCompiler.cmake.in;D:\Program Files\CMake\share\cmake-3.17\Modules\CMakeCCompilerABI.c;D:\Program Files\CMake\share\cmake-3.17\Modules\CMakeCInformation.cmake;D:\Program Files\CMake\share\cmake-3.17\Modules\CMakeCXXCompiler.cmake.in;D:\Program Files\CMake\share\cmake-3.17\Modules\CMakeCXXCompilerABI.cpp;D:\Program Files\CMake\share\cmake-3.17\Modules\CMakeCXXInformation.cmake;D:\Program Files\CMake\share\cmake-3.17\Modules\CMakeCommonLanguageInclude.cmake;D:\Program Files\CMake\share\cmake-3.17\Modules\CMakeCompilerIdDetection.cmake;D:\Program Files\CMake\share\cmake-3.17\Modules\CMakeDetermineCCompiler.cmake;D:\Program Files\CMake\share\cmake-3.17\Modules\CMakeDetermineCXXCompiler.cmake;D:\Program Files\CMake\share\cmake-3.17\Modules\CMakeDetermineCompileFeatures.cmake;D:\Program Files\CMake\share\cmake-3.17\Modules\CMakeDetermineCompiler.cmake;D:\Program Files\CMake\share\cmake-3.17\Modules\CMakeDetermineCompilerABI.cmake;D:\Program Files\CMake\share\cmake-3.17\Modules\CMakeDetermineCompilerId.cmake;D:\Program Files\CMake\share\cmake-3.17\Modules\CMakeDetermineRCCompiler.cmake;D:\Program Files\CMake\share\cmake-3.17\Modules\CMakeDetermineSystem.cmake;D:\Program Files\CMake\share\cmake-3.17\Modules\CMakeFindBinUtils.cmake;D:\Program Files\CMake\share\cmake-3.17\Modules\CMakeGenericSystem.cmake;D:\Program Files\CMake\share\cmake-3.17\Modules\CMakeInitializeConfigs.cmake;D:\Program Files\CMake\share\cmake-3.17\Modules\CMakeLanguageInformation.cmake;D:\Program Files\CMake\share\cmake-3.17\Modules\CMakeParseImplicitIncludeInfo.cmake;D:\Program Files\CMake\share\cmake-3.17\Modules\CMakeParseImplicitLinkInfo.cmake;D:\Program Files\CMake\share\cmake-3.17\Modules\CMakeRCCompiler.cmake.in;D:\Program Files\CMake\share\cmake-3.17\Modules\CMakeRCInformation.cmake;D:\Program Files\CMake\share\cmake-3.17\Modules\CMakeSystem.cmake.in;D:\Program Files\CMake\share\cmake-3.17\Modules\CMakeSystemSpecificInformation.cmake;D:\Program Files\CMake\share\cmake-3.17\Modules\CMakeSystemSpecificInitialize.cmake;D:\Program Files\CMake\share\cmake-3.17\Modules\CMakeTestCCompiler.cmake;D:\Program Files\CMake\share\cmake-3.17\Modules\CMakeTestCXXCompiler.cmake;D:\Program Files\CMake\share\cmake-3.17\Modules\CMakeTestCompilerCommon.cmake;D:\Program Files\CMake\share\cmake-3.17\Modules\CMakeTestRCCompiler.cmake;D:\Program Files\CMake\share\cmake-3.17\Modules\Compiler\ADSP-DetermineCompiler.cmake;D:\Program Files\CMake\share\cmake-3.17\Modules\Compiler\ARMCC-DetermineCompiler.cmake;D:\Program Files\CMake\share\cmake-3.17\Modules\Compiler\ARMClang-DetermineCompiler.cmake;D:\Program Files\CMake\share\cmake-3.17\Modules\Compiler\AppleClang-DetermineCompiler.cmake;D:\Program Files\CMake\share\cmake-3.17\Modules\Compiler\Borland-DetermineCompiler.cmake;D:\Program Files\CMake\share\cmake-3.17\Modules\Compiler\Bruce-C-DetermineCompiler.cmake;D:\Program Files\CMake\share\cmake-3.17\Modules\Compiler\CMakeCommonCompilerMacros.cmake;D:\Program Files\CMake\share\cmake-3.17\Modules\Compiler\Clang-DetermineCompiler.cmake;D:\Program Files\CMake\share\cmake-3.17\Modules\Compiler\Clang-DetermineCompilerInternal.cmake;D:\Program Files\CMake\share\cmake-3.17\Modules\Compiler\Comeau-CXX-DetermineCompiler.cmake;D:\Program Files\CMake\share\cmake-3.17\Modules\Compiler\Compaq-C-DetermineCompiler.cmake;D:\Program Files\CMake\share\cmake-3.17\Modules\Compiler\Compaq-CXX-DetermineCompiler.cmake;D:\Program Files\CMake\share\cmake-3.17\Modules\Compiler\Cray-DetermineCompiler.cmake;D:\Program Files\CMake\share\cmake-3.17\Modules\Compiler\Embarcadero-DetermineCompiler.cmake;D:\Program Files\CMake\share\cmake-3.17\Modules\Compiler\Fujitsu-DetermineCompiler.cmake;D:\Program Files\CMake\share\cmake-3.17\Modules\Compiler\GHS-DetermineCompiler.cmake;D:\Program Files\CMake\share\cmake-3.17\Modules\Compiler\GNU-C-DetermineCompiler.cmake;D:\Program Files\CMake\share\cmake-3.17\Modules\Compiler\GNU-CXX-DetermineCompiler.cmake;D:\Program Files\CMake\share\cmake-3.17\Modules\Compiler\HP-C-DetermineCompiler.cmake;D:\Program Files\CMake\share\cmake-3.17\Modules\Compiler\HP-CXX-DetermineCompiler.cmake;D:\Program Files\CMake\share\cmake-3.17\Modules\Compiler\IAR-DetermineCompiler.cmake;D:\Program Files\CMake\share\cmake-3.17\Modules\Compiler\IBMCPP-C-DetermineVersionInternal.cmake;D:\Program Files\CMake\share\cmake-3.17\Modules\Compiler\IBMCPP-CXX-DetermineVersionInternal.cmake;D:\Program Files\CMake\share\cmake-3.17\Modules\Compiler\Intel-DetermineCompiler.cmake;D:\Program Files\CMake\share\cmake-3.17\Modules\Compiler\MSVC-C.cmake;D:\Program Files\CMake\share\cmake-3.17\Modules\Compiler\MSVC-CXX.cmake;D:\Program Files\CMake\share\cmake-3.17\Modules\Compiler\MSVC-DetermineCompiler.cmake;D:\Program Files\CMake\share\cmake-3.17\Modules\Compiler\NVIDIA-DetermineCompiler.cmake;D:\Program Files\CMake\share\cmake-3.17\Modules\Compiler\OpenWatcom-DetermineCompiler.cmake;D:\Program Files\CMake\share\cmake-3.17\Modules\Compiler\PGI-DetermineCompiler.cmake;D:\Program Files\CMake\share\cmake-3.17\Modules\Compiler\PathScale-DetermineCompiler.cmake;D:\Program Files\CMake\share\cmake-3.17\Modules\Compiler\SCO-DetermineCompiler.cmake;D:\Program Files\CMake\share\cmake-3.17\Modules\Compiler\SDCC-C-DetermineCompiler.cmake;D:\Program Files\CMake\share\cmake-3.17\Modules\Compiler\SunPro-C-DetermineCompiler.cmake;D:\Program Files\CMake\share\cmake-3.17\Modules\Compiler\SunPro-CXX-DetermineCompiler.cmake;D:\Program Files\CMake\share\cmake-3.17\Modules\Compiler\TI-DetermineCompiler.cmake;D:\Program Files\CMake\share\cmake-3.17\Modules\Compiler\TinyCC-C-DetermineCompiler.cmake;D:\Program Files\CMake\share\cmake-3.17\Modules\Compiler\VisualAge-C-DetermineCompiler.cmake;D:\Program Files\CMake\share\cmake-3.17\Modules\Compiler\VisualAge-CXX-DetermineCompiler.cmake;D:\Program Files\CMake\share\cmake-3.17\Modules\Compiler\Watcom-DetermineCompiler.cmake;D:\Program Files\CMake\share\cmake-3.17\Modules\Compiler\XL-C-DetermineCompiler.cmake;D:\Program Files\CMake\share\cmake-3.17\Modules\Compiler\XL-CXX-DetermineCompiler.cmake;D:\Program Files\CMake\share\cmake-3.17\Modules\Compiler\XLClang-C-DetermineCompiler.cmake;D:\Program Files\CMake\share\cmake-3.17\Modules\Compiler\XLClang-CXX-DetermineCompiler.cmake;D:\Program Files\CMake\share\cmake-3.17\Modules\Compiler\zOS-C-DetermineCompiler.cmake;D:\Program Files\CMake\share\cmake-3.17\Modules\Compiler\zOS-CXX-DetermineCompiler.cmake;D:\Program Files\CMake\share\cmake-3.17\Modules\CompilerId\VS-10.vcxproj.in;D:\Program Files\CMake\share\cmake-3.17\Modules\Internal\FeatureTesting.cmake;D:\Program Files\CMake\share\cmake-3.17\Modules\Platform\Windows-Determine-CXX.cmake;D:\Program Files\CMake\share\cmake-3.17\Modules\Platform\Windows-MSVC-C.cmake;D:\Program Files\CMake\share\cmake-3.17\Modules\Platform\Windows-MSVC-CXX.cmake;D:\Program Files\CMake\share\cmake-3.17\Modules\Platform\Windows-MSVC.cmake;D:\Program Files\CMake\share\cmake-3.17\Modules\Platform\Windows.cmake;D:\Program Files\CMake\share\cmake-3.17\Modules\Platform\WindowsPaths.cmake;D:\workspace_vs\PathTracking\CrowdNavigation\CMakeFiles\3.17.2\CMakeCCompiler.cmake;D:\workspace_vs\PathTracking\CrowdNavigation\CMakeFiles\3.17.2\CMakeCXXCompiler.cmake;D:\workspace_vs\PathTracking\CrowdNavigation\CMakeFiles\3.17.2\CMakeRCCompiler.cmake;D:\workspace_vs\PathTracking\CrowdNavigation\CMakeFiles\3.17.2\CMakeSystem.cmake;%(AdditionalInputs)
318 | D:\workspace_vs\PathTracking\CrowdNavigation\CMakeFiles\generate.stamp
319 | false
320 |
321 |
322 |
323 |
324 |
325 |
326 |
327 |
328 | {19533138-2A8D-3A98-B781-B7FC80205B45}
329 | ZERO_CHECK
330 | false
331 | Never
332 |
333 |
334 |
335 |
336 |
337 |
--------------------------------------------------------------------------------
/CrowdNavigation/GL/glut.def:
--------------------------------------------------------------------------------
1 | DESCRIPTION 'OpenGL Utility Toolkit for Win32'
2 |
3 | VERSION 3.7
4 |
5 | EXPORTS
6 |
7 | glutAddMenuEntry
8 | glutAddSubMenu
9 | glutAttachMenu
10 | glutBitmapCharacter
11 | glutBitmapLength
12 | glutBitmapWidth
13 | glutButtonBoxFunc
14 | glutChangeToMenuEntry
15 | glutChangeToSubMenu
16 | glutCopyColormap
17 | glutCreateMenu
18 | __glutCreateMenuWithExit
19 | glutCreateSubWindow
20 | glutCreateWindow
21 | __glutCreateWindowWithExit
22 | glutDestroyMenu
23 | glutDestroyWindow
24 | glutDetachMenu
25 | glutDeviceGet
26 | glutDialsFunc
27 | glutDisplayFunc
28 | glutEnterGameMode
29 | glutEntryFunc
30 | glutEstablishOverlay
31 | glutExtensionSupported
32 | glutForceJoystickFunc
33 | glutFullScreen
34 | glutGameModeGet
35 | glutGameModeString
36 | glutGet
37 | glutGetColor
38 | glutGetMenu
39 | glutGetModifiers
40 | glutGetWindow
41 | glutHideOverlay
42 | glutHideWindow
43 | glutIconifyWindow
44 | glutIdleFunc
45 | glutIgnoreKeyRepeat
46 | glutInit
47 | __glutInitWithExit
48 | glutInitDisplayMode
49 | glutInitDisplayString
50 | glutInitWindowPosition
51 | glutInitWindowSize
52 | glutJoystickFunc
53 | glutKeyboardFunc
54 | glutKeyboardUpFunc
55 | glutLayerGet
56 | glutLeaveGameMode
57 | glutMainLoop
58 | glutMenuStateFunc
59 | glutMenuStatusFunc
60 | glutMotionFunc
61 | glutMouseFunc
62 | glutOverlayDisplayFunc
63 | glutPassiveMotionFunc
64 | glutPopWindow
65 | glutPositionWindow
66 | glutPostOverlayRedisplay
67 | glutPostRedisplay
68 | glutPostWindowOverlayRedisplay
69 | glutPostWindowRedisplay
70 | glutPushWindow
71 | glutRemoveMenuItem
72 | glutRemoveOverlay
73 | glutReportErrors
74 | glutReshapeFunc
75 | glutReshapeWindow
76 | glutSetColor
77 | glutSetCursor
78 | glutSetIconTitle
79 | glutSetKeyRepeat
80 | glutSetMenu
81 | glutSetWindow
82 | glutSetWindowTitle
83 | glutSetupVideoResizing
84 | glutShowOverlay
85 | glutShowWindow
86 | glutSolidCone
87 | glutSolidCube
88 | glutSolidDodecahedron
89 | glutSolidIcosahedron
90 | glutSolidOctahedron
91 | glutSolidSphere
92 | glutSolidTeapot
93 | glutSolidTetrahedron
94 | glutSolidTorus
95 | glutSpaceballButtonFunc
96 | glutSpaceballMotionFunc
97 | glutSpaceballRotateFunc
98 | glutSpecialFunc
99 | glutSpecialUpFunc
100 | glutStopVideoResizing
101 | glutStrokeCharacter
102 | glutStrokeLength
103 | glutStrokeWidth
104 | glutSwapBuffers
105 | glutTabletButtonFunc
106 | glutTabletMotionFunc
107 | glutTimerFunc
108 | glutUseLayer
109 | glutVideoPan
110 | glutVideoResize
111 | glutVideoResizeGet
112 | glutVisibilityFunc
113 | glutWarpPointer
114 | glutWindowStatusFunc
115 | glutWireCone
116 | glutWireCube
117 | glutWireDodecahedron
118 | glutWireIcosahedron
119 | glutWireOctahedron
120 | glutWireSphere
121 | glutWireTeapot
122 | glutWireTetrahedron
123 | glutWireTorus
124 | ; __glutSetFCB
125 | ; __glutGetFCB
126 |
127 |
--------------------------------------------------------------------------------
/CrowdNavigation/GL/glut.h:
--------------------------------------------------------------------------------
1 | #ifndef __glut_h__
2 | #define __glut_h__
3 |
4 | /* Copyright (c) Mark J. Kilgard, 1994, 1995, 1996, 1998. */
5 |
6 | /* This program is freely distributable without licensing fees and is
7 | provided without guarantee or warrantee expressed or implied. This
8 | program is -not- in the public domain. */
9 |
10 | #if defined(_WIN32)
11 |
12 | /* GLUT 3.7 now tries to avoid including
13 | to avoid name space pollution, but Win32's
14 | needs APIENTRY and WINGDIAPI defined properly. */
15 | # if 0
16 | /* This would put tons of macros and crap in our clean name space. */
17 | # define WIN32_LEAN_AND_MEAN
18 | # include
19 | # else
20 | /* XXX This is from Win32's */
21 | # ifndef APIENTRY
22 | # define GLUT_APIENTRY_DEFINED
23 | # if (_MSC_VER >= 800) || defined(_STDCALL_SUPPORTED) || defined(__BORLANDC__) || defined(__LCC__)
24 | # define APIENTRY __stdcall
25 | # else
26 | # define APIENTRY
27 | # endif
28 | # endif
29 | /* XXX This is from Win32's */
30 | # ifndef CALLBACK
31 | # if (defined(_M_MRX000) || defined(_M_IX86) || defined(_M_ALPHA) || defined(_M_PPC)) && !defined(MIDL_PASS) || defined(__LCC__)
32 | # define CALLBACK __stdcall
33 | # else
34 | # define CALLBACK
35 | # endif
36 | # endif
37 | /* XXX Hack for lcc compiler. It doesn't support __declspec(dllimport), just __stdcall. */
38 | # if defined( __LCC__ )
39 | # undef WINGDIAPI
40 | # define WINGDIAPI __stdcall
41 | # else
42 | /* XXX This is from Win32's and */
43 | # ifndef WINGDIAPI
44 | # define GLUT_WINGDIAPI_DEFINED
45 | # define WINGDIAPI __declspec(dllimport)
46 | # endif
47 | # endif
48 | /* XXX This is from Win32's */
49 | # ifndef _WCHAR_T_DEFINED
50 | typedef unsigned short wchar_t;
51 | # define _WCHAR_T_DEFINED
52 | # endif
53 | # endif
54 |
55 | /* To disable automatic library usage for GLUT, define GLUT_NO_LIB_PRAGMA
56 | in your compile preprocessor options. */
57 | # if !defined(GLUT_BUILDING_LIB) && !defined(GLUT_NO_LIB_PRAGMA)
58 | # pragma comment (lib, "winmm.lib") /* link with Windows MultiMedia lib */
59 | /* To enable automatic SGI OpenGL for Windows library usage for GLUT,
60 | define GLUT_USE_SGI_OPENGL in your compile preprocessor options. */
61 | # ifdef GLUT_USE_SGI_OPENGL
62 | # pragma comment (lib, "opengl.lib") /* link with SGI OpenGL for Windows lib */
63 | # pragma comment (lib, "glu.lib") /* link with SGI OpenGL Utility lib */
64 | # pragma comment (lib, "glut.lib") /* link with Win32 GLUT for SGI OpenGL lib */
65 | # else
66 | # pragma comment (lib, "opengl32.lib") /* link with Microsoft OpenGL lib */
67 | # pragma comment (lib, "glu32.lib") /* link with Microsoft OpenGL Utility lib */
68 | # pragma comment (lib, "glut32.lib") /* link with Win32 GLUT lib */
69 | # endif
70 | # endif
71 |
72 | /* To disable supression of annoying warnings about floats being promoted
73 | to doubles, define GLUT_NO_WARNING_DISABLE in your compile preprocessor
74 | options. */
75 | # ifndef GLUT_NO_WARNING_DISABLE
76 | # pragma warning (disable:4244) /* Disable bogus VC++ 4.2 conversion warnings. */
77 | # pragma warning (disable:4305) /* VC++ 5.0 version of above warning. */
78 | # endif
79 |
80 | /* Win32 has an annoying issue where there are multiple C run-time
81 | libraries (CRTs). If the executable is linked with a different CRT
82 | from the GLUT DLL, the GLUT DLL will not share the same CRT static
83 | data seen by the executable. In particular, atexit callbacks registered
84 | in the executable will not be called if GLUT calls its (different)
85 | exit routine). GLUT is typically built with the
86 | "/MD" option (the CRT with multithreading DLL support), but the Visual
87 | C++ linker default is "/ML" (the single threaded CRT).
88 |
89 | One workaround to this issue is requiring users to always link with
90 | the same CRT as GLUT is compiled with. That requires users supply a
91 | non-standard option. GLUT 3.7 has its own built-in workaround where
92 | the executable's "exit" function pointer is covertly passed to GLUT.
93 | GLUT then calls the executable's exit function pointer to ensure that
94 | any "atexit" calls registered by the application are called if GLUT
95 | needs to exit.
96 |
97 | Note that the __glut*WithExit routines should NEVER be called directly.
98 | To avoid the atexit workaround, #define GLUT_DISABLE_ATEXIT_HACK. */
99 |
100 | /* XXX This is from Win32's */
101 | # if !defined(_MSC_VER) && !defined(__cdecl)
102 | /* Define __cdecl for non-Microsoft compilers. */
103 | # define __cdecl
104 | # define GLUT_DEFINED___CDECL
105 | # endif
106 | # ifndef _CRTIMP
107 | # ifdef _NTSDK
108 | /* Definition compatible with NT SDK */
109 | # define _CRTIMP
110 | # else
111 | /* Current definition */
112 | # ifdef _DLL
113 | # define _CRTIMP __declspec(dllimport)
114 | # else
115 | # define _CRTIMP
116 | # endif
117 | # endif
118 | # define GLUT_DEFINED__CRTIMP
119 | # endif
120 |
121 | /* GLUT API entry point declarations for Win32. */
122 | # ifdef GLUT_BUILDING_LIB
123 | # define GLUTAPI __declspec(dllexport)
124 | # else
125 | # ifdef _DLL
126 | # define GLUTAPI __declspec(dllimport)
127 | # else
128 | # define GLUTAPI extern
129 | # endif
130 | # endif
131 |
132 | /* GLUT callback calling convention for Win32. */
133 | # define GLUTCALLBACK __cdecl
134 |
135 | #endif /* _WIN32 */
136 |
137 | #include
138 | #include
139 |
140 | #ifdef __cplusplus
141 | extern "C" {
142 | #endif
143 |
144 | #if defined(_WIN32)
145 | # ifndef GLUT_BUILDING_LIB
146 | extern _CRTIMP void __cdecl exit(int);
147 | # endif
148 | #else
149 | /* non-Win32 case. */
150 | /* Define APIENTRY and CALLBACK to nothing if we aren't on Win32. */
151 | # define APIENTRY
152 | # define GLUT_APIENTRY_DEFINED
153 | # define CALLBACK
154 | /* Define GLUTAPI and GLUTCALLBACK as below if we aren't on Win32. */
155 | # define GLUTAPI extern
156 | # define GLUTCALLBACK
157 | /* Prototype exit for the non-Win32 case (see above). */
158 | extern void exit(int);
159 | #endif
160 |
161 | /**
162 | GLUT API revision history:
163 |
164 | GLUT_API_VERSION is updated to reflect incompatible GLUT
165 | API changes (interface changes, semantic changes, deletions,
166 | or additions).
167 |
168 | GLUT_API_VERSION=1 First public release of GLUT. 11/29/94
169 |
170 | GLUT_API_VERSION=2 Added support for OpenGL/GLX multisampling,
171 | extension. Supports new input devices like tablet, dial and button
172 | box, and Spaceball. Easy to query OpenGL extensions.
173 |
174 | GLUT_API_VERSION=3 glutMenuStatus added.
175 |
176 | GLUT_API_VERSION=4 glutInitDisplayString, glutWarpPointer,
177 | glutBitmapLength, glutStrokeLength, glutWindowStatusFunc, dynamic
178 | video resize subAPI, glutPostWindowRedisplay, glutKeyboardUpFunc,
179 | glutSpecialUpFunc, glutIgnoreKeyRepeat, glutSetKeyRepeat,
180 | glutJoystickFunc, glutForceJoystickFunc (NOT FINALIZED!).
181 | **/
182 | #ifndef GLUT_API_VERSION /* allow this to be overriden */
183 | #define GLUT_API_VERSION 3
184 | #endif
185 |
186 | /**
187 | GLUT implementation revision history:
188 |
189 | GLUT_XLIB_IMPLEMENTATION is updated to reflect both GLUT
190 | API revisions and implementation revisions (ie, bug fixes).
191 |
192 | GLUT_XLIB_IMPLEMENTATION=1 mjk's first public release of
193 | GLUT Xlib-based implementation. 11/29/94
194 |
195 | GLUT_XLIB_IMPLEMENTATION=2 mjk's second public release of
196 | GLUT Xlib-based implementation providing GLUT version 2
197 | interfaces.
198 |
199 | GLUT_XLIB_IMPLEMENTATION=3 mjk's GLUT 2.2 images. 4/17/95
200 |
201 | GLUT_XLIB_IMPLEMENTATION=4 mjk's GLUT 2.3 images. 6/?/95
202 |
203 | GLUT_XLIB_IMPLEMENTATION=5 mjk's GLUT 3.0 images. 10/?/95
204 |
205 | GLUT_XLIB_IMPLEMENTATION=7 mjk's GLUT 3.1+ with glutWarpPoitner. 7/24/96
206 |
207 | GLUT_XLIB_IMPLEMENTATION=8 mjk's GLUT 3.1+ with glutWarpPoitner
208 | and video resize. 1/3/97
209 |
210 | GLUT_XLIB_IMPLEMENTATION=9 mjk's GLUT 3.4 release with early GLUT 4 routines.
211 |
212 | GLUT_XLIB_IMPLEMENTATION=11 Mesa 2.5's GLUT 3.6 release.
213 |
214 | GLUT_XLIB_IMPLEMENTATION=12 mjk's GLUT 3.6 release with early GLUT 4 routines + signal handling.
215 |
216 | GLUT_XLIB_IMPLEMENTATION=13 mjk's GLUT 3.7 beta with GameGLUT support.
217 |
218 | GLUT_XLIB_IMPLEMENTATION=14 mjk's GLUT 3.7 beta with f90gl friend interface.
219 |
220 | GLUT_XLIB_IMPLEMENTATION=15 mjk's GLUT 3.7 beta sync'ed with Mesa
221 | **/
222 | #ifndef GLUT_XLIB_IMPLEMENTATION /* Allow this to be overriden. */
223 | #define GLUT_XLIB_IMPLEMENTATION 15
224 | #endif
225 |
226 | /* Display mode bit masks. */
227 | #define GLUT_RGB 0
228 | #define GLUT_RGBA GLUT_RGB
229 | #define GLUT_INDEX 1
230 | #define GLUT_SINGLE 0
231 | #define GLUT_DOUBLE 2
232 | #define GLUT_ACCUM 4
233 | #define GLUT_ALPHA 8
234 | #define GLUT_DEPTH 16
235 | #define GLUT_STENCIL 32
236 | #if (GLUT_API_VERSION >= 2)
237 | #define GLUT_MULTISAMPLE 128
238 | #define GLUT_STEREO 256
239 | #endif
240 | #if (GLUT_API_VERSION >= 3)
241 | #define GLUT_LUMINANCE 512
242 | #endif
243 |
244 | /* Mouse buttons. */
245 | #define GLUT_LEFT_BUTTON 0
246 | #define GLUT_MIDDLE_BUTTON 1
247 | #define GLUT_RIGHT_BUTTON 2
248 |
249 | /* Mouse button state. */
250 | #define GLUT_DOWN 0
251 | #define GLUT_UP 1
252 |
253 | #if (GLUT_API_VERSION >= 2)
254 | /* function keys */
255 | #define GLUT_KEY_F1 1
256 | #define GLUT_KEY_F2 2
257 | #define GLUT_KEY_F3 3
258 | #define GLUT_KEY_F4 4
259 | #define GLUT_KEY_F5 5
260 | #define GLUT_KEY_F6 6
261 | #define GLUT_KEY_F7 7
262 | #define GLUT_KEY_F8 8
263 | #define GLUT_KEY_F9 9
264 | #define GLUT_KEY_F10 10
265 | #define GLUT_KEY_F11 11
266 | #define GLUT_KEY_F12 12
267 | /* directional keys */
268 | #define GLUT_KEY_LEFT 100
269 | #define GLUT_KEY_UP 101
270 | #define GLUT_KEY_RIGHT 102
271 | #define GLUT_KEY_DOWN 103
272 | #define GLUT_KEY_PAGE_UP 104
273 | #define GLUT_KEY_PAGE_DOWN 105
274 | #define GLUT_KEY_HOME 106
275 | #define GLUT_KEY_END 107
276 | #define GLUT_KEY_INSERT 108
277 | #endif
278 |
279 | /* Entry/exit state. */
280 | #define GLUT_LEFT 0
281 | #define GLUT_ENTERED 1
282 |
283 | /* Menu usage state. */
284 | #define GLUT_MENU_NOT_IN_USE 0
285 | #define GLUT_MENU_IN_USE 1
286 |
287 | /* Visibility state. */
288 | #define GLUT_NOT_VISIBLE 0
289 | #define GLUT_VISIBLE 1
290 |
291 | /* Window status state. */
292 | #define GLUT_HIDDEN 0
293 | #define GLUT_FULLY_RETAINED 1
294 | #define GLUT_PARTIALLY_RETAINED 2
295 | #define GLUT_FULLY_COVERED 3
296 |
297 | /* Color index component selection values. */
298 | #define GLUT_RED 0
299 | #define GLUT_GREEN 1
300 | #define GLUT_BLUE 2
301 |
302 | #if defined(_WIN32)
303 | /* Stroke font constants (use these in GLUT program). */
304 | #define GLUT_STROKE_ROMAN ((void*)0)
305 | #define GLUT_STROKE_MONO_ROMAN ((void*)1)
306 |
307 | /* Bitmap font constants (use these in GLUT program). */
308 | #define GLUT_BITMAP_9_BY_15 ((void*)2)
309 | #define GLUT_BITMAP_8_BY_13 ((void*)3)
310 | #define GLUT_BITMAP_TIMES_ROMAN_10 ((void*)4)
311 | #define GLUT_BITMAP_TIMES_ROMAN_24 ((void*)5)
312 | #if (GLUT_API_VERSION >= 3)
313 | #define GLUT_BITMAP_HELVETICA_10 ((void*)6)
314 | #define GLUT_BITMAP_HELVETICA_12 ((void*)7)
315 | #define GLUT_BITMAP_HELVETICA_18 ((void*)8)
316 | #endif
317 | #else
318 | /* Stroke font opaque addresses (use constants instead in source code). */
319 | GLUTAPI void *glutStrokeRoman;
320 | GLUTAPI void *glutStrokeMonoRoman;
321 |
322 | /* Stroke font constants (use these in GLUT program). */
323 | #define GLUT_STROKE_ROMAN (&glutStrokeRoman)
324 | #define GLUT_STROKE_MONO_ROMAN (&glutStrokeMonoRoman)
325 |
326 | /* Bitmap font opaque addresses (use constants instead in source code). */
327 | GLUTAPI void *glutBitmap9By15;
328 | GLUTAPI void *glutBitmap8By13;
329 | GLUTAPI void *glutBitmapTimesRoman10;
330 | GLUTAPI void *glutBitmapTimesRoman24;
331 | GLUTAPI void *glutBitmapHelvetica10;
332 | GLUTAPI void *glutBitmapHelvetica12;
333 | GLUTAPI void *glutBitmapHelvetica18;
334 |
335 | /* Bitmap font constants (use these in GLUT program). */
336 | #define GLUT_BITMAP_9_BY_15 (&glutBitmap9By15)
337 | #define GLUT_BITMAP_8_BY_13 (&glutBitmap8By13)
338 | #define GLUT_BITMAP_TIMES_ROMAN_10 (&glutBitmapTimesRoman10)
339 | #define GLUT_BITMAP_TIMES_ROMAN_24 (&glutBitmapTimesRoman24)
340 | #if (GLUT_API_VERSION >= 3)
341 | #define GLUT_BITMAP_HELVETICA_10 (&glutBitmapHelvetica10)
342 | #define GLUT_BITMAP_HELVETICA_12 (&glutBitmapHelvetica12)
343 | #define GLUT_BITMAP_HELVETICA_18 (&glutBitmapHelvetica18)
344 | #endif
345 | #endif
346 |
347 | /* glutGet parameters. */
348 | #define GLUT_WINDOW_X ((GLenum) 100)
349 | #define GLUT_WINDOW_Y ((GLenum) 101)
350 | #define GLUT_WINDOW_WIDTH ((GLenum) 102)
351 | #define GLUT_WINDOW_HEIGHT ((GLenum) 103)
352 | #define GLUT_WINDOW_BUFFER_SIZE ((GLenum) 104)
353 | #define GLUT_WINDOW_STENCIL_SIZE ((GLenum) 105)
354 | #define GLUT_WINDOW_DEPTH_SIZE ((GLenum) 106)
355 | #define GLUT_WINDOW_RED_SIZE ((GLenum) 107)
356 | #define GLUT_WINDOW_GREEN_SIZE ((GLenum) 108)
357 | #define GLUT_WINDOW_BLUE_SIZE ((GLenum) 109)
358 | #define GLUT_WINDOW_ALPHA_SIZE ((GLenum) 110)
359 | #define GLUT_WINDOW_ACCUM_RED_SIZE ((GLenum) 111)
360 | #define GLUT_WINDOW_ACCUM_GREEN_SIZE ((GLenum) 112)
361 | #define GLUT_WINDOW_ACCUM_BLUE_SIZE ((GLenum) 113)
362 | #define GLUT_WINDOW_ACCUM_ALPHA_SIZE ((GLenum) 114)
363 | #define GLUT_WINDOW_DOUBLEBUFFER ((GLenum) 115)
364 | #define GLUT_WINDOW_RGBA ((GLenum) 116)
365 | #define GLUT_WINDOW_PARENT ((GLenum) 117)
366 | #define GLUT_WINDOW_NUM_CHILDREN ((GLenum) 118)
367 | #define GLUT_WINDOW_COLORMAP_SIZE ((GLenum) 119)
368 | #if (GLUT_API_VERSION >= 2)
369 | #define GLUT_WINDOW_NUM_SAMPLES ((GLenum) 120)
370 | #define GLUT_WINDOW_STEREO ((GLenum) 121)
371 | #endif
372 | #if (GLUT_API_VERSION >= 3)
373 | #define GLUT_WINDOW_CURSOR ((GLenum) 122)
374 | #endif
375 | #define GLUT_SCREEN_WIDTH ((GLenum) 200)
376 | #define GLUT_SCREEN_HEIGHT ((GLenum) 201)
377 | #define GLUT_SCREEN_WIDTH_MM ((GLenum) 202)
378 | #define GLUT_SCREEN_HEIGHT_MM ((GLenum) 203)
379 | #define GLUT_MENU_NUM_ITEMS ((GLenum) 300)
380 | #define GLUT_DISPLAY_MODE_POSSIBLE ((GLenum) 400)
381 | #define GLUT_INIT_WINDOW_X ((GLenum) 500)
382 | #define GLUT_INIT_WINDOW_Y ((GLenum) 501)
383 | #define GLUT_INIT_WINDOW_WIDTH ((GLenum) 502)
384 | #define GLUT_INIT_WINDOW_HEIGHT ((GLenum) 503)
385 | #define GLUT_INIT_DISPLAY_MODE ((GLenum) 504)
386 | #if (GLUT_API_VERSION >= 2)
387 | #define GLUT_ELAPSED_TIME ((GLenum) 700)
388 | #endif
389 | #if (GLUT_API_VERSION >= 4 || GLUT_XLIB_IMPLEMENTATION >= 13)
390 | #define GLUT_WINDOW_FORMAT_ID ((GLenum) 123)
391 | #endif
392 |
393 | #if (GLUT_API_VERSION >= 2)
394 | /* glutDeviceGet parameters. */
395 | #define GLUT_HAS_KEYBOARD ((GLenum) 600)
396 | #define GLUT_HAS_MOUSE ((GLenum) 601)
397 | #define GLUT_HAS_SPACEBALL ((GLenum) 602)
398 | #define GLUT_HAS_DIAL_AND_BUTTON_BOX ((GLenum) 603)
399 | #define GLUT_HAS_TABLET ((GLenum) 604)
400 | #define GLUT_NUM_MOUSE_BUTTONS ((GLenum) 605)
401 | #define GLUT_NUM_SPACEBALL_BUTTONS ((GLenum) 606)
402 | #define GLUT_NUM_BUTTON_BOX_BUTTONS ((GLenum) 607)
403 | #define GLUT_NUM_DIALS ((GLenum) 608)
404 | #define GLUT_NUM_TABLET_BUTTONS ((GLenum) 609)
405 | #endif
406 | #if (GLUT_API_VERSION >= 4 || GLUT_XLIB_IMPLEMENTATION >= 13)
407 | #define GLUT_DEVICE_IGNORE_KEY_REPEAT ((GLenum) 610)
408 | #define GLUT_DEVICE_KEY_REPEAT ((GLenum) 611)
409 | #define GLUT_HAS_JOYSTICK ((GLenum) 612)
410 | #define GLUT_OWNS_JOYSTICK ((GLenum) 613)
411 | #define GLUT_JOYSTICK_BUTTONS ((GLenum) 614)
412 | #define GLUT_JOYSTICK_AXES ((GLenum) 615)
413 | #define GLUT_JOYSTICK_POLL_RATE ((GLenum) 616)
414 | #endif
415 |
416 | #if (GLUT_API_VERSION >= 3)
417 | /* glutLayerGet parameters. */
418 | #define GLUT_OVERLAY_POSSIBLE ((GLenum) 800)
419 | #define GLUT_LAYER_IN_USE ((GLenum) 801)
420 | #define GLUT_HAS_OVERLAY ((GLenum) 802)
421 | #define GLUT_TRANSPARENT_INDEX ((GLenum) 803)
422 | #define GLUT_NORMAL_DAMAGED ((GLenum) 804)
423 | #define GLUT_OVERLAY_DAMAGED ((GLenum) 805)
424 |
425 | #if (GLUT_API_VERSION >= 4 || GLUT_XLIB_IMPLEMENTATION >= 9)
426 | /* glutVideoResizeGet parameters. */
427 | #define GLUT_VIDEO_RESIZE_POSSIBLE ((GLenum) 900)
428 | #define GLUT_VIDEO_RESIZE_IN_USE ((GLenum) 901)
429 | #define GLUT_VIDEO_RESIZE_X_DELTA ((GLenum) 902)
430 | #define GLUT_VIDEO_RESIZE_Y_DELTA ((GLenum) 903)
431 | #define GLUT_VIDEO_RESIZE_WIDTH_DELTA ((GLenum) 904)
432 | #define GLUT_VIDEO_RESIZE_HEIGHT_DELTA ((GLenum) 905)
433 | #define GLUT_VIDEO_RESIZE_X ((GLenum) 906)
434 | #define GLUT_VIDEO_RESIZE_Y ((GLenum) 907)
435 | #define GLUT_VIDEO_RESIZE_WIDTH ((GLenum) 908)
436 | #define GLUT_VIDEO_RESIZE_HEIGHT ((GLenum) 909)
437 | #endif
438 |
439 | /* glutUseLayer parameters. */
440 | #define GLUT_NORMAL ((GLenum) 0)
441 | #define GLUT_OVERLAY ((GLenum) 1)
442 |
443 | /* glutGetModifiers return mask. */
444 | #define GLUT_ACTIVE_SHIFT 1
445 | #define GLUT_ACTIVE_CTRL 2
446 | #define GLUT_ACTIVE_ALT 4
447 |
448 | /* glutSetCursor parameters. */
449 | /* Basic arrows. */
450 | #define GLUT_CURSOR_RIGHT_ARROW 0
451 | #define GLUT_CURSOR_LEFT_ARROW 1
452 | /* Symbolic cursor shapes. */
453 | #define GLUT_CURSOR_INFO 2
454 | #define GLUT_CURSOR_DESTROY 3
455 | #define GLUT_CURSOR_HELP 4
456 | #define GLUT_CURSOR_CYCLE 5
457 | #define GLUT_CURSOR_SPRAY 6
458 | #define GLUT_CURSOR_WAIT 7
459 | #define GLUT_CURSOR_TEXT 8
460 | #define GLUT_CURSOR_CROSSHAIR 9
461 | /* Directional cursors. */
462 | #define GLUT_CURSOR_UP_DOWN 10
463 | #define GLUT_CURSOR_LEFT_RIGHT 11
464 | /* Sizing cursors. */
465 | #define GLUT_CURSOR_TOP_SIDE 12
466 | #define GLUT_CURSOR_BOTTOM_SIDE 13
467 | #define GLUT_CURSOR_LEFT_SIDE 14
468 | #define GLUT_CURSOR_RIGHT_SIDE 15
469 | #define GLUT_CURSOR_TOP_LEFT_CORNER 16
470 | #define GLUT_CURSOR_TOP_RIGHT_CORNER 17
471 | #define GLUT_CURSOR_BOTTOM_RIGHT_CORNER 18
472 | #define GLUT_CURSOR_BOTTOM_LEFT_CORNER 19
473 | /* Inherit from parent window. */
474 | #define GLUT_CURSOR_INHERIT 100
475 | /* Blank cursor. */
476 | #define GLUT_CURSOR_NONE 101
477 | /* Fullscreen crosshair (if available). */
478 | #define GLUT_CURSOR_FULL_CROSSHAIR 102
479 | #endif
480 |
481 | /* GLUT initialization sub-API. */
482 | GLUTAPI void APIENTRY glutInit(int *argcp, char **argv);
483 | #if defined(_WIN32) && !defined(GLUT_DISABLE_ATEXIT_HACK)
484 | GLUTAPI void APIENTRY __glutInitWithExit(int *argcp, char **argv, void (__cdecl *exitfunc)(int));
485 | #ifndef GLUT_BUILDING_LIB
486 | static void APIENTRY glutInit_ATEXIT_HACK(int *argcp, char **argv) { __glutInitWithExit(argcp, argv, exit); }
487 | #define glutInit glutInit_ATEXIT_HACK
488 | #endif
489 | #endif
490 | GLUTAPI void APIENTRY glutInitDisplayMode(unsigned int mode);
491 | #if (GLUT_API_VERSION >= 4 || GLUT_XLIB_IMPLEMENTATION >= 9)
492 | GLUTAPI void APIENTRY glutInitDisplayString(const char *string);
493 | #endif
494 | GLUTAPI void APIENTRY glutInitWindowPosition(int x, int y);
495 | GLUTAPI void APIENTRY glutInitWindowSize(int width, int height);
496 | GLUTAPI void APIENTRY glutMainLoop(void);
497 |
498 | /* GLUT window sub-API. */
499 | GLUTAPI int APIENTRY glutCreateWindow(const char *title);
500 | #if defined(_WIN32) && !defined(GLUT_DISABLE_ATEXIT_HACK)
501 | GLUTAPI int APIENTRY __glutCreateWindowWithExit(const char *title, void (__cdecl *exitfunc)(int));
502 | #ifndef GLUT_BUILDING_LIB
503 | static int APIENTRY glutCreateWindow_ATEXIT_HACK(const char *title) { return __glutCreateWindowWithExit(title, exit); }
504 | #define glutCreateWindow glutCreateWindow_ATEXIT_HACK
505 | #endif
506 | #endif
507 | GLUTAPI int APIENTRY glutCreateSubWindow(int win, int x, int y, int width, int height);
508 | GLUTAPI void APIENTRY glutDestroyWindow(int win);
509 | GLUTAPI void APIENTRY glutPostRedisplay(void);
510 | #if (GLUT_API_VERSION >= 4 || GLUT_XLIB_IMPLEMENTATION >= 11)
511 | GLUTAPI void APIENTRY glutPostWindowRedisplay(int win);
512 | #endif
513 | GLUTAPI void APIENTRY glutSwapBuffers(void);
514 | GLUTAPI int APIENTRY glutGetWindow(void);
515 | GLUTAPI void APIENTRY glutSetWindow(int win);
516 | GLUTAPI void APIENTRY glutSetWindowTitle(const char *title);
517 | GLUTAPI void APIENTRY glutSetIconTitle(const char *title);
518 | GLUTAPI void APIENTRY glutPositionWindow(int x, int y);
519 | GLUTAPI void APIENTRY glutReshapeWindow(int width, int height);
520 | GLUTAPI void APIENTRY glutPopWindow(void);
521 | GLUTAPI void APIENTRY glutPushWindow(void);
522 | GLUTAPI void APIENTRY glutIconifyWindow(void);
523 | GLUTAPI void APIENTRY glutShowWindow(void);
524 | GLUTAPI void APIENTRY glutHideWindow(void);
525 | #if (GLUT_API_VERSION >= 3)
526 | GLUTAPI void APIENTRY glutFullScreen(void);
527 | GLUTAPI void APIENTRY glutSetCursor(int cursor);
528 | #if (GLUT_API_VERSION >= 4 || GLUT_XLIB_IMPLEMENTATION >= 9)
529 | GLUTAPI void APIENTRY glutWarpPointer(int x, int y);
530 | #endif
531 |
532 | /* GLUT overlay sub-API. */
533 | GLUTAPI void APIENTRY glutEstablishOverlay(void);
534 | GLUTAPI void APIENTRY glutRemoveOverlay(void);
535 | GLUTAPI void APIENTRY glutUseLayer(GLenum layer);
536 | GLUTAPI void APIENTRY glutPostOverlayRedisplay(void);
537 | #if (GLUT_API_VERSION >= 4 || GLUT_XLIB_IMPLEMENTATION >= 11)
538 | GLUTAPI void APIENTRY glutPostWindowOverlayRedisplay(int win);
539 | #endif
540 | GLUTAPI void APIENTRY glutShowOverlay(void);
541 | GLUTAPI void APIENTRY glutHideOverlay(void);
542 | #endif
543 |
544 | /* GLUT menu sub-API. */
545 | GLUTAPI int APIENTRY glutCreateMenu(void (GLUTCALLBACK *func)(int));
546 | #if defined(_WIN32) && !defined(GLUT_DISABLE_ATEXIT_HACK)
547 | GLUTAPI int APIENTRY __glutCreateMenuWithExit(void (GLUTCALLBACK *func)(int), void (__cdecl *exitfunc)(int));
548 | #ifndef GLUT_BUILDING_LIB
549 | static int APIENTRY glutCreateMenu_ATEXIT_HACK(void (GLUTCALLBACK *func)(int)) { return __glutCreateMenuWithExit(func, exit); }
550 | #define glutCreateMenu glutCreateMenu_ATEXIT_HACK
551 | #endif
552 | #endif
553 | GLUTAPI void APIENTRY glutDestroyMenu(int menu);
554 | GLUTAPI int APIENTRY glutGetMenu(void);
555 | GLUTAPI void APIENTRY glutSetMenu(int menu);
556 | GLUTAPI void APIENTRY glutAddMenuEntry(const char *label, int value);
557 | GLUTAPI void APIENTRY glutAddSubMenu(const char *label, int submenu);
558 | GLUTAPI void APIENTRY glutChangeToMenuEntry(int item, const char *label, int value);
559 | GLUTAPI void APIENTRY glutChangeToSubMenu(int item, const char *label, int submenu);
560 | GLUTAPI void APIENTRY glutRemoveMenuItem(int item);
561 | GLUTAPI void APIENTRY glutAttachMenu(int button);
562 | GLUTAPI void APIENTRY glutDetachMenu(int button);
563 |
564 | /* GLUT window callback sub-API. */
565 | GLUTAPI void APIENTRY glutDisplayFunc(void (GLUTCALLBACK *func)(void));
566 | GLUTAPI void APIENTRY glutReshapeFunc(void (GLUTCALLBACK *func)(int width, int height));
567 | GLUTAPI void APIENTRY glutKeyboardFunc(void (GLUTCALLBACK *func)(unsigned char key, int x, int y));
568 | GLUTAPI void APIENTRY glutMouseFunc(void (GLUTCALLBACK *func)(int button, int state, int x, int y));
569 | GLUTAPI void APIENTRY glutMotionFunc(void (GLUTCALLBACK *func)(int x, int y));
570 | GLUTAPI void APIENTRY glutPassiveMotionFunc(void (GLUTCALLBACK *func)(int x, int y));
571 | GLUTAPI void APIENTRY glutEntryFunc(void (GLUTCALLBACK *func)(int state));
572 | GLUTAPI void APIENTRY glutVisibilityFunc(void (GLUTCALLBACK *func)(int state));
573 | GLUTAPI void APIENTRY glutIdleFunc(void (GLUTCALLBACK *func)(void));
574 | GLUTAPI void APIENTRY glutTimerFunc(unsigned int millis, void (GLUTCALLBACK *func)(int value), int value);
575 | GLUTAPI void APIENTRY glutMenuStateFunc(void (GLUTCALLBACK *func)(int state));
576 | #if (GLUT_API_VERSION >= 2)
577 | GLUTAPI void APIENTRY glutSpecialFunc(void (GLUTCALLBACK *func)(int key, int x, int y));
578 | GLUTAPI void APIENTRY glutSpaceballMotionFunc(void (GLUTCALLBACK *func)(int x, int y, int z));
579 | GLUTAPI void APIENTRY glutSpaceballRotateFunc(void (GLUTCALLBACK *func)(int x, int y, int z));
580 | GLUTAPI void APIENTRY glutSpaceballButtonFunc(void (GLUTCALLBACK *func)(int button, int state));
581 | GLUTAPI void APIENTRY glutButtonBoxFunc(void (GLUTCALLBACK *func)(int button, int state));
582 | GLUTAPI void APIENTRY glutDialsFunc(void (GLUTCALLBACK *func)(int dial, int value));
583 | GLUTAPI void APIENTRY glutTabletMotionFunc(void (GLUTCALLBACK *func)(int x, int y));
584 | GLUTAPI void APIENTRY glutTabletButtonFunc(void (GLUTCALLBACK *func)(int button, int state, int x, int y));
585 | #if (GLUT_API_VERSION >= 3)
586 | GLUTAPI void APIENTRY glutMenuStatusFunc(void (GLUTCALLBACK *func)(int status, int x, int y));
587 | GLUTAPI void APIENTRY glutOverlayDisplayFunc(void (GLUTCALLBACK *func)(void));
588 | #if (GLUT_API_VERSION >= 4 || GLUT_XLIB_IMPLEMENTATION >= 9)
589 | GLUTAPI void APIENTRY glutWindowStatusFunc(void (GLUTCALLBACK *func)(int state));
590 | #endif
591 | #if (GLUT_API_VERSION >= 4 || GLUT_XLIB_IMPLEMENTATION >= 13)
592 | GLUTAPI void APIENTRY glutKeyboardUpFunc(void (GLUTCALLBACK *func)(unsigned char key, int x, int y));
593 | GLUTAPI void APIENTRY glutSpecialUpFunc(void (GLUTCALLBACK *func)(int key, int x, int y));
594 | GLUTAPI void APIENTRY glutJoystickFunc(void (GLUTCALLBACK *func)(unsigned int buttonMask, int x, int y, int z), int pollInterval);
595 | #endif
596 | #endif
597 | #endif
598 |
599 | /* GLUT color index sub-API. */
600 | GLUTAPI void APIENTRY glutSetColor(int, GLfloat red, GLfloat green, GLfloat blue);
601 | GLUTAPI GLfloat APIENTRY glutGetColor(int ndx, int component);
602 | GLUTAPI void APIENTRY glutCopyColormap(int win);
603 |
604 | /* GLUT state retrieval sub-API. */
605 | GLUTAPI int APIENTRY glutGet(GLenum type);
606 | GLUTAPI int APIENTRY glutDeviceGet(GLenum type);
607 | #if (GLUT_API_VERSION >= 2)
608 | /* GLUT extension support sub-API */
609 | GLUTAPI int APIENTRY glutExtensionSupported(const char *name);
610 | #endif
611 | #if (GLUT_API_VERSION >= 3)
612 | GLUTAPI int APIENTRY glutGetModifiers(void);
613 | GLUTAPI int APIENTRY glutLayerGet(GLenum type);
614 | #endif
615 |
616 | /* GLUT font sub-API */
617 | GLUTAPI void APIENTRY glutBitmapCharacter(void *font, int character);
618 | GLUTAPI int APIENTRY glutBitmapWidth(void *font, int character);
619 | GLUTAPI void APIENTRY glutStrokeCharacter(void *font, int character);
620 | GLUTAPI int APIENTRY glutStrokeWidth(void *font, int character);
621 | #if (GLUT_API_VERSION >= 4 || GLUT_XLIB_IMPLEMENTATION >= 9)
622 | GLUTAPI int APIENTRY glutBitmapLength(void *font, const unsigned char *string);
623 | GLUTAPI int APIENTRY glutStrokeLength(void *font, const unsigned char *string);
624 | #endif
625 |
626 | /* GLUT pre-built models sub-API */
627 | GLUTAPI void APIENTRY glutWireSphere(GLdouble radius, GLint slices, GLint stacks);
628 | GLUTAPI void APIENTRY glutSolidSphere(GLdouble radius, GLint slices, GLint stacks);
629 | GLUTAPI void APIENTRY glutWireCone(GLdouble base, GLdouble height, GLint slices, GLint stacks);
630 | GLUTAPI void APIENTRY glutSolidCone(GLdouble base, GLdouble height, GLint slices, GLint stacks);
631 | GLUTAPI void APIENTRY glutWireCube(GLdouble size);
632 | GLUTAPI void APIENTRY glutSolidCube(GLdouble size);
633 | GLUTAPI void APIENTRY glutWireTorus(GLdouble innerRadius, GLdouble outerRadius, GLint sides, GLint rings);
634 | GLUTAPI void APIENTRY glutSolidTorus(GLdouble innerRadius, GLdouble outerRadius, GLint sides, GLint rings);
635 | GLUTAPI void APIENTRY glutWireDodecahedron(void);
636 | GLUTAPI void APIENTRY glutSolidDodecahedron(void);
637 | GLUTAPI void APIENTRY glutWireTeapot(GLdouble size);
638 | GLUTAPI void APIENTRY glutSolidTeapot(GLdouble size);
639 | GLUTAPI void APIENTRY glutWireOctahedron(void);
640 | GLUTAPI void APIENTRY glutSolidOctahedron(void);
641 | GLUTAPI void APIENTRY glutWireTetrahedron(void);
642 | GLUTAPI void APIENTRY glutSolidTetrahedron(void);
643 | GLUTAPI void APIENTRY glutWireIcosahedron(void);
644 | GLUTAPI void APIENTRY glutSolidIcosahedron(void);
645 |
646 | #if (GLUT_API_VERSION >= 4 || GLUT_XLIB_IMPLEMENTATION >= 9)
647 | /* GLUT video resize sub-API. */
648 | GLUTAPI int APIENTRY glutVideoResizeGet(GLenum param);
649 | GLUTAPI void APIENTRY glutSetupVideoResizing(void);
650 | GLUTAPI void APIENTRY glutStopVideoResizing(void);
651 | GLUTAPI void APIENTRY glutVideoResize(int x, int y, int width, int height);
652 | GLUTAPI void APIENTRY glutVideoPan(int x, int y, int width, int height);
653 |
654 | /* GLUT debugging sub-API. */
655 | GLUTAPI void APIENTRY glutReportErrors(void);
656 | #endif
657 |
658 | #if (GLUT_API_VERSION >= 4 || GLUT_XLIB_IMPLEMENTATION >= 13)
659 | /* GLUT device control sub-API. */
660 | /* glutSetKeyRepeat modes. */
661 | #define GLUT_KEY_REPEAT_OFF 0
662 | #define GLUT_KEY_REPEAT_ON 1
663 | #define GLUT_KEY_REPEAT_DEFAULT 2
664 |
665 | /* Joystick button masks. */
666 | #define GLUT_JOYSTICK_BUTTON_A 1
667 | #define GLUT_JOYSTICK_BUTTON_B 2
668 | #define GLUT_JOYSTICK_BUTTON_C 4
669 | #define GLUT_JOYSTICK_BUTTON_D 8
670 |
671 | GLUTAPI void APIENTRY glutIgnoreKeyRepeat(int ignore);
672 | GLUTAPI void APIENTRY glutSetKeyRepeat(int repeatMode);
673 | GLUTAPI void APIENTRY glutForceJoystickFunc(void);
674 |
675 | /* GLUT game mode sub-API. */
676 | /* glutGameModeGet. */
677 | #define GLUT_GAME_MODE_ACTIVE ((GLenum) 0)
678 | #define GLUT_GAME_MODE_POSSIBLE ((GLenum) 1)
679 | #define GLUT_GAME_MODE_WIDTH ((GLenum) 2)
680 | #define GLUT_GAME_MODE_HEIGHT ((GLenum) 3)
681 | #define GLUT_GAME_MODE_PIXEL_DEPTH ((GLenum) 4)
682 | #define GLUT_GAME_MODE_REFRESH_RATE ((GLenum) 5)
683 | #define GLUT_GAME_MODE_DISPLAY_CHANGED ((GLenum) 6)
684 |
685 | GLUTAPI void APIENTRY glutGameModeString(const char *string);
686 | GLUTAPI int APIENTRY glutEnterGameMode(void);
687 | GLUTAPI void APIENTRY glutLeaveGameMode(void);
688 | GLUTAPI int APIENTRY glutGameModeGet(GLenum mode);
689 | #endif
690 |
691 | #ifdef __cplusplus
692 | }
693 |
694 | #endif
695 |
696 | #ifdef GLUT_APIENTRY_DEFINED
697 | # undef GLUT_APIENTRY_DEFINED
698 | # undef APIENTRY
699 | #endif
700 |
701 | #ifdef GLUT_WINGDIAPI_DEFINED
702 | # undef GLUT_WINGDIAPI_DEFINED
703 | # undef WINGDIAPI
704 | #endif
705 |
706 | #ifdef GLUT_DEFINED___CDECL
707 | # undef GLUT_DEFINED___CDECL
708 | # undef __cdecl
709 | #endif
710 |
711 | #ifdef GLUT_DEFINED__CRTIMP
712 | # undef GLUT_DEFINED__CRTIMP
713 | # undef _CRTIMP
714 | #endif
715 |
716 | #endif /* __glut_h__ */
717 |
--------------------------------------------------------------------------------
/CrowdNavigation/GL/glut32.dll:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Flians/PathTracking/d4a799bafc5a49cbb280f18da663648571d79838/CrowdNavigation/GL/glut32.dll
--------------------------------------------------------------------------------
/CrowdNavigation/GL/glut32.lib:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Flians/PathTracking/d4a799bafc5a49cbb280f18da663648571d79838/CrowdNavigation/GL/glut32.lib
--------------------------------------------------------------------------------
/CrowdNavigation/PathFinding.cpp:
--------------------------------------------------------------------------------
1 | #include "PathFinding.h"
2 |
3 | SGridInfo **gMap = NULL;
4 |
5 | float gCurWinWidth = WINDOW_WIDTH;
6 | float gCurWinHeight = WINDOW_HEIGHT;
7 | int gClickDownX = -1;
8 | int gClickDownY = -1;
9 | SCoordinate gDest(0, 0);
10 | SMoveObject gObjectPosition[MOVE_OBJECT_NUM];
11 |
12 | void SetObstocle(int x, int y)
13 | {
14 | if (x < 0 || y < 0 || x >= WORLD_WIDTH / GRID_SIZE || y >= WORLD_HEIGHT / GRID_SIZE)
15 | {
16 | return;
17 | }
18 | gMap[x][y].c = INFI;
19 | gMap[x][y].d = ED_NULL;
20 | gMap[x][y].t = EGT_OBSTOCLE;
21 | }
22 | void SetDestination(const SCoordinate &d)
23 | {
24 | if (d.x < 0 || d.y < 0 || d.x >= WORLD_WIDTH / GRID_SIZE || d.y >= WORLD_HEIGHT / GRID_SIZE)
25 | {
26 | return;
27 | }
28 | gMap[gDest.x][gDest.y].t = EGT_NORMAL;
29 | gMap[gDest.x][gDest.y].pl = 0;
30 | gMap[d.x][d.y].d = ED_NULL;
31 | gMap[d.x][d.y].t = EGT_DESTINATION;
32 | gDest = d;
33 | }
34 | void RecoverGridType()
35 | {
36 | for (int x = 0; x < WORLD_WIDTH / GRID_SIZE; ++x)
37 | {
38 | for (int y = 0; y < WORLD_HEIGHT / GRID_SIZE; ++y)
39 | {
40 | if (EGT_DESTINATION != gMap[x][y].t && EGT_OBSTOCLE != gMap[x][y].t)
41 | {
42 | gMap[x][y].pl = INFI;
43 | gMap[x][y].t = EGT_NORMAL;
44 | }
45 | }
46 | }
47 | gMap[gDest.x][gDest.y].pl = 0;
48 | }
49 |
50 | string Num2String(int i)
51 | {
52 | stringstream ss;
53 | ss << i;
54 | return ss.str();
55 | }
56 | void DrawString(const string &strn)
57 | {
58 | static int isFirstCall = 1;
59 | static GLuint lists;
60 | const char *str = strn.c_str();
61 | if (isFirstCall)
62 | {
63 | isFirstCall = 0;
64 | lists = glGenLists(MAX_CHAR);
65 | wglUseFontBitmaps(wglGetCurrentDC(), 0, MAX_CHAR, lists);
66 | }
67 | for (; *str != '\0'; ++str)
68 | glCallList(lists + *str);
69 | }
70 | SPoint Index2World(const SCoordinate &idx)
71 | {
72 | float x = idx.x * GRID_SIZE + GRID_SIZE / 2;
73 | float y = idx.y * GRID_SIZE + GRID_SIZE / 2;
74 | x = min(x, WORLD_WIDTH);
75 | x = max(x, 0.0f);
76 | y = min(y, WORLD_HEIGHT);
77 | y = max(y, 0.0f);
78 |
79 | return SPoint(x, y);
80 | }
81 | SPoint Pixel2World(const SPoint &pixel)
82 | {
83 | float x = pixel.x / gCurWinWidth * WORLD_WIDTH;
84 | float y = pixel.y / gCurWinHeight * WORLD_HEIGHT;
85 | x = min(x, WORLD_WIDTH);
86 | x = max(x, 0.0f);
87 | y = min(y, WORLD_HEIGHT);
88 | y = max(y, 0.0f);
89 | y = abs(y - WORLD_HEIGHT);
90 |
91 | return SPoint(x, y);
92 | }
93 | SCoordinate World2Index(const SPoint &p)
94 | {
95 | int x = p.x / GRID_SIZE;
96 | int y = p.y / GRID_SIZE;
97 | x = min(x, int(WORLD_WIDTH / GRID_SIZE) - 1);
98 | x = max(x, 0);
99 | y = min(y, int(WORLD_HEIGHT / GRID_SIZE) - 1);
100 | y = max(y, 0);
101 |
102 | return SCoordinate(x, y);
103 | }
104 |
105 | void InitMap(int hGridNum, int vGridNum)
106 | {
107 | srand((unsigned)time(NULL));
108 | if (NULL == gMap)
109 | {
110 | gMap = new SGridInfo *[hGridNum];
111 | for (int x = 0; x < hGridNum; ++x)
112 | {
113 | gMap[x] = new SGridInfo[vGridNum];
114 | for (int y = 0; y < vGridNum; ++y)
115 | {
116 | gMap[x][y].d = ED_D;
117 | gMap[x][y].c = 20;
118 | }
119 | }
120 |
121 | for (int x = hGridNum / 5; x <= hGridNum * 4 / 5; ++x)
122 | {
123 | if (x % 4 == 2)
124 | {
125 | for (int y = vGridNum / 4; y <= vGridNum * 3 / 4; ++y)
126 | {
127 | if (y % 4 == 2)
128 | {
129 | SetObstocle(x, y);
130 | SetObstocle(x, y + 1);
131 | SetObstocle(x + 1, y);
132 | SetObstocle(x + 1, y + 1);
133 | }
134 | }
135 | }
136 | }
137 |
138 | SetDestination(gDest);
139 | CalcFlowField(gDest, hGridNum, vGridNum);
140 | InitMoveObject();
141 | }
142 | }
143 | void InitMoveObject()
144 | {
145 | for (int i = 0; i < MOVE_OBJECT_NUM; ++i)
146 | {
147 | SCoordinate tmp;
148 | do
149 | {
150 | gObjectPosition[i].p.x = rand() % (int)WORLD_WIDTH;
151 | gObjectPosition[i].p.y = rand() % (int)WORLD_HEIGHT;
152 | gObjectPosition[i].s = rand() % 10 + 5;
153 | tmp = World2Index(gObjectPosition[i].p);
154 | } while (gMap[tmp.x][tmp.y].t == EGT_OBSTOCLE);
155 | }
156 | }
157 | void ReleaseMap(int hGridNum)
158 | {
159 | if (NULL != gMap)
160 | {
161 | for (int i = 0; i < hGridNum; ++i)
162 | {
163 | delete[] gMap[i];
164 | }
165 | delete[] gMap;
166 | gMap = NULL;
167 | }
168 | }
169 | void PathFindDisplay()
170 | {
171 | int hGridNum = WORLD_WIDTH / GRID_SIZE;
172 | int vGridNum = WORLD_HEIGHT / GRID_SIZE;
173 |
174 | InitMap(hGridNum, vGridNum);
175 | glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
176 | glMatrixMode(GL_PROJECTION);
177 | DrawMap(hGridNum, vGridNum);
178 | DrawObstacle(hGridNum, vGridNum);
179 | DrawDestination(Index2World(gDest));
180 | DrawFlowField(hGridNum, vGridNum);
181 | DrawMoveObject(hGridNum, vGridNum);
182 | glFlush();
183 | glutSwapBuffers();
184 | }
185 |
186 | void DrawMap(int hGridNum, int vGridNum)
187 | {
188 | glClear(GL_COLOR_BUFFER_BIT);
189 | glColor3f(0.5f, 0.9f, 0.89f);
190 |
191 | GLfloat lineWidth = 0.5f;
192 | GLfloat xCoor = 0.0f;
193 | GLfloat yCoor = 0.0f;
194 | glLineWidth(lineWidth);
195 | glPolygonMode(GL_FRONT_AND_BACK, GL_LINE);
196 | glBegin(GL_QUADS);
197 | for (int x = 0; x < hGridNum; ++x)
198 | {
199 | for (int y = 0; y < vGridNum; ++y)
200 | {
201 | glVertex2f(xCoor, yCoor);
202 | glVertex2f(xCoor + GRID_SIZE, yCoor);
203 | glVertex2f(xCoor + GRID_SIZE, yCoor + GRID_SIZE);
204 | glVertex2f(xCoor, yCoor + GRID_SIZE);
205 | yCoor += GRID_SIZE;
206 | }
207 | xCoor += GRID_SIZE;
208 | yCoor = 0.0f;
209 | }
210 | glEnd();
211 | }
212 | void DrawObstacle(int hGridNum, int vGridNum)
213 | {
214 | for (int x = 0; x < hGridNum; ++x)
215 | {
216 | for (int y = 0; y < vGridNum; ++y)
217 | {
218 | if (gMap[x][y].c == INFI)
219 | {
220 | DrawLineSurroundQuads(SCoordinate(x, y));
221 | }
222 | }
223 | }
224 | }
225 | void DrawDestination(const SPoint &dIdx)
226 | {
227 | DrawPoint(dIdx, 7, SColorRGB(0.0f, 0.0f, 1.0f));
228 | }
229 | void DrawFlowField(int hGridNum, int vGridNum)
230 | {
231 | for (int x = 0; x < hGridNum; ++x)
232 | {
233 | for (int y = 0; y < vGridNum; ++y)
234 | {
235 | SPoint sp = Index2World(SCoordinate(x, y));
236 | switch (gMap[x][y].d)
237 | {
238 | case ED_U:
239 | DrawArraw(sp, SPoint(sp.x, sp.y + GRID_SIZE / 2));
240 | break;
241 | case ED_D:
242 | DrawArraw(sp, SPoint(sp.x, sp.y - GRID_SIZE / 2));
243 | break;
244 | case ED_L:
245 | DrawArraw(sp, SPoint(sp.x - GRID_SIZE / 2, sp.y));
246 | break;
247 | case ED_R:
248 | DrawArraw(sp, SPoint(sp.x + GRID_SIZE / 2, sp.y));
249 | break;
250 | case ED_UL:
251 | DrawArraw(sp, SPoint(sp.x - GRID_SIZE / 2, sp.y + GRID_SIZE / 2));
252 | break;
253 | case ED_UR:
254 | DrawArraw(sp, SPoint(sp.x + GRID_SIZE / 2, sp.y + GRID_SIZE / 2));
255 | break;
256 | case ED_DL:
257 | DrawArraw(sp, SPoint(sp.x - GRID_SIZE / 2, sp.y - GRID_SIZE / 2));
258 | break;
259 | case ED_DR:
260 | DrawArraw(sp, SPoint(sp.x + GRID_SIZE / 2, sp.y - GRID_SIZE / 2));
261 | break;
262 | default:
263 | break;
264 | }
265 | }
266 | }
267 | }
268 | void DrawMoveObject(int hGridNum, int vGridNum)
269 | {
270 | for (int i = 0; i < MOVE_OBJECT_NUM; ++i)
271 | {
272 | DrawPoint(gObjectPosition[i].p, 4, SColorRGB(0.0f, 1.0f, 1.0f));
273 | }
274 | }
275 |
276 | void DrawQuads(const SPoint &ldp, const SPoint &urp, const SColorRGB &c, int mode)
277 | {
278 | glColor3f(c.r, c.g, c.b);
279 | glLineWidth(1.0f);
280 | glPolygonMode(GL_FRONT_AND_BACK, mode);
281 | glBegin(GL_QUADS);
282 | glVertex2f(ldp.x, ldp.y);
283 | glVertex2f(ldp.x, urp.y);
284 | glVertex2f(urp.x, urp.y);
285 | glVertex2f(urp.x, ldp.y);
286 | glEnd();
287 | }
288 | void DrawLineSurroundQuads(const SCoordinate &idx)
289 | {
290 | if (idx.x < 0 || idx.y < 0)
291 | {
292 | return;
293 | }
294 | int x = idx.x * GRID_SIZE;
295 | int y = idx.y * GRID_SIZE;
296 |
297 | DrawQuads(SPoint(x, y), SPoint(x + GRID_SIZE, y + GRID_SIZE),
298 | SColorRGB(1.0f, 0.0f, 0.0f), GL_FILL);
299 |
300 | DrawQuads(SPoint(x, y), SPoint(x + GRID_SIZE, y + GRID_SIZE),
301 | SColorRGB(0.0f, 0.0f, 0.0f), GL_LINE);
302 | }
303 | void DrawPoint(const SPoint &p, GLint size, const SColorRGB &c)
304 | {
305 | glColor3f(c.r, c.g, c.b);
306 | glPointSize(size);
307 | glBegin(GL_POINTS);
308 | glVertex2f(p.x, p.y);
309 | glEnd();
310 | }
311 | void DrawArraw(const SPoint &sp, const SPoint &ep)
312 | {
313 | DrawPoint(sp, 2, SColorRGB(0.5f, 0.1f, 0.3f));
314 |
315 | glColor3f(0.5f, 0.5f, 0.5f);
316 | glLineWidth(1.0f);
317 | glBegin(GL_LINES);
318 | glVertex2f(sp.x, sp.y);
319 | glVertex2f(ep.x, ep.y);
320 | glEnd();
321 | }
322 |
323 | void TimeerFunc(int value)
324 | {
325 | ChangeObjectPosition();
326 | PathFindDisplay();
327 | glutTimerFunc(40, TimeerFunc, 1);
328 | }
329 | void MouseClick(int button, int state, int x, int y)
330 | {
331 | if (button == GLUT_LEFT_BUTTON)
332 | {
333 | SCoordinate ci;
334 | static SPoint cp;
335 | switch (state)
336 | {
337 | case GLUT_DOWN:
338 | {
339 | gClickDownX = cp.x = x;
340 | gClickDownY = cp.y = y;
341 | #if MYDEBUG
342 | ci = World2Index(Pixel2World(SPoint(x, y)));
343 | printf("Mouse clicked down point (%d,%d):(%d,%d)\n", x, y, ci.x, ci.y);
344 | #endif
345 | break;
346 | }
347 | case GLUT_UP:
348 | {
349 | ci = World2Index(Pixel2World(SPoint(x, y)));
350 | printf("Mouse clicked up point (%d,%d):(%d,%d)\n", x, y, ci.x, ci.y);
351 | if (abs(x - cp.x) < GRID_SIZE * gCurWinWidth / WORLD_WIDTH * 1.0 / 2.0 &&
352 | abs(y - cp.y) < GRID_SIZE * gCurWinHeight / WORLD_HEIGHT * 1.0 / 2.0)
353 | {
354 | if (gMap[ci.x][ci.y].c != INFI)
355 | {
356 | glClear(GL_COLOR_BUFFER_BIT);
357 | SetDestination(ci);
358 | CalcFlowField(ci, WORLD_WIDTH / GRID_SIZE, WORLD_HEIGHT / GRID_SIZE);
359 | PathFindDisplay();
360 | glFlush();
361 | }
362 | }
363 | gClickDownY = gClickDownX = cp.x = cp.y = -1;
364 | break;
365 | }
366 | default:
367 | break;
368 | }
369 | }
370 | }
371 | void MouseMove(int x, int y)
372 | {
373 | if (-1 == gClickDownY && -1 == gClickDownX)
374 | {
375 | return;
376 | }
377 |
378 | SCoordinate dIdx = World2Index(Pixel2World(SPoint(x, y)));
379 | bool drawObs = false;
380 | if (abs(x - gClickDownX) >= GRID_SIZE * gCurWinWidth / WORLD_WIDTH * 1.0 / 2.0)
381 | {
382 | int derction = (x - gClickDownX) / abs(x - gClickDownX);
383 | gClickDownX = x + derction * GRID_SIZE * gCurWinWidth / WORLD_WIDTH * 1.0 / 2.0;
384 | gClickDownX = max(gClickDownX, 0);
385 | if (gClickDownX >= gCurWinWidth)
386 | gClickDownX = gCurWinWidth;
387 | drawObs = true;
388 | }
389 | if (abs(y - gClickDownY) >= GRID_SIZE * gCurWinHeight / WORLD_HEIGHT * 1.0 / 2.0)
390 | {
391 | int direction = (y - gClickDownY) / abs(y - gClickDownY);
392 | gClickDownY = y + direction * GRID_SIZE * gCurWinHeight / WORLD_HEIGHT * 1.0 / 2.0;
393 | gClickDownY = max(gClickDownY, 0);
394 | if (gClickDownY >= gCurWinHeight)
395 | gClickDownY = gCurWinHeight;
396 | drawObs = true;
397 | }
398 | if (drawObs)
399 | {
400 | if (EGT_CLOSE == gMap[dIdx.x][dIdx.y].t)
401 | {
402 | SetObstocle(dIdx.x, dIdx.y);
403 | CalcFlowField(gDest, WORLD_WIDTH / GRID_SIZE, WORLD_HEIGHT / GRID_SIZE);
404 | PathFindDisplay();
405 | glFlush();
406 | }
407 | }
408 | }
409 |
410 | void Initial()
411 | {
412 | glClear(GL_COLOR_BUFFER_BIT);
413 | glClearColor(1.0f, 1.0f, 1.0f, 1.0f);
414 | glMatrixMode(GL_PROJECTION);
415 | glLoadIdentity();
416 | gluOrtho2D(0.0, WORLD_WIDTH, 0.0, WORLD_HEIGHT);
417 | }
418 | void ReshapeWin(int w, int h)
419 | {
420 | GLfloat aspectRatio = (GLfloat)w / (GLfloat)h;
421 | if (w <= h)
422 | {
423 | gluOrtho2D(0.0, WORLD_WIDTH, 0.0, WORLD_HEIGHT / aspectRatio);
424 | }
425 | else
426 | {
427 | gluOrtho2D(0.0, double(WORLD_WIDTH) * aspectRatio, 0.0, WORLD_HEIGHT);
428 | }
429 | if (w != gCurWinWidth)
430 | {
431 | gCurWinWidth = w;
432 | if (gCurWinWidth < 1)
433 | gCurWinWidth = 1.0f;
434 | }
435 | if (h != gCurWinHeight)
436 | {
437 | gCurWinHeight = h;
438 | if (gCurWinHeight < 1)
439 | gCurWinHeight = 1;
440 | }
441 | }
442 | SPoint JumpToSuitablePos(const SCoordinate &curIdx)
443 | {
444 | return SPoint(rand() % 6 - 3, rand() % 6 - 3);
445 | }
446 | void ChangeObjectPosition()
447 | {
448 | if (NULL == gMap)
449 | {
450 | return;
451 | }
452 | for (int i = 0; i < MOVE_OBJECT_NUM; ++i)
453 | {
454 | SCoordinate op = World2Index(gObjectPosition[i].p);
455 | float moveSpeed = CALC_MOVE_SPEED(gObjectPosition[i], op);
456 | SPoint cur_pos(gObjectPosition[i].p.x, gObjectPosition[i].p.y);
457 | switch (gMap[op.x][op.y].d)
458 | {
459 | case ED_U:
460 | cur_pos.y += moveSpeed;
461 | break;
462 | case ED_D:
463 | cur_pos.y -= moveSpeed;
464 | break;
465 | case ED_L:
466 | cur_pos.x -= moveSpeed;
467 | break;
468 | case ED_R:
469 | cur_pos.x += moveSpeed;
470 | break;
471 | case ED_UL:
472 | cur_pos.x -= moveSpeed;
473 | cur_pos.y += moveSpeed;
474 | break;
475 | case ED_UR:
476 | cur_pos.x += moveSpeed;
477 | cur_pos.y += moveSpeed;
478 | break;
479 | case ED_DL:
480 | cur_pos.x -= moveSpeed;
481 | cur_pos.y -= moveSpeed;
482 | break;
483 | case ED_DR:
484 | cur_pos.x += moveSpeed;
485 | cur_pos.y -= moveSpeed;
486 | break;
487 | default:
488 | {
489 | /*
490 | SPoint offset = JumpToSuitablePos(op);
491 | cur_pos.x += offset.x;
492 | cur_pos.y += offset.y;
493 | */
494 | break;
495 | }
496 | }
497 | SCoordinate op_next = World2Index(cur_pos);
498 | if ((op.x != op_next.x || op.y != op_next.y) && gMap[op_next.x][op_next.y].t == EGT_USED)
499 | {
500 | int min_cost = INFI;
501 | for (int x = max(op.x - 1, 0), ex = min(op.x + 1, int(WORLD_WIDTH / GRID_SIZE) - 1); x <= ex; ++x)
502 | {
503 | for (int y = max(op.y - 1, 0), ey = min(op.y + 1, int(WORLD_HEIGHT / GRID_SIZE) - 1); y <= ey; ++y)
504 | {
505 | SGridInfo &curGrid = gMap[x][y];
506 | if (curGrid.t != EGT_USED && curGrid.t != EGT_OBSTOCLE && min_cost > gMap[x][y].pl)
507 | {
508 | cur_pos.x = x, cur_pos.y = y;
509 | min_cost = gMap[x][y].pl;
510 | }
511 | }
512 | }
513 | if (min_cost == INFI)
514 | continue;
515 | }
516 | gMap[op.x][op.y].t = EGT_CLOSE;
517 | gMap[op_next.x][op_next.y].t = EGT_USED;
518 | gObjectPosition[i].p.x = min(WORLD_WIDTH, max(1.0f, cur_pos.x));
519 | gObjectPosition[i].p.y = min(WORLD_HEIGHT, max(1.0f, cur_pos.y));
520 | }
521 | }
522 |
523 | bool IsCorner(const SCoordinate &p, const SCoordinate &s)
524 | {
525 | int x = p.x - s.x;
526 | int y = p.y - s.y;
527 |
528 | if (x != 0 && y != 0)
529 | {
530 | if (EGT_OBSTOCLE == gMap[s.x + x][s.y].t)
531 | {
532 | return true;
533 | }
534 | if (EGT_OBSTOCLE == gMap[s.x][s.y + y].t)
535 | {
536 | return true;
537 | }
538 | else
539 | return false;
540 | }
541 | return false;
542 | }
543 | int CalcCost(const SCoordinate &p, const SCoordinate &s)
544 | {
545 | int dirCost = 10 * sqrt((float)(abs(p.x - s.x) + abs(p.y - s.y)));
546 | return gMap[p.x][p.y].pl + gMap[s.x][s.y].c + dirCost;
547 | }
548 | int ParentDirection(const SCoordinate &p, const SCoordinate &s)
549 | {
550 | int x = p.x - s.x;
551 | int y = p.y - s.y;
552 |
553 | return (30 * x + 3 * y);
554 | }
555 | void UpdateOpenList(multiset &openList, const SCoordinate &cneterIdx)
556 | {
557 | int sx, sy, ex, ey;
558 | sx = max(cneterIdx.x - 1, 0);
559 | sy = max(cneterIdx.y - 1, 0);
560 | ex = min(cneterIdx.x + 1, int(WORLD_WIDTH / GRID_SIZE) - 1);
561 | ey = min(cneterIdx.y + 1, int(WORLD_HEIGHT / GRID_SIZE) - 1);
562 | for (int x = sx; x <= ex; ++x)
563 | {
564 | for (int y = sy; y <= ey; ++y)
565 | {
566 | SGridInfo &curGrid = gMap[x][y];
567 | if (EGT_NORMAL == curGrid.t)
568 | {
569 | if (IsCorner(cneterIdx, SCoordinate(x, y)))
570 | {
571 | continue;
572 | }
573 | int cost = CalcCost(cneterIdx, SCoordinate(x, y));
574 | openList.insert(SOpenGridInfo(SCoordinate(x, y), cost));
575 | curGrid.t = EGT_OPEN;
576 | curGrid.pl = cost;
577 | curGrid.d = ParentDirection(cneterIdx, SCoordinate(x, y));
578 | }
579 | else if (EGT_CLOSE == curGrid.t)
580 | {
581 | int cost = CalcCost(cneterIdx, SCoordinate(x, y));
582 | if (cost < curGrid.pl)
583 | {
584 | curGrid.pl = cost;
585 | curGrid.d = ParentDirection(cneterIdx, SCoordinate(x, y));
586 | }
587 | }
588 | }
589 | }
590 | }
591 | void CalcFlowField(const SCoordinate &d, int hGridNum, int vGridNum)
592 | {
593 | RecoverGridType();
594 | multiset openList;
595 | openList.insert(SOpenGridInfo(d, gMap[d.x][d.y].c));
596 | SCoordinate curIdx = d;
597 | while (!openList.empty())
598 | {
599 | openList.erase(openList.begin());
600 | gMap[curIdx.x][curIdx.y].t = EGT_CLOSE;
601 |
602 | UpdateOpenList(openList, curIdx);
603 |
604 | if (openList.empty())
605 | {
606 | break;
607 | }
608 | curIdx = openList.begin()->c;
609 | }
610 | gMap[gDest.x][gDest.y].t = EGT_DESTINATION;
611 | }
612 |
--------------------------------------------------------------------------------
/CrowdNavigation/PathFinding.h:
--------------------------------------------------------------------------------
1 | #ifndef _PATHFINDING_H_
2 | #define _PATHFINDING_H_
3 |
4 | #include
5 | #include
6 | #include
7 | #include
8 | #include
9 | #include
10 | #include
11 | #include
12 | #include
13 |
14 | using namespace std;
15 |
16 | #pragma comment(lib, "glut32.lib")
17 |
18 | const float WORLD_WIDTH = 200.0;
19 | const float WORLD_HEIGHT = 160.0;
20 | const float WINDOW_WIDTH = 800.0;
21 | const float WINDOW_HEIGHT = 500.0;
22 | const float GRID_SIZE = 4.0;
23 | const float MOVE_STEP = 1.8;
24 | const int MAX_CHAR = 128;
25 | const int MOVE_OBJECT_NUM = 200;
26 | const int INFI = 0xFFFFFFF;
27 |
28 | #define CALC_MOVE_SPEED(_obj, _objIdx) \
29 | ((_obj).s * MOVE_STEP / gMap[(_objIdx).x][(_objIdx).y].c)
30 |
31 | typedef enum EDirection
32 | {
33 | ED_U = 3,
34 | ED_D = -3,
35 | ED_L = -30,
36 | ED_R = 30,
37 | ED_UL = -27,
38 | ED_UR = 33,
39 | ED_DL = -33,
40 | ED_DR = 27,
41 | ED_NULL = 10,
42 | } EDirection;
43 | typedef enum EGridType
44 | {
45 | EGT_NORMAL = 0,
46 | EGT_OPEN = 1,
47 | EGT_CLOSE = 2,
48 | EGT_OBSTOCLE = 4,
49 | EGT_DESTINATION = 5,
50 | EGT_USED = 6
51 | } EGridType;
52 |
53 | typedef struct SGridInfo
54 | {
55 | int c; // cost
56 | int pl; // the length to target
57 | int d; // direction
58 | int t; // type of the grid
59 | SGridInfo()
60 | {
61 | c = 0;
62 | pl = INFI;
63 | d = ED_NULL;
64 | t = EGT_NORMAL;
65 | }
66 | } SGridInfo;
67 | typedef struct SPoint
68 | {
69 | GLfloat x;
70 | GLfloat y;
71 | SPoint(GLfloat ax = 0.0f, GLfloat ay = 0.0f)
72 | {
73 | x = ax;
74 | y = ay;
75 | }
76 | } SPoint;
77 | typedef struct SCoordinate
78 | {
79 | int x;
80 | int y;
81 | SCoordinate(int ax = 0, int ay = 0)
82 | {
83 | x = ax;
84 | y = ay;
85 | }
86 | const SCoordinate &operator=(const SCoordinate &d)
87 | {
88 | x = d.x;
89 | y = d.y;
90 | return *this;
91 | }
92 | } SCoordinate;
93 | typedef struct SColorRGB
94 | {
95 | GLfloat r;
96 | GLfloat g;
97 | GLfloat b;
98 | SColorRGB(GLfloat ar, GLfloat ag, GLfloat ab)
99 | {
100 | r = ar;
101 | g = ag;
102 | b = ab;
103 | }
104 | } SColorRGB;
105 | typedef struct SOpenGridInfo
106 | {
107 | SCoordinate c;
108 | int pl;
109 |
110 | SOpenGridInfo(const SCoordinate &ac, int l = 0)
111 | {
112 | c = ac;
113 | pl = l;
114 | }
115 | bool operator<(const SOpenGridInfo &o) const
116 | {
117 | return pl < o.pl;
118 | }
119 | } SOpenGridInfo;
120 | typedef struct SMoveObject
121 | {
122 | SPoint p;
123 | float s;
124 | SMoveObject(const SPoint ap = SPoint(), float as = 20.0f)
125 | {
126 | p = ap;
127 | s = as;
128 | }
129 | } SMoveObject;
130 |
131 | string Num2String(int i);
132 | SPoint Index2World(const SCoordinate &idx);
133 | SPoint Pixel2World(const SPoint &pixel);
134 | SCoordinate World2Index(const SPoint &p);
135 |
136 | void Initial();
137 | void PathFindDisplay();
138 | void ReshapeWin(int w, int h);
139 | void MouseClick(int button, int state, int x, int y);
140 | void MouseMove(int x, int y);
141 | void TimeerFunc(int value);
142 | void InitMoveObject();
143 | /*********************** draw map **********************/
144 | void DrawMap(int hGridNum, int vGridNum);
145 | void DrawObstacle(int hGridNum, int vGridNum);
146 | void DrawFlowField(int hGridNum, int vGridNum);
147 | void DrawMoveObject(int hGridNum, int vGridNum);
148 | void DrawDestination(const SPoint &dIdx);
149 | /*********************** draw shape **********************/
150 | void DrawString(string strn);
151 | void DrawQuads(const SPoint &ldp, const SPoint &urp, const SColorRGB &c, int mode);
152 | void DrawLineSurroundQuads(const SCoordinate &idx);
153 | void DrawPoint(const SPoint &p, GLint size, const SColorRGB &c);
154 | void DrawArraw(const SPoint &sp, const SPoint &ep);
155 |
156 | /*********************** find path **********************/
157 | void CalcFlowField(const SCoordinate &d, int hGridNum, int vGridNum);
158 | void ChangeObjectPosition();
159 | #endif
--------------------------------------------------------------------------------
/CrowdNavigation/main.cpp:
--------------------------------------------------------------------------------
1 | #include "PathFinding.h"
2 |
3 | int main(int argc, char *argv[])
4 | {
5 | glutInit(&argc, argv);
6 | glutInitDisplayMode(GLUT_DOUBLE | GLUT_RGB);
7 | glutInitWindowSize(WINDOW_WIDTH, WINDOW_HEIGHT);
8 | glutInitWindowPosition(300, 300);
9 | glutCreateWindow("Flow Field Path Finding");
10 | Initial();
11 | glutDisplayFunc(PathFindDisplay);
12 | glutMouseFunc(MouseClick);
13 | glutMotionFunc(MouseMove);
14 | glutTimerFunc(40, TimeerFunc, 1);
15 | glutMainLoop();
16 |
17 | return 0;
18 | }
--------------------------------------------------------------------------------
/CrowdNavigation/makefile:
--------------------------------------------------------------------------------
1 | LDFLAGS=-L./LG -lopengl32 -lglu32 -lglut32
2 | CFLAGS=-g -DDEBUG -DGLUT_DISABLE_ATEXIT_HACK
3 | all:
4 | g++ PathFinding.cpp -c -o PathFinding.o
5 | g++ main.cpp -c -o main.o $(CFLAGS)
6 | g++ main.o PathFinding.o $(LDFLAGS) -o CrowdNavigation.exe
7 |
8 | clean:
9 | del PathFinding.o main.o CrowdNavigation.exe
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # PathTracking
2 |
3 | ## Spline
4 |
5 | ## PID
6 |
7 | ## LQR
8 |
9 | ## Flow Field Path Finding
10 |
--------------------------------------------------------------------------------
/build.sh:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 |
3 | build_dir="./build"
4 |
5 | if [ ! -d "$build_dir" ]; then
6 | mkdir $build_dir
7 | fi
8 |
9 | cd build
10 |
11 | if [ $# -ge 1 ]
12 | then
13 | cmake -DCMAKE_BUILD_TYPE=$1 ..
14 | else
15 | cmake -DCMAKE_BUILD_TYPE=Release ..
16 | fi
17 |
18 | make -j8
--------------------------------------------------------------------------------
/main.cpp:
--------------------------------------------------------------------------------
1 | #include
2 |
3 | int main(){
4 | std::cout << "Hello, from PathTracking!\n";
5 | return 0;
6 | }
7 |
--------------------------------------------------------------------------------
/src/LQR/LQR.cpp:
--------------------------------------------------------------------------------
1 | #include "LQR.h"
2 |
3 | LQR::LQR(double _dt, double _L)
4 | {
5 | Q.setIdentity(5, 5);
6 | R.setIdentity(2, 2);
7 | A.setZero(5, 5);
8 | B.setZero(5, 2);
9 |
10 | this->dt = _dt;
11 | this->L = _L;
12 | }
13 |
14 | Eigen::MatrixXd LQR::polyfit(const std::vector &in_point, int n)
15 | {
16 | int _size = in_point.size();
17 | // the number of parameters
18 | int x_num = n + 1;
19 | // Y = UK
20 | // y = k0 + x*K1 + x^2 * K2 + ...
21 | Eigen::MatrixXd mat_u(_size, x_num);
22 | Eigen::MatrixXd mat_y(_size, 1);
23 |
24 | for (int i = 0; i < _size; ++i)
25 | for (int j = 0; j < x_num; ++j)
26 | {
27 | mat_u(i, j) = pow(in_point[i].x, j);
28 | }
29 |
30 | for (int i = 0; i < _size; ++i)
31 | {
32 | mat_y(i, 0) = in_point[i].y;
33 | }
34 | // K =(U_T * U).inv() * U_T * Y
35 | Eigen::MatrixXd mat_k(x_num, 1);
36 | mat_k = (mat_u.transpose() * mat_u).inverse() * mat_u.transpose() * mat_y;
37 | return mat_k;
38 | }
39 |
40 | double LQR::cal_k(const Eigen::MatrixXd &K, double _x)
41 | {
42 | double k = 0;
43 | for (size_t j = 1, n = K.rows(); j < n; ++j)
44 | {
45 | k += K(j, 0) * pow(_x, j - 1) * j;
46 | }
47 | return k;
48 | }
49 |
50 | double LQR::cal_y(const Eigen::MatrixXd &K, double _x)
51 | {
52 | double y = 0;
53 | for (size_t j = 0, n = K.rows(); j < n; ++j)
54 | {
55 | y += K(j, 0) * pow(_x, j);
56 | }
57 | return y;
58 | }
59 |
60 | bool LQR::solveRiccatiArimotoPotter(const Eigen::MatrixXd &A, const Eigen::MatrixXd &B,
61 | const Eigen::MatrixXd &Q, const Eigen::MatrixXd &R,
62 | Eigen::MatrixXd &P) const
63 | {
64 | const uint dim_x = A.rows();
65 | const uint dim_u = B.cols();
66 |
67 | // set Hamilton matrix
68 | Eigen::MatrixXd Ham = Eigen::MatrixXd::Zero(2 * dim_x, 2 * dim_x);
69 | Ham << A, -B * R.inverse() * B.transpose(), -Q, -A.transpose();
70 |
71 | // calc eigenvalues and eigenvectors
72 | Eigen::EigenSolver Eigs(Ham);
73 |
74 | // extract stable eigenvectors into 'eigvec'
75 | Eigen::MatrixXcd eigvec = Eigen::MatrixXcd::Zero(2 * dim_x, dim_x);
76 | int j = 0;
77 | for (int i = 0; i < 2 * dim_x; ++i)
78 | {
79 | if (Eigs.eigenvalues()[i].real() < 0.)
80 | {
81 | eigvec.col(j) = Eigs.eigenvectors().block(0, i, 2 * dim_x, 1);
82 | ++j;
83 | }
84 | }
85 |
86 | // calc P with stable eigen vector matrix
87 | Eigen::MatrixXcd Vs_1, Vs_2;
88 | Vs_1 = eigvec.block(0, 0, dim_x, dim_x);
89 | Vs_2 = eigvec.block(dim_x, 0, dim_x, dim_x);
90 | P = (Vs_2 * Vs_1.inverse()).real();
91 |
92 | return true;
93 | }
94 |
95 | bool LQR::dlqr(const Eigen::MatrixXd &A, const Eigen::MatrixXd &B,
96 | const Eigen::MatrixXd &Q, const Eigen::MatrixXd &R,
97 | Eigen::MatrixXd &K, Eigen::MatrixXd &P, Eigen::MatrixXcd &EV) const
98 | {
99 | bool res = this->solveRiccatiArimotoPotter(A, B, Q, R, P);
100 | K = (B.transpose() * P * B + R).inverse() * (B.transpose() * P * A);
101 | Eigen::EigenSolver es(A - B * K);
102 | EV = es.eigenvalues();
103 | return res;
104 | }
105 |
106 | Eigen::MatrixXd LQR::control(const State_X &curX)
107 | {
108 | A.setZero();
109 | A(0, 0) = 1.0;
110 | A(0, 1) = this->dt;
111 | A(1, 2) = curX.v;
112 | A(2, 2) = 1.0;
113 | A(2, 3) = this->dt;
114 | A(4, 4) = 1.0;
115 |
116 | B.setZero();
117 | B(3, 0) = curX.v / this->L; //this->dt;
118 | B(4, 1) = this->dt;
119 | Eigen::MatrixXd K, P;
120 | Eigen::MatrixXcd EV;
121 | dlqr(A, B, Q, R, K, P, EV);
122 |
123 | this->stateX.d_cte = (curX.cte - this->stateX.cte) / this->dt;
124 | this->stateX.cte = curX.cte;
125 | this->stateX.d_theta = (curX.theta - this->stateX.theta) / this->dt;
126 | this->stateX.theta = curX.theta;
127 | this->stateX.d_v = curX.d_v;
128 |
129 | Eigen::MatrixXd X(5, 1);
130 | X << this->stateX.cte, this->stateX.d_cte, this->stateX.theta, this->stateX.d_theta, this->stateX.d_v;
131 |
132 | // [w, a]
133 | Eigen::MatrixXd U = -1 * (K * X);
134 | U(1, 0) *= this->dt;
135 | return U;
136 | }
137 |
138 | void LQR::reset()
139 | {
140 | this->stateX.reset();
141 | }
--------------------------------------------------------------------------------
/src/LQR/LQR.h:
--------------------------------------------------------------------------------
1 | #ifndef _LQR_H
2 | #define _LQR_H
3 |
4 | #include
5 | #include
6 | #include
7 | #include
8 | #include
9 | #include
10 |
11 | struct State_Veh
12 | {
13 | double x;
14 | double y;
15 | double yaw;
16 | double v;
17 | State_Veh() : x(0.0), y(0.0), yaw(0.0), v(0.0) {}
18 | State_Veh(double _x, double _y, double _yaw, double _v) : x(_x), y(_y), yaw(_yaw), v(_v) {}
19 | };
20 |
21 | struct State_X
22 | {
23 | double cte;
24 | double d_cte;
25 | double theta;
26 | double d_theta;
27 | double v;
28 | double d_v;
29 | State_X() { this->reset(); }
30 | State_X(double _cte, double _d_cte, double _theta, double _d_theta, double _v, double _d_v) : cte(_cte), d_cte(_d_cte), theta(_theta), d_theta(_d_theta), v(_v), d_v(_d_v) {}
31 | void reset()
32 | {
33 | cte = 0.0, d_cte = 0.0, theta = 0.0, d_theta = 0.0, v = 0.0, d_v = 0.0;
34 | }
35 | };
36 |
37 | class LQR
38 | {
39 | public:
40 | Eigen::MatrixXd Q;
41 | Eigen::MatrixXd R;
42 | Eigen::MatrixXd A;
43 | Eigen::MatrixXd B;
44 | double dt;
45 | double L;
46 |
47 | State_X stateX;
48 |
49 | public:
50 | /**
51 | * Constructor
52 | */
53 | LQR(double _dt = 0.05, double _L = 0.7);
54 |
55 | /**
56 | * Destructor.
57 | */
58 | virtual ~LQR() = default;
59 |
60 | /**
61 | * n polynomial curve fitting
62 | */
63 | Eigen::MatrixXd polyfit(const std::vector &in_point, int n);
64 |
65 | /**
66 | * calculate k
67 | */
68 | double cal_k(const Eigen::MatrixXd &K, double _x);
69 |
70 | /**
71 | * calculate y
72 | */
73 | double cal_y(const Eigen::MatrixXd &K, double _x);
74 |
75 | /**
76 | * solve Riccati
77 | * @return P
78 | */
79 | bool solveRiccatiArimotoPotter(const Eigen::MatrixXd &A, const Eigen::MatrixXd &B,
80 | const Eigen::MatrixXd &Q, const Eigen::MatrixXd &R,
81 | Eigen::MatrixXd &P) const;
82 |
83 | /**
84 | * @return K, P, eigen_values
85 | */
86 | bool dlqr(const Eigen::MatrixXd &A, const Eigen::MatrixXd &B,
87 | const Eigen::MatrixXd &Q, const Eigen::MatrixXd &R,
88 | Eigen::MatrixXd &K, Eigen::MatrixXd &P, Eigen::MatrixXcd &EV) const;
89 |
90 | Eigen::MatrixXd control(const State_X &curX);
91 |
92 | void reset();
93 | };
94 |
95 | #endif /* _LQR_H */
--------------------------------------------------------------------------------
/src/PID/PID.cpp:
--------------------------------------------------------------------------------
1 | #include "Pid.h"
2 |
3 | unsigned long millis()
4 | {
5 | struct timeb t1;
6 | ftime(&t1);
7 | return t1.millitm + t1.time * 1000;
8 | }
9 |
10 | PID::PID(double Kp, double Ki, double Kd)
11 | {
12 | this->inAuto = true;
13 | this->kp.resize(3, 0);
14 | this->ep.resize(3, 0);
15 | PID::SetOutputLimits(-0.3, 0.3); //default output limit
16 |
17 | SampleTime = 50; //default Controller Sample Time is 0.05 seconds
18 |
19 | PID::SetTunings(Kp, Ki, Kd);
20 |
21 | lastTime = millis() - SampleTime;
22 | }
23 |
24 | double PID::Compute(double dth, double v, cv::Point cur, cv::Point A, cv::Point B)
25 | {
26 | if (!inAuto)
27 | return false;
28 | unsigned long now = millis();
29 | unsigned long timeChange = (now - lastTime);
30 | if (timeChange >= SampleTime)
31 | {
32 | double cte = distance_from_point_to_line(cur.x, cur.y, A.x, A.y, B.x, B.y);
33 | cv::Point foot = get_foot_point(cur, A, B);
34 | bool left = (foot.x - cur.x) * (B.y - A.y) - (B.x - B.y) * (foot.y - cur.y) > 0;
35 | if (dth > M_PI)
36 | {
37 | dth -= 2 * M_PI;
38 | }
39 | else if (dth < -M_PI)
40 | {
41 | dth += 2 * M_PI;
42 | }
43 | /*Compute all the working error variables*/
44 | this->ep[2] = this->kp[2] * dth;
45 | this->ep[0] = this->kp[0] * cte;
46 | this->ep[1] += this->kp[1] * cte * v * SampleTime / 1000.0;
47 | /* limit integral*/
48 | if (this->ep[1] > outMax)
49 | {
50 | this->ep[1] = outMax;
51 | }
52 | else if (this->ep[1] < outMin)
53 | {
54 | this->ep[1] = outMin;
55 | }
56 |
57 | /*Compute PID Output*/
58 | double output;
59 | if (left)
60 | {
61 | output = -this->ep[0] - this->ep[1] + this->ep[2];
62 | }
63 | else
64 | {
65 | output = this->ep[0] + this->ep[1] + this->ep[2];
66 | }
67 |
68 | RoundTheta(output);
69 | /* limit output*/
70 | if (output > outMax)
71 | {
72 | output = outMax;
73 | }
74 | else if (output < outMin)
75 | {
76 | output = outMin;
77 | }
78 |
79 | /*Remember some variables for next time*/
80 | lastTime = now;
81 | return output;
82 | }
83 | else
84 | return __DBL_MAX__;
85 | }
86 |
87 | void PID::SetTunings(double Kp, double Ki, double Kd)
88 | {
89 | if (Kp < 0 || Ki < 0 || Kd < 0)
90 | return;
91 |
92 | double SampleTimeInSec = ((double)SampleTime) / 1000;
93 | this->kp = {Kp, Ki * SampleTimeInSec, Kd / SampleTimeInSec};
94 | }
95 |
96 | /* SetSampleTime(...) *********************************************************
97 | * sets the period, in Milliseconds, at which the calculation is performed
98 | ******************************************************************************/
99 | void PID::SetSampleTime(int NewSampleTime)
100 | {
101 | if (NewSampleTime > 0)
102 | {
103 | double ratio = (double)NewSampleTime / (double)SampleTime;
104 | this->kp[1] *= ratio;
105 | this->kp[2] /= ratio;
106 | SampleTime = (unsigned long)NewSampleTime;
107 | }
108 | }
109 |
110 | void PID::SetOutputLimits(double Min, double Max)
111 | {
112 | if (Min >= Max)
113 | return;
114 | outMin = Min;
115 | outMax = Max;
116 |
117 | if (inAuto)
118 | {
119 | if (this->ep[1] > outMax)
120 | this->ep[1] = outMax;
121 | else if (this->ep[1] < outMin)
122 | this->ep[1] = outMin;
123 | }
124 | }
125 |
126 | /* SetMode(...)****************************************************************
127 | * Allows the controller Mode to be set to manual (0) or Automatic (non-zero)
128 | * when the transition from manual to auto occurs, the controller is
129 | * automatically initialized
130 | ******************************************************************************/
131 | void PID::SetMode(int Mode)
132 | {
133 | bool newAuto = (Mode == AUTOMATIC);
134 | if (newAuto && !inAuto)
135 | { /*we just went from manual to auto*/
136 | PID::Initialize();
137 | }
138 | inAuto = newAuto;
139 | }
140 |
141 | /* Initialize()****************************************************************
142 | * does all the things that need to happen to ensure a bumpless transfer
143 | * from manual to automatic mode.
144 | ******************************************************************************/
145 | void PID::Initialize()
146 | {
147 | if (this->ep[1] > outMax)
148 | this->ep[1] = outMax;
149 | else if (this->ep[1] < outMin)
150 | this->ep[1] = outMin;
151 | }
152 |
153 | double PID::RoundTheta(double angle)
154 | {
155 | double a = fmod(angle + M_PI, 2.0 * M_PI);
156 | if (a < 0.0)
157 | {
158 | a += (2.0 * M_PI);
159 | }
160 | return a - M_PI;
161 | }
162 |
163 | double PID::distance_from_point_to_line(
164 | const double &x0, const double &y0,
165 | const double &x1, const double &y1,
166 | const double &x2, const double &y2)
167 | {
168 | double d = (fabs((y2 - y1) * x0 + (x1 - x2) * y0 + ((x2 * y1) - (x1 * y2)))) /
169 | (sqrt(pow(y2 - y1, 2) + pow(x1 - x2, 2)));
170 | return d;
171 | }
172 |
173 | bool PID::point_in_left_line(const double &x0, const double &y0,
174 | const double &x1, const double &y1,
175 | const double &x2, const double &y2)
176 | {
177 | return (x1 - x0) * (y2 - y0) - (y1 - y0) * (x2 - x0) >= 0;
178 | }
179 |
180 | cv::Point2d PID::get_foot_point(cv::Point point, cv::Point pnt1, cv::Point pnt2)
181 | {
182 | double A = pnt2.y - pnt1.y; //y2-y1
183 | double B = pnt1.x - pnt2.x; //x1-x2;
184 | double C = pnt2.x * pnt1.y - pnt1.x * pnt2.y; //x2*y1-x1*y2
185 | if (A * A + B * B < 1e-13)
186 | {
187 | return cv::Point2d(pnt1.x, pnt1.y); //pnt1与pnt2重叠
188 | }
189 | else if (abs(A * point.x + B * point.y + C) < 1e-13)
190 | {
191 | return cv::Point2d(point.x, point.y); //point在直线上(pnt1_pnt2)
192 | }
193 | else
194 | {
195 | double x = (B * B * point.x - A * B * point.y - A * C) / (A * A + B * B);
196 | double y = (-A * B * point.x + A * A * point.y - B * C) / (A * A + B * B);
197 | cv::Point2d fpoint(x, y);
198 | return fpoint;
199 | }
200 | }
--------------------------------------------------------------------------------
/src/PID/PID.h:
--------------------------------------------------------------------------------
1 | #ifndef PID_H
2 | #define PID_H
3 |
4 | #include
5 | #include
6 | #include
7 | #include
8 | #include
9 | #include
10 |
11 | //Constants used in some of the functions below
12 | #define AUTOMATIC 1
13 | #define MANUAL 0
14 |
15 | class PID
16 | {
17 |
18 | public:
19 | PID(double Kp, double Ki, double Kd);
20 |
21 | void SetMode(int Mode); // * sets PID to either Manual (0) or Auto (non-0)
22 |
23 | double Compute(double dth, double v, cv::Point cur, cv::Point A, cv::Point B); // * performs the PID calculation. it should be
24 | // called every time loop() cycles. ON/OFF and
25 | // calculation frequency can be set using SetMode
26 | // SetSampleTime respectively
27 |
28 | void SetOutputLimits(double, double); // * clamps the output to a specific range. 0-255 by default, but
29 | // it's likely the user will want to change this depending on
30 | // the application
31 |
32 | //available but not commonly used functions ********************************************************
33 | void SetTunings(double, double, // * While most users will set the tunings once in the
34 | double); // constructor, this function gives the user the option
35 | // of changing tunings during runtime for Adaptive control
36 |
37 | void SetControllerDirection(int); // * Sets the Direction, or "Action" of the controller. DIRECT
38 | // means the output will increase when error is positive. REVERSE
39 | // means the opposite. it's very unlikely that this will be needed
40 | // once it is set in the constructor.
41 | void SetSampleTime(int); // * sets the frequency, in Milliseconds, with which
42 | // the PID calculation is performed. default is 100
43 |
44 | // [-pi, pi]
45 | double RoundTheta(double angle);
46 | // point (x0,y0) -> line (x1,y1), (x2,y2)
47 | double distance_from_point_to_line(
48 | const double &x0, const double &y0,
49 | const double &x1, const double &y1,
50 | const double &x2, const double &y2);
51 | // point (x0,y0) -> line (x1,y1), (x2,y2)
52 | bool point_in_left_line(const double &x0, const double &y0,
53 | const double &x1, const double &y1,
54 | const double &x2, const double &y2);
55 | cv::Point2d get_foot_point(cv::Point point, cv::Point pnt1, cv::Point pnt2);
56 |
57 | private:
58 | void Initialize();
59 |
60 | /**
61 | * Coefficients, the order is P, I, D
62 | * (P)roportional Tuning Parameter
63 | * (I)ntegral Tuning Parameter
64 | * (D)erivative Tuning Parameter
65 | */
66 | std::vector kp;
67 | /**
68 | * Coefficients, the order is dP, dI, dD
69 | */
70 | std::vector dp;
71 | /**
72 | * Coefficients, the order is eP, eI, eD
73 | */
74 | std::vector ep;
75 |
76 | int controllerDirection;
77 |
78 | unsigned long lastTime, SampleTime;
79 | double outMin, outMax;
80 | bool inAuto;
81 | };
82 | #endif /* PID_H */
--------------------------------------------------------------------------------
/src/spline/Spline.cpp:
--------------------------------------------------------------------------------
1 | #include "Spline.h"
2 |
3 | namespace frl
4 | {
5 |
6 | void Spline::clean()
7 | {
8 | std::vector().swap(this->m_x);
9 | std::vector().swap(this->m_a);
10 | std::vector().swap(this->m_b);
11 | std::vector().swap(this->m_c);
12 | std::vector().swap(this->m_d);
13 | }
14 |
15 | void Spline::reset(std::size_t n)
16 | {
17 | this->n = n;
18 | this->m_x.resize(n, 0);
19 | this->m_a.resize(n, 0);
20 | this->m_b.resize(n - 1, 0);
21 | this->m_c.resize(n, 0);
22 | this->m_d.resize(n - 1, 0);
23 | }
24 |
25 | void Spline::set_boundary(bd_type left, double left_value,
26 | bd_type right, double right_value,
27 | bool force_linear_extrapolation)
28 | {
29 | assert(this->n == 0); // set_points() must not have happened yet
30 | this->m_left = left;
31 | this->m_right = right;
32 | this->m_left_value = left_value;
33 | this->m_right_value = right_value;
34 | this->m_force_linear_extrapolation = force_linear_extrapolation;
35 | }
36 |
37 | void Spline::set_points(const std::vector &_points)
38 | {
39 | std::size_t n = _points.size();
40 | assert(n > 2);
41 | this->reset(n);
42 | this->m_x[0] = _points[0].x;
43 | this->m_a[0] = _points[0].y;
44 | std::vector h(n - 1, 0);
45 | for (std::size_t i = 1; i < n; i++)
46 | {
47 | assert(_points[i - 1].x < _points[i].x);
48 | this->m_x[i] = _points[i].x;
49 | this->m_a[i] = _points[i].y;
50 | h[i - 1] = _points[i].x - _points[i - 1].x;
51 | }
52 |
53 | Eigen::MatrixXd A;
54 | A.setZero(n, n);
55 | Eigen::MatrixXd B;
56 | B.setZero(n, 1);
57 | // calculate A
58 | for (std::size_t i = 0; i < n - 1; ++i)
59 | {
60 | if (i < n - 2)
61 | {
62 | A(i + 1, i + 1) = 2 * (h[i] + h[i + 1]);
63 | }
64 | A(i + 1, i) = h[i];
65 | A(i, i + 1) = h[i];
66 | }
67 | // boundary conditions
68 | if (this->m_left == Natural)
69 | {
70 | A(0, 0) = 1.0;
71 | A(0, 1) = 0.0;
72 | }
73 | else if (this->m_left == Clamped)
74 | {
75 | A(0, 0) = 2.0 * h[0];
76 | B(0, 1) = 3.0 * ((this->m_a[1] - this->m_a[0]) / h[0] - this->m_left_value);
77 | }
78 | else
79 | {
80 | A(0, 0) = -h[0];
81 | A(0, 1) += h[1];
82 | A(0, 2) = -h[0];
83 | }
84 | if (this->m_right == Natural)
85 | {
86 | A(n - 1, n - 2) = 0.0;
87 | A(n - 1, n - 1) = 1.0;
88 | }
89 | else if (this->m_right == Clamped)
90 | {
91 | A(n - 1, n - 1) = 2.0 * h[n - 2];
92 | B(n - 2, 0) = 3.0 * (this->m_right_value - (this->m_a[n - 1] - this->m_a[n - 2]) / h[n - 2]);
93 | }
94 | else
95 | {
96 | A(n - 1, n - 3) = -h[n - 2];
97 | A(n - 1, n - 2) += h[n - 3];
98 | A(n - 1, n - 1) = -h[n - 3];
99 | }
100 |
101 | // calculat B
102 | for (std::size_t i = 0; i < n - 2; ++i)
103 | {
104 | B(i + 1, 0) = 3.0 * (this->m_a[i + 2] - this->m_a[i + 1]) / h[i + 1] -
105 | 3.0 * (this->m_a[i + 1] - this->m_a[i]) / h[i];
106 | }
107 |
108 | // calculat c
109 | Eigen::MatrixXd c = A.colPivHouseholderQr().solve(B);
110 | // std::cout << A << std::endl;
111 | // std::cout << B << std::endl;
112 | // std::cout << c << std::endl;
113 |
114 | this->m_c.assign(c.data(), c.data() + c.rows() * c.cols());
115 |
116 | // calculat b, d
117 | for (std::size_t i = 0; i < n - 1; ++i)
118 | {
119 | this->m_b[i] = (this->m_a[i + 1] - this->m_a[i]) / h[i] - (2 * this->m_c[i] + this->m_c[i + 1]) * h[i] / 3.0;
120 | this->m_d[i] = (this->m_c[i + 1] - this->m_c[i]) / (3.0 * h[i]);
121 | }
122 |
123 | // for left extrapolation coefficients
124 | this->m_b0 = m_b[0];
125 | this->m_c0 = (m_force_linear_extrapolation == false) ? this->m_c[0] : 0.0;
126 | }
127 |
128 | std::size_t Spline::index(double x) const
129 | {
130 | // find the closest point m_x[idx] < x, idx=0 even if x::const_iterator it;
132 | it = std::lower_bound(this->m_x.begin(), m_x.end(), x);
133 | return std::max(int(it - m_x.begin()) - 1, 0);
134 | }
135 |
136 | double Spline::calculate_y(double x) const
137 | {
138 | // find the closest point m_x[idx] < x, idx=0 even if xindex(x);
140 |
141 | double dx = x - this->m_x[idx];
142 | double interpol;
143 | if (x < this->m_x[0])
144 | {
145 | // extrapolation to the left
146 | interpol = (this->m_c0 * dx + this->m_b0) * dx + this->m_a[0];
147 | }
148 | else if (x > this->m_x[n - 1])
149 | {
150 | // extrapolation to the right
151 | interpol = (this->m_c[n - 1] * dx + this->m_b[n - 1]) * dx + this->m_a[n - 1];
152 | }
153 | else
154 | {
155 | // interpolation
156 | interpol = ((this->m_d[idx] * dx + this->m_c[idx]) * dx + this->m_b[idx]) * dx + this->m_a[idx];
157 | }
158 | return interpol;
159 | }
160 |
161 | double Spline::calculate_dy(double x) const
162 | {
163 | std::size_t idx = this->index(x);
164 | double dx = x - this->m_x[idx];
165 | return this->m_b[idx] + dx * (2 * this->m_c[idx] + 3 * dx * this->m_d[idx]);
166 | }
167 |
168 | double Spline::calculate_ddy(double x) const
169 | {
170 | std::size_t idx = this->index(x);
171 | double dx = x - this->m_x[idx];
172 | return 2 * this->m_c[idx] + 6 * dx * this->m_d[idx];
173 | }
174 |
175 | void Spline2D::clean()
176 | {
177 | this->sx.clean();
178 | this->sy.clean();
179 |
180 | this->IN = 0;
181 | std::vector().swap(this->IS);
182 | std::vector().swap(this->IPoints);
183 | }
184 |
185 | cv::Point2d Spline2D::calculate_position(double s) const
186 | {
187 | return {this->sx.calculate_y(s), this->sy.calculate_y(s)};
188 | }
189 |
190 | double Spline2D::calculate_curvature(double s) const
191 | {
192 | double dx = this->sx.calculate_dy(s);
193 | double ddx = this->sx.calculate_ddy(s);
194 | double dy = this->sy.calculate_dy(s);
195 | double ddy = this->sy.calculate_ddy(s);
196 | return (ddy * dx - ddx * dy) / pow(dx * dx + dy * dy, 1.5);
197 | }
198 |
199 | double Spline2D::calculate_yaw(double s) const
200 | {
201 | return atan2(this->sy.calculate_dy(s), this->sx.calculate_dy(s));
202 | }
203 | } // namespace frl
--------------------------------------------------------------------------------
/src/spline/Spline.h:
--------------------------------------------------------------------------------
1 | #ifndef _SPLINE_H
2 | #define _SPLINE_H
3 |
4 | #include
5 | #include
6 | #include
7 | #include
8 | #include
9 | #include
10 | #include
11 |
12 | namespace frl
13 | {
14 | class Spline
15 | {
16 | public:
17 | enum bd_type
18 | {
19 | Natural = 1,
20 | Clamped = 2,
21 | NotAKnot = 3
22 | };
23 |
24 | private:
25 | /**
26 | * f_i(x) = d_i*(x-x_i)^3 + c_i*(x-x_i)^2 + b_i*(x-x_i) + a_i
27 | * f_i(x_i) = y_i
28 | * f_i(x_i+1) = y_i+1
29 | * d_f_i(x_i+1) = d_f_i+1(x_i+1)
30 | * dd_f_i(x_i+1) = dd_f_i+i(x_i+1)
31 | * -->
32 | * A*M = 6*B -> A*(M/2) = 3*B
33 | * -->
34 | * a_i = y_i
35 | * b_i = (a_i+1 - a_i)/h_i - h_i*(2*c_i + c_i+1)/3, h_i = x_i+1 - x_i
36 | * c_i = M_i / 2
37 | * d_i = (c_i+1 - c_i) / (3 * h_i)
38 | */
39 | std::size_t n;
40 | std::vector m_x;
41 | std::vector m_a, m_b, m_c, m_d; // spline coefficients
42 |
43 | double m_b0, m_c0; // for left extrapol
44 | bd_type m_left, m_right;
45 | double m_left_value, m_right_value;
46 | bool m_force_linear_extrapolation;
47 |
48 | void reset(std::size_t n);
49 | std::size_t index(double x) const;
50 |
51 | public:
52 | // set default boundary condition to be zero curvature at both ends
53 | Spline() : m_left(Natural), m_right(Natural),
54 | m_left_value(0.0), m_right_value(0.0),
55 | m_force_linear_extrapolation(false)
56 | {
57 | }
58 |
59 | ~Spline() = default;
60 |
61 | void clean();
62 |
63 | // optional, but if called it has to come be before set_points()
64 | void set_boundary(bd_type left, double left_value,
65 | bd_type right, double right_value,
66 | bool force_linear_extrapolation = false);
67 |
68 | void set_points(const std::vector &_points);
69 |
70 | double calculate_y(double x) const;
71 | double calculate_dy(double x) const;
72 | double calculate_ddy(double x) const;
73 | };
74 |
75 | class Spline2D
76 | {
77 | private:
78 | Spline sx;
79 | Spline sy;
80 |
81 | public:
82 | std::size_t IN;
83 | std::vector IS;
84 | std::vector IPoints;
85 |
86 | Spline2D() = default;
87 | ~Spline2D() = default;
88 |
89 | void clean();
90 |
91 | template
92 | void set_points(const std::vector> &_points, bool is_spline = false, double ds = 0.1);
93 |
94 | cv::Point2d calculate_position(double s) const;
95 | double calculate_curvature(double s) const;
96 | double calculate_yaw(double s) const;
97 | };
98 |
99 | template
100 | void Spline2D::set_points(const std::vector> &_points, bool is_spline, double ds)
101 | {
102 | this->clean();
103 | std::size_t n = _points.size();
104 | std::vector px(n, {0, 0}), py(n, {0, 0});
105 | px[0].y = _points[0].x;
106 | py[0].y = _points[0].y;
107 | double s = 0;
108 | for (std::size_t i = 1; i < n; i++)
109 | {
110 | s += hypot(_points[i].x - _points[i - 1].x, _points[i].y - _points[i - 1].y);
111 | px[i] = {s, (double)_points[i].x};
112 | py[i] = {s, (double)_points[i].y};
113 | }
114 | this->sx.set_points(px);
115 | this->sy.set_points(py);
116 |
117 | if (is_spline)
118 | {
119 | this->IN = 0;
120 | this->IPoints.reserve(ceil(s / ds) + 1);
121 | this->IS.reserve(ceil(s / ds) + 1);
122 | double cur_s = 0;
123 | while (cur_s <= s)
124 | {
125 | ++this->IN;
126 | this->IS.emplace_back(cur_s);
127 | this->IPoints.emplace_back(this->calculate_position(cur_s));
128 | cur_s += ds;
129 | if (s > cur_s && s - cur_s < ds)
130 | cur_s = s;
131 | }
132 | }
133 | else
134 | {
135 | this->IN = n;
136 | this->IPoints.reserve(n);
137 | this->IS.reserve(n);
138 | for (std::size_t i = 0; i < n; i++)
139 | {
140 | this->IS.push_back(px[i].x);
141 | this->IPoints.emplace_back(px[i].y, py[i].y);
142 | }
143 | }
144 | }
145 | } // namespace frl
146 | #endif /* _SPLINE_H */
147 |
--------------------------------------------------------------------------------