2 Commits

Author SHA1 Message Date
Endertom 5169bc4096 Caricamento v0.3 2026-05-31 11:06:50 +02:00
Endertom e50e2987c9 Caricamento v0.2 2026-05-31 10:42:30 +02:00
37 changed files with 3595 additions and 16725 deletions
+11 -3
View File
@@ -12,12 +12,20 @@ FetchContent_Declare(SFML
SYSTEM)
FetchContent_MakeAvailable(SFML)
FetchContent_Declare(
glm
GIT_REPOSITORY https://github.com/g-truc/glm.git
GIT_TAG 0af55ccecd98d4e5a8d1fad7de25ba429d60e863 #refs/tags/1.0.1
)
FetchContent_MakeAvailable(glm)
set(METHODS_PATH "./src/*/methods/*.cpp")
#V1
set(VERSION "V1")
set(VERSION "V3")
file(GLOB_RECURSE METHODS_SRC "${METHODS_PATH}")
add_executable(main${VERSION} ./src/testMain.cpp ${METHODS_SRC} )
target_compile_features(main${VERSION} PRIVATE cxx_std_17)
target_link_libraries(main${VERSION} PRIVATE SFML::Graphics)
target_link_libraries(main${VERSION} PRIVATE SFML::Graphics glm)
+15 -4
View File
@@ -1,7 +1,7 @@
# FCG_VisualizzatoreCamminata
Nella versione versione v0.1 è presente la base del progetto.
## Nella versione versione v0.1 è presente la base del progetto.
- La gerarchia dei file e delle classi
@@ -17,10 +17,21 @@ Per questione di debug tutti i pezzi rappresentati si possono trascinare e ruota
Per spostare l'intera scena si tiene premuto il tasto centrale del mouse.
Per compliare:
## Nella versione v0.2:
- Applicato refactoring di diverse classi
- Aggiustato calcolo dei pivot implementando le rotazioni con algebra affine e glm
- Aggiuta classe caviglia (per differenziarla dalla coscia)
## Nella versione v0.3:
- Applicato refactoring delle classi pieces
- Aggiunta pezzo torso
- Nel testMain vengono agganciate caviglia e coscia al nuovo torso
# Per compliare:
cmake --build
Per lanciare:
# Per lanciare:
./build/bin/mainV1
./build/bin/mainV3
@@ -1107,7 +1107,7 @@
}
],
"type" : "INTERNAL",
"value" : "8"
"value" : "10"
},
{
"name" : "CMAKE_OBJCOPY",
@@ -1653,6 +1653,18 @@
"type" : "BOOL",
"value" : "ON"
},
{
"name" : "FETCHCONTENT_SOURCE_DIR_GLM",
"properties" :
[
{
"name" : "HELPSTRING",
"value" : "When not empty, overrides where to find pre-populated content for glm"
}
],
"type" : "PATH",
"value" : ""
},
{
"name" : "FETCHCONTENT_SOURCE_DIR_SFML",
"properties" :
@@ -1677,6 +1689,18 @@
"type" : "BOOL",
"value" : "OFF"
},
{
"name" : "FETCHCONTENT_UPDATES_DISCONNECTED_GLM",
"properties" :
[
{
"name" : "HELPSTRING",
"value" : "Enables UPDATE_DISCONNECTED behavior just for population of glm"
}
],
"type" : "BOOL",
"value" : "OFF"
},
{
"name" : "FETCHCONTENT_UPDATES_DISCONNECTED_SFML",
"properties" :
@@ -1869,6 +1893,234 @@
"type" : "FILEPATH",
"value" : "/usr/bin/git"
},
{
"name" : "GLM_BUILD_INSTALL",
"properties" :
[
{
"name" : "HELPSTRING",
"value" : "Generate the install target"
}
],
"type" : "BOOL",
"value" : "OFF"
},
{
"name" : "GLM_BUILD_LIBRARY",
"properties" :
[
{
"name" : "HELPSTRING",
"value" : "Build dynamic/static library"
}
],
"type" : "BOOL",
"value" : "ON"
},
{
"name" : "GLM_BUILD_TESTS",
"properties" :
[
{
"name" : "HELPSTRING",
"value" : "Build the test programs"
}
],
"type" : "BOOL",
"value" : "OFF"
},
{
"name" : "GLM_DISABLE_AUTO_DETECTION",
"properties" :
[
{
"name" : "HELPSTRING",
"value" : "Disable platform, compiler, arch and C++ language detection"
}
],
"type" : "BOOL",
"value" : "OFF"
},
{
"name" : "GLM_ENABLE_CXX_11",
"properties" :
[
{
"name" : "HELPSTRING",
"value" : "Enable C++ 11"
}
],
"type" : "BOOL",
"value" : "OFF"
},
{
"name" : "GLM_ENABLE_CXX_14",
"properties" :
[
{
"name" : "HELPSTRING",
"value" : "Enable C++ 14"
}
],
"type" : "BOOL",
"value" : "OFF"
},
{
"name" : "GLM_ENABLE_CXX_17",
"properties" :
[
{
"name" : "HELPSTRING",
"value" : "Enable C++ 17"
}
],
"type" : "BOOL",
"value" : "OFF"
},
{
"name" : "GLM_ENABLE_CXX_20",
"properties" :
[
{
"name" : "HELPSTRING",
"value" : "Enable C++ 20"
}
],
"type" : "BOOL",
"value" : "OFF"
},
{
"name" : "GLM_ENABLE_CXX_98",
"properties" :
[
{
"name" : "HELPSTRING",
"value" : "Enable C++ 98"
}
],
"type" : "BOOL",
"value" : "OFF"
},
{
"name" : "GLM_ENABLE_FAST_MATH",
"properties" :
[
{
"name" : "HELPSTRING",
"value" : "Enable fast math optimizations"
}
],
"type" : "BOOL",
"value" : "OFF"
},
{
"name" : "GLM_ENABLE_LANG_EXTENSIONS",
"properties" :
[
{
"name" : "HELPSTRING",
"value" : "Enable language extensions"
}
],
"type" : "BOOL",
"value" : "OFF"
},
{
"name" : "GLM_ENABLE_SIMD_AVX",
"properties" :
[
{
"name" : "HELPSTRING",
"value" : "Enable AVX optimizations"
}
],
"type" : "BOOL",
"value" : "OFF"
},
{
"name" : "GLM_ENABLE_SIMD_AVX2",
"properties" :
[
{
"name" : "HELPSTRING",
"value" : "Enable AVX2 optimizations"
}
],
"type" : "BOOL",
"value" : "OFF"
},
{
"name" : "GLM_ENABLE_SIMD_SSE2",
"properties" :
[
{
"name" : "HELPSTRING",
"value" : "Enable SSE2 optimizations"
}
],
"type" : "BOOL",
"value" : "OFF"
},
{
"name" : "GLM_ENABLE_SIMD_SSE3",
"properties" :
[
{
"name" : "HELPSTRING",
"value" : "Enable SSE3 optimizations"
}
],
"type" : "BOOL",
"value" : "OFF"
},
{
"name" : "GLM_ENABLE_SIMD_SSE4_1",
"properties" :
[
{
"name" : "HELPSTRING",
"value" : "Enable SSE 4.1 optimizations"
}
],
"type" : "BOOL",
"value" : "OFF"
},
{
"name" : "GLM_ENABLE_SIMD_SSE4_2",
"properties" :
[
{
"name" : "HELPSTRING",
"value" : "Enable SSE 4.2 optimizations"
}
],
"type" : "BOOL",
"value" : "OFF"
},
{
"name" : "GLM_ENABLE_SIMD_SSSE3",
"properties" :
[
{
"name" : "HELPSTRING",
"value" : "Enable SSSE3 optimizations"
}
],
"type" : "BOOL",
"value" : "OFF"
},
{
"name" : "GLM_FORCE_PURE",
"properties" :
[
{
"name" : "HELPSTRING",
"value" : "Force 'pure' instructions"
}
],
"type" : "BOOL",
"value" : "OFF"
},
{
"name" : "OGG_INCLUDE_DIR",
"properties" :
@@ -4636,6 +4888,42 @@
],
"type" : "INTERNAL",
"value" : "/usr/local"
},
{
"name" : "glm_BINARY_DIR",
"properties" :
[
{
"name" : "HELPSTRING",
"value" : "Value Computed by CMake"
}
],
"type" : "STATIC",
"value" : "/home/endertom/Documenti/ProgettoFinaleRep/FCG_VisualizzatoreCamminata/build/_deps/glm-build"
},
{
"name" : "glm_IS_TOP_LEVEL",
"properties" :
[
{
"name" : "HELPSTRING",
"value" : "Value Computed by CMake"
}
],
"type" : "STATIC",
"value" : "OFF"
},
{
"name" : "glm_SOURCE_DIR",
"properties" :
[
{
"name" : "HELPSTRING",
"value" : "Value Computed by CMake"
}
],
"type" : "STATIC",
"value" : "/home/endertom/Documenti/ProgettoFinaleRep/FCG_VisualizzatoreCamminata/build/_deps/glm-src"
}
],
"kind" : "cache",
@@ -147,6 +147,26 @@
"isExternal" : true,
"path" : "/usr/share/cmake-4.2/Modules/FetchContent/CMakeLists.cmake.in"
},
{
"isCMake" : true,
"isExternal" : true,
"path" : "/usr/share/cmake-4.2/Modules/FindGit.cmake"
},
{
"isCMake" : true,
"isExternal" : true,
"path" : "/usr/share/cmake-4.2/Modules/FindPackageHandleStandardArgs.cmake"
},
{
"isCMake" : true,
"isExternal" : true,
"path" : "/usr/share/cmake-4.2/Modules/FindPackageMessage.cmake"
},
{
"isCMake" : true,
"isExternal" : true,
"path" : "/usr/share/cmake-4.2/Modules/FetchContent/CMakeLists.cmake.in"
},
{
"isGenerated" : true,
"path" : "build/_deps/sfml-src/CMakeLists.txt"
@@ -535,6 +555,19 @@
{
"isGenerated" : true,
"path" : "build/_deps/sfml-src/src/SFML/Audio/Dependencies.cmake.in"
},
{
"isGenerated" : true,
"path" : "build/_deps/glm-src/CMakeLists.txt"
},
{
"isCMake" : true,
"isExternal" : true,
"path" : "/usr/share/cmake-4.2/Modules/GNUInstallDirs.cmake"
},
{
"isGenerated" : true,
"path" : "build/_deps/glm-src/glm/CMakeLists.txt"
}
],
"kind" : "cmakeFiles",
@@ -234,6 +234,13 @@
"jsonFile" : "target-freetype-Debug-abdfbd050f0222558c4d.json",
"name" : "freetype",
"projectIndex" : 1
},
{
"directoryIndex" : 9,
"id" : "glm-header-only::@ce54d98d7b326a3e12a8",
"jsonFile" : "target-glm-header-only-Debug-ba11e7860c401de4a955.json",
"name" : "glm-header-only",
"projectIndex" : 2
}
],
"directories" :
@@ -246,7 +253,8 @@
"build" : ".",
"childIndexes" :
[
1
1,
8
],
"hasInstallRule" : true,
"jsonFile" : "directory-.-Debug-9ad1a58d4644cf6543fa.json",
@@ -258,7 +266,7 @@
"source" : ".",
"targetIndexes" :
[
0
1
]
},
{
@@ -268,7 +276,7 @@
2
],
"hasInstallRule" : true,
"jsonFile" : "directory-_deps.sfml-build-Debug-dfee4a8ac98e62d8aa87.json",
"jsonFile" : "directory-_deps.sfml-build-Debug-9e99fff3adb968d44f8e.json",
"minimumCMakeVersion" :
{
"string" : "3.22"
@@ -304,7 +312,7 @@
],
"build" : "_deps/sfml-build/src/SFML/System",
"hasInstallRule" : true,
"jsonFile" : "directory-_deps.sfml-build.src.SFML.System-Debug-a8a648ac157acad150c5.json",
"jsonFile" : "directory-_deps.sfml-build.src.SFML.System-Debug-8ed26fbff62444cac103.json",
"minimumCMakeVersion" :
{
"string" : "3.22"
@@ -314,7 +322,7 @@
"source" : "build/_deps/sfml-src/src/SFML/System",
"targetIndexes" :
[
4
5
]
},
{
@@ -347,7 +355,7 @@
],
"build" : "_deps/sfml-build/src/SFML/Window",
"hasInstallRule" : true,
"jsonFile" : "directory-_deps.sfml-build.src.SFML.Window-Debug-be3f1b58265dd0b182ad.json",
"jsonFile" : "directory-_deps.sfml-build.src.SFML.Window-Debug-bc441d344f43ebac1e95.json",
"minimumCMakeVersion" :
{
"string" : "3.22"
@@ -357,13 +365,13 @@
"source" : "build/_deps/sfml-src/src/SFML/Window",
"targetIndexes" :
[
5
6
]
},
{
"build" : "_deps/sfml-build/src/SFML/Network",
"hasInstallRule" : true,
"jsonFile" : "directory-_deps.sfml-build.src.SFML.Network-Debug-2e3db7a0b897a8f2912c.json",
"jsonFile" : "directory-_deps.sfml-build.src.SFML.Network-Debug-2df01c5cf9c0481e3681.json",
"minimumCMakeVersion" :
{
"string" : "3.22"
@@ -373,7 +381,7 @@
"source" : "build/_deps/sfml-src/src/SFML/Network",
"targetIndexes" :
[
3
4
]
},
{
@@ -383,7 +391,7 @@
],
"build" : "_deps/sfml-build/src/SFML/Graphics",
"hasInstallRule" : true,
"jsonFile" : "directory-_deps.sfml-build.src.SFML.Graphics-Debug-d9a9bb084c70b51401a2.json",
"jsonFile" : "directory-_deps.sfml-build.src.SFML.Graphics-Debug-882c334f5d5ccd802105.json",
"minimumCMakeVersion" :
{
"string" : "3.22"
@@ -393,7 +401,7 @@
"source" : "build/_deps/sfml-src/src/SFML/Graphics",
"targetIndexes" :
[
2
3
]
},
{
@@ -408,7 +416,7 @@
],
"build" : "_deps/sfml-build/src/SFML/Audio",
"hasInstallRule" : true,
"jsonFile" : "directory-_deps.sfml-build.src.SFML.Audio-Debug-a33c3c7d6b217e553221.json",
"jsonFile" : "directory-_deps.sfml-build.src.SFML.Audio-Debug-6b2b3af0fd9759ab7812.json",
"minimumCMakeVersion" :
{
"string" : "3.22"
@@ -418,7 +426,41 @@
"source" : "build/_deps/sfml-src/src/SFML/Audio",
"targetIndexes" :
[
1
2
]
},
{
"build" : "_deps/glm-build",
"childIndexes" :
[
9
],
"jsonFile" : "directory-_deps.glm-build-Debug-c62d847c2156f7f8634f.json",
"minimumCMakeVersion" :
{
"string" : "3.6"
},
"parentIndex" : 0,
"projectIndex" : 2,
"source" : "build/_deps/glm-src"
},
{
"abstractTargetIndexes" :
[
33
],
"build" : "_deps/glm-build/glm",
"jsonFile" : "directory-_deps.glm-build.glm-Debug-ee2f18c9a18ae24a8c8e.json",
"minimumCMakeVersion" :
{
"string" : "3.6"
},
"parentIndex" : 8,
"projectIndex" : 2,
"source" : "build/_deps/glm-src/glm",
"targetIndexes" :
[
0
]
}
],
@@ -432,7 +474,8 @@
],
"childIndexes" :
[
1
1,
2
],
"directoryIndexes" :
[
@@ -441,7 +484,7 @@
"name" : "CMakeSFMLProject",
"targetIndexes" :
[
0
1
]
},
{
@@ -494,21 +537,45 @@
"parentIndex" : 0,
"targetIndexes" :
[
1,
2,
3,
4,
5
5,
6
]
},
{
"abstractTargetIndexes" :
[
33
],
"directoryIndexes" :
[
8,
9
],
"name" : "glm",
"parentIndex" : 0,
"targetIndexes" :
[
0
]
}
],
"targets" :
[
{
"directoryIndex" : 9,
"id" : "glm::@ce54d98d7b326a3e12a8",
"jsonFile" : "target-glm-Debug-244f6aa87d17e32353a7.json",
"name" : "glm",
"projectIndex" : 2
},
{
"directoryIndex" : 0,
"id" : "mainV1::@6890427a1f51a3e7e1df",
"jsonFile" : "target-mainV1-Debug-5ee4cebbd3969ed04364.json",
"name" : "mainV1",
"id" : "mainV3::@6890427a1f51a3e7e1df",
"jsonFile" : "target-mainV3-Debug-ee31761362aa79611c23.json",
"name" : "mainV3",
"projectIndex" : 0
},
{
@@ -0,0 +1,19 @@
{
"backtraceGraph" :
{
"commands" : [],
"files" : [],
"nodes" : []
},
"codemodelVersion" :
{
"major" : 2,
"minor" : 9
},
"installers" : [],
"paths" :
{
"build" : "_deps/glm-build",
"source" : "build/_deps/glm-src"
}
}
@@ -0,0 +1,19 @@
{
"backtraceGraph" :
{
"commands" : [],
"files" : [],
"nodes" : []
},
"codemodelVersion" :
{
"major" : 2,
"minor" : 9
},
"installers" : [],
"paths" :
{
"build" : "_deps/glm-build/glm",
"source" : "build/_deps/glm-src/glm"
}
}
@@ -242,7 +242,7 @@
[
{
"id" : "sfml-system::@8cb1db2982443611e568",
"index" : 4
"index" : 5
}
],
"paths" :
@@ -260,7 +260,7 @@
[
{
"id" : "sfml-window::@5730451e331e3690ae65",
"index" : 5
"index" : 6
}
],
"paths" :
@@ -278,7 +278,7 @@
[
{
"id" : "sfml-network::@d7f79968b2699e7782cb",
"index" : 3
"index" : 4
}
],
"paths" :
@@ -296,7 +296,7 @@
[
{
"id" : "sfml-graphics::@98af38147d5fa7e70f61",
"index" : 2
"index" : 3
}
],
"paths" :
@@ -314,7 +314,7 @@
[
{
"id" : "sfml-audio::@a153e5727587c53fce98",
"index" : 1
"index" : 2
}
],
"paths" :
@@ -52,7 +52,7 @@
"_deps/sfml-build/lib/libsfml-audio-s-d.a"
],
"targetId" : "sfml-audio::@a153e5727587c53fce98",
"targetIndex" : 1,
"targetIndex" : 2,
"type" : "target"
},
{
@@ -52,7 +52,7 @@
"_deps/sfml-build/lib/libsfml-graphics-s-d.a"
],
"targetId" : "sfml-graphics::@98af38147d5fa7e70f61",
"targetIndex" : 2,
"targetIndex" : 3,
"type" : "target"
},
{
@@ -46,7 +46,7 @@
"_deps/sfml-build/lib/libsfml-network-s-d.a"
],
"targetId" : "sfml-network::@d7f79968b2699e7782cb",
"targetIndex" : 3,
"targetIndex" : 4,
"type" : "target"
}
],
@@ -52,7 +52,7 @@
"_deps/sfml-build/lib/libsfml-system-s-d.a"
],
"targetId" : "sfml-system::@8cb1db2982443611e568",
"targetIndex" : 4,
"targetIndex" : 5,
"type" : "target"
},
{
@@ -52,7 +52,7 @@
"_deps/sfml-build/lib/libsfml-window-s-d.a"
],
"targetId" : "sfml-window::@5730451e331e3690ae65",
"targetIndex" : 5,
"targetIndex" : 6,
"type" : "target"
},
{
@@ -26,7 +26,7 @@
"objects" :
[
{
"jsonFile" : "codemodel-v2-32cc683d1353c8d76846.json",
"jsonFile" : "codemodel-v2-48a6e2c377bb606c3455.json",
"kind" : "codemodel",
"version" :
{
@@ -35,7 +35,7 @@
}
},
{
"jsonFile" : "cache-v2-bfa9fbd295e1c2548deb.json",
"jsonFile" : "cache-v2-cf38a27fbc2746147de0.json",
"kind" : "cache",
"version" :
{
@@ -44,7 +44,7 @@
}
},
{
"jsonFile" : "cmakeFiles-v1-c1c7adbe1bc85952b01c.json",
"jsonFile" : "cmakeFiles-v1-55a603bab8f1f7b9a9db.json",
"kind" : "cmakeFiles",
"version" :
{
@@ -90,7 +90,7 @@
"responses" :
[
{
"jsonFile" : "cache-v2-bfa9fbd295e1c2548deb.json",
"jsonFile" : "cache-v2-cf38a27fbc2746147de0.json",
"kind" : "cache",
"version" :
{
@@ -99,7 +99,7 @@
}
},
{
"jsonFile" : "codemodel-v2-32cc683d1353c8d76846.json",
"jsonFile" : "codemodel-v2-48a6e2c377bb606c3455.json",
"kind" : "codemodel",
"version" :
{
@@ -117,7 +117,7 @@
}
},
{
"jsonFile" : "cmakeFiles-v1-c1c7adbe1bc85952b01c.json",
"jsonFile" : "cmakeFiles-v1-55a603bab8f1f7b9a9db.json",
"kind" : "cmakeFiles",
"version" :
{
File diff suppressed because it is too large Load Diff
@@ -0,0 +1,41 @@
{
"abstract" : true,
"backtrace" : 1,
"backtraceGraph" :
{
"commands" :
[
"add_library"
],
"files" :
[
"build/_deps/glm-src/glm/CMakeLists.txt"
],
"nodes" :
[
{
"file" : 0
},
{
"command" : 0,
"file" : 0,
"line" : 45,
"parent" : 0
}
]
},
"codemodelVersion" :
{
"major" : 2,
"minor" : 9
},
"id" : "glm-header-only::@ce54d98d7b326a3e12a8",
"name" : "glm-header-only",
"paths" :
{
"build" : "_deps/glm-build/glm",
"source" : "build/_deps/glm-src/glm"
},
"sources" : [],
"type" : "INTERFACE_LIBRARY"
}
@@ -2,7 +2,7 @@
"artifacts" :
[
{
"path" : "bin/mainV1"
"path" : "bin/mainV3"
}
],
"backtrace" : 1,
@@ -31,13 +31,13 @@
{
"command" : 0,
"file" : 0,
"line" : 21,
"line" : 29,
"parent" : 0
},
{
"command" : 1,
"file" : 0,
"line" : 23,
"line" : 31,
"parent" : 0
},
{
@@ -125,6 +125,10 @@
{
"backtrace" : 2,
"id" : "sfml-graphics::@98af38147d5fa7e70f61"
},
{
"backtrace" : 2,
"id" : "glm::@ce54d98d7b326a3e12a8"
}
],
"compileGroups" :
@@ -145,6 +149,10 @@
],
"includes" :
[
{
"backtrace" : 2,
"path" : "/home/endertom/Documenti/ProgettoFinaleRep/FCG_VisualizzatoreCamminata/build/_deps/glm-src"
},
{
"backtrace" : 2,
"isSystem" : true,
@@ -160,7 +168,9 @@
3,
4,
5,
6
6,
7,
8
]
}
],
@@ -177,9 +187,13 @@
{
"backtrace" : 2,
"id" : "sfml-graphics::@98af38147d5fa7e70f61"
},
{
"backtrace" : 2,
"id" : "glm::@ce54d98d7b326a3e12a8"
}
],
"id" : "mainV1::@6890427a1f51a3e7e1df",
"id" : "mainV3::@6890427a1f51a3e7e1df",
"link" :
{
"commandFragments" :
@@ -193,6 +207,11 @@
"fragment" : "_deps/sfml-build/lib/libsfml-graphics-s-d.a",
"role" : "libraries"
},
{
"backtrace" : 2,
"fragment" : "_deps/glm-build/glm/libglm.a",
"role" : "libraries"
},
{
"backtrace" : 4,
"fragment" : "_deps/sfml-build/lib/libsfml-window-s-d.a",
@@ -271,10 +290,14 @@
{
"backtrace" : 2,
"id" : "sfml-graphics::@98af38147d5fa7e70f61"
},
{
"backtrace" : 2,
"id" : "glm::@ce54d98d7b326a3e12a8"
}
],
"name" : "mainV1",
"nameOnDisk" : "mainV1",
"name" : "mainV3",
"nameOnDisk" : "mainV3",
"paths" :
{
"build" : ".",
@@ -292,7 +315,9 @@
3,
4,
5,
6
6,
7,
8
]
}
],
@@ -322,6 +347,12 @@
"path" : "src/joints/methods/rigid_joint_class.cpp",
"sourceGroupIndex" : 0
},
{
"backtrace" : 1,
"compileGroupIndex" : 0,
"path" : "src/pieces/methods/caviglia_class.cpp",
"sourceGroupIndex" : 0
},
{
"backtrace" : 1,
"compileGroupIndex" : 0,
@@ -334,6 +365,12 @@
"path" : "src/pieces/methods/sensore_class.cpp",
"sourceGroupIndex" : 0
},
{
"backtrace" : 1,
"compileGroupIndex" : 0,
"path" : "src/pieces/methods/torso.cpp",
"sourceGroupIndex" : 0
},
{
"backtrace" : 1,
"compileGroupIndex" : 0,
BIN
View File
Binary file not shown.
BIN
View File
Binary file not shown.
-16515
View File
File diff suppressed because it is too large Load Diff
-44
View File
@@ -1,44 +0,0 @@
#include<math.h>
#include"rb_class.cpp"
#include<time.h>
/*
Questo namespace deve contenere le funzioni di gestione della fisica del motore.
Ogni moto in questo engine sarà ti tipo uniformemente accelerato per dare una semplificazione della realtà.
Le funzioni necessarie sono:
- Calcolo velocità, richiede:
(Oggetto rigidbody)
(time di partenza, time di arrivo o delta t)
(Accelerazione media)
(velocità iniziale)
- Calcolo rotazione, richiede:
(Oggetto rigidbody)
(time di partenza, time di arrivo o delta t)
(Accelerazione tangenziale)
(RAD/s iniziale)
- Calcolo accelerazione, deve modificare i valori di accelerazione su oggetti di tipo rigidbody, richiede:
(Oggetto rigidbody)
- Calcolo posizione, deve calcolare la posizione di un rigidbody in in un intervallo di tempo
- Calcolo energia potenziale
- Calcolo inerzia
- Calcolo energia meccanica
*/
using namespace rb;
namespace fis{
void calcVel(rigidbody body, const time_t Dtime);
void calcRot(rigidbody body, const time_t Dtime);
void calcAcc(rigidbody body, const std::vector<float> Dacc);
void calcTanAcc(rigidbody body, const std::vector<float> Dacc);
void calcPos(rigidbody body, const time_t Dtime);
}
+2
View File
@@ -2,6 +2,8 @@
#include "csv/headers/csv.hpp"
#include "sfml_util.cpp"
#include "pieces/headers/coscia.hpp"
#include "pieces/headers/caviglia.hpp"
#include "pieces/headers/sensore.hpp"
#include "pieces/headers/torso.hpp"
#include "joints/headers/rigid_joint.hpp"
#include "joints/headers/pivot_joint.hpp"
+1
View File
@@ -1,4 +1,5 @@
#include "../../pieces/headers/piece_interface.hpp"
#include <glm/glm.hpp>
#ifndef JOINT_INTERFACE_H
#define JOINT_INTERFACE_H
+23 -35
View File
@@ -4,55 +4,43 @@
void PivotJoint::rotate(unsigned int id){
rb::Vector3_s fRot = father->body.getRot();
rb::Vector3 fPos = father->body.getPos();
rb::Vector3_s cRot = childs[id]->body.getRot();
//// sposto l'origine passivamente su tutti gli assi ////
float r1 = sqrt(pow(pivot[0],2)+pow(pivot[2],2)); //calcolo modulo dell'offset (per ora solo sul piano xz)
float r2 = sqrt(pow(offset[id][0],2)+pow(offset[id][2],2));
if (r1>ZERO_INT){
float sign = pivot[2] >= 0 ? 1 : -1;
float alpha = float (fRot[2] - oldRot[2]);
float cosA = glm::cos(alpha);
float sinA = glm::sin(alpha);
float beta = float (cRot[2] - oldCRot[id][2]);
float cosB = glm::cos(beta);
float sinB = glm::sin(beta);
sf::Angle alpha = sf::radians(fRot[2] - oldRot[2]); // angolo aggiunto
sf::Angle alpha1 = sf::radians(acos(sign * pivot[0]/r1)); // angolo rispetto alla posizione del pivot
sf::Angle alpha2 = alpha + alpha1;
glm::mat3 R1 = glm::mat3(
/*cos*/ cosA, /*sin*/ sinA, 0,
/*-sin*/ -sinA , /*cos*/ cosA, 0,
0, 0, 1
);
sf::Vector2f tmpCoordsX = sf::Vector2f(r1,alpha2);
pivot = {sign * tmpCoordsX.x,pivot[1],sign * tmpCoordsX.y};
glm::mat3 R2 = glm::mat3(
/*cos*/ cosB, /*sin*/ sinB, 0,
/*-sin*/ -sinB , /*cos*/ cosB, 0,
0, 0, 1
);
//calcolo la posizione in base alla rotazione del child
sign = offset[id][2] >= 0 ? 1 : -1;
glm::vec3 pivotNXZ = R1 * glm::vec3(pivot[0],pivot[2],1);
pivot = rb::Vector3{pivotNXZ[0],pivot[1],pivotNXZ[1]};
glm::vec3 offsetNXZ = R2 * glm::vec3(offset[id][0],offset[id][2],1);
offset[id] = rb::Vector3{offsetNXZ[0],offset[id][1],offsetNXZ[1]};
sf::Angle beta = sf::radians(cRot[2] - oldCRot[id][2]);
sf::Angle beta1 = sf::radians(acos(sign * offset[id][0]/r2));
sf::Angle beta2 = beta + beta1;
sf::Vector2f tmpCoordsC = sf::Vector2f(r2,beta2);
offset[id] = {sign * tmpCoordsC.x,offset[id][1],sign * tmpCoordsC.y};
//ora devo muovere il child rispetto al nuovo offset
rb::Vector3 pivotPos = father->body.getPos()+father->globalPos+pivot;
rb::Vector3 cPos = childs[id]->body.getPos() + childs[id]->globalPos;
rb::Vector3 tmpChild = pivotPos + offset[id];
childs[id]->body.setPos(tmpChild - childs[id]->globalPos);
}
childs[id]->body.setPos(rb::Vector3{fPos[0]+offset[id][0]+pivot[0],fPos[1]+offset[id][1]+pivot[1],fPos[2]+offset[id][2]+pivot[2]});
oldRot = fRot; //aggiorno la rotazione per il ciclo successivo
oldCRot[id] = cRot;
// r cosA = x -> x/r = cosA
/*
Devo spostare l'offset per poter ricalcolare la posizione relativa dei child rispetto al father dopo aver eseguito la rotazione.
La rotazione va eseguita nella posizione del mondo, ovvero sulle coordinate di body
Le coordinate camera non vanno toccate, determinano solo lo spostamento rispetto alla telecamera
*/
}
void PivotJoint::traslate(unsigned int id){
+21 -36
View File
@@ -2,55 +2,40 @@
#define ZERO_INT 0.00001
//using namespace glm;
void RigidJoint::rotate(unsigned int id){
rb::Vector3_s fRot = father->body.getRot();
rb::Vector3_s fRotOld = childs[id]->body.getRot() - rotOffset[id];
rb::Vector3 cPos = childs[id]->body.getPos() + childs[id]->globalPos;
rb::Vector3 fPos = father->body.getPos();
rb::Vector3 cPos = childs[id]->body.getPos();
childs[id]->body.setRot(fRot + rotOffset[id]);
//// sposto l'origine passivamente su tutti gli assi ////
//se si muove il child devo muovere anche il padre -> devo trovare la differenza di posizione prima di ricalcolare l'offset
/*
if (cPos != oldCPos[id]);*/
float r = sqrt(pow(offset[id][0],2)+pow(offset[id][2],2)); //calcolo modulo dell'offset (per ora solo sul piano xz)
// sposto il alla distanza offset rispetto all'origine R*pos
// calcolo alpha angolo
if (r>ZERO_INT){
float sign = offset[id][2] >= 0 ? 1 : -1;
float alpha = float (fRot[2] - fRotOld[2]);
float cosA = glm::cos(alpha);
float sinA = glm::sin(alpha);
sf::Angle alpha = sf::radians(fRot[2] - fRotOld[2]); // angolo aggiunto
sf::Angle alpha1 = sf::radians(acos(sign * offset[id][0]/r)); // angolo rispetto alla posizione del child
sf::Angle beta = alpha + alpha1;
glm::mat3 R = glm::mat3(
/*cos*/ cosA, /*sin*/ sinA, 0,
/*-sin*/ -sinA , /*cos*/ cosA, 0,
0, 0, 1
);
sf::Vector2f tmpCoordsX = sf::Vector2f(r,beta);
offset[id] = {sign * tmpCoordsX.x,offset[id][1],sign * tmpCoordsX.y};
//sposto il child all'origine rispetto al padre
//ora devo muovere il child rispetto al nuovo offset
glm::vec3 XZ_cPos = {offset[id][0],offset[id][2],1};
glm::vec3 resRot = R * XZ_cPos;
offset[id][0] = resRot[0] ;
offset[id][2] = resRot[1] ;
rb::Vector3 fPos = father->body.getPos() + father->globalPos;
rb::Vector3 tmpChild = fPos + offset[id];
childs[id]->body.setPos(tmpChild - childs[id]->globalPos);
}
else{
childs[id]->body.setPos(father->body.getPos()+father->globalPos-childs[id]->globalPos);
}
// r cosA = x -> x/r = cosA
/*
Devo spostare l'offset per poter ricalcolare la posizione relativa dei child rispetto al father dopo aver eseguito la rotazione.
La rotazione va eseguita nella posizione del mondo, ovvero sulle coordinate di body
Le coordinate camera non vanno toccate, determinano solo lo spostamento rispetto alla telecamera
*/
childs[id]->body.setPos({fPos[0]-offset[id][0],offset[id][1],fPos[2] -offset[id][2]});
}
void RigidJoint::traslate(unsigned int id){
+21
View File
@@ -0,0 +1,21 @@
#include "piece_interface.hpp"
#ifndef CAVIGLIA_H
#define CAVIGLIA_H
class Caviglia : public PieceInterface{
private:
const sf::Vector3f caviglia_Dim = {60, 200, 60};
const sf::Color caviglia_Col = sf::Color(230,160,11,255);
public:
Caviglia(rb::Vector3 coords, _Float16 mass);
~Caviglia();
void update(sf::Clock cl) override;
sf::Shape* draw(ReferencePlane plane) override;
};
#endif
+4 -2
View File
@@ -3,11 +3,13 @@
#ifndef COSCIA_H
#define COSCIA_H
const sf::Vector2f coscia_Dim = {80, 200};
const sf::Color coscia_Col = sf::Color::Yellow;
class Coscia : public PieceInterface{
private:
const sf::Vector3f coscia_Dim = {80, 200, 80};
const sf::Color coscia_Col = sf::Color::Yellow;
public:
Coscia(rb::Vector3 coords, _Float16 mass);
+10 -9
View File
@@ -1,17 +1,12 @@
#include <SFML/Graphics.hpp>
#include <math.h>
#include "../../rigidbody/headers/rb.hpp"
//#include "../../joints/headers/joint_interface.hpp"
#ifndef PIECE_INTERFACE_H
#define PIECE_INTERFACE_H
// costanti
const sf::Vector2f caviglia_Dim = {50, 200};
const sf::Color caviglia_Col = sf::Color::Red;
enum class ReferencePlane {
XY,
YZ,
@@ -22,11 +17,17 @@ enum class ReferencePlane {
class PieceInterface{
protected:
//std::vector<JointInterface*> joints;
void initialize_shapes(sf::Vector3f dim){
shapeXZ = new sf::RectangleShape({dim.x, dim.y});
shapeYZ = new sf::RectangleShape({dim.z, dim.y});
shapeXZ->setOrigin({dim.x/2,dim.y/2});
shapeYZ->setOrigin({dim.z/2,dim.y/2});
shapeXZ->setFillColor(color);
shapeYZ->setFillColor(color);
}
public:
sf::Shape* shape;
sf::Vector2f size;
sf::Shape* shapeXZ, *shapeYZ;
rb::Vector3 globalPos;
rb::rigidbody body;
sf::Color color;
+5 -2
View File
@@ -3,11 +3,13 @@
#ifndef SENSORE_H
#define SENSORE_H
const sf::Vector2f sensore_Dim = {30, 60};
const sf::Color sensore_Col = sf::Color::Red;
class Sensore : public PieceInterface{
private:
const sf::Vector3f sensore_Dim = {30, 60, 30};
const sf::Color sensore_Col = sf::Color::Red;
std::vector<std::vector<float>> accData;
std::vector<std::vector<float>> gData;
std::vector<std::vector<float>> rotData;
@@ -21,6 +23,7 @@ class Sensore : public PieceInterface{
//funzioni ausiliarie
void calcRotWithG(unsigned int index);
public:
Sensore(rb::Vector3 coords, _Float16 mass);
+21
View File
@@ -0,0 +1,21 @@
#include "piece_interface.hpp"
#ifndef TORSO_H
#define TORSO_H
class Torso : public PieceInterface{
private:
const sf::Vector3f torso_Dim = {100, 100, 250};
const sf::Color torso_Col = sf::Color::Red;
public:
Torso(rb::Vector3 coords, _Float16 mass);
~Torso();
void update(sf::Clock cl) override;
sf::Shape* draw(ReferencePlane plane) override;
};
#endif
+50
View File
@@ -0,0 +1,50 @@
#include "../headers/caviglia.hpp"
Caviglia::Caviglia(rb::Vector3 coords, _Float16 mass){
rb::Vector3 com = {caviglia_Dim.x/2,caviglia_Dim.x/2, caviglia_Dim.y/2};
body = rb::rigidbody(coords, com, mass);
color = caviglia_Col;
globalPos = {0,0,0};
initialize_shapes(caviglia_Dim);
}
Caviglia::~Caviglia(){
delete shapeXZ;
delete shapeYZ;
}
void Caviglia::update(sf::Clock cl){
//body.step(cl);
}
sf::Shape* Caviglia::draw(ReferencePlane plane){
rb::Vector3 tmpPos = body.getPos();
rb::Vector3_s tmpRot = body.getRot();
switch (plane)
{
case ReferencePlane::XZ:
{
sf::Shape* shape = shapeXZ;
shape->setRotation(sf::Angle(sf::radians(tmpRot[2])));
shape->setPosition({tmpPos[0]+globalPos[0],tmpPos[2]+globalPos[2]});
return shape;}
break;
case ReferencePlane::YZ:
{
sf::Shape* shape = shapeYZ;
shape->setRotation(sf::Angle(sf::radians(tmpRot[1])));
shape->setPosition({tmpPos[1]+globalPos[1],tmpPos[2]+globalPos[2]});
return shape;}
break;
default:
break;
}
return nullptr;
}
+19 -9
View File
@@ -1,17 +1,16 @@
#include "../headers/coscia.hpp"
Coscia::Coscia(rb::Vector3 coords, _Float16 mass){
size = coscia_Dim;
rb::Vector3 com = {size.x/2,0, size.y/2};
rb::Vector3 com = {coscia_Dim.x/2,coscia_Dim.z/2,coscia_Dim.y/2};
body = rb::rigidbody(coords, com, mass);
color = coscia_Col;
shape = new sf::RectangleShape(size);
shape->setOrigin({size.x/2,size.y/2});
globalPos = {0,0,0};
initialize_shapes(coscia_Dim);
}
Coscia::~Coscia(){
delete shape;
delete shapeXZ;
delete shapeYZ;
}
void Coscia::update(sf::Clock cl){
@@ -19,22 +18,33 @@ void Coscia::update(sf::Clock cl){
}
sf::Shape* Coscia::draw(ReferencePlane plane){
shape->setFillColor(color);
rb::Vector3 tmpPos = body.getPos();
rb::Vector3_s tmpRot = body.getRot();
switch (plane)
{
case ReferencePlane::XZ:
shape->setPosition({tmpPos[0]+globalPos[0],tmpPos[2]+globalPos[2]});
{
sf::Shape* shape = shapeXZ;
shape->setRotation(sf::Angle(sf::radians(tmpRot[2])));
shape->setPosition({tmpPos[0]+globalPos[0],tmpPos[2]+globalPos[2]});
return shape;}
break;
case ReferencePlane::YZ:
{
sf::Shape* shape = shapeYZ;
shape->setRotation(sf::Angle(sf::radians(tmpRot[1])));
shape->setPosition({tmpPos[1]+globalPos[1],tmpPos[2]+globalPos[2]});
return shape;}
break;
default:
break;
}
return shape;
return nullptr;
}
+27 -16
View File
@@ -2,12 +2,11 @@
Sensore::Sensore(rb::Vector3 coords, _Float16 mass){
size = sensore_Dim;
rb::Vector3 com = {size.x/2,0, size.y/2};
body = rb::rigidbody({0,0,0}, com, mass);
rb::Vector3 com = {sensore_Dim.x/2,sensore_Dim.z/2, sensore_Dim.y/2};
body = rb::rigidbody(coords, com, mass);
color = sensore_Col;
shape = new sf::RectangleShape(size);
globalPos = coords;
globalPos = {0,0,0};
initialize_shapes(sensore_Dim);
}
Sensore::Sensore(rb::Vector3 coords, _Float16 mass, unsigned int st, unsigned int dataIntvl, std::vector<std::vector<float>> data) : Sensore(coords, mass){
@@ -18,7 +17,8 @@ Sensore::Sensore(rb::Vector3 coords, _Float16 mass, unsigned int st, unsigned in
Sensore::~Sensore(){
delete shape;
delete shapeXZ;
delete shapeYZ;
}
void Sensore::initCSV(std::vector<std::vector<float>> data){
@@ -48,6 +48,8 @@ void Sensore::update(sf::Clock cl){
//calcolo la posizione e velocità
calcRotWithG(dataPos);
body.setAcc(rb::Vector3{accData[dataPos]});
body.step(cl);
}
@@ -55,30 +57,33 @@ void Sensore::update(sf::Clock cl){
}
sf::Shape* Sensore::draw(ReferencePlane plane){
shape->setFillColor(color);
shape->setOrigin({sensore_Dim.x/2, sensore_Dim.y/2});
rb::Vector3_s tmpRot = body.getRot();
rb::Vector3 tmpPos = body.getPos();
switch (plane)
{
case ReferencePlane::XZ:
{
sf::Shape* shape = shapeXZ;
shape->setRotation(sf::Angle(sf::radians(tmpRot[2])));
shape->setPosition({tmpPos[0]+globalPos[0],tmpPos[2]+globalPos[2]});
return shape;}
break;
case ReferencePlane::YZ:
{
sf::Shape* shape = shapeYZ;
shape->setRotation(sf::Angle(sf::radians(tmpRot[1])));
shape->setPosition({tmpPos[1]+globalPos[1],tmpPos[2]+globalPos[2]});
return shape;}
break;
default:
break;
}
return shape;
return nullptr;
}
@@ -99,4 +104,10 @@ void Sensore::calcRotWithG(unsigned int index){ // calcolo rotazione con valori
body.setRot(rb::Vector3_s{_Float16( tmpAX),_Float16( tmpAY),_Float16( tmpAZ) });
}
}
/*
void Sensore::calcRotWithConstraint(){
};*/
/////////////// cinematica inversa
+50
View File
@@ -0,0 +1,50 @@
#include "../headers/torso.hpp"
Torso::Torso(rb::Vector3 coords, _Float16 mass){
rb::Vector3 com = {torso_Dim.x/2, torso_Dim.y/2, torso_Dim.z/2};
body = rb::rigidbody(coords,com, mass);
color = torso_Col;
globalPos = {0,0,0};
initialize_shapes(torso_Dim);
}
Torso::~Torso(){
delete shapeXZ;
delete shapeYZ;
}
void Torso::update(sf::Clock cl){
}
sf::Shape* Torso::draw(ReferencePlane plane){
rb::Vector3_s tmpRot = body.getRot();
rb::Vector3 tmpPos = body.getPos();
switch (plane)
{
case ReferencePlane::XZ:
{
sf::Shape* shape = shapeXZ;
shape->setRotation(sf::Angle(sf::radians(tmpRot[2])));
shape->setPosition({tmpPos[0]+globalPos[0],tmpPos[2]+globalPos[2]});
return shape;}
break;
case ReferencePlane::YZ:
{
sf::Shape* shape = shapeYZ;
shape->setRotation(sf::Angle(sf::radians(tmpRot[1])));
shape->setPosition({tmpPos[1]+globalPos[1],tmpPos[2]+globalPos[2]});
return shape;}
break;
default:
break;
}
return nullptr;
}
+1 -1
View File
@@ -51,7 +51,7 @@ void rigidbody::setRot(const Vector3_s Nrot){
if (Nrot.size() != 3) throw "Vel vector must be 3 in lenght!";
int i = 0;
for (float axis : Nrot){
for (_Float16 axis : Nrot){
rot[i] = axis;
i++;
}
+8 -3
View File
@@ -22,6 +22,7 @@ struct State
sf::Vector2f cameraOffset = {0.,0.};
sf::Clock clock;
ReferencePlane selectedPlane = ReferencePlane::XZ;
int selected = -1;
@@ -72,6 +73,12 @@ void handle(const sf::Event::TextEntered &textEnter, State &gs)
void handle(const sf::Event::KeyPressed &keyPressed, State &gs)
{
if (keyPressed.scancode == sf::Keyboard::Scancode::Space){
if (gs.selectedPlane == ReferencePlane::XZ)
gs.selectedPlane = ReferencePlane::YZ;
else
gs.selectedPlane = ReferencePlane::XZ;
}
}
void handle(const sf::Event::MouseMoved &mouseMoved, State &gs)
@@ -113,7 +120,6 @@ void handle(const sf::Event::MouseButtonPressed &mouseBP, State &gs)
if (dist(pos,mouseBP.position) < 20){
gs.selected = i;
break;
}
i++;
}
@@ -127,7 +133,6 @@ void handle(const sf::Event::MouseButtonPressed &mouseBP, State &gs)
if (dist(pos,mouseBP.position) < 20){
gs.selected = i;
break;
}
i++;
}
@@ -173,7 +178,7 @@ void doGraphics(State &gs)
doGUI(gs);
for(PieceInterface* p: gs.pieces){
gs.window.draw(*p->draw(ReferencePlane::XZ));
gs.window.draw(*p->draw(gs.selectedPlane));
}
// TODO: add here code to display shapes in your canvas
+5 -1
View File
@@ -40,7 +40,7 @@ int main() {
gs.pieces.push_back(new Coscia (rb::Vector3{300,10,300},2));
gs.pieces.push_back(new Sensore (rb::Vector3{300,300,300},_Float16( 0.2 ),900,3000,coscia));
gs.pieces.push_back(new Coscia (rb::Vector3{300,10,500},1));
gs.pieces.push_back(new Caviglia (rb::Vector3{300,10,500},1));
gs.pieces[1]->body.setRot({0,0,0});
@@ -49,6 +49,8 @@ int main() {
const auto& caviglia = processor.getData();
gs.pieces.push_back(new Sensore (rb::Vector3{300,700,500},_Float16( 0.2 ),900,3000,caviglia));
gs.pieces.push_back(new Torso(rb::Vector3{300,400,150},2));
// modifico la rotazione relativa della gamba
gs.pieces[1]->body.setRot({0,0,_Float16 (1.6)});
gs.pieces[3]->body.setRot({0,0,_Float16 (1.7)});
@@ -59,6 +61,8 @@ int main() {
gs.joints.push_back(new RigidJoint(gs.pieces[1], {gs.pieces[0]}));
gs.joints.push_back(new PivotJoint(gs.pieces[1], {gs.pieces[3]}, rb::Vector3{0,0,100}));
gs.joints.push_back(new RigidJoint(gs.pieces[3], {gs.pieces[2]}));
gs.joints.push_back(new PivotJoint(gs.pieces[4], {gs.pieces[1]}, rb::Vector3{0,0,50}));
printf("Ho costruito tutto!\n");
}