├── .gitignore ├── CMakeLists.txt ├── LICENSE ├── README.md ├── cmake ├── TbGALConfig.cmake.in └── TbGALConfigVersion.cmake.in ├── cpp ├── example │ ├── CMakeLists.txt │ ├── simple_usingEigen_assumingConformalD.cpp │ ├── simple_usingEigen_assumingEuclidean3.cpp │ └── simple_usingEigen_assumingHomogeneous3.cpp ├── include │ └── tbgal │ │ ├── Conformal │ │ ├── macro.hpp │ │ └── metric_space.hpp │ │ ├── Euclidean │ │ ├── macro.hpp │ │ └── metric_space.hpp │ │ ├── Homogeneous │ │ ├── macro.hpp │ │ └── metric_space.hpp │ │ ├── Minkowski │ │ ├── macro.hpp │ │ └── metric_space.hpp │ │ ├── Signed │ │ ├── macro.hpp │ │ └── metric_space.hpp │ │ ├── addition.hpp │ │ ├── apply_versor.hpp │ │ ├── assuming_Conformal1.hpp │ │ ├── assuming_Conformal2.hpp │ │ ├── assuming_Conformal3.hpp │ │ ├── assuming_ConformalD.hpp │ │ ├── assuming_Euclidean1.hpp │ │ ├── assuming_Euclidean2.hpp │ │ ├── assuming_Euclidean3.hpp │ │ ├── assuming_EuclideanD.hpp │ │ ├── assuming_Homogeneous1.hpp │ │ ├── assuming_Homogeneous2.hpp │ │ ├── assuming_Homogeneous3.hpp │ │ ├── assuming_HomogeneousD.hpp │ │ ├── assuming_Minkowski1.hpp │ │ ├── assuming_Minkowski2.hpp │ │ ├── assuming_Minkowski3.hpp │ │ ├── assuming_MinkowskiD.hpp │ │ ├── assuming_SignedPQ.hpp │ │ ├── conjugation.hpp │ │ ├── core.hpp │ │ ├── dot_product.hpp │ │ ├── dualization.hpp │ │ ├── exception.hpp │ │ ├── factored_multivector.hpp │ │ ├── factoring_product.hpp │ │ ├── geometric_product.hpp │ │ ├── hestenes_inner_product.hpp │ │ ├── inverse_geometric_product.hpp │ │ ├── inversion.hpp │ │ ├── involution.hpp │ │ ├── left_contraction.hpp │ │ ├── macro.hpp │ │ ├── matrix_declarations.hpp │ │ ├── metric_space.hpp │ │ ├── normalization.hpp │ │ ├── outer_product.hpp │ │ ├── reverse_norm.hpp │ │ ├── reversion.hpp │ │ ├── right_contraction.hpp │ │ ├── scalar_product.hpp │ │ ├── subtraction.hpp │ │ ├── unary_minus.hpp │ │ ├── unary_plus.hpp │ │ ├── using_Eigen.hpp │ │ ├── utils.hpp │ │ └── write.hpp └── test │ ├── CMakeLists-googletest.txt.in │ ├── CMakeLists.txt │ ├── common.hpp │ ├── usingEigen_assumingConformal1.cpp │ ├── usingEigen_assumingConformal2.cpp │ ├── usingEigen_assumingConformal3.cpp │ ├── usingEigen_assumingEuclidean1.cpp │ ├── usingEigen_assumingEuclidean2.cpp │ ├── usingEigen_assumingEuclidean3.cpp │ ├── usingEigen_assumingHomogeneous1.cpp │ ├── usingEigen_assumingHomogeneous2.cpp │ └── usingEigen_assumingHomogeneous3.cpp └── python ├── example ├── py2 │ ├── simple_conformalD.py │ ├── simple_euclidean3.py │ └── simple_homogeneous3.py └── py3 │ ├── simple_conformalD.py │ ├── simple_euclidean3.py │ └── simple_homogeneous3.py └── src ├── common.hpp ├── conformal1.cpp ├── conformal2.cpp ├── conformal3.cpp ├── conformalD.cpp ├── euclidean1.cpp ├── euclidean2.cpp ├── euclidean3.cpp ├── euclideanD.cpp ├── homogeneous1.cpp ├── homogeneous2.cpp ├── homogeneous3.cpp ├── homogeneousD.cpp ├── macro_Conformal.hpp ├── macro_Euclidean.hpp ├── macro_Homogeneous.hpp ├── macro_Minkowski.hpp ├── macro_Signed.hpp ├── minkowski1.cpp ├── minkowski2.cpp ├── minkowski3.cpp ├── minkowskiD.cpp └── signedPQ.cpp /.gitignore: -------------------------------------------------------------------------------- 1 | /.vscode 2 | /build 3 | /cpp/example/.vscode 4 | /cpp/example/build 5 | /python/example/py3/__pycache__ 6 | /cpp/test/build 7 | -------------------------------------------------------------------------------- /CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # Copyright (C) Eduardo Vera Sousa and Leandro Augusto Frata Fernandes 2 | # 3 | # authors : Sousa, Eduardo V. 4 | # Fernandes, Leandro A. F. 5 | # repository : https://github.com/Prograf-UFF/TbGAL 6 | # 7 | # This file is part of the Tensor-based Geometric Algebra Library (TbGAL). 8 | # 9 | # TbGAL is free software: you can redistribute it and/or modify 10 | # it under the terms of the GNU General Public License as published by 11 | # the Free Software Foundation, either version 3 of the License, or 12 | # (at your option) any later version. 13 | # 14 | # TbGAL is distributed in the hope that it will be useful, 15 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 16 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17 | # GNU General Public License for more details. 18 | # 19 | # You should have received a copy of the GNU General Public License 20 | # along with TbGAL. If not, see . 21 | 22 | cmake_minimum_required(VERSION 3.14) 23 | 24 | set(VERSION_MAJOR 1) 25 | set(VERSION_MINOR 0) 26 | set(VERSION_PATCH 20200604) 27 | 28 | project(TbGAL 29 | VERSION ${VERSION_MAJOR}.${VERSION_MINOR}.${VERSION_PATCH} 30 | DESCRIPTION "TbGAL: Tensor-Based Geometric Algebra Library" 31 | HOMEPAGE_URL https://github.com/Prograf-UFF/TbGAL 32 | LANGUAGES CXX 33 | ) 34 | 35 | set(CMAKE_CXX_STANDARD 17) 36 | set(CMAKE_CXX_STANDARD_REQUIRED ON) 37 | 38 | find_package(Eigen3 3.3 NO_MODULE REQUIRED) 39 | 40 | message(STATUS "Installing C++ front-end") 41 | 42 | file(INSTALL ./cpp/include DESTINATION ${CMAKE_INSTALL_PREFIX} FILES_MATCHING PATTERN "*.hpp") 43 | 44 | configure_file(./cmake/TbGALConfig.cmake.in ${CMAKE_CURRENT_BINARY_DIR}/TbGALConfig.cmake @ONLY NEWLINE_STYLE UNIX) 45 | file(INSTALL ${CMAKE_CURRENT_BINARY_DIR}/TbGALConfig.cmake DESTINATION ${CMAKE_INSTALL_PREFIX}/lib/tbgal) 46 | 47 | configure_file(./cmake/TbGALConfigVersion.cmake.in ${CMAKE_CURRENT_BINARY_DIR}/TbGALConfigVersion.cmake @ONLY NEWLINE_STYLE UNIX) 48 | file(INSTALL ${CMAKE_CURRENT_BINARY_DIR}/TbGALConfigVersion.cmake DESTINATION ${CMAKE_INSTALL_PREFIX}/lib/tbgal) 49 | 50 | message(STATUS "Installing C++ front-end - done") 51 | 52 | message(STATUS "Configuring Python front-end") 53 | 54 | find_package(Python COMPONENTS Interpreter Development NumPy) 55 | if(NOT Python_FOUND) 56 | message(STATUS "Configuring Python front-end - error (Python.Interpreter, Python.Developmemnt, or Python.NumPy components found)") 57 | else() 58 | if(WIN32) 59 | set(Boost_USE_MULTITHREADED ON) 60 | set(Boost_USE_STATIC_LIBS OFF) 61 | add_definitions(-DBOOST_ALL_NO_LIB) 62 | add_definitions(-DBOOST_ALL_DYN_LINK) 63 | endif() 64 | 65 | foreach(_boost_python_suffix IN ITEMS "${Python_VERSION_MAJOR}${Python_VERSION_MINOR}" "${Python_VERSION_MAJOR}" "") 66 | find_package(Boost COMPONENTS python${_boost_python_suffix} numpy${_boost_python_suffix}) 67 | if(Boost_FOUND) 68 | set(_boost_python_suffix_found ${_boost_python_suffix}) 69 | break() 70 | endif() 71 | endforeach() 72 | 73 | if(NOT Boost_FOUND) 74 | message(STATUS "Configuring Python front-end - error (no matching Boost.Python or Boost.NumPy components found)") 75 | else() 76 | link_libraries(${Python_LIBRARIES} Boost::python${_boost_python_suffix_found} Boost::numpy${_boost_python_suffix_found} ${TbGAL_LIBRARIES}) 77 | include_directories(${PROJECT_SOURCE_DIR}/python/src ${EIGEN3_INCLUDE_DIRS} ${Python_INCLUDE_DIRS} ${Python_NumPy_INCLUDE_DIRS} ${Boost_INCLUDE_DIR} ${TbGAL_INCLUDE_DIRS}) 78 | 79 | include(GNUInstallDirs) 80 | 81 | file(GLOB module_filenames RELATIVE ${PROJECT_SOURCE_DIR}/python/src ${PROJECT_SOURCE_DIR}/python/src/*.cpp) 82 | foreach(module_filename ${module_filenames}) 83 | string(REPLACE ".cpp" "" module_name ${module_filename}) 84 | Python_add_library(${module_name} ${PROJECT_SOURCE_DIR}/python/src/${module_filename}) 85 | install(TARGETS ${module_name} LIBRARY DESTINATION ${CMAKE_INSTALL_PREFIX}/lib/tbgal/python/${Python_VERSION_MAJOR}.${Python_VERSION_MINOR}/tbgal) 86 | endforeach() 87 | 88 | install(CODE "file(TOUCH \"${CMAKE_INSTALL_PREFIX}/lib/tbgal/python/${Python_VERSION_MAJOR}.${Python_VERSION_MINOR}/tbgal/__init__.py\")") 89 | 90 | message(STATUS "Configuring Python front-end - done") 91 | endif() 92 | endif() -------------------------------------------------------------------------------- /cmake/TbGALConfig.cmake.in: -------------------------------------------------------------------------------- 1 | # Copyright (C) Eduardo Vera Sousa and Leandro Augusto Frata Fernandes 2 | # 3 | # authors : Sousa, Eduardo V. 4 | # Fernandes, Leandro A. F. 5 | # repository : https://github.com/Prograf-UFF/TbGAL 6 | # 7 | # This file is part of the Tensor-based Geometric Algebra Library (TbGAL). 8 | # 9 | # TbGAL is free software: you can redistribute it and/or modify 10 | # it under the terms of the GNU General Public License as published by 11 | # the Free Software Foundation, either version 3 of the License, or 12 | # (at your option) any later version. 13 | # 14 | # TbGAL is distributed in the hope that it will be useful, 15 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 16 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17 | # GNU General Public License for more details. 18 | # 19 | # You should have received a copy of the GNU General Public License 20 | # along with TbGAL. If not, see . 21 | 22 | find_package(Eigen3 3.3 NO_MODULE REQUIRED) 23 | set(TbGAL_INCLUDE_DIRS "@CMAKE_INSTALL_PREFIX@/include" ${EIGEN3_INCLUDE_DIRS}) -------------------------------------------------------------------------------- /cmake/TbGALConfigVersion.cmake.in: -------------------------------------------------------------------------------- 1 | # Copyright (C) Eduardo Vera Sousa and Leandro Augusto Frata Fernandes 2 | # 3 | # authors : Sousa, Eduardo V. 4 | # Fernandes, Leandro A. F. 5 | # repository : https://github.com/Prograf-UFF/TbGAL 6 | # 7 | # This file is part of the Tensor-based Geometric Algebra Library (TbGAL). 8 | # 9 | # TbGAL is free software: you can redistribute it and/or modify 10 | # it under the terms of the GNU General Public License as published by 11 | # the Free Software Foundation, either version 3 of the License, or 12 | # (at your option) any later version. 13 | # 14 | # TbGAL is distributed in the hope that it will be useful, 15 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 16 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17 | # GNU General Public License for more details. 18 | # 19 | # You should have received a copy of the GNU General Public License 20 | # along with TbGAL. If not, see . 21 | 22 | set(PACKAGE_VERSION @TbGAL_VERSION_MAJOR@.@TbGAL_VERSION_MINOR@.@TbGAL_VERSION_PATCH@) 23 | 24 | if("${PACKAGE_FIND_VERSION_MAJOR}" EQUAL @TbGAL_VERSION_MAJOR@) 25 | set(PACKAGE_VERSION_COMPATIBLE true) 26 | if("${PACKAGE_FIND_VERSION_MINOR}" EQUAL @TbGAL_VERSION_MINOR@) 27 | set(PACKAGE_VERSION_EXACT true) 28 | endif() 29 | endif() -------------------------------------------------------------------------------- /cpp/example/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # Copyright (C) Eduardo Vera Sousa and Leandro Augusto Frata Fernandes 2 | # 3 | # authors : Sousa, Eduardo V. 4 | # Fernandes, Leandro A. F. 5 | # repository : https://github.com/Prograf-UFF/TbGAL 6 | # 7 | # This file is part of the Tensor-based Geometric Algebra Library (TbGAL). 8 | # 9 | # TbGAL is free software: you can redistribute it and/or modify 10 | # it under the terms of the GNU General Public License as published by 11 | # the Free Software Foundation, either version 3 of the License, or 12 | # (at your option) any later version. 13 | # 14 | # TbGAL is distributed in the hope that it will be useful, 15 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 16 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17 | # GNU General Public License for more details. 18 | # 19 | # You should have received a copy of the GNU General Public License 20 | # along with TbGAL. If not, see . 21 | 22 | cmake_minimum_required(VERSION 3.14) 23 | 24 | project(TbGAL-Example) 25 | 26 | find_package(TbGAL REQUIRED) 27 | 28 | set(CMAKE_CXX_STANDARD 17) 29 | set(CMAKE_CXX_STANDARD_REQUIRED ON) 30 | 31 | set(target_prefix TbGAL_example) 32 | 33 | file(GLOB example_filenames RELATIVE ${PROJECT_SOURCE_DIR} ${PROJECT_SOURCE_DIR}/*.cpp) 34 | foreach(example_filename ${example_filenames}) 35 | string(REPLACE ".cpp" "" example_name ${example_filename}) 36 | add_executable(${target_prefix}_${example_name} ${PROJECT_SOURCE_DIR}/${example_filename}) 37 | target_include_directories(${target_prefix}_${example_name} PUBLIC ${PROJECT_SOURCE_DIR} ${TbGAL_INCLUDE_DIRS}) 38 | target_link_libraries(${target_prefix}_${example_name}) 39 | endforeach() 40 | -------------------------------------------------------------------------------- /cpp/example/simple_usingEigen_assumingConformalD.cpp: -------------------------------------------------------------------------------- 1 | /* Copyright (C) Eduardo Vera Sousa and Leandro Augusto Frata Fernandes 2 | * 3 | * authors : Sousa, Eduardo V. 4 | * Fernandes, Leandro A. F. 5 | * repository : https://github.com/Prograf-UFF/TbGAL 6 | * 7 | * This file is part of the Tensor-based Geometric Algebra Library (TbGAL). 8 | * 9 | * TbGAL is free software: you can redistribute it and/or modify 10 | * it under the terms of the GNU General Public License as published by 11 | * the Free Software Foundation, either version 3 of the License, or 12 | * (at your option) any later version. 13 | * 14 | * TbGAL is distributed in the hope that it will be useful, 15 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 16 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17 | * GNU General Public License for more details. 18 | * 19 | * You should have received a copy of the GNU General Public License 20 | * along with TbGAL. If not, see . 21 | */ 22 | 23 | #include 24 | #include 25 | 26 | using namespace tbgal; 27 | using namespace tbgal::ConformalD; 28 | 29 | int main(int argc, char *argv[]) { 30 | SPACE.set_base_space_dimensions(10); 31 | std::cout << "Conformal model of " << SPACE.base_space_dimensions() << "-D Euclidean space (n =" << SPACE.dimensions() << ")" << std::endl; 32 | std::cout << std::endl; 33 | 34 | auto x = euclidean_vector(10.0, 20.0, 30.0, 40.0, 50.0, 60.0, 70.0, 80.0, 90.0, 100.0); 35 | auto x1 = sp(x, e(1)); 36 | auto x3 = sp(x, e(3)); // We have to use the e(i), no(), and ni() 37 | // functions instead of the ei, no, and ni 38 | auto Y = x^ni(); // constants because the number of dimensions 39 | // of the base space is defined at runtime 40 | std::cout << "x = " << x << std::endl; 41 | std::cout << "x1 = " << x1 << std::endl; 42 | std::cout << "x3 = " << x3 << std::endl; 43 | std::cout << std::endl; 44 | std::cout << "Y = " << Y << std::endl; 45 | 46 | return EXIT_SUCCESS; 47 | } 48 | -------------------------------------------------------------------------------- /cpp/example/simple_usingEigen_assumingEuclidean3.cpp: -------------------------------------------------------------------------------- 1 | /* Copyright (C) Eduardo Vera Sousa and Leandro Augusto Frata Fernandes 2 | * 3 | * authors : Sousa, Eduardo V. 4 | * Fernandes, Leandro A. F. 5 | * repository : https://github.com/Prograf-UFF/TbGAL 6 | * 7 | * This file is part of the Tensor-based Geometric Algebra Library (TbGAL). 8 | * 9 | * TbGAL is free software: you can redistribute it and/or modify 10 | * it under the terms of the GNU General Public License as published by 11 | * the Free Software Foundation, either version 3 of the License, or 12 | * (at your option) any later version. 13 | * 14 | * TbGAL is distributed in the hope that it will be useful, 15 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 16 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17 | * GNU General Public License for more details. 18 | * 19 | * You should have received a copy of the GNU General Public License 20 | * along with TbGAL. If not, see . 21 | */ 22 | 23 | #include 24 | #include 25 | 26 | using namespace tbgal; 27 | using namespace tbgal::Euclidean3; 28 | 29 | int main(int argc, char *argv[]) { 30 | auto a = vector(0.5, 0.0, 0.5); // a = 0.5 * (e1 + e3) 31 | 32 | auto M = 3.0 * (e1 ^ e2); // M = 3.0 * e1^e2 33 | auto v = dual(M); // v = 3.0 * e3 34 | 35 | auto b = -gp(v, a, inverse(v)); // b = 0.5 * (e1 - e3) 36 | 37 | std::cout << "a = " << a << std::endl; 38 | std::cout << "M = " << M << std::endl; 39 | std::cout << "v = " << v << std::endl; 40 | std::cout << "b = " << b << std::endl; 41 | 42 | return EXIT_SUCCESS; 43 | } 44 | -------------------------------------------------------------------------------- /cpp/example/simple_usingEigen_assumingHomogeneous3.cpp: -------------------------------------------------------------------------------- 1 | /* Copyright (C) Eduardo Vera Sousa and Leandro Augusto Frata Fernandes 2 | * 3 | * authors : Sousa, Eduardo V. 4 | * Fernandes, Leandro A. F. 5 | * repository : https://github.com/Prograf-UFF/TbGAL 6 | * 7 | * This file is part of the Tensor-based Geometric Algebra Library (TbGAL). 8 | * 9 | * TbGAL is free software: you can redistribute it and/or modify 10 | * it under the terms of the GNU General Public License as published by 11 | * the Free Software Foundation, either version 3 of the License, or 12 | * (at your option) any later version. 13 | * 14 | * TbGAL is distributed in the hope that it will be useful, 15 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 16 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17 | * GNU General Public License for more details. 18 | * 19 | * You should have received a copy of the GNU General Public License 20 | * along with TbGAL. If not, see . 21 | */ 22 | 23 | #include 24 | #include 25 | 26 | using namespace tbgal; 27 | using namespace tbgal::Homogeneous3; 28 | 29 | int main(int argc, char *argv[]) { 30 | double x, y, z; 31 | 32 | std::cout << "-- Input" << std::endl; 33 | std::cout << std::endl; 34 | std::cout << "x = "; std::cin >> x; 35 | std::cout << "y = "; std::cin >> y; 36 | std::cout << "z = "; std::cin >> z; 37 | std::cout << std::endl; 38 | 39 | auto p = point(x, y, z); 40 | auto d = direction(x, y, z); 41 | auto l = p ^ d; 42 | 43 | std::cout << "-- Result" << std::endl; 44 | std::cout << std::endl; 45 | std::cout << "p = " << p << std::endl; 46 | std::cout << "d = " << d << std::endl; 47 | std::cout << "l = p ^ d = " << l << std::endl; 48 | std::cout << std::endl; 49 | 50 | return EXIT_SUCCESS; 51 | } 52 | -------------------------------------------------------------------------------- /cpp/include/tbgal/Conformal/macro.hpp: -------------------------------------------------------------------------------- 1 | /* Copyright (C) Eduardo Vera Sousa and Leandro Augusto Frata Fernandes 2 | * 3 | * authors : Sousa, Eduardo V. 4 | * Fernandes, Leandro A. F. 5 | * repository : https://github.com/Prograf-UFF/TbGAL 6 | * 7 | * This file is part of the Tensor-based Geometric Algebra Library (TbGAL). 8 | * 9 | * TbGAL is free software: you can redistribute it and/or modify 10 | * it under the terms of the GNU General Public License as published by 11 | * the Free Software Foundation, either version 3 of the License, or 12 | * (at your option) any later version. 13 | * 14 | * TbGAL is distributed in the hope that it will be useful, 15 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 16 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17 | * GNU General Public License for more details. 18 | * 19 | * You should have received a copy of the GNU General Public License 20 | * along with TbGAL. If not, see . 21 | */ 22 | 23 | #ifndef __TBGAL_CONFORMAL_MACRO_HPP__ 24 | #define __TBGAL_CONFORMAL_MACRO_HPP__ 25 | 26 | #define TBGAL_OVERLOAD_CONFORMAL_UTILS(METRIC_SPACE) \ 27 | \ 28 | template >...>, int> > \ 29 | constexpr decltype(auto) euclidean_vector(ScalarTypes &&... coords) { \ 30 | return tbgal::detail::make_vector(&METRIC_SPACE, std::move(coords)..., 0, 0); \ 31 | } \ 32 | \ 33 | template, int> > \ 34 | constexpr decltype(auto) euclidean_vector(IteratorType begin, IteratorType end) { \ 35 | return tbgal::detail::make_vector_using_iterator(&METRIC_SPACE, begin, end, 0, 0); \ 36 | } \ 37 | \ 38 | template >...>, int> > \ 39 | constexpr decltype(auto) point(ScalarTypes &&... coords) { \ 40 | return tbgal::detail::make_vector(&METRIC_SPACE, std::move(coords)..., 1, ((std::move(coords) * std::move(coords)) + ... + 0) / 2); \ 41 | } \ 42 | \ 43 | template, int> > \ 44 | constexpr decltype(auto) point(IteratorType begin, IteratorType end) { \ 45 | std::remove_cv_t::value_type> > aux = 0; \ 46 | for (IteratorType itr = begin; itr != end; ++itr) { \ 47 | aux += (*itr) * (*itr); \ 48 | } \ 49 | return tbgal::detail::make_vector_using_iterator(&METRIC_SPACE, begin, end, 1, aux / 2); \ 50 | } 51 | 52 | //TODO [NEXT] Inclue other helpers. 53 | 54 | #endif // __TBGAL_CONFORMAL_MACRO_HPP__ 55 | -------------------------------------------------------------------------------- /cpp/include/tbgal/Conformal/metric_space.hpp: -------------------------------------------------------------------------------- 1 | /* Copyright (C) Eduardo Vera Sousa and Leandro Augusto Frata Fernandes 2 | * 3 | * authors : Sousa, Eduardo V. 4 | * Fernandes, Leandro A. F. 5 | * repository : https://github.com/Prograf-UFF/TbGAL 6 | * 7 | * This file is part of the Tensor-based Geometric Algebra Library (TbGAL). 8 | * 9 | * TbGAL is free software: you can redistribute it and/or modify 10 | * it under the terms of the GNU General Public License as published by 11 | * the Free Software Foundation, either version 3 of the License, or 12 | * (at your option) any later version. 13 | * 14 | * TbGAL is distributed in the hope that it will be useful, 15 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 16 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17 | * GNU General Public License for more details. 18 | * 19 | * You should have received a copy of the GNU General Public License 20 | * along with TbGAL. If not, see . 21 | */ 22 | 23 | #ifndef __TBGAL_CONFORMAL_METRIC_SPACE_HPP__ 24 | #define __TBGAL_CONFORMAL_METRIC_SPACE_HPP__ 25 | 26 | namespace tbgal { 27 | 28 | template 29 | class ConformalMetricSpace : public BaseSignedMetricSpace { 30 | private: 31 | 32 | using Super = BaseSignedMetricSpace; 33 | 34 | public: 35 | 36 | using IndexType = typename Super::IndexType; 37 | using ScalarType = typename Super::ScalarType; 38 | 39 | constexpr static IndexType DimensionsAtCompileTime = Super::DimensionsAtCompileTime; 40 | constexpr static IndexType MaxDimensionsAtCompileTime = Super::MaxDimensionsAtCompileTime; 41 | 42 | constexpr static IndexType BaseSpaceDimensionsAtCompileTime = BaseSpaceDimensionsAtCompileTime_; 43 | constexpr static IndexType MaxBaseSpaceDimensionsAtCompileTime = MaxBaseSpaceDimensionsAtCompileTime_; 44 | 45 | inline ConformalMetricSpace(ConformalMetricSpace const &) = default; 46 | inline ConformalMetricSpace(ConformalMetricSpace &&) = default; 47 | 48 | inline ConformalMetricSpace(IndexType base_space_dimensions) : 49 | Super(base_space_dimensions + 1, 1), 50 | basis_vectors_str_(), 51 | from_actual_to_signed_metric_(), 52 | from_signed_to_actual_metric_() { 53 | update_basis_vectors_str(base_space_dimensions); 54 | } 55 | 56 | inline ConformalMetricSpace() : 57 | ConformalMetricSpace((BaseSpaceDimensionsAtCompileTime != Dynamic) ? BaseSpaceDimensionsAtCompileTime : 0) { 58 | } 59 | 60 | inline ConformalMetricSpace & operator=(ConformalMetricSpace const &) = default; 61 | inline ConformalMetricSpace & operator=(ConformalMetricSpace &&) = default; 62 | 63 | inline std::string const & basis_vector_str(IndexType index) const override { 64 | return basis_vectors_str_[index]; 65 | } 66 | 67 | inline IndexType base_space_dimensions() const { 68 | return Super::dimensions() - 2; 69 | } 70 | 71 | inline void set_base_space_dimensions(IndexType base_space_dimensions) { 72 | Super::set_dimensions(base_space_dimensions + 1, 1); 73 | update_basis_vectors_str(base_space_dimensions); 74 | } 75 | 76 | private: 77 | 78 | inline void update_basis_vectors_str(IndexType base_space_dimensions) { 79 | basis_vectors_str_.resize(base_space_dimensions + 2); 80 | for (IndexType ind = 0; ind != base_space_dimensions; ++ind) { 81 | basis_vectors_str_[ind] = "e" + std::to_string(ind + 1); 82 | } 83 | basis_vectors_str_[base_space_dimensions] = "no"; 84 | basis_vectors_str_[base_space_dimensions + 1] = "ni"; 85 | 86 | auto aux = 1 / sqrt(ScalarType(2)); 87 | from_actual_to_signed_metric_ = detail::make_identity_matrix(base_space_dimensions + 2); 88 | detail::coeff(from_actual_to_signed_metric_, base_space_dimensions, base_space_dimensions) = aux; 89 | detail::coeff(from_actual_to_signed_metric_, base_space_dimensions + 1, base_space_dimensions) = aux; 90 | detail::coeff(from_actual_to_signed_metric_, base_space_dimensions, base_space_dimensions + 1) = -aux; 91 | detail::coeff(from_actual_to_signed_metric_, base_space_dimensions + 1, base_space_dimensions + 1) = aux; 92 | 93 | from_signed_to_actual_metric_ = detail::transpose(from_actual_to_signed_metric_); 94 | } 95 | 96 | std::vector basis_vectors_str_; 97 | detail::matrix_type_t from_actual_to_signed_metric_; 98 | detail::matrix_type_t from_signed_to_actual_metric_; 99 | 100 | template friend struct detail::from_actual_to_signed_metric_impl; 101 | template friend struct detail::from_signed_to_actual_metric_impl; 102 | }; 103 | 104 | namespace detail { 105 | 106 | template 107 | struct from_actual_to_signed_metric_impl > { 108 | template 109 | constexpr static decltype(auto) eval(ConformalMetricSpace const *space_ptr, MatrixType &&factors_in_actual_metric) { 110 | return detail::prod(space_ptr->from_actual_to_signed_metric_, std::move(factors_in_actual_metric)); 111 | } 112 | }; 113 | 114 | template 115 | struct from_signed_to_actual_metric_impl > { 116 | template 117 | constexpr static decltype(auto) eval(ConformalMetricSpace const *space_ptr, MatrixType &&factors_in_signed_metric) { 118 | return detail::prod(space_ptr->from_signed_to_actual_metric_, std::move(factors_in_signed_metric)); 119 | } 120 | }; 121 | 122 | } 123 | 124 | } 125 | 126 | #endif // __TBGAL_CONFORMAL_METRIC_SPACE_HPP__ 127 | -------------------------------------------------------------------------------- /cpp/include/tbgal/Euclidean/macro.hpp: -------------------------------------------------------------------------------- 1 | /* Copyright (C) Eduardo Vera Sousa and Leandro Augusto Frata Fernandes 2 | * 3 | * authors : Sousa, Eduardo V. 4 | * Fernandes, Leandro A. F. 5 | * repository : https://github.com/Prograf-UFF/TbGAL 6 | * 7 | * This file is part of the Tensor-based Geometric Algebra Library (TbGAL). 8 | * 9 | * TbGAL is free software: you can redistribute it and/or modify 10 | * it under the terms of the GNU General Public License as published by 11 | * the Free Software Foundation, either version 3 of the License, or 12 | * (at your option) any later version. 13 | * 14 | * TbGAL is distributed in the hope that it will be useful, 15 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 16 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17 | * GNU General Public License for more details. 18 | * 19 | * You should have received a copy of the GNU General Public License 20 | * along with TbGAL. If not, see . 21 | */ 22 | 23 | #ifndef __TBGAL_EUCLIDEAN_MACRO_HPP__ 24 | #define __TBGAL_EUCLIDEAN_MACRO_HPP__ 25 | 26 | #define TBGAL_OVERLOAD_EUCLIDEAN_UTILS(METRIC_SPACE) \ 27 | \ 28 | template >...>, int> > \ 29 | constexpr decltype(auto) euclidean_vector(ScalarTypes &&... coords) { \ 30 | return tbgal::detail::make_vector(&METRIC_SPACE, std::move(coords)...); \ 31 | } \ 32 | \ 33 | template, int> > \ 34 | constexpr decltype(auto) euclidean_vector(IteratorType begin, IteratorType end) { \ 35 | return tbgal::detail::make_vector_using_iterator(&METRIC_SPACE, begin, end); \ 36 | } 37 | 38 | #endif // __TBGAL_EUCLIDEAN_MACRO_HPP__ 39 | -------------------------------------------------------------------------------- /cpp/include/tbgal/Euclidean/metric_space.hpp: -------------------------------------------------------------------------------- 1 | /* Copyright (C) Eduardo Vera Sousa and Leandro Augusto Frata Fernandes 2 | * 3 | * authors : Sousa, Eduardo V. 4 | * Fernandes, Leandro A. F. 5 | * repository : https://github.com/Prograf-UFF/TbGAL 6 | * 7 | * This file is part of the Tensor-based Geometric Algebra Library (TbGAL). 8 | * 9 | * TbGAL is free software: you can redistribute it and/or modify 10 | * it under the terms of the GNU General Public License as published by 11 | * the Free Software Foundation, either version 3 of the License, or 12 | * (at your option) any later version. 13 | * 14 | * TbGAL is distributed in the hope that it will be useful, 15 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 16 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17 | * GNU General Public License for more details. 18 | * 19 | * You should have received a copy of the GNU General Public License 20 | * along with TbGAL. If not, see . 21 | */ 22 | 23 | #ifndef __TBGAL_EUCLIDEAN_METRIC_SPACE_HPP__ 24 | #define __TBGAL_EUCLIDEAN_METRIC_SPACE_HPP__ 25 | 26 | namespace tbgal { 27 | 28 | template 29 | class EuclideanMetricSpace : public BaseSignedMetricSpace { 30 | private: 31 | 32 | using Super = BaseSignedMetricSpace; 33 | 34 | public: 35 | 36 | using IndexType = typename Super::IndexType; 37 | using ScalarType = typename Super::ScalarType; 38 | 39 | constexpr static IndexType DimensionsAtCompileTime = Super::DimensionsAtCompileTime; 40 | constexpr static IndexType MaxDimensionsAtCompileTime = Super::MaxDimensionsAtCompileTime; 41 | 42 | inline EuclideanMetricSpace(EuclideanMetricSpace const &) = default; 43 | inline EuclideanMetricSpace(EuclideanMetricSpace &&) = default; 44 | 45 | inline EuclideanMetricSpace(IndexType dimensions) : 46 | Super(dimensions, 0), 47 | basis_vectors_str_(0) { 48 | update_basis_vectors_str(dimensions); 49 | } 50 | 51 | inline EuclideanMetricSpace() : 52 | EuclideanMetricSpace((DimensionsAtCompileTime != Dynamic) ? DimensionsAtCompileTime : 0) { 53 | } 54 | 55 | inline EuclideanMetricSpace & operator=(EuclideanMetricSpace const &) = default; 56 | inline EuclideanMetricSpace & operator=(EuclideanMetricSpace &&) = default; 57 | 58 | inline std::string const & basis_vector_str(IndexType index) const override { 59 | return basis_vectors_str_[index]; 60 | } 61 | 62 | inline void set_dimensions(IndexType dimensions) { 63 | Super::set_dimensions(dimensions, 0); 64 | update_basis_vectors_str(dimensions); 65 | } 66 | 67 | private: 68 | 69 | inline void update_basis_vectors_str(IndexType dimensions) { 70 | basis_vectors_str_.resize(dimensions); 71 | for (IndexType ind = 0; ind != dimensions; ++ind) { 72 | basis_vectors_str_[ind] = "e" + std::to_string(ind + 1); 73 | } 74 | } 75 | 76 | std::vector basis_vectors_str_; 77 | }; 78 | 79 | } 80 | 81 | #endif // __TBGAL_EUCLIDEAN_METRIC_SPACE_HPP__ 82 | -------------------------------------------------------------------------------- /cpp/include/tbgal/Homogeneous/macro.hpp: -------------------------------------------------------------------------------- 1 | /* Copyright (C) Eduardo Vera Sousa and Leandro Augusto Frata Fernandes 2 | * 3 | * authors : Sousa, Eduardo V. 4 | * Fernandes, Leandro A. F. 5 | * repository : https://github.com/Prograf-UFF/TbGAL 6 | * 7 | * This file is part of the Tensor-based Geometric Algebra Library (TbGAL). 8 | * 9 | * TbGAL is free software: you can redistribute it and/or modify 10 | * it under the terms of the GNU General Public License as published by 11 | * the Free Software Foundation, either version 3 of the License, or 12 | * (at your option) any later version. 13 | * 14 | * TbGAL is distributed in the hope that it will be useful, 15 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 16 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17 | * GNU General Public License for more details. 18 | * 19 | * You should have received a copy of the GNU General Public License 20 | * along with TbGAL. If not, see . 21 | */ 22 | 23 | #ifndef __TBGAL_HOMOGENEOUS_MACRO_HPP__ 24 | #define __TBGAL_HOMOGENEOUS_MACRO_HPP__ 25 | 26 | #define TBGAL_OVERLOAD_HOMOGENEOUS_UTILS(METRIC_SPACE) \ 27 | \ 28 | template >...>, int> > \ 29 | constexpr decltype(auto) direction(ScalarTypes &&... coords) { \ 30 | return tbgal::detail::make_vector(&METRIC_SPACE, std::move(coords)..., 0); \ 31 | } \ 32 | \ 33 | template, int> > \ 34 | constexpr decltype(auto) direction(IteratorType begin, IteratorType end) { \ 35 | return tbgal::detail::make_vector_using_iterator(&METRIC_SPACE, begin, end, 0); \ 36 | } \ 37 | \ 38 | template >...>, int> > \ 39 | constexpr decltype(auto) euclidean_vector(ScalarTypes &&... coords) { \ 40 | return tbgal::detail::make_vector(&METRIC_SPACE, std::move(coords)..., 0); \ 41 | } \ 42 | \ 43 | template, int> > \ 44 | constexpr decltype(auto) euclidean_vector(IteratorType begin, IteratorType end) { \ 45 | return tbgal::detail::make_vector_using_iterator(&METRIC_SPACE, begin, end, 0); \ 46 | } \ 47 | \ 48 | template >...>, int> > \ 49 | constexpr decltype(auto) point(ScalarTypes &&... coords) { \ 50 | return tbgal::detail::make_vector(&METRIC_SPACE, std::move(coords)..., 1); \ 51 | } \ 52 | \ 53 | template, int> > \ 54 | constexpr decltype(auto) point(IteratorType begin, IteratorType end) { \ 55 | return tbgal::detail::make_vector_using_iterator(&METRIC_SPACE, begin, end, 1); \ 56 | } 57 | 58 | //TODO [NEXT] Inclue other helpers. 59 | 60 | #endif // __TBGAL_HOMOGENEOUS_MACRO_HPP__ 61 | -------------------------------------------------------------------------------- /cpp/include/tbgal/Homogeneous/metric_space.hpp: -------------------------------------------------------------------------------- 1 | /* Copyright (C) Eduardo Vera Sousa and Leandro Augusto Frata Fernandes 2 | * 3 | * authors : Sousa, Eduardo V. 4 | * Fernandes, Leandro A. F. 5 | * repository : https://github.com/Prograf-UFF/TbGAL 6 | * 7 | * This file is part of the Tensor-based Geometric Algebra Library (TbGAL). 8 | * 9 | * TbGAL is free software: you can redistribute it and/or modify 10 | * it under the terms of the GNU General Public License as published by 11 | * the Free Software Foundation, either version 3 of the License, or 12 | * (at your option) any later version. 13 | * 14 | * TbGAL is distributed in the hope that it will be useful, 15 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 16 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17 | * GNU General Public License for more details. 18 | * 19 | * You should have received a copy of the GNU General Public License 20 | * along with TbGAL. If not, see . 21 | */ 22 | 23 | #ifndef __TBGAL_HOMOGENEOUS_METRIC_SPACE_HPP__ 24 | #define __TBGAL_HOMOGENEOUS_METRIC_SPACE_HPP__ 25 | 26 | namespace tbgal { 27 | 28 | template 29 | class HomogeneousMetricSpace : public BaseSignedMetricSpace { 30 | private: 31 | 32 | using Super = BaseSignedMetricSpace; 33 | 34 | public: 35 | 36 | using IndexType = typename Super::IndexType; 37 | using ScalarType = typename Super::ScalarType; 38 | 39 | constexpr static IndexType DimensionsAtCompileTime = Super::DimensionsAtCompileTime; 40 | constexpr static IndexType MaxDimensionsAtCompileTime = Super::MaxDimensionsAtCompileTime; 41 | 42 | constexpr static IndexType BaseSpaceDimensionsAtCompileTime = BaseSpaceDimensionsAtCompileTime_; 43 | constexpr static IndexType MaxBaseSpaceDimensionsAtCompileTime = MaxBaseSpaceDimensionsAtCompileTime_; 44 | 45 | inline HomogeneousMetricSpace(HomogeneousMetricSpace const &) = default; 46 | inline HomogeneousMetricSpace(HomogeneousMetricSpace &&) = default; 47 | 48 | inline HomogeneousMetricSpace(IndexType base_space_dimensions) : 49 | Super(base_space_dimensions + 1, 0), 50 | basis_vectors_str_() { 51 | update_basis_vectors_str(base_space_dimensions); 52 | } 53 | 54 | inline HomogeneousMetricSpace() : 55 | HomogeneousMetricSpace((BaseSpaceDimensionsAtCompileTime != Dynamic) ? BaseSpaceDimensionsAtCompileTime : 0) { 56 | } 57 | 58 | inline HomogeneousMetricSpace & operator=(HomogeneousMetricSpace const &) = default; 59 | inline HomogeneousMetricSpace & operator=(HomogeneousMetricSpace &&) = default; 60 | 61 | inline std::string const & basis_vector_str(IndexType index) const override { 62 | return basis_vectors_str_[index]; 63 | } 64 | 65 | inline IndexType base_space_dimensions() const { 66 | return Super::dimensions() - 1; 67 | } 68 | 69 | inline void set_base_space_dimensions(IndexType base_space_dimensions) { 70 | Super::set_dimensions(base_space_dimensions + 1, 0); 71 | update_basis_vectors_str(base_space_dimensions); 72 | } 73 | 74 | private: 75 | 76 | inline void update_basis_vectors_str(IndexType base_space_dimensions) { 77 | basis_vectors_str_.resize(base_space_dimensions + 1); 78 | for (IndexType ind = 0; ind != base_space_dimensions; ++ind) { 79 | basis_vectors_str_[ind] = "e" + std::to_string(ind + 1); 80 | } 81 | basis_vectors_str_[base_space_dimensions] = "ep"; 82 | } 83 | 84 | std::vector basis_vectors_str_; 85 | }; 86 | 87 | } 88 | 89 | #endif // __TBGAL_HOMOGENEOUS_METRIC_SPACE_HPP__ 90 | -------------------------------------------------------------------------------- /cpp/include/tbgal/Minkowski/macro.hpp: -------------------------------------------------------------------------------- 1 | /* Copyright (C) Eduardo Vera Sousa and Leandro Augusto Frata Fernandes 2 | * 3 | * authors : Sousa, Eduardo V. 4 | * Fernandes, Leandro A. F. 5 | * repository : https://github.com/Prograf-UFF/TbGAL 6 | * 7 | * This file is part of the Tensor-based Geometric Algebra Library (TbGAL). 8 | * 9 | * TbGAL is free software: you can redistribute it and/or modify 10 | * it under the terms of the GNU General Public License as published by 11 | * the Free Software Foundation, either version 3 of the License, or 12 | * (at your option) any later version. 13 | * 14 | * TbGAL is distributed in the hope that it will be useful, 15 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 16 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17 | * GNU General Public License for more details. 18 | * 19 | * You should have received a copy of the GNU General Public License 20 | * along with TbGAL. If not, see . 21 | */ 22 | 23 | #ifndef __TBGAL_MINKOWSKI_MACRO_HPP__ 24 | #define __TBGAL_MINKOWSKI_MACRO_HPP__ 25 | 26 | #define TBGAL_OVERLOAD_MINKOWSKI_UTILS(METRIC_SPACE) \ 27 | \ 28 | template >...>, int> > \ 29 | constexpr decltype(auto) euclidean_vector(ScalarTypes &&... coords) { \ 30 | return tbgal::detail::make_vector(&METRIC_SPACE, std::move(coords)..., 0, 0); \ 31 | } \ 32 | \ 33 | template, int> > \ 34 | constexpr decltype(auto) euclidean_vector(IteratorType begin, IteratorType end) { \ 35 | return tbgal::detail::make_vector_using_iterator(&METRIC_SPACE, begin, end, 0, 0); \ 36 | } \ 37 | \ 38 | template >...>, int> > \ 39 | constexpr decltype(auto) point(ScalarTypes &&... coords) { \ 40 | auto aux = ((std::move(coords) * std::move(coords)) + ... + 0); \ 41 | return tbgal::detail::make_vector(&METRIC_SPACE, std::move(coords)..., (aux - 1) / 2, (aux + 1) / 2); \ 42 | } \ 43 | \ 44 | template, int> > \ 45 | constexpr decltype(auto) point(IteratorType begin, IteratorType end) { \ 46 | std::remove_cv_t::value_type> > aux = 0; \ 47 | for (IteratorType itr = begin; itr != end; ++itr) { \ 48 | aux += (*itr) * (*itr); \ 49 | } \ 50 | return tbgal::detail::make_vector_using_iterator(&METRIC_SPACE, begin, end, (aux - 1) / 2, (aux + 1) / 2); \ 51 | } 52 | 53 | //TODO [NEXT] Inclue other helpers. 54 | 55 | #endif // __TBGAL_MINKOWSKI_MACRO_HPP__ 56 | -------------------------------------------------------------------------------- /cpp/include/tbgal/Minkowski/metric_space.hpp: -------------------------------------------------------------------------------- 1 | /* Copyright (C) Eduardo Vera Sousa and Leandro Augusto Frata Fernandes 2 | * 3 | * authors : Sousa, Eduardo V. 4 | * Fernandes, Leandro A. F. 5 | * repository : https://github.com/Prograf-UFF/TbGAL 6 | * 7 | * This file is part of the Tensor-based Geometric Algebra Library (TbGAL). 8 | * 9 | * TbGAL is free software: you can redistribute it and/or modify 10 | * it under the terms of the GNU General Public License as published by 11 | * the Free Software Foundation, either version 3 of the License, or 12 | * (at your option) any later version. 13 | * 14 | * TbGAL is distributed in the hope that it will be useful, 15 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 16 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17 | * GNU General Public License for more details. 18 | * 19 | * You should have received a copy of the GNU General Public License 20 | * along with TbGAL. If not, see . 21 | */ 22 | 23 | #ifndef __TBGAL_MINKOWSKI_METRIC_SPACE_HPP__ 24 | #define __TBGAL_MINKOWSKI_METRIC_SPACE_HPP__ 25 | 26 | namespace tbgal { 27 | 28 | template 29 | class MinkowskiMetricSpace : public BaseSignedMetricSpace { 30 | private: 31 | 32 | using Super = BaseSignedMetricSpace; 33 | 34 | public: 35 | 36 | using IndexType = typename Super::IndexType; 37 | using ScalarType = typename Super::ScalarType; 38 | 39 | constexpr static IndexType DimensionsAtCompileTime = Super::DimensionsAtCompileTime; 40 | constexpr static IndexType MaxDimensionsAtCompileTime = Super::MaxDimensionsAtCompileTime; 41 | 42 | constexpr static IndexType BaseSpaceDimensionsAtCompileTime = BaseSpaceDimensionsAtCompileTime_; 43 | constexpr static IndexType MaxBaseSpaceDimensionsAtCompileTime = MaxBaseSpaceDimensionsAtCompileTime_; 44 | 45 | inline MinkowskiMetricSpace(MinkowskiMetricSpace const &) = default; 46 | inline MinkowskiMetricSpace(MinkowskiMetricSpace &&) = default; 47 | 48 | inline MinkowskiMetricSpace(IndexType base_space_dimensions) : 49 | Super(base_space_dimensions + 1, 1), 50 | basis_vectors_str_() { 51 | update_basis_vectors_str(base_space_dimensions); 52 | } 53 | 54 | inline MinkowskiMetricSpace() : 55 | MinkowskiMetricSpace((BaseSpaceDimensionsAtCompileTime != Dynamic) ? BaseSpaceDimensionsAtCompileTime : 0) { 56 | } 57 | 58 | inline MinkowskiMetricSpace & operator=(MinkowskiMetricSpace const &) = default; 59 | inline MinkowskiMetricSpace & operator=(MinkowskiMetricSpace &&) = default; 60 | 61 | inline std::string const & basis_vector_str(IndexType index) const override { 62 | return basis_vectors_str_[index]; 63 | } 64 | 65 | inline IndexType base_space_dimensions() const { 66 | return Super::dimensions() - 2; 67 | } 68 | 69 | inline void set_base_space_dimensions(IndexType base_space_dimensions) { 70 | Super::set_dimensions(base_space_dimensions + 1, 1); 71 | update_basis_vectors_str(base_space_dimensions); 72 | } 73 | 74 | private: 75 | 76 | inline void update_basis_vectors_str(IndexType base_space_dimensions) { 77 | basis_vectors_str_.resize(base_space_dimensions + 2); 78 | for (IndexType ind = 0; ind != base_space_dimensions; ++ind) { 79 | basis_vectors_str_[ind] = "e" + std::to_string(ind + 1); 80 | } 81 | basis_vectors_str_[base_space_dimensions] = "ep"; 82 | basis_vectors_str_[base_space_dimensions + 1] = "em"; 83 | } 84 | 85 | std::vector basis_vectors_str_; 86 | }; 87 | 88 | namespace detail { 89 | 90 | template 91 | struct from_actual_to_signed_metric_impl > { 92 | template 93 | constexpr static decltype(auto) eval(MinkowskiMetricSpace const *, MatrixType &&factors_in_actual_metric) { 94 | return std::move(factors_in_actual_metric); 95 | } 96 | }; 97 | 98 | template 99 | struct from_signed_to_actual_metric_impl > { 100 | template 101 | constexpr static decltype(auto) eval(MinkowskiMetricSpace const *space_ptr, MatrixType &&factors_in_signed_metric) { 102 | return std::move(factors_in_signed_metric); 103 | } 104 | }; 105 | 106 | } 107 | 108 | } 109 | 110 | #endif // __TBGAL_MINKOWSKI_METRIC_SPACE_HPP__ 111 | -------------------------------------------------------------------------------- /cpp/include/tbgal/Signed/macro.hpp: -------------------------------------------------------------------------------- 1 | /* Copyright (C) Eduardo Vera Sousa and Leandro Augusto Frata Fernandes 2 | * 3 | * authors : Sousa, Eduardo V. 4 | * Fernandes, Leandro A. F. 5 | * repository : https://github.com/Prograf-UFF/TbGAL 6 | * 7 | * This file is part of the Tensor-based Geometric Algebra Library (TbGAL). 8 | * 9 | * TbGAL is free software: you can redistribute it and/or modify 10 | * it under the terms of the GNU General Public License as published by 11 | * the Free Software Foundation, either version 3 of the License, or 12 | * (at your option) any later version. 13 | * 14 | * TbGAL is distributed in the hope that it will be useful, 15 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 16 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17 | * GNU General Public License for more details. 18 | * 19 | * You should have received a copy of the GNU General Public License 20 | * along with TbGAL. If not, see . 21 | */ 22 | 23 | #ifndef __TBGAL_SIGNED_MACRO_HPP__ 24 | #define __TBGAL_SIGNED_MACRO_HPP__ 25 | 26 | #define TBGAL_OVERLOAD_SIGNED_UTILS(METRIC_SPACE) 27 | 28 | #endif // __TBGAL_SIGNED_MACRO_HPP__ 29 | -------------------------------------------------------------------------------- /cpp/include/tbgal/Signed/metric_space.hpp: -------------------------------------------------------------------------------- 1 | /* Copyright (C) Eduardo Vera Sousa and Leandro Augusto Frata Fernandes 2 | * 3 | * authors : Sousa, Eduardo V. 4 | * Fernandes, Leandro A. F. 5 | * repository : https://github.com/Prograf-UFF/TbGAL 6 | * 7 | * This file is part of the Tensor-based Geometric Algebra Library (TbGAL). 8 | * 9 | * TbGAL is free software: you can redistribute it and/or modify 10 | * it under the terms of the GNU General Public License as published by 11 | * the Free Software Foundation, either version 3 of the License, or 12 | * (at your option) any later version. 13 | * 14 | * TbGAL is distributed in the hope that it will be useful, 15 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 16 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17 | * GNU General Public License for more details. 18 | * 19 | * You should have received a copy of the GNU General Public License 20 | * along with TbGAL. If not, see . 21 | */ 22 | 23 | #ifndef __TBGAL_SIGNED_METRIC_SPACE_HPP__ 24 | #define __TBGAL_SIGNED_METRIC_SPACE_HPP__ 25 | 26 | namespace tbgal { 27 | 28 | template 29 | class SignedMetricSpace : public BaseSignedMetricSpace { 30 | private: 31 | 32 | using Super = BaseSignedMetricSpace; 33 | 34 | public: 35 | 36 | using IndexType = typename Super::IndexType; 37 | using ScalarType = typename Super::ScalarType; 38 | 39 | constexpr static IndexType PDimensionsAtCompileTime = Super::PDimensionsAtCompileTime; 40 | constexpr static IndexType QDimensionsAtCompileTime = Super::QDimensionsAtCompileTime; 41 | 42 | constexpr static IndexType DimensionsAtCompileTime = Super::DimensionsAtCompileTime; 43 | constexpr static IndexType MaxDimensionsAtCompileTime = Super::MaxDimensionsAtCompileTime; 44 | 45 | inline SignedMetricSpace(SignedMetricSpace const &) = default; 46 | inline SignedMetricSpace(SignedMetricSpace &&) = default; 47 | 48 | inline SignedMetricSpace(IndexType p_dimensions, IndexType q_dimensions) : 49 | Super(p_dimensions, q_dimensions), 50 | basis_vectors_str_(), 51 | p_dimensions_(p_dimensions), 52 | q_dimensions_(q_dimensions) { 53 | update_basis_vectors_str(p_dimensions, q_dimensions); 54 | } 55 | 56 | inline SignedMetricSpace() : 57 | SignedMetricSpace((PDimensionsAtCompileTime != Dynamic && QDimensionsAtCompileTime != Dynamic) ? PDimensionsAtCompileTime : 0, (PDimensionsAtCompileTime != Dynamic && QDimensionsAtCompileTime != Dynamic) ? QDimensionsAtCompileTime : 0) { 58 | } 59 | 60 | inline SignedMetricSpace & operator=(SignedMetricSpace const &) = default; 61 | inline SignedMetricSpace & operator=(SignedMetricSpace &&) = default; 62 | 63 | inline IndexType p_dimensions() const { 64 | return p_dimensions_; 65 | } 66 | 67 | inline IndexType q_dimensions() const { 68 | return q_dimensions_; 69 | } 70 | 71 | inline std::string const & basis_vector_str(IndexType index) const override { 72 | return basis_vectors_str_[index]; 73 | } 74 | 75 | inline void set_dimensions(IndexType p_dimensions, IndexType q_dimensions) { 76 | Super::set_dimensions(p_dimensions, q_dimensions); 77 | p_dimensions_ = p_dimensions; 78 | q_dimensions_ = q_dimensions; 79 | update_basis_vectors_str(p_dimensions, q_dimensions); 80 | } 81 | 82 | private: 83 | 84 | inline void update_basis_vectors_str(IndexType p_dimensions, IndexType q_dimensions) { 85 | basis_vectors_str_.resize(p_dimensions + q_dimensions); 86 | for (IndexType ind = 0, ind_end = p_dimensions + q_dimensions; ind != ind_end; ++ind) { 87 | basis_vectors_str_[ind] = "e" + std::to_string(ind + 1); 88 | } 89 | } 90 | 91 | std::vector basis_vectors_str_; 92 | IndexType p_dimensions_; 93 | IndexType q_dimensions_; 94 | }; 95 | 96 | namespace detail { 97 | 98 | template 99 | struct from_actual_to_signed_metric_impl > { 100 | template 101 | constexpr static decltype(auto) eval(SignedMetricSpace const *, MatrixType &&factors_in_actual_metric) { 102 | return std::move(factors_in_actual_metric); 103 | } 104 | }; 105 | 106 | template 107 | struct from_signed_to_actual_metric_impl > { 108 | template 109 | constexpr static decltype(auto) eval(SignedMetricSpace const *space_ptr, MatrixType &&factors_in_signed_metric) { 110 | return std::move(factors_in_signed_metric); 111 | } 112 | }; 113 | 114 | } 115 | 116 | } 117 | 118 | #endif // __TBGAL_SIGNED_METRIC_SPACE_HPP__ 119 | -------------------------------------------------------------------------------- /cpp/include/tbgal/addition.hpp: -------------------------------------------------------------------------------- 1 | /* Copyright (C) Eduardo Vera Sousa and Leandro Augusto Frata Fernandes 2 | * 3 | * authors : Sousa, Eduardo V. 4 | * Fernandes, Leandro A. F. 5 | * repository : https://github.com/Prograf-UFF/TbGAL 6 | * 7 | * This file is part of the Tensor-based Geometric Algebra Library (TbGAL). 8 | * 9 | * TbGAL is free software: you can redistribute it and/or modify 10 | * it under the terms of the GNU General Public License as published by 11 | * the Free Software Foundation, either version 3 of the License, or 12 | * (at your option) any later version. 13 | * 14 | * TbGAL is distributed in the hope that it will be useful, 15 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 16 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17 | * GNU General Public License for more details. 18 | * 19 | * You should have received a copy of the GNU General Public License 20 | * along with TbGAL. If not, see . 21 | */ 22 | 23 | #ifndef __TBGAL_ADDITION_HPP__ 24 | #define __TBGAL_ADDITION_HPP__ 25 | 26 | namespace tbgal { 27 | 28 | //TODO [FUTURE] Implement associativity. 29 | 30 | template 31 | constexpr decltype(auto) addition(FactoredMultivector const &arg1, FactoredMultivector const &arg2) { 32 | using ResultingScalarType = std::common_type_t; 33 | using ResultingFactoringProductType = OuterProduct; 34 | using ResultingFactoredMultivectorType = FactoredMultivector; 35 | static_assert(std::is_same_v, "The multivectors must have the same metric space."); 36 | if (arg1.space_ptr() != arg2.space_ptr()) { 37 | throw NotSupportedError("Operations with multivectors from different models of geometry are not supported yet."); 38 | } 39 | if (arg1.factors_count() == arg2.factors_count()) { 40 | if (arg1.factors_count() == 0) { 41 | return ResultingFactoredMultivectorType(arg1.space_ptr(), arg1.scalar() + arg2.scalar()); 42 | } 43 | //TODO [FUTURE] Handle vectors. 44 | //TODO [FUTURE] Handle pseudovetors. 45 | //TODO [FUTURE] Handle pseudoscalars. 46 | } 47 | throw NotSupportedError("The general case of summation of factored multivectors is not supported."); 48 | } 49 | 50 | template, int> > 51 | constexpr decltype(auto) addition(FactoredMultivector const &arg1, SecondScalarType const &arg2) { 52 | if (arg1.factors_count() == 0) { 53 | return scalar(arg1.space_ptr(), arg1.scalar() + arg2); 54 | } 55 | throw NotSupportedError("The general case of summation of factored multivectors is not supported."); 56 | } 57 | 58 | template, int> > 59 | constexpr decltype(auto) addition(FirstScalarType const &arg1, FactoredMultivector const &arg2) { 60 | if (arg2.factors_count() == 0) { 61 | return scalar(arg2.space_ptr(), arg1 + arg2.scalar()); 62 | } 63 | throw NotSupportedError("The general case of summation of factored multivectors is not supported."); 64 | } 65 | 66 | template || is_multivector_v), int> > 67 | constexpr decltype(auto) addition(FirstScalarType const &arg1, SecondScalarType const &arg2) { 68 | return arg1 + arg2; 69 | } 70 | 71 | template 72 | constexpr decltype(auto) add(FirstType const &arg1, SecondType const &arg2) { 73 | return addition(arg1, arg2); 74 | } 75 | 76 | template 77 | constexpr decltype(auto) operator+(FactoredMultivector const &arg1, FactoredMultivector const &arg2) { 78 | return addition(arg1, arg2); 79 | } 80 | 81 | template, int> > 82 | constexpr decltype(auto) operator+(FactoredMultivector const &arg1, SecondScalarType const &arg2) { 83 | return addition(arg1, arg2); 84 | } 85 | 86 | template, int> > 87 | constexpr decltype(auto) operator+(FirstScalarType const &arg1, FactoredMultivector const &arg2) { 88 | return addition(arg1, arg2); 89 | } 90 | 91 | } 92 | 93 | #endif // __TBGAL_ADDITION_HPP__ 94 | -------------------------------------------------------------------------------- /cpp/include/tbgal/apply_versor.hpp: -------------------------------------------------------------------------------- 1 | /* Copyright (C) Eduardo Vera Sousa and Leandro Augusto Frata Fernandes 2 | * 3 | * authors : Sousa, Eduardo V. 4 | * Fernandes, Leandro A. F. 5 | * repository : https://github.com/Prograf-UFF/TbGAL 6 | * 7 | * This file is part of the Tensor-based Geometric Algebra Library (TbGAL). 8 | * 9 | * TbGAL is free software: you can redistribute it and/or modify 10 | * it under the terms of the GNU General Public License as published by 11 | * the Free Software Foundation, either version 3 of the License, or 12 | * (at your option) any later version. 13 | * 14 | * TbGAL is distributed in the hope that it will be useful, 15 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 16 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17 | * GNU General Public License for more details. 18 | * 19 | * You should have received a copy of the GNU General Public License 20 | * along with TbGAL. If not, see . 21 | */ 22 | 23 | #ifndef __TBGAL_APPLY_VERSOR_HPP__ 24 | #define __TBGAL_APPLY_VERSOR_HPP__ 25 | 26 | namespace tbgal { 27 | 28 | template 29 | constexpr decltype(auto) apply_even_versor(FactoredMultivector const &versor, FactoredMultivector const &arg) { 30 | return gp(versor, arg, inverse(versor)); 31 | } 32 | 33 | template, int> > 34 | constexpr Type apply_even_versor(FactoredMultivector const &, Type const &arg) { 35 | return arg; 36 | } 37 | 38 | template, int> > 39 | constexpr FactoredMultivector apply_even_versor(VersorType const &, FactoredMultivector const &arg) { 40 | return arg; 41 | } 42 | 43 | template || is_multivector_v), int> > 44 | constexpr Type apply_even_versor(VersorType const &, Type const &arg) { 45 | return arg; 46 | } 47 | 48 | template 49 | constexpr decltype(auto) apply_odd_versor(FactoredMultivector const &versor, FactoredMultivector const &arg) { 50 | return gp(versor, involute(arg), inverse(versor)); 51 | } 52 | 53 | template, int> > 54 | constexpr Type apply_odd_versor(FactoredMultivector const &, Type const &arg) { 55 | return arg; 56 | } 57 | 58 | template, int> > 59 | constexpr FactoredMultivector apply_odd_versor(VersorType const &, FactoredMultivector const &arg) { 60 | return arg; 61 | } 62 | 63 | template || is_multivector_v), int> > 64 | constexpr Type apply_odd_versor(VersorType const &, Type const &arg) { 65 | return arg; 66 | } 67 | 68 | template 69 | constexpr decltype(auto) apply_rotor(FactoredMultivector const &rotor, FactoredMultivector const &arg) { 70 | return gp(rotor, arg, reverse(rotor)); 71 | } 72 | 73 | template, int> > 74 | constexpr Type apply_rotor(FactoredMultivector const &, Type const &arg) { 75 | return arg; 76 | } 77 | 78 | template, int> > 79 | constexpr FactoredMultivector apply_rotor(RotorType const &, FactoredMultivector const &arg) { 80 | return arg; 81 | } 82 | 83 | template || is_multivector_v), int> > 84 | constexpr Type apply_rotor(RotorType const &, Type const &arg) { 85 | return arg; 86 | } 87 | 88 | } 89 | 90 | #endif // __TBGAL_APPLY_VERSOR_HPP__ 91 | -------------------------------------------------------------------------------- /cpp/include/tbgal/assuming_Conformal1.hpp: -------------------------------------------------------------------------------- 1 | /* Copyright (C) Eduardo Vera Sousa and Leandro Augusto Frata Fernandes 2 | * 3 | * authors : Sousa, Eduardo V. 4 | * Fernandes, Leandro A. F. 5 | * repository : https://github.com/Prograf-UFF/TbGAL 6 | * 7 | * This file is part of the Tensor-based Geometric Algebra Library (TbGAL). 8 | * 9 | * TbGAL is free software: you can redistribute it and/or modify 10 | * it under the terms of the GNU General Public License as published by 11 | * the Free Software Foundation, either version 3 of the License, or 12 | * (at your option) any later version. 13 | * 14 | * TbGAL is distributed in the hope that it will be useful, 15 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 16 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17 | * GNU General Public License for more details. 18 | * 19 | * You should have received a copy of the GNU General Public License 20 | * along with TbGAL. If not, see . 21 | */ 22 | 23 | #ifndef __TBGAL_ASSUMING_CONFORMAL1_HPP__ 24 | #define __TBGAL_ASSUMING_CONFORMAL1_HPP__ 25 | 26 | #include "core.hpp" 27 | 28 | namespace tbgal { 29 | 30 | namespace Conformal1 { 31 | 32 | using MetricSpaceType = ConformalMetricSpace<1>; 33 | 34 | static MetricSpaceType const SPACE; 35 | 36 | TBGAL_OVERLOAD_UTILS(SPACE) 37 | TBGAL_OVERLOAD_CONFORMAL_UTILS(SPACE) 38 | 39 | static auto const e1 = e(1); 40 | static auto const no = e(2); 41 | static auto const ni = e(3); 42 | 43 | } 44 | 45 | } 46 | 47 | #endif // __TBGAL_ASSUMING_CONFORMAL1_HPP__ 48 | -------------------------------------------------------------------------------- /cpp/include/tbgal/assuming_Conformal2.hpp: -------------------------------------------------------------------------------- 1 | /* Copyright (C) Eduardo Vera Sousa and Leandro Augusto Frata Fernandes 2 | * 3 | * authors : Sousa, Eduardo V. 4 | * Fernandes, Leandro A. F. 5 | * repository : https://github.com/Prograf-UFF/TbGAL 6 | * 7 | * This file is part of the Tensor-based Geometric Algebra Library (TbGAL). 8 | * 9 | * TbGAL is free software: you can redistribute it and/or modify 10 | * it under the terms of the GNU General Public License as published by 11 | * the Free Software Foundation, either version 3 of the License, or 12 | * (at your option) any later version. 13 | * 14 | * TbGAL is distributed in the hope that it will be useful, 15 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 16 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17 | * GNU General Public License for more details. 18 | * 19 | * You should have received a copy of the GNU General Public License 20 | * along with TbGAL. If not, see . 21 | */ 22 | 23 | #ifndef __TBGAL_ASSUMING_CONFORMAL2_HPP__ 24 | #define __TBGAL_ASSUMING_CONFORMAL2_HPP__ 25 | 26 | #include "core.hpp" 27 | 28 | namespace tbgal { 29 | 30 | namespace Conformal2 { 31 | 32 | using MetricSpaceType = ConformalMetricSpace<2>; 33 | 34 | static MetricSpaceType const SPACE; 35 | 36 | TBGAL_OVERLOAD_UTILS(SPACE) 37 | TBGAL_OVERLOAD_CONFORMAL_UTILS(SPACE) 38 | 39 | static auto const e1 = e(1); 40 | static auto const e2 = e(2); 41 | static auto const no = e(3); 42 | static auto const ni = e(4); 43 | 44 | } 45 | 46 | } 47 | 48 | #endif // __TBGAL_ASSUMING_CONFORMAL2_HPP__ 49 | -------------------------------------------------------------------------------- /cpp/include/tbgal/assuming_Conformal3.hpp: -------------------------------------------------------------------------------- 1 | /* Copyright (C) Eduardo Vera Sousa and Leandro Augusto Frata Fernandes 2 | * 3 | * authors : Sousa, Eduardo V. 4 | * Fernandes, Leandro A. F. 5 | * repository : https://github.com/Prograf-UFF/TbGAL 6 | * 7 | * This file is part of the Tensor-based Geometric Algebra Library (TbGAL). 8 | * 9 | * TbGAL is free software: you can redistribute it and/or modify 10 | * it under the terms of the GNU General Public License as published by 11 | * the Free Software Foundation, either version 3 of the License, or 12 | * (at your option) any later version. 13 | * 14 | * TbGAL is distributed in the hope that it will be useful, 15 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 16 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17 | * GNU General Public License for more details. 18 | * 19 | * You should have received a copy of the GNU General Public License 20 | * along with TbGAL. If not, see . 21 | */ 22 | 23 | #ifndef __TBGAL_ASSUMING_CONFORMAL3_HPP__ 24 | #define __TBGAL_ASSUMING_CONFORMAL3_HPP__ 25 | 26 | #include "core.hpp" 27 | 28 | namespace tbgal { 29 | 30 | namespace Conformal3 { 31 | 32 | using MetricSpaceType = ConformalMetricSpace<3>; 33 | 34 | static MetricSpaceType const SPACE; 35 | 36 | TBGAL_OVERLOAD_UTILS(SPACE) 37 | TBGAL_OVERLOAD_CONFORMAL_UTILS(SPACE) 38 | 39 | static auto const e1 = e(1); 40 | static auto const e2 = e(2); 41 | static auto const e3 = e(3); 42 | static auto const no = e(4); 43 | static auto const ni = e(5); 44 | 45 | } 46 | 47 | } 48 | 49 | #endif // __TBGAL_ASSUMING_CONFORMAL3_HPP__ 50 | -------------------------------------------------------------------------------- /cpp/include/tbgal/assuming_ConformalD.hpp: -------------------------------------------------------------------------------- 1 | /* Copyright (C) Eduardo Vera Sousa and Leandro Augusto Frata Fernandes 2 | * 3 | * authors : Sousa, Eduardo V. 4 | * Fernandes, Leandro A. F. 5 | * repository : https://github.com/Prograf-UFF/TbGAL 6 | * 7 | * This file is part of the Tensor-based Geometric Algebra Library (TbGAL). 8 | * 9 | * TbGAL is free software: you can redistribute it and/or modify 10 | * it under the terms of the GNU General Public License as published by 11 | * the Free Software Foundation, either version 3 of the License, or 12 | * (at your option) any later version. 13 | * 14 | * TbGAL is distributed in the hope that it will be useful, 15 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 16 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17 | * GNU General Public License for more details. 18 | * 19 | * You should have received a copy of the GNU General Public License 20 | * along with TbGAL. If not, see . 21 | */ 22 | 23 | #ifndef __TBGAL_ASSUMING_CONFORMALD_HPP__ 24 | #define __TBGAL_ASSUMING_CONFORMALD_HPP__ 25 | 26 | #include "core.hpp" 27 | 28 | #ifndef TBGAL_ConformalD_BaseSpaceDimensions 29 | #define TBGAL_ConformalD_BaseSpaceDimensions Dynamic 30 | #endif // TBGAL_ConformalD_BaseSpaceDimensions 31 | 32 | #ifndef TBGAL_ConformalD_MaxBaseSpaceDimensions 33 | #define TBGAL_ConformalD_MaxBaseSpaceDimensions (TBGAL_ConformalD_BaseSpaceDimensions) 34 | #endif // TBGAL_ConformalD_MaxBaseSpaceDimensions 35 | 36 | namespace tbgal { 37 | 38 | namespace ConformalD { 39 | 40 | using MetricSpaceType = ConformalMetricSpace<(TBGAL_ConformalD_BaseSpaceDimensions), (TBGAL_ConformalD_MaxBaseSpaceDimensions)>; 41 | 42 | static MetricSpaceType SPACE; 43 | 44 | TBGAL_OVERLOAD_UTILS(SPACE) 45 | TBGAL_OVERLOAD_CONFORMAL_UTILS(SPACE) 46 | 47 | inline decltype(auto) no() { 48 | return e(SPACE.dimensions() - 1); 49 | } 50 | 51 | inline decltype(auto) ni() { 52 | return e(SPACE.dimensions()); 53 | } 54 | 55 | } 56 | 57 | } 58 | 59 | #endif // __TBGAL_ASSUMING_CONFORMALD_HPP__ 60 | -------------------------------------------------------------------------------- /cpp/include/tbgal/assuming_Euclidean1.hpp: -------------------------------------------------------------------------------- 1 | /* Copyright (C) Eduardo Vera Sousa and Leandro Augusto Frata Fernandes 2 | * 3 | * authors : Sousa, Eduardo V. 4 | * Fernandes, Leandro A. F. 5 | * repository : https://github.com/Prograf-UFF/TbGAL 6 | * 7 | * This file is part of the Tensor-based Geometric Algebra Library (TbGAL). 8 | * 9 | * TbGAL is free software: you can redistribute it and/or modify 10 | * it under the terms of the GNU General Public License as published by 11 | * the Free Software Foundation, either version 3 of the License, or 12 | * (at your option) any later version. 13 | * 14 | * TbGAL is distributed in the hope that it will be useful, 15 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 16 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17 | * GNU General Public License for more details. 18 | * 19 | * You should have received a copy of the GNU General Public License 20 | * along with TbGAL. If not, see . 21 | */ 22 | 23 | #ifndef __TBGAL_ASSUMING_EUCLIDEAN1_HPP__ 24 | #define __TBGAL_ASSUMING_EUCLIDEAN1_HPP__ 25 | 26 | #include "core.hpp" 27 | 28 | namespace tbgal { 29 | 30 | namespace Euclidean1 { 31 | 32 | using MetricSpaceType = EuclideanMetricSpace<1>; 33 | 34 | static MetricSpaceType const SPACE; 35 | 36 | TBGAL_OVERLOAD_UTILS(SPACE) 37 | TBGAL_OVERLOAD_EUCLIDEAN_UTILS(SPACE) 38 | 39 | static auto const e1 = e(1); 40 | 41 | } 42 | 43 | } 44 | 45 | #endif // __TBGAL_ASSUMING_EUCLIDEAN1_HPP__ 46 | -------------------------------------------------------------------------------- /cpp/include/tbgal/assuming_Euclidean2.hpp: -------------------------------------------------------------------------------- 1 | /* Copyright (C) Eduardo Vera Sousa and Leandro Augusto Frata Fernandes 2 | * 3 | * authors : Sousa, Eduardo V. 4 | * Fernandes, Leandro A. F. 5 | * repository : https://github.com/Prograf-UFF/TbGAL 6 | * 7 | * This file is part of the Tensor-based Geometric Algebra Library (TbGAL). 8 | * 9 | * TbGAL is free software: you can redistribute it and/or modify 10 | * it under the terms of the GNU General Public License as published by 11 | * the Free Software Foundation, either version 3 of the License, or 12 | * (at your option) any later version. 13 | * 14 | * TbGAL is distributed in the hope that it will be useful, 15 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 16 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17 | * GNU General Public License for more details. 18 | * 19 | * You should have received a copy of the GNU General Public License 20 | * along with TbGAL. If not, see . 21 | */ 22 | 23 | #ifndef __TBGAL_ASSUMING_EUCLIDEAN2_HPP__ 24 | #define __TBGAL_ASSUMING_EUCLIDEAN2_HPP__ 25 | 26 | #include "core.hpp" 27 | 28 | namespace tbgal { 29 | 30 | namespace Euclidean2 { 31 | 32 | using MetricSpaceType = EuclideanMetricSpace<2>; 33 | 34 | static MetricSpaceType const SPACE; 35 | 36 | TBGAL_OVERLOAD_UTILS(SPACE) 37 | TBGAL_OVERLOAD_EUCLIDEAN_UTILS(SPACE) 38 | 39 | static auto const e1 = e(1); 40 | static auto const e2 = e(2); 41 | 42 | } 43 | 44 | } 45 | 46 | #endif // __TBGAL_ASSUMING_EUCLIDEAN2_HPP__ 47 | -------------------------------------------------------------------------------- /cpp/include/tbgal/assuming_Euclidean3.hpp: -------------------------------------------------------------------------------- 1 | /* Copyright (C) Eduardo Vera Sousa and Leandro Augusto Frata Fernandes 2 | * 3 | * authors : Sousa, Eduardo V. 4 | * Fernandes, Leandro A. F. 5 | * repository : https://github.com/Prograf-UFF/TbGAL 6 | * 7 | * This file is part of the Tensor-based Geometric Algebra Library (TbGAL). 8 | * 9 | * TbGAL is free software: you can redistribute it and/or modify 10 | * it under the terms of the GNU General Public License as published by 11 | * the Free Software Foundation, either version 3 of the License, or 12 | * (at your option) any later version. 13 | * 14 | * TbGAL is distributed in the hope that it will be useful, 15 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 16 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17 | * GNU General Public License for more details. 18 | * 19 | * You should have received a copy of the GNU General Public License 20 | * along with TbGAL. If not, see . 21 | */ 22 | 23 | #ifndef __TBGAL_ASSUMING_EUCLIDEAN3_HPP__ 24 | #define __TBGAL_ASSUMING_EUCLIDEAN3_HPP__ 25 | 26 | #include "core.hpp" 27 | 28 | namespace tbgal { 29 | 30 | namespace Euclidean3 { 31 | 32 | using MetricSpaceType = EuclideanMetricSpace<3>; 33 | 34 | static MetricSpaceType const SPACE; 35 | 36 | TBGAL_OVERLOAD_UTILS(SPACE) 37 | TBGAL_OVERLOAD_EUCLIDEAN_UTILS(SPACE) 38 | 39 | static auto const e1 = e(1); 40 | static auto const e2 = e(2); 41 | static auto const e3 = e(3); 42 | 43 | } 44 | 45 | } 46 | 47 | #endif // __TBGAL_ASSUMING_EUCLIDEAN3_HPP__ 48 | -------------------------------------------------------------------------------- /cpp/include/tbgal/assuming_EuclideanD.hpp: -------------------------------------------------------------------------------- 1 | /* Copyright (C) Eduardo Vera Sousa and Leandro Augusto Frata Fernandes 2 | * 3 | * authors : Sousa, Eduardo V. 4 | * Fernandes, Leandro A. F. 5 | * repository : https://github.com/Prograf-UFF/TbGAL 6 | * 7 | * This file is part of the Tensor-based Geometric Algebra Library (TbGAL). 8 | * 9 | * TbGAL is free software: you can redistribute it and/or modify 10 | * it under the terms of the GNU General Public License as published by 11 | * the Free Software Foundation, either version 3 of the License, or 12 | * (at your option) any later version. 13 | * 14 | * TbGAL is distributed in the hope that it will be useful, 15 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 16 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17 | * GNU General Public License for more details. 18 | * 19 | * You should have received a copy of the GNU General Public License 20 | * along with TbGAL. If not, see . 21 | */ 22 | 23 | #ifndef __TBGAL_ASSUMING_EUCLIDEAND_HPP__ 24 | #define __TBGAL_ASSUMING_EUCLIDEAND_HPP__ 25 | 26 | #include "core.hpp" 27 | 28 | #ifndef TBGAL_EuclideanD_BaseSpaceDimensions 29 | #define TBGAL_EuclideanD_BaseSpaceDimensions Dynamic 30 | #endif // TBGAL_EuclideanD_BaseSpaceDimensions 31 | 32 | #ifndef TBGAL_EuclideanD_MaxBaseSpaceDimensions 33 | #define TBGAL_EuclideanD_MaxBaseSpaceDimensions (TBGAL_EuclideanD_BaseSpaceDimensions) 34 | #endif // TBGAL_EuclideanD_MaxBaseSpaceDimensions 35 | 36 | namespace tbgal { 37 | 38 | namespace EuclideanD { 39 | 40 | using MetricSpaceType = EuclideanMetricSpace<(TBGAL_EuclideanD_BaseSpaceDimensions), (TBGAL_EuclideanD_MaxBaseSpaceDimensions)>; 41 | 42 | static MetricSpaceType SPACE; 43 | 44 | TBGAL_OVERLOAD_UTILS(SPACE) 45 | TBGAL_OVERLOAD_EUCLIDEAN_UTILS(SPACE) 46 | 47 | } 48 | 49 | } 50 | 51 | #endif // __TBGAL_ASSUMING_EUCLIDEAND_HPP__ 52 | -------------------------------------------------------------------------------- /cpp/include/tbgal/assuming_Homogeneous1.hpp: -------------------------------------------------------------------------------- 1 | /* Copyright (C) Eduardo Vera Sousa and Leandro Augusto Frata Fernandes 2 | * 3 | * authors : Sousa, Eduardo V. 4 | * Fernandes, Leandro A. F. 5 | * repository : https://github.com/Prograf-UFF/TbGAL 6 | * 7 | * This file is part of the Tensor-based Geometric Algebra Library (TbGAL). 8 | * 9 | * TbGAL is free software: you can redistribute it and/or modify 10 | * it under the terms of the GNU General Public License as published by 11 | * the Free Software Foundation, either version 3 of the License, or 12 | * (at your option) any later version. 13 | * 14 | * TbGAL is distributed in the hope that it will be useful, 15 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 16 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17 | * GNU General Public License for more details. 18 | * 19 | * You should have received a copy of the GNU General Public License 20 | * along with TbGAL. If not, see . 21 | */ 22 | 23 | #ifndef __TBGAL_ASSUMING_HOMOGENEOUS1_HPP__ 24 | #define __TBGAL_ASSUMING_HOMOGENEOUS1_HPP__ 25 | 26 | #include "core.hpp" 27 | 28 | namespace tbgal { 29 | 30 | namespace Homogeneous1 { 31 | 32 | using MetricSpaceType = HomogeneousMetricSpace<1>; 33 | 34 | static MetricSpaceType const SPACE; 35 | 36 | TBGAL_OVERLOAD_UTILS(SPACE) 37 | TBGAL_OVERLOAD_HOMOGENEOUS_UTILS(SPACE) 38 | 39 | static auto const e1 = e(1); 40 | static auto const ep = e(2); 41 | 42 | } 43 | 44 | } 45 | 46 | #endif // __TBGAL_ASSUMING_HOMOGENEOUS1_HPP__ 47 | -------------------------------------------------------------------------------- /cpp/include/tbgal/assuming_Homogeneous2.hpp: -------------------------------------------------------------------------------- 1 | /* Copyright (C) Eduardo Vera Sousa and Leandro Augusto Frata Fernandes 2 | * 3 | * authors : Sousa, Eduardo V. 4 | * Fernandes, Leandro A. F. 5 | * repository : https://github.com/Prograf-UFF/TbGAL 6 | * 7 | * This file is part of the Tensor-based Geometric Algebra Library (TbGAL). 8 | * 9 | * TbGAL is free software: you can redistribute it and/or modify 10 | * it under the terms of the GNU General Public License as published by 11 | * the Free Software Foundation, either version 3 of the License, or 12 | * (at your option) any later version. 13 | * 14 | * TbGAL is distributed in the hope that it will be useful, 15 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 16 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17 | * GNU General Public License for more details. 18 | * 19 | * You should have received a copy of the GNU General Public License 20 | * along with TbGAL. If not, see . 21 | */ 22 | 23 | #ifndef __TBGAL_ASSUMING_HOMOGENEOUS2_HPP__ 24 | #define __TBGAL_ASSUMING_HOMOGENEOUS2_HPP__ 25 | 26 | #include "core.hpp" 27 | 28 | namespace tbgal { 29 | 30 | namespace Homogeneous2 { 31 | 32 | using MetricSpaceType = HomogeneousMetricSpace<2>; 33 | 34 | static MetricSpaceType const SPACE; 35 | 36 | TBGAL_OVERLOAD_UTILS(SPACE) 37 | TBGAL_OVERLOAD_HOMOGENEOUS_UTILS(SPACE) 38 | 39 | static auto const e1 = e(1); 40 | static auto const e2 = e(2); 41 | static auto const ep = e(3); 42 | 43 | } 44 | 45 | } 46 | 47 | #endif // __TBGAL_ASSUMING_HOMOGENEOUS2_HPP__ 48 | -------------------------------------------------------------------------------- /cpp/include/tbgal/assuming_Homogeneous3.hpp: -------------------------------------------------------------------------------- 1 | /* Copyright (C) Eduardo Vera Sousa and Leandro Augusto Frata Fernandes 2 | * 3 | * authors : Sousa, Eduardo V. 4 | * Fernandes, Leandro A. F. 5 | * repository : https://github.com/Prograf-UFF/TbGAL 6 | * 7 | * This file is part of the Tensor-based Geometric Algebra Library (TbGAL). 8 | * 9 | * TbGAL is free software: you can redistribute it and/or modify 10 | * it under the terms of the GNU General Public License as published by 11 | * the Free Software Foundation, either version 3 of the License, or 12 | * (at your option) any later version. 13 | * 14 | * TbGAL is distributed in the hope that it will be useful, 15 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 16 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17 | * GNU General Public License for more details. 18 | * 19 | * You should have received a copy of the GNU General Public License 20 | * along with TbGAL. If not, see . 21 | */ 22 | 23 | #ifndef __TBGAL_ASSUMING_HOMOGENEOUS3_HPP__ 24 | #define __TBGAL_ASSUMING_HOMOGENEOUS3_HPP__ 25 | 26 | #include "core.hpp" 27 | 28 | namespace tbgal { 29 | 30 | namespace Homogeneous3 { 31 | 32 | using MetricSpaceType = HomogeneousMetricSpace<3>; 33 | 34 | static MetricSpaceType const SPACE; 35 | 36 | TBGAL_OVERLOAD_UTILS(SPACE) 37 | TBGAL_OVERLOAD_HOMOGENEOUS_UTILS(SPACE) 38 | 39 | static auto const e1 = e(1); 40 | static auto const e2 = e(2); 41 | static auto const e3 = e(3); 42 | static auto const ep = e(4); 43 | 44 | } 45 | 46 | } 47 | 48 | #endif // __TBGAL_ASSUMING_HOMOGENEOUS3_HPP__ 49 | -------------------------------------------------------------------------------- /cpp/include/tbgal/assuming_HomogeneousD.hpp: -------------------------------------------------------------------------------- 1 | /* Copyright (C) Eduardo Vera Sousa and Leandro Augusto Frata Fernandes 2 | * 3 | * authors : Sousa, Eduardo V. 4 | * Fernandes, Leandro A. F. 5 | * repository : https://github.com/Prograf-UFF/TbGAL 6 | * 7 | * This file is part of the Tensor-based Geometric Algebra Library (TbGAL). 8 | * 9 | * TbGAL is free software: you can redistribute it and/or modify 10 | * it under the terms of the GNU General Public License as published by 11 | * the Free Software Foundation, either version 3 of the License, or 12 | * (at your option) any later version. 13 | * 14 | * TbGAL is distributed in the hope that it will be useful, 15 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 16 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17 | * GNU General Public License for more details. 18 | * 19 | * You should have received a copy of the GNU General Public License 20 | * along with TbGAL. If not, see . 21 | */ 22 | 23 | #ifndef __TBGAL_ASSUMING_HOMOGENEOUSD_HPP__ 24 | #define __TBGAL_ASSUMING_HOMOGENEOUSD_HPP__ 25 | 26 | #include "core.hpp" 27 | 28 | #ifndef TBGAL_HomogeneousD_BaseSpaceDimensions 29 | #define TBGAL_HomogeneousD_BaseSpaceDimensions Dynamic 30 | #endif // TBGAL_HomogeneousD_BaseSpaceDimensions 31 | 32 | #ifndef TBGAL_HomogeneousD_MaxBaseSpaceDimensions 33 | #define TBGAL_HomogeneousD_MaxBaseSpaceDimensions (TBGAL_HomogeneousD_BaseSpaceDimensions) 34 | #endif // TBGAL_HomogeneousD_MaxBaseSpaceDimensions 35 | 36 | namespace tbgal { 37 | 38 | namespace HomogeneousD { 39 | 40 | using MetricSpaceType = HomogeneousMetricSpace<(TBGAL_HomogeneousD_BaseSpaceDimensions), (TBGAL_HomogeneousD_MaxBaseSpaceDimensions)>; 41 | 42 | static MetricSpaceType SPACE; 43 | 44 | TBGAL_OVERLOAD_UTILS(SPACE) 45 | TBGAL_OVERLOAD_HOMOGENEOUS_UTILS(SPACE) 46 | 47 | inline decltype(auto) ep() { 48 | return e(SPACE.dimensions()); 49 | } 50 | 51 | } 52 | 53 | } 54 | 55 | #endif // __TBGAL_ASSUMING_HOMOGENEOUSD_HPP__ 56 | -------------------------------------------------------------------------------- /cpp/include/tbgal/assuming_Minkowski1.hpp: -------------------------------------------------------------------------------- 1 | /* Copyright (C) Eduardo Vera Sousa and Leandro Augusto Frata Fernandes 2 | * 3 | * authors : Sousa, Eduardo V. 4 | * Fernandes, Leandro A. F. 5 | * repository : https://github.com/Prograf-UFF/TbGAL 6 | * 7 | * This file is part of the Tensor-based Geometric Algebra Library (TbGAL). 8 | * 9 | * TbGAL is free software: you can redistribute it and/or modify 10 | * it under the terms of the GNU General Public License as published by 11 | * the Free Software Foundation, either version 3 of the License, or 12 | * (at your option) any later version. 13 | * 14 | * TbGAL is distributed in the hope that it will be useful, 15 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 16 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17 | * GNU General Public License for more details. 18 | * 19 | * You should have received a copy of the GNU General Public License 20 | * along with TbGAL. If not, see . 21 | */ 22 | 23 | #ifndef __TBGAL_ASSUMING_MINKOWSKI1_HPP__ 24 | #define __TBGAL_ASSUMING_MINKOWSKI1_HPP__ 25 | 26 | #include "core.hpp" 27 | 28 | namespace tbgal { 29 | 30 | namespace Minkowski1 { 31 | 32 | using MetricSpaceType = MinkowskiMetricSpace<1>; 33 | 34 | static MetricSpaceType const SPACE; 35 | 36 | TBGAL_OVERLOAD_UTILS(SPACE) 37 | TBGAL_OVERLOAD_MINKOWSKI_UTILS(SPACE) 38 | 39 | static auto const e1 = e(1); 40 | static auto const ep = e(2); 41 | static auto const em = e(3); 42 | 43 | } 44 | 45 | } 46 | 47 | #endif // __TBGAL_ASSUMING_MINKOWSKI1_HPP__ 48 | -------------------------------------------------------------------------------- /cpp/include/tbgal/assuming_Minkowski2.hpp: -------------------------------------------------------------------------------- 1 | /* Copyright (C) Eduardo Vera Sousa and Leandro Augusto Frata Fernandes 2 | * 3 | * authors : Sousa, Eduardo V. 4 | * Fernandes, Leandro A. F. 5 | * repository : https://github.com/Prograf-UFF/TbGAL 6 | * 7 | * This file is part of the Tensor-based Geometric Algebra Library (TbGAL). 8 | * 9 | * TbGAL is free software: you can redistribute it and/or modify 10 | * it under the terms of the GNU General Public License as published by 11 | * the Free Software Foundation, either version 3 of the License, or 12 | * (at your option) any later version. 13 | * 14 | * TbGAL is distributed in the hope that it will be useful, 15 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 16 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17 | * GNU General Public License for more details. 18 | * 19 | * You should have received a copy of the GNU General Public License 20 | * along with TbGAL. If not, see . 21 | */ 22 | 23 | #ifndef __TBGAL_ASSUMING_MINKOWSKI2_HPP__ 24 | #define __TBGAL_ASSUMING_MINKOWSKI2_HPP__ 25 | 26 | #include "core.hpp" 27 | 28 | namespace tbgal { 29 | 30 | namespace Minkowski2 { 31 | 32 | using MetricSpaceType = MinkowskiMetricSpace<2>; 33 | 34 | static MetricSpaceType const SPACE; 35 | 36 | TBGAL_OVERLOAD_UTILS(SPACE) 37 | TBGAL_OVERLOAD_MINKOWSKI_UTILS(SPACE) 38 | 39 | static auto const e1 = e(1); 40 | static auto const e2 = e(2); 41 | static auto const ep = e(3); 42 | static auto const em = e(4); 43 | 44 | } 45 | 46 | } 47 | 48 | #endif // __TBGAL_ASSUMING_MINKOWSKI2_HPP__ 49 | -------------------------------------------------------------------------------- /cpp/include/tbgal/assuming_Minkowski3.hpp: -------------------------------------------------------------------------------- 1 | /* Copyright (C) Eduardo Vera Sousa and Leandro Augusto Frata Fernandes 2 | * 3 | * authors : Sousa, Eduardo V. 4 | * Fernandes, Leandro A. F. 5 | * repository : https://github.com/Prograf-UFF/TbGAL 6 | * 7 | * This file is part of the Tensor-based Geometric Algebra Library (TbGAL). 8 | * 9 | * TbGAL is free software: you can redistribute it and/or modify 10 | * it under the terms of the GNU General Public License as published by 11 | * the Free Software Foundation, either version 3 of the License, or 12 | * (at your option) any later version. 13 | * 14 | * TbGAL is distributed in the hope that it will be useful, 15 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 16 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17 | * GNU General Public License for more details. 18 | * 19 | * You should have received a copy of the GNU General Public License 20 | * along with TbGAL. If not, see . 21 | */ 22 | 23 | #ifndef __TBGAL_ASSUMING_MINKOWSKI3_HPP__ 24 | #define __TBGAL_ASSUMING_MINKOWSKI3_HPP__ 25 | 26 | #include "core.hpp" 27 | 28 | namespace tbgal { 29 | 30 | namespace Minkowski3 { 31 | 32 | using MetricSpaceType = MinkowskiMetricSpace<3>; 33 | 34 | static MetricSpaceType const SPACE; 35 | 36 | TBGAL_OVERLOAD_UTILS(SPACE) 37 | TBGAL_OVERLOAD_MINKOWSKI_UTILS(SPACE) 38 | 39 | static auto const e1 = e(1); 40 | static auto const e2 = e(2); 41 | static auto const e3 = e(3); 42 | static auto const ep = e(4); 43 | static auto const em = e(5); 44 | 45 | } 46 | 47 | } 48 | 49 | #endif // __TBGAL_ASSUMING_MINKOWSKI3_HPP__ 50 | -------------------------------------------------------------------------------- /cpp/include/tbgal/assuming_MinkowskiD.hpp: -------------------------------------------------------------------------------- 1 | /* Copyright (C) Eduardo Vera Sousa and Leandro Augusto Frata Fernandes 2 | * 3 | * authors : Sousa, Eduardo V. 4 | * Fernandes, Leandro A. F. 5 | * repository : https://github.com/Prograf-UFF/TbGAL 6 | * 7 | * This file is part of the Tensor-based Geometric Algebra Library (TbGAL). 8 | * 9 | * TbGAL is free software: you can redistribute it and/or modify 10 | * it under the terms of the GNU General Public License as published by 11 | * the Free Software Foundation, either version 3 of the License, or 12 | * (at your option) any later version. 13 | * 14 | * TbGAL is distributed in the hope that it will be useful, 15 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 16 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17 | * GNU General Public License for more details. 18 | * 19 | * You should have received a copy of the GNU General Public License 20 | * along with TbGAL. If not, see . 21 | */ 22 | 23 | #ifndef __TBGAL_ASSUMING_MINKOWSKID_HPP__ 24 | #define __TBGAL_ASSUMING_MINKOWSKID_HPP__ 25 | 26 | #include "core.hpp" 27 | 28 | #ifndef TBGAL_MinkowskiD_BaseSpaceDimensions 29 | #define TBGAL_MinkowskiD_BaseSpaceDimensions Dynamic 30 | #endif // TBGAL_MinkowskiD_BaseSpaceDimensions 31 | 32 | #ifndef TBGAL_MinkowskiD_MaxBaseSpaceDimensions 33 | #define TBGAL_MinkowskiD_MaxBaseSpaceDimensions (TBGAL_MinkowskiD_BaseSpaceDimensions) 34 | #endif // TBGAL_MinkowskiD_MaxBaseSpaceDimensions 35 | 36 | namespace tbgal { 37 | 38 | namespace MinkowskiD { 39 | 40 | using MetricSpaceType = MinkowskiMetricSpace<(TBGAL_MinkowskiD_BaseSpaceDimensions), (TBGAL_MinkowskiD_MaxBaseSpaceDimensions)>; 41 | 42 | static MetricSpaceType SPACE; 43 | 44 | TBGAL_OVERLOAD_UTILS(SPACE) 45 | TBGAL_OVERLOAD_MINKOWSKI_UTILS(SPACE) 46 | 47 | inline decltype(auto) ep() { 48 | return e(SPACE.dimensions() - 1); 49 | } 50 | 51 | inline decltype(auto) em() { 52 | return e(SPACE.dimensions()); 53 | } 54 | 55 | } 56 | 57 | } 58 | 59 | #endif // __TBGAL_ASSUMING_MINKOWSKID_HPP__ 60 | -------------------------------------------------------------------------------- /cpp/include/tbgal/assuming_SignedPQ.hpp: -------------------------------------------------------------------------------- 1 | /* Copyright (C) Eduardo Vera Sousa and Leandro Augusto Frata Fernandes 2 | * 3 | * authors : Sousa, Eduardo V. 4 | * Fernandes, Leandro A. F. 5 | * repository : https://github.com/Prograf-UFF/TbGAL 6 | * 7 | * This file is part of the Tensor-based Geometric Algebra Library (TbGAL). 8 | * 9 | * TbGAL is free software: you can redistribute it and/or modify 10 | * it under the terms of the GNU General Public License as published by 11 | * the Free Software Foundation, either version 3 of the License, or 12 | * (at your option) any later version. 13 | * 14 | * TbGAL is distributed in the hope that it will be useful, 15 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 16 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17 | * GNU General Public License for more details. 18 | * 19 | * You should have received a copy of the GNU General Public License 20 | * along with TbGAL. If not, see . 21 | */ 22 | 23 | #ifndef __TBGAL_ASSUMING_SIGNEDPQ_HPP__ 24 | #define __TBGAL_ASSUMING_SIGNEDPQ_HPP__ 25 | 26 | #include "core.hpp" 27 | 28 | #ifndef TBGAL_SignedPQ_PDimensions 29 | #define TBGAL_SignedPQ_PDimensions Dynamic 30 | #endif // TBGAL_SignedPQ_PDimensions 31 | 32 | #ifndef TBGAL_SignedPQ_QDimensions 33 | #define TBGAL_SignedPQ_QDimensions Dynamic 34 | #endif // TBGAL_SignedPQ_QDimensions 35 | 36 | #ifndef TBGAL_SignedPQ_MaxDimensions 37 | #define TBGAL_SignedPQ_MaxDimensions ((TBGAL_SignedPQ_PDimensions) != Dynamic && (TBGAL_SignedPQ_QDimensions) != Dynamic ? (TBGAL_SignedPQ_PDimensions) + (TBGAL_SignedPQ_QDimensions) : Dynamic) 38 | #endif // TBGAL_SignedPQ_MaxDimensions 39 | 40 | namespace tbgal { 41 | 42 | namespace SignedPQ { 43 | 44 | using MetricSpaceType = SignedMetricSpace<(TBGAL_SignedPQ_PDimensions), (TBGAL_SignedPQ_QDimensions), (TBGAL_SignedPQ_MaxDimensions)>; 45 | 46 | static MetricSpaceType SPACE; 47 | 48 | TBGAL_OVERLOAD_UTILS(SPACE) 49 | TBGAL_OVERLOAD_SIGNED_UTILS(SPACE) 50 | 51 | } 52 | 53 | } 54 | 55 | #endif // __TBGAL_ASSUMING_SIGNEDPQ_HPP__ 56 | -------------------------------------------------------------------------------- /cpp/include/tbgal/conjugation.hpp: -------------------------------------------------------------------------------- 1 | /* Copyright (C) Eduardo Vera Sousa and Leandro Augusto Frata Fernandes 2 | * 3 | * authors : Sousa, Eduardo V. 4 | * Fernandes, Leandro A. F. 5 | * repository : https://github.com/Prograf-UFF/TbGAL 6 | * 7 | * This file is part of the Tensor-based Geometric Algebra Library (TbGAL). 8 | * 9 | * TbGAL is free software: you can redistribute it and/or modify 10 | * it under the terms of the GNU General Public License as published by 11 | * the Free Software Foundation, either version 3 of the License, or 12 | * (at your option) any later version. 13 | * 14 | * TbGAL is distributed in the hope that it will be useful, 15 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 16 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17 | * GNU General Public License for more details. 18 | * 19 | * You should have received a copy of the GNU General Public License 20 | * along with TbGAL. If not, see . 21 | */ 22 | 23 | #ifndef __TBGAL_CONJUGATION_HPP__ 24 | #define __TBGAL_CONJUGATION_HPP__ 25 | 26 | namespace tbgal { 27 | 28 | template 29 | constexpr decltype(auto) conjugate(FactoredMultivector > const &arg) { 30 | using ResultingScalarType = ScalarType; 31 | using ResultingFactoringProductType = GeometricProduct; 32 | using ResultingFactoredMultivectorType = FactoredMultivector; 33 | return ResultingFactoredMultivectorType(arg.space_ptr(), (arg.factors_count() & 1) ? -arg.scalar() : arg.scalar(), detail::reverse_columns(arg.factors_in_signed_metric())); 34 | } 35 | 36 | template 37 | constexpr decltype(auto) conjugate(FactoredMultivector > const &arg) { 38 | using ResultingScalarType = ScalarType; 39 | using ResultingFactoringProductType = OuterProduct; 40 | using ResultingFactoredMultivectorType = FactoredMultivector; 41 | return ResultingFactoredMultivectorType(arg.space_ptr(), ((arg.factors_count() * (arg.factors_count() + 1)) & 2) ? -arg.scalar() : arg.scalar(), arg.factors_and_complement_in_signed_metric(), arg.factors_count()); 42 | } 43 | 44 | template, int> > 45 | constexpr Type conjugate(Type const &arg) { 46 | return arg; 47 | } 48 | 49 | } 50 | 51 | #endif // __TBGAL_CONJUGATION_HPP__ 52 | -------------------------------------------------------------------------------- /cpp/include/tbgal/dot_product.hpp: -------------------------------------------------------------------------------- 1 | /* Copyright (C) Eduardo Vera Sousa and Leandro Augusto Frata Fernandes 2 | * 3 | * authors : Sousa, Eduardo V. 4 | * Fernandes, Leandro A. F. 5 | * repository : https://github.com/Prograf-UFF/TbGAL 6 | * 7 | * This file is part of the Tensor-based Geometric Algebra Library (TbGAL). 8 | * 9 | * TbGAL is free software: you can redistribute it and/or modify 10 | * it under the terms of the GNU General Public License as published by 11 | * the Free Software Foundation, either version 3 of the License, or 12 | * (at your option) any later version. 13 | * 14 | * TbGAL is distributed in the hope that it will be useful, 15 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 16 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17 | * GNU General Public License for more details. 18 | * 19 | * You should have received a copy of the GNU General Public License 20 | * along with TbGAL. If not, see . 21 | */ 22 | 23 | #ifndef __TBGAL_DOT_PRODUCT_HPP__ 24 | #define __TBGAL_DOT_PRODUCT_HPP__ 25 | 26 | namespace tbgal { 27 | 28 | template 29 | constexpr decltype(auto) dot(FactoredMultivector const &arg1, FactoredMultivector const &arg2) { 30 | if (arg1.factors_count() <= arg2.factors_count()) { 31 | return lcont(arg1, arg2); 32 | } 33 | return rcont(arg1, arg2); 34 | } 35 | 36 | template, int> > 37 | constexpr decltype(auto) dot(FactoredMultivector const &arg1, SecondScalarType const &arg2) { 38 | return rcont(arg1, arg2); 39 | } 40 | 41 | template, int> > 42 | constexpr decltype(auto) dot(FirstScalarType const &arg1, FactoredMultivector const &arg2) { 43 | return lcont(arg1, arg2); 44 | } 45 | 46 | template || is_multivector_v), int> > 47 | constexpr decltype(auto) dot(FirstScalarType const &arg1, SecondScalarType const &arg2) { 48 | return arg1 * arg2; 49 | } 50 | 51 | } 52 | 53 | #endif // __TBGAL_DOT_PRODUCT_HPP__ 54 | -------------------------------------------------------------------------------- /cpp/include/tbgal/dualization.hpp: -------------------------------------------------------------------------------- 1 | /* Copyright (C) Eduardo Vera Sousa and Leandro Augusto Frata Fernandes 2 | * 3 | * authors : Sousa, Eduardo V. 4 | * Fernandes, Leandro A. F. 5 | * repository : https://github.com/Prograf-UFF/TbGAL 6 | * 7 | * This file is part of the Tensor-based Geometric Algebra Library (TbGAL). 8 | * 9 | * TbGAL is free software: you can redistribute it and/or modify 10 | * it under the terms of the GNU General Public License as published by 11 | * the Free Software Foundation, either version 3 of the License, or 12 | * (at your option) any later version. 13 | * 14 | * TbGAL is distributed in the hope that it will be useful, 15 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 16 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17 | * GNU General Public License for more details. 18 | * 19 | * You should have received a copy of the GNU General Public License 20 | * along with TbGAL. If not, see . 21 | */ 22 | 23 | #ifndef __TBGAL_DUALIZATION_HPP__ 24 | #define __TBGAL_DUALIZATION_HPP__ 25 | 26 | namespace tbgal { 27 | 28 | template 29 | constexpr decltype(auto) dual(FactoredMultivector > const &arg) { 30 | //TODO [FUTURE] Implement dualization for the general case (when the input multivector is not a blade). 31 | throw NotSupportedError("The dual of multivectors factored by the geometric product is not supported yet."); 32 | return FactoredMultivector >(); 33 | } 34 | 35 | template 36 | constexpr decltype(auto) dual(FactoredMultivector > const &arg) { 37 | using ResultingScalarType = ScalarType; 38 | using ResultingFactoringProductType = OuterProduct; 39 | using ResultingFactoredMultivectorType = FactoredMultivector; 40 | return ResultingFactoredMultivectorType( 41 | arg.space_ptr(), 42 | (((arg.factors_count() * (arg.factors_count() - 1) + arg.space().dimensions() * (arg.space().dimensions() - 1)) & 2) ? -arg.scalar() : arg.scalar()) * detail::determinant(arg.factors_and_complement_in_signed_metric()), 43 | detail::apply_signed_metric(arg.space_ptr(), detail::split_columns_and_swap(arg.factors_and_complement_in_signed_metric(), arg.factors_count())), 44 | arg.space().dimensions() - arg.factors_count() 45 | ); 46 | } 47 | 48 | template 49 | constexpr decltype(auto) undual(FactoredMultivector > const &arg) { 50 | //TODO [FUTURE] Implement undualization for the general case (when the input multivector is not a blade). 51 | throw NotSupportedError("The undual of multivectors factored by the geometric product is not supported yet."); 52 | return FactoredMultivector >(); 53 | } 54 | 55 | template 56 | constexpr decltype(auto) undual(FactoredMultivector > const &arg) { 57 | using ResultingScalarType = ScalarType; 58 | using ResultingFactoringProductType = OuterProduct; 59 | using ResultingFactoredMultivectorType = FactoredMultivector; 60 | auto factors_and_complement_in_signed_metric = detail::evaluate(detail::apply_signed_metric(arg.space_ptr(), arg.factors_and_complement_in_signed_metric())); 61 | return ResultingFactoredMultivectorType( 62 | arg.space_ptr(), 63 | (((arg.factors_count() * (arg.factors_count() - 1)) & 2) ? -arg.scalar() : arg.scalar()) * detail::determinant(factors_and_complement_in_signed_metric), 64 | detail::split_columns_and_swap(factors_and_complement_in_signed_metric, arg.factors_count()), 65 | arg.space().dimensions() - arg.factors_count() 66 | ); 67 | } 68 | 69 | } 70 | 71 | #endif // __TBGAL_DUALIZATION_HPP__ 72 | -------------------------------------------------------------------------------- /cpp/include/tbgal/exception.hpp: -------------------------------------------------------------------------------- 1 | /* Copyright (C) Eduardo Vera Sousa and Leandro Augusto Frata Fernandes 2 | * 3 | * authors : Sousa, Eduardo V. 4 | * Fernandes, Leandro A. F. 5 | * repository : https://github.com/Prograf-UFF/TbGAL 6 | * 7 | * This file is part of the Tensor-based Geometric Algebra Library (TbGAL). 8 | * 9 | * TbGAL is free software: you can redistribute it and/or modify 10 | * it under the terms of the GNU General Public License as published by 11 | * the Free Software Foundation, either version 3 of the License, or 12 | * (at your option) any later version. 13 | * 14 | * TbGAL is distributed in the hope that it will be useful, 15 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 16 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17 | * GNU General Public License for more details. 18 | * 19 | * You should have received a copy of the GNU General Public License 20 | * along with TbGAL. If not, see . 21 | */ 22 | 23 | #ifndef __TBGAL_EXCEPTION_HPP__ 24 | #define __TBGAL_EXCEPTION_HPP__ 25 | 26 | namespace tbgal { 27 | 28 | class NotSupportedError : public std::logic_error { 29 | public: 30 | 31 | explicit NotSupportedError(std::string const &what) : 32 | std::logic_error(what) { 33 | } 34 | 35 | explicit NotSupportedError(char const *what) : 36 | std::logic_error(what) { 37 | } 38 | }; 39 | 40 | } 41 | 42 | #endif // __TBGAL_EXCEPTION_HPP__ 43 | -------------------------------------------------------------------------------- /cpp/include/tbgal/factoring_product.hpp: -------------------------------------------------------------------------------- 1 | /* Copyright (C) Eduardo Vera Sousa and Leandro Augusto Frata Fernandes 2 | * 3 | * authors : Sousa, Eduardo V. 4 | * Fernandes, Leandro A. F. 5 | * repository : https://github.com/Prograf-UFF/TbGAL 6 | * 7 | * This file is part of the Tensor-based Geometric Algebra Library (TbGAL). 8 | * 9 | * TbGAL is free software: you can redistribute it and/or modify 10 | * it under the terms of the GNU General Public License as published by 11 | * the Free Software Foundation, either version 3 of the License, or 12 | * (at your option) any later version. 13 | * 14 | * TbGAL is distributed in the hope that it will be useful, 15 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 16 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17 | * GNU General Public License for more details. 18 | * 19 | * You should have received a copy of the GNU General Public License 20 | * along with TbGAL. If not, see . 21 | */ 22 | 23 | #ifndef __TBGAL_FACTORING_PRODUCT_HPP__ 24 | #define __TBGAL_FACTORING_PRODUCT_HPP__ 25 | 26 | namespace tbgal { 27 | 28 | template 29 | struct GeometricProduct final { 30 | public: 31 | 32 | using MetricSpaceType = MetricSpaceType_; 33 | 34 | private: 35 | 36 | constexpr GeometricProduct() { 37 | // Nothing to do. It just avoid the instantiation of GeometricProduct. 38 | } 39 | }; 40 | 41 | template 42 | struct OuterProduct final { 43 | public: 44 | 45 | using MetricSpaceType = MetricSpaceType_; 46 | 47 | private: 48 | 49 | constexpr OuterProduct() { 50 | // Nothing to do. It just avoid the instantiation of OuterProduct. 51 | } 52 | }; 53 | 54 | } 55 | 56 | #endif // __TBGAL_FACTORING_PRODUCT_HPP__ 57 | -------------------------------------------------------------------------------- /cpp/include/tbgal/hestenes_inner_product.hpp: -------------------------------------------------------------------------------- 1 | /* Copyright (C) Eduardo Vera Sousa and Leandro Augusto Frata Fernandes 2 | * 3 | * authors : Sousa, Eduardo V. 4 | * Fernandes, Leandro A. F. 5 | * repository : https://github.com/Prograf-UFF/TbGAL 6 | * 7 | * This file is part of the Tensor-based Geometric Algebra Library (TbGAL). 8 | * 9 | * TbGAL is free software: you can redistribute it and/or modify 10 | * it under the terms of the GNU General Public License as published by 11 | * the Free Software Foundation, either version 3 of the License, or 12 | * (at your option) any later version. 13 | * 14 | * TbGAL is distributed in the hope that it will be useful, 15 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 16 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17 | * GNU General Public License for more details. 18 | * 19 | * You should have received a copy of the GNU General Public License 20 | * along with TbGAL. If not, see . 21 | */ 22 | 23 | #ifndef __TBGAL_HESTENES_INNER_PRODUCT_HPP__ 24 | #define __TBGAL_HESTENES_INNER_PRODUCT_HPP__ 25 | 26 | namespace tbgal { 27 | 28 | template 29 | constexpr decltype(auto) hip(FactoredMultivector const &arg1, FactoredMultivector const &arg2) { 30 | using ResultingFactoredMultivectorType = decltype(lcont(arg1, arg2)); 31 | if (arg1.factors_count() != 0 && arg2.factors_count() != 0) { 32 | if (arg1.factors_count() <= arg2.factors_count()) { 33 | return lcont(arg1, arg2); 34 | } 35 | return rcont(arg1, arg2); 36 | } 37 | return ResultingFactoredMultivectorType(detail::space_ptr(arg1, arg2), 0); 38 | } 39 | 40 | template, int> > 41 | constexpr decltype(auto) hip(FactoredMultivector const &, SecondScalarType const &) { 42 | return std::common_type_t(0); 43 | } 44 | 45 | template, int> > 46 | constexpr decltype(auto) hip(FirstScalarType const &, FactoredMultivector const &) { 47 | return std::common_type_t(0); 48 | } 49 | 50 | template || is_multivector_v), int> > 51 | constexpr decltype(auto) hip(FirstScalarType const &, SecondScalarType const &) { 52 | return std::common_type_t(0); 53 | } 54 | 55 | } 56 | 57 | #endif // __TBGAL_HESTENES_INNER_PRODUCT_HPP__ 58 | -------------------------------------------------------------------------------- /cpp/include/tbgal/inverse_geometric_product.hpp: -------------------------------------------------------------------------------- 1 | /* Copyright (C) Eduardo Vera Sousa and Leandro Augusto Frata Fernandes 2 | * 3 | * authors : Sousa, Eduardo V. 4 | * Fernandes, Leandro A. F. 5 | * repository : https://github.com/Prograf-UFF/TbGAL 6 | * 7 | * This file is part of the Tensor-based Geometric Algebra Library (TbGAL). 8 | * 9 | * TbGAL is free software: you can redistribute it and/or modify 10 | * it under the terms of the GNU General Public License as published by 11 | * the Free Software Foundation, either version 3 of the License, or 12 | * (at your option) any later version. 13 | * 14 | * TbGAL is distributed in the hope that it will be useful, 15 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 16 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17 | * GNU General Public License for more details. 18 | * 19 | * You should have received a copy of the GNU General Public License 20 | * along with TbGAL. If not, see . 21 | */ 22 | 23 | #ifndef __TBGAL_INVERSE_GEOMETRIC_PRODUCT_HPP__ 24 | #define __TBGAL_INVERSE_GEOMETRIC_PRODUCT_HPP__ 25 | 26 | namespace tbgal { 27 | 28 | template 29 | constexpr decltype(auto) igp(FirstType const &arg1, SecondType const &arg2) { 30 | return gp(arg1, inverse(arg2)); 31 | } 32 | 33 | template 34 | constexpr decltype(auto) operator/(FactoredMultivector const &arg1, FactoredMultivector const &arg2) { 35 | return igp(arg1, arg2); 36 | } 37 | 38 | template, int> > 39 | constexpr decltype(auto) operator/(FactoredMultivector const &arg1, SecondScalarType const &arg2) { 40 | return igp(arg1, arg2); 41 | } 42 | 43 | template, int> > 44 | constexpr decltype(auto) operator/(FirstScalarType const &arg1, FactoredMultivector const &arg2) { 45 | return igp(arg1, arg2); 46 | } 47 | 48 | } 49 | 50 | #endif // __TBGAL_INVERSE_GEOMETRIC_PRODUCT_HPP__ 51 | -------------------------------------------------------------------------------- /cpp/include/tbgal/inversion.hpp: -------------------------------------------------------------------------------- 1 | /* Copyright (C) Eduardo Vera Sousa and Leandro Augusto Frata Fernandes 2 | * 3 | * authors : Sousa, Eduardo V. 4 | * Fernandes, Leandro A. F. 5 | * repository : https://github.com/Prograf-UFF/TbGAL 6 | * 7 | * This file is part of the Tensor-based Geometric Algebra Library (TbGAL). 8 | * 9 | * TbGAL is free software: you can redistribute it and/or modify 10 | * it under the terms of the GNU General Public License as published by 11 | * the Free Software Foundation, either version 3 of the License, or 12 | * (at your option) any later version. 13 | * 14 | * TbGAL is distributed in the hope that it will be useful, 15 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 16 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17 | * GNU General Public License for more details. 18 | * 19 | * You should have received a copy of the GNU General Public License 20 | * along with TbGAL. If not, see . 21 | */ 22 | 23 | #ifndef __TBGAL_INVERSION_HPP__ 24 | #define __TBGAL_INVERSION_HPP__ 25 | 26 | namespace tbgal { 27 | 28 | template 29 | constexpr decltype(auto) inverse(FactoredMultivector > const &arg) { 30 | using ResultingScalarType = std::common_type_t; 31 | using ResultingFactoringProductType = GeometricProduct; 32 | using ResultingFactoredMultivectorType = FactoredMultivector; 33 | if (arg.factors_count() > 0) { 34 | return ResultingFactoredMultivectorType(arg.space_ptr(), 1 / (arg.scalar() * detail::metric_factor(arg.space_ptr(), arg.factors_in_signed_metric())), detail::reverse_columns(arg.factors_in_signed_metric())); 35 | } 36 | else { 37 | return ResultingFactoredMultivectorType(arg.space_ptr(), 1 / arg.scalar(), arg.factors_in_signed_metric()); 38 | } 39 | } 40 | 41 | template 42 | constexpr decltype(auto) inverse(FactoredMultivector > const &arg) { 43 | using ResultingScalarType = std::common_type_t; 44 | using ResultingFactoringProductType = OuterProduct; 45 | using ResultingFactoredMultivectorType = FactoredMultivector; 46 | if (arg.factors_count() > 0) { 47 | auto factors_tuple = detail::from_outer_to_geometric_factors(arg.space_ptr(), arg.factors_in_signed_metric()); 48 | return ResultingFactoredMultivectorType(arg.space_ptr(), (((arg.factors_count() * (arg.factors_count() - 1)) & 2) ? -1 : 1) / (arg.scalar() * std::get<0>(factors_tuple) * std::get<0>(factors_tuple) * detail::metric_factor(arg.space_ptr(), std::get<1>(factors_tuple))), arg.factors_and_complement_in_signed_metric(), arg.factors_count()); 49 | } 50 | else { 51 | return ResultingFactoredMultivectorType(arg.space_ptr(), 1 / arg.scalar(), arg.factors_and_complement_in_signed_metric(), 0); 52 | } 53 | } 54 | 55 | template, int> > 56 | constexpr Type inverse(Type const &arg) { 57 | return Type(1) / arg; 58 | } 59 | 60 | template 61 | constexpr Type inv(Type const &arg) { 62 | return inverse(arg); 63 | } 64 | 65 | } 66 | 67 | #endif // __TBGAL_INVERSION_HPP__ 68 | -------------------------------------------------------------------------------- /cpp/include/tbgal/involution.hpp: -------------------------------------------------------------------------------- 1 | /* Copyright (C) Eduardo Vera Sousa and Leandro Augusto Frata Fernandes 2 | * 3 | * authors : Sousa, Eduardo V. 4 | * Fernandes, Leandro A. F. 5 | * repository : https://github.com/Prograf-UFF/TbGAL 6 | * 7 | * This file is part of the Tensor-based Geometric Algebra Library (TbGAL). 8 | * 9 | * TbGAL is free software: you can redistribute it and/or modify 10 | * it under the terms of the GNU General Public License as published by 11 | * the Free Software Foundation, either version 3 of the License, or 12 | * (at your option) any later version. 13 | * 14 | * TbGAL is distributed in the hope that it will be useful, 15 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 16 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17 | * GNU General Public License for more details. 18 | * 19 | * You should have received a copy of the GNU General Public License 20 | * along with TbGAL. If not, see . 21 | */ 22 | 23 | #ifndef __TBGAL_INVOLUTION_HPP__ 24 | #define __TBGAL_INVOLUTION_HPP__ 25 | 26 | namespace tbgal { 27 | 28 | template 29 | constexpr decltype(auto) involute(FactoredMultivector > const &arg) { 30 | using ResultingScalarType = ScalarType; 31 | using ResultingFactoringProductType = GeometricProduct; 32 | using ResultingFactoredMultivectorType = FactoredMultivector; 33 | return ResultingFactoredMultivectorType(arg.space_ptr(), (arg.factors_count() & 1) ? -arg.scalar() : arg.scalar(), arg.factors_in_signed_metric()); 34 | } 35 | 36 | template 37 | constexpr decltype(auto) involute(FactoredMultivector > const &arg) { 38 | using ResultingScalarType = ScalarType; 39 | using ResultingFactoringProductType = OuterProduct; 40 | using ResultingFactoredMultivectorType = FactoredMultivector; 41 | return ResultingFactoredMultivectorType(arg.space_ptr(), (arg.factors_count() & 1) ? -arg.scalar() : arg.scalar(), arg.factors_and_complement_in_signed_metric(), arg.factors_count()); 42 | } 43 | 44 | template, int> > 45 | constexpr Type involute(Type const &arg) { 46 | return arg; 47 | } 48 | 49 | } 50 | 51 | #endif // __TBGAL_INVOLUTION_HPP__ 52 | -------------------------------------------------------------------------------- /cpp/include/tbgal/left_contraction.hpp: -------------------------------------------------------------------------------- 1 | /* Copyright (C) Eduardo Vera Sousa and Leandro Augusto Frata Fernandes 2 | * 3 | * authors : Sousa, Eduardo V. 4 | * Fernandes, Leandro A. F. 5 | * repository : https://github.com/Prograf-UFF/TbGAL 6 | * 7 | * This file is part of the Tensor-based Geometric Algebra Library (TbGAL). 8 | * 9 | * TbGAL is free software: you can redistribute it and/or modify 10 | * it under the terms of the GNU General Public License as published by 11 | * the Free Software Foundation, either version 3 of the License, or 12 | * (at your option) any later version. 13 | * 14 | * TbGAL is distributed in the hope that it will be useful, 15 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 16 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17 | * GNU General Public License for more details. 18 | * 19 | * You should have received a copy of the GNU General Public License 20 | * along with TbGAL. If not, see . 21 | */ 22 | 23 | #ifndef __TBGAL_LEFT_CONTRACTION_HPP__ 24 | #define __TBGAL_LEFT_CONTRACTION_HPP__ 25 | 26 | namespace tbgal { 27 | 28 | template 29 | constexpr decltype(auto) lcont(FactoredMultivector const &arg1, FactoredMultivector const &arg2) { 30 | using ResultingFactoredMultivectorType = decltype(undual(op(arg1, dual(arg2)))); 31 | if (!is_blade(arg1) || !is_blade(arg2) || (arg1.factors_count() <= arg2.factors_count())) { 32 | return undual(op(arg1, dual(arg2))); 33 | } 34 | return ResultingFactoredMultivectorType(detail::space_ptr(arg1, arg2), 0); 35 | } 36 | 37 | template, int> > 38 | constexpr decltype(auto) lcont(FactoredMultivector const &arg1, SecondScalarType const &arg2) { 39 | using ResultingType = std::common_type_t; 40 | return arg1.factors_count() == 0 ? arg1.scalar() * arg2 : ResultingType(0); 41 | } 42 | 43 | template, int> > 44 | constexpr decltype(auto) lcont(FirstScalarType const &arg1, FactoredMultivector > const &arg2) { 45 | using ResultingScalarType = std::common_type_t; 46 | using ResultingFactoringProductType = GeometricProduct; 47 | using ResultingFactoredMultivectorType = FactoredMultivector; 48 | auto resulting_scalar = arg1 * arg2.scalar(); 49 | if (!is_zero(resulting_scalar)) { 50 | return ResultingFactoredMultivectorType(arg2.space_ptr(), resulting_scalar, arg2.factors_in_signed_metric()); 51 | } 52 | return ResultingFactoredMultivectorType(arg2.space_ptr(), 0); 53 | } 54 | 55 | template, int> > 56 | constexpr decltype(auto) lcont(FirstScalarType const &arg1, FactoredMultivector > const &arg2) { 57 | using ResultingScalarType = std::common_type_t; 58 | using ResultingFactoringProductType = OuterProduct; 59 | using ResultingFactoredMultivectorType = FactoredMultivector; 60 | auto resulting_scalar = arg1 * arg2.scalar(); 61 | if (!is_zero(resulting_scalar)) { 62 | return ResultingFactoredMultivectorType(arg2.space_ptr(), resulting_scalar, arg2.factors_and_complement_in_signed_metric(), arg2.factors_count()); 63 | } 64 | return ResultingFactoredMultivectorType(arg2.space_ptr(), 0); 65 | } 66 | 67 | template || is_multivector_v), int> > 68 | constexpr decltype(auto) lcont(FirstScalarType const &arg1, SecondScalarType const &arg2) { 69 | return arg1 * arg2; 70 | } 71 | 72 | } 73 | 74 | #endif // __TBGAL_LEFT_CONTRACTION_HPP__ 75 | -------------------------------------------------------------------------------- /cpp/include/tbgal/macro.hpp: -------------------------------------------------------------------------------- 1 | /* Copyright (C) Eduardo Vera Sousa and Leandro Augusto Frata Fernandes 2 | * 3 | * authors : Sousa, Eduardo V. 4 | * Fernandes, Leandro A. F. 5 | * repository : https://github.com/Prograf-UFF/TbGAL 6 | * 7 | * This file is part of the Tensor-based Geometric Algebra Library (TbGAL). 8 | * 9 | * TbGAL is free software: you can redistribute it and/or modify 10 | * it under the terms of the GNU General Public License as published by 11 | * the Free Software Foundation, either version 3 of the License, or 12 | * (at your option) any later version. 13 | * 14 | * TbGAL is distributed in the hope that it will be useful, 15 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 16 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17 | * GNU General Public License for more details. 18 | * 19 | * You should have received a copy of the GNU General Public License 20 | * along with TbGAL. If not, see . 21 | */ 22 | 23 | #ifndef __TBGAL_MACRO_HPP__ 24 | #define __TBGAL_MACRO_HPP__ 25 | 26 | #define TBGAL_OVERLOAD_UTILS(METRIC_SPACE) \ 27 | \ 28 | decltype(auto) e(tbgal::DefaultIndexType index) { \ 29 | return tbgal::e(&METRIC_SPACE, index); \ 30 | } \ 31 | \ 32 | template \ 33 | decltype(auto) scalar(ScalarType &&scalar) { \ 34 | return tbgal::scalar(&METRIC_SPACE, std::move(scalar)); \ 35 | } \ 36 | \ 37 | template >...>, int> > \ 38 | decltype(auto) vector(ScalarTypes &&... coords) { \ 39 | return tbgal::vector(&METRIC_SPACE, std::move(coords)...); \ 40 | } \ 41 | \ 42 | template, int> > \ 43 | decltype(auto) vector(IteratorType begin, IteratorType end) { \ 44 | return tbgal::vector(&METRIC_SPACE, begin, end); \ 45 | } \ 46 | \ 47 | template, int> > \ 48 | constexpr decltype(auto) dual(Type const &arg) { \ 49 | return dual(scalar(arg)); \ 50 | } \ 51 | \ 52 | template, int> > \ 53 | constexpr decltype(auto) undual(Type const &arg) { \ 54 | return undual(scalar(arg)); \ 55 | } 56 | 57 | #endif // __TBGAL_MACRO_HPP__ 58 | -------------------------------------------------------------------------------- /cpp/include/tbgal/normalization.hpp: -------------------------------------------------------------------------------- 1 | /* Copyright (C) Eduardo Vera Sousa and Leandro Augusto Frata Fernandes 2 | * 3 | * authors : Sousa, Eduardo V. 4 | * Fernandes, Leandro A. F. 5 | * repository : https://github.com/Prograf-UFF/TbGAL 6 | * 7 | * This file is part of the Tensor-based Geometric Algebra Library (TbGAL). 8 | * 9 | * TbGAL is free software: you can redistribute it and/or modify 10 | * it under the terms of the GNU General Public License as published by 11 | * the Free Software Foundation, either version 3 of the License, or 12 | * (at your option) any later version. 13 | * 14 | * TbGAL is distributed in the hope that it will be useful, 15 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 16 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17 | * GNU General Public License for more details. 18 | * 19 | * You should have received a copy of the GNU General Public License 20 | * along with TbGAL. If not, see . 21 | */ 22 | 23 | #ifndef __TBGAL_NORMALIZATION_HPP__ 24 | #define __TBGAL_NORMALIZATION_HPP__ 25 | 26 | namespace tbgal { 27 | 28 | template 29 | constexpr decltype(auto) unit(FactoredMultivector > const &arg) { 30 | using ResultingScalarType = std::common_type_t; 31 | using ResultingFactoringProductType = GeometricProduct; 32 | using ResultingFactoredMultivectorType = FactoredMultivector; 33 | if (arg.factors_count() > 0) { 34 | return ResultingFactoredMultivectorType(arg.space_ptr(), arg.scalar() / sqrt(abs(arg.scalar() * arg.scalar() * detail::metric_factor(arg.space_ptr(), arg.factors_in_signed_metric()))), arg.factors_in_signed_metric()); 35 | } 36 | else { 37 | return ResultingFactoredMultivectorType(arg.space_ptr(), arg.scalar() / abs(arg.scalar()), arg.factors_in_signed_metric()); 38 | } 39 | } 40 | 41 | template 42 | constexpr decltype(auto) unit(FactoredMultivector > const &arg) { 43 | using ResultingScalarType = std::common_type_t; 44 | using ResultingFactoringProductType = OuterProduct; 45 | using ResultingFactoredMultivectorType = FactoredMultivector; 46 | if (arg.factors_count() > 0) { 47 | auto factors_tuple = detail::from_outer_to_geometric_factors(arg.space_ptr(), arg.factors_in_signed_metric()); 48 | return ResultingFactoredMultivectorType(arg.space_ptr(), arg.scalar() / sqrt(abs(arg.scalar() * arg.scalar() * std::get<0>(factors_tuple) * std::get<0>(factors_tuple) * detail::metric_factor(arg.space_ptr(), std::get<1>(factors_tuple)))), arg.factors_and_complement_in_signed_metric(), arg.factors_count()); 49 | } 50 | else { 51 | return ResultingFactoredMultivectorType(arg.space_ptr(), arg.scalar() / abs(arg.scalar()), arg.factors_and_complement_in_signed_metric(), 0); 52 | } 53 | } 54 | 55 | template, int> > 56 | constexpr Type unit(Type const &arg) { 57 | return arg / abs(arg); 58 | } 59 | 60 | } 61 | 62 | #endif // __TBGAL_NORMALIZATION_HPP__ 63 | -------------------------------------------------------------------------------- /cpp/include/tbgal/reverse_norm.hpp: -------------------------------------------------------------------------------- 1 | /* Copyright (C) Eduardo Vera Sousa and Leandro Augusto Frata Fernandes 2 | * 3 | * authors : Sousa, Eduardo V. 4 | * Fernandes, Leandro A. F. 5 | * repository : https://github.com/Prograf-UFF/TbGAL 6 | * 7 | * This file is part of the Tensor-based Geometric Algebra Library (TbGAL). 8 | * 9 | * TbGAL is free software: you can redistribute it and/or modify 10 | * it under the terms of the GNU General Public License as published by 11 | * the Free Software Foundation, either version 3 of the License, or 12 | * (at your option) any later version. 13 | * 14 | * TbGAL is distributed in the hope that it will be useful, 15 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 16 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17 | * GNU General Public License for more details. 18 | * 19 | * You should have received a copy of the GNU General Public License 20 | * along with TbGAL. If not, see . 21 | */ 22 | 23 | #ifndef __TBGAL_REVERSE_NORM_HPP__ 24 | #define __TBGAL_REVERSE_NORM_HPP__ 25 | 26 | namespace tbgal { 27 | 28 | template 29 | constexpr decltype(auto) rnorm_sqr(FactoredMultivector > const &arg) { 30 | if (arg.factors_count() > 0) { 31 | return arg.scalar() * arg.scalar() * detail::metric_factor(arg.space_ptr(), arg.factors_in_signed_metric()); 32 | } 33 | else { 34 | return arg.scalar() * arg.scalar(); 35 | } 36 | } 37 | 38 | template 39 | constexpr decltype(auto) rnorm_sqr(FactoredMultivector > const &arg) { 40 | if (arg.factors_count() > 0) { 41 | auto factors_tuple = detail::from_outer_to_geometric_factors(arg.space_ptr(), arg.factors_in_signed_metric()); 42 | return arg.scalar() * arg.scalar() * std::get<0>(factors_tuple) * std::get<0>(factors_tuple) * detail::metric_factor(arg.space_ptr(), std::get<1>(factors_tuple)); 43 | } 44 | else { 45 | return arg.scalar() * arg.scalar(); 46 | } 47 | } 48 | 49 | template, int> > 50 | constexpr decltype(auto) rnorm_sqr(Type const &arg) { 51 | return arg * arg; 52 | } 53 | 54 | template 55 | constexpr decltype(auto) rnorm(Type const &arg) { 56 | return sqrt(rnorm_sqr(arg)); 57 | } 58 | 59 | } 60 | 61 | #endif // __TBGAL_REVERSE_NORM_HPP__ 62 | -------------------------------------------------------------------------------- /cpp/include/tbgal/reversion.hpp: -------------------------------------------------------------------------------- 1 | /* Copyright (C) Eduardo Vera Sousa and Leandro Augusto Frata Fernandes 2 | * 3 | * authors : Sousa, Eduardo V. 4 | * Fernandes, Leandro A. F. 5 | * repository : https://github.com/Prograf-UFF/TbGAL 6 | * 7 | * This file is part of the Tensor-based Geometric Algebra Library (TbGAL). 8 | * 9 | * TbGAL is free software: you can redistribute it and/or modify 10 | * it under the terms of the GNU General Public License as published by 11 | * the Free Software Foundation, either version 3 of the License, or 12 | * (at your option) any later version. 13 | * 14 | * TbGAL is distributed in the hope that it will be useful, 15 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 16 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17 | * GNU General Public License for more details. 18 | * 19 | * You should have received a copy of the GNU General Public License 20 | * along with TbGAL. If not, see . 21 | */ 22 | 23 | #ifndef __TBGAL_REVERSION_HPP__ 24 | #define __TBGAL_REVERSION_HPP__ 25 | 26 | namespace tbgal { 27 | 28 | template 29 | constexpr decltype(auto) reverse(FactoredMultivector > const &arg) { 30 | using ResultingScalarType = ScalarType; 31 | using ResultingFactoringProductType = GeometricProduct; 32 | using ResultingFactoredMultivectorType = FactoredMultivector; 33 | return ResultingFactoredMultivectorType(arg.space_ptr(), arg.scalar(), detail::reverse_columns(arg.factors_in_signed_metric())); 34 | } 35 | 36 | template 37 | constexpr decltype(auto) reverse(FactoredMultivector > const &arg) { 38 | using ResultingScalarType = ScalarType; 39 | using ResultingFactoringProductType = OuterProduct; 40 | using ResultingFactoredMultivectorType = FactoredMultivector; 41 | return ResultingFactoredMultivectorType(arg.space_ptr(), ((arg.factors_count() * (arg.factors_count() - 1)) & 2) ? -arg.scalar() : arg.scalar(), arg.factors_and_complement_in_signed_metric(), arg.factors_count()); 42 | } 43 | 44 | template, int> > 45 | constexpr Type reverse(Type const &arg) { 46 | return arg; 47 | } 48 | 49 | template 50 | constexpr decltype(auto) operator~(FactoredMultivector const &arg) { 51 | return reverse(arg); 52 | } 53 | 54 | } 55 | 56 | #endif // __TBGAL_REVERSION_HPP__ 57 | -------------------------------------------------------------------------------- /cpp/include/tbgal/right_contraction.hpp: -------------------------------------------------------------------------------- 1 | /* Copyright (C) Eduardo Vera Sousa and Leandro Augusto Frata Fernandes 2 | * 3 | * authors : Sousa, Eduardo V. 4 | * Fernandes, Leandro A. F. 5 | * repository : https://github.com/Prograf-UFF/TbGAL 6 | * 7 | * This file is part of the Tensor-based Geometric Algebra Library (TbGAL). 8 | * 9 | * TbGAL is free software: you can redistribute it and/or modify 10 | * it under the terms of the GNU General Public License as published by 11 | * the Free Software Foundation, either version 3 of the License, or 12 | * (at your option) any later version. 13 | * 14 | * TbGAL is distributed in the hope that it will be useful, 15 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 16 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17 | * GNU General Public License for more details. 18 | * 19 | * You should have received a copy of the GNU General Public License 20 | * along with TbGAL. If not, see . 21 | */ 22 | 23 | #ifndef __TBGAL_RIGHT_CONTRACTION_HPP__ 24 | #define __TBGAL_RIGHT_CONTRACTION_HPP__ 25 | 26 | namespace tbgal { 27 | 28 | template 29 | constexpr decltype(auto) rcont(FactoredMultivector const &arg1, FactoredMultivector const &arg2) { 30 | using ResultingScalarType = std::common_type_t; 31 | using ResultingFactoredMultivectorType = decltype(undual(op(arg2, dual(arg1)))); 32 | if (!is_blade(arg1) || !is_blade(arg2) || (arg1.factors_count() >= arg2.factors_count())) { 33 | if ((arg2.factors_count() * (arg1.factors_count() + 1)) & 1) { 34 | return -undual(op(arg2, dual(arg1))); 35 | } 36 | return undual(op(arg2, dual(arg1))); 37 | } 38 | return ResultingFactoredMultivectorType(detail::space_ptr(arg1, arg2), 0); 39 | } 40 | 41 | template, int> > 42 | constexpr decltype(auto) rcont(FactoredMultivector > const &arg1, SecondScalarType const &arg2) { 43 | using ResultingScalarType = std::common_type_t; 44 | using ResultingFactoringProductType = GeometricProduct; 45 | using ResultingFactoredMultivectorType = FactoredMultivector; 46 | auto resulting_scalar = arg1.scalar() * arg2; 47 | if (!is_zero(resulting_scalar)) { 48 | return ResultingFactoredMultivectorType(arg1.space_ptr(), resulting_scalar, arg1.factors_in_signed_metric()); 49 | } 50 | return ResultingFactoredMultivectorType(arg1.space_ptr(), 0); 51 | } 52 | 53 | template, int> > 54 | constexpr decltype(auto) rcont(FactoredMultivector > const &arg1, SecondScalarType const &arg2) { 55 | using ResultingScalarType = std::common_type_t; 56 | using ResultingFactoringProductType = OuterProduct; 57 | using ResultingFactoredMultivectorType = FactoredMultivector; 58 | auto resulting_scalar = arg1.scalar() * arg2; 59 | if (!is_zero(resulting_scalar)) { 60 | return ResultingFactoredMultivectorType(arg1.space_ptr(), resulting_scalar, arg1.factors_and_complement_in_signed_metric(), arg1.factors_count()); 61 | } 62 | return ResultingFactoredMultivectorType(arg1.space_ptr(), 0); 63 | } 64 | 65 | template, int> > 66 | constexpr decltype(auto) rcont(FirstScalarType const &arg1, FactoredMultivector const &arg2) { 67 | using ResultingType = std::common_type_t; 68 | return arg2.factors_count() == 0 ? arg1 * arg2.scalar() : ResultingType(0); 69 | } 70 | 71 | template || is_multivector_v), int> > 72 | constexpr decltype(auto) rcont(FirstScalarType const &arg1, SecondScalarType const &arg2) { 73 | return arg1 * arg2; 74 | } 75 | 76 | } 77 | 78 | #endif // __TBGAL_RIGHT_CONTRACTION_HPP__ 79 | -------------------------------------------------------------------------------- /cpp/include/tbgal/scalar_product.hpp: -------------------------------------------------------------------------------- 1 | /* Copyright (C) Eduardo Vera Sousa and Leandro Augusto Frata Fernandes 2 | * 3 | * authors : Sousa, Eduardo V. 4 | * Fernandes, Leandro A. F. 5 | * repository : https://github.com/Prograf-UFF/TbGAL 6 | * 7 | * This file is part of the Tensor-based Geometric Algebra Library (TbGAL). 8 | * 9 | * TbGAL is free software: you can redistribute it and/or modify 10 | * it under the terms of the GNU General Public License as published by 11 | * the Free Software Foundation, either version 3 of the License, or 12 | * (at your option) any later version. 13 | * 14 | * TbGAL is distributed in the hope that it will be useful, 15 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 16 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17 | * GNU General Public License for more details. 18 | * 19 | * You should have received a copy of the GNU General Public License 20 | * along with TbGAL. If not, see . 21 | */ 22 | 23 | #ifndef __TBGAL_SCALAR_PRODUCT_HPP__ 24 | #define __TBGAL_SCALAR_PRODUCT_HPP__ 25 | 26 | namespace tbgal { 27 | 28 | //TODO [FUTURE] Implement scalar product for the general case (when the input multivector is not a blade). 29 | 30 | template 31 | constexpr decltype(auto) sp(FactoredMultivector const &arg1, FactoredMultivector const &arg2) { 32 | static_assert(std::is_same_v, "The multivectors must have the same metric space."); 33 | using MetricSpaceType = typename FirstFactoringProductType::MetricSpaceType; 34 | using ResultingScalarType = std::common_type_t; 35 | if (!is_blade(arg1) || !is_blade(arg2)) { 36 | throw NotSupportedError("The scalar product is only implemented for blades."); 37 | } 38 | if (arg1.factors_count() == arg2.factors_count()) { 39 | return (((arg1.factors_count() * (arg1.factors_count() - 1)) & 2) ? -arg1.scalar() : arg1.scalar()) * arg2.scalar() * detail::determinant(detail::prod(detail::transpose(arg1.factors_in_signed_metric()), detail::apply_signed_metric(arg2.space_ptr(), arg2.factors_in_signed_metric()))); 40 | } 41 | return ResultingScalarType(0); 42 | } 43 | 44 | template, int> > 45 | constexpr decltype(auto) sp(FactoredMultivector const &arg1, SecondScalarType const &arg2) { 46 | using ResultingScalarType = std::common_type_t; 47 | if (!is_blade(arg1)) { 48 | throw NotSupportedError("The scalar product is only implemented for blades."); 49 | } 50 | if (arg1.factors_count() == 0) { 51 | return arg1.scalar() * arg2; 52 | } 53 | return ResultingScalarType(0); 54 | } 55 | 56 | template, int> > 57 | constexpr decltype(auto) sp(FirstScalarType const &arg1, FactoredMultivector const &arg2) { 58 | using ResultingScalarType = std::common_type_t; 59 | if (!is_blade(arg2)) { 60 | throw NotSupportedError("The scalar product is only implemented for blades."); 61 | } 62 | if (arg2.factors_count() == 0) { 63 | return arg1 * arg2.scalar(); 64 | } 65 | return ResultingScalarType(0); 66 | } 67 | 68 | template || is_multivector_v), int> > 69 | constexpr decltype(auto) sp(FirstScalarType const &arg1, SecondScalarType const &arg2) { 70 | return arg1 * arg2; 71 | } 72 | 73 | } 74 | 75 | #endif // __TBGAL_SCALAR_PRODUCT_HPP__ 76 | -------------------------------------------------------------------------------- /cpp/include/tbgal/subtraction.hpp: -------------------------------------------------------------------------------- 1 | /* Copyright (C) Eduardo Vera Sousa and Leandro Augusto Frata Fernandes 2 | * 3 | * authors : Sousa, Eduardo V. 4 | * Fernandes, Leandro A. F. 5 | * repository : https://github.com/Prograf-UFF/TbGAL 6 | * 7 | * This file is part of the Tensor-based Geometric Algebra Library (TbGAL). 8 | * 9 | * TbGAL is free software: you can redistribute it and/or modify 10 | * it under the terms of the GNU General Public License as published by 11 | * the Free Software Foundation, either version 3 of the License, or 12 | * (at your option) any later version. 13 | * 14 | * TbGAL is distributed in the hope that it will be useful, 15 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 16 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17 | * GNU General Public License for more details. 18 | * 19 | * You should have received a copy of the GNU General Public License 20 | * along with TbGAL. If not, see . 21 | */ 22 | 23 | #ifndef __TBGAL_SUBTRACTION_HPP__ 24 | #define __TBGAL_SUBTRACTION_HPP__ 25 | 26 | namespace tbgal { 27 | 28 | //TODO [FUTURE] Implement associativity. 29 | 30 | template 31 | constexpr decltype(auto) subtraction(FactoredMultivector const &arg1, FactoredMultivector const &arg2) { 32 | using ResultingScalarType = std::common_type_t; 33 | using ResultingFactoringProductType = OuterProduct; 34 | using ResultingFactoredMultivectorType = FactoredMultivector; 35 | static_assert(std::is_same_v, "The multivectors must have the same metric space."); 36 | if (arg1.space_ptr() != arg2.space_ptr()) { 37 | throw NotSupportedError("Operations with multivectors from different models of geometry are not supported yet."); 38 | } 39 | if (arg1.factors_count() == arg2.factors_count()) { 40 | if (arg1.factors_count() == 0) { 41 | return ResultingFactoredMultivectorType(arg1.space_ptr(), arg1.scalar() - arg2.scalar()); 42 | } 43 | //TODO [FUTURE] Handle vectors. 44 | //TODO [FUTURE] Handle pseudovetors. 45 | //TODO [FUTURE] Handle pseudoscalars. 46 | } 47 | throw NotSupportedError("The general case of summation of factored multivectors is not supported."); 48 | } 49 | 50 | template, int> > 51 | constexpr decltype(auto) subtraction(FactoredMultivector const &arg1, SecondScalarType const &arg2) { 52 | if (arg1.factors_count() == 0) { 53 | return scalar(arg1.space_ptr(), arg1.scalar() - arg2); 54 | } 55 | throw NotSupportedError("The general case of summation of factored multivectors is not supported."); 56 | } 57 | 58 | template, int> > 59 | constexpr decltype(auto) subtraction(FirstScalarType const &arg1, FactoredMultivector const &arg2) { 60 | if (arg2.factors_count() == 0) { 61 | return scalar(arg2.space_ptr(), arg1 - arg2.scalar()); 62 | } 63 | throw NotSupportedError("The general case of summation of factored multivectors is not supported."); 64 | } 65 | 66 | template || is_multivector_v), int> > 67 | constexpr decltype(auto) subtraction(FirstScalarType const &arg1, SecondScalarType const &arg2) { 68 | return arg1 - arg2; 69 | } 70 | 71 | template 72 | constexpr decltype(auto) sub(FirstType const &arg1, SecondType const &arg2) { 73 | return subtraction(arg1, arg2); 74 | } 75 | 76 | template 77 | constexpr decltype(auto) operator-(FactoredMultivector const &arg1, FactoredMultivector const &arg2) { 78 | return subtraction(arg1, arg2); 79 | } 80 | 81 | template, int> > 82 | constexpr decltype(auto) operator-(FactoredMultivector const &arg1, SecondScalarType const &arg2) { 83 | return subtraction(arg1, arg2); 84 | } 85 | 86 | template, int> > 87 | constexpr decltype(auto) operator-(FirstScalarType const &arg1, FactoredMultivector const &arg2) { 88 | return subtraction(arg1, arg2); 89 | } 90 | 91 | } 92 | 93 | #endif // __TBGAL_SUBTRACTION_HPP__ 94 | -------------------------------------------------------------------------------- /cpp/include/tbgal/unary_minus.hpp: -------------------------------------------------------------------------------- 1 | /* Copyright (C) Eduardo Vera Sousa and Leandro Augusto Frata Fernandes 2 | * 3 | * authors : Sousa, Eduardo V. 4 | * Fernandes, Leandro A. F. 5 | * repository : https://github.com/Prograf-UFF/TbGAL 6 | * 7 | * This file is part of the Tensor-based Geometric Algebra Library (TbGAL). 8 | * 9 | * TbGAL is free software: you can redistribute it and/or modify 10 | * it under the terms of the GNU General Public License as published by 11 | * the Free Software Foundation, either version 3 of the License, or 12 | * (at your option) any later version. 13 | * 14 | * TbGAL is distributed in the hope that it will be useful, 15 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 16 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17 | * GNU General Public License for more details. 18 | * 19 | * You should have received a copy of the GNU General Public License 20 | * along with TbGAL. If not, see . 21 | */ 22 | 23 | #ifndef __TBGAL_UNARY_MINUS_HPP__ 24 | #define __TBGAL_UNARY_MINUS_HPP__ 25 | 26 | namespace tbgal { 27 | 28 | template 29 | constexpr decltype(auto) unary_minus(FactoredMultivector > const &arg) { 30 | using ResultingScalarType = ScalarType; 31 | using ResultingFactoringProductType = GeometricProduct; 32 | using ResultingFactoredMultivectorType = FactoredMultivector; 33 | return ResultingFactoredMultivectorType(arg.space_ptr(), -arg.scalar(), arg.factors_in_signed_metric()); 34 | } 35 | 36 | template 37 | constexpr decltype(auto) unary_minus(FactoredMultivector > const &arg) { 38 | using ResultingScalarType = ScalarType; 39 | using ResultingFactoringProductType = OuterProduct; 40 | using ResultingFactoredMultivectorType = FactoredMultivector; 41 | return ResultingFactoredMultivectorType(arg.space_ptr(), -arg.scalar(), arg.factors_and_complement_in_signed_metric(), arg.factors_count()); 42 | } 43 | 44 | template, int> > 45 | constexpr decltype(auto) unary_minus(Type const &arg) { 46 | return -arg; 47 | } 48 | 49 | template 50 | constexpr decltype(auto) operator-(FactoredMultivector const &arg) { 51 | return unary_minus(arg); 52 | } 53 | 54 | } 55 | 56 | #endif // __TBGAL_UNARY_MINUS_HPP__ 57 | -------------------------------------------------------------------------------- /cpp/include/tbgal/unary_plus.hpp: -------------------------------------------------------------------------------- 1 | /* Copyright (C) Eduardo Vera Sousa and Leandro Augusto Frata Fernandes 2 | * 3 | * authors : Sousa, Eduardo V. 4 | * Fernandes, Leandro A. F. 5 | * repository : https://github.com/Prograf-UFF/TbGAL 6 | * 7 | * This file is part of the Tensor-based Geometric Algebra Library (TbGAL). 8 | * 9 | * TbGAL is free software: you can redistribute it and/or modify 10 | * it under the terms of the GNU General Public License as published by 11 | * the Free Software Foundation, either version 3 of the License, or 12 | * (at your option) any later version. 13 | * 14 | * TbGAL is distributed in the hope that it will be useful, 15 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 16 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17 | * GNU General Public License for more details. 18 | * 19 | * You should have received a copy of the GNU General Public License 20 | * along with TbGAL. If not, see . 21 | */ 22 | 23 | #ifndef __TBGAL_UNARY_PLUS_HPP__ 24 | #define __TBGAL_UNARY_PLUS_HPP__ 25 | 26 | namespace tbgal { 27 | 28 | template 29 | constexpr FactoredMultivector unary_plus(FactoredMultivector const &arg) { 30 | return arg; 31 | } 32 | 33 | template, int> > 34 | constexpr Type unary_plus(Type const &arg) { 35 | return arg; 36 | } 37 | 38 | template 39 | constexpr FactoredMultivector operator+(FactoredMultivector const &arg) { 40 | return arg; 41 | } 42 | 43 | } 44 | 45 | #endif // __TBGAL_UNARY_PLUS_HPP__ 46 | -------------------------------------------------------------------------------- /cpp/include/tbgal/write.hpp: -------------------------------------------------------------------------------- 1 | /* Copyright (C) Eduardo Vera Sousa and Leandro Augusto Frata Fernandes 2 | * 3 | * authors : Sousa, Eduardo V. 4 | * Fernandes, Leandro A. F. 5 | * repository : https://github.com/Prograf-UFF/TbGAL 6 | * 7 | * This file is part of the Tensor-based Geometric Algebra Library (TbGAL). 8 | * 9 | * TbGAL is free software: you can redistribute it and/or modify 10 | * it under the terms of the GNU General Public License as published by 11 | * the Free Software Foundation, either version 3 of the License, or 12 | * (at your option) any later version. 13 | * 14 | * TbGAL is distributed in the hope that it will be useful, 15 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 16 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17 | * GNU General Public License for more details. 18 | * 19 | * You should have received a copy of the GNU General Public License 20 | * along with TbGAL. If not, see . 21 | */ 22 | 23 | #ifndef __TBGAL_WRITE_HPP__ 24 | #define __TBGAL_WRITE_HPP__ 25 | 26 | namespace tbgal { 27 | 28 | namespace detail { 29 | 30 | template 31 | std::ostream & write(std::ostream &os, FactoredMultivector const &arg) { 32 | using IndexType = typename FactoredMultivector::IndexType; 33 | os << arg.scalar(); 34 | if (arg.factors_count() > 0) { 35 | auto factors = arg.factors_in_actual_metric(); 36 | for (IndexType ind = 0; ind != arg.factors_count(); ++ind) { 37 | os << ", ("; 38 | for (IndexType dim = 0; dim != arg.space().dimensions(); ++dim) { 39 | auto value = coeff(factors, dim, ind); 40 | if (dim > 0) { 41 | os << (value >= 0 ? " + " : " - ") << std::abs(value); 42 | } 43 | else { 44 | os << value; 45 | } 46 | os << " * " << arg.space().basis_vector_str(dim); 47 | } 48 | os << ")"; 49 | } 50 | } 51 | return os; 52 | } 53 | 54 | } 55 | 56 | template 57 | std::ostream & operator <<(std::ostream &os, FactoredMultivector > const &arg) { 58 | os << "gp("; 59 | detail::write(os, arg); 60 | os << ")"; 61 | return os; 62 | } 63 | 64 | template 65 | std::ostream & operator <<(std::ostream &os, FactoredMultivector > const &arg) { 66 | os << "op("; 67 | detail::write(os, arg); 68 | os << ")"; 69 | return os; 70 | } 71 | 72 | } 73 | 74 | #endif // __TBGAL_WRITE_HPP__ 75 | -------------------------------------------------------------------------------- /cpp/test/CMakeLists-googletest.txt.in: -------------------------------------------------------------------------------- 1 | cmake_minimum_required(VERSION 2.8.2) 2 | 3 | project(googletest-download NONE) 4 | 5 | include(ExternalProject) 6 | 7 | ExternalProject_Add(googletest 8 | GIT_REPOSITORY https://github.com/google/googletest.git 9 | GIT_TAG main 10 | SOURCE_DIR ${CMAKE_CURRENT_BINARY_DIR}/googletest-src 11 | BINARY_DIR ${CMAKE_CURRENT_BINARY_DIR}/googletest-build 12 | CONFIGURE_COMMAND "" 13 | BUILD_COMMAND "" 14 | INSTALL_COMMAND "" 15 | TEST_COMMAND "" 16 | ) 17 | -------------------------------------------------------------------------------- /cpp/test/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # Copyright (C) Eduardo Vera Sousa and Leandro Augusto Frata Fernandes 2 | # 3 | # authors : Sousa, Eduardo V. 4 | # Fernandes, Leandro A. F. 5 | # repository : https://github.com/Prograf-UFF/TbGAL 6 | # 7 | # This file is part of the Tensor-based Geometric Algebra Library (TbGAL). 8 | # 9 | # TbGAL is free software: you can redistribute it and/or modify 10 | # it under the terms of the GNU General Public License as published by 11 | # the Free Software Foundation, either version 3 of the License, or 12 | # (at your option) any later version. 13 | # 14 | # TbGAL is distributed in the hope that it will be useful, 15 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 16 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17 | # GNU General Public License for more details. 18 | # 19 | # You should have received a copy of the GNU General Public License 20 | # along with TbGAL. If not, see . 21 | 22 | cmake_minimum_required(VERSION 3.14) 23 | 24 | project(TbGAL-Test) 25 | 26 | enable_testing() 27 | 28 | find_package(TbGAL REQUIRED) 29 | find_package(GATL REQUIRED) 30 | find_package(Threads REQUIRED) 31 | 32 | set(CMAKE_CXX_STANDARD 17) 33 | set(CMAKE_CXX_STANDARD_REQUIRED ON) 34 | 35 | ############################################################################### 36 | # Download and unpack googletest at configure time 37 | configure_file(CMakeLists-googletest.txt.in googletest-download/CMakeLists.txt) 38 | 39 | execute_process(COMMAND ${CMAKE_COMMAND} -G ${CMAKE_GENERATOR} . RESULT_VARIABLE result WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/googletest-download) 40 | if(result) 41 | message(FATAL_ERROR "CMake step for googletest failed: ${result}") 42 | endif() 43 | 44 | execute_process(COMMAND ${CMAKE_COMMAND} --build . RESULT_VARIABLE result WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/googletest-download) 45 | if(result) 46 | message(FATAL_ERROR "Build step for googletest failed: ${result}") 47 | endif() 48 | 49 | set(gtest_force_shared_crt ON CACHE BOOL "" FORCE) 50 | 51 | add_subdirectory(${CMAKE_CURRENT_BINARY_DIR}/googletest-src ${CMAKE_CURRENT_BINARY_DIR}/googletest-build EXCLUDE_FROM_ALL) 52 | ############################################################################### 53 | 54 | set(target_prefix TbGAL_test_) 55 | 56 | include_directories(${TbGAL_INCLUDE_DIRS} ${GATL_INCLUDE_DIRS}) 57 | 58 | file(GLOB test_filenames RELATIVE ${PROJECT_SOURCE_DIR} ${PROJECT_SOURCE_DIR}/*.cpp) 59 | foreach(test_filename ${test_filenames}) 60 | string(REPLACE ".cpp" "" test_name ${test_filename}) 61 | add_executable(${target_prefix}${test_name} ${PROJECT_SOURCE_DIR}/${test_filename}) 62 | target_include_directories(${target_prefix}${test_name} PUBLIC ${PROJECT_SOURCE_DIR}) 63 | target_link_libraries(${target_prefix}${test_name} gtest_main ${CMAKE_THREAD_LIBS_INIT}) 64 | add_test(${target_prefix}${test_name} ${target_prefix}${test_name}) 65 | endforeach() 66 | -------------------------------------------------------------------------------- /cpp/test/usingEigen_assumingConformal1.cpp: -------------------------------------------------------------------------------- 1 | /* Copyright (C) Eduardo Vera Sousa and Leandro Augusto Frata Fernandes 2 | * 3 | * authors : Sousa, Eduardo V. 4 | * Fernandes, Leandro A. F. 5 | * repository : https://github.com/Prograf-UFF/TbGAL 6 | * 7 | * This file is part of the Tensor-based Geometric Algebra Library (TbGAL). 8 | * 9 | * TbGAL is free software: you can redistribute it and/or modify 10 | * it under the terms of the GNU General Public License as published by 11 | * the Free Software Foundation, either version 3 of the License, or 12 | * (at your option) any later version. 13 | * 14 | * TbGAL is distributed in the hope that it will be useful, 15 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 16 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17 | * GNU General Public License for more details. 18 | * 19 | * You should have received a copy of the GNU General Public License 20 | * along with TbGAL. If not, see . 21 | */ 22 | 23 | #include 24 | #include 25 | #define TESTING_TBGAL_MODEL_NAMESPACE tbgal::Conformal1 26 | 27 | #include 28 | #define TESTING_GATL_MODEL_NAMESPACE ga1c 29 | 30 | #define TESTING_VECTOR_SPACE_DIMENSIONS (1 + 2) 31 | 32 | #include "common.hpp" 33 | -------------------------------------------------------------------------------- /cpp/test/usingEigen_assumingConformal2.cpp: -------------------------------------------------------------------------------- 1 | /* Copyright (C) Eduardo Vera Sousa and Leandro Augusto Frata Fernandes 2 | * 3 | * authors : Sousa, Eduardo V. 4 | * Fernandes, Leandro A. F. 5 | * repository : https://github.com/Prograf-UFF/TbGAL 6 | * 7 | * This file is part of the Tensor-based Geometric Algebra Library (TbGAL). 8 | * 9 | * TbGAL is free software: you can redistribute it and/or modify 10 | * it under the terms of the GNU General Public License as published by 11 | * the Free Software Foundation, either version 3 of the License, or 12 | * (at your option) any later version. 13 | * 14 | * TbGAL is distributed in the hope that it will be useful, 15 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 16 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17 | * GNU General Public License for more details. 18 | * 19 | * You should have received a copy of the GNU General Public License 20 | * along with TbGAL. If not, see . 21 | */ 22 | 23 | #include 24 | #include 25 | #define TESTING_TBGAL_MODEL_NAMESPACE tbgal::Conformal2 26 | 27 | #include 28 | #define TESTING_GATL_MODEL_NAMESPACE ga2c 29 | 30 | #define TESTING_VECTOR_SPACE_DIMENSIONS (2 + 2) 31 | 32 | #include "common.hpp" 33 | -------------------------------------------------------------------------------- /cpp/test/usingEigen_assumingConformal3.cpp: -------------------------------------------------------------------------------- 1 | /* Copyright (C) Eduardo Vera Sousa and Leandro Augusto Frata Fernandes 2 | * 3 | * authors : Sousa, Eduardo V. 4 | * Fernandes, Leandro A. F. 5 | * repository : https://github.com/Prograf-UFF/TbGAL 6 | * 7 | * This file is part of the Tensor-based Geometric Algebra Library (TbGAL). 8 | * 9 | * TbGAL is free software: you can redistribute it and/or modify 10 | * it under the terms of the GNU General Public License as published by 11 | * the Free Software Foundation, either version 3 of the License, or 12 | * (at your option) any later version. 13 | * 14 | * TbGAL is distributed in the hope that it will be useful, 15 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 16 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17 | * GNU General Public License for more details. 18 | * 19 | * You should have received a copy of the GNU General Public License 20 | * along with TbGAL. If not, see . 21 | */ 22 | 23 | #include 24 | #include 25 | #define TESTING_TBGAL_MODEL_NAMESPACE tbgal::Conformal3 26 | 27 | #include 28 | #define TESTING_GATL_MODEL_NAMESPACE ga3c 29 | 30 | #define TESTING_VECTOR_SPACE_DIMENSIONS (3 + 2) 31 | 32 | #include "common.hpp" 33 | -------------------------------------------------------------------------------- /cpp/test/usingEigen_assumingEuclidean1.cpp: -------------------------------------------------------------------------------- 1 | /* Copyright (C) Eduardo Vera Sousa and Leandro Augusto Frata Fernandes 2 | * 3 | * authors : Sousa, Eduardo V. 4 | * Fernandes, Leandro A. F. 5 | * repository : https://github.com/Prograf-UFF/TbGAL 6 | * 7 | * This file is part of the Tensor-based Geometric Algebra Library (TbGAL). 8 | * 9 | * TbGAL is free software: you can redistribute it and/or modify 10 | * it under the terms of the GNU General Public License as published by 11 | * the Free Software Foundation, either version 3 of the License, or 12 | * (at your option) any later version. 13 | * 14 | * TbGAL is distributed in the hope that it will be useful, 15 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 16 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17 | * GNU General Public License for more details. 18 | * 19 | * You should have received a copy of the GNU General Public License 20 | * along with TbGAL. If not, see . 21 | */ 22 | 23 | #include 24 | #include 25 | #define TESTING_TBGAL_MODEL_NAMESPACE tbgal::Euclidean1 26 | 27 | #include 28 | #define TESTING_GATL_MODEL_NAMESPACE ga1e 29 | 30 | #define TESTING_VECTOR_SPACE_DIMENSIONS 1 31 | 32 | #include "common.hpp" 33 | -------------------------------------------------------------------------------- /cpp/test/usingEigen_assumingEuclidean2.cpp: -------------------------------------------------------------------------------- 1 | /* Copyright (C) Eduardo Vera Sousa and Leandro Augusto Frata Fernandes 2 | * 3 | * authors : Sousa, Eduardo V. 4 | * Fernandes, Leandro A. F. 5 | * repository : https://github.com/Prograf-UFF/TbGAL 6 | * 7 | * This file is part of the Tensor-based Geometric Algebra Library (TbGAL). 8 | * 9 | * TbGAL is free software: you can redistribute it and/or modify 10 | * it under the terms of the GNU General Public License as published by 11 | * the Free Software Foundation, either version 3 of the License, or 12 | * (at your option) any later version. 13 | * 14 | * TbGAL is distributed in the hope that it will be useful, 15 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 16 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17 | * GNU General Public License for more details. 18 | * 19 | * You should have received a copy of the GNU General Public License 20 | * along with TbGAL. If not, see . 21 | */ 22 | 23 | #include 24 | #include 25 | #define TESTING_TBGAL_MODEL_NAMESPACE tbgal::Euclidean2 26 | 27 | #include 28 | #define TESTING_GATL_MODEL_NAMESPACE ga2e 29 | 30 | #define TESTING_VECTOR_SPACE_DIMENSIONS 2 31 | 32 | #include "common.hpp" 33 | -------------------------------------------------------------------------------- /cpp/test/usingEigen_assumingEuclidean3.cpp: -------------------------------------------------------------------------------- 1 | /* Copyright (C) Eduardo Vera Sousa and Leandro Augusto Frata Fernandes 2 | * 3 | * authors : Sousa, Eduardo V. 4 | * Fernandes, Leandro A. F. 5 | * repository : https://github.com/Prograf-UFF/TbGAL 6 | * 7 | * This file is part of the Tensor-based Geometric Algebra Library (TbGAL). 8 | * 9 | * TbGAL is free software: you can redistribute it and/or modify 10 | * it under the terms of the GNU General Public License as published by 11 | * the Free Software Foundation, either version 3 of the License, or 12 | * (at your option) any later version. 13 | * 14 | * TbGAL is distributed in the hope that it will be useful, 15 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 16 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17 | * GNU General Public License for more details. 18 | * 19 | * You should have received a copy of the GNU General Public License 20 | * along with TbGAL. If not, see . 21 | */ 22 | 23 | #include 24 | #include 25 | #define TESTING_TBGAL_MODEL_NAMESPACE tbgal::Euclidean3 26 | 27 | #include 28 | #define TESTING_GATL_MODEL_NAMESPACE ga3e 29 | 30 | #define TESTING_VECTOR_SPACE_DIMENSIONS 3 31 | 32 | #include "common.hpp" 33 | -------------------------------------------------------------------------------- /cpp/test/usingEigen_assumingHomogeneous1.cpp: -------------------------------------------------------------------------------- 1 | /* Copyright (C) Eduardo Vera Sousa and Leandro Augusto Frata Fernandes 2 | * 3 | * authors : Sousa, Eduardo V. 4 | * Fernandes, Leandro A. F. 5 | * repository : https://github.com/Prograf-UFF/TbGAL 6 | * 7 | * This file is part of the Tensor-based Geometric Algebra Library (TbGAL). 8 | * 9 | * TbGAL is free software: you can redistribute it and/or modify 10 | * it under the terms of the GNU General Public License as published by 11 | * the Free Software Foundation, either version 3 of the License, or 12 | * (at your option) any later version. 13 | * 14 | * TbGAL is distributed in the hope that it will be useful, 15 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 16 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17 | * GNU General Public License for more details. 18 | * 19 | * You should have received a copy of the GNU General Public License 20 | * along with TbGAL. If not, see . 21 | */ 22 | 23 | #include 24 | #include 25 | #define TESTING_TBGAL_MODEL_NAMESPACE tbgal::Homogeneous1 26 | 27 | #include 28 | #define TESTING_GATL_MODEL_NAMESPACE ga1h 29 | 30 | #define TESTING_VECTOR_SPACE_DIMENSIONS (1 + 1) 31 | 32 | #include "common.hpp" 33 | -------------------------------------------------------------------------------- /cpp/test/usingEigen_assumingHomogeneous2.cpp: -------------------------------------------------------------------------------- 1 | /* Copyright (C) Eduardo Vera Sousa and Leandro Augusto Frata Fernandes 2 | * 3 | * authors : Sousa, Eduardo V. 4 | * Fernandes, Leandro A. F. 5 | * repository : https://github.com/Prograf-UFF/TbGAL 6 | * 7 | * This file is part of the Tensor-based Geometric Algebra Library (TbGAL). 8 | * 9 | * TbGAL is free software: you can redistribute it and/or modify 10 | * it under the terms of the GNU General Public License as published by 11 | * the Free Software Foundation, either version 3 of the License, or 12 | * (at your option) any later version. 13 | * 14 | * TbGAL is distributed in the hope that it will be useful, 15 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 16 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17 | * GNU General Public License for more details. 18 | * 19 | * You should have received a copy of the GNU General Public License 20 | * along with TbGAL. If not, see . 21 | */ 22 | 23 | #include 24 | #include 25 | #define TESTING_TBGAL_MODEL_NAMESPACE tbgal::Homogeneous2 26 | 27 | #include 28 | #define TESTING_GATL_MODEL_NAMESPACE ga2h 29 | 30 | #define TESTING_VECTOR_SPACE_DIMENSIONS (2 + 1) 31 | 32 | #include "common.hpp" 33 | -------------------------------------------------------------------------------- /cpp/test/usingEigen_assumingHomogeneous3.cpp: -------------------------------------------------------------------------------- 1 | /* Copyright (C) Eduardo Vera Sousa and Leandro Augusto Frata Fernandes 2 | * 3 | * authors : Sousa, Eduardo V. 4 | * Fernandes, Leandro A. F. 5 | * repository : https://github.com/Prograf-UFF/TbGAL 6 | * 7 | * This file is part of the Tensor-based Geometric Algebra Library (TbGAL). 8 | * 9 | * TbGAL is free software: you can redistribute it and/or modify 10 | * it under the terms of the GNU General Public License as published by 11 | * the Free Software Foundation, either version 3 of the License, or 12 | * (at your option) any later version. 13 | * 14 | * TbGAL is distributed in the hope that it will be useful, 15 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 16 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17 | * GNU General Public License for more details. 18 | * 19 | * You should have received a copy of the GNU General Public License 20 | * along with TbGAL. If not, see . 21 | */ 22 | 23 | #include 24 | #include 25 | #define TESTING_TBGAL_MODEL_NAMESPACE tbgal::Homogeneous3 26 | 27 | #include 28 | #define TESTING_GATL_MODEL_NAMESPACE ga3h 29 | 30 | #define TESTING_VECTOR_SPACE_DIMENSIONS (3 + 1) 31 | 32 | #include "common.hpp" 33 | -------------------------------------------------------------------------------- /python/example/py2/simple_conformalD.py: -------------------------------------------------------------------------------- 1 | # Copyright (C) Eduardo Vera Sousa and Leandro Augusto Frata Fernandes 2 | # 3 | # authors : Sousa, Eduardo V. 4 | # Fernandes, Leandro A. F. 5 | # repository : https://github.com/Prograf-UFF/TbGAL 6 | # 7 | # This file is part of the Tensor-based Geometric Algebra Library (TbGAL). 8 | # 9 | # TbGAL is free software: you can redistribute it and/or modify 10 | # it under the terms of the GNU General Public License as published by 11 | # the Free Software Foundation, either version 3 of the License, or 12 | # (at your option) any later version. 13 | # 14 | # TbGAL is distributed in the hope that it will be useful, 15 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 16 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17 | # GNU General Public License for more details. 18 | # 19 | # You should have received a copy of the GNU General Public License 20 | # along with TbGAL. If not, see . 21 | 22 | from tbgal.conformalD import * 23 | 24 | space.set_base_space_dimensions(10) 25 | print 'Conformal model of %d-D Euclidean space (n = %d)' % (space.base_space_dimensions(), space.dimensions()) 26 | print '' 27 | 28 | x = euclidean_vector(10, 20, 30, 40 ,50, 60, 70, 80, 90, 100) 29 | x1 = sp(x, e(1)) 30 | x3 = sp(x, e(3)) # We have to use the e(i), no(), and ni() 31 | # functions instead of the ei, no, and ni 32 | Y = x^ni() # constants because the number of dimensions 33 | # of the base space is defined at runtime 34 | print 'x =', x 35 | print 'x1 =', x1 36 | print 'x3 =', x3 37 | print '' 38 | print 'Y =', Y 39 | -------------------------------------------------------------------------------- /python/example/py2/simple_euclidean3.py: -------------------------------------------------------------------------------- 1 | # Copyright (C) Eduardo Vera Sousa and Leandro Augusto Frata Fernandes 2 | # 3 | # authors : Sousa, Eduardo V. 4 | # Fernandes, Leandro A. F. 5 | # repository : https://github.com/Prograf-UFF/TbGAL 6 | # 7 | # This file is part of the Tensor-based Geometric Algebra Library (TbGAL). 8 | # 9 | # TbGAL is free software: you can redistribute it and/or modify 10 | # it under the terms of the GNU General Public License as published by 11 | # the Free Software Foundation, either version 3 of the License, or 12 | # (at your option) any later version. 13 | # 14 | # TbGAL is distributed in the hope that it will be useful, 15 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 16 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17 | # GNU General Public License for more details. 18 | # 19 | # You should have received a copy of the GNU General Public License 20 | # along with TbGAL. If not, see . 21 | 22 | from tbgal.euclidean3 import * 23 | 24 | a = vector(0.5, 0.0, 0.5) # a = 0.5 * (e1 + e3) 25 | 26 | M = 3.0 * (e1^e2) # M = 3.0 * e1^e2 27 | v = dual(M) # v = 3.0 * e3 28 | 29 | b = -v * a * inv(v) # b = 0.5 * (e1 - e3) 30 | 31 | print 'a =', a 32 | print 'M =', M 33 | print 'v =', v 34 | print 'b =', b 35 | -------------------------------------------------------------------------------- /python/example/py2/simple_homogeneous3.py: -------------------------------------------------------------------------------- 1 | # Copyright (C) Eduardo Vera Sousa and Leandro Augusto Frata Fernandes 2 | # 3 | # authors : Sousa, Eduardo V. 4 | # Fernandes, Leandro A. F. 5 | # repository : https://github.com/Prograf-UFF/TbGAL 6 | # 7 | # This file is part of the Tensor-based Geometric Algebra Library (TbGAL). 8 | # 9 | # TbGAL is free software: you can redistribute it and/or modify 10 | # it under the terms of the GNU General Public License as published by 11 | # the Free Software Foundation, either version 3 of the License, or 12 | # (at your option) any later version. 13 | # 14 | # TbGAL is distributed in the hope that it will be useful, 15 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 16 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17 | # GNU General Public License for more details. 18 | # 19 | # You should have received a copy of the GNU General Public License 20 | # along with TbGAL. If not, see . 21 | 22 | from tbgal.homogeneous3 import * 23 | 24 | print '-- Input' 25 | x = float(raw_input('x = ')) 26 | y = float(raw_input('y = ')) 27 | z = float(raw_input('z = ')) 28 | print 29 | 30 | p = point(x, y, z) 31 | d = direction(x, y, z) 32 | l = p ^ d 33 | 34 | print '-- Result' 35 | print 'p =', p 36 | print 'd =', d 37 | print 'l = p ^ d =', l 38 | -------------------------------------------------------------------------------- /python/example/py3/simple_conformalD.py: -------------------------------------------------------------------------------- 1 | # Copyright (C) Eduardo Vera Sousa and Leandro Augusto Frata Fernandes 2 | # 3 | # authors : Sousa, Eduardo V. 4 | # Fernandes, Leandro A. F. 5 | # repository : https://github.com/Prograf-UFF/TbGAL 6 | # 7 | # This file is part of the Tensor-based Geometric Algebra Library (TbGAL). 8 | # 9 | # TbGAL is free software: you can redistribute it and/or modify 10 | # it under the terms of the GNU General Public License as published by 11 | # the Free Software Foundation, either version 3 of the License, or 12 | # (at your option) any later version. 13 | # 14 | # TbGAL is distributed in the hope that it will be useful, 15 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 16 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17 | # GNU General Public License for more details. 18 | # 19 | # You should have received a copy of the GNU General Public License 20 | # along with TbGAL. If not, see . 21 | 22 | from tbgal.conformalD import * 23 | 24 | space.set_base_space_dimensions(10) 25 | print('Conformal model of {}-D Euclidean space (n = {})'.format(space.base_space_dimensions(), space.dimensions())) 26 | print() 27 | 28 | x = euclidean_vector(10, 20, 30, 40 ,50, 60, 70, 80, 90, 100) 29 | x1 = sp(x, e(1)) 30 | x3 = sp(x, e(3)) # We have to use the e(i), no(), and ni() 31 | # functions instead of the ei, no, and ni 32 | Y = x^ni() # constants because the number of dimensions 33 | # of the base space is defined at runtime 34 | print('x =', x) 35 | print('x1 =', x1) 36 | print('x3 =', x3) 37 | print() 38 | print('Y =', Y) 39 | -------------------------------------------------------------------------------- /python/example/py3/simple_euclidean3.py: -------------------------------------------------------------------------------- 1 | # Copyright (C) Eduardo Vera Sousa and Leandro Augusto Frata Fernandes 2 | # 3 | # authors : Sousa, Eduardo V. 4 | # Fernandes, Leandro A. F. 5 | # repository : https://github.com/Prograf-UFF/TbGAL 6 | # 7 | # This file is part of the Tensor-based Geometric Algebra Library (TbGAL). 8 | # 9 | # TbGAL is free software: you can redistribute it and/or modify 10 | # it under the terms of the GNU General Public License as published by 11 | # the Free Software Foundation, either version 3 of the License, or 12 | # (at your option) any later version. 13 | # 14 | # TbGAL is distributed in the hope that it will be useful, 15 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 16 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17 | # GNU General Public License for more details. 18 | # 19 | # You should have received a copy of the GNU General Public License 20 | # along with TbGAL. If not, see . 21 | 22 | from tbgal.euclidean3 import * 23 | 24 | a = vector(0.5, 0.0, 0.5) # a = 0.5 * (e1 + e3) 25 | 26 | M = 3.0 * (e1^e2) # M = 3.0 * e1^e2 27 | v = dual(M) # v = 3.0 * e3 28 | 29 | b = -v * a * inv(v) # b = 0.5 * (e1 - e3) 30 | 31 | print('a =', a) 32 | print('M =', M) 33 | print('v =', v) 34 | print('b =', b) 35 | -------------------------------------------------------------------------------- /python/example/py3/simple_homogeneous3.py: -------------------------------------------------------------------------------- 1 | # Copyright (C) Eduardo Vera Sousa and Leandro Augusto Frata Fernandes 2 | # 3 | # authors : Sousa, Eduardo V. 4 | # Fernandes, Leandro A. F. 5 | # repository : https://github.com/Prograf-UFF/TbGAL 6 | # 7 | # This file is part of the Tensor-based Geometric Algebra Library (TbGAL). 8 | # 9 | # TbGAL is free software: you can redistribute it and/or modify 10 | # it under the terms of the GNU General Public License as published by 11 | # the Free Software Foundation, either version 3 of the License, or 12 | # (at your option) any later version. 13 | # 14 | # TbGAL is distributed in the hope that it will be useful, 15 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 16 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17 | # GNU General Public License for more details. 18 | # 19 | # You should have received a copy of the GNU General Public License 20 | # along with TbGAL. If not, see . 21 | 22 | from tbgal.homogeneous3 import * 23 | 24 | print('-- Input') 25 | x = float(input('x = ')) 26 | y = float(input('y = ')) 27 | z = float(input('z = ')) 28 | print() 29 | 30 | p = point(x, y, z) 31 | d = direction(x, y, z) 32 | l = p ^ d 33 | 34 | print('-- Result') 35 | print('p =', p) 36 | print('d =', d) 37 | print('l = p ^ d =', l) 38 | -------------------------------------------------------------------------------- /python/src/conformal1.cpp: -------------------------------------------------------------------------------- 1 | /* Copyright (C) Eduardo Vera Sousa and Leandro Augusto Frata Fernandes 2 | * 3 | * authors : Sousa, Eduardo V. 4 | * Fernandes, Leandro A. F. 5 | * repository : https://github.com/Prograf-UFF/TbGAL 6 | * 7 | * This file is part of the Tensor-based Geometric Algebra Library (TbGAL). 8 | * 9 | * TbGAL is free software: you can redistribute it and/or modify 10 | * it under the terms of the GNU General Public License as published by 11 | * the Free Software Foundation, either version 3 of the License, or 12 | * (at your option) any later version. 13 | * 14 | * TbGAL is distributed in the hope that it will be useful, 15 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 16 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17 | * GNU General Public License for more details. 18 | * 19 | * You should have received a copy of the GNU General Public License 20 | * along with TbGAL. If not, see . 21 | */ 22 | 23 | #include "../../cpp/include/tbgal/using_Eigen.hpp" 24 | #include "../../cpp/include/tbgal/assuming_Conformal1.hpp" 25 | 26 | #include "common.hpp" 27 | #include "macro_Conformal.hpp" 28 | 29 | BOOST_PYTHON_MODULE(conformal1) { 30 | using namespace tbgal; 31 | using namespace tbgal::Conformal1; 32 | 33 | PY_TBGAL_INITIALIZE(); 34 | 35 | PY_TBGAL_EXPOSE_CORE(MetricSpaceType); 36 | PY_TBGAL_EXPOSE_UTILS(); 37 | 38 | PY_TBGAL_EXPOSE_CONFORMAL_METRIC_SPACE(MetricSpaceType); 39 | PY_TBGAL_EXPOSE_CONFORMAL_UTILS(); 40 | 41 | PY_TBGAL_EXPOSE_GLOBAL_VARIABLE("space", SPACE); 42 | PY_TBGAL_EXPOSE_GLOBAL_VARIABLE("e1", e1); 43 | PY_TBGAL_EXPOSE_GLOBAL_VARIABLE("no", no); 44 | PY_TBGAL_EXPOSE_GLOBAL_VARIABLE("ni", ni); 45 | } 46 | -------------------------------------------------------------------------------- /python/src/conformal2.cpp: -------------------------------------------------------------------------------- 1 | /* Copyright (C) Eduardo Vera Sousa and Leandro Augusto Frata Fernandes 2 | * 3 | * authors : Sousa, Eduardo V. 4 | * Fernandes, Leandro A. F. 5 | * repository : https://github.com/Prograf-UFF/TbGAL 6 | * 7 | * This file is part of the Tensor-based Geometric Algebra Library (TbGAL). 8 | * 9 | * TbGAL is free software: you can redistribute it and/or modify 10 | * it under the terms of the GNU General Public License as published by 11 | * the Free Software Foundation, either version 3 of the License, or 12 | * (at your option) any later version. 13 | * 14 | * TbGAL is distributed in the hope that it will be useful, 15 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 16 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17 | * GNU General Public License for more details. 18 | * 19 | * You should have received a copy of the GNU General Public License 20 | * along with TbGAL. If not, see . 21 | */ 22 | 23 | #include "../../cpp/include/tbgal/using_Eigen.hpp" 24 | #include "../../cpp/include/tbgal/assuming_Conformal2.hpp" 25 | 26 | #include "common.hpp" 27 | #include "macro_Conformal.hpp" 28 | 29 | BOOST_PYTHON_MODULE(conformal2) { 30 | using namespace tbgal; 31 | using namespace tbgal::Conformal2; 32 | 33 | PY_TBGAL_INITIALIZE(); 34 | 35 | PY_TBGAL_EXPOSE_CORE(MetricSpaceType); 36 | PY_TBGAL_EXPOSE_UTILS(); 37 | 38 | PY_TBGAL_EXPOSE_CONFORMAL_METRIC_SPACE(MetricSpaceType); 39 | PY_TBGAL_EXPOSE_CONFORMAL_UTILS(); 40 | 41 | PY_TBGAL_EXPOSE_GLOBAL_VARIABLE("space", SPACE); 42 | PY_TBGAL_EXPOSE_GLOBAL_VARIABLE("e1", e1); 43 | PY_TBGAL_EXPOSE_GLOBAL_VARIABLE("e2", e2); 44 | PY_TBGAL_EXPOSE_GLOBAL_VARIABLE("no", no); 45 | PY_TBGAL_EXPOSE_GLOBAL_VARIABLE("ni", ni); 46 | } 47 | -------------------------------------------------------------------------------- /python/src/conformal3.cpp: -------------------------------------------------------------------------------- 1 | /* Copyright (C) Eduardo Vera Sousa and Leandro Augusto Frata Fernandes 2 | * 3 | * authors : Sousa, Eduardo V. 4 | * Fernandes, Leandro A. F. 5 | * repository : https://github.com/Prograf-UFF/TbGAL 6 | * 7 | * This file is part of the Tensor-based Geometric Algebra Library (TbGAL). 8 | * 9 | * TbGAL is free software: you can redistribute it and/or modify 10 | * it under the terms of the GNU General Public License as published by 11 | * the Free Software Foundation, either version 3 of the License, or 12 | * (at your option) any later version. 13 | * 14 | * TbGAL is distributed in the hope that it will be useful, 15 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 16 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17 | * GNU General Public License for more details. 18 | * 19 | * You should have received a copy of the GNU General Public License 20 | * along with TbGAL. If not, see . 21 | */ 22 | 23 | #include "../../cpp/include/tbgal/using_Eigen.hpp" 24 | #include "../../cpp/include/tbgal/assuming_Conformal3.hpp" 25 | 26 | #include "common.hpp" 27 | #include "macro_Conformal.hpp" 28 | 29 | BOOST_PYTHON_MODULE(conformal3) { 30 | using namespace tbgal; 31 | using namespace tbgal::Conformal3; 32 | 33 | PY_TBGAL_INITIALIZE(); 34 | 35 | PY_TBGAL_EXPOSE_CORE(MetricSpaceType); 36 | PY_TBGAL_EXPOSE_UTILS(); 37 | 38 | PY_TBGAL_EXPOSE_CONFORMAL_METRIC_SPACE(MetricSpaceType); 39 | PY_TBGAL_EXPOSE_CONFORMAL_UTILS(); 40 | 41 | PY_TBGAL_EXPOSE_GLOBAL_VARIABLE("space", SPACE); 42 | PY_TBGAL_EXPOSE_GLOBAL_VARIABLE("e1", e1); 43 | PY_TBGAL_EXPOSE_GLOBAL_VARIABLE("e2", e2); 44 | PY_TBGAL_EXPOSE_GLOBAL_VARIABLE("e3", e3); 45 | PY_TBGAL_EXPOSE_GLOBAL_VARIABLE("no", no); 46 | PY_TBGAL_EXPOSE_GLOBAL_VARIABLE("ni", ni); 47 | } 48 | -------------------------------------------------------------------------------- /python/src/conformalD.cpp: -------------------------------------------------------------------------------- 1 | /* Copyright (C) Eduardo Vera Sousa and Leandro Augusto Frata Fernandes 2 | * 3 | * authors : Sousa, Eduardo V. 4 | * Fernandes, Leandro A. F. 5 | * repository : https://github.com/Prograf-UFF/TbGAL 6 | * 7 | * This file is part of the Tensor-based Geometric Algebra Library (TbGAL). 8 | * 9 | * TbGAL is free software: you can redistribute it and/or modify 10 | * it under the terms of the GNU General Public License as published by 11 | * the Free Software Foundation, either version 3 of the License, or 12 | * (at your option) any later version. 13 | * 14 | * TbGAL is distributed in the hope that it will be useful, 15 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 16 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17 | * GNU General Public License for more details. 18 | * 19 | * You should have received a copy of the GNU General Public License 20 | * along with TbGAL. If not, see . 21 | */ 22 | 23 | #include "../../cpp/include/tbgal/using_Eigen.hpp" 24 | #include "../../cpp/include/tbgal/assuming_ConformalD.hpp" 25 | 26 | #include "common.hpp" 27 | #include "macro_Conformal.hpp" 28 | 29 | BOOST_PYTHON_MODULE(conformalD) { 30 | using namespace tbgal; 31 | using namespace tbgal::ConformalD; 32 | 33 | PY_TBGAL_INITIALIZE(); 34 | 35 | PY_TBGAL_EXPOSE_CORE(MetricSpaceType); 36 | PY_TBGAL_EXPOSE_UTILS(); 37 | 38 | PY_TBGAL_EXPOSE_CONFORMAL_METRIC_SPACE(MetricSpaceType); 39 | PY_TBGAL_EXPOSE_CONFORMAL_UTILS(); 40 | 41 | PY_TBGAL_EXPOSE_GLOBAL_VARIABLE("space", SPACE); 42 | PY_TBGAL_EXPOSE_FUNCTION("no", no); 43 | PY_TBGAL_EXPOSE_FUNCTION("ni", ni); 44 | } 45 | -------------------------------------------------------------------------------- /python/src/euclidean1.cpp: -------------------------------------------------------------------------------- 1 | /* Copyright (C) Eduardo Vera Sousa and Leandro Augusto Frata Fernandes 2 | * 3 | * authors : Sousa, Eduardo V. 4 | * Fernandes, Leandro A. F. 5 | * repository : https://github.com/Prograf-UFF/TbGAL 6 | * 7 | * This file is part of the Tensor-based Geometric Algebra Library (TbGAL). 8 | * 9 | * TbGAL is free software: you can redistribute it and/or modify 10 | * it under the terms of the GNU General Public License as published by 11 | * the Free Software Foundation, either version 3 of the License, or 12 | * (at your option) any later version. 13 | * 14 | * TbGAL is distributed in the hope that it will be useful, 15 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 16 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17 | * GNU General Public License for more details. 18 | * 19 | * You should have received a copy of the GNU General Public License 20 | * along with TbGAL. If not, see . 21 | */ 22 | 23 | #include "../../cpp/include/tbgal/using_Eigen.hpp" 24 | #include "../../cpp/include/tbgal/assuming_Euclidean1.hpp" 25 | 26 | #include "common.hpp" 27 | #include "macro_Euclidean.hpp" 28 | 29 | BOOST_PYTHON_MODULE(euclidean1) { 30 | using namespace tbgal; 31 | using namespace tbgal::Euclidean1; 32 | 33 | PY_TBGAL_INITIALIZE(); 34 | 35 | PY_TBGAL_EXPOSE_CORE(MetricSpaceType); 36 | PY_TBGAL_EXPOSE_UTILS(); 37 | 38 | PY_TBGAL_EXPOSE_EUCLIDEAN_METRIC_SPACE(MetricSpaceType); 39 | PY_TBGAL_EXPOSE_EUCLIDEAN_UTILS(); 40 | 41 | PY_TBGAL_EXPOSE_GLOBAL_VARIABLE("space", SPACE); 42 | PY_TBGAL_EXPOSE_GLOBAL_VARIABLE("e1", e1); 43 | } 44 | -------------------------------------------------------------------------------- /python/src/euclidean2.cpp: -------------------------------------------------------------------------------- 1 | /* Copyright (C) Eduardo Vera Sousa and Leandro Augusto Frata Fernandes 2 | * 3 | * authors : Sousa, Eduardo V. 4 | * Fernandes, Leandro A. F. 5 | * repository : https://github.com/Prograf-UFF/TbGAL 6 | * 7 | * This file is part of the Tensor-based Geometric Algebra Library (TbGAL). 8 | * 9 | * TbGAL is free software: you can redistribute it and/or modify 10 | * it under the terms of the GNU General Public License as published by 11 | * the Free Software Foundation, either version 3 of the License, or 12 | * (at your option) any later version. 13 | * 14 | * TbGAL is distributed in the hope that it will be useful, 15 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 16 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17 | * GNU General Public License for more details. 18 | * 19 | * You should have received a copy of the GNU General Public License 20 | * along with TbGAL. If not, see . 21 | */ 22 | 23 | #include "../../cpp/include/tbgal/using_Eigen.hpp" 24 | #include "../../cpp/include/tbgal/assuming_Euclidean2.hpp" 25 | 26 | #include "common.hpp" 27 | #include "macro_Euclidean.hpp" 28 | 29 | BOOST_PYTHON_MODULE(euclidean2) { 30 | using namespace tbgal; 31 | using namespace tbgal::Euclidean2; 32 | 33 | PY_TBGAL_INITIALIZE(); 34 | 35 | PY_TBGAL_EXPOSE_CORE(MetricSpaceType); 36 | PY_TBGAL_EXPOSE_UTILS(); 37 | 38 | PY_TBGAL_EXPOSE_EUCLIDEAN_METRIC_SPACE(MetricSpaceType); 39 | PY_TBGAL_EXPOSE_EUCLIDEAN_UTILS(); 40 | 41 | PY_TBGAL_EXPOSE_GLOBAL_VARIABLE("space", SPACE); 42 | PY_TBGAL_EXPOSE_GLOBAL_VARIABLE("e1", e1); 43 | PY_TBGAL_EXPOSE_GLOBAL_VARIABLE("e2", e2); 44 | } 45 | -------------------------------------------------------------------------------- /python/src/euclidean3.cpp: -------------------------------------------------------------------------------- 1 | /* Copyright (C) Eduardo Vera Sousa and Leandro Augusto Frata Fernandes 2 | * 3 | * authors : Sousa, Eduardo V. 4 | * Fernandes, Leandro A. F. 5 | * repository : https://github.com/Prograf-UFF/TbGAL 6 | * 7 | * This file is part of the Tensor-based Geometric Algebra Library (TbGAL). 8 | * 9 | * TbGAL is free software: you can redistribute it and/or modify 10 | * it under the terms of the GNU General Public License as published by 11 | * the Free Software Foundation, either version 3 of the License, or 12 | * (at your option) any later version. 13 | * 14 | * TbGAL is distributed in the hope that it will be useful, 15 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 16 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17 | * GNU General Public License for more details. 18 | * 19 | * You should have received a copy of the GNU General Public License 20 | * along with TbGAL. If not, see . 21 | */ 22 | 23 | #include "../../cpp/include/tbgal/using_Eigen.hpp" 24 | #include "../../cpp/include/tbgal/assuming_Euclidean3.hpp" 25 | 26 | #include "common.hpp" 27 | #include "macro_Euclidean.hpp" 28 | 29 | BOOST_PYTHON_MODULE(euclidean3) { 30 | using namespace tbgal; 31 | using namespace tbgal::Euclidean3; 32 | 33 | PY_TBGAL_INITIALIZE(); 34 | 35 | PY_TBGAL_EXPOSE_CORE(MetricSpaceType); 36 | PY_TBGAL_EXPOSE_UTILS(); 37 | 38 | PY_TBGAL_EXPOSE_EUCLIDEAN_METRIC_SPACE(MetricSpaceType); 39 | PY_TBGAL_EXPOSE_EUCLIDEAN_UTILS(); 40 | 41 | PY_TBGAL_EXPOSE_GLOBAL_VARIABLE("space", SPACE); 42 | PY_TBGAL_EXPOSE_GLOBAL_VARIABLE("e1", e1); 43 | PY_TBGAL_EXPOSE_GLOBAL_VARIABLE("e2", e2); 44 | PY_TBGAL_EXPOSE_GLOBAL_VARIABLE("e3", e3); 45 | } 46 | -------------------------------------------------------------------------------- /python/src/euclideanD.cpp: -------------------------------------------------------------------------------- 1 | /* Copyright (C) Eduardo Vera Sousa and Leandro Augusto Frata Fernandes 2 | * 3 | * authors : Sousa, Eduardo V. 4 | * Fernandes, Leandro A. F. 5 | * repository : https://github.com/Prograf-UFF/TbGAL 6 | * 7 | * This file is part of the Tensor-based Geometric Algebra Library (TbGAL). 8 | * 9 | * TbGAL is free software: you can redistribute it and/or modify 10 | * it under the terms of the GNU General Public License as published by 11 | * the Free Software Foundation, either version 3 of the License, or 12 | * (at your option) any later version. 13 | * 14 | * TbGAL is distributed in the hope that it will be useful, 15 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 16 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17 | * GNU General Public License for more details. 18 | * 19 | * You should have received a copy of the GNU General Public License 20 | * along with TbGAL. If not, see . 21 | */ 22 | 23 | #include "../../cpp/include/tbgal/using_Eigen.hpp" 24 | #include "../../cpp/include/tbgal/assuming_EuclideanD.hpp" 25 | 26 | #include "common.hpp" 27 | #include "macro_Euclidean.hpp" 28 | 29 | BOOST_PYTHON_MODULE(euclideanD) { 30 | using namespace tbgal; 31 | using namespace tbgal::EuclideanD; 32 | 33 | PY_TBGAL_INITIALIZE(); 34 | 35 | PY_TBGAL_EXPOSE_CORE(MetricSpaceType); 36 | PY_TBGAL_EXPOSE_UTILS(); 37 | 38 | PY_TBGAL_EXPOSE_EUCLIDEAN_METRIC_SPACE(MetricSpaceType); 39 | PY_TBGAL_EXPOSE_EUCLIDEAN_UTILS(); 40 | 41 | PY_TBGAL_EXPOSE_GLOBAL_VARIABLE("space", SPACE); 42 | } 43 | -------------------------------------------------------------------------------- /python/src/homogeneous1.cpp: -------------------------------------------------------------------------------- 1 | /* Copyright (C) Eduardo Vera Sousa and Leandro Augusto Frata Fernandes 2 | * 3 | * authors : Sousa, Eduardo V. 4 | * Fernandes, Leandro A. F. 5 | * repository : https://github.com/Prograf-UFF/TbGAL 6 | * 7 | * This file is part of the Tensor-based Geometric Algebra Library (TbGAL). 8 | * 9 | * TbGAL is free software: you can redistribute it and/or modify 10 | * it under the terms of the GNU General Public License as published by 11 | * the Free Software Foundation, either version 3 of the License, or 12 | * (at your option) any later version. 13 | * 14 | * TbGAL is distributed in the hope that it will be useful, 15 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 16 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17 | * GNU General Public License for more details. 18 | * 19 | * You should have received a copy of the GNU General Public License 20 | * along with TbGAL. If not, see . 21 | */ 22 | 23 | #include "../../cpp/include/tbgal/using_Eigen.hpp" 24 | #include "../../cpp/include/tbgal/assuming_Homogeneous1.hpp" 25 | 26 | #include "common.hpp" 27 | #include "macro_Homogeneous.hpp" 28 | 29 | BOOST_PYTHON_MODULE(homogeneous1) { 30 | using namespace tbgal; 31 | using namespace tbgal::Homogeneous1; 32 | 33 | PY_TBGAL_INITIALIZE(); 34 | 35 | PY_TBGAL_EXPOSE_CORE(MetricSpaceType); 36 | PY_TBGAL_EXPOSE_UTILS(); 37 | 38 | PY_TBGAL_EXPOSE_HOMOGENEOUS_METRIC_SPACE(MetricSpaceType); 39 | PY_TBGAL_EXPOSE_HOMOGENEOUS_UTILS(); 40 | 41 | PY_TBGAL_EXPOSE_GLOBAL_VARIABLE("space", SPACE); 42 | PY_TBGAL_EXPOSE_GLOBAL_VARIABLE("e1", e1); 43 | PY_TBGAL_EXPOSE_GLOBAL_VARIABLE("ep", ep); 44 | } 45 | -------------------------------------------------------------------------------- /python/src/homogeneous2.cpp: -------------------------------------------------------------------------------- 1 | /* Copyright (C) Eduardo Vera Sousa and Leandro Augusto Frata Fernandes 2 | * 3 | * authors : Sousa, Eduardo V. 4 | * Fernandes, Leandro A. F. 5 | * repository : https://github.com/Prograf-UFF/TbGAL 6 | * 7 | * This file is part of the Tensor-based Geometric Algebra Library (TbGAL). 8 | * 9 | * TbGAL is free software: you can redistribute it and/or modify 10 | * it under the terms of the GNU General Public License as published by 11 | * the Free Software Foundation, either version 3 of the License, or 12 | * (at your option) any later version. 13 | * 14 | * TbGAL is distributed in the hope that it will be useful, 15 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 16 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17 | * GNU General Public License for more details. 18 | * 19 | * You should have received a copy of the GNU General Public License 20 | * along with TbGAL. If not, see . 21 | */ 22 | 23 | #include "../../cpp/include/tbgal/using_Eigen.hpp" 24 | #include "../../cpp/include/tbgal/assuming_Homogeneous2.hpp" 25 | 26 | #include "common.hpp" 27 | #include "macro_Homogeneous.hpp" 28 | 29 | BOOST_PYTHON_MODULE(homogeneous2) { 30 | using namespace tbgal; 31 | using namespace tbgal::Homogeneous2; 32 | 33 | PY_TBGAL_INITIALIZE(); 34 | 35 | PY_TBGAL_EXPOSE_CORE(MetricSpaceType); 36 | PY_TBGAL_EXPOSE_UTILS(); 37 | 38 | PY_TBGAL_EXPOSE_HOMOGENEOUS_METRIC_SPACE(MetricSpaceType); 39 | PY_TBGAL_EXPOSE_HOMOGENEOUS_UTILS(); 40 | 41 | PY_TBGAL_EXPOSE_GLOBAL_VARIABLE("space", SPACE); 42 | PY_TBGAL_EXPOSE_GLOBAL_VARIABLE("e1", e1); 43 | PY_TBGAL_EXPOSE_GLOBAL_VARIABLE("e2", e2); 44 | PY_TBGAL_EXPOSE_GLOBAL_VARIABLE("ep", ep); 45 | } 46 | -------------------------------------------------------------------------------- /python/src/homogeneous3.cpp: -------------------------------------------------------------------------------- 1 | /* Copyright (C) Eduardo Vera Sousa and Leandro Augusto Frata Fernandes 2 | * 3 | * authors : Sousa, Eduardo V. 4 | * Fernandes, Leandro A. F. 5 | * repository : https://github.com/Prograf-UFF/TbGAL 6 | * 7 | * This file is part of the Tensor-based Geometric Algebra Library (TbGAL). 8 | * 9 | * TbGAL is free software: you can redistribute it and/or modify 10 | * it under the terms of the GNU General Public License as published by 11 | * the Free Software Foundation, either version 3 of the License, or 12 | * (at your option) any later version. 13 | * 14 | * TbGAL is distributed in the hope that it will be useful, 15 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 16 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17 | * GNU General Public License for more details. 18 | * 19 | * You should have received a copy of the GNU General Public License 20 | * along with TbGAL. If not, see . 21 | */ 22 | 23 | #include "../../cpp/include/tbgal/using_Eigen.hpp" 24 | #include "../../cpp/include/tbgal/assuming_Homogeneous3.hpp" 25 | 26 | #include "common.hpp" 27 | #include "macro_Homogeneous.hpp" 28 | 29 | BOOST_PYTHON_MODULE(homogeneous3) { 30 | using namespace tbgal; 31 | using namespace tbgal::Homogeneous3; 32 | 33 | PY_TBGAL_INITIALIZE(); 34 | 35 | PY_TBGAL_EXPOSE_CORE(MetricSpaceType); 36 | PY_TBGAL_EXPOSE_UTILS(); 37 | 38 | PY_TBGAL_EXPOSE_HOMOGENEOUS_METRIC_SPACE(MetricSpaceType); 39 | PY_TBGAL_EXPOSE_HOMOGENEOUS_UTILS(); 40 | 41 | PY_TBGAL_EXPOSE_GLOBAL_VARIABLE("space", SPACE); 42 | PY_TBGAL_EXPOSE_GLOBAL_VARIABLE("e1", e1); 43 | PY_TBGAL_EXPOSE_GLOBAL_VARIABLE("e2", e2); 44 | PY_TBGAL_EXPOSE_GLOBAL_VARIABLE("e3", e3); 45 | PY_TBGAL_EXPOSE_GLOBAL_VARIABLE("ep", ep); 46 | } 47 | -------------------------------------------------------------------------------- /python/src/homogeneousD.cpp: -------------------------------------------------------------------------------- 1 | /* Copyright (C) Eduardo Vera Sousa and Leandro Augusto Frata Fernandes 2 | * 3 | * authors : Sousa, Eduardo V. 4 | * Fernandes, Leandro A. F. 5 | * repository : https://github.com/Prograf-UFF/TbGAL 6 | * 7 | * This file is part of the Tensor-based Geometric Algebra Library (TbGAL). 8 | * 9 | * TbGAL is free software: you can redistribute it and/or modify 10 | * it under the terms of the GNU General Public License as published by 11 | * the Free Software Foundation, either version 3 of the License, or 12 | * (at your option) any later version. 13 | * 14 | * TbGAL is distributed in the hope that it will be useful, 15 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 16 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17 | * GNU General Public License for more details. 18 | * 19 | * You should have received a copy of the GNU General Public License 20 | * along with TbGAL. If not, see . 21 | */ 22 | 23 | #include "../../cpp/include/tbgal/using_Eigen.hpp" 24 | #include "../../cpp/include/tbgal/assuming_HomogeneousD.hpp" 25 | 26 | #include "common.hpp" 27 | #include "macro_Homogeneous.hpp" 28 | 29 | BOOST_PYTHON_MODULE(homogeneousD) { 30 | using namespace tbgal; 31 | using namespace tbgal::HomogeneousD; 32 | 33 | PY_TBGAL_INITIALIZE(); 34 | 35 | PY_TBGAL_EXPOSE_CORE(MetricSpaceType); 36 | PY_TBGAL_EXPOSE_UTILS(); 37 | 38 | PY_TBGAL_EXPOSE_HOMOGENEOUS_METRIC_SPACE(MetricSpaceType); 39 | PY_TBGAL_EXPOSE_HOMOGENEOUS_UTILS(); 40 | 41 | PY_TBGAL_EXPOSE_GLOBAL_VARIABLE("space", SPACE); 42 | PY_TBGAL_EXPOSE_FUNCTION("ep", ep); 43 | } 44 | -------------------------------------------------------------------------------- /python/src/macro_Conformal.hpp: -------------------------------------------------------------------------------- 1 | /* Copyright (C) Eduardo Vera Sousa and Leandro Augusto Frata Fernandes 2 | * 3 | * authors : Sousa, Eduardo V. 4 | * Fernandes, Leandro A. F. 5 | * repository : https://github.com/Prograf-UFF/TbGAL 6 | * 7 | * This file is part of the Tensor-based Geometric Algebra Library (TbGAL). 8 | * 9 | * TbGAL is free software: you can redistribute it and/or modify 10 | * it under the terms of the GNU General Public License as published by 11 | * the Free Software Foundation, either version 3 of the License, or 12 | * (at your option) any later version. 13 | * 14 | * TbGAL is distributed in the hope that it will be useful, 15 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 16 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17 | * GNU General Public License for more details. 18 | * 19 | * You should have received a copy of the GNU General Public License 20 | * along with TbGAL. If not, see . 21 | */ 22 | 23 | #ifndef __TBGAL_PYTHON_MACRO_CONFORMAL_HPP__ 24 | #define __TBGAL_PYTHON_MACRO_CONFORMAL_HPP__ 25 | 26 | #define PY_TBGAL_EXPOSE_CONFORMAL_METRIC_SPACE(METRIC_SPACE_TYPE) \ 27 | py::class_("MetricSpace") \ 28 | .def("dimensions", &METRIC_SPACE_TYPE::dimensions) \ 29 | .def("base_space_dimensions", &METRIC_SPACE_TYPE::base_space_dimensions) \ 30 | .def("set_base_space_dimensions", &METRIC_SPACE_TYPE::set_base_space_dimensions, py::args("base_space_dimensions")) 31 | 32 | #define PY_TBGAL_EXPOSE_CONFORMAL_UTILS() \ 33 | py::def("euclidean_vector", py::raw_function(+[](py::tuple const &args, py::dict const &) { return euclidean_vector(tbgal::python::begin(&args), tbgal::python::end(&args)); })); \ 34 | py::def("point", py::raw_function(+[](py::tuple const &args, py::dict const &) { return point(tbgal::python::begin(&args), tbgal::python::end(&args)); })); 35 | 36 | #endif // __TBGAL_PYTHON_MACRO_CONFORMAL_HPP__ 37 | -------------------------------------------------------------------------------- /python/src/macro_Euclidean.hpp: -------------------------------------------------------------------------------- 1 | /* Copyright (C) Eduardo Vera Sousa and Leandro Augusto Frata Fernandes 2 | * 3 | * authors : Sousa, Eduardo V. 4 | * Fernandes, Leandro A. F. 5 | * repository : https://github.com/Prograf-UFF/TbGAL 6 | * 7 | * This file is part of the Tensor-based Geometric Algebra Library (TbGAL). 8 | * 9 | * TbGAL is free software: you can redistribute it and/or modify 10 | * it under the terms of the GNU General Public License as published by 11 | * the Free Software Foundation, either version 3 of the License, or 12 | * (at your option) any later version. 13 | * 14 | * TbGAL is distributed in the hope that it will be useful, 15 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 16 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17 | * GNU General Public License for more details. 18 | * 19 | * You should have received a copy of the GNU General Public License 20 | * along with TbGAL. If not, see . 21 | */ 22 | 23 | #ifndef __TBGAL_PYTHON_MACRO_EUCLIDEAN_HPP__ 24 | #define __TBGAL_PYTHON_MACRO_EUCLIDEAN_HPP__ 25 | 26 | #define PY_TBGAL_EXPOSE_EUCLIDEAN_METRIC_SPACE(METRIC_SPACE_TYPE) \ 27 | py::class_("MetricSpace") \ 28 | .def("dimensions", &METRIC_SPACE_TYPE::dimensions) \ 29 | .def("set_dimensions", &METRIC_SPACE_TYPE::set_dimensions, py::args("dimensions")) 30 | 31 | #define PY_TBGAL_EXPOSE_EUCLIDEAN_UTILS() \ 32 | py::def("euclidean_vector", py::raw_function(+[](py::tuple const &args, py::dict const &) { return euclidean_vector(tbgal::python::begin(&args), tbgal::python::end(&args)); })); 33 | 34 | #endif // __TBGAL_PYTHON_MACRO_EUCLIDEAN_HPP__ 35 | -------------------------------------------------------------------------------- /python/src/macro_Homogeneous.hpp: -------------------------------------------------------------------------------- 1 | /* Copyright (C) Eduardo Vera Sousa and Leandro Augusto Frata Fernandes 2 | * 3 | * authors : Sousa, Eduardo V. 4 | * Fernandes, Leandro A. F. 5 | * repository : https://github.com/Prograf-UFF/TbGAL 6 | * 7 | * This file is part of the Tensor-based Geometric Algebra Library (TbGAL). 8 | * 9 | * TbGAL is free software: you can redistribute it and/or modify 10 | * it under the terms of the GNU General Public License as published by 11 | * the Free Software Foundation, either version 3 of the License, or 12 | * (at your option) any later version. 13 | * 14 | * TbGAL is distributed in the hope that it will be useful, 15 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 16 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17 | * GNU General Public License for more details. 18 | * 19 | * You should have received a copy of the GNU General Public License 20 | * along with TbGAL. If not, see . 21 | */ 22 | 23 | #ifndef __TBGAL_PYTHON_MACRO_HOMOGENEOUS_HPP__ 24 | #define __TBGAL_PYTHON_MACRO_HOMOGENEOUS_HPP__ 25 | 26 | #define PY_TBGAL_EXPOSE_HOMOGENEOUS_METRIC_SPACE(METRIC_SPACE_TYPE) \ 27 | py::class_("MetricSpace") \ 28 | .def("dimensions", &METRIC_SPACE_TYPE::dimensions) \ 29 | .def("base_space_dimensions", &METRIC_SPACE_TYPE::base_space_dimensions) \ 30 | .def("set_base_space_dimensions", &METRIC_SPACE_TYPE::set_base_space_dimensions, py::args("base_space_dimensions")) 31 | 32 | #define PY_TBGAL_EXPOSE_HOMOGENEOUS_UTILS() \ 33 | py::def("direction", py::raw_function(+[](py::tuple const &args, py::dict const &) { return direction(tbgal::python::begin(&args), tbgal::python::end(&args)); })); \ 34 | py::def("euclidean_vector", py::raw_function(+[](py::tuple const &args, py::dict const &) { return euclidean_vector(tbgal::python::begin(&args), tbgal::python::end(&args)); })); \ 35 | py::def("point", py::raw_function(+[](py::tuple const &args, py::dict const &) { return point(tbgal::python::begin(&args), tbgal::python::end(&args)); })); 36 | 37 | #endif // __TBGAL_PYTHON_MACRO_HOMOGENEOUS_HPP__ 38 | -------------------------------------------------------------------------------- /python/src/macro_Minkowski.hpp: -------------------------------------------------------------------------------- 1 | /* Copyright (C) Eduardo Vera Sousa and Leandro Augusto Frata Fernandes 2 | * 3 | * authors : Sousa, Eduardo V. 4 | * Fernandes, Leandro A. F. 5 | * repository : https://github.com/Prograf-UFF/TbGAL 6 | * 7 | * This file is part of the Tensor-based Geometric Algebra Library (TbGAL). 8 | * 9 | * TbGAL is free software: you can redistribute it and/or modify 10 | * it under the terms of the GNU General Public License as published by 11 | * the Free Software Foundation, either version 3 of the License, or 12 | * (at your option) any later version. 13 | * 14 | * TbGAL is distributed in the hope that it will be useful, 15 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 16 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17 | * GNU General Public License for more details. 18 | * 19 | * You should have received a copy of the GNU General Public License 20 | * along with TbGAL. If not, see . 21 | */ 22 | 23 | #ifndef __TBGAL_PYTHON_MACRO_MINKOWSKI_HPP__ 24 | #define __TBGAL_PYTHON_MACRO_MINKOWSKI_HPP__ 25 | 26 | #define PY_TBGAL_EXPOSE_MINKOWSKI_METRIC_SPACE(METRIC_SPACE_TYPE) \ 27 | py::class_("MetricSpace") \ 28 | .def("dimensions", &METRIC_SPACE_TYPE::dimensions) \ 29 | .def("base_space_dimensions", &METRIC_SPACE_TYPE::base_space_dimensions) \ 30 | .def("set_base_space_dimensions", &METRIC_SPACE_TYPE::set_base_space_dimensions, py::args("base_space_dimensions")) 31 | 32 | #define PY_TBGAL_EXPOSE_MINKOWSKI_UTILS() \ 33 | py::def("euclidean_vector", py::raw_function(+[](py::tuple const &args, py::dict const &) { return euclidean_vector(tbgal::python::begin(&args), tbgal::python::end(&args)); })); \ 34 | py::def("point", py::raw_function(+[](py::tuple const &args, py::dict const &) { return point(tbgal::python::begin(&args), tbgal::python::end(&args)); })); 35 | 36 | #endif // __TBGAL_PYTHON_MACRO_MINKOWSKI_HPP__ 37 | -------------------------------------------------------------------------------- /python/src/macro_Signed.hpp: -------------------------------------------------------------------------------- 1 | /* Copyright (C) Eduardo Vera Sousa and Leandro Augusto Frata Fernandes 2 | * 3 | * authors : Sousa, Eduardo V. 4 | * Fernandes, Leandro A. F. 5 | * repository : https://github.com/Prograf-UFF/TbGAL 6 | * 7 | * This file is part of the Tensor-based Geometric Algebra Library (TbGAL). 8 | * 9 | * TbGAL is free software: you can redistribute it and/or modify 10 | * it under the terms of the GNU General Public License as published by 11 | * the Free Software Foundation, either version 3 of the License, or 12 | * (at your option) any later version. 13 | * 14 | * TbGAL is distributed in the hope that it will be useful, 15 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 16 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17 | * GNU General Public License for more details. 18 | * 19 | * You should have received a copy of the GNU General Public License 20 | * along with TbGAL. If not, see . 21 | */ 22 | 23 | #ifndef __TBGAL_PYTHON_MACRO_SIGNED_HPP__ 24 | #define __TBGAL_PYTHON_MACRO_SIGNED_HPP__ 25 | 26 | #define PY_TBGAL_EXPOSE_SIGNED_METRIC_SPACE(METRIC_SPACE_TYPE) \ 27 | py::class_("MetricSpace") \ 28 | .def("dimensions", &METRIC_SPACE_TYPE::dimensions) \ 29 | .def("p_dimensions", &METRIC_SPACE_TYPE::p_dimensions) \ 30 | .def("q_dimensions", &METRIC_SPACE_TYPE::q_dimensions) \ 31 | .def("set_dimensions", &METRIC_SPACE_TYPE::set_dimensions, py::args("p_dimensions", "q_dimensions")) 32 | 33 | #define PY_TBGAL_EXPOSE_SIGNED_UTILS() 34 | 35 | #endif // __TBGAL_PYTHON_MACRO_SIGNED_HPP__ 36 | -------------------------------------------------------------------------------- /python/src/minkowski1.cpp: -------------------------------------------------------------------------------- 1 | /* Copyright (C) Eduardo Vera Sousa and Leandro Augusto Frata Fernandes 2 | * 3 | * authors : Sousa, Eduardo V. 4 | * Fernandes, Leandro A. F. 5 | * repository : https://github.com/Prograf-UFF/TbGAL 6 | * 7 | * This file is part of the Tensor-based Geometric Algebra Library (TbGAL). 8 | * 9 | * TbGAL is free software: you can redistribute it and/or modify 10 | * it under the terms of the GNU General Public License as published by 11 | * the Free Software Foundation, either version 3 of the License, or 12 | * (at your option) any later version. 13 | * 14 | * TbGAL is distributed in the hope that it will be useful, 15 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 16 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17 | * GNU General Public License for more details. 18 | * 19 | * You should have received a copy of the GNU General Public License 20 | * along with TbGAL. If not, see . 21 | */ 22 | 23 | #include "../../cpp/include/tbgal/using_Eigen.hpp" 24 | #include "../../cpp/include/tbgal/assuming_Minkowski1.hpp" 25 | 26 | #include "common.hpp" 27 | #include "macro_Minkowski.hpp" 28 | 29 | BOOST_PYTHON_MODULE(minkowski1) { 30 | using namespace tbgal; 31 | using namespace tbgal::Minkowski1; 32 | 33 | PY_TBGAL_INITIALIZE(); 34 | 35 | PY_TBGAL_EXPOSE_CORE(MetricSpaceType); 36 | PY_TBGAL_EXPOSE_UTILS(); 37 | 38 | PY_TBGAL_EXPOSE_MINKOWSKI_METRIC_SPACE(MetricSpaceType); 39 | PY_TBGAL_EXPOSE_MINKOWSKI_UTILS(); 40 | 41 | PY_TBGAL_EXPOSE_GLOBAL_VARIABLE("space", SPACE); 42 | PY_TBGAL_EXPOSE_GLOBAL_VARIABLE("e1", e1); 43 | PY_TBGAL_EXPOSE_GLOBAL_VARIABLE("ep", ep); 44 | PY_TBGAL_EXPOSE_GLOBAL_VARIABLE("em", em); 45 | } 46 | -------------------------------------------------------------------------------- /python/src/minkowski2.cpp: -------------------------------------------------------------------------------- 1 | /* Copyright (C) Eduardo Vera Sousa and Leandro Augusto Frata Fernandes 2 | * 3 | * authors : Sousa, Eduardo V. 4 | * Fernandes, Leandro A. F. 5 | * repository : https://github.com/Prograf-UFF/TbGAL 6 | * 7 | * This file is part of the Tensor-based Geometric Algebra Library (TbGAL). 8 | * 9 | * TbGAL is free software: you can redistribute it and/or modify 10 | * it under the terms of the GNU General Public License as published by 11 | * the Free Software Foundation, either version 3 of the License, or 12 | * (at your option) any later version. 13 | * 14 | * TbGAL is distributed in the hope that it will be useful, 15 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 16 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17 | * GNU General Public License for more details. 18 | * 19 | * You should have received a copy of the GNU General Public License 20 | * along with TbGAL. If not, see . 21 | */ 22 | 23 | #include "../../cpp/include/tbgal/using_Eigen.hpp" 24 | #include "../../cpp/include/tbgal/assuming_Minkowski2.hpp" 25 | 26 | #include "common.hpp" 27 | #include "macro_Minkowski.hpp" 28 | 29 | BOOST_PYTHON_MODULE(minkowski2) { 30 | using namespace tbgal; 31 | using namespace tbgal::Minkowski2; 32 | 33 | PY_TBGAL_INITIALIZE(); 34 | 35 | PY_TBGAL_EXPOSE_CORE(MetricSpaceType); 36 | PY_TBGAL_EXPOSE_UTILS(); 37 | 38 | PY_TBGAL_EXPOSE_MINKOWSKI_METRIC_SPACE(MetricSpaceType); 39 | PY_TBGAL_EXPOSE_MINKOWSKI_UTILS(); 40 | 41 | PY_TBGAL_EXPOSE_GLOBAL_VARIABLE("space", SPACE); 42 | PY_TBGAL_EXPOSE_GLOBAL_VARIABLE("e1", e1); 43 | PY_TBGAL_EXPOSE_GLOBAL_VARIABLE("e2", e2); 44 | PY_TBGAL_EXPOSE_GLOBAL_VARIABLE("ep", ep); 45 | PY_TBGAL_EXPOSE_GLOBAL_VARIABLE("em", em); 46 | } 47 | -------------------------------------------------------------------------------- /python/src/minkowski3.cpp: -------------------------------------------------------------------------------- 1 | /* Copyright (C) Eduardo Vera Sousa and Leandro Augusto Frata Fernandes 2 | * 3 | * authors : Sousa, Eduardo V. 4 | * Fernandes, Leandro A. F. 5 | * repository : https://github.com/Prograf-UFF/TbGAL 6 | * 7 | * This file is part of the Tensor-based Geometric Algebra Library (TbGAL). 8 | * 9 | * TbGAL is free software: you can redistribute it and/or modify 10 | * it under the terms of the GNU General Public License as published by 11 | * the Free Software Foundation, either version 3 of the License, or 12 | * (at your option) any later version. 13 | * 14 | * TbGAL is distributed in the hope that it will be useful, 15 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 16 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17 | * GNU General Public License for more details. 18 | * 19 | * You should have received a copy of the GNU General Public License 20 | * along with TbGAL. If not, see . 21 | */ 22 | 23 | #include "../../cpp/include/tbgal/using_Eigen.hpp" 24 | #include "../../cpp/include/tbgal/assuming_Minkowski3.hpp" 25 | 26 | #include "common.hpp" 27 | #include "macro_Minkowski.hpp" 28 | 29 | BOOST_PYTHON_MODULE(minkowski3) { 30 | using namespace tbgal; 31 | using namespace tbgal::Minkowski3; 32 | 33 | PY_TBGAL_INITIALIZE(); 34 | 35 | PY_TBGAL_EXPOSE_CORE(MetricSpaceType); 36 | PY_TBGAL_EXPOSE_UTILS(); 37 | 38 | PY_TBGAL_EXPOSE_MINKOWSKI_METRIC_SPACE(MetricSpaceType); 39 | PY_TBGAL_EXPOSE_MINKOWSKI_UTILS(); 40 | 41 | PY_TBGAL_EXPOSE_GLOBAL_VARIABLE("space", SPACE); 42 | PY_TBGAL_EXPOSE_GLOBAL_VARIABLE("e1", e1); 43 | PY_TBGAL_EXPOSE_GLOBAL_VARIABLE("e2", e2); 44 | PY_TBGAL_EXPOSE_GLOBAL_VARIABLE("e3", e3); 45 | PY_TBGAL_EXPOSE_GLOBAL_VARIABLE("ep", ep); 46 | PY_TBGAL_EXPOSE_GLOBAL_VARIABLE("em", em); 47 | } 48 | -------------------------------------------------------------------------------- /python/src/minkowskiD.cpp: -------------------------------------------------------------------------------- 1 | /* Copyright (C) Eduardo Vera Sousa and Leandro Augusto Frata Fernandes 2 | * 3 | * authors : Sousa, Eduardo V. 4 | * Fernandes, Leandro A. F. 5 | * repository : https://github.com/Prograf-UFF/TbGAL 6 | * 7 | * This file is part of the Tensor-based Geometric Algebra Library (TbGAL). 8 | * 9 | * TbGAL is free software: you can redistribute it and/or modify 10 | * it under the terms of the GNU General Public License as published by 11 | * the Free Software Foundation, either version 3 of the License, or 12 | * (at your option) any later version. 13 | * 14 | * TbGAL is distributed in the hope that it will be useful, 15 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 16 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17 | * GNU General Public License for more details. 18 | * 19 | * You should have received a copy of the GNU General Public License 20 | * along with TbGAL. If not, see . 21 | */ 22 | 23 | #include "../../cpp/include/tbgal/using_Eigen.hpp" 24 | #include "../../cpp/include/tbgal/assuming_MinkowskiD.hpp" 25 | 26 | #include "common.hpp" 27 | #include "macro_Minkowski.hpp" 28 | 29 | BOOST_PYTHON_MODULE(minkowskiD) { 30 | using namespace tbgal; 31 | using namespace tbgal::MinkowskiD; 32 | 33 | PY_TBGAL_INITIALIZE(); 34 | 35 | PY_TBGAL_EXPOSE_CORE(MetricSpaceType); 36 | PY_TBGAL_EXPOSE_UTILS(); 37 | 38 | PY_TBGAL_EXPOSE_MINKOWSKI_METRIC_SPACE(MetricSpaceType); 39 | PY_TBGAL_EXPOSE_MINKOWSKI_UTILS(); 40 | 41 | PY_TBGAL_EXPOSE_GLOBAL_VARIABLE("space", SPACE); 42 | PY_TBGAL_EXPOSE_FUNCTION("ep", ep); 43 | PY_TBGAL_EXPOSE_FUNCTION("em", em); 44 | } 45 | -------------------------------------------------------------------------------- /python/src/signedPQ.cpp: -------------------------------------------------------------------------------- 1 | /* Copyright (C) Eduardo Vera Sousa and Leandro Augusto Frata Fernandes 2 | * 3 | * authors : Sousa, Eduardo V. 4 | * Fernandes, Leandro A. F. 5 | * repository : https://github.com/Prograf-UFF/TbGAL 6 | * 7 | * This file is part of the Tensor-based Geometric Algebra Library (TbGAL). 8 | * 9 | * TbGAL is free software: you can redistribute it and/or modify 10 | * it under the terms of the GNU General Public License as published by 11 | * the Free Software Foundation, either version 3 of the License, or 12 | * (at your option) any later version. 13 | * 14 | * TbGAL is distributed in the hope that it will be useful, 15 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 16 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17 | * GNU General Public License for more details. 18 | * 19 | * You should have received a copy of the GNU General Public License 20 | * along with TbGAL. If not, see . 21 | */ 22 | 23 | #include "../../cpp/include/tbgal/using_Eigen.hpp" 24 | #include "../../cpp/include/tbgal/assuming_SignedPQ.hpp" 25 | 26 | #include "common.hpp" 27 | #include "macro_Signed.hpp" 28 | 29 | BOOST_PYTHON_MODULE(signedPQ) { 30 | using namespace tbgal; 31 | using namespace tbgal::SignedPQ; 32 | 33 | PY_TBGAL_INITIALIZE(); 34 | 35 | PY_TBGAL_EXPOSE_CORE(MetricSpaceType); 36 | PY_TBGAL_EXPOSE_UTILS(); 37 | 38 | PY_TBGAL_EXPOSE_SIGNED_METRIC_SPACE(MetricSpaceType); 39 | PY_TBGAL_EXPOSE_SIGNED_UTILS(); 40 | 41 | PY_TBGAL_EXPOSE_GLOBAL_VARIABLE("space", SPACE); 42 | } 43 | --------------------------------------------------------------------------------