Basic segment settings and generation
This commit is contained in:
parent
28e8c15fc1
commit
95cfe0cf43
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
|
@ -1,13 +1,29 @@
|
||||||
cmake_minimum_required(VERSION 3.20)
|
cmake_minimum_required(VERSION 3.20)
|
||||||
project(TimeCoil)
|
project(TimeCoil)
|
||||||
|
|
||||||
SET(PROJECT_SOURCES src/main.cpp src/glad.c)
|
include(FetchContent)
|
||||||
include_directories(${CMAKE_CURRENT_SOURCE_DIR}/src ${CMAKE_CURRENT_SOURCE_DIR}/include )
|
|
||||||
|
SET(PROJECT_SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/src/main.cpp src/glad.c
|
||||||
|
${CMAKE_CURRENT_SOURCE_DIR}/src/coil/coil.cpp
|
||||||
|
${CMAKE_CURRENT_SOURCE_DIR}/src/coil/segment.cpp
|
||||||
|
)
|
||||||
|
|
||||||
|
include_directories(${CMAKE_CURRENT_SOURCE_DIR}/src
|
||||||
|
${CMAKE_CURRENT_SOURCE_DIR}/include
|
||||||
|
${CMAKE_CURRENT_SOURCE_DIR}/src/coil
|
||||||
|
${CMAKE_CURRENT_SOURCE_DIR}/src/ui
|
||||||
|
)
|
||||||
|
|
||||||
add_executable(TimeCoil ${PROJECT_SOURCES})
|
add_executable(TimeCoil ${PROJECT_SOURCES})
|
||||||
|
|
||||||
|
FetchContent_Declare(
|
||||||
|
glm
|
||||||
|
GIT_REPOSITORY https://github.com/g-truc/glm.git
|
||||||
|
GIT_TAG 5847dd91b2dc85cdd8d395ccf68985310e3e0e40
|
||||||
|
)
|
||||||
|
|
||||||
|
FetchContent_MakeAvailable(glm)
|
||||||
|
|
||||||
find_package(glfw3 3.4 REQUIRED)
|
find_package(glfw3 3.4 REQUIRED)
|
||||||
find_package(OpenGL REQUIRED)
|
find_package(OpenGL REQUIRED)
|
||||||
|
target_link_libraries(TimeCoil glfw OpenGL::GL glm)
|
||||||
target_link_libraries(TimeCoil glfw)
|
|
||||||
target_link_libraries(TimeCoil OpenGL::GL)
|
|
||||||
|
|
2
build.sh
2
build.sh
|
@ -1,2 +1,2 @@
|
||||||
#!/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
cd build && cmake -DCMAKE_C_FLAGS="-g" .. && make && ./TimeCoil
|
cd build && cmake -DCMAKE_EXPORT_COMPILE_COMMANDS=ON -DCMAKE_C_FLAGS="-g -v -da -Q -O0" .. && make && ./TimeCoil > ../points.csv && python ../tools/build_3d.py ../points.csv
|
||||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -0,0 +1,366 @@
|
||||||
|
x,y,z
|
||||||
|
10,0,0
|
||||||
|
9.99852,0,0.172134
|
||||||
|
9.99407,0,0.344216
|
||||||
|
9.98667,0,0.516197
|
||||||
|
9.9763,0,0.688024
|
||||||
|
9.96298,0,0.859648
|
||||||
|
9.94671,0,1.03102
|
||||||
|
9.92749,0,1.20208
|
||||||
|
9.90532,0,1.37279
|
||||||
|
9.88023,0,1.54309
|
||||||
|
9.8522,0,1.71293
|
||||||
|
9.82126,0,1.88227
|
||||||
|
9.7874,0,2.05104
|
||||||
|
9.75064,0,2.21921
|
||||||
|
9.711,0,2.38673
|
||||||
|
9.66848,0,2.55353
|
||||||
|
9.62309,0,2.71958
|
||||||
|
9.57485,0,2.88482
|
||||||
|
9.52378,0,3.04921
|
||||||
|
9.46988,0,3.2127
|
||||||
|
9.41317,0,3.37523
|
||||||
|
9.35368,0,3.53676
|
||||||
|
9.29141,0,3.69725
|
||||||
|
9.2264,0,3.85663
|
||||||
|
9.15864,0,4.01488
|
||||||
|
9.08818,0,4.17194
|
||||||
|
9.01502,0,4.32776
|
||||||
|
8.93919,0,4.48229
|
||||||
|
8.86071,0,4.6355
|
||||||
|
8.7796,0,4.78734
|
||||||
|
8.69589,0,4.93776
|
||||||
|
8.60961,0,5.08671
|
||||||
|
8.52077,0,5.23416
|
||||||
|
8.42942,0,5.38005
|
||||||
|
8.33556,0,5.52435
|
||||||
|
8.23923,0,5.66702
|
||||||
|
8.14046,0,5.808
|
||||||
|
8.03928,0,5.94727
|
||||||
|
7.93572,0,6.08477
|
||||||
|
7.8298,0,6.22047
|
||||||
|
7.72157,0,6.35432
|
||||||
|
7.61104,0,6.4863
|
||||||
|
7.49826,0,6.61635
|
||||||
|
7.38326,0,6.74444
|
||||||
|
7.26608,0,6.87053
|
||||||
|
7.14673,0,6.99458
|
||||||
|
7.02527,0,7.11657
|
||||||
|
6.90173,0,7.23644
|
||||||
|
6.77615,0,7.35417
|
||||||
|
6.64855,0,7.46972
|
||||||
|
6.51899,0,7.58306
|
||||||
|
6.38749,0,7.69415
|
||||||
|
6.25411,0,7.80296
|
||||||
|
6.11886,0,7.90946
|
||||||
|
5.98181,0,8.01361
|
||||||
|
5.84298,0,8.11539
|
||||||
|
5.70242,0,8.21477
|
||||||
|
5.56017,0,8.31171
|
||||||
|
5.41628,0,8.40618
|
||||||
|
5.27078,0,8.49817
|
||||||
|
5.12371,0,8.58764
|
||||||
|
4.97513,0,8.67456
|
||||||
|
4.82508,0,8.75892
|
||||||
|
4.67359,0,8.84067
|
||||||
|
4.52072,0,8.91981
|
||||||
|
4.36651,0,8.99631
|
||||||
|
4.21101,0,9.07014
|
||||||
|
4.05426,0,9.14128
|
||||||
|
3.89631,0,9.20971
|
||||||
|
3.7372,0,9.27542
|
||||||
|
3.57698,0,9.33837
|
||||||
|
3.41571,0,9.39856
|
||||||
|
3.25342,0,9.45596
|
||||||
|
3.09017,0,9.51057
|
||||||
|
2.926,0,9.56235
|
||||||
|
2.76097,0,9.6113
|
||||||
|
2.59512,0,9.6574
|
||||||
|
2.4285,0,9.70064
|
||||||
|
2.26116,0,9.741
|
||||||
|
2.09315,0,9.77848
|
||||||
|
1.92452,0,9.81306
|
||||||
|
1.75531,0,9.84474
|
||||||
|
1.58559,0,9.87349
|
||||||
|
1.4154,0,9.89932
|
||||||
|
1.24479,0,9.92222
|
||||||
|
1.07381,0,9.94218
|
||||||
|
0.902517,0,9.95919
|
||||||
|
0.730951,0,9.97325
|
||||||
|
0.55917,0,9.98435
|
||||||
|
0.387223,0,9.9925
|
||||||
|
0.215162,0,9.99768
|
||||||
|
0.0430352,0,9.99991
|
||||||
|
-0.129103,0,9.99917
|
||||||
|
-0.301203,0,9.99546
|
||||||
|
-0.473213,0,9.9888
|
||||||
|
-0.645085,0,9.97917
|
||||||
|
-0.816763,0,9.96659
|
||||||
|
-0.988201,0,9.95105
|
||||||
|
-1.15935,0,9.93257
|
||||||
|
-1.33015,0,9.91114
|
||||||
|
-1.50055,0,9.88678
|
||||||
|
-1.67052,0,9.85948
|
||||||
|
-1.83998,0,9.82927
|
||||||
|
-2.00891,0,9.79614
|
||||||
|
-2.17723,0,9.76011
|
||||||
|
-2.34491,0,9.72118
|
||||||
|
-2.5119,0,9.67938
|
||||||
|
-2.67814,0,9.63471
|
||||||
|
-2.84359,0,9.58718
|
||||||
|
-3.0082,0,9.53681
|
||||||
|
-3.17191,0,9.48362
|
||||||
|
-3.33469,0,9.42761
|
||||||
|
-3.49647,0,9.36881
|
||||||
|
-3.65723,0,9.30724
|
||||||
|
-3.81689,0,9.24291
|
||||||
|
-3.97543,0,9.17584
|
||||||
|
-4.13279,0,9.10605
|
||||||
|
-4.28892,0,9.03356
|
||||||
|
-4.44378,0,8.95839
|
||||||
|
-4.59733,0,8.88057
|
||||||
|
-4.74951,0,8.80012
|
||||||
|
-4.90029,0,8.71706
|
||||||
|
-5.04961,0,8.63142
|
||||||
|
-5.19744,0,8.54322
|
||||||
|
-5.34373,0,8.45249
|
||||||
|
-5.48843,0,8.35925
|
||||||
|
-5.63151,0,8.26354
|
||||||
|
-5.77292,0,8.16538
|
||||||
|
-5.91261,0,8.0648
|
||||||
|
-6.05056,0,7.96183
|
||||||
|
-6.18671,0,7.8565
|
||||||
|
-6.32103,0,7.74884
|
||||||
|
-6.45348,0,7.63889
|
||||||
|
-6.58402,0,7.52667
|
||||||
|
-6.7126,0,7.41222
|
||||||
|
-6.83919,0,7.29558
|
||||||
|
-6.96376,0,7.17677
|
||||||
|
-7.08627,0,7.05584
|
||||||
|
-7.20667,0,6.93281
|
||||||
|
-7.32494,0,6.80773
|
||||||
|
-7.44104,0,6.68064
|
||||||
|
-7.55493,0,6.55156
|
||||||
|
-7.66659,0,6.42055
|
||||||
|
-7.77597,0,6.28763
|
||||||
|
-7.88305,0,6.15285
|
||||||
|
-7.98779,0,6.01624
|
||||||
|
-8.09017,0,5.87785
|
||||||
|
-8.19015,0,5.73772
|
||||||
|
-8.2877,0,5.59589
|
||||||
|
-8.3828,0,5.4524
|
||||||
|
-8.47541,0,5.3073
|
||||||
|
-8.56551,0,5.16063
|
||||||
|
-8.65307,0,5.01242
|
||||||
|
-8.73807,0,4.86273
|
||||||
|
-8.82048,0,4.71159
|
||||||
|
-8.90028,0,4.55907
|
||||||
|
-8.97743,0,4.40519
|
||||||
|
-9.05193,0,4.25
|
||||||
|
-9.12375,0,4.09356
|
||||||
|
-9.19286,0,3.9359
|
||||||
|
-9.25925,0,3.77708
|
||||||
|
-9.32289,0,3.61714
|
||||||
|
-9.38377,0,3.45612
|
||||||
|
-9.44188,0,3.29409
|
||||||
|
-9.49718,0,3.13107
|
||||||
|
-9.54967,0,2.96713
|
||||||
|
-9.59933,0,2.80231
|
||||||
|
-9.64614,0,2.63666
|
||||||
|
-9.6901,0,2.47022
|
||||||
|
-9.73118,0,2.30306
|
||||||
|
-9.76938,0,2.13521
|
||||||
|
-9.80469,0,1.96673
|
||||||
|
-9.83709,0,1.79767
|
||||||
|
-9.86658,0,1.62807
|
||||||
|
-9.89314,0,1.45799
|
||||||
|
-9.91677,0,1.28748
|
||||||
|
-9.93747,0,1.11659
|
||||||
|
-9.95521,0,0.945367
|
||||||
|
-9.97001,0,0.773866
|
||||||
|
-9.98186,0,0.602133
|
||||||
|
-9.99074,0,0.430224
|
||||||
|
-9.99667,0,0.258183
|
||||||
|
-9.99963,0,0.0860696
|
||||||
|
-9.99963,0,-0.0860689
|
||||||
|
-9.99667,0,-0.258184
|
||||||
|
-9.99074,0,-0.430223
|
||||||
|
-9.98186,0,-0.602132
|
||||||
|
-9.97001,0,-0.773865
|
||||||
|
-9.95521,0,-0.945366
|
||||||
|
-9.93747,0,-1.11659
|
||||||
|
-9.91677,0,-1.28748
|
||||||
|
-9.89314,0,-1.45799
|
||||||
|
-9.86658,0,-1.62807
|
||||||
|
-9.83709,0,-1.79766
|
||||||
|
-9.80469,0,-1.96673
|
||||||
|
-9.76938,0,-2.13521
|
||||||
|
-9.73118,0,-2.30306
|
||||||
|
-9.6901,0,-2.47022
|
||||||
|
-9.64614,0,-2.63666
|
||||||
|
-9.59933,0,-2.80231
|
||||||
|
-9.54967,0,-2.96713
|
||||||
|
-9.49718,0,-3.13107
|
||||||
|
-9.44188,0,-3.29408
|
||||||
|
-9.38377,0,-3.45612
|
||||||
|
-9.32289,0,-3.61714
|
||||||
|
-9.25925,0,-3.77708
|
||||||
|
-9.19286,0,-3.9359
|
||||||
|
-9.12375,0,-4.09356
|
||||||
|
-9.05193,0,-4.25
|
||||||
|
-8.97743,0,-4.40519
|
||||||
|
-8.90028,0,-4.55907
|
||||||
|
-8.82048,0,-4.71159
|
||||||
|
-8.73807,0,-4.86273
|
||||||
|
-8.65307,0,-5.01242
|
||||||
|
-8.56551,0,-5.16062
|
||||||
|
-8.47541,0,-5.3073
|
||||||
|
-8.3828,0,-5.4524
|
||||||
|
-8.2877,0,-5.59589
|
||||||
|
-8.19015,0,-5.73772
|
||||||
|
-8.09017,0,-5.87785
|
||||||
|
-7.98779,0,-6.01624
|
||||||
|
-7.88305,0,-6.15284
|
||||||
|
-7.77597,0,-6.28763
|
||||||
|
-7.66659,0,-6.42055
|
||||||
|
-7.55493,0,-6.55156
|
||||||
|
-7.44104,0,-6.68064
|
||||||
|
-7.32494,0,-6.80773
|
||||||
|
-7.20667,0,-6.93281
|
||||||
|
-7.08627,0,-7.05584
|
||||||
|
-6.96376,0,-7.17677
|
||||||
|
-6.83919,0,-7.29558
|
||||||
|
-6.7126,0,-7.41222
|
||||||
|
-6.58402,0,-7.52667
|
||||||
|
-6.45348,0,-7.63889
|
||||||
|
-6.32103,0,-7.74884
|
||||||
|
-6.18671,0,-7.8565
|
||||||
|
-6.05056,0,-7.96183
|
||||||
|
-5.91262,0,-8.0648
|
||||||
|
-5.77292,0,-8.16538
|
||||||
|
-5.63151,0,-8.26354
|
||||||
|
-5.48843,0,-8.35926
|
||||||
|
-5.34373,0,-8.45249
|
||||||
|
-5.19744,0,-8.54322
|
||||||
|
-5.04961,0,-8.63142
|
||||||
|
-4.90029,0,-8.71706
|
||||||
|
-4.74951,0,-8.80012
|
||||||
|
-4.59733,0,-8.88057
|
||||||
|
-4.44378,0,-8.95839
|
||||||
|
-4.28892,0,-9.03356
|
||||||
|
-4.13279,0,-9.10605
|
||||||
|
-3.97543,0,-9.17584
|
||||||
|
-3.81689,0,-9.24291
|
||||||
|
-3.65723,0,-9.30724
|
||||||
|
-3.49648,0,-9.36881
|
||||||
|
-3.33469,0,-9.42761
|
||||||
|
-3.17191,0,-9.48362
|
||||||
|
-3.0082,0,-9.53681
|
||||||
|
-2.84359,0,-9.58718
|
||||||
|
-2.67814,0,-9.63471
|
||||||
|
-2.5119,0,-9.67938
|
||||||
|
-2.34491,0,-9.72118
|
||||||
|
-2.17724,0,-9.76011
|
||||||
|
-2.00891,0,-9.79614
|
||||||
|
-1.83998,0,-9.82927
|
||||||
|
-1.67052,0,-9.85948
|
||||||
|
-1.50055,0,-9.88678
|
||||||
|
-1.33015,0,-9.91114
|
||||||
|
-1.15934,0,-9.93257
|
||||||
|
-0.988203,0,-9.95105
|
||||||
|
-0.816765,0,-9.96659
|
||||||
|
-0.645084,0,-9.97917
|
||||||
|
-0.473217,0,-9.9888
|
||||||
|
-0.301206,0,-9.99546
|
||||||
|
-0.1291,0,-9.99917
|
||||||
|
0.0430345,0,-9.99991
|
||||||
|
0.215161,0,-9.99768
|
||||||
|
0.387224,0,-9.9925
|
||||||
|
0.559167,0,-9.98435
|
||||||
|
0.730949,0,-9.97325
|
||||||
|
0.902515,0,-9.95919
|
||||||
|
1.07381,0,-9.94218
|
||||||
|
1.24479,0,-9.92222
|
||||||
|
1.4154,0,-9.89932
|
||||||
|
1.58559,0,-9.87349
|
||||||
|
1.75531,0,-9.84474
|
||||||
|
1.92452,0,-9.81306
|
||||||
|
2.09314,0,-9.77848
|
||||||
|
2.26115,0,-9.741
|
||||||
|
2.42849,0,-9.70064
|
||||||
|
2.59512,0,-9.6574
|
||||||
|
2.76097,0,-9.6113
|
||||||
|
2.926,0,-9.56235
|
||||||
|
3.09017,0,-9.51056
|
||||||
|
3.25342,0,-9.45597
|
||||||
|
3.41571,0,-9.39856
|
||||||
|
3.57698,0,-9.33837
|
||||||
|
3.73719,0,-9.27542
|
||||||
|
3.89631,0,-9.20971
|
||||||
|
4.05426,0,-9.14128
|
||||||
|
4.21101,0,-9.07014
|
||||||
|
4.36651,0,-8.99631
|
||||||
|
4.52072,0,-8.91981
|
||||||
|
4.67359,0,-8.84068
|
||||||
|
4.82508,0,-8.75892
|
||||||
|
4.97513,0,-8.67456
|
||||||
|
5.12372,0,-8.58764
|
||||||
|
5.27078,0,-8.49817
|
||||||
|
5.41628,0,-8.40618
|
||||||
|
5.56018,0,-8.3117
|
||||||
|
5.70242,0,-8.21477
|
||||||
|
5.84298,0,-8.11539
|
||||||
|
5.98181,0,-8.01361
|
||||||
|
6.11886,0,-7.90946
|
||||||
|
6.25411,0,-7.80296
|
||||||
|
6.3875,0,-7.69415
|
||||||
|
6.51899,0,-7.58306
|
||||||
|
6.64855,0,-7.46972
|
||||||
|
6.77615,0,-7.35417
|
||||||
|
6.90173,0,-7.23644
|
||||||
|
7.02527,0,-7.11657
|
||||||
|
7.14673,0,-6.99458
|
||||||
|
7.26607,0,-6.87053
|
||||||
|
7.38326,0,-6.74444
|
||||||
|
7.49826,0,-6.61634
|
||||||
|
7.61104,0,-6.48629
|
||||||
|
7.72156,0,-6.35432
|
||||||
|
7.8298,0,-6.22047
|
||||||
|
7.93572,0,-6.08477
|
||||||
|
8.03928,0,-5.94727
|
||||||
|
8.14046,0,-5.808
|
||||||
|
8.23923,0,-5.66702
|
||||||
|
8.33556,0,-5.52435
|
||||||
|
8.42941,0,-5.38005
|
||||||
|
8.52078,0,-5.23416
|
||||||
|
8.60961,0,-5.08671
|
||||||
|
8.69589,0,-4.93776
|
||||||
|
8.7796,0,-4.78734
|
||||||
|
8.8607,0,-4.63551
|
||||||
|
8.93919,0,-4.48229
|
||||||
|
9.01502,0,-4.32775
|
||||||
|
9.08817,0,-4.17194
|
||||||
|
9.15864,0,-4.01488
|
||||||
|
9.2264,0,-3.85663
|
||||||
|
9.29141,0,-3.69725
|
||||||
|
9.35368,0,-3.53676
|
||||||
|
9.41317,0,-3.37523
|
||||||
|
9.46988,0,-3.21269
|
||||||
|
9.52378,0,-3.04921
|
||||||
|
9.57485,0,-2.88482
|
||||||
|
9.62309,0,-2.71958
|
||||||
|
9.66848,0,-2.55354
|
||||||
|
9.711,0,-2.38673
|
||||||
|
9.75064,0,-2.21922
|
||||||
|
9.7874,0,-2.05105
|
||||||
|
9.82126,0,-1.88227
|
||||||
|
9.8522,0,-1.71293
|
||||||
|
9.88023,0,-1.54309
|
||||||
|
9.90532,0,-1.37279
|
||||||
|
9.92749,0,-1.20208
|
||||||
|
9.94671,0,-1.03102
|
||||||
|
9.96298,0,-0.859651
|
||||||
|
9.9763,0,-0.688026
|
||||||
|
9.98667,0,-0.516193
|
||||||
|
9.99407,0,-0.344216
|
||||||
|
9.99852,0,-0.172133
|
|
|
@ -0,0 +1,153 @@
|
||||||
|
x,y,z
|
||||||
|
1,0,0
|
||||||
|
0.99978,-0.0208,0
|
||||||
|
0.99913,-0.0416,0
|
||||||
|
0.99805,-0.06238,0
|
||||||
|
0.99654,-0.08312,0
|
||||||
|
0.99459,-0.10384,0
|
||||||
|
0.99222,-0.12451,0
|
||||||
|
0.98941,-0.14512,0
|
||||||
|
0.98618,-0.16567,0
|
||||||
|
0.98252,-0.18615,0
|
||||||
|
0.97844,-0.20655,0
|
||||||
|
0.97393,-0.22687,0
|
||||||
|
0.969,-0.24708,0
|
||||||
|
0.96365,-0.26718,0
|
||||||
|
0.95788,-0.28717,0
|
||||||
|
0.9517,-0.30704,0
|
||||||
|
0.9451,-0.32677,0
|
||||||
|
0.9381,-0.34636,0
|
||||||
|
0.93069,-0.3658,0
|
||||||
|
0.92288,-0.38508,0
|
||||||
|
0.91467,-0.4042,0
|
||||||
|
0.90606,-0.42314,0
|
||||||
|
0.89706,-0.4419,0
|
||||||
|
0.88768,-0.46047,0
|
||||||
|
0.87791,-0.47883,0
|
||||||
|
0.86775,-0.49699,0
|
||||||
|
0.85723,-0.51494,0
|
||||||
|
0.84633,-0.53266,0
|
||||||
|
0.83506,-0.55015,0
|
||||||
|
0.82344,-0.56741,0
|
||||||
|
0.81146,-0.58441,0
|
||||||
|
0.79912,-0.60117,0
|
||||||
|
0.78644,-0.61766,0
|
||||||
|
0.77342,-0.63389,0
|
||||||
|
0.76007,-0.64984,0
|
||||||
|
0.74638,-0.66552,0
|
||||||
|
0.73238,-0.6809,0
|
||||||
|
0.71805,-0.69599,0
|
||||||
|
0.70342,-0.71078,0
|
||||||
|
0.68848,-0.72526,0
|
||||||
|
0.67324,-0.73942,0
|
||||||
|
0.65771,-0.75327,0
|
||||||
|
0.6419,-0.76679,0
|
||||||
|
0.62581,-0.77997,0
|
||||||
|
0.60945,-0.79283,0
|
||||||
|
0.59282,-0.80533,0
|
||||||
|
0.57594,-0.81749,0
|
||||||
|
0.55881,-0.8293,0
|
||||||
|
0.54144,-0.84074,0
|
||||||
|
0.52383,-0.85182,0
|
||||||
|
0.50599,-0.86254,0
|
||||||
|
0.48794,-0.87288,0
|
||||||
|
0.46968,-0.88284,0
|
||||||
|
0.45121,-0.89242,0
|
||||||
|
0.43254,-0.90161,0
|
||||||
|
0.41369,-0.91042,0
|
||||||
|
0.39466,-0.91883,0
|
||||||
|
0.37546,-0.92684,0
|
||||||
|
0.3561,-0.93445,0
|
||||||
|
0.33658,-0.94165,0
|
||||||
|
0.31692,-0.94845,0
|
||||||
|
0.29712,-0.95484,0
|
||||||
|
0.27719,-0.96081,0
|
||||||
|
0.25714,-0.96637,0
|
||||||
|
0.23698,-0.97151,0
|
||||||
|
0.21672,-0.97623,0
|
||||||
|
0.19637,-0.98053,0
|
||||||
|
0.17592,-0.9844,0
|
||||||
|
0.15541,-0.98785,0
|
||||||
|
0.13482,-0.99087,0
|
||||||
|
0.11418,-0.99346,0
|
||||||
|
0.09349,-0.99562,0
|
||||||
|
0.07275,-0.99735,0
|
||||||
|
0.05199,-0.99865,0
|
||||||
|
0.0312,-0.99951,0
|
||||||
|
0.0104,-0.99995,0
|
||||||
|
-0.0104,-0.99995,0
|
||||||
|
-0.0312,-0.99951,0
|
||||||
|
-0.05199,-0.99865,0
|
||||||
|
-0.07275,-0.99735,0
|
||||||
|
-0.09349,-0.99562,0
|
||||||
|
-0.11418,-0.99346,0
|
||||||
|
-0.13482,-0.99087,0
|
||||||
|
-0.15541,-0.98785,0
|
||||||
|
-0.17592,-0.9844,0
|
||||||
|
-0.19637,-0.98053,0
|
||||||
|
-0.21672,-0.97623,0
|
||||||
|
-0.23698,-0.97151,0
|
||||||
|
-0.25714,-0.96637,0
|
||||||
|
-0.27719,-0.96081,0
|
||||||
|
-0.29712,-0.95484,0
|
||||||
|
-0.31692,-0.94845,0
|
||||||
|
-0.33658,-0.94165,0
|
||||||
|
-0.3561,-0.93445,0
|
||||||
|
-0.37546,-0.92684,0
|
||||||
|
-0.39466,-0.91883,0
|
||||||
|
-0.41369,-0.91042,0
|
||||||
|
-0.43254,-0.90161,0
|
||||||
|
-0.45121,-0.89242,0
|
||||||
|
-0.46968,-0.88284,0
|
||||||
|
-0.48794,-0.87288,0
|
||||||
|
-0.50599,-0.86254,0
|
||||||
|
-0.52383,-0.85182,0
|
||||||
|
-0.54144,-0.84074,0
|
||||||
|
-0.55881,-0.8293,0
|
||||||
|
-0.57594,-0.81749,0
|
||||||
|
-0.59282,-0.80533,0
|
||||||
|
-0.60945,-0.79283,0
|
||||||
|
-0.62581,-0.77997,0
|
||||||
|
-0.6419,-0.76679,0
|
||||||
|
-0.65771,-0.75327,0
|
||||||
|
-0.67324,-0.73942,0
|
||||||
|
-0.68848,-0.72526,0
|
||||||
|
-0.70342,-0.71078,0
|
||||||
|
-0.71805,-0.69599,0
|
||||||
|
-0.73238,-0.6809,0
|
||||||
|
-0.74638,-0.66552,0
|
||||||
|
-0.76007,-0.64984,0
|
||||||
|
-0.77342,-0.63389,0
|
||||||
|
-0.78644,-0.61766,0
|
||||||
|
-0.79912,-0.60117,0
|
||||||
|
-0.81146,-0.58441,0
|
||||||
|
-0.82344,-0.56741,0
|
||||||
|
-0.83506,-0.55015,0
|
||||||
|
-0.84633,-0.53266,0
|
||||||
|
-0.85723,-0.51494,0
|
||||||
|
-0.86775,-0.49699,0
|
||||||
|
-0.87791,-0.47883,0
|
||||||
|
-0.88768,-0.46047,0
|
||||||
|
-0.89706,-0.4419,0
|
||||||
|
-0.90606,-0.42314,0
|
||||||
|
-0.91467,-0.4042,0
|
||||||
|
-0.92288,-0.38508,0
|
||||||
|
-0.93069,-0.3658,0
|
||||||
|
-0.9381,-0.34636,0
|
||||||
|
-0.9451,-0.32677,0
|
||||||
|
-0.9517,-0.30704,0
|
||||||
|
-0.95788,-0.28717,0
|
||||||
|
-0.96365,-0.26718,0
|
||||||
|
-0.969,-0.24708,0
|
||||||
|
-0.97393,-0.22687,0
|
||||||
|
-0.97844,-0.20655,0
|
||||||
|
-0.98252,-0.18615,0
|
||||||
|
-0.98618,-0.16567,0
|
||||||
|
-0.98941,-0.14512,0
|
||||||
|
-0.99222,-0.12451,0
|
||||||
|
-0.99459,-0.10384,0
|
||||||
|
-0.99654,-0.08312,0
|
||||||
|
-0.99805,-0.06238,0
|
||||||
|
-0.99913,-0.0416,0
|
||||||
|
-0.99978,-0.0208,0
|
||||||
|
-1,0,0
|
|
|
@ -0,0 +1,17 @@
|
||||||
|
#include "coil.hpp"
|
||||||
|
|
||||||
|
Coil::Coil(uint32_t currentYear, uint32_t amountOfSegments)
|
||||||
|
: currentYear(currentYear) {
|
||||||
|
for (short i = amountOfSegments / -2.; i < amountOfSegments / 2.; i++) {
|
||||||
|
uint32_t year = this->currentYear + i;
|
||||||
|
segments.push_back(CoilSegment(this, year, segmentHeight, i, 3,false));
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
std::vector<CoilSegment> &Coil::getSegments() {
|
||||||
|
return segments;
|
||||||
|
}
|
||||||
|
|
||||||
|
double Coil::getWidth() {
|
||||||
|
return width;
|
||||||
|
}
|
|
@ -0,0 +1,25 @@
|
||||||
|
#include <vector>
|
||||||
|
#include "segment.hpp"
|
||||||
|
|
||||||
|
#ifndef COIL_HPP
|
||||||
|
#define COIL_HPP
|
||||||
|
|
||||||
|
// Coil segment is a one turn of a coil
|
||||||
|
// Coil slice is a set of points that define slice of coil
|
||||||
|
|
||||||
|
class Coil {
|
||||||
|
// distance between coil center and nearest to it coil edge
|
||||||
|
double radius;
|
||||||
|
// distance between coil slices edges
|
||||||
|
double width;
|
||||||
|
double segmentHeight;
|
||||||
|
uint32_t currentYear;
|
||||||
|
std::vector<CoilSegment> segments;
|
||||||
|
|
||||||
|
public:
|
||||||
|
Coil(uint32_t currentYear, uint32_t amountOfSegments);
|
||||||
|
std::vector<CoilSegment> &getSegments();
|
||||||
|
double getWidth();
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif // COIL_HPP
|
|
@ -0,0 +1,225 @@
|
||||||
|
#include "segment.hpp"
|
||||||
|
#include "coil.hpp"
|
||||||
|
#include "glm/ext/matrix_float4x4.hpp"
|
||||||
|
#include "glm/ext/matrix_transform.hpp"
|
||||||
|
#include "glm/trigonometric.hpp"
|
||||||
|
#include <cstring>
|
||||||
|
#include <iostream>
|
||||||
|
#include <glm/glm.hpp>
|
||||||
|
#include <cstdint>
|
||||||
|
|
||||||
|
// x, y, z, r, g, b
|
||||||
|
#define FIELDS_IN_POINT 6
|
||||||
|
#define DAYS_IN_YEAR (isLeap? 366.0f : 365.0f)
|
||||||
|
|
||||||
|
using glm::vec4;
|
||||||
|
using glm::vec3;
|
||||||
|
using glm::mat4;
|
||||||
|
using glm::radians;
|
||||||
|
using glm::rotate;
|
||||||
|
using glm::sin;
|
||||||
|
using glm::cos;
|
||||||
|
using glm::translate;
|
||||||
|
|
||||||
|
using std::endl;
|
||||||
|
using std::cout;
|
||||||
|
using std::cerr;
|
||||||
|
|
||||||
|
CoilSegment::CoilSegment(
|
||||||
|
Coil* coil,
|
||||||
|
uint16_t year,
|
||||||
|
uint16_t height,
|
||||||
|
int shift,
|
||||||
|
uint32_t sliceDetalization,
|
||||||
|
bool isLeap
|
||||||
|
) :
|
||||||
|
coil(coil), year(year),
|
||||||
|
height(height), shift(shift),
|
||||||
|
sliceDetalization(sliceDetalization), isLeap(isLeap) {
|
||||||
|
init();
|
||||||
|
calculate();
|
||||||
|
}
|
||||||
|
|
||||||
|
void CoilSegment::init () {
|
||||||
|
verticesLength = DAYS_IN_YEAR * FIELDS_IN_POINT * (sliceDetalization+2);
|
||||||
|
vertices = (double *) calloc(verticesLength, sizeof(double));
|
||||||
|
if (vertices == NULL) {
|
||||||
|
cerr << "Allocation failed" << endl;
|
||||||
|
exit(-1);
|
||||||
|
}
|
||||||
|
// cout << "Initialized CoilSegment"
|
||||||
|
// << "(year: " << year
|
||||||
|
// << ", height: " << height
|
||||||
|
// << ", shift: " << shift
|
||||||
|
// << ", isLeap: " << isLeap <<")" << endl;
|
||||||
|
}
|
||||||
|
|
||||||
|
void CoilSegment::printVertices() {
|
||||||
|
for (uint16_t day = 0; day < DAYS_IN_YEAR; day ++) {
|
||||||
|
cout << "Day " << day << ", " <<
|
||||||
|
"x: " << vertices[FIELDS_IN_POINT * day + 0] << ", " <<
|
||||||
|
"y: " << vertices[FIELDS_IN_POINT * day + 1] << ", " <<
|
||||||
|
"z: " << vertices[FIELDS_IN_POINT * day + 2] << ", " <<
|
||||||
|
"r: " << vertices[FIELDS_IN_POINT * day + 3] << ", " <<
|
||||||
|
"g: " << vertices[FIELDS_IN_POINT * day + 4] << ", " <<
|
||||||
|
"b: " << vertices[FIELDS_IN_POINT * day + 5] << endl;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
double round_to_presicion( double value, int precision ) {
|
||||||
|
const int adjustment = pow(10,precision);
|
||||||
|
return floor( value*(adjustment) + 0.5 )/adjustment;
|
||||||
|
}
|
||||||
|
|
||||||
|
double *CoilSegment::calculateSlice() {
|
||||||
|
uint32_t size = (/*start and end of a slize*/2 + sliceDetalization) * FIELDS_IN_POINT * sizeof(double);
|
||||||
|
double *slice = (double *)malloc(size);
|
||||||
|
// Start of a slice
|
||||||
|
slice[0] = cos(0);
|
||||||
|
slice[1] = sin(0);
|
||||||
|
slice[2] = 0;
|
||||||
|
slice[3] = 1;
|
||||||
|
slice[4] = 1;
|
||||||
|
slice[5] = 1;
|
||||||
|
|
||||||
|
double degreeByPoint = -180. / (sliceDetalization + 1);
|
||||||
|
|
||||||
|
for (uint32_t i = 1; i <= sliceDetalization; i ++) {
|
||||||
|
uint32_t offset = FIELDS_IN_POINT * i;
|
||||||
|
|
||||||
|
slice[offset + 0] = round_to_presicion(cos(radians(degreeByPoint * i)), 5);
|
||||||
|
slice[offset + 1] = round_to_presicion(sin(radians(degreeByPoint * i)), 5);
|
||||||
|
slice[offset + 2] = 0;
|
||||||
|
slice[offset + 3] = 1;
|
||||||
|
slice[offset + 4] = 1;
|
||||||
|
slice[offset + 5] = 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
// End of a slice
|
||||||
|
uint32_t endIndex = (size / sizeof(double) - FIELDS_IN_POINT);
|
||||||
|
slice[endIndex + 0] = round_to_presicion(cos(radians(180.)), 5);
|
||||||
|
slice[endIndex + 1] = round_to_presicion(sin(radians(180.)), 5);
|
||||||
|
slice[endIndex + 2] = 0;
|
||||||
|
slice[endIndex + 3] = 1;
|
||||||
|
slice[endIndex + 4] = 1;
|
||||||
|
slice[endIndex + 5] = 1;
|
||||||
|
|
||||||
|
return slice;
|
||||||
|
}
|
||||||
|
|
||||||
|
void CoilSegment::constructSegment(double *slice) {
|
||||||
|
|
||||||
|
double degreesPerDay = 360.f / DAYS_IN_YEAR;
|
||||||
|
|
||||||
|
for (uint32_t day = 0; day < DAYS_IN_YEAR; day ++) {
|
||||||
|
float daysDegree = day * degreesPerDay;
|
||||||
|
// TODO: replace 10 to coil->getWidth();
|
||||||
|
vec3 daysPosition = vec3(
|
||||||
|
cos(radians(daysDegree)) * 200,
|
||||||
|
10* daysDegree/360.,
|
||||||
|
sin(radians(daysDegree)) * 200
|
||||||
|
);
|
||||||
|
|
||||||
|
mat4 transform = mat4(1.);
|
||||||
|
// For some reason I cannot combine transform and rotation to one singe matrix.
|
||||||
|
// TODO: investigate and fix
|
||||||
|
// transform = translate(
|
||||||
|
// transform,
|
||||||
|
// daysPosition
|
||||||
|
// );
|
||||||
|
|
||||||
|
transform = rotate(
|
||||||
|
transform,
|
||||||
|
radians(daysDegree),
|
||||||
|
vec3(
|
||||||
|
0.0,
|
||||||
|
1.0,
|
||||||
|
0.0
|
||||||
|
)
|
||||||
|
);
|
||||||
|
|
||||||
|
for (uint32_t slicePoint = 0; slicePoint < (2 + sliceDetalization); slicePoint ++) {
|
||||||
|
uint32_t slicePointOffset = FIELDS_IN_POINT * slicePoint;
|
||||||
|
vec4 point(
|
||||||
|
slice[slicePointOffset + 0],
|
||||||
|
slice[slicePointOffset + 1],
|
||||||
|
slice[slicePointOffset + 2],
|
||||||
|
1
|
||||||
|
);
|
||||||
|
|
||||||
|
point = point*transform ;
|
||||||
|
uint64_t currentPointOffset = day * (2+sliceDetalization) * FIELDS_IN_POINT + slicePointOffset;
|
||||||
|
vertices[currentPointOffset + 0] = point.x + daysPosition.x;
|
||||||
|
vertices[currentPointOffset + 1] = point.y + daysPosition.y;
|
||||||
|
vertices[currentPointOffset + 2] = point.z + daysPosition.z;
|
||||||
|
|
||||||
|
memcpy(
|
||||||
|
vertices + currentPointOffset + 3,
|
||||||
|
slice + slicePointOffset + 3,
|
||||||
|
3
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// Sample layout of 2 slices with 3 points.
|
||||||
|
// |x |y |z |r |g |b | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | |
|
||||||
|
// 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38
|
||||||
|
// | point | point | point | point | point | point |
|
||||||
|
// | slice | slice |
|
||||||
|
//
|
||||||
|
void CoilSegment::calculate() {
|
||||||
|
double *slice = calculateSlice();
|
||||||
|
|
||||||
|
constructSegment(slice);
|
||||||
|
exportSegmentToCsv();
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
double *CoilSegment::getVertices() {
|
||||||
|
return vertices;
|
||||||
|
}
|
||||||
|
|
||||||
|
uint16_t CoilSegment::getVerticesLength() {
|
||||||
|
return verticesLength;
|
||||||
|
}
|
||||||
|
|
||||||
|
void CoilSegment::printSlice(double *slice) {
|
||||||
|
for (uint32_t i = 0; i < sliceDetalization+2; i ++) {
|
||||||
|
uint32_t offset = FIELDS_IN_POINT * i;
|
||||||
|
cout << "Point ("
|
||||||
|
<< slice[offset + 0] << ", "
|
||||||
|
<< slice[offset + 1] << ", "
|
||||||
|
<< slice[offset + 2] << ", "
|
||||||
|
<< ") rgb("
|
||||||
|
<< slice[offset + 3] << ", "
|
||||||
|
<< slice[offset + 4] << ", "
|
||||||
|
<< slice[offset + 5] << ")"
|
||||||
|
<< endl;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void CoilSegment::exportSliceToCSV(double *slice) {
|
||||||
|
cout << "x,y,z" << endl;
|
||||||
|
|
||||||
|
for (uint32_t i = 0; i < sliceDetalization+2; i ++) {
|
||||||
|
uint32_t offset = FIELDS_IN_POINT * i;
|
||||||
|
cout
|
||||||
|
<< slice[offset + 0] << ","
|
||||||
|
<< slice[offset + 1] << ",0" << endl;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void CoilSegment::exportSegmentToCsv() {
|
||||||
|
cout << "x,y,z" << endl;
|
||||||
|
|
||||||
|
for (uint16_t day = 0; day < DAYS_IN_YEAR; day ++) {
|
||||||
|
uint64_t dayOffset = day * (2+sliceDetalization) * FIELDS_IN_POINT;
|
||||||
|
|
||||||
|
for (uint32_t point_in_slice = 0; point_in_slice < (2+sliceDetalization); point_in_slice ++) {
|
||||||
|
uint32_t sliceOffset = point_in_slice * FIELDS_IN_POINT;
|
||||||
|
cout << vertices[dayOffset + sliceOffset + 0] << ","
|
||||||
|
<< vertices[dayOffset + sliceOffset + 1] << ","
|
||||||
|
<< vertices[dayOffset + sliceOffset + 2] << endl;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,34 @@
|
||||||
|
#ifndef COIL_SEGMENT_HPP
|
||||||
|
#define COIL_SEGMENT_HPP
|
||||||
|
|
||||||
|
#include <cstdint>
|
||||||
|
|
||||||
|
class Coil;
|
||||||
|
|
||||||
|
class CoilSegment {
|
||||||
|
Coil *coil;
|
||||||
|
uint16_t year;
|
||||||
|
uint16_t height;
|
||||||
|
// Number of a segments, counting from the central (which is 0)
|
||||||
|
int shift;
|
||||||
|
uint32_t sliceDetalization;
|
||||||
|
bool isLeap;
|
||||||
|
double *vertices;
|
||||||
|
uint32_t verticesLength;
|
||||||
|
|
||||||
|
void init();
|
||||||
|
double* calculateSlice();
|
||||||
|
void constructSegment(double *slice);
|
||||||
|
|
||||||
|
public:
|
||||||
|
CoilSegment(Coil* coil, uint16_t year, uint16_t height, int shift, uint32_t sliceDetalization, bool isLeap);
|
||||||
|
void calculate();
|
||||||
|
void printVertices();
|
||||||
|
double *getVertices();
|
||||||
|
uint16_t getVerticesLength();
|
||||||
|
void printSlice(double *slice);
|
||||||
|
void exportSliceToCSV(double *slice);
|
||||||
|
void exportSegmentToCsv();
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif // COIL_SEGMENT_HPP
|
150
src/main.cpp
150
src/main.cpp
|
@ -6,7 +6,10 @@
|
||||||
#include <cmath>
|
#include <cmath>
|
||||||
#include <cstdlib>
|
#include <cstdlib>
|
||||||
|
|
||||||
#define RAND_0_1 ((float)rand()) / RAND_MAX
|
#include "coil/coil.hpp"
|
||||||
|
#include "coil/segment.hpp"
|
||||||
|
|
||||||
|
#define RAND_0_1 ((double)rand()) / RAND_MAX
|
||||||
|
|
||||||
void framebufferSizeCallback(GLFWwindow *window, int width, int height) {
|
void framebufferSizeCallback(GLFWwindow *window, int width, int height) {
|
||||||
glViewport(10, 10, width-10, height-10);
|
glViewport(10, 10, width-10, height-10);
|
||||||
|
@ -44,9 +47,9 @@ std::string readFile(std::string path) {
|
||||||
return content;
|
return content;
|
||||||
}
|
}
|
||||||
|
|
||||||
void updateVertices(float (&vertices)[24]) {
|
void updateVertices(double (&vertices)[24]) {
|
||||||
// if (RAND_0_1 < 0.99f) return;
|
// if (RAND_0_1 < 0.99f) return;
|
||||||
float a[] = {
|
double a[] = {
|
||||||
-1.0f, 1.0f, 0.0f, RAND_0_1, RAND_0_1, RAND_0_1, // upper left
|
-1.0f, 1.0f, 0.0f, RAND_0_1, RAND_0_1, RAND_0_1, // upper left
|
||||||
-1.0f, -1.0f, 0.0f, RAND_0_1, RAND_0_1, RAND_0_1, // bottom left
|
-1.0f, -1.0f, 0.0f, RAND_0_1, RAND_0_1, RAND_0_1, // bottom left
|
||||||
1.0f, 1.0f, 0.0f, RAND_0_1, RAND_0_1, RAND_0_1, // upper right
|
1.0f, 1.0f, 0.0f, RAND_0_1, RAND_0_1, RAND_0_1, // upper right
|
||||||
|
@ -107,89 +110,102 @@ unsigned int prepareShaders() {
|
||||||
}
|
}
|
||||||
|
|
||||||
int main () {
|
int main () {
|
||||||
srand(time(0));
|
Coil c = Coil(2025, 1);
|
||||||
glfwInit();
|
|
||||||
glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR, 3);
|
|
||||||
glfwWindowHint(GLFW_CONTEXT_VERSION_MINOR, 3);
|
|
||||||
glfwWindowHint(GLFW_OPENGL_PROFILE, GLFW_OPENGL_CORE_PROFILE);
|
|
||||||
#ifdef __APPLE__
|
|
||||||
glfwWindowHint(GLFW_OPENGL_FORWARD_COMPAT, GL_TRUE);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
GLFWwindow *window = glfwCreateWindow(800, 600, "TimeCoil", NULL, NULL);
|
// CoilSegment cs = CoilSegment(10, 0, false);
|
||||||
if (window == NULL) {
|
for (auto segment : c.getSegments()) {
|
||||||
std::cerr << "Failed to create GLFW window." << std::endl;
|
// segment.printVertices();
|
||||||
gracefulExit(-1);
|
|
||||||
}
|
}
|
||||||
|
// cs.printVertices();
|
||||||
|
return 0;
|
||||||
|
// srand(time(0));
|
||||||
|
// glfwInit();
|
||||||
|
// glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR, 3);
|
||||||
|
// glfwWindowHint(GLFW_CONTEXT_VERSION_MINOR, 3);
|
||||||
|
// glfwWindowHint(GLFW_OPENGL_PROFILE, GLFW_OPENGL_CORE_PROFILE);
|
||||||
|
// #ifdef __APPLE__
|
||||||
|
// glfwWindowHint(GLFW_OPENGL_FORWARD_COMPAT, GL_TRUE);
|
||||||
|
// #endif
|
||||||
|
|
||||||
glfwMakeContextCurrent(window);
|
// GLFWwindow *window = glfwCreateWindow(800, 600, "TimeCoil", NULL, NULL);
|
||||||
glfwSetFramebufferSizeCallback(window, framebufferSizeCallback);
|
// if (window == NULL) {
|
||||||
|
// std::cerr << "Failed to create GLFW window." << std::endl;
|
||||||
|
// gracefulExit(-1);
|
||||||
|
// }
|
||||||
|
|
||||||
if (!gladLoadGLLoader((GLADloadproc)glfwGetProcAddress)) {
|
// glfwMakeContextCurrent(window);
|
||||||
std::cerr << "Failed to initialize GLAD." << std::endl;
|
// glfwSetFramebufferSizeCallback(window, framebufferSizeCallback);
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
|
|
||||||
unsigned int shaderProgram = prepareShaders();
|
// if (!gladLoadGLLoader((GLADloadproc)glfwGetProcAddress)) {
|
||||||
|
// std::cerr << "Failed to initialize GLAD." << std::endl;
|
||||||
|
// return -1;
|
||||||
|
// }
|
||||||
|
|
||||||
float vertices[] = {
|
// unsigned int shaderProgram = prepareShaders();
|
||||||
-1.0f, 1.0f, 0.0f, 1.0f, 0.0f, 0.0f, // upper left
|
|
||||||
-1.0f, -1.0f, 0.0f, 0.0f, 1.0f, 0.0f, // bottom left
|
|
||||||
1.0f, 1.0f, 0.0f, 1.0f, 0.0f, 0.0f, // upper right
|
|
||||||
1.0f, -1.0f, 0.0f, 0.0f, 1.0f, 0.0f // bottom right
|
|
||||||
};
|
|
||||||
unsigned int indices[] = {
|
|
||||||
1, 2, 3,
|
|
||||||
1, 2, 0
|
|
||||||
};
|
|
||||||
unsigned int VBO, VAO, EBO;
|
|
||||||
glGenVertexArrays(1, &VAO);
|
|
||||||
glGenBuffers(1, &VBO);
|
|
||||||
glGenBuffers(1, &EBO);
|
|
||||||
|
|
||||||
glBindVertexArray(VAO);
|
// double *vertices = cs.getVertices();
|
||||||
|
// unsigned int amountOfVerticies = cs.getVerticesLength();
|
||||||
|
// std::cout << amountOfVerticies << std::endl;
|
||||||
|
// // double vertices[] = {
|
||||||
|
// // -1.0f, -1.0f, 0.0f, 1.0f, 0.0f, 0.0f, // upper left
|
||||||
|
// // -0.5f, -0.5f, 0.0f, 0.0f, 1.0f, 0.0f, // bottom left
|
||||||
|
// // 0.5f, 0.5f, 0.0f, 1.0f, 0.0f, 0.0f, // upper right
|
||||||
|
// // 1.0f, 1.0f, 0.0f, 0.0f, 1.0f, 0.0f // bottom right
|
||||||
|
// // };
|
||||||
|
// // unsigned int indices[] = {
|
||||||
|
// // 1, 2, 3,
|
||||||
|
// // 1, 2, 0
|
||||||
|
// // };
|
||||||
|
// unsigned int VBO, VAO, EBO;
|
||||||
|
// glGenVertexArrays(1, &VAO);
|
||||||
|
// glGenBuffers(1, &VBO);
|
||||||
|
// // glGenBuffers(1, &EBO);
|
||||||
|
|
||||||
glBindBuffer(GL_ARRAY_BUFFER, VBO);
|
// glBindVertexArray(VAO);
|
||||||
glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, EBO);
|
|
||||||
|
|
||||||
glBufferData(GL_ARRAY_BUFFER, sizeof(vertices), vertices, GL_STATIC_DRAW);
|
// glBindBuffer(GL_ARRAY_BUFFER, VBO);
|
||||||
glBufferData(GL_ELEMENT_ARRAY_BUFFER, sizeof(indices), indices, GL_STATIC_DRAW);
|
// // glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, EBO);
|
||||||
|
|
||||||
glVertexAttribPointer(0, 3, GL_FLOAT, GL_FALSE, 6 * sizeof(float), (void*)0);
|
// glBufferData(GL_ARRAY_BUFFER, amountOfVerticies, vertices, GL_STATIC_DRAW);
|
||||||
glEnableVertexAttribArray(0);
|
// // glBufferData(GL_ELEMENT_ARRAY_BUFFER, sizeof(indices), indices, GL_STATIC_DRAW);
|
||||||
|
|
||||||
glVertexAttribPointer(1, 3, GL_FLOAT, GL_FALSE, 6 * sizeof(float), (void*) (3 * sizeof(float)));
|
// glVertexAttribPointer(0, 3, GL_DOUBLE, GL_FALSE, 6 * sizeof(double), (void*)0);
|
||||||
glEnableVertexAttribArray(1);
|
// glEnableVertexAttribArray(0);
|
||||||
|
|
||||||
glBindVertexArray(0);
|
// glVertexAttribPointer(1, 3, GL_DOUBLE, GL_FALSE, 6 * sizeof(double), (void*) (3 * sizeof(double)));
|
||||||
|
// glEnableVertexAttribArray(1);
|
||||||
|
|
||||||
|
// glBindVertexArray(0);
|
||||||
|
|
||||||
while(!glfwWindowShouldClose(window)) {
|
// while(!glfwWindowShouldClose(window)) {
|
||||||
processInput(window);
|
// processInput(window);
|
||||||
|
|
||||||
glClearColor(0.2f, 0.3f, 0.3f, 1.0f);
|
// glClearColor(0.2f, 0.3f, 0.3f, 1.0f);
|
||||||
glClear(GL_COLOR_BUFFER_BIT);
|
// glClear(GL_COLOR_BUFFER_BIT);
|
||||||
|
|
||||||
glUseProgram(shaderProgram);
|
// glUseProgram(shaderProgram);
|
||||||
|
|
||||||
// float time = glfwGetTime();
|
// // double time = glfwGetTime();
|
||||||
// float greenValue = sin(time);
|
// // double greenValue = sin(time);
|
||||||
|
|
||||||
|
|
||||||
// int vertexColorLocation = glGetUniformLocation(shaderProgram, "MyColor");
|
// // int vertexColorLocation = glGetUniformLocation(shaderProgram, "MyColor");
|
||||||
// glUniform4f(vertexColorLocation, 0, greenValue, 0, 1);
|
// // glUniform4f(vertexColorLocation, 0, greenValue, 0, 1);
|
||||||
glBindVertexArray(VAO);
|
// glBindVertexArray(VAO);
|
||||||
|
|
||||||
updateVertices(vertices);
|
// // updateVertices(vertices);
|
||||||
glBufferData(GL_ARRAY_BUFFER, sizeof(vertices), vertices, GL_DYNAMIC_DRAW);
|
// glBufferData(GL_ARRAY_BUFFER, amountOfVerticies, vertices, GL_DYNAMIC_DRAW);
|
||||||
glDrawElements(GL_TRIANGLES, 6, GL_UNSIGNED_INT, 0);
|
// // glDrawElements(GL_TRIANGLES, 6, GL_UNSIGNED_INT, 0);
|
||||||
|
// glDrawArrays(GL_LINE_STRIP_ADJACENCY, -30, amountOfVerticies);
|
||||||
|
|
||||||
|
|
||||||
glBindVertexArray(0);
|
// glBindVertexArray(0);
|
||||||
glfwSwapBuffers(window);
|
// glfwSwapBuffers(window);
|
||||||
glfwPollEvents();
|
// glfwPollEvents();
|
||||||
}
|
// }
|
||||||
|
|
||||||
glDeleteVertexArrays(1, &VAO);
|
// glDeleteVertexArrays(1, &VAO);
|
||||||
glDeleteBuffers(1, &VBO);
|
// glDeleteBuffers(1, &VBO);
|
||||||
glDeleteProgram(shaderProgram);
|
// glDeleteProgram(shaderProgram);
|
||||||
gracefulExit(0);
|
// gracefulExit(0);
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,13 @@
|
||||||
|
#include <stdint.h>
|
||||||
|
#include <stdio.h>
|
||||||
|
#include <stdlib.h>
|
||||||
|
|
||||||
|
int main () {
|
||||||
|
uint32_t size = -1;
|
||||||
|
char *arr = (char*) malloc(size);
|
||||||
|
for (uint64_t i = 0; i < (uint64_t)-1; i ++) {
|
||||||
|
arr[i] = '\0';
|
||||||
|
if (i % 10000000 != 0) continue;
|
||||||
|
printf("%lli\n", i);
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,4 @@
|
||||||
|
x,y,z
|
||||||
|
1,0,0
|
||||||
|
0,1,0
|
||||||
|
0,0,1
|
|
|
@ -0,0 +1,40 @@
|
||||||
|
|
||||||
|
|
||||||
|
#!/usr/bin/env python0;
|
||||||
|
|
||||||
|
import plotly.graph_objects as go
|
||||||
|
import pandas as pd
|
||||||
|
import numpy as np
|
||||||
|
import sys
|
||||||
|
|
||||||
|
if len(sys.argv) != 2:
|
||||||
|
print(f"Usage: ./{sys.argv[0]} <filename>")
|
||||||
|
sys.exit(1)
|
||||||
|
|
||||||
|
df = pd.read_csv(sys.argv[1])
|
||||||
|
|
||||||
|
fig = go.Figure(data=[go.Scatter3d(x=df['x'], y=df['y'], z=df['z'], mode='markers')])
|
||||||
|
|
||||||
|
fig.update_layout(
|
||||||
|
scene = dict(
|
||||||
|
xaxis_title='X',
|
||||||
|
yaxis_title='Y',
|
||||||
|
zaxis_title='Z',
|
||||||
|
xaxis=dict(nticks=10, range=[-220, 220]),
|
||||||
|
yaxis=dict(nticks=10, range=[-220, 220]),
|
||||||
|
zaxis=dict(nticks=10, range=[-220, 220])
|
||||||
|
),
|
||||||
|
)
|
||||||
|
|
||||||
|
fig.update_layout(
|
||||||
|
scene = dict(
|
||||||
|
camera = dict(
|
||||||
|
eye=dict(x=1.5, y=1.5, z=1.5)
|
||||||
|
)
|
||||||
|
),
|
||||||
|
)
|
||||||
|
|
||||||
|
fig.data[0].y, fig.data[0].z = fig.data[0].z, fig.data[0].y
|
||||||
|
|
||||||
|
|
||||||
|
fig.show()
|
Loading…
Reference in New Issue