diff --git a/.github/workflows/build-linux-wheels.yml b/.github/workflows/build-linux-wheels.yml new file mode 100644 index 00000000..fc805c68 --- /dev/null +++ b/.github/workflows/build-linux-wheels.yml @@ -0,0 +1,60 @@ +name: build-linux-wheels + +on: + push: + branches: [ master ] + +jobs: + build-manylinux-python: + runs-on: ubuntu-latest + strategy: + fail-fast: false + matrix: + python-version: ["cp38-manylinux_x86_64", "cp39-manylinux_x86_64", "cp310-manylinux_x86_64", "cp311-manylinux_x86_64", "cp312-manylinux_x86_64", "cp313-manylinux_x86_64"] + + steps: + - uses: actions/checkout@v4 + + - name: Set up Python (runner) + uses: actions/setup-python@v5 + with: + python-version: '3.12' + + - name: Install build tooling + run: | + python -m pip install --upgrade pip + python -m pip install --upgrade cibuildwheel twine + + - name: Build manylinux wheels with cibuildwheel + env: + # Target CPython versions (align with former matrix) + CIBW_BUILD: ${{ matrix.python-version }} + # CIBW_BUILD: "cp310-manylinux_x86_64" + # Skip PyPy & musllinux for now + CIBW_SKIP: "pp* *musllinux*" + # Install system deps (runs inside manylinux container) + CIBW_BEFORE_ALL_LINUX: >- + yum install -y epel-release && + yum install -y cmake3 libXrandr-devel libXinerama-devel libXcursor-devel libXi-devel mesa-libGLU-devel + # Provide flags similar to prior pip-wheel-args (handled via env; setup.py could be adapted to read these) + EXTRA_CMAKE_DEFINES: "-DUSE_AVX=Off -DCI_BUILD=On" + # Verbosity + CIBW_BUILD_VERBOSITY: "1" + run: | + # If needed, adapt setup.py to consume EXTRA_CMAKE_DEFINES; for now rely on defaults. + python -m cibuildwheel --output-dir wheelhouse + + - name: Upload wheels artifact + uses: actions/upload-artifact@v4 + with: + name: pypbd-${{matrix.python-version}} + path: wheelhouse + if: always() + + - name: Publish wheels to PyPI + if: github.event_name == 'push' && github.ref == 'refs/heads/master' + env: + TWINE_USERNAME: ${{ secrets.PYPI_USERNAME }} + TWINE_PASSWORD: ${{ secrets.PYPI_PASSWORD }} + run: | + twine upload wheelhouse/*-manylinux*.whl --skip-existing diff --git a/.github/workflows/build-linux.yml b/.github/workflows/build-linux.yml new file mode 100644 index 00000000..5d537277 --- /dev/null +++ b/.github/workflows/build-linux.yml @@ -0,0 +1,23 @@ +name: build-linux + +on: + push: + branches: [ master ] + +jobs: + build-ubuntu: + + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v4 + - name: apt-get update + run: sudo apt-get update --fix-missing + - name: Install packages + run: sudo apt-get -y install xorg-dev freeglut3-dev + - name: configure + run: mkdir build-release && cd build-release && cmake -DCMAKE_BUILD_TYPE=Release .. + - name: build + run: cmake --build build-release + + \ No newline at end of file diff --git a/.github/workflows/build-windows-wheels.yml b/.github/workflows/build-windows-wheels.yml new file mode 100644 index 00000000..de0b7bc2 --- /dev/null +++ b/.github/workflows/build-windows-wheels.yml @@ -0,0 +1,55 @@ +name: build-windows-wheels + +on: + push: + branches: [ master ] + +jobs: + # Build the python wheel in parallel + build-windows-wheels: + runs-on: windows-latest + strategy: + fail-fast: false + matrix: + # python-version: [3.7] + python-version: ['cp38-win_amd64', 'cp39-win_amd64', 'cp310-win_amd64', 'cp311-win_amd64', 'cp312-win_amd64', 'cp313-win_amd64'] + + steps: + # Checkout repo + - uses: actions/checkout@v3 + + # Checkout repo + - name: Set up Python (runner) + uses: actions/setup-python@v5 + with: + python-version: '3.12' + + - name: Install build tooling + run: | + python -m pip install --upgrade pip + python -m pip install --upgrade cibuildwheel twine + + - name: Build manylinux wheels with cibuildwheel + env: + EXTRA_CMAKE_DEFINES: "-DUSE_AVX=On" + # Verbosity + CIBW_BUILD_VERBOSITY: "1" + CIBW_BUILD: ${{matrix.python-version}} + run: | + # If needed, adapt setup.py to consume EXTRA_CMAKE_DEFINES; for now rely on defaults. + python -m cibuildwheel --output-dir wheelhouse + + - name: Upload wheels artifact + uses: actions/upload-artifact@v4 + with: + name: pypbd-${{matrix.python-version}} + path: wheelhouse + if: always() + + # Upload wheel to pypi + - name: Upload wheel to pypi + env: + TWINE_USERNAME: ${{ secrets.PYPI_USERNAME }} + TWINE_PASSWORD: ${{ secrets.PYPI_PASSWORD }} + run: | + twine upload wheelhouse/*.whl --skip-existing diff --git a/.github/workflows/build-windows.yml b/.github/workflows/build-windows.yml new file mode 100644 index 00000000..6d6221b1 --- /dev/null +++ b/.github/workflows/build-windows.yml @@ -0,0 +1,31 @@ +name: build-windows + +on: + push: + branches: [ master ] + +jobs: + build-windows: + + runs-on: windows-latest + strategy: + matrix: + python-version: [3.7] + + steps: + # Checkout repo + - uses: actions/checkout@v3 + + # Set up python + - name: Set up Python ${{ matrix.python-version }} + uses: actions/setup-python@v4 + with: + python-version: ${{ matrix.python-version }} + + # Configure, build and test + - name: configure + run: mkdir build-release;cd build-release;cmake .. + shell: pwsh + - name: build + run: cmake --build build-release --config Release + diff --git a/.gitignore b/.gitignore new file mode 100644 index 00000000..fd3c1bb5 --- /dev/null +++ b/.gitignore @@ -0,0 +1,3 @@ +lib/ +bin/ +!bin/*.bat \ No newline at end of file diff --git a/.readthedocs.yaml b/.readthedocs.yaml new file mode 100644 index 00000000..cd33f478 --- /dev/null +++ b/.readthedocs.yaml @@ -0,0 +1,35 @@ +# Read the Docs configuration file for Sphinx projects +# See https://docs.readthedocs.io/en/stable/config-file/v2.html for details + +# Required +version: 2 + +# Set the OS, Python version and other tools you might need +build: + os: ubuntu-22.04 + tools: + python: "3.11" + # You can also specify other tool versions: + # nodejs: "20" + # rust: "1.70" + # golang: "1.20" + +# Build documentation in the "docs/" directory with Sphinx +sphinx: + configuration: doc/conf.py + # You can configure Sphinx to use a different builder, for instance use the dirhtml builder for simpler URLs + # builder: "dirhtml" + # Fail on all warnings to avoid broken references + # fail_on_warning: true + +# Optionally build your docs in additional formats such as PDF and ePub +# formats: +# - pdf +# - epub + +# Optional but recommended, declare the Python requirements required +# to build your documentation +# See https://docs.readthedocs.io/en/stable/guides/reproducible-builds.html +python: + install: + - requirements: doc/requirements.txt \ No newline at end of file diff --git a/CMake/Common.cmake b/CMake/Common.cmake index 35a01c5d..cafe12f5 100644 --- a/CMake/Common.cmake +++ b/CMake/Common.cmake @@ -1,30 +1,88 @@ -set(CMAKE_RUNTIME_OUTPUT_DIRECTORY "${CMAKE_SOURCE_DIR}/bin") +set(CMAKE_RUNTIME_OUTPUT_DIRECTORY "${CMAKE_SOURCE_DIR}/bin" CACHE INTERNAL "Where to place executables and dlls") set(CMAKE_RUNTIME_OUTPUT_DIRECTORY_DEBUG "${CMAKE_SOURCE_DIR}/bin") -set(CMAKE_RUNTIME_OUTPUT_DIRECTORY_RELEASE "${CMAKE_SOURCE_DIR}/bin") +set(CMAKE_RUNTIME_OUTPUT_DIRECTORY_RELEASE "${CMAKE_SOURCE_DIR}/bin" CACHE INTERNAL "Where to place executables and dlls in release mode") set(CMAKE_RUNTIME_OUTPUT_DIRECTORY_RELWITHDEBINFO "${CMAKE_SOURCE_DIR}/bin") set(CMAKE_RUNTIME_OUTPUT_DIRECTORY_MINSIZEREL "${CMAKE_SOURCE_DIR}/bin") -set(LIBRARY_OUTPUT_PATH ${CMAKE_SOURCE_DIR}/lib) +set(LIBRARY_OUTPUT_PATH ${CMAKE_BINARY_DIR}/lib) set(CMAKE_DEBUG_POSTFIX "_d") set(CMAKE_RELWITHDEBINFO_POSTFIX "_rd") set(CMAKE_MINSIZEREL_POSTFIX "_ms") -if (WIN32) +include(CMakeDependentOption) + +cmake_dependent_option(USE_PYTHON_BINDINGS "Generate Python Bindings using PyBind11" ON "PYTHON_EXECUTABLE" OFF) +if (USE_PYTHON_BINDINGS AND UNIX) + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fPIC") + set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fPIC") + message(STATUS "Adding -fPIC option when generating Python bindings using GCC") +endif () + +option(CI_BUILD "Build on CI System" OFF) +mark_as_advanced(CI_BUILD) + +if (NOT WIN32) + if (NOT EXISTS ${CMAKE_BINARY_DIR}/CMakeCache.txt) + if (NOT CMAKE_BUILD_TYPE) + set(CMAKE_BUILD_TYPE "Release" CACHE STRING "" FORCE) + endif() + endif() +endif() + +option(USE_OpenMP "Use OpenMP" ON) +if(USE_OpenMP) + FIND_PACKAGE(OpenMP) + if(OPENMP_FOUND) + if (CMAKE_VERSION VERSION_GREATER "3.8") + link_libraries(OpenMP::OpenMP_CXX) + else() + SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${OpenMP_C_FLAGS}") + SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${OpenMP_CXX_FLAGS}") + endif() + endif() +endif() + +if (MSVC) set(CMAKE_USE_RELATIVE_PATHS "1") - # Set compiler flags for "release" - set(CMAKE_CXX_FLAGS_RELEASE "/MD /Ox /Ob2 /Oi /Ot /GL /D NDEBUG /openmp") - set(CMAKE_EXE_LINKER_FLAGS_RELEASE "/INCREMENTAL:NO /LTCG") - set(CMAKE_SHARED_LINKER_FLAGS_RELEASE "/INCREMENTAL:NO /LTCG") - set(CMAKE_STATIC_LINKER_FLAGS_RELEASE "/INCREMENTAL:NO /LTCG") -endif (WIN32) - -if (UNIX) + # Set compiler flags + set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} /MP /bigobj") + set(CMAKE_CXX_FLAGS_RELEASE "/MD /MP /Ox /Ob2 /Oi /Ot /D NDEBUG") + set(CMAKE_CXX_FLAGS_RELWITHDEBINFO "/MD /Zi /MP /Ox /Ob2 /Oi /Ot /D NDEBUG /bigobj") + set(CMAKE_EXE_LINKER_FLAGS_RELEASE "/INCREMENTAL:NO") + set(CMAKE_SHARED_LINKER_FLAGS_RELEASE "/INCREMENTAL:NO") + set(CMAKE_STATIC_LINKER_FLAGS_RELEASE "/INCREMENTAL:NO") +endif (MSVC) + +if (UNIX OR MINGW) set(CMAKE_USE_RELATIVE_PATHS "1") - # Set compiler flags for "release" - set(CMAKE_CXX_FLAGS_RELEASE "-O3 -DNDEBUG -fopenmp") -endif (UNIX) + set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -D_DEBUG") + # Set compiler flags for "release" Use generic 64 bit instructions when building on CI + if (CI_BUILD) + set(CMAKE_CXX_FLAGS_RELEASE "-O3 -DNDEBUG -march=x86-64") + set(CMAKE_CXX_FLAGS_RELWITHDEBINFO "-O3 -DNDEBUG -march=x86-64") + elseif (CMAKE_SYSTEM_PROCESSOR STREQUAL "arm64") + set(CMAKE_CXX_FLAGS_RELEASE "-O3 -DNDEBUG -mcpu=native") + set(CMAKE_CXX_FLAGS_RELWITHDEBINFO "-O3 -DNDEBUG -mcpu=native") + else() + set(CMAKE_CXX_FLAGS_RELEASE "-O3 -DNDEBUG -march=native") + set(CMAKE_CXX_FLAGS_RELWITHDEBINFO "-O3 -DNDEBUG -march=native") + endif () +endif (UNIX OR MINGW) +if(MINGW) + set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -O1 -Wa,-mbig-obj") +endif(MINGW) if(APPLE) - set(CMAKE_MACOSX_RPATH 1) + set(CMAKE_MACOSX_RPATH 1) + add_definitions(-DGL_SILENCE_DEPRECATION) endif() +set (CMAKE_CXX_STANDARD 11) + +if (MSVC) add_definitions(-D_CRT_SECURE_NO_DEPRECATE) +endif(MSVC) + +OPTION(USE_DOUBLE_PRECISION "Use double precision" ON) +if (USE_DOUBLE_PRECISION) + add_definitions( -DUSE_DOUBLE) +endif (USE_DOUBLE_PRECISION) diff --git a/CMake/DataCopyTargets.cmake b/CMake/DataCopyTargets.cmake new file mode 100644 index 00000000..fecab441 --- /dev/null +++ b/CMake/DataCopyTargets.cmake @@ -0,0 +1,31 @@ +add_custom_target(CopyPBDShaders + ${CMAKE_COMMAND} -E copy_directory + ${PROJECT_SOURCE_DIR}/data/shaders + ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/resources/shaders + COMMENT "Copying PBD shaders" +) +set_target_properties(CopyPBDShaders PROPERTIES FOLDER "Data copy") + +add_custom_target(CopyPBDModels + ${CMAKE_COMMAND} -E copy_directory + ${PROJECT_SOURCE_DIR}/data/models + ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/resources/models + COMMENT "Copying PBD models" +) +set_target_properties(CopyPBDModels PROPERTIES FOLDER "Data copy") + +add_custom_target(CopyPBDScenes + ${CMAKE_COMMAND} -E copy_directory + ${PROJECT_SOURCE_DIR}/data/scenes + ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/resources/scenes + COMMENT "Copying PBD scenes" +) +set_target_properties(CopyPBDScenes PROPERTIES FOLDER "Data copy") + +add_custom_target(CopyImguiFonts + ${CMAKE_COMMAND} -E copy_directory + ${PROJECT_SOURCE_DIR}/extern/imgui/misc/fonts + ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/resources/fonts + COMMENT "Copying fonts" +) +set_target_properties(CopyImguiFonts PROPERTIES FOLDER "Data copy") diff --git a/CMake/FindEigen3.cmake b/CMake/FindEigen3.cmake index 1fccf3ff..8a9d9284 100644 --- a/CMake/FindEigen3.cmake +++ b/CMake/FindEigen3.cmake @@ -63,7 +63,7 @@ else (EIGEN3_INCLUDE_DIR) find_path(EIGEN3_INCLUDE_DIR NAMES signature_of_eigen3_matrix_library PATHS - ${PROJECT_PATH}/extern/eigen + ${PROJECT_SOURCE_DIR}/extern/eigen ${CMAKE_INSTALL_PREFIX}/include ${KDE4_INCLUDE_DIR} PATH_SUFFIXES eigen3 eigen diff --git a/CMake/GetGitRevisionDescription.cmake b/CMake/GetGitRevisionDescription.cmake new file mode 100644 index 00000000..8ab03bc5 --- /dev/null +++ b/CMake/GetGitRevisionDescription.cmake @@ -0,0 +1,168 @@ +# - Returns a version string from Git +# +# These functions force a re-configure on each git commit so that you can +# trust the values of the variables in your build system. +# +# get_git_head_revision( [ ...]) +# +# Returns the refspec and sha hash of the current head revision +# +# git_describe( [ ...]) +# +# Returns the results of git describe on the source tree, and adjusting +# the output so that it tests false if an error occurs. +# +# git_get_exact_tag( [ ...]) +# +# Returns the results of git describe --exact-match on the source tree, +# and adjusting the output so that it tests false if there was no exact +# matching tag. +# +# git_local_changes() +# +# Returns either "CLEAN" or "DIRTY" with respect to uncommitted changes. +# Uses the return code of "git diff-index --quiet HEAD --". +# Does not regard untracked files. +# +# Requires CMake 2.6 or newer (uses the 'function' command) +# +# Original Author: +# 2009-2010 Ryan Pavlik +# http://academic.cleardefinition.com +# Iowa State University HCI Graduate Program/VRAC +# +# Copyright Iowa State University 2009-2010. +# Distributed under the Boost Software License, Version 1.0. +# (See accompanying file LICENSE_1_0.txt or copy at +# http://www.boost.org/LICENSE_1_0.txt) + +if(__get_git_revision_description) + return() +endif() +set(__get_git_revision_description YES) + +# We must run the following at "include" time, not at function call time, +# to find the path to this module rather than the path to a calling list file +get_filename_component(_gitdescmoddir ${CMAKE_CURRENT_LIST_FILE} PATH) + +function(get_git_head_revision _refspecvar _hashvar) + set(GIT_PARENT_DIR "${CMAKE_CURRENT_SOURCE_DIR}") + set(GIT_DIR "${GIT_PARENT_DIR}/.git") + while(NOT EXISTS "${GIT_DIR}") # .git dir not found, search parent directories + set(GIT_PREVIOUS_PARENT "${GIT_PARENT_DIR}") + get_filename_component(GIT_PARENT_DIR ${GIT_PARENT_DIR} PATH) + if(GIT_PARENT_DIR STREQUAL GIT_PREVIOUS_PARENT) + # We have reached the root directory, we are not in git + set(${_refspecvar} "GITDIR-NOTFOUND" PARENT_SCOPE) + set(${_hashvar} "GITDIR-NOTFOUND" PARENT_SCOPE) + return() + endif() + set(GIT_DIR "${GIT_PARENT_DIR}/.git") + endwhile() + # check if this is a submodule + if(NOT IS_DIRECTORY ${GIT_DIR}) + file(READ ${GIT_DIR} submodule) + string(REGEX REPLACE "gitdir: (.*)\n$" "\\1" GIT_DIR_RELATIVE ${submodule}) + get_filename_component(SUBMODULE_DIR ${GIT_DIR} PATH) + get_filename_component(GIT_DIR ${SUBMODULE_DIR}/${GIT_DIR_RELATIVE} ABSOLUTE) + endif() + set(GIT_DATA "${CMAKE_CURRENT_BINARY_DIR}/CMakeFiles/git-data") + if(NOT EXISTS "${GIT_DATA}") + file(MAKE_DIRECTORY "${GIT_DATA}") + endif() + + if(NOT EXISTS "${GIT_DIR}/HEAD") + return() + endif() + set(HEAD_FILE "${GIT_DATA}/HEAD") + configure_file("${GIT_DIR}/HEAD" "${HEAD_FILE}" COPYONLY) + + configure_file("${_gitdescmoddir}/GetGitRevisionDescription.cmake.in" + "${GIT_DATA}/grabRef.cmake" + @ONLY) + include("${GIT_DATA}/grabRef.cmake") + + set(${_refspecvar} "${HEAD_REF}" PARENT_SCOPE) + set(${_hashvar} "${HEAD_HASH}" PARENT_SCOPE) +endfunction() + +function(git_describe _var) + if(NOT GIT_FOUND) + find_package(Git QUIET) + endif() + get_git_head_revision(refspec hash) + if(NOT GIT_FOUND) + set(${_var} "GIT-NOTFOUND" PARENT_SCOPE) + return() + endif() + if(NOT hash) + set(${_var} "HEAD-HASH-NOTFOUND" PARENT_SCOPE) + return() + endif() + + # TODO sanitize + #if((${ARGN}" MATCHES "&&") OR + # (ARGN MATCHES "||") OR + # (ARGN MATCHES "\\;")) + # message("Please report the following error to the project!") + # message(FATAL_ERROR "Looks like someone's doing something nefarious with git_describe! Passed arguments ${ARGN}") + #endif() + + #message(STATUS "Arguments to execute_process: ${ARGN}") + + execute_process(COMMAND + "${GIT_EXECUTABLE}" + describe + ${hash} + ${ARGN} + WORKING_DIRECTORY + "${CMAKE_CURRENT_SOURCE_DIR}" + RESULT_VARIABLE + res + OUTPUT_VARIABLE + out + ERROR_QUIET + OUTPUT_STRIP_TRAILING_WHITESPACE) + if(NOT res EQUAL 0) + set(out "${out}-${res}-NOTFOUND") + endif() + + set(${_var} "${out}" PARENT_SCOPE) +endfunction() + +function(git_get_exact_tag _var) + git_describe(out --exact-match ${ARGN}) + set(${_var} "${out}" PARENT_SCOPE) +endfunction() + +function(git_local_changes _var) + if(NOT GIT_FOUND) + find_package(Git QUIET) + endif() + get_git_head_revision(refspec hash) + if(NOT GIT_FOUND) + set(${_var} "GIT-NOTFOUND" PARENT_SCOPE) + return() + endif() + if(NOT hash) + set(${_var} "HEAD-HASH-NOTFOUND" PARENT_SCOPE) + return() + endif() + + execute_process(COMMAND + "${GIT_EXECUTABLE}" + diff-index --quiet HEAD -- + WORKING_DIRECTORY + "${CMAKE_CURRENT_SOURCE_DIR}" + RESULT_VARIABLE + res + OUTPUT_VARIABLE + out + ERROR_QUIET + OUTPUT_STRIP_TRAILING_WHITESPACE) + if(res EQUAL 0) + set(${_var} "CLEAN" PARENT_SCOPE) + else() + set(${_var} "DIRTY" PARENT_SCOPE) + endif() +endfunction() diff --git a/CMake/GetGitRevisionDescription.cmake.in b/CMake/GetGitRevisionDescription.cmake.in new file mode 100644 index 00000000..6d8b708e --- /dev/null +++ b/CMake/GetGitRevisionDescription.cmake.in @@ -0,0 +1,41 @@ +# +# Internal file for GetGitRevisionDescription.cmake +# +# Requires CMake 2.6 or newer (uses the 'function' command) +# +# Original Author: +# 2009-2010 Ryan Pavlik +# http://academic.cleardefinition.com +# Iowa State University HCI Graduate Program/VRAC +# +# Copyright Iowa State University 2009-2010. +# Distributed under the Boost Software License, Version 1.0. +# (See accompanying file LICENSE_1_0.txt or copy at +# http://www.boost.org/LICENSE_1_0.txt) + +set(HEAD_HASH) + +file(READ "@HEAD_FILE@" HEAD_CONTENTS LIMIT 1024) + +string(STRIP "${HEAD_CONTENTS}" HEAD_CONTENTS) +if(HEAD_CONTENTS MATCHES "ref") + # named branch + string(REPLACE "ref: " "" HEAD_REF "${HEAD_CONTENTS}") + if(EXISTS "@GIT_DIR@/${HEAD_REF}") + configure_file("@GIT_DIR@/${HEAD_REF}" "@GIT_DATA@/head-ref" COPYONLY) + else() + configure_file("@GIT_DIR@/packed-refs" "@GIT_DATA@/packed-refs" COPYONLY) + file(READ "@GIT_DATA@/packed-refs" PACKED_REFS) + if(${PACKED_REFS} MATCHES "([0-9a-z]*) ${HEAD_REF}") + set(HEAD_HASH "${CMAKE_MATCH_1}") + endif() + endif() +else() + # detached HEAD + configure_file("@GIT_DIR@/HEAD" "@GIT_DATA@/head-ref" COPYONLY) +endif() + +if(NOT HEAD_HASH) + file(READ "@GIT_DATA@/head-ref" HEAD_HASH LIMIT 1024) + string(STRIP "${HEAD_HASH}" HEAD_HASH) +endif() diff --git a/CMakeLists.txt b/CMakeLists.txt index c68c8095..5b6fbd00 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,20 +1,109 @@ -cmake_minimum_required(VERSION 2.8) +################################################################################ +# general CMake and project setup +################################################################################ +cmake_minimum_required(VERSION 3.10) project(PositionBasedDynamics) set(PROJECT_PATH ${PROJECT_SOURCE_DIR}) -include_directories(${PROJECT_SOURCE_DIR}) +if (CMAKE_CXX_COMPILER_ID MATCHES "Clang") + add_compile_options(-idirafter${PROJECT_SOURCE_DIR}) +else() + include_directories(${PROJECT_SOURCE_DIR}) +endif() set(CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/CMake" ${CMAKE_MODULE_PATH}) set_property(GLOBAL PROPERTY USE_FOLDERS ON) include(${PROJECT_PATH}/CMake/Common.cmake) -if (WIN32) - subdirs(extern/freeglut extern/AntTweakBar extern/glew Demos PositionBasedDynamics) +if (NOT WIN32) + message(STATUS "Build type: ${CMAKE_BUILD_TYPE}") +endif() + +if (DEFINED PBD_EXTERNALINSTALLDIR) + set(ExternalInstallDir "${PBD_EXTERNALINSTALLDIR}" CACHE INTERNAL "External install directory") +else() + set(ExternalInstallDir "${PROJECT_BINARY_DIR}" CACHE INTERNAL "External install directory") +endif() + +include(ExternalProject) + +## Eigen3 is used by most of the libraries that follow +find_package(Eigen3 REQUIRED) +if (CMAKE_CXX_COMPILER_ID MATCHES "Clang") + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -idirafter${EIGEN3_INCLUDE_DIR}") +endif() + +set(EXT_CMAKE_BUILD_TYPE ${CMAKE_BUILD_TYPE}) +if (NOT ${CMAKE_BUILD_TYPE} STREQUAL "Debug") + set(EXT_CMAKE_BUILD_TYPE "Release") +endif() + +## Discregrid +if ((DEFINED Discregrid_INCLUDE_DIR) AND (DEFINED Discregrid_DEBUG_LIB) AND (DEFINED Discregrid_LIB)) + message(STATUS "Using ${Discregrid_INCLUDE_DIR}") + set(Discregrid_LIBRARIES optimized ${Discregrid_LIB} debug ${Discregrid_DEBUG_LIB}) +else() + ExternalProject_Add( + Ext_Discregrid + PREFIX "${CMAKE_BINARY_DIR}/extern/Discregrid" + GIT_REPOSITORY https://github.com/InteractiveComputerGraphics/Discregrid.git + GIT_TAG "ddf20dc0480874bf02e0bdc6ded76c1f101b17fb" + INSTALL_DIR ${ExternalInstallDir}/Discregrid + CMAKE_ARGS -DCMAKE_BUILD_TYPE:STRING=${EXT_CMAKE_BUILD_TYPE} -DCMAKE_INSTALL_PREFIX:PATH=${ExternalInstallDir}/Discregrid + -DBUILD_CMD_EXECUTABLE:BOOL=0 -DEIGEN3_INCLUDE_DIR:PATH=${EIGEN3_INCLUDE_DIR} -DCMAKE_CXX_FLAGS=${CMAKE_CXX_FLAGS} -DCMAKE_POLICY_VERSION_MINIMUM=3.10 + ) + ExternalProject_Get_Property(Ext_Discregrid INSTALL_DIR) + set(Discregrid_INCLUDE_DIR ${INSTALL_DIR}/include) + set(Discregrid_LIBRARIES optimized ${INSTALL_DIR}/lib/${CMAKE_STATIC_LIBRARY_PREFIX}Discregrid${CMAKE_STATIC_LIBRARY_SUFFIX} + debug ${INSTALL_DIR}/lib/${CMAKE_STATIC_LIBRARY_PREFIX}Discregrid_d${CMAKE_STATIC_LIBRARY_SUFFIX}) + unset(INSTALL_DIR) + message(STATUS "Building ${Discregrid_INCLUDE_DIR}") +endif() + +if (DEFINED GenericParameters_INCLUDE_DIR) + message(STATUS "Using ${GenericParameters_INCLUDE_DIR}") else() - subdirs(extern/AntTweakBar extern/glew Demos PositionBasedDynamics) + ## GenericParameters + ExternalProject_Add( + Ext_GenericParameters + PREFIX "${ExternalInstallDir}/GenericParameters" + GIT_REPOSITORY https://github.com/InteractiveComputerGraphics/GenericParameters.git + GIT_TAG "a4e2744eea526270cfe38b826440d09f66473316" + INSTALL_DIR ${ExternalInstallDir}/GenericParameters + CMAKE_ARGS -DCMAKE_BUILD_TYPE=${EXT_CMAKE_BUILD_TYPE} -DCMAKE_INSTALL_PREFIX:PATH=${ExternalInstallDir}/GenericParameters -DGENERICPARAMETERS_NO_TESTS:BOOL=1 -DCMAKE_POLICY_VERSION_MINIMUM=3.10 + ) + ExternalProject_Get_Property(Ext_GenericParameters INSTALL_DIR) + set(GenericParameters_INCLUDE_DIR ${INSTALL_DIR}/include) + unset(INSTALL_DIR) endif() +add_subdirectory(PositionBasedDynamics) +add_subdirectory(Simulation) +add_subdirectory(Utils) +if (NOT PBD_LIBS_ONLY) + include(DataCopyTargets) + add_subdirectory(extern/glfw) + add_subdirectory(extern/imgui) + add_subdirectory(extern/md5) + add_subdirectory(Demos) + if (USE_PYTHON_BINDINGS) + add_subdirectory(extern/pybind) + add_subdirectory(pyPBD) + endif () +endif() + + +install(DIRECTORY ./Common +DESTINATION include +FILES_MATCHING PATTERN "*.h") + +install(DIRECTORY ./data +DESTINATION include +FILES_MATCHING PATTERN "*.glsl") +install(DIRECTORY ./Demos/Visualization +DESTINATION include +FILES_MATCHING PATTERN "*.h") diff --git a/Changelog.txt b/Changelog.txt index 36002710..67c21b2c 100644 --- a/Changelog.txt +++ b/Changelog.txt @@ -1,3 +1,102 @@ +2.2.2 + - bugfix in TimeStepFluidModel + - updated DiscreGrid + - updated glfw + - updated pybind11 + - support for CMake 4 + +2.2.1 + - bugfix in XPBD FEM code + - updated GenericParameters + - fixed meshes + +2.2.0 + - removed AntTweakBar GUI + - added imgui + - added PLY export + - added documentation of scene file format + +2.1.5 + - updated pybind11 + - cleanup mesh loading code + - added support of PLY files + +2.1.4 + - cleanup some code + - glfw fps limit + +2.1.3 + - fixed compilation on macOS thanks to Robin Rademacher + +2.1.2 + - updated Python examples + - added documentation files + - moved build directory for lib files + - fixed encoding of some source files + - updated numpy version + +2.1.1 + - fixed Python interface for function addFace + +2.1.0 + - added XPBD FEM constraint for deformable solids + - updated to Eigen 3.4.0 + +2.0.1 + - extended and modified Python interface + - more Python examples + - bugfixes + +2.0.0 + - added Python binding + - cleaned up demos + - added XPBD distance constraint + - added XPBD isometric bending constraint + - added XPBD volume constraint + - added glfw + - removed freeglut and glew + - added flat shading + +1.8.0 + - added OBJ export + - added substepping + - updated GenericParameters + - bufixes + - fixed several compiler warnings + - removed MiniBall dependency + - update to Eigen 3.3.7 + +1.7.0 + - added DamperJoint + - improved implementation of SliderJoint + - improved implementation of TargetPositionMotorSliderJoint + - improved implementation of TargetVelocityMotorSliderJoint + - improved implementation of HingeJoint + - improved implementation of TargetAngleMotorHingeJoint + - improved implementation of TargetVelocityMotorHingeJoint + - use XPBD to implement an implicit spring + - added distance joint for rigid bodies + - small optimizations + - fixed single precision build + - cleanup code + - using GenericParameters + - Crispin Deul added the implementation of his paper Deul, Kugelstadt, Weiler, Bender, "Direct Position-Based Solver for Stiff Rods", Computer Graphics Forum 2018 and a corresponding demo + +1.6.0 + - added collision detection for arbitrary meshes based on cubic signed distance fields + - added DiscreGrid library as external project to generate cubic signed distance fields + - added possibility to define motor target sequences in scene files + - added implementation of the paper Kugelstadt, Schoemer, "Position and Orientation Based Cosserat Rods", SCA 2016 and a corresponding demo + - update to Eigen 3.3.4 + +1.5.1 + - added Timing class + - removed Boost dependency + - update to Eigen 3.2.9 + - added support for x86 compilation (thanks to Josef Kohout) + - added implementation of "Position-Based Elastic Rods" paper and a corresponding demo + - fixed some problems with VS2015 + 1.5.0 - added SceneGenerator.py to generate new scenarios easily by simple Python scripting - added scene loader demo diff --git a/Common/Common.h b/Common/Common.h index b1b9a140..425f0233 100644 --- a/Common/Common.h +++ b/Common/Common.h @@ -2,33 +2,68 @@ #define COMMON_H #include +#include -#define USE_DOUBLE +//#define USE_DOUBLE +#define MIN_PARALLEL_SIZE 64 #ifdef USE_DOUBLE typedef double Real; #define REAL_MAX DBL_MAX #define REAL_MIN DBL_MIN +#define RealParameter DoubleParameter +#define RealParameterType ParameterBase::DOUBLE +#define RealVectorParameter DoubleVectorParameter +#define RealVectorParameterType ParameterBase::VEC_DOUBLE #else typedef float Real; #define REAL_MAX FLT_MAX #define REAL_MIN FLT_MIN +#define RealParameter FloatParameter +#define RealParameterType ParameterBase::FLOAT +#define RealVectorParameter FloatVectorParameter +#define RealVectorParameterType ParameterBase::VEC_FLOAT #endif -namespace PBD -{ - using Vector2r = Eigen::Matrix; - using Vector3r = Eigen::Matrix; - using Vector4r = Eigen::Matrix; - using Matrix2r = Eigen::Matrix; - using Matrix3r = Eigen::Matrix; - using Matrix4r = Eigen::Matrix; - using AlignedBox2r = Eigen::AlignedBox; - using AlignedBox3r = Eigen::AlignedBox; - using AngleAxisr = Eigen::AngleAxis; - using Quaternionr = Eigen::Quaternion; -} +using Vector2r = Eigen::Matrix; +using Vector3r = Eigen::Matrix; +using Vector4r = Eigen::Matrix; +using Vector5r = Eigen::Matrix; +using Vector6r = Eigen::Matrix; +using Matrix2r = Eigen::Matrix; +using Matrix3r = Eigen::Matrix; +using Matrix4r = Eigen::Matrix; +using Vector2i = Eigen::Matrix; +using AlignedBox2r = Eigen::AlignedBox; +using AlignedBox3r = Eigen::AlignedBox; +using AngleAxisr = Eigen::AngleAxis; +using Quaternionr = Eigen::Quaternion; +#if defined(WIN32) || defined(_WIN32) || defined(WIN64) + // Enable memory leak detection +#ifdef _DEBUG + #define _CRTDBG_MAP_ALLOC + #include + #include + #define DEBUG_NEW new(_NORMAL_BLOCK, __FILE__, __LINE__) + #define REPORT_MEMORY_LEAKS _CrtSetDbgFlag ( _CRTDBG_ALLOC_MEM_DF | _CRTDBG_LEAK_CHECK_DF ); +#else + #define REPORT_MEMORY_LEAKS +#endif +#else + #define REPORT_MEMORY_LEAKS + #define DEBUG_NEW new #endif + +#endif + + +#if defined(WIN32) || defined(_WIN32) || defined(WIN64) +#define FORCE_INLINE __forceinline +#else +#define FORCE_INLINE __attribute__((always_inline)) +#endif + + diff --git a/Demos/BarDemo/CMakeLists.txt b/Demos/BarDemo/CMakeLists.txt index 55309c62..109a6a8d 100644 --- a/Demos/BarDemo/CMakeLists.txt +++ b/Demos/BarDemo/CMakeLists.txt @@ -1,44 +1,48 @@ -set(SIMULATION_LINK_LIBRARIES AntTweakBar glew PositionBasedDynamics Simulation) -set(SIMULATION_DEPENDENCIES AntTweakBar glew PositionBasedDynamics Simulation) +set(SIMULATION_LINK_LIBRARIES imgui glfw PositionBasedDynamics Simulation Utils) +set(SIMULATION_DEPENDENCIES imgui glfw PositionBasedDynamics Simulation Utils CopyPBDShaders CopyImguiFonts) if(WIN32) - set(SIMULATION_LINK_LIBRARIES freeglut opengl32.lib glu32.lib ${SIMULATION_LINK_LIBRARIES}) - set(SIMULATION_DEPENDENCIES freeglut ${SIMULATION_DEPENDENCIES}) + set(SIMULATION_LINK_LIBRARIES opengl32.lib glu32.lib ${SIMULATION_LINK_LIBRARIES}) + #set(SIMULATION_DEPENDENCIES ${SIMULATION_DEPENDENCIES}) else() - find_package(GLUT REQUIRED) + set(OpenGL_GL_PREFERENCE GLVND) find_package(OpenGL REQUIRED) - + include_directories( ${OPENGL_INCLUDE_DIRS}) + set(SIMULATION_LINK_LIBRARIES ${SIMULATION_LINK_LIBRARIES} - ${GLUT_LIBRARIES} ${OPENGL_LIBRARIES} ) endif() +############################################################ +# GenericParameters +############################################################ +include_directories(${GenericParameters_INCLUDE_DIR}) +if(TARGET Ext_GenericParameters) + set(SIMULATION_DEPENDENCIES ${SIMULATION_DEPENDENCIES} Ext_GenericParameters) +endif() + add_executable(BarDemo main.cpp + + ../Common/LogWindow.cpp + ../Common/LogWindow.h + ../Common/Simulator_GUI_imgui.cpp + ../Common/Simulator_GUI_imgui.h + ../Common/imguiParameters.cpp + ../Common/imguiParameters.h + ../Common/DemoBase.cpp + ../Common/DemoBase.h ${VIS_FILES} ${PROJECT_PATH}/Common/Common.h - ${PROJECT_PATH}/Demos/Common/Config.h - ${PROJECT_PATH}/Demos/Utils/IndexedFaceMesh.cpp - ${PROJECT_PATH}/Demos/Utils/IndexedFaceMesh.h - ${PROJECT_PATH}/Demos/Utils/IndexedTetMesh.cpp - ${PROJECT_PATH}/Demos/Utils/IndexedTetMesh.h - ${PROJECT_PATH}/Demos/Utils/Utilities.cpp - ${PROJECT_PATH}/Demos/Utils/Utilities.h - ${PROJECT_PATH}/Demos/Utils/VolumeIntegration.cpp - ${PROJECT_PATH}/Demos/Utils/VolumeIntegration.h CMakeLists.txt ) -add_definitions(-DTW_NO_LIB_PRAGMA -DTW_STATIC) - find_package( Eigen3 REQUIRED ) include_directories( ${EIGEN3_INCLUDE_DIR} ) -include_directories(${PROJECT_PATH}/extern/freeglut/include) -include_directories(${PROJECT_PATH}/extern/glew/include) set_target_properties(BarDemo PROPERTIES FOLDER "Demos") set_target_properties(BarDemo PROPERTIES DEBUG_POSTFIX ${CMAKE_DEBUG_POSTFIX}) diff --git a/Demos/BarDemo/main.cpp b/Demos/BarDemo/main.cpp index 07446cc4..a5ff1c73 100644 --- a/Demos/BarDemo/main.cpp +++ b/Demos/BarDemo/main.cpp @@ -1,306 +1,139 @@ -#include "Demos/Common/Config.h" +#include "Common/Common.h" #include "Demos/Visualization/MiniGL.h" #include "Demos/Visualization/Selection.h" -#include "GL/glut.h" -#include "Demos/Simulation/TimeManager.h" +#include "Simulation/TimeManager.h" #include -#include "Demos/Simulation/SimulationModel.h" -#include "Demos/Simulation/TimeStepController.h" +#include "Simulation/SimulationModel.h" +#include "Simulation/TimeStepController.h" #include #include "Demos/Visualization/Visualization.h" -#include "Demos/Utils/Utilities.h" +#include "Utils/Logger.h" +#include "Utils/Timing.h" +#include "Utils/FileSystem.h" +#include "Demos/Common/DemoBase.h" +#include "Simulation/Simulation.h" + // Enable memory leak detection -#ifdef _DEBUG +#if defined(_DEBUG) && !defined(EIGEN_ALIGN) #define new DEBUG_NEW #endif using namespace PBD; using namespace Eigen; using namespace std; +using namespace Utilities; void timeStep (); void buildModel (); void createMesh(); void render (); -void cleanup(); void reset(); -void initShader(); -void selection(const Eigen::Vector2i &start, const Eigen::Vector2i &end); -void TW_CALL setTimeStep(const void *value, void *clientData); -void TW_CALL getTimeStep(void *value, void *clientData); -void TW_CALL setStiffness(const void *value, void *clientData); -void TW_CALL getStiffness(void *value, void *clientData); -void TW_CALL setPoissonRatio(const void *value, void *clientData); -void TW_CALL getPoissonRatio(void *value, void *clientData); -void TW_CALL setNormalizeStretch(const void *value, void *clientData); -void TW_CALL getNormalizeStretch(void *value, void *clientData); -void TW_CALL setNormalizeShear(const void *value, void *clientData); -void TW_CALL getNormalizeShear(void *value, void *clientData); -void TW_CALL setSimulationMethod(const void *value, void *clientData); -void TW_CALL getSimulationMethod(void *value, void *clientData); -void TW_CALL setVelocityUpdateMethod(const void *value, void *clientData); -void TW_CALL getVelocityUpdateMethod(void *value, void *clientData); - -SimulationModel model; -TimeStepController sim; + +DemoBase *base; const unsigned int width = 30; const unsigned int depth = 5; const unsigned int height = 5; -short simulationMethod = 2; -bool doPause = true; -std::vector selectedParticles; -Vector3r oldMousePos; -Shader *shader; -string exePath; -string dataPath; + // main int main( int argc, char **argv ) { REPORT_MEMORY_LEAKS - exePath = Utilities::getFilePath(argv[0]); - dataPath = exePath + "/" + std::string(PBD_DATA_PATH); + base = new DemoBase(); + base->init(argc, argv, "Bar demo"); - // OpenGL - MiniGL::init (argc, argv, 1024, 768, 0, 0, "Bar demo"); - MiniGL::initLights (); - MiniGL::initTexture(); - MiniGL::setClientIdleFunc (50, timeStep); - MiniGL::setKeyFunc(0, 'r', reset); - MiniGL::setSelectionFunc(selection); - initShader(); + SimulationModel *model = new SimulationModel(); + model->init(); + Simulation::getCurrent()->setModel(model); + + buildModel(); + + base->createParameterGUI(); - buildModel (); + // reset simulation when solid simulation method has changed + model->setSolidSimulationMethodChangedCallback([&]() { reset(); }); + // OpenGL + MiniGL::setClientIdleFunc (timeStep); + MiniGL::addKeyFunc('r', reset); MiniGL::setClientSceneFunc(render); MiniGL::setViewport (40.0f, 0.1f, 500.0f, Vector3r (5.0, 10.0, 30.0), Vector3r (5.0, 0.0, 0.0)); + MiniGL::mainLoop(); + base->cleanup(); - TwAddVarRW(MiniGL::getTweakBar(), "Pause", TW_TYPE_BOOLCPP, &doPause, " label='Pause' group=Simulation key=SPACE "); - TwAddVarCB(MiniGL::getTweakBar(), "TimeStepSize", TW_TYPE_REAL, setTimeStep, getTimeStep, &model, " label='Time step size' min=0.0 max = 0.1 step=0.001 precision=4 group=Simulation "); - TwType enumType = TwDefineEnum("VelocityUpdateMethodType", NULL, 0); - TwAddVarCB(MiniGL::getTweakBar(), "VelocityUpdateMethod", enumType, setVelocityUpdateMethod, getVelocityUpdateMethod, &sim, " label='Velocity update method' enum='0 {First Order Update}, 1 {Second Order Update}' group=Simulation"); - TwType enumType2 = TwDefineEnum("SimulationMethodType", NULL, 0); - TwAddVarCB(MiniGL::getTweakBar(), "SimulationMethod", enumType2, setSimulationMethod, getSimulationMethod, &simulationMethod, - " label='Simulation method' enum='0 {None}, 1 {Volume constraints}, 2 {FEM based PBD}, 3 {Strain based dynamics (no inversion handling)}, 4 {Shape matching (no inversion handling)}' group=Simulation"); - TwAddVarCB(MiniGL::getTweakBar(), "Stiffness", TW_TYPE_REAL, setStiffness, getStiffness, &model, " label='Stiffness' min=0.0 step=0.1 precision=4 group='Simulation' "); - TwAddVarCB(MiniGL::getTweakBar(), "PoissonRatio", TW_TYPE_REAL, setPoissonRatio, getPoissonRatio, &model, " label='Poisson ratio XY' min=0.0 step=0.1 precision=4 group='Simulation' "); - TwAddVarCB(MiniGL::getTweakBar(), "NormalizeStretch", TW_TYPE_BOOL32, setNormalizeStretch, getNormalizeStretch, &model, " label='Normalize stretch' group='Strain based dynamics' "); - TwAddVarCB(MiniGL::getTweakBar(), "NormalizeShear", TW_TYPE_BOOL32, setNormalizeShear, getNormalizeShear, &model, " label='Normalize shear' group='Strain based dynamics' "); - - glutMainLoop (); + Utilities::Timing::printAverageTimes(); + Utilities::Timing::printTimeSums(); - cleanup (); + delete Simulation::getCurrent(); + delete base; + delete model; return 0; } -void initShader() -{ - std::string vertFile = dataPath + "/shaders/vs_smooth.glsl"; - std::string fragFile = dataPath + "/shaders/fs_smooth.glsl"; - shader = MiniGL::createShader(vertFile, "", fragFile); - - if (shader == NULL) - return; - - shader->begin(); - shader->addUniform("modelview_matrix"); - shader->addUniform("projection_matrix"); - shader->addUniform("surface_color"); - shader->addUniform("shininess"); - shader->addUniform("specular_factor"); - shader->end(); -} - -void cleanup() -{ - delete TimeManager::getCurrent(); - delete shader; -} - void reset() { - model.reset(); - sim.reset(); - TimeManager::getCurrent()->setTime(0.0); + Utilities::Timing::printAverageTimes(); + Utilities::Timing::reset(); - model.cleanup(); + Simulation::getCurrent()->reset(); + base->getSelectedParticles().clear(); + + Simulation::getCurrent()->getModel()->cleanup(); buildModel(); } -void mouseMove(int x, int y) -{ - Vector3r mousePos; - MiniGL::unproject(x, y, mousePos); - const Vector3r diff = mousePos - oldMousePos; - - TimeManager *tm = TimeManager::getCurrent(); - const Real h = tm->getTimeStepSize(); - - ParticleData &pd = model.getParticles(); - for (unsigned int j = 0; j < selectedParticles.size(); j++) - { - pd.getVelocity(selectedParticles[j]) += 5.0*diff/h; - } - oldMousePos = mousePos; -} - -void selection(const Eigen::Vector2i &start, const Eigen::Vector2i &end) -{ - std::vector hits; - selectedParticles.clear(); - ParticleData &pd = model.getParticles(); - Selection::selectRect(start, end, &pd.getPosition(0), &pd.getPosition(pd.size() - 1), selectedParticles); - if (selectedParticles.size() > 0) - MiniGL::setMouseMoveFunc(GLUT_MIDDLE_BUTTON, mouseMove); - else - MiniGL::setMouseMoveFunc(-1, NULL); - - MiniGL::unproject(end[0], end[1], oldMousePos); -} - void timeStep () { - if (doPause) + const Real pauseAt = base->getValue(DemoBase::PAUSE_AT); + if ((pauseAt > 0.0) && (pauseAt < TimeManager::getCurrent()->getTime())) + base->setValue(DemoBase::PAUSE, true); + + if (base->getValue(DemoBase::PAUSE)) return; // Simulation code - for (unsigned int i = 0; i < 8; i++) - sim.step(model); + SimulationModel *model = Simulation::getCurrent()->getModel(); + const unsigned int numSteps = base->getValue(DemoBase::NUM_STEPS_PER_RENDER); + for (unsigned int i = 0; i < numSteps; i++) + { + START_TIMING("SimStep"); + Simulation::getCurrent()->getTimeStep()->step(*model); + STOP_TIMING_AVG; - for (unsigned int i = 0; i < model.getTetModels().size(); i++) + base->step(); + } + + for (unsigned int i = 0; i < model->getTetModels().size(); i++) { - model.getTetModels()[i]->updateMeshNormals(model.getParticles()); + model->getTetModels()[i]->updateMeshNormals(model->getParticles()); } } void buildModel () { - TimeManager::getCurrent ()->setTimeStepSize (0.005); + TimeManager::getCurrent ()->setTimeStepSize (static_cast(0.005)); createMesh(); } -void renderTetModels() -{ - // Draw simulation model - - const ParticleData &pd = model.getParticles(); - float surfaceColor[4] = { 0.2f, 0.5f, 1.0f, 1 }; - - if (shader) - { - shader->begin(); - glUniform3fv(shader->getUniform("surface_color"), 1, surfaceColor); - glUniform1f(shader->getUniform("shininess"), 5.0f); - glUniform1f(shader->getUniform("specular_factor"), 0.2f); - - GLfloat matrix[16]; - glGetFloatv(GL_MODELVIEW_MATRIX, matrix); - glUniformMatrix4fv(shader->getUniform("modelview_matrix"), 1, GL_FALSE, matrix); - GLfloat pmatrix[16]; - glGetFloatv(GL_PROJECTION_MATRIX, pmatrix); - glUniformMatrix4fv(shader->getUniform("projection_matrix"), 1, GL_FALSE, pmatrix); - } - - for (unsigned int i = 0; i < model.getTetModels().size(); i++) - { - TetModel *tetModel = model.getTetModels()[i]; - const IndexedFaceMesh &surfaceMesh = tetModel->getSurfaceMesh(); - Visualization::drawMesh(pd, surfaceMesh, tetModel->getIndexOffset(), surfaceColor); - } - if (shader) - shader->end(); -} - void render () { - MiniGL::coordinateSystem(); - - // Draw simulation model - renderTetModels(); - - float red[4] = { 0.8f, 0.0f, 0.0f, 1 }; - const ParticleData &pd = model.getParticles(); - for (unsigned int j = 0; j < selectedParticles.size(); j++) - { - MiniGL::drawSphere(pd.getPosition(selectedParticles[j]), 0.08f, red); - } - - MiniGL::drawTime( TimeManager::getCurrent ()->getTime ()); + base->render(); } void createMesh() { - Vector3r points[width*height*depth]; - for (unsigned int i = 0; i < width; i++) - { - for (unsigned int j = 0; j < height; j++) - { - for (unsigned int k = 0; k < depth; k++) - { - points[i*height*depth + j*depth + k] = 0.3*Vector3r((Real)i, (Real)j, (Real)k); - } - } - } + SimulationModel* model = Simulation::getCurrent()->getModel(); + model->addRegularTetModel(width, height, depth, + Vector3r(5, 0, 0), Matrix3r::Identity(), Vector3r(10.0, 1.5, 1.5)); - vector indices; - for (unsigned int i = 0; i < width - 1; i++) - { - for (unsigned int j = 0; j < height - 1; j++) - { - for (unsigned int k = 0; k < depth - 1; k++) - { - // For each block, the 8 corners are numerated as: - // 4*-----*7 - // /| /| - // / | / | - // 5*-----*6 | - // | 0*--|--*3 - // | / | / - // |/ |/ - // 1*-----*2 - unsigned int p0 = i*height*depth + j*depth + k; - unsigned int p1 = p0 + 1; - unsigned int p3 = (i + 1)*height*depth + j*depth + k; - unsigned int p2 = p3 + 1; - unsigned int p7 = (i + 1)*height*depth + (j + 1)*depth + k; - unsigned int p6 = p7 + 1; - unsigned int p4 = i*height*depth + (j + 1)*depth + k; - unsigned int p5 = p4 + 1; - - // Ensure that neighboring tetras are sharing faces - if ((i + j + k) % 2 == 1) - { - indices.push_back(p2); indices.push_back(p1); indices.push_back(p6); indices.push_back(p3); - indices.push_back(p6); indices.push_back(p3); indices.push_back(p4); indices.push_back(p7); - indices.push_back(p4); indices.push_back(p1); indices.push_back(p6); indices.push_back(p5); - indices.push_back(p3); indices.push_back(p1); indices.push_back(p4); indices.push_back(p0); - indices.push_back(p6); indices.push_back(p1); indices.push_back(p4); indices.push_back(p3); - } - else - { - indices.push_back(p0); indices.push_back(p2); indices.push_back(p5); indices.push_back(p1); - indices.push_back(p7); indices.push_back(p2); indices.push_back(p0); indices.push_back(p3); - indices.push_back(p5); indices.push_back(p2); indices.push_back(p7); indices.push_back(p6); - indices.push_back(p7); indices.push_back(p0); indices.push_back(p5); indices.push_back(p4); - indices.push_back(p0); indices.push_back(p2); indices.push_back(p7); indices.push_back(p5); - } - } - } - } - model.addTetModel(width*height*depth, (unsigned int)indices.size() / 4u, points, indices.data()); - - ParticleData &pd = model.getParticles(); - for (unsigned int i = 0; i < pd.getNumberOfParticles(); i++) - { - pd.setMass(i, 1.0); - } + ParticleData& pd = model->getParticles(); for (unsigned int i = 0; i < 1; i++) { for (unsigned int j = 0; j < height; j++) @@ -311,154 +144,24 @@ void createMesh() } // init constraints - for (unsigned int cm = 0; cm < model.getTetModels().size(); cm++) + model->setSolidStiffness(1.0); + if (model->getSolidSimulationMethod() == 3) + model->setSolidStiffness(1000000); + if (model->getSolidSimulationMethod() == 6) + model->setSolidStiffness(100000); + + model->setSolidVolumeStiffness(1.0); + if (model->getSolidSimulationMethod() == 6) + model->setSolidVolumeStiffness(100000); + for (unsigned int cm = 0; cm < model->getTetModels().size(); cm++) { - const unsigned int nTets = model.getTetModels()[cm]->getParticleMesh().numTets(); - const unsigned int *tets = model.getTetModels()[cm]->getParticleMesh().getTets().data(); - const IndexedTetMesh::VertexTets *vTets = model.getTetModels()[cm]->getParticleMesh().getVertexTets().data(); - if (simulationMethod == 1) - { - const unsigned int offset = model.getTetModels()[cm]->getIndexOffset(); - const unsigned int nEdges = model.getTetModels()[cm]->getParticleMesh().numEdges(); - const IndexedTetMesh::Edge *edges = model.getTetModels()[cm]->getParticleMesh().getEdges().data(); - for (unsigned int i = 0; i < nEdges; i++) - { - const unsigned int v1 = edges[i].m_vert[0] + offset; - const unsigned int v2 = edges[i].m_vert[1] + offset; - - model.addDistanceConstraint(v1, v2); - } - - for (unsigned int i = 0; i < nTets; i++) - { - const unsigned int v1 = tets[4 * i]; - const unsigned int v2 = tets[4 * i + 1]; - const unsigned int v3 = tets[4 * i + 2]; - const unsigned int v4 = tets[4 * i + 3]; - - model.addVolumeConstraint(v1, v2, v3, v4); - } - } - else if (simulationMethod == 2) - { - TetModel::ParticleMesh &mesh = model.getTetModels()[cm]->getParticleMesh(); - for (unsigned int i = 0; i < nTets; i++) - { - const unsigned int v1 = tets[4 * i]; - const unsigned int v2 = tets[4 * i + 1]; - const unsigned int v3 = tets[4 * i + 2]; - const unsigned int v4 = tets[4 * i + 3]; - - model.addFEMTetConstraint(v1, v2, v3, v4); - } - } - else if (simulationMethod == 3) - { - TetModel::ParticleMesh &mesh = model.getTetModels()[cm]->getParticleMesh(); - for (unsigned int i = 0; i < nTets; i++) - { - const unsigned int v1 = tets[4 * i]; - const unsigned int v2 = tets[4 * i + 1]; - const unsigned int v3 = tets[4 * i + 2]; - const unsigned int v4 = tets[4 * i + 3]; - - model.addStrainTetConstraint(v1, v2, v3, v4); - } - } - else if (simulationMethod == 4) - { - TetModel::ParticleMesh &mesh = model.getTetModels()[cm]->getParticleMesh(); - for (unsigned int i = 0; i < nTets; i++) - { - const unsigned int v[4] = { tets[4 * i], tets[4 * i + 1], tets[4 * i + 2], tets[4 * i + 3] }; - // Important: Divide position correction by the number of clusters - // which contain the vertex. - const unsigned int nc[4] = { vTets[v[0]].m_numTets, vTets[v[1]].m_numTets, vTets[v[2]].m_numTets, vTets[v[3]].m_numTets }; - model.addShapeMatchingConstraint(4, v, nc); - } - } - model.getTetModels()[cm]->updateMeshNormals(pd); - } - - std::cout << "Number of tets: " << indices.size() / 4 << "\n"; - std::cout << "Number of vertices: " << width*height*depth << "\n"; + model->addSolidConstraints(model->getTetModels()[cm], model->getSolidSimulationMethod(), model->getSolidStiffness(), + model->getSolidPoissonRatio(), model->getSolidVolumeStiffness(), model->getSolidNormalizeStretch(), model->getSolidNormalizeShear()); -} + model->getTetModels()[cm]->updateMeshNormals(pd); -void TW_CALL setTimeStep(const void *value, void *clientData) -{ - const Real val = *(const Real *)(value); - TimeManager::getCurrent()->setTimeStepSize(val); -} - -void TW_CALL getTimeStep(void *value, void *clientData) -{ - *(Real *)(value) = TimeManager::getCurrent()->getTimeStepSize(); -} - -void TW_CALL setStiffness(const void *value, void *clientData) -{ - const Real val = *(const Real *)(value); - ((SimulationModel*) clientData)->setSolidStiffness(val); -} - -void TW_CALL getStiffness(void *value, void *clientData) -{ - *(Real *)(value) = ((SimulationModel*)clientData)->getSolidStiffness(); -} - -void TW_CALL setPoissonRatio(const void *value, void *clientData) -{ - const Real val = *(const Real *)(value); - ((SimulationModel*)clientData)->setSolidPoissonRatio(val); -} - -void TW_CALL getPoissonRatio(void *value, void *clientData) -{ - *(Real *)(value) = ((SimulationModel*)clientData)->getSolidPoissonRatio(); -} - -void TW_CALL setNormalizeStretch(const void *value, void *clientData) -{ - const bool val = *(const bool *)(value); - ((SimulationModel*)clientData)->setSolidNormalizeStretch(val); -} - -void TW_CALL getNormalizeStretch(void *value, void *clientData) -{ - *(bool *)(value) = ((SimulationModel*)clientData)->getSolidNormalizeStretch(); -} - -void TW_CALL setNormalizeShear(const void *value, void *clientData) -{ - const bool val = *(const bool *)(value); - ((SimulationModel*)clientData)->setSolidNormalizeShear(val); -} - -void TW_CALL getNormalizeShear(void *value, void *clientData) -{ - *(bool *)(value) = ((SimulationModel*)clientData)->getSolidNormalizeShear(); -} - -void TW_CALL setSimulationMethod(const void *value, void *clientData) -{ - const short val = *(const short *)(value); - *((short*)clientData) = val; - reset(); -} - -void TW_CALL getSimulationMethod(void *value, void *clientData) -{ - *(short *)(value) = *((short*)clientData); -} - -void TW_CALL setVelocityUpdateMethod(const void *value, void *clientData) -{ - const short val = *(const short *)(value); - ((TimeStepController*)clientData)->setVelocityUpdateMethod((unsigned int)val); + LOG_INFO << "Number of tets: " << model->getTetModels()[cm]->getParticleMesh().numTets(); + LOG_INFO << "Number of vertices: " << width * height * depth; + } } -void TW_CALL getVelocityUpdateMethod(void *value, void *clientData) -{ - *(short *)(value) = (short)((TimeStepController*)clientData)->getVelocityUpdateMethod(); -} \ No newline at end of file diff --git a/Demos/CMakeLists.txt b/Demos/CMakeLists.txt index 09ef419f..0ffaa501 100644 --- a/Demos/CMakeLists.txt +++ b/Demos/CMakeLists.txt @@ -1,5 +1,30 @@ include(Visualization/CMakeLists.txt) -add_definitions(-DPBD_DATA_PATH="../data") -subdirs(Simulation BarDemo ClothDemo DistanceFieldDemos FluidDemo RigidBodyDemos CouplingDemos GenericConstraintsDemos SceneLoaderDemo) +# search all demos +set(PBD_DEMOS + BarDemo + ClothDemo + CosseratRodsDemo + CouplingDemos + DistanceFieldDemos + FluidDemo + GenericConstraintsDemos + PositionBasedElasticRodsDemo + RigidBodyDemos + SceneLoaderDemo + StiffRodsDemos +) + +if (NOT PBD_LIBS_ONLY) + foreach (_demo_name ${PBD_DEMOS}) + option(Build_${_demo_name} "Build ${_demo_name}" ON) + if (Build_${_demo_name}) + add_subdirectory (${CMAKE_CURRENT_SOURCE_DIR}/${_demo_name}) + endif (Build_${_demo_name}) + endforeach () +endif() + +install(DIRECTORY ./Common +DESTINATION include/Demos +FILES_MATCHING PATTERN "*.h") diff --git a/Demos/ClothDemo/CMakeLists.txt b/Demos/ClothDemo/CMakeLists.txt index 8b26bc5b..c444262b 100644 --- a/Demos/ClothDemo/CMakeLists.txt +++ b/Demos/ClothDemo/CMakeLists.txt @@ -1,40 +1,47 @@ -set(SIMULATION_LINK_LIBRARIES AntTweakBar glew PositionBasedDynamics Simulation) -set(SIMULATION_DEPENDENCIES AntTweakBar glew PositionBasedDynamics Simulation) +set(SIMULATION_LINK_LIBRARIES imgui glfw PositionBasedDynamics Simulation Utils) +set(SIMULATION_DEPENDENCIES imgui glfw PositionBasedDynamics Simulation Utils CopyPBDShaders CopyImguiFonts) if(WIN32) - set(SIMULATION_LINK_LIBRARIES freeglut opengl32.lib glu32.lib ${SIMULATION_LINK_LIBRARIES}) - set(SIMULATION_DEPENDENCIES freeglut ${SIMULATION_DEPENDENCIES}) + set(SIMULATION_LINK_LIBRARIES opengl32.lib glu32.lib ${SIMULATION_LINK_LIBRARIES}) + #set(SIMULATION_DEPENDENCIES ${SIMULATION_DEPENDENCIES}) else() - find_package(GLUT REQUIRED) + set(OpenGL_GL_PREFERENCE GLVND) find_package(OpenGL REQUIRED) + include_directories( ${OPENGL_INCLUDE_DIRS}) set(SIMULATION_LINK_LIBRARIES ${SIMULATION_LINK_LIBRARIES} - ${GLUT_LIBRARIES} ${OPENGL_LIBRARIES} ) endif() +############################################################ +# GenericParameters +############################################################ +include_directories(${GenericParameters_INCLUDE_DIR}) +if(TARGET Ext_GenericParameters) + set(SIMULATION_DEPENDENCIES ${SIMULATION_DEPENDENCIES} Ext_GenericParameters) +endif() + + add_executable(ClothDemo main.cpp + + ../Common/LogWindow.cpp + ../Common/LogWindow.h + ../Common/Simulator_GUI_imgui.cpp + ../Common/Simulator_GUI_imgui.h + ../Common/imguiParameters.cpp + ../Common/imguiParameters.h + ../Common/DemoBase.cpp + ../Common/DemoBase.h ${VIS_FILES} ${PROJECT_PATH}/Common/Common.h - ${PROJECT_PATH}/Demos/Common/Config.h - ${PROJECT_PATH}/Demos/Utils/IndexedFaceMesh.cpp - ${PROJECT_PATH}/Demos/Utils/IndexedFaceMesh.h - ${PROJECT_PATH}/Demos/Utils/IndexedTetMesh.cpp - ${PROJECT_PATH}/Demos/Utils/IndexedTetMesh.h - ${PROJECT_PATH}/Demos/Utils/Utilities.cpp - ${PROJECT_PATH}/Demos/Utils/Utilities.h - ${PROJECT_PATH}/Demos/Utils/VolumeIntegration.cpp - ${PROJECT_PATH}/Demos/Utils/VolumeIntegration.h CMakeLists.txt ) -add_definitions(-DTW_NO_LIB_PRAGMA -DTW_STATIC) - find_package( Eigen3 REQUIRED ) include_directories( ${EIGEN3_INCLUDE_DIR} ) include_directories(${PROJECT_PATH}/extern/freeglut/include) diff --git a/Demos/ClothDemo/main.cpp b/Demos/ClothDemo/main.cpp index 8fb48ef0..7f8fd2fb 100644 --- a/Demos/ClothDemo/main.cpp +++ b/Demos/ClothDemo/main.cpp @@ -1,259 +1,129 @@ -#include "Demos/Common/Config.h" +#include "Common/Common.h" #include "Demos/Visualization/MiniGL.h" #include "Demos/Visualization/Selection.h" -#include "GL/glut.h" -#include "Demos/Simulation/TimeManager.h" +#include "Simulation/TimeManager.h" #include -#include "Demos/Simulation/SimulationModel.h" -#include "Demos/Simulation/TimeStepController.h" +#include "Simulation/SimulationModel.h" +#include "Simulation/TimeStepController.h" #include #include "Demos/Visualization/Visualization.h" -#include "Demos/Utils/Utilities.h" +#include "Utils/Logger.h" +#include "Utils/Timing.h" +#include "Utils/FileSystem.h" +#include "Demos/Common/DemoBase.h" +#include "Simulation/Simulation.h" // Enable memory leak detection -#ifdef _DEBUG +#if defined(_DEBUG) && !defined(EIGEN_ALIGN) #define new DEBUG_NEW #endif using namespace PBD; using namespace Eigen; using namespace std; +using namespace Utilities; void timeStep (); void buildModel (); void createMesh(); void render (); -void cleanup(); void reset(); -void initShader(); -void selection(const Eigen::Vector2i &start, const Eigen::Vector2i &end); -void TW_CALL setTimeStep(const void *value, void *clientData); -void TW_CALL getTimeStep(void *value, void *clientData); -void TW_CALL setStiffness(const void *value, void *clientData); -void TW_CALL getStiffness(void *value, void *clientData); -void TW_CALL setXXStiffness(const void *value, void *clientData); -void TW_CALL getXXStiffness(void *value, void *clientData); -void TW_CALL setYYStiffness(const void *value, void *clientData); -void TW_CALL getYYStiffness(void *value, void *clientData); -void TW_CALL setXYStiffness(const void *value, void *clientData); -void TW_CALL getXYStiffness(void *value, void *clientData); -void TW_CALL setXYPoissonRatio(const void *value, void *clientData); -void TW_CALL getXYPoissonRatio(void *value, void *clientData); -void TW_CALL setYXPoissonRatio(const void *value, void *clientData); -void TW_CALL getYXPoissonRatio(void *value, void *clientData); -void TW_CALL setNormalizeStretch(const void *value, void *clientData); -void TW_CALL getNormalizeStretch(void *value, void *clientData); -void TW_CALL setNormalizeShear(const void *value, void *clientData); -void TW_CALL getNormalizeShear(void *value, void *clientData); -void TW_CALL setBendingStiffness(const void *value, void *clientData); -void TW_CALL getBendingStiffness(void *value, void *clientData); -void TW_CALL setBendingMethod(const void *value, void *clientData); -void TW_CALL getBendingMethod(void *value, void *clientData); -void TW_CALL setSimulationMethod(const void *value, void *clientData); -void TW_CALL getSimulationMethod(void *value, void *clientData); -void TW_CALL setVelocityUpdateMethod(const void *value, void *clientData); -void TW_CALL getVelocityUpdateMethod(void *value, void *clientData); - - -SimulationModel model; -TimeStepController sim; const int nRows = 50; const int nCols = 50; const Real width = 10.0; const Real height = 10.0; -short simulationMethod = 2; -short bendingMethod = 2; -bool doPause = true; -std::vector selectedParticles; -Vector3r oldMousePos; -Shader *shader; -string exePath; -string dataPath; +DemoBase *base; // main int main( int argc, char **argv ) { REPORT_MEMORY_LEAKS - exePath = Utilities::getFilePath(argv[0]); - dataPath = exePath + "/" + std::string(PBD_DATA_PATH); + base = new DemoBase(); + base->init(argc, argv, "Cloth demo"); - // OpenGL - MiniGL::init (argc, argv, 1024, 768, 0, 0, "Cloth demo"); - MiniGL::initLights (); - MiniGL::initTexture(); - MiniGL::setClientIdleFunc (50, timeStep); - MiniGL::setKeyFunc(0, 'r', reset); - MiniGL::setSelectionFunc(selection); - initShader(); + SimulationModel *model = new SimulationModel(); + model->init(); + Simulation::getCurrent()->setModel(model); + + buildModel(); - buildModel (); + base->createParameterGUI(); + // reset simulation when cloth simulation/bending method has changed + model->setClothSimulationMethodChangedCallback([&]() { reset(); }); + model->setClothBendingMethodChangedCallback([&]() { reset(); }); + + // OpenGL + MiniGL::setClientIdleFunc (timeStep); + MiniGL::addKeyFunc('r', reset); MiniGL::setClientSceneFunc(render); MiniGL::setViewport (40.0f, 0.1f, 500.0f, Vector3r (5.0, 10.0, 30.0), Vector3r (5.0, 0.0, 0.0)); - TwAddVarRW(MiniGL::getTweakBar(), "Pause", TW_TYPE_BOOLCPP, &doPause, " label='Pause' group=Simulation key=SPACE "); - TwAddVarCB(MiniGL::getTweakBar(), "TimeStepSize", TW_TYPE_REAL, setTimeStep, getTimeStep, &model, " label='Time step size' min=0.0 max = 0.1 step=0.001 precision=4 group=Simulation "); - TwType enumType = TwDefineEnum("VelocityUpdateMethodType", NULL, 0); - TwAddVarCB(MiniGL::getTweakBar(), "VelocityUpdateMethod", enumType, setVelocityUpdateMethod, getVelocityUpdateMethod, &sim, " label='Velocity update method' enum='0 {First Order Update}, 1 {Second Order Update}' group=Simulation"); - TwType enumType2 = TwDefineEnum("SimulationMethodType", NULL, 0); - TwAddVarCB(MiniGL::getTweakBar(), "SimulationMethod", enumType2, setSimulationMethod, getSimulationMethod, &simulationMethod, " label='Simulation method' enum='0 {None}, 1 {Distance constraints}, 2 {FEM based PBD}, 3 {Strain based dynamics}' group=Simulation"); - TwAddVarCB(MiniGL::getTweakBar(), "Stiffness", TW_TYPE_REAL, setStiffness, getStiffness, &model, " label='Stiffness' min=0.0 step=0.1 precision=4 group='Distance constraints' "); - TwAddVarCB(MiniGL::getTweakBar(), "XXStiffness", TW_TYPE_REAL, setXXStiffness, getXXStiffness, &model, " label='Stiffness XX' min=0.0 step=0.1 precision=4 group='Strain based dynamics' "); - TwAddVarCB(MiniGL::getTweakBar(), "YYStiffness", TW_TYPE_REAL, setYYStiffness, getYYStiffness, &model, " label='Stiffness YY' min=0.0 step=0.1 precision=4 group='Strain based dynamics' "); - TwAddVarCB(MiniGL::getTweakBar(), "XYStiffness", TW_TYPE_REAL, setXYStiffness, getXYStiffness, &model, " label='Stiffness XY' min=0.0 step=0.1 precision=4 group='Strain based dynamics' "); - TwAddVarCB(MiniGL::getTweakBar(), "XXStiffnessFEM", TW_TYPE_REAL, setXXStiffness, getXXStiffness, &model, " label='Youngs modulus XX' min=0.0 step=0.1 precision=4 group='FEM based PBD' "); - TwAddVarCB(MiniGL::getTweakBar(), "YYStiffnessFEM", TW_TYPE_REAL, setYYStiffness, getYYStiffness, &model, " label='Youngs modulus YY' min=0.0 step=0.1 precision=4 group='FEM based PBD' "); - TwAddVarCB(MiniGL::getTweakBar(), "XYStiffnessFEM", TW_TYPE_REAL, setXYStiffness, getXYStiffness, &model, " label='Youngs modulus XY' min=0.0 step=0.1 precision=4 group='FEM based PBD' "); - TwAddVarCB(MiniGL::getTweakBar(), "XYPoissonRatioFEM", TW_TYPE_REAL, setXYPoissonRatio, getXYPoissonRatio, &model, " label='Poisson ratio XY' min=0.0 step=0.1 precision=4 group='FEM based PBD' "); - TwAddVarCB(MiniGL::getTweakBar(), "YXPoissonRatioFEM", TW_TYPE_REAL, setYXPoissonRatio, getYXPoissonRatio, &model, " label='Poisson ratio YX' min=0.0 step=0.1 precision=4 group='FEM based PBD' "); - TwAddVarCB(MiniGL::getTweakBar(), "NormalizeStretch", TW_TYPE_BOOL32, setNormalizeStretch, getNormalizeStretch, &model, " label='Normalize stretch' group='Strain based dynamics' "); - TwAddVarCB(MiniGL::getTweakBar(), "NormalizeShear", TW_TYPE_BOOL32, setNormalizeShear, getNormalizeShear, &model, " label='Normalize shear' group='Strain based dynamics' "); - TwType enumType3 = TwDefineEnum("BendingMethodType", NULL, 0); - TwAddVarCB(MiniGL::getTweakBar(), "BendingMethod", enumType3, setBendingMethod, getBendingMethod, &bendingMethod, " label='Bending method' enum='0 {None}, 1 {Dihedral angle}, 2 {Isometric bending}' group=Bending"); - TwAddVarCB(MiniGL::getTweakBar(), "BendingStiffness", TW_TYPE_REAL, setBendingStiffness, getBendingStiffness, &model, " label='Bending stiffness' min=0.0 step=0.01 precision=4 group=Bending "); - - glutMainLoop (); - - cleanup (); - - return 0; -} + MiniGL::mainLoop(); -void initShader() -{ - std::string vertFile = dataPath + "/shaders/vs_smoothTex.glsl"; - std::string fragFile = dataPath + "/shaders/fs_smoothTex.glsl"; - shader = MiniGL::createShader(vertFile, "", fragFile); + base->cleanup(); - if (shader == NULL) - return; + Utilities::Timing::printAverageTimes(); + Utilities::Timing::printTimeSums(); - shader->begin(); - shader->addUniform("modelview_matrix"); - shader->addUniform("projection_matrix"); - shader->addUniform("surface_color"); - shader->addUniform("shininess"); - shader->addUniform("specular_factor"); - shader->end(); -} + delete Simulation::getCurrent(); + delete base; + delete model; -void cleanup() -{ - delete TimeManager::getCurrent(); - delete shader; + return 0; } void reset() { - model.reset(); - sim.reset(); - TimeManager::getCurrent()->setTime(0.0); + Utilities::Timing::printAverageTimes(); + Utilities::Timing::reset(); - model.cleanup(); - buildModel(); -} - -void mouseMove(int x, int y) -{ - Vector3r mousePos; - MiniGL::unproject(x, y, mousePos); - const Vector3r diff = mousePos - oldMousePos; + Simulation::getCurrent()->reset(); + base->getSelectedParticles().clear(); - TimeManager *tm = TimeManager::getCurrent(); - const Real h = tm->getTimeStepSize(); + Simulation::getCurrent()->getModel()->cleanup(); - ParticleData &pd = model.getParticles(); - for (unsigned int j = 0; j < selectedParticles.size(); j++) - { - pd.getVelocity(selectedParticles[j]) += 5.0*diff/h; - } - oldMousePos = mousePos; + buildModel(); } -void selection(const Eigen::Vector2i &start, const Eigen::Vector2i &end) -{ - std::vector hits; - selectedParticles.clear(); - ParticleData &pd = model.getParticles(); - Selection::selectRect(start, end, &pd.getPosition(0), &pd.getPosition(pd.size() - 1), selectedParticles); - if (selectedParticles.size() > 0) - MiniGL::setMouseMoveFunc(GLUT_MIDDLE_BUTTON, mouseMove); - else - MiniGL::setMouseMoveFunc(-1, NULL); - - MiniGL::unproject(end[0], end[1], oldMousePos); -} void timeStep () { - if (doPause) + const Real pauseAt = base->getValue(DemoBase::PAUSE_AT); + if ((pauseAt > 0.0) && (pauseAt < TimeManager::getCurrent()->getTime())) + base->setValue(DemoBase::PAUSE, true); + + if (base->getValue(DemoBase::PAUSE)) return; // Simulation code - for (unsigned int i = 0; i < 8; i++) - sim.step(model); + SimulationModel *model = Simulation::getCurrent()->getModel(); + const unsigned int numSteps = base->getValue(DemoBase::NUM_STEPS_PER_RENDER); + for (unsigned int i = 0; i < numSteps; i++) + { + START_TIMING("SimStep"); + Simulation::getCurrent()->getTimeStep()->step(*model); + STOP_TIMING_AVG; + + base->step(); + } - for (unsigned int i = 0; i < model.getTriangleModels().size(); i++) - model.getTriangleModels()[i]->updateMeshNormals(model.getParticles()); + for (unsigned int i = 0; i < model->getTriangleModels().size(); i++) + model->getTriangleModels()[i]->updateMeshNormals(model->getParticles()); } void buildModel () { - TimeManager::getCurrent ()->setTimeStepSize (0.005); + TimeManager::getCurrent ()->setTimeStepSize (static_cast(0.005)); createMesh(); } -void renderTriangleModels() -{ - // Draw simulation model - - const ParticleData &pd = model.getParticles(); - float surfaceColor[4] = { 0.2f, 0.5f, 1.0f, 1 }; - - if (shader) - { - shader->begin(); - glUniform3fv(shader->getUniform("surface_color"), 1, surfaceColor); - glUniform1f(shader->getUniform("shininess"), 5.0f); - glUniform1f(shader->getUniform("specular_factor"), 0.2f); - - GLfloat matrix[16]; - glGetFloatv(GL_MODELVIEW_MATRIX, matrix); - glUniformMatrix4fv(shader->getUniform("modelview_matrix"), 1, GL_FALSE, matrix); - GLfloat pmatrix[16]; - glGetFloatv(GL_PROJECTION_MATRIX, pmatrix); - glUniformMatrix4fv(shader->getUniform("projection_matrix"), 1, GL_FALSE, pmatrix); - } - - for (unsigned int i = 0; i < model.getTriangleModels().size(); i++) - { - // mesh - TriangleModel *triModel = model.getTriangleModels()[i]; - const IndexedFaceMesh &mesh = triModel->getParticleMesh(); - Visualization::drawTexturedMesh(pd, mesh, triModel->getIndexOffset(), surfaceColor); - } - if (shader) - shader->end(); -} - - void render () { - MiniGL::coordinateSystem(); - - renderTriangleModels(); - - float red[4] = { 0.8f, 0.0f, 0.0f, 1 }; - const ParticleData &pd = model.getParticles(); - for (unsigned int j = 0; j < selectedParticles.size(); j++) - { - MiniGL::drawSphere(pd.getPosition(selectedParticles[j]), 0.08f, red); - } - - MiniGL::drawTime( TimeManager::getCurrent ()->getTime ()); + base->render(); } @@ -261,313 +131,33 @@ void render () */ void createMesh() { - TriangleModel::ParticleMesh::UVs uvs; - uvs.resize(nRows*nCols); - - const Real dy = width / (Real)(nCols - 1); - const Real dx = height / (Real)(nRows - 1); - - Vector3r points[nRows*nCols]; - for (int i = 0; i < nRows; i++) - { - for (int j = 0; j < nCols; j++) - { - const Real y = (Real)dy*j; - const Real x = (Real)dx*i; - points[i*nCols + j] = Vector3r(x, 1.0, y); - - uvs[i*nCols + j][0] = x/width; - uvs[i*nCols + j][1] = y/height; - } - } - const int nIndices = 6 * (nRows - 1)*(nCols - 1); - - TriangleModel::ParticleMesh::UVIndices uvIndices; - uvIndices.resize(nIndices); - - unsigned int indices[nIndices]; - int index = 0; - for (int i = 0; i < nRows - 1; i++) - { - for (int j = 0; j < nCols - 1; j++) - { - int helper = 0; - if (i % 2 == j % 2) - helper = 1; - - indices[index] = i*nCols + j; - indices[index + 1] = i*nCols + j + 1; - indices[index + 2] = (i + 1)*nCols + j + helper; - - uvIndices[index] = i*nCols + j; - uvIndices[index + 1] = i*nCols + j + 1; - uvIndices[index + 2] = (i + 1)*nCols + j + helper; - index += 3; - - indices[index] = (i + 1)*nCols + j + 1; - indices[index + 1] = (i + 1)*nCols + j; - indices[index + 2] = i*nCols + j + 1 - helper; - - uvIndices[index] = (i + 1)*nCols + j + 1; - uvIndices[index + 1] = (i + 1)*nCols + j; - uvIndices[index + 2] = i*nCols + j + 1 - helper; - index += 3; - } - } - - model.addTriangleModel(nRows*nCols, nIndices / 3, &points[0], &indices[0], uvIndices, uvs); + SimulationModel *model = Simulation::getCurrent()->getModel(); + model->addRegularTriangleModel(nCols, nRows, + Vector3r(0,1,0), AngleAxisr(M_PI*0.5, Vector3r(1,0,0)).matrix(), Vector2r(width, height)); - ParticleData &pd = model.getParticles(); - for (unsigned int i = 0; i < pd.getNumberOfParticles(); i++) - { - pd.setMass(i, 1.0); - } - // Set mass of points to zero => make it static + ParticleData& pd = model->getParticles(); pd.setMass(0, 0.0); - pd.setMass((nRows-1)*nCols, 0.0); + pd.setMass(nRows-1, 0.0); // init constraints - for (unsigned int cm = 0; cm < model.getTriangleModels().size(); cm++) + for (unsigned int cm = 0; cm < model->getTriangleModels().size(); cm++) { - if (simulationMethod == 1) - { - const unsigned int offset = model.getTriangleModels()[cm]->getIndexOffset(); - const unsigned int nEdges = model.getTriangleModels()[cm]->getParticleMesh().numEdges(); - const IndexedFaceMesh::Edge *edges = model.getTriangleModels()[cm]->getParticleMesh().getEdges().data(); - for (unsigned int i = 0; i < nEdges; i++) - { - const unsigned int v1 = edges[i].m_vert[0] + offset; - const unsigned int v2 = edges[i].m_vert[1] + offset; - - model.addDistanceConstraint(v1, v2); - } - } - else if (simulationMethod == 2) - { - const unsigned int offset = model.getTriangleModels()[cm]->getIndexOffset(); - TriangleModel::ParticleMesh &mesh = model.getTriangleModels()[cm]->getParticleMesh(); - const unsigned int *tris = mesh.getFaces().data(); - const unsigned int nFaces = mesh.numFaces(); - for (unsigned int i = 0; i < nFaces; i++) - { - const unsigned int v1 = tris[3 * i] + offset; - const unsigned int v2 = tris[3 * i + 1] + offset; - const unsigned int v3 = tris[3 * i + 2] + offset; - model.addFEMTriangleConstraint(v1, v2, v3); - } - } - else if (simulationMethod == 3) - { - const unsigned int offset = model.getTriangleModels()[cm]->getIndexOffset(); - TriangleModel::ParticleMesh &mesh = model.getTriangleModels()[cm]->getParticleMesh(); - const unsigned int *tris = mesh.getFaces().data(); - const unsigned int nFaces = mesh.numFaces(); - for (unsigned int i = 0; i < nFaces; i++) - { - const unsigned int v1 = tris[3 * i] + offset; - const unsigned int v2 = tris[3 * i + 1] + offset; - const unsigned int v3 = tris[3 * i + 2] + offset; - model.addStrainTriangleConstraint(v1, v2, v3); - } - } - if (bendingMethod != 0) - { - const unsigned int offset = model.getTriangleModels()[cm]->getIndexOffset(); - TriangleModel::ParticleMesh &mesh = model.getTriangleModels()[cm]->getParticleMesh(); - unsigned int nEdges = mesh.numEdges(); - const TriangleModel::ParticleMesh::Edge *edges = mesh.getEdges().data(); - const unsigned int *tris = mesh.getFaces().data(); - for (unsigned int i = 0; i < nEdges; i++) - { - const int tri1 = edges[i].m_face[0]; - const int tri2 = edges[i].m_face[1]; - if ((tri1 != 0xffffffff) && (tri2 != 0xffffffff)) - { - // Find the triangle points which do not lie on the axis - const int axisPoint1 = edges[i].m_vert[0]; - const int axisPoint2 = edges[i].m_vert[1]; - int point1 = -1; - int point2 = -1; - for (int j = 0; j < 3; j++) - { - if ((tris[3 * tri1 + j] != axisPoint1) && (tris[3 * tri1 + j] != axisPoint2)) - { - point1 = tris[3 * tri1 + j]; - break; - } - } - for (int j = 0; j < 3; j++) - { - if ((tris[3 * tri2 + j] != axisPoint1) && (tris[3 * tri2 + j] != axisPoint2)) - { - point2 = tris[3 * tri2 + j]; - break; - } - } - if ((point1 != -1) && (point2 != -1)) - { - const unsigned int vertex1 = point1 + offset; - const unsigned int vertex2 = point2 + offset; - const unsigned int vertex3 = edges[i].m_vert[0] + offset; - const unsigned int vertex4 = edges[i].m_vert[1] + offset; - if (bendingMethod == 1) - model.addDihedralConstraint(vertex1, vertex2, vertex3, vertex4); - else if (bendingMethod == 2) - model.addIsometricBendingConstraint(vertex1, vertex2, vertex3, vertex4); - } - } - } - } + model->setClothStiffness(1.0); + if (model->getClothSimulationMethod() == 4) + model->setClothStiffness(100000); + model->addClothConstraints(model->getTriangleModels()[cm], model->getClothSimulationMethod(), model->getClothStiffness(), model->getClothStiffnessXX(), + model->getClothStiffnessYY(), model->getClothStiffnessXY(), model->getClothPoissonRatioXY(), model->getClothPoissonRatioYX(), + model->getClothNormalizeStretch(), model->getClothNormalizeShear()); + + model->setClothBendingStiffness(0.01); + if (model->getClothBendingMethod() == 3) + model->setClothBendingStiffness(100.0); + model->addBendingConstraints(model->getTriangleModels()[cm], model->getClothBendingMethod(), model->getClothBendingStiffness()); } - std::cout << "Number of triangles: " << nIndices / 3 << "\n"; - std::cout << "Number of vertices: " << nRows*nCols << "\n"; - -} - -void TW_CALL setTimeStep(const void *value, void *clientData) -{ - const Real val = *(const Real *)(value); - TimeManager::getCurrent()->setTimeStepSize(val); -} - -void TW_CALL getTimeStep(void *value, void *clientData) -{ - *(Real *)(value) = TimeManager::getCurrent()->getTimeStepSize(); -} - -void TW_CALL setStiffness(const void *value, void *clientData) -{ - const Real val = *(const Real *)(value); - ((SimulationModel*) clientData)->setClothStiffness(val); -} - -void TW_CALL getStiffness(void *value, void *clientData) -{ - *(Real *)(value) = ((SimulationModel*)clientData)->getClothStiffness(); -} - -void TW_CALL setXXStiffness(const void *value, void *clientData) -{ - const Real val = *(const Real *)(value); - ((SimulationModel*)clientData)->setClothXXStiffness(val); -} - -void TW_CALL getXXStiffness(void *value, void *clientData) -{ - *(Real *)(value) = ((SimulationModel*)clientData)->getClothXXStiffness(); -} - -void TW_CALL setYYStiffness(const void *value, void *clientData) -{ - const Real val = *(const Real *)(value); - ((SimulationModel*)clientData)->setClothYYStiffness(val); -} - -void TW_CALL getYYStiffness(void *value, void *clientData) -{ - *(Real *)(value) = ((SimulationModel*)clientData)->getClothYYStiffness(); -} - -void TW_CALL setXYStiffness(const void *value, void *clientData) -{ - const Real val = *(const Real *)(value); - ((SimulationModel*)clientData)->setClothXYStiffness(val); -} - -void TW_CALL getXYStiffness(void *value, void *clientData) -{ - *(Real *)(value) = ((SimulationModel*)clientData)->getClothXYStiffness(); -} - -void TW_CALL setYXPoissonRatio(const void *value, void *clientData) -{ - const Real val = *(const Real *)(value); - ((SimulationModel*)clientData)->setClothYXPoissonRatio(val); -} - -void TW_CALL getYXPoissonRatio(void *value, void *clientData) -{ - *(Real *)(value) = ((SimulationModel*)clientData)->getClothYXPoissonRatio(); -} - -void TW_CALL setXYPoissonRatio(const void *value, void *clientData) -{ - const Real val = *(const Real *)(value); - ((SimulationModel*)clientData)->setClothXYPoissonRatio(val); -} - -void TW_CALL getXYPoissonRatio(void *value, void *clientData) -{ - *(Real *)(value) = ((SimulationModel*)clientData)->getClothXYPoissonRatio(); -} - -void TW_CALL setNormalizeStretch(const void *value, void *clientData) -{ - const bool val = *(const bool *)(value); - ((SimulationModel*)clientData)->setClothNormalizeStretch(val); -} - -void TW_CALL getNormalizeStretch(void *value, void *clientData) -{ - *(bool *)(value) = ((SimulationModel*)clientData)->getClothNormalizeStretch(); -} - -void TW_CALL setNormalizeShear(const void *value, void *clientData) -{ - const bool val = *(const bool *)(value); - ((SimulationModel*)clientData)->setClothNormalizeShear(val); -} - -void TW_CALL getNormalizeShear(void *value, void *clientData) -{ - *(bool *)(value) = ((SimulationModel*)clientData)->getClothNormalizeShear(); -} - -void TW_CALL setBendingStiffness(const void *value, void *clientData) -{ - const Real val = *(const Real *)(value); - ((SimulationModel*)clientData)->setClothBendingStiffness(val); -} - -void TW_CALL getBendingStiffness(void *value, void *clientData) -{ - *(Real *)(value) = ((SimulationModel*)clientData)->getClothBendingStiffness(); -} + LOG_INFO << "Number of triangles: " << model->getTriangleModels()[0]->getParticleMesh().numFaces(); + LOG_INFO << "Number of vertices: " << nRows*nCols; -void TW_CALL setBendingMethod(const void *value, void *clientData) -{ - const short val = *(const short *)(value); - *((short*)clientData) = val; - reset(); -} - -void TW_CALL getBendingMethod(void *value, void *clientData) -{ - *(short *)(value) = *((short*)clientData); -} - -void TW_CALL setSimulationMethod(const void *value, void *clientData) -{ - const short val = *(const short *)(value); - *((short*)clientData) = val; - reset(); -} - -void TW_CALL getSimulationMethod(void *value, void *clientData) -{ - *(short *)(value) = *((short*)clientData); -} - -void TW_CALL setVelocityUpdateMethod(const void *value, void *clientData) -{ - const short val = *(const short *)(value); - ((TimeStepController*)clientData)->setVelocityUpdateMethod((unsigned int)val); -} - -void TW_CALL getVelocityUpdateMethod(void *value, void *clientData) -{ - *(short *)(value) = (short)((TimeStepController*)clientData)->getVelocityUpdateMethod(); } diff --git a/Demos/Common/Config.h b/Demos/Common/Config.h deleted file mode 100644 index 33358e1c..00000000 --- a/Demos/Common/Config.h +++ /dev/null @@ -1,24 +0,0 @@ -#ifndef __CONFIG_H__ -#define __CONFIG_H__ - -#define MIN_PARALLEL_SIZE 64 - -#if defined(WIN32) || defined(_WIN32) || defined(WIN64) - // Enable memory leak detection - #ifdef _DEBUG - #define _CRTDBG_MAP_ALLOC - #include - #include - #define DEBUG_NEW new(_NORMAL_BLOCK, __FILE__, __LINE__) - #define REPORT_MEMORY_LEAKS _CrtSetDbgFlag ( _CRTDBG_ALLOC_MEM_DF | _CRTDBG_LEAK_CHECK_DF ); - #else - #define REPORT_MEMORY_LEAKS - #endif - - #define FORCE_INLINE __forceinline -#else - #define REPORT_MEMORY_LEAKS - #define FORCE_INLINE __attribute__((always_inline)) -#endif - -#endif diff --git a/Demos/Common/DemoBase.cpp b/Demos/Common/DemoBase.cpp new file mode 100644 index 00000000..162cdf7c --- /dev/null +++ b/Demos/Common/DemoBase.cpp @@ -0,0 +1,1237 @@ +#include "DemoBase.h" +#include "Demos/Visualization/MiniGL.h" +#include "Utils/SceneLoader.h" +#include "Utils/FileSystem.h" +#include "Simulation/TimeManager.h" +#include "Demos/Visualization/Selection.h" +#include "Simulation/Simulation.h" +#include "NumericParameter.h" +#include "Utils/Logger.h" +#include "Utils/Timing.h" +#include "Utils/Version.h" +#include "Utils/SystemInfo.h" +#include "../Visualization/Visualization.h" +#include "Simulation/DistanceFieldCollisionDetection.h" +#include "Utils/OBJLoader.h" +#include "Utils/PLYLoader.h" + + +INIT_LOGGING +INIT_TIMING + +using namespace PBD; +using namespace std; +using namespace GenParam; +using namespace Utilities; + +int DemoBase::PAUSE = -1; +int DemoBase::PAUSE_AT = -1; +int DemoBase::NUM_STEPS_PER_RENDER = -1; +int DemoBase::RENDER_TETS = -1; +int DemoBase::RENDER_TETS0 = -1; +int DemoBase::RENDER_CONTACTS = -1; +int DemoBase::RENDER_AABB = -1; +int DemoBase::RENDER_SDF = -1; +int DemoBase::RENDER_BVH = -1; +int DemoBase::RENDER_BVH_TETS = -1; +int DemoBase::EXPORT_OBJ = -1; +int DemoBase::EXPORT_PLY = -1; +int DemoBase::EXPORT_FPS = -1; + + +DemoBase::DemoBase() +{ + Utilities::logger.addSink(unique_ptr(new Utilities::ConsoleSink(Utilities::LogLevel::INFO))); + Utilities::logger.addSink(shared_ptr(new Utilities::BufferSink(Utilities::LogLevel::DEBUG))); + + m_sceneLoader = nullptr; + m_numberOfStepsPerRenderUpdate = 8; + m_renderContacts = false; + m_renderAABB = false; + m_renderSDF = false; + m_renderBVHDepth = -1; + m_renderBVHDepthTets = -1; + m_renderRefTets = false; + m_renderTets = false; + m_sceneFile = ""; + m_sceneName = ""; + m_doPause = true; + m_pauseAt = -1.0; + m_useCache = true; + m_oldMousePos.setZero(); + m_enableExportOBJ = false; + m_enableExportPLY = false; + m_exportFPS = 25; + m_nextFrameTime = 0.0; + m_frameCounter = 1; + + m_gui = new Simulator_GUI_imgui(this); +} + +DemoBase::~DemoBase() +{ + delete m_sceneLoader; + delete m_gui; +} + +void DemoBase::initParameters() +{ + ParameterObject::initParameters(); + + PAUSE = createBoolParameter("pause", "Pause", &m_doPause); + setGroup(PAUSE, "Simulation|General"); + setDescription(PAUSE, "Pause simulation."); + setHotKey(PAUSE, "space"); + + PAUSE_AT = createNumericParameter("pauseAt", "Pause simulation at", &m_pauseAt); + setGroup(PAUSE_AT, "Simulation|General"); + setDescription(PAUSE_AT, "Pause simulation at the given time. When the value is negative, the simulation is not paused."); + + NUM_STEPS_PER_RENDER = createNumericParameter("numberOfStepsPerRenderUpdate", "# time steps / update", &m_numberOfStepsPerRenderUpdate); + setGroup(NUM_STEPS_PER_RENDER, "Visualization|General"); + setDescription(NUM_STEPS_PER_RENDER, "Pause simulation at the given time. When the value is negative, the simulation is not paused."); + static_cast*>(getParameter(NUM_STEPS_PER_RENDER))->setMinValue(1); + + RENDER_TETS = createBoolParameter("renderTets", "Render tet model", &m_renderTets); + setGroup(RENDER_TETS, "Visualization|Solids"); + setDescription(RENDER_TETS, "Render tet model."); + + RENDER_TETS0 = createBoolParameter("renderTets0", "Render ref. tet model", &m_renderRefTets); + setGroup(RENDER_TETS0, "Visualization|Solids"); + setDescription(RENDER_TETS0, "Render ref. tet model."); + + RENDER_CONTACTS = createBoolParameter("renderContacts", "Render contacts", &m_renderContacts); + setGroup(RENDER_CONTACTS, "Visualization|Contact"); + setDescription(RENDER_CONTACTS, "Render contact points and normals."); + + RENDER_AABB = createBoolParameter("renderAABB", "Render AABBs", &m_renderAABB); + setGroup(RENDER_AABB, "Visualization|Contact"); + setDescription(RENDER_AABB, "Render AABBs."); + + RENDER_SDF = createBoolParameter("renderSDF", "Render SDFs", &m_renderSDF); + setGroup(RENDER_SDF, "Visualization|Contact"); + setDescription(RENDER_SDF, "Render SDFs."); + + RENDER_BVH = createNumericParameter("renderBVHDepth", "Render BVH depth", &m_renderBVHDepth); + setGroup(RENDER_BVH, "Visualization|Contact"); + setDescription(RENDER_BVH, "Render BVH until given depth."); + static_cast*>(getParameter(RENDER_BVH))->setMinValue(-1); + + RENDER_BVH_TETS = createNumericParameter("renderBVHDepthTets", "Render BVH depth (tets)", &m_renderBVHDepthTets); + setGroup(RENDER_BVH_TETS, "Visualization|Contact"); + setDescription(RENDER_BVH_TETS, "Render BVH (tets) until given depth."); + static_cast*>(getParameter(RENDER_BVH_TETS))->setMinValue(-1); + + EXPORT_OBJ = createBoolParameter("exportOBJ", "Export OBJ", &m_enableExportOBJ); + setGroup(EXPORT_OBJ, "Simulation|Export"); + setDescription(EXPORT_OBJ, "Export meshes in OBJ files."); + + EXPORT_PLY = createBoolParameter("exportPLY", "Export PLY", &m_enableExportPLY); + setGroup(EXPORT_PLY, "Simulation|Export"); + setDescription(EXPORT_PLY, "Export meshes in PLY files."); + + EXPORT_FPS = createNumericParameter("exportFPS", "Export FPS", &m_exportFPS); + setGroup(EXPORT_FPS, "Simulation|Export"); + setDescription(EXPORT_FPS, "Frame rate for export."); + static_cast*>(getParameter(EXPORT_FPS))->setMinValue(0); +} + +void DemoBase::createParameterGUI() +{ + m_gui->initSimulationParameterGUI(); +} + +void DemoBase::cleanup() +{ + m_scene.m_rigidBodyData.clear(); + m_scene.m_rigidBodyData.clear(); + m_scene.m_triangleModelData.clear(); + m_scene.m_tetModelData.clear(); + m_scene.m_ballJointData.clear(); + m_scene.m_ballOnLineJointData.clear(); + m_scene.m_hingeJointData.clear(); + m_scene.m_universalJointData.clear(); + m_scene.m_sliderJointData.clear(); + m_scene.m_rigidBodyParticleBallJointData.clear(); + m_scene.m_targetAngleMotorHingeJointData.clear(); + m_scene.m_targetVelocityMotorHingeJointData.clear(); + m_scene.m_targetPositionMotorSliderJointData.clear(); + m_scene.m_targetVelocityMotorSliderJointData.clear(); + m_scene.m_rigidBodySpringData.clear(); + m_scene.m_distanceJointData.clear(); + m_scene.m_damperJointData.clear(); +} + +void DemoBase::init(int argc, char **argv, const char *demoName) +{ + initParameters(); + m_exePath = FileSystem::getProgramPath(); + + m_sceneFile = ""; + setUseCache(true); + for (int i = 1; i < argc; i++) + { + string argStr = argv[i]; + if (argStr == "--no-cache") + setUseCache(false); + else + { + m_sceneFile = string(argv[i]); + if (FileSystem::isRelativePath(m_sceneFile)) + m_sceneFile = FileSystem::normalizePath(m_exePath + "/" + m_sceneFile); + } + } + + if (m_sceneFile != "") + m_outputPath = FileSystem::normalizePath(getExePath() + "/output/" + FileSystem::getFileName(m_sceneFile)); + else + m_outputPath = FileSystem::normalizePath(getExePath() + "/output/" + std::string(demoName)); + +#ifdef DL_OUTPUT + std::string sceneFilePath = FileSystem::normalizePath(m_outputPath + "/scene"); + FileSystem::makeDirs(sceneFilePath); + FileSystem::copyFile(m_sceneFile, sceneFilePath + "/" + FileSystem::getFileNameWithExt(m_sceneFile)); + + std::string progFilePath = FileSystem::normalizePath(m_outputPath + "/program"); + FileSystem::makeDirs(progFilePath); + FileSystem::copyFile(argv[0], progFilePath + "/" + FileSystem::getFileNameWithExt(argv[0])); +#endif + + std::string logPath = FileSystem::normalizePath(m_outputPath + "/log"); + FileSystem::makeDirs(logPath); + Utilities::logger.addSink(unique_ptr(new Utilities::FileSink(Utilities::LogLevel::DEBUG, logPath + "/PBD_log.txt"))); + + LOG_DEBUG << "Git refspec: " << GIT_REFSPEC; + LOG_DEBUG << "Git SHA1: " << GIT_SHA1; + LOG_DEBUG << "Git status: " << GIT_LOCAL_STATUS; + LOG_DEBUG << "Host name: " << SystemInfo::getHostName(); + LOG_INFO << "PositionBasedDynamics " << PBD_VERSION; + + m_gui->init(); + + // OpenGL + MiniGL::init(argc, argv, 1280, 1024, demoName, m_gui->getVSync(), m_gui->getMaximized()); + MiniGL::initLights(); + MiniGL::initTexture(); + MiniGL::getOpenGLVersion(m_context_major_version, m_context_minor_version); + MiniGL::setViewport(40.0, 0.1f, 500.0, Vector3r(0.0, 3.0, 8.0), Vector3r(0.0, 0.0, 0.0)); + MiniGL::setSelectionFunc(selection, this); + + if (MiniGL::checkOpenGLVersion(3, 3)) + initShaders(); + + m_gui->initImgui(); +} + +void DemoBase::readScene() +{ + if (m_sceneLoader == nullptr) + m_sceneLoader = new SceneLoader(); + if (m_sceneFile != "") + m_sceneLoader->readScene(m_sceneFile.c_str(), m_scene); + else + return; + + m_sceneName = m_scene.m_sceneName; +} + +void DemoBase::initShaders() +{ + std::string vertFile = m_exePath + "/resources/shaders/vs_smooth.glsl"; + std::string fragFile = m_exePath + "/resources/shaders/fs_smooth.glsl"; + m_shader.compileShaderFile(GL_VERTEX_SHADER, vertFile); + m_shader.compileShaderFile(GL_FRAGMENT_SHADER, fragFile); + m_shader.createAndLinkProgram(); + m_shader.begin(); + m_shader.addUniform("modelview_matrix"); + m_shader.addUniform("projection_matrix"); + m_shader.addUniform("surface_color"); + m_shader.addUniform("shininess"); + m_shader.addUniform("specular_factor"); + m_shader.end(); + + vertFile = m_exePath + "/resources/shaders/vs_smoothTex.glsl"; + fragFile = m_exePath + "/resources/shaders/fs_smoothTex.glsl"; + m_shaderTex.compileShaderFile(GL_VERTEX_SHADER, vertFile); + m_shaderTex.compileShaderFile(GL_FRAGMENT_SHADER, fragFile); + m_shaderTex.createAndLinkProgram(); + m_shaderTex.begin(); + m_shaderTex.addUniform("modelview_matrix"); + m_shaderTex.addUniform("projection_matrix"); + m_shaderTex.addUniform("surface_color"); + m_shaderTex.addUniform("shininess"); + m_shaderTex.addUniform("specular_factor"); + m_shaderTex.end(); + + vertFile = m_exePath + "/resources/shaders/vs_flat.glsl"; + std::string geomFile = m_exePath + "/resources/shaders/gs_flat.glsl"; + fragFile = m_exePath + "/resources/shaders/fs_flat.glsl"; + m_shaderFlat.compileShaderFile(GL_VERTEX_SHADER, vertFile); + m_shaderFlat.compileShaderFile(GL_GEOMETRY_SHADER, geomFile); + m_shaderFlat.compileShaderFile(GL_FRAGMENT_SHADER, fragFile); + m_shaderFlat.createAndLinkProgram(); + m_shaderFlat.begin(); + m_shaderFlat.addUniform("modelview_matrix"); + m_shaderFlat.addUniform("projection_matrix"); + m_shaderFlat.addUniform("surface_color"); + m_shaderFlat.addUniform("shininess"); + m_shaderFlat.addUniform("specular_factor"); + m_shaderFlat.end(); +} + + +void DemoBase::shaderTexBegin(const float *col) +{ + m_shaderTex.begin(); + glUniform1f(m_shaderTex.getUniform("shininess"), 5.0f); + glUniform1f(m_shaderTex.getUniform("specular_factor"), 0.2f); + + GLfloat matrix[16]; + glGetFloatv(GL_MODELVIEW_MATRIX, matrix); + glUniformMatrix4fv(m_shaderTex.getUniform("modelview_matrix"), 1, GL_FALSE, matrix); + GLfloat pmatrix[16]; + glGetFloatv(GL_PROJECTION_MATRIX, pmatrix); + glUniformMatrix4fv(m_shaderTex.getUniform("projection_matrix"), 1, GL_FALSE, pmatrix); + glUniform3fv(m_shaderTex.getUniform("surface_color"), 1, col); +} + +void DemoBase::shaderTexEnd() +{ + m_shaderTex.end(); +} + +void DemoBase::shaderBegin(const float *col) +{ + m_shader.begin(); + glUniform1f(m_shader.getUniform("shininess"), 5.0f); + glUniform1f(m_shader.getUniform("specular_factor"), 0.2f); + + GLfloat matrix[16]; + glGetFloatv(GL_MODELVIEW_MATRIX, matrix); + glUniformMatrix4fv(m_shader.getUniform("modelview_matrix"), 1, GL_FALSE, matrix); + GLfloat pmatrix[16]; + glGetFloatv(GL_PROJECTION_MATRIX, pmatrix); + glUniformMatrix4fv(m_shader.getUniform("projection_matrix"), 1, GL_FALSE, pmatrix); + glUniform3fv(m_shader.getUniform("surface_color"), 1, col); +} + +void DemoBase::shaderEnd() +{ + m_shader.end(); +} + +void DemoBase::shaderFlatBegin(const float* col) +{ + m_shaderFlat.begin(); + glUniform1f(m_shaderFlat.getUniform("shininess"), 5.0f); + glUniform1f(m_shaderFlat.getUniform("specular_factor"), 0.2f); + + GLfloat matrix[16]; + glGetFloatv(GL_MODELVIEW_MATRIX, matrix); + glUniformMatrix4fv(m_shaderFlat.getUniform("modelview_matrix"), 1, GL_FALSE, matrix); + GLfloat pmatrix[16]; + glGetFloatv(GL_PROJECTION_MATRIX, pmatrix); + glUniformMatrix4fv(m_shaderFlat.getUniform("projection_matrix"), 1, GL_FALSE, pmatrix); + glUniform3fv(m_shaderFlat.getUniform("surface_color"), 1, col); +} + +void DemoBase::shaderFlatEnd() +{ + m_shaderFlat.end(); +} + +void DemoBase::readParameters() +{ + Simulation* sim = Simulation::getCurrent(); + m_sceneLoader->readParameterObject(this); + m_sceneLoader->readParameterObject(sim); + m_sceneLoader->readParameterObject(sim->getModel()); + m_sceneLoader->readParameterObject(sim->getTimeStep()); + if (sim->getTimeStep()->getCollisionDetection() != nullptr) + m_sceneLoader->readParameterObject(sim->getTimeStep()->getCollisionDetection()); +} + +void DemoBase::render() +{ + float gridColor[4] = { 0.2f, 0.2f, 0.2f, 1.0f }; + MiniGL::drawGrid_xz(gridColor); + + MiniGL::coordinateSystem(); + + // Draw sim model + SimulationModel *model = Simulation::getCurrent()->getModel(); + if (model == nullptr) + { + m_gui->update(); + return; + } + SimulationModel::RigidBodyVector &rb = model->getRigidBodies(); + SimulationModel::ConstraintVector &constraints = model->getConstraints(); + SimulationModel::RigidBodyContactConstraintVector &rigidBodyContacts = model->getRigidBodyContactConstraints(); + SimulationModel::ParticleRigidBodyContactConstraintVector &particleRigidBodyContacts = model->getParticleRigidBodyContactConstraints(); + + float selectionColor[4] = { 0.8f, 0.0f, 0.0f, 1 }; + float surfaceColor[4] = { 0.1f, 0.4f, 0.7f, 1 }; + float staticColor[4] = { 0.5f, 0.5f, 0.5f, 1 }; + + if (m_renderContacts) + { + for (unsigned int i = 0; i < rigidBodyContacts.size(); i++) + renderRigidBodyContact(rigidBodyContacts[i]); + for (unsigned int i = 0; i < particleRigidBodyContacts.size(); i++) + renderParticleRigidBodyContact(particleRigidBodyContacts[i]); + } + + + for (size_t i = 0; i < rb.size(); i++) + { + bool selected = false; + for (unsigned int j = 0; j < m_selectedBodies.size(); j++) + { + if (m_selectedBodies[j] == i) + selected = true; + } + + const VertexData &vd = rb[i]->getGeometry().getVertexData(); + const IndexedFaceMesh &mesh = rb[i]->getGeometry().getMesh(); + + if (mesh.getFlatShading()) + shaderFlatBegin(staticColor); + else + shaderBegin(staticColor); + + if (!selected) + { + if (rb[i]->getMass() == 0.0) + { + glUniform3fv(m_shader.getUniform("surface_color"), 1, staticColor); + Visualization::drawMesh(vd, mesh, 0, staticColor); + } + else + { + glUniform3fv(m_shader.getUniform("surface_color"), 1, surfaceColor); + Visualization::drawMesh(vd, mesh, 0, surfaceColor); + } + } + else + { + glUniform3fv(m_shader.getUniform("surface_color"), 1, selectionColor); + Visualization::drawMesh(vd, mesh, 0, selectionColor); + } + + if (mesh.getFlatShading()) + shaderFlatEnd(); + else + shaderEnd(); + } + + + + renderTriangleModels(); + renderTetModels(); + + for (size_t i = 0; i < constraints.size(); i++) + { + if (constraints[i]->getTypeId() == BallJoint::TYPE_ID) + { + renderBallJoint(*(BallJoint*)constraints[i]); + } + else if (constraints[i]->getTypeId() == BallOnLineJoint::TYPE_ID) + { + renderBallOnLineJoint(*(BallOnLineJoint*)constraints[i]); + } + else if (constraints[i]->getTypeId() == HingeJoint::TYPE_ID) + { + renderHingeJoint(*(HingeJoint*)constraints[i]); + } + else if (constraints[i]->getTypeId() == UniversalJoint::TYPE_ID) + { + renderUniversalJoint(*(UniversalJoint*)constraints[i]); + } + else if (constraints[i]->getTypeId() == SliderJoint::TYPE_ID) + { + renderSliderJoint(*(SliderJoint*)constraints[i]); + } + else if (constraints[i]->getTypeId() == TargetAngleMotorHingeJoint::TYPE_ID) + { + renderTargetAngleMotorHingeJoint(*(TargetAngleMotorHingeJoint*)constraints[i]); + } + else if (constraints[i]->getTypeId() == TargetVelocityMotorHingeJoint::TYPE_ID) + { + renderTargetVelocityMotorHingeJoint(*(TargetVelocityMotorHingeJoint*)constraints[i]); + } + else if (constraints[i]->getTypeId() == TargetPositionMotorSliderJoint::TYPE_ID) + { + renderTargetPositionMotorSliderJoint(*(TargetPositionMotorSliderJoint*)constraints[i]); + } + else if (constraints[i]->getTypeId() == TargetVelocityMotorSliderJoint::TYPE_ID) + { + renderTargetVelocityMotorSliderJoint(*(TargetVelocityMotorSliderJoint*)constraints[i]); + } + else if (constraints[i]->getTypeId() == RigidBodyParticleBallJoint::TYPE_ID) + { + renderRigidBodyParticleBallJoint(*(RigidBodyParticleBallJoint*)constraints[i]); + } + else if (constraints[i]->getTypeId() == RigidBodySpring::TYPE_ID) + { + renderSpring(*(RigidBodySpring*)constraints[i]); + } + else if (constraints[i]->getTypeId() == DistanceJoint::TYPE_ID) + { + renderDistanceJoint(*(DistanceJoint*)constraints[i]); + } + else if (constraints[i]->getTypeId() == DamperJoint::TYPE_ID) + { + renderDamperJoint(*(DamperJoint*)constraints[i]); + } + } + + + DistanceFieldCollisionDetection *cd = (DistanceFieldCollisionDetection*)Simulation::getCurrent()->getTimeStep()->getCollisionDetection(); + if (cd && (m_renderSDF || m_renderAABB || (m_renderBVHDepth >= 0) || (m_renderBVHDepthTets >= 0))) + { + std::vector &collisionObjects = cd->getCollisionObjects(); + for (unsigned int k = 0; k < collisionObjects.size(); k++) + { + if (m_renderAABB) + renderAABB(collisionObjects[k]->m_aabb); + + if (m_renderSDF) + renderSDF(collisionObjects[k]); + + if (m_renderBVHDepth >= 0) + { + if (cd->isDistanceFieldCollisionObject(collisionObjects[k])) + { + const PointCloudBSH &bvh = ((DistanceFieldCollisionDetection::DistanceFieldCollisionObject*) collisionObjects[k])->m_bvh; + + std::function predicate = [&](unsigned int node_index, unsigned int depth) { return (int)depth <= m_renderBVHDepth; }; + std::function cb = [&](unsigned int node_index, unsigned int depth) + { + if (depth == m_renderBVHDepth) + { + const BoundingSphere &bs = bvh.hull(node_index); + if (collisionObjects[k]->m_bodyType == CollisionDetection::CollisionObject::RigidBodyCollisionObjectType) + { + RigidBody *body = rb[collisionObjects[k]->m_bodyIndex]; + const Vector3r &sphere_x = bs.x(); + const Vector3r sphere_x_w = body->getRotation() * sphere_x + body->getPosition(); + MiniGL::drawSphere(sphere_x_w, std::max((float)bs.r(), 0.05f), staticColor); + } + else + MiniGL::drawSphere(bs.x(), std::max((float)bs.r(), 0.05f), staticColor); + } + }; + + bvh.traverse_depth_first(predicate, cb); + } + } + + if (m_renderBVHDepthTets >= 0) + { + if (cd->isDistanceFieldCollisionObject(collisionObjects[k]) && (collisionObjects[k]->m_bodyType == CollisionDetection::CollisionObject::TetModelCollisionObjectType)) + { + + TetMeshBSH &bvh = ((DistanceFieldCollisionDetection::DistanceFieldCollisionObject*) collisionObjects[k])->m_bvhTets; + + std::function predicate = [&](unsigned int node_index, unsigned int depth) { return (int)depth <= m_renderBVHDepthTets; }; + std::function cb = [&](unsigned int node_index, unsigned int depth) + { + if (depth == m_renderBVHDepthTets) + { + const BoundingSphere &bs = bvh.hull(node_index); + const Vector3r &sphere_x = bs.x(); + MiniGL::drawSphere(sphere_x, std::max((float)bs.r(), 0.05f), staticColor); + } + }; + + bvh.traverse_depth_first(predicate, cb); + } + } + } + } + + const Vector3r refOffset(0, 0, 0); + const ParticleData &pd = model->getParticles(); + if (m_renderRefTets || m_renderTets) + { + shaderBegin(surfaceColor); + + for (unsigned int i = 0; i < model->getTetModels().size(); i++) + { + const IndexedTetMesh &mesh = model->getTetModels()[i]->getParticleMesh(); + const unsigned int nTets = mesh.numTets(); + const unsigned int *indices = mesh.getTets().data(); + const unsigned int offset = model->getTetModels()[i]->getIndexOffset(); + + const Vector3r &ix = model->getTetModels()[i]->getInitialX(); + const Matrix3r &R = model->getTetModels()[i]->getInitialR(); + + for (unsigned int j = 0; j < nTets; j++) + { + if (m_renderTets) + { + const Vector3r &x0 = pd.getPosition(indices[4 * j] + offset); + const Vector3r &x1 = pd.getPosition(indices[4 * j + 1] + offset); + const Vector3r &x2 = pd.getPosition(indices[4 * j + 2] + offset); + const Vector3r &x3 = pd.getPosition(indices[4 * j + 3] + offset); + MiniGL::drawTetrahedron(x0, x1, x2, x3, surfaceColor); + } + if (m_renderRefTets) + { +// const Vector3r &x0 = R.transpose() * (pd.getPosition0(indices[4 * j + 0] + offset) - ix); +// const Vector3r &x1 = R.transpose() * (pd.getPosition0(indices[4 * j + 1] + offset) - ix); +// const Vector3r &x2 = R.transpose() * (pd.getPosition0(indices[4 * j + 2] + offset) - ix); +// const Vector3r &x3 = R.transpose() * (pd.getPosition0(indices[4 * j + 3] + offset) - ix); + const Vector3r &x0 = pd.getPosition0(indices[4 * j] + offset) + refOffset; + const Vector3r &x1 = pd.getPosition0(indices[4 * j + 1] + offset) + refOffset; + const Vector3r &x2 = pd.getPosition0(indices[4 * j + 2] + offset) + refOffset; + const Vector3r &x3 = pd.getPosition0(indices[4 * j + 3] + offset) + refOffset; + + MiniGL::drawTetrahedron(x0, x1, x2, x3, staticColor); + } + } + } + shaderEnd(); + } + + float red[4] = { 0.8f, 0.0f, 0.0f, 1 }; + for (unsigned int j = 0; j < m_selectedParticles.size(); j++) + { + MiniGL::drawSphere(pd.getPosition(m_selectedParticles[j]), 0.08f, red); + } + + m_gui->update(); +} + +void DemoBase::renderTriangleModels() +{ + SimulationModel *model = Simulation::getCurrent()->getModel(); + const ParticleData &pd = model->getParticles(); + float surfaceColor[4] = { 0.8f, 0.9f, 0.2f, 1 }; + + shaderTexBegin(surfaceColor); + + for (unsigned int i = 0; i < model->getTriangleModels().size(); i++) + { + // mesh + const IndexedFaceMesh &mesh = model->getTriangleModels()[i]->getParticleMesh(); + const unsigned int offset = model->getTriangleModels()[i]->getIndexOffset(); + Visualization::drawTexturedMesh(pd, mesh, offset, surfaceColor); + } + + shaderTexEnd(); +} + +void DemoBase::renderTetModels() +{ + SimulationModel *model = Simulation::getCurrent()->getModel(); + const ParticleData &pd = model->getParticles(); + float surfaceColor[4] = { 0.1f, 0.4f, 0.7f, 1 }; + + shaderBegin(surfaceColor); + + for (unsigned int i = 0; i < model->getTetModels().size(); i++) + { + const VertexData &vdVis = model->getTetModels()[i]->getVisVertices(); + if (vdVis.size() > 0) + { + const IndexedFaceMesh &visMesh = model->getTetModels()[i]->getVisMesh(); + Visualization::drawMesh(vdVis, visMesh, 0, surfaceColor); + } + else + { + const IndexedFaceMesh &surfaceMesh = model->getTetModels()[i]->getSurfaceMesh(); + const unsigned int offset = model->getTetModels()[i]->getIndexOffset(); + Visualization::drawMesh(pd, surfaceMesh, offset, surfaceColor); + } + } + + shaderEnd(); +} + +void DemoBase::renderAABB(AABB &aabb) +{ + Vector3r p1, p2; + glBegin(GL_LINES); + for (unsigned char i = 0; i < 12; i++) + { + AABB::getEdge(aabb, i, p1, p2); + glVertex3d(p1[0], p1[1], p1[2]); + glVertex3d(p2[0], p2[1], p2[2]); + } + glEnd(); +} + +void DemoBase::renderSDF(CollisionDetection::CollisionObject* co) +{ + DistanceFieldCollisionDetection *cd = (DistanceFieldCollisionDetection*)Simulation::getCurrent()->getTimeStep()->getCollisionDetection(); + if ((!cd->isDistanceFieldCollisionObject(co)) || (co->m_bodyType != CollisionDetection::CollisionObject::RigidBodyCollisionObjectType)) + return; + + SimulationModel *model = Simulation::getCurrent()->getModel(); + const SimulationModel::RigidBodyVector &rigidBodies = model->getRigidBodies(); + RigidBody *rb = rigidBodies[co->m_bodyIndex]; + + const Vector3r &com = rb->getPosition(); + const Matrix3r &R = rb->getTransformationR(); + const Vector3r &v1 = rb->getTransformationV1(); + const Vector3r &v2 = rb->getTransformationV2(); + + DistanceFieldCollisionDetection::DistanceFieldCollisionObject *dfco = (DistanceFieldCollisionDetection::DistanceFieldCollisionObject *)co; + const Vector3r &startX = co->m_aabb.m_p[0]; + const Vector3r &endX = co->m_aabb.m_p[1]; + Vector3r diff = endX - startX; + const unsigned int steps = 20; + Vector3r stepSize = (1.0 / steps) * diff; + for (Real x = startX[0]; x < endX[0]; x += stepSize[0]) + { + for (Real y = startX[1]; y < endX[1]; y += stepSize[1]) + { + for (Real z = startX[2]; z < endX[2]; z += stepSize[2]) + { + Vector3r pos_w(x, y, z); + const Vector3r pos = R * (pos_w - com) + v1; + const double dist = dfco->distance(pos.template cast(), 0.0); + + if (dist < 0.0) + { + float col[4] = { (float)-dist, 0.0f, 0.0f, 1.0f }; + MiniGL::drawPoint(pos_w, 3.0f, col); + } + } + } + } +} + +void DemoBase::renderBallJoint(BallJoint &bj) +{ + MiniGL::drawSphere(bj.m_jointInfo.col(2), 0.15f, m_jointColor); +} + +void DemoBase::renderRigidBodyParticleBallJoint(RigidBodyParticleBallJoint &bj) +{ + MiniGL::drawSphere(bj.m_jointInfo.col(1), 0.1f, m_jointColor); +} + +void DemoBase::renderBallOnLineJoint(BallOnLineJoint &bj) +{ + MiniGL::drawSphere(bj.m_jointInfo.col(5), 0.1f, m_jointColor); + MiniGL::drawCylinder(bj.m_jointInfo.col(5) - bj.m_jointInfo.col(7), bj.m_jointInfo.col(5) + bj.m_jointInfo.col(7), m_jointColor, 0.05f); +} + +void DemoBase::renderHingeJoint(HingeJoint &joint) +{ + SimulationModel *model = Simulation::getCurrent()->getModel(); + const SimulationModel::RigidBodyVector &rigidBodies = model->getRigidBodies(); + RigidBody *rb = rigidBodies[joint.m_bodies[0]]; + + const Vector3r &c = joint.m_jointInfo.block<3, 1>(0, 4); + const Vector3r &axis_local = joint.m_jointInfo.block<3, 1>(0, 6); + const Vector3r axis = rb->getRotation().matrix() * axis_local; + + MiniGL::drawSphere(c - 0.5*axis, 0.1f, m_jointColor); + MiniGL::drawSphere(c + 0.5*axis, 0.1f, m_jointColor); + MiniGL::drawCylinder(c - 0.5*axis, c + 0.5*axis, m_jointColor, 0.05f); +} + +void DemoBase::renderUniversalJoint(UniversalJoint &uj) +{ + MiniGL::drawSphere(uj.m_jointInfo.col(4) - 0.5*uj.m_jointInfo.col(6), 0.1f, m_jointColor); + MiniGL::drawSphere(uj.m_jointInfo.col(4) + 0.5*uj.m_jointInfo.col(6), 0.1f, m_jointColor); + MiniGL::drawSphere(uj.m_jointInfo.col(5) - 0.5*uj.m_jointInfo.col(7), 0.1f, m_jointColor); + MiniGL::drawSphere(uj.m_jointInfo.col(5) + 0.5*uj.m_jointInfo.col(7), 0.1f, m_jointColor); + MiniGL::drawCylinder(uj.m_jointInfo.col(4) - 0.5*uj.m_jointInfo.col(6), uj.m_jointInfo.col(4) + 0.5*uj.m_jointInfo.col(6), m_jointColor, 0.05f); + MiniGL::drawCylinder(uj.m_jointInfo.col(5) - 0.5*uj.m_jointInfo.col(7), uj.m_jointInfo.col(5) + 0.5*uj.m_jointInfo.col(7), m_jointColor, 0.05f); +} + +void DemoBase::renderSliderJoint(SliderJoint &joint) +{ + SimulationModel *model = Simulation::getCurrent()->getModel(); + const SimulationModel::RigidBodyVector &rigidBodies = model->getRigidBodies(); + RigidBody *rb = rigidBodies[joint.m_bodies[0]]; + + Quaternionr qR0; + qR0.coeffs() = joint.m_jointInfo.col(1); + const Vector3r &c = rb->getPosition(); + Vector3r axis = qR0.matrix().col(0); + MiniGL::drawSphere(c, 0.1f, m_jointColor); + MiniGL::drawCylinder(c - axis, c + axis, m_jointColor, 0.05f); +} + +void DemoBase::renderTargetPositionMotorSliderJoint(TargetPositionMotorSliderJoint &joint) +{ + SimulationModel *model = Simulation::getCurrent()->getModel(); + const SimulationModel::RigidBodyVector &rigidBodies = model->getRigidBodies(); + RigidBody *rb = rigidBodies[joint.m_bodies[0]]; + + const Vector3r &c = rb->getPosition(); + Vector3r axis = joint.m_jointInfo.block<3, 1>(0, 1); + MiniGL::drawSphere(c, 0.1f, m_jointColor); + MiniGL::drawCylinder(c - axis, c + axis, m_jointColor, 0.05f); +} + +void DemoBase::renderTargetVelocityMotorSliderJoint(TargetVelocityMotorSliderJoint &joint) +{ + SimulationModel *model = Simulation::getCurrent()->getModel(); + const SimulationModel::RigidBodyVector &rigidBodies = model->getRigidBodies(); + RigidBody *rb = rigidBodies[joint.m_bodies[0]]; + + Quaternionr qR0; + qR0.coeffs() = joint.m_jointInfo.col(1); + const Vector3r &c = rb->getPosition(); + Vector3r axis = qR0.matrix().col(0); + MiniGL::drawSphere(c, 0.1f, m_jointColor); + MiniGL::drawCylinder(c - axis, c + axis, m_jointColor, 0.05f); +} + +void DemoBase::renderTargetAngleMotorHingeJoint(TargetAngleMotorHingeJoint &joint) +{ + SimulationModel *model = Simulation::getCurrent()->getModel(); + const SimulationModel::RigidBodyVector &rigidBodies = model->getRigidBodies(); + RigidBody *rb = rigidBodies[joint.m_bodies[0]]; + + const Vector3r &c = joint.m_jointInfo.block<3, 1>(0, 5); + const Vector3r &axis_local = joint.m_jointInfo.block<3, 1>(0, 7); + const Vector3r axis = rb->getRotation().matrix() * axis_local; + + MiniGL::drawSphere(c - 0.5*axis, 0.1f, m_jointColor); + MiniGL::drawSphere(c + 0.5*axis, 0.1f, m_jointColor); + MiniGL::drawCylinder(c - 0.5*axis, c + 0.5*axis, m_jointColor, 0.05f); +} + +void DemoBase::renderTargetVelocityMotorHingeJoint(TargetVelocityMotorHingeJoint &joint) +{ + SimulationModel *model = Simulation::getCurrent()->getModel(); + const SimulationModel::RigidBodyVector &rigidBodies = model->getRigidBodies(); + RigidBody *rb = rigidBodies[joint.m_bodies[0]]; + + const Vector3r &c = joint.m_jointInfo.block<3, 1>(0, 5); + const Vector3r axis = joint.m_jointInfo.block<3, 1>(0, 7); + + MiniGL::drawSphere(c - 0.5*axis, 0.1f, m_jointColor); + MiniGL::drawSphere(c + 0.5*axis, 0.1f, m_jointColor); + MiniGL::drawCylinder(c - 0.5*axis, c + 0.5*axis, m_jointColor, 0.05f); +} + +void DemoBase::renderRigidBodyContact(RigidBodyContactConstraint &cc) +{ + float col1[4] = { 0.0f, 0.6f, 0.2f, 1 }; + float col2[4] = { 0.6f, 0.0f, 0.2f, 1 }; + MiniGL::drawPoint(cc.m_constraintInfo.col(0), 5.0f, col1); + MiniGL::drawPoint(cc.m_constraintInfo.col(1), 5.0f, col2); + MiniGL::drawVector(cc.m_constraintInfo.col(1), cc.m_constraintInfo.col(1) + cc.m_constraintInfo.col(2), 1.0f, col2); +} + +void DemoBase::renderParticleRigidBodyContact(ParticleRigidBodyContactConstraint &cc) +{ + float col1[4] = { 0.0f, 0.6f, 0.2f, 1 }; + float col2[4] = { 0.6f, 0.0f, 0.2f, 1 }; + MiniGL::drawPoint(cc.m_constraintInfo.col(0), 5.0f, col1); + MiniGL::drawPoint(cc.m_constraintInfo.col(1), 5.0f, col2); + MiniGL::drawVector(cc.m_constraintInfo.col(1), cc.m_constraintInfo.col(1) + cc.m_constraintInfo.col(2), 1.0f, col2); +} + +void DemoBase::renderSpring(RigidBodySpring &s) +{ + MiniGL::drawSphere(s.m_jointInfo.col(2), 0.1f, m_jointColor); + MiniGL::drawSphere(s.m_jointInfo.col(3), 0.1f, m_jointColor); + MiniGL::drawCylinder(s.m_jointInfo.col(2), s.m_jointInfo.col(3), m_jointColor, 0.05f); +} + +void DemoBase::renderDistanceJoint(DistanceJoint &j) +{ + MiniGL::drawSphere(j.m_jointInfo.col(2), 0.1f, m_jointColor); + MiniGL::drawSphere(j.m_jointInfo.col(3), 0.1f, m_jointColor); + MiniGL::drawCylinder(j.m_jointInfo.col(2), j.m_jointInfo.col(3), m_jointColor, 0.05f); +} + +void DemoBase::renderDamperJoint(DamperJoint &joint) +{ + SimulationModel *model = Simulation::getCurrent()->getModel(); + const SimulationModel::RigidBodyVector &rigidBodies = model->getRigidBodies(); + RigidBody *rb = rigidBodies[joint.m_bodies[0]]; + + Quaternionr qR0; + qR0.coeffs() = joint.m_jointInfo.col(1); + const Vector3r &c = rb->getPosition(); + Vector3r axis = qR0.matrix().col(0); + MiniGL::drawSphere(c, 0.1f, m_jointColor); + MiniGL::drawCylinder(c - axis, c + axis, m_jointColor, 0.05f); +} + +void DemoBase::mouseMove(int x, int y, void *clientData) +{ + DemoBase *base = (DemoBase*)clientData; + SimulationModel *model = Simulation::getCurrent()->getModel(); + + Vector3r mousePos; + MiniGL::unproject(x, y, mousePos); + const Vector3r diff = mousePos - base->m_oldMousePos; + + TimeManager *tm = TimeManager::getCurrent(); + const Real h = tm->getTimeStepSize(); + + SimulationModel::RigidBodyVector &rb = model->getRigidBodies(); + for (size_t j = 0; j < base->m_selectedBodies.size(); j++) + { + const Real mass = rb[base->m_selectedBodies[j]]->getMass(); + if (mass != 0.0) + rb[base->m_selectedBodies[j]]->getVelocity() += 3.0 / h * diff; + } + ParticleData &pd = model->getParticles(); + for (unsigned int j = 0; j < base->m_selectedParticles.size(); j++) + { + const Real mass = pd.getMass(base->m_selectedParticles[j]); + if (mass != 0.0) + pd.getVelocity(base->m_selectedParticles[j]) += 5.0*diff / h; + } + base->m_oldMousePos = mousePos; +} + +void DemoBase::selection(const Vector2i &start, const Vector2i &end, void *clientData) +{ + SimulationModel *model = Simulation::getCurrent()->getModel(); + DemoBase *base = (DemoBase*)clientData; + + std::vector hits; + + base->m_selectedParticles.clear(); + ParticleData &pd = model->getParticles(); + if (pd.size() > 0) + Selection::selectRect(start, end, &pd.getPosition(0), &pd.getPosition(pd.size() - 1), base->m_selectedParticles); + + base->m_selectedBodies.clear(); + SimulationModel::RigidBodyVector &rb = model->getRigidBodies(); + std::vector > x; + x.resize(rb.size()); + for (unsigned int i = 0; i < rb.size(); i++) + { + x[i] = rb[i]->getPosition(); + } + + if (rb.size() > 0) + Selection::selectRect(start, end, &x[0], &x[rb.size() - 1], base->m_selectedBodies); + if ((base->m_selectedBodies.size() > 0) || (base->m_selectedParticles.size() > 0)) + MiniGL::setMouseMoveFunc(2, mouseMove); + else + MiniGL::setMouseMoveFunc(-1, NULL); + + MiniGL::unproject(end[0], end[1], base->m_oldMousePos); +} + +void DemoBase::reset() +{ + m_nextFrameTime = 0.0; + m_frameCounter = 1; +} + +void DemoBase::loadMesh(const std::string& filename, VertexData& vd, Utilities::IndexedFaceMesh& mesh, const Vector3r& translation, + const Matrix3r& rotation, const Vector3r& scale) +{ + string ext = FileSystem::getFileExt(filename); + transform(ext.begin(), ext.end(), ext.begin(), ::toupper); + + std::vector> x; + if (ext == "OBJ") + { + std::vector normals; + std::vector texCoords; + std::vector faces; + OBJLoader::Vec3f s = { (float)scale[0], (float)scale[1], (float)scale[2] }; + OBJLoader::loadObj(filename, &x, &faces, &normals, &texCoords, s); + + mesh.release(); + const unsigned int nPoints = (unsigned int)x.size(); + const unsigned int nFaces = (unsigned int)faces.size(); + const unsigned int nTexCoords = (unsigned int)texCoords.size(); + mesh.initMesh(nPoints, nFaces * 2, nFaces); + vd.reserve(nPoints); + for (unsigned int i = 0; i < nPoints; i++) + { + vd.addVertex(Vector3r(x[i][0], x[i][1], x[i][2])); + } + for (unsigned int i = 0; i < nTexCoords; i++) + { + mesh.addUV(texCoords[i][0], texCoords[i][1]); + } + for (unsigned int i = 0; i < nFaces; i++) + { + int posIndices[3]; + int texIndices[3]; + for (int j = 0; j < 3; j++) + { + posIndices[j] = faces[i].posIndices[j]; + if (nTexCoords > 0) + { + texIndices[j] = faces[i].texIndices[j]; + mesh.addUVIndex(texIndices[j]); + } + } + + mesh.addFace(&posIndices[0]); + } + mesh.buildNeighbors(); + + mesh.updateNormals(vd, 0); + mesh.updateVertexNormals(vd); + + LOG_INFO << "Number of triangles: " << nFaces; + LOG_INFO << "Number of vertices: " << nPoints; + } + else if (ext == "PLY") + { + std::vector> faces; + OBJLoader::Vec3f s = { (float)scale[0], (float)scale[1], (float)scale[2] }; + PLYLoader::loadPly(filename, x, faces, s); + + mesh.release(); + const unsigned int nPoints = (unsigned int)x.size(); + const unsigned int nFaces = (unsigned int)faces.size(); + mesh.initMesh(nPoints, nFaces * 2, nFaces); + vd.reserve(nPoints); + for (unsigned int i = 0; i < nPoints; i++) + { + vd.addVertex(Vector3r(x[i][0], x[i][1], x[i][2])); + } + for (unsigned int i = 0; i < nFaces; i++) + { + int posIndices[3]; + for (int j = 0; j < 3; j++) + posIndices[j] = faces[i][j]; + + mesh.addFace(&posIndices[0]); + } + + LOG_INFO << "Number of triangles: " << nFaces; + LOG_INFO << "Number of vertices: " << nPoints; + + } + else + LOG_ERR << "File " << filename << " has a unknown file type."; +} + +void DemoBase::exportMeshOBJ(const std::string& exportFileName, const unsigned int nVert, const Vector3r* pos, const unsigned int nTri, const unsigned int* faces) +{ + // Open the file + std::ofstream outfile(exportFileName); + if (!outfile) + { + LOG_WARN << "Cannot open a file to save OBJ mesh."; + return; + } + + // Header + outfile << "# Created by the PositionBasedDynamics library\n"; + outfile << "g default\n"; + + // Vertices + { + for (auto j = 0u; j < nVert; j++) + { + const Vector3r& x = pos[j]; + outfile << "v " << x[0] << " " << x[1] << " " << x[2] << "\n"; + } + } + + // faces + { + for (auto j = 0u; j < nTri; j++) + { + outfile << "f " << faces[3 * j + 0] + 1 << " " << faces[3 * j + 1] + 1 << " " << faces[3 * j + 2] + 1 << "\n"; + } + } + outfile.close(); +} + + +void DemoBase::exportOBJ() +{ + if (!m_enableExportOBJ) + return; + + if (TimeManager::getCurrent()->getTime() < m_nextFrameTime) + return; + + m_nextFrameTime += 1.0 / (Real)m_exportFPS; + + ////////////////////////////////////////////////////////////////////////// + // rigid bodies + ////////////////////////////////////////////////////////////////////////// + + std::string exportPath = getOutputPath() + "/export"; + FileSystem::makeDirs(exportPath); + + SimulationModel* model = Simulation::getCurrent()->getModel(); + const ParticleData& pd = model->getParticles(); + for (unsigned int i = 0; i < model->getTriangleModels().size(); i++) + { + const IndexedFaceMesh& mesh = model->getTriangleModels()[i]->getParticleMesh(); + const unsigned int offset = model->getTriangleModels()[i]->getIndexOffset(); + const Vector3r* x = model->getParticles().getVertices().data(); + + std::string fileName = "triangle_model"; + fileName = fileName + std::to_string(i) + "_" + std::to_string(m_frameCounter) + ".obj"; + std::string exportFileName = FileSystem::normalizePath(exportPath + "/" + fileName); + + exportMeshOBJ(exportFileName, mesh.numVertices(), &x[offset], mesh.numFaces(), mesh.getFaces().data()); + } + + for (unsigned int i = 0; i < model->getTetModels().size(); i++) + { + const IndexedFaceMesh& mesh = model->getTetModels()[i]->getVisMesh(); + // has a vis mesh + if (mesh.numVertices() > 0) + { + const Vector3r* x = model->getTetModels()[i]->getVisVertices().getVertices().data(); + + std::string fileName = "tet_model"; + fileName = fileName + std::to_string(i) + "_" + std::to_string(m_frameCounter) + ".obj"; + std::string exportFileName = FileSystem::normalizePath(exportPath + "/" + fileName); + + exportMeshOBJ(exportFileName, mesh.numVertices(), x, mesh.numFaces(), mesh.getFaces().data()); + } + else + { + const IndexedFaceMesh& mesh = model->getTetModels()[i]->getSurfaceMesh(); + const unsigned int offset = model->getTetModels()[i]->getIndexOffset(); + const Vector3r* x = model->getParticles().getVertices().data(); + + std::string fileName = "tet_model"; + fileName = fileName + std::to_string(i) + "_" + std::to_string(m_frameCounter) + ".obj"; + std::string exportFileName = FileSystem::normalizePath(exportPath + "/" + fileName); + + exportMeshOBJ(exportFileName, mesh.numVertices(), &x[offset], mesh.numFaces(), mesh.getFaces().data()); + } + } + + for (unsigned int i = 0; i < model->getRigidBodies().size(); i++) + { + const IndexedFaceMesh& mesh = model->getRigidBodies()[i]->getGeometry().getMesh(); + const Vector3r* x = model->getRigidBodies()[i]->getGeometry().getVertexData().getVertices().data(); + + std::string fileName = "rigid_body"; + fileName = fileName + std::to_string(i) + "_" + std::to_string(m_frameCounter) + ".obj"; + std::string exportFileName = FileSystem::normalizePath(exportPath + "/" + fileName); + + exportMeshOBJ(exportFileName, mesh.numVertices(), x, mesh.numFaces(), mesh.getFaces().data()); + } + + + m_frameCounter++; +} + +void DemoBase::exportMeshPLY(const std::string& exportFileName, const unsigned int nVert, const Vector3r* pos, const unsigned int nTri, const unsigned int* faces) +{ + // Suppose these hold your data + std::vector> meshVertexPositions; + std::vector> meshFaceIndices; + + // vertices + meshVertexPositions.resize(nVert); + for (auto j = 0u; j < nVert; j++) + meshVertexPositions[j] = { pos[j][0], pos[j][1], pos[j][2] }; + + // faces + meshFaceIndices.resize(nTri); + for (auto j = 0u; j < nTri; j++) + { + meshFaceIndices[j].resize(3); + meshFaceIndices[j] = { faces[3 * j], faces[3 * j + 1], faces[3 * j + 2] }; + } + + // Create an empty object + happly::PLYData plyOut; + + // Add mesh data (elements are created automatically) + plyOut.addVertexPositions(meshVertexPositions); + plyOut.addFaceIndices(meshFaceIndices); + + + // Write the object to file + plyOut.write(exportFileName, happly::DataFormat::Binary); +} + +void DemoBase::exportPLY() +{ + if (!m_enableExportPLY) + return; + + if (TimeManager::getCurrent()->getTime() < m_nextFrameTime) + return; + + m_nextFrameTime += 1.0 / (Real)m_exportFPS; + + ////////////////////////////////////////////////////////////////////////// + // rigid bodies + ////////////////////////////////////////////////////////////////////////// + + std::string exportPath = getOutputPath() + "/export"; + FileSystem::makeDirs(exportPath); + + SimulationModel* model = Simulation::getCurrent()->getModel(); + const ParticleData& pd = model->getParticles(); + for (unsigned int i = 0; i < model->getTriangleModels().size(); i++) + { + const IndexedFaceMesh& mesh = model->getTriangleModels()[i]->getParticleMesh(); + const unsigned int offset = model->getTriangleModels()[i]->getIndexOffset(); + const Vector3r* x = model->getParticles().getVertices().data(); + + std::string fileName = "triangle_model"; + fileName = fileName + std::to_string(i) + "_" + std::to_string(m_frameCounter) + ".ply"; + std::string exportFileName = FileSystem::normalizePath(exportPath + "/" + fileName); + + exportMeshPLY(exportFileName, mesh.numVertices(), &x[offset], mesh.numFaces(), mesh.getFaces().data()); + } + + for (unsigned int i = 0; i < model->getTetModels().size(); i++) + { + const IndexedFaceMesh& mesh = model->getTetModels()[i]->getVisMesh(); + // has a vis mesh + if (mesh.numVertices() > 0) + { + const Vector3r* x = model->getTetModels()[i]->getVisVertices().getVertices().data(); + + std::string fileName = "tet_model"; + fileName = fileName + std::to_string(i) + "_" + std::to_string(m_frameCounter) + ".ply"; + std::string exportFileName = FileSystem::normalizePath(exportPath + "/" + fileName); + + exportMeshPLY(exportFileName, mesh.numVertices(), x, mesh.numFaces(), mesh.getFaces().data()); + } + else + { + const IndexedFaceMesh& mesh = model->getTetModels()[i]->getSurfaceMesh(); + const unsigned int offset = model->getTetModels()[i]->getIndexOffset(); + const Vector3r* x = model->getParticles().getVertices().data(); + + std::string fileName = "tet_model"; + fileName = fileName + std::to_string(i) + "_" + std::to_string(m_frameCounter) + ".ply"; + std::string exportFileName = FileSystem::normalizePath(exportPath + "/" + fileName); + + exportMeshPLY(exportFileName, mesh.numVertices(), &x[offset], mesh.numFaces(), mesh.getFaces().data()); + } + } + + for (unsigned int i = 0; i < model->getRigidBodies().size(); i++) + { + const IndexedFaceMesh& mesh = model->getRigidBodies()[i]->getGeometry().getMesh(); + const Vector3r* x = model->getRigidBodies()[i]->getGeometry().getVertexData().getVertices().data(); + + std::string fileName = "rigid_body"; + fileName = fileName + std::to_string(i) + "_" + std::to_string(m_frameCounter) + ".ply"; + std::string exportFileName = FileSystem::normalizePath(exportPath + "/" + fileName); + + exportMeshPLY(exportFileName, mesh.numVertices(), x, mesh.numFaces(), mesh.getFaces().data()); + } + + + m_frameCounter++; +} + + +void DemoBase::step() +{ + exportOBJ(); + exportPLY(); +} + diff --git a/Demos/Common/DemoBase.h b/Demos/Common/DemoBase.h new file mode 100644 index 00000000..f9ae14ce --- /dev/null +++ b/Demos/Common/DemoBase.h @@ -0,0 +1,145 @@ +#ifndef __DemoBase_h__ +#define __DemoBase_h__ + +#include "Common/Common.h" +#include "Utils/SceneLoader.h" +#include "Demos/Visualization/Shader.h" +#include "Simulation/TimeStep.h" +#include "Simulation/SimulationModel.h" +#include "ParameterObject.h" +#include "Simulator_GUI_imgui.h" + +namespace PBD +{ + class DemoBase : public GenParam::ParameterObject + { + protected: + unsigned int m_numberOfStepsPerRenderUpdate; + std::string m_exePath; + std::string m_outputPath; + std::string m_sceneFile; + std::string m_sceneName; + bool m_useCache; + GLint m_context_major_version; + GLint m_context_minor_version; + Shader m_shader; + Shader m_shaderFlat; + Shader m_shaderTex; + bool m_doPause; + Real m_pauseAt; + bool m_renderTets; + bool m_renderRefTets; + bool m_renderContacts; + bool m_renderAABB; + bool m_renderSDF; + int m_renderBVHDepth; + int m_renderBVHDepthTets; + Vector3r m_oldMousePos; + std::vector m_selectedBodies; + std::vector m_selectedParticles; + Utilities::SceneLoader *m_sceneLoader; + Utilities::SceneLoader::SceneData m_scene; + float m_jointColor[4] = { 0.0f, 0.6f, 0.2f, 1 }; + Simulator_GUI_imgui *m_gui; + bool m_enableExportOBJ; + bool m_enableExportPLY; + unsigned int m_exportFPS; + Real m_nextFrameTime; + unsigned int m_frameCounter; + + + virtual void initParameters(); + + void initShaders(); + + static void selection(const Vector2i &start, const Vector2i &end, void *clientData); + static void mouseMove(int x, int y, void *clientData); + + void renderTriangleModels(); + void renderTetModels(); + void renderAABB(AABB &aabb); + void renderSDF(CollisionDetection::CollisionObject* co); + void renderBallJoint(BallJoint &bj); + void renderRigidBodyParticleBallJoint(RigidBodyParticleBallJoint &bj); + void renderBallOnLineJoint(BallOnLineJoint &bj); + void renderHingeJoint(HingeJoint &hj); + void renderUniversalJoint(UniversalJoint &uj); + void renderSliderJoint(SliderJoint &joint); + void renderTargetPositionMotorSliderJoint(TargetPositionMotorSliderJoint &joint); + void renderTargetVelocityMotorSliderJoint(TargetVelocityMotorSliderJoint &joint); + void renderTargetAngleMotorHingeJoint(TargetAngleMotorHingeJoint &hj); + void renderTargetVelocityMotorHingeJoint(TargetVelocityMotorHingeJoint &hj); + void renderRigidBodyContact(RigidBodyContactConstraint &cc); + void renderParticleRigidBodyContact(ParticleRigidBodyContactConstraint &cc); + void renderSpring(RigidBodySpring &s); + void renderDistanceJoint(DistanceJoint &j); + void renderDamperJoint(DamperJoint &j); + + void exportMeshOBJ(const std::string& exportFileName, const unsigned int nVert, const Vector3r* pos, const unsigned int nTri, const unsigned int* faces); + void exportMeshPLY(const std::string& exportFileName, const unsigned int nVert, const Vector3r* pos, const unsigned int nTri, const unsigned int* faces); + void exportOBJ(); + void exportPLY(); + + public: + static int PAUSE; + static int PAUSE_AT; + static int NUM_STEPS_PER_RENDER; + static int RENDER_TETS; + static int RENDER_TETS0; + static int RENDER_CONTACTS; + static int RENDER_AABB; + static int RENDER_SDF; + static int RENDER_BVH; + static int RENDER_BVH_TETS; + static int EXPORT_OBJ; + static int EXPORT_PLY; + static int EXPORT_FPS; + + DemoBase(); + virtual ~DemoBase(); + + void init(int argc, char **argv, const char *demoName); + + void createParameterGUI(); + + void render(); + void cleanup(); + + void readParameters(); + void readScene(); + void reset(); + void step(); + + Utilities::SceneLoader *getSceneLoader() { return m_sceneLoader; } + void setSceneLoader(Utilities::SceneLoader *sceneLoader) { m_sceneLoader = sceneLoader; } + + const std::string& getExePath() const { return m_exePath; } + const std::string& getSceneFile() const { return m_sceneFile; } + const std::string& getSceneName() const { return m_sceneName; } + + GLint getContextMajorVersion() const { return m_context_major_version; } + GLint getContextMinorVersion() const { return m_context_minor_version; } + Shader& getShader() { return m_shader; } + Shader& getShaderTex() { return m_shaderTex; } + Shader& getShaderFlat() { return m_shaderFlat; } + void shaderTexBegin(const float *col); + void shaderTexEnd(); + void shaderBegin(const float *col); + void shaderEnd(); + void shaderFlatBegin(const float* col); + void shaderFlatEnd(); + + std::vector& getSelectedParticles() { return m_selectedParticles; } + std::vector& getSelectedRigidBodies() { return m_selectedBodies; } + bool getUseCache() const { return m_useCache; } + void setUseCache(bool val) { m_useCache = val; } + std::string getOutputPath() const { return m_outputPath; } + + Utilities::SceneLoader::SceneData& getSceneData() { return m_scene; } + + static void loadMesh(const std::string& filename, VertexData& vd, Utilities::IndexedFaceMesh& mesh, const Vector3r& translation = Vector3r::Zero(), + const Matrix3r& rotation = Matrix3r::Identity(), const Vector3r& scale = Vector3r::Ones()); + }; +} + +#endif \ No newline at end of file diff --git a/Demos/Common/LogWindow.cpp b/Demos/Common/LogWindow.cpp new file mode 100644 index 00000000..efe36e4b --- /dev/null +++ b/Demos/Common/LogWindow.cpp @@ -0,0 +1,100 @@ +#include "LogWindow.h" +#include "imgui_internal.h" + + +using namespace std; +using namespace PBD; +using namespace Utilities; + + +LogWindow::LogWindow() +{ + m_lastSize = 0; + m_selectedFilter = 1; +} + +LogWindow::~LogWindow(void) +{ +} + +void LogWindow::drawWindow(ImFont* textFont) +{ + if (m_bufferSink != 0) + { + std::vector>& buffer = m_bufferSink->getBuffer(); + + float alpha = 0.8f; + if (ImGui::IsWindowDocked()) + alpha = 1.0f; + ImGui::PushStyleColor(ImGuiCol_WindowBg, ImVec4(0.1f, 0.1f, 0.1f, alpha)); + + ImGui::Begin("Log"); + + if (ImGui::Button("Clear")) + m_bufferSink->clearBuffer(); + ImGui::SameLine(); + bool copy = ImGui::Button("Copy"); + ImGui::SameLine(); + + const char* items[] = { "Debug", "Info", "Warning", "Error" }; + const char* currentItem = items[m_selectedFilter]; + ImGui::PushItemWidth(200.0f); + if (ImGui::BeginCombo("Filter", currentItem)) + { + for (int n = 0; n < IM_ARRAYSIZE(items); n++) + { + const bool is_selected = (m_selectedFilter == n); + if (ImGui::Selectable(items[n], is_selected)) + { + if (n != m_selectedFilter) + m_selectedFilter = n; + } + if (is_selected) + ImGui::SetItemDefaultFocus(); + } + ImGui::EndCombo(); + } + ImGui::PopItemWidth(); + + + ImGui::Separator(); + ImGui::BeginChild("Scrolling"); + ImGui::PushStyleVar(ImGuiStyleVar_ItemSpacing, ImVec2(0, 1)); + if (copy) + ImGui::LogToClipboard(); + + ImGui::PushFont(textFont); + for (size_t i = 0; i < buffer.size(); i++) + { + if ((m_selectedFilter == 0) && (buffer[i].first == LogLevel::DEBUG)) + ImGui::TextColored(ImVec4(0.4f, 1.0f, 0.4f, 1.0f), buffer[i].second.c_str()); + else if ((m_selectedFilter <= 1) && (buffer[i].first == LogLevel::INFO)) + ImGui::TextColored(ImVec4(1.0f, 1.0f, 1.0f, 1.0f), buffer[i].second.c_str()); + else if ((m_selectedFilter <= 2) && (buffer[i].first == LogLevel::WARN)) + ImGui::TextColored(ImVec4(1.0f, 1.0f, 0.0f, 1.0f), buffer[i].second.c_str()); + else if ((m_selectedFilter <= 3) && (buffer[i].first == LogLevel::ERR)) + ImGui::TextColored(ImVec4(1.0f, 0.5f, 0.5f, 1.0f), buffer[i].second.c_str()); + } + ImGui::PopFont(); + // if there are new lines, scroll to bottom + if (buffer.size() > m_lastSize) + { + m_lastSize = buffer.size(); + ImGui::SetScrollHereY(1.0f); + } + ImGui::PopStyleVar(); + ImGui::EndChild(); + ImGui::PopStyleColor(1); + ImGui::End(); + } + else + { + auto& sinks = Utilities::logger.getSinks(); + for (auto it = sinks.begin(); it != sinks.end(); it++) + { + m_bufferSink = dynamic_pointer_cast(*it); + if (m_bufferSink != 0) + break; + } + } +} diff --git a/Demos/Common/LogWindow.h b/Demos/Common/LogWindow.h new file mode 100644 index 00000000..5dce94a2 --- /dev/null +++ b/Demos/Common/LogWindow.h @@ -0,0 +1,31 @@ +#ifndef __LogWindow_h__ +#define __LogWindow_h__ + +#include "Common/Common.h" +#include "Utils/Logger.h" +#include +#include "imgui.h" + +struct ImFont; + +namespace PBD +{ + class LogWindow + { + protected: + std::shared_ptr m_bufferSink; + bool m_scrollToBottom; + size_t m_lastSize; + int m_selectedFilter; + + public: + LogWindow(); + ~LogWindow(); + + void drawWindow(ImFont *textFont); + int getSelectedFilter() const { return m_selectedFilter; } + void setSelectedFilter(const int i) { m_selectedFilter = i; } + }; +} + +#endif \ No newline at end of file diff --git a/Demos/Common/Simulator_GUI_imgui.cpp b/Demos/Common/Simulator_GUI_imgui.cpp new file mode 100644 index 00000000..1680a32e --- /dev/null +++ b/Demos/Common/Simulator_GUI_imgui.cpp @@ -0,0 +1,427 @@ +#include "Simulator_GUI_imgui.h" +#include "Demos/Visualization/MiniGL.h" +#include "DemoBase.h" +#include "imguiParameters.h" +#include "Utils/FileSystem.h" +#include "Simulation/Simulation.h" +#include "Simulation/TimeManager.h" +#include "LogWindow.h" + +#include "imgui.h" +#include "imgui_internal.h" +#include "backends/imgui_impl_glfw.h" +#include "backends/imgui_impl_opengl3.h" + + +using namespace PBD; +using namespace Utilities; + +Simulator_GUI_imgui::Simulator_GUI_imgui(DemoBase *base) +{ + m_base = base; + m_currentScaleIndex = 0; + m_vsync = false; + m_iniFound = false; + m_showLogWindow = true; +} + +Simulator_GUI_imgui::~Simulator_GUI_imgui(void) +{ + imguiParameters::cleanup(); + delete m_logWindow; +} + +void Simulator_GUI_imgui::init() +{ + m_logWindow = new LogWindow(); + + // Setup Dear ImGui context + IMGUI_CHECKVERSION(); + m_context = ImGui::CreateContext(); + + // Add .ini handle for UserData type + ImGuiSettingsHandler ini_handler; + ini_handler.TypeName = "PBDSimulator"; + ini_handler.TypeHash = ImHashStr("PBDSimulator"); + ini_handler.ReadOpenFn = readOpenIni; + ini_handler.ReadLineFn = readIni; + ini_handler.WriteAllFn = writeIni; + ini_handler.ApplyAllFn = applySettings; + ini_handler.UserData = this; + m_context->SettingsHandlers.push_back(ini_handler); + + // load ini file before window is created + ImGuiIO& io = ImGui::GetIO(); (void)io; + io.ConfigFlags |= ImGuiConfigFlags_DockingEnable; // Enable Docking + ImGui::LoadIniSettingsFromDisk(io.IniFilename); +} + +void Simulator_GUI_imgui::initStyle() +{ + m_context->Style = ImGuiStyle(); + + // Setup Dear ImGui style + ImGui::StyleColorsDark(); + + ImGuiStyle* style = &ImGui::GetStyle(); + ImVec4* colors = style->Colors; + colors[ImGuiCol_Text] = ImVec4(1.00f, 1.00f, 1.00f, 1.00f); + colors[ImGuiCol_WindowBg] = ImVec4(0.1f, 0.1f, 0.1f, 1.0f); + style->FrameBorderSize = 0.5f; + style->FrameRounding = 3.0f; + style->TabBorderSize = 1.0f; + style->WindowRounding = 6.0f; + style->ScaleAllSizes(1); +} + +void* Simulator_GUI_imgui::readOpenIni(ImGuiContext* ctx, ImGuiSettingsHandler* handler, const char* name) +{ + Simulator_GUI_imgui* gui = (Simulator_GUI_imgui*)handler->UserData; + return &gui->m_userSettings; +} + +void Simulator_GUI_imgui::readIni(ImGuiContext* ctx, ImGuiSettingsHandler* handler, void* entry, const char* line) +{ + Simulator_GUI_imgui* gui = (Simulator_GUI_imgui*)handler->UserData; + UserSettings* settings = (UserSettings*)entry; + int x, y, w, h; + int i; + if (sscanf(line, "pos=%d,%d", &x, &y) == 2) { settings->win_x = x; settings->win_y = y; } + else if (sscanf(line, "size=%d,%d", &w, &h) == 2) { settings->win_width = w; settings->win_height = h; } + else if (sscanf(line, "scale=%d", &i) == 1) { settings->scaleIndex = i; } + else if (sscanf(line, "maximized=%d", &i) == 1) { settings->maximized = (i != 0); } + else if (sscanf(line, "vsync=%d", &i) == 1) { settings->vsync = (i != 0); } + else if (sscanf(line, "show_log_window=%d", &i) == 1) { settings->show_log_window = (i != 0); } + else if (sscanf(line, "log_filter=%d", &i) == 1) { settings->log_filter = i; } +} + +void Simulator_GUI_imgui::writeIni(ImGuiContext* ctx, ImGuiSettingsHandler* handler, ImGuiTextBuffer* out_buf) +{ + Simulator_GUI_imgui* gui = (Simulator_GUI_imgui*)handler->UserData; + out_buf->reserve(out_buf->size() + 200); + out_buf->appendf("[%s][%s]\n", handler->TypeName, "Settings"); + out_buf->appendf("scale=%d\n", gui->m_currentScaleIndex); + + int x, y; + MiniGL::getWindowPos(x, y); + out_buf->appendf("pos=%d,%d\n", x, y); + + int w, h; + MiniGL::getWindowSize(w, h); + out_buf->appendf("size=%d,%d\n", w, h); + out_buf->appendf("maximized=%d\n", MiniGL::getWindowMaximized()); + + out_buf->appendf("vsync=%d\n", gui->m_vsync); + out_buf->appendf("show_log_window=%d\n", gui->m_showLogWindow); + out_buf->appendf("log_filter=%d\n", gui->m_logWindow->getSelectedFilter()); +} + +void Simulator_GUI_imgui::applySettings(ImGuiContext* ctx, ImGuiSettingsHandler* handler) +{ + Simulator_GUI_imgui* gui = (Simulator_GUI_imgui*)handler->UserData; + UserSettings* settings = (UserSettings*) &gui->m_userSettings; + gui->m_currentScaleIndex = settings->scaleIndex; + gui->m_vsync = settings->vsync; + gui->m_showLogWindow = settings->show_log_window; + gui->m_iniFound = true; + gui->m_logWindow->setSelectedFilter(settings->log_filter); +} + +void Simulator_GUI_imgui::initImgui() +{ + MiniGL::addKeyboardFunc([](int key, int scancode, int action, int mods) -> bool { ImGui_ImplGlfw_KeyCallback(MiniGL::getWindow(), key, scancode, action, mods); return ImGui::GetIO().WantCaptureKeyboard; }); + MiniGL::addCharFunc([](int key, int action) -> bool { ImGui_ImplGlfw_CharCallback(MiniGL::getWindow(), key); return ImGui::GetIO().WantCaptureKeyboard; }); + MiniGL::addMousePressFunc([](int button, int action, int mods) -> bool { ImGui_ImplGlfw_MouseButtonCallback(MiniGL::getWindow(), button, action, mods); return ImGui::GetIO().WantCaptureMouse; }); + MiniGL::addMouseWheelFunc([](int pos, double xoffset, double yoffset) -> bool { ImGui_ImplGlfw_ScrollCallback(MiniGL::getWindow(), xoffset, yoffset); return ImGui::GetIO().WantCaptureMouse; }); + + MiniGL::addKeyFunc('r', std::bind(&DemoBase::reset, m_base)); + MiniGL::addKeyFunc('w', Simulator_GUI_imgui::switchDrawMode); + MiniGL::addKeyFunc(' ', std::bind(&Simulator_GUI_imgui::switchPause, this)); + MiniGL::setClientDestroyFunc(std::bind(&Simulator_GUI_imgui::destroy, this)); + + // apply user settings from ini file + if (m_iniFound) + { + MiniGL::setWindowPos(m_userSettings.win_x, m_userSettings.win_y); + MiniGL::setWindowSize(m_userSettings.win_width, m_userSettings.win_height); + } + + ImGuiIO& io = ImGui::GetIO(); (void)io; + + std::string font = Utilities::FileSystem::normalizePath(m_base->getExePath() + "/resources/fonts/Roboto-Medium.ttf"); + std::string font2 = Utilities::FileSystem::normalizePath(m_base->getExePath() + "/resources/fonts/Cousine-Regular.ttf"); + + m_scales.push_back(1.0f); + m_scales.push_back(1.25f); + m_scales.push_back(1.5f); + m_scales.push_back(1.75f); + m_scales.push_back(2.0f); + + for(int i=0; i < 5; i++) + m_fonts.push_back(io.Fonts->AddFontFromFileTTF(font.c_str(), m_baseSize * m_scales[i])); + for (int i = 0; i < 5; i++) + m_fonts2.push_back(io.Fonts->AddFontFromFileTTF(font2.c_str(), m_baseSize * m_scales[i])); + + initStyle(); + + // Setup Platform/Renderer bindings + ImGui_ImplGlfw_InitForOpenGL(MiniGL::getWindow(), false); + const char* glsl_version = "#version 330"; + ImGui_ImplOpenGL3_Init(glsl_version); +} + +void Simulator_GUI_imgui::initImguiParameters() +{ + imguiParameters::imguiNumericParameter* timeParam = new imguiParameters::imguiNumericParameter(); + timeParam->description = "Current simulation time"; + timeParam->label = "Time"; + timeParam->readOnly = true; + timeParam->getFct = []() -> Real { return TimeManager::getCurrent()->getTime(); }; + imguiParameters::addParam("General", "General", timeParam); + + imguiParameters::imguiNumericParameter* timeStepSizeParam = new imguiParameters::imguiNumericParameter(); + timeStepSizeParam->description = "Set time step size"; + timeStepSizeParam->label = "Time step size"; + timeStepSizeParam->minValue = static_cast(0.00001); + timeStepSizeParam->maxValue = static_cast(0.1); + timeStepSizeParam->getFct = []() -> Real { return TimeManager::getCurrent()->getTimeStepSize(); }; + timeStepSizeParam->setFct = [](Real v) { TimeManager::getCurrent()->setTimeStepSize(v); }; + imguiParameters::addParam("General", "General", timeStepSizeParam); + + imguiParameters::imguiBoolParameter* wireframeParam = new imguiParameters::imguiBoolParameter(); + wireframeParam->description = "Switch wireframe mode"; + wireframeParam->label = "Wireframe"; + wireframeParam->readOnly = false; + wireframeParam->getFct = []() -> bool { return MiniGL::getDrawMode() == GL_LINE; }; + wireframeParam->setFct = [](bool v) { + if (!v) + MiniGL::setDrawMode(GL_FILL); + else + MiniGL::setDrawMode(GL_LINE); + }; + imguiParameters::addParam("Visualization", "General", wireframeParam); +} + +bool Simulator_GUI_imgui::alignedButton(const char* label, float alignment) +{ + ImGuiStyle& style = ImGui::GetStyle(); + + const float size = ImGui::CalcTextSize(label).x + style.FramePadding.x * 2.0f; + const float avail = ImGui::GetContentRegionAvail().x; + + const float offset = (avail - size) * alignment; + if (offset > 0.0f) + ImGui::SetCursorPosX(ImGui::GetCursorPosX() + offset); + + return ImGui::Button(label); +} + +void Simulator_GUI_imgui::createMenuBar() +{ + bool openpopup = false; + + ImGui::PushStyleVar(ImGuiStyleVar_FramePadding, ImVec2(0.0f, 10.0f)); + + if (ImGui::BeginMainMenuBar()) + { + if (ImGui::BeginMenu("Simulation")) + { + if (ImGui::MenuItem("Pause/run simulation", "Space")) + switchPause(); + ImGui::EndMenu(); + } + if (ImGui::BeginMenu("GUI")) + { + if (ImGui::MenuItem("V-Sync", "", m_vsync)) + { + m_vsync = !m_vsync; + openpopup = true; + } + if (ImGui::MenuItem("Scale - 100%", "", m_currentScaleIndex == 0)) + { + m_currentScaleIndex = 0; + initStyle(); + } + if (ImGui::MenuItem("Scale - 125%", "", m_currentScaleIndex == 1)) + { + m_currentScaleIndex = 1; + initStyle(); + } + if (ImGui::MenuItem("Scale - 150%", "", m_currentScaleIndex == 2)) + { + m_currentScaleIndex = 2; + initStyle(); + } + if (ImGui::MenuItem("Scale - 175%", "", m_currentScaleIndex == 3)) + { + m_currentScaleIndex = 3; + initStyle(); + } + if (ImGui::MenuItem("Scale - 200%", "", m_currentScaleIndex == 4)) + { + m_currentScaleIndex = 4; + initStyle(); + } + ImGui::Separator(); + if (ImGui::MenuItem("Show log window", "", m_showLogWindow)) + { + m_showLogWindow = !m_showLogWindow; + } + ImGui::EndMenu(); + } + ImGui::EndMainMenuBar(); + } + + ImGui::PopStyleVar(1); + + if (openpopup) + { + ImGui::OpenPopup("Info"); + openpopup = false; + } + bool open = true; + ImGui::PushStyleVar(ImGuiStyleVar_FramePadding, ImVec2(5.0f, 5.0f)); + ImGui::PushStyleVar(ImGuiStyleVar_WindowTitleAlign, ImVec2(0.5f, 0.5f)); + ImGui::PushStyleVar(ImGuiStyleVar_ItemSpacing, ImVec2(5.0f, 15.0f)); + ImGui::PushStyleVar(ImGuiStyleVar_WindowPadding, ImVec2(10.0f, 10.0f)); + if (ImGui::BeginPopupModal("Info", &open, ImGuiWindowFlags_AlwaysAutoResize)) + { + ImGui::Text("To turn on/off the vertical sync, \nyou have to restart the simulator."); + if (alignedButton("Close")) + ImGui::CloseCurrentPopup(); + ImGui::EndPopup(); + } + ImGui::PopStyleVar(4); +} + +void Simulator_GUI_imgui::createSimulationParameterGUI() +{ + ImGui::SetNextWindowPos(ImVec2(10, 10), ImGuiCond_FirstUseEver); + ImGui::SetNextWindowSize(ImVec2(390, 900), ImGuiCond_FirstUseEver); + + float alpha = 0.8f; + if (ImGui::IsWindowDocked()) + alpha = 1.0f; + + ImGui::PushStyleColor(ImGuiCol_WindowBg, ImVec4(0.15f, 0.15f, 0.15f, alpha)); + + ImGui::PushStyleVar(ImGuiStyleVar_WindowPadding, ImVec2(5.0f, 10.0f)); + ImGui::Begin("Settings"); + + ImGui::PushItemWidth(175 * m_scales[m_currentScaleIndex]); + + imguiParameters::createParameterGUI(); + + ImGui::PopItemWidth(); + ImGui::End(); + ImGui::PopStyleVar(1); + ImGui::PopStyleColor(1); + + if (m_showLogWindow) + m_logWindow->drawWindow(m_fonts2[m_currentScaleIndex]); +} + +void Simulator_GUI_imgui::initSimulationParameterGUI() +{ + imguiParameters::cleanup(); + + Simulation *sim = Simulation::getCurrent(); + + imguiParameters::createParameterObjectGUI(m_base); + imguiParameters::createParameterObjectGUI(sim); + if (sim->getModel() != nullptr) + imguiParameters::createParameterObjectGUI(sim->getModel()); + if (sim->getTimeStep() != nullptr) + { + imguiParameters::createParameterObjectGUI(sim->getTimeStep()); + if (sim->getTimeStep()->getCollisionDetection() != nullptr) + imguiParameters::createParameterObjectGUI(sim->getTimeStep()->getCollisionDetection()); + } + initImguiParameters(); +} + +void Simulator_GUI_imgui::update() +{ + // Start the Dear ImGui frame + ImGui_ImplOpenGL3_NewFrame(); + ImGui_ImplGlfw_NewFrame(); + ImGui::NewFrame(); + + // init dock space + static ImGuiDockNodeFlags dockspaceFlags = ImGuiDockNodeFlags_PassthruCentralNode | ImGuiDockNodeFlags_NoDockingInCentralNode | ImGuiDockNodeFlags_AutoHideTabBar; + ImGuiWindowFlags windowFlags = ImGuiWindowFlags_MenuBar | ImGuiWindowFlags_NoDocking; + ImGuiViewport* viewport = ImGui::GetMainViewport(); + + // add enough space for the menubar + ImVec2 pos = viewport->Pos; + ImVec2 size = viewport->Size; + size.y -= m_baseSize * m_scales[m_currentScaleIndex]; + pos.y += m_baseSize * m_scales[m_currentScaleIndex]; + + ImGui::SetNextWindowPos(pos); + ImGui::SetNextWindowSize(size); + ImGui::SetNextWindowViewport(viewport->ID); + windowFlags |= ImGuiWindowFlags_NoTitleBar | ImGuiWindowFlags_NoCollapse | ImGuiWindowFlags_NoResize | ImGuiWindowFlags_NoMove; + windowFlags |= ImGuiWindowFlags_NoBringToFrontOnFocus | ImGuiWindowFlags_NoNavFocus; + if (dockspaceFlags & ImGuiDockNodeFlags_PassthruCentralNode) + windowFlags |= ImGuiWindowFlags_NoBackground; + + ImGui::PushFont(m_fonts[m_currentScaleIndex]); + ImGui::PushStyleVar(ImGuiStyleVar_WindowRounding, 0.0f); + ImGui::PushStyleVar(ImGuiStyleVar_WindowBorderSize, 0.0f); + ImGui::PushStyleVar(ImGuiStyleVar_WindowPadding, ImVec2(0.0f, 0.0f)); + ImGui::Begin("DockSpace", nullptr, windowFlags); + + ImGuiID dockspaceID = ImGui::GetID("DockSpace"); + ImGui::DockSpace(dockspaceID, ImVec2(0.0f, 0.0f), dockspaceFlags); + static int first = true; + if (!m_iniFound && first) + { + first = false; + ImGui::DockBuilderRemoveNode(dockspaceID); + ImGui::DockBuilderAddNode(dockspaceID, dockspaceFlags | ImGuiDockNodeFlags_DockSpace); + ImGui::DockBuilderSetNodeSize(dockspaceID, viewport->Size); + + auto dock_id_down = ImGui::DockBuilderSplitNode(dockspaceID, ImGuiDir_Down, 0.3f, nullptr, &dockspaceID); + auto dock_id_left = ImGui::DockBuilderSplitNode(dockspaceID, ImGuiDir_Left, 0.3f, nullptr, &dockspaceID); + ImGui::DockBuilderDockWindow("Settings", dock_id_left); + ImGui::DockBuilderDockWindow("Log", dock_id_down); + + ImGui::DockBuilderFinish(dockspaceID); + } + + ImGui::End(); + ImGui::PopStyleVar(3); + + + createMenuBar(); + + createSimulationParameterGUI(); + ImGui::PopFont(); + + // Rendering + ImGui::Render(); + ImGui_ImplOpenGL3_RenderDrawData(ImGui::GetDrawData()); +} + +void Simulator_GUI_imgui::destroy() +{ + // Cleanup + ImGui_ImplOpenGL3_Shutdown(); + ImGui_ImplGlfw_Shutdown(); + ImGui::DestroyContext(); +} + +void Simulator_GUI_imgui::switchPause() +{ + m_base->setValue(DemoBase::PAUSE, !m_base->getValue(DemoBase::PAUSE)); +} + +void Simulator_GUI_imgui::switchDrawMode() +{ + if (MiniGL::getDrawMode() == GL_LINE) + MiniGL::setDrawMode(GL_FILL); + else + MiniGL::setDrawMode(GL_LINE); +} + diff --git a/Demos/Common/Simulator_GUI_imgui.h b/Demos/Common/Simulator_GUI_imgui.h new file mode 100644 index 00000000..f77ae258 --- /dev/null +++ b/Demos/Common/Simulator_GUI_imgui.h @@ -0,0 +1,77 @@ +#ifndef __Simulator_GUI_imgui_h__ +#define __Simulator_GUI_imgui_h__ + +#include "Common/Common.h" +#include + +struct ImFont; +struct ImGuiContext; +struct ImGuiSettingsHandler; +struct ImGuiTextBuffer; + +namespace PBD +{ + struct UserSettings + { + int scaleIndex; + int win_x, win_y; + int win_width, win_height; + bool vsync; + bool show_log_window; + bool maximized; + int log_filter; + + UserSettings() { win_x = 0; win_y = 0; win_width = 1280; win_height = 960; scaleIndex = 0; vsync = false; maximized = false; log_filter = 1; } + }; + + class LogWindow; + class DemoBase; + + class Simulator_GUI_imgui + { + public: + Simulator_GUI_imgui(DemoBase *base); + virtual ~Simulator_GUI_imgui(); + + protected: + DemoBase* m_base; + std::vector m_fonts; + std::vector m_fonts2; + std::vector m_scales; + unsigned int m_currentScaleIndex; + bool m_vsync; + bool m_showLogWindow; + ImGuiContext* m_context; + UserSettings m_userSettings; + bool m_iniFound; + LogWindow* m_logWindow; + const float m_baseSize = 15.0f; + + void initStyle(); + void initImguiParameters(); + + void switchPause(); + static void switchDrawMode(); + + void destroy(); + + static void writeIni(ImGuiContext* ctx, ImGuiSettingsHandler* handler, ImGuiTextBuffer* out_buf); + static void readIni(ImGuiContext* ctx, ImGuiSettingsHandler* handler, void* entry, const char* line); + static void* readOpenIni(ImGuiContext* ctx, ImGuiSettingsHandler* handler, const char* name); + static void applySettings(ImGuiContext* ctx, ImGuiSettingsHandler* handler); + bool alignedButton(const char* label, float alignment = 0.5f); + void createMenuBar(); + + public: + void init(); + void initImgui(); + void initSimulationParameterGUI(); + void update(); + void createSimulationParameterGUI(); + + bool getVSync() { return m_userSettings.vsync; } + bool getMaximized() { return m_userSettings.maximized; } + }; +} + +#endif \ No newline at end of file diff --git a/Demos/Common/imguiParameters.cpp b/Demos/Common/imguiParameters.cpp new file mode 100644 index 00000000..d5e55679 --- /dev/null +++ b/Demos/Common/imguiParameters.cpp @@ -0,0 +1,533 @@ +#include "imguiParameters.h" +#include "FunctionParameter.h" +#include "Simulation/TimeManager.h" +#include "Demos/Visualization/MiniGL.h" +#include "Utils/Logger.h" +#include "Utils/StringTools.h" + +using namespace PBD; +using namespace std; +using namespace GenParam; + +string imguiParameters::m_format = "%.5f"; +Real imguiParameters::m_step = static_cast(0.001); +Real imguiParameters::m_faststep = static_cast(0.01); +int imguiParameters::m_istep = 1; +int imguiParameters::m_ifaststep = 10; +std::vector> imguiParameters::m_setFcts; +std::vector>>>> imguiParameters::m_imguiParams; + +void imguiParameters::createRealParameter(imguiParameters::imguiParameter* param, ImGuiInputTextFlags flags, const std::string &helpText) +{ + // Real parameter + imguiParameters::imguiNumericParameter* rparam = dynamic_cast*>(param); + if ((rparam != nullptr) && (rparam->getFct != nullptr)) + { + Real value = rparam->getFct(); + InputReal(rparam->label.c_str(), &value, m_step, m_faststep, m_format.c_str(), flags); + + if (ImGui::IsItemDeactivatedAfterEdit()) + { + if (rparam->minValue != std::numeric_limits::min()) + value = std::max(rparam->minValue, value); + if (rparam->maxValue != std::numeric_limits::max()) + value = std::min(rparam->maxValue, value); + if (rparam->setFct) + rparam->setFct(value); + } + if (ImGui::IsItemHovered()) + ImGui::SetTooltip(helpText.c_str()); + } +} + +void imguiParameters::createBoolParameter(imguiParameters::imguiParameter* param, ImGuiInputTextFlags flags, const std::string& helpText) +{ + // bool parameter + imguiParameters::imguiBoolParameter* bparam = dynamic_cast(param); + if ((bparam != nullptr) && (bparam->getFct != nullptr)) + { + bool value = bparam->getFct(); + ImGui::Checkbox(bparam->label.c_str(), &value); + + if (ImGui::IsItemDeactivatedAfterEdit()) + { + if (!bparam->readOnly) + { + if (bparam->setFct) + bparam->setFct(value); + } + } + if (ImGui::IsItemHovered()) + ImGui::SetTooltip(helpText.c_str()); + } +} + +void imguiParameters::createStringParameter(imguiParameters::imguiParameter* param, ImGuiInputTextFlags flags, const std::string& helpText) +{ + // string parameter + imguiParameters::imguiStringParameter* sparam = dynamic_cast(param); + if ((sparam != nullptr) && (sparam->getFct != nullptr)) + { + std::string str = sparam->getFct(); + const unsigned int buf_size = 1000; + char value[buf_size]; + strcpy(value, str.c_str()); + + ImGui::InputText(sparam->label.c_str(), value, buf_size, flags); + + if (ImGui::IsItemDeactivatedAfterEdit()) + { + if (sparam->setFct) + sparam->setFct(value); + } + if (ImGui::IsItemHovered()) + ImGui::SetTooltip(helpText.c_str()); + } +} + +void imguiParameters::createVec3rParameter(imguiParameters::imguiParameter* param, ImGuiInputTextFlags flags, const std::string& helpText) +{ + // vec3 parameter + imguiParameters::imguiVec3rParameter* vparam = dynamic_cast(param); + if ((vparam != nullptr) && (vparam->getFct != nullptr)) + { + Vector3r value = vparam->getFct(); + ImGui::InputScalarN(vparam->label.c_str(), ImGuiDataType_Real, value.data(), 3, NULL, NULL, m_format.c_str(), flags); + + if (ImGui::IsItemDeactivatedAfterEdit()) + { + if (vparam->setFct) + vparam->setFct(value); + } + if (ImGui::IsItemHovered()) + ImGui::SetTooltip(helpText.c_str()); + } +} + +void imguiParameters::createVec3fParameter(imguiParameters::imguiParameter* param, ImGuiInputTextFlags flags, const std::string& helpText) +{ + // vec3 parameter + imguiParameters::imguiVec3fParameter* vparam = dynamic_cast(param); + if ((vparam != nullptr) && (vparam->getFct != nullptr)) + { + Eigen::Vector3f value = vparam->getFct(); + ImGui::InputFloat3(vparam->label.c_str(), value.data(), m_format.c_str(), flags); + + if (ImGui::IsItemDeactivatedAfterEdit()) + { + if (vparam->setFct) + vparam->setFct(value); + } + if (ImGui::IsItemHovered()) + ImGui::SetTooltip(helpText.c_str()); + } +} + +bool imguiParameters::createEnumParameter(imguiParameters::imguiParameter* param, ImGuiInputTextFlags flags, const std::string& helpText) +{ + // enum parameter + imguiParameters::imguiEnumParameter* eparam = dynamic_cast(param); + if ((eparam != nullptr) && (eparam->getFct != nullptr)) + { + int value = eparam->getFct(); + const char* item_current = eparam->items[value].c_str(); + if (ImGui::BeginCombo(eparam->label.c_str(), item_current)) + { + for (int n = 0; n < eparam->items.size(); n++) + { + bool is_selected = (item_current == eparam->items[n]); + if (ImGui::Selectable(eparam->items[n].c_str(), is_selected)) + { + item_current = eparam->items[n].c_str(); + if (!eparam->readOnly) + { + // stop the creation of the GUI since the change of an enum value + // could cause a change of the GUI + // store the callback function and call it at the end of the GUI function + m_setFcts.push_back([eparam,n]() { eparam->setFct(n); }); + ImGui::EndCombo(); + return true; + } + } + if (is_selected) + ImGui::SetItemDefaultFocus(); + } + + ImGui::EndCombo(); + } + if (ImGui::IsItemHovered()) + ImGui::SetTooltip(helpText.c_str()); + } + return false; +} + +void imguiParameters::createFunctionParameter(imguiParameters::imguiParameter* param, ImGuiInputTextFlags flags, const std::string& helpText) +{ + // bool parameter + imguiParameters::imguiFunctionParameter* fparam = dynamic_cast(param); + if ((fparam != nullptr) && (fparam->function != nullptr)) + { + if (ImGui::Button(fparam->label.c_str())) + { + if (fparam->function) + fparam->function(); + } + if (ImGui::IsItemHovered()) + ImGui::SetTooltip(helpText.c_str()); + } +} + +void imguiParameters::createSubgroupParameters(const std::vector>> ¶ms) +{ + for (auto subgroup_index = 0; subgroup_index < params.size(); subgroup_index++) + { + auto subgroup = params[subgroup_index]; + ImGui::PushStyleColor(ImGuiCol_Text, ImVec4{ 1.0f, 1.0f, 0.5f, 1.0f }); + if ((subgroup.first == "") || (ImGui::TreeNodeEx(subgroup.first.c_str(), ImGuiTreeNodeFlags_DefaultOpen))) + { + ImGui::PushStyleColor(ImGuiCol_Text, ImVec4{ 1.0f, 1.0f, 1.0f, 1.0f }); + for (int i = 0; i < subgroup.second.size(); i++) + { + imguiParameters::imguiParameter* param = subgroup.second[i]; + std::string helpText = param->description; + if (param->readOnly) + helpText += " (read-only)"; + else if ((param->name != "") && (dynamic_cast(param) == nullptr)) // no key help text for function parameters + helpText += "\n\nkey in scene file:\n" + param->name; + + ImGuiInputTextFlags flags = 0; + if (param->readOnly) + { + ImGui::PushStyleColor(ImGuiCol_FrameBg, ImVec4{ 0.3f, 0.3f, 0.3f, 1.0f }); + ImGui::PushStyleColor(ImGuiCol_Button, ImVec4{ 0.3f, 0.3f, 0.3f, 1.0f }); + ImGui::PushStyleColor(ImGuiCol_Text, ImVec4{ 1.0f, 1.0f, 1.0f, 1.0f }); + flags = ImGuiInputTextFlags_ReadOnly; + } + + createRealParameter(param, flags, helpText); + createNumericParameter(param, flags, helpText); + createNumericParameter(param, flags, helpText); + createNumericParameter(param, flags, helpText); + createNumericParameter(param, flags, helpText); + createNumericParameter(param, flags, helpText); + createNumericParameter(param, flags, helpText); + createBoolParameter(param, flags, helpText); + createStringParameter(param, flags, helpText); + createVec3rParameter(param, flags, helpText); + createVec3fParameter(param, flags, helpText); + createFunctionParameter(param, flags, helpText); + if (createEnumParameter(param, flags, helpText)) + { + // stop the creation of the GUI since the change of an enum value + // could cause a change of the GUI + if (param->readOnly) + ImGui::PopStyleColor(3); + ImGui::PopStyleColor(1); + if (subgroup.first != "") + ImGui::TreePop(); + ImGui::PopStyleColor(1); + return; + } + + if (param->readOnly) + ImGui::PopStyleColor(3); + } + + ImGui::PopStyleColor(1); + if (subgroup.first != "") + ImGui::TreePop(); + ImGui::Separator(); + } + ImGui::PopStyleColor(1); + } +} + +void imguiParameters::createParameterGUI() +{ + // always show "General" + for (auto group_index = 0; group_index < m_imguiParams.size(); group_index++) + { + auto &group = m_imguiParams[group_index]; + if (group.first == "General") + { + createSubgroupParameters(group.second); + } + } + + ImGui::Dummy(ImVec2(0, 20)); + + ImGui::PushStyleColor(ImGuiCol_Tab, ImVec4{ 0.3f, 0.3f, 0.3f, 1.0f }); + ImGui::PushStyleColor(ImGuiCol_TabHovered, ImVec4{ 0.5f, 0.5f, 0.5f, 1.0f }); + ImGui::PushStyleColor(ImGuiCol_TabActive, ImVec4{ 0.0f, 0.3f, 0.6f, 1.0f }); + if (ImGui::BeginTabBar("TabBar", ImGuiTabBarFlags_None)) + { + for (auto group_index = 0; group_index < m_imguiParams.size(); group_index++) + { + auto group = m_imguiParams[group_index]; + if (group.first == "General") + continue; + + if (ImGui::BeginTabItem(group.first.c_str())) + { + ImGui::Dummy(ImVec2(0, 5)); + createSubgroupParameters(group.second); + ImGui::EndTabItem(); + } + } + ImGui::EndTabBar(); + } + ImGui::PopStyleColor(3); + + // deferred call of callback functions + for (size_t i = 0; i < m_setFcts.size(); i++) + m_setFcts[i](); + m_setFcts.clear(); +} + +void imguiParameters::createParameterObjectGUI(ParameterObject* paramObj) +{ + if (paramObj == nullptr) + return; + + const unsigned int numParams = paramObj->numParameters(); + + for (unsigned int i = 0; i < numParams; i++) + { + ParameterBase* paramBase = paramObj->getParameter(i); + std::string group = paramBase->getGroup(); + std::string subgroup = ""; + + std::vector tokens; + Utilities::StringTools::tokenize(group, tokens, "|"); + if (tokens.size() > 1) + { + group = tokens[0]; + subgroup = tokens[1]; + } + + if (paramBase->getType() == RealParameterType) + { + imguiParameters::imguiNumericParameter* param = new imguiParameters::imguiNumericParameter(); + param->name = paramBase->getName(); + param->description = paramBase->getDescription(); + param->label = paramBase->getLabel(); + param->readOnly = paramBase->getReadOnly(); + param->minValue = static_cast*>(paramBase)->getMinValue(); + param->maxValue = static_cast*>(paramBase)->getMaxValue(); + param->getFct = [paramBase]() -> Real { return static_cast*>(paramBase)->getValue(); }; + param->setFct = [paramBase](Real v) { static_cast*>(paramBase)->setValue(v); }; + imguiParameters::addParam(group, subgroup, param); + } + else if (paramBase->getType() == ParameterBase::UINT32) + { + imguiParameters::imguiNumericParameter* param = new imguiParameters::imguiNumericParameter(); + param->name = paramBase->getName(); + param->description = paramBase->getDescription(); + param->label = paramBase->getLabel(); + param->readOnly = paramBase->getReadOnly(); + param->minValue = static_cast*>(paramBase)->getMinValue(); + param->maxValue = static_cast*>(paramBase)->getMaxValue(); + param->getFct = [paramBase]() -> unsigned int { return static_cast*>(paramBase)->getValue(); }; + param->setFct = [paramBase](unsigned int v) { static_cast*>(paramBase)->setValue(v); }; + imguiParameters::addParam(group, subgroup, param); + } + else if (paramBase->getType() == ParameterBase::UINT16) + { + imguiParameters::imguiNumericParameter* param = new imguiParameters::imguiNumericParameter(); + param->name = paramBase->getName(); + param->description = paramBase->getDescription(); + param->label = paramBase->getLabel(); + param->readOnly = paramBase->getReadOnly(); + param->minValue = static_cast*>(paramBase)->getMinValue(); + param->maxValue = static_cast*>(paramBase)->getMaxValue(); + param->getFct = [paramBase]() -> unsigned short { return static_cast*>(paramBase)->getValue(); }; + param->setFct = [paramBase](unsigned short v) { static_cast*>(paramBase)->setValue(v); }; + imguiParameters::addParam(group, subgroup, param); + } + else if (paramBase->getType() == ParameterBase::UINT8) + { + imguiParameters::imguiNumericParameter* param = new imguiParameters::imguiNumericParameter(); + param->name = paramBase->getName(); + param->description = paramBase->getDescription(); + param->label = paramBase->getLabel(); + param->readOnly = paramBase->getReadOnly(); + param->minValue = static_cast*>(paramBase)->getMinValue(); + param->maxValue = static_cast*>(paramBase)->getMaxValue(); + param->getFct = [paramBase]() -> unsigned char { return static_cast*>(paramBase)->getValue(); }; + param->setFct = [paramBase](unsigned char v) { static_cast*>(paramBase)->setValue(v); }; + imguiParameters::addParam(group, subgroup, param); + } + else if (paramBase->getType() == ParameterBase::INT32) + { + imguiParameters::imguiNumericParameter* param = new imguiParameters::imguiNumericParameter(); + param->name = paramBase->getName(); + param->description = paramBase->getDescription(); + param->label = paramBase->getLabel(); + param->readOnly = paramBase->getReadOnly(); + param->minValue = static_cast*>(paramBase)->getMinValue(); + param->maxValue = static_cast*>(paramBase)->getMaxValue(); + param->getFct = [paramBase]() -> int { return static_cast*>(paramBase)->getValue(); }; + param->setFct = [paramBase](int v) { static_cast*>(paramBase)->setValue(v); }; + imguiParameters::addParam(group, subgroup, param); + } + else if (paramBase->getType() == ParameterBase::INT16) + { + imguiParameters::imguiNumericParameter* param = new imguiParameters::imguiNumericParameter(); + param->name = paramBase->getName(); + param->description = paramBase->getDescription(); + param->label = paramBase->getLabel(); + param->readOnly = paramBase->getReadOnly(); + param->minValue = static_cast*>(paramBase)->getMinValue(); + param->maxValue = static_cast*>(paramBase)->getMaxValue(); + param->getFct = [paramBase]() -> short { return static_cast*>(paramBase)->getValue(); }; + param->setFct = [paramBase](short v) { static_cast*>(paramBase)->setValue(v); }; + imguiParameters::addParam(group, subgroup, param); + } + else if (paramBase->getType() == ParameterBase::INT8) + { + imguiParameters::imguiNumericParameter* param = new imguiParameters::imguiNumericParameter(); + param->name = paramBase->getName(); + param->description = paramBase->getDescription(); + param->label = paramBase->getLabel(); + param->readOnly = paramBase->getReadOnly(); + param->minValue = static_cast*>(paramBase)->getMinValue(); + param->maxValue = static_cast*>(paramBase)->getMaxValue(); + param->getFct = [paramBase]() -> char { return static_cast*>(paramBase)->getValue(); }; + param->setFct = [paramBase](char v) { static_cast*>(paramBase)->setValue(v); }; + imguiParameters::addParam(group, subgroup, param); + } + else if (paramBase->getType() == ParameterBase::BOOL) + { + imguiParameters::imguiBoolParameter* param = new imguiParameters::imguiBoolParameter(); + param->name = paramBase->getName(); + param->description = paramBase->getDescription(); + param->label = paramBase->getLabel(); + param->readOnly = paramBase->getReadOnly(); + param->getFct = [paramBase]() -> bool { return static_cast(paramBase)->getValue(); }; + param->setFct = [paramBase](bool v) { static_cast(paramBase)->setValue(v); }; + imguiParameters::addParam(group, subgroup, param); + } + else if (paramBase->getType() == ParameterBase::ENUM) + { + imguiParameters::imguiEnumParameter* param = new imguiParameters::imguiEnumParameter(); + param->name = paramBase->getName(); + param->description = paramBase->getDescription(); + param->label = paramBase->getLabel(); + param->readOnly = paramBase->getReadOnly(); + EnumParameter* eparam = static_cast(paramBase); + for (auto item : eparam->getEnumValues()) + param->items.push_back(item.name); + param->getFct = [paramBase]() -> int { return static_cast(paramBase)->getValue(); }; + param->setFct = [paramBase](int v) { static_cast(paramBase)->setValue(v); }; + imguiParameters::addParam(group, subgroup, param); + } + else if (paramBase->getType() == ParameterBase::STRING) + { + imguiParameters::imguiStringParameter* param = new imguiParameters::imguiStringParameter(); + param->name = paramBase->getName(); + param->description = paramBase->getDescription(); + param->label = paramBase->getLabel(); + param->readOnly = paramBase->getReadOnly(); + param->getFct = [paramBase]() -> std::string { return static_cast(paramBase)->getValue(); }; + param->setFct = [paramBase](const std::string &v) { static_cast(paramBase)->setValue(v); }; + imguiParameters::addParam(group, subgroup, param); + } + else if ((paramBase->getType() == RealVectorParameterType) && (static_cast(paramBase)->getDim() == 3)) + { + imguiParameters::imguiVec3rParameter* param = new imguiParameters::imguiVec3rParameter(); + param->name = paramBase->getName(); + param->description = paramBase->getDescription(); + param->label = paramBase->getLabel(); + param->readOnly = paramBase->getReadOnly(); + param->getFct = [paramBase]() -> Vector3r { return Vector3r(static_cast(paramBase)->getValue()); }; + param->setFct = [paramBase](Vector3r& v) { static_cast(paramBase)->setValue(v.data()); }; + imguiParameters::addParam(group, subgroup, param); + } + else if (paramBase->getType() == ParameterBase::FUNCTION) + { + imguiParameters::imguiFunctionParameter* param = new imguiParameters::imguiFunctionParameter(); + param->name = paramBase->getName(); + param->description = paramBase->getDescription(); + param->label = paramBase->getLabel(); + param->readOnly = false; + param->function = [paramBase]() { static_cast(paramBase)->callFunction(); }; + imguiParameters::addParam(group, subgroup, param); + } + } +} + +void imguiParameters::cleanup() +{ + for (auto group_index = 0; group_index < m_imguiParams.size(); group_index++) + { + auto group = m_imguiParams[group_index]; + for (auto subgroup_index = 0; subgroup_index < group.second.size(); subgroup_index++) + { + auto subgroup = group.second[subgroup_index]; + for (int i = 0; i < subgroup.second.size(); i++) + { + delete subgroup.second[i]; + } + subgroup.second.clear(); + } + group.second.clear(); + } + m_imguiParams.clear(); +} + +void imguiParameters::addParam(const std::string& pgroup, const std::string& psubgroup, imguiParameter* param) +{ + for (auto group_index = 0; group_index < m_imguiParams.size(); group_index++) + { + auto &group = m_imguiParams[group_index]; + if (group.first == pgroup) + { + for (auto subgroup_index = 0; subgroup_index < group.second.size(); subgroup_index++) + { + auto &subgroup = group.second[subgroup_index]; + if (subgroup.first == psubgroup) + { + subgroup.second.push_back(param); + return; + } + } + // sub group not found + group.second.push_back({ psubgroup, std::vector() }); + group.second.back().second.reserve(20); + group.second.back().second.push_back(param); + return; + } + } + + // group not found + m_imguiParams.push_back({ pgroup, std::vector>>() }); + m_imguiParams.back().second.push_back({ psubgroup, std::vector() }); + m_imguiParams.back().second.back().second.reserve(20); + m_imguiParams.back().second.back().second.push_back(param); +} + +void imguiParameters::addGroup(const std::string& pgroup, const std::string& psubgroup) +{ + for (auto group_index = 0; group_index < m_imguiParams.size(); group_index++) + { + auto group = m_imguiParams[group_index]; + if (group.first == pgroup) + { + for (auto subgroup_index = 0; subgroup_index < group.second.size(); subgroup_index++) + { + auto subgroup = group.second[subgroup_index]; + if (subgroup.first == psubgroup) + return; + } + // sub group not found + group.second.push_back({ psubgroup, std::vector() }); + group.second.back().second.reserve(20); + } + } + + // group not found + m_imguiParams.push_back({ pgroup, std::vector>>() }); + m_imguiParams.back().second.push_back({ psubgroup, std::vector() }); + m_imguiParams.back().second.back().second.reserve(20); +} + diff --git a/Demos/Common/imguiParameters.h b/Demos/Common/imguiParameters.h new file mode 100644 index 00000000..a09f6643 --- /dev/null +++ b/Demos/Common/imguiParameters.h @@ -0,0 +1,151 @@ +#ifndef __imguiParameters_h__ +#define __imguiParameters_h__ + +#include "Common/Common.h" +#include +#include "ParameterObject.h" +#include "imgui.h" + +#ifdef USE_DOUBLE +#define InputReal ImGui::InputDouble +#define ImGuiDataType_Real ImGuiDataType_Double +#else +#define InputReal ImGui::InputFloat +#define ImGuiDataType_Real ImGuiDataType_Float +#endif + +namespace PBD +{ + class imguiParameters + { + public: + struct imguiParameter + { + std::string name; + std::string label; + std::string description; + bool readOnly; + + imguiParameter() { readOnly = false; } + virtual ~imguiParameter() {}; + }; + + template + struct imguiNumericParameter : public imguiParameter + { + T minValue; + T maxValue; + std::function getFct; + std::function setFct; + imguiNumericParameter() : imguiParameter() { minValue = std::numeric_limits::min(); maxValue = std::numeric_limits::max(); getFct = nullptr; setFct = nullptr; } + virtual ~imguiNumericParameter() {}; + }; + + struct imguiBoolParameter : public imguiParameter + { + std::function getFct; + std::function setFct; + imguiBoolParameter() : imguiParameter() { getFct = nullptr; setFct = nullptr; } + virtual ~imguiBoolParameter() {}; + }; + + struct imguiStringParameter : public imguiParameter + { + std::function getFct; + std::function setFct; + imguiStringParameter() : imguiParameter() { getFct = nullptr; setFct = nullptr; } + virtual ~imguiStringParameter() {}; + }; + + struct imguiVec3rParameter : public imguiParameter + { + std::function getFct; + std::function setFct; + imguiVec3rParameter() : imguiParameter() { getFct = nullptr; setFct = nullptr; } + virtual ~imguiVec3rParameter() {}; + }; + + struct imguiVec3fParameter : public imguiParameter + { + std::function getFct; + std::function setFct; + imguiVec3fParameter() : imguiParameter() { getFct = nullptr; setFct = nullptr; } + virtual ~imguiVec3fParameter() {}; + }; + + struct imguiEnumParameter : public imguiParameter + { + std::vector items; + std::function getFct; + std::function setFct; + imguiEnumParameter() : imguiParameter() { getFct = nullptr; setFct = nullptr; } + virtual ~imguiEnumParameter() { items.clear(); }; + }; + + struct imguiFunctionParameter : public imguiParameter + { + std::function function; + imguiFunctionParameter() : imguiParameter() { function = nullptr; } + virtual ~imguiFunctionParameter() {}; + }; + + static std::string m_format; + static Real m_step; + static Real m_faststep; + static int m_istep; + static int m_ifaststep; + static std::vector> m_setFcts; + + typedef std::pair ParameterIndex; + + static void createParameterGUI(); + static void createParameterObjectGUI(GenParam::ParameterObject* paramObj); + + static void createRealParameter(imguiParameters::imguiParameter* param, ImGuiInputTextFlags flags, const std::string& helpText); + static void createBoolParameter(imguiParameters::imguiParameter* param, ImGuiInputTextFlags flags, const std::string& helpText); + static void createStringParameter(imguiParameters::imguiParameter* param, ImGuiInputTextFlags flags, const std::string& helpText); + static void createVec3rParameter(imguiParameters::imguiParameter* param, ImGuiInputTextFlags flags, const std::string& helpText); + static void createVec3fParameter(imguiParameters::imguiParameter* param, ImGuiInputTextFlags flags, const std::string& helpText); + static bool createEnumParameter(imguiParameters::imguiParameter* param, ImGuiInputTextFlags flags, const std::string& helpText); + template + static void createNumericParameter(imguiParameters::imguiParameter* param, ImGuiInputTextFlags flags, const std::string& helpText); + static void createFunctionParameter(imguiParameters::imguiParameter* param, ImGuiInputTextFlags flags, const std::string& helpText); + + static void addParam(const std::string& group, const std::string& subgroup, imguiParameter* param); + static void addGroup(const std::string& group, const std::string& subgroup); + + static void cleanup(); + + protected: + // vector>> + static std::vector>>>> m_imguiParams; + + static void createSubgroupParameters(const std::vector>>& params); + }; + + + template + inline void imguiParameters::createNumericParameter(imguiParameters::imguiParameter* param, ImGuiInputTextFlags flags, const std::string& helpText) + { + imguiParameters::imguiNumericParameter* rparam = dynamic_cast*>(param); + if ((rparam != nullptr) && (rparam->getFct != nullptr)) + { + int value = static_cast(rparam->getFct()); + ImGui::InputInt(rparam->label.c_str(), &value, m_istep, m_ifaststep, flags); + + if (ImGui::IsItemDeactivatedAfterEdit()) + { + if (rparam->minValue != std::numeric_limits::min()) + value = std::max(static_cast(rparam->minValue), value); + if (rparam->maxValue != std::numeric_limits::max()) + value = std::min(static_cast(rparam->maxValue), value); + if (rparam->setFct) + rparam->setFct(value); + } + if (ImGui::IsItemHovered()) + ImGui::SetTooltip(helpText.c_str()); + } + } +} + +#endif \ No newline at end of file diff --git a/Demos/CosseratRodsDemo/CMakeLists.txt b/Demos/CosseratRodsDemo/CMakeLists.txt new file mode 100644 index 00000000..444fbf87 --- /dev/null +++ b/Demos/CosseratRodsDemo/CMakeLists.txt @@ -0,0 +1,55 @@ +set(SIMULATION_LINK_LIBRARIES imgui glfw PositionBasedDynamics Simulation Utils) +set(SIMULATION_DEPENDENCIES imgui glfw PositionBasedDynamics Simulation Utils CopyPBDShaders CopyImguiFonts) + +if(WIN32) + set(SIMULATION_LINK_LIBRARIES opengl32.lib glu32.lib ${SIMULATION_LINK_LIBRARIES}) + #set(SIMULATION_DEPENDENCIES ${SIMULATION_DEPENDENCIES}) +else() + set(OpenGL_GL_PREFERENCE GLVND) + find_package(OpenGL REQUIRED) + include_directories( ${OPENGL_INCLUDE_DIRS}) + + set(SIMULATION_LINK_LIBRARIES + ${SIMULATION_LINK_LIBRARIES} + ${OPENGL_LIBRARIES} + ) +endif() + +############################################################ +# GenericParameters +############################################################ +include_directories(${GenericParameters_INCLUDE_DIR}) +if(TARGET Ext_GenericParameters) + set(SIMULATION_DEPENDENCIES ${SIMULATION_DEPENDENCIES} Ext_GenericParameters) +endif() + +add_executable(CosseratRodsDemo + main.cpp + + ../Common/LogWindow.cpp + ../Common/LogWindow.h + ../Common/Simulator_GUI_imgui.cpp + ../Common/Simulator_GUI_imgui.h + ../Common/imguiParameters.cpp + ../Common/imguiParameters.h + ../Common/DemoBase.cpp + ../Common/DemoBase.h + + ${VIS_FILES} + ${PROJECT_PATH}/Common/Common.h + + CMakeLists.txt +) + +find_package( Eigen3 REQUIRED ) +include_directories( ${EIGEN3_INCLUDE_DIR} ) +include_directories(${PROJECT_PATH}/extern/freeglut/include) +include_directories(${PROJECT_PATH}/extern/glew/include) + +set_target_properties(CosseratRodsDemo PROPERTIES FOLDER "Demos") +set_target_properties(CosseratRodsDemo PROPERTIES DEBUG_POSTFIX ${CMAKE_DEBUG_POSTFIX}) +set_target_properties(CosseratRodsDemo PROPERTIES RELWITHDEBINFO_POSTFIX ${CMAKE_RELWITHDEBINFO_POSTFIX}) +set_target_properties(CosseratRodsDemo PROPERTIES MINSIZEREL_POSTFIX ${CMAKE_MINSIZEREL_POSTFIX}) +add_dependencies(CosseratRodsDemo ${SIMULATION_DEPENDENCIES}) +target_link_libraries(CosseratRodsDemo ${SIMULATION_LINK_LIBRARIES}) +VIS_SOURCE_GROUPS() diff --git a/Demos/CosseratRodsDemo/main.cpp b/Demos/CosseratRodsDemo/main.cpp new file mode 100644 index 00000000..202d3af6 --- /dev/null +++ b/Demos/CosseratRodsDemo/main.cpp @@ -0,0 +1,273 @@ +#include "Common/Common.h" +#include "Demos/Visualization/MiniGL.h" +#include "Demos/Visualization/Selection.h" +#include "Simulation/TimeManager.h" +#include +#include "Simulation/SimulationModel.h" +#include "Simulation/TimeStepController.h" +#include +#include "Demos/Visualization/Visualization.h" +#include "Utils/Logger.h" +#include "Utils/Timing.h" +#include "Utils/FileSystem.h" +#include "Demos/Common/DemoBase.h" +#include "Simulation/Simulation.h" +#include "../Common/imguiParameters.h" + +// Enable memory leak detection +#if defined(_DEBUG) && !defined(EIGEN_ALIGN) + #define new DEBUG_NEW +#endif + +using namespace PBD; +using namespace Eigen; +using namespace std; +using namespace Utilities; + +void timeStep (); +void buildModel (); +void createHelix(const Vector3r &position, const Matrix3r &orientation, Real radius, Real height, Real totalAngle, int nPoints); +void render (); +void reset(); + +DemoBase *base; +const unsigned int nParticles = 50; +const Real helixRadius = 0.5; +const Real helixHeight = -5.0; +const Real helixTotalAngle = static_cast(10.0*M_PI); +const Matrix3r helixOrientation = AngleAxisr(-static_cast(0.5 * M_PI), Vector3r(0,1,0)).toRotationMatrix(); +bool drawFrames = false; + + +// main +int main( int argc, char **argv ) +{ + REPORT_MEMORY_LEAKS + + base = new DemoBase(); + base->init(argc, argv, "Cosserat rods demo"); + + SimulationModel *model = new SimulationModel(); + model->init(); + Simulation::getCurrent()->setModel(model); + + buildModel(); + + base->createParameterGUI(); + + // add additional parameter just for this demo + imguiParameters::imguiBoolParameter* param = new imguiParameters::imguiBoolParameter(); + param->description = "Draw frames"; + param->label = "Draw frames"; + param->readOnly = false; + param->getFct = []() -> bool { return drawFrames; }; + param->setFct = [](bool b) -> void { drawFrames = b; }; + imguiParameters::addParam("Visualization", "Elastic rods", param); + + + // OpenGL + MiniGL::setClientIdleFunc (timeStep); + MiniGL::addKeyFunc('r', reset); + MiniGL::setClientSceneFunc(render); + MiniGL::setViewport (40.0f, 0.1f, 500.0f, Vector3r (5.0, 10.0, 30.0), Vector3r (5.0, 0.0, 0.0)); + MiniGL::mainLoop (); + + Utilities::Timing::printAverageTimes(); + Utilities::Timing::printTimeSums(); + + delete Simulation::getCurrent(); + delete base; + delete model; + + return 0; +} + + +void reset() +{ + Utilities::Timing::printAverageTimes(); + Utilities::Timing::reset(); + + Simulation::getCurrent()->reset(); + base->getSelectedParticles().clear(); + + Simulation::getCurrent()->getModel()->cleanup(); + buildModel(); +} + + +void timeStep () +{ + const Real pauseAt = base->getValue(DemoBase::PAUSE_AT); + if ((pauseAt > 0.0) && (pauseAt < TimeManager::getCurrent()->getTime())) + base->setValue(DemoBase::PAUSE, true); + + if (base->getValue(DemoBase::PAUSE)) + return; + + // Simulation code + SimulationModel *model = Simulation::getCurrent()->getModel(); + const unsigned int numSteps = base->getValue(DemoBase::NUM_STEPS_PER_RENDER); + for (unsigned int i = 0; i < numSteps; i++) + { + START_TIMING("SimStep"); + Simulation::getCurrent()->getTimeStep()->step(*model); + STOP_TIMING_AVG; + + base->step(); + } +} + +void buildModel () +{ + TimeManager::getCurrent ()->setTimeStepSize (static_cast(0.005)); + + createHelix(Vector3r(0, 0, 0), helixOrientation, helixRadius, helixHeight, helixTotalAngle, nParticles); +} + +void renderLineModels() +{ + // Draw simulation model + SimulationModel *model = Simulation::getCurrent()->getModel(); + const ParticleData &pd = model->getParticles(); + const OrientationData &od = model->getOrientations(); + float red[4] = { 0.8f, 0.0f, 0.0f, 1 }; + float green[4] = { 0.0f, 0.8f, 0.0f, 1 }; + float blue[4] = { 0.0f, 0.0f, 0.8f, 1 }; + + for (unsigned int i = 0; i < model->getLineModels().size(); i++) + { + LineModel *lineModel = model->getLineModels()[i]; + + for(unsigned int e=0; egetEdges().size(); e++) + { + const unsigned int indexOffset = lineModel->getIndexOffset(); + const unsigned int indexOffsetQuaternions = lineModel->getIndexOffsetQuaternions(); + const unsigned int i1 = lineModel->getEdges()[e].m_vert[0] + indexOffset; + const unsigned int i2 = lineModel->getEdges()[e].m_vert[1] + indexOffset; + const unsigned int iq = lineModel->getEdges()[e].m_quat + indexOffsetQuaternions; + const Vector3r &v1 = pd.getPosition(i1); + const Vector3r &v2 = pd.getPosition(i2); + const Quaternionr &q = od.getQuaternion(iq); + + MiniGL::drawSphere(v1, 0.07f, blue); + if( e == lineModel->getEdges().size() -1 ) MiniGL::drawSphere(v2, 0.07f, blue); + if(drawFrames) MiniGL::drawCylinder(v1, v2, blue, 0.01f); + else MiniGL::drawCylinder(v1, v2, blue, 0.07f); + + //draw coordinate frame at the center of the edges + if(drawFrames) + { + Vector3r vm = 0.5 * (v1 + v2); + Real scale = static_cast(0.15); + Vector3r d1 = q._transformVector(Vector3r(1, 0, 0)) * scale; + Vector3r d2 = q._transformVector(Vector3r(0, 1, 0)) * scale; + Vector3r d3 = q._transformVector(Vector3r(0, 0, 1)) * scale; + MiniGL::drawCylinder(vm, vm + d1, red, 0.01f); + MiniGL::drawCylinder(vm, vm + d2, green, 0.01f); + MiniGL::drawCylinder(vm, vm + d3, blue, 0.01f); + } + } + } +} + +void render () +{ + base->render(); + + renderLineModels(); +} + +/** Create a particle model and orientation model +*/ +void createHelix(const Vector3r &position, const Matrix3r &orientation, Real radius, Real height, Real totalAngle, int nPoints) +{ + int nQuaternions = nPoints - 1; + vector points(nPoints); + vector quaternions(nQuaternions); + + //init particles + for (int i = 0; i indices(2 * nPoints - 1); + vector indicesQuaternions(nQuaternions); + + for(int i=0; i < nPoints -1; i++) + { + indices[2 * i] = i; + indices[2 * i + 1] = i + 1; + } + + for (int i = 0; i < nQuaternions; i++) + { + indicesQuaternions[i] = i; + } + + SimulationModel *model = Simulation::getCurrent()->getModel(); + model->addLineModel(nPoints, nQuaternions, &points[0], &quaternions[0], &indices[0], &indicesQuaternions[0]); + + ParticleData &pd = model->getParticles(); + const int nPointsTotal = pd.getNumberOfParticles(); + for (int i = nPointsTotal - 1; i > nPointsTotal - nPoints; i--) + { + pd.setMass(i, 1.0); + } + + // Set mass of points to zero => make it static + pd.setMass(nPointsTotal - nPoints, 0.0); + + OrientationData &od = model->getOrientations(); + const unsigned int nQuaternionsTotal = od.getNumberOfQuaternions(); + for(unsigned int i = nQuaternionsTotal - 1; i > nQuaternionsTotal - nQuaternions; i--) + { + od.setMass(i, 1.0); + } + + // Set mass of quaternions to zero => make it static + od.setMass(nQuaternionsTotal - nQuaternions, 0.0); + + // init constraints + const size_t rodNumber = model->getLineModels().size() - 1; + const unsigned int offset = model->getLineModels()[rodNumber]->getIndexOffset(); + const unsigned int offsetQuaternions = model->getLineModels()[rodNumber]->getIndexOffsetQuaternions(); + const size_t nEdges = model->getLineModels()[rodNumber]->getEdges().size(); + const LineModel::Edges &edges = model->getLineModels()[rodNumber]->getEdges(); + + //stretchShear constraints + for(unsigned int i=0; i < nEdges; i++) + { + const unsigned int v1 = edges[i].m_vert[0] + offset; + const unsigned int v2 = edges[i].m_vert[1] + offset; + const unsigned int q1 = edges[i].m_quat + offsetQuaternions; + model->addStretchShearConstraint(v1, v2, q1, model->getRodStretchingStiffness(), model->getRodShearingStiffnessX(), model->getRodShearingStiffnessY()); + } + + //bendTwist constraints + for(unsigned int i=0; i < nEdges - 1; i++) + { + const unsigned int q1 = edges[i].m_quat + offsetQuaternions; + const unsigned int q2 = edges[i + 1].m_quat + offsetQuaternions; + model->addBendTwistConstraint(q1, q2, model->getRodTwistingStiffness(), model->getRodBendingStiffnessX(), model->getRodBendingStiffnessY()); + } + +// LOG_INFO << "Number of particles: " << nPoints; +// LOG_INFO << "Number of quaternions: " << nQuaternions; +} diff --git a/Demos/CouplingDemos/CMakeLists.txt b/Demos/CouplingDemos/CMakeLists.txt index ecbc1af9..5d9336d9 100644 --- a/Demos/CouplingDemos/CMakeLists.txt +++ b/Demos/CouplingDemos/CMakeLists.txt @@ -1,36 +1,42 @@ -set(SIMULATION_LINK_LIBRARIES AntTweakBar glew PositionBasedDynamics Simulation) -set(SIMULATION_DEPENDENCIES AntTweakBar glew PositionBasedDynamics Simulation) +set(SIMULATION_LINK_LIBRARIES imgui glfw PositionBasedDynamics Simulation Utils) +set(SIMULATION_DEPENDENCIES imgui glfw PositionBasedDynamics Simulation Utils CopyPBDShaders CopyPBDModels CopyImguiFonts) if(WIN32) - set(SIMULATION_LINK_LIBRARIES freeglut opengl32.lib glu32.lib ${SIMULATION_LINK_LIBRARIES}) - set(SIMULATION_DEPENDENCIES freeglut ${SIMULATION_DEPENDENCIES}) + set(SIMULATION_LINK_LIBRARIES opengl32.lib glu32.lib ${SIMULATION_LINK_LIBRARIES}) + #set(SIMULATION_DEPENDENCIES ${SIMULATION_DEPENDENCIES}) else() - find_package(GLUT REQUIRED) + set(OpenGL_GL_PREFERENCE GLVND) find_package(OpenGL REQUIRED) + include_directories( ${OPENGL_INCLUDE_DIRS}) set(SIMULATION_LINK_LIBRARIES ${SIMULATION_LINK_LIBRARIES} - ${GLUT_LIBRARIES} ${OPENGL_LIBRARIES} ) endif() +############################################################ +# GenericParameters +############################################################ +include_directories(${GenericParameters_INCLUDE_DIR}) +if(TARGET Ext_GenericParameters) + set(SIMULATION_DEPENDENCIES ${SIMULATION_DEPENDENCIES} Ext_GenericParameters) +endif() + add_executable(RigidBodyClothCouplingDemo RigidBodyClothCouplingDemo.cpp + + ../Common/LogWindow.cpp + ../Common/LogWindow.h + ../Common/Simulator_GUI_imgui.cpp + ../Common/Simulator_GUI_imgui.h + ../Common/imguiParameters.cpp + ../Common/imguiParameters.h + ../Common/DemoBase.cpp + ../Common/DemoBase.h ${VIS_FILES} ${PROJECT_PATH}/Common/Common.h - ${PROJECT_PATH}/Demos/Common/Config.h - ${PROJECT_PATH}/Demos/Utils/IndexedFaceMesh.cpp - ${PROJECT_PATH}/Demos/Utils/IndexedFaceMesh.h - ${PROJECT_PATH}/Demos/Utils/IndexedTetMesh.cpp - ${PROJECT_PATH}/Demos/Utils/IndexedTetMesh.h - ${PROJECT_PATH}/Demos/Utils/OBJLoader.cpp - ${PROJECT_PATH}/Demos/Utils/OBJLoader.h - ${PROJECT_PATH}/Demos/Utils/Utilities.cpp - ${PROJECT_PATH}/Demos/Utils/Utilities.h - ${PROJECT_PATH}/Demos/Utils/VolumeIntegration.cpp - ${PROJECT_PATH}/Demos/Utils/VolumeIntegration.h CMakeLists.txt ) @@ -42,8 +48,6 @@ set_target_properties(RigidBodyClothCouplingDemo PROPERTIES MINSIZEREL_POSTFIX $ add_dependencies(RigidBodyClothCouplingDemo ${SIMULATION_DEPENDENCIES}) target_link_libraries(RigidBodyClothCouplingDemo ${SIMULATION_LINK_LIBRARIES}) - -add_definitions(-DTW_NO_LIB_PRAGMA -DTW_STATIC) find_package( Eigen3 REQUIRED ) include_directories( ${EIGEN3_INCLUDE_DIR} ) include_directories(${PROJECT_PATH}/extern/freeglut/include) diff --git a/Demos/CouplingDemos/RigidBodyClothCouplingDemo.cpp b/Demos/CouplingDemos/RigidBodyClothCouplingDemo.cpp index ed8cdba4..74b29b30 100644 --- a/Demos/CouplingDemos/RigidBodyClothCouplingDemo.cpp +++ b/Demos/CouplingDemos/RigidBodyClothCouplingDemo.cpp @@ -1,28 +1,31 @@ -#include "Demos/Common/Config.h" +#include "Common/Common.h" #include "Demos/Visualization/MiniGL.h" #include "Demos/Visualization/Selection.h" -#include "GL/glut.h" -#include "Demos/Simulation/TimeManager.h" +#include "Simulation/TimeManager.h" #include -#include "Demos/Simulation/SimulationModel.h" -#include "Demos/Simulation/TimeStepController.h" +#include "Simulation/SimulationModel.h" +#include "Simulation/TimeStepController.h" #include -#include "Demos/Simulation/Constraints.h" +#include "Simulation/Constraints.h" #include "Demos/Visualization/Visualization.h" -#include "Demos/Utils/OBJLoader.h" -#include "Demos/Utils/Utilities.h" +#include "Utils/Logger.h" +#include "Utils/Timing.h" +#include "Utils/FileSystem.h" +#include "Demos/Common/DemoBase.h" +#include "Simulation/Simulation.h" #define _USE_MATH_DEFINES #include "math.h" // Enable memory leak detection -#ifdef _DEBUG +#if defined(_DEBUG) && !defined(EIGEN_ALIGN) #define new DEBUG_NEW #endif using namespace PBD; using namespace Eigen; using namespace std; +using namespace Utilities; void timeStep (); void buildModel (); @@ -30,60 +33,15 @@ void createRigidBodyModel(); void createClothMesh(); void render (); void reset(); -void cleanup(); -void initShader(); -void selection(const Eigen::Vector2i &start, const Eigen::Vector2i &end); -void TW_CALL setTimeStep(const void *value, void *clientData); -void TW_CALL getTimeStep(void *value, void *clientData); -void TW_CALL setVelocityUpdateMethod(const void *value, void *clientData); -void TW_CALL getVelocityUpdateMethod(void *value, void *clientData); -void TW_CALL setStiffness(const void *value, void *clientData); -void TW_CALL getStiffness(void *value, void *clientData); -void TW_CALL setXXStiffness(const void *value, void *clientData); -void TW_CALL getXXStiffness(void *value, void *clientData); -void TW_CALL setYYStiffness(const void *value, void *clientData); -void TW_CALL getYYStiffness(void *value, void *clientData); -void TW_CALL setXYStiffness(const void *value, void *clientData); -void TW_CALL getXYStiffness(void *value, void *clientData); -void TW_CALL setXYPoissonRatio(const void *value, void *clientData); -void TW_CALL getXYPoissonRatio(void *value, void *clientData); -void TW_CALL setYXPoissonRatio(const void *value, void *clientData); -void TW_CALL getYXPoissonRatio(void *value, void *clientData); -void TW_CALL setNormalizeStretch(const void *value, void *clientData); -void TW_CALL getNormalizeStretch(void *value, void *clientData); -void TW_CALL setNormalizeShear(const void *value, void *clientData); -void TW_CALL getNormalizeShear(void *value, void *clientData); -void TW_CALL setBendingStiffness(const void *value, void *clientData); -void TW_CALL getBendingStiffness(void *value, void *clientData); -void TW_CALL setBendingMethod(const void *value, void *clientData); -void TW_CALL getBendingMethod(void *value, void *clientData); -void TW_CALL setSimulationMethod(const void *value, void *clientData); -void TW_CALL getSimulationMethod(void *value, void *clientData); - - -SimulationModel model; -TimeStepController sim; +DemoBase *base; const int nRows = 20; const int nCols = 20; const Real clothWidth = 10.0; const Real clothHeight = 10.0; -const Real width = 0.2; -const Real height = 2.0; -const Real depth = 0.2; -short simulationMethod = 2; -short bendingMethod = 2; -bool doPause = true; -std::vector selectedBodies; -std::vector selectedParticles; -Vector3r oldMousePos; -Shader *shader; -Shader *shaderTex; -string exePath; -string dataPath; -float jointColor[4] = { 0.0, 0.4f, 0.2f, 1.0 }; -float dynamicBodyColor[4] = { 0.1f, 0.4f, 0.8f, 1 }; -float staticBodyColor[4] = { 0.4f, 0.4f, 0.4f, 1.0 }; +const Real width = static_cast(0.2); +const Real height = static_cast(2.0); +const Real depth = static_cast(0.2); // main @@ -91,319 +49,120 @@ int main( int argc, char **argv ) { REPORT_MEMORY_LEAKS - exePath = Utilities::getFilePath(argv[0]); - dataPath = exePath + "/" + std::string(PBD_DATA_PATH); + base = new DemoBase(); + base->init(argc, argv, "Rigid-cloth coupling demo"); - // OpenGL - MiniGL::init (argc, argv, 1024, 768, 0, 0, "Rigid body demo"); - MiniGL::initLights (); - MiniGL::initTexture(); - MiniGL::setClientIdleFunc (50, timeStep); - MiniGL::setKeyFunc(0, 'r', reset); - MiniGL::setSelectionFunc(selection); - initShader(); - - buildModel (); + SimulationModel *model = new SimulationModel(); + model->init(); + Simulation::getCurrent()->setModel(model); - MiniGL::setClientSceneFunc(render); - MiniGL::setViewport (40.0, 0.1f, 500.0, Vector3r (0.0, 10.0, 30.0), Vector3r (0.0, 0.0, 0.0)); + buildModel(); - TwAddVarRW(MiniGL::getTweakBar(), "Pause", TW_TYPE_BOOLCPP, &doPause, " label='Pause' group=Simulation key=SPACE "); - TwAddVarCB(MiniGL::getTweakBar(), "TimeStepSize", TW_TYPE_REAL, setTimeStep, getTimeStep, 0, " label='Time step size' min=0.0 max = 0.1 step=0.001 precision=4 group=Simulation "); - TwType enumType = TwDefineEnum("VelocityUpdateMethodType", NULL, 0); - TwAddVarCB(MiniGL::getTweakBar(), "VelocityUpdateMethod", enumType, setVelocityUpdateMethod, getVelocityUpdateMethod, &sim, " label='Velocity update method' enum='0 {First Order Update}, 1 {Second Order Update}' group=Simulation"); - TwType enumType2 = TwDefineEnum("SimulationMethodType", NULL, 0); - TwAddVarCB(MiniGL::getTweakBar(), "SimulationMethod", enumType2, setSimulationMethod, getSimulationMethod, &simulationMethod, " label='Simulation method' enum='0 {None}, 1 {Distance constraints}, 2 {FEM based PBD}, 3 {Strain based dynamics}' group=Simulation"); - TwAddVarCB(MiniGL::getTweakBar(), "Stiffness", TW_TYPE_REAL, setStiffness, getStiffness, &model, " label='Stiffness' min=0.0 step=0.1 precision=4 group='Distance constraints' "); - TwAddVarCB(MiniGL::getTweakBar(), "XXStiffness", TW_TYPE_REAL, setXXStiffness, getXXStiffness, &model, " label='Stiffness XX' min=0.0 step=0.1 precision=4 group='Strain based dynamics' "); - TwAddVarCB(MiniGL::getTweakBar(), "YYStiffness", TW_TYPE_REAL, setYYStiffness, getYYStiffness, &model, " label='Stiffness YY' min=0.0 step=0.1 precision=4 group='Strain based dynamics' "); - TwAddVarCB(MiniGL::getTweakBar(), "XYStiffness", TW_TYPE_REAL, setXYStiffness, getXYStiffness, &model, " label='Stiffness XY' min=0.0 step=0.1 precision=4 group='Strain based dynamics' "); - TwAddVarCB(MiniGL::getTweakBar(), "XXStiffnessFEM", TW_TYPE_REAL, setXXStiffness, getXXStiffness, &model, " label='Youngs modulus XX' min=0.0 step=0.1 precision=4 group='FEM based PBD' "); - TwAddVarCB(MiniGL::getTweakBar(), "YYStiffnessFEM", TW_TYPE_REAL, setYYStiffness, getYYStiffness, &model, " label='Youngs modulus YY' min=0.0 step=0.1 precision=4 group='FEM based PBD' "); - TwAddVarCB(MiniGL::getTweakBar(), "XYStiffnessFEM", TW_TYPE_REAL, setXYStiffness, getXYStiffness, &model, " label='Youngs modulus XY' min=0.0 step=0.1 precision=4 group='FEM based PBD' "); - TwAddVarCB(MiniGL::getTweakBar(), "XYPoissonRatioFEM", TW_TYPE_REAL, setXYPoissonRatio, getXYPoissonRatio, &model, " label='Poisson ratio XY' min=0.0 step=0.1 precision=4 group='FEM based PBD' "); - TwAddVarCB(MiniGL::getTweakBar(), "YXPoissonRatioFEM", TW_TYPE_REAL, setYXPoissonRatio, getYXPoissonRatio, &model, " label='Poisson ratio YX' min=0.0 step=0.1 precision=4 group='FEM based PBD' "); - TwAddVarCB(MiniGL::getTweakBar(), "NormalizeStretch", TW_TYPE_BOOL32, setNormalizeStretch, getNormalizeStretch, &model, " label='Normalize stretch' group='Strain based dynamics' "); - TwAddVarCB(MiniGL::getTweakBar(), "NormalizeShear", TW_TYPE_BOOL32, setNormalizeShear, getNormalizeShear, &model, " label='Normalize shear' group='Strain based dynamics' "); - TwType enumType3 = TwDefineEnum("BendingMethodType", NULL, 0); - TwAddVarCB(MiniGL::getTweakBar(), "BendingMethod", enumType3, setBendingMethod, getBendingMethod, &bendingMethod, " label='Bending method' enum='0 {None}, 1 {Dihedral angle}, 2 {Isometric bending}' group=Bending"); - TwAddVarCB(MiniGL::getTweakBar(), "BendingStiffness", TW_TYPE_REAL, setBendingStiffness, getBendingStiffness, &model, " label='Bending stiffness' min=0.0 step=0.01 precision=4 group=Bending "); - - glutMainLoop (); - - cleanup (); - - return 0; -} + base->createParameterGUI(); -void initShader() -{ - std::string vertFile = dataPath + "/shaders/vs_flat.glsl"; - std::string geomFile = dataPath + "/shaders/gs_flat.glsl"; - std::string fragFile = dataPath + "/shaders/fs_flat.glsl"; - shader = MiniGL::createShader(vertFile, geomFile, fragFile); + // reset simulation when cloth simulation/bending method has changed + model->setClothSimulationMethodChangedCallback([&]() { reset(); }); + model->setClothBendingMethodChangedCallback([&]() { reset(); }); - if (shader == NULL) - return; + // OpenGL + MiniGL::setClientIdleFunc (timeStep); + MiniGL::addKeyFunc('r', reset); + MiniGL::setClientSceneFunc(render); + MiniGL::setViewport (40.0, 0.1f, 500.0, Vector3r (0.0, 10.0, 30.0), Vector3r (0.0, 0.0, 0.0)); - shader->begin(); - shader->addUniform("modelview_matrix"); - shader->addUniform("projection_matrix"); - shader->addUniform("surface_color"); - shader->addUniform("shininess"); - shader->addUniform("specular_factor"); - shader->end(); + MiniGL::mainLoop(); - vertFile = dataPath + "/shaders/vs_smoothTex.glsl"; - fragFile = dataPath + "/shaders/fs_smoothTex.glsl"; - shaderTex = MiniGL::createShader(vertFile, "", fragFile); + base->cleanup(); - if (shaderTex == NULL) - return; + Utilities::Timing::printAverageTimes(); + Utilities::Timing::printTimeSums(); - shaderTex->begin(); - shaderTex->addUniform("modelview_matrix"); - shaderTex->addUniform("projection_matrix"); - shaderTex->addUniform("surface_color"); - shaderTex->addUniform("shininess"); - shaderTex->addUniform("specular_factor"); - shaderTex->end(); -} + delete Simulation::getCurrent(); + delete base; + delete model; -void cleanup() -{ - delete TimeManager::getCurrent(); - delete shader; - delete shaderTex; + return 0; } void reset() { - model.reset(); - sim.reset(); - TimeManager::getCurrent()->setTime(0.0); + Utilities::Timing::printAverageTimes(); + Utilities::Timing::reset(); - model.cleanup(); - buildModel(); -} + Simulation::getCurrent()->reset(); + base->getSelectedParticles().clear(); -void mouseMove(int x, int y) -{ - Vector3r mousePos; - MiniGL::unproject(x, y, mousePos); - const Vector3r diff = mousePos - oldMousePos; + Simulation::getCurrent()->getModel()->cleanup(); - TimeManager *tm = TimeManager::getCurrent(); - const Real h = tm->getTimeStepSize(); - - SimulationModel::RigidBodyVector &rb = model.getRigidBodies(); - for (size_t j = 0; j < selectedBodies.size(); j++) - { - rb[selectedBodies[j]]->getVelocity() += 1.0 / h * diff; - } - ParticleData &pd = model.getParticles(); - for (unsigned int j = 0; j < selectedParticles.size(); j++) - { - pd.getVelocity(selectedParticles[j]) += 5.0*diff / h; - } - oldMousePos = mousePos; + buildModel(); } -void selection(const Eigen::Vector2i &start, const Eigen::Vector2i &end) -{ - std::vector hits; - - selectedParticles.clear(); - ParticleData &pd = model.getParticles(); - Selection::selectRect(start, end, &pd.getPosition(0), &pd.getPosition(pd.size() - 1), selectedParticles); - - selectedBodies.clear(); - SimulationModel::RigidBodyVector &rb = model.getRigidBodies(); - std::vector > x; - x.resize(rb.size()); - for (unsigned int i = 0; i < rb.size(); i++) - { - x[i] = rb[i]->getPosition(); - } - - Selection::selectRect(start, end, &x[0], &x[rb.size() - 1], selectedBodies); - if ((selectedBodies.size() > 0) || (selectedParticles.size() > 0)) - MiniGL::setMouseMoveFunc(GLUT_MIDDLE_BUTTON, mouseMove); - else - MiniGL::setMouseMoveFunc(-1, NULL); - - MiniGL::unproject(end[0], end[1], oldMousePos); -} void timeStep () { - if (doPause) + const Real pauseAt = base->getValue(DemoBase::PAUSE_AT); + if ((pauseAt > 0.0) && (pauseAt < TimeManager::getCurrent()->getTime())) + base->setValue(DemoBase::PAUSE, true); + + if (base->getValue(DemoBase::PAUSE)) return; // Simulation code - for (unsigned int i = 0; i < 8; i++) - sim.step(model); - - for (unsigned int i = 0; i < model.getTriangleModels().size(); i++) - model.getTriangleModels()[i]->updateMeshNormals(model.getParticles()); -} - -void buildModel () -{ - TimeManager::getCurrent ()->setTimeStepSize (0.005); - - createClothMesh(); - createRigidBodyModel(); -} - -void renderBallJoint(BallJoint &bj) -{ - MiniGL::drawSphere(bj.m_jointInfo.col(2), 0.1f, jointColor); -} - -void renderRigidBodyParticleBallJoint(RigidBodyParticleBallJoint &bj) -{ - MiniGL::drawSphere(bj.m_jointInfo.col(1), 0.1f, jointColor); -} - -void renderRigidBodyModel() -{ - // Draw simulation model - - SimulationModel::RigidBodyVector &rb = model.getRigidBodies(); - SimulationModel::ConstraintVector &constraints = model.getConstraints(); - - float selectionColor[4] = { 0.8f, 0.0f, 0.0f, 1 }; - float surfaceColor[4] = { 0.1f, 0.4f, 0.8f, 1 }; - - if (shader) + SimulationModel *model = Simulation::getCurrent()->getModel(); + const unsigned int numSteps = base->getValue(DemoBase::NUM_STEPS_PER_RENDER); + for (unsigned int i = 0; i < numSteps; i++) { - shader->begin(); - glUniform1f(shader->getUniform("shininess"), 5.0); - glUniform1f(shader->getUniform("specular_factor"), 0.2f); - - GLfloat matrix[16]; - glGetFloatv(GL_MODELVIEW_MATRIX, matrix); - glUniformMatrix4fv(shader->getUniform("modelview_matrix"), 1, GL_FALSE, matrix); - GLfloat pmatrix[16]; - glGetFloatv(GL_PROJECTION_MATRIX, pmatrix); - glUniformMatrix4fv(shader->getUniform("projection_matrix"), 1, GL_FALSE, pmatrix); - } + START_TIMING("SimStep"); + Simulation::getCurrent()->getTimeStep()->step(*model); + STOP_TIMING_AVG; - for (size_t i = 0; i < rb.size(); i++) - { - bool selected = false; - for (unsigned int j = 0; j < selectedBodies.size(); j++) - { - if (selectedBodies[j] == i) - selected = true; - } - - if (rb[i]->getMass() != 0.0) - { - - const VertexData &vd = rb[i]->getGeometry().getVertexData(); - const IndexedFaceMesh &mesh = rb[i]->getGeometry().getMesh(); - if (!selected) - { - if (shader) - glUniform3fv(shader->getUniform("surface_color"), 1, surfaceColor); - Visualization::drawMesh(vd, mesh, 0, surfaceColor); - } - else - { - if (shader) - glUniform3fv(shader->getUniform("surface_color"), 1, selectionColor); - Visualization::drawMesh(vd, mesh, 0, selectionColor); - } - } + base->step(); } - if (shader) - shader->end(); - for (size_t i = 0; i < constraints.size(); i++) - { - if (constraints[i]->getTypeId() == BallJoint::TYPE_ID) - { - renderBallJoint(*(BallJoint*)constraints[i]); - } - else if (constraints[i]->getTypeId() == RigidBodyParticleBallJoint::TYPE_ID) - { - renderRigidBodyParticleBallJoint(*(RigidBodyParticleBallJoint*)constraints[i]); - } - } + for (unsigned int i = 0; i < model->getTriangleModels().size(); i++) + model->getTriangleModels()[i]->updateMeshNormals(model->getParticles()); } -void renderTriangleModels() +void buildModel () { - // Draw simulation model - - const ParticleData &pd = model.getParticles(); - float surfaceColor[4] = { 0.2f, 0.5, 1.0, 1 }; - - if (shaderTex) - { - shaderTex->begin(); - glUniform3fv(shaderTex->getUniform("surface_color"), 1, surfaceColor); - glUniform1f(shaderTex->getUniform("shininess"), 5.0); - glUniform1f(shaderTex->getUniform("specular_factor"), 0.2f); - - GLfloat matrix[16]; - glGetFloatv(GL_MODELVIEW_MATRIX, matrix); - glUniformMatrix4fv(shaderTex->getUniform("modelview_matrix"), 1, GL_FALSE, matrix); - GLfloat pmatrix[16]; - glGetFloatv(GL_PROJECTION_MATRIX, pmatrix); - glUniformMatrix4fv(shaderTex->getUniform("projection_matrix"), 1, GL_FALSE, pmatrix); - } + TimeManager::getCurrent ()->setTimeStepSize (static_cast(0.005)); - for (unsigned int i = 0; i < model.getTriangleModels().size(); i++) - { - // mesh - TriangleModel *triModel = model.getTriangleModels()[i]; - const IndexedFaceMesh &mesh = triModel->getParticleMesh(); - Visualization::drawTexturedMesh(pd, mesh, triModel->getIndexOffset(), surfaceColor); - } - if (shaderTex) - shaderTex->end(); - - float red[4] = { 0.8f, 0.0, 0.0, 1 }; - for (unsigned int j = 0; j < selectedParticles.size(); j++) - { - MiniGL::drawSphere(pd.getPosition(selectedParticles[j]), 0.08f, red); - } + createClothMesh(); + createRigidBodyModel(); } - void render () { - MiniGL::coordinateSystem(); - - renderRigidBodyModel(); - renderTriangleModels(); - - MiniGL::drawTime( TimeManager::getCurrent ()->getTime ()); + base->render(); } // Compute diagonal inertia tensor Vector3r computeInertiaTensorBox(const Real mass, const Real width, const Real height, const Real depth) { - const Real Ix = (mass / 12.0) * (height*height + depth*depth); - const Real Iy = (mass / 12.0) * (width*width + depth*depth); - const Real Iz = (mass / 12.0) * (width*width + height*height); + const Real Ix = (mass / static_cast(12.0)) * (height*height + depth*depth); + const Real Iy = (mass / static_cast(12.0)) * (width*width + depth*depth); + const Real Iz = (mass / static_cast(12.0)) * (width*width + height*height); return Vector3r(Ix, Iy, Iz); } + /** Create the model */ void createRigidBodyModel() { - SimulationModel::RigidBodyVector &rb = model.getRigidBodies(); - SimulationModel::ConstraintVector &constraints = model.getConstraints(); - - string fileName = dataPath + "/models/cube.obj"; + SimulationModel *model = Simulation::getCurrent()->getModel(); + SimulationModel::RigidBodyVector &rb = model->getRigidBodies(); + + string fileName = FileSystem::normalizePath(base->getExePath() + "/resources/models/cube.obj"); IndexedFaceMesh mesh; VertexData vd; - OBJLoader::loadObj(fileName, vd, mesh, Vector3r(width, height, depth)); + DemoBase::loadMesh(fileName, vd, mesh, Vector3r::Zero(), Matrix3r::Identity(), Vector3r(width, height, depth)); + mesh.setFlatShading(true); + + IndexedFaceMesh mesh_static; + VertexData vd_static; + DemoBase::loadMesh(fileName, vd_static, mesh_static, Vector3r::Zero(), Matrix3r::Identity(), Vector3r(0.5, 0.5, 0.5)); + mesh_static.setFlatShading(true); rb.resize(12); @@ -415,7 +174,7 @@ void createRigidBodyModel() Vector3r(-5.0, 0.0, -5.0), computeInertiaTensorBox(1.0, 0.5, 0.5, 0.5), Quaternionr(1.0, 0.0, 0.0, 0.0), - vd, mesh); + vd_static, mesh_static); // dynamic body rb[1] = new RigidBody(); @@ -433,8 +192,8 @@ void createRigidBodyModel() Quaternionr(1.0, 0.0, 0.0, 0.0), vd, mesh); - model.addBallJoint(0, 1, Vector3r(-5.0, 0.0, -5.0)); - model.addBallJoint(1, 2, Vector3r(-5.0, 2.0, -5.0)); + model->addBallJoint(0, 1, Vector3r(-5.0, 0.0, -5.0)); + model->addBallJoint(1, 2, Vector3r(-5.0, 2.0, -5.0)); ////////////////////////////////////////////////////////////////////////// // 5, -5 @@ -444,7 +203,7 @@ void createRigidBodyModel() Vector3r(5.0, 0.0, -5.0), computeInertiaTensorBox(1.0, 0.5, 0.5, 0.5), Quaternionr(1.0, 0.0, 0.0, 0.0), - vd, mesh); + vd_static, mesh_static); // dynamic body rb[4] = new RigidBody(); @@ -462,8 +221,8 @@ void createRigidBodyModel() Quaternionr(1.0, 0.0, 0.0, 0.0), vd, mesh); - model.addBallJoint(3, 4, Vector3r(5.0, 0.0, -5.0)); - model.addBallJoint(4, 5, Vector3r(5.0, 2.0, -5.0)); + model->addBallJoint(3, 4, Vector3r(5.0, 0.0, -5.0)); + model->addBallJoint(4, 5, Vector3r(5.0, 2.0, -5.0)); ////////////////////////////////////////////////////////////////////////// // 5, 5 @@ -473,7 +232,7 @@ void createRigidBodyModel() Vector3r(5.0, 0.0, 5.0), computeInertiaTensorBox(1.0, 0.5, 0.5, 0.5), Quaternionr(1.0, 0.0, 0.0, 0.0), - vd, mesh); + vd_static, mesh_static); // dynamic body rb[7] = new RigidBody(); @@ -491,8 +250,8 @@ void createRigidBodyModel() Quaternionr(1.0, 0.0, 0.0, 0.0), vd, mesh); - model.addBallJoint(6, 7, Vector3r(5.0, 0.0, 5.0)); - model.addBallJoint(7, 8, Vector3r(5.0, 2.0, 5.0)); + model->addBallJoint(6, 7, Vector3r(5.0, 0.0, 5.0)); + model->addBallJoint(7, 8, Vector3r(5.0, 2.0, 5.0)); ////////////////////////////////////////////////////////////////////////// // -5, 5 @@ -502,7 +261,7 @@ void createRigidBodyModel() Vector3r(-5.0, 0.0, 5.0), computeInertiaTensorBox(1.0, 0.5, 0.5, 0.5), Quaternionr(1.0, 0.0, 0.0, 0.0), - vd, mesh); + vd_static, mesh_static); // dynamic body rb[10] = new RigidBody(); @@ -520,14 +279,14 @@ void createRigidBodyModel() Quaternionr(1.0, 0.0, 0.0, 0.0), vd, mesh); - model.addBallJoint(9, 10, Vector3r(-5.0, 0.0, 5.0)); - model.addBallJoint(10, 11, Vector3r(-5.0, 2.0, 5.0)); + model->addBallJoint(9, 10, Vector3r(-5.0, 0.0, 5.0)); + model->addBallJoint(10, 11, Vector3r(-5.0, 2.0, 5.0)); - model.addRigidBodyParticleBallJoint(2, 0); - model.addRigidBodyParticleBallJoint(5, (nRows - 1)*nCols); - model.addRigidBodyParticleBallJoint(8, nRows*nCols - 1); - model.addRigidBodyParticleBallJoint(11, nCols-1); + model->addRigidBodyParticleBallJoint(2, 0); + model->addRigidBodyParticleBallJoint(5, nCols - 1); + model->addRigidBodyParticleBallJoint(8, nRows*nCols - 1); + model->addRigidBodyParticleBallJoint(11, (nRows -1)*nCols); } @@ -536,308 +295,28 @@ void createRigidBodyModel() */ void createClothMesh() { - TriangleModel::ParticleMesh::UVs uvs; - uvs.resize(nRows*nCols); - - const Real dy = clothWidth / (Real)(nCols - 1); - const Real dx = clothHeight / (Real)(nRows - 1); - - Vector3r points[nRows*nCols]; - for (int i = 0; i < nRows; i++) - { - for (int j = 0; j < nCols; j++) - { - const Real y = (Real)dy*j; - const Real x = (Real)dx*i; - points[i*nCols + j] = Vector3r(x - 5.0, 4.0, y - 5.0); - - uvs[i*nCols + j][0] = x / clothWidth; - uvs[i*nCols + j][1] = y / clothHeight; - } - } - const int nIndices = 6 * (nRows - 1)*(nCols - 1); - - TriangleModel::ParticleMesh::UVIndices uvIndices; - uvIndices.resize(nIndices); - - unsigned int indices[nIndices]; - int index = 0; - for (int i = 0; i < nRows - 1; i++) - { - for (int j = 0; j < nCols - 1; j++) - { - int helper = 0; - if (i % 2 == j % 2) - helper = 1; - - indices[index] = i*nCols + j; - indices[index + 1] = i*nCols + j + 1; - indices[index + 2] = (i + 1)*nCols + j + helper; - - uvIndices[index] = i*nCols + j; - uvIndices[index + 1] = i*nCols + j + 1; - uvIndices[index + 2] = (i + 1)*nCols + j + helper; - index += 3; - - indices[index] = (i + 1)*nCols + j + 1; - indices[index + 1] = (i + 1)*nCols + j; - indices[index + 2] = i*nCols + j + 1 - helper; - - uvIndices[index] = (i + 1)*nCols + j + 1; - uvIndices[index + 1] = (i + 1)*nCols + j; - uvIndices[index + 2] = i*nCols + j + 1 - helper; - index += 3; - } - } + SimulationModel* model = Simulation::getCurrent()->getModel(); + model->addRegularTriangleModel(nCols, nRows, + Vector3r(-5, 4, -5), AngleAxisr(M_PI * 0.5, Vector3r(1, 0, 0)).matrix(), Vector2r(clothWidth, clothHeight)); - model.addTriangleModel(nRows*nCols, nIndices / 3, &points[0], &indices[0], uvIndices, uvs); - - ParticleData &pd = model.getParticles(); - for (unsigned int i = 0; i < pd.getNumberOfParticles(); i++) - { - pd.setMass(i, 1.0); - } // init constraints - for (unsigned int cm = 0; cm < model.getTriangleModels().size(); cm++) + for (unsigned int cm = 0; cm < model->getTriangleModels().size(); cm++) { - if (simulationMethod == 1) - { - const unsigned int offset = model.getTriangleModels()[cm]->getIndexOffset(); - const unsigned int nEdges = model.getTriangleModels()[cm]->getParticleMesh().numEdges(); - const IndexedFaceMesh::Edge *edges = model.getTriangleModels()[cm]->getParticleMesh().getEdges().data(); - for (unsigned int i = 0; i < nEdges; i++) - { - const unsigned int v1 = edges[i].m_vert[0] + offset; - const unsigned int v2 = edges[i].m_vert[1] + offset; - - model.addDistanceConstraint(v1, v2); - } - } - else if (simulationMethod == 2) - { - const unsigned int offset = model.getTriangleModels()[cm]->getIndexOffset(); - TriangleModel::ParticleMesh &mesh = model.getTriangleModels()[cm]->getParticleMesh(); - const unsigned int *tris = mesh.getFaces().data(); - const unsigned int nFaces = mesh.numFaces(); - for (unsigned int i = 0; i < nFaces; i++) - { - const unsigned int v1 = tris[3 * i] + offset; - const unsigned int v2 = tris[3 * i + 1] + offset; - const unsigned int v3 = tris[3 * i + 2] + offset; - model.addFEMTriangleConstraint(v1, v2, v3); - } - } - else if (simulationMethod == 3) - { - const unsigned int offset = model.getTriangleModels()[cm]->getIndexOffset(); - TriangleModel::ParticleMesh &mesh = model.getTriangleModels()[cm]->getParticleMesh(); - const unsigned int *tris = mesh.getFaces().data(); - const unsigned int nFaces = mesh.numFaces(); - for (unsigned int i = 0; i < nFaces; i++) - { - const unsigned int v1 = tris[3 * i] + offset; - const unsigned int v2 = tris[3 * i + 1] + offset; - const unsigned int v3 = tris[3 * i + 2] + offset; - model.addStrainTriangleConstraint(v1, v2, v3); - } - } - if (bendingMethod != 0) - { - const unsigned int offset = model.getTriangleModels()[cm]->getIndexOffset(); - TriangleModel::ParticleMesh &mesh = model.getTriangleModels()[cm]->getParticleMesh(); - unsigned int nEdges = mesh.numEdges(); - const TriangleModel::ParticleMesh::Edge *edges = mesh.getEdges().data(); - const unsigned int *tris = mesh.getFaces().data(); - for (unsigned int i = 0; i < nEdges; i++) - { - const int tri1 = edges[i].m_face[0]; - const int tri2 = edges[i].m_face[1]; - if ((tri1 != 0xffffffff) && (tri2 != 0xffffffff)) - { - // Find the triangle points which do not lie on the axis - const int axisPoint1 = edges[i].m_vert[0]; - const int axisPoint2 = edges[i].m_vert[1]; - int point1 = -1; - int point2 = -1; - for (int j = 0; j < 3; j++) - { - if ((tris[3 * tri1 + j] != axisPoint1) && (tris[3 * tri1 + j] != axisPoint2)) - { - point1 = tris[3 * tri1 + j]; - break; - } - } - for (int j = 0; j < 3; j++) - { - if ((tris[3 * tri2 + j] != axisPoint1) && (tris[3 * tri2 + j] != axisPoint2)) - { - point2 = tris[3 * tri2 + j]; - break; - } - } - if ((point1 != -1) && (point2 != -1)) - { - const unsigned int vertex1 = point1 + offset; - const unsigned int vertex2 = point2 + offset; - const unsigned int vertex3 = edges[i].m_vert[0] + offset; - const unsigned int vertex4 = edges[i].m_vert[1] + offset; - if (bendingMethod == 1) - model.addDihedralConstraint(vertex1, vertex2, vertex3, vertex4); - else if (bendingMethod == 2) - model.addIsometricBendingConstraint(vertex1, vertex2, vertex3, vertex4); - } - } - } - } + model->setClothStiffness(1.0); + if (model->getClothSimulationMethod() == 4) + model->setClothStiffness(100000); + model->addClothConstraints(model->getTriangleModels()[cm], model->getClothSimulationMethod(), model->getClothStiffness(), model->getClothStiffnessXX(), + model->getClothStiffnessYY(), model->getClothStiffnessXY(), model->getClothPoissonRatioXY(), model->getClothPoissonRatioYX(), + model->getClothNormalizeStretch(), model->getClothNormalizeShear()); + + model->setClothBendingStiffness(0.01); + if (model->getClothBendingMethod() == 3) + model->setClothBendingStiffness(100.0); + model->addBendingConstraints(model->getTriangleModels()[cm], model->getClothBendingMethod(), model->getClothBendingStiffness()); } - std::cout << "Number of triangles: " << nIndices / 3 << "\n"; - std::cout << "Number of vertices: " << nRows*nCols << "\n"; - -} - -void TW_CALL setTimeStep(const void *value, void *clientData) -{ - const Real val = *(const Real *)(value); - TimeManager::getCurrent()->setTimeStepSize(val); -} - -void TW_CALL getTimeStep(void *value, void *clientData) -{ - *(Real *)(value) = TimeManager::getCurrent()->getTimeStepSize(); -} - -void TW_CALL setVelocityUpdateMethod(const void *value, void *clientData) -{ - const short val = *(const short *)(value); - ((TimeStepController*)clientData)->setVelocityUpdateMethod((unsigned int)val); -} - -void TW_CALL getVelocityUpdateMethod(void *value, void *clientData) -{ - *(short *)(value) = (short)((TimeStepController*)clientData)->getVelocityUpdateMethod(); -} - -void TW_CALL setStiffness(const void *value, void *clientData) -{ - const Real val = *(const Real *)(value); - ((SimulationModel*)clientData)->setClothStiffness(val); -} - -void TW_CALL getStiffness(void *value, void *clientData) -{ - *(Real *)(value) = ((SimulationModel*)clientData)->getClothStiffness(); -} - -void TW_CALL setXXStiffness(const void *value, void *clientData) -{ - const Real val = *(const Real *)(value); - ((SimulationModel*)clientData)->setClothXXStiffness(val); -} - -void TW_CALL getXXStiffness(void *value, void *clientData) -{ - *(Real *)(value) = ((SimulationModel*)clientData)->getClothXXStiffness(); -} - -void TW_CALL setYYStiffness(const void *value, void *clientData) -{ - const Real val = *(const Real *)(value); - ((SimulationModel*)clientData)->setClothYYStiffness(val); -} - -void TW_CALL getYYStiffness(void *value, void *clientData) -{ - *(Real *)(value) = ((SimulationModel*)clientData)->getClothYYStiffness(); -} - -void TW_CALL setXYStiffness(const void *value, void *clientData) -{ - const Real val = *(const Real *)(value); - ((SimulationModel*)clientData)->setClothXYStiffness(val); -} - -void TW_CALL getXYStiffness(void *value, void *clientData) -{ - *(Real *)(value) = ((SimulationModel*)clientData)->getClothXYStiffness(); -} - -void TW_CALL setYXPoissonRatio(const void *value, void *clientData) -{ - const Real val = *(const Real *)(value); - ((SimulationModel*)clientData)->setClothYXPoissonRatio(val); -} - -void TW_CALL getYXPoissonRatio(void *value, void *clientData) -{ - *(Real *)(value) = ((SimulationModel*)clientData)->getClothYXPoissonRatio(); -} - -void TW_CALL setXYPoissonRatio(const void *value, void *clientData) -{ - const Real val = *(const Real *)(value); - ((SimulationModel*)clientData)->setClothXYPoissonRatio(val); -} - -void TW_CALL getXYPoissonRatio(void *value, void *clientData) -{ - *(Real *)(value) = ((SimulationModel*)clientData)->getClothXYPoissonRatio(); -} - -void TW_CALL setNormalizeStretch(const void *value, void *clientData) -{ - const bool val = *(const bool *)(value); - ((SimulationModel*)clientData)->setClothNormalizeStretch(val); -} - -void TW_CALL getNormalizeStretch(void *value, void *clientData) -{ - *(bool *)(value) = ((SimulationModel*)clientData)->getClothNormalizeStretch(); -} - -void TW_CALL setNormalizeShear(const void *value, void *clientData) -{ - const bool val = *(const bool *)(value); - ((SimulationModel*)clientData)->setClothNormalizeShear(val); -} - -void TW_CALL getNormalizeShear(void *value, void *clientData) -{ - *(bool *)(value) = ((SimulationModel*)clientData)->getClothNormalizeShear(); -} - -void TW_CALL setBendingStiffness(const void *value, void *clientData) -{ - const Real val = *(const Real *)(value); - ((SimulationModel*)clientData)->setClothBendingStiffness(val); -} - -void TW_CALL getBendingStiffness(void *value, void *clientData) -{ - *(Real *)(value) = ((SimulationModel*)clientData)->getClothBendingStiffness(); -} - -void TW_CALL setBendingMethod(const void *value, void *clientData) -{ - const short val = *(const short *)(value); - *((short*)clientData) = val; - reset(); -} - -void TW_CALL getBendingMethod(void *value, void *clientData) -{ - *(short *)(value) = *((short*)clientData); -} + LOG_INFO << "Number of triangles: " << model->getTriangleModels()[0]->getParticleMesh().numFaces(); + LOG_INFO << "Number of vertices: " << nRows*nCols; -void TW_CALL setSimulationMethod(const void *value, void *clientData) -{ - const short val = *(const short *)(value); - *((short*)clientData) = val; - reset(); } - -void TW_CALL getSimulationMethod(void *value, void *clientData) -{ - *(short *)(value) = *((short*)clientData); -} \ No newline at end of file diff --git a/Demos/DistanceFieldDemos/CMakeLists.txt b/Demos/DistanceFieldDemos/CMakeLists.txt index 014870da..078ced88 100644 --- a/Demos/DistanceFieldDemos/CMakeLists.txt +++ b/Demos/DistanceFieldDemos/CMakeLists.txt @@ -1,37 +1,43 @@ -set(SIMULATION_LINK_LIBRARIES AntTweakBar glew PositionBasedDynamics Simulation) -set(SIMULATION_DEPENDENCIES AntTweakBar glew PositionBasedDynamics Simulation) +set(SIMULATION_LINK_LIBRARIES imgui glfw PositionBasedDynamics Simulation Utils) +set(SIMULATION_DEPENDENCIES imgui glfw PositionBasedDynamics Simulation Utils CopyPBDShaders CopyPBDModels CopyImguiFonts) if(WIN32) - set(SIMULATION_LINK_LIBRARIES freeglut opengl32.lib glu32.lib ${SIMULATION_LINK_LIBRARIES} ${Boost_LIBRARIES}) - set(SIMULATION_DEPENDENCIES freeglut ${SIMULATION_DEPENDENCIES}) + set(SIMULATION_LINK_LIBRARIES opengl32.lib glu32.lib ${SIMULATION_LINK_LIBRARIES}) + #set(SIMULATION_DEPENDENCIES ${SIMULATION_DEPENDENCIES}) else() - find_package(GLUT REQUIRED) + set(OpenGL_GL_PREFERENCE GLVND) find_package(OpenGL REQUIRED) + include_directories( ${OPENGL_INCLUDE_DIRS}) set(SIMULATION_LINK_LIBRARIES ${SIMULATION_LINK_LIBRARIES} - ${GLUT_LIBRARIES} ${OPENGL_LIBRARIES} ) endif() +############################################################ +# GenericParameters +############################################################ +include_directories(${GenericParameters_INCLUDE_DIR}) +if(TARGET Ext_GenericParameters) + set(SIMULATION_DEPENDENCIES ${SIMULATION_DEPENDENCIES} Ext_GenericParameters) +endif() + + add_executable(ClothCollisionDemo ClothCollisionDemo.cpp + + ../Common/LogWindow.cpp + ../Common/LogWindow.h + ../Common/Simulator_GUI_imgui.cpp + ../Common/Simulator_GUI_imgui.h + ../Common/imguiParameters.cpp + ../Common/imguiParameters.h + ../Common/DemoBase.cpp + ../Common/DemoBase.h ${VIS_FILES} ${PROJECT_PATH}/Common/Common.h - ${PROJECT_PATH}/Demos/Common/Config.h - ${PROJECT_PATH}/Demos/Utils/IndexedFaceMesh.cpp - ${PROJECT_PATH}/Demos/Utils/IndexedFaceMesh.h - ${PROJECT_PATH}/Demos/Utils/IndexedTetMesh.cpp - ${PROJECT_PATH}/Demos/Utils/IndexedTetMesh.h - ${PROJECT_PATH}/Demos/Utils/OBJLoader.cpp - ${PROJECT_PATH}/Demos/Utils/OBJLoader.h - ${PROJECT_PATH}/Demos/Utils/ObjectArray.h - ${PROJECT_PATH}/Demos/Utils/Utilities.cpp - ${PROJECT_PATH}/Demos/Utils/Utilities.h - ${PROJECT_PATH}/Demos/Utils/VolumeIntegration.cpp - ${PROJECT_PATH}/Demos/Utils/VolumeIntegration.h CMakeLists.txt ) @@ -46,21 +52,18 @@ target_link_libraries(ClothCollisionDemo ${SIMULATION_LINK_LIBRARIES}) add_executable(DeformableCollisionDemo DeformableCollisionDemo.cpp + + ../Common/LogWindow.cpp + ../Common/LogWindow.h + ../Common/Simulator_GUI_imgui.cpp + ../Common/Simulator_GUI_imgui.h + ../Common/imguiParameters.cpp + ../Common/imguiParameters.h + ../Common/DemoBase.cpp + ../Common/DemoBase.h ${VIS_FILES} ${PROJECT_PATH}/Common/Common.h - ${PROJECT_PATH}/Demos/Common/Config.h - ${PROJECT_PATH}/Demos/Utils/IndexedFaceMesh.cpp - ${PROJECT_PATH}/Demos/Utils/IndexedFaceMesh.h - ${PROJECT_PATH}/Demos/Utils/IndexedTetMesh.cpp - ${PROJECT_PATH}/Demos/Utils/IndexedTetMesh.h - ${PROJECT_PATH}/Demos/Utils/OBJLoader.cpp - ${PROJECT_PATH}/Demos/Utils/OBJLoader.h - ${PROJECT_PATH}/Demos/Utils/ObjectArray.h - ${PROJECT_PATH}/Demos/Utils/Utilities.cpp - ${PROJECT_PATH}/Demos/Utils/Utilities.h - ${PROJECT_PATH}/Demos/Utils/VolumeIntegration.cpp - ${PROJECT_PATH}/Demos/Utils/VolumeIntegration.h CMakeLists.txt ) @@ -75,21 +78,18 @@ target_link_libraries(DeformableCollisionDemo ${SIMULATION_LINK_LIBRARIES}) add_executable(RigidBodyCollisionDemo RigidBodyCollisionDemo.cpp + + ../Common/LogWindow.cpp + ../Common/LogWindow.h + ../Common/Simulator_GUI_imgui.cpp + ../Common/Simulator_GUI_imgui.h + ../Common/imguiParameters.cpp + ../Common/imguiParameters.h + ../Common/DemoBase.cpp + ../Common/DemoBase.h ${VIS_FILES} ${PROJECT_PATH}/Common/Common.h - ${PROJECT_PATH}/Demos/Common/Config.h - ${PROJECT_PATH}/Demos/Utils/IndexedFaceMesh.cpp - ${PROJECT_PATH}/Demos/Utils/IndexedFaceMesh.h - ${PROJECT_PATH}/Demos/Utils/IndexedTetMesh.cpp - ${PROJECT_PATH}/Demos/Utils/IndexedTetMesh.h - ${PROJECT_PATH}/Demos/Utils/OBJLoader.cpp - ${PROJECT_PATH}/Demos/Utils/OBJLoader.h - ${PROJECT_PATH}/Demos/Utils/ObjectArray.h - ${PROJECT_PATH}/Demos/Utils/Utilities.cpp - ${PROJECT_PATH}/Demos/Utils/Utilities.h - ${PROJECT_PATH}/Demos/Utils/VolumeIntegration.cpp - ${PROJECT_PATH}/Demos/Utils/VolumeIntegration.h CMakeLists.txt ) @@ -101,8 +101,6 @@ set_target_properties(RigidBodyCollisionDemo PROPERTIES MINSIZEREL_POSTFIX ${CMA add_dependencies(RigidBodyCollisionDemo ${SIMULATION_DEPENDENCIES}) target_link_libraries(RigidBodyCollisionDemo ${SIMULATION_LINK_LIBRARIES}) - -add_definitions(-DTW_NO_LIB_PRAGMA -DTW_STATIC) find_package( Eigen3 REQUIRED ) include_directories( ${EIGEN3_INCLUDE_DIR} ) include_directories(${PROJECT_PATH}/extern/freeglut/include) diff --git a/Demos/DistanceFieldDemos/ClothCollisionDemo.cpp b/Demos/DistanceFieldDemos/ClothCollisionDemo.cpp index 3139a24d..7b4adef3 100644 --- a/Demos/DistanceFieldDemos/ClothCollisionDemo.cpp +++ b/Demos/DistanceFieldDemos/ClothCollisionDemo.cpp @@ -1,267 +1,149 @@ -#include "Demos/Common/Config.h" +#include "Common/Common.h" #include "Demos/Visualization/MiniGL.h" #include "Demos/Visualization/Selection.h" -#include "GL/glut.h" -#include "Demos/Simulation/TimeManager.h" +#include "Simulation/TimeManager.h" #include -#include "Demos/Simulation/SimulationModel.h" -#include "Demos/Simulation/TimeStepController.h" +#include "Simulation/SimulationModel.h" +#include "Simulation/TimeStepController.h" #include #include "Demos/Visualization/Visualization.h" -#include "Demos/Utils/Utilities.h" -#include "Demos/Simulation/DistanceFieldCollisionDetection.h" -#include "Demos/Utils/OBJLoader.h" +#include "Simulation/DistanceFieldCollisionDetection.h" +#include "Utils/Logger.h" +#include "Utils/Timing.h" +#include "Utils/FileSystem.h" +#include "Demos/Common/DemoBase.h" +#include "Simulation/Simulation.h" + // Enable memory leak detection -#ifdef _DEBUG +#if defined(_DEBUG) && !defined(EIGEN_ALIGN) #define new DEBUG_NEW #endif using namespace PBD; using namespace Eigen; using namespace std; +using namespace Utilities; void timeStep (); void buildModel (); void createMesh(); void render (); -void cleanup(); void reset(); -void initShader(); -void selection(const Eigen::Vector2i &start, const Eigen::Vector2i &end); -void TW_CALL setTimeStep(const void *value, void *clientData); -void TW_CALL getTimeStep(void *value, void *clientData); -void TW_CALL setStiffness(const void *value, void *clientData); -void TW_CALL getStiffness(void *value, void *clientData); -void TW_CALL setXXStiffness(const void *value, void *clientData); -void TW_CALL getXXStiffness(void *value, void *clientData); -void TW_CALL setYYStiffness(const void *value, void *clientData); -void TW_CALL getYYStiffness(void *value, void *clientData); -void TW_CALL setXYStiffness(const void *value, void *clientData); -void TW_CALL getXYStiffness(void *value, void *clientData); -void TW_CALL setXYPoissonRatio(const void *value, void *clientData); -void TW_CALL getXYPoissonRatio(void *value, void *clientData); -void TW_CALL setYXPoissonRatio(const void *value, void *clientData); -void TW_CALL getYXPoissonRatio(void *value, void *clientData); -void TW_CALL setNormalizeStretch(const void *value, void *clientData); -void TW_CALL getNormalizeStretch(void *value, void *clientData); -void TW_CALL setNormalizeShear(const void *value, void *clientData); -void TW_CALL getNormalizeShear(void *value, void *clientData); -void TW_CALL setBendingStiffness(const void *value, void *clientData); -void TW_CALL getBendingStiffness(void *value, void *clientData); -void TW_CALL setBendingMethod(const void *value, void *clientData); -void TW_CALL getBendingMethod(void *value, void *clientData); -void TW_CALL setSimulationMethod(const void *value, void *clientData); -void TW_CALL getSimulationMethod(void *value, void *clientData); -void TW_CALL setVelocityUpdateMethod(const void *value, void *clientData); -void TW_CALL getVelocityUpdateMethod(void *value, void *clientData); -void TW_CALL setMaxIterations(const void *value, void *clientData); -void TW_CALL getMaxIterations(void *value, void *clientData); -void TW_CALL setMaxIterationsV(const void *value, void *clientData); -void TW_CALL getMaxIterationsV(void *value, void *clientData); -void TW_CALL setContactTolerance(const void *value, void *clientData); -void TW_CALL getContactTolerance(void *value, void *clientData); -void TW_CALL setContactStiffnessRigidBody(const void *value, void *clientData); -void TW_CALL getContactStiffnessRigidBody(void *value, void *clientData); -void TW_CALL setContactStiffnessParticleRigidBody(const void *value, void *clientData); -void TW_CALL getContactStiffnessParticleRigidBody(void *value, void *clientData); - - - -SimulationModel model; -DistanceFieldCollisionDetection cd; -TimeStepController sim; const int nRows = 50; const int nCols = 50; const Real width = 10.0; const Real height = 10.0; -short simulationMethod = 2; -short bendingMethod = 2; bool doPause = true; -bool renderContacts = false; -std::vector selectedParticles; -Vector3r oldMousePos; -Shader *shader; -Shader *shaderTex; -string exePath; -string dataPath; +DemoBase *base; +DistanceFieldCollisionDetection cd; // main int main( int argc, char **argv ) { REPORT_MEMORY_LEAKS - exePath = Utilities::getFilePath(argv[0]); - dataPath = exePath + "/" + std::string(PBD_DATA_PATH); + base = new DemoBase(); + base->init(argc, argv, "Cloth collision demo"); - // OpenGL - MiniGL::init (argc, argv, 1024, 768, 0, 0, "Cloth collision demo"); - MiniGL::initLights (); - MiniGL::initTexture(); - MiniGL::setClientIdleFunc (50, timeStep); - MiniGL::setKeyFunc(0, 'r', reset); - MiniGL::setSelectionFunc(selection); - initShader(); + SimulationModel *model = new SimulationModel(); + model->init(); + Simulation::getCurrent()->setModel(model); - buildModel (); + buildModel(); - MiniGL::setClientSceneFunc(render); - MiniGL::setViewport (40.0f, 0.1f, 500.0f, Vector3r (5.0, 10.0, 30.0), Vector3r (5.0, 0.0, 0.0)); - - TwAddVarRW(MiniGL::getTweakBar(), "Pause", TW_TYPE_BOOLCPP, &doPause, " label='Pause' group=Simulation key=SPACE "); - TwAddVarRW(MiniGL::getTweakBar(), "RenderContacts", TW_TYPE_BOOLCPP, &renderContacts, " label='Render contacts' group=Simulation "); - TwAddVarCB(MiniGL::getTweakBar(), "TimeStepSize", TW_TYPE_REAL, setTimeStep, getTimeStep, &model, " label='Time step size' min=0.0 max = 0.1 step=0.001 precision=4 group=Simulation "); - TwType enumType = TwDefineEnum("VelocityUpdateMethodType", NULL, 0); - TwAddVarCB(MiniGL::getTweakBar(), "VelocityUpdateMethod", enumType, setVelocityUpdateMethod, getVelocityUpdateMethod, &sim, " label='Velocity update method' enum='0 {First Order Update}, 1 {Second Order Update}' group=Simulation"); - TwType enumType2 = TwDefineEnum("SimulationMethodType", NULL, 0); - TwAddVarCB(MiniGL::getTweakBar(), "SimulationMethod", enumType2, setSimulationMethod, getSimulationMethod, &simulationMethod, " label='Simulation method' enum='0 {None}, 1 {Distance constraints}, 2 {FEM based PBD}, 3 {Strain based dynamics}' group=Simulation"); - TwAddVarCB(MiniGL::getTweakBar(), "Stiffness", TW_TYPE_REAL, setStiffness, getStiffness, &model, " label='Stiffness' min=0.0 step=0.1 precision=4 group='Distance constraints' "); - TwAddVarCB(MiniGL::getTweakBar(), "XXStiffness", TW_TYPE_REAL, setXXStiffness, getXXStiffness, &model, " label='Stiffness XX' min=0.0 step=0.1 precision=4 group='Strain based dynamics' "); - TwAddVarCB(MiniGL::getTweakBar(), "YYStiffness", TW_TYPE_REAL, setYYStiffness, getYYStiffness, &model, " label='Stiffness YY' min=0.0 step=0.1 precision=4 group='Strain based dynamics' "); - TwAddVarCB(MiniGL::getTweakBar(), "XYStiffness", TW_TYPE_REAL, setXYStiffness, getXYStiffness, &model, " label='Stiffness XY' min=0.0 step=0.1 precision=4 group='Strain based dynamics' "); - TwAddVarCB(MiniGL::getTweakBar(), "XXStiffnessFEM", TW_TYPE_REAL, setXXStiffness, getXXStiffness, &model, " label='Youngs modulus XX' min=0.0 step=0.1 precision=4 group='FEM based PBD' "); - TwAddVarCB(MiniGL::getTweakBar(), "YYStiffnessFEM", TW_TYPE_REAL, setYYStiffness, getYYStiffness, &model, " label='Youngs modulus YY' min=0.0 step=0.1 precision=4 group='FEM based PBD' "); - TwAddVarCB(MiniGL::getTweakBar(), "XYStiffnessFEM", TW_TYPE_REAL, setXYStiffness, getXYStiffness, &model, " label='Youngs modulus XY' min=0.0 step=0.1 precision=4 group='FEM based PBD' "); - TwAddVarCB(MiniGL::getTweakBar(), "XYPoissonRatioFEM", TW_TYPE_REAL, setXYPoissonRatio, getXYPoissonRatio, &model, " label='Poisson ratio XY' min=0.0 step=0.1 precision=4 group='FEM based PBD' "); - TwAddVarCB(MiniGL::getTweakBar(), "YXPoissonRatioFEM", TW_TYPE_REAL, setYXPoissonRatio, getYXPoissonRatio, &model, " label='Poisson ratio YX' min=0.0 step=0.1 precision=4 group='FEM based PBD' "); - TwAddVarCB(MiniGL::getTweakBar(), "NormalizeStretch", TW_TYPE_BOOL32, setNormalizeStretch, getNormalizeStretch, &model, " label='Normalize stretch' group='Strain based dynamics' "); - TwAddVarCB(MiniGL::getTweakBar(), "NormalizeShear", TW_TYPE_BOOL32, setNormalizeShear, getNormalizeShear, &model, " label='Normalize shear' group='Strain based dynamics' "); - TwType enumType3 = TwDefineEnum("BendingMethodType", NULL, 0); - TwAddVarCB(MiniGL::getTweakBar(), "BendingMethod", enumType3, setBendingMethod, getBendingMethod, &bendingMethod, " label='Bending method' enum='0 {None}, 1 {Dihedral angle}, 2 {Isometric bending}' group=Bending"); - TwAddVarCB(MiniGL::getTweakBar(), "BendingStiffness", TW_TYPE_REAL, setBendingStiffness, getBendingStiffness, &model, " label='Bending stiffness' min=0.0 step=0.01 precision=4 group=Bending "); - TwAddVarCB(MiniGL::getTweakBar(), "MaxIter", TW_TYPE_UINT32, setMaxIterations, getMaxIterations, &sim, " label='Max. iterations' min=1 step=1 group=Simulation "); - TwAddVarCB(MiniGL::getTweakBar(), "MaxIterV", TW_TYPE_UINT32, setMaxIterationsV, getMaxIterationsV, &sim, " label='Max. iterations Vel.' min=1 step=1 group=Simulation "); - TwAddVarCB(MiniGL::getTweakBar(), "ContactTolerance", TW_TYPE_REAL, setContactTolerance, getContactTolerance, &cd, " label='Contact tolerance' min=0.0 step=0.001 precision=3 group=Simulation "); - TwAddVarCB(MiniGL::getTweakBar(), "ContactStiffnessRigidBody", TW_TYPE_REAL, setContactStiffnessRigidBody, getContactStiffnessRigidBody, &model, " label='Contact stiffness RB' min=0.0 step=0.1 precision=2 group=Simulation "); - TwAddVarCB(MiniGL::getTweakBar(), "ContactStiffnessParticleRigidBody", TW_TYPE_REAL, setContactStiffnessParticleRigidBody, getContactStiffnessParticleRigidBody, &model, " label='Contact stiffness Particle-RB' min=0.0 step=0.1 precision=2 group=Simulation "); - - - glutMainLoop (); - - cleanup (); - - return 0; -} + base->createParameterGUI(); -void initShader() -{ - std::string vertFile = dataPath + "/shaders/vs_smooth.glsl"; - std::string fragFile = dataPath + "/shaders/fs_smooth.glsl"; - shader = MiniGL::createShader(vertFile, "", fragFile); + // reset simulation when cloth simulation/bending method has changed + model->setClothSimulationMethodChangedCallback([&]() { reset(); }); + model->setClothBendingMethodChangedCallback([&]() { reset(); }); - if (shader == NULL) - return; + // OpenGL + MiniGL::setClientIdleFunc (timeStep); + MiniGL::addKeyFunc('r', reset); + MiniGL::setClientSceneFunc(render); + MiniGL::setViewport (40.0f, 0.1f, 500.0f, Vector3r (0.0, 10.0, 25.0), Vector3r (0.0, 0.0, 0.0)); - shader->begin(); - shader->addUniform("modelview_matrix"); - shader->addUniform("projection_matrix"); - shader->addUniform("surface_color"); - shader->addUniform("shininess"); - shader->addUniform("specular_factor"); - shader->end(); + MiniGL::mainLoop(); - vertFile = dataPath + "/shaders/vs_smoothTex.glsl"; - fragFile = dataPath + "/shaders/fs_smoothTex.glsl"; - shaderTex = MiniGL::createShader(vertFile, "", fragFile); + base->cleanup(); - if (shaderTex == NULL) - return; + Utilities::Timing::printAverageTimes(); + Utilities::Timing::printTimeSums(); - shaderTex->begin(); - shaderTex->addUniform("modelview_matrix"); - shaderTex->addUniform("projection_matrix"); - shaderTex->addUniform("surface_color"); - shaderTex->addUniform("shininess"); - shaderTex->addUniform("specular_factor"); - shaderTex->end(); -} + delete Simulation::getCurrent(); + delete base; + delete model; -void cleanup() -{ - delete TimeManager::getCurrent(); - delete shader; - delete shaderTex; + return 0; } void reset() { - model.reset(); - sim.reset(); - TimeManager::getCurrent()->setTime(0.0); + Utilities::Timing::printAverageTimes(); + Utilities::Timing::reset(); - model.cleanup(); - buildModel(); -} - -void mouseMove(int x, int y) -{ - Vector3r mousePos; - MiniGL::unproject(x, y, mousePos); - const Vector3r diff = mousePos - oldMousePos; + Simulation::getCurrent()->reset(); + base->getSelectedParticles().clear(); - TimeManager *tm = TimeManager::getCurrent(); - const Real h = tm->getTimeStepSize(); - - ParticleData &pd = model.getParticles(); - for (unsigned int j = 0; j < selectedParticles.size(); j++) - { - pd.getVelocity(selectedParticles[j]) += 5.0*diff/h; - } - oldMousePos = mousePos; -} + Simulation::getCurrent()->getModel()->cleanup(); + cd.cleanup(); -void selection(const Eigen::Vector2i &start, const Eigen::Vector2i &end) -{ - std::vector hits; - selectedParticles.clear(); - ParticleData &pd = model.getParticles(); - Selection::selectRect(start, end, &pd.getPosition(0), &pd.getPosition(pd.size() - 1), selectedParticles); - if (selectedParticles.size() > 0) - MiniGL::setMouseMoveFunc(GLUT_MIDDLE_BUTTON, mouseMove); - else - MiniGL::setMouseMoveFunc(-1, NULL); - - MiniGL::unproject(end[0], end[1], oldMousePos); + buildModel(); } void timeStep () { - if (doPause) + const Real pauseAt = base->getValue(DemoBase::PAUSE_AT); + if ((pauseAt > 0.0) && (pauseAt < TimeManager::getCurrent()->getTime())) + base->setValue(DemoBase::PAUSE, true); + + if (base->getValue(DemoBase::PAUSE)) return; // Simulation code - for (unsigned int i = 0; i < 8; i++) - sim.step(model); + SimulationModel *model = Simulation::getCurrent()->getModel(); + const unsigned int numSteps = base->getValue(DemoBase::NUM_STEPS_PER_RENDER); + for (unsigned int i = 0; i < numSteps; i++) + { + START_TIMING("SimStep"); + Simulation::getCurrent()->getTimeStep()->step(*model); + STOP_TIMING_AVG; - for (unsigned int i = 0; i < model.getTriangleModels().size(); i++) - model.getTriangleModels()[i]->updateMeshNormals(model.getParticles()); + base->step(); + } + + for (unsigned int i = 0; i < model->getTriangleModels().size(); i++) + model->getTriangleModels()[i]->updateMeshNormals(model->getParticles()); } void buildModel () { - TimeManager::getCurrent ()->setTimeStepSize (0.005); + TimeManager::getCurrent ()->setTimeStepSize (static_cast(0.005)); createMesh(); // create static rigid body - string fileName = dataPath + "/models/cube.obj"; + string fileName = FileSystem::normalizePath(base->getExePath() + "/resources/models/cube.obj"); IndexedFaceMesh mesh; VertexData vd; - OBJLoader::loadObj(fileName, vd, mesh); + DemoBase::loadMesh(fileName, vd, mesh, Vector3r::Zero(), Matrix3r::Identity(), Vector3r::Ones()); + mesh.setFlatShading(true); - string fileNameTorus = dataPath + "/models/torus.obj"; + string fileNameTorus = FileSystem::normalizePath(base->getExePath() + "/resources/models/torus.obj"); IndexedFaceMesh meshTorus; VertexData vdTorus; - OBJLoader::loadObj(fileNameTorus, vdTorus, meshTorus); + DemoBase::loadMesh(fileNameTorus, vdTorus, meshTorus, Vector3r::Zero(), Matrix3r::Identity(), Vector3r::Ones()); - SimulationModel::RigidBodyVector &rb = model.getRigidBodies(); + SimulationModel *model = Simulation::getCurrent()->getModel(); + SimulationModel::RigidBodyVector &rb = model->getRigidBodies(); rb.resize(2); // floor rb[0] = new RigidBody(); rb[0]->initBody(1.0, - Vector3r(0.0, -5.5, 0.0), + Vector3r(0.0, -2.5, 0.0), Quaternionr(1.0, 0.0, 0.0, 0.0), vd, mesh, Vector3r(100.0, 1.0, 100.0)); @@ -270,129 +152,38 @@ void buildModel () // torus rb[1] = new RigidBody(); rb[1]->initBody(1.0, - Vector3r(5.0, -1.5, 5.0), + Vector3r(0.0, 1.5, 0.0), Quaternionr(1.0, 0.0, 0.0, 0.0), vdTorus, meshTorus, Vector3r(2.0, 2.0, 2.0)); rb[1]->setMass(0.0); - rb[1]->setFrictionCoeff(0.1); + rb[1]->setFrictionCoeff(static_cast(0.1)); - sim.setCollisionDetection(model, &cd); - cd.setTolerance(0.05); + Simulation::getCurrent()->getTimeStep()->setCollisionDetection(*model, &cd); + cd.setTolerance(static_cast(0.05)); - const std::vector *vertices1 = rb[0]->getGeometry().getVertexDataLocal().getVertices(); - const unsigned int nVert1 = static_cast(vertices1->size()); - cd.addCollisionBox(0, CollisionDetection::CollisionObject::RigidBodyCollisionObjectType, &(*vertices1)[0], nVert1, Vector3r(100.0, 1.0, 100.0)); + const std::vector &vertices1 = rb[0]->getGeometry().getVertexDataLocal().getVertices(); + const unsigned int nVert1 = static_cast(vertices1.size()); + cd.addCollisionBox(0, CollisionDetection::CollisionObject::RigidBodyCollisionObjectType, vertices1.data(), nVert1, Vector3r(100.0, 1.0, 100.0)); - const std::vector *vertices2 = rb[1]->getGeometry().getVertexDataLocal().getVertices(); - const unsigned int nVert2 = static_cast(vertices2->size()); - cd.addCollisionTorus(1, CollisionDetection::CollisionObject::RigidBodyCollisionObjectType, &(*vertices2)[0], nVert2, Vector2r(2.0, 1.0)); + const std::vector &vertices2 = rb[1]->getGeometry().getVertexDataLocal().getVertices(); + const unsigned int nVert2 = static_cast(vertices2.size()); + cd.addCollisionTorus(1, CollisionDetection::CollisionObject::RigidBodyCollisionObjectType, vertices2.data(), nVert2, Vector2r(2.0, 1.0)); - SimulationModel::TriangleModelVector &tm = model.getTriangleModels(); - ParticleData &pd = model.getParticles(); + SimulationModel::TriangleModelVector &tm = model->getTriangleModels(); + ParticleData &pd = model->getParticles(); for (unsigned int i = 0; i < tm.size(); i++) { const unsigned int nVert = tm[i]->getParticleMesh().numVertices(); unsigned int offset = tm[i]->getIndexOffset(); - tm[i]->setFrictionCoeff(0.1); - cd.addCollisionObjectWithoutGeometry(i, CollisionDetection::CollisionObject::TriangleModelCollisionObjectType, &pd.getPosition(offset), nVert); + tm[i]->setFrictionCoeff(static_cast(0.1)); + cd.addCollisionObjectWithoutGeometry(i, CollisionDetection::CollisionObject::TriangleModelCollisionObjectType, &pd.getPosition(offset), nVert, true); } } -void renderModels() -{ - // Draw simulation model - - const ParticleData &pd = model.getParticles(); - float surfaceColor[4] = { 0.2f, 0.5f, 1.0f, 1 }; - - if (shaderTex) - { - shaderTex->begin(); - glUniform3fv(shaderTex->getUniform("surface_color"), 1, surfaceColor); - glUniform1f(shaderTex->getUniform("shininess"), 5.0f); - glUniform1f(shaderTex->getUniform("specular_factor"), 0.2f); - - GLfloat matrix[16]; - glGetFloatv(GL_MODELVIEW_MATRIX, matrix); - glUniformMatrix4fv(shaderTex->getUniform("modelview_matrix"), 1, GL_FALSE, matrix); - GLfloat pmatrix[16]; - glGetFloatv(GL_PROJECTION_MATRIX, pmatrix); - glUniformMatrix4fv(shaderTex->getUniform("projection_matrix"), 1, GL_FALSE, pmatrix); - } - - for (unsigned int i = 0; i < model.getTriangleModels().size(); i++) - { - // mesh - TriangleModel *triModel = model.getTriangleModels()[i]; - const IndexedFaceMesh &mesh = triModel->getParticleMesh(); - Visualization::drawTexturedMesh(pd, mesh, triModel->getIndexOffset(), surfaceColor); - } - - if (shaderTex) - shaderTex->end(); - - if (shader) - { - shader->begin(); - glUniform1f(shader->getUniform("shininess"), 5.0); - glUniform1f(shader->getUniform("specular_factor"), 0.2f); - - GLfloat matrix[16]; - glGetFloatv(GL_MODELVIEW_MATRIX, matrix); - glUniformMatrix4fv(shader->getUniform("modelview_matrix"), 1, GL_FALSE, matrix); - GLfloat pmatrix[16]; - glGetFloatv(GL_PROJECTION_MATRIX, pmatrix); - glUniformMatrix4fv(shader->getUniform("projection_matrix"), 1, GL_FALSE, pmatrix); - } - - SimulationModel::RigidBodyVector &rb = model.getRigidBodies(); - float rbColor[4] = { 0.6f, 0.6f, 0.6f, 1 }; - for (size_t i = 0; i < rb.size(); i++) - { - const VertexData &vd = rb[i]->getGeometry().getVertexData(); - const IndexedFaceMesh &mesh = rb[i]->getGeometry().getMesh(); - if (shader) - glUniform3fv(shader->getUniform("surface_color"), 1, rbColor); - Visualization::drawMesh(vd, mesh, 0, rbColor); - } - - if (shader) - shader->end(); -} - -void renderContact(ParticleRigidBodyContactConstraint &cc) -{ - float col1[4] = { 0.0f, 0.6f, 0.2f, 1 }; - float col2[4] = { 0.6f, 0.0f, 0.2f, 1 }; - MiniGL::drawPoint(cc.m_constraintInfo.col(0), 5.0f, col1); - MiniGL::drawPoint(cc.m_constraintInfo.col(1), 5.0f, col2); - MiniGL::drawVector(cc.m_constraintInfo.col(1), cc.m_constraintInfo.col(1) + cc.m_constraintInfo.col(2), 1.0f, col2); -} - void render () { - MiniGL::coordinateSystem(); - - SimulationModel::ParticleRigidBodyContactConstraintVector &contacts = model.getParticleRigidBodyContactConstraints(); - - renderModels(); - - - float red[4] = { 0.8f, 0.0f, 0.0f, 1 }; - const ParticleData &pd = model.getParticles(); - for (unsigned int j = 0; j < selectedParticles.size(); j++) - { - MiniGL::drawSphere(pd.getPosition(selectedParticles[j]), 0.08f, red); - } - - if (renderContacts) - { - for (unsigned int i = 0; i < contacts.size(); i++) - renderContact(contacts[i]); - } - - MiniGL::drawTime( TimeManager::getCurrent ()->getTime ()); + base->render(); } @@ -400,363 +191,27 @@ void render () */ void createMesh() { - TriangleModel::ParticleMesh::UVs uvs; - uvs.resize(nRows*nCols); - - const Real dy = width / (Real)(nCols-1); - const Real dx = height / (Real)(nRows-1); - - Vector3r points[nRows*nCols]; - for (int i = 0; i < nRows; i++) - { - for (int j = 0; j < nCols; j++) - { - const Real y = (Real)dy*j; - const Real x = (Real)dx*i; - points[i*nCols + j] = Vector3r(x, 1.0, y); - - uvs[i*nCols + j][0] = x/width; - uvs[i*nCols + j][1] = y/height; - } - } - const int nIndices = 6 * (nRows - 1)*(nCols - 1); - - TriangleModel::ParticleMesh::UVIndices uvIndices; - uvIndices.resize(nIndices); - - unsigned int indices[nIndices]; - int index = 0; - for (int i = 0; i < nRows - 1; i++) - { - for (int j = 0; j < nCols - 1; j++) - { - int helper = 0; - if (i % 2 == j % 2) - helper = 1; - - indices[index] = i*nCols + j; - indices[index + 1] = i*nCols + j + 1; - indices[index + 2] = (i + 1)*nCols + j + helper; - - uvIndices[index] = i*nCols + j; - uvIndices[index + 1] = i*nCols + j + 1; - uvIndices[index + 2] = (i + 1)*nCols + j + helper; - index += 3; - - indices[index] = (i + 1)*nCols + j + 1; - indices[index + 1] = (i + 1)*nCols + j; - indices[index + 2] = i*nCols + j + 1 - helper; - - uvIndices[index] = (i + 1)*nCols + j + 1; - uvIndices[index + 1] = (i + 1)*nCols + j; - uvIndices[index + 2] = i*nCols + j + 1 - helper; - index += 3; - } - } - - model.addTriangleModel(nRows*nCols, nIndices / 3, &points[0], &indices[0], uvIndices, uvs); - - ParticleData &pd = model.getParticles(); - for (unsigned int i = 0; i < pd.getNumberOfParticles(); i++) - { - pd.setMass(i, 1.0); - } + SimulationModel* model = Simulation::getCurrent()->getModel(); + model->addRegularTriangleModel(nCols, nRows, + Vector3r(-5, 4, -5), AngleAxisr(M_PI * 0.5, Vector3r(1, 0, 0)).matrix(), Vector2r(width, height)); // init constraints - for (unsigned int cm = 0; cm < model.getTriangleModels().size(); cm++) + for (unsigned int cm = 0; cm < model->getTriangleModels().size(); cm++) { - if (simulationMethod == 1) - { - const unsigned int offset = model.getTriangleModels()[cm]->getIndexOffset(); - const unsigned int nEdges = model.getTriangleModels()[cm]->getParticleMesh().numEdges(); - const IndexedFaceMesh::Edge *edges = model.getTriangleModels()[cm]->getParticleMesh().getEdges().data(); - for (unsigned int i = 0; i < nEdges; i++) - { - const unsigned int v1 = edges[i].m_vert[0] + offset; - const unsigned int v2 = edges[i].m_vert[1] + offset; - - model.addDistanceConstraint(v1, v2); - } - } - else if (simulationMethod == 2) - { - const unsigned int offset = model.getTriangleModels()[cm]->getIndexOffset(); - TriangleModel::ParticleMesh &mesh = model.getTriangleModels()[cm]->getParticleMesh(); - const unsigned int *tris = mesh.getFaces().data(); - const unsigned int nFaces = mesh.numFaces(); - for (unsigned int i = 0; i < nFaces; i++) - { - const unsigned int v1 = tris[3 * i] + offset; - const unsigned int v2 = tris[3 * i + 1] + offset; - const unsigned int v3 = tris[3 * i + 2] + offset; - model.addFEMTriangleConstraint(v1, v2, v3); - } - } - else if (simulationMethod == 3) - { - const unsigned int offset = model.getTriangleModels()[cm]->getIndexOffset(); - TriangleModel::ParticleMesh &mesh = model.getTriangleModels()[cm]->getParticleMesh(); - const unsigned int *tris = mesh.getFaces().data(); - const unsigned int nFaces = mesh.numFaces(); - for (unsigned int i = 0; i < nFaces; i++) - { - const unsigned int v1 = tris[3 * i] + offset; - const unsigned int v2 = tris[3 * i + 1] + offset; - const unsigned int v3 = tris[3 * i + 2] + offset; - model.addStrainTriangleConstraint(v1, v2, v3); - } - } - if (bendingMethod != 0) - { - const unsigned int offset = model.getTriangleModels()[cm]->getIndexOffset(); - TriangleModel::ParticleMesh &mesh = model.getTriangleModels()[cm]->getParticleMesh(); - unsigned int nEdges = mesh.numEdges(); - const TriangleModel::ParticleMesh::Edge *edges = mesh.getEdges().data(); - const unsigned int *tris = mesh.getFaces().data(); - for (unsigned int i = 0; i < nEdges; i++) - { - const int tri1 = edges[i].m_face[0]; - const int tri2 = edges[i].m_face[1]; - if ((tri1 != 0xffffffff) && (tri2 != 0xffffffff)) - { - // Find the triangle points which do not lie on the axis - const int axisPoint1 = edges[i].m_vert[0]; - const int axisPoint2 = edges[i].m_vert[1]; - int point1 = -1; - int point2 = -1; - for (int j = 0; j < 3; j++) - { - if ((tris[3 * tri1 + j] != axisPoint1) && (tris[3 * tri1 + j] != axisPoint2)) - { - point1 = tris[3 * tri1 + j]; - break; - } - } - for (int j = 0; j < 3; j++) - { - if ((tris[3 * tri2 + j] != axisPoint1) && (tris[3 * tri2 + j] != axisPoint2)) - { - point2 = tris[3 * tri2 + j]; - break; - } - } - if ((point1 != -1) && (point2 != -1)) - { - const unsigned int vertex1 = point1 + offset; - const unsigned int vertex2 = point2 + offset; - const unsigned int vertex3 = edges[i].m_vert[0] + offset; - const unsigned int vertex4 = edges[i].m_vert[1] + offset; - if (bendingMethod == 1) - model.addDihedralConstraint(vertex1, vertex2, vertex3, vertex4); - else if (bendingMethod == 2) - model.addIsometricBendingConstraint(vertex1, vertex2, vertex3, vertex4); - } - } - } - } + model->setClothStiffness(1.0); + if (model->getClothSimulationMethod() == 4) + model->setClothStiffness(100000); + model->addClothConstraints(model->getTriangleModels()[cm], model->getClothSimulationMethod(), model->getClothStiffness(), model->getClothStiffnessXX(), + model->getClothStiffnessYY(), model->getClothStiffnessXY(), model->getClothPoissonRatioXY(), model->getClothPoissonRatioYX(), + model->getClothNormalizeStretch(), model->getClothNormalizeShear()); + + model->setClothBendingStiffness(0.01); + if (model->getClothBendingMethod() == 3) + model->setClothBendingStiffness(100.0); + model->addBendingConstraints(model->getTriangleModels()[cm], model->getClothBendingMethod(), model->getClothBendingStiffness()); } - std::cout << "Number of triangles: " << nIndices / 3 << "\n"; - std::cout << "Number of vertices: " << nRows*nCols << "\n"; - -} - -void TW_CALL setTimeStep(const void *value, void *clientData) -{ - const Real val = *(const Real *)(value); - TimeManager::getCurrent()->setTimeStepSize(val); -} - -void TW_CALL getTimeStep(void *value, void *clientData) -{ - *(Real *)(value) = TimeManager::getCurrent()->getTimeStepSize(); -} - -void TW_CALL setStiffness(const void *value, void *clientData) -{ - const Real val = *(const Real *)(value); - ((SimulationModel*) clientData)->setClothStiffness(val); -} - -void TW_CALL getStiffness(void *value, void *clientData) -{ - *(Real *)(value) = ((SimulationModel*)clientData)->getClothStiffness(); -} - -void TW_CALL setXXStiffness(const void *value, void *clientData) -{ - const Real val = *(const Real *)(value); - ((SimulationModel*)clientData)->setClothXXStiffness(val); -} - -void TW_CALL getXXStiffness(void *value, void *clientData) -{ - *(Real *)(value) = ((SimulationModel*)clientData)->getClothXXStiffness(); -} - -void TW_CALL setYYStiffness(const void *value, void *clientData) -{ - const Real val = *(const Real *)(value); - ((SimulationModel*)clientData)->setClothYYStiffness(val); -} - -void TW_CALL getYYStiffness(void *value, void *clientData) -{ - *(Real *)(value) = ((SimulationModel*)clientData)->getClothYYStiffness(); -} - -void TW_CALL setXYStiffness(const void *value, void *clientData) -{ - const Real val = *(const Real *)(value); - ((SimulationModel*)clientData)->setClothXYStiffness(val); -} - -void TW_CALL getXYStiffness(void *value, void *clientData) -{ - *(Real *)(value) = ((SimulationModel*)clientData)->getClothXYStiffness(); -} - -void TW_CALL setYXPoissonRatio(const void *value, void *clientData) -{ - const Real val = *(const Real *)(value); - ((SimulationModel*)clientData)->setClothYXPoissonRatio(val); -} - -void TW_CALL getYXPoissonRatio(void *value, void *clientData) -{ - *(Real *)(value) = ((SimulationModel*)clientData)->getClothYXPoissonRatio(); -} - -void TW_CALL setXYPoissonRatio(const void *value, void *clientData) -{ - const Real val = *(const Real *)(value); - ((SimulationModel*)clientData)->setClothXYPoissonRatio(val); -} - -void TW_CALL getXYPoissonRatio(void *value, void *clientData) -{ - *(Real *)(value) = ((SimulationModel*)clientData)->getClothXYPoissonRatio(); -} - -void TW_CALL setNormalizeStretch(const void *value, void *clientData) -{ - const bool val = *(const bool *)(value); - ((SimulationModel*)clientData)->setClothNormalizeStretch(val); -} - -void TW_CALL getNormalizeStretch(void *value, void *clientData) -{ - *(bool *)(value) = ((SimulationModel*)clientData)->getClothNormalizeStretch(); -} + LOG_INFO << "Number of triangles: " << model->getTriangleModels()[0]->getParticleMesh().numFaces(); + LOG_INFO << "Number of vertices: " << nRows*nCols; -void TW_CALL setNormalizeShear(const void *value, void *clientData) -{ - const bool val = *(const bool *)(value); - ((SimulationModel*)clientData)->setClothNormalizeShear(val); -} - -void TW_CALL getNormalizeShear(void *value, void *clientData) -{ - *(bool *)(value) = ((SimulationModel*)clientData)->getClothNormalizeShear(); -} - -void TW_CALL setBendingStiffness(const void *value, void *clientData) -{ - const Real val = *(const Real *)(value); - ((SimulationModel*)clientData)->setClothBendingStiffness(val); -} - -void TW_CALL getBendingStiffness(void *value, void *clientData) -{ - *(Real *)(value) = ((SimulationModel*)clientData)->getClothBendingStiffness(); -} - -void TW_CALL setBendingMethod(const void *value, void *clientData) -{ - const short val = *(const short *)(value); - *((short*)clientData) = val; - reset(); -} - -void TW_CALL getBendingMethod(void *value, void *clientData) -{ - *(short *)(value) = *((short*)clientData); -} - -void TW_CALL setSimulationMethod(const void *value, void *clientData) -{ - const short val = *(const short *)(value); - *((short*)clientData) = val; - reset(); -} - -void TW_CALL getSimulationMethod(void *value, void *clientData) -{ - *(short *)(value) = *((short*)clientData); -} - -void TW_CALL setVelocityUpdateMethod(const void *value, void *clientData) -{ - const short val = *(const short *)(value); - ((TimeStepController*)clientData)->setVelocityUpdateMethod((unsigned int)val); -} - -void TW_CALL getVelocityUpdateMethod(void *value, void *clientData) -{ - *(short *)(value) = (short)((TimeStepController*)clientData)->getVelocityUpdateMethod(); -} - -void TW_CALL setMaxIterations(const void *value, void *clientData) -{ - const unsigned int val = *(const unsigned int *)(value); - ((TimeStepController*)clientData)->setMaxIterations(val); -} - -void TW_CALL getMaxIterations(void *value, void *clientData) -{ - *(unsigned int *)(value) = ((TimeStepController*)clientData)->getMaxIterations(); -} - -void TW_CALL setMaxIterationsV(const void *value, void *clientData) -{ - const unsigned int val = *(const unsigned int *)(value); - ((TimeStepController*)clientData)->setMaxIterationsV(val); -} - -void TW_CALL getMaxIterationsV(void *value, void *clientData) -{ - *(unsigned int *)(value) = ((TimeStepController*)clientData)->getMaxIterationsV(); -} - -void TW_CALL setContactStiffnessRigidBody(const void *value, void *clientData) -{ - const Real val = *(const Real *)(value); - ((SimulationModel*)clientData)->setContactStiffnessRigidBody(val); -} - -void TW_CALL getContactStiffnessRigidBody(void *value, void *clientData) -{ - *(Real *)(value) = ((SimulationModel*)clientData)->getContactStiffnessRigidBody(); -} - -void TW_CALL setContactStiffnessParticleRigidBody(const void *value, void *clientData) -{ - const Real val = *(const Real *)(value); - ((SimulationModel*)clientData)->setContactStiffnessParticleRigidBody(val); -} - -void TW_CALL getContactStiffnessParticleRigidBody(void *value, void *clientData) -{ - *(Real *)(value) = ((SimulationModel*)clientData)->getContactStiffnessParticleRigidBody(); -} - -void TW_CALL setContactTolerance(const void *value, void *clientData) -{ - const Real val = *(const Real *)(value); - ((DistanceFieldCollisionDetection*)clientData)->setTolerance(val); -} - -void TW_CALL getContactTolerance(void *value, void *clientData) -{ - *(Real *)(value) = ((DistanceFieldCollisionDetection*)clientData)->getTolerance(); } diff --git a/Demos/DistanceFieldDemos/DeformableCollisionDemo.cpp b/Demos/DistanceFieldDemos/DeformableCollisionDemo.cpp index f23e53eb..9a28934a 100644 --- a/Demos/DistanceFieldDemos/DeformableCollisionDemo.cpp +++ b/Demos/DistanceFieldDemos/DeformableCollisionDemo.cpp @@ -1,221 +1,140 @@ -#include "Demos/Common/Config.h" +#include "Common/Common.h" #include "Demos/Visualization/MiniGL.h" #include "Demos/Visualization/Selection.h" -#include "GL/glut.h" -#include "Demos/Simulation/TimeManager.h" +#include "Simulation/TimeManager.h" #include -#include "Demos/Simulation/SimulationModel.h" -#include "Demos/Simulation/TimeStepController.h" +#include "Simulation/SimulationModel.h" +#include "Simulation/TimeStepController.h" #include #include "Demos/Visualization/Visualization.h" -#include "Demos/Utils/Utilities.h" -#include "Demos/Simulation/DistanceFieldCollisionDetection.h" -#include "Demos/Utils/OBJLoader.h" +#include "Simulation/DistanceFieldCollisionDetection.h" +#include "Utils/Logger.h" +#include "Utils/Timing.h" +#include "Utils/FileSystem.h" +#include "Demos/Common/DemoBase.h" +#include "Simulation/Simulation.h" // Enable memory leak detection -#ifdef _DEBUG +#if defined(_DEBUG) && !defined(EIGEN_ALIGN) #define new DEBUG_NEW #endif using namespace PBD; using namespace Eigen; using namespace std; +using namespace Utilities; void timeStep (); void buildModel (); void createMesh(); void render (); -void cleanup(); void reset(); -void initShader(); -void selection(const Eigen::Vector2i &start, const Eigen::Vector2i &end); -void TW_CALL setTimeStep(const void *value, void *clientData); -void TW_CALL getTimeStep(void *value, void *clientData); -void TW_CALL setStiffness(const void *value, void *clientData); -void TW_CALL getStiffness(void *value, void *clientData); -void TW_CALL setPoissonRatio(const void *value, void *clientData); -void TW_CALL getPoissonRatio(void *value, void *clientData); -void TW_CALL setNormalizeStretch(const void *value, void *clientData); -void TW_CALL getNormalizeStretch(void *value, void *clientData); -void TW_CALL setNormalizeShear(const void *value, void *clientData); -void TW_CALL getNormalizeShear(void *value, void *clientData); -void TW_CALL setSimulationMethod(const void *value, void *clientData); -void TW_CALL getSimulationMethod(void *value, void *clientData); -void TW_CALL setVelocityUpdateMethod(const void *value, void *clientData); -void TW_CALL getVelocityUpdateMethod(void *value, void *clientData); -void TW_CALL setMaxIterations(const void *value, void *clientData); -void TW_CALL getMaxIterations(void *value, void *clientData); -void TW_CALL setMaxIterationsV(const void *value, void *clientData); -void TW_CALL getMaxIterationsV(void *value, void *clientData); -void TW_CALL setContactTolerance(const void *value, void *clientData); -void TW_CALL getContactTolerance(void *value, void *clientData); -void TW_CALL setContactStiffnessRigidBody(const void *value, void *clientData); -void TW_CALL getContactStiffnessRigidBody(void *value, void *clientData); -void TW_CALL setContactStiffnessParticleRigidBody(const void *value, void *clientData); -void TW_CALL getContactStiffnessParticleRigidBody(void *value, void *clientData); - - - -SimulationModel model; -DistanceFieldCollisionDetection cd; -TimeStepController sim; + +DemoBase *base; +DistanceFieldCollisionDetection *cd; const unsigned int width = 30; const unsigned int depth = 5; const unsigned int height = 5; -short simulationMethod = 2; -bool doPause = true; -bool renderContacts = false; -std::vector selectedParticles; -Vector3r oldMousePos; -Shader *shader; -string exePath; -string dataPath; // main int main( int argc, char **argv ) { REPORT_MEMORY_LEAKS - exePath = Utilities::getFilePath(argv[0]); - dataPath = exePath + "/" + std::string(PBD_DATA_PATH); + base = new DemoBase(); + base->init(argc, argv, "Bar collision demo"); - // OpenGL - MiniGL::init (argc, argv, 1024, 768, 0, 0, "Bar collision demo"); - MiniGL::initLights (); - MiniGL::initTexture(); - MiniGL::setClientIdleFunc (50, timeStep); - MiniGL::setKeyFunc(0, 'r', reset); - MiniGL::setSelectionFunc(selection); - initShader(); + SimulationModel *model = new SimulationModel(); + model->init(); + Simulation::getCurrent()->setModel(model); - buildModel (); + cd = new DistanceFieldCollisionDetection(); + cd->init(); - MiniGL::setClientSceneFunc(render); - MiniGL::setViewport (40.0f, 0.1f, 500.0f, Vector3r (5.0, 10.0, 30.0), Vector3r (5.0, 0.0, 0.0)); + buildModel(); - TwAddVarRW(MiniGL::getTweakBar(), "Pause", TW_TYPE_BOOLCPP, &doPause, " label='Pause' group=Simulation key=SPACE "); - TwAddVarRW(MiniGL::getTweakBar(), "RenderContacts", TW_TYPE_BOOLCPP, &renderContacts, " label='Render contacts' group=Simulation "); - TwAddVarCB(MiniGL::getTweakBar(), "TimeStepSize", TW_TYPE_REAL, setTimeStep, getTimeStep, &model, " label='Time step size' min=0.0 max = 0.1 step=0.001 precision=4 group=Simulation "); - TwType enumType = TwDefineEnum("VelocityUpdateMethodType", NULL, 0); - TwAddVarCB(MiniGL::getTweakBar(), "VelocityUpdateMethod", enumType, setVelocityUpdateMethod, getVelocityUpdateMethod, &sim, " label='Velocity update method' enum='0 {First Order Update}, 1 {Second Order Update}' group=Simulation"); - TwType enumType2 = TwDefineEnum("SimulationMethodType", NULL, 0); - TwAddVarCB(MiniGL::getTweakBar(), "SimulationMethod", enumType2, setSimulationMethod, getSimulationMethod, &simulationMethod, - " label='Simulation method' enum='0 {None}, 1 {Volume constraints}, 2 {FEM based PBD}, 3 {Strain based dynamics (no inversion handling)}, 4 {Shape matching (no inversion handling)}' group=Simulation"); - TwAddVarCB(MiniGL::getTweakBar(), "Stiffness", TW_TYPE_REAL, setStiffness, getStiffness, &model, " label='Stiffness' min=0.0 step=0.1 precision=4 group='Simulation' "); - TwAddVarCB(MiniGL::getTweakBar(), "PoissonRatio", TW_TYPE_REAL, setPoissonRatio, getPoissonRatio, &model, " label='Poisson ratio XY' min=0.0 step=0.1 precision=4 group='Simulation' "); - TwAddVarCB(MiniGL::getTweakBar(), "NormalizeStretch", TW_TYPE_BOOL32, setNormalizeStretch, getNormalizeStretch, &model, " label='Normalize stretch' group='Strain based dynamics' "); - TwAddVarCB(MiniGL::getTweakBar(), "NormalizeShear", TW_TYPE_BOOL32, setNormalizeShear, getNormalizeShear, &model, " label='Normalize shear' group='Strain based dynamics' "); - TwAddVarCB(MiniGL::getTweakBar(), "MaxIter", TW_TYPE_UINT32, setMaxIterations, getMaxIterations, &sim, " label='Max. iterations' min=1 step=1 group=Simulation "); - TwAddVarCB(MiniGL::getTweakBar(), "MaxIterV", TW_TYPE_UINT32, setMaxIterationsV, getMaxIterationsV, &sim, " label='Max. iterations Vel.' min=1 step=1 group=Simulation "); - TwAddVarCB(MiniGL::getTweakBar(), "ContactTolerance", TW_TYPE_REAL, setContactTolerance, getContactTolerance, &cd, " label='Contact tolerance' min=0.0 step=0.001 precision=3 group=Simulation "); - TwAddVarCB(MiniGL::getTweakBar(), "ContactStiffnessRigidBody", TW_TYPE_REAL, setContactStiffnessRigidBody, getContactStiffnessRigidBody, &model, " label='Contact stiffness RB' min=0.0 step=0.1 precision=2 group=Simulation "); - TwAddVarCB(MiniGL::getTweakBar(), "ContactStiffnessParticleRigidBody", TW_TYPE_REAL, setContactStiffnessParticleRigidBody, getContactStiffnessParticleRigidBody, &model, " label='Contact stiffness Particle-RB' min=0.0 step=0.1 precision=2 group=Simulation "); - - - glutMainLoop (); - - cleanup (); + base->createParameterGUI(); - return 0; -} + // OpenGL + MiniGL::setClientIdleFunc (timeStep); + MiniGL::addKeyFunc('r', reset); + MiniGL::setClientSceneFunc(render); + MiniGL::setViewport (40.0f, 0.1f, 500.0f, Vector3r (5.0, 10.0, 30.0), Vector3r (5.0, 0.0, 0.0)); + MiniGL::mainLoop (); -void initShader() -{ - std::string vertFile = dataPath + "/shaders/vs_smooth.glsl"; - std::string fragFile = dataPath + "/shaders/fs_smooth.glsl"; - shader = MiniGL::createShader(vertFile, "", fragFile); + base->cleanup(); - if (shader == NULL) - return; + Utilities::Timing::printAverageTimes(); + Utilities::Timing::printTimeSums(); - shader->begin(); - shader->addUniform("modelview_matrix"); - shader->addUniform("projection_matrix"); - shader->addUniform("surface_color"); - shader->addUniform("shininess"); - shader->addUniform("specular_factor"); - shader->end(); -} + delete Simulation::getCurrent(); + delete base; + delete model; + delete cd; -void cleanup() -{ - delete TimeManager::getCurrent(); - delete shader; + return 0; } void reset() { - model.reset(); - sim.reset(); - TimeManager::getCurrent()->setTime(0.0); + Utilities::Timing::printAverageTimes(); + Utilities::Timing::reset(); - model.cleanup(); - buildModel(); -} + Simulation::getCurrent()->reset(); + base->getSelectedParticles().clear(); -void mouseMove(int x, int y) -{ - Vector3r mousePos; - MiniGL::unproject(x, y, mousePos); - const Vector3r diff = mousePos - oldMousePos; - - TimeManager *tm = TimeManager::getCurrent(); - const Real h = tm->getTimeStepSize(); - - ParticleData &pd = model.getParticles(); - for (unsigned int j = 0; j < selectedParticles.size(); j++) - { - pd.getVelocity(selectedParticles[j]) += 5.0*diff/h; - } - oldMousePos = mousePos; -} + Simulation::getCurrent()->getModel()->cleanup(); + Simulation::getCurrent()->getTimeStep()->getCollisionDetection()->cleanup(); -void selection(const Eigen::Vector2i &start, const Eigen::Vector2i &end) -{ - std::vector hits; - selectedParticles.clear(); - ParticleData &pd = model.getParticles(); - Selection::selectRect(start, end, &pd.getPosition(0), &pd.getPosition(pd.size() - 1), selectedParticles); - if (selectedParticles.size() > 0) - MiniGL::setMouseMoveFunc(GLUT_MIDDLE_BUTTON, mouseMove); - else - MiniGL::setMouseMoveFunc(-1, NULL); - - MiniGL::unproject(end[0], end[1], oldMousePos); + buildModel(); } void timeStep () { - if (doPause) + const Real pauseAt = base->getValue(DemoBase::PAUSE_AT); + if ((pauseAt > 0.0) && (pauseAt < TimeManager::getCurrent()->getTime())) + base->setValue(DemoBase::PAUSE, true); + + if (base->getValue(DemoBase::PAUSE)) return; // Simulation code - for (unsigned int i = 0; i < 8; i++) - sim.step(model); + SimulationModel *model = Simulation::getCurrent()->getModel(); + const unsigned int numSteps = base->getValue(DemoBase::NUM_STEPS_PER_RENDER); + for (unsigned int i = 0; i < numSteps; i++) + { + START_TIMING("SimStep"); + Simulation::getCurrent()->getTimeStep()->step(*model); + STOP_TIMING_AVG; + + base->step(); + } - for (unsigned int i = 0; i < model.getTetModels().size(); i++) - model.getTetModels()[i]->updateMeshNormals(model.getParticles()); + for (unsigned int i = 0; i < model->getTetModels().size(); i++) + model->getTetModels()[i]->updateMeshNormals(model->getParticles()); } void buildModel () { - TimeManager::getCurrent ()->setTimeStepSize (0.005); + TimeManager::getCurrent ()->setTimeStepSize (static_cast(0.005)); + SimulationModel *model = Simulation::getCurrent()->getModel(); createMesh(); // create static rigid body - string fileName = dataPath + "/models/cube.obj"; + string fileName = FileSystem::normalizePath(base->getExePath() + "/resources/models/cube.obj"); IndexedFaceMesh mesh; VertexData vd; - OBJLoader::loadObj(fileName, vd, mesh); + DemoBase::loadMesh(fileName, vd, mesh, Vector3r::Zero(), Matrix3r::Identity(), Vector3r::Ones()); + mesh.setFlatShading(true); - string fileNameTorus = dataPath + "/models/torus.obj"; + string fileNameTorus = FileSystem::normalizePath(base->getExePath() + "/resources/models/torus.obj"); IndexedFaceMesh meshTorus; VertexData vdTorus; - OBJLoader::loadObj(fileNameTorus, vdTorus, meshTorus); + DemoBase::loadMesh(fileNameTorus, vdTorus, meshTorus, Vector3r::Zero(), Matrix3r::Identity(), Vector3r::Ones()); - SimulationModel::RigidBodyVector &rb = model.getRigidBodies(); + SimulationModel::RigidBodyVector &rb = model->getRigidBodies(); rb.resize(2); // floor @@ -235,380 +154,64 @@ void buildModel () vdTorus, meshTorus, Vector3r(3.0, 3.0, 3.0)); rb[1]->setMass(0.0); - rb[1]->setFrictionCoeff(0.1); + rb[1]->setFrictionCoeff(static_cast(0.1)); - sim.setCollisionDetection(model, &cd); - cd.setTolerance(0.05); + Simulation::getCurrent()->getTimeStep()->setCollisionDetection(*model, cd); + cd->setTolerance(static_cast(0.05)); - const std::vector *vertices1 = rb[0]->getGeometry().getVertexDataLocal().getVertices(); - const unsigned int nVert1 = static_cast(vertices1->size()); - cd.addCollisionBox(0, CollisionDetection::CollisionObject::RigidBodyCollisionObjectType, &(*vertices1)[0], nVert1, Vector3r(100.0, 1.0, 100.0)); + const std::vector &vertices1 = rb[0]->getGeometry().getVertexDataLocal().getVertices(); + const unsigned int nVert1 = static_cast(vertices1.size()); + cd->addCollisionBox(0, CollisionDetection::CollisionObject::RigidBodyCollisionObjectType, vertices1.data(), nVert1, Vector3r(100.0, 1.0, 100.0)); - const std::vector *vertices2 = rb[1]->getGeometry().getVertexDataLocal().getVertices(); - const unsigned int nVert2 = static_cast(vertices2->size()); - cd.addCollisionTorus(1, CollisionDetection::CollisionObject::RigidBodyCollisionObjectType, &(*vertices2)[0], nVert2, Vector2r(3.0, 1.5)); + const std::vector &vertices2 = rb[1]->getGeometry().getVertexDataLocal().getVertices(); + const unsigned int nVert2 = static_cast(vertices2.size()); + cd->addCollisionTorus(1, CollisionDetection::CollisionObject::RigidBodyCollisionObjectType, vertices2.data(), nVert2, Vector2r(3.0, 1.5)); - SimulationModel::TetModelVector &tm = model.getTetModels(); - ParticleData &pd = model.getParticles(); + SimulationModel::TetModelVector &tm = model->getTetModels(); + ParticleData &pd = model->getParticles(); for (unsigned int i = 0; i < tm.size(); i++) { const unsigned int nVert = tm[i]->getParticleMesh().numVertices(); unsigned int offset = tm[i]->getIndexOffset(); - tm[i]->setFrictionCoeff(0.1); - cd.addCollisionObjectWithoutGeometry(i, CollisionDetection::CollisionObject::TetModelCollisionObjectType, &pd.getPosition(offset), nVert); - } -} - -void renderModels() -{ - // Draw simulation model - - const ParticleData &pd = model.getParticles(); - float surfaceColor[4] = { 0.2f, 0.5f, 1.0f, 1 }; - - if (shader) - { - shader->begin(); - glUniform3fv(shader->getUniform("surface_color"), 1, surfaceColor); - glUniform1f(shader->getUniform("shininess"), 5.0f); - glUniform1f(shader->getUniform("specular_factor"), 0.2f); - - GLfloat matrix[16]; - glGetFloatv(GL_MODELVIEW_MATRIX, matrix); - glUniformMatrix4fv(shader->getUniform("modelview_matrix"), 1, GL_FALSE, matrix); - GLfloat pmatrix[16]; - glGetFloatv(GL_PROJECTION_MATRIX, pmatrix); - glUniformMatrix4fv(shader->getUniform("projection_matrix"), 1, GL_FALSE, pmatrix); - } - - for (unsigned int i = 0; i < model.getTetModels().size(); i++) - { - TetModel *tetModel = model.getTetModels()[i]; - const IndexedFaceMesh &surfaceMesh = tetModel->getSurfaceMesh(); - Visualization::drawMesh(pd, surfaceMesh, tetModel->getIndexOffset(), surfaceColor); - } - - SimulationModel::RigidBodyVector &rb = model.getRigidBodies(); - float rbColor[4] = { 0.4f, 0.4f, 0.4f, 1 }; - for (size_t i = 0; i < rb.size(); i++) - { - const VertexData &vd = rb[i]->getGeometry().getVertexData(); - const IndexedFaceMesh &mesh = rb[i]->getGeometry().getMesh(); - if (shader) - glUniform3fv(shader->getUniform("surface_color"), 1, rbColor); - Visualization::drawTexturedMesh(vd, mesh, 0, rbColor); + tm[i]->setFrictionCoeff(static_cast(0.1)); + cd->addCollisionObjectWithoutGeometry(i, CollisionDetection::CollisionObject::TetModelCollisionObjectType, &pd.getPosition(offset), nVert, true); } - - if (shader) - shader->end(); } -void renderContact(ParticleRigidBodyContactConstraint &cc) -{ - float col1[4] = { 0.0f, 0.6f, 0.2f, 1 }; - float col2[4] = { 0.6f, 0.0f, 0.2f, 1 }; - MiniGL::drawPoint(cc.m_constraintInfo.col(0), 5.0f, col1); - MiniGL::drawPoint(cc.m_constraintInfo.col(1), 5.0f, col2); - MiniGL::drawVector(cc.m_constraintInfo.col(1), cc.m_constraintInfo.col(1) + cc.m_constraintInfo.col(2), 1.0f, col2); -} void render () { - MiniGL::coordinateSystem(); - - SimulationModel::ParticleRigidBodyContactConstraintVector &contacts = model.getParticleRigidBodyContactConstraints(); - - // Draw simulation model - renderModels(); - - float red[4] = { 0.8f, 0.0f, 0.0f, 1 }; - const ParticleData &pd = model.getParticles(); - for (unsigned int j = 0; j < selectedParticles.size(); j++) - { - MiniGL::drawSphere(pd.getPosition(selectedParticles[j]), 0.08f, red); - } - - if (renderContacts) - { - for (unsigned int i = 0; i < contacts.size(); i++) - renderContact(contacts[i]); - } - - MiniGL::drawTime( TimeManager::getCurrent ()->getTime ()); + base->render(); } void createMesh() { - Vector3r points[width*height*depth]; - for (unsigned int i = 0; i < width; i++) - { - for (unsigned int j = 0; j < height; j++) - { - for (unsigned int k = 0; k < depth; k++) - { - points[i*height*depth + j*depth + k] = 0.3*Vector3r((Real)i, (Real)j + 3.0, (Real)k); - } - } - } - - vector indices; - for (unsigned int i = 0; i < width - 1; i++) - { - for (unsigned int j = 0; j < height - 1; j++) - { - for (unsigned int k = 0; k < depth - 1; k++) - { - // For each block, the 8 corners are numerated as: - // 4*-----*7 - // /| /| - // / | / | - // 5*-----*6 | - // | 0*--|--*3 - // | / | / - // |/ |/ - // 1*-----*2 - unsigned int p0 = i*height*depth + j*depth + k; - unsigned int p1 = p0 + 1; - unsigned int p3 = (i + 1)*height*depth + j*depth + k; - unsigned int p2 = p3 + 1; - unsigned int p7 = (i + 1)*height*depth + (j + 1)*depth + k; - unsigned int p6 = p7 + 1; - unsigned int p4 = i*height*depth + (j + 1)*depth + k; - unsigned int p5 = p4 + 1; - - // Ensure that neighboring tetras are sharing faces - if ((i + j + k) % 2 == 1) - { - indices.push_back(p2); indices.push_back(p1); indices.push_back(p6); indices.push_back(p3); - indices.push_back(p6); indices.push_back(p3); indices.push_back(p4); indices.push_back(p7); - indices.push_back(p4); indices.push_back(p1); indices.push_back(p6); indices.push_back(p5); - indices.push_back(p3); indices.push_back(p1); indices.push_back(p4); indices.push_back(p0); - indices.push_back(p6); indices.push_back(p1); indices.push_back(p4); indices.push_back(p3); - } - else - { - indices.push_back(p0); indices.push_back(p2); indices.push_back(p5); indices.push_back(p1); - indices.push_back(p7); indices.push_back(p2); indices.push_back(p0); indices.push_back(p3); - indices.push_back(p5); indices.push_back(p2); indices.push_back(p7); indices.push_back(p6); - indices.push_back(p7); indices.push_back(p0); indices.push_back(p5); indices.push_back(p4); - indices.push_back(p0); indices.push_back(p2); indices.push_back(p7); indices.push_back(p5); - } - } - } - } - model.addTetModel(width*height*depth, (unsigned int)indices.size() / 4u, points, indices.data()); - - ParticleData &pd = model.getParticles(); - for (unsigned int i = 0; i < pd.getNumberOfParticles(); i++) - { - pd.setMass(i, 1.0); - } + SimulationModel* model = Simulation::getCurrent()->getModel(); + model->addRegularTetModel(width, height, depth, + Vector3r(4.5, 3, 0), Matrix3r::Identity(), Vector3r(9.0, 1.5, 1.5)); // init constraints - for (unsigned int cm = 0; cm < model.getTetModels().size(); cm++) + model->setSolidStiffness(1.0); + if (model->getSolidSimulationMethod() == 3) + model->setSolidStiffness(1000000); + if (model->getSolidSimulationMethod() == 6) + model->setSolidStiffness(100000); + + model->setSolidVolumeStiffness(1.0); + if (model->getSolidSimulationMethod() == 6) + model->setSolidVolumeStiffness(100000); + + ParticleData& pd = model->getParticles(); + for (unsigned int cm = 0; cm < model->getTetModels().size(); cm++) { - const unsigned int nTets = model.getTetModels()[cm]->getParticleMesh().numTets(); - const unsigned int *tets = model.getTetModels()[cm]->getParticleMesh().getTets().data(); - const IndexedTetMesh::VertexTets *vTets = model.getTetModels()[cm]->getParticleMesh().getVertexTets().data(); - if (simulationMethod == 1) - { - const unsigned int offset = model.getTetModels()[cm]->getIndexOffset(); - const unsigned int nEdges = model.getTetModels()[cm]->getParticleMesh().numEdges(); - const IndexedTetMesh::Edge *edges = model.getTetModels()[cm]->getParticleMesh().getEdges().data(); - for (unsigned int i = 0; i < nEdges; i++) - { - const unsigned int v1 = edges[i].m_vert[0] + offset; - const unsigned int v2 = edges[i].m_vert[1] + offset; - - model.addDistanceConstraint(v1, v2); - } - - for (unsigned int i = 0; i < nTets; i++) - { - const unsigned int v1 = tets[4 * i]; - const unsigned int v2 = tets[4 * i + 1]; - const unsigned int v3 = tets[4 * i + 2]; - const unsigned int v4 = tets[4 * i + 3]; - - model.addVolumeConstraint(v1, v2, v3, v4); - } - } - else if (simulationMethod == 2) - { - TetModel::ParticleMesh &mesh = model.getTetModels()[cm]->getParticleMesh(); - for (unsigned int i = 0; i < nTets; i++) - { - const unsigned int v1 = tets[4 * i]; - const unsigned int v2 = tets[4 * i + 1]; - const unsigned int v3 = tets[4 * i + 2]; - const unsigned int v4 = tets[4 * i + 3]; - - model.addFEMTetConstraint(v1, v2, v3, v4); - } - } - else if (simulationMethod == 3) - { - TetModel::ParticleMesh &mesh = model.getTetModels()[cm]->getParticleMesh(); - for (unsigned int i = 0; i < nTets; i++) - { - const unsigned int v1 = tets[4 * i]; - const unsigned int v2 = tets[4 * i + 1]; - const unsigned int v3 = tets[4 * i + 2]; - const unsigned int v4 = tets[4 * i + 3]; - - model.addStrainTetConstraint(v1, v2, v3, v4); - } - } - else if (simulationMethod == 4) - { - TetModel::ParticleMesh &mesh = model.getTetModels()[cm]->getParticleMesh(); - for (unsigned int i = 0; i < nTets; i++) - { - const unsigned int v[4] = { tets[4 * i], tets[4 * i + 1], tets[4 * i + 2], tets[4 * i + 3] }; - // Important: Divide position correction by the number of clusters - // which contain the vertex. - const unsigned int nc[4] = { vTets[v[0]].m_numTets, vTets[v[1]].m_numTets, vTets[v[2]].m_numTets, vTets[v[3]].m_numTets }; - model.addShapeMatchingConstraint(4, v, nc); - } - } - model.getTetModels()[cm]->updateMeshNormals(pd); - } - - std::cout << "Number of tets: " << indices.size() / 4 << "\n"; - std::cout << "Number of vertices: " << width*height*depth << "\n"; - -} + model->addSolidConstraints(model->getTetModels()[cm], model->getSolidSimulationMethod(), model->getSolidStiffness(), + model->getSolidPoissonRatio(), model->getSolidVolumeStiffness(), model->getSolidNormalizeStretch(), model->getSolidNormalizeShear()); -void TW_CALL setTimeStep(const void *value, void *clientData) -{ - const Real val = *(const Real *)(value); - TimeManager::getCurrent()->setTimeStepSize(val); -} + model->getTetModels()[cm]->updateMeshNormals(pd); -void TW_CALL getTimeStep(void *value, void *clientData) -{ - *(Real *)(value) = TimeManager::getCurrent()->getTimeStepSize(); -} - -void TW_CALL setStiffness(const void *value, void *clientData) -{ - const Real val = *(const Real *)(value); - ((SimulationModel*) clientData)->setSolidStiffness(val); -} - -void TW_CALL getStiffness(void *value, void *clientData) -{ - *(Real *)(value) = ((SimulationModel*)clientData)->getSolidStiffness(); -} - -void TW_CALL setPoissonRatio(const void *value, void *clientData) -{ - const Real val = *(const Real *)(value); - ((SimulationModel*)clientData)->setSolidPoissonRatio(val); -} - -void TW_CALL getPoissonRatio(void *value, void *clientData) -{ - *(Real *)(value) = ((SimulationModel*)clientData)->getSolidPoissonRatio(); -} - -void TW_CALL setNormalizeStretch(const void *value, void *clientData) -{ - const bool val = *(const bool *)(value); - ((SimulationModel*)clientData)->setSolidNormalizeStretch(val); -} - -void TW_CALL getNormalizeStretch(void *value, void *clientData) -{ - *(bool *)(value) = ((SimulationModel*)clientData)->getSolidNormalizeStretch(); -} - -void TW_CALL setNormalizeShear(const void *value, void *clientData) -{ - const bool val = *(const bool *)(value); - ((SimulationModel*)clientData)->setSolidNormalizeShear(val); -} - -void TW_CALL getNormalizeShear(void *value, void *clientData) -{ - *(bool *)(value) = ((SimulationModel*)clientData)->getSolidNormalizeShear(); -} - -void TW_CALL setSimulationMethod(const void *value, void *clientData) -{ - const short val = *(const short *)(value); - *((short*)clientData) = val; - reset(); -} - -void TW_CALL getSimulationMethod(void *value, void *clientData) -{ - *(short *)(value) = *((short*)clientData); -} - -void TW_CALL setVelocityUpdateMethod(const void *value, void *clientData) -{ - const short val = *(const short *)(value); - ((TimeStepController*)clientData)->setVelocityUpdateMethod((unsigned int)val); -} - -void TW_CALL getVelocityUpdateMethod(void *value, void *clientData) -{ - *(short *)(value) = (short)((TimeStepController*)clientData)->getVelocityUpdateMethod(); -} - -void TW_CALL setMaxIterations(const void *value, void *clientData) -{ - const unsigned int val = *(const unsigned int *)(value); - ((TimeStepController*)clientData)->setMaxIterations(val); -} - -void TW_CALL getMaxIterations(void *value, void *clientData) -{ - *(unsigned int *)(value) = ((TimeStepController*)clientData)->getMaxIterations(); -} - -void TW_CALL setMaxIterationsV(const void *value, void *clientData) -{ - const unsigned int val = *(const unsigned int *)(value); - ((TimeStepController*)clientData)->setMaxIterationsV(val); -} - -void TW_CALL getMaxIterationsV(void *value, void *clientData) -{ - *(unsigned int *)(value) = ((TimeStepController*)clientData)->getMaxIterationsV(); -} - -void TW_CALL setContactStiffnessRigidBody(const void *value, void *clientData) -{ - const Real val = *(const Real *)(value); - ((SimulationModel*)clientData)->setContactStiffnessRigidBody(val); -} - -void TW_CALL getContactStiffnessRigidBody(void *value, void *clientData) -{ - *(Real *)(value) = ((SimulationModel*)clientData)->getContactStiffnessRigidBody(); -} - -void TW_CALL setContactStiffnessParticleRigidBody(const void *value, void *clientData) -{ - const Real val = *(const Real *)(value); - ((SimulationModel*)clientData)->setContactStiffnessParticleRigidBody(val); -} - -void TW_CALL getContactStiffnessParticleRigidBody(void *value, void *clientData) -{ - *(Real *)(value) = ((SimulationModel*)clientData)->getContactStiffnessParticleRigidBody(); -} - -void TW_CALL setContactTolerance(const void *value, void *clientData) -{ - const Real val = *(const Real *)(value); - ((DistanceFieldCollisionDetection*)clientData)->setTolerance(val); + LOG_INFO << "Number of tets: " << model->getTetModels()[cm]->getParticleMesh().numTets(); + LOG_INFO << "Number of vertices: " << width * height * depth; + } } -void TW_CALL getContactTolerance(void *value, void *clientData) -{ - *(Real *)(value) = ((DistanceFieldCollisionDetection*)clientData)->getTolerance(); -} diff --git a/Demos/DistanceFieldDemos/RigidBodyCollisionDemo.cpp b/Demos/DistanceFieldDemos/RigidBodyCollisionDemo.cpp index 2b2246d1..a071746b 100644 --- a/Demos/DistanceFieldDemos/RigidBodyCollisionDemo.cpp +++ b/Demos/DistanceFieldDemos/RigidBodyCollisionDemo.cpp @@ -1,381 +1,162 @@ -#include "Demos/Common/Config.h" +#include "Common/Common.h" #include "Demos/Visualization/MiniGL.h" #include "Demos/Visualization/Selection.h" -#include "GL/glut.h" -#include "Demos/Simulation/TimeManager.h" +#include "Simulation/TimeManager.h" #include -#include "Demos/Simulation/SimulationModel.h" -#include "Demos/Simulation/TimeStepController.h" +#include "Simulation/SimulationModel.h" +#include "Simulation/TimeStepController.h" #include -#include "Demos/Utils/OBJLoader.h" #include "Demos/Visualization/Visualization.h" -#include "Demos/Utils/Utilities.h" -#include "Demos/Simulation/DistanceFieldCollisionDetection.h" +#include "Simulation/DistanceFieldCollisionDetection.h" +#include "Utils/Logger.h" +#include "Utils/Timing.h" +#include "Utils/FileSystem.h" +#include "Demos/Common/DemoBase.h" +#include "Simulation/Simulation.h" #define _USE_MATH_DEFINES #include "math.h" // Enable memory leak detection -#ifdef _DEBUG +#if defined(_DEBUG) && !defined(EIGEN_ALIGN) #define new DEBUG_NEW #endif using namespace PBD; using namespace Eigen; using namespace std; +using namespace Utilities; void timeStep (); void buildModel (); void createBodyModel(); void render (); void reset(); -void cleanup(); -void initShader(); -void selection(const Eigen::Vector2i &start, const Eigen::Vector2i &end); -void TW_CALL setTimeStep(const void *value, void *clientData); -void TW_CALL getTimeStep(void *value, void *clientData); -void TW_CALL setVelocityUpdateMethod(const void *value, void *clientData); -void TW_CALL getVelocityUpdateMethod(void *value, void *clientData); -void TW_CALL setMaxIterations(const void *value, void *clientData); -void TW_CALL getMaxIterations(void *value, void *clientData); -void TW_CALL setContactTolerance(const void *value, void *clientData); -void TW_CALL getContactTolerance(void *value, void *clientData); -void TW_CALL setContactStiffnessRigidBody(const void *value, void *clientData); -void TW_CALL getContactStiffnessRigidBody(void *value, void *clientData); -void TW_CALL setContactStiffnessParticleRigidBody(const void *value, void *clientData); -void TW_CALL getContactStiffnessParticleRigidBody(void *value, void *clientData); - - -SimulationModel model; -DistanceFieldCollisionDetection cd; -TimeStepController sim; - -bool doPause = true; -std::vector selectedBodies; -Vector3r oldMousePos; -Shader *shader; -Shader *shaderTex; -bool renderContacts = false; -string exePath; -string dataPath; + +DemoBase *base; +DistanceFieldCollisionDetection *cd; + // main int main( int argc, char **argv ) { REPORT_MEMORY_LEAKS - exePath = Utilities::getFilePath(argv[0]); - dataPath = exePath + "/" + std::string(PBD_DATA_PATH); + base = new DemoBase(); + base->init(argc, argv, "Rigid body collision demo"); - // OpenGL - MiniGL::init (argc, argv, 1024, 768, 0, 0, "Rigid body collision demo"); - MiniGL::initLights (); - MiniGL::initTexture(); - MiniGL::setClientIdleFunc (50, timeStep); - MiniGL::setKeyFunc(0, 'r', reset); - MiniGL::setSelectionFunc(selection); - initShader(); + SimulationModel *model = new SimulationModel(); + model->init(); + Simulation::getCurrent()->setModel(model); + + cd = new DistanceFieldCollisionDetection(); + cd->init(); - buildModel (); + buildModel(); + base->createParameterGUI(); + + // OpenGL + MiniGL::setClientIdleFunc (timeStep); + MiniGL::addKeyFunc('r', reset); MiniGL::setClientSceneFunc(render); MiniGL::setViewport (40.0f, 0.1f, 500.0, Vector3r (5.0, 30.0, 70.0), Vector3r (5.0, 0.0, 0.0)); + MiniGL::mainLoop(); - TwAddVarRW(MiniGL::getTweakBar(), "Pause", TW_TYPE_BOOLCPP, &doPause, " label='Pause' group=Simulation key=SPACE "); - TwAddVarRW(MiniGL::getTweakBar(), "RenderContacts", TW_TYPE_BOOLCPP, &renderContacts, " label='Render contacts' group=Simulation "); - TwAddVarCB(MiniGL::getTweakBar(), "TimeStepSize", TW_TYPE_REAL, setTimeStep, getTimeStep, &model, " label='Time step size' min=0.0 max = 0.1 step=0.001 precision=4 group=Simulation "); - TwType enumType = TwDefineEnum("VelocityUpdateMethodType", NULL, 0); - TwAddVarCB(MiniGL::getTweakBar(), "VelocityUpdateMethod", enumType, setVelocityUpdateMethod, getVelocityUpdateMethod, &sim, " label='Velocity update method' enum='0 {First Order Update}, 1 {Second Order Update}' group=Simulation"); - TwAddVarCB(MiniGL::getTweakBar(), "MaxIter", TW_TYPE_UINT32, setMaxIterations, getMaxIterations, &sim, " label='Max. iterations' min=1 step=1 group=Simulation "); - TwAddVarCB(MiniGL::getTweakBar(), "ContactTolerance", TW_TYPE_REAL, setContactTolerance, getContactTolerance, &cd, " label='Contact tolerance' min=0.0 step=0.001 precision=3 group=Simulation "); - TwAddVarCB(MiniGL::getTweakBar(), "ContactStiffnessRigidBody", TW_TYPE_REAL, setContactStiffnessRigidBody, getContactStiffnessRigidBody, &model, " label='Contact stiffness RB' min=0.0 step=0.1 precision=2 group=Simulation "); - TwAddVarCB(MiniGL::getTweakBar(), "ContactStiffnessParticleRigidBody", TW_TYPE_REAL, setContactStiffnessParticleRigidBody, getContactStiffnessParticleRigidBody, &model, " label='Contact stiffness Particle-RB' min=0.0 step=0.1 precision=2 group=Simulation "); + base->cleanup(); + Utilities::Timing::printAverageTimes(); + Utilities::Timing::printTimeSums(); - glutMainLoop (); - - cleanup (); + delete Simulation::getCurrent(); + delete base; + delete model; + delete cd; return 0; } -void initShader() -{ - std::string vertFile = dataPath + "/shaders/vs_smooth.glsl"; - std::string fragFile = dataPath + "/shaders/fs_smooth.glsl"; - shader = MiniGL::createShader(vertFile, "", fragFile); - - if (shader == NULL) - return; - - shader->begin(); - shader->addUniform("modelview_matrix"); - shader->addUniform("projection_matrix"); - shader->addUniform("surface_color"); - shader->addUniform("shininess"); - shader->addUniform("specular_factor"); - shader->end(); - - std::string vertFileTex = dataPath + "/shaders/vs_smoothTex.glsl"; - std::string fragFileTex = dataPath + "/shaders/fs_smoothTex.glsl"; - shaderTex = MiniGL::createShader(vertFileTex, "", fragFileTex); - - if (shaderTex == NULL) - return; - - shaderTex->begin(); - shaderTex->addUniform("modelview_matrix"); - shaderTex->addUniform("projection_matrix"); - shaderTex->addUniform("surface_color"); - shaderTex->addUniform("shininess"); - shaderTex->addUniform("specular_factor"); - shaderTex->end(); -} - -void cleanup() -{ - delete TimeManager::getCurrent(); - delete shader; - delete shaderTex; -} - void reset() { - model.reset(); - sim.reset(); - TimeManager::getCurrent()->setTime(0.0); -} - -void mouseMove(int x, int y) -{ - Vector3r mousePos; - MiniGL::unproject(x, y, mousePos); - const Vector3r diff = mousePos - oldMousePos; - - TimeManager *tm = TimeManager::getCurrent(); - const Real h = tm->getTimeStepSize(); + Utilities::Timing::printAverageTimes(); + Utilities::Timing::reset(); - SimulationModel::RigidBodyVector &rb = model.getRigidBodies(); - for (size_t j = 0; j < selectedBodies.size(); j++) - { - if (rb[selectedBodies[j]]->getMass() != 0.0) - rb[selectedBodies[j]]->getVelocity() += 1.0 / h * diff; - } - oldMousePos = mousePos; + Simulation::getCurrent()->reset(); + base->getSelectedParticles().clear(); } -void selection(const Eigen::Vector2i &start, const Eigen::Vector2i &end) -{ - std::vector hits; - selectedBodies.clear(); - - SimulationModel::RigidBodyVector &rb = model.getRigidBodies(); - std::vector > x; - x.resize(rb.size()); - for (unsigned int i = 0; i < rb.size(); i++) - { - x[i] = rb[i]->getPosition(); - } - - Selection::selectRect(start, end, &x[0], &x[rb.size() - 1], selectedBodies); - if (selectedBodies.size() > 0) - MiniGL::setMouseMoveFunc(GLUT_MIDDLE_BUTTON, mouseMove); - else - MiniGL::setMouseMoveFunc(-1, NULL); - - MiniGL::unproject(end[0], end[1], oldMousePos); -} void timeStep () { - if (doPause) + const Real pauseAt = base->getValue(DemoBase::PAUSE_AT); + if ((pauseAt > 0.0) && (pauseAt < TimeManager::getCurrent()->getTime())) + base->setValue(DemoBase::PAUSE, true); + + if (base->getValue(DemoBase::PAUSE)) return; // Simulation code - for (unsigned int i = 0; i < 8; i++) - sim.step(model); + SimulationModel *model = Simulation::getCurrent()->getModel(); + const unsigned int numSteps = base->getValue(DemoBase::NUM_STEPS_PER_RENDER); + for (unsigned int i = 0; i < numSteps; i++) + { + START_TIMING("SimStep"); + Simulation::getCurrent()->getTimeStep()->step(*model); + STOP_TIMING_AVG; + + base->step(); + } } void buildModel () { - TimeManager::getCurrent ()->setTimeStepSize (0.005); + TimeManager::getCurrent ()->setTimeStepSize (static_cast(0.005)); - sim.setCollisionDetection(model, &cd); + SimulationModel *model = Simulation::getCurrent()->getModel(); + Simulation::getCurrent()->getTimeStep()->setCollisionDetection(*model, cd); createBodyModel(); } -void renderBallJoint(BallJoint &bj) -{ - float jointColor[4] = { 0.0, 0.6f, 0.2f, 1 }; - MiniGL::drawSphere(bj.m_jointInfo.col(2), 0.15f, jointColor); -} - -void renderContact(RigidBodyContactConstraint &cc) -{ - float col1[4] = { 0.0, 0.6f, 0.2f, 1 }; - float col2[4] = { 0.6f, 0.0, 0.2f, 1 }; - MiniGL::drawPoint(cc.m_constraintInfo.col(0), 5.0, col1); - MiniGL::drawPoint(cc.m_constraintInfo.col(1), 5.0, col2); - MiniGL::drawVector(cc.m_constraintInfo.col(1), cc.m_constraintInfo.col(1) + cc.m_constraintInfo.col(2), 1.0, col2); -} - void render () { - MiniGL::coordinateSystem(); - - // Draw sim model - - SimulationModel::RigidBodyVector &rb = model.getRigidBodies(); - SimulationModel::ConstraintVector &constraints = model.getConstraints(); - SimulationModel::RigidBodyContactConstraintVector &contacts = model.getRigidBodyContactConstraints(); - - float selectionColor[4] = { 0.8f, 0.0f, 0.0f, 1 }; - float surfaceColor[4] = { 0.3f, 0.5f, 0.8f, 1 }; - float staticColor[4] = { 0.5f, 0.5f, 0.5f, 1 }; - - if (renderContacts) - { - for (unsigned int i = 0; i < contacts.size(); i++) - renderContact(contacts[i]); - } - - - if (shader) - { - shader->begin(); - glUniform1f(shader->getUniform("shininess"), 5.0); - glUniform1f(shader->getUniform("specular_factor"), 0.2f); - - GLfloat matrix[16]; - glGetFloatv(GL_MODELVIEW_MATRIX, matrix); - glUniformMatrix4fv(shader->getUniform("modelview_matrix"), 1, GL_FALSE, matrix); - GLfloat pmatrix[16]; - glGetFloatv(GL_PROJECTION_MATRIX, pmatrix); - glUniformMatrix4fv(shader->getUniform("projection_matrix"), 1, GL_FALSE, pmatrix); - } - - for (size_t i = 0; i < rb.size(); i++) - { - bool selected = false; - for (unsigned int j = 0; j < selectedBodies.size(); j++) - { - if (selectedBodies[j] == i) - selected = true; - } - - const VertexData &vd = rb[i]->getGeometry().getVertexData(); - const IndexedFaceMesh &mesh = rb[i]->getGeometry().getMesh(); - if (shader) - { - if (rb[i]->getMass() != 0.0) - { - if (!selected) - { - glUniform3fv(shader->getUniform("surface_color"), 1, surfaceColor); - Visualization::drawMesh(vd, mesh, 0, surfaceColor); - } - else - { - glUniform3fv(shader->getUniform("surface_color"), 1, selectionColor); - Visualization::drawMesh(vd, mesh, 0, selectionColor); - } - } - } - } - - if (shaderTex) - shaderTex->end(); - - if (shaderTex) - { - shaderTex->begin(); - glUniform1f(shaderTex->getUniform("shininess"), 5.0); - glUniform1f(shaderTex->getUniform("specular_factor"), 0.2f); - - GLfloat matrix[16]; - glGetFloatv(GL_MODELVIEW_MATRIX, matrix); - glUniformMatrix4fv(shaderTex->getUniform("modelview_matrix"), 1, GL_FALSE, matrix); - GLfloat pmatrix[16]; - glGetFloatv(GL_PROJECTION_MATRIX, pmatrix); - glUniformMatrix4fv(shaderTex->getUniform("projection_matrix"), 1, GL_FALSE, pmatrix); - } - - for (size_t i = 0; i < rb.size(); i++) - { - bool selected = false; - for (unsigned int j = 0; j < selectedBodies.size(); j++) - { - if (selectedBodies[j] == i) - selected = true; - } - - const VertexData &vd = rb[i]->getGeometry().getVertexData(); - const IndexedFaceMesh &mesh = rb[i]->getGeometry().getMesh(); - if (shaderTex) - { - if (rb[i]->getMass() == 0.0) - { - if (!selected) - { - glUniform3fv(shaderTex->getUniform("surface_color"), 1, staticColor); - Visualization::drawTexturedMesh(vd, mesh, 0, staticColor); - } - else - { - glUniform3fv(shaderTex->getUniform("surface_color"), 1, selectionColor); - Visualization::drawTexturedMesh(vd, mesh, 0, selectionColor); - } - } - } - } - - if (shaderTex) - shaderTex->end(); - - for (size_t i = 0; i < constraints.size(); i++) - { - if (constraints[i]->getTypeId() == BallJoint::TYPE_ID) - { - renderBallJoint(*(BallJoint*)constraints[i]); - } - } - - MiniGL::drawTime( TimeManager::getCurrent ()->getTime ()); + base->render(); } - /** Create the rigid body model */ void createBodyModel() { - SimulationModel::RigidBodyVector &rb = model.getRigidBodies(); - SimulationModel::ConstraintVector &constraints = model.getConstraints(); + SimulationModel *model = Simulation::getCurrent()->getModel(); + SimulationModel::RigidBodyVector &rb = model->getRigidBodies(); + SimulationModel::ConstraintVector &constraints = model->getConstraints(); - string fileNameBox = dataPath + "/models/cube.obj"; + string fileNameBox = FileSystem::normalizePath(base->getExePath() + "/resources/models/cube.obj"); IndexedFaceMesh meshBox; VertexData vdBox; - OBJLoader::loadObj(fileNameBox, vdBox, meshBox); + DemoBase::loadMesh(fileNameBox, vdBox, meshBox, Vector3r::Zero(), Matrix3r::Identity(), Vector3r::Ones()); + meshBox.setFlatShading(true); - string fileNameCylinder = dataPath + "/models/cylinder.obj"; + string fileNameCylinder = FileSystem::normalizePath(base->getExePath() + "/resources/models/cylinder.obj"); IndexedFaceMesh meshCylinder; VertexData vdCylinder; - OBJLoader::loadObj(fileNameCylinder, vdCylinder, meshCylinder); + DemoBase::loadMesh(fileNameCylinder, vdCylinder, meshCylinder, Vector3r::Zero(), Matrix3r::Identity(), Vector3r::Ones()); - string fileNameTorus = dataPath + "/models/torus.obj"; + string fileNameTorus = FileSystem::normalizePath(base->getExePath() + "/resources/models/torus.obj"); IndexedFaceMesh meshTorus; VertexData vdTorus; - OBJLoader::loadObj(fileNameTorus, vdTorus, meshTorus); + DemoBase::loadMesh(fileNameTorus, vdTorus, meshTorus, Vector3r::Zero(), Matrix3r::Identity(), Vector3r::Ones()); - string fileNameCube = dataPath + "/models/cube_5.obj"; + string fileNameCube = FileSystem::normalizePath(base->getExePath() + "/resources/models/cube_5.obj"); IndexedFaceMesh meshCube; VertexData vdCube; - OBJLoader::loadObj(fileNameCube, vdCube, meshCube); + DemoBase::loadMesh(fileNameCube, vdCube, meshCube, Vector3r::Zero(), Matrix3r::Identity(), Vector3r::Ones()); + meshCube.setFlatShading(true); - string fileNameSphere = dataPath + "/models/sphere.obj"; + string fileNameSphere = FileSystem::normalizePath(base->getExePath() + "/resources/models/sphere.obj"); IndexedFaceMesh meshSphere; VertexData vdSphere; - OBJLoader::loadObj(fileNameSphere, vdSphere, meshSphere); + DemoBase::loadMesh(fileNameSphere, vdSphere, meshSphere, Vector3r::Zero(), Matrix3r::Identity(), 2.0*Vector3r::Ones()); const unsigned int num_piles_x = 5; @@ -406,10 +187,10 @@ void createBodyModel() vdBox, meshBox, Vector3r(100.0, 1.0, 100.0)); rb[rbIndex]->setMass(0.0); - const std::vector *vertices = rb[rbIndex]->getGeometry().getVertexDataLocal().getVertices(); - const unsigned int nVert = static_cast(vertices->size()); + const std::vector &vertices = rb[rbIndex]->getGeometry().getVertexDataLocal().getVertices(); + const unsigned int nVert = static_cast(vertices.size()); - cd.addCollisionBox(rbIndex, CollisionDetection::CollisionObject::RigidBodyCollisionObjectType, &(*vertices)[0], nVert, Vector3r(100.0, 1.0, 100.0)); + cd->addCollisionBox(rbIndex, CollisionDetection::CollisionObject::RigidBodyCollisionObjectType, vertices.data(), nVert, Vector3r(100.0, 1.0, 100.0)); rbIndex++; Real current_z = startz_piles; @@ -426,15 +207,17 @@ void createBodyModel() Vector3r(0.5, 10.0, 0.5)); rb[rbIndex]->setMass(0.0); - const std::vector *vertices = rb[rbIndex]->getGeometry().getVertexDataLocal().getVertices(); - const unsigned int nVert = static_cast(vertices->size()); - cd.addCollisionCylinder(rbIndex, CollisionDetection::CollisionObject::RigidBodyCollisionObjectType, &(*vertices)[0], nVert, Vector2r(0.5, 10.0)); + const std::vector &vertices = rb[rbIndex]->getGeometry().getVertexDataLocal().getVertices(); + const unsigned int nVert = static_cast(vertices.size()); + cd->addCollisionCylinder(rbIndex, CollisionDetection::CollisionObject::RigidBodyCollisionObjectType, vertices.data(), nVert, Vector2r(0.5, 10.0)); current_x += dx_piles; rbIndex++; } current_z += dz_piles; } + srand((unsigned int) time(NULL)); + Real current_y = starty_bodies; unsigned int currentType = 0; for (unsigned int i = 0; i < num_bodies_y; i++) @@ -463,9 +246,9 @@ void createBodyModel() vdTorus, meshTorus, Vector3r(2.0, 2.0, 2.0)); - const std::vector *vertices = rb[rbIndex]->getGeometry().getVertexDataLocal().getVertices(); - const unsigned int nVert = static_cast(vertices->size()); - cd.addCollisionTorus(rbIndex, CollisionDetection::CollisionObject::RigidBodyCollisionObjectType, &(*vertices)[0], nVert, Vector2r(2.0, 1.0)); + const std::vector &vertices = rb[rbIndex]->getGeometry().getVertexDataLocal().getVertices(); + const unsigned int nVert = static_cast(vertices.size()); + cd->addCollisionTorus(rbIndex, CollisionDetection::CollisionObject::RigidBodyCollisionObjectType, vertices.data(), nVert, Vector2r(2.0, 1.0)); } else if (currentType == 1) { @@ -475,9 +258,9 @@ void createBodyModel() vdCube, meshCube, Vector3r(4.0, 1.0, 1.0)); - const std::vector *vertices = rb[rbIndex]->getGeometry().getVertexDataLocal().getVertices(); - const unsigned int nVert = static_cast(vertices->size()); - cd.addCollisionBox(rbIndex, CollisionDetection::CollisionObject::RigidBodyCollisionObjectType, &(*vertices)[0], nVert, Vector3r(4.0, 1.0, 1.0)); + const std::vector &vertices = rb[rbIndex]->getGeometry().getVertexDataLocal().getVertices(); + const unsigned int nVert = static_cast(vertices.size()); + cd->addCollisionBox(rbIndex, CollisionDetection::CollisionObject::RigidBodyCollisionObjectType, vertices.data(), nVert, Vector3r(4.0, 1.0, 1.0)); } else if (currentType == 2) { @@ -486,9 +269,9 @@ void createBodyModel() q, //Quaternionr(1.0, 0.0, 0.0, 0.0), vdSphere, meshSphere); - const std::vector *vertices = rb[rbIndex]->getGeometry().getVertexDataLocal().getVertices(); - const unsigned int nVert = static_cast(vertices->size()); - cd.addCollisionSphere(rbIndex, CollisionDetection::CollisionObject::RigidBodyCollisionObjectType, &(*vertices)[0], nVert, 1.0); + const std::vector &vertices = rb[rbIndex]->getGeometry().getVertexDataLocal().getVertices(); + const unsigned int nVert = static_cast(vertices.size()); + cd->addCollisionSphere(rbIndex, CollisionDetection::CollisionObject::RigidBodyCollisionObjectType, vertices.data(), nVert, 2.0); } else if (currentType == 3) { @@ -498,9 +281,9 @@ void createBodyModel() vdCylinder, meshCylinder, Vector3r(0.75, 5.0, 0.75)); - const std::vector *vertices = rb[rbIndex]->getGeometry().getVertexDataLocal().getVertices(); - const unsigned int nVert = static_cast(vertices->size()); - cd.addCollisionCylinder(rbIndex, CollisionDetection::CollisionObject::RigidBodyCollisionObjectType, &(*vertices)[0], nVert, Vector2r(0.75, 5.0)); + const std::vector &vertices = rb[rbIndex]->getGeometry().getVertexDataLocal().getVertices(); + const unsigned int nVert = static_cast(vertices.size()); + cd->addCollisionCylinder(rbIndex, CollisionDetection::CollisionObject::RigidBodyCollisionObjectType, vertices.data(), nVert, Vector2r(0.75, 5.0)); } currentType = (currentType + 1) % 4; current_z += dz_bodies; @@ -512,69 +295,3 @@ void createBodyModel() } } -void TW_CALL setTimeStep(const void *value, void *clientData) -{ - const Real val = *(const Real *)(value); - TimeManager::getCurrent()->setTimeStepSize(val); -} - -void TW_CALL getTimeStep(void *value, void *clientData) -{ - *(Real *)(value) = TimeManager::getCurrent()->getTimeStepSize(); -} - -void TW_CALL setVelocityUpdateMethod(const void *value, void *clientData) -{ - const short val = *(const short *)(value); - ((TimeStepController*)clientData)->setVelocityUpdateMethod((unsigned int)val); -} - -void TW_CALL getVelocityUpdateMethod(void *value, void *clientData) -{ - *(short *)(value) = (short)((TimeStepController*)clientData)->getVelocityUpdateMethod(); -} - -void TW_CALL setMaxIterations(const void *value, void *clientData) -{ - const unsigned int val = *(const unsigned int *)(value); - ((TimeStepController*)clientData)->setMaxIterations(val); -} - -void TW_CALL getMaxIterations(void *value, void *clientData) -{ - *(unsigned int *)(value) = ((TimeStepController*)clientData)->getMaxIterations(); -} - -void TW_CALL setContactStiffnessRigidBody(const void *value, void *clientData) -{ - const Real val = *(const Real *)(value); - ((SimulationModel*)clientData)->setContactStiffnessRigidBody(val); -} - -void TW_CALL getContactStiffnessRigidBody(void *value, void *clientData) -{ - *(Real *)(value) = ((SimulationModel*)clientData)->getContactStiffnessRigidBody(); -} - -void TW_CALL setContactStiffnessParticleRigidBody(const void *value, void *clientData) -{ - const Real val = *(const Real *)(value); - ((SimulationModel*)clientData)->setContactStiffnessParticleRigidBody(val); -} - -void TW_CALL getContactStiffnessParticleRigidBody(void *value, void *clientData) -{ - *(Real *)(value) = ((SimulationModel*)clientData)->getContactStiffnessParticleRigidBody(); -} - -void TW_CALL setContactTolerance(const void *value, void *clientData) -{ - const Real val = *(const Real *)(value); - ((DistanceFieldCollisionDetection*)clientData)->setTolerance(val); -} - -void TW_CALL getContactTolerance(void *value, void *clientData) -{ - *(Real *)(value) = ((DistanceFieldCollisionDetection*)clientData)->getTolerance(); -} - diff --git a/Demos/FluidDemo/CMakeLists.txt b/Demos/FluidDemo/CMakeLists.txt index 2209f9ff..56b138f1 100644 --- a/Demos/FluidDemo/CMakeLists.txt +++ b/Demos/FluidDemo/CMakeLists.txt @@ -1,16 +1,16 @@ -set(SIMULATION_LINK_LIBRARIES AntTweakBar glew PositionBasedDynamics Simulation) -set(SIMULATION_DEPENDENCIES AntTweakBar glew PositionBasedDynamics Simulation) +set(SIMULATION_LINK_LIBRARIES imgui glfw PositionBasedDynamics Simulation Utils) +set(SIMULATION_DEPENDENCIES imgui glfw PositionBasedDynamics Simulation Utils CopyPBDShaders CopyImguiFonts) if(WIN32) - set(SIMULATION_LINK_LIBRARIES freeglut opengl32.lib glu32.lib ${SIMULATION_LINK_LIBRARIES}) - set(SIMULATION_DEPENDENCIES freeglut ${SIMULATION_DEPENDENCIES}) + set(SIMULATION_LINK_LIBRARIES opengl32.lib glu32.lib ${SIMULATION_LINK_LIBRARIES}) + #set(SIMULATION_DEPENDENCIES ${SIMULATION_DEPENDENCIES}) else() - find_package(GLUT REQUIRED) + set(OpenGL_GL_PREFERENCE GLVND) find_package(OpenGL REQUIRED) + include_directories( ${OPENGL_INCLUDE_DIRS}) set(SIMULATION_LINK_LIBRARIES ${SIMULATION_LINK_LIBRARIES} - ${GLUT_LIBRARIES} ${OPENGL_LIBRARIES} ) endif() @@ -18,6 +18,14 @@ endif() add_executable(FluidDemo main.cpp + ../Common/LogWindow.cpp + ../Common/LogWindow.h + ../Common/Simulator_GUI_imgui.cpp + ../Common/Simulator_GUI_imgui.h + ../Common/imguiParameters.cpp + ../Common/imguiParameters.h + ../Common/DemoBase.cpp + ../Common/DemoBase.h TimeStepFluidModel.cpp TimeStepFluidModel.h FluidModel.cpp @@ -25,15 +33,10 @@ add_executable(FluidDemo ${VIS_FILES} ${PROJECT_PATH}/Common/Common.h - ${PROJECT_PATH}/Demos/Common/Config.h - ${PROJECT_PATH}/Demos/Utils/Utilities.cpp - ${PROJECT_PATH}/Demos/Utils/Utilities.h CMakeLists.txt ) -add_definitions(-DTW_NO_LIB_PRAGMA -DTW_STATIC) - find_package( Eigen3 REQUIRED ) include_directories( ${EIGEN3_INCLUDE_DIR} ) include_directories(${PROJECT_PATH}/extern/freeglut/include) diff --git a/Demos/FluidDemo/FluidModel.cpp b/Demos/FluidDemo/FluidModel.cpp index 3115aa36..1e30aa7b 100644 --- a/Demos/FluidDemo/FluidModel.cpp +++ b/Demos/FluidDemo/FluidModel.cpp @@ -7,9 +7,9 @@ using namespace PBD; FluidModel::FluidModel() : m_particles() { - m_density0 = 1000.0; - m_particleRadius = 0.025; - viscosity = 0.02; + m_density0 = static_cast(1000.0); + m_particleRadius = static_cast(0.025); + viscosity = static_cast(0.02); m_neighborhoodSearch = NULL; } @@ -53,14 +53,14 @@ ParticleData & PBD::FluidModel::getParticles() void FluidModel::initMasses() { const int nParticles = (int) m_particles.size(); - const Real diam = 2.0*m_particleRadius; + const Real diam = static_cast(2.0)*m_particleRadius; #pragma omp parallel default(shared) { #pragma omp for schedule(static) for (int i = 0; i < nParticles; i++) { - m_particles.setMass(i, 0.8 * diam*diam*diam * m_density0); // each particle represents a cube with a side length of r + m_particles.setMass(i, static_cast(0.8) * diam*diam*diam * m_density0); // each particle represents a cube with a side length of r // mass is slightly reduced to prevent pressure at the beginning of the simulation } } @@ -145,7 +145,7 @@ void FluidModel::initModel(const unsigned int nFluidParticles, Vector3r* fluidPa const unsigned int neighborIndex = neighbors[i][j]; delta += CubicKernel::W(m_boundaryX[i] - m_boundaryX[neighborIndex]); } - const Real volume = 1.0 / delta; + const Real volume = static_cast(1.0) / delta; m_boundaryPsi[i] = m_density0 * volume; } } diff --git a/Demos/FluidDemo/FluidModel.h b/Demos/FluidDemo/FluidModel.h index fc926e89..c8a50bb9 100644 --- a/Demos/FluidDemo/FluidModel.h +++ b/Demos/FluidDemo/FluidModel.h @@ -1,10 +1,9 @@ #ifndef __FluidModel_h__ #define __FluidModel_h__ -#include "Demos/Common/Config.h" -#include "Demos/Simulation/ParticleData.h" +#include "Simulation/ParticleData.h" #include -#include "Demos/Simulation/NeighborhoodSearchSpatialHashing.h" +#include "Simulation/NeighborhoodSearchSpatialHashing.h" namespace PBD { @@ -45,7 +44,7 @@ namespace PBD Real getDensity0() const { return m_density0; } Real getSupportRadius() const { return m_supportRadius; } Real getParticleRadius() const { return m_particleRadius; } - void setParticleRadius(Real val) { m_particleRadius = val; m_supportRadius = 4.0*m_particleRadius; } + void setParticleRadius(Real val) { m_particleRadius = val; m_supportRadius = static_cast(4.0)*m_particleRadius; } NeighborhoodSearchSpatialHashing* getNeighborhoodSearch() { return m_neighborhoodSearch; } Real getViscosity() const { return viscosity; } diff --git a/Demos/FluidDemo/TimeStepFluidModel.cpp b/Demos/FluidDemo/TimeStepFluidModel.cpp index ba7bd41d..ac9987aa 100644 --- a/Demos/FluidDemo/TimeStepFluidModel.cpp +++ b/Demos/FluidDemo/TimeStepFluidModel.cpp @@ -1,14 +1,17 @@ #include "TimeStepFluidModel.h" -#include "Demos/Simulation/TimeManager.h" +#include "Simulation/TimeManager.h" #include "PositionBasedDynamics/PositionBasedFluids.h" #include "PositionBasedDynamics/TimeIntegration.h" #include "PositionBasedDynamics/SPHKernels.h" +#include "Simulation/Simulation.h" +#include "Utils/Timing.h" using namespace PBD; using namespace std; TimeStepFluidModel::TimeStepFluidModel() { + m_velocityUpdateMethod = 0; } TimeStepFluidModel::~TimeStepFluidModel(void) @@ -17,6 +20,7 @@ TimeStepFluidModel::~TimeStepFluidModel(void) void TimeStepFluidModel::step(FluidModel &model) { + START_TIMING("simulation step"); TimeManager *tm = TimeManager::getCurrent (); const Real h = tm->getTimeStepSize(); ParticleData &pd = model.getParticles(); @@ -24,7 +28,7 @@ void TimeStepFluidModel::step(FluidModel &model) clearAccelerations(model); // Update time step size by CFL condition - updateTimeStepSizeCFL(model, 0.0001, 0.005); + updateTimeStepSizeCFL(model, static_cast(0.0001), static_cast(0.005)); // Time integration for (unsigned int i = 0; i < pd.size(); i++) @@ -36,10 +40,14 @@ void TimeStepFluidModel::step(FluidModel &model) } // Perform neighborhood search + START_TIMING("neighborhood search"); model.getNeighborhoodSearch()->neighborhoodSearch(&model.getParticles().getPosition(0), model.numBoundaryParticles(), &model.getBoundaryX(0)); + STOP_TIMING_AVG; // Solve density constraint + START_TIMING("constraint projection"); constraintProjection(model); + STOP_TIMING_AVG; // Update velocities for (unsigned int i = 0; i < pd.size(); i++) @@ -56,6 +64,7 @@ void TimeStepFluidModel::step(FluidModel &model) // Compute new time tm->setTime (tm->getTime () + h); model.getNeighborhoodSearch()->update(); + STOP_TIMING_AVG; } @@ -65,7 +74,8 @@ void TimeStepFluidModel::clearAccelerations(FluidModel &model) { ParticleData &pd = model.getParticles(); const unsigned int count = pd.size(); - const Vector3r grav(0.0, -9.81, 0.0); + Simulation* sim = Simulation::getCurrent(); + const Vector3r grav(sim->getVecValue(Simulation::GRAVITATION)); for (unsigned int i=0; i < count; i++) { // Clear accelerations of dynamic particles @@ -107,10 +117,10 @@ void TimeStepFluidModel::updateTimeStepSizeCFL(FluidModel &model, const Real min Real h = TimeManager::getCurrent()->getTimeStepSize(); // Approximate max. position change due to current velocities - Real maxVel = 0.1; + Real maxVel = static_cast(0.1); ParticleData &pd = model.getParticles(); const unsigned int numParticles = pd.size(); - const Real diameter = 2.0*radius; + const Real diameter = static_cast(2.0)*radius; for (unsigned int i = 0; i < numParticles; i++) { const Vector3r &vel = pd.getVelocity(i); @@ -121,7 +131,7 @@ void TimeStepFluidModel::updateTimeStepSizeCFL(FluidModel &model, const Real min } // Approximate max. time step size - h = cflFactor * .4 * (diameter / (sqrt(maxVel))); + h = cflFactor * static_cast(0.4) * (diameter / (sqrt(maxVel))); h = min(h, maxTimeStepSize); h = max(h, minTimeStepSize); diff --git a/Demos/FluidDemo/TimeStepFluidModel.h b/Demos/FluidDemo/TimeStepFluidModel.h index 14888225..8811f8d8 100644 --- a/Demos/FluidDemo/TimeStepFluidModel.h +++ b/Demos/FluidDemo/TimeStepFluidModel.h @@ -1,7 +1,6 @@ #ifndef __TimeStepFluidModel_h__ #define __TimeStepFluidModel_h__ -#include "Demos/Common/Config.h" #include "FluidModel.h" namespace PBD @@ -9,7 +8,7 @@ namespace PBD class TimeStepFluidModel { protected: - unsigned int m_velocityUpdateMethod; + int m_velocityUpdateMethod; void clearAccelerations(FluidModel &model); void computeXSPHViscosity(FluidModel &model); @@ -24,8 +23,8 @@ namespace PBD void step(FluidModel &model); void reset(); - unsigned int getVelocityUpdateMethod() const { return m_velocityUpdateMethod; } - void setVelocityUpdateMethod(unsigned int val) { m_velocityUpdateMethod = val; } + int getVelocityUpdateMethod() const { return m_velocityUpdateMethod; } + void setVelocityUpdateMethod(int val) { m_velocityUpdateMethod = val; } }; } diff --git a/Demos/FluidDemo/main.cpp b/Demos/FluidDemo/main.cpp index c641afca..21aed274 100644 --- a/Demos/FluidDemo/main.cpp +++ b/Demos/FluidDemo/main.cpp @@ -1,23 +1,29 @@ -#include "Demos/Common/Config.h" -#include "GL/glew.h" +#include "Common/Common.h" #include "Demos/Visualization/MiniGL.h" #include "Demos/Visualization/Selection.h" -#include "GL/glut.h" -#include "Demos/Simulation/TimeManager.h" +#include "Simulation/TimeManager.h" +#include "Demos/Common/DemoBase.h" #include #include "FluidModel.h" #include "TimeStepFluidModel.h" +#include "Simulation/Simulation.h" #include -#include "Demos/Utils/Utilities.h" +#include "Utils/Logger.h" +#include "Utils/Timing.h" +#include "Utils/FileSystem.h" +#include "../Common/imguiParameters.h" +#define _USE_MATH_DEFINES +#include "math.h" + // Enable memory leak detection -#ifdef _DEBUG +#if defined(_DEBUG) && !defined(EIGEN_ALIGN) #define new DEBUG_NEW #endif using namespace PBD; -using namespace Eigen; using namespace std; +using namespace Utilities; void timeStep (); void buildModel (); @@ -27,29 +33,22 @@ void initBoundaryData(std::vector &boundaryParticles); void render (); void cleanup(); void reset(); -void hsvToRgb(float h, float s, float v, float *rgb); -void selection(const Eigen::Vector2i &start, const Eigen::Vector2i &end); +void selection(const Vector2i &start, const Vector2i &end, void *clientData); void createSphereBuffers(Real radius, int resolution); void renderSphere(const Vector3r &x, const float color[]); void releaseSphereBuffers(); -void TW_CALL setTimeStep(const void *value, void *clientData); -void TW_CALL getTimeStep(void *value, void *clientData); -void TW_CALL setVelocityUpdateMethod(const void *value, void *clientData); -void TW_CALL getVelocityUpdateMethod(void *value, void *clientData); -void TW_CALL setViscosity(const void *value, void *clientData); -void TW_CALL getViscosity(void *value, void *clientData); - FluidModel model; TimeStepFluidModel simulation; +DemoBase* base; -const Real particleRadius = 0.025; +const Real particleRadius = static_cast(0.025); const unsigned int width = 15; const unsigned int depth = 15; const unsigned int height = 20; -const Real containerWidth = (width + 1)*particleRadius*2.0 * 5.0; -const Real containerDepth = (depth + 1)*particleRadius*2.0; +const Real containerWidth = (width + 1)*particleRadius*static_cast(2.0 * 5.0); +const Real containerDepth = (depth + 1)*particleRadius*static_cast(2.0); const Real containerHeight = 4.0; bool doPause = true; std::vector selectedParticles; @@ -69,36 +68,54 @@ int main( int argc, char **argv ) { REPORT_MEMORY_LEAKS - exePath = Utilities::getFilePath(argv[0]); - dataPath = exePath + "/" + std::string(PBD_DATA_PATH); - - // OpenGL - MiniGL::init (argc, argv, 1024, 768, 0, 0, "Fluid demo"); - MiniGL::initLights (); - MiniGL::setClientIdleFunc (50, timeStep); - MiniGL::setKeyFunc(0, 'r', reset); - MiniGL::setSelectionFunc(selection); + base = new DemoBase(); + base->init(argc, argv, "Fluid demo"); - MiniGL::getOpenGLVersion(context_major_version, context_minor_version); + // we use an own time step controller + delete PBD::Simulation::getCurrent()->getTimeStep(); + PBD::Simulation::getCurrent()->setTimeStep(nullptr); - MiniGL::setClientSceneFunc(render); + MiniGL::setSelectionFunc(selection, nullptr); + MiniGL::setClientIdleFunc(timeStep); + MiniGL::addKeyFunc('r', reset); + MiniGL::setClientSceneFunc(render); MiniGL::setViewport (40.0, 0.1f, 500.0, Vector3r (0.0, 3.0, 8.0), Vector3r (0.0, 0.0, 0.0)); - TwAddVarRW(MiniGL::getTweakBar(), "Pause", TW_TYPE_BOOLCPP, &doPause, " label='Pause' group=Simulation key=SPACE "); - TwAddVarCB(MiniGL::getTweakBar(), "TimeStepSize", TW_TYPE_REAL, setTimeStep, getTimeStep, &model, " label='Time step size' min=0.0 max = 0.1 step=0.001 precision=4 group=Simulation "); - TwType enumType = TwDefineEnum("VelocityUpdateMethodType", NULL, 0); - TwAddVarCB(MiniGL::getTweakBar(), "VelocityUpdateMethod", enumType, setVelocityUpdateMethod, getVelocityUpdateMethod, &simulation, " label='Velocity update method' enum='0 {First Order Update}, 1 {Second Order Update}' group=Simulation"); - TwAddVarCB(MiniGL::getTweakBar(), "Viscosity", TW_TYPE_REAL, setViscosity, getViscosity, &model, " label='Viscosity' min=0.0 max = 0.5 step=0.001 precision=4 group=Simulation "); - buildModel(); + base->createParameterGUI(); + + // add additional parameter just for this demo + imguiParameters::imguiEnumParameter* eparam = new imguiParameters::imguiEnumParameter(); + eparam->description = "Velocity update method"; + eparam->label = "Velocity update method"; + eparam->getFct = [&]() -> int { return simulation.getVelocityUpdateMethod(); }; + eparam->setFct = [&](int i) -> void { simulation.setVelocityUpdateMethod(i); }; + eparam->items.push_back("First Order Update"); + eparam->items.push_back("Second Order Update"); + imguiParameters::addParam("Simulation", "PBD", eparam); + + imguiParameters::imguiNumericParameter* param = new imguiParameters::imguiNumericParameter(); + param->description = "Viscosity coefficient"; + param->label = "Viscosity"; + param->getFct = [&]() -> Real { return model.getViscosity(); }; + param->setFct = [&](Real v) -> void { model.setViscosity(v); }; + imguiParameters::addParam("Simulation", "PBD", param); + + MiniGL::getOpenGLVersion(context_major_version, context_minor_version); if (context_major_version >= 3) createSphereBuffers((Real)particleRadius, 8); - glutMainLoop (); + MiniGL::mainLoop(); cleanup (); - + base->cleanup(); + + Utilities::Timing::printAverageTimes(); + Utilities::Timing::printTimeSums(); + delete base; + delete Simulation::getCurrent(); + return 0; } @@ -111,12 +128,15 @@ void cleanup() void reset() { + Timing::printAverageTimes(); + Timing::reset(); + model.reset(); simulation.reset(); TimeManager::getCurrent()->setTime(0.0); } -void mouseMove(int x, int y) +void mouseMove(int x, int y, void *clientData) { Vector3r mousePos; MiniGL::unproject(x, y, mousePos); @@ -133,14 +153,14 @@ void mouseMove(int x, int y) oldMousePos = mousePos; } -void selection(const Eigen::Vector2i &start, const Eigen::Vector2i &end) +void selection(const Vector2i &start, const Vector2i &end, void *clientData) { std::vector hits; selectedParticles.clear(); ParticleData &pd = model.getParticles(); Selection::selectRect(start, end, &pd.getPosition(0), &pd.getPosition(pd.size() - 1), selectedParticles); if (selectedParticles.size() > 0) - MiniGL::setMouseMoveFunc(GLUT_MIDDLE_BUTTON, mouseMove); + MiniGL::setMouseMoveFunc(2, mouseMove); else MiniGL::setMouseMoveFunc(-1, NULL); @@ -149,44 +169,34 @@ void selection(const Eigen::Vector2i &start, const Eigen::Vector2i &end) void timeStep () { - if (doPause) + const Real pauseAt = base->getValue(DemoBase::PAUSE_AT); + if ((pauseAt > 0.0) && (pauseAt < TimeManager::getCurrent()->getTime())) + base->setValue(DemoBase::PAUSE, true); + + if (base->getValue(DemoBase::PAUSE)) return; // Simulation code - for (unsigned int i = 0; i < 8; i++) + const unsigned int numSteps = base->getValue(DemoBase::NUM_STEPS_PER_RENDER); + for (unsigned int i = 0; i < numSteps; i++) + { + START_TIMING("SimStep"); simulation.step(model); + STOP_TIMING_AVG; + + base->step(); + } } void buildModel () { - TimeManager::getCurrent ()->setTimeStepSize (0.0025); + TimeManager::getCurrent ()->setTimeStepSize (static_cast(0.0025)); createBreakingDam(); } -void hsvToRgb(float h, float s, float v, float *rgb) -{ - int i = (int)floor(h * 6); - float f = h * 6 - i; - float p = v * (1 - s); - float q = v * (1 - f * s); - float t = v * (1 - (1 - f) * s); - - switch (i % 6) - { - case 0: rgb[0] = v, rgb[1] = t, rgb[2] = p; break; - case 1: rgb[0] = q, rgb[1] = v, rgb[2] = p; break; - case 2: rgb[0] = p, rgb[1] = v, rgb[2] = t; break; - case 3: rgb[0] = p, rgb[1] = q, rgb[2] = v; break; - case 4: rgb[0] = t, rgb[1] = p, rgb[2] = v; break; - case 5: rgb[0] = v, rgb[1] = p, rgb[2] = q; break; - } -} - void render () { - MiniGL::coordinateSystem(); - // Draw simulation model const ParticleData &pd = model.getParticles(); @@ -203,7 +213,7 @@ void render () glPointSize(4.0); const Real supportRadius = model.getSupportRadius(); - Real vmax = 0.4*2.0*supportRadius / TimeManager::getCurrent()->getTimeStepSize(); + Real vmax = static_cast(0.4*2.0)*supportRadius / TimeManager::getCurrent()->getTimeStepSize(); Real vmin = 0.0; if (context_major_version > 3) @@ -211,10 +221,10 @@ void render () for (unsigned int i = 0; i < nParticles; i++) { Real v = pd.getVelocity(i).norm(); - v = 0.5*((v - vmin) / (vmax - vmin)); - v = min(128.0*v*v, 0.5); + v = static_cast(0.5)*((v - vmin) / (vmax - vmin)); + v = min(static_cast(128.0)*v*v, static_cast(0.5)); float fluidColor[4] = { 0.2f, 0.2f, 0.2f, 1.0 }; - hsvToRgb(0.55f, 1.0f, 0.5f + (float)v, fluidColor); + MiniGL::hsvToRgb(0.55f, 1.0f, 0.5f + (float)v, fluidColor); renderSphere(pd.getPosition(i), fluidColor); } @@ -228,10 +238,10 @@ void render () for (unsigned int i = 0; i < nParticles; i++) { Real v = pd.getVelocity(i).norm(); - v = 0.5*((v - vmin) / (vmax - vmin)); - v = min(128.0*v*v, 0.5); + v = static_cast(0.5)*((v - vmin) / (vmax - vmin)); + v = min(static_cast(128.0)*v*v, static_cast(0.5)); float fluidColor[4] = { 0.2f, 0.2f, 0.2f, 1.0 }; - hsvToRgb(0.55f, 1.0f, 0.5f + (float)v, fluidColor); + MiniGL::hsvToRgb(0.55f, 1.0f, 0.5f + (float)v, fluidColor); glColor3fv(fluidColor); glVertex3v(&pd.getPosition(i)[0]); @@ -257,7 +267,8 @@ void render () MiniGL::drawSphere(pd.getPosition(selectedParticles[j]), 0.08f, red); } - MiniGL::drawTime( TimeManager::getCurrent ()->getTime ()); + base->render(); + } @@ -265,12 +276,12 @@ void render () */ void createBreakingDam() { - std::cout << "Initialize fluid particles\n"; + LOG_INFO << "Initialize fluid particles"; const Real diam = 2.0*particleRadius; - const Real startX = -0.5*containerWidth + diam; + const Real startX = -static_cast(0.5)*containerWidth + diam; const Real startY = diam; - const Real startZ = -0.5*containerDepth + diam; - const Real yshift = sqrt(3.0) * particleRadius; + const Real startZ = -static_cast(0.5)*containerDepth + diam; + const Real yshift = sqrt(static_cast(3.0)) * particleRadius; std::vector fluidParticles; fluidParticles.resize(width*height*depth); @@ -297,13 +308,13 @@ void createBreakingDam() model.initModel((unsigned int)fluidParticles.size(), fluidParticles.data(), (unsigned int)boundaryParticles.size(), boundaryParticles.data()); - std::cout << "Number of particles: " << width*height*depth << "\n"; + LOG_INFO << "Number of particles: " << width*height*depth; } void addWall(const Vector3r &minX, const Vector3r &maxX, std::vector &boundaryParticles) { - const Real particleDistance = 2.0*model.getParticleRadius(); + const Real particleDistance = static_cast(2.0)*model.getParticleRadius(); const Vector3r diff = maxX - minX; const unsigned int stepsX = (unsigned int)(diff[0] / particleDistance) + 1u; @@ -422,20 +433,20 @@ void createSphereBuffers(Real radius, int resolution) n[i].normalize(); - glGenBuffersARB(1, &vertexbuffer); - glBindBufferARB(GL_ARRAY_BUFFER_ARB, vertexbuffer); - glBufferDataARB(GL_ARRAY_BUFFER_ARB, v.size() * sizeof(Vector3r), &v[0], GL_STATIC_DRAW); + glGenBuffers(1, &vertexbuffer); + glBindBuffer(GL_ARRAY_BUFFER, vertexbuffer); + glBufferData(GL_ARRAY_BUFFER, v.size() * sizeof(Vector3r), &v[0], GL_STATIC_DRAW); - glGenBuffersARB(1, &normalbuffer); - glBindBufferARB(GL_ARRAY_BUFFER_ARB, normalbuffer); - glBufferDataARB(GL_ARRAY_BUFFER_ARB, n.size() * sizeof(Vector3r), &n[0], GL_STATIC_DRAW); - glBindBufferARB(GL_ARRAY_BUFFER_ARB, 0); + glGenBuffers(1, &normalbuffer); + glBindBuffer(GL_ARRAY_BUFFER, normalbuffer); + glBufferData(GL_ARRAY_BUFFER, n.size() * sizeof(Vector3r), &n[0], GL_STATIC_DRAW); + glBindBuffer(GL_ARRAY_BUFFER, 0); // Generate a buffer for the indices as well - glGenBuffersARB(1, &elementbuffer); - glBindBufferARB(GL_ELEMENT_ARRAY_BUFFER_ARB, elementbuffer); - glBufferDataARB(GL_ELEMENT_ARRAY_BUFFER_ARB, indices.size() * sizeof(unsigned short), &indices[0], GL_STATIC_DRAW); - glBindBufferARB(GL_ELEMENT_ARRAY_BUFFER_ARB, 0); + glGenBuffers(1, &elementbuffer); + glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, elementbuffer); + glBufferData(GL_ELEMENT_ARRAY_BUFFER, indices.size() * sizeof(unsigned short), &indices[0], GL_STATIC_DRAW); + glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, 0); // store the number of indices for later use vertexBufferSize = (unsigned int)indices.size(); @@ -455,20 +466,20 @@ void renderSphere(const Vector3r &x, const float color[]) glMaterialfv(GL_FRONT_AND_BACK, GL_DIFFUSE, color); - glBindBufferARB(GL_ARRAY_BUFFER_ARB, vertexbuffer); + glBindBuffer(GL_ARRAY_BUFFER, vertexbuffer); glVertexPointer(3, GL_REAL, 0, 0); - glBindBufferARB(GL_ARRAY_BUFFER_ARB, normalbuffer); + glBindBuffer(GL_ARRAY_BUFFER, normalbuffer); glNormalPointer(GL_REAL, 0, 0); - glBindBufferARB(GL_ELEMENT_ARRAY_BUFFER_ARB, elementbuffer); + glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, elementbuffer); glPushMatrix(); glTranslated(x[0], x[1], x[2]); glDrawElements(GL_TRIANGLES, (GLsizei)vertexBufferSize, GL_UNSIGNED_SHORT, 0); glPopMatrix(); - glBindBufferARB(GL_ELEMENT_ARRAY_BUFFER_ARB, 0); - glBindBufferARB(GL_ARRAY_BUFFER_ARB, 0); + glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, 0); + glBindBuffer(GL_ARRAY_BUFFER, 0); glDisableClientState(GL_NORMAL_ARRAY); glDisableClientState(GL_VERTEX_ARRAY); @@ -478,52 +489,17 @@ void releaseSphereBuffers() { if (elementbuffer != 0) { - glDeleteBuffersARB(1, &elementbuffer); + glDeleteBuffers(1, &elementbuffer); elementbuffer = 0; } if (normalbuffer != 0) { - glDeleteBuffersARB(1, &normalbuffer); + glDeleteBuffers(1, &normalbuffer); normalbuffer = 0; } if (vertexbuffer != 0) { - glDeleteBuffersARB(1, &vertexbuffer); + glDeleteBuffers(1, &vertexbuffer); vertexbuffer = 0; } } - - -void TW_CALL setTimeStep(const void *value, void *clientData) -{ - const Real val = *(const Real *)(value); - TimeManager::getCurrent()->setTimeStepSize(val); -} - -void TW_CALL getTimeStep(void *value, void *clientData) -{ - *(Real *)(value) = TimeManager::getCurrent()->getTimeStepSize(); -} - -void TW_CALL setVelocityUpdateMethod(const void *value, void *clientData) -{ - const short val = *(const short *)(value); - ((TimeStepFluidModel*)clientData)->setVelocityUpdateMethod((unsigned int)val); -} - -void TW_CALL getVelocityUpdateMethod(void *value, void *clientData) -{ - *(short *)(value) = (short)((TimeStepFluidModel*)clientData)->getVelocityUpdateMethod(); -} - -void TW_CALL setViscosity(const void *value, void *clientData) -{ - const Real val = *(const Real *)(value); - ((FluidModel*)clientData)->setViscosity(val); -} - -void TW_CALL getViscosity(void *value, void *clientData) -{ - *(Real *)(value) = ((FluidModel*)clientData)->getViscosity(); -} - diff --git a/Demos/GenericConstraintsDemos/CMakeLists.txt b/Demos/GenericConstraintsDemos/CMakeLists.txt index 627e2f19..d8a18f8b 100644 --- a/Demos/GenericConstraintsDemos/CMakeLists.txt +++ b/Demos/GenericConstraintsDemos/CMakeLists.txt @@ -1,20 +1,28 @@ -set(SIMULATION_LINK_LIBRARIES AntTweakBar glew PositionBasedDynamics Simulation) -set(SIMULATION_DEPENDENCIES AntTweakBar glew PositionBasedDynamics Simulation) +set(SIMULATION_LINK_LIBRARIES imgui glfw PositionBasedDynamics Simulation Utils) +set(SIMULATION_DEPENDENCIES imgui glfw PositionBasedDynamics Simulation Utils CopyPBDShaders CopyPBDModels CopyImguiFonts) if(WIN32) - set(SIMULATION_LINK_LIBRARIES freeglut opengl32.lib glu32.lib ${SIMULATION_LINK_LIBRARIES}) - set(SIMULATION_DEPENDENCIES freeglut ${SIMULATION_DEPENDENCIES}) + set(SIMULATION_LINK_LIBRARIES opengl32.lib glu32.lib ${SIMULATION_LINK_LIBRARIES}) + #set(SIMULATION_DEPENDENCIES ${SIMULATION_DEPENDENCIES}) else() - find_package(GLUT REQUIRED) + set(OpenGL_GL_PREFERENCE GLVND) find_package(OpenGL REQUIRED) + include_directories( ${OPENGL_INCLUDE_DIRS}) set(SIMULATION_LINK_LIBRARIES ${SIMULATION_LINK_LIBRARIES} - ${GLUT_LIBRARIES} ${OPENGL_LIBRARIES} ) endif() +############################################################ +# GenericParameters +############################################################ +include_directories(${GenericParameters_INCLUDE_DIR}) +if(TARGET Ext_GenericParameters) + set(SIMULATION_DEPENDENCIES ${SIMULATION_DEPENDENCIES} Ext_GenericParameters) +endif() + add_executable(GenericParticleConstraintsDemo GenericParticleConstraintsDemo.cpp @@ -22,23 +30,44 @@ add_executable(GenericParticleConstraintsDemo GenericConstraintsModel.h GenericConstraints.cpp GenericConstraints.h + + ../Common/LogWindow.cpp + ../Common/LogWindow.h + ../Common/Simulator_GUI_imgui.cpp + ../Common/Simulator_GUI_imgui.h + ../Common/imguiParameters.cpp + ../Common/imguiParameters.h + ../Common/DemoBase.cpp + ../Common/DemoBase.h ${VIS_FILES} ${PROJECT_PATH}/Common/Common.h - ${PROJECT_PATH}/Demos/Common/Config.h - ${PROJECT_PATH}/Demos/Utils/IndexedFaceMesh.cpp - ${PROJECT_PATH}/Demos/Utils/IndexedFaceMesh.h - ${PROJECT_PATH}/Demos/Utils/IndexedTetMesh.cpp - ${PROJECT_PATH}/Demos/Utils/IndexedTetMesh.h - ${PROJECT_PATH}/Demos/Utils/Utilities.cpp - ${PROJECT_PATH}/Demos/Utils/Utilities.h - ${PROJECT_PATH}/Demos/Utils/VolumeIntegration.cpp - ${PROJECT_PATH}/Demos/Utils/VolumeIntegration.h CMakeLists.txt ) -add_definitions(-DTW_NO_LIB_PRAGMA -DTW_STATIC) +add_executable(GenericRigidBodyConstraintsDemo + GenericRigidBodyConstraintsDemo.cpp + + GenericConstraintsModel.cpp + GenericConstraintsModel.h + GenericConstraints.cpp + GenericConstraints.h + + ../Common/LogWindow.cpp + ../Common/LogWindow.h + ../Common/Simulator_GUI_imgui.cpp + ../Common/Simulator_GUI_imgui.h + ../Common/imguiParameters.cpp + ../Common/imguiParameters.h + ../Common/DemoBase.cpp + ../Common/DemoBase.h + + ${VIS_FILES} + ${PROJECT_PATH}/Common/Common.h + + CMakeLists.txt +) find_package( Eigen3 REQUIRED ) include_directories( ${EIGEN3_INCLUDE_DIR} ) @@ -51,4 +80,12 @@ set_target_properties(GenericParticleConstraintsDemo PROPERTIES RELWITHDEBINFO_P set_target_properties(GenericParticleConstraintsDemo PROPERTIES MINSIZEREL_POSTFIX ${CMAKE_MINSIZEREL_POSTFIX}) add_dependencies(GenericParticleConstraintsDemo ${SIMULATION_DEPENDENCIES}) target_link_libraries(GenericParticleConstraintsDemo ${SIMULATION_LINK_LIBRARIES}) + +set_target_properties(GenericRigidBodyConstraintsDemo PROPERTIES FOLDER "Demos") +set_target_properties(GenericRigidBodyConstraintsDemo PROPERTIES DEBUG_POSTFIX ${CMAKE_DEBUG_POSTFIX}) +set_target_properties(GenericRigidBodyConstraintsDemo PROPERTIES RELWITHDEBINFO_POSTFIX ${CMAKE_RELWITHDEBINFO_POSTFIX}) +set_target_properties(GenericRigidBodyConstraintsDemo PROPERTIES MINSIZEREL_POSTFIX ${CMAKE_MINSIZEREL_POSTFIX}) +add_dependencies(GenericRigidBodyConstraintsDemo ${SIMULATION_DEPENDENCIES}) +target_link_libraries(GenericRigidBodyConstraintsDemo ${SIMULATION_LINK_LIBRARIES}) + VIS_SOURCE_GROUPS() diff --git a/Demos/GenericConstraintsDemos/GenericConstraints.cpp b/Demos/GenericConstraintsDemos/GenericConstraints.cpp index bb15d108..a89bbc27 100644 --- a/Demos/GenericConstraintsDemos/GenericConstraints.cpp +++ b/Demos/GenericConstraintsDemos/GenericConstraints.cpp @@ -1,13 +1,16 @@ #include "GenericConstraints.h" -#include "Demos/Simulation/SimulationModel.h" +#include "Simulation/SimulationModel.h" #include "PositionBasedDynamics/PositionBasedGenericConstraints.h" #include "PositionBasedDynamics/MathFunctions.h" -#include "Demos/Simulation/IDFactory.h" +#include "Simulation/IDFactory.h" using namespace PBD; int GenericDistanceConstraint::TYPE_ID = IDFactory::getId(); int GenericIsometricBendingConstraint::TYPE_ID = IDFactory::getId(); +int GenericHingeJoint::TYPE_ID = IDFactory::getId(); +int GenericBallJoint::TYPE_ID = IDFactory::getId(); +int GenericSliderJoint::TYPE_ID = IDFactory::getId(); ////////////////////////////////////////////////////////////////////////// @@ -40,8 +43,9 @@ void GenericDistanceConstraint::gradientFct( jacobian = n.transpose(); } -bool GenericDistanceConstraint::initConstraint(SimulationModel &model, const unsigned int particle1, const unsigned int particle2) +bool GenericDistanceConstraint::initConstraint(SimulationModel &model, const unsigned int particle1, const unsigned int particle2, const Real stiffness) { + m_stiffness = stiffness; m_bodies[0] = particle1; m_bodies[1] = particle2; ParticleData &pd = model.getParticles(); @@ -54,7 +58,7 @@ bool GenericDistanceConstraint::initConstraint(SimulationModel &model, const uns return true; } -bool GenericDistanceConstraint::solvePositionConstraint(SimulationModel &model) +bool GenericDistanceConstraint::solvePositionConstraint(SimulationModel &model, const unsigned int iter) { ParticleData &pd = model.getParticles(); @@ -78,7 +82,7 @@ bool GenericDistanceConstraint::solvePositionConstraint(SimulationModel &model) if (res) { - const Real stiffness = model.getClothStiffness(); + const Real stiffness = m_stiffness; if (invMass1 != 0.0) x1 += stiffness * corr[0]; if (invMass2 != 0.0) @@ -95,24 +99,25 @@ bool GenericDistanceConstraint::solvePositionConstraint(SimulationModel &model) void GenericIsometricBendingConstraint::constraintFct( const unsigned int numberOfParticles, const Real invMass[], - const Eigen::Vector3d x[], + const Vector3r x[], void *userData, - Eigen::Matrix &constraintValue) + Eigen::Matrix &constraintValue) { Matrix4r *Q = (Matrix4r*)userData; - double energy = 0.0; + Real energy = 0.0; for (unsigned char k = 0; k < 4; k++) for (unsigned char j = 0; j < 4; j++) - energy += (double) (*Q)(j, k)*(x[k].dot(x[j])); - energy *= 0.5; + energy += (*Q)(j, k)*(x[k].dot(x[j])); + energy *= static_cast(0.5); constraintValue(0, 0) = energy; } bool GenericIsometricBendingConstraint::initConstraint(SimulationModel &model, const unsigned int particle1, const unsigned int particle2, - const unsigned int particle3, const unsigned int particle4) + const unsigned int particle3, const unsigned int particle4, const Real stiffness) { + m_stiffness = stiffness; m_bodies[0] = particle3; m_bodies[1] = particle4; m_bodies[2] = particle1; @@ -138,10 +143,10 @@ bool GenericIsometricBendingConstraint::initConstraint(SimulationModel &model, c const Real c03 = MathFunctions::cotTheta(-e0, e3); const Real c04 = MathFunctions::cotTheta(-e0, e4); - const Real A0 = 0.5 * (e0.cross(e1)).norm(); - const Real A1 = 0.5 * (e0.cross(e2)).norm(); + const Real A0 = static_cast(0.5) * (e0.cross(e1)).norm(); + const Real A1 = static_cast(0.5) * (e0.cross(e2)).norm(); - const Real coef = -3.0 / (2.0*(A0 + A1)); + const Real coef = -static_cast(3.0) / (static_cast(2.0)*(A0 + A1)); const Real K[4] = { c03 + c04, c01 + c02, -c01 - c03, -c02 - c04 }; const Real K2[4] = { coef*K[0], coef*K[1], coef*K[2], coef*K[3] }; @@ -157,7 +162,7 @@ bool GenericIsometricBendingConstraint::initConstraint(SimulationModel &model, c return true; } -bool GenericIsometricBendingConstraint::solvePositionConstraint(SimulationModel &model) +bool GenericIsometricBendingConstraint::solvePositionConstraint(SimulationModel &model, const unsigned int iter) { ParticleData &pd = model.getParticles(); @@ -177,27 +182,489 @@ bool GenericIsometricBendingConstraint::solvePositionConstraint(SimulationModel Real invMass[4] = { invMass0, invMass1, invMass2, invMass3 }; const Vector3r x[4] = { x0, x1, x2, x3 }; - - Vector3r corr[4]; - + + Vector3r corr[4]; + const bool res = PositionBasedGenericConstraints::solve_GenericConstraint<4, 1>( invMass, x, &m_Q, GenericIsometricBendingConstraint::constraintFct, //GenericIsometricBendingConstraint::gradientFct, - corr); - - if (res) - { - const Real stiffness = model.getClothBendingStiffness(); - if (invMass0 != 0.0) - x0 += stiffness*corr[0]; - if (invMass1 != 0.0) - x1 += stiffness*corr[1]; + corr); + + if (res) + { + if (invMass0 != 0.0) + x0 += m_stiffness*corr[0]; + if (invMass1 != 0.0) + x1 += m_stiffness *corr[1]; if (invMass2 != 0.0) - x2 += stiffness*corr[2]; + x2 += m_stiffness *corr[2]; if (invMass3 != 0.0) - x3 += stiffness*corr[3]; - } + x3 += m_stiffness *corr[3]; + } + return res; +} + +////////////////////////////////////////////////////////////////////////// +// GenericHingeJoint +////////////////////////////////////////////////////////////////////////// + +void GenericHingeJoint::constraintFct( + const unsigned int numberOfRigidBodies, + const Real mass[], + const Vector3r x[], + const Matrix3r inertiaInverseW[], + const Quaternionr q[], + void *userData, + Eigen::Matrix &constraintValue) +{ + Eigen::Matrix &jointInfo = *(Eigen::Matrix*)userData; + + const Vector3r &c0 = jointInfo.col(6); + const Vector3r &c1 = jointInfo.col(7); + const Vector3r &axis1 = jointInfo.col(11); + const Vector3r &t1 = jointInfo.col(9); + const Vector3r &t2 = jointInfo.col(10); + + constraintValue.block<3, 1>(0, 0) = c0 - c1; + constraintValue(3, 0) = t1.dot(axis1); + constraintValue(4, 0) = t2.dot(axis1); +} + +void GenericHingeJoint::gradientFct( + const unsigned int i, + const unsigned int numberOfRigidBodies, + const Real mass[], + const Vector3r x[], + const Matrix3r inertiaInverseW[], + const Quaternionr q[], + void *userData, + Eigen::Matrix &jacobian) +{ + Eigen::Matrix &jointInfo = *(Eigen::Matrix*)userData; + + const Vector3r &c0 = jointInfo.col(6); + const Vector3r &c1 = jointInfo.col(7); + const Vector3r &axis1 = jointInfo.col(11); + const Vector3r &t1 = jointInfo.col(9); + const Vector3r &t2 = jointInfo.col(10); + + const Vector3r r0 = c0 - x[0]; + const Vector3r r1 = c1 - x[1]; + Matrix3r r_star; + if (i==0) + MathFunctions::crossProductMatrix(r0, r_star); + else + MathFunctions::crossProductMatrix(r1, r_star); + + const Vector3r u1 = t1.cross(axis1); + const Vector3r u2 = t2.cross(axis1); + + // Jacobian: + // + // (I_3 -r*) + // (0 u1^T) + // (0 u2^T) + + jacobian.setZero(); + + if (i == 0) + { + jacobian.block<3, 3>(0, 0) = Matrix3r::Identity(); + jacobian.block<3, 3>(0, 3) = -r_star; + jacobian.block<1, 3>(3, 3) = u1.transpose(); + jacobian.block<1, 3>(4, 3) = u2.transpose(); + } + else + { + jacobian.block<3, 3>(0, 0) = -Matrix3r::Identity(); + jacobian.block<3, 3>(0, 3) = r_star; + jacobian.block<1, 3>(3, 3) = -u1.transpose(); + jacobian.block<1, 3>(4, 3) = -u2.transpose(); + } +} + +bool GenericHingeJoint::initConstraint(SimulationModel &model, const unsigned int rbIndex1, const unsigned int rbIndex2, const Vector3r &pos, const Vector3r &axis) +{ + m_bodies[0] = rbIndex1; + m_bodies[1] = rbIndex2; + + SimulationModel::RigidBodyVector &rb = model.getRigidBodies(); + RigidBody *rb0 = rb[rbIndex1]; + RigidBody *rb1 = rb[rbIndex2]; + + const Vector3r &x0 = rb0->getPosition(); + const Vector3r &x1 = rb1->getPosition(); + const Quaternionr &q0 = rb0->getRotation(); + const Quaternionr &q1 = rb1->getRotation(); + + // jointInfo contains + // 0: connector in body 0 (local) + // 1: connector in body 1 (local) + // 2-4: coordinate system of body 0 (local) + // 5: joint axis in body 1 (local) + // 6: connector in body 0 (global) + // 7: connector in body 1 (global) + // 8-10:coordinate system of body 0 (global) + // 11: joint axis in body 1 (global) + + // transform in local coordinates + const Matrix3r rot0T = q0.matrix().transpose(); + const Matrix3r rot1T = q1.matrix().transpose(); + + // connector in body 0 (local) + m_jointInfo.col(0) = rot0T * (pos - x0); + // connector in body 1 (local) + m_jointInfo.col(1) = rot1T * (pos - x1); + // connector in body 0 (global) + m_jointInfo.col(6) = pos; + // connector in body 1 (global) + m_jointInfo.col(7) = pos; + + // determine constraint coordinate system + // with direction as x-axis + m_jointInfo.col(8) = axis; + m_jointInfo.col(8).normalize(); + + Vector3r v(1.0, 0.0, 0.0); + // check if vectors are parallel + if (fabs(v.dot(m_jointInfo.col(8))) > 0.99) + v = Vector3r(0.0, 1.0, 0.0); + + m_jointInfo.col(9) = m_jointInfo.col(8).cross(v); + m_jointInfo.col(10) = m_jointInfo.col(8).cross(m_jointInfo.col(9)); + m_jointInfo.col(9).normalize(); + m_jointInfo.col(10).normalize(); + + // joint axis in body 1 (global) + m_jointInfo.col(11) = m_jointInfo.col(8); + + // coordinate system of body 0 (local) + m_jointInfo.block<3, 3>(0, 2) = rot0T * m_jointInfo.block<3, 3>(0, 8); + + // joint axis in body 1 (local) + m_jointInfo.col(5) = rot1T * m_jointInfo.col(11); + + return true; +} + +bool GenericHingeJoint::updateConstraint(SimulationModel &model) +{ + SimulationModel::RigidBodyVector &rb = model.getRigidBodies(); + RigidBody *rb0 = rb[m_bodies[0]]; + RigidBody *rb1 = rb[m_bodies[1]]; + + const Vector3r &x0 = rb0->getPosition(); + const Vector3r &x1 = rb1->getPosition(); + const Quaternionr &q0 = rb0->getRotation(); + const Quaternionr &q1 = rb1->getRotation(); + + // jointInfo contains + // 0: connector in body 0 (local) + // 1: connector in body 1 (local) + // 2-4: coordinate system of body 0 (local) + // 5: joint axis in body 1 (local) + // 6: connector in body 0 (global) + // 7: connector in body 1 (global) + // 8-10:coordinate system of body 0 (global) + // 11: joint axis in body 1 (global) + + // compute world space positions of connectors + const Matrix3r rot0 = q0.matrix(); + const Matrix3r rot1 = q1.matrix(); + m_jointInfo.col(6) = rot0 * m_jointInfo.col(0) + x0; + m_jointInfo.col(7) = rot1 * m_jointInfo.col(1) + x1; + + // transform constraint coordinate system of body 0 to world space + m_jointInfo.block<3, 3>(0, 8) = rot0 * m_jointInfo.block<3, 3>(0, 2); + // transform joint axis of body 1 to world space + m_jointInfo.col(11) = rot1 * m_jointInfo.col(5); + + return true; +} + +bool GenericHingeJoint::solvePositionConstraint(SimulationModel &model, const unsigned int iter) +{ + SimulationModel::RigidBodyVector &rb = model.getRigidBodies(); + RigidBody *rb0 = rb[m_bodies[0]]; + RigidBody *rb1 = rb[m_bodies[1]]; + + const Matrix3r &inertiaInverseW0 = rb0->getInertiaTensorInverseW(); + const Matrix3r &inertiaInverseW1 = rb1->getInertiaTensorInverseW(); + const Real invMass0 = rb0->getInvMass(); + const Real invMass1 = rb1->getInvMass(); + Vector3r &x0 = rb0->getPosition(); + Vector3r &x1 = rb1->getPosition(); + Quaternionr &q0 = rb0->getRotation(); + Quaternionr &q1 = rb1->getRotation(); + + const Real invMass[2] = { invMass0, invMass1 }; + const Vector3r x[2] = { x0, x1 }; + const Quaternionr q[2] = { q0, q1 }; + const Matrix3r inertiaInverseW[2] = { inertiaInverseW0, inertiaInverseW1 }; + + Vector3r corrX[2]; + Quaternionr corrQ[2]; + const bool res = PositionBasedGenericConstraints::solve_GenericConstraint<2, 5>( + invMass, x, inertiaInverseW, q, &m_jointInfo, + GenericHingeJoint::constraintFct, + GenericHingeJoint::gradientFct, + corrX, corrQ); + + if (res) + { + if (invMass0 != 0.0) + { + x0 += corrX[0]; + q0.coeffs() += corrQ[0].coeffs(); + q0.normalize(); + rb0->rotationUpdated(); + } + if (invMass1 != 0.0) + { + x1 += corrX[1]; + q1.coeffs() += corrQ[1].coeffs(); + q1.normalize(); + rb1->rotationUpdated(); + } + } return res; } + +////////////////////////////////////////////////////////////////////////// +// GenericBallJoint +////////////////////////////////////////////////////////////////////////// + +void GenericBallJoint::constraintFct( + const unsigned int numberOfRigidBodies, + const Real mass[], + const Vector3r x[], + const Matrix3r inertiaInverseW[], + const Quaternionr q[], + void *userData, + Eigen::Matrix &constraintValue) +{ + Eigen::Matrix &jointInfo = *(Eigen::Matrix*)userData; + + const Vector3r c0 = q[0].matrix() * jointInfo.col(0) + x[0]; + const Vector3r c1 = q[1].matrix() * jointInfo.col(1) + x[1]; + + constraintValue = c0 - c1; +} + +bool GenericBallJoint::initConstraint(SimulationModel &model, const unsigned int rbIndex1, const unsigned int rbIndex2, const Vector3r &pos) +{ + m_bodies[0] = rbIndex1; + m_bodies[1] = rbIndex2; + + SimulationModel::RigidBodyVector &rb = model.getRigidBodies(); + RigidBody *rb0 = rb[rbIndex1]; + RigidBody *rb1 = rb[rbIndex2]; + + const Vector3r &x0 = rb0->getPosition(); + const Vector3r &x1 = rb1->getPosition(); + const Quaternionr &q0 = rb0->getRotation(); + const Quaternionr &q1 = rb1->getRotation(); + + // jointInfo contains + // 0: connector in body 0 (local) + // 1: connector in body 1 (local) + + // transform in local coordinates + const Matrix3r rot0T = q0.matrix().transpose(); + const Matrix3r rot1T = q1.matrix().transpose(); + + m_jointInfo.col(0) = rot0T * (pos - x0); + m_jointInfo.col(1) = rot1T * (pos - x1); + + return true; +} + +bool GenericBallJoint::solvePositionConstraint(SimulationModel &model, const unsigned int iter) +{ + SimulationModel::RigidBodyVector &rb = model.getRigidBodies(); + RigidBody *rb0 = rb[m_bodies[0]]; + RigidBody *rb1 = rb[m_bodies[1]]; + + const Matrix3r &inertiaInverseW0 = rb0->getInertiaTensorInverseW(); + const Matrix3r &inertiaInverseW1 = rb1->getInertiaTensorInverseW(); + const Real invMass0 = rb0->getInvMass(); + const Real invMass1 = rb1->getInvMass(); + Vector3r &x0 = rb0->getPosition(); + Vector3r &x1 = rb1->getPosition(); + Quaternionr &q0 = rb0->getRotation(); + Quaternionr &q1 = rb1->getRotation(); + + const Real invMass[2] = { invMass0, invMass1 }; + const Vector3r x[2] = { x0, x1 }; + const Quaternionr q[2] = { q0, q1 }; + const Matrix3r inertiaInverseW[2] = { inertiaInverseW0, inertiaInverseW1 }; + + Vector3r corrX[2]; + Quaternionr corrQ[2]; + const bool res = PositionBasedGenericConstraints::solve_GenericConstraint<2, 3>( + invMass, x, inertiaInverseW, q, &m_jointInfo, + GenericBallJoint::constraintFct, + corrX, corrQ); + + if (res) + { + if (invMass0 != 0.0) + { + x0 += corrX[0]; + q0.coeffs() += corrQ[0].coeffs(); + q0.normalize(); + rb0->rotationUpdated(); + } + if (invMass1 != 0.0) + { + x1 += corrX[1]; + q1.coeffs() += corrQ[1].coeffs(); + q1.normalize(); + rb1->rotationUpdated(); + } + } + return res; +} + +////////////////////////////////////////////////////////////////////////// +// GenericSliderJoint +////////////////////////////////////////////////////////////////////////// + +void GenericSliderJoint::constraintFct( + const unsigned int numberOfRigidBodies, + const Real mass[], + const Vector3r x[], + const Matrix3r inertiaInverseW[], + const Quaternionr q[], + void *userData, + Eigen::Matrix &constraintValue) +{ + Eigen::Matrix &jointInfo = *(Eigen::Matrix*)userData; + + const Vector3r c0 = q[0].matrix() * jointInfo.col(0) + x[0]; + const Vector3r c1 = q[1].matrix() * jointInfo.col(1) + x[1]; + const Vector3r axis0 = q[0].matrix() * jointInfo.col(2); + const Vector3r axis1 = q[1].matrix() * jointInfo.col(5); + const Vector3r u = axis0.cross(axis1); + const Vector3r t1 = q[0].matrix() * jointInfo.col(3); + const Vector3r t2 = q[0].matrix() * jointInfo.col(4); + const Vector3r t3 = q[1].matrix() * jointInfo.col(6); + + // projection + Eigen::Matrix P; + P.row(0) = t1.transpose(); + P.row(1) = t2.transpose(); + + constraintValue.block<2, 1>(0, 0) = P * (c0 - c1); + constraintValue(2, 0) = t1.dot(axis1); + constraintValue(3, 0) = t2.dot(axis1); + constraintValue(4, 0) = t2.dot(t3); +} + +bool GenericSliderJoint::initConstraint(SimulationModel &model, const unsigned int rbIndex1, const unsigned int rbIndex2, const Vector3r &pos, const Vector3r &axis) +{ + m_bodies[0] = rbIndex1; + m_bodies[1] = rbIndex2; + + SimulationModel::RigidBodyVector &rb = model.getRigidBodies(); + RigidBody *rb0 = rb[rbIndex1]; + RigidBody *rb1 = rb[rbIndex2]; + + const Vector3r &x0 = rb0->getPosition(); + const Vector3r &x1 = rb1->getPosition(); + const Quaternionr &q0 = rb0->getRotation(); + const Quaternionr &q1 = rb1->getRotation(); + + // jointInfo contains + // 0: connector in body 0 (local) + // 1: connector in body 1 (local) + // 2-4: coordinate system of body 0 (local) + // 5: joint axis in body 1 (local) + // 6: perpendicular vector on joint axis (normalized) in body 1 (local) + + // transform in local coordinates + const Matrix3r rot0T = q0.matrix().transpose(); + const Matrix3r rot1T = q1.matrix().transpose(); + + // connector in body 0 (local) + m_jointInfo.col(0) = rot0T * (pos - x0); + // connector in body 1 (local) + m_jointInfo.col(1) = rot1T * (pos - x1); + + // determine constraint coordinate system + // with direction as x-axis + Matrix3r A; + A.col(0) = axis; + A.col(0).normalize(); + + Vector3r v(1.0, 0.0, 0.0); + // check if vectors are parallel + if (fabs(v.dot(A.col(0))) > 0.99) + v = Vector3r(0.0, 1.0, 0.0); + + A.col(1) = A.col(0).cross(v); + A.col(2) = A.col(0).cross(A.col(1)); + A.col(1).normalize(); + A.col(2).normalize(); + + // coordinate system of body 0 (local) + m_jointInfo.block<3, 3>(0, 2) = rot0T * A; + + // joint axis in body 1 (local) + m_jointInfo.col(5) = rot1T * A.col(0); + + // perpendicular vector on joint axis(normalized) in body 1 (local) + m_jointInfo.col(6) = rot1T * A.col(1); + + return true; +} + + +bool GenericSliderJoint::solvePositionConstraint(SimulationModel &model, const unsigned int iter) +{ + SimulationModel::RigidBodyVector &rb = model.getRigidBodies(); + RigidBody *rb0 = rb[m_bodies[0]]; + RigidBody *rb1 = rb[m_bodies[1]]; + + const Matrix3r &inertiaInverseW0 = rb0->getInertiaTensorInverseW(); + const Matrix3r &inertiaInverseW1 = rb1->getInertiaTensorInverseW(); + const Real invMass0 = rb0->getInvMass(); + const Real invMass1 = rb1->getInvMass(); + Vector3r &x0 = rb0->getPosition(); + Vector3r &x1 = rb1->getPosition(); + Quaternionr &q0 = rb0->getRotation(); + Quaternionr &q1 = rb1->getRotation(); + + const Real invMass[2] = { invMass0, invMass1 }; + const Vector3r x[2] = { x0, x1 }; + const Quaternionr q[2] = { q0, q1 }; + const Matrix3r inertiaInverseW[2] = { inertiaInverseW0, inertiaInverseW1 }; + + Vector3r corrX[2]; + Quaternionr corrQ[2]; + const bool res = PositionBasedGenericConstraints::solve_GenericConstraint<2, 5>( + invMass, x, inertiaInverseW, q, &m_jointInfo, + GenericSliderJoint::constraintFct, + corrX, corrQ); + + if (res) + { + if (invMass0 != 0.0) + { + x0 += corrX[0]; + q0.coeffs() += corrQ[0].coeffs(); + q0.normalize(); + rb0->rotationUpdated(); + } + if (invMass1 != 0.0) + { + x1 += corrX[1]; + q1.coeffs() += corrQ[1].coeffs(); + q1.normalize(); + rb1->rotationUpdated(); + } + } + return res; +} diff --git a/Demos/GenericConstraintsDemos/GenericConstraints.h b/Demos/GenericConstraintsDemos/GenericConstraints.h index a91e45f4..5bdbbf8b 100644 --- a/Demos/GenericConstraintsDemos/GenericConstraints.h +++ b/Demos/GenericConstraintsDemos/GenericConstraints.h @@ -1,9 +1,8 @@ #ifndef _GENERICCONSTRAINTS_H #define _GENERICCONSTRAINTS_H -#include "Demos/Common/Config.h" #include -#include "Demos/Simulation/Constraints.h" +#include "Simulation/Constraints.h" namespace PBD { @@ -14,6 +13,7 @@ namespace PBD public: static int TYPE_ID; Real m_restLength; + Real m_stiffness; static void constraintFct( const unsigned int numberOfParticles, @@ -33,8 +33,8 @@ namespace PBD GenericDistanceConstraint() : Constraint(2) {} virtual int &getTypeId() const { return TYPE_ID; } - virtual bool initConstraint(SimulationModel &model, const unsigned int particle1, const unsigned int particle2); - virtual bool solvePositionConstraint(SimulationModel &model); + virtual bool initConstraint(SimulationModel &model, const unsigned int particle1, const unsigned int particle2, const Real stiffness); + virtual bool solvePositionConstraint(SimulationModel &model, const unsigned int iter); }; class GenericIsometricBendingConstraint : public Constraint @@ -42,20 +42,98 @@ namespace PBD public: static int TYPE_ID; Matrix4r m_Q; + Real m_stiffness; static void constraintFct( const unsigned int numberOfParticles, const Real invMass[], - const Eigen::Vector3d x[], + const Vector3r x[], void *userData, - Eigen::Matrix &constraintValue); + Eigen::Matrix &constraintValue); GenericIsometricBendingConstraint() : Constraint(4) {} virtual int &getTypeId() const { return TYPE_ID; } - virtual bool initConstraint(SimulationModel &model, const unsigned int particle1, const unsigned int particle2, - const unsigned int particle3, const unsigned int particle4); - virtual bool solvePositionConstraint(SimulationModel &model); + virtual bool initConstraint(SimulationModel &model, const unsigned int particle1, const unsigned int particle2, + const unsigned int particle3, const unsigned int particle4, const Real stiffness); + virtual bool solvePositionConstraint(SimulationModel &model, const unsigned int iter); + }; + + class GenericHingeJoint : public Constraint + { + public: + static int TYPE_ID; + Eigen::Matrix m_jointInfo; + + static void constraintFct( + const unsigned int numberOfRigidBodies, + const Real invMass[], // inverse mass is zero if body is static + const Vector3r x[], // positions of bodies + const Matrix3r inertiaInverseW[], // inverse inertia tensor (world space) of bodies + const Quaternionr q[], + void *userData, + Eigen::Matrix &constraintValue); + + static void gradientFct( + const unsigned int i, + const unsigned int numberOfRigidBodies, + const Real invMass[], + const Vector3r x[], + const Matrix3r inertiaInverseW[], + const Quaternionr q[], + void *userData, + Eigen::Matrix &jacobian); + + GenericHingeJoint() : Constraint(2) {} + virtual int &getTypeId() const { return TYPE_ID; } + + virtual bool initConstraint(SimulationModel &model, const unsigned int rbIndex1, const unsigned int rbIndex2, const Vector3r &pos, const Vector3r &axis); + virtual bool updateConstraint(SimulationModel &model); + virtual bool solvePositionConstraint(SimulationModel &model, const unsigned int iter); + }; + + class GenericBallJoint : public Constraint + { + public: + static int TYPE_ID; + Eigen::Matrix m_jointInfo; + + static void constraintFct( + const unsigned int numberOfRigidBodies, + const Real invMass[], // inverse mass is zero if body is static + const Vector3r x[], // positions of bodies + const Matrix3r inertiaInverseW[], // inverse inertia tensor (world space) of bodies + const Quaternionr q[], + void *userData, + Eigen::Matrix &constraintValue); + + GenericBallJoint() : Constraint(2) {} + virtual int &getTypeId() const { return TYPE_ID; } + + virtual bool initConstraint(SimulationModel &model, const unsigned int rbIndex1, const unsigned int rbIndex2, const Vector3r &pos); + virtual bool solvePositionConstraint(SimulationModel &model, const unsigned int iter); + }; + + class GenericSliderJoint : public Constraint + { + public: + static int TYPE_ID; + Eigen::Matrix m_jointInfo; + + static void constraintFct( + const unsigned int numberOfRigidBodies, + const Real invMass[], // inverse mass is zero if body is static + const Vector3r x[], // positions of bodies + const Matrix3r inertiaInverseW[], // inverse inertia tensor (world space) of bodies + const Quaternionr q[], + void *userData, + Eigen::Matrix &constraintValue); + + GenericSliderJoint() : Constraint(2) {} + virtual int &getTypeId() const { return TYPE_ID; } + + virtual bool initConstraint(SimulationModel &model, const unsigned int rbIndex1, const unsigned int rbIndex2, const Vector3r &pos, const Vector3r &axis); + virtual bool solvePositionConstraint(SimulationModel &model, const unsigned int iter); }; } diff --git a/Demos/GenericConstraintsDemos/GenericConstraintsModel.cpp b/Demos/GenericConstraintsDemos/GenericConstraintsModel.cpp index 610433a9..c7ffdc61 100644 --- a/Demos/GenericConstraintsDemos/GenericConstraintsModel.cpp +++ b/Demos/GenericConstraintsDemos/GenericConstraintsModel.cpp @@ -3,7 +3,7 @@ #include "GenericConstraints.h" using namespace PBD; - +using namespace GenParam; GenericConstraintsModel::GenericConstraintsModel() : SimulationModel() @@ -14,21 +14,75 @@ GenericConstraintsModel::~GenericConstraintsModel(void) { } -bool GenericConstraintsModel::addGenericDistanceConstraint(const unsigned int particle1, const unsigned int particle2) +void GenericConstraintsModel::initParameters() +{ + ParameterObject::initParameters(); + + CLOTH_STIFFNESS = createNumericParameter("cloth_stiffness", "Distance constraint stiffness", std::bind(&SimulationModel::getClothStiffness, this), std::bind(static_cast(&SimulationModel::setClothStiffness), this, std::placeholders::_1)); + setGroup(CLOTH_STIFFNESS, "Cloth"); + setDescription(CLOTH_STIFFNESS, "Distance constraint stiffness"); + static_cast*>(getParameter(CLOTH_STIFFNESS))->setMinValue(0.0); + + CLOTH_BENDING_STIFFNESS = createNumericParameter("cloth_bendingStiffness", "Bending stiffness", std::bind(&SimulationModel::getClothBendingStiffness, this), std::bind(static_cast(&SimulationModel::setClothBendingStiffness), this, std::placeholders::_1)); + setGroup(CLOTH_BENDING_STIFFNESS, "Cloth"); + setDescription(CLOTH_BENDING_STIFFNESS, "Bending stiffness of cloth models."); + static_cast*>(getParameter(CLOTH_BENDING_STIFFNESS))->setMinValue(0.0); +} + +bool GenericConstraintsModel::addGenericDistanceConstraint(const unsigned int particle1, const unsigned int particle2, const Real stiffness) { GenericDistanceConstraint *c = new GenericDistanceConstraint(); - const bool res = c->initConstraint(*this, particle1, particle2); + const bool res = c->initConstraint(*this, particle1, particle2, stiffness); if (res) m_constraints.push_back(c); return res; } bool GenericConstraintsModel::addGenericIsometricBendingConstraint(const unsigned int particle1, const unsigned int particle2, - const unsigned int particle3, const unsigned int particle4) + const unsigned int particle3, const unsigned int particle4, const Real stiffness) { GenericIsometricBendingConstraint *c = new GenericIsometricBendingConstraint(); - const bool res = c->initConstraint(*this, particle1, particle2, particle3, particle4); + const bool res = c->initConstraint(*this, particle1, particle2, particle3, particle4, stiffness); + if (res) + m_constraints.push_back(c); + return res; +} + +bool GenericConstraintsModel::addGenericHingeJoint(const unsigned int rbIndex1, const unsigned int rbIndex2, const Vector3r &pos, const Vector3r &axis) +{ + GenericHingeJoint *c = new GenericHingeJoint(); + const bool res = c->initConstraint(*this, rbIndex1, rbIndex2, pos, axis); if (res) m_constraints.push_back(c); return res; -} \ No newline at end of file +} + +bool GenericConstraintsModel::addGenericSliderJoint(const unsigned int rbIndex1, const unsigned int rbIndex2, const Vector3r &pos, const Vector3r &axis) +{ + GenericSliderJoint *c = new GenericSliderJoint(); + const bool res = c->initConstraint(*this, rbIndex1, rbIndex2, pos, axis); + if (res) + m_constraints.push_back(c); + return res; +} + +bool GenericConstraintsModel::addGenericBallJoint(const unsigned int rbIndex1, const unsigned int rbIndex2, const Vector3r &pos) +{ + GenericBallJoint *c = new GenericBallJoint(); + const bool res = c->initConstraint(*this, rbIndex1, rbIndex2, pos); + if (res) + m_constraints.push_back(c); + return res; +} + +void PBD::GenericConstraintsModel::setClothStiffness(Real val) +{ + SimulationModel::setClothStiffness(val); + setConstraintValue(val); +} + +void PBD::GenericConstraintsModel::setClothBendingStiffness(Real val) +{ + SimulationModel::setClothBendingStiffness(val); + setConstraintValue(val); +} diff --git a/Demos/GenericConstraintsDemos/GenericConstraintsModel.h b/Demos/GenericConstraintsDemos/GenericConstraintsModel.h index 8e1d71ba..b7697331 100644 --- a/Demos/GenericConstraintsDemos/GenericConstraintsModel.h +++ b/Demos/GenericConstraintsDemos/GenericConstraintsModel.h @@ -1,12 +1,10 @@ #ifndef __GENERICCONSTRAINTSMODEL_H__ #define __GENERICCONSTRAINTSMODEL_H__ -#include "Demos/Common/Config.h" -#include "Demos/Utils/IndexedFaceMesh.h" -#include "Demos/Simulation/ParticleData.h" -#include "Demos/Simulation/SimulationModel.h" +#include "Utils/IndexedFaceMesh.h" +#include "Simulation/ParticleData.h" +#include "Simulation/SimulationModel.h" #include -#include namespace PBD { @@ -16,9 +14,17 @@ namespace PBD GenericConstraintsModel(); virtual ~GenericConstraintsModel(); - bool addGenericDistanceConstraint(const unsigned int particle1, const unsigned int particle2); + virtual void initParameters(); + + bool addGenericDistanceConstraint(const unsigned int particle1, const unsigned int particle2, const Real stiffness); bool addGenericIsometricBendingConstraint(const unsigned int particle1, const unsigned int particle2, - const unsigned int particle3, const unsigned int particle4); + const unsigned int particle3, const unsigned int particle4, const Real stiffness); + bool addGenericHingeJoint(const unsigned int rbIndex1, const unsigned int rbIndex2, const Vector3r &pos, const Vector3r &axis); + bool addGenericSliderJoint(const unsigned int rbIndex1, const unsigned int rbIndex2, const Vector3r &pos, const Vector3r &axis); + bool addGenericBallJoint(const unsigned int rbIndex1, const unsigned int rbIndex2, const Vector3r &pos); + + virtual void setClothStiffness(Real val); + virtual void setClothBendingStiffness(Real val); }; } diff --git a/Demos/GenericConstraintsDemos/GenericParticleConstraintsDemo.cpp b/Demos/GenericConstraintsDemos/GenericParticleConstraintsDemo.cpp index fc480604..f8774d61 100644 --- a/Demos/GenericConstraintsDemos/GenericParticleConstraintsDemo.cpp +++ b/Demos/GenericConstraintsDemos/GenericParticleConstraintsDemo.cpp @@ -1,221 +1,125 @@ -#include "Demos/Common/Config.h" +#include "Common/Common.h" #include "Demos/Visualization/MiniGL.h" #include "Demos/Visualization/Selection.h" -#include "GL/glut.h" -#include "Demos/Simulation/TimeManager.h" +#include "Simulation/TimeManager.h" #include #include "GenericConstraintsModel.h" #include -#include "Demos/Simulation/TimeStepController.h" +#include "Simulation/TimeStepController.h" #include "Demos/Visualization/Visualization.h" -#include "Demos/Utils/Utilities.h" +#include "Utils/Logger.h" +#include "Utils/Timing.h" +#include "Utils/FileSystem.h" +#include "Demos/Common/DemoBase.h" +#include "Simulation/Simulation.h" +#include "GenericConstraints.h" // Enable memory leak detection -#ifdef _DEBUG +#if defined(_DEBUG) && !defined(EIGEN_ALIGN) #define new DEBUG_NEW #endif using namespace PBD; using namespace Eigen; using namespace std; +using namespace Utilities; void timeStep (); void buildModel (); void createMesh(); void render (); -void cleanup(); void reset(); -void initShader(); -void selection(const Eigen::Vector2i &start, const Eigen::Vector2i &end); -void TW_CALL setTimeStep(const void *value, void *clientData); -void TW_CALL getTimeStep(void *value, void *clientData); -void TW_CALL setVelocityUpdateMethod(const void *value, void *clientData); -void TW_CALL getVelocityUpdateMethod(void *value, void *clientData); -void TW_CALL setStiffness(const void *value, void *clientData); -void TW_CALL getStiffness(void *value, void *clientData); -void TW_CALL setBendingStiffness(const void *value, void *clientData); -void TW_CALL getBendingStiffness(void *value, void *clientData); - -GenericConstraintsModel model; -TimeStepController simulation; +DemoBase *base; const int nRows = 30; const int nCols = 30; const Real width = 10.0; const Real height = 10.0; -bool doPause = true; -std::vector selectedParticles; -Vector3r oldMousePos; -Shader *shader; -string exePath; -string dataPath; +Real bendingStiffness = 0.01; +Real distanceStiffness = 1.0; // main int main( int argc, char **argv ) { REPORT_MEMORY_LEAKS - exePath = Utilities::getFilePath(argv[0]); - dataPath = exePath + "/" + std::string(PBD_DATA_PATH); + base = new DemoBase(); + base->init(argc, argv, "Generic cloth demo"); - // OpenGL - MiniGL::init (argc, argv, 1024, 768, 0, 0, "Cloth demo"); - MiniGL::initLights (); - MiniGL::initTexture(); - MiniGL::setClientIdleFunc (50, timeStep); - MiniGL::setKeyFunc(0, 'r', reset); - MiniGL::setSelectionFunc(selection); - initShader(); + GenericConstraintsModel *model = new GenericConstraintsModel(); + model->init(); + Simulation::getCurrent()->setModel(model); + + buildModel(); - buildModel (); + base->createParameterGUI(); + // reset simulation when cloth simulation/bending method has changed + model->setClothSimulationMethodChangedCallback([&]() { reset(); }); + model->setClothBendingMethodChangedCallback([&]() { reset(); }); + + // OpenGL + MiniGL::setClientIdleFunc (timeStep); + MiniGL::addKeyFunc('r', reset); MiniGL::setClientSceneFunc(render); MiniGL::setViewport (40.0f, 0.1f, 500.0f, Vector3r (5.0, 10.0, 30.0), Vector3r (5.0, 0.0, 0.0)); + MiniGL::mainLoop(); - TwAddVarRW(MiniGL::getTweakBar(), "Pause", TW_TYPE_BOOLCPP, &doPause, " label='Pause' group=Simulation key=SPACE "); - TwAddVarCB(MiniGL::getTweakBar(), "TimeStepSize", TW_TYPE_REAL, setTimeStep, getTimeStep, &model, " label='Time step size' min=0.0 max = 0.1 step=0.001 precision=4 group=Simulation "); - TwType enumType = TwDefineEnum("VelocityUpdateMethodType", NULL, 0); - TwAddVarCB(MiniGL::getTweakBar(), "VelocityUpdateMethod", enumType, setVelocityUpdateMethod, getVelocityUpdateMethod, &simulation, " label='Velocity update method' enum='0 {First Order Update}, 1 {Second Order Update}' group=Simulation"); - TwAddVarCB(MiniGL::getTweakBar(), "Stiffness", TW_TYPE_REAL, setStiffness, getStiffness, &model, " label='Stiffness' min=0.0 step=0.1 precision=4 group='Distance constraints' "); - TwAddVarCB(MiniGL::getTweakBar(), "BendingStiffness", TW_TYPE_REAL, setBendingStiffness, getBendingStiffness, &model, " label='Bending stiffness' min=0.0 step=0.01 precision=4 group=Bending "); + Utilities::Timing::printAverageTimes(); + Utilities::Timing::printTimeSums(); - glutMainLoop (); + delete Simulation::getCurrent(); + delete base; + delete model; - cleanup (); - return 0; } -void initShader() -{ - std::string vertFile = dataPath + "/shaders/vs_smoothTex.glsl"; - std::string fragFile = dataPath + "/shaders/fs_smoothTex.glsl"; - shader = MiniGL::createShader(vertFile, "", fragFile); - - if (shader == NULL) - return; - - shader->begin(); - shader->addUniform("modelview_matrix"); - shader->addUniform("projection_matrix"); - shader->addUniform("surface_color"); - shader->addUniform("shininess"); - shader->addUniform("specular_factor"); - shader->end(); -} - -void cleanup() -{ - delete TimeManager::getCurrent(); - delete shader; -} - void reset() { - model.reset(); - simulation.reset(); - TimeManager::getCurrent()->setTime(0.0); -} - -void mouseMove(int x, int y) -{ - Vector3r mousePos; - MiniGL::unproject(x, y, mousePos); - const Vector3r diff = mousePos - oldMousePos; - - TimeManager *tm = TimeManager::getCurrent(); - const Real h = tm->getTimeStepSize(); - - ParticleData &pd = model.getParticles(); - for (unsigned int j = 0; j < selectedParticles.size(); j++) - { - pd.getVelocity(selectedParticles[j]) += 5.0*diff/h; - } - oldMousePos = mousePos; -} + Utilities::Timing::printAverageTimes(); + Utilities::Timing::reset(); -void selection(const Eigen::Vector2i &start, const Eigen::Vector2i &end) -{ - std::vector hits; - selectedParticles.clear(); - ParticleData &pd = model.getParticles(); - Selection::selectRect(start, end, &pd.getPosition(0), &pd.getPosition(pd.size() - 1), selectedParticles); - if (selectedParticles.size() > 0) - MiniGL::setMouseMoveFunc(GLUT_MIDDLE_BUTTON, mouseMove); - else - MiniGL::setMouseMoveFunc(-1, NULL); - - MiniGL::unproject(end[0], end[1], oldMousePos); + Simulation::getCurrent()->reset(); + base->getSelectedParticles().clear(); } void timeStep () { - if (doPause) + const Real pauseAt = base->getValue(DemoBase::PAUSE_AT); + if ((pauseAt > 0.0) && (pauseAt < TimeManager::getCurrent()->getTime())) + base->setValue(DemoBase::PAUSE, true); + + if (base->getValue(DemoBase::PAUSE)) return; // Simulation code - for (unsigned int i = 0; i < 8; i++) - simulation.step(model); + SimulationModel *model = Simulation::getCurrent()->getModel(); + const unsigned int numSteps = base->getValue(DemoBase::NUM_STEPS_PER_RENDER); + for (unsigned int i = 0; i < numSteps; i++) + { + START_TIMING("SimStep"); + Simulation::getCurrent()->getTimeStep()->step(*model); + STOP_TIMING_AVG; - for (unsigned int i = 0; i < model.getTriangleModels().size(); i++) - model.getTriangleModels()[i]->updateMeshNormals(model.getParticles()); + base->step(); + } + + for (unsigned int i = 0; i < model->getTriangleModels().size(); i++) + model->getTriangleModels()[i]->updateMeshNormals(model->getParticles()); } void buildModel () { - TimeManager::getCurrent ()->setTimeStepSize (0.005); + TimeManager::getCurrent ()->setTimeStepSize (static_cast(0.005)); createMesh(); } -void renderTriangleModels() -{ - // Draw simulation model - - const ParticleData &pd = model.getParticles(); - float surfaceColor[4] = { 0.2f, 0.5f, 1.0f, 1 }; - - if (shader) - { - shader->begin(); - glUniform3fv(shader->getUniform("surface_color"), 1, surfaceColor); - glUniform1f(shader->getUniform("shininess"), 5.0f); - glUniform1f(shader->getUniform("specular_factor"), 0.2f); - - GLfloat matrix[16]; - glGetFloatv(GL_MODELVIEW_MATRIX, matrix); - glUniformMatrix4fv(shader->getUniform("modelview_matrix"), 1, GL_FALSE, matrix); - GLfloat pmatrix[16]; - glGetFloatv(GL_PROJECTION_MATRIX, pmatrix); - glUniformMatrix4fv(shader->getUniform("projection_matrix"), 1, GL_FALSE, pmatrix); - } - - for (unsigned int i = 0; i < model.getTriangleModels().size(); i++) - { - // mesh - TriangleModel *triModel = model.getTriangleModels()[i]; - const IndexedFaceMesh &mesh = triModel->getParticleMesh(); - Visualization::drawTexturedMesh(pd, mesh, triModel->getIndexOffset(), surfaceColor); - } - if (shader) - shader->end(); -} - void render () { - MiniGL::coordinateSystem(); - - renderTriangleModels(); - - float red[4] = { 0.8f, 0.0f, 0.0f, 1 }; - const ParticleData &pd = model.getParticles(); - for (unsigned int j = 0; j < selectedParticles.size(); j++) - { - MiniGL::drawSphere(pd.getPosition(selectedParticles[j]), 0.08f, red); - } - - MiniGL::drawTime( TimeManager::getCurrent ()->getTime ()); + base->render(); } @@ -223,76 +127,20 @@ void render () */ void createMesh() { - TriangleModel::ParticleMesh::UVs uvs; - uvs.resize(nRows*nCols); - - const Real dy = width / (Real)(nCols - 1); - const Real dx = height / (Real)(nRows - 1); - - Vector3r points[nRows*nCols]; - for (int i = 0; i < nRows; i++) - { - for (int j = 0; j < nCols; j++) - { - const Real y = (Real)dy*j; - const Real x = (Real)dx*i; - points[i*nCols + j] = Vector3r(x, 1.0, y); - - uvs[i*nCols + j][0] = x/width; - uvs[i*nCols + j][1] = y/height; - } - } - const int nIndices = 6 * (nRows - 1)*(nCols - 1); - - TriangleModel::ParticleMesh::UVIndices uvIndices; - uvIndices.resize(nIndices); - - unsigned int indices[nIndices]; - int index = 0; - for (int i = 0; i < nRows - 1; i++) - { - for (int j = 0; j < nCols - 1; j++) - { - int helper = 0; - if (i % 2 == j % 2) - helper = 1; - - indices[index] = i*nCols + j; - indices[index + 1] = i*nCols + j + 1; - indices[index + 2] = (i + 1)*nCols + j + helper; - - uvIndices[index] = i*nCols + j; - uvIndices[index + 1] = i*nCols + j + 1; - uvIndices[index + 2] = (i + 1)*nCols + j + helper; - index += 3; - - indices[index] = (i + 1)*nCols + j + 1; - indices[index + 1] = (i + 1)*nCols + j; - indices[index + 2] = i*nCols + j + 1 - helper; - - uvIndices[index] = (i + 1)*nCols + j + 1; - uvIndices[index + 1] = (i + 1)*nCols + j; - uvIndices[index + 2] = i*nCols + j + 1 - helper; - index += 3; - } - } - model.addTriangleModel(nRows*nCols, nIndices / 3, &points[0], &indices[0], uvIndices, uvs); - - ParticleData &pd = model.getParticles(); - for (unsigned int i = 0; i < pd.getNumberOfParticles(); i++) - { - pd.setMass(i, 1.0); - } + GenericConstraintsModel* model = (GenericConstraintsModel*)Simulation::getCurrent()->getModel(); + model->addRegularTriangleModel(nCols, nRows, + Vector3r(0, 1, 0), AngleAxisr(M_PI * 0.5, Vector3r(1, 0, 0)).matrix(), Vector2r(width, height)); // Set mass of points to zero => make it static + ParticleData& pd = model->getParticles(); pd.setMass(0, 0.0); - pd.setMass((nRows-1)*nCols, 0.0); + pd.setMass(nRows-1, 0.0); // init constraints - for (unsigned int cm = 0; cm < model.getTriangleModels().size(); cm++) + for (unsigned int cm = 0; cm < model->getTriangleModels().size(); cm++) { - const unsigned int offset = model.getTriangleModels()[cm]->getIndexOffset(); - IndexedFaceMesh &mesh = model.getTriangleModels()[cm]->getParticleMesh(); + const unsigned int offset = model->getTriangleModels()[cm]->getIndexOffset(); + IndexedFaceMesh &mesh = model->getTriangleModels()[cm]->getParticleMesh(); const unsigned int nEdges = mesh.numEdges(); const IndexedFaceMesh::Edge *edges = mesh.getEdges().data(); @@ -302,7 +150,7 @@ void createMesh() const unsigned int v1 = edges[i].m_vert[0] + offset; const unsigned int v2 = edges[i].m_vert[1] + offset; - model.addGenericDistanceConstraint(v1, v2); + model->addGenericDistanceConstraint(v1, v2, distanceStiffness); } // bending constraints @@ -340,57 +188,13 @@ void createMesh() const unsigned int vertex2 = point2 + offset; const unsigned int vertex3 = edges[i].m_vert[0] + offset; const unsigned int vertex4 = edges[i].m_vert[1] + offset; - model.addGenericIsometricBendingConstraint(vertex1, vertex2, vertex3, vertex4); + model->addGenericIsometricBendingConstraint(vertex1, vertex2, vertex3, vertex4, bendingStiffness); } } } } - std::cout << "Number of triangles: " << nIndices / 3 << "\n"; - std::cout << "Number of vertices: " << nRows*nCols << "\n"; - -} - -void TW_CALL setTimeStep(const void *value, void *clientData) -{ - const Real val = *(const Real *)(value); - TimeManager::getCurrent()->setTimeStepSize(val); -} - -void TW_CALL getTimeStep(void *value, void *clientData) -{ - *(Real *)(value) = TimeManager::getCurrent()->getTimeStepSize(); -} - -void TW_CALL setVelocityUpdateMethod(const void *value, void *clientData) -{ - const short val = *(const short *)(value); - ((TimeStepController*)clientData)->setVelocityUpdateMethod((unsigned int)val); -} - -void TW_CALL getVelocityUpdateMethod(void *value, void *clientData) -{ - *(short *)(value) = (short)((TimeStepController*)clientData)->getVelocityUpdateMethod(); -} - -void TW_CALL setStiffness(const void *value, void *clientData) -{ - const Real val = *(const Real *)(value); - ((GenericConstraintsModel*)clientData)->setClothStiffness(val); -} - -void TW_CALL getStiffness(void *value, void *clientData) -{ - *(Real *)(value) = ((GenericConstraintsModel*)clientData)->getClothStiffness(); -} - -void TW_CALL setBendingStiffness(const void *value, void *clientData) -{ - const Real val = *(const Real *)(value); - ((GenericConstraintsModel*)clientData)->setClothBendingStiffness(val); -} + LOG_INFO << "Number of triangles: " << model->getTriangleModels()[0]->getParticleMesh().numFaces(); + LOG_INFO << "Number of vertices: " << nRows*nCols; -void TW_CALL getBendingStiffness(void *value, void *clientData) -{ - *(Real *)(value) = ((GenericConstraintsModel*)clientData)->getClothBendingStiffness(); } diff --git a/Demos/GenericConstraintsDemos/GenericRigidBodyConstraintsDemo.cpp b/Demos/GenericConstraintsDemos/GenericRigidBodyConstraintsDemo.cpp new file mode 100644 index 00000000..ccfd2c78 --- /dev/null +++ b/Demos/GenericConstraintsDemos/GenericRigidBodyConstraintsDemo.cpp @@ -0,0 +1,187 @@ +#include "Common/Common.h" +#include "Demos/Visualization/MiniGL.h" +#include "Demos/Visualization/Selection.h" +#include "Simulation/TimeManager.h" +#include +#include "GenericConstraintsModel.h" +#include +#include "Simulation/TimeStepController.h" +#include "Demos/Visualization/Visualization.h" +#include "Utils/Logger.h" +#include "Utils/Timing.h" +#include "Utils/FileSystem.h" +#include "Demos/Common/DemoBase.h" +#include "Simulation/Simulation.h" + +// Enable memory leak detection +#if defined(_DEBUG) && !defined(EIGEN_ALIGN) + #define new DEBUG_NEW +#endif + +using namespace PBD; +using namespace Eigen; +using namespace std; +using namespace Utilities; + +void timeStep (); +void buildModel (); +void createBodyModel(); +void render (); +void reset(); + +DemoBase *base; + +const Real width = static_cast(0.4); +const Real height = static_cast(0.4); +const Real depth = static_cast(2.0); + + +// main +int main( int argc, char **argv ) +{ + REPORT_MEMORY_LEAKS + + base = new DemoBase(); + base->init(argc, argv, "Generic rigid body demo"); + + GenericConstraintsModel *model = new GenericConstraintsModel(); + model->init(); + Simulation::getCurrent()->setModel(model); + + buildModel(); + + base->createParameterGUI(); + + // OpenGL + MiniGL::setClientIdleFunc (timeStep); + MiniGL::addKeyFunc('r', reset); + MiniGL::setClientSceneFunc(render); + MiniGL::setViewport(60.0, 0.1f, 500.0, Vector3r(2.0, 4.0, 15.0), Vector3r(2.0, -2.0, 0.0)); + + MiniGL::mainLoop (); + + Utilities::Timing::printAverageTimes(); + Utilities::Timing::printTimeSums(); + + delete Simulation::getCurrent(); + delete base; + delete model; + + return 0; +} + +void reset() +{ + Utilities::Timing::printAverageTimes(); + Utilities::Timing::reset(); + + Simulation::getCurrent()->reset(); + base->getSelectedParticles().clear(); +} + +void timeStep () +{ + const Real pauseAt = base->getValue(DemoBase::PAUSE_AT); + if ((pauseAt > 0.0) && (pauseAt < TimeManager::getCurrent()->getTime())) + base->setValue(DemoBase::PAUSE, true); + + if (base->getValue(DemoBase::PAUSE)) + return; + + // Simulation code + SimulationModel *model = Simulation::getCurrent()->getModel(); + const unsigned int numSteps = base->getValue(DemoBase::NUM_STEPS_PER_RENDER); + for (unsigned int i = 0; i < numSteps; i++) + { + START_TIMING("SimStep"); + Simulation::getCurrent()->getTimeStep()->step(*model); + STOP_TIMING_AVG; + + base->step(); + } +} + +void buildModel () +{ + TimeManager::getCurrent ()->setTimeStepSize (static_cast(0.005)); + + createBodyModel(); +} + +void render () +{ + base->render(); +} + +// Compute diagonal inertia tensor +Vector3r computeInertiaTensorBox(const Real mass, const Real width, const Real height, const Real depth) +{ + const Real Ix = (mass / static_cast(12.0)) * (height*height + depth*depth); + const Real Iy = (mass / static_cast(12.0)) * (width*width + depth*depth); + const Real Iz = (mass / static_cast(12.0)) * (width*width + height*height); + return Vector3r(Ix, Iy, Iz); +} + +void createBodyModel() +{ + GenericConstraintsModel *model = (GenericConstraintsModel*)Simulation::getCurrent()->getModel(); + SimulationModel::RigidBodyVector &rb = model->getRigidBodies(); + + string fileName = FileSystem::normalizePath(base->getExePath() + "/resources/models/cube.obj"); + IndexedFaceMesh mesh; + VertexData vd; + DemoBase::loadMesh(fileName, vd, mesh, Vector3r::Zero(), Matrix3r::Identity(), Vector3r(width, height, depth)); + mesh.setFlatShading(true); + IndexedFaceMesh meshStatic; + VertexData vdStatic; + DemoBase::loadMesh(fileName, vdStatic, meshStatic, Vector3r::Zero(), Matrix3r::Identity(), Vector3r(0.5, 0.5, 0.5)); + meshStatic.setFlatShading(true); + + // static body + const unsigned int numberOfBodies = 6; + rb.resize(numberOfBodies); + Real startX = 0.0; + Real startY = 1.0; + for (unsigned int i = 0; i < 2; i++) + { + rb[3 * i] = new RigidBody(); + rb[3 * i]->initBody(0.0, + Vector3r(startX, startY, 1.0), + computeInertiaTensorBox(1.0, 0.5, 0.5, 0.5), + Quaternionr(1.0, 0.0, 0.0, 0.0), + vdStatic, meshStatic); + + // dynamic body + rb[3 * i + 1] = new RigidBody(); + rb[3 * i + 1]->initBody(1.0, + Vector3r(startX, startY - static_cast(0.25), static_cast(2.0)), + computeInertiaTensorBox(1.0, width, height, depth), + Quaternionr(1.0, 0.0, 0.0, 0.0), + vd, mesh); + + // dynamic body + rb[3 * i + 2] = new RigidBody(); + rb[3 * i + 2]->initBody(1.0, + Vector3r(startX, startY - static_cast(0.25), static_cast(4.0)), + computeInertiaTensorBox(1.0, width, height, depth), + Quaternionr(1.0, 0.0, 0.0, 0.0), + vd, mesh); + + startX += 4.0; + + if (i == 3) + { + startY -= 5.5; + startX = 0.0; + } + } + + Real jointY = 0.75; + model->addGenericHingeJoint(0, 1, Vector3r(0.0, jointY, 1.0), Vector3r(1.0, 0.0, 0.0)); + model->addGenericBallJoint(1, 2, Vector3r(0.25, jointY, 3.0)); + + model->addGenericSliderJoint(3, 4, Vector3r(4.0, jointY, 1.0), Vector3r(1.0, 0.0, 0.0)); + model->addGenericBallJoint(4, 5, Vector3r(4.25, jointY, 3.0)); +} + + diff --git a/Demos/PositionBasedElasticRodsDemo/CMakeLists.txt b/Demos/PositionBasedElasticRodsDemo/CMakeLists.txt new file mode 100644 index 00000000..bb13f8dd --- /dev/null +++ b/Demos/PositionBasedElasticRodsDemo/CMakeLists.txt @@ -0,0 +1,63 @@ +set(SIMULATION_LINK_LIBRARIES imgui glfw PositionBasedDynamics Simulation Utils) +set(SIMULATION_DEPENDENCIES imgui glfw PositionBasedDynamics Simulation Utils CopyPBDShaders CopyImguiFonts) + +if(WIN32) + set(SIMULATION_LINK_LIBRARIES opengl32.lib glu32.lib ${SIMULATION_LINK_LIBRARIES}) + #set(SIMULATION_DEPENDENCIES ${SIMULATION_DEPENDENCIES}) +else() + set(OpenGL_GL_PREFERENCE GLVND) + find_package(OpenGL REQUIRED) + include_directories( ${OPENGL_INCLUDE_DIRS}) + + set(SIMULATION_LINK_LIBRARIES + ${SIMULATION_LINK_LIBRARIES} + ${OPENGL_LIBRARIES} + ) +endif() + +############################################################ +# GenericParameters +############################################################ +include_directories(${GenericParameters_INCLUDE_DIR}) +if(TARGET Ext_GenericParameters) + set(SIMULATION_DEPENDENCIES ${SIMULATION_DEPENDENCIES} Ext_GenericParameters) +endif() + +add_executable(ElasticRodDemo + PositionBasedElasticRodsDemo.cpp + PositionBasedElasticRodsConstraints.cpp + PositionBasedElasticRodsConstraints.h + PositionBasedElasticRodsModel.cpp + PositionBasedElasticRodsModel.h + PositionBasedElasticRodsTSC.cpp + PositionBasedElasticRodsTSC.h + + ../Common/LogWindow.cpp + ../Common/LogWindow.h + ../Common/Simulator_GUI_imgui.cpp + ../Common/Simulator_GUI_imgui.h + ../Common/imguiParameters.cpp + ../Common/imguiParameters.h + ../Common/DemoBase.cpp + ../Common/DemoBase.h + + ${VIS_FILES} + ${PROJECT_PATH}/Common/Common.h + + CMakeLists.txt +) + +find_package( Eigen3 REQUIRED ) +include_directories( ${EIGEN3_INCLUDE_DIR} ) +include_directories(${PROJECT_PATH}/extern/freeglut/include) +include_directories(${PROJECT_PATH}/extern/glew/include) + +set_target_properties(ElasticRodDemo PROPERTIES FOLDER "Demos") +set_target_properties(ElasticRodDemo PROPERTIES DEBUG_POSTFIX ${CMAKE_DEBUG_POSTFIX}) +set_target_properties(ElasticRodDemo PROPERTIES RELWITHDEBINFO_POSTFIX ${CMAKE_RELWITHDEBINFO_POSTFIX}) +set_target_properties(ElasticRodDemo PROPERTIES MINSIZEREL_POSTFIX ${CMAKE_MINSIZEREL_POSTFIX}) +add_dependencies(ElasticRodDemo ${SIMULATION_DEPENDENCIES}) +target_link_libraries(ElasticRodDemo ${SIMULATION_LINK_LIBRARIES}) + + +VIS_SOURCE_GROUPS() diff --git a/Demos/PositionBasedElasticRodsDemo/PositionBasedElasticRodsConstraints.cpp b/Demos/PositionBasedElasticRodsDemo/PositionBasedElasticRodsConstraints.cpp new file mode 100644 index 00000000..01d7fa80 --- /dev/null +++ b/Demos/PositionBasedElasticRodsDemo/PositionBasedElasticRodsConstraints.cpp @@ -0,0 +1,204 @@ +#include "PositionBasedElasticRodsConstraints.h" +#include "Simulation/SimulationModel.h" +#include "PositionBasedDynamics/PositionBasedDynamics.h" +#include "PositionBasedDynamics/PositionBasedElasticRods.h" +#include "Simulation/IDFactory.h" + +using namespace PBD; + +int PerpendiculaBisectorConstraint::TYPE_ID = IDFactory::getId(); +int GhostPointEdgeDistanceConstraint::TYPE_ID = IDFactory::getId(); +int DarbouxVectorConstraint::TYPE_ID = IDFactory::getId(); + + +////////////////////////////////////////////////////////////////////////// +// PerpendiculaBisectorConstraint +////////////////////////////////////////////////////////////////////////// +bool PerpendiculaBisectorConstraint::initConstraint(SimulationModel &model, + const unsigned int particle1, const unsigned int particle2, const unsigned int particle3) +{ + m_bodies[0] = particle1; + m_bodies[1] = particle2; + m_bodies[2] = particle3; + + return true; +} + +bool PerpendiculaBisectorConstraint::solvePositionConstraint(SimulationModel &model, const unsigned int iter) +{ + PositionBasedElasticRodsModel &simModel = static_cast(model); + + ParticleData &pd = model.getParticles(); + ParticleData &pg = simModel.getGhostParticles(); + + const unsigned i1 = m_bodies[0]; + const unsigned i2 = m_bodies[1]; + const unsigned i3 = m_bodies[2]; + + Vector3r &x1 = pd.getPosition(i1); + Vector3r &x2 = pd.getPosition(i2); + Vector3r &x3 = pg.getPosition(i3); + + const Real invMass1 = pd.getInvMass(i1); + const Real invMass2 = pd.getInvMass(i2); + const Real invMass3 = pg.getInvMass(i3); + + Vector3r corr[3]; + const bool res = PositionBasedElasticRods::solve_PerpendiculaBisectorConstraint( + x1, invMass1, + x2, invMass2, + x3, invMass3, + 1.0, + corr[0], corr[1], corr[2]); + + if (res) + { + if (invMass1 != 0.0f) + x1 += corr[0]; + + if (invMass2 != 0.0f) + x2 += corr[1]; + + if (invMass2 != 0.0f) + x3 += corr[2]; + } + + return res; +} + +////////////////////////////////////////////////////////////////////////// +// GhostPointEdgeDistanceConstraint +////////////////////////////////////////////////////////////////////////// +bool GhostPointEdgeDistanceConstraint::initConstraint(PositionBasedElasticRodsModel &model, const unsigned int particle1, const unsigned int particle2, const unsigned int particle3) +{ + m_bodies[0] = particle1; + m_bodies[1] = particle2; + m_bodies[2] = particle3; + + ParticleData &pd = model.getParticles(); + ParticleData &pg = model.getGhostParticles(); + + Vector3r &x1 = pd.getPosition( particle1); + Vector3r &x2 = pd.getPosition( particle2); + Vector3r &x3 = pg.getPosition( particle3); + + Vector3r xm = 0.5 * (x1 + x2); + + m_restLength = (x3 - xm).norm(); + + return true; +} + +bool GhostPointEdgeDistanceConstraint::solvePositionConstraint(SimulationModel &model, const unsigned int iter) +{ + PositionBasedElasticRodsModel &simModel = static_cast(model); + + ParticleData &pd = model.getParticles(); + ParticleData &pg = simModel.getGhostParticles(); + + const unsigned i1 = m_bodies[0]; + const unsigned i2 = m_bodies[1]; + const unsigned i3 = m_bodies[2]; + + Vector3r &x1 = pd.getPosition(i1); + Vector3r &x2 = pd.getPosition(i2); + Vector3r &x3 = pg.getPosition(i3); + + const Real invMass1 = pd.getInvMass(i1); + const Real invMass2 = pd.getInvMass(i2); + const Real invMass3 = pg.getInvMass(i3); + + Vector3r corr[3]; + const bool res = PositionBasedElasticRods::solve_GhostPointEdgeDistanceConstraint(x1, invMass1, x2, invMass2, x3, invMass3, 1.0, m_restLength, corr[0], corr[1], corr[2]); + + if (res) + { + if (invMass1 != 0.0f) + x1 += corr[0]; + + if (invMass2 != 0.0f) + x2 += corr[1]; + + if (invMass3 != 0.0f) + x3 += corr[2]; + } + + return res; +} + +////////////////////////////////////////////////////////////////////////// +// DarbouxVectorConstraint +////////////////////////////////////////////////////////////////////////// +bool DarbouxVectorConstraint::initConstraint(PositionBasedElasticRodsModel &model, const unsigned int particle1, const unsigned int particle2, + const unsigned int particle3, const unsigned int particle4, const unsigned int particle5) +{ + m_bodies[0] = particle1; + m_bodies[1] = particle2; + m_bodies[2] = particle3; + m_bodies[3] = particle4; //ghost point id + m_bodies[4] = particle5; //ghost point id + + ParticleData &pd = model.getParticles(); + ParticleData &pg = model.getGhostParticles(); + + const Vector3r &x1 = pd.getPosition0(m_bodies[0]); + const Vector3r &x2 = pd.getPosition0(m_bodies[1]); + const Vector3r &x3 = pd.getPosition0(m_bodies[2]); + const Vector3r &x4 = pg.getPosition0(m_bodies[3]); + const Vector3r &x5 = pg.getPosition0(m_bodies[4]); + + PositionBasedElasticRods::computeMaterialFrame(x1, x2, x4, m_dA); + PositionBasedElasticRods::computeMaterialFrame(x2, x3, x5, m_dB); + Vector3r restDarbouxVector; + PositionBasedElasticRods::computeDarbouxVector(m_dA, m_dB, 1.0, restDarbouxVector); + model.setRestDarbouxVector(restDarbouxVector); + + return true; +} + +bool DarbouxVectorConstraint::solvePositionConstraint(SimulationModel &model, const unsigned int iter) +{ + PositionBasedElasticRodsModel &simModel = static_cast(model); + + ParticleData &pd = model.getParticles(); + ParticleData &pg = simModel.getGhostParticles(); + + Vector3r &x1 = pd.getPosition(m_bodies[0]); + Vector3r &x2 = pd.getPosition(m_bodies[1]); + Vector3r &x3 = pd.getPosition(m_bodies[2]); + Vector3r &x4 = pg.getPosition(m_bodies[3]); + Vector3r &x5 = pg.getPosition(m_bodies[4]); + + const Real invMass1 = pd.getInvMass(m_bodies[0]); + const Real invMass2 = pd.getInvMass(m_bodies[1]); + const Real invMass3 = pd.getInvMass(m_bodies[2]); + const Real invMass4 = pg.getInvMass(m_bodies[3]); + const Real invMass5 = pg.getInvMass(m_bodies[4]); + + Vector3r corr[5]; + + bool res = PositionBasedElasticRods::solve_DarbouxVectorConstraint( + x1, invMass1, x2, invMass2, x3, invMass3, x4, invMass4, x5, invMass5, + simModel.getBendingAndTwistingStiffness(), 1.0, simModel.getRestDarbouxVector(), + corr[0], corr[1], corr[2], corr[3], corr[4]); + + if (res) + { + if (invMass1 != 0.0f) + x1 += corr[0]; + + if (invMass2 != 0.0f) + x2 += corr[1]; + + if (invMass3 != 0.0f) + x3 += corr[2]; + + if (invMass4 != 0.0f) + x4 += corr[3]; + + if (invMass5 != 0.0f) + x5 += corr[4]; + } + return res; +} + diff --git a/Demos/PositionBasedElasticRodsDemo/PositionBasedElasticRodsConstraints.h b/Demos/PositionBasedElasticRodsDemo/PositionBasedElasticRodsConstraints.h new file mode 100644 index 00000000..43fe4b38 --- /dev/null +++ b/Demos/PositionBasedElasticRodsDemo/PositionBasedElasticRodsConstraints.h @@ -0,0 +1,55 @@ +#ifndef _POSITIONBASEDELASTICRODSCONSTRAINTS_H +#define _POSITIONBASEDELASTICRODSCONSTRAINTS_H + +#include +#include "Simulation/Constraints.h" +#include "PositionBasedElasticRodsModel.h" + +namespace PBD +{ + class SimulationModel; + + class GhostPointEdgeDistanceConstraint : public Constraint + { + public: + static int TYPE_ID; + Real m_restLength; + + GhostPointEdgeDistanceConstraint() : Constraint(3) {} + virtual int &getTypeId() const { return TYPE_ID; } + + bool initConstraint(PositionBasedElasticRodsModel &model, const unsigned int particle1, const unsigned int particle2, const unsigned int particle3); + virtual bool solvePositionConstraint(SimulationModel &model, const unsigned int iter); + }; + + class PerpendiculaBisectorConstraint : public Constraint + { + public: + static int TYPE_ID; + + PerpendiculaBisectorConstraint() : Constraint(3) {} + virtual int &getTypeId() const { return TYPE_ID; } + + bool initConstraint(SimulationModel &model, const unsigned int particle1, const unsigned int particle2, const unsigned int particle3); + virtual bool solvePositionConstraint(SimulationModel &model, const unsigned int iter); + }; + + class DarbouxVectorConstraint : public Constraint + { + public: + static int TYPE_ID; + Matrix3r m_dA; //material frame A + Matrix3r m_dB; //material frame B + + DarbouxVectorConstraint() : Constraint(5) {} + virtual int &getTypeId() const { return TYPE_ID; } + + virtual bool initConstraint(PositionBasedElasticRodsModel &model, const unsigned int particle1, const unsigned int particle2, + const unsigned int particle3, const unsigned int particle4, const unsigned int particle5); + + virtual bool solvePositionConstraint(SimulationModel &model, const unsigned int iter); + }; + +} + +#endif diff --git a/Demos/PositionBasedElasticRodsDemo/PositionBasedElasticRodsDemo.cpp b/Demos/PositionBasedElasticRodsDemo/PositionBasedElasticRodsDemo.cpp new file mode 100644 index 00000000..ce33a9a1 --- /dev/null +++ b/Demos/PositionBasedElasticRodsDemo/PositionBasedElasticRodsDemo.cpp @@ -0,0 +1,193 @@ +#include "Common/Common.h" +#include "Demos/Visualization/MiniGL.h" +#include "Demos/Visualization/Selection.h" +#include "Simulation/TimeManager.h" +#include +#include "PositionBasedElasticRodsModel.h" +#include "PositionBasedElasticRodsConstraints.h" +#include "PositionBasedElasticRodsTSC.h" +#include +#include "Utils/Logger.h" +#include "Utils/Timing.h" +#include "Utils/FileSystem.h" +#include "Demos/Common/DemoBase.h" +#include "Simulation/Simulation.h" + +#define _USE_MATH_DEFINES +#include "math.h" + +// Enable memory leak detection +#if defined(_DEBUG) && !defined(EIGEN_ALIGN) + #define new DEBUG_NEW +#endif + +using namespace PBD; +using namespace Eigen; +using namespace std; +using namespace Utilities; + +void timeStep (); +void buildModel (); +void createRod(); +void render (); +void reset(); + +DemoBase *base; +PositionBasedElasticRodsTSC sim; + +const int numberOfPoints = 32; + +// main +int main( int argc, char **argv ) +{ + REPORT_MEMORY_LEAKS + + base = new DemoBase(); + base->init(argc, argv, "Elastic rod demo"); + + PositionBasedElasticRodsModel *model = new PositionBasedElasticRodsModel(); + model->init(); + Simulation::getCurrent()->setModel(model); + PositionBasedElasticRodsTSC *tsc = new PositionBasedElasticRodsTSC(); + tsc->init(); + delete Simulation::getCurrent()->getTimeStep(); + Simulation::getCurrent()->setTimeStep(tsc); + + buildModel(); + + base->createParameterGUI(); + + // OpenGL + MiniGL::setClientIdleFunc (timeStep); + MiniGL::addKeyFunc('r', reset); + MiniGL::setClientSceneFunc(render); + MiniGL::setViewport (40.0f, 0.1f, 500.0f, Vector3r (5.0, 5.0, 10.0), Vector3r (5.0, 0.0, 0.0)); + MiniGL::mainLoop (); + + Utilities::Timing::printAverageTimes(); + Utilities::Timing::printTimeSums(); + + delete Simulation::getCurrent(); + delete base; + delete model; + + return 0; +} + +void reset() +{ + Utilities::Timing::printAverageTimes(); + Utilities::Timing::reset(); + + Simulation::getCurrent()->reset(); + base->getSelectedParticles().clear(); +} + +void buildModel() +{ + TimeManager::getCurrent()->setTimeStepSize(0.002f); + PositionBasedElasticRodsModel *model = (PositionBasedElasticRodsModel*)Simulation::getCurrent()->getModel(); + model->setBendingAndTwistingStiffness(Vector3r(0.5, 0.5, 0.5)); + + sim.setDamping(0.001f); + + createRod(); +} + +void timeStep () +{ + const Real pauseAt = base->getValue(DemoBase::PAUSE_AT); + if ((pauseAt > 0.0) && (pauseAt < TimeManager::getCurrent()->getTime())) + base->setValue(DemoBase::PAUSE, true); + + if (base->getValue(DemoBase::PAUSE)) + return; + + // Simulation code + SimulationModel *model = Simulation::getCurrent()->getModel(); + const unsigned int numSteps = base->getValue(DemoBase::NUM_STEPS_PER_RENDER); + for (unsigned int i = 0; i < numSteps; i++) + { + START_TIMING("SimStep"); + Simulation::getCurrent()->getTimeStep()->step(*model); + STOP_TIMING_AVG; + + base->step(); + } +} + + +void render() +{ + // Draw sim model + PositionBasedElasticRodsModel *model = (PositionBasedElasticRodsModel*) Simulation::getCurrent()->getModel(); + ParticleData &pd = model->getParticles(); + ParticleData &ghostParticles = model->getGhostParticles(); + SimulationModel::ConstraintVector &constraints = model->getConstraints(); + + float selectionColor[4] = { 0.8f, 0.0f, 0.0f, 1 }; + float pointColor[4] = { 0.1f, 0.2f, 0.6f, 1 }; + float ghostPointColor[4] = { 0.1f, 0.1f, 0.1f, 0.5f }; + float edgeColor[4] = { 0.0f, 0.6f, 0.2f, 1 }; + + for (unsigned int i = 0; i < numberOfPoints; i++) + { + MiniGL::drawSphere(pd.getPosition(i), 0.07f, pointColor); + } + + for (unsigned int i = 0; i < numberOfPoints-1; i++) + { + MiniGL::drawSphere(ghostParticles.getPosition(i), 0.07f, ghostPointColor); + MiniGL::drawVector(pd.getPosition(i), pd.getPosition(i + 1), 0.2f, edgeColor); + } + base->render(); +} + + +/** Create the elastic rod model +*/ +void createRod() +{ + PositionBasedElasticRodsModel *model = (PositionBasedElasticRodsModel*)Simulation::getCurrent()->getModel(); + ParticleData &particles = model->getParticles(); + ParticleData &ghostParticles = model->getGhostParticles(); + SimulationModel::ConstraintVector &constraints = model->getConstraints(); + + //centreline points + for (unsigned int i = 0; i < numberOfPoints; i++) + { + particles.addVertex(Vector3r(static_cast(0.25 * i), 0.0, 0.0)); + } + + //edge ghost points + for (unsigned int i = 0; i < numberOfPoints-1; i++) + { + ghostParticles.addVertex(Vector3r(static_cast(0.25 * i) + static_cast(0.125), static_cast(0.25), 0.0)); + } + + //lock two first particles and first ghost point + particles.setMass(0, 0.0f); + particles.setMass(1, 0.0f); + ghostParticles.setMass(0, 0.0f); + + for (unsigned int i = 0; i < numberOfPoints - 1; i++) + { + model->addDistanceConstraint(i, i + 1, model->getRodStretchingStiffness()); + model->addPerpendiculaBisectorConstraint(i, i + 1, i); + model->addGhostPointEdgeDistanceConstraint(i, i + 1, i); + + if (i < numberOfPoints - 2) + { + // Single rod element: + // D E //ghost points + // | | + // --A---B---C-- // rod points + int pA = i; + int pB = i + 1; + int pC = i + 2; + int pD = i; + int pE = i + 1; + model->addDarbouxVectorConstraint(pA, pB, pC, pD, pE); + } + } +} diff --git a/Demos/PositionBasedElasticRodsDemo/PositionBasedElasticRodsModel.cpp b/Demos/PositionBasedElasticRodsDemo/PositionBasedElasticRodsModel.cpp new file mode 100644 index 00000000..c83aa87a --- /dev/null +++ b/Demos/PositionBasedElasticRodsDemo/PositionBasedElasticRodsModel.cpp @@ -0,0 +1,107 @@ +#include "PositionBasedElasticRodsModel.h" +#include "PositionBasedDynamics/PositionBasedElasticRods.h" +#include "PositionBasedElasticRodsConstraints.h" + +using namespace PBD; + +int PositionBasedElasticRodsModel::REST_DARBOUX_VECTOR = -1; + +PositionBasedElasticRodsModel::PositionBasedElasticRodsModel() : + SimulationModel() +{ + m_stiffness.setOnes(); +} + +PositionBasedElasticRodsModel::~PositionBasedElasticRodsModel(void) +{ +} + +void PositionBasedElasticRodsModel::cleanup() +{ + SimulationModel::cleanup(); + m_ghostParticles.release(); +} + +void PositionBasedElasticRodsModel::initParameters() +{ + SimulationModel::initParameters(); + + REST_DARBOUX_VECTOR = createVectorParameter("restDarbouxVector", "Rest Darboux vector", 3u, m_restDarbouxVector.data()); + setGroup(REST_DARBOUX_VECTOR, "Elastic Rod|Parameters"); + setDescription(REST_DARBOUX_VECTOR, "Initial Darboux vector."); +} + +void PositionBasedElasticRodsModel::reset() +{ + // ghost particles + for (unsigned int i = 0; i < m_ghostParticles.size(); i++) + { + const Vector3r & x0 = m_ghostParticles.getPosition0(i); + m_ghostParticles.getPosition(i) = x0; + m_ghostParticles.getLastPosition(i) = m_ghostParticles.getPosition(i); + m_ghostParticles.getOldPosition(i) = m_ghostParticles.getPosition(i); + m_ghostParticles.getVelocity(i).setZero(); + m_ghostParticles.getAcceleration(i).setZero(); + } + SimulationModel::reset(); +} + +ParticleData & PositionBasedElasticRodsModel::getGhostParticles() +{ + return m_ghostParticles; +} + +bool PositionBasedElasticRodsModel::addPerpendiculaBisectorConstraint(const unsigned int p0, const unsigned int p1, const unsigned int p2) +{ + PerpendiculaBisectorConstraint *c = new PerpendiculaBisectorConstraint(); + const bool res = c->initConstraint(*this, p0, p1, p2); + if (res) + m_constraints.push_back(c); + return res; +} + +bool PositionBasedElasticRodsModel::addGhostPointEdgeDistanceConstraint(const unsigned int pA, const unsigned int pB, const unsigned int pG) +{ + GhostPointEdgeDistanceConstraint *c = new GhostPointEdgeDistanceConstraint(); + const bool res = c->initConstraint(*this, pA, pB, pG); + if (res) + m_constraints.push_back(c); + return res; +} + +bool PositionBasedElasticRodsModel::addDarbouxVectorConstraint(const unsigned int pA, const unsigned int pB, + const unsigned int pC, const unsigned int pD, const unsigned int pE) +{ + DarbouxVectorConstraint *c = new DarbouxVectorConstraint(); + const bool res = c->initConstraint(*this, pA, pB, pC, pD, pE); + if (res) + m_constraints.push_back(c); + return res; +} + +void PBD::PositionBasedElasticRodsModel::addElasticRodModel( + const unsigned int nPoints, + Vector3r * points) +{ + + +} + +void PBD::PositionBasedElasticRodsModel::setRodBendingStiffnessX(Real val) +{ + SimulationModel::setRodBendingStiffnessX(val); + m_stiffness[0] = val; +} + +void PBD::PositionBasedElasticRodsModel::setRodBendingStiffnessY(Real val) +{ + SimulationModel::setRodBendingStiffnessY(val); + m_stiffness[1] = val; +} + +void PBD::PositionBasedElasticRodsModel::setRodTwistingStiffness(Real val) +{ + SimulationModel::setRodTwistingStiffness(val); + m_stiffness[2] = val; +} + diff --git a/Demos/PositionBasedElasticRodsDemo/PositionBasedElasticRodsModel.h b/Demos/PositionBasedElasticRodsDemo/PositionBasedElasticRodsModel.h new file mode 100644 index 00000000..f31ec3d8 --- /dev/null +++ b/Demos/PositionBasedElasticRodsDemo/PositionBasedElasticRodsModel.h @@ -0,0 +1,56 @@ +#ifndef __POSITIONBASEDELASTICRODSMODEL_H__ +#define __POSITIONBASEDELASTICRODSMODEL_H__ + +#include "Simulation/ParticleData.h" +#include "Simulation/SimulationModel.h" +#include + +namespace PBD +{ + class Constraint; + + class PositionBasedElasticRodsModel : public SimulationModel + { + public: + static int REST_DARBOUX_VECTOR; + + PositionBasedElasticRodsModel(); + virtual ~PositionBasedElasticRodsModel(); + + protected: + ParticleData m_ghostParticles; + Vector3r m_restDarbouxVector; + Vector3r m_stiffness; + + public: + virtual void reset(); + virtual void cleanup(); + virtual void initParameters(); + + ParticleData &getGhostParticles(); + void addElasticRodModel( + const unsigned int nPoints, + Vector3r *points); + + bool addPerpendiculaBisectorConstraint(const unsigned int p0, const unsigned int p1, const unsigned int p2); + bool addGhostPointEdgeDistanceConstraint(const unsigned int pA, const unsigned int pB, const unsigned int pG); + bool addDarbouxVectorConstraint(const unsigned int pA, const unsigned int pB, + const unsigned int pC, const unsigned int pD, const unsigned int pE); + + + void setRestDarbouxVector(const Vector3r &val) { m_restDarbouxVector = val; } + Vector3r &getRestDarbouxVector() { return m_restDarbouxVector; } + void setBendingAndTwistingStiffness(const Vector3r &val) { m_stiffness = val; } + Vector3r &getBendingAndTwistingStiffness() { return m_stiffness; } + + virtual Real getRodBendingStiffnessX() { return m_stiffness[0]; } + virtual void setRodBendingStiffnessX(Real val); + virtual Real getRodBendingStiffnessY() { return m_stiffness[1]; } + virtual void setRodBendingStiffnessY(Real val); + virtual Real getRodTwistingStiffness() { return m_stiffness[2]; } + virtual void setRodTwistingStiffness(Real val); + + }; +} + +#endif \ No newline at end of file diff --git a/Demos/PositionBasedElasticRodsDemo/PositionBasedElasticRodsTSC.cpp b/Demos/PositionBasedElasticRodsDemo/PositionBasedElasticRodsTSC.cpp new file mode 100644 index 00000000..31b87126 --- /dev/null +++ b/Demos/PositionBasedElasticRodsDemo/PositionBasedElasticRodsTSC.cpp @@ -0,0 +1,190 @@ +#include "PositionBasedElasticRodsTSC.h" +#include "PositionBasedElasticRodsModel.h" +#include "Simulation/TimeManager.h" +#include "PositionBasedDynamics/TimeIntegration.h" +#include "Simulation/Simulation.h" + + +using namespace PBD; +using namespace std; + +PositionBasedElasticRodsTSC::PositionBasedElasticRodsTSC() : + TimeStepController() +{ + m_damping = 0.0; +} + +PositionBasedElasticRodsTSC::~PositionBasedElasticRodsTSC() +{ +} + +void PositionBasedElasticRodsTSC::step(SimulationModel &model) +{ + TimeManager *tm = TimeManager::getCurrent (); + const Real hOld = tm->getTimeStepSize(); + PositionBasedElasticRodsModel &ermodel = (PositionBasedElasticRodsModel&)model; + + ////////////////////////////////////////////////////////////////////////// + // rigid body model + ////////////////////////////////////////////////////////////////////////// + clearAccelerations(model); + SimulationModel::RigidBodyVector &rb = model.getRigidBodies(); + ParticleData &pd = model.getParticles(); + ParticleData &pg = ermodel.getGhostParticles(); + + const int numBodies = (int)rb.size(); + + Real h = hOld / (Real)m_subSteps; + tm->setTimeStepSize(h); + for (unsigned int step = 0; step < m_subSteps; step++) + { + #pragma omp parallel if(numBodies > MIN_PARALLEL_SIZE) default(shared) + { + #pragma omp for schedule(static) nowait + for (int i = 0; i < numBodies; i++) + { + rb[i]->getLastPosition() = rb[i]->getOldPosition(); + rb[i]->getOldPosition() = rb[i]->getPosition(); + TimeIntegration::semiImplicitEuler(h, rb[i]->getMass(), rb[i]->getPosition(), rb[i]->getVelocity(), rb[i]->getAcceleration()); + rb[i]->getLastRotation() = rb[i]->getOldRotation(); + rb[i]->getOldRotation() = rb[i]->getRotation(); + TimeIntegration::semiImplicitEulerRotation(h, rb[i]->getMass(), rb[i]->getInertiaTensorW(), rb[i]->getInertiaTensorInverseW(), rb[i]->getRotation(), rb[i]->getAngularVelocity(), rb[i]->getTorque()); + rb[i]->rotationUpdated(); + } + + ////////////////////////////////////////////////////////////////////////// + // particle model + ////////////////////////////////////////////////////////////////////////// + #pragma omp for schedule(static) + for (int i = 0; i < (int) pd.size(); i++) + { + pd.getLastPosition(i) = pd.getOldPosition(i); + pd.getOldPosition(i) = pd.getPosition(i); + pd.getVelocity(i) *= (1.0f - m_damping); + + TimeIntegration::semiImplicitEuler(h, pd.getMass(i), pd.getPosition(i), pd.getVelocity(i), pd.getAcceleration(i)); + } + + for (int i = 0; i < (int)pg.size(); i++) + { + pg.getLastPosition(i) = pg.getOldPosition(i); + pg.getOldPosition(i) = pg.getPosition(i); + + pg.getVelocity(i) *= (1.0f - m_damping); + + TimeIntegration::semiImplicitEuler(h, pg.getMass(i), pg.getPosition(i), pg.getVelocity(i), pg.getAcceleration(i)); + } + } + + positionConstraintProjection(model); + + #pragma omp parallel if(numBodies > MIN_PARALLEL_SIZE) default(shared) + { + // Update velocities + #pragma omp for schedule(static) nowait + for (int i = 0; i < numBodies; i++) + { + if (m_velocityUpdateMethod == 0) + { + TimeIntegration::velocityUpdateFirstOrder(h, rb[i]->getMass(), rb[i]->getPosition(), rb[i]->getOldPosition(), rb[i]->getVelocity()); + TimeIntegration::angularVelocityUpdateFirstOrder(h, rb[i]->getMass(), rb[i]->getRotation(), rb[i]->getOldRotation(), rb[i]->getAngularVelocity()); + } + else + { + TimeIntegration::velocityUpdateSecondOrder(h, rb[i]->getMass(), rb[i]->getPosition(), rb[i]->getOldPosition(), rb[i]->getLastPosition(), rb[i]->getVelocity()); + TimeIntegration::angularVelocityUpdateSecondOrder(h, rb[i]->getMass(), rb[i]->getRotation(), rb[i]->getOldRotation(), rb[i]->getLastRotation(), rb[i]->getAngularVelocity()); + } + } + + // Update velocities + #pragma omp for schedule(static) + for (int i = 0; i < (int) pd.size(); i++) + { + if (m_velocityUpdateMethod == 0) + TimeIntegration::velocityUpdateFirstOrder(h, pd.getMass(i), pd.getPosition(i), pd.getOldPosition(i), pd.getVelocity(i)); + else + TimeIntegration::velocityUpdateSecondOrder(h, pd.getMass(i), pd.getPosition(i), pd.getOldPosition(i), pd.getLastPosition(i), pd.getVelocity(i)); + } + + #pragma omp for schedule(static) + for (int i = 0; i < (int)pg.size(); i++) + { + if (m_velocityUpdateMethod == 0) + TimeIntegration::velocityUpdateFirstOrder(h, pg.getMass(i), pg.getPosition(i), pg.getOldPosition(i), pg.getVelocity(i)); + else + TimeIntegration::velocityUpdateSecondOrder(h, pg.getMass(i), pg.getPosition(i), pg.getOldPosition(i), pg.getLastPosition(i), pg.getVelocity(i)); + } + } + } + h = hOld; + tm->setTimeStepSize(hOld); + + #pragma omp parallel if(numBodies > MIN_PARALLEL_SIZE) default(shared) + { + // Update velocities + #pragma omp for schedule(static) nowait + for (int i = 0; i < numBodies; i++) + { + if (rb[i]->getMass() != 0.0) + rb[i]->getGeometry().updateMeshTransformation(rb[i]->getPosition(), rb[i]->getRotationMatrix()); + } + } + + if (m_collisionDetection) + m_collisionDetection->collisionDetection(model); + + velocityConstraintProjection(model); + + // compute new time + tm->setTime (tm->getTime () + h); +} + +void PositionBasedElasticRodsTSC::clearAccelerations(SimulationModel &model) +{ + ////////////////////////////////////////////////////////////////////////// + // rigid body model + ////////////////////////////////////////////////////////////////////////// + + PositionBasedElasticRodsModel &ermodel = (PositionBasedElasticRodsModel&)model; + SimulationModel::RigidBodyVector &rb = model.getRigidBodies(); + Simulation *sim = Simulation::getCurrent(); + const Vector3r grav(sim->getVecValue(Simulation::GRAVITATION)); + for (size_t i=0; i < rb.size(); i++) + { + // Clear accelerations of dynamic particles + if (rb[i]->getMass() != 0.0) + { + Vector3r &a = rb[i]->getAcceleration(); + a = grav; + } + } + + ////////////////////////////////////////////////////////////////////////// + // particle model + ////////////////////////////////////////////////////////////////////////// + + ParticleData &pd = model.getParticles(); + const unsigned int count = pd.size(); + for (unsigned int i = 0; i < count; i++) + { + // Clear accelerations of dynamic particles + if (pd.getMass(i) != 0.0) + { + Vector3r &a = pd.getAcceleration(i); + a = grav; + } + } + + ParticleData &pg = ermodel.getGhostParticles(); + for (unsigned int i = 0; i < pg.size(); i++) + { + // Clear accelerations of dynamic particles + if (pg.getMass(i) != 0.0) + { + Vector3r &a = pg.getAcceleration(i); + a.setZero(); + } + } +} + + diff --git a/Demos/PositionBasedElasticRodsDemo/PositionBasedElasticRodsTSC.h b/Demos/PositionBasedElasticRodsDemo/PositionBasedElasticRodsTSC.h new file mode 100644 index 00000000..1fba4113 --- /dev/null +++ b/Demos/PositionBasedElasticRodsDemo/PositionBasedElasticRodsTSC.h @@ -0,0 +1,26 @@ +#ifndef __POSITIONBASEDELASTICRODSTSC_H__ +#define __POSITIONBASEDELASTICRODSTSC_H__ + +#include "Simulation/TimeStepController.h" +#include "PositionBasedElasticRodsModel.h" + +namespace PBD +{ + class PositionBasedElasticRodsTSC : public TimeStepController + { + protected: + Real m_damping; + virtual void clearAccelerations(SimulationModel &model); + + public: + PositionBasedElasticRodsTSC(); + virtual ~PositionBasedElasticRodsTSC(void); + + virtual void step(SimulationModel &model); + + Real getDamping() const { return m_damping; } + void setDamping(Real val) { m_damping = val; } + }; +} + +#endif diff --git a/Demos/PositionBasedElasticRodsDemo/ReadMe.txt b/Demos/PositionBasedElasticRodsDemo/ReadMe.txt new file mode 100644 index 00000000..44d6cc25 --- /dev/null +++ b/Demos/PositionBasedElasticRodsDemo/ReadMe.txt @@ -0,0 +1,14 @@ +Implementation of "Position Based Elastic Rods" paper +(http://www.nobuyuki-umetani.com/PositionBasedElasticRod/2014_sca_PositionBasedElasticRod.html) +for Position Based Dynamics library (https://github.com/InteractiveComputerGraphics/PositionBasedDynamics): + +The code is based on the implementation of + +Przemyslaw Korzeniowski +Department of Surgery and Cancer +Imperial College London + +http://github.com/korzen/PositionBasedDynamics-ElasticRod +korzenio [at] gmail.com + + diff --git a/Demos/RigidBodyDemos/CMakeLists.txt b/Demos/RigidBodyDemos/CMakeLists.txt index e62f495d..20395749 100644 --- a/Demos/RigidBodyDemos/CMakeLists.txt +++ b/Demos/RigidBodyDemos/CMakeLists.txt @@ -1,36 +1,42 @@ -set(SIMULATION_LINK_LIBRARIES AntTweakBar glew PositionBasedDynamics Simulation) -set(SIMULATION_DEPENDENCIES AntTweakBar glew PositionBasedDynamics Simulation) +set(SIMULATION_LINK_LIBRARIES imgui glfw PositionBasedDynamics Simulation Utils) +set(SIMULATION_DEPENDENCIES imgui glfw PositionBasedDynamics Simulation Utils CopyPBDShaders CopyPBDModels CopyImguiFonts) if(WIN32) - set(SIMULATION_LINK_LIBRARIES freeglut opengl32.lib glu32.lib ${SIMULATION_LINK_LIBRARIES}) - set(SIMULATION_DEPENDENCIES freeglut ${SIMULATION_DEPENDENCIES}) + set(SIMULATION_LINK_LIBRARIES opengl32.lib glu32.lib ${SIMULATION_LINK_LIBRARIES}) + #set(SIMULATION_DEPENDENCIES ${SIMULATION_DEPENDENCIES}) else() - find_package(GLUT REQUIRED) + set(OpenGL_GL_PREFERENCE GLVND) find_package(OpenGL REQUIRED) + include_directories( ${OPENGL_INCLUDE_DIRS}) set(SIMULATION_LINK_LIBRARIES ${SIMULATION_LINK_LIBRARIES} - ${GLUT_LIBRARIES} ${OPENGL_LIBRARIES} ) endif() +############################################################ +# GenericParameters +############################################################ +include_directories(${GenericParameters_INCLUDE_DIR}) +if(TARGET Ext_GenericParameters) + set(SIMULATION_DEPENDENCIES ${SIMULATION_DEPENDENCIES} Ext_GenericParameters) +endif() + add_executable(ChainDemo ChainDemo.cpp + ../Common/LogWindow.cpp + ../Common/LogWindow.h + ../Common/Simulator_GUI_imgui.cpp + ../Common/Simulator_GUI_imgui.h + ../Common/imguiParameters.cpp + ../Common/imguiParameters.h + ../Common/DemoBase.cpp + ../Common/DemoBase.h + ${VIS_FILES} ${PROJECT_PATH}/Common/Common.h - ${PROJECT_PATH}/Demos/Common/Config.h - ${PROJECT_PATH}/Demos/Utils/IndexedFaceMesh.cpp - ${PROJECT_PATH}/Demos/Utils/IndexedFaceMesh.h - ${PROJECT_PATH}/Demos/Utils/IndexedTetMesh.cpp - ${PROJECT_PATH}/Demos/Utils/IndexedTetMesh.h - ${PROJECT_PATH}/Demos/Utils/OBJLoader.cpp - ${PROJECT_PATH}/Demos/Utils/OBJLoader.h - ${PROJECT_PATH}/Demos/Utils/Utilities.cpp - ${PROJECT_PATH}/Demos/Utils/Utilities.h - ${PROJECT_PATH}/Demos/Utils/VolumeIntegration.cpp - ${PROJECT_PATH}/Demos/Utils/VolumeIntegration.h CMakeLists.txt ) @@ -42,22 +48,21 @@ set_target_properties(ChainDemo PROPERTIES MINSIZEREL_POSTFIX ${CMAKE_MINSIZEREL add_dependencies(ChainDemo ${SIMULATION_DEPENDENCIES}) target_link_libraries(ChainDemo ${SIMULATION_LINK_LIBRARIES}) + add_executable(JointDemo JointDemo.cpp + + ../Common/LogWindow.cpp + ../Common/LogWindow.h + ../Common/Simulator_GUI_imgui.cpp + ../Common/Simulator_GUI_imgui.h + ../Common/imguiParameters.cpp + ../Common/imguiParameters.h + ../Common/DemoBase.cpp + ../Common/DemoBase.h ${VIS_FILES} ${PROJECT_PATH}/Common/Common.h - ${PROJECT_PATH}/Demos/Common/Config.h - ${PROJECT_PATH}/Demos/Utils/IndexedFaceMesh.cpp - ${PROJECT_PATH}/Demos/Utils/IndexedFaceMesh.h - ${PROJECT_PATH}/Demos/Utils/IndexedTetMesh.cpp - ${PROJECT_PATH}/Demos/Utils/IndexedTetMesh.h - ${PROJECT_PATH}/Demos/Utils/OBJLoader.cpp - ${PROJECT_PATH}/Demos/Utils/OBJLoader.h - ${PROJECT_PATH}/Demos/Utils/Utilities.cpp - ${PROJECT_PATH}/Demos/Utils/Utilities.h - ${PROJECT_PATH}/Demos/Utils/VolumeIntegration.cpp - ${PROJECT_PATH}/Demos/Utils/VolumeIntegration.h CMakeLists.txt ) @@ -69,7 +74,6 @@ set_target_properties(JointDemo PROPERTIES MINSIZEREL_POSTFIX ${CMAKE_MINSIZEREL add_dependencies(JointDemo ${SIMULATION_DEPENDENCIES}) target_link_libraries(JointDemo ${SIMULATION_LINK_LIBRARIES}) -add_definitions(-DTW_NO_LIB_PRAGMA -DTW_STATIC) find_package( Eigen3 REQUIRED ) include_directories( ${EIGEN3_INCLUDE_DIR} ) include_directories(${PROJECT_PATH}/extern/freeglut/include) diff --git a/Demos/RigidBodyDemos/ChainDemo.cpp b/Demos/RigidBodyDemos/ChainDemo.cpp index 88606006..a1fa4d5a 100644 --- a/Demos/RigidBodyDemos/ChainDemo.cpp +++ b/Demos/RigidBodyDemos/ChainDemo.cpp @@ -1,246 +1,120 @@ -#include "Demos/Common/Config.h" +#include "Common/Common.h" #include "Demos/Visualization/MiniGL.h" #include "Demos/Visualization/Selection.h" -#include "GL/glut.h" -#include "Demos/Simulation/TimeManager.h" +#include "Simulation/TimeManager.h" #include -#include "Demos/Simulation/SimulationModel.h" -#include "Demos/Simulation/TimeStepController.h" +#include "Simulation/SimulationModel.h" +#include "Simulation/TimeStepController.h" #include -#include "Demos/Utils/OBJLoader.h" #include "Demos/Visualization/Visualization.h" -#include "Demos/Utils/Utilities.h" +#include "Utils/Logger.h" +#include "Utils/Timing.h" +#include "Utils/FileSystem.h" +#include "Demos/Common/DemoBase.h" +#include "Simulation/Simulation.h" #define _USE_MATH_DEFINES #include "math.h" // Enable memory leak detection -#ifdef _DEBUG +#if defined(_DEBUG) && !defined(EIGEN_ALIGN) #define new DEBUG_NEW #endif using namespace PBD; using namespace Eigen; using namespace std; +using namespace Utilities; void timeStep (); void buildModel (); void createBodyModel(); void render (); void reset(); -void cleanup(); -void initShader(); -void selection(const Eigen::Vector2i &start, const Eigen::Vector2i &end); -void TW_CALL setTimeStep(const void *value, void *clientData); -void TW_CALL getTimeStep(void *value, void *clientData); -void TW_CALL setVelocityUpdateMethod(const void *value, void *clientData); -void TW_CALL getVelocityUpdateMethod(void *value, void *clientData); - -SimulationModel model; -TimeStepController sim; +DemoBase *base; const int numberOfBodies = 10; -const Real width = 1.0; -const Real height = 0.1; -const Real depth = 0.1; -bool doPause = true; -std::vector selectedBodies; -Vector3r oldMousePos; -Shader *shader; -string exePath; -string dataPath; +const Real width = static_cast(1.0); +const Real height = static_cast(0.1); +const Real depth = static_cast(0.1); // main int main( int argc, char **argv ) { REPORT_MEMORY_LEAKS - exePath = Utilities::getFilePath(argv[0]); - dataPath = exePath + "/" + std::string(PBD_DATA_PATH); - - // OpenGL - MiniGL::init (argc, argv, 1024, 768, 0, 0, "Rigid body demo"); - MiniGL::initLights (); - MiniGL::initTexture(); - MiniGL::setClientIdleFunc (50, timeStep); - MiniGL::setKeyFunc(0, 'r', reset); - MiniGL::setSelectionFunc(selection); - initShader(); + base = new DemoBase(); + base->init(argc, argv, "Rigid body demo"); - buildModel (); + SimulationModel *model = new SimulationModel(); + model->init(); + Simulation::getCurrent()->setModel(model); - MiniGL::setClientSceneFunc(render); - MiniGL::setViewport (40.0, 0.1f, 500.0, Vector3r (5.0, 10.0, 30.0), Vector3r (5.0, 0.0, 0.0)); + buildModel(); - TwAddVarRW(MiniGL::getTweakBar(), "Pause", TW_TYPE_BOOLCPP, &doPause, " label='Pause' group=Simulation key=SPACE "); - TwAddVarCB(MiniGL::getTweakBar(), "TimeStepSize", TW_TYPE_REAL, setTimeStep, getTimeStep, &model, " label='Time step size' min=0.0 max = 0.1 step=0.001 precision=4 group=Simulation "); - TwType enumType = TwDefineEnum("VelocityUpdateMethodType", NULL, 0); - TwAddVarCB(MiniGL::getTweakBar(), "VelocityUpdateMethod", enumType, setVelocityUpdateMethod, getVelocityUpdateMethod, &sim, " label='Velocity update method' enum='0 {First Order Update}, 1 {Second Order Update}' group=Simulation"); + base->createParameterGUI(); - glutMainLoop (); - - cleanup (); - - return 0; -} + // OpenGL + MiniGL::setClientIdleFunc(timeStep); + MiniGL::addKeyFunc('r', reset); + MiniGL::setClientSceneFunc(render); + MiniGL::setViewport (40.0, 0.1f, 500.0, Vector3r (5.0, 10.0, 30.0), Vector3r (5.0, 0.0, 0.0)); -void initShader() -{ - std::string vertFile = dataPath + "/shaders/vs_smooth.glsl"; - std::string fragFile = dataPath + "/shaders/fs_smooth.glsl"; - shader = MiniGL::createShader(vertFile, "", fragFile); + MiniGL::mainLoop(); - if (shader == NULL) - return; + Utilities::Timing::printAverageTimes(); + Utilities::Timing::printTimeSums(); - shader->begin(); - shader->addUniform("modelview_matrix"); - shader->addUniform("projection_matrix"); - shader->addUniform("surface_color"); - shader->addUniform("shininess"); - shader->addUniform("specular_factor"); - shader->end(); -} + delete Simulation::getCurrent(); + delete base; + delete model; -void cleanup() -{ - delete TimeManager::getCurrent(); - delete shader; + return 0; } void reset() { - model.reset(); - sim.reset(); - TimeManager::getCurrent()->setTime(0.0); -} - -void mouseMove(int x, int y) -{ - Vector3r mousePos; - MiniGL::unproject(x, y, mousePos); - const Vector3r diff = mousePos - oldMousePos; - - TimeManager *tm = TimeManager::getCurrent(); - const Real h = tm->getTimeStepSize(); + Utilities::Timing::printAverageTimes(); + Utilities::Timing::reset(); - SimulationModel::RigidBodyVector &rb = model.getRigidBodies(); - for (size_t j = 0; j < selectedBodies.size(); j++) - { - rb[selectedBodies[j]]->getVelocity() += 1.0 / h * diff; - } - oldMousePos = mousePos; -} - -void selection(const Eigen::Vector2i &start, const Eigen::Vector2i &end) -{ - std::vector hits; - selectedBodies.clear(); - - SimulationModel::RigidBodyVector &rb = model.getRigidBodies(); - std::vector > x; - x.resize(rb.size()); - for (unsigned int i = 0; i < rb.size(); i++) - { - x[i] = rb[i]->getPosition(); - } - - Selection::selectRect(start, end, &x[0], &x[rb.size() - 1], selectedBodies); - if (selectedBodies.size() > 0) - MiniGL::setMouseMoveFunc(GLUT_MIDDLE_BUTTON, mouseMove); - else - MiniGL::setMouseMoveFunc(-1, NULL); - - MiniGL::unproject(end[0], end[1], oldMousePos); + Simulation::getCurrent()->reset(); + base->getSelectedParticles().clear(); } void timeStep () { - if (doPause) + const Real pauseAt = base->getValue(DemoBase::PAUSE_AT); + if ((pauseAt > 0.0) && (pauseAt < TimeManager::getCurrent()->getTime())) + base->setValue(DemoBase::PAUSE, true); + + if (base->getValue(DemoBase::PAUSE)) return; // Simulation code - for (unsigned int i = 0; i < 8; i++) - sim.step(model); + SimulationModel *model = Simulation::getCurrent()->getModel(); + const unsigned int numSteps = base->getValue(DemoBase::NUM_STEPS_PER_RENDER); + for (unsigned int i = 0; i < numSteps; i++) + { + START_TIMING("SimStep"); + Simulation::getCurrent()->getTimeStep()->step(*model); + STOP_TIMING_AVG; + + base->step(); + } } void buildModel () { - TimeManager::getCurrent ()->setTimeStepSize (0.005); + TimeManager::getCurrent ()->setTimeStepSize (static_cast(0.005)); createBodyModel(); } -void renderBallJoint(BallJoint &bj) -{ - float jointColor[4] = { 0.0, 0.6f, 0.2f, 1 }; - MiniGL::drawSphere(bj.m_jointInfo.col(2), 1.25f*(float) height, jointColor); -} - void render () { - MiniGL::coordinateSystem(); - - // Draw sim model - - SimulationModel::RigidBodyVector &rb = model.getRigidBodies(); - SimulationModel::ConstraintVector &constraints = model.getConstraints(); - - float selectionColor[4] = { 0.8f, 0.0f, 0.0f, 1 }; - float surfaceColor[4] = { 0.1f, 0.4f, 0.8f, 1 }; - - if (shader) - { - shader->begin(); - glUniform1f(shader->getUniform("shininess"), 5.0); - glUniform1f(shader->getUniform("specular_factor"), 0.2f); - - GLfloat matrix[16]; - glGetFloatv(GL_MODELVIEW_MATRIX, matrix); - glUniformMatrix4fv(shader->getUniform("modelview_matrix"), 1, GL_FALSE, matrix); - GLfloat pmatrix[16]; - glGetFloatv(GL_PROJECTION_MATRIX, pmatrix); - glUniformMatrix4fv(shader->getUniform("projection_matrix"), 1, GL_FALSE, pmatrix); - } - - for (size_t i = 0; i < rb.size(); i++) - { - bool selected = false; - for (unsigned int j = 0; j < selectedBodies.size(); j++) - { - if (selectedBodies[j] == i) - selected = true; - } - - const VertexData &vd = rb[i]->getGeometry().getVertexData(); - const IndexedFaceMesh &mesh = rb[i]->getGeometry().getMesh(); - if (!selected) - { - if (shader) - glUniform3fv(shader->getUniform("surface_color"), 1, surfaceColor); - Visualization::drawMesh(vd, mesh, 0, surfaceColor); - } - else - { - if (shader) - glUniform3fv(shader->getUniform("surface_color"), 1, selectionColor); - Visualization::drawMesh(vd, mesh, 0, selectionColor); - } - } - if (shader) - shader->end(); - - for (size_t i = 0; i < constraints.size(); i++) - { - if (constraints[i]->getTypeId() == BallJoint::TYPE_ID) - { - renderBallJoint(*(BallJoint*)constraints[i]); - } - } - - MiniGL::drawTime( TimeManager::getCurrent ()->getTime ()); + base->render(); } @@ -248,18 +122,19 @@ void render () */ void createBodyModel() { - SimulationModel::RigidBodyVector &rb = model.getRigidBodies(); - SimulationModel::ConstraintVector &constraints = model.getConstraints(); + SimulationModel *model = Simulation::getCurrent()->getModel(); + SimulationModel::RigidBodyVector &rb = model->getRigidBodies(); - string fileName = dataPath + "/models/cube.obj"; + string fileName = FileSystem::normalizePath(base->getExePath() + "/resources/models/cube.obj"); IndexedFaceMesh mesh; VertexData vd; - OBJLoader::loadObj(fileName, vd, mesh, Vector3r(width, height, depth)); + DemoBase::loadMesh(fileName, vd, mesh, Vector3r::Zero(), Matrix3r::Identity(), Vector3r(width, height, depth)); + mesh.setFlatShading(true); - string fileName2 = dataPath + "/models/bunny_10k.obj"; + string fileName2 = FileSystem::normalizePath(base->getExePath() + "/resources/models/bunny_10k.obj"); IndexedFaceMesh mesh2; VertexData vd2; - OBJLoader::loadObj(fileName2, vd2, mesh2, Vector3r(2.0, 2.0, 2.0)); + DemoBase::loadMesh(fileName2, vd2, mesh2, Vector3r::Zero(), Matrix3r::Identity(), Vector3r(2.0, 2.0, 2.0)); rb.resize(numberOfBodies); const Real density = 1.0; @@ -275,37 +150,14 @@ void createBodyModel() rb[0]->setMass(0.0); // bunny - const Quaternionr q(AngleAxisr((1.0/6.0*M_PI), Vector3r(0.0, 0.0, 1.0))); - const Vector3r t(0.411 + ((Real)numberOfBodies - 1.0)*width, -1.776, 0.356); + const Quaternionr q(AngleAxisr(static_cast(1.0/6.0*M_PI), Vector3r(0.0, 0.0, 1.0))); + const Vector3r t(static_cast(0.411) + (static_cast(numberOfBodies) - static_cast(1.0))*width, static_cast(-1.776), static_cast(0.356)); rb[numberOfBodies - 1] = new RigidBody(); rb[numberOfBodies - 1]->initBody(density, t, q, vd2, mesh2); - constraints.reserve(numberOfBodies - 1); for (unsigned int i = 0; i < numberOfBodies-1; i++) { - model.addBallJoint(i, i + 1, Vector3r((Real)i*width + 0.5*width, 0.0, 0.0)); + model->addBallJoint(i, i + 1, Vector3r((Real)i*width + static_cast(0.5)*width, 0.0, 0.0)); } } -void TW_CALL setTimeStep(const void *value, void *clientData) -{ - const Real val = *(const Real *)(value); - TimeManager::getCurrent()->setTimeStepSize(val); -} - -void TW_CALL getTimeStep(void *value, void *clientData) -{ - *(Real *)(value) = TimeManager::getCurrent()->getTimeStepSize(); -} - -void TW_CALL setVelocityUpdateMethod(const void *value, void *clientData) -{ - const short val = *(const short *)(value); - ((TimeStepController*)clientData)->setVelocityUpdateMethod((unsigned int)val); -} - -void TW_CALL getVelocityUpdateMethod(void *value, void *clientData) -{ - *(short *)(value) = (short)((TimeStepController*)clientData)->getVelocityUpdateMethod(); -} - diff --git a/Demos/RigidBodyDemos/JointDemo.cpp b/Demos/RigidBodyDemos/JointDemo.cpp index 78843367..76e6de9b 100644 --- a/Demos/RigidBodyDemos/JointDemo.cpp +++ b/Demos/RigidBodyDemos/JointDemo.cpp @@ -1,408 +1,186 @@ -#include "Demos/Common/Config.h" +#include "Common/Common.h" #include "Demos/Visualization/MiniGL.h" #include "Demos/Visualization/Selection.h" -#include "GL/glut.h" -#include "Demos/Simulation/TimeManager.h" +#include "Simulation/TimeManager.h" #include -#include "Demos/Simulation/SimulationModel.h" -#include "Demos/Simulation/TimeStepController.h" +#include "Simulation/SimulationModel.h" +#include "Simulation/TimeStepController.h" #include -#include "Demos/Utils/OBJLoader.h" #include "Demos/Visualization/Visualization.h" -#include "Demos/Utils/Utilities.h" +#include "Utils/Logger.h" +#include "Utils/Timing.h" +#include "Utils/FileSystem.h" +#include "Demos/Common/DemoBase.h" +#include "Simulation/Simulation.h" #define _USE_MATH_DEFINES #include "math.h" - // Enable memory leak detection -#ifdef _DEBUG +#if defined(_DEBUG) && !defined(EIGEN_ALIGN) #define new DEBUG_NEW #endif using namespace PBD; using namespace Eigen; using namespace std; +using namespace Utilities; void timeStep (); void buildModel (); void createBodyModel(); void render (); void reset(); -void cleanup(); -void initShader(); -void selection(const Eigen::Vector2i &start, const Eigen::Vector2i &end); -void TW_CALL setTimeStep(const void *value, void *clientData); -void TW_CALL getTimeStep(void *value, void *clientData); -void TW_CALL setVelocityUpdateMethod(const void *value, void *clientData); -void TW_CALL getVelocityUpdateMethod(void *value, void *clientData); -void TW_CALL setMaxIterations(const void *value, void *clientData); -void TW_CALL getMaxIterations(void *value, void *clientData); - -SimulationModel model; -TimeStepController sim; - -const Real width = 0.4; -const Real height = 0.4; -const Real depth = 2.0; -bool doPause = true; -std::vector selectedBodies; -Vector3r oldMousePos; -Shader *shader; -string exePath; -string dataPath; -float jointColor[4] = { 0.0f, 0.4f, 0.2f, 1.0 }; -float dynamicBodyColor[4] = { 0.1f, 0.4f, 0.8f, 1.0 }; -float staticBodyColor[4] = { 0.4f, 0.4f, 0.4f, 1.0 }; + +DemoBase *base; + +const Real width = static_cast(0.4); +const Real height = static_cast(0.4); +const Real depth = static_cast(2.0); + // main int main( int argc, char **argv ) { REPORT_MEMORY_LEAKS - exePath = Utilities::getFilePath(argv[0]); - dataPath = exePath + "/" + std::string(PBD_DATA_PATH); + base = new DemoBase(); + base->init(argc, argv, "Rigid body demo"); - // OpenGL - MiniGL::init (argc, argv, 1280, 960, 0, 0, "Rigid body demo"); - MiniGL::initLights (); - MiniGL::setClientIdleFunc (50, timeStep); - MiniGL::setKeyFunc(0, 'r', reset); - MiniGL::setSelectionFunc(selection); - initShader(); + SimulationModel *model = new SimulationModel(); + model->init(); + Simulation::getCurrent()->setModel(model); buildModel (); - MiniGL::setClientSceneFunc(render); - MiniGL::setViewport (60.0, 0.1f, 500.0, Vector3r (6.0, 1.0, 15.0), Vector3r (6.0, -3.0, 0.0)); - - TwAddVarRW(MiniGL::getTweakBar(), "Pause", TW_TYPE_BOOLCPP, &doPause, " label='Pause' group=Simulation key=SPACE "); - TwAddVarCB(MiniGL::getTweakBar(), "TimeStepSize", TW_TYPE_REAL, setTimeStep, getTimeStep, &model, " label='Time step size' min=0.0 max = 0.1 step=0.001 precision=4 group=Simulation "); - TwType enumType = TwDefineEnum("VelocityUpdateMethodType", NULL, 0); - TwAddVarCB(MiniGL::getTweakBar(), "VelocityUpdateMethod", enumType, setVelocityUpdateMethod, getVelocityUpdateMethod, &sim, " label='Velocity update method' enum='0 {First Order Update}, 1 {Second Order Update}' group=Simulation"); - TwAddVarCB(MiniGL::getTweakBar(), "MaxIter", TW_TYPE_UINT32, setMaxIterations, getMaxIterations, &sim, " label='Max. iterations' min=1 step=1 group=Simulation "); + base->createParameterGUI(); - glutMainLoop (); + Simulation::getCurrent()->getTimeStep()->setValue(TimeStepController::NUM_SUB_STEPS, 1); + Simulation::getCurrent()->getTimeStep()->setValue(TimeStepController::MAX_ITERATIONS, 5); - cleanup (); - - return 0; -} + // OpenGL + MiniGL::setClientIdleFunc(timeStep); + MiniGL::addKeyFunc('r', reset); + MiniGL::setClientSceneFunc(render); + MiniGL::setViewport(60.0, 0.1f, 500.0, Vector3r(6.0, 0.0, 18.0), Vector3r(6.0, -4.0, 0.0)); -void initShader() -{ - std::string vertFile = dataPath + "/shaders/vs_flat.glsl"; - std::string geomFile = dataPath + "/shaders/gs_flat.glsl"; - std::string fragFile = dataPath + "/shaders/fs_flat.glsl"; - shader = MiniGL::createShader(vertFile, geomFile, fragFile); + MiniGL::mainLoop (); - if (shader == NULL) - return; + Utilities::Timing::printAverageTimes(); + Utilities::Timing::printTimeSums(); - shader->begin(); - shader->addUniform("modelview_matrix"); - shader->addUniform("projection_matrix"); - shader->addUniform("surface_color"); - shader->addUniform("shininess"); - shader->addUniform("specular_factor"); - shader->end(); -} - -void cleanup() -{ - delete TimeManager::getCurrent(); - delete shader; + delete Simulation::getCurrent(); + delete base; + delete model; + + return 0; } void reset() { - model.reset(); - sim.reset(); - TimeManager::getCurrent()->setTime(0.0); -} - -void mouseMove(int x, int y) -{ - Vector3r mousePos; - MiniGL::unproject(x, y, mousePos); - const Vector3r diff = mousePos - oldMousePos; - - TimeManager *tm = TimeManager::getCurrent(); - const Real h = tm->getTimeStepSize(); + Utilities::Timing::printAverageTimes(); + Utilities::Timing::reset(); - SimulationModel::RigidBodyVector &rb = model.getRigidBodies(); - for (size_t j = 0; j < selectedBodies.size(); j++) - { - rb[selectedBodies[j]]->getVelocity() += 1.0 / h * diff; - } - oldMousePos = mousePos; + Simulation::getCurrent()->reset(); + base->getSelectedParticles().clear(); } -void selection(const Eigen::Vector2i &start, const Eigen::Vector2i &end) +void timeStep() { - std::vector hits; - selectedBodies.clear(); - - SimulationModel::RigidBodyVector &rb = model.getRigidBodies(); - std::vector > x; - x.resize(rb.size()); - for (unsigned int i = 0; i < rb.size(); i++) - { - x[i] = rb[i]->getPosition(); - } - - Selection::selectRect(start, end, &x[0], &x[rb.size() - 1], selectedBodies); - if (selectedBodies.size() > 0) - MiniGL::setMouseMoveFunc(GLUT_MIDDLE_BUTTON, mouseMove); - else - MiniGL::setMouseMoveFunc(-1, NULL); - - MiniGL::unproject(end[0], end[1], oldMousePos); -} + const Real pauseAt = base->getValue(DemoBase::PAUSE_AT); + if ((pauseAt > 0.0) && (pauseAt < TimeManager::getCurrent()->getTime())) + base->setValue(DemoBase::PAUSE, true); -void timeStep () -{ - if (doPause) + if (base->getValue(DemoBase::PAUSE)) return; // Simulation code - for (unsigned int i = 0; i < 8; i++) + SimulationModel *model = Simulation::getCurrent()->getModel(); + const unsigned int numSteps = base->getValue(DemoBase::NUM_STEPS_PER_RENDER); + for (unsigned int i = 0; i < numSteps; i++) { - sim.step(model); - // set target angle of motors for an animation - const Real currentTargetAngle = (Real)M_PI * 0.5 - (Real)M_PI * 0.5 * cos(0.25*TimeManager::getCurrent()->getTime()); - SimulationModel::ConstraintVector &constraints = model.getConstraints(); + const Real currentTargetAngle = static_cast(M_PI * 0.5) - static_cast(M_PI * 0.25) * (cos(static_cast(0.25)*TimeManager::getCurrent()->getTime()) + 1.0); + SimulationModel::ConstraintVector &constraints = model->getConstraints(); TargetAngleMotorHingeJoint &joint1 = (*(TargetAngleMotorHingeJoint*)constraints[8]); - TargetVelocityMotorHingeJoint &joint2 = (*(TargetVelocityMotorHingeJoint*)constraints[9]); - joint1.setTargetAngle(currentTargetAngle); - joint2.setTargetAngularVelocity(3.5); + TargetVelocityMotorHingeJoint &joint2 = (*(TargetVelocityMotorHingeJoint*)constraints[10]); + joint1.setTarget(currentTargetAngle); + joint2.setTarget(3.5); - const Real currentTargetPos = 1.5*sin(2.0*TimeManager::getCurrent()->getTime()); + const Real currentTargetPos = static_cast(1.5)*sin(static_cast(2.0)*TimeManager::getCurrent()->getTime()); TargetPositionMotorSliderJoint &joint3 = (*(TargetPositionMotorSliderJoint*)constraints[12]); - joint3.setTargetPosition(currentTargetPos); + joint3.setTarget(currentTargetPos); Real currentTargetVel = 0.25; - if (((int) (0.25*TimeManager::getCurrent()->getTime())) % 2 == 1) + if (((int)(0.25*TimeManager::getCurrent()->getTime())) % 2 == 1) currentTargetVel = -currentTargetVel; TargetVelocityMotorSliderJoint &joint4 = (*(TargetVelocityMotorSliderJoint*)constraints[14]); - joint4.setTargetVelocity(currentTargetVel); + joint4.setTarget(currentTargetVel); + + START_TIMING("SimStep"); + Simulation::getCurrent()->getTimeStep()->step(*model); + STOP_TIMING_AVG; + + base->step(); } } void buildModel () { - TimeManager::getCurrent ()->setTimeStepSize (0.005); - + TimeManager::getCurrent ()->setTimeStepSize (static_cast(0.005)); createBodyModel(); -} -void renderBallJoint(BallJoint &bj) -{ - MiniGL::drawSphere(bj.m_jointInfo.col(2), 0.1f, jointColor); -} - -void renderBallOnLineJoint(BallOnLineJoint &bj) -{ - MiniGL::drawSphere(bj.m_jointInfo.col(5), 0.1f, jointColor); - MiniGL::drawCylinder(bj.m_jointInfo.col(5) - bj.m_jointInfo.col(7), bj.m_jointInfo.col(5) + bj.m_jointInfo.col(7), jointColor, 0.05f); -} - -void renderHingeJoint(HingeJoint &hj) -{ - MiniGL::drawSphere(hj.m_jointInfo.col(6) - 0.5*hj.m_jointInfo.col(8), 0.1f, jointColor); - MiniGL::drawSphere(hj.m_jointInfo.col(6) + 0.5*hj.m_jointInfo.col(8), 0.1f, jointColor); - MiniGL::drawCylinder(hj.m_jointInfo.col(6) - 0.5*hj.m_jointInfo.col(8), hj.m_jointInfo.col(6) + 0.5*hj.m_jointInfo.col(8), jointColor, 0.05f); -} - -void renderUniversalJoint(UniversalJoint &uj) -{ - MiniGL::drawSphere(uj.m_jointInfo.col(4) - 0.5*uj.m_jointInfo.col(6), 0.1f, jointColor); - MiniGL::drawSphere(uj.m_jointInfo.col(4) + 0.5*uj.m_jointInfo.col(6), 0.1f, jointColor); - MiniGL::drawSphere(uj.m_jointInfo.col(5) - 0.5*uj.m_jointInfo.col(7), 0.1f, jointColor); - MiniGL::drawSphere(uj.m_jointInfo.col(5) + 0.5*uj.m_jointInfo.col(7), 0.1f, jointColor); - MiniGL::drawCylinder(uj.m_jointInfo.col(4) - 0.5*uj.m_jointInfo.col(6), uj.m_jointInfo.col(4) + 0.5*uj.m_jointInfo.col(6), jointColor, 0.05f); - MiniGL::drawCylinder(uj.m_jointInfo.col(5) - 0.5*uj.m_jointInfo.col(7), uj.m_jointInfo.col(5) + 0.5*uj.m_jointInfo.col(7), jointColor, 0.05f); -} - -void renderSliderJoint(SliderJoint &joint) -{ - MiniGL::drawSphere(joint.m_jointInfo.col(6), 0.1f, jointColor); - MiniGL::drawCylinder(joint.m_jointInfo.col(7) - joint.m_jointInfo.col(8), joint.m_jointInfo.col(7) + joint.m_jointInfo.col(8), jointColor, 0.05f); -} - -void renderTargetPositionMotorSliderJoint(TargetPositionMotorSliderJoint &joint) -{ - MiniGL::drawSphere(joint.m_jointInfo.col(6), 0.1f, jointColor); - MiniGL::drawCylinder(joint.m_jointInfo.col(7) - joint.m_jointInfo.col(8), joint.m_jointInfo.col(7) + joint.m_jointInfo.col(8), jointColor, 0.05f); -} - -void renderTargetVelocityMotorSliderJoint(TargetVelocityMotorSliderJoint &joint) -{ - MiniGL::drawSphere(joint.m_jointInfo.col(6), 0.1f, jointColor); - MiniGL::drawCylinder(joint.m_jointInfo.col(7) - joint.m_jointInfo.col(8), joint.m_jointInfo.col(7) + joint.m_jointInfo.col(8), jointColor, 0.05f); -} - -void renderTargetAngleMotorHingeJoint(TargetAngleMotorHingeJoint &hj) -{ - MiniGL::drawSphere(hj.m_jointInfo.col(6) - 0.5*hj.m_jointInfo.col(8), 0.1f, jointColor); - MiniGL::drawSphere(hj.m_jointInfo.col(6) + 0.5*hj.m_jointInfo.col(8), 0.1f, jointColor); - MiniGL::drawCylinder(hj.m_jointInfo.col(6) - 0.5*hj.m_jointInfo.col(8), hj.m_jointInfo.col(6) + 0.5*hj.m_jointInfo.col(8), jointColor, 0.05f); -} - -void renderTargetVelocityMotorHingeJoint(TargetVelocityMotorHingeJoint &hj) -{ - MiniGL::drawSphere(hj.m_jointInfo.col(6) - 0.5*hj.m_jointInfo.col(8), 0.1f, jointColor); - MiniGL::drawSphere(hj.m_jointInfo.col(6) + 0.5*hj.m_jointInfo.col(8), 0.1f, jointColor); - MiniGL::drawCylinder(hj.m_jointInfo.col(6) - 0.5*hj.m_jointInfo.col(8), hj.m_jointInfo.col(6) + 0.5*hj.m_jointInfo.col(8), jointColor, 0.05f); + LOG_INFO << "\nJoint types in simulation:"; + LOG_INFO << "--------------------------\n"; + LOG_INFO << "row 1: ball joint, ball-on-line joint, hinge joint, universal joint"; + LOG_INFO << "row 2: target angle hinge motor, target velocity hinge motor, target position motor, target velocity motor"; + LOG_INFO << "row 3: spring, distance joint, slider joint"; } void render () { - MiniGL::coordinateSystem(); - - // Draw sim model - - SimulationModel::RigidBodyVector &rb = model.getRigidBodies(); - SimulationModel::ConstraintVector &constraints = model.getConstraints(); - - float selectionColor[4] = { 0.8f, 0.0f, 0.0f, 1 }; - - if (shader) - { - shader->begin(); - glUniform1f(shader->getUniform("shininess"), 5.0); - glUniform1f(shader->getUniform("specular_factor"), 0.2f); - - GLfloat matrix[16]; - glGetFloatv(GL_MODELVIEW_MATRIX, matrix); - glUniformMatrix4fv(shader->getUniform("modelview_matrix"), 1, GL_FALSE, matrix); - GLfloat pmatrix[16]; - glGetFloatv(GL_PROJECTION_MATRIX, pmatrix); - glUniformMatrix4fv(shader->getUniform("projection_matrix"), 1, GL_FALSE, pmatrix); - } - - for (size_t i = 0; i < rb.size(); i++) - { - bool selected = false; - for (unsigned int j = 0; j < selectedBodies.size(); j++) - { - if (selectedBodies[j] == i) - selected = true; - } - - const VertexData &vd = rb[i]->getGeometry().getVertexData(); - const IndexedFaceMesh &mesh = rb[i]->getGeometry().getMesh(); - if (rb[i]->getMass() == 0.0) - { - if (shader) - glUniform3fv(shader->getUniform("surface_color"), 1, staticBodyColor); - Visualization::drawMesh(vd, mesh, 0, staticBodyColor); - } - else - { - if (!selected) - { - if (shader) - glUniform3fv(shader->getUniform("surface_color"), 1, dynamicBodyColor); - Visualization::drawMesh(vd, mesh, 0, dynamicBodyColor); - } - else - { - if (shader) - glUniform3fv(shader->getUniform("surface_color"), 1, selectionColor); - Visualization::drawMesh(vd, mesh, 0, selectionColor); - } - } - } - if (shader) - shader->end(); - - for (size_t i = 0; i < constraints.size(); i++) - { - if (constraints[i]->getTypeId() == BallJoint::TYPE_ID) - { - renderBallJoint(*(BallJoint*)constraints[i]); - } - else if (constraints[i]->getTypeId() == BallOnLineJoint::TYPE_ID) - { - renderBallOnLineJoint(*(BallOnLineJoint*)constraints[i]); - } - else if (constraints[i]->getTypeId() == HingeJoint::TYPE_ID) - { - renderHingeJoint(*(HingeJoint*)constraints[i]); - } - else if (constraints[i]->getTypeId() == UniversalJoint::TYPE_ID) - { - renderUniversalJoint(*(UniversalJoint*)constraints[i]); - } - else if (constraints[i]->getTypeId() == SliderJoint::TYPE_ID) - { - renderSliderJoint(*(SliderJoint*)constraints[i]); - } - else if (constraints[i]->getTypeId() == TargetAngleMotorHingeJoint::TYPE_ID) - { - renderTargetAngleMotorHingeJoint(*(TargetAngleMotorHingeJoint*)constraints[i]); - } - else if (constraints[i]->getTypeId() == TargetVelocityMotorHingeJoint::TYPE_ID) - { - renderTargetVelocityMotorHingeJoint(*(TargetVelocityMotorHingeJoint*)constraints[i]); - } - else if (constraints[i]->getTypeId() == TargetPositionMotorSliderJoint::TYPE_ID) - { - renderTargetPositionMotorSliderJoint(*(TargetPositionMotorSliderJoint*)constraints[i]); - } - else if (constraints[i]->getTypeId() == TargetVelocityMotorSliderJoint::TYPE_ID) - { - renderTargetVelocityMotorSliderJoint(*(TargetVelocityMotorSliderJoint*)constraints[i]); - } - } - - float textColor[4] = { 0.0, .2f, .4f, 1 }; - MiniGL::drawStrokeText(-0.5, 1.5, 1.0, 0.002f, "ball joint", 11, textColor); - MiniGL::drawStrokeText(3.0, 1.5, 1.0, 0.002f, "ball-on-line joint", 19, textColor); - MiniGL::drawStrokeText(7.3f, 1.5, 1.0, 0.002f, "hinge joint", 12, textColor); - MiniGL::drawStrokeText(11.2f, 1.5, 1.0, 0.002f, "universal joint", 15, textColor); - - MiniGL::drawStrokeText(-1.0, -4.0, 1.0, 0.002f, "motor hinge joint", 17, textColor); - MiniGL::drawStrokeText(3.4f, -4.0, 1.0, 0.002f, "slider joint", 12, textColor); - MiniGL::drawStrokeText(6.6f, -4.0, 1.0, 0.002f, "target position motor", 21, textColor); - MiniGL::drawStrokeText(10.6f, -4.0, 1.0, 0.002f, "target velocity motor", 21, textColor); - - MiniGL::drawTime( TimeManager::getCurrent ()->getTime ()); + base->render(); } // Compute diagonal inertia tensor Vector3r computeInertiaTensorBox(const Real mass, const Real width, const Real height, const Real depth) { - const Real Ix = (mass / 12.0) * (height*height + depth*depth); - const Real Iy = (mass / 12.0) * (width*width + depth*depth); - const Real Iz = (mass / 12.0) * (width*width + height*height); + const Real Ix = (mass / static_cast(12.0)) * (height*height + depth*depth); + const Real Iy = (mass / static_cast(12.0)) * (width*width + depth*depth); + const Real Iz = (mass / static_cast(12.0)) * (width*width + height*height); return Vector3r(Ix, Iy, Iz); } - /** Create the rigid body model */ void createBodyModel() { - SimulationModel::RigidBodyVector &rb = model.getRigidBodies(); + SimulationModel *model = Simulation::getCurrent()->getModel(); + SimulationModel::RigidBodyVector &rb = model->getRigidBodies(); - string fileName = dataPath + "/models/cube.obj"; + string fileName = FileSystem::normalizePath(base->getExePath() + "/resources/models/cube.obj"); IndexedFaceMesh mesh; VertexData vd; - OBJLoader::loadObj(fileName, vd, mesh, Vector3r(width, height, depth)); + DemoBase::loadMesh(fileName, vd, mesh, Vector3r::Zero(), Matrix3r::Identity(), Vector3r(width, height, depth)); + mesh.setFlatShading(true); IndexedFaceMesh meshStatic; VertexData vdStatic; - OBJLoader::loadObj(fileName, vdStatic, meshStatic, Vector3r(0.5, 0.5, 0.5)); + DemoBase::loadMesh(fileName, vdStatic, meshStatic, Vector3r::Zero(), Matrix3r::Identity(), Vector3r(0.5, 0.5, 0.5)); + meshStatic.setFlatShading(true); // static body - const unsigned int numberOfBodies = 24; + const unsigned int numberOfBodies = 33; rb.resize(numberOfBodies); Real startX = 0.0; - Real startY = 1.0; - for (unsigned int i = 0; i < 8; i++) + Real startY = 6.5; + for (unsigned int i = 0; i < 11; i++) { + if (i % 4 == 0) + { + startY -= 5.5; + startX = 0.0; + } + rb[3*i] = new RigidBody(); rb[3*i]->initBody(0.0, Vector3r(startX, startY, 1.0), @@ -413,7 +191,7 @@ void createBodyModel() // dynamic body rb[3*i+1] = new RigidBody(); rb[3*i+1]->initBody(1.0, - Vector3r(startX, startY-0.25, 2.0), + Vector3r(startX, startY- static_cast(0.25), static_cast(2.0)), computeInertiaTensorBox(1.0, width, height, depth), Quaternionr(1.0, 0.0, 0.0, 0.0), vd, mesh); @@ -421,86 +199,50 @@ void createBodyModel() // dynamic body rb[3 * i + 2] = new RigidBody(); rb[3 * i + 2]->initBody(1.0, - Vector3r(startX, startY - 0.25, 4.0), + Vector3r(startX, startY - static_cast(0.25), static_cast(4.0)), computeInertiaTensorBox(1.0, width, height, depth), Quaternionr(1.0, 0.0, 0.0, 0.0), vd, mesh); startX += 4.0; - - if (i == 3) - { - startY -= 5.5; - startX = 0.0; - } } -// // create geometries -// for (unsigned int i = 0; i < numberOfBodies; i++) -// { -// if (rb[i]->getMass() != 0.0) -// rb[i]->getGeometry().initMesh(vd.size(), mesh.numFaces(), &vd.getPosition(0), mesh.getFaces().data(), mesh.getUVIndices(), mesh.getUVs()); -// else -// rb[i]->getGeometry().initMesh(vdStatic.size(), meshStatic.numFaces(), &vdStatic.getPosition(0), meshStatic.getFaces().data(), meshStatic.getUVIndices(), meshStatic.getUVs()); -// rb[i]->getGeometry().updateMeshTransformation(rb[i]->getPosition(), rb[i]->getRotationMatrix()); -// } - Real jointY = 0.75; - model.addBallJoint(0, 1, Vector3r(0.25, jointY, 1.0)); - model.addBallJoint(1, 2, Vector3r(0.25, jointY, 3.0)); + model->addBallJoint(0, 1, Vector3r(0.25, jointY, 1.0)); + model->addBallJoint(1, 2, Vector3r(0.25, jointY, 3.0)); - model.addBallOnLineJoint(3, 4, Vector3r(4.25, jointY, 1.0), Vector3r(1.0, 0.0, 0.0)); - model.addBallJoint(4, 5, Vector3r(4.25, jointY, 3.0)); + model->addBallOnLineJoint(3, 4, Vector3r(4.25, jointY, 1.0), Vector3r(1.0, 0.0, 0.0)); + model->addBallJoint(4, 5, Vector3r(4.25, jointY, 3.0)); - model.addHingeJoint(6, 7, Vector3r(8.0, jointY, 1.0), Vector3r(1.0, 0.0, 0.0)); - model.addBallJoint(7, 8, Vector3r(8.25, jointY, 3.0)); + model->addHingeJoint(6, 7, Vector3r(8.0, jointY, 1.0), Vector3r(1.0, 0.0, 0.0)); + model->addBallJoint(7, 8, Vector3r(8.25, jointY, 3.0)); - model.addUniversalJoint(9, 10, Vector3r(12.0, jointY, 1.0), Vector3r(1.0, 0.0, 0.0), Vector3r(0.0, 1.0, 0.0)); - model.addBallJoint(10, 11, Vector3r(12.25, jointY, 3.0)); + model->addUniversalJoint(9, 10, Vector3r(12.0, jointY, 1.0), Vector3r(1.0, 0.0, 0.0), Vector3r(0.0, 1.0, 0.0)); + model->addBallJoint(10, 11, Vector3r(12.25, jointY, 3.0)); jointY -= 5.5; - model.addTargetAngleMotorHingeJoint(12, 13, Vector3r(0.0, jointY, 1.0), Vector3r(1.0, 0.0, 0.0)); - model.addTargetVelocityMotorHingeJoint(13, 14, Vector3r(0.0, jointY, 3.0), Vector3r(0.0, 1.0, 0.0)); + model->addTargetAngleMotorHingeJoint(12, 13, Vector3r(0.0, jointY, 1.0), Vector3r(1.0, 0.0, 0.0)); + model->addBallJoint(13, 14, Vector3r(0.25, jointY, 3.0)); - model.addSliderJoint(15, 16, Vector3r(4.0, jointY, 1.0), Vector3r(1.0, 0.0, 0.0)); - model.addBallJoint(16, 17, Vector3r(4.25, jointY, 3.0)); + model->addTargetVelocityMotorHingeJoint(15, 16, Vector3r(4.0, jointY, 1.0), Vector3r(1.0, 0.0, 0.0)); + model->addBallJoint(16, 17, Vector3r(4.25, jointY, 3.0)); - model.addTargetPositionMotorSliderJoint(18, 19, Vector3r(8.0, jointY, 1.0), Vector3r(1.0, 0.0, 0.0)); - model.addBallJoint(19, 20, Vector3r(8.25, jointY, 3.0)); + model->addTargetPositionMotorSliderJoint(18, 19, Vector3r(1.0, 0.0, 0.0)); + model->addBallJoint(19, 20, Vector3r(8.25, jointY, 3.0)); - model.addTargetVelocityMotorSliderJoint(21, 22, Vector3r(12.0, jointY, 1.0), Vector3r(1.0, 0.0, 0.0)); - model.addBallJoint(22, 23, Vector3r(12.25, jointY, 3.0)); -} + model->addTargetVelocityMotorSliderJoint(21, 22, Vector3r(1.0, 0.0, 0.0)); + model->addBallJoint(22, 23, Vector3r(12.25, jointY, 3.0)); -void TW_CALL setTimeStep(const void *value, void *clientData) -{ - const Real val = *(const Real *)(value); - TimeManager::getCurrent()->setTimeStepSize(val); -} + jointY -= 5.5; + model->addRigidBodySpring(24, 25, Vector3r(0.25, jointY, 1.0), Vector3r(0.25, jointY, 1.0), 50.0); + model->addBallJoint(25, 26, Vector3r(0.25, jointY, 3.0)); -void TW_CALL getTimeStep(void *value, void *clientData) -{ - *(Real *)(value) = TimeManager::getCurrent()->getTimeStepSize(); -} + model->addDistanceJoint(27, 28, Vector3r(4.25, jointY, 1.0), Vector3r(4.25, jointY, 2.0)); + model->addBallJoint(28, 29, Vector3r(4.25, jointY, 3.0)); -void TW_CALL setVelocityUpdateMethod(const void *value, void *clientData) -{ - const short val = *(const short *)(value); - ((TimeStepController*)clientData)->setVelocityUpdateMethod((unsigned int)val); + model->addSliderJoint(30, 31, Vector3r(1.0, 0.0, 0.0)); + model->addBallJoint(31, 32, Vector3r(8.25, jointY, 3.0)); } -void TW_CALL getVelocityUpdateMethod(void *value, void *clientData) -{ - *(short *)(value) = (short)((TimeStepController*)clientData)->getVelocityUpdateMethod(); -} -void TW_CALL setMaxIterations(const void *value, void *clientData) -{ - const unsigned int val = *(const unsigned int *)(value); - ((TimeStepController*)clientData)->setMaxIterations(val); -} -void TW_CALL getMaxIterations(void *value, void *clientData) -{ - *(unsigned int *)(value) = ((TimeStepController*)clientData)->getMaxIterations(); -} diff --git a/Demos/SceneLoaderDemo/CMakeLists.txt b/Demos/SceneLoaderDemo/CMakeLists.txt index b1f92188..7cf9866f 100644 --- a/Demos/SceneLoaderDemo/CMakeLists.txt +++ b/Demos/SceneLoaderDemo/CMakeLists.txt @@ -1,48 +1,52 @@ -set(SIMULATION_LINK_LIBRARIES AntTweakBar glew PositionBasedDynamics Simulation) -set(SIMULATION_DEPENDENCIES AntTweakBar glew PositionBasedDynamics Simulation) - - -set(Boost_USE_STATIC_LIBS ON) -add_definitions(-DBOOST_ALL_NO_LIB) -find_package( Boost 1.55 COMPONENTS filesystem system REQUIRED ) -include_directories( ${Boost_INCLUDE_DIR} ) +set(SIMULATION_LINK_LIBRARIES imgui glfw MD5 PositionBasedDynamics Simulation Utils) +set(SIMULATION_DEPENDENCIES imgui glfw MD5 PositionBasedDynamics Simulation Utils CopyPBDShaders CopyImguiFonts) if(WIN32) - set(SIMULATION_LINK_LIBRARIES freeglut opengl32.lib glu32.lib ${SIMULATION_LINK_LIBRARIES} ${Boost_LIBRARIES}) - set(SIMULATION_DEPENDENCIES freeglut ${SIMULATION_DEPENDENCIES}) + set(SIMULATION_LINK_LIBRARIES opengl32.lib glu32.lib ${SIMULATION_LINK_LIBRARIES}) + #set(SIMULATION_DEPENDENCIES ${SIMULATION_DEPENDENCIES}) else() - find_package(GLUT REQUIRED) + set(OpenGL_GL_PREFERENCE GLVND) find_package(OpenGL REQUIRED) + include_directories( ${OPENGL_INCLUDE_DIRS}) set(SIMULATION_LINK_LIBRARIES ${SIMULATION_LINK_LIBRARIES} - ${GLUT_LIBRARIES} ${OPENGL_LIBRARIES} - ${Boost_LIBRARIES} ) endif() +############################################################ +# Discregrid +############################################################ +include_directories(${Discregrid_INCLUDE_DIR}) +if (TARGET Ext_Discregrid) + set(SIMULATION_DEPENDENCIES ${SIMULATION_DEPENDENCIES} Ext_Discregrid) +endif() +set(SIMULATION_LINK_LIBRARIES ${SIMULATION_LINK_LIBRARIES} ${Discregrid_LIBRARIES}) + + +############################################################ +# GenericParameters +############################################################ +include_directories(${GenericParameters_INCLUDE_DIR}) +if(TARGET Ext_GenericParameters) + set(SIMULATION_DEPENDENCIES ${SIMULATION_DEPENDENCIES} Ext_GenericParameters) +endif() + add_executable(SceneLoaderDemo SceneLoaderDemo.cpp + + ../Common/LogWindow.cpp + ../Common/LogWindow.h + ../Common/Simulator_GUI_imgui.cpp + ../Common/Simulator_GUI_imgui.h + ../Common/imguiParameters.cpp + ../Common/imguiParameters.h + ../Common/DemoBase.cpp + ../Common/DemoBase.h ${VIS_FILES} ${PROJECT_PATH}/Common/Common.h - ${PROJECT_PATH}/Demos/Common/Config.h - ${PROJECT_PATH}/Demos/Utils/IndexedFaceMesh.cpp - ${PROJECT_PATH}/Demos/Utils/IndexedFaceMesh.h - ${PROJECT_PATH}/Demos/Utils/IndexedTetMesh.cpp - ${PROJECT_PATH}/Demos/Utils/IndexedTetMesh.h - ${PROJECT_PATH}/Demos/Utils/OBJLoader.cpp - ${PROJECT_PATH}/Demos/Utils/OBJLoader.h - ${PROJECT_PATH}/Demos/Utils/ObjectArray.h - ${PROJECT_PATH}/Demos/Utils/SceneLoader.cpp - ${PROJECT_PATH}/Demos/Utils/SceneLoader.h - ${PROJECT_PATH}/Demos/Utils/TetGenLoader.cpp - ${PROJECT_PATH}/Demos/Utils/TetGenLoader.h - ${PROJECT_PATH}/Demos/Utils/Utilities.cpp - ${PROJECT_PATH}/Demos/Utils/Utilities.h - ${PROJECT_PATH}/Demos/Utils/VolumeIntegration.cpp - ${PROJECT_PATH}/Demos/Utils/VolumeIntegration.h CMakeLists.txt ) @@ -54,8 +58,6 @@ set_target_properties(SceneLoaderDemo PROPERTIES MINSIZEREL_POSTFIX ${CMAKE_MINS add_dependencies(SceneLoaderDemo ${SIMULATION_DEPENDENCIES}) target_link_libraries(SceneLoaderDemo ${SIMULATION_LINK_LIBRARIES}) - -add_definitions(-DTW_NO_LIB_PRAGMA -DTW_STATIC) find_package( Eigen3 REQUIRED ) include_directories( ${EIGEN3_INCLUDE_DIR} ) include_directories(${PROJECT_PATH}/extern/freeglut/include) diff --git a/Demos/SceneLoaderDemo/SceneLoaderDemo.cpp b/Demos/SceneLoaderDemo/SceneLoaderDemo.cpp index 9254b8d4..733c3872 100644 --- a/Demos/SceneLoaderDemo/SceneLoaderDemo.cpp +++ b/Demos/SceneLoaderDemo/SceneLoaderDemo.cpp @@ -1,103 +1,46 @@ -#include "Demos/Common/Config.h" +#include "Common/Common.h" #include "Demos/Visualization/MiniGL.h" #include "Demos/Visualization/Selection.h" -#include "GL/glut.h" -#include "Demos/Simulation/TimeManager.h" +#include "Simulation/TimeManager.h" #include -#include "Demos/Simulation/SimulationModel.h" -#include "Demos/Simulation/TimeStepController.h" +#include "Simulation/SimulationModel.h" +#include "Simulation/TimeStepController.h" #include -#include "Demos/Utils/OBJLoader.h" #include "Demos/Visualization/Visualization.h" -#include "Demos/Utils/Utilities.h" -#include "Demos/Simulation/DistanceFieldCollisionDetection.h" -#include "Demos/Utils/SceneLoader.h" -#include "Demos/Utils/TetGenLoader.h" +#include "Simulation/DistanceFieldCollisionDetection.h" +#include "Utils/SceneLoader.h" +#include "Utils/TetGenLoader.h" +#include "Simulation/CubicSDFCollisionDetection.h" +#include "Utils/Logger.h" +#include "Utils/Timing.h" +#include "Utils/FileSystem.h" +#include "Demos/Common/DemoBase.h" +#include "Simulation/Simulation.h" #define _USE_MATH_DEFINES #include "math.h" - // Enable memory leak detection -#ifdef _DEBUG +#if defined(_DEBUG) && !defined(EIGEN_ALIGN) #define new DEBUG_NEW #endif using namespace PBD; using namespace Eigen; using namespace std; +using namespace Utilities; void timeStep (); void buildModel (); -void readScene(); +void readScene(const bool readFile); void render (); void reset(); -void cleanup(); -void initShader(); -void selection(const Eigen::Vector2i &start, const Eigen::Vector2i &end); -void TW_CALL setTimeStep(const void *value, void *clientData); -void TW_CALL getTimeStep(void *value, void *clientData); -void TW_CALL setVelocityUpdateMethod(const void *value, void *clientData); -void TW_CALL getVelocityUpdateMethod(void *value, void *clientData); -void TW_CALL setMaxIterations(const void *value, void *clientData); -void TW_CALL getMaxIterations(void *value, void *clientData); -void TW_CALL setMaxIterationsV(const void *value, void *clientData); -void TW_CALL getMaxIterationsV(void *value, void *clientData); -void TW_CALL setContactTolerance(const void *value, void *clientData); -void TW_CALL getContactTolerance(void *value, void *clientData); -void TW_CALL setContactStiffnessRigidBody(const void *value, void *clientData); -void TW_CALL getContactStiffnessRigidBody(void *value, void *clientData); -void TW_CALL setContactStiffnessParticleRigidBody(const void *value, void *clientData); -void TW_CALL getContactStiffnessParticleRigidBody(void *value, void *clientData); -void TW_CALL setStiffness(const void *value, void *clientData); -void TW_CALL getStiffness(void *value, void *clientData); -void TW_CALL setXXStiffness(const void *value, void *clientData); -void TW_CALL getXXStiffness(void *value, void *clientData); -void TW_CALL setYYStiffness(const void *value, void *clientData); -void TW_CALL getYYStiffness(void *value, void *clientData); -void TW_CALL setXYStiffness(const void *value, void *clientData); -void TW_CALL getXYStiffness(void *value, void *clientData); -void TW_CALL setXYPoissonRatio(const void *value, void *clientData); -void TW_CALL getXYPoissonRatio(void *value, void *clientData); -void TW_CALL setYXPoissonRatio(const void *value, void *clientData); -void TW_CALL getYXPoissonRatio(void *value, void *clientData); -void TW_CALL setNormalizeStretch(const void *value, void *clientData); -void TW_CALL getNormalizeStretch(void *value, void *clientData); -void TW_CALL setNormalizeShear(const void *value, void *clientData); -void TW_CALL getNormalizeShear(void *value, void *clientData); -void TW_CALL setBendingStiffness(const void *value, void *clientData); -void TW_CALL getBendingStiffness(void *value, void *clientData); -void TW_CALL setBendingMethod(const void *value, void *clientData); -void TW_CALL getBendingMethod(void *value, void *clientData); -void TW_CALL setClothSimulationMethod(const void *value, void *clientData); -void TW_CALL getClothSimulationMethod(void *value, void *clientData); -void TW_CALL setSolidSimulationMethod(const void *value, void *clientData); -void TW_CALL getSolidSimulationMethod(void *value, void *clientData); - - -SimulationModel model; -DistanceFieldCollisionDetection cd; -TimeStepController sim; - -short clothSimulationMethod = 2; -short solidSimulationMethod = 2; -short bendingMethod = 2; -bool doPause = true; -std::vector selectedBodies; -std::vector selectedParticles; -Vector3r oldMousePos; -Shader *shader; -Shader *shaderTex; -bool renderContacts = false; -string exePath; -string dataPath; -bool drawAABB = false; -int drawBVHDepth = -1; -float jointColor[4] = { 0.0f, 0.6f, 0.2f, 1 }; -string sceneFileName = "/scenes/DeformableSolidCollisionScene.json"; -string sceneName; + + +DemoBase *base; Vector3r camPos; Vector3r camLookat; +CubicSDFCollisionDetection *cd; // main @@ -105,779 +48,377 @@ int main( int argc, char **argv ) { REPORT_MEMORY_LEAKS - exePath = Utilities::getFilePath(argv[0]); - dataPath = exePath + "/" + std::string(PBD_DATA_PATH); + std::string exePath = FileSystem::getProgramPath(); + std::string sceneFileName; if (argc > 1) sceneFileName = string(argv[1]); else - sceneFileName = dataPath + sceneFileName; + { + std::cerr << "Usage: SceneLoaderDemo [scene_file]\n"; + exit(1); + } - buildModel(); + base = new DemoBase(); + base->init(argc, argv, sceneFileName.c_str()); - // OpenGL - MiniGL::init(argc, argv, 1024, 768, 0, 0, sceneName.c_str()); - MiniGL::initLights (); - MiniGL::initTexture(); - MiniGL::setClientIdleFunc (50, timeStep); - MiniGL::setKeyFunc(0, 'r', reset); - MiniGL::setSelectionFunc(selection); - initShader(); + SimulationModel *model = new SimulationModel(); + model->init(); + Simulation::getCurrent()->setModel(model); - MiniGL::setClientSceneFunc(render); - MiniGL::setViewport(40.0f, 0.1f, 500.0f, camPos, camLookat); + cd = new CubicSDFCollisionDetection(); + cd->init(); - TwAddVarRW(MiniGL::getTweakBar(), "Pause", TW_TYPE_BOOLCPP, &doPause, " label='Pause' group=Simulation key=SPACE "); - TwAddVarRW(MiniGL::getTweakBar(), "RenderContacts", TW_TYPE_BOOLCPP, &renderContacts, " label='Render contacts' group=Simulation "); - TwAddVarRW(MiniGL::getTweakBar(), "RenderAABBs", TW_TYPE_BOOLCPP, &drawAABB, " label='Render AABBs' group=Simulation "); - TwAddVarRW(MiniGL::getTweakBar(), "RenderBVH", TW_TYPE_INT32, &drawBVHDepth, " label='Render BVH depth' group=Simulation "); - TwAddVarCB(MiniGL::getTweakBar(), "TimeStepSize", TW_TYPE_REAL, setTimeStep, getTimeStep, &model, " label='Time step size' min=0.0 max = 0.1 step=0.001 precision=4 group=Simulation "); - TwType enumType = TwDefineEnum("VelocityUpdateMethodType", NULL, 0); - TwAddVarCB(MiniGL::getTweakBar(), "VelocityUpdateMethod", enumType, setVelocityUpdateMethod, getVelocityUpdateMethod, &sim, " label='Velocity update method' enum='0 {First Order Update}, 1 {Second Order Update}' group=Simulation"); - TwAddVarCB(MiniGL::getTweakBar(), "MaxIter", TW_TYPE_UINT32, setMaxIterations, getMaxIterations, &sim, " label='Max. iterations' min=1 step=1 group=Simulation "); - TwAddVarCB(MiniGL::getTweakBar(), "MaxIterV", TW_TYPE_UINT32, setMaxIterationsV, getMaxIterationsV, &sim, " label='Max. iterations Vel.' min=1 step=1 group=Simulation "); - TwAddVarCB(MiniGL::getTweakBar(), "ContactTolerance", TW_TYPE_REAL, setContactTolerance, getContactTolerance, &cd, " label='Contact tolerance' min=0.0 step=0.001 precision=3 group=Simulation "); - TwAddVarCB(MiniGL::getTweakBar(), "ContactStiffnessRigidBody", TW_TYPE_REAL, setContactStiffnessRigidBody, getContactStiffnessRigidBody, &model, " label='Contact stiffness RB' min=0.0 step=0.1 precision=2 group=Simulation "); - TwAddVarCB(MiniGL::getTweakBar(), "ContactStiffnessParticleRigidBody", TW_TYPE_REAL, setContactStiffnessParticleRigidBody, getContactStiffnessParticleRigidBody, &model, " label='Contact stiffness Particle-RB' min=0.0 step=0.1 precision=2 group=Simulation "); - TwType enumType2 = TwDefineEnum("ClothSimulationMethodType", NULL, 0); - TwAddVarCB(MiniGL::getTweakBar(), "ClothSimulationMethod", enumType2, setClothSimulationMethod, getClothSimulationMethod, &clothSimulationMethod, " label='Cloth sim. method' enum='0 {None}, 1 {Distance constraints}, 2 {FEM based PBD}, 3 {Strain based dynamics}' group=Simulation"); - TwType enumType3 = TwDefineEnum("SolidSimulationMethodType", NULL, 0); - TwAddVarCB(MiniGL::getTweakBar(), "SolidSimulationMethod", enumType3, setSolidSimulationMethod, getSolidSimulationMethod, &solidSimulationMethod, - " label='Solid sim. method' enum='0 {None}, 1 {Volume constraints}, 2 {FEM based PBD}, 3 {Strain based dynamics (no inversion handling)}, 4 {Shape matching (no inversion handling)}' group=Simulation"); - TwAddVarCB(MiniGL::getTweakBar(), "Stiffness", TW_TYPE_REAL, setStiffness, getStiffness, &model, " label='Stiffness' min=0.0 step=0.1 precision=4 group='Distance constraints' "); - TwAddVarCB(MiniGL::getTweakBar(), "XXStiffness", TW_TYPE_REAL, setXXStiffness, getXXStiffness, &model, " label='Stiffness XX' min=0.0 step=0.1 precision=4 group='Strain based dynamics' "); - TwAddVarCB(MiniGL::getTweakBar(), "YYStiffness", TW_TYPE_REAL, setYYStiffness, getYYStiffness, &model, " label='Stiffness YY' min=0.0 step=0.1 precision=4 group='Strain based dynamics' "); - TwAddVarCB(MiniGL::getTweakBar(), "XYStiffness", TW_TYPE_REAL, setXYStiffness, getXYStiffness, &model, " label='Stiffness XY' min=0.0 step=0.1 precision=4 group='Strain based dynamics' "); - TwAddVarCB(MiniGL::getTweakBar(), "XXStiffnessFEM", TW_TYPE_REAL, setXXStiffness, getXXStiffness, &model, " label='Youngs modulus XX' min=0.0 step=0.1 precision=4 group='FEM based PBD' "); - TwAddVarCB(MiniGL::getTweakBar(), "YYStiffnessFEM", TW_TYPE_REAL, setYYStiffness, getYYStiffness, &model, " label='Youngs modulus YY' min=0.0 step=0.1 precision=4 group='FEM based PBD' "); - TwAddVarCB(MiniGL::getTweakBar(), "XYStiffnessFEM", TW_TYPE_REAL, setXYStiffness, getXYStiffness, &model, " label='Youngs modulus XY' min=0.0 step=0.1 precision=4 group='FEM based PBD' "); - TwAddVarCB(MiniGL::getTweakBar(), "XYPoissonRatioFEM", TW_TYPE_REAL, setXYPoissonRatio, getXYPoissonRatio, &model, " label='Poisson ratio XY' min=0.0 step=0.1 precision=4 group='FEM based PBD' "); - TwAddVarCB(MiniGL::getTweakBar(), "YXPoissonRatioFEM", TW_TYPE_REAL, setYXPoissonRatio, getYXPoissonRatio, &model, " label='Poisson ratio YX' min=0.0 step=0.1 precision=4 group='FEM based PBD' "); - TwAddVarCB(MiniGL::getTweakBar(), "NormalizeStretch", TW_TYPE_BOOL32, setNormalizeStretch, getNormalizeStretch, &model, " label='Normalize stretch' group='Strain based dynamics' "); - TwAddVarCB(MiniGL::getTweakBar(), "NormalizeShear", TW_TYPE_BOOL32, setNormalizeShear, getNormalizeShear, &model, " label='Normalize shear' group='Strain based dynamics' "); - TwType enumType4 = TwDefineEnum("BendingMethodType", NULL, 0); - TwAddVarCB(MiniGL::getTweakBar(), "BendingMethod", enumType4, setBendingMethod, getBendingMethod, &bendingMethod, " label='Bending method' enum='0 {None}, 1 {Dihedral angle}, 2 {Isometric bending}' group=Bending"); - TwAddVarCB(MiniGL::getTweakBar(), "BendingStiffness", TW_TYPE_REAL, setBendingStiffness, getBendingStiffness, &model, " label='Bending stiffness' min=0.0 step=0.01 precision=4 group=Bending "); - - glutMainLoop (); - - cleanup (); - - return 0; -} + buildModel(); -void initShader() -{ - std::string vertFile = dataPath + "/shaders/vs_smooth.glsl"; - std::string fragFile = dataPath + "/shaders/fs_smooth.glsl"; - shader = MiniGL::createShader(vertFile, "", fragFile); + base->createParameterGUI(); - if (shader == NULL) - return; + // reset simulation when cloth simulation/bending method has changed + model->setClothSimulationMethodChangedCallback([&]() { reset(); }); + model->setClothBendingMethodChangedCallback([&]() { reset(); }); + model->setSolidSimulationMethodChangedCallback([&]() { reset(); }); - shader->begin(); - shader->addUniform("modelview_matrix"); - shader->addUniform("projection_matrix"); - shader->addUniform("surface_color"); - shader->addUniform("shininess"); - shader->addUniform("specular_factor"); - shader->end(); + base->readParameters(); - std::string vertFileTex = dataPath + "/shaders/vs_smoothTex.glsl"; - std::string fragFileTex = dataPath + "/shaders/fs_smoothTex.glsl"; - shaderTex = MiniGL::createShader(vertFileTex, "", fragFileTex); + // OpenGL + MiniGL::setClientIdleFunc (timeStep); + MiniGL::addKeyFunc('r', reset); + MiniGL::setClientSceneFunc(render); + MiniGL::setViewport(40.0f, 0.1f, 500.0f, camPos, camLookat); + + SimulationModel::TriangleModelVector &triModels = model->getTriangleModels(); + SimulationModel::TetModelVector &tetModels = model->getTetModels(); + MiniGL::mainLoop(); - if (shaderTex == NULL) - return; + base->cleanup(); - shaderTex->begin(); - shaderTex->addUniform("modelview_matrix"); - shaderTex->addUniform("projection_matrix"); - shaderTex->addUniform("surface_color"); - shaderTex->addUniform("shininess"); - shaderTex->addUniform("specular_factor"); - shaderTex->end(); -} + Utilities::Timing::printAverageTimes(); + Utilities::Timing::printTimeSums(); -void cleanup() -{ - delete TimeManager::getCurrent(); - delete shader; - delete shaderTex; + delete Simulation::getCurrent(); + delete base; + delete model; + delete cd; + + return 0; } void reset() { - sim.getCollisionDetection()->cleanup(); - model.cleanup(); - sim.reset(); - TimeManager::getCurrent()->setTime(0.0); - readScene(); -} + const Real h = TimeManager::getCurrent()->getTimeStepSize(); + Utilities::Timing::printAverageTimes(); + Utilities::Timing::reset(); -void mouseMove(int x, int y) -{ - Vector3r mousePos; - MiniGL::unproject(x, y, mousePos); - const Vector3r diff = mousePos - oldMousePos; + Simulation::getCurrent()->reset(); + base->getSelectedParticles().clear(); - TimeManager *tm = TimeManager::getCurrent(); - const Real h = tm->getTimeStepSize(); + Simulation::getCurrent()->getModel()->cleanup(); + Simulation::getCurrent()->getTimeStep()->getCollisionDetection()->cleanup(); - SimulationModel::RigidBodyVector &rb = model.getRigidBodies(); - for (size_t j = 0; j < selectedBodies.size(); j++) - { - if (rb[selectedBodies[j]]->getMass() != 0.0) - rb[selectedBodies[j]]->getVelocity() += 1.0 / h * diff; - } - ParticleData &pd = model.getParticles(); - for (unsigned int j = 0; j < selectedParticles.size(); j++) - { - pd.getVelocity(selectedParticles[j]) += 5.0*diff / h; - } - oldMousePos = mousePos; -} - -void selection(const Eigen::Vector2i &start, const Eigen::Vector2i &end) -{ - std::vector hits; - - selectedParticles.clear(); - ParticleData &pd = model.getParticles(); - if (pd.size() > 0) - Selection::selectRect(start, end, &pd.getPosition(0), &pd.getPosition(pd.size() - 1), selectedParticles); - - selectedBodies.clear(); - SimulationModel::RigidBodyVector &rb = model.getRigidBodies(); - std::vector > x; - x.resize(rb.size()); - for (unsigned int i = 0; i < rb.size(); i++) - { - x[i] = rb[i]->getPosition(); - } - - if (rb.size() > 0) - Selection::selectRect(start, end, &x[0], &x[rb.size() - 1], selectedBodies); - if ((selectedBodies.size() > 0) || (selectedParticles.size() > 0)) - MiniGL::setMouseMoveFunc(GLUT_MIDDLE_BUTTON, mouseMove); - else - MiniGL::setMouseMoveFunc(-1, NULL); - - MiniGL::unproject(end[0], end[1], oldMousePos); + readScene(false); + TimeManager::getCurrent()->setTimeStepSize(h); } void timeStep () { - if (doPause) + const Real pauseAt = base->getValue(DemoBase::PAUSE_AT); + if ((pauseAt > 0.0) && (pauseAt < TimeManager::getCurrent()->getTime())) + base->setValue(DemoBase::PAUSE, true); + + if (base->getValue(DemoBase::PAUSE)) return; // Simulation code - for (unsigned int i = 0; i < 8; i++) - sim.step(model); + SimulationModel *model = Simulation::getCurrent()->getModel(); + const unsigned int numSteps = base->getValue(DemoBase::NUM_STEPS_PER_RENDER); + for (unsigned int i = 0; i < numSteps; i++) + { + START_TIMING("SimStep"); + Simulation::getCurrent()->getTimeStep()->step(*model); + STOP_TIMING_AVG; + + base->step(); + } // Update visualization models - const ParticleData &pd = model.getParticles(); - for (unsigned int i = 0; i < model.getTetModels().size(); i++) + const ParticleData &pd = model->getParticles(); + for (unsigned int i = 0; i < model->getTetModels().size(); i++) { - model.getTetModels()[i]->updateMeshNormals(pd); - model.getTetModels()[i]->updateVisMesh(pd); + model->getTetModels()[i]->updateMeshNormals(pd); + model->getTetModels()[i]->updateVisMesh(pd); } - for (unsigned int i = 0; i < model.getTriangleModels().size(); i++) + for (unsigned int i = 0; i < model->getTriangleModels().size(); i++) { - model.getTriangleModels()[i]->updateMeshNormals(pd); + model->getTriangleModels()[i]->updateMeshNormals(pd); } + //base->setValue(DemoBase::PAUSE, true); } -void buildModel () +void render() { - TimeManager::getCurrent ()->setTimeStepSize (0.005); - - sim.setCollisionDetection(model, &cd); - - readScene(); + base->render(); } -void renderTriangleModels() +void buildModel () { - const ParticleData &pd = model.getParticles(); - float surfaceColor[4] = { 0.8f, 0.9f, 0.2f, 1 }; - - if (shaderTex) - { - shaderTex->begin(); - glUniform1f(shaderTex->getUniform("shininess"), 5.0f); - glUniform1f(shaderTex->getUniform("specular_factor"), 0.2f); - - GLfloat matrix[16]; - glGetFloatv(GL_MODELVIEW_MATRIX, matrix); - glUniformMatrix4fv(shaderTex->getUniform("modelview_matrix"), 1, GL_FALSE, matrix); - GLfloat pmatrix[16]; - glGetFloatv(GL_PROJECTION_MATRIX, pmatrix); - glUniformMatrix4fv(shaderTex->getUniform("projection_matrix"), 1, GL_FALSE, pmatrix); - - glUniform3fv(shaderTex->getUniform("surface_color"), 1, surfaceColor); - } + TimeManager::getCurrent ()->setTimeStepSize (static_cast(0.005)); - for (unsigned int i = 0; i < model.getTriangleModels().size(); i++) - { - // mesh - const IndexedFaceMesh &mesh = model.getTriangleModels()[i]->getParticleMesh(); - const unsigned int offset = model.getTriangleModels()[i]->getIndexOffset(); - Visualization::drawTexturedMesh(pd, mesh, offset, surfaceColor); - } + SimulationModel *model = Simulation::getCurrent()->getModel(); + Simulation::getCurrent()->getTimeStep()->setCollisionDetection(*model, cd); - if (shaderTex) - shaderTex->end(); + readScene(true); } -void renderTetModels() +void initTriangleModelConstraints() { - const ParticleData &pd = model.getParticles(); - float surfaceColor[4] = { 0.8f, 0.4f, 0.7f, 1 }; - - if (shader) + // init constraints + SimulationModel *model = Simulation::getCurrent()->getModel(); + for (unsigned int cm = 0; cm < model->getTriangleModels().size(); cm++) { - shader->begin(); - glUniform1f(shader->getUniform("shininess"), 5.0f); - glUniform1f(shader->getUniform("specular_factor"), 0.2f); - - GLfloat matrix[16]; - glGetFloatv(GL_MODELVIEW_MATRIX, matrix); - glUniformMatrix4fv(shader->getUniform("modelview_matrix"), 1, GL_FALSE, matrix); - GLfloat pmatrix[16]; - glGetFloatv(GL_PROJECTION_MATRIX, pmatrix); - glUniformMatrix4fv(shader->getUniform("projection_matrix"), 1, GL_FALSE, pmatrix); - - glUniform3fv(shader->getUniform("surface_color"), 1, surfaceColor); - } + model->setClothStiffness(1.0); + if (model->getClothSimulationMethod() == 4) + model->setClothStiffness(100000); + model->addClothConstraints(model->getTriangleModels()[cm], model->getClothSimulationMethod(), model->getClothStiffness(), model->getClothStiffnessXX(), + model->getClothStiffnessYY(), model->getClothStiffnessXY(), model->getClothPoissonRatioXY(), model->getClothPoissonRatioYX(), + model->getClothNormalizeStretch(), model->getClothNormalizeShear()); - for (unsigned int i = 0; i < model.getTetModels().size(); i++) - { - const VertexData &vdVis = model.getTetModels()[i]->getVisVertices(); - if (vdVis.size() > 0) - { - const IndexedFaceMesh &visMesh = model.getTetModels()[i]->getVisMesh(); - Visualization::drawMesh(vdVis, visMesh, 0, surfaceColor); - } - else - { - const IndexedFaceMesh &surfaceMesh = model.getTetModels()[i]->getSurfaceMesh(); - const unsigned int offset = model.getTetModels()[i]->getIndexOffset(); - Visualization::drawMesh(pd, surfaceMesh, offset, surfaceColor); - } + model->setClothBendingStiffness(0.01); + if (model->getClothBendingMethod() == 3) + model->setClothBendingStiffness(100.0); + model->addBendingConstraints(model->getTriangleModels()[cm], model->getClothBendingMethod(), model->getClothBendingStiffness()); } - - if (shader) - shader->end(); } -void renderAABB(AABB &aabb) +void initTetModelConstraints() { - Vector3r p1, p2; - glBegin(GL_LINES); - for (unsigned char i = 0; i < 12; i++) + // init constraints + SimulationModel *model = Simulation::getCurrent()->getModel(); + model->setSolidStiffness(1.0); + if (model->getSolidSimulationMethod() == 3) + model->setSolidStiffness(1000000); + if (model->getSolidSimulationMethod() == 6) + model->setSolidStiffness(100000); + + model->setSolidVolumeStiffness(1.0); + if (model->getSolidSimulationMethod() == 6) + model->setSolidVolumeStiffness(100000); + for (unsigned int cm = 0; cm < model->getTetModels().size(); cm++) { - AABB::getEdge(aabb, i, p1, p2); - glVertex3d(p1[0], p1[1], p1[2]); - glVertex3d(p2[0], p2[1], p2[2]); + model->addSolidConstraints(model->getTetModels()[cm], model->getSolidSimulationMethod(), model->getSolidStiffness(), + model->getSolidPoissonRatio(), model->getSolidVolumeStiffness(), model->getSolidNormalizeStretch(), model->getSolidNormalizeShear()); } - glEnd(); -} - -void renderBallJoint(BallJoint &bj) -{ - MiniGL::drawSphere(bj.m_jointInfo.col(2), 0.15f, jointColor); -} - -void renderRigidBodyParticleBallJoint(RigidBodyParticleBallJoint &bj) -{ - MiniGL::drawSphere(bj.m_jointInfo.col(1), 0.1f, jointColor); -} - -void renderBallOnLineJoint(BallOnLineJoint &bj) -{ - MiniGL::drawSphere(bj.m_jointInfo.col(5), 0.1f, jointColor); - MiniGL::drawCylinder(bj.m_jointInfo.col(5) - bj.m_jointInfo.col(7), bj.m_jointInfo.col(5) + bj.m_jointInfo.col(7), jointColor, 0.05f); -} - -void renderHingeJoint(HingeJoint &hj) -{ - MiniGL::drawSphere(hj.m_jointInfo.col(6) - 0.5*hj.m_jointInfo.col(8), 0.1f, jointColor); - MiniGL::drawSphere(hj.m_jointInfo.col(6) + 0.5*hj.m_jointInfo.col(8), 0.1f, jointColor); - MiniGL::drawCylinder(hj.m_jointInfo.col(6) - 0.5*hj.m_jointInfo.col(8), hj.m_jointInfo.col(6) + 0.5*hj.m_jointInfo.col(8), jointColor, 0.05f); -} - -void renderUniversalJoint(UniversalJoint &uj) -{ - MiniGL::drawSphere(uj.m_jointInfo.col(4) - 0.5*uj.m_jointInfo.col(6), 0.1f, jointColor); - MiniGL::drawSphere(uj.m_jointInfo.col(4) + 0.5*uj.m_jointInfo.col(6), 0.1f, jointColor); - MiniGL::drawSphere(uj.m_jointInfo.col(5) - 0.5*uj.m_jointInfo.col(7), 0.1f, jointColor); - MiniGL::drawSphere(uj.m_jointInfo.col(5) + 0.5*uj.m_jointInfo.col(7), 0.1f, jointColor); - MiniGL::drawCylinder(uj.m_jointInfo.col(4) - 0.5*uj.m_jointInfo.col(6), uj.m_jointInfo.col(4) + 0.5*uj.m_jointInfo.col(6), jointColor, 0.05f); - MiniGL::drawCylinder(uj.m_jointInfo.col(5) - 0.5*uj.m_jointInfo.col(7), uj.m_jointInfo.col(5) + 0.5*uj.m_jointInfo.col(7), jointColor, 0.05f); -} - -void renderSliderJoint(SliderJoint &joint) -{ - MiniGL::drawSphere(joint.m_jointInfo.col(6), 0.1f, jointColor); - MiniGL::drawCylinder(joint.m_jointInfo.col(7) - joint.m_jointInfo.col(8), joint.m_jointInfo.col(7) + joint.m_jointInfo.col(8), jointColor, 0.05f); -} - -void renderTargetPositionMotorSliderJoint(TargetPositionMotorSliderJoint &joint) -{ - MiniGL::drawSphere(joint.m_jointInfo.col(6), 0.1f, jointColor); - MiniGL::drawCylinder(joint.m_jointInfo.col(7) - joint.m_jointInfo.col(8), joint.m_jointInfo.col(7) + joint.m_jointInfo.col(8), jointColor, 0.05f); -} - -void renderTargetVelocityMotorSliderJoint(TargetVelocityMotorSliderJoint &joint) -{ - MiniGL::drawSphere(joint.m_jointInfo.col(6), 0.1f, jointColor); - MiniGL::drawCylinder(joint.m_jointInfo.col(7) - joint.m_jointInfo.col(8), joint.m_jointInfo.col(7) + joint.m_jointInfo.col(8), jointColor, 0.05f); -} - -void renderTargetAngleMotorHingeJoint(TargetAngleMotorHingeJoint &hj) -{ - MiniGL::drawSphere(hj.m_jointInfo.col(6) - 0.5*hj.m_jointInfo.col(8), 0.1f, jointColor); - MiniGL::drawSphere(hj.m_jointInfo.col(6) + 0.5*hj.m_jointInfo.col(8), 0.1f, jointColor); - MiniGL::drawCylinder(hj.m_jointInfo.col(6) - 0.5*hj.m_jointInfo.col(8), hj.m_jointInfo.col(6) + 0.5*hj.m_jointInfo.col(8), jointColor, 0.05f); -} - -void renderTargetVelocityMotorHingeJoint(TargetVelocityMotorHingeJoint &hj) -{ - MiniGL::drawSphere(hj.m_jointInfo.col(6) - 0.5*hj.m_jointInfo.col(8), 0.1f, jointColor); - MiniGL::drawSphere(hj.m_jointInfo.col(6) + 0.5*hj.m_jointInfo.col(8), 0.1f, jointColor); - MiniGL::drawCylinder(hj.m_jointInfo.col(6) - 0.5*hj.m_jointInfo.col(8), hj.m_jointInfo.col(6) + 0.5*hj.m_jointInfo.col(8), jointColor, 0.05f); } -void renderRigidBodyContact(RigidBodyContactConstraint &cc) +CubicSDFCollisionDetection::GridPtr generateSDF(const std::string &modelFile, const std::string &collisionObjectFileName, const Eigen::Matrix &resolutionSDF, + VertexData &vd, IndexedFaceMesh &mesh) { - float col1[4] = { 0.0f, 0.6f, 0.2f, 1 }; - float col2[4] = { 0.6f, 0.0f, 0.2f, 1 }; - MiniGL::drawPoint(cc.m_constraintInfo.col(0), 5.0f, col1); - MiniGL::drawPoint(cc.m_constraintInfo.col(1), 5.0f, col2); - MiniGL::drawVector(cc.m_constraintInfo.col(1), cc.m_constraintInfo.col(1) + cc.m_constraintInfo.col(2), 1.0f, col2); -} - -void renderParticleRigidBodyContact(ParticleRigidBodyContactConstraint &cc) -{ - float col1[4] = { 0.0f, 0.6f, 0.2f, 1 }; - float col2[4] = { 0.6f, 0.0f, 0.2f, 1 }; - MiniGL::drawPoint(cc.m_constraintInfo.col(0), 5.0f, col1); - MiniGL::drawPoint(cc.m_constraintInfo.col(1), 5.0f, col2); - MiniGL::drawVector(cc.m_constraintInfo.col(1), cc.m_constraintInfo.col(1) + cc.m_constraintInfo.col(2), 1.0f, col2); -} - -void render () -{ - MiniGL::coordinateSystem(); + const std::string basePath = FileSystem::getFilePath(base->getSceneFile()); + const string cachePath = basePath + "/Cache"; + const std::string modelFileName = FileSystem::getFileNameWithExt(modelFile); + CubicSDFCollisionDetection::GridPtr distanceField; - // Draw sim model - - SimulationModel::RigidBodyVector &rb = model.getRigidBodies(); - SimulationModel::ConstraintVector &constraints = model.getConstraints(); - SimulationModel::RigidBodyContactConstraintVector &rigidBodyContacts = model.getRigidBodyContactConstraints(); - SimulationModel::ParticleRigidBodyContactConstraintVector &particleRigidBodyContacts = model.getParticleRigidBodyContactConstraints(); - - float selectionColor[4] = { 0.8f, 0.0f, 0.0f, 1 }; - float surfaceColor[4] = { 0.3f, 0.5f, 0.8f, 1 }; - float staticColor[4] = { 0.5f, 0.5f, 0.5f, 1 }; - - if (renderContacts) + if (collisionObjectFileName == "") { - for (unsigned int i = 0; i < rigidBodyContacts.size(); i++) - renderRigidBodyContact(rigidBodyContacts[i]); - for (unsigned int i = 0; i < particleRigidBodyContacts.size(); i++) - renderParticleRigidBodyContact(particleRigidBodyContacts[i]); - } + std::string md5FileName = FileSystem::normalizePath(cachePath + "/" + modelFileName + ".md5"); + string md5Str = FileSystem::getFileMD5(modelFile); + bool md5 = false; + if (FileSystem::fileExists(md5FileName)) + md5 = FileSystem::checkMD5(md5Str, md5FileName); + // check MD5 if cache file is available + const string resStr = to_string(resolutionSDF[0]) + "_" + to_string(resolutionSDF[1]) + "_" + to_string(resolutionSDF[2]); + const string sdfFileName = FileSystem::normalizePath(cachePath + "/" + modelFileName + "_" + resStr + ".csdf"); + bool foundCacheFile = FileSystem::fileExists(sdfFileName); - if (shader) - { - shader->begin(); - glUniform1f(shader->getUniform("shininess"), 5.0f); - glUniform1f(shader->getUniform("specular_factor"), 0.2f); - - GLfloat matrix[16]; - glGetFloatv(GL_MODELVIEW_MATRIX, matrix); - glUniformMatrix4fv(shader->getUniform("modelview_matrix"), 1, GL_FALSE, matrix); - GLfloat pmatrix[16]; - glGetFloatv(GL_PROJECTION_MATRIX, pmatrix); - glUniformMatrix4fv(shader->getUniform("projection_matrix"), 1, GL_FALSE, pmatrix); - } - - for (size_t i = 0; i < rb.size(); i++) - { - bool selected = false; - for (unsigned int j = 0; j < selectedBodies.size(); j++) - { - if (selectedBodies[j] == i) - selected = true; - } - - const VertexData &vd = rb[i]->getGeometry().getVertexData(); - const IndexedFaceMesh &mesh = rb[i]->getGeometry().getMesh(); - if (shader) - { - if (!selected) - { - if (rb[i]->getMass() == 0.0) - { - glUniform3fv(shader->getUniform("surface_color"), 1, staticColor); - Visualization::drawMesh(vd, mesh, 0, staticColor); - } - else - { - glUniform3fv(shader->getUniform("surface_color"), 1, surfaceColor); - Visualization::drawMesh(vd, mesh, 0, surfaceColor); - } - } - else - { - glUniform3fv(shader->getUniform("surface_color"), 1, selectionColor); - Visualization::drawMesh(vd, mesh, 0, selectionColor); - } - } - } - - if (shader) - shader->end(); - - - - renderTriangleModels(); - renderTetModels(); - - for (size_t i = 0; i < constraints.size(); i++) - { - if (constraints[i]->getTypeId() == BallJoint::TYPE_ID) - { - renderBallJoint(*(BallJoint*)constraints[i]); - } - else if (constraints[i]->getTypeId() == BallOnLineJoint::TYPE_ID) - { - renderBallOnLineJoint(*(BallOnLineJoint*)constraints[i]); - } - else if (constraints[i]->getTypeId() == HingeJoint::TYPE_ID) - { - renderHingeJoint(*(HingeJoint*)constraints[i]); - } - else if (constraints[i]->getTypeId() == UniversalJoint::TYPE_ID) - { - renderUniversalJoint(*(UniversalJoint*)constraints[i]); - } - else if (constraints[i]->getTypeId() == SliderJoint::TYPE_ID) - { - renderSliderJoint(*(SliderJoint*)constraints[i]); - } - else if (constraints[i]->getTypeId() == TargetAngleMotorHingeJoint::TYPE_ID) - { - renderTargetAngleMotorHingeJoint(*(TargetAngleMotorHingeJoint*)constraints[i]); - } - else if (constraints[i]->getTypeId() == TargetVelocityMotorHingeJoint::TYPE_ID) - { - renderTargetVelocityMotorHingeJoint(*(TargetVelocityMotorHingeJoint*)constraints[i]); - } - else if (constraints[i]->getTypeId() == TargetPositionMotorSliderJoint::TYPE_ID) - { - renderTargetPositionMotorSliderJoint(*(TargetPositionMotorSliderJoint*)constraints[i]); - } - else if (constraints[i]->getTypeId() == TargetVelocityMotorSliderJoint::TYPE_ID) - { - renderTargetVelocityMotorSliderJoint(*(TargetVelocityMotorSliderJoint*)constraints[i]); - } - else if (constraints[i]->getTypeId() == RigidBodyParticleBallJoint::TYPE_ID) - { - renderRigidBodyParticleBallJoint(*(RigidBodyParticleBallJoint*)constraints[i]); - } - } - - - - if (drawAABB || (drawBVHDepth >= 0)) - { - ObjectArray &collisionObjects = cd.getCollisionObjects(); - for (unsigned int k = 0; k < collisionObjects.size(); k++) - { - if (drawAABB) - renderAABB(collisionObjects[k]->m_aabb); - - if (drawBVHDepth >= 0) - { - if (cd.isDistanceFieldCollisionObject(collisionObjects[k])) - { - const PointCloudBSH &bvh = ((DistanceFieldCollisionDetection::DistanceFieldCollisionObject*) collisionObjects[k])->m_bvh; - - std::function predicate = [&](unsigned int node_index, unsigned int depth) { return (int) depth <= drawBVHDepth; }; - std::function cb = [&](unsigned int node_index, unsigned int depth) - { - if (depth == drawBVHDepth) - { - const BoundingSphere &bs = bvh.hull(node_index); - if (collisionObjects[k]->m_bodyType == CollisionDetection::CollisionObject::RigidBodyCollisionObjectType) - { - RigidBody *body = rb[collisionObjects[k]->m_bodyIndex]; - const Vector3r &sphere_x = bs.x(); - const Vector3r sphere_x_w = body->getRotation() * sphere_x + body->getPosition(); - MiniGL::drawSphere(sphere_x_w, std::max((float)bs.r(), 0.05f), staticColor); - } - else - MiniGL::drawSphere(bs.x(), std::max((float)bs.r(), 0.05f), staticColor); - } - }; - - bvh.traverse_depth_first(predicate, cb); - } - } - } - } - - float red[4] = { 0.8f, 0.0f, 0.0f, 1 }; - const ParticleData &pd = model.getParticles(); - for (unsigned int j = 0; j < selectedParticles.size(); j++) - { - MiniGL::drawSphere(pd.getPosition(selectedParticles[j]), 0.08f, red); - } - - MiniGL::drawTime( TimeManager::getCurrent ()->getTime ()); -} - -void initTriangleModelConstraints() -{ - // init constraints - for (unsigned int cm = 0; cm < model.getTriangleModels().size(); cm++) - { - const unsigned int offset = model.getTriangleModels()[cm]->getIndexOffset(); - if (clothSimulationMethod == 1) - { - const unsigned int nEdges = model.getTriangleModels()[cm]->getParticleMesh().numEdges(); - const IndexedFaceMesh::Edge *edges = model.getTriangleModels()[cm]->getParticleMesh().getEdges().data(); - for (unsigned int i = 0; i < nEdges; i++) - { - const unsigned int v1 = edges[i].m_vert[0] + offset; - const unsigned int v2 = edges[i].m_vert[1] + offset; - - model.addDistanceConstraint(v1, v2); - } - } - else if (clothSimulationMethod == 2) + if (foundCacheFile && md5) { - - TriangleModel::ParticleMesh &mesh = model.getTriangleModels()[cm]->getParticleMesh(); - const unsigned int *tris = mesh.getFaces().data(); - const unsigned int nFaces = mesh.numFaces(); - for (unsigned int i = 0; i < nFaces; i++) - { - const unsigned int v1 = tris[3 * i] + offset; - const unsigned int v2 = tris[3 * i + 1] + offset; - const unsigned int v3 = tris[3 * i + 2] + offset; - model.addFEMTriangleConstraint(v1, v2, v3); - } + LOG_INFO << "Load cached SDF: " << sdfFileName; + distanceField = std::make_shared(sdfFileName); } - else if (clothSimulationMethod == 3) + else { - TriangleModel::ParticleMesh &mesh = model.getTriangleModels()[cm]->getParticleMesh(); - const unsigned int *tris = mesh.getFaces().data(); + std::vector &faces = mesh.getFaces(); const unsigned int nFaces = mesh.numFaces(); - for (unsigned int i = 0; i < nFaces; i++) + +#ifdef USE_DOUBLE + Discregrid::TriangleMesh sdfMesh(&vd.getPosition(0)[0], faces.data(), vd.size(), nFaces); +#else + // if type is float, copy vector to double vector + std::vector doubleVec; + doubleVec.resize(3 * vd.size()); + for (unsigned int i = 0; i < vd.size(); i++) + for (unsigned int j = 0; j < 3; j++) + doubleVec[3 * i + j] = vd.getPosition(i)[j]; + Discregrid::TriangleMesh sdfMesh(&doubleVec[0], faces.data(), vd.size(), nFaces); +#endif + Discregrid::TriangleMeshDistance md(sdfMesh); + Eigen::AlignedBox3d domain; + for (auto const& x : sdfMesh.vertices()) { - const unsigned int v1 = tris[3 * i] + offset; - const unsigned int v2 = tris[3 * i + 1] + offset; - const unsigned int v3 = tris[3 * i + 2] + offset; - model.addStrainTriangleConstraint(v1, v2, v3); + domain.extend(x); } - } - if (bendingMethod != 0) - { - TriangleModel::ParticleMesh &mesh = model.getTriangleModels()[cm]->getParticleMesh(); - unsigned int nEdges = mesh.numEdges(); - const TriangleModel::ParticleMesh::Edge *edges = mesh.getEdges().data(); - const unsigned int *tris = mesh.getFaces().data(); - for (unsigned int i = 0; i < nEdges; i++) + domain.max() += 0.1 * Eigen::Vector3d::Ones(); + domain.min() -= 0.1 * Eigen::Vector3d::Ones(); + + LOG_INFO << "Set SDF resolution: " << resolutionSDF[0] << ", " << resolutionSDF[1] << ", " << resolutionSDF[2]; + distanceField = std::make_shared(domain, std::array({ resolutionSDF[0], resolutionSDF[1], resolutionSDF[2] })); + auto func = Discregrid::DiscreteGrid::ContinuousFunction{}; + func = [&md](Eigen::Vector3d const& xi) {return md.signed_distance(xi).distance; }; + LOG_INFO << "Generate SDF for " << modelFile; + distanceField->addFunction(func, true); + if (FileSystem::makeDir(cachePath) == 0) { - const int tri1 = edges[i].m_face[0]; - const int tri2 = edges[i].m_face[1]; - if ((tri1 != 0xffffffff) && (tri2 != 0xffffffff)) - { - // Find the triangle points which do not lie on the axis - const int axisPoint1 = edges[i].m_vert[0]; - const int axisPoint2 = edges[i].m_vert[1]; - int point1 = -1; - int point2 = -1; - for (int j = 0; j < 3; j++) - { - if ((tris[3 * tri1 + j] != axisPoint1) && (tris[3 * tri1 + j] != axisPoint2)) - { - point1 = tris[3 * tri1 + j]; - break; - } - } - for (int j = 0; j < 3; j++) - { - if ((tris[3 * tri2 + j] != axisPoint1) && (tris[3 * tri2 + j] != axisPoint2)) - { - point2 = tris[3 * tri2 + j]; - break; - } - } - if ((point1 != -1) && (point2 != -1)) - { - const unsigned int vertex1 = point1 + offset; - const unsigned int vertex2 = point2 + offset; - const unsigned int vertex3 = edges[i].m_vert[0] + offset; - const unsigned int vertex4 = edges[i].m_vert[1] + offset; - if (bendingMethod == 1) - model.addDihedralConstraint(vertex1, vertex2, vertex3, vertex4); - else if (bendingMethod == 2) - model.addIsometricBendingConstraint(vertex1, vertex2, vertex3, vertex4); - } - } + LOG_INFO << "Save SDF: " << sdfFileName; + distanceField->save(sdfFileName); + FileSystem::writeMD5File(modelFile, md5FileName); } } } -} - -void initTetModelConstraints() -{ - // init constraints - for (unsigned int cm = 0; cm < model.getTetModels().size(); cm++) + else { - const unsigned int offset = model.getTetModels()[cm]->getIndexOffset(); - const unsigned int nTets = model.getTetModels()[cm]->getParticleMesh().numTets(); - const unsigned int *tets = model.getTetModels()[cm]->getParticleMesh().getTets().data(); - const IndexedTetMesh::VertexTets *vTets = model.getTetModels()[cm]->getParticleMesh().getVertexTets().data(); - if (solidSimulationMethod == 1) - { - const unsigned int offset = model.getTetModels()[cm]->getIndexOffset(); - const unsigned int nEdges = model.getTetModels()[cm]->getParticleMesh().numEdges(); - const IndexedTetMesh::Edge *edges = model.getTetModels()[cm]->getParticleMesh().getEdges().data(); - for (unsigned int i = 0; i < nEdges; i++) - { - const unsigned int v1 = edges[i].m_vert[0] + offset; - const unsigned int v2 = edges[i].m_vert[1] + offset; - - model.addDistanceConstraint(v1, v2); - } - - for (unsigned int i = 0; i < nTets; i++) - { - const unsigned int v1 = tets[4 * i] + offset; - const unsigned int v2 = tets[4 * i + 1] + offset; - const unsigned int v3 = tets[4 * i + 2] + offset; - const unsigned int v4 = tets[4 * i + 3] + offset; - - model.addVolumeConstraint(v1, v2, v3, v4); - } - } - else if (solidSimulationMethod == 2) - { - TetModel::ParticleMesh &mesh = model.getTetModels()[cm]->getParticleMesh(); - for (unsigned int i = 0; i < nTets; i++) - { - const unsigned int v1 = tets[4 * i] + offset; - const unsigned int v2 = tets[4 * i + 1] + offset; - const unsigned int v3 = tets[4 * i + 2] + offset; - const unsigned int v4 = tets[4 * i + 3] + offset; - - model.addFEMTetConstraint(v1, v2, v3, v4); - } - } - else if (solidSimulationMethod == 3) + std::string fileName = collisionObjectFileName; + if (FileSystem::isRelativePath(fileName)) { - TetModel::ParticleMesh &mesh = model.getTetModels()[cm]->getParticleMesh(); - for (unsigned int i = 0; i < nTets; i++) - { - const unsigned int v1 = tets[4 * i] + offset; - const unsigned int v2 = tets[4 * i + 1] + offset; - const unsigned int v3 = tets[4 * i + 2] + offset; - const unsigned int v4 = tets[4 * i + 3] + offset; - - model.addStrainTetConstraint(v1, v2, v3, v4); - } - } - else if (solidSimulationMethod == 4) - { - TetModel::ParticleMesh &mesh = model.getTetModels()[cm]->getParticleMesh(); - for (unsigned int i = 0; i < nTets; i++) - { - const unsigned int v[4] = { tets[4 * i] + offset, - tets[4 * i + 1] + offset, - tets[4 * i + 2] + offset, - tets[4 * i + 3] + offset }; - // Important: Divide position correction by the number of clusters - // which contain the vertex. - const unsigned int nc[4] = { vTets[v[0]].m_numTets, vTets[v[1]].m_numTets, vTets[v[2]].m_numTets, vTets[v[3]].m_numTets }; - model.addShapeMatchingConstraint(4, v, nc); - } + fileName = FileSystem::normalizePath(basePath + "/" + fileName); } + LOG_INFO << "Load SDF: " << fileName; + distanceField = std::make_shared(fileName); } + return distanceField; } /** Create the rigid body model */ -void readScene() +void readScene(const bool readFile) { - SimulationModel::RigidBodyVector &rb = model.getRigidBodies(); - SimulationModel::TriangleModelVector &triModels = model.getTriangleModels(); - SimulationModel::TetModelVector &tetModels = model.getTetModels(); - SimulationModel::ConstraintVector &constraints = model.getConstraints(); + SimulationModel *model = Simulation::getCurrent()->getModel(); + SimulationModel::RigidBodyVector &rb = model->getRigidBodies(); + SimulationModel::TriangleModelVector &triModels = model->getTriangleModels(); + SimulationModel::TetModelVector &tetModels = model->getTetModels(); + SimulationModel::ConstraintVector &constraints = model->getConstraints(); - SceneLoader::SceneData data; - SceneLoader loader; - loader.readScene(sceneFileName, data); - std::cout << "Scene: " << sceneFileName << "\n"; + if (readFile) + { + base->cleanup(); + base->readScene(); + } + SceneLoader::SceneData &data = base->getSceneData(); camPos = data.m_camPosition; camLookat = data.m_camLookat; - boost::filesystem::path basePath = boost::filesystem::path(sceneFileName).parent_path(); - TimeManager::getCurrent()->setTimeStepSize(data.m_timeStepSize); - sceneName = data.m_sceneName; - - sim.setGravity(data.m_gravity); - sim.setMaxIterations(data.m_maxIter); - sim.setMaxIterationsV(data.m_maxIterVel); - sim.setVelocityUpdateMethod(data.m_velocityUpdateMethod); - if (data.m_triangleModelSimulationMethod != -1) - clothSimulationMethod = data.m_triangleModelSimulationMethod; - if (data.m_tetModelSimulationMethod != -1) - solidSimulationMethod = data.m_tetModelSimulationMethod; - if (data.m_triangleModelBendingMethod != -1) - bendingMethod = data.m_triangleModelBendingMethod; - cd.setTolerance(data.m_contactTolerance); - model.setContactStiffnessRigidBody(data.m_contactStiffnessRigidBody); - model.setContactStiffnessParticleRigidBody(data.m_contactStiffnessParticleRigidBody); - - model.setClothStiffness(data.m_cloth_stiffness); - model.setClothBendingStiffness(data.m_cloth_bendingStiffness); - model.setClothXXStiffness(data.m_cloth_xxStiffness); - model.setClothYYStiffness(data.m_cloth_yyStiffness); - model.setClothXYStiffness(data.m_cloth_xyStiffness); - model.setClothXYPoissonRatio(data.m_cloth_xyPoissonRatio); - model.setClothYXPoissonRatio(data.m_cloth_yxPoissonRatio); - model.setClothNormalizeStretch(data.m_cloth_normalizeStretch); - model.setClothNormalizeShear(data.m_cloth_normalizeShear); - ////////////////////////////////////////////////////////////////////////// // rigid bodies ////////////////////////////////////////////////////////////////////////// // map file names to loaded geometry to prevent multiple imports of same files std::map> objFiles; + std::map distanceFields; for (unsigned int i = 0; i < data.m_rigidBodyData.size(); i++) { - const SceneLoader::RigidBodyData &rbd = data.m_rigidBodyData[i]; + SceneLoader::RigidBodyData &rbd = data.m_rigidBodyData[i]; // Check if already loaded + rbd.m_modelFile = FileSystem::normalizePath(rbd.m_modelFile); if (objFiles.find(rbd.m_modelFile) == objFiles.end()) { IndexedFaceMesh mesh; VertexData vd; - OBJLoader::loadObj(rbd.m_modelFile, vd, mesh); + DemoBase::loadMesh(rbd.m_modelFile, vd, mesh, Vector3r::Zero(), Matrix3r::Identity(), Vector3r::Ones()); objFiles[rbd.m_modelFile] = { vd, mesh }; } + + const std::string basePath = FileSystem::getFilePath(base->getSceneFile()); + const string cachePath = basePath + "/Cache"; + const string resStr = to_string(rbd.m_resolutionSDF[0]) + "_" + to_string(rbd.m_resolutionSDF[1]) + "_" + to_string(rbd.m_resolutionSDF[2]); + const std::string modelFileName = FileSystem::getFileNameWithExt(rbd.m_modelFile); + const string sdfFileName = FileSystem::normalizePath(cachePath + "/" + modelFileName + "_" + resStr + ".csdf"); + + std::string sdfKey = rbd.m_collisionObjectFileName; + if (sdfKey == "") + { + sdfKey = sdfFileName; + } + if (distanceFields.find(sdfKey) == distanceFields.end()) + { + // Generate SDF + if (rbd.m_collisionObjectType == SceneLoader::SDF) + { + if (rbd.m_collisionObjectFileName == "") + { + std::string md5FileName = FileSystem::normalizePath(cachePath + "/" + modelFileName + ".md5"); + string md5Str = FileSystem::getFileMD5(rbd.m_modelFile); + bool md5 = false; + if (FileSystem::fileExists(md5FileName)) + md5 = FileSystem::checkMD5(md5Str, md5FileName); + + // check MD5 if cache file is available + const string resStr = to_string(rbd.m_resolutionSDF[0]) + "_" + to_string(rbd.m_resolutionSDF[1]) + "_" + to_string(rbd.m_resolutionSDF[2]); + const string sdfFileName = FileSystem::normalizePath(cachePath + "/" + modelFileName + "_" + resStr + ".csdf"); + bool foundCacheFile = FileSystem::fileExists(sdfFileName); + + if (foundCacheFile && md5) + { + LOG_INFO << "Load cached SDF: " << sdfFileName; + distanceFields[sdfFileName] = std::make_shared(sdfFileName); + } + else + { + VertexData &vd = objFiles[rbd.m_modelFile].first; + IndexedFaceMesh &mesh = objFiles[rbd.m_modelFile].second; + + std::vector &faces = mesh.getFaces(); + const unsigned int nFaces = mesh.numFaces(); + +#ifdef USE_DOUBLE + Discregrid::TriangleMesh sdfMesh(&vd.getPosition(0)[0], faces.data(), vd.size(), nFaces); +#else + // if type is float, copy vector to double vector + std::vector doubleVec; + doubleVec.resize(3 * vd.size()); + for (unsigned int i = 0; i < vd.size(); i++) + for (unsigned int j = 0; j < 3; j++) + doubleVec[3 * i + j] = vd.getPosition(i)[j]; + Discregrid::TriangleMesh sdfMesh(&doubleVec[0], faces.data(), vd.size(), nFaces); +#endif + Discregrid::TriangleMeshDistance md(sdfMesh); + Eigen::AlignedBox3d domain; + for (auto const& x : sdfMesh.vertices()) + { + domain.extend(x); + } + domain.max() += 0.1 * Eigen::Vector3d::Ones(); + domain.min() -= 0.1 * Eigen::Vector3d::Ones(); + + LOG_INFO << "Set SDF resolution: " << rbd.m_resolutionSDF[0] << ", " << rbd.m_resolutionSDF[1] << ", " << rbd.m_resolutionSDF[2]; + distanceFields[sdfFileName] = std::make_shared(domain, std::array({ rbd.m_resolutionSDF[0], rbd.m_resolutionSDF[1], rbd.m_resolutionSDF[2] })); + auto func = Discregrid::DiscreteGrid::ContinuousFunction{}; + func = [&md](Eigen::Vector3d const& xi) {return md.signed_distance(xi).distance; }; + LOG_INFO << "Generate SDF for " << rbd.m_modelFile; + distanceFields[sdfFileName]->addFunction(func, true); + if (FileSystem::makeDir(cachePath) == 0) + { + LOG_INFO << "Save SDF: " << sdfFileName; + distanceFields[sdfFileName]->save(sdfFileName); + FileSystem::writeMD5File(rbd.m_modelFile, md5FileName); + } + } + } + else + { + std::string fileName = rbd.m_collisionObjectFileName; + if (FileSystem::isRelativePath(fileName)) + { + fileName = FileSystem::normalizePath(basePath + "/" + fileName); + } + LOG_INFO << "Load SDF: " << fileName; + distanceFields[rbd.m_collisionObjectFileName] = std::make_shared(fileName); + } + } + } } for (unsigned int i = 0; i < data.m_tetModelData.size(); i++) @@ -890,9 +431,37 @@ void readScene() { IndexedFaceMesh mesh; VertexData vd; - OBJLoader::loadObj(tmd.m_modelFileVis, vd, mesh); + DemoBase::loadMesh(FileSystem::normalizePath(tmd.m_modelFileVis), vd, mesh, Vector3r::Zero(), Matrix3r::Identity(), Vector3r::Ones()); objFiles[tmd.m_modelFileVis] = { vd, mesh }; } + + const std::string basePath = FileSystem::getFilePath(base->getSceneFile()); + const string cachePath = basePath + "/Cache"; + const string resStr = to_string(tmd.m_resolutionSDF[0]) + "_" + to_string(tmd.m_resolutionSDF[1]) + "_" + to_string(tmd.m_resolutionSDF[2]); + const std::string modelFileName = FileSystem::getFileNameWithExt(tmd.m_modelFileVis); + const string sdfFileName = FileSystem::normalizePath(cachePath + "/" + modelFileName + "_" + resStr + ".csdf"); + + std::string sdfKey = tmd.m_collisionObjectFileName; + if (sdfKey == "") + { + sdfKey = sdfFileName; + } + if (distanceFields.find(sdfKey) == distanceFields.end()) + { + // Generate SDF + if (tmd.m_collisionObjectType == SceneLoader::SDF) + { + VertexData &vd = objFiles[tmd.m_modelFileVis].first; + IndexedFaceMesh &mesh = objFiles[tmd.m_modelFileVis].second; + + CubicSDFCollisionDetection::GridPtr distanceField = generateSDF(tmd.m_modelFileVis, tmd.m_collisionObjectFileName, tmd.m_resolutionSDF, vd, mesh); + + if (tmd.m_collisionObjectFileName == "") + distanceFields[sdfFileName] = distanceField; + else + distanceFields[tmd.m_collisionObjectFileName] = distanceField; + } + } } @@ -909,6 +478,7 @@ void readScene() VertexData &vd = objFiles[rbd.m_modelFile].first; IndexedFaceMesh &mesh = objFiles[rbd.m_modelFile].second; + mesh.setFlatShading(rbd.m_flatShading); rb[i] = new RigidBody(); rb[i]->initBody(rbd.m_density, @@ -927,24 +497,45 @@ void readScene() rb[i]->setRestitutionCoeff(rbd.m_restitutionCoeff); rb[i]->setFrictionCoeff(rbd.m_frictionCoeff); - const std::vector *vertices = rb[i]->getGeometry().getVertexDataLocal().getVertices(); - const unsigned int nVert = static_cast(vertices->size()); + const std::vector &vertices = rb[i]->getGeometry().getVertexDataLocal().getVertices(); + const unsigned int nVert = static_cast(vertices.size()); switch (rbd.m_collisionObjectType) { - case SceneLoader::RigidBodyData::No_Collision_Object: break; - case SceneLoader::RigidBodyData::Sphere: - cd.addCollisionSphere(i, CollisionDetection::CollisionObject::RigidBodyCollisionObjectType, &(*vertices)[0], nVert, rbd.m_collisionObjectScale[0], rbd.m_testMesh); + case SceneLoader::No_Collision_Object: break; + case SceneLoader::Sphere: + cd->addCollisionSphere(i, CollisionDetection::CollisionObject::RigidBodyCollisionObjectType, vertices.data(), nVert, rbd.m_collisionObjectScale[0], rbd.m_testMesh, rbd.m_invertSDF); break; - case SceneLoader::RigidBodyData::Box: - cd.addCollisionBox(i, CollisionDetection::CollisionObject::RigidBodyCollisionObjectType, &(*vertices)[0], nVert, rbd.m_collisionObjectScale, rbd.m_testMesh); + case SceneLoader::Box: + cd->addCollisionBox(i, CollisionDetection::CollisionObject::RigidBodyCollisionObjectType, vertices.data(), nVert, rbd.m_collisionObjectScale, rbd.m_testMesh, rbd.m_invertSDF); break; - case SceneLoader::RigidBodyData::Cylinder: - cd.addCollisionCylinder(i, CollisionDetection::CollisionObject::RigidBodyCollisionObjectType, &(*vertices)[0], nVert, rbd.m_collisionObjectScale.head<2>(), rbd.m_testMesh); + case SceneLoader::Cylinder: + cd->addCollisionCylinder(i, CollisionDetection::CollisionObject::RigidBodyCollisionObjectType, vertices.data(), nVert, rbd.m_collisionObjectScale.head<2>(), rbd.m_testMesh, rbd.m_invertSDF); break; - case SceneLoader::RigidBodyData::Torus: - cd.addCollisionTorus(i, CollisionDetection::CollisionObject::RigidBodyCollisionObjectType, &(*vertices)[0], nVert, rbd.m_collisionObjectScale.head<2>(), rbd.m_testMesh); + case SceneLoader::Torus: + cd->addCollisionTorus(i, CollisionDetection::CollisionObject::RigidBodyCollisionObjectType, vertices.data(), nVert, rbd.m_collisionObjectScale.head<2>(), rbd.m_testMesh, rbd.m_invertSDF); break; + case SceneLoader::HollowSphere: + cd->addCollisionHollowSphere(i, PBD::CollisionDetection::CollisionObject::RigidBodyCollisionObjectType, vertices.data(), nVert, rbd.m_collisionObjectScale[0], rbd.m_thicknessSDF, rbd.m_testMesh, rbd.m_invertSDF); + break; + case SceneLoader::HollowBox: + cd->addCollisionHollowBox(i, CollisionDetection::CollisionObject::RigidBodyCollisionObjectType, vertices.data(), nVert, rbd.m_collisionObjectScale, rbd.m_thicknessSDF, rbd.m_testMesh, rbd.m_invertSDF); + break; + case SceneLoader::SDF: + { + if (rbd.m_collisionObjectFileName == "") + { + const std::string basePath = FileSystem::getFilePath(base->getSceneFile()); + const string cachePath = basePath + "/Cache"; + const string resStr = to_string(rbd.m_resolutionSDF[0]) + "_" + to_string(rbd.m_resolutionSDF[1]) + "_" + to_string(rbd.m_resolutionSDF[2]); + const std::string modelFileName = FileSystem::getFileNameWithExt(rbd.m_modelFile); + const string sdfFileName = FileSystem::normalizePath(cachePath + "/" + modelFileName + "_" + resStr + ".csdf"); + cd->addCubicSDFCollisionObject(i, CollisionDetection::CollisionObject::RigidBodyCollisionObjectType, vertices.data(), nVert, distanceFields[sdfFileName], rbd.m_collisionObjectScale, rbd.m_testMesh, rbd.m_invertSDF); + } + else + cd->addCubicSDFCollisionObject(i, CollisionDetection::CollisionObject::RigidBodyCollisionObjectType, vertices.data(), nVert, distanceFields[rbd.m_collisionObjectFileName], rbd.m_collisionObjectScale, rbd.m_testMesh, rbd.m_invertSDF); + break; + } } } @@ -963,7 +554,7 @@ void readScene() { IndexedFaceMesh mesh; VertexData vd; - OBJLoader::loadObj(tmd.m_modelFile, vd, mesh); + DemoBase::loadMesh(FileSystem::normalizePath(tmd.m_modelFile), vd, mesh, Vector3r::Zero(), Matrix3r::Identity(), Vector3r::Ones()); triFiles[tmd.m_modelFile] = { vd, mesh }; } } @@ -988,10 +579,10 @@ void readScene() vd.getPosition(j) = R * (vd.getPosition(j).cwiseProduct(tmd.m_scale)) + tmd.m_x; } - model.addTriangleModel(vd.size(), mesh.numFaces(), &vd.getPosition(0), mesh.getFaces().data(), mesh.getUVIndices(), mesh.getUVs()); + model->addTriangleModel(vd.size(), mesh.numFaces(), &vd.getPosition(0), mesh.getFaces().data(), mesh.getUVIndices(), mesh.getUVs()); TriangleModel *tm = triModels[triModels.size() - 1]; - ParticleData &pd = model.getParticles(); + ParticleData &pd = model->getParticles(); unsigned int offset = tm->getIndexOffset(); for (unsigned int j = 0; j < tmd.m_staticParticles.size(); j++) @@ -1022,7 +613,7 @@ void readScene() { vector vertices; vector tets; - TetGenLoader::loadTetgenModel(tmd.m_modelFileNodes, tmd.m_modelFileElements, vertices, tets); + TetGenLoader::loadTetgenModel(FileSystem::normalizePath(tmd.m_modelFileNodes), FileSystem::normalizePath(tmd.m_modelFileElements), vertices, tets); tetFiles[fileNames] = { vertices, tets }; } } @@ -1049,11 +640,15 @@ void readScene() vertices[j] = R * (vertices[j].cwiseProduct(tmd.m_scale)) + tmd.m_x; } - model.addTetModel((unsigned int)vertices.size(), (unsigned int)tets.size() / 4, vertices.data(), tets.data()); + model->addTetModel((unsigned int)vertices.size(), (unsigned int)tets.size() / 4, vertices.data(), tets.data()); TetModel *tm = tetModels[tetModels.size() - 1]; - ParticleData &pd = model.getParticles(); + ParticleData &pd = model->getParticles(); unsigned int offset = tm->getIndexOffset(); + + tm->setInitialX(tmd.m_x); + tm->setInitialR(R); + tm->setInitialScale(tmd.m_scale); for (unsigned int j = 0; j < tmd.m_staticParticles.size(); j++) { @@ -1089,13 +684,13 @@ void readScene() initTetModelConstraints(); // init collision objects for deformable models - ParticleData &pd = model.getParticles(); + ParticleData &pd = model->getParticles(); for (unsigned int i = 0; i < data.m_triangleModelData.size(); i++) { TriangleModel *tm = triModels[i]; unsigned int offset = tm->getIndexOffset(); const unsigned int nVert = tm->getParticleMesh().numVertices(); - cd.addCollisionObjectWithoutGeometry(i, CollisionDetection::CollisionObject::TriangleModelCollisionObjectType, &pd.getPosition(offset), nVert); + cd->addCollisionObjectWithoutGeometry(i, CollisionDetection::CollisionObject::TriangleModelCollisionObjectType, &pd.getPosition(offset), nVert, true); } for (unsigned int i = 0; i < data.m_tetModelData.size(); i++) @@ -1103,7 +698,65 @@ void readScene() TetModel *tm = tetModels[i]; unsigned int offset = tm->getIndexOffset(); const unsigned int nVert = tm->getParticleMesh().numVertices(); - cd.addCollisionObjectWithoutGeometry(i, CollisionDetection::CollisionObject::TetModelCollisionObjectType, &pd.getPosition(offset), nVert); + const IndexedTetMesh &tetMesh = tm->getParticleMesh(); + + const SceneLoader::TetModelData &tmd = data.m_tetModelData[i]; + + switch (tmd.m_collisionObjectType) + { + case SceneLoader::No_Collision_Object: + cd->addCollisionObjectWithoutGeometry(i, CollisionDetection::CollisionObject::TetModelCollisionObjectType, &pd.getPosition(offset), nVert, true); + break; + case SceneLoader::Sphere: + cd->addCollisionSphere(i, CollisionDetection::CollisionObject::TetModelCollisionObjectType, &pd.getPosition(offset), nVert, tmd.m_collisionObjectScale[0], tmd.m_testMesh, tmd.m_invertSDF); + break; + case SceneLoader::Box: + cd->addCollisionBox(i, CollisionDetection::CollisionObject::TetModelCollisionObjectType, &pd.getPosition(offset), nVert, tmd.m_collisionObjectScale, tmd.m_testMesh, tmd.m_invertSDF); + break; + case SceneLoader::Cylinder: + cd->addCollisionCylinder(i, CollisionDetection::CollisionObject::TetModelCollisionObjectType, &pd.getPosition(offset), nVert, tmd.m_collisionObjectScale.head<2>(), tmd.m_testMesh, tmd.m_invertSDF); + break; + case SceneLoader::Torus: + cd->addCollisionTorus(i, CollisionDetection::CollisionObject::TetModelCollisionObjectType, &pd.getPosition(offset), nVert, tmd.m_collisionObjectScale.head<2>(), tmd.m_testMesh, tmd.m_invertSDF); + break; + case SceneLoader::HollowSphere: + cd->addCollisionHollowSphere(i, PBD::CollisionDetection::CollisionObject::TetModelCollisionObjectType, &pd.getPosition(offset), nVert, tmd.m_collisionObjectScale[0], tmd.m_thicknessSDF, tmd.m_testMesh, tmd.m_invertSDF); + break; + case SceneLoader::HollowBox: + cd->addCollisionHollowBox(i, CollisionDetection::CollisionObject::TetModelCollisionObjectType, &pd.getPosition(offset), nVert, tmd.m_collisionObjectScale, tmd.m_thicknessSDF, tmd.m_testMesh, tmd.m_invertSDF); + break; + case SceneLoader::SDF: + { + if (tmd.m_collisionObjectFileName == "") + { + const std::string basePath = FileSystem::getFilePath(base->getSceneFile()); + const string cachePath = basePath + "/Cache"; + const string resStr = to_string(tmd.m_resolutionSDF[0]) + "_" + to_string(tmd.m_resolutionSDF[1]) + "_" + to_string(tmd.m_resolutionSDF[2]); + const std::string modelFileName = FileSystem::getFileNameWithExt(tmd.m_modelFileVis); + const string sdfFileName = FileSystem::normalizePath(cachePath + "/" + modelFileName + "_" + resStr + ".csdf"); + cd->addCubicSDFCollisionObject(i, CollisionDetection::CollisionObject::TetModelCollisionObjectType, &pd.getPosition(offset), nVert, distanceFields[sdfFileName], tmd.m_collisionObjectScale, tmd.m_testMesh, tmd.m_invertSDF); + } + else + cd->addCubicSDFCollisionObject(i, CollisionDetection::CollisionObject::TetModelCollisionObjectType, &pd.getPosition(offset), nVert, distanceFields[tmd.m_collisionObjectFileName], tmd.m_collisionObjectScale, tmd.m_testMesh, tmd.m_invertSDF); + break; + } + } + } + + // init tet BVH + std::vector &collisionObjects = cd->getCollisionObjects(); + for (unsigned int k = 0; k < collisionObjects.size(); k++) + { + if (cd->isDistanceFieldCollisionObject(collisionObjects[k]) && + (collisionObjects[k]->m_bodyType == CollisionDetection::CollisionObject::TetModelCollisionObjectType)) + { + const unsigned int modelIndex = collisionObjects[k]->m_bodyIndex; + TetModel *tm = tetModels[modelIndex]; + const unsigned int offset = tm->getIndexOffset(); + const IndexedTetMesh &mesh = tm->getParticleMesh(); + + ((DistanceFieldCollisionDetection::DistanceFieldCollisionObject*) collisionObjects[k])->initTetBVH(&pd.getPosition(offset), mesh.numVertices(), mesh.getTets().data(), mesh.numTets(), cd->getTolerance()); + } } ////////////////////////////////////////////////////////////////////////// @@ -1113,276 +766,92 @@ void readScene() for (unsigned int i = 0; i < data.m_ballJointData.size(); i++) { const SceneLoader::BallJointData &jd = data.m_ballJointData[i]; - model.addBallJoint(id_index[jd.m_bodyID[0]], id_index[jd.m_bodyID[1]], jd.m_position); + model->addBallJoint(id_index[jd.m_bodyID[0]], id_index[jd.m_bodyID[1]], jd.m_position); } for (unsigned int i = 0; i < data.m_ballOnLineJointData.size(); i++) { const SceneLoader::BallOnLineJointData &jd = data.m_ballOnLineJointData[i]; - model.addBallOnLineJoint(id_index[jd.m_bodyID[0]], id_index[jd.m_bodyID[1]], jd.m_position, jd.m_axis); + model->addBallOnLineJoint(id_index[jd.m_bodyID[0]], id_index[jd.m_bodyID[1]], jd.m_position, jd.m_axis); } for (unsigned int i = 0; i < data.m_hingeJointData.size(); i++) { const SceneLoader::HingeJointData &jd = data.m_hingeJointData[i]; - model.addHingeJoint(id_index[jd.m_bodyID[0]], id_index[jd.m_bodyID[1]], jd.m_position, jd.m_axis); + model->addHingeJoint(id_index[jd.m_bodyID[0]], id_index[jd.m_bodyID[1]], jd.m_position, jd.m_axis); } for (unsigned int i = 0; i < data.m_universalJointData.size(); i++) { const SceneLoader::UniversalJointData &jd = data.m_universalJointData[i]; - model.addUniversalJoint(id_index[jd.m_bodyID[0]], id_index[jd.m_bodyID[1]], jd.m_position, jd.m_axis[0], jd.m_axis[1]); + model->addUniversalJoint(id_index[jd.m_bodyID[0]], id_index[jd.m_bodyID[1]], jd.m_position, jd.m_axis[0], jd.m_axis[1]); } for (unsigned int i = 0; i < data.m_sliderJointData.size(); i++) { const SceneLoader::SliderJointData &jd = data.m_sliderJointData[i]; - model.addSliderJoint(id_index[jd.m_bodyID[0]], id_index[jd.m_bodyID[1]], jd.m_position, jd.m_axis); + model->addSliderJoint(id_index[jd.m_bodyID[0]], id_index[jd.m_bodyID[1]], jd.m_axis); } for (unsigned int i = 0; i < data.m_rigidBodyParticleBallJointData.size(); i++) { const SceneLoader::RigidBodyParticleBallJointData &jd = data.m_rigidBodyParticleBallJointData[i]; - model.addRigidBodyParticleBallJoint(id_index[jd.m_bodyID[0]], jd.m_bodyID[1]); + model->addRigidBodyParticleBallJoint(id_index[jd.m_bodyID[0]], jd.m_bodyID[1]); } for (unsigned int i = 0; i < data.m_targetAngleMotorHingeJointData.size(); i++) { const SceneLoader::TargetAngleMotorHingeJointData &jd = data.m_targetAngleMotorHingeJointData[i]; - model.addTargetAngleMotorHingeJoint(id_index[jd.m_bodyID[0]], id_index[jd.m_bodyID[1]], jd.m_position, jd.m_axis); - ((TargetAngleMotorHingeJoint*)constraints[constraints.size() - 1])->setTargetAngle(jd.m_target); + model->addTargetAngleMotorHingeJoint(id_index[jd.m_bodyID[0]], id_index[jd.m_bodyID[1]], jd.m_position, jd.m_axis); + ((MotorJoint*)constraints[constraints.size() - 1])->setTarget(jd.m_target); + ((MotorJoint*)constraints[constraints.size() - 1])->setTargetSequence(jd.m_targetSequence); + ((MotorJoint*)constraints[constraints.size() - 1])->setRepeatSequence(jd.m_repeat); } for (unsigned int i = 0; i < data.m_targetVelocityMotorHingeJointData.size(); i++) { const SceneLoader::TargetVelocityMotorHingeJointData &jd = data.m_targetVelocityMotorHingeJointData[i]; - model.addTargetVelocityMotorHingeJoint(id_index[jd.m_bodyID[0]], id_index[jd.m_bodyID[1]], jd.m_position, jd.m_axis); - ((TargetVelocityMotorHingeJoint*)constraints[constraints.size() - 1])->setTargetAngularVelocity(jd.m_target); + model->addTargetVelocityMotorHingeJoint(id_index[jd.m_bodyID[0]], id_index[jd.m_bodyID[1]], jd.m_position, jd.m_axis); + ((MotorJoint*)constraints[constraints.size() - 1])->setTarget(jd.m_target); + ((MotorJoint*)constraints[constraints.size() - 1])->setTargetSequence(jd.m_targetSequence); + ((MotorJoint*)constraints[constraints.size() - 1])->setRepeatSequence(jd.m_repeat); } for (unsigned int i = 0; i < data.m_targetPositionMotorSliderJointData.size(); i++) { const SceneLoader::TargetPositionMotorSliderJointData &jd = data.m_targetPositionMotorSliderJointData[i]; - model.addTargetPositionMotorSliderJoint(id_index[jd.m_bodyID[0]], id_index[jd.m_bodyID[1]], jd.m_position, jd.m_axis); - ((TargetPositionMotorSliderJoint*)constraints[constraints.size() - 1])->setTargetPosition(jd.m_target); + model->addTargetPositionMotorSliderJoint(id_index[jd.m_bodyID[0]], id_index[jd.m_bodyID[1]], jd.m_axis); + ((MotorJoint*)constraints[constraints.size() - 1])->setTarget(jd.m_target); + ((MotorJoint*)constraints[constraints.size() - 1])->setTargetSequence(jd.m_targetSequence); + ((MotorJoint*)constraints[constraints.size() - 1])->setRepeatSequence(jd.m_repeat); } for (unsigned int i = 0; i < data.m_targetVelocityMotorSliderJointData.size(); i++) { const SceneLoader::TargetVelocityMotorSliderJointData &jd = data.m_targetVelocityMotorSliderJointData[i]; - model.addTargetVelocityMotorSliderJoint(id_index[jd.m_bodyID[0]], id_index[jd.m_bodyID[1]], jd.m_position, jd.m_axis); - ((TargetVelocityMotorSliderJoint*)constraints[constraints.size() - 1])->setTargetVelocity(jd.m_target); + model->addTargetVelocityMotorSliderJoint(id_index[jd.m_bodyID[0]], id_index[jd.m_bodyID[1]], jd.m_axis); + ((MotorJoint*)constraints[constraints.size() - 1])->setTarget(jd.m_target); + ((MotorJoint*)constraints[constraints.size() - 1])->setTargetSequence(jd.m_targetSequence); + ((MotorJoint*)constraints[constraints.size() - 1])->setRepeatSequence(jd.m_repeat); } -} -void TW_CALL setTimeStep(const void *value, void *clientData) -{ - const Real val = *(const Real *)(value); - TimeManager::getCurrent()->setTimeStepSize(val); -} - -void TW_CALL getTimeStep(void *value, void *clientData) -{ - *(Real *)(value) = TimeManager::getCurrent()->getTimeStepSize(); -} - -void TW_CALL setVelocityUpdateMethod(const void *value, void *clientData) -{ - const short val = *(const short *)(value); - ((TimeStepController*)clientData)->setVelocityUpdateMethod((unsigned int)val); -} - -void TW_CALL getVelocityUpdateMethod(void *value, void *clientData) -{ - *(short *)(value) = (short)((TimeStepController*)clientData)->getVelocityUpdateMethod(); -} - -void TW_CALL setMaxIterations(const void *value, void *clientData) -{ - const unsigned int val = *(const unsigned int *)(value); - ((TimeStepController*)clientData)->setMaxIterations(val); -} - -void TW_CALL getMaxIterations(void *value, void *clientData) -{ - *(unsigned int *)(value) = ((TimeStepController*)clientData)->getMaxIterations(); -} - -void TW_CALL setMaxIterationsV(const void *value, void *clientData) -{ - const unsigned int val = *(const unsigned int *)(value); - ((TimeStepController*)clientData)->setMaxIterationsV(val); -} - -void TW_CALL getMaxIterationsV(void *value, void *clientData) -{ - *(unsigned int *)(value) = ((TimeStepController*)clientData)->getMaxIterationsV(); -} - -void TW_CALL setContactTolerance(const void *value, void *clientData) -{ - const Real val = *(const Real *)(value); - ((DistanceFieldCollisionDetection*)clientData)->setTolerance(val); -} - -void TW_CALL getContactTolerance(void *value, void *clientData) -{ - *(Real *)(value) = ((DistanceFieldCollisionDetection*)clientData)->getTolerance(); -} - -void TW_CALL setContactStiffnessRigidBody(const void *value, void *clientData) -{ - const Real val = *(const Real *)(value); - ((SimulationModel*)clientData)->setContactStiffnessRigidBody(val); -} - -void TW_CALL getContactStiffnessRigidBody(void *value, void *clientData) -{ - *(Real *)(value) = ((SimulationModel*)clientData)->getContactStiffnessRigidBody(); -} - -void TW_CALL setContactStiffnessParticleRigidBody(const void *value, void *clientData) -{ - const Real val = *(const Real *)(value); - ((SimulationModel*)clientData)->setContactStiffnessParticleRigidBody(val); -} - -void TW_CALL getContactStiffnessParticleRigidBody(void *value, void *clientData) -{ - *(Real *)(value) = ((SimulationModel*)clientData)->getContactStiffnessParticleRigidBody(); -} - -void TW_CALL setStiffness(const void *value, void *clientData) -{ - const Real val = *(const Real *)(value); - ((SimulationModel*)clientData)->setClothStiffness(val); -} - -void TW_CALL getStiffness(void *value, void *clientData) -{ - *(Real *)(value) = ((SimulationModel*)clientData)->getClothStiffness(); -} - -void TW_CALL setXXStiffness(const void *value, void *clientData) -{ - const Real val = *(const Real *)(value); - ((SimulationModel*)clientData)->setClothXXStiffness(val); -} - -void TW_CALL getXXStiffness(void *value, void *clientData) -{ - *(Real *)(value) = ((SimulationModel*)clientData)->getClothXXStiffness(); -} - -void TW_CALL setYYStiffness(const void *value, void *clientData) -{ - const Real val = *(const Real *)(value); - ((SimulationModel*)clientData)->setClothYYStiffness(val); -} - -void TW_CALL getYYStiffness(void *value, void *clientData) -{ - *(Real *)(value) = ((SimulationModel*)clientData)->getClothYYStiffness(); -} - -void TW_CALL setXYStiffness(const void *value, void *clientData) -{ - const Real val = *(const Real *)(value); - ((SimulationModel*)clientData)->setClothXYStiffness(val); -} - -void TW_CALL getXYStiffness(void *value, void *clientData) -{ - *(Real *)(value) = ((SimulationModel*)clientData)->getClothXYStiffness(); -} - -void TW_CALL setYXPoissonRatio(const void *value, void *clientData) -{ - const Real val = *(const Real *)(value); - ((SimulationModel*)clientData)->setClothYXPoissonRatio(val); -} - -void TW_CALL getYXPoissonRatio(void *value, void *clientData) -{ - *(Real *)(value) = ((SimulationModel*)clientData)->getClothYXPoissonRatio(); -} - -void TW_CALL setXYPoissonRatio(const void *value, void *clientData) -{ - const Real val = *(const Real *)(value); - ((SimulationModel*)clientData)->setClothXYPoissonRatio(val); -} - -void TW_CALL getXYPoissonRatio(void *value, void *clientData) -{ - *(Real *)(value) = ((SimulationModel*)clientData)->getClothXYPoissonRatio(); -} - -void TW_CALL setNormalizeStretch(const void *value, void *clientData) -{ - const bool val = *(const bool *)(value); - ((SimulationModel*)clientData)->setClothNormalizeStretch(val); -} - -void TW_CALL getNormalizeStretch(void *value, void *clientData) -{ - *(bool *)(value) = ((SimulationModel*)clientData)->getClothNormalizeStretch(); -} - -void TW_CALL setNormalizeShear(const void *value, void *clientData) -{ - const bool val = *(const bool *)(value); - ((SimulationModel*)clientData)->setClothNormalizeShear(val); -} - -void TW_CALL getNormalizeShear(void *value, void *clientData) -{ - *(bool *)(value) = ((SimulationModel*)clientData)->getClothNormalizeShear(); -} - -void TW_CALL setBendingStiffness(const void *value, void *clientData) -{ - const Real val = *(const Real *)(value); - ((SimulationModel*)clientData)->setClothBendingStiffness(val); -} - -void TW_CALL getBendingStiffness(void *value, void *clientData) -{ - *(Real *)(value) = ((SimulationModel*)clientData)->getClothBendingStiffness(); -} - -void TW_CALL setBendingMethod(const void *value, void *clientData) -{ - const short val = *(const short *)(value); - *((short*)clientData) = val; - reset(); -} - -void TW_CALL getBendingMethod(void *value, void *clientData) -{ - *(short *)(value) = *((short*)clientData); -} + for (unsigned int i = 0; i < data.m_damperJointData.size(); i++) + { + const SceneLoader::DamperJointData &jd = data.m_damperJointData[i]; + model->addDamperJoint(id_index[jd.m_bodyID[0]], id_index[jd.m_bodyID[1]], jd.m_axis, jd.m_stiffness); + } -void TW_CALL setClothSimulationMethod(const void *value, void *clientData) -{ - const short val = *(const short *)(value); - *((short*)clientData) = val; - reset(); -} + for (unsigned int i = 0; i < data.m_rigidBodySpringData.size(); i++) + { + const SceneLoader::RigidBodySpringData &jd = data.m_rigidBodySpringData[i]; + model->addRigidBodySpring(id_index[jd.m_bodyID[0]], id_index[jd.m_bodyID[1]], jd.m_position1, jd.m_position2, jd.m_stiffness); + } -void TW_CALL getClothSimulationMethod(void *value, void *clientData) -{ - *(short *)(value) = *((short*)clientData); + for (unsigned int i = 0; i < data.m_distanceJointData.size(); i++) + { + const SceneLoader::DistanceJointData &jd = data.m_distanceJointData[i]; + model->addDistanceJoint(id_index[jd.m_bodyID[0]], id_index[jd.m_bodyID[1]], jd.m_position1, jd.m_position2); + } } -void TW_CALL setSolidSimulationMethod(const void *value, void *clientData) -{ - const short val = *(const short *)(value); - *((short*)clientData) = val; - reset(); -} -void TW_CALL getSolidSimulationMethod(void *value, void *clientData) -{ - *(short *)(value) = *((short*)clientData); -} diff --git a/Demos/Simulation/BoundingSphere.h b/Demos/Simulation/BoundingSphere.h deleted file mode 100644 index fbe68c5a..00000000 --- a/Demos/Simulation/BoundingSphere.h +++ /dev/null @@ -1,47 +0,0 @@ -#ifndef __BOUNDINGSPHERE_H__ -#define __BOUNDINGSPHERE_H__ - -#include "Common/Common.h" - -namespace PBD -{ - - class BoundingSphere - { - public: - - BoundingSphere() = default; - BoundingSphere(Vector3r const& x, Real r) : m_x(x), m_r(r) {} - - Vector3r const& x() const { return m_x; } - Vector3r& x() { return m_x; } - - Real r() const { return m_r; } - Real& r() { return m_r; } - - bool overlaps(BoundingSphere const& other) const - { - Real rr = m_r + other.m_r; - return (m_x - other.m_x).squaredNorm() < rr * rr; - } - - bool contains(BoundingSphere const& other) const - { - Real rr = r() - other.r(); - return (x() - other.x()).squaredNorm() < rr * rr; - } - - bool contains(Vector3r const& other) const - { - return (x() - other).squaredNorm() < m_r * m_r; - } - - private: - - Vector3r m_x; - Real m_r; - }; - -} - -#endif diff --git a/Demos/Simulation/BoundingSphereHierarchy.cpp b/Demos/Simulation/BoundingSphereHierarchy.cpp deleted file mode 100644 index b579e429..00000000 --- a/Demos/Simulation/BoundingSphereHierarchy.cpp +++ /dev/null @@ -1,75 +0,0 @@ - -#include "BoundingSphereHierarchy.h" -#include "MiniBall.h" - -#include -#include -#include - -using namespace Eigen; -using pool_set = std::set; -using namespace PBD; - - -PointCloudBSH::PointCloudBSH() - : super(0) -{ -} - -Vector3r const& PointCloudBSH::entity_position(unsigned int i) const -{ - return m_vertices[i]; -} - -struct PCBSHCoordAccessor -{ - PCBSHCoordAccessor(const Vector3r *vertices_, - std::vector const* lst_) - : vertices(vertices_), lst(lst_) - { - } - - using Pit = unsigned int; - using Cit = Real const*; - inline Cit operator() (Pit it) const { - return vertices[(*lst)[it]].data(); - } - const Vector3r *vertices; - std::vector const* lst; -}; - - -void PointCloudBSH::compute_hull(unsigned int b, unsigned int n, BoundingSphere& hull) const -{ - auto mb = Miniball::Miniball(3, b, b + n, {m_vertices, &m_lst}); - - hull.x() = Map(mb.center()); - hull.r() = std::sqrt(mb.squared_radius()); -} - -void PointCloudBSH::compute_hull_approx(unsigned int b, unsigned int n, BoundingSphere& hull) const -{ - // compute center - Vector3r x; - x.setZero(); - for (unsigned int i = b; i < b+n; i++) - x += m_vertices[m_lst[i]]; - x /= (Real)n; - - Real radius2 = 0.0; - for (unsigned int i = b; i < b+n; i++) - { - radius2 = std::max(radius2, (x - m_vertices[m_lst[i]]).squaredNorm()); - } - - hull.x() = x; - hull.r() = sqrt(radius2); -} - -void PointCloudBSH::init(const Vector3r *vertices, const unsigned int numVertices) -{ - m_lst.resize(numVertices); - m_vertices = vertices; - m_numVertices = numVertices; -} - diff --git a/Demos/Simulation/BoundingSphereHierarchy.h b/Demos/Simulation/BoundingSphereHierarchy.h deleted file mode 100644 index b0a1447d..00000000 --- a/Demos/Simulation/BoundingSphereHierarchy.h +++ /dev/null @@ -1,33 +0,0 @@ -#ifndef __BOUNDINGSPHEREHIERARCHY_H__ -#define __BOUNDINGSPHEREHIERARCHY_H__ - -#include "Common/Common.h" -#include "BoundingSphere.h" -#include "kdTree.h" - -namespace PBD -{ - class PointCloudBSH : public KDTree - { - - public: - - using super = KDTree; - - PointCloudBSH(); - - void init(const Vector3r *vertices, const unsigned int numVertices); - Vector3r const& entity_position(unsigned int i) const final; - void compute_hull(unsigned int b, unsigned int n, BoundingSphere& hull) - const final; - void compute_hull_approx(unsigned int b, unsigned int n, BoundingSphere& hull) - const final; - - private: - const Vector3r *m_vertices; - unsigned int m_numVertices; - }; - -} - -#endif diff --git a/Demos/Simulation/CMakeLists.txt b/Demos/Simulation/CMakeLists.txt deleted file mode 100644 index 6b70eaf5..00000000 --- a/Demos/Simulation/CMakeLists.txt +++ /dev/null @@ -1,43 +0,0 @@ -add_library(Simulation - AABB.h - CollisionDetection.cpp - CollisionDetection.h - Constraints.cpp - Constraints.h - DistanceFieldCollisionDetection.cpp - DistanceFieldCollisionDetection.h - IDFactory.cpp - IDFactory.h - NeighborhoodSearchSpatialHashing.cpp - NeighborhoodSearchSpatialHashing.h - ParticleData.h - RigidBody.h - RigidBodyGeometry.cpp - RigidBodyGeometry.h - SimulationModel.cpp - SimulationModel.h - TetModel.cpp - TetModel.h - TimeManager.cpp - TimeManager.h - TimeStepController.cpp - TimeStepController.h - TriangleModel.cpp - TriangleModel.h - - BoundingSphere.h - BoundingSphereHierarchy.cpp - BoundingSphereHierarchy.h - kdTree.h - kdTree.inl - - CMakeLists.txt -) - -find_package( Eigen3 REQUIRED ) -include_directories( ${EIGEN3_INCLUDE_DIR} ) -include_directories(${PROJECT_PATH}/extern/Miniball) - - - - diff --git a/Demos/Simulation/CollisionDetection.h b/Demos/Simulation/CollisionDetection.h deleted file mode 100644 index f4f07843..00000000 --- a/Demos/Simulation/CollisionDetection.h +++ /dev/null @@ -1,84 +0,0 @@ -#ifndef _COLLISIONDETECTION_H -#define _COLLISIONDETECTION_H - -#include "Demos/Common/Config.h" -#include "Common/Common.h" -#include "Demos/Utils/ObjectArray.h" -#include "SimulationModel.h" -#include "AABB.h" - -namespace PBD -{ - class CollisionDetection - { - public: - static const unsigned int RigidBodyContactType = 0; - static const unsigned int ParticleContactType = 1; - static const unsigned int ParticleRigidBodyContactType = 2; - - typedef void(*ContactCallbackFunction)(const unsigned int contactType, const unsigned int bodyIndex1, const unsigned int bodyIndex2, - const Vector3r &cp1, const Vector3r &cp2, - const Vector3r &normal, const Real dist, - const Real restitutionCoeff, const Real frictionCoeff, void *userData); - - struct CollisionObject - { - static const unsigned int RigidBodyCollisionObjectType = 0; - static const unsigned int TriangleModelCollisionObjectType = 1; - static const unsigned int TetModelCollisionObjectType = 2; - - AABB m_aabb; - unsigned int m_bodyIndex; - unsigned int m_bodyType; - - virtual ~CollisionObject() {} - virtual int &getTypeId() const = 0; - }; - - struct CollisionObjectWithoutGeometry : public CollisionObject - { - static int TYPE_ID; - virtual int &getTypeId() const { return TYPE_ID; } - virtual ~CollisionObjectWithoutGeometry() {} - }; - - protected: - Real m_tolerance; - ContactCallbackFunction m_contactCB; - void *m_contactCBUserData; - ObjectArray m_collisionObjects; - - void updateAABB(const Vector3r &p, AABB &aabb); - - public: - CollisionDetection(); - virtual ~CollisionDetection(); - - void cleanup(); - - Real getTolerance() const { return m_tolerance; } - void setTolerance(Real val) { m_tolerance = val; } - - void addRigidBodyContact(const unsigned int rbIndex1, const unsigned int rbIndex2, - const Vector3r &cp1, const Vector3r &cp2, - const Vector3r &normal, const Real dist, - const Real restitutionCoeff, const Real frictionCoeff); - - void addParticleRigidBodyContact(const unsigned int particleIndex, const unsigned int rbIndex, - const Vector3r &cp1, const Vector3r &cp2, - const Vector3r &normal, const Real dist, - const Real restitutionCoeff, const Real frictionCoeff); - - virtual void addCollisionObject(const unsigned int bodyIndex, const unsigned int bodyType); - - ObjectArray &getCollisionObjects() { return m_collisionObjects; } - - virtual void collisionDetection(SimulationModel &model) = 0; - - void setContactCallback(CollisionDetection::ContactCallbackFunction val, void *userData); - void updateAABBs(SimulationModel &model); - void updateAABB(SimulationModel &model, CollisionDetection::CollisionObject *co); - }; -} - -#endif diff --git a/Demos/Simulation/Constraints.h b/Demos/Simulation/Constraints.h deleted file mode 100644 index d452a2dd..00000000 --- a/Demos/Simulation/Constraints.h +++ /dev/null @@ -1,387 +0,0 @@ -#ifndef _CONSTRAINTS_H -#define _CONSTRAINTS_H - -#include "Demos/Common/Config.h" -#include "Common/Common.h" - -namespace PBD -{ - class SimulationModel; - - class Constraint - { - public: - unsigned int m_numberOfBodies; - /** indices of the linked bodies */ - unsigned int *m_bodies; - - Constraint(const unsigned int numberOfBodies) - { - m_numberOfBodies = numberOfBodies; - m_bodies = new unsigned int[numberOfBodies]; - } - - virtual ~Constraint() { delete[] m_bodies; }; - virtual int &getTypeId() const = 0; - - virtual bool updateConstraint(SimulationModel &model) { return true; }; - virtual bool solvePositionConstraint(SimulationModel &model) { return true; }; - virtual bool solveVelocityConstraint(SimulationModel &model) { return true; }; - }; - - class BallJoint : public Constraint - { - public: - static int TYPE_ID; - Eigen::Matrix m_jointInfo; - - BallJoint() : Constraint(2) {} - virtual int &getTypeId() const { return TYPE_ID; } - - bool initConstraint(SimulationModel &model, const unsigned int rbIndex1, const unsigned int rbIndex2, const Vector3r &pos); - virtual bool updateConstraint(SimulationModel &model); - virtual bool solvePositionConstraint(SimulationModel &model); - }; - - class BallOnLineJoint : public Constraint - { - public: - static int TYPE_ID; - Eigen::Matrix m_jointInfo; - - BallOnLineJoint() : Constraint(2) {} - virtual int &getTypeId() const { return TYPE_ID; } - - bool initConstraint(SimulationModel &model, const unsigned int rbIndex1, const unsigned int rbIndex2, const Vector3r &pos, const Vector3r &dir); - virtual bool updateConstraint(SimulationModel &model); - virtual bool solvePositionConstraint(SimulationModel &model); - }; - - class HingeJoint : public Constraint - { - public: - static int TYPE_ID; - Eigen::Matrix m_jointInfo; - - HingeJoint() : Constraint(2) {} - virtual int &getTypeId() const { return TYPE_ID; } - - bool initConstraint(SimulationModel &model, const unsigned int rbIndex1, const unsigned int rbIndex2, const Vector3r &pos, const Vector3r &axis); - virtual bool updateConstraint(SimulationModel &model); - virtual bool solvePositionConstraint(SimulationModel &model); - }; - - class UniversalJoint : public Constraint - { - public: - static int TYPE_ID; - Eigen::Matrix m_jointInfo; - - UniversalJoint() : Constraint(2) {} - virtual int &getTypeId() const { return TYPE_ID; } - - bool initConstraint(SimulationModel &model, const unsigned int rbIndex1, const unsigned int rbIndex2, const Vector3r &pos, const Vector3r &axis1, const Vector3r &axis2); - virtual bool updateConstraint(SimulationModel &model); - virtual bool solvePositionConstraint(SimulationModel &model); - }; - - class SliderJoint : public Constraint - { - public: - static int TYPE_ID; - Eigen::Matrix m_jointInfo; - - SliderJoint() : Constraint(2) {} - virtual int &getTypeId() const { return TYPE_ID; } - - bool initConstraint(SimulationModel &model, const unsigned int rbIndex1, const unsigned int rbIndex2, const Vector3r &pos, const Vector3r &axis); - virtual bool updateConstraint(SimulationModel &model); - virtual bool solvePositionConstraint(SimulationModel &model); - }; - - class TargetPositionMotorSliderJoint : public Constraint - { - public: - static int TYPE_ID; - Eigen::Matrix m_jointInfo; - Real m_targetPosition; - - TargetPositionMotorSliderJoint() : Constraint(2) { m_targetPosition = 0.0; } - virtual int &getTypeId() const { return TYPE_ID; } - - Real getTargetPosition() const { return m_targetPosition; } - void setTargetPosition(const Real val) { m_targetPosition = val; } - - bool initConstraint(SimulationModel &model, const unsigned int rbIndex1, const unsigned int rbIndex2, const Vector3r &pos, const Vector3r &axis); - virtual bool updateConstraint(SimulationModel &model); - virtual bool solvePositionConstraint(SimulationModel &model); - }; - - class TargetVelocityMotorSliderJoint : public Constraint - { - public: - static int TYPE_ID; - Eigen::Matrix m_jointInfo; - Real m_targetVelocity; - - TargetVelocityMotorSliderJoint() : Constraint(2) { m_targetVelocity = 0.0; } - virtual int &getTypeId() const { return TYPE_ID; } - - Real getTargetVelocity() const { return m_targetVelocity; } - void setTargetVelocity(const Real val) { m_targetVelocity = val; } - - bool initConstraint(SimulationModel &model, const unsigned int rbIndex1, const unsigned int rbIndex2, const Vector3r &pos, const Vector3r &axis); - virtual bool updateConstraint(SimulationModel &model); - virtual bool solvePositionConstraint(SimulationModel &model); - virtual bool solveVelocityConstraint(SimulationModel &model); - }; - - class TargetAngleMotorHingeJoint : public Constraint - { - public: - static int TYPE_ID; - Eigen::Matrix m_jointInfo; - Real m_targetAngle; - TargetAngleMotorHingeJoint() : Constraint(2) { m_targetAngle = 0.0; } - virtual int &getTypeId() const { return TYPE_ID; } - - Real getTargetAngle() const { return m_targetAngle; } - void setTargetAngle(const Real val) - { - const Real pi = (Real)M_PI; - m_targetAngle = std::max(val, -pi); - m_targetAngle = std::min(m_targetAngle, pi); - } - - bool initConstraint(SimulationModel &model, const unsigned int rbIndex1, const unsigned int rbIndex2, const Vector3r &pos, const Vector3r &axis); - virtual bool updateConstraint(SimulationModel &model); - virtual bool solvePositionConstraint(SimulationModel &model); - }; - - class TargetVelocityMotorHingeJoint : public Constraint - { - public: - static int TYPE_ID; - Eigen::Matrix m_jointInfo; - Real m_targetAngularVelocity; - TargetVelocityMotorHingeJoint() : Constraint(2) { m_targetAngularVelocity = 0.0; } - virtual int &getTypeId() const { return TYPE_ID; } - - Real getTargetAngularVelocity() const { return m_targetAngularVelocity; } - void setTargetAngularVelocity(const Real val) { m_targetAngularVelocity = val; } - - bool initConstraint(SimulationModel &model, const unsigned int rbIndex1, const unsigned int rbIndex2, const Vector3r &pos, const Vector3r &axis); - virtual bool updateConstraint(SimulationModel &model); - virtual bool solvePositionConstraint(SimulationModel &model); - virtual bool solveVelocityConstraint(SimulationModel &model); - }; - - class RigidBodyParticleBallJoint : public Constraint - { - public: - static int TYPE_ID; - Eigen::Matrix m_jointInfo; - - RigidBodyParticleBallJoint() : Constraint(2) {} - virtual int &getTypeId() const { return TYPE_ID; } - - bool initConstraint(SimulationModel &model, const unsigned int rbIndex, const unsigned int particleIndex); - virtual bool updateConstraint(SimulationModel &model); - virtual bool solvePositionConstraint(SimulationModel &model); - }; - - class DistanceConstraint : public Constraint - { - public: - static int TYPE_ID; - Real m_restLength; - - DistanceConstraint() : Constraint(2) {} - virtual int &getTypeId() const { return TYPE_ID; } - - virtual bool initConstraint(SimulationModel &model, const unsigned int particle1, const unsigned int particle2); - virtual bool solvePositionConstraint(SimulationModel &model); - }; - - class DihedralConstraint : public Constraint - { - public: - static int TYPE_ID; - Real m_restAngle; - - DihedralConstraint() : Constraint(4) {} - virtual int &getTypeId() const { return TYPE_ID; } - - virtual bool initConstraint(SimulationModel &model, const unsigned int particle1, const unsigned int particle2, - const unsigned int particle3, const unsigned int particle4); - virtual bool solvePositionConstraint(SimulationModel &model); - }; - - class IsometricBendingConstraint : public Constraint - { - public: - static int TYPE_ID; - Matrix4r m_Q; - - IsometricBendingConstraint() : Constraint(4) {} - virtual int &getTypeId() const { return TYPE_ID; } - - virtual bool initConstraint(SimulationModel &model, const unsigned int particle1, const unsigned int particle2, - const unsigned int particle3, const unsigned int particle4); - virtual bool solvePositionConstraint(SimulationModel &model); - }; - - class FEMTriangleConstraint : public Constraint - { - public: - static int TYPE_ID; - Real m_area; - Matrix2r m_invRestMat; - - FEMTriangleConstraint() : Constraint(3) {} - virtual int &getTypeId() const { return TYPE_ID; } - - virtual bool initConstraint(SimulationModel &model, const unsigned int particle1, const unsigned int particle2, - const unsigned int particle3); - virtual bool solvePositionConstraint(SimulationModel &model); - }; - - class StrainTriangleConstraint : public Constraint - { - public: - static int TYPE_ID; - Matrix2r m_invRestMat; - - StrainTriangleConstraint() : Constraint(3) {} - virtual int &getTypeId() const { return TYPE_ID; } - - virtual bool initConstraint(SimulationModel &model, const unsigned int particle1, const unsigned int particle2, - const unsigned int particle3); - virtual bool solvePositionConstraint(SimulationModel &model); - }; - - class VolumeConstraint : public Constraint - { - public: - static int TYPE_ID; - Real m_restVolume; - - VolumeConstraint() : Constraint(4) {} - virtual int &getTypeId() const { return TYPE_ID; } - - virtual bool initConstraint(SimulationModel &model, const unsigned int particle1, const unsigned int particle2, - const unsigned int particle3, const unsigned int particle4); - virtual bool solvePositionConstraint(SimulationModel &model); - }; - - class FEMTetConstraint : public Constraint - { - public: - static int TYPE_ID; - Real m_volume; - Matrix3r m_invRestMat; - - FEMTetConstraint() : Constraint(4) {} - virtual int &getTypeId() const { return TYPE_ID; } - - virtual bool initConstraint(SimulationModel &model, const unsigned int particle1, const unsigned int particle2, - const unsigned int particle3, const unsigned int particle4); - virtual bool solvePositionConstraint(SimulationModel &model); - }; - - class StrainTetConstraint : public Constraint - { - public: - static int TYPE_ID; - Matrix3r m_invRestMat; - - StrainTetConstraint() : Constraint(4) {} - virtual int &getTypeId() const { return TYPE_ID; } - - virtual bool initConstraint(SimulationModel &model, const unsigned int particle1, const unsigned int particle2, - const unsigned int particle3, const unsigned int particle4); - virtual bool solvePositionConstraint(SimulationModel &model); - }; - - class ShapeMatchingConstraint : public Constraint - { - public: - static int TYPE_ID; - Vector3r m_restCm; - Matrix3r m_invRestMat; - Real *m_w; - Vector3r *m_x0; - Vector3r *m_x; - Vector3r *m_corr; - unsigned int *m_numClusters; - - ShapeMatchingConstraint(const unsigned int numberOfParticles) : Constraint(numberOfParticles) - { - m_x = new Vector3r[numberOfParticles]; - m_x0 = new Vector3r[numberOfParticles]; - m_corr = new Vector3r[numberOfParticles]; - m_w = new Real[numberOfParticles]; - m_numClusters = new unsigned int[numberOfParticles]; - } - virtual ~ShapeMatchingConstraint() - { - delete[] m_x; - delete[] m_x0; - delete[] m_corr; - delete[] m_w; - delete[] m_numClusters; - } - virtual int &getTypeId() const { return TYPE_ID; } - - virtual bool initConstraint(SimulationModel &model, const unsigned int particleIndices[], const unsigned int numClusters[]); - virtual bool solvePositionConstraint(SimulationModel &model); - }; - - class RigidBodyContactConstraint - { - public: - static int TYPE_ID; - /** indices of the linked bodies */ - unsigned int m_bodies[2]; - Real m_stiffness; - Real m_frictionCoeff; - Real m_currentCorrection; - Real m_sum_impulses; - Eigen::Matrix m_constraintInfo; - - RigidBodyContactConstraint() { m_currentCorrection = 0.0; } - ~RigidBodyContactConstraint() {} - virtual int &getTypeId() const { return TYPE_ID; } - - bool initConstraint(SimulationModel &model, const unsigned int rbIndex1, const unsigned int rbIndex2, - const Vector3r &cp1, const Vector3r &cp2, - const Vector3r &normal, const Real dist, - const Real restitutionCoeff, const Real stiffness, const Real frictionCoeff); - virtual bool solveVelocityConstraint(SimulationModel &model); - }; - - class ParticleRigidBodyContactConstraint - { - public: - static int TYPE_ID; - /** indices of the linked bodies */ - unsigned int m_bodies[2]; - Real m_stiffness; - Real m_frictionCoeff; - Real m_currentCorrection; - Real m_sum_impulses; - Eigen::Matrix m_constraintInfo; - - ParticleRigidBodyContactConstraint() { m_currentCorrection = 0.0; } - ~ParticleRigidBodyContactConstraint() {} - virtual int &getTypeId() const { return TYPE_ID; } - - bool initConstraint(SimulationModel &model, const unsigned int particleIndex, const unsigned int rbIndex, - const Vector3r &cp1, const Vector3r &cp2, - const Vector3r &normal, const Real dist, - const Real restitutionCoeff, const Real stiffness, const Real frictionCoeff); - virtual bool solveVelocityConstraint(SimulationModel &model); - }; -} - -#endif diff --git a/Demos/Simulation/DistanceFieldCollisionDetection.cpp b/Demos/Simulation/DistanceFieldCollisionDetection.cpp deleted file mode 100644 index 5433597b..00000000 --- a/Demos/Simulation/DistanceFieldCollisionDetection.cpp +++ /dev/null @@ -1,454 +0,0 @@ -#include "DistanceFieldCollisionDetection.h" -#include "Demos/Simulation/IDFactory.h" -#include "omp.h" - -using namespace PBD; - -int DistanceFieldCollisionDetection::DistanceFieldCollisionBox::TYPE_ID = IDFactory::getId(); -int DistanceFieldCollisionDetection::DistanceFieldCollisionSphere::TYPE_ID = IDFactory::getId(); -int DistanceFieldCollisionDetection::DistanceFieldCollisionTorus::TYPE_ID = IDFactory::getId(); -int DistanceFieldCollisionDetection::DistanceFieldCollisionCylinder::TYPE_ID = IDFactory::getId(); -int DistanceFieldCollisionDetection::DistanceFieldCollisionObjectWithoutGeometry::TYPE_ID = IDFactory::getId(); - -DistanceFieldCollisionDetection::DistanceFieldCollisionDetection() : - CollisionDetection() -{ -} - -DistanceFieldCollisionDetection::~DistanceFieldCollisionDetection() -{ -} - -void DistanceFieldCollisionDetection::collisionDetection(SimulationModel &model) -{ - model.resetContacts(); - const SimulationModel::RigidBodyVector &rigidBodies = model.getRigidBodies(); - const SimulationModel::TriangleModelVector &triModels = model.getTriangleModels(); - const SimulationModel::TetModelVector &tetModels = model.getTetModels(); - const ParticleData &pd = model.getParticles(); - - std::vector < std::pair> coPairs; - for (unsigned int i = 0; i < m_collisionObjects.size(); i++) - { - CollisionDetection::CollisionObject *co1 = m_collisionObjects[i]; - for (unsigned int k = 0; k < m_collisionObjects.size(); k++) - { - CollisionDetection::CollisionObject *co2 = m_collisionObjects[k]; - if ((i != k)) - { - coPairs.push_back({ i, k }); - } - } - } - - //omp_set_num_threads(1); - std::vector > contacts_mt; - contacts_mt.resize(omp_get_max_threads()); - - #pragma omp parallel default(shared) - { - // Update BVHs - #pragma omp for schedule(static) - for (int i = 0; i < (int)m_collisionObjects.size(); i++) - { - CollisionDetection::CollisionObject *co = m_collisionObjects[i]; - updateAABB(model, co); - if (isDistanceFieldCollisionObject(co)) - { - if ((co->m_bodyType == CollisionDetection::CollisionObject::TriangleModelCollisionObjectType) || - (co->m_bodyType == CollisionDetection::CollisionObject::TetModelCollisionObjectType)) - { - DistanceFieldCollisionObject *sco = (DistanceFieldCollisionObject*)co; - sco->m_bvh.update(); - } - } - } - - #pragma omp for schedule(static) - for (int i = 0; i < (int)coPairs.size(); i++) - { - std::pair &coPair = coPairs[i]; - CollisionDetection::CollisionObject *co1 = m_collisionObjects[coPair.first]; - CollisionDetection::CollisionObject *co2 = m_collisionObjects[coPair.second]; - - if ((co2->m_bodyType != CollisionDetection::CollisionObject::RigidBodyCollisionObjectType) || - !isDistanceFieldCollisionObject(co1) || - !isDistanceFieldCollisionObject(co2) || - !AABB::intersection(co1->m_aabb, co2->m_aabb)) - continue; - - - RigidBody *rb2 = rigidBodies[co2->m_bodyIndex]; - if ((co1->m_bodyType == CollisionDetection::CollisionObject::RigidBodyCollisionObjectType) && - ((DistanceFieldCollisionObject*) co1)->m_testMesh) - { - RigidBody *rb1 = rigidBodies[co1->m_bodyIndex]; - const Real restitutionCoeff = rb1->getRestitutionCoeff() * rb2->getRestitutionCoeff(); - const Real frictionCoeff = rb1->getFrictionCoeff() + rb2->getFrictionCoeff(); - collisionDetectionRigidBodies(rb1, (DistanceFieldCollisionObject*)co1, rb2, (DistanceFieldCollisionObject*)co2, - restitutionCoeff, frictionCoeff - , contacts_mt - ); - } - else if (co1->m_bodyType == CollisionDetection::CollisionObject::TriangleModelCollisionObjectType) - { - TriangleModel *tm = triModels[co1->m_bodyIndex]; - const unsigned int offset = tm->getIndexOffset(); - const IndexedFaceMesh &mesh = tm->getParticleMesh(); - const unsigned int numVert = mesh.numVertices(); - const Real restitutionCoeff = tm->getRestitutionCoeff() * rb2->getRestitutionCoeff(); - const Real frictionCoeff = tm->getFrictionCoeff() + rb2->getFrictionCoeff(); - collisionDetectionRBSolid(pd, offset, numVert, (DistanceFieldCollisionObject*)co1, rb2, (DistanceFieldCollisionObject*)co2, - restitutionCoeff, frictionCoeff - , contacts_mt - ); - } - else if (co1->m_bodyType == CollisionDetection::CollisionObject::TetModelCollisionObjectType) - { - TetModel *tm = tetModels[co1->m_bodyIndex]; - const unsigned int offset = tm->getIndexOffset(); - const IndexedTetMesh &mesh = tm->getParticleMesh(); - const unsigned int numVert = mesh.numVertices(); - const Real restitutionCoeff = tm->getRestitutionCoeff() * rb2->getRestitutionCoeff(); - const Real frictionCoeff = tm->getFrictionCoeff() + rb2->getFrictionCoeff(); - collisionDetectionRBSolid(pd, offset, numVert, (DistanceFieldCollisionObject*)co1, rb2, (DistanceFieldCollisionObject*)co2, - restitutionCoeff, frictionCoeff - , contacts_mt - ); - } - } - } - for (unsigned int i = 0; i < contacts_mt.size(); i++) - { - for (unsigned int j = 0; j < contacts_mt[i].size(); j++) - { - if (contacts_mt[i][j].m_type == 1) - addParticleRigidBodyContact(contacts_mt[i][j].m_index1, contacts_mt[i][j].m_index2, - contacts_mt[i][j].m_cp1, contacts_mt[i][j].m_cp2, contacts_mt[i][j].m_normal, - contacts_mt[i][j].m_dist, contacts_mt[i][j].m_restitution, contacts_mt[i][j].m_friction); - else - addRigidBodyContact(contacts_mt[i][j].m_index1, contacts_mt[i][j].m_index2, - contacts_mt[i][j].m_cp1, contacts_mt[i][j].m_cp2, contacts_mt[i][j].m_normal, - contacts_mt[i][j].m_dist, contacts_mt[i][j].m_restitution, contacts_mt[i][j].m_friction); - } - } -} - -void DistanceFieldCollisionDetection::collisionDetectionRigidBodies(RigidBody *rb1, DistanceFieldCollisionObject *co1, RigidBody *rb2, DistanceFieldCollisionObject *co2, - const Real restitutionCoeff, const Real frictionCoeff - , std::vector > &contacts_mt - ) -{ - if ((rb1->getMass() == 0.0) && (rb2->getMass() == 0.0)) - return; - - const VertexData &vd = rb1->getGeometry().getVertexData(); - - const Vector3r &com2 = rb2->getPosition(); - - // remove the rotation of the main axis transformation that is performed - // to get a diagonal inertia tensor since the distance function is - // evaluated in local coordinates - // - // transformation world to local: - // p_local = R_initial^T ( R_MAT R^T (p_world - x) - x_initial + x_MAT) - // - // transformation local to: - // p_world = R R_MAT^T (R_initial p_local + x_initial - x_MAT) + x - // - const Matrix3r R = (rb2->getRotationInitial().inverse() * rb2->getRotationMAT() * rb2->getRotation().inverse()).matrix(); - const Vector3r v1 = -rb2->getRotationInitial().inverse().matrix() * rb2->getPositionInitial_MAT(); - const Vector3r v2 = (rb2->getRotation()*rb2->getRotationMAT().inverse()).matrix() * rb2->getPositionInitial_MAT() + com2; - - const PointCloudBSH &bvh = ((DistanceFieldCollisionDetection::DistanceFieldCollisionObject*) co1)->m_bvh; - std::function predicate = [&](unsigned int node_index, unsigned int depth) - { - const BoundingSphere &bs = bvh.hull(node_index); - const Vector3r &sphere_x = bs.x(); - const Vector3r sphere_x_w = rb1->getRotation() * sphere_x + rb1->getPosition(); - - AlignedBox3r box3f; - box3f.extend(co2->m_aabb.m_p[0]); - box3f.extend(co2->m_aabb.m_p[1]); - const Real dist = box3f.exteriorDistance(sphere_x_w); - - // Test if center of bounding sphere intersects AABB - if (dist < bs.r()) - { - // Test if distance of center of bounding sphere to collision object is smaller than the radius - const Vector3r x = R * (sphere_x_w - com2) + v1; - const Real dist2 = co2->distance(x.template cast(), static_cast(m_tolerance)); - if (dist2 == std::numeric_limits::max()) - return true; - if (dist2 < bs.r()) - return true; - } - return false; - }; - std::function cb = [&](unsigned int node_index, unsigned int depth) - { - auto const& node = bvh.node(node_index); - if (!node.is_leaf()) - return; - - for (auto i = node.begin; i < node.begin + node.n; ++i) - { - unsigned int index = bvh.entity(i); - const Vector3r &x_w = vd.getPosition(index); - const Vector3r x = R * (x_w - com2) + v1; - Vector3r cp, n; - Real dist; - if (co2->collisionTest(x, m_tolerance, cp, n, dist)) - { - const Vector3r cp_w = R.transpose() * cp + v2; - const Vector3r n_w = R.transpose() * n; - - int tid = omp_get_thread_num(); - contacts_mt[tid].push_back({ 0, co1->m_bodyIndex, co2->m_bodyIndex, x_w, cp_w, n_w, dist, restitutionCoeff, frictionCoeff }); - } - } - }; - bvh.traverse_depth_first(predicate, cb); -} - - -void DistanceFieldCollisionDetection::collisionDetectionRBSolid(const ParticleData &pd, const unsigned int offset, const unsigned int numVert, - DistanceFieldCollisionObject *co1, RigidBody *rb2, DistanceFieldCollisionObject *co2, - const Real restitutionCoeff, const Real frictionCoeff - , std::vector > &contacts_mt - ) -{ - const Vector3r &com2 = rb2->getPosition(); - - // remove the rotation of the main axis transformation that is performed - // to get a diagonal inertia tensor since the distance function is - // evaluated in local coordinates - // - // transformation world to local: - // p_local = R_initial^T ( R_MAT R^T (p_world - x) - x_initial + x_MAT) - // - // transformation local to: - // p_world = R R_MAT^T (R_initial p_local + x_initial - x_MAT) + x - // - const Matrix3r R = (rb2->getRotationInitial().inverse() * rb2->getRotationMAT() * rb2->getRotation().inverse()).matrix(); - const Vector3r v1 = -rb2->getRotationInitial().inverse().matrix() * rb2->getPositionInitial_MAT(); - const Vector3r v2 = (rb2->getRotation()*rb2->getRotationMAT().inverse()).matrix() * rb2->getPositionInitial_MAT() + com2; - - const PointCloudBSH &bvh = ((DistanceFieldCollisionDetection::DistanceFieldCollisionObject*) co1)->m_bvh; - - std::function predicate = [&](unsigned int node_index, unsigned int depth) - { - const BoundingSphere &bs = bvh.hull(node_index); - const Vector3r &sphere_x_w = bs.x(); - - AlignedBox3r box3f; - box3f.extend(co2->m_aabb.m_p[0]); - box3f.extend(co2->m_aabb.m_p[1]); - const Real dist = box3f.exteriorDistance(sphere_x_w); - - // Test if center of bounding sphere intersects AABB - if (dist < bs.r()) - { - // Test if distance of center of bounding sphere to collision object is smaller than the radius - const Vector3r x = R * (sphere_x_w - com2) + v1; - const Real dist2 = co2->distance(x.template cast(), static_cast(m_tolerance)); - if (dist2 == std::numeric_limits::max()) - return true; - if (dist2 < bs.r()) - return true; - } - return false; - }; - - std::function cb = [&](unsigned int node_index, unsigned int depth) - { - auto const& node = bvh.node(node_index); - if (!node.is_leaf()) - return; - - for (auto i = node.begin; i < node.begin + node.n; ++i) - { - unsigned int index = bvh.entity(i) + offset; - const Vector3r &x_w = pd.getPosition(index); - const Vector3r x = R * (x_w - com2) + v1; - Vector3r cp, n; - Real dist; - if (co2->collisionTest(x, m_tolerance, cp, n, dist)) - { - const Vector3r cp_w = R.transpose() * cp + v2; - const Vector3r n_w = R.transpose() * n; - - int tid = omp_get_thread_num(); - contacts_mt[tid].push_back({ 1, index, co2->m_bodyIndex, x_w, cp_w, n_w, dist, restitutionCoeff, frictionCoeff }); - } - } - }; - - bvh.traverse_depth_first(predicate, cb); -} - -bool DistanceFieldCollisionDetection::isDistanceFieldCollisionObject(CollisionObject *co) const -{ - return (co->getTypeId() == DistanceFieldCollisionDetection::DistanceFieldCollisionBox::TYPE_ID) || - (co->getTypeId() == DistanceFieldCollisionDetection::DistanceFieldCollisionSphere::TYPE_ID) || - (co->getTypeId() == DistanceFieldCollisionDetection::DistanceFieldCollisionTorus::TYPE_ID) || - (co->getTypeId() == DistanceFieldCollisionDetection::DistanceFieldCollisionCylinder::TYPE_ID) || - (co->getTypeId() == DistanceFieldCollisionDetection::DistanceFieldCollisionObjectWithoutGeometry::TYPE_ID); -} - -void DistanceFieldCollisionDetection::addCollisionBox(const unsigned int bodyIndex, const unsigned int bodyType, const Vector3r *vertices, const unsigned int numVertices, const Vector3r &box, const bool testMesh) -{ - DistanceFieldCollisionDetection::DistanceFieldCollisionBox *cf = new DistanceFieldCollisionDetection::DistanceFieldCollisionBox(); - cf->m_bodyIndex = bodyIndex; - cf->m_bodyType = bodyType; - // distance function requires 0.5*box - cf->m_box = 0.5*box; - cf->m_bvh.init(vertices, numVertices); - cf->m_bvh.construct(); - cf->m_testMesh = testMesh; - m_collisionObjects.push_back(cf); -} - -void DistanceFieldCollisionDetection::addCollisionSphere(const unsigned int bodyIndex, const unsigned int bodyType, const Vector3r *vertices, const unsigned int numVertices, const Real radius, const bool testMesh) -{ - DistanceFieldCollisionDetection::DistanceFieldCollisionSphere *cs = new DistanceFieldCollisionDetection::DistanceFieldCollisionSphere(); - cs->m_bodyIndex = bodyIndex; - cs->m_bodyType = bodyType; - cs->m_radius = radius; - cs->m_bvh.init(vertices, numVertices); - cs->m_bvh.construct(); - cs->m_testMesh = testMesh; - m_collisionObjects.push_back(cs); -} - -void DistanceFieldCollisionDetection::addCollisionTorus(const unsigned int bodyIndex, const unsigned int bodyType, const Vector3r *vertices, const unsigned int numVertices, const Vector2r &radii, const bool testMesh) -{ - DistanceFieldCollisionDetection::DistanceFieldCollisionTorus *ct = new DistanceFieldCollisionDetection::DistanceFieldCollisionTorus(); - ct->m_bodyIndex = bodyIndex; - ct->m_bodyType = bodyType; - ct->m_radii = radii; - ct->m_bvh.init(vertices, numVertices); - ct->m_bvh.construct(); - ct->m_testMesh = testMesh; - m_collisionObjects.push_back(ct); -} - -void DistanceFieldCollisionDetection::addCollisionCylinder(const unsigned int bodyIndex, const unsigned int bodyType, const Vector3r *vertices, const unsigned int numVertices, const Vector2r &dim, const bool testMesh) -{ - DistanceFieldCollisionDetection::DistanceFieldCollisionCylinder *ct = new DistanceFieldCollisionDetection::DistanceFieldCollisionCylinder(); - ct->m_bodyIndex = bodyIndex; - ct->m_bodyType = bodyType; - ct->m_dim = dim; - // distance function uses height/2 - ct->m_dim[1] *= 0.5; - ct->m_bvh.init(vertices, numVertices); - ct->m_bvh.construct(); - ct->m_testMesh = testMesh; - m_collisionObjects.push_back(ct); -} - -void DistanceFieldCollisionDetection::addCollisionObjectWithoutGeometry(const unsigned int bodyIndex, const unsigned int bodyType, const Vector3r *vertices, const unsigned int numVertices) -{ - DistanceFieldCollisionObjectWithoutGeometry *co = new DistanceFieldCollisionObjectWithoutGeometry(); - co->m_bodyIndex = bodyIndex; - co->m_bodyType = bodyType; - co->m_bvh.init(vertices, numVertices); - co->m_bvh.construct(); - co->m_testMesh = false; - m_collisionObjects.push_back(co); -} - -Real DistanceFieldCollisionDetection::DistanceFieldCollisionBox::distance(const Eigen::Vector3d &x, const Real tolerance) -{ - const Eigen::Vector3d box_d = m_box.template cast(); - const Eigen::Vector3d x_d = x.template cast(); - const Eigen::Vector3d d(fabs(x_d.x()) - box_d.x(), fabs(x_d.y()) - box_d.y(), fabs(x_d.z()) - box_d.z()); - const Eigen::Vector3d max_d(std::max(d.x(), 0.0), std::max(d.y(), 0.0), std::max(d.z(), 0.0)); - return std::min(std::max(d.x(), std::max(d.y(), d.z())), 0.0) + max_d.norm() - tolerance; -} - -Real DistanceFieldCollisionDetection::DistanceFieldCollisionSphere::distance(const Eigen::Vector3d &x, const Real tolerance) -{ - const Eigen::Vector3d d = x.template cast(); - const Real dl = d.norm(); - return dl - static_cast(m_radius) - tolerance; -} - -bool DistanceFieldCollisionDetection::DistanceFieldCollisionSphere::collisionTest(const Vector3r &x, const Real tolerance, Vector3r &cp, Vector3r &n, Real &dist) -{ - const Vector3r d = x; - const Real dl = d.norm(); - dist = dl - m_radius - tolerance; - if (dist < 0.0) - { - if (dl < 1.e-6) - n.setZero(); - else - n = d / dl; - - cp = ((m_radius+tolerance) * n); - return true; - } - return false; -} - -Real DistanceFieldCollisionDetection::DistanceFieldCollisionTorus::distance(const Eigen::Vector3d &x, const Real tolerance) -{ - const Eigen::Vector2d radii_d = m_radii.template cast(); - const Eigen::Vector2d q(Vector2r(x.x(), x.z()).norm() - radii_d.x(), x.y()); - return q.norm() - radii_d.y() - tolerance; -} - -Real DistanceFieldCollisionDetection::DistanceFieldCollisionCylinder::distance(const Eigen::Vector3d &x, const Real tolerance) -{ - const Real l = sqrt(x.x()*x.x() + x.z()*x.z()); - const Eigen::Vector2d d = Eigen::Vector2d(fabs(l), fabs(x.y())) - m_dim.template cast(); - const Eigen::Vector2d max_d(std::max(d.x(), 0.0), std::max(d.y(), 0.0)); - return std::min(std::max(d.x(), d.y()), 0.0) + max_d.norm() - tolerance; -} - -void DistanceFieldCollisionDetection::DistanceFieldCollisionObject::approximateNormal(const Eigen::Vector3d &x, const Real tolerance, Vector3r &n) -{ - // approximate gradient - Real eps = 1.e-6; - n.setZero(); - Eigen::Vector3d xTmp = x; - for (unsigned int j = 0; j < 3; j++) - { - xTmp[j] += eps; - - Real e_p, e_m; - e_p = distance(xTmp, tolerance); - xTmp[j] = x[j] - eps; - e_m = distance(xTmp, tolerance); - xTmp[j] = x[j]; - - Real res = (e_p - e_m) * (1.0 / (2.0*eps)); - - n[j] = static_cast(res); - } - - const Real norm2 = n.squaredNorm(); - if (norm2 < 1.e-6) - n.setZero(); - else - n = n / sqrt(norm2); -} - - -bool DistanceFieldCollisionDetection::DistanceFieldCollisionObject::collisionTest(const Vector3r &x, const Real tolerance, Vector3r &cp, Vector3r &n, Real &dist) -{ - const Real t_d = static_cast(tolerance); - dist = (Real)distance(x.template cast(), t_d); - if (dist < 0.0) - { - // approximate gradient - const Eigen::Vector3d x_d = x.template cast(); - - approximateNormal(x_d, t_d, n); - - cp = (x - dist * n); - return true; - } - return false; -} diff --git a/Demos/Simulation/SimulationModel.cpp b/Demos/Simulation/SimulationModel.cpp deleted file mode 100644 index c846e9ee..00000000 --- a/Demos/Simulation/SimulationModel.cpp +++ /dev/null @@ -1,501 +0,0 @@ -#include "SimulationModel.h" -#include "PositionBasedDynamics/PositionBasedRigidBodyDynamics.h" -#include "Constraints.h" - -using namespace PBD; - -SimulationModel::SimulationModel() -{ - m_cloth_stiffness = 1.0; - m_cloth_bendingStiffness = 0.01; - m_cloth_xxStiffness = 1.0; - m_cloth_yyStiffness = 1.0; - m_cloth_xyStiffness = 1.0; - m_cloth_xyPoissonRatio = 0.3; - m_cloth_yxPoissonRatio = 0.3; - m_cloth_normalizeShear = false; - m_cloth_normalizeStretch = false; - - m_solid_stiffness = 1.0; - m_solid_poissonRatio = 0.3; - m_solid_normalizeShear = false; - m_solid_normalizeStretch = false; - - m_contactStiffnessRigidBody = 1.0; - m_contactStiffnessParticleRigidBody = 100.0; - - m_groupsInitialized = false; - - m_rigidBodyContactConstraints.reserve(10000); - m_particleRigidBodyContactConstraints.reserve(10000); -} - -SimulationModel::~SimulationModel(void) -{ - cleanup(); -} - -void SimulationModel::cleanup() -{ - resetContacts(); - for (unsigned int i = 0; i < m_rigidBodies.size(); i++) - delete m_rigidBodies[i]; - m_rigidBodies.clear(); - for (unsigned int i = 0; i < m_triangleModels.size(); i++) - delete m_triangleModels[i]; - m_triangleModels.clear(); - for (unsigned int i = 0; i < m_tetModels.size(); i++) - delete m_tetModels[i]; - m_tetModels.clear(); - for (unsigned int i = 0; i < m_constraints.size(); i++) - delete m_constraints[i]; - m_constraints.clear(); - m_particles.release(); - m_groupsInitialized = false; -} - -void SimulationModel::reset() -{ - resetContacts(); - - // rigid bodies - for (size_t i = 0; i < m_rigidBodies.size(); i++) - { - m_rigidBodies[i]->reset(); - m_rigidBodies[i]->getGeometry().updateMeshTransformation(m_rigidBodies[i]->getPosition(), m_rigidBodies[i]->getRotationMatrix()); - } - - // particles - for (unsigned int i = 0; i < m_particles.size(); i++) - { - const Vector3r& x0 = m_particles.getPosition0(i); - m_particles.getPosition(i) = x0; - m_particles.getLastPosition(i) = m_particles.getPosition(i); - m_particles.getOldPosition(i) = m_particles.getPosition(i); - m_particles.getVelocity(i).setZero(); - m_particles.getAcceleration(i).setZero(); - } - - updateConstraints(); -} - -SimulationModel::RigidBodyVector & SimulationModel::getRigidBodies() -{ - return m_rigidBodies; -} - -ParticleData & SimulationModel::getParticles() -{ - return m_particles; -} - -SimulationModel::TriangleModelVector & SimulationModel::getTriangleModels() -{ - return m_triangleModels; -} - -SimulationModel::TetModelVector & SimulationModel::getTetModels() -{ - return m_tetModels; -} - -SimulationModel::ConstraintVector & SimulationModel::getConstraints() -{ - return m_constraints; -} - -SimulationModel::RigidBodyContactConstraintVector & SimulationModel::getRigidBodyContactConstraints() -{ - return m_rigidBodyContactConstraints; -} - -SimulationModel::ParticleRigidBodyContactConstraintVector & SimulationModel::getParticleRigidBodyContactConstraints() -{ - return m_particleRigidBodyContactConstraints; -} - -SimulationModel::ConstraintGroupVector & SimulationModel::getConstraintGroups() -{ - return m_constraintGroups; -} - -void SimulationModel::updateConstraints() -{ - for (unsigned int i = 0; i < m_constraints.size(); i++) - m_constraints[i]->updateConstraint(*this); -} - - -bool SimulationModel::addBallJoint(const unsigned int rbIndex1, const unsigned int rbIndex2, const Vector3r &pos) -{ - BallJoint *bj = new BallJoint(); - const bool res = bj->initConstraint(*this, rbIndex1, rbIndex2, pos); - if (res) - { - m_constraints.push_back(bj); - m_groupsInitialized = false; - } - return res; -} - -bool SimulationModel::addBallOnLineJoint(const unsigned int rbIndex1, const unsigned int rbIndex2, const Vector3r &pos, const Vector3r &dir) -{ - BallOnLineJoint *bj = new BallOnLineJoint(); - const bool res = bj->initConstraint(*this, rbIndex1, rbIndex2, pos, dir); - if (res) - { - m_constraints.push_back(bj); - m_groupsInitialized = false; - } - return res; -} - -bool SimulationModel::addHingeJoint(const unsigned int rbIndex1, const unsigned int rbIndex2, const Vector3r &pos, const Vector3r &axis) -{ - HingeJoint *hj = new HingeJoint(); - const bool res = hj->initConstraint(*this, rbIndex1, rbIndex2, pos, axis); - if (res) - { - m_constraints.push_back(hj); - m_groupsInitialized = false; - } - return res; -} - -bool SimulationModel::addUniversalJoint(const unsigned int rbIndex1, const unsigned int rbIndex2, const Vector3r &pos, const Vector3r &axis1, const Vector3r &axis2) -{ - UniversalJoint *uj = new UniversalJoint(); - const bool res = uj->initConstraint(*this, rbIndex1, rbIndex2, pos, axis1, axis2); - if (res) - { - m_constraints.push_back(uj); - m_groupsInitialized = false; - } - return res; -} - -bool SimulationModel::addSliderJoint(const unsigned int rbIndex1, const unsigned int rbIndex2, const Vector3r &pos, const Vector3r &axis) -{ - SliderJoint *joint = new SliderJoint(); - const bool res = joint->initConstraint(*this, rbIndex1, rbIndex2, pos, axis); - if (res) - { - m_constraints.push_back(joint); - m_groupsInitialized = false; - } - return res; -} - -bool SimulationModel::addTargetPositionMotorSliderJoint(const unsigned int rbIndex1, const unsigned int rbIndex2, const Vector3r &pos, const Vector3r &axis) -{ - TargetPositionMotorSliderJoint *joint = new TargetPositionMotorSliderJoint(); - const bool res = joint->initConstraint(*this, rbIndex1, rbIndex2, pos, axis); - if (res) - { - m_constraints.push_back(joint); - m_groupsInitialized = false; - } - return res; -} - -bool SimulationModel::addTargetVelocityMotorSliderJoint(const unsigned int rbIndex1, const unsigned int rbIndex2, const Vector3r &pos, const Vector3r &axis) -{ - TargetVelocityMotorSliderJoint *joint = new TargetVelocityMotorSliderJoint(); - const bool res = joint->initConstraint(*this, rbIndex1, rbIndex2, pos, axis); - if (res) - { - m_constraints.push_back(joint); - m_groupsInitialized = false; - } - return res; -} - - -bool SimulationModel::addTargetAngleMotorHingeJoint(const unsigned int rbIndex1, const unsigned int rbIndex2, const Vector3r &pos, const Vector3r &axis) -{ - TargetAngleMotorHingeJoint *hj = new TargetAngleMotorHingeJoint(); - const bool res = hj->initConstraint(*this, rbIndex1, rbIndex2, pos, axis); - if (res) - { - m_constraints.push_back(hj); - m_groupsInitialized = false; - } - return res; -} - -bool SimulationModel::addTargetVelocityMotorHingeJoint(const unsigned int rbIndex1, const unsigned int rbIndex2, const Vector3r &pos, const Vector3r &axis) -{ - TargetVelocityMotorHingeJoint *hj = new TargetVelocityMotorHingeJoint(); - const bool res = hj->initConstraint(*this, rbIndex1, rbIndex2, pos, axis); - if (res) - { - m_constraints.push_back(hj); - m_groupsInitialized = false; - } - return res; -} - -bool SimulationModel::addRigidBodyParticleBallJoint(const unsigned int rbIndex, const unsigned int particleIndex) -{ - RigidBodyParticleBallJoint *bj = new RigidBodyParticleBallJoint(); - const bool res = bj->initConstraint(*this, rbIndex, particleIndex); - if (res) - { - m_constraints.push_back(bj); - m_groupsInitialized = false; - } - return res; -} - -bool SimulationModel::addRigidBodyContactConstraint(const unsigned int rbIndex1, const unsigned int rbIndex2, - const Vector3r &cp1, const Vector3r &cp2, - const Vector3r &normal, const Real dist, - const Real restitutionCoeff, const Real frictionCoeff) -{ - RigidBodyContactConstraint &cc = m_rigidBodyContactConstraints.create(); - const bool res = cc.initConstraint(*this, rbIndex1, rbIndex2, cp1, cp2, normal, dist, restitutionCoeff, m_contactStiffnessRigidBody, frictionCoeff); - if (!res) - m_rigidBodyContactConstraints.pop_back(); - return res; -} - - bool SimulationModel::addParticleRigidBodyContactConstraint(const unsigned int particleIndex, const unsigned int rbIndex, - const Vector3r &cp1, const Vector3r &cp2, - const Vector3r &normal, const Real dist, - const Real restitutionCoeff, const Real frictionCoeff) -{ - ParticleRigidBodyContactConstraint &cc = m_particleRigidBodyContactConstraints.create(); - const bool res = cc.initConstraint(*this, particleIndex, rbIndex, cp1, cp2, normal, dist, restitutionCoeff, m_contactStiffnessParticleRigidBody, frictionCoeff); - if (!res) - m_particleRigidBodyContactConstraints.pop_back(); - return res; -} - -bool SimulationModel::addDistanceConstraint(const unsigned int particle1, const unsigned int particle2) -{ - DistanceConstraint *c = new DistanceConstraint(); - const bool res = c->initConstraint(*this, particle1, particle2); - if (res) - { - m_constraints.push_back(c); - m_groupsInitialized = false; - } - return res; -} - -bool SimulationModel::addDihedralConstraint(const unsigned int particle1, const unsigned int particle2, - const unsigned int particle3, const unsigned int particle4) -{ - DihedralConstraint *c = new DihedralConstraint(); - const bool res = c->initConstraint(*this, particle1, particle2, particle3, particle4); - if (res) - { - m_constraints.push_back(c); - m_groupsInitialized = false; - } - return res; -} - -bool SimulationModel::addIsometricBendingConstraint(const unsigned int particle1, const unsigned int particle2, - const unsigned int particle3, const unsigned int particle4) -{ - IsometricBendingConstraint *c = new IsometricBendingConstraint(); - const bool res = c->initConstraint(*this, particle1, particle2, particle3, particle4); - if (res) - { - m_constraints.push_back(c); - m_groupsInitialized = false; - } - return res; -} - -bool SimulationModel::addFEMTriangleConstraint(const unsigned int particle1, const unsigned int particle2, - const unsigned int particle3) -{ - FEMTriangleConstraint *c = new FEMTriangleConstraint(); - const bool res = c->initConstraint(*this, particle1, particle2, particle3); - if (res) - { - m_constraints.push_back(c); - m_groupsInitialized = false; - } - return res; -} - -bool SimulationModel::addStrainTriangleConstraint(const unsigned int particle1, const unsigned int particle2, - const unsigned int particle3) -{ - StrainTriangleConstraint *c = new StrainTriangleConstraint(); - const bool res = c->initConstraint(*this, particle1, particle2, particle3); - if (res) - { - m_constraints.push_back(c); - m_groupsInitialized = false; - } - return res; -} - -bool SimulationModel::addVolumeConstraint(const unsigned int particle1, const unsigned int particle2, - const unsigned int particle3, const unsigned int particle4) -{ - VolumeConstraint *c = new VolumeConstraint(); - const bool res = c->initConstraint(*this, particle1, particle2, particle3, particle4); - if (res) - { - m_constraints.push_back(c); - m_groupsInitialized = false; - } - return res; -} - -bool SimulationModel::addFEMTetConstraint(const unsigned int particle1, const unsigned int particle2, - const unsigned int particle3, const unsigned int particle4) -{ - FEMTetConstraint *c = new FEMTetConstraint(); - const bool res = c->initConstraint(*this, particle1, particle2, particle3, particle4); - if (res) - { - m_constraints.push_back(c); - m_groupsInitialized = false; - } - return res; -} - -bool SimulationModel::addStrainTetConstraint(const unsigned int particle1, const unsigned int particle2, - const unsigned int particle3, const unsigned int particle4) -{ - StrainTetConstraint *c = new StrainTetConstraint(); - const bool res = c->initConstraint(*this, particle1, particle2, particle3, particle4); - if (res) - { - m_constraints.push_back(c); - m_groupsInitialized = false; - } - return res; -} - -bool SimulationModel::addShapeMatchingConstraint(const unsigned int numberOfParticles, const unsigned int particleIndices[], const unsigned int numClusters[]) -{ - ShapeMatchingConstraint *c = new ShapeMatchingConstraint(numberOfParticles); - const bool res = c->initConstraint(*this, particleIndices, numClusters); - if (res) - { - m_constraints.push_back(c); - m_groupsInitialized = false; - } - return res; -} - - -void SimulationModel::addTriangleModel( - const unsigned int nPoints, - const unsigned int nFaces, - Vector3r *points, - unsigned int* indices, - const TriangleModel::ParticleMesh::UVIndices& uvIndices, - const TriangleModel::ParticleMesh::UVs& uvs) -{ - TriangleModel *triModel = new TriangleModel(); - m_triangleModels.push_back(triModel); - - unsigned int startIndex = m_particles.size(); - m_particles.reserve(startIndex + nPoints); - - for (unsigned int i = 0; i < nPoints; i++) - m_particles.addVertex(points[i]); - - triModel->initMesh(nPoints, nFaces, startIndex, indices, uvIndices, uvs); - - // Update normals - triModel->updateMeshNormals(m_particles); -} - -void SimulationModel::addTetModel( - const unsigned int nPoints, - const unsigned int nTets, - Vector3r *points, - unsigned int* indices) -{ - TetModel *tetModel = new TetModel(); - m_tetModels.push_back(tetModel); - - unsigned int startIndex = m_particles.size(); - m_particles.reserve(startIndex + nPoints); - - for (unsigned int i = 0; i < nPoints; i++) - m_particles.addVertex(points[i]); - - tetModel->initMesh(nPoints, nTets, startIndex, indices); -} - - - -void SimulationModel::initConstraintGroups() -{ - if (m_groupsInitialized) - return; - - const unsigned int numConstraints = (unsigned int) m_constraints.size(); - const unsigned int numParticles = (unsigned int) m_particles.size(); - const unsigned int numRigidBodies = (unsigned int) m_rigidBodies.size(); - const unsigned int numBodies = numParticles + numRigidBodies; - m_constraintGroups.clear(); - - // Maps in which group a particle is or 0 if not yet mapped - std::vector mapping; - - for (unsigned int i = 0; i < numConstraints; i++) - { - Constraint *constraint = m_constraints[i]; - - bool addToNewGroup = true; - for (unsigned int j = 0; j < m_constraintGroups.size(); j++) - { - bool addToThisGroup = true; - - for (unsigned int k = 0; k < constraint->m_numberOfBodies; k++) - { - if (mapping[j][constraint->m_bodies[k]] != 0) - { - addToThisGroup = false; - break; - } - } - - if (addToThisGroup) - { - m_constraintGroups[j].push_back(i); - - for (unsigned int k = 0; k < constraint->m_numberOfBodies; k++) - mapping[j][constraint->m_bodies[k]] = 1; - - addToNewGroup = false; - break; - } - } - if (addToNewGroup) - { - mapping.push_back(new unsigned char[numBodies]); - memset(mapping[mapping.size() - 1], 0, sizeof(unsigned char)*numBodies); - m_constraintGroups.resize(m_constraintGroups.size() + 1); - m_constraintGroups[m_constraintGroups.size()-1].push_back(i); - for (unsigned int k = 0; k < constraint->m_numberOfBodies; k++) - mapping[m_constraintGroups.size() - 1][constraint->m_bodies[k]] = 1; - } - } - - for (unsigned int i = 0; i < mapping.size(); i++) - { - delete[] mapping[i]; - } - mapping.clear(); - - m_groupsInitialized = true; -} - -void SimulationModel::resetContacts() -{ - m_rigidBodyContactConstraints.reset(); - m_particleRigidBodyContactConstraints.reset(); -} - diff --git a/Demos/Simulation/SimulationModel.h b/Demos/Simulation/SimulationModel.h deleted file mode 100644 index 571f9a08..00000000 --- a/Demos/Simulation/SimulationModel.h +++ /dev/null @@ -1,165 +0,0 @@ -#ifndef __SIMULATIONMODEL_H__ -#define __SIMULATIONMODEL_H__ - -#include "Demos/Common/Config.h" -#include "Common/Common.h" -#include -#include "Demos/Simulation/RigidBody.h" -#include "Demos/Simulation/ParticleData.h" -#include -#include "TriangleModel.h" -#include "TetModel.h" -#include "Demos/Utils/ObjectArray.h" - -namespace PBD -{ - class Constraint; - - class SimulationModel - { - public: - SimulationModel(); - virtual ~SimulationModel(); - - typedef std::vector ConstraintVector; - typedef ObjectArray RigidBodyContactConstraintVector; - typedef ObjectArray ParticleRigidBodyContactConstraintVector; - typedef std::vector RigidBodyVector; - typedef std::vector TriangleModelVector; - typedef std::vector TetModelVector; - typedef std::vector ConstraintGroup; - typedef std::vector ConstraintGroupVector; - - - protected: - RigidBodyVector m_rigidBodies; - TriangleModelVector m_triangleModels; - TetModelVector m_tetModels; - ParticleData m_particles; - ConstraintVector m_constraints; - RigidBodyContactConstraintVector m_rigidBodyContactConstraints; - ParticleRigidBodyContactConstraintVector m_particleRigidBodyContactConstraints; - ConstraintGroupVector m_constraintGroups; - - Real m_cloth_stiffness; - Real m_cloth_bendingStiffness; - Real m_cloth_xxStiffness; - Real m_cloth_yyStiffness; - Real m_cloth_xyStiffness; - Real m_cloth_xyPoissonRatio; - Real m_cloth_yxPoissonRatio; - bool m_cloth_normalizeStretch; - bool m_cloth_normalizeShear; - - Real m_solid_stiffness; - Real m_solid_poissonRatio; - bool m_solid_normalizeStretch; - bool m_solid_normalizeShear; - - Real m_contactStiffnessRigidBody; - Real m_contactStiffnessParticleRigidBody; - - public: - void reset(); - void cleanup(); - - RigidBodyVector &getRigidBodies(); - ParticleData &getParticles(); - TriangleModelVector &getTriangleModels(); - TetModelVector &getTetModels(); - ConstraintVector &getConstraints(); - RigidBodyContactConstraintVector &getRigidBodyContactConstraints(); - ParticleRigidBodyContactConstraintVector &getParticleRigidBodyContactConstraints(); - ConstraintGroupVector &getConstraintGroups(); - bool m_groupsInitialized; - - void resetContacts(); - - void addTriangleModel( - const unsigned int nPoints, - const unsigned int nFaces, - Vector3r *points, - unsigned int* indices, - const TriangleModel::ParticleMesh::UVIndices& uvIndices, - const TriangleModel::ParticleMesh::UVs& uvs); - - void addTetModel( - const unsigned int nPoints, - const unsigned int nTets, - Vector3r *points, - unsigned int* indices); - - void updateConstraints(); - void initConstraintGroups(); - - bool addBallJoint(const unsigned int rbIndex1, const unsigned int rbIndex2, const Vector3r &pos); - bool addBallOnLineJoint(const unsigned int rbIndex1, const unsigned int rbIndex2, const Vector3r &pos, const Vector3r &dir); - bool addHingeJoint(const unsigned int rbIndex1, const unsigned int rbIndex2, const Vector3r &pos, const Vector3r &axis); - bool addTargetAngleMotorHingeJoint(const unsigned int rbIndex1, const unsigned int rbIndex2, const Vector3r &pos, const Vector3r &axis); - bool addTargetVelocityMotorHingeJoint(const unsigned int rbIndex1, const unsigned int rbIndex2, const Vector3r &pos, const Vector3r &axis); - bool addUniversalJoint(const unsigned int rbIndex1, const unsigned int rbIndex2, const Vector3r &pos, const Vector3r &axis1, const Vector3r &axis2); - bool addSliderJoint(const unsigned int rbIndex1, const unsigned int rbIndex2, const Vector3r &pos, const Vector3r &axis); - bool addTargetPositionMotorSliderJoint(const unsigned int rbIndex1, const unsigned int rbIndex2, const Vector3r &pos, const Vector3r &axis); - bool addTargetVelocityMotorSliderJoint(const unsigned int rbIndex1, const unsigned int rbIndex2, const Vector3r &pos, const Vector3r &axis); - bool addRigidBodyParticleBallJoint(const unsigned int rbIndex, const unsigned int particleIndex); - bool addRigidBodyContactConstraint(const unsigned int rbIndex1, const unsigned int rbIndex2, - const Vector3r &cp1, const Vector3r &cp2, - const Vector3r &normal, const Real dist, - const Real restitutionCoeff, const Real frictionCoeff); - bool addParticleRigidBodyContactConstraint(const unsigned int particleIndex, const unsigned int rbIndex, - const Vector3r &cp1, const Vector3r &cp2, - const Vector3r &normal, const Real dist, - const Real restitutionCoeff, const Real frictionCoeff); - - bool addDistanceConstraint(const unsigned int particle1, const unsigned int particle2); - bool addDihedralConstraint( const unsigned int particle1, const unsigned int particle2, - const unsigned int particle3, const unsigned int particle4); - bool addIsometricBendingConstraint(const unsigned int particle1, const unsigned int particle2, - const unsigned int particle3, const unsigned int particle4); - bool addFEMTriangleConstraint(const unsigned int particle1, const unsigned int particle2, const unsigned int particle3); - bool addStrainTriangleConstraint(const unsigned int particle1, const unsigned int particle2, const unsigned int particle3); - bool addVolumeConstraint(const unsigned int particle1, const unsigned int particle2, - const unsigned int particle3, const unsigned int particle4); - bool addFEMTetConstraint(const unsigned int particle1, const unsigned int particle2, - const unsigned int particle3, const unsigned int particle4); - bool addStrainTetConstraint(const unsigned int particle1, const unsigned int particle2, - const unsigned int particle3, const unsigned int particle4); - bool addShapeMatchingConstraint(const unsigned int numberOfParticles, const unsigned int particleIndices[], const unsigned int numClusters[]); - - - Real getClothStiffness() const { return m_cloth_stiffness; } - void setClothStiffness(Real val) { m_cloth_stiffness = val; } - Real getClothBendingStiffness() const { return m_cloth_bendingStiffness; } - void setClothBendingStiffness(Real val) { m_cloth_bendingStiffness = val; } - Real getClothXXStiffness() const { return m_cloth_xxStiffness; } - void setClothXXStiffness(Real val) { m_cloth_xxStiffness = val; } - Real getClothYYStiffness() const { return m_cloth_yyStiffness; } - void setClothYYStiffness(Real val) { m_cloth_yyStiffness = val; } - Real getClothXYStiffness() const { return m_cloth_xyStiffness; } - void setClothXYStiffness(Real val) { m_cloth_xyStiffness = val; } - bool getClothNormalizeStretch() const { return m_cloth_normalizeStretch; } - void setClothNormalizeStretch(bool val) { m_cloth_normalizeStretch = val; } - bool getClothNormalizeShear() const { return m_cloth_normalizeShear; } - void setClothNormalizeShear(bool val) { m_cloth_normalizeShear = val; } - Real getClothXYPoissonRatio() const { return m_cloth_xyPoissonRatio; } - void setClothXYPoissonRatio(Real val) { m_cloth_xyPoissonRatio = val; } - Real getClothYXPoissonRatio() const { return m_cloth_yxPoissonRatio; } - void setClothYXPoissonRatio(Real val) { m_cloth_yxPoissonRatio = val; } - - Real getSolidStiffness() const { return m_solid_stiffness; } - void setSolidStiffness(Real val) { m_solid_stiffness = val; } - Real getSolidPoissonRatio() { return m_solid_poissonRatio; } - void setSolidPoissonRatio(const Real val) { m_solid_poissonRatio = val; } - bool getSolidNormalizeStretch() const { return m_solid_normalizeStretch; } - void setSolidNormalizeStretch(bool val) { m_solid_normalizeStretch = val; } - bool getSolidNormalizeShear() const { return m_solid_normalizeShear; } - void setSolidNormalizeShear(bool val) { m_solid_normalizeShear = val; } - - Real getContactStiffnessRigidBody() const { return m_contactStiffnessRigidBody; } - void setContactStiffnessRigidBody(Real val) { m_contactStiffnessRigidBody = val; } - Real getContactStiffnessParticleRigidBody() const { return m_contactStiffnessParticleRigidBody; } - void setContactStiffnessParticleRigidBody(Real val) { m_contactStiffnessParticleRigidBody = val; } - }; -} - -#endif \ No newline at end of file diff --git a/Demos/Simulation/TimeStepController.cpp b/Demos/Simulation/TimeStepController.cpp deleted file mode 100644 index 3ecffbfc..00000000 --- a/Demos/Simulation/TimeStepController.cpp +++ /dev/null @@ -1,256 +0,0 @@ -#include "TimeStepController.h" -#include "Demos/Simulation/TimeManager.h" -#include "PositionBasedDynamics/PositionBasedRigidBodyDynamics.h" -#include "PositionBasedDynamics/TimeIntegration.h" -#include -#include "PositionBasedDynamics/PositionBasedDynamics.h" - -using namespace PBD; -using namespace std; - -TimeStepController::TimeStepController() -{ - m_velocityUpdateMethod = 0; - m_maxIter = 5; - m_maxIterVel = 5; - m_collisionDetection = NULL; - m_gravity = Vector3r(0.0, -9.81, 0.0); -} - -TimeStepController::~TimeStepController(void) -{ -} - -unsigned int counter = 0; - -void TimeStepController::step(SimulationModel &model) -{ - TimeManager *tm = TimeManager::getCurrent (); - const Real h = tm->getTimeStepSize(); - - ////////////////////////////////////////////////////////////////////////// - // rigid body model - ////////////////////////////////////////////////////////////////////////// - clearAccelerations(model); - SimulationModel::RigidBodyVector &rb = model.getRigidBodies(); - ParticleData &pd = model.getParticles(); - - const int numBodies = (int)rb.size(); - #pragma omp parallel if(numBodies > MIN_PARALLEL_SIZE) default(shared) - { - #pragma omp for schedule(static) nowait - for (int i = 0; i < numBodies; i++) - { - rb[i]->getLastPosition() = rb[i]->getOldPosition(); - rb[i]->getOldPosition() = rb[i]->getPosition(); - TimeIntegration::semiImplicitEuler(h, rb[i]->getMass(), rb[i]->getPosition(), rb[i]->getVelocity(), rb[i]->getAcceleration()); - rb[i]->getLastRotation() = rb[i]->getOldRotation(); - rb[i]->getOldRotation() = rb[i]->getRotation(); - TimeIntegration::semiImplicitEulerRotation(h, rb[i]->getMass(), rb[i]->getInertiaTensorInverseW(), rb[i]->getRotation(), rb[i]->getAngularVelocity(), rb[i]->getTorque()); - rb[i]->rotationUpdated(); - } - - ////////////////////////////////////////////////////////////////////////// - // particle model - ////////////////////////////////////////////////////////////////////////// - #pragma omp for schedule(static) - for (int i = 0; i < (int) pd.size(); i++) - { - pd.getLastPosition(i) = pd.getOldPosition(i); - pd.getOldPosition(i) = pd.getPosition(i); - TimeIntegration::semiImplicitEuler(h, pd.getMass(i), pd.getPosition(i), pd.getVelocity(i), pd.getAcceleration(i)); - } - } - - positionConstraintProjection(model); - - #pragma omp parallel if(numBodies > MIN_PARALLEL_SIZE) default(shared) - { - // Update velocities - #pragma omp for schedule(static) nowait - for (int i = 0; i < numBodies; i++) - { - if (m_velocityUpdateMethod == 0) - { - TimeIntegration::velocityUpdateFirstOrder(h, rb[i]->getMass(), rb[i]->getPosition(), rb[i]->getOldPosition(), rb[i]->getVelocity()); - TimeIntegration::angularVelocityUpdateFirstOrder(h, rb[i]->getMass(), rb[i]->getRotation(), rb[i]->getOldRotation(), rb[i]->getAngularVelocity()); - } - else - { - TimeIntegration::velocityUpdateSecondOrder(h, rb[i]->getMass(), rb[i]->getPosition(), rb[i]->getOldPosition(), rb[i]->getLastPosition(), rb[i]->getVelocity()); - TimeIntegration::angularVelocityUpdateSecondOrder(h, rb[i]->getMass(), rb[i]->getRotation(), rb[i]->getOldRotation(), rb[i]->getLastRotation(), rb[i]->getAngularVelocity()); - } - // update geometry - rb[i]->getGeometry().updateMeshTransformation(rb[i]->getPosition(), rb[i]->getRotationMatrix()); - } - - // Update velocities - #pragma omp for schedule(static) - for (int i = 0; i < (int) pd.size(); i++) - { - if (m_velocityUpdateMethod == 0) - TimeIntegration::velocityUpdateFirstOrder(h, pd.getMass(i), pd.getPosition(i), pd.getOldPosition(i), pd.getVelocity(i)); - else - TimeIntegration::velocityUpdateSecondOrder(h, pd.getMass(i), pd.getPosition(i), pd.getOldPosition(i), pd.getLastPosition(i), pd.getVelocity(i)); - } - } - - if (m_collisionDetection) - m_collisionDetection->collisionDetection(model); - - velocityConstraintProjection(model); - - // compute new time - tm->setTime (tm->getTime () + h); -} - -void TimeStepController::clearAccelerations(SimulationModel &model) -{ - ////////////////////////////////////////////////////////////////////////// - // rigid body model - ////////////////////////////////////////////////////////////////////////// - - SimulationModel::RigidBodyVector &rb = model.getRigidBodies(); - for (size_t i=0; i < rb.size(); i++) - { - // Clear accelerations of dynamic particles - if (rb[i]->getMass() != 0.0) - { - Vector3r &a = rb[i]->getAcceleration(); - a = m_gravity; - } - } - - ////////////////////////////////////////////////////////////////////////// - // particle model - ////////////////////////////////////////////////////////////////////////// - - ParticleData &pd = model.getParticles(); - const unsigned int count = pd.size(); - for (unsigned int i = 0; i < count; i++) - { - // Clear accelerations of dynamic particles - if (pd.getMass(i) != 0.0) - { - Vector3r &a = pd.getAcceleration(i); - a = m_gravity; - } - } -} - -void TimeStepController::reset() -{ - -} - -void TimeStepController::positionConstraintProjection(SimulationModel &model) -{ - unsigned int iter = 0; - - // init constraint groups if necessary - model.initConstraintGroups(); - - SimulationModel::RigidBodyVector &rb = model.getRigidBodies(); - SimulationModel::ConstraintVector &constraints = model.getConstraints(); - SimulationModel::ConstraintGroupVector &groups = model.getConstraintGroups(); - SimulationModel::RigidBodyContactConstraintVector &contacts = model.getRigidBodyContactConstraints(); - - while (iter < m_maxIter) - { - for (unsigned int group = 0; group < groups.size(); group++) - { - const int groupSize = (int)groups[group].size(); - #pragma omp parallel if(groupSize > MIN_PARALLEL_SIZE) default(shared) - { - #pragma omp for schedule(static) - for (int i = 0; i < groupSize; i++) - { - const unsigned int constraintIndex = groups[group][i]; - - constraints[constraintIndex]->updateConstraint(model); - constraints[constraintIndex]->solvePositionConstraint(model); - } - } - } - - iter++; - } -} - - -void TimeStepController::velocityConstraintProjection(SimulationModel &model) -{ - unsigned int iter = 0; - - // init constraint groups if necessary - model.initConstraintGroups(); - - SimulationModel::RigidBodyVector &rb = model.getRigidBodies(); - SimulationModel::ConstraintVector &constraints = model.getConstraints(); - SimulationModel::ConstraintGroupVector &groups = model.getConstraintGroups(); - SimulationModel::RigidBodyContactConstraintVector &rigidBodyContacts = model.getRigidBodyContactConstraints(); - SimulationModel::ParticleRigidBodyContactConstraintVector &particleRigidBodyContacts = model.getParticleRigidBodyContactConstraints(); - - for (unsigned int group = 0; group < groups.size(); group++) - { - const int groupSize = (int)groups[group].size(); - #pragma omp parallel if(groupSize > MIN_PARALLEL_SIZE) default(shared) - { - #pragma omp for schedule(static) - for (int i = 0; i < groupSize; i++) - { - const unsigned int constraintIndex = groups[group][i]; - constraints[constraintIndex]->updateConstraint(model); - } - } - } - - while (iter < m_maxIterVel) - { - for (unsigned int group = 0; group < groups.size(); group++) - { - const int groupSize = (int)groups[group].size(); - #pragma omp parallel if(groupSize > MIN_PARALLEL_SIZE) default(shared) - { - #pragma omp for schedule(static) - for (int i = 0; i < groupSize; i++) - { - const unsigned int constraintIndex = groups[group][i]; - constraints[constraintIndex]->solveVelocityConstraint(model); - } - } - } - - // solve contacts - for (unsigned int i = 0; i < rigidBodyContacts.size(); i++) - rigidBodyContacts[i].solveVelocityConstraint(model); - for (unsigned int i = 0; i < particleRigidBodyContacts.size(); i++) - particleRigidBodyContacts[i].solveVelocityConstraint(model); - - iter++; - } -} - -void TimeStepController::setCollisionDetection(SimulationModel &model, CollisionDetection *cd) -{ - m_collisionDetection = cd; - m_collisionDetection->setContactCallback(contactCallbackFunction, &model); -} - -CollisionDetection *TimeStepController::getCollisionDetection() -{ - return m_collisionDetection; -} - -void TimeStepController::contactCallbackFunction(const unsigned int contactType, const unsigned int bodyIndex1, const unsigned int bodyIndex2, - const Vector3r &cp1, const Vector3r &cp2, - const Vector3r &normal, const Real dist, - const Real restitutionCoeff, const Real frictionCoeff, void *userData) -{ - SimulationModel *model = (SimulationModel*)userData; - if (contactType == CollisionDetection::RigidBodyContactType) - model->addRigidBodyContactConstraint(bodyIndex1, bodyIndex2, cp1, cp2, normal, dist, restitutionCoeff,frictionCoeff); - else if (contactType == CollisionDetection::ParticleRigidBodyContactType) - model->addParticleRigidBodyContactConstraint(bodyIndex1, bodyIndex2, cp1, cp2, normal, dist, restitutionCoeff, frictionCoeff); -} - diff --git a/Demos/Simulation/TimeStepController.h b/Demos/Simulation/TimeStepController.h deleted file mode 100644 index 4dbca9f6..00000000 --- a/Demos/Simulation/TimeStepController.h +++ /dev/null @@ -1,54 +0,0 @@ -#ifndef __TIMESTEPCONTROLLER_h__ -#define __TIMESTEPCONTROLLER_h__ - -#include "Demos/Common/Config.h" -#include "Common/Common.h" -#include "SimulationModel.h" -#include "CollisionDetection.h" - -namespace PBD -{ - class TimeStepController - { - protected: - CollisionDetection *m_collisionDetection; - unsigned int m_velocityUpdateMethod; - unsigned int m_maxIter; - unsigned int m_maxIterVel; - Vector3r m_gravity; - - /** Clear accelerations and add gravitation. - */ - void clearAccelerations(SimulationModel &model); - void positionConstraintProjection(SimulationModel &model); - void velocityConstraintProjection(SimulationModel &model); - - static void contactCallbackFunction(const unsigned int contactType, - const unsigned int bodyIndex1, const unsigned int bodyIndex2, - const Vector3r &cp1, const Vector3r &cp2, - const Vector3r &normal, const Real dist, - const Real restitutionCoeff, const Real frictionCoeff, void *userData); - - - public: - TimeStepController(); - virtual ~TimeStepController(void); - - void step(SimulationModel &model); - void reset(); - - void setCollisionDetection(SimulationModel &model, CollisionDetection *cd); - CollisionDetection *getCollisionDetection(); - - unsigned int getVelocityUpdateMethod() const { return m_velocityUpdateMethod; } - void setVelocityUpdateMethod(unsigned int val) { m_velocityUpdateMethod = val; } - unsigned int getMaxIterations() const { return m_maxIter; } - void setMaxIterations(unsigned int val) { m_maxIter = val; } - unsigned int getMaxIterationsV() const { return m_maxIterVel; } - void setMaxIterationsV(unsigned int val) { m_maxIterVel = val; } - const Vector3r& getGravity() const { return m_gravity; } - void setGravity(const Vector3r& val) { m_gravity = val; } - }; -} - -#endif diff --git a/Demos/Simulation/kdTree.inl b/Demos/Simulation/kdTree.inl deleted file mode 100644 index e5f56e6f..00000000 --- a/Demos/Simulation/kdTree.inl +++ /dev/null @@ -1,205 +0,0 @@ - -#include "BoundingSphere.h" - -template void -KDTree::construct() -{ - m_nodes.clear(); - m_hulls.clear(); - if (m_lst.empty()) return; - - std::iota(m_lst.begin(), m_lst.end(), 0); - - // Determine bounding box of considered domain. - auto box = AlignedBox3r{}; - for (auto i = 0u; i < m_lst.size(); ++i) - box.extend(entity_position(i)); - - auto ni = add_node(0, static_cast(m_lst.size())); - construct(ni, box, 0, static_cast(m_lst.size())); -} - -template void -KDTree::construct(unsigned int node, AlignedBox3r const& box, unsigned int b, - unsigned int n) -{ - // If only one element is left end recursion. - //if (n == 1) return; - if (n < 10) return; - - // Determine longest side of bounding box. - auto max_dir = 0; - auto d = box.diagonal().eval(); - if (d(1) >= d(0) && d(1) >= d(2)) - max_dir = 1; - else if (d(2) >= d(0) && d(2) >= d(1)) - max_dir = 2; - -#ifdef _DEBUG - for (auto i = 0u; i < n; ++i) - { - if (!box.contains(entity_position(m_lst[b + i]))) - std::cerr << "ERROR: Bounding box wrong!" << std::endl; - } -#endif - - // Sort range according to center of the longest side. - std::sort(m_lst.begin() + b, m_lst.begin() + b + n, - [&](unsigned int a, unsigned int b) - { - return entity_position(a)(max_dir) < entity_position(b)(max_dir); - } - ); - - auto hal = n / 2; - auto n0 = add_node(b , hal ); - auto n1 = add_node(b + hal, n - hal); - m_nodes[node].children[0] = n0; - m_nodes[node].children[1] = n1; - - auto c = 0.5 * ( - entity_position(m_lst[b + hal -1])(max_dir) + - entity_position(m_lst[b + hal ])(max_dir)); - auto l_box = box; l_box.max()(max_dir) = c; - auto r_box = box; r_box.min()(max_dir) = c; - - construct(m_nodes[node].children[0], l_box, b, hal); - construct(m_nodes[node].children[1], r_box, b + hal, n - hal); -} - -template void -KDTree::traverse_depth_first(TraversalPredicate pred, TraversalCallback cb, - TraversalPriorityLess const& pless) const -{ - if (m_nodes.empty()) - return; - - if (pred(0, 0)) - traverse_depth_first(0, 0, pred, cb, pless); -} - -template void -KDTree::traverse_depth_first(unsigned int node_index, - unsigned int depth, TraversalPredicate pred, TraversalCallback cb, - TraversalPriorityLess const& pless) const -{ - Node const& node = m_nodes[node_index]; - - cb(node_index, depth); - auto is_pred = pred(node_index, depth); - if (!node.is_leaf() && is_pred) - { - if (pless && !pless(node.children)) - { - traverse_depth_first(m_nodes[node_index].children[1], depth + 1, pred, cb, pless); - traverse_depth_first(m_nodes[node_index].children[0], depth + 1, pred, cb, pless); - } - else - { - traverse_depth_first(m_nodes[node_index].children[0], depth + 1, pred, cb, pless); - traverse_depth_first(m_nodes[node_index].children[1], depth + 1, pred, cb, pless); - } - } -} - - -template void -KDTree::traverse_breadth_first(TraversalPredicate const& pred, - TraversalCallback const& cb, unsigned int start_node, TraversalPriorityLess const& pless, - TraversalQueue& pending) const -{ - cb(start_node, 0); - if (pred(start_node, 0)) pending.push({ start_node, 0 }); - traverse_breadth_first(pending, pred, cb, pless); -} - - -template void -KDTree::traverse_breadth_first_parallel(TraversalPredicate pred, - TraversalCallback cb) const -{ - auto start_nodes = std::vector{}; - const unsigned int maxThreads = omp_get_max_threads(); - - // compute ceiling of Log2 - Real d = maxThreads - 1; - const unsigned int targetDepth = (*reinterpret_cast(&d) >> 52) - 1022; - - traverse_breadth_first( - [&start_nodes, &maxThreads, &targetDepth](unsigned int node_index, unsigned int depth) - { - return (depth < targetDepth) && (start_nodes.size() < maxThreads); - }, - [&](unsigned int node_index, unsigned int depth) - { - if ((depth == targetDepth) || (node(node_index).is_leaf())) - start_nodes.push_back({ node_index, depth }); - } - ); - - #pragma omp parallel default(shared) - { - #pragma omp for schedule(static) - for (int i = 0; i < start_nodes.size(); i++) - { - QueueItem const& qi = start_nodes[i]; - cb(qi.n, qi.d); - traverse_depth_first(qi.n, qi.d, pred, cb, nullptr); - } - } -} - -template unsigned int -KDTree::add_node(unsigned int b, unsigned int n) -{ - HullType hull; - compute_hull(b, n, hull); - m_hulls.push_back(hull); - m_nodes.push_back({ b, n }); - return static_cast(m_nodes.size() - 1); -} - - - -template -void -KDTree::traverse_breadth_first(TraversalQueue& pending, - TraversalPredicate const& pred, TraversalCallback const& cb, TraversalPriorityLess const& pless) const -{ - while (!pending.empty()) - { - auto n = pending.front().n; - auto d = pending.front().d; - auto const& node = m_nodes[n]; - pending.pop(); - - cb(n, d); - auto is_pred = pred(n, d); - if (!node.is_leaf() && is_pred) - { - if (pless && !pless(node.children)) - { - pending.push({ static_cast(node.children[1]), d + 1 }); - pending.push({ static_cast(node.children[0]), d + 1 }); - } - else - { - pending.push({ static_cast(node.children[0]), d + 1 }); - pending.push({ static_cast(node.children[1]), d + 1 }); - } - } - } -} - -template void -KDTree::update() -{ - traverse_depth_first( - [&](unsigned int, unsigned int) { return true; }, - [&](unsigned int node_index, unsigned int) - { - auto const& nd = node(node_index); - compute_hull_approx(nd.begin, nd.n, m_hulls[node_index]); - } - ); -} \ No newline at end of file diff --git a/Demos/StiffRodsDemos/CMakeLists.txt b/Demos/StiffRodsDemos/CMakeLists.txt new file mode 100644 index 00000000..56c005e0 --- /dev/null +++ b/Demos/StiffRodsDemos/CMakeLists.txt @@ -0,0 +1,94 @@ +set(SIMULATION_LINK_LIBRARIES imgui glfw MD5 PositionBasedDynamics Simulation Utils) +set(SIMULATION_DEPENDENCIES imgui glfw MD5 PositionBasedDynamics Simulation Utils CopyPBDShaders CopyPBDModels CopyPBDScenes CopyImguiFonts) + +if(WIN32) + set(SIMULATION_LINK_LIBRARIES opengl32.lib glu32.lib ${SIMULATION_LINK_LIBRARIES}) + #set(SIMULATION_DEPENDENCIES ${SIMULATION_DEPENDENCIES}) +else() + set(OpenGL_GL_PREFERENCE GLVND) + find_package(OpenGL REQUIRED) + include_directories( ${OPENGL_INCLUDE_DIRS}) + + set(SIMULATION_LINK_LIBRARIES + ${SIMULATION_LINK_LIBRARIES} + ${OPENGL_LIBRARIES} + ) +endif() + +############################################################ +# GenericParameters +############################################################ +include_directories(${GenericParameters_INCLUDE_DIR}) +if(TARGET Ext_GenericParameters) + set(SIMULATION_DEPENDENCIES ${SIMULATION_DEPENDENCIES} Ext_GenericParameters) +endif() + +add_executable(StretchBendingTwistingDemo + StretchBendingTwistingDemo.cpp + + ../Common/LogWindow.cpp + ../Common/LogWindow.h + ../Common/Simulator_GUI_imgui.cpp + ../Common/Simulator_GUI_imgui.h + ../Common/imguiParameters.cpp + ../Common/imguiParameters.h + ../Common/DemoBase.cpp + ../Common/DemoBase.h + + ${VIS_FILES} + ${PROJECT_PATH}/Common/Common.h + + CMakeLists.txt +) + +set_target_properties(StretchBendingTwistingDemo PROPERTIES FOLDER "Demos") +set_target_properties(StretchBendingTwistingDemo PROPERTIES DEBUG_POSTFIX ${CMAKE_DEBUG_POSTFIX}) +set_target_properties(StretchBendingTwistingDemo PROPERTIES RELWITHDEBINFO_POSTFIX ${CMAKE_RELWITHDEBINFO_POSTFIX}) +set_target_properties(StretchBendingTwistingDemo PROPERTIES MINSIZEREL_POSTFIX ${CMAKE_MINSIZEREL_POSTFIX}) +add_dependencies(StretchBendingTwistingDemo ${SIMULATION_DEPENDENCIES}) +target_link_libraries(StretchBendingTwistingDemo ${SIMULATION_LINK_LIBRARIES}) + +############################################################ +# Discregrid +############################################################ +include_directories(${Discregrid_INCLUDE_DIR}) +if (TARGET Ext_Discregrid) + set(SIMULATION_DEPENDENCIES ${SIMULATION_DEPENDENCIES} Ext_Discregrid) +endif() +set(SIMULATION_LINK_LIBRARIES ${SIMULATION_LINK_LIBRARIES} ${Discregrid_LIBRARIES}) + +add_executable(DirectPositionBasedSolverForStiffRodsDemo + DirectPositionBasedSolverForStiffRodsDemo.cpp + + StiffRodsSceneLoader.h + StiffRodsSceneLoader.cpp + + ../Common/LogWindow.cpp + ../Common/LogWindow.h + ../Common/Simulator_GUI_imgui.cpp + ../Common/Simulator_GUI_imgui.h + ../Common/imguiParameters.cpp + ../Common/imguiParameters.h + ../Common/DemoBase.cpp + ../Common/DemoBase.h + + ${VIS_FILES} + ${PROJECT_PATH}/Common/Common.h + + CMakeLists.txt +) + +set_target_properties(DirectPositionBasedSolverForStiffRodsDemo PROPERTIES FOLDER "Demos") +set_target_properties(DirectPositionBasedSolverForStiffRodsDemo PROPERTIES DEBUG_POSTFIX ${CMAKE_DEBUG_POSTFIX}) +set_target_properties(DirectPositionBasedSolverForStiffRodsDemo PROPERTIES RELWITHDEBINFO_POSTFIX ${CMAKE_RELWITHDEBINFO_POSTFIX}) +set_target_properties(DirectPositionBasedSolverForStiffRodsDemo PROPERTIES MINSIZEREL_POSTFIX ${CMAKE_MINSIZEREL_POSTFIX}) +add_dependencies(DirectPositionBasedSolverForStiffRodsDemo ${SIMULATION_DEPENDENCIES}) +target_link_libraries(DirectPositionBasedSolverForStiffRodsDemo ${SIMULATION_LINK_LIBRARIES}) + +find_package( Eigen3 REQUIRED ) +include_directories( ${EIGEN3_INCLUDE_DIR} ) +include_directories(${PROJECT_PATH}/extern/freeglut/include) +include_directories(${PROJECT_PATH}/extern/glew/include) + + +VIS_SOURCE_GROUPS() diff --git a/Demos/StiffRodsDemos/DirectPositionBasedSolverForStiffRodsDemo.cpp b/Demos/StiffRodsDemos/DirectPositionBasedSolverForStiffRodsDemo.cpp new file mode 100644 index 00000000..91163d6e --- /dev/null +++ b/Demos/StiffRodsDemos/DirectPositionBasedSolverForStiffRodsDemo.cpp @@ -0,0 +1,1044 @@ +#include "Common/Common.h" +#include "Simulation/CubicSDFCollisionDetection.h" +#include "Simulation/DistanceFieldCollisionDetection.h" +#include "Simulation/TimeManager.h" +#include "Simulation/SimulationModel.h" +#include "Simulation/TimeStepController.h" +#include "Utils/FileSystem.h" +#include "Utils/Logger.h" +#include "Utils/TetGenLoader.h" +#include "Utils/Timing.h" +#include "Demos/Visualization/MiniGL.h" +#include "Demos/Visualization/Selection.h" +#include "Demos/Visualization/Visualization.h" +#include "Demos/Common/DemoBase.h" +#include "Simulation/Simulation.h" +#include +#include +#include + +#include "StiffRodsSceneLoader.h" + +#define _USE_MATH_DEFINES +#include "math.h" + +// Enable memory leak detection +#if defined(_DEBUG) && !defined(EIGEN_ALIGN) +#define new DEBUG_NEW +#endif + +using namespace PBD; +using namespace Eigen; +using namespace std; +using namespace Utilities; + +void timeStep(); +void buildModel(); +void readScene(); +void render(); +void reset(); + +void singleStep(); + + +DemoBase *base; +CubicSDFCollisionDetection *cd; + +string sceneFileName = "/scenes/Wilberforce_scene.json"; +string sceneName; +Vector3r camPos; +Vector3r camLookat; + + +// main +int main(int argc, char **argv) +{ + REPORT_MEMORY_LEAKS; + + std::string exePath = FileSystem::getProgramPath(); + + if (argc > 1) + sceneFileName = string(argv[1]); + else + sceneFileName = FileSystem::normalizePath(exePath + "/resources" + sceneFileName); + + base = new DemoBase(); + base->init(argc, argv, sceneFileName.c_str()); + base->setSceneLoader(new StiffRodsSceneLoader()); + + SimulationModel *model = new SimulationModel(); + model->init(); + Simulation::getCurrent()->setModel(model); + + cd = new CubicSDFCollisionDetection(); + cd->init(); + + buildModel(); + + base->createParameterGUI(); + + // reset simulation when cloth simulation/bending method has changed + model->setClothSimulationMethodChangedCallback([&]() { reset(); }); + model->setClothBendingMethodChangedCallback([&]() { reset(); }); + model->setSolidSimulationMethodChangedCallback([&]() { reset(); }); + + base->readParameters(); + + // OpenGL + MiniGL::setClientIdleFunc(timeStep); + MiniGL::addKeyFunc('r', reset); + MiniGL::addKeyFunc('s', singleStep); + MiniGL::setClientSceneFunc(render); + MiniGL::setViewport(40.0f, 0.1f, 500.0f, camPos, camLookat); + + base->createParameterGUI(); + + MiniGL::mainLoop(); + + base->cleanup(); + + Utilities::Timing::printAverageTimes(); + Utilities::Timing::printTimeSums(); + + delete Simulation::getCurrent(); + delete base; + delete model; + delete cd; + + return 0; +} + +void reset() +{ + Utilities::Timing::printAverageTimes(); + Utilities::Timing::reset(); + + Simulation::getCurrent()->reset(); + base->getSelectedParticles().clear(); + + Simulation::getCurrent()->getModel()->cleanup(); + Simulation::getCurrent()->getTimeStep()->getCollisionDetection()->cleanup(); + + readScene(); +} + +void singleStep() +{ + // Simulation code + SimulationModel *model = Simulation::getCurrent()->getModel(); + Simulation::getCurrent()->getTimeStep()->step(*model); + + base->step(); + + // Update visualization models + const ParticleData &pd = model->getParticles(); + for (unsigned int i = 0; i < model->getTetModels().size(); i++) + { + model->getTetModels()[i]->updateMeshNormals(pd); + model->getTetModels()[i]->updateVisMesh(pd); + } + for (unsigned int i = 0; i < model->getTriangleModels().size(); i++) + { + model->getTriangleModels()[i]->updateMeshNormals(pd); + } +} + +void timeStep() +{ + const Real pauseAt = base->getValue(DemoBase::PAUSE_AT); + if ((pauseAt > 0.0) && (pauseAt < TimeManager::getCurrent()->getTime())) + base->setValue(DemoBase::PAUSE, true); + + if (base->getValue(DemoBase::PAUSE)) + return; + + // Simulation code + SimulationModel *model = Simulation::getCurrent()->getModel(); + const unsigned int numSteps = base->getValue(DemoBase::NUM_STEPS_PER_RENDER); + for (unsigned int i = 0; i < numSteps; i++) + { + START_TIMING("SimStep"); + Simulation::getCurrent()->getTimeStep()->step(*model); + STOP_TIMING_AVG; + + base->step(); + } + + // Update visualization models + const ParticleData &pd = model->getParticles(); + for (unsigned int i = 0; i < model->getTetModels().size(); i++) + { + model->getTetModels()[i]->updateMeshNormals(pd); + model->getTetModels()[i]->updateVisMesh(pd); + } + for (unsigned int i = 0; i < model->getTriangleModels().size(); i++) + { + model->getTriangleModels()[i]->updateMeshNormals(pd); + } +} + +void render() +{ + base->render(); +} + +void buildModel() +{ + TimeManager::getCurrent()->setTimeStepSize(static_cast(0.005)); + + SimulationModel *model = Simulation::getCurrent()->getModel(); + Simulation::getCurrent()->getTimeStep()->setCollisionDetection(*model, cd); + + readScene(); +} + +void initTriangleModelConstraints() +{ + // init constraints + SimulationModel *model = Simulation::getCurrent()->getModel(); + for (unsigned int cm = 0; cm < model->getTriangleModels().size(); cm++) + { + model->setClothStiffness(1.0); + if (model->getClothSimulationMethod() == 4) + model->setClothStiffness(100000); + model->addClothConstraints(model->getTriangleModels()[cm], model->getClothSimulationMethod(), model->getClothStiffness(), model->getClothStiffnessXX(), + model->getClothStiffnessYY(), model->getClothStiffnessXY(), model->getClothPoissonRatioXY(), model->getClothPoissonRatioYX(), + model->getClothNormalizeStretch(), model->getClothNormalizeShear()); + + model->setClothBendingStiffness(0.01); + if (model->getClothBendingMethod() == 3) + model->setClothBendingStiffness(100.0); + model->addBendingConstraints(model->getTriangleModels()[cm], model->getClothBendingMethod(), model->getClothBendingStiffness()); + } +} + +void initTetModelConstraints() +{ + // init constraints + SimulationModel* model = Simulation::getCurrent()->getModel(); + model->setSolidStiffness(1.0); + if (model->getSolidSimulationMethod() == 3) + model->setSolidStiffness(1000000); + if (model->getSolidSimulationMethod() == 6) + model->setSolidStiffness(100000); + + model->setSolidVolumeStiffness(1.0); + if (model->getSolidSimulationMethod() == 6) + model->setSolidVolumeStiffness(100000); + for (unsigned int cm = 0; cm < model->getTetModels().size(); cm++) + { + model->addSolidConstraints(model->getTetModels()[cm], model->getSolidSimulationMethod(), model->getSolidStiffness(), + model->getSolidPoissonRatio(), model->getSolidVolumeStiffness(), model->getSolidNormalizeStretch(), model->getSolidNormalizeShear()); + } +} + +CubicSDFCollisionDetection::GridPtr generateSDF(const std::string &modelFile, const std::string &collisionObjectFileName, const Eigen::Matrix &resolutionSDF, + VertexData &vd, IndexedFaceMesh &mesh) +{ + const std::string basePath = FileSystem::getFilePath(base->getSceneFile()); + const string cachePath = basePath + "/Cache"; + const std::string modelFileName = FileSystem::getFileNameWithExt(modelFile); + CubicSDFCollisionDetection::GridPtr distanceField; + + if (collisionObjectFileName == "") + { + std::string md5FileName = FileSystem::normalizePath(cachePath + "/" + modelFileName + ".md5"); + string md5Str = FileSystem::getFileMD5(modelFile); + bool md5 = false; + if (FileSystem::fileExists(md5FileName)) + md5 = FileSystem::checkMD5(md5Str, md5FileName); + + // check MD5 if cache file is available + const string resStr = to_string(resolutionSDF[0]) + "_" + to_string(resolutionSDF[1]) + "_" + to_string(resolutionSDF[2]); + const string sdfFileName = FileSystem::normalizePath(cachePath + "/" + modelFileName + "_" + resStr + ".csdf"); + bool foundCacheFile = FileSystem::fileExists(sdfFileName); + + if (foundCacheFile && md5) + { + LOG_INFO << "Load cached SDF: " << sdfFileName; + distanceField = std::make_shared(sdfFileName); + } + else + { + std::vector &faces = mesh.getFaces(); + const unsigned int nFaces = mesh.numFaces(); +#ifdef USE_DOUBLE + Discregrid::TriangleMesh sdfMesh(&vd.getPosition(0)[0], faces.data(), vd.size(), nFaces); +#else + // if type is float, copy vector to double vector + std::vector doubleVec; + doubleVec.resize(3 * vd.size()); + for (unsigned int i = 0; i < vd.size(); i++) + for (unsigned int j = 0; j < 3; j++) + doubleVec[3 * i + j] = vd.getPosition(i)[j]; + Discregrid::TriangleMesh sdfMesh(&doubleVec[0], faces.data(), vd.size(), nFaces); +#endif + Discregrid::TriangleMeshDistance md(sdfMesh); + Eigen::AlignedBox3d domain; + for (auto const& x : sdfMesh.vertices()) + { + domain.extend(x); + } + domain.max() += 0.1 * Eigen::Vector3d::Ones(); + domain.min() -= 0.1 * Eigen::Vector3d::Ones(); + + LOG_INFO << "Set SDF resolution: " << resolutionSDF[0] << ", " << resolutionSDF[1] << ", " << resolutionSDF[2]; + distanceField = std::make_shared(domain, std::array({ resolutionSDF[0], resolutionSDF[1], resolutionSDF[2] })); + auto func = Discregrid::DiscreteGrid::ContinuousFunction{}; + func = [&md](Eigen::Vector3d const& xi) {return md.signed_distance(xi).distance; }; + LOG_INFO << "Generate SDF for " << modelFile; + distanceField->addFunction(func, true); + if (FileSystem::makeDir(cachePath) == 0) + { + LOG_INFO << "Save SDF: " << sdfFileName; + distanceField->save(sdfFileName); + FileSystem::writeMD5File(modelFile, md5FileName); + } + } + } + else + { + std::string fileName = collisionObjectFileName; + if (FileSystem::isRelativePath(fileName)) + { + fileName = FileSystem::normalizePath(basePath + "/" + fileName); + } + LOG_INFO << "Load SDF: " << fileName; + distanceField = std::make_shared(fileName); + } + return distanceField; +} + + +/** Create the rigid body model +*/ +void readScene() +{ + SimulationModel *model = Simulation::getCurrent()->getModel(); + SimulationModel::RigidBodyVector &rb = model->getRigidBodies(); + SimulationModel::TriangleModelVector &triModels = model->getTriangleModels(); + SimulationModel::TetModelVector &tetModels = model->getTetModels(); + SimulationModel::ConstraintVector &constraints = model->getConstraints(); + + StiffRodsSceneLoader::RodSceneData data; + StiffRodsSceneLoader *loader = static_cast(base->getSceneLoader()); + loader->readStiffRodsScene(sceneFileName, data); + LOG_INFO << "Scene: " << sceneFileName; + + camPos = data.m_camPosition; + camLookat = data.m_camLookat; + + TimeManager::getCurrent()->setTimeStepSize(data.m_timeStepSize); + + sceneName = data.m_sceneName; + + ////////////////////////////////////////////////////////////////////////// + // rigid bodies + ////////////////////////////////////////////////////////////////////////// + + // map file names to loaded geometry to prevent multiple imports of same files + std::map> objFiles; + std::map distanceFields; + for (unsigned int rbIndex = 0; rbIndex < data.m_rigidBodyData.size(); rbIndex++) + { + SceneLoader::RigidBodyData &rbd = data.m_rigidBodyData[rbIndex]; + + // Check if already loaded + rbd.m_modelFile = FileSystem::normalizePath(rbd.m_modelFile); + if (objFiles.find(rbd.m_modelFile) == objFiles.end()) + { + IndexedFaceMesh mesh; + VertexData vd; + DemoBase::loadMesh(rbd.m_modelFile, vd, mesh, Vector3r::Zero(), Matrix3r::Identity(), Vector3r::Ones()); + objFiles[rbd.m_modelFile] = { vd, mesh }; + } + + const std::string basePath = FileSystem::getFilePath(sceneFileName); + const string cachePath = basePath + "/Cache"; + const string resStr = to_string(rbd.m_resolutionSDF[0]) + "_" + to_string(rbd.m_resolutionSDF[1]) + "_" + to_string(rbd.m_resolutionSDF[2]); + const std::string modelFileName = FileSystem::getFileNameWithExt(rbd.m_modelFile); + const string sdfFileName = FileSystem::normalizePath(cachePath + "/" + modelFileName + "_" + resStr + ".csdf"); + + std::string sdfKey = rbd.m_collisionObjectFileName; + if (sdfKey == "") + { + sdfKey = sdfFileName; + } + if (distanceFields.find(sdfKey) == distanceFields.end()) + { + // Generate SDF + if (rbd.m_collisionObjectType == SceneLoader::SDF) + { + if (rbd.m_collisionObjectFileName == "") + { + std::string md5FileName = FileSystem::normalizePath(cachePath + "/" + modelFileName + ".md5"); + string md5Str = FileSystem::getFileMD5(rbd.m_modelFile); + bool md5 = false; + if (FileSystem::fileExists(md5FileName)) + md5 = FileSystem::checkMD5(md5Str, md5FileName); + + // check MD5 if cache file is available + const string resStr = to_string(rbd.m_resolutionSDF[0]) + "_" + to_string(rbd.m_resolutionSDF[1]) + "_" + to_string(rbd.m_resolutionSDF[2]); + const string sdfFileName = FileSystem::normalizePath(cachePath + "/" + modelFileName + "_" + resStr + ".csdf"); + bool foundCacheFile = FileSystem::fileExists(sdfFileName); + + if (foundCacheFile && md5) + { + LOG_INFO << "Load cached SDF: " << sdfFileName; + distanceFields[sdfFileName] = std::make_shared(sdfFileName); + } + else + { + VertexData &vd = objFiles[rbd.m_modelFile].first; + IndexedFaceMesh &mesh = objFiles[rbd.m_modelFile].second; + + std::vector &faces = mesh.getFaces(); + const unsigned int nFaces = mesh.numFaces(); + +#ifdef USE_DOUBLE + Discregrid::TriangleMesh sdfMesh(&vd.getPosition(0)[0], faces.data(), vd.size(), nFaces); +#else + // if type is float, copy vector to double vector + std::vector doubleVec; + doubleVec.resize(3 * vd.size()); + for (unsigned int i = 0; i < vd.size(); i++) + for (unsigned int j = 0; j < 3; j++) + doubleVec[3 * i + j] = vd.getPosition(i)[j]; + Discregrid::TriangleMesh sdfMesh(&doubleVec[0], faces.data(), vd.size(), nFaces); +#endif + Discregrid::TriangleMeshDistance md(sdfMesh); + Eigen::AlignedBox3d domain; + for (auto const& x : sdfMesh.vertices()) + { + domain.extend(x); + } + domain.max() += 0.1 * Eigen::Vector3d::Ones(); + domain.min() -= 0.1 * Eigen::Vector3d::Ones(); + + LOG_INFO << "Set SDF resolution: " << rbd.m_resolutionSDF[0] << ", " << rbd.m_resolutionSDF[1] << ", " << rbd.m_resolutionSDF[2]; + distanceFields[sdfFileName] = std::make_shared(domain, std::array({ rbd.m_resolutionSDF[0], rbd.m_resolutionSDF[1], rbd.m_resolutionSDF[2] })); + auto func = Discregrid::DiscreteGrid::ContinuousFunction{}; + func = [&md](Eigen::Vector3d const& xi) {return md.signed_distance(xi).distance; }; + LOG_INFO << "Generate SDF for " << rbd.m_modelFile; + distanceFields[sdfFileName]->addFunction(func, true); + if (FileSystem::makeDir(cachePath) == 0) + { + LOG_INFO << "Save SDF: " << sdfFileName; + distanceFields[sdfFileName]->save(sdfFileName); + FileSystem::writeMD5File(rbd.m_modelFile, md5FileName); + } + } + } + else + { + std::string fileName = rbd.m_collisionObjectFileName; + if (FileSystem::isRelativePath(fileName)) + { + fileName = FileSystem::normalizePath(basePath + "/" + fileName); + } + LOG_INFO << "Load SDF: " << fileName; + distanceFields[rbd.m_collisionObjectFileName] = std::make_shared(fileName); + } + } + } + } + + for (unsigned int rbIndex = 0; rbIndex < data.m_tetModelData.size(); rbIndex++) + { + const SceneLoader::TetModelData &tmd = data.m_tetModelData[rbIndex]; + + // Check if already loaded + if ((tmd.m_modelFileVis != "") && + (objFiles.find(tmd.m_modelFileVis) == objFiles.end())) + { + IndexedFaceMesh mesh; + VertexData vd; + DemoBase::loadMesh(FileSystem::normalizePath(tmd.m_modelFileVis), vd, mesh, Vector3r::Zero(), Matrix3r::Identity(), Vector3r::Ones()); + objFiles[tmd.m_modelFileVis] = { vd, mesh }; + } + } + + // Stiff rods: gather rigid body id of bodies belonging to a tree + std::set treeSegments; + for (auto &tree : data.m_TreeModels) + { + treeSegments.insert(tree.m_SegmentIds.begin(), tree.m_SegmentIds.end()); + } + // end stiff rods + + for (unsigned int i = 0; i < data.m_tetModelData.size(); i++) + { + const SceneLoader::TetModelData &tmd = data.m_tetModelData[i]; + + // Check if already loaded + if ((tmd.m_modelFileVis != "") && + (objFiles.find(tmd.m_modelFileVis) == objFiles.end())) + { + IndexedFaceMesh mesh; + VertexData vd; + DemoBase::loadMesh(FileSystem::normalizePath(tmd.m_modelFileVis), vd, mesh, Vector3r::Zero(), Matrix3r::Identity(), Vector3r::Ones()); + objFiles[tmd.m_modelFileVis] = { vd, mesh }; + } + + const std::string basePath = FileSystem::getFilePath(base->getSceneFile()); + const string cachePath = basePath + "/Cache"; + const string resStr = to_string(tmd.m_resolutionSDF[0]) + "_" + to_string(tmd.m_resolutionSDF[1]) + "_" + to_string(tmd.m_resolutionSDF[2]); + const std::string modelFileName = FileSystem::getFileNameWithExt(tmd.m_modelFileVis); + const string sdfFileName = FileSystem::normalizePath(cachePath + "/" + modelFileName + "_" + resStr + ".csdf"); + + std::string sdfKey = tmd.m_collisionObjectFileName; + if (sdfKey == "") + { + sdfKey = sdfFileName; + } + if (distanceFields.find(sdfKey) == distanceFields.end()) + { + // Generate SDF + if (tmd.m_collisionObjectType == SceneLoader::SDF) + { + VertexData &vd = objFiles[tmd.m_modelFileVis].first; + IndexedFaceMesh &mesh = objFiles[tmd.m_modelFileVis].second; + + CubicSDFCollisionDetection::GridPtr distanceField = generateSDF(tmd.m_modelFileVis, tmd.m_collisionObjectFileName, tmd.m_resolutionSDF, vd, mesh); + + if (tmd.m_collisionObjectFileName == "") + distanceFields[sdfFileName] = distanceField; + else + distanceFields[tmd.m_collisionObjectFileName] = distanceField; + } + } + } + + rb.resize(data.m_rigidBodyData.size()); + std::map id_index; + unsigned int rbIndex = 0; + for (unsigned int idx(0); idx < data.m_rigidBodyData.size(); ++idx) + { + const SceneLoader::RigidBodyData &rbd = data.m_rigidBodyData[idx]; + + // Stiff rods: do not handle segments of rods here + if (treeSegments.find(rbd.m_id) != treeSegments.end()) + continue; + // end stiff rods + + if (objFiles.find(rbd.m_modelFile) == objFiles.end()) + continue; + + id_index[rbd.m_id] = rbIndex; + + VertexData &vd = objFiles[rbd.m_modelFile].first; + IndexedFaceMesh &mesh = objFiles[rbd.m_modelFile].second; + mesh.setFlatShading(rbd.m_flatShading); + + rb[rbIndex] = new RigidBody(); + rb[rbIndex]->initBody(rbd.m_density, + rbd.m_x, + rbd.m_q, + vd, mesh, + rbd.m_scale); + + if (!rbd.m_isDynamic) + rb[rbIndex]->setMass(0.0); + else + { + rb[rbIndex]->setVelocity(rbd.m_v); + rb[rbIndex]->setAngularVelocity(rbd.m_omega); + } + rb[rbIndex]->setRestitutionCoeff(rbd.m_restitutionCoeff); + rb[rbIndex]->setFrictionCoeff(rbd.m_frictionCoeff); + + const std::vector &vertices = rb[rbIndex]->getGeometry().getVertexDataLocal().getVertices(); + const unsigned int nVert = static_cast(vertices.size()); + + switch (rbd.m_collisionObjectType) + { + case SceneLoader::No_Collision_Object: break; + case SceneLoader::Sphere: + cd->addCollisionSphere(rbIndex, CollisionDetection::CollisionObject::RigidBodyCollisionObjectType, vertices.data(), nVert, rbd.m_collisionObjectScale[0], rbd.m_testMesh, rbd.m_invertSDF); + break; + case SceneLoader::Box: + cd->addCollisionBox(rbIndex, CollisionDetection::CollisionObject::RigidBodyCollisionObjectType, vertices.data(), nVert, rbd.m_collisionObjectScale, rbd.m_testMesh, rbd.m_invertSDF); + break; + case SceneLoader::Cylinder: + cd->addCollisionCylinder(rbIndex, CollisionDetection::CollisionObject::RigidBodyCollisionObjectType, vertices.data(), nVert, rbd.m_collisionObjectScale.head<2>(), rbd.m_testMesh, rbd.m_invertSDF); + break; + case SceneLoader::Torus: + cd->addCollisionTorus(rbIndex, CollisionDetection::CollisionObject::RigidBodyCollisionObjectType, vertices.data(), nVert, rbd.m_collisionObjectScale.head<2>(), rbd.m_testMesh, rbd.m_invertSDF); + break; + case SceneLoader::HollowSphere: + cd->addCollisionHollowSphere(rbIndex, PBD::CollisionDetection::CollisionObject::RigidBodyCollisionObjectType, vertices.data(), nVert, rbd.m_collisionObjectScale[0], rbd.m_thicknessSDF, rbd.m_testMesh, rbd.m_invertSDF); + break; + case SceneLoader::HollowBox: + cd->addCollisionHollowBox(rbIndex, CollisionDetection::CollisionObject::RigidBodyCollisionObjectType, vertices.data(), nVert, rbd.m_collisionObjectScale, rbd.m_thicknessSDF, rbd.m_testMesh, rbd.m_invertSDF); + break; + case SceneLoader::SDF: + { + if (rbd.m_collisionObjectFileName == "") + { + const std::string basePath = FileSystem::getFilePath(sceneFileName); + const string cachePath = basePath + "/Cache"; + const string resStr = to_string(rbd.m_resolutionSDF[0]) + "_" + to_string(rbd.m_resolutionSDF[1]) + "_" + to_string(rbd.m_resolutionSDF[2]); + const std::string modelFileName = FileSystem::getFileNameWithExt(rbd.m_modelFile); + const string sdfFileName = FileSystem::normalizePath(cachePath + "/" + modelFileName + "_" + resStr + ".csdf"); + cd->addCubicSDFCollisionObject(rbIndex, CollisionDetection::CollisionObject::RigidBodyCollisionObjectType, vertices.data(), nVert, distanceFields[sdfFileName], rbd.m_collisionObjectScale, rbd.m_testMesh, rbd.m_invertSDF); + } + else + cd->addCubicSDFCollisionObject(rbIndex, CollisionDetection::CollisionObject::RigidBodyCollisionObjectType, vertices.data(), nVert, distanceFields[rbd.m_collisionObjectFileName], rbd.m_collisionObjectScale, rbd.m_testMesh, rbd.m_invertSDF); + break; + } + } + // stiff rods + ++rbIndex; + // end stiff rods + } + + ////////////////////////////////////////////////////////////////////////// + // stiff rod models + ////////////////////////////////////////////////////////////////////////// + + if (data.m_TreeModels.size()) + LOG_INFO << "Loading " << data.m_TreeModels.size() << " stiff rods" ; + + std::map index_id; + + std::map cIDTocData; + for (auto &constraint : data.m_StretchBendingTwistingConstraints) + { + cIDTocData[constraint.m_Id] = &constraint; + } + + unsigned int lengthIdx(1), widthIdx(0), heightIdx(2); // y-axis is used as the length axis to be compatible to Blender's armatures (Blender 2.78) + std::map segmentScale; + std::map segmentDensity; + + for (auto &treeModel : data.m_TreeModels) + { + START_TIMING("Load tree"); + + std::vector treeSegments; + treeSegments.reserve(treeModel.m_SegmentIds.size()); + + const Vector3r &modelPosition(treeModel.m_X); + const Quaternionr &modelRotationQuat(treeModel.m_Q); + Matrix3r modelRotationMat(modelRotationQuat.toRotationMatrix()); + + std::cout << "Loading " << treeModel.m_SegmentIds.size() << " stiff rod segments" << std::endl; + for (size_t idx(0); idx < data.m_rigidBodyData.size(); ++idx) + { + auto &segmentData(data.m_rigidBodyData[static_cast(idx)]); + if (treeModel.m_SegmentIds.find(segmentData.m_id) == treeModel.m_SegmentIds.end()) + continue; + + if (objFiles.find(segmentData.m_modelFile) == objFiles.end()) + continue; + + // continue if segment has already been created because it is also a member of another tree + if (id_index.find(segmentData.m_id) != id_index.end()) + continue; + + VertexData &vd = objFiles[segmentData.m_modelFile].first; + IndexedFaceMesh &mesh = objFiles[segmentData.m_modelFile].second; + mesh.setFlatShading(segmentData.m_flatShading); + + //compute mass and inertia of a cylinder + Vector3r & scale(segmentData.m_scale); + Real length(scale[lengthIdx]), width(scale[widthIdx]), height(scale[heightIdx]); + Real density(segmentData.m_density); + segmentDensity[segmentData.m_id] = density; + + Real mass(static_cast(M_PI_4) * width * height * length * density); + + const Real Iy = static_cast(1. / 12.) * mass*(static_cast(3.)*(static_cast(0.25)*height*height) + length*length); + const Real Iz = static_cast(1. / 12.) * mass*(static_cast(3.)*(static_cast(0.25)*width*width) + length*length); + const Real Ix = static_cast(0.25) * mass*(static_cast(0.25)*(height*height + width*width)); + + Vector3r inertiaTensor; + inertiaTensor(lengthIdx) = Ix; + inertiaTensor(widthIdx) = Iy; + inertiaTensor(heightIdx) = Iz; + + rb[rbIndex] = new RigidBody(); + rb[rbIndex]->initBody(mass, + modelPosition + modelRotationMat * segmentData.m_x, + inertiaTensor, + modelRotationQuat * segmentData.m_q, + vd, mesh, scale); + + if (!segmentData.m_isDynamic) + rb[rbIndex]->setMass(0.0); + else + { + rb[rbIndex]->setVelocity(segmentData.m_v); + rb[rbIndex]->setAngularVelocity(segmentData.m_omega); + } + rb[rbIndex]->setRestitutionCoeff(segmentData.m_restitutionCoeff); + rb[rbIndex]->setFrictionCoeff(segmentData.m_frictionCoeff); + + segmentScale[segmentData.m_id] = scale; + + id_index[segmentData.m_id] = rbIndex; + index_id[rbIndex] = segmentData.m_id; + treeSegments.push_back(rb[rbIndex]); + + ++rbIndex; + } + + // Make roots static; + for (auto id : treeModel.m_StaticSegments) + { + std::map::iterator it(id_index.find(id)); + if (it != id_index.end()) + { + rb[it->second]->setMass(0.); + } + } + + + // create zero-stretch, bending and twisting constraints + + std::vector> constraintSegmentIndices; + std::vector constraintPositions; + std::vector averageRadii; + std::vector averageSegmentLengths; + std::vector youngsModuli(treeModel.m_StretchBendingTwistingConstraintIds.size(), treeModel.m_YoungsModulus); + std::vector torsionModuli(treeModel.m_StretchBendingTwistingConstraintIds.size(), treeModel.m_TorsionModulus); + + constraintSegmentIndices.reserve(treeModel.m_StretchBendingTwistingConstraintIds.size()); + constraintPositions.reserve(treeModel.m_StretchBendingTwistingConstraintIds.size()); + averageRadii.reserve(treeModel.m_StretchBendingTwistingConstraintIds.size()); + averageSegmentLengths.reserve(treeModel.m_StretchBendingTwistingConstraintIds.size()); + + for (unsigned int cID : treeModel.m_StretchBendingTwistingConstraintIds) + { + if (cIDTocData.find(cID) == cIDTocData.end()) + continue; + + auto &sbtConstraint = *cIDTocData[cID]; + + std::map::iterator itFirstIdx(id_index.find(sbtConstraint.m_SegmentID[0])), + itSecondIdx(id_index.find(sbtConstraint.m_SegmentID[1])); + + if (itFirstIdx == id_index.end() || itSecondIdx == id_index.end()) + continue; + + constraintSegmentIndices.push_back(std::pair(itFirstIdx->second, itSecondIdx->second)); + + const Vector3r &localPosition(sbtConstraint.m_Position); + Vector3r x(modelPosition + modelRotationMat * localPosition); + constraintPositions.push_back(x); + + // compute average length + Real avgLength(static_cast(0.5)*(segmentScale[sbtConstraint.m_SegmentID[0]][lengthIdx] + segmentScale[sbtConstraint.m_SegmentID[1]][lengthIdx])); + averageSegmentLengths.push_back(avgLength); + + // compute average radius + averageRadii.push_back(static_cast(0.125)*(segmentScale[sbtConstraint.m_SegmentID[0]][widthIdx] + + segmentScale[sbtConstraint.m_SegmentID[0]][heightIdx] + + segmentScale[sbtConstraint.m_SegmentID[1]][widthIdx] + segmentScale[sbtConstraint.m_SegmentID[1]][heightIdx])); + } + + model->addDirectPositionBasedSolverForStiffRodsConstraint(constraintSegmentIndices, + constraintPositions, averageRadii, averageSegmentLengths, youngsModuli, torsionModuli); + + STOP_TIMING_PRINT;// load tree + } + + + ////////////////////////////////////////////////////////////////////////// + // triangle models + ////////////////////////////////////////////////////////////////////////// + + // map file names to loaded geometry to prevent multiple imports of same files + std::map> triFiles; + for (unsigned int i = 0; i < data.m_triangleModelData.size(); i++) + { + const SceneLoader::TriangleModelData &tmd = data.m_triangleModelData[i]; + + // Check if already loaded + if (triFiles.find(tmd.m_modelFile) == triFiles.end()) + { + IndexedFaceMesh mesh; + VertexData vd; + DemoBase::loadMesh(FileSystem::normalizePath(tmd.m_modelFile), vd, mesh, Vector3r::Zero(), Matrix3r::Identity(), Vector3r::Ones()); + triFiles[tmd.m_modelFile] = { vd, mesh }; + } + } + + triModels.reserve(data.m_triangleModelData.size()); + std::map tm_id_index; + for (unsigned int i = 0; i < data.m_triangleModelData.size(); i++) + { + const SceneLoader::TriangleModelData &tmd = data.m_triangleModelData[i]; + + if (triFiles.find(tmd.m_modelFile) == triFiles.end()) + continue; + + tm_id_index[tmd.m_id] = i; + + VertexData vd = triFiles[tmd.m_modelFile].first; + IndexedFaceMesh &mesh = triFiles[tmd.m_modelFile].second; + + const Matrix3r R = tmd.m_q.matrix(); + for (unsigned int j = 0; j < vd.size(); j++) + { + vd.getPosition(j) = R * (vd.getPosition(j).cwiseProduct(tmd.m_scale)) + tmd.m_x; + } + + model->addTriangleModel(vd.size(), mesh.numFaces(), &vd.getPosition(0), mesh.getFaces().data(), mesh.getUVIndices(), mesh.getUVs()); + + TriangleModel *tm = triModels[triModels.size() - 1]; + ParticleData &pd = model->getParticles(); + unsigned int offset = tm->getIndexOffset(); + + for (unsigned int j = 0; j < tmd.m_staticParticles.size(); j++) + { + const unsigned int index = tmd.m_staticParticles[j] + offset; + pd.setMass(index, 0.0); + } + + tm->setRestitutionCoeff(tmd.m_restitutionCoeff); + tm->setFrictionCoeff(tmd.m_frictionCoeff); + } + + initTriangleModelConstraints(); + + ////////////////////////////////////////////////////////////////////////// + // tet models + ////////////////////////////////////////////////////////////////////////// + + // map file names to loaded geometry to prevent multiple imports of same files + std::map, pair, vector>> tetFiles; + for (unsigned int i = 0; i < data.m_tetModelData.size(); i++) + { + const SceneLoader::TetModelData &tmd = data.m_tetModelData[i]; + + // Check if already loaded + pair fileNames = { tmd.m_modelFileNodes, tmd.m_modelFileElements }; + if (tetFiles.find(fileNames) == tetFiles.end()) + { + vector vertices; + vector tets; + TetGenLoader::loadTetgenModel(FileSystem::normalizePath(tmd.m_modelFileNodes), FileSystem::normalizePath(tmd.m_modelFileElements), vertices, tets); + tetFiles[fileNames] = { vertices, tets }; + } + } + + tetModels.reserve(data.m_tetModelData.size()); + std::map tm_id_index2; + for (unsigned int i = 0; i < data.m_tetModelData.size(); i++) + { + const SceneLoader::TetModelData &tmd = data.m_tetModelData[i]; + + pair fileNames = { tmd.m_modelFileNodes, tmd.m_modelFileElements }; + auto geo = tetFiles.find(fileNames); + if (geo == tetFiles.end()) + continue; + + tm_id_index2[tmd.m_id] = i; + + vector vertices = geo->second.first; + vector &tets = geo->second.second; + + const Matrix3r R = tmd.m_q.matrix(); + for (unsigned int j = 0; j < vertices.size(); j++) + { + vertices[j] = R * (vertices[j].cwiseProduct(tmd.m_scale)) + tmd.m_x; + } + + model->addTetModel((unsigned int)vertices.size(), (unsigned int)tets.size() / 4, vertices.data(), tets.data()); + + TetModel *tm = tetModels[tetModels.size() - 1]; + ParticleData &pd = model->getParticles(); + unsigned int offset = tm->getIndexOffset(); + + tm->setInitialX(tmd.m_x); + tm->setInitialR(R); + tm->setInitialScale(tmd.m_scale); + + for (unsigned int j = 0; j < tmd.m_staticParticles.size(); j++) + { + const unsigned int index = tmd.m_staticParticles[j] + offset; + pd.setMass(index, 0.0); + } + + // read visualization mesh + if (tmd.m_modelFileVis != "") + { + if (objFiles.find(tmd.m_modelFileVis) != objFiles.end()) + { + IndexedFaceMesh &visMesh = tm->getVisMesh(); + VertexData &vdVis = tm->getVisVertices(); + vdVis = objFiles[tmd.m_modelFileVis].first; + visMesh = objFiles[tmd.m_modelFileVis].second; + + for (unsigned int j = 0; j < vdVis.size(); j++) + vdVis.getPosition(j) = R * (vdVis.getPosition(j).cwiseProduct(tmd.m_scale)) + tmd.m_x; + + tm->updateMeshNormals(pd); + tm->attachVisMesh(pd); + tm->updateVisMesh(pd); + } + } + + tm->setRestitutionCoeff(tmd.m_restitutionCoeff); + tm->setFrictionCoeff(tmd.m_frictionCoeff); + + tm->updateMeshNormals(pd); + } + + initTetModelConstraints(); + + // init collision objects for deformable models + ParticleData &pd = model->getParticles(); + for (unsigned int i = 0; i < data.m_triangleModelData.size(); i++) + { + TriangleModel *tm = triModels[i]; + unsigned int offset = tm->getIndexOffset(); + const unsigned int nVert = tm->getParticleMesh().numVertices(); + cd->addCollisionObjectWithoutGeometry(i, CollisionDetection::CollisionObject::TriangleModelCollisionObjectType, &pd.getPosition(offset), nVert, true); + + } + for (unsigned int i = 0; i < data.m_tetModelData.size(); i++) + { + TetModel *tm = tetModels[i]; + unsigned int offset = tm->getIndexOffset(); + const unsigned int nVert = tm->getParticleMesh().numVertices(); + const IndexedTetMesh &tetMesh = tm->getParticleMesh(); + + const SceneLoader::TetModelData &tmd = data.m_tetModelData[i]; + + switch (tmd.m_collisionObjectType) + { + case SceneLoader::No_Collision_Object: + cd->addCollisionObjectWithoutGeometry(i, CollisionDetection::CollisionObject::TetModelCollisionObjectType, &pd.getPosition(offset), nVert, true); + break; + case SceneLoader::Sphere: + cd->addCollisionSphere(i, CollisionDetection::CollisionObject::TetModelCollisionObjectType, &pd.getPosition(offset), nVert, tmd.m_collisionObjectScale[0], tmd.m_testMesh, tmd.m_invertSDF); + break; + case SceneLoader::Box: + cd->addCollisionBox(i, CollisionDetection::CollisionObject::TetModelCollisionObjectType, &pd.getPosition(offset), nVert, tmd.m_collisionObjectScale, tmd.m_testMesh, tmd.m_invertSDF); + break; + case SceneLoader::Cylinder: + cd->addCollisionCylinder(i, CollisionDetection::CollisionObject::TetModelCollisionObjectType, &pd.getPosition(offset), nVert, tmd.m_collisionObjectScale.head<2>(), tmd.m_testMesh, tmd.m_invertSDF); + break; + case SceneLoader::Torus: + cd->addCollisionTorus(i, CollisionDetection::CollisionObject::TetModelCollisionObjectType, &pd.getPosition(offset), nVert, tmd.m_collisionObjectScale.head<2>(), tmd.m_testMesh, tmd.m_invertSDF); + break; + case SceneLoader::HollowSphere: + cd->addCollisionHollowSphere(i, PBD::CollisionDetection::CollisionObject::TetModelCollisionObjectType, &pd.getPosition(offset), nVert, tmd.m_collisionObjectScale[0], tmd.m_thicknessSDF, tmd.m_testMesh, tmd.m_invertSDF); + break; + case SceneLoader::HollowBox: + cd->addCollisionHollowBox(i, CollisionDetection::CollisionObject::TetModelCollisionObjectType, &pd.getPosition(offset), nVert, tmd.m_collisionObjectScale, tmd.m_thicknessSDF, tmd.m_testMesh, tmd.m_invertSDF); + break; + case SceneLoader::SDF: + { + if (tmd.m_collisionObjectFileName == "") + { + const std::string basePath = FileSystem::getFilePath(base->getSceneFile()); + const string cachePath = basePath + "/Cache"; + const string resStr = to_string(tmd.m_resolutionSDF[0]) + "_" + to_string(tmd.m_resolutionSDF[1]) + "_" + to_string(tmd.m_resolutionSDF[2]); + const std::string modelFileName = FileSystem::getFileNameWithExt(tmd.m_modelFileVis); + const string sdfFileName = FileSystem::normalizePath(cachePath + "/" + modelFileName + "_" + resStr + ".csdf"); + cd->addCubicSDFCollisionObject(i, CollisionDetection::CollisionObject::TetModelCollisionObjectType, &pd.getPosition(offset), nVert, distanceFields[sdfFileName], tmd.m_collisionObjectScale, tmd.m_testMesh, tmd.m_invertSDF); + } + else + cd->addCubicSDFCollisionObject(i, CollisionDetection::CollisionObject::TetModelCollisionObjectType, &pd.getPosition(offset), nVert, distanceFields[tmd.m_collisionObjectFileName], tmd.m_collisionObjectScale, tmd.m_testMesh, tmd.m_invertSDF); + break; + } + } + } + + ////////////////////////////////////////////////////////////////////////// + // joints + ////////////////////////////////////////////////////////////////////////// + + for (unsigned int i = 0; i < data.m_ballJointData.size(); i++) + { + const SceneLoader::BallJointData &jd = data.m_ballJointData[i]; + model->addBallJoint(id_index[jd.m_bodyID[0]], id_index[jd.m_bodyID[1]], jd.m_position); + } + + for (unsigned int i = 0; i < data.m_ballOnLineJointData.size(); i++) + { + const SceneLoader::BallOnLineJointData &jd = data.m_ballOnLineJointData[i]; + model->addBallOnLineJoint(id_index[jd.m_bodyID[0]], id_index[jd.m_bodyID[1]], jd.m_position, jd.m_axis); + } + + for (unsigned int i = 0; i < data.m_hingeJointData.size(); i++) + { + const SceneLoader::HingeJointData &jd = data.m_hingeJointData[i]; + model->addHingeJoint(id_index[jd.m_bodyID[0]], id_index[jd.m_bodyID[1]], jd.m_position, jd.m_axis); + } + + for (unsigned int i = 0; i < data.m_universalJointData.size(); i++) + { + const SceneLoader::UniversalJointData &jd = data.m_universalJointData[i]; + model->addUniversalJoint(id_index[jd.m_bodyID[0]], id_index[jd.m_bodyID[1]], jd.m_position, jd.m_axis[0], jd.m_axis[1]); + } + + for (unsigned int i = 0; i < data.m_sliderJointData.size(); i++) + { + const SceneLoader::SliderJointData &jd = data.m_sliderJointData[i]; + model->addSliderJoint(id_index[jd.m_bodyID[0]], id_index[jd.m_bodyID[1]], jd.m_axis); + } + + for (unsigned int i = 0; i < data.m_rigidBodyParticleBallJointData.size(); i++) + { + const SceneLoader::RigidBodyParticleBallJointData &jd = data.m_rigidBodyParticleBallJointData[i]; + model->addRigidBodyParticleBallJoint(id_index[jd.m_bodyID[0]], jd.m_bodyID[1]); + } + + for (unsigned int i = 0; i < data.m_targetAngleMotorHingeJointData.size(); i++) + { + const SceneLoader::TargetAngleMotorHingeJointData &jd = data.m_targetAngleMotorHingeJointData[i]; + model->addTargetAngleMotorHingeJoint(id_index[jd.m_bodyID[0]], id_index[jd.m_bodyID[1]], jd.m_position, jd.m_axis); + ((MotorJoint*)constraints[constraints.size() - 1])->setTarget(jd.m_target); + ((MotorJoint*)constraints[constraints.size() - 1])->setTargetSequence(jd.m_targetSequence); + ((MotorJoint*)constraints[constraints.size() - 1])->setRepeatSequence(jd.m_repeat); + } + + for (unsigned int i = 0; i < data.m_targetVelocityMotorHingeJointData.size(); i++) + { + const SceneLoader::TargetVelocityMotorHingeJointData &jd = data.m_targetVelocityMotorHingeJointData[i]; + model->addTargetVelocityMotorHingeJoint(id_index[jd.m_bodyID[0]], id_index[jd.m_bodyID[1]], jd.m_position, jd.m_axis); + ((MotorJoint*)constraints[constraints.size() - 1])->setTarget(jd.m_target); + ((MotorJoint*)constraints[constraints.size() - 1])->setTargetSequence(jd.m_targetSequence); + ((MotorJoint*)constraints[constraints.size() - 1])->setRepeatSequence(jd.m_repeat); + } + + for (unsigned int i = 0; i < data.m_targetPositionMotorSliderJointData.size(); i++) + { + const SceneLoader::TargetPositionMotorSliderJointData &jd = data.m_targetPositionMotorSliderJointData[i]; + model->addTargetPositionMotorSliderJoint(id_index[jd.m_bodyID[0]], id_index[jd.m_bodyID[1]], jd.m_axis); + ((MotorJoint*)constraints[constraints.size() - 1])->setTarget(jd.m_target); + ((MotorJoint*)constraints[constraints.size() - 1])->setTargetSequence(jd.m_targetSequence); + ((MotorJoint*)constraints[constraints.size() - 1])->setRepeatSequence(jd.m_repeat); + } + + for (unsigned int i = 0; i < data.m_targetVelocityMotorSliderJointData.size(); i++) + { + const SceneLoader::TargetVelocityMotorSliderJointData &jd = data.m_targetVelocityMotorSliderJointData[i]; + model->addTargetVelocityMotorSliderJoint(id_index[jd.m_bodyID[0]], id_index[jd.m_bodyID[1]], jd.m_axis); + ((MotorJoint*)constraints[constraints.size() - 1])->setTarget(jd.m_target); + ((MotorJoint*)constraints[constraints.size() - 1])->setTargetSequence(jd.m_targetSequence); + ((MotorJoint*)constraints[constraints.size() - 1])->setRepeatSequence(jd.m_repeat); + } + + for (unsigned int i = 0; i < data.m_damperJointData.size(); i++) + { + const SceneLoader::DamperJointData &jd = data.m_damperJointData[i]; + model->addDamperJoint(id_index[jd.m_bodyID[0]], id_index[jd.m_bodyID[1]], jd.m_axis, jd.m_stiffness); + } + + for (unsigned int i = 0; i < data.m_rigidBodySpringData.size(); i++) + { + const SceneLoader::RigidBodySpringData &jd = data.m_rigidBodySpringData[i]; + model->addRigidBodySpring(id_index[jd.m_bodyID[0]], id_index[jd.m_bodyID[1]], jd.m_position1, jd.m_position2, jd.m_stiffness); + } + + for (unsigned int i = 0; i < data.m_distanceJointData.size(); i++) + { + const SceneLoader::DistanceJointData &jd = data.m_distanceJointData[i]; + model->addDistanceJoint(id_index[jd.m_bodyID[0]], id_index[jd.m_bodyID[1]], jd.m_position1, jd.m_position2); + } +} diff --git a/Demos/StiffRodsDemos/StiffRodsSceneLoader.cpp b/Demos/StiffRodsDemos/StiffRodsSceneLoader.cpp new file mode 100644 index 00000000..cd5ac673 --- /dev/null +++ b/Demos/StiffRodsDemos/StiffRodsSceneLoader.cpp @@ -0,0 +1,627 @@ +#include "StiffRodsSceneLoader.h" +#include "Utils/FileSystem.h" +#include "Utils/Logger.h" + +using namespace PBD; +using namespace Utilities; + +void StiffRodsSceneLoader::parseStiffRodsData(const nlohmann::json &child, SceneData &sceneData, const std::string &basePath) +{ + if (m_json.find("RodAnimators") != m_json.end()) + parseRodAnimators(m_json, "RodAnimators", sceneData); + + // parse cosserat joint data + if (m_json.find("CosseratJoints") != m_json.end()) + parseStretchBendingTwistingConstraints(m_json, "CosseratJoints", sceneData); + + // parse tree data + if (m_json.find("TreeModels") != m_json.end()) + parseTreeModels(m_json, "TreeModels", sceneData); + + // parse skinning mesh data + if (m_json.find("SkinningMeshes") != m_json.end()) + parseSkinningMeshes(m_json, "SkinningMeshes", sceneData, basePath); + + if (m_json.find("CompactTreeModels") != m_json.end()) + parseCompactTreeModels(m_json, "CompactTreeModels", sceneData, basePath); + +} + +void StiffRodsSceneLoader::parseSkinningMeshes(const nlohmann::json &j, const std::string &key, SceneData & sceneData, const std::string &basePath) +{ + const nlohmann::json &child = j[key]; + { + RodSceneData &rodSceneData = static_cast(sceneData); + rodSceneData.m_SkinningMeshes.reserve(child.size()); + + for (auto &sMesh : child) + { + std::string meshFileName; + if (readValue(sMesh, "meshFile", meshFileName)) + { + if (FileSystem::isRelativePath(meshFileName)) + { + meshFileName = basePath + "/" + meshFileName; + } + + rodSceneData.m_SkinningMeshes.resize(rodSceneData.m_SkinningMeshes.size() + 1); + SkinningMeshData &smd = rodSceneData.m_SkinningMeshes.back(); + + // id + smd.m_Id = 0; + readValue(sMesh, "id", smd.m_Id); + + // file name + smd.m_MeshFile = meshFileName; + + // translation + smd.m_X.setZero(); + readVector(sMesh, "translation", smd.m_X); + + // Orientation + Vector3r axis; + axis.setZero(); + Real angle = 0.0; + if (readVector(sMesh, "rotationAxis", axis) && + readValue(sMesh, "rotationAngle", angle)) + { + axis.normalize(); + smd.m_Q = Quaternionr(AngleAxisr(angle, axis)); + } + else + smd.m_Q = Quaternionr::Identity(); + + // scaling + smd.m_Scale = Vector3r(1.0, 1.0, 1.0); + readVector(sMesh, "scale", smd.m_Scale); + + // vertex ids + std::vector &vertIDs(smd.m_VertexIDs); + if (sMesh.find("skinnedVertsIds") != sMesh.end()) + { + vertIDs.reserve(sMesh["skinnedVertsIds"].size()); + for (auto &skinnedVertID : sMesh["skinnedVertsIds"]) + { + vertIDs.push_back(skinnedVertID.get()); + } + } + + // body ids + std::vector> &rbIdsOfVerts(smd.m_BodyIDs); + if (sMesh.find("rbIdsOfVerts") != sMesh.end()) + { + rbIdsOfVerts.reserve(sMesh["rbIdsOfVerts"].size()); + for (auto &rbIDs : sMesh["rbIdsOfVerts"]) + { + std::vector ids; + for (auto &id : rbIDs) + { + ids.push_back(id.get()); + } + rbIdsOfVerts.push_back(ids); + } + } + + // skinning Weights + std::vector> &skinningWeights(smd.m_SkinningWeights); + if (sMesh.find("weightsOfVerts") != sMesh.end()) + { + for (auto &vWeightsData : sMesh["weightsOfVerts"]) + { + std::vector weights; + for (auto &weight : vWeightsData) + { + weights.push_back(weight.get()); + } + skinningWeights.push_back(weights); + } + } + } + + } + } +} + +void StiffRodsSceneLoader::parseTreeModels(const nlohmann::json &j, const std::string &key, SceneData & sceneData) +{ + const nlohmann::json &child = j[key]; + { + RodSceneData &rodSceneData = static_cast(sceneData); + rodSceneData.m_TreeModels.reserve(child.size()); + + for (auto &tm : child) + { + rodSceneData.m_TreeModels.resize(rodSceneData.m_TreeModels.size() + 1); + TreeModelData &tmd = rodSceneData.m_TreeModels.back(); + + // id + tmd.m_Id = 0; + readValue(tm, "id", tmd.m_Id); + + // translation + tmd.m_X.setZero(); + readVector(tm, "translation", tmd.m_X); + + // Orientation + Vector3r axis; + axis.setZero(); + Real angle = 0.0; + if (readVector(tm, "rotationAxis", axis) && + readValue(tm, "rotationAngle", angle)) + { + axis.normalize(); + tmd.m_Q = Quaternionr(AngleAxisr(angle, axis)); + } + else + tmd.m_Q = Quaternionr::Identity(); + + // youngs modulus + tmd.m_YoungsModulus = 0.; + readValue(tm, "youngsModulus", tmd.m_YoungsModulus); + + // torsion modulus + tmd.m_TorsionModulus = 0.; + readValue(tm, "torsionModulus", tmd.m_TorsionModulus); + + // rigid body IDs + if (tm.find("rbIds") != tm.end()) + { + for (auto& id : tm["rbIds"]) + { + tmd.m_SegmentIds.insert(id.get()); + } + } + + // joint IDs + if (tm.find("jIds") != tm.end()) + { + for (auto& id : tm["jIds"]) + { + tmd.m_StretchBendingTwistingConstraintIds.insert(id.get()); + } + } + + // static Segment + if (tm.find("staticSegments") != tm.end()) + { + for (auto& id : tm["staticSegments"]) + { + tmd.m_StaticSegments.insert(id.get()); + } + } + + // id + tmd.m_SolverType = 12; // direct solver type == 12 + readValue(tm, "solverType", tmd.m_SolverType); + } + } +} + +void StiffRodsSceneLoader::parseCompactTreeModels(const nlohmann::json &j, const std::string &key, SceneData & sceneData, const std::string &basePath) +{ + { + const nlohmann::json &child = j[key]; + + RodSceneData &rodSceneData = static_cast(sceneData); + rodSceneData.m_CompactTreeModels.reserve(child.size()); + + for (auto &tm : child) + { + rodSceneData.m_CompactTreeModels.resize(rodSceneData.m_CompactTreeModels.size() + 1); + CompactTreeModelData &ctmd = rodSceneData.m_CompactTreeModels.back(); + + // id + ctmd.m_Id = 0; + readValue(tm, "id", ctmd.m_Id); + + // translation + ctmd.m_X.setZero(); + readVector(tm, "translation", ctmd.m_X); + + // Orientation + Vector3r axis; + axis.setZero(); + Real angle = 0.0; + if (readVector(tm, "rotationAxis", axis) && + readValue(tm, "rotationAngle", angle)) + { + axis.normalize(); + ctmd.m_Q = Quaternionr(AngleAxisr(angle, axis)); + } + else + ctmd.m_Q = Quaternionr::Identity(); + + // youngs modulus + ctmd.m_YoungsModulus = 0.; + readValue(tm, "youngsModulus", ctmd.m_YoungsModulus); + + // torsion modulus + ctmd.m_TorsionModulus = 0.; + readValue(tm, "torsionModulus", ctmd.m_TorsionModulus); + + // static Segment + if (tm.find("staticSegments") != tm.end()) + { + for (auto& id : tm["staticSegments"]) + { + ctmd.m_StaticSegments.insert(id.get()); + } + } + + // solver type + ctmd.m_SolverType = 12; + readValue(tm, "solverType", ctmd.m_SolverType); + + // segment positions + if (tm.find("segmentPositions") != tm.end()) + { + for (auto &position : tm["segmentPositions"]) + { + ctmd.m_SegmentPositions.push_back + (readVectorValues(position)); + } + } + + // segment Orientations + std::vector tmpSegmentOrientationAxes; + std::vector tmpSegmentOrientationAngles; + + if (tm.find("segmentOrientationAxes") != tm.end()) + { + for (auto &axis : tm["segmentOrientationAxes"]) + { + tmpSegmentOrientationAxes.push_back + (readVectorValues(axis)); + } + } + + if (tm.find("segmentOrientationAngles") != tm.end()) + { + for (auto &angle : tm["segmentOrientationAngles"]) + { + tmpSegmentOrientationAngles.push_back + (angle.get()); + } + } + + for (size_t idx(0); + idx < tmpSegmentOrientationAngles.size() && idx < tmpSegmentOrientationAxes.size(); + ++idx) + { + Real angle(tmpSegmentOrientationAngles[idx]); + Vector3r & axis(tmpSegmentOrientationAxes[idx]); + axis.normalize(); + ctmd.m_SegmentOrientations.push_back(Quaternionr(AngleAxisr(angle, axis))); + } + + // segment scales + if (tm.find("segmentScales") != tm.end()) + { + for (auto &scale : tm["segmentScales"]) + { + ctmd.m_SegmentScales.push_back + (readVectorValues(scale)); + } + } + + // segment densities + if (tm.find("segmentDensities") != tm.end()) + { + for (auto &density : tm["segmentDensities"]) + { + ctmd.m_SegmentDensities.push_back + (density.get()); + } + } + + // segment model files + if (tm.find("segmentModelFiles") != tm.end()) + { + std::string geomFileName; + for (auto &modelFile : tm["segmentModelFiles"]) + { + geomFileName = modelFile.get(); + if (FileSystem::isRelativePath(geomFileName)) + { + geomFileName = basePath + "/" + geomFileName; + } + ctmd.m_SegmentModelFiles.push_back(geomFileName); + } + } + + // segment friction coefficients + if (tm.find("segmentFrictionCoefficients") != tm.end()) + { + for (auto &fc : tm["segmentFrictionCoefficients"]) + { + ctmd.m_SegmentFrictionCoefficients.push_back + (fc.get()); + } + } + + // segment restitution coefficients + if (tm.find("segmentRestitutionCoefficients") != tm.end()) + { + for (auto &rc : tm["segmentRestitutionCoefficients"]) + { + ctmd.m_SegmentRestitutioCoefficients.push_back + (rc.get()); + } + } + + // segment collision category bits + if (tm.find("segmentCollisionCategoryBits") != tm.end()) + { + for (auto &ccb : tm["segmentCollisionCategoryBits"]) + { + ctmd.m_SegmentCollisionCategoryBits.push_back + (ccb.get()); + } + } + + // segment collision filter mask bits + if (tm.find("segmentCollisionFilterMaskBits") != tm.end()) + { + for (auto &cfmb : tm["segmentCollisionFilterMaskBits"]) + { + ctmd.m_SegmentCollisionFilterMaskBits.push_back + (cfmb.get()); + } + } + + // joint positions + if (tm.find("jointPositions") != tm.end()) + { + for (auto &jp : tm["jointPositions"]) + { + ctmd.m_SBTConstraintPositions.push_back + (readVectorValues(jp)); + } + } + + // joint bodies indices + if (tm.find("jointBodiesIndices") != tm.end()) + { + for (auto &jbi : tm["jointBodiesIndices"]) + { + std::vector bodyIndices; + for (auto& item : jbi) + { + bodyIndices.push_back(item.get()); + } + ctmd.m_SBTConstraintBodiesIndices.push_back(bodyIndices); + } + } + + // joint stiffness modifier + if (tm.find("jointStiffnessModifier") != tm.end()) + { + for (auto &jsm : tm["jointStiffnessModifier"]) + { + ctmd.m_SBTConstraintStiffnessModifier.push_back + (readVectorValues(jsm)); + } + } + } + } +} + +void StiffRodsSceneLoader::parseStretchBendingTwistingConstraints(const nlohmann::json &j, const std::string &key, SceneData & sceneData) +{ + { + const nlohmann::json &child = j[key]; + RodSceneData &rodSceneData = static_cast(sceneData); + rodSceneData.m_StretchBendingTwistingConstraints.reserve(static_cast(child.size())); + + for (auto &joint : child) + { + rodSceneData.m_StretchBendingTwistingConstraints.resize(rodSceneData.m_StretchBendingTwistingConstraints.size() + 1); + StretchBendingTwistingConstraintData &cj = rodSceneData.m_StretchBendingTwistingConstraints.back(); + + // id + cj.m_Id = 0; + readValue(joint, "id", cj.m_Id); + + // first rigid body Id + cj.m_SegmentID[0] = 0; + readValue(joint, "bodyID1", cj.m_SegmentID[0]); + + // second rigid body Id + cj.m_SegmentID[1] = 0; + readValue(joint, "bodyID2", cj.m_SegmentID[1]); + + // joint position + cj.m_Position = Vector3r(0., 0., 0.); + readVector(joint, "position", cj.m_Position); + + // youngs modulus + cj.m_YoungsModulus = 0.; + readValue(joint, "youngsModulus", cj.m_YoungsModulus); + + // torsion modulus + cj.m_TorsionModulus = 0.; + readValue(joint, "torsionModulus", cj.m_TorsionModulus); + + // stiffness modifier + cj.m_StiffnessModifier = Vector3r(0., 0., 0.); + readVector(joint, "stiffnessModifier", cj.m_StiffnessModifier); + } + } +} + +void StiffRodsSceneLoader::parseRodAnimators(const nlohmann::json &j, const std::string &key, SceneData & sceneData) +{ + { + const nlohmann::json &child = j[key]; + RodSceneData &rodSceneData = static_cast(sceneData); + rodSceneData.m_RodAnimators.reserve(static_cast(child.size())); + + for (auto &anim : child) + { + rodSceneData.m_RodAnimators.resize(rodSceneData.m_RodAnimators.size() + 1); + AnimatorData &ra = rodSceneData.m_RodAnimators.back(); + + // id + ra.m_id = 0; + readValue(anim, "id", ra.m_id); + + // rod id + ra.m_RodID = 0; + readValue(anim, "rodID", ra.m_RodID); + + // segment id + ra.m_SegmentID = 0; + readValue(anim, "segmentID", ra.m_SegmentID); + + // starting time + ra.m_StartingTime = 0; + readValue(anim, "startingTime", ra.m_StartingTime); + + // ending time + ra.m_EndingTime = 0; + readValue(anim, "endingTime", ra.m_EndingTime); + + // type + ra.m_Type = 0; + readValue(anim, "type", ra.m_Type); + + // data + if (anim.find("data") != anim.end()) + { + for (auto &dataItem : anim["data"]) + { + ra.m_Data.push_back(readVectorValues(dataItem)); + } + } + + } + } +} + +void PBD::StiffRodsSceneLoader::readStiffRodsScene(const std::string &fileName, SceneData &sceneData) +{ + try + { + std::ifstream input_file(fileName); + if (!input_file.is_open()) + { + std::cerr << "Cannot open file!\n"; + return; + } + m_json << input_file; + + std::string basePath = FileSystem::getFilePath(fileName); + + readValue(m_json, "Name", sceneData.m_sceneName); + + sceneData.m_camPosition = Vector3r(5.0, 10.0, 30.0); + readVector(m_json, "cameraPosition", sceneData.m_camPosition); + sceneData.m_camLookat = Vector3r(5.0, 0.0, 0.0); + readVector(m_json, "cameraLookat", sceneData.m_camLookat); + + ////////////////////////////////////////////////////////////////////////// + // read general + ////////////////////////////////////////////////////////////////////////// + sceneData.m_timeStepSize = static_cast(0.005); + sceneData.m_gravity = Vector3r(0, -static_cast(9.81), 0); + if (m_json.find("Simulation") != m_json.end()) + readSimulation(m_json, "Simulation", sceneData); + + ////////////////////////////////////////////////////////////////////////// + // read rigid bodies + ////////////////////////////////////////////////////////////////////////// + if (m_json.find("RigidBodies") != m_json.end()) + readRigidBodies(m_json, "RigidBodies", basePath, sceneData); + + ////////////////////////////////////////////////////////////////////////// + // read triangle models + ////////////////////////////////////////////////////////////////////////// + if (m_json.find("TriangleModels") != m_json.end()) + readTriangleModels(m_json, "TriangleModels", basePath, sceneData); + + ////////////////////////////////////////////////////////////////////////// + // read tet models + ////////////////////////////////////////////////////////////////////////// + if (m_json.find("TetModels") != m_json.end()) + readTetModels(m_json, "TetModels", basePath, sceneData); + + ////////////////////////////////////////////////////////////////////////// + // read ball joints + ////////////////////////////////////////////////////////////////////////// + if (m_json.find("BallJoints") != m_json.end()) + readBallJoints(m_json, "BallJoints", sceneData); + + ////////////////////////////////////////////////////////////////////////// + // read ball-on-line joints + ////////////////////////////////////////////////////////////////////////// + if (m_json.find("BallOnLineJoints") != m_json.end()) + readBallOnLineJoints(m_json, "BallOnLineJoints", sceneData); + + ////////////////////////////////////////////////////////////////////////// + // read hinge joints + ////////////////////////////////////////////////////////////////////////// + if (m_json.find("HingeJoints") != m_json.end()) + readHingeJoints(m_json, "HingeJoints", sceneData); + + ////////////////////////////////////////////////////////////////////////// + // read universal joints + ////////////////////////////////////////////////////////////////////////// + if (m_json.find("UniversalJoints") != m_json.end()) + readUniversalJoints(m_json, "UniversalJoints", sceneData); + + ////////////////////////////////////////////////////////////////////////// + // read slider joints + ////////////////////////////////////////////////////////////////////////// + if (m_json.find("SliderJoints") != m_json.end()) + readSliderJoints(m_json, "SliderJoints", sceneData); + + ////////////////////////////////////////////////////////////////////////// + // read RigidBodyParticleBallJoints + ////////////////////////////////////////////////////////////////////////// + if (m_json.find("RigidBodyParticleBallJoints") != m_json.end()) + readRigidBodyParticleBallJoints(m_json, "RigidBodyParticleBallJoints", sceneData); + + ////////////////////////////////////////////////////////////////////////// + // read RigidBodySprings + ////////////////////////////////////////////////////////////////////////// + if (m_json.find("RigidBodySprings") != m_json.end()) + readRigidBodySprings(m_json, "RigidBodySprings", sceneData); + + ////////////////////////////////////////////////////////////////////////// + // read DistanceJoints + ////////////////////////////////////////////////////////////////////////// + if (m_json.find("DistanceJoints") != m_json.end()) + readDistanceJoints(m_json, "DistanceJoints", sceneData); + + ////////////////////////////////////////////////////////////////////////// + // read TargetAngleMotorHingeJoint + ////////////////////////////////////////////////////////////////////////// + if (m_json.find("TargetAngleMotorHingeJoints") != m_json.end()) + readTargetAngleMotorHingeJoints(m_json, "TargetAngleMotorHingeJoints", sceneData); + + ////////////////////////////////////////////////////////////////////////// + // read TargetVelocityMotorHingeJoint + ////////////////////////////////////////////////////////////////////////// + if (m_json.find("TargetVelocityMotorHingeJoints") != m_json.end()) + readTargetVelocityMotorHingeJoints(m_json, "TargetVelocityMotorHingeJoints", sceneData); + + ////////////////////////////////////////////////////////////////////////// + // read TargetPositionMotorSliderJoint + ////////////////////////////////////////////////////////////////////////// + if (m_json.find("TargetPositionMotorSliderJoints") != m_json.end()) + readTargetPositionMotorSliderJoints(m_json, "TargetPositionMotorSliderJoints", sceneData); + + ////////////////////////////////////////////////////////////////////////// + // read TargetVelocityMotorSliderJoint + ////////////////////////////////////////////////////////////////////////// + if (m_json.find("TargetVelocityMotorSliderJoints") != m_json.end()) + readTargetVelocityMotorSliderJoints(m_json, "TargetVelocityMotorSliderJoints", sceneData); + + parseStiffRodsData(m_json, sceneData, basePath); + } + catch (std::exception& e) + { + LOG_ERR << e.what(); + exit(1); + } +} diff --git a/Demos/StiffRodsDemos/StiffRodsSceneLoader.h b/Demos/StiffRodsDemos/StiffRodsSceneLoader.h new file mode 100644 index 00000000..fbaa7e4c --- /dev/null +++ b/Demos/StiffRodsDemos/StiffRodsSceneLoader.h @@ -0,0 +1,118 @@ + +#ifndef __STIFFRODSSCENELOADER_H__ +#define __STIFFRODSSCENELOADER_H__ + +#include "Utils/SceneLoader.h" + +#include +#include + +namespace PBD +{ + class StiffRodsSceneLoader : public Utilities::SceneLoader + { + public: + virtual ~StiffRodsSceneLoader() {} + + struct AnimatorData{ + unsigned int m_id; + unsigned int m_RodID; + unsigned int m_SegmentID; + Real m_StartingTime; + Real m_EndingTime; + unsigned int m_Type; + std::vector m_Data; + }; + + struct StretchBendingTwistingConstraintData + { + unsigned int m_Id; + unsigned int m_SegmentID[2]; + Real m_YoungsModulus; + Real m_TorsionModulus; + Vector3r m_Position; + Vector3r m_StiffnessModifier; + }; + + struct TreeModelData{ + unsigned int m_Id; + Vector3r m_X; + Quaternionr m_Q; + Real m_YoungsModulus; + Real m_TorsionModulus; + std::set m_SegmentIds; + std::set m_StretchBendingTwistingConstraintIds; + std::set m_StaticSegments; + unsigned int m_SolverType; + }; + + struct SkinningMeshData{ + unsigned int m_Id; + std::string m_MeshFile; + Vector3r m_X; + Quaternionr m_Q; + Vector3r m_Scale; + std::vector m_VertexIDs; + std::vector> m_BodyIDs; + std::vector> m_SkinningWeights; + }; + + struct CompactTreeModelData{ + unsigned int m_Id; + Vector3r m_X; + Quaternionr m_Q; + Real m_YoungsModulus; + Real m_TorsionModulus; + std::set m_StaticSegments; + unsigned int m_SolverType; + std::vector m_SegmentPositions; + std::vector m_SegmentOrientations; + std::vector m_SegmentScales; + std::vector m_SegmentDensities; + std::vector m_SegmentModelFiles; + std::vector m_SegmentFrictionCoefficients; + std::vector m_SegmentRestitutioCoefficients; + std::vector m_SegmentCollisionCategoryBits; + std::vector m_SegmentCollisionFilterMaskBits; + std::vector m_SBTConstraintPositions; + std::vector> m_SBTConstraintBodiesIndices; + std::vector m_SBTConstraintStiffnessModifier; + }; + + struct RodSceneData : public SceneLoader::SceneData{ + std::vector m_RodAnimators; + std::vector m_StretchBendingTwistingConstraints; + std::vector m_TreeModels; + std::vector m_SkinningMeshes; + std::vector m_CompactTreeModels; + }; + + virtual void readStiffRodsScene(const std::string &fileName, SceneData &sceneData); + + protected: + + void parseStiffRodsData(const nlohmann::json &j, SceneData &sceneData, const std::string &basePath); + void parseRodAnimators(const nlohmann::json &j, const std::string &key, SceneData & sceneData); + void parseStretchBendingTwistingConstraints(const nlohmann::json &j, const std::string &key, SceneData & sceneData); + void parseTreeModels(const nlohmann::json &j, const std::string &key, SceneData & sceneData); + void parseCompactTreeModels(const nlohmann::json &j, const std::string &key, SceneData & sceneData, const std::string &basePath); + void parseSkinningMeshes(const nlohmann::json &j, const std::string &key, SceneData & sceneData, const std::string &basePath); + + template + static Eigen::Matrix readVectorValues(const nlohmann::json &j) + { + unsigned int index = 0u; + Eigen::Matrix v(Eigen::Matrix::Zero()); + for (auto& item : j) + { + v[index++] = item.get(); + if (index >= size) + break; + } + + return v; + } + }; +} + +#endif diff --git a/Demos/StiffRodsDemos/StretchBendingTwistingDemo.cpp b/Demos/StiffRodsDemos/StretchBendingTwistingDemo.cpp new file mode 100644 index 00000000..8ab60d4c --- /dev/null +++ b/Demos/StiffRodsDemos/StretchBendingTwistingDemo.cpp @@ -0,0 +1,192 @@ +#include "Common/Common.h" +#include "Demos/Visualization/MiniGL.h" +#include "Demos/Visualization/Selection.h" +#include "Simulation/TimeManager.h" +#include +#include "Simulation/SimulationModel.h" +#include "Simulation/TimeStepController.h" +#include +#include "Demos/Visualization/Visualization.h" +#include "Utils/Logger.h" +#include "Utils/Timing.h" +#include "Utils/FileSystem.h" +#include "Demos/Common/DemoBase.h" +#include "Simulation/Simulation.h" + +#define _USE_MATH_DEFINES +#include "math.h" + + +// Enable memory leak detection +#if defined(_DEBUG) && !defined(EIGEN_ALIGN) + #define new DEBUG_NEW +#endif + +using namespace PBD; +using namespace Eigen; +using namespace std; +using namespace Utilities; + +void initParameters(); +void timeStep (); +void buildModel (); +void createBunnyRodModel(); +void render (); +void reset(); + +DemoBase *base; + +// bunny rod scene +const int numberOfBodies = 10; +const Real width = static_cast(1.0); +const Real height = static_cast(0.1); +const Real depth = static_cast(0.1); +const Real youngsModulus = static_cast(209e9); +const Real torsionModulus = static_cast(79e9); +const Real density = 7800.; + +const Real bunnyDensity = 500.; + +// main +int main( int argc, char **argv ) +{ + REPORT_MEMORY_LEAKS + + base = new DemoBase(); + base->init(argc, argv, "Stretch-bending-twisting demo"); + + SimulationModel *model = new SimulationModel(); + model->init(); + Simulation::getCurrent()->setModel(model); + + buildModel(); + + base->createParameterGUI(); + + // OpenGL + MiniGL::setClientIdleFunc (timeStep); + MiniGL::addKeyFunc('r', reset); + MiniGL::setClientSceneFunc(render); + MiniGL::setViewport (40.0, 0.1f, 500.0, Vector3r (5.0, 10.0, 30.0), Vector3r (5.0, 0.0, 0.0)); + + MiniGL::mainLoop(); + + Utilities::Timing::printAverageTimes(); + Utilities::Timing::printTimeSums(); + + delete Simulation::getCurrent(); + delete base; + delete model; + + return 0; +} + +void reset() +{ + Utilities::Timing::printAverageTimes(); + Utilities::Timing::reset(); + + Simulation::getCurrent()->reset(); + base->getSelectedParticles().clear(); + + Simulation::getCurrent()->getModel()->cleanup(); + buildModel(); +} + +void timeStep () +{ + const Real pauseAt = base->getValue(DemoBase::PAUSE_AT); + if ((pauseAt > 0.0) && (pauseAt < TimeManager::getCurrent()->getTime())) + base->setValue(DemoBase::PAUSE, true); + + if (base->getValue(DemoBase::PAUSE)) + return; + + // Simulation code + SimulationModel *model = Simulation::getCurrent()->getModel(); + const unsigned int numSteps = base->getValue(DemoBase::NUM_STEPS_PER_RENDER); + for (unsigned int i = 0; i < numSteps; i++) + { + START_TIMING("SimStep"); + Simulation::getCurrent()->getTimeStep()->step(*model); + STOP_TIMING_AVG; + + base->step(); + } +} + +void buildModel () +{ + TimeManager::getCurrent ()->setTimeStepSize (static_cast(0.01)); + + createBunnyRodModel(); +} + +void render () +{ + base->render(); +} + +/** Create the bunny rod body model +*/ +void createBunnyRodModel() +{ + SimulationModel *model = Simulation::getCurrent()->getModel(); + SimulationModel::RigidBodyVector &rb = model->getRigidBodies(); + SimulationModel::ConstraintVector &constraints = model->getConstraints(); + + string fileName = FileSystem::normalizePath(base->getExePath() + "/resources/models/cube.obj"); + IndexedFaceMesh mesh; + VertexData vd; + DemoBase::loadMesh(fileName, vd, mesh, Vector3r::Zero(), Matrix3r::Identity(), Vector3r(height, width, depth)); + mesh.setFlatShading(true); + + string fileName2 = FileSystem::normalizePath(base->getExePath() + "/resources/models/bunny_10k.obj"); + IndexedFaceMesh mesh2; + VertexData vd2; + DemoBase::loadMesh(fileName2, vd2, mesh2, Vector3r::Zero(), Matrix3r::Identity(), Vector3r(2.0, 2.0, 2.0)); + + rb.resize(numberOfBodies); + for (unsigned int i = 0; i < numberOfBodies-1; i++) + { + rb[i] = new RigidBody(); + + Real mass(static_cast(0.25 * M_PI) * width * height * depth * density); + + const Real Iy = static_cast(1. / 12.) * mass*(static_cast(3.)*(static_cast(0.25)*height*height) + width*width); + const Real Iz = static_cast(1. / 12.) * mass*(static_cast(3.)*(static_cast(0.25)*depth*depth) + width*width); + const Real Ix = static_cast(0.25) * mass*(static_cast(0.25)*(height*height + depth*depth)); + Vector3r inertia(Iy, Ix, Iz); // rod axis along y-axis + + Real angle(static_cast(M_PI_2)); + Vector3r axis(0., 0., 1.); + AngleAxisr angleAxis(angle, axis); + Quaternionr rotation(angleAxis); + + rb[i]->initBody(mass, + Vector3r((Real)i*width, 0.0, 0.0), + inertia, + rotation, + vd, mesh); + } + // Make first body static + rb[0]->setMass(0.0); + + // bunny + const Quaternionr q(AngleAxisr(static_cast(1.0/6.0*M_PI), Vector3r(0.0, 0.0, 1.0))); + const Vector3r t(static_cast(0.411) + (static_cast(numberOfBodies - 1.0))*width, -static_cast(1.776), static_cast(0.356)); + rb[numberOfBodies - 1] = new RigidBody(); + rb[numberOfBodies - 1]->initBody(bunnyDensity, t, q, vd2, mesh2); + + constraints.reserve(numberOfBodies - 1); + for (unsigned int i = 0; i < numberOfBodies-2; i++) + { + model->addStretchBendingTwistingConstraint(i, i + 1, Vector3r(static_cast(i)*width + static_cast(0.5)*width, 0.0, 0.0), + 0.25*(height+depth), width, youngsModulus, torsionModulus); + } + unsigned int i(numberOfBodies - 2); + model->addBallJoint(i, i + 1, Vector3r(static_cast(i)*width + static_cast(0.5)*width, 0.0, 0.0)); + + Simulation::getCurrent()->getTimeStep()->setValue(TimeStepController::MAX_ITERATIONS, 200); +} + diff --git a/Demos/Utils/CMakeLists.txt b/Demos/Utils/CMakeLists.txt deleted file mode 100644 index e64fc79c..00000000 --- a/Demos/Utils/CMakeLists.txt +++ /dev/null @@ -1,33 +0,0 @@ -add_library(Utils - Hashmap.h - IndexedFaceMesh.cpp - IndexedFaceMesh.h - IndexedTetMesh.cpp - IndexedTetMesh.h - ObjectArray.h - OBJExporter.cpp - OBJExporter.h - OBJLoader.cpp - OBJLoader.h - SceneLoader.cpp - SceneLoader.h - TetGenLoader.cpp - TetGenLoader.h - Timing.cpp - Timing.h - Utilities.cpp - Utilities.h - VolumeIntegration.cpp - VolumeIntegration.h - - CMakeLists.txt -) - -find_package( Eigen3 REQUIRED ) -include_directories( ${EIGEN3_INCLUDE_DIR} ) - - - - - - diff --git a/Demos/Utils/Config.h b/Demos/Utils/Config.h deleted file mode 100644 index ec0f3b1d..00000000 --- a/Demos/Utils/Config.h +++ /dev/null @@ -1,22 +0,0 @@ -#ifndef __CONFIG_H__ -#define __CONFIG_H__ - -#if defined(WIN32) || defined(_WIN32) || defined(WIN64) - // Enable memory leak detection - #ifdef _DEBUG - #define _CRTDBG_MAP_ALLOC - #include - #include - #define DEBUG_NEW new(_NORMAL_BLOCK, __FILE__, __LINE__) - #define REPORT_MEMORY_LEAKS _CrtSetDbgFlag ( _CRTDBG_ALLOC_MEM_DF | _CRTDBG_LEAK_CHECK_DF ); - #else - #define REPORT_MEMORY_LEAKS - #endif - - #define FORCE_INLINE __forceinline -#else - #define REPORT_MEMORY_LEAKS - #define FORCE_INLINE __attribute__((always_inline)) -#endif - -#endif diff --git a/Demos/Utils/OBJLoader.cpp b/Demos/Utils/OBJLoader.cpp deleted file mode 100644 index 0b99711f..00000000 --- a/Demos/Utils/OBJLoader.cpp +++ /dev/null @@ -1,188 +0,0 @@ -#include "OBJLoader.h" -#include -#include -#include -#include - -using namespace PBD; -using namespace std; - -struct MeshFaceIndices -{ - int posIndices[3]; - int texIndices[3]; - int normalIndices[3]; -}; - -void OBJLoader::tokenize(const string& str, vector& tokens, const string& delimiters) -{ - string::size_type lastPos = str.find_first_not_of(delimiters, 0); - string::size_type pos = str.find_first_of(delimiters, lastPos); - - while (string::npos != pos || string::npos != lastPos) - { - tokens.push_back(str.substr(lastPos, pos - lastPos)); - lastPos = str.find_first_not_of(delimiters, pos); - pos = str.find_first_of(delimiters, lastPos); - } -} - -void OBJLoader::loadObj(const std::string &filename, VertexData &vertexData, IndexedFaceMesh &mesh, const Vector3r &scale) -{ - std::cout << "Loading " << filename << std::endl; - - vector positions; - vector texcoords; - vector normals; - vector faces; - - ifstream filestream; - filestream.open(filename.c_str()); - if (filestream.fail()) - { - std::cerr << "Failed to open file: " << filename << "\n"; - return; - } - - string line_stream; - bool vt = false; - bool vn = false; - - std::vector pos_buffer; - std::vector f_buffer; - - while(getline(filestream, line_stream)) - { - stringstream str_stream(line_stream); - string type_str; - str_stream >> type_str; - - if(type_str == "v") - { - Vector3r pos; - pos_buffer.clear(); - std::string parse_str = line_stream.substr(line_stream.find("v") + 1); - tokenize(parse_str, pos_buffer); - for (unsigned int i = 0; i < 3; i++) - pos[i] = stof(pos_buffer[i]) * scale[i]; - - positions.push_back(pos); - } - else if(type_str == "vt") - { - Vector2r tex; - pos_buffer.clear(); - std::string parse_str = line_stream.substr(line_stream.find("vt") + 2); - tokenize(parse_str, pos_buffer); - for (unsigned int i = 0; i < 2; i++) - tex[i] = stof(pos_buffer[i]); - - texcoords.push_back(tex); - vt = true; - } - else if(type_str == "vn") - { - Vector3r nor; - pos_buffer.clear(); - std::string parse_str = line_stream.substr(line_stream.find("vn") + 2); - tokenize(parse_str, pos_buffer); - for (unsigned int i = 0; i < 3; i++) - nor[i] = stof(pos_buffer[i]); - - normals.push_back(nor); - vn = true; - } - else if(type_str == "f") - { - MeshFaceIndices faceIndex; - if (vn && vt) - { - f_buffer.clear(); - std::string parse_str = line_stream.substr(line_stream.find("f") + 1); - tokenize(parse_str, f_buffer); - for(int i = 0; i < 3; ++i) - { - pos_buffer.clear(); - tokenize(f_buffer[i], pos_buffer, "/"); - faceIndex.posIndices[i] = stoi(pos_buffer[0]); - faceIndex.texIndices[i] = stoi(pos_buffer[1]); - faceIndex.normalIndices[i] = stoi(pos_buffer[2]); - } - } - else if (vn) - { - f_buffer.clear(); - std::string parse_str = line_stream.substr(line_stream.find("f") + 1); - tokenize(parse_str, f_buffer); - for(int i = 0; i < 3; ++i) - { - pos_buffer.clear(); - tokenize(f_buffer[i], pos_buffer, "/"); - faceIndex.posIndices[i] = stoi(pos_buffer[0]); - faceIndex.normalIndices[i] = stoi(pos_buffer[1]); - } - } - else if (vt) - { - f_buffer.clear(); - std::string parse_str = line_stream.substr(line_stream.find("f") + 1); - tokenize(parse_str, f_buffer); - for(int i = 0; i < 3; ++i) - { - pos_buffer.clear(); - tokenize(f_buffer[i], pos_buffer, "/"); - faceIndex.posIndices[i] = stoi(pos_buffer[0]); - faceIndex.texIndices[i] = stoi(pos_buffer[1]); - } - } - else - { - f_buffer.clear(); - std::string parse_str = line_stream.substr(line_stream.find("f") + 1); - tokenize(parse_str, f_buffer); - for (int i = 0; i < 3; ++i) - { - faceIndex.posIndices[i] = stoi(f_buffer[i]); - } - } - faces.push_back(faceIndex); - } - } - filestream.close(); - mesh.release(); - vertexData.release(); - const unsigned int nPoints = (unsigned int) positions.size(); - const unsigned int nFaces = (unsigned int) faces.size(); - const unsigned int nTexCoords = (unsigned int) texcoords.size(); - mesh.initMesh(nPoints, nFaces * 2, nFaces); - vertexData.reserve(nPoints); - for(unsigned int i=0; i < nPoints; i++) - { - vertexData.addVertex(positions[i]); - } - for(unsigned int i=0; i < nTexCoords; i++) - { - mesh.addUV(texcoords[i][0], texcoords[i][1]); - } - for(unsigned int i=0; i < nFaces; i++) - { - // Reduce the indices by one - int posIndices[3]; - int texIndices[3]; - for (int j=0; j < 3; j++) - { - posIndices[j] = faces[i].posIndices[j]-1; - if (nTexCoords > 0) - { - texIndices[j] = faces[i].texIndices[j] - 1; - mesh.addUVIndex(texIndices[j]); - } - } - - mesh.addFace(&posIndices[0]); - } - mesh.buildNeighbors(); - - std::cout << "Number of triangles: " << nFaces << "\n"; - std::cout << "Number of vertices: " << nPoints << "\n"; -} \ No newline at end of file diff --git a/Demos/Utils/OBJLoader.h b/Demos/Utils/OBJLoader.h deleted file mode 100644 index c6af0d98..00000000 --- a/Demos/Utils/OBJLoader.h +++ /dev/null @@ -1,21 +0,0 @@ -#ifndef __OBJLOADER_H__ -#define __OBJLOADER_H__ - -#include "Demos/Utils/IndexedFaceMesh.h" -#include "Demos/Simulation/ParticleData.h" -#include - -namespace PBD -{ - class OBJLoader - { - public: - /** This function loads an OBJ file in an IndexedFaceMesh data structure. - * Only triangulated meshes are supported at the moment. - */ - static void loadObj(const std::string &filename, VertexData &vertexData, IndexedFaceMesh &mesh, const Vector3r &scale = Vector3r(1.0, 1.0, 1.0)); - static void tokenize(const std::string& str, std::vector& tokens, const std::string& delimiters = " "); - }; -} - -#endif \ No newline at end of file diff --git a/Demos/Utils/SceneLoader.cpp b/Demos/Utils/SceneLoader.cpp deleted file mode 100644 index 0de8c86d..00000000 --- a/Demos/Utils/SceneLoader.cpp +++ /dev/null @@ -1,594 +0,0 @@ -#include "SceneLoader.h" -#include -#include -#include -#include -#include - -using namespace PBD; - - -void SceneLoader::readScene(const std::string &fileName, SceneData &sceneData) -{ - FILE *file = fopen(fileName.c_str(), "r"); - if (file == NULL) - return; - fclose(file); - - try - { - boost::property_tree::json_parser::read_json(fileName, m_ptree); - - readValue(m_ptree, "Name", sceneData.m_sceneName); - - sceneData.m_camPosition = Vector3r(5.0, 10.0, 30.0); - readVector(m_ptree, "cameraPosition", sceneData.m_camPosition); - sceneData.m_camLookat = Vector3r(5.0, 0.0, 0.0); - readVector(m_ptree, "cameraLookat", sceneData.m_camLookat); - - ////////////////////////////////////////////////////////////////////////// - // read general - ////////////////////////////////////////////////////////////////////////// - boost::optional child = m_ptree.get_child_optional("Simulation"); - if (child) - readSimulation(child, sceneData); - - ////////////////////////////////////////////////////////////////////////// - // read rigid bodies - ////////////////////////////////////////////////////////////////////////// - boost::filesystem::path basePath = boost::filesystem::path(fileName).parent_path(); - child = m_ptree.get_child_optional("RigidBodies"); - if (child) - readRigidBodies(child, basePath, sceneData); - - ////////////////////////////////////////////////////////////////////////// - // read triangle models - ////////////////////////////////////////////////////////////////////////// - child = m_ptree.get_child_optional("TriangleModels"); - if (child) - readTriangleModels(child, basePath, sceneData); - - ////////////////////////////////////////////////////////////////////////// - // read tet models - ////////////////////////////////////////////////////////////////////////// - child = m_ptree.get_child_optional("TetModels"); - if (child) - readTetModels(child, basePath, sceneData); - - ////////////////////////////////////////////////////////////////////////// - // read ball joints - ////////////////////////////////////////////////////////////////////////// - child = m_ptree.get_child_optional("BallJoints"); - if (child) - readBallJoints(child, sceneData); - - ////////////////////////////////////////////////////////////////////////// - // read ball-on-line joints - ////////////////////////////////////////////////////////////////////////// - child = m_ptree.get_child_optional("BallOnLineJoints"); - if (child) - readBallOnLineJoints(child, sceneData); - - ////////////////////////////////////////////////////////////////////////// - // read hinge joints - ////////////////////////////////////////////////////////////////////////// - child = m_ptree.get_child_optional("HingeJoints"); - if (child) - readHingeJoints(child, sceneData); - - ////////////////////////////////////////////////////////////////////////// - // read universal joints - ////////////////////////////////////////////////////////////////////////// - child = m_ptree.get_child_optional("UniversalJoints"); - if (child) - readUniversalJoints(child, sceneData); - - ////////////////////////////////////////////////////////////////////////// - // read slider joints - ////////////////////////////////////////////////////////////////////////// - child = m_ptree.get_child_optional("SliderJoints"); - if (child) - readSliderJoints(child, sceneData); - - ////////////////////////////////////////////////////////////////////////// - // read RigidBodyParticleBallJoints - ////////////////////////////////////////////////////////////////////////// - child = m_ptree.get_child_optional("RigidBodyParticleBallJoints"); - if (child) - readRigidBodyParticleBallJoints(child, sceneData); - - ////////////////////////////////////////////////////////////////////////// - // read TargetAngleMotorHingeJoint - ////////////////////////////////////////////////////////////////////////// - child = m_ptree.get_child_optional("TargetAngleMotorHingeJoints"); - if (child) - readTargetAngleMotorHingeJoints(child, sceneData); - - ////////////////////////////////////////////////////////////////////////// - // read TargetVelocityMotorHingeJoint - ////////////////////////////////////////////////////////////////////////// - child = m_ptree.get_child_optional("TargetVelocityMotorHingeJoints"); - if (child) - readTargetVelocityMotorHingeJoints(child, sceneData); - - ////////////////////////////////////////////////////////////////////////// - // read TargetPositionMotorSliderJoint - ////////////////////////////////////////////////////////////////////////// - child = m_ptree.get_child_optional("TargetPositionMotorSliderJoints"); - if (child) - readTargetPositionMotorSliderJoints(child, sceneData); - - ////////////////////////////////////////////////////////////////////////// - // read TargetVelocityMotorSliderJoint - ////////////////////////////////////////////////////////////////////////// - child = m_ptree.get_child_optional("TargetVelocityMotorSliderJoints"); - if (child) - readTargetVelocityMotorSliderJoints(child, sceneData); - } - catch (std::exception& e) - { - std::cout << e.what() << "\n"; - exit(1); - } -} - -void SceneLoader::readSimulation(const boost::optional child, SceneData &sceneData) -{ - sceneData.m_timeStepSize = 0.005; - readValue(child.get(), "timeStepSize", sceneData.m_timeStepSize); - - sceneData.m_gravity = Vector3r(0, -9.81, 0); - readVector(child.get(), "gravity", sceneData.m_gravity); - - sceneData.m_maxIter = 5; - readValue(child.get(), "maxIter", sceneData.m_maxIter); - - sceneData.m_maxIterVel = 5; - readValue(child.get(), "maxIterVel", sceneData.m_maxIterVel); - - sceneData.m_velocityUpdateMethod = 0; - readValue(child.get(), "velocityUpdateMethod", sceneData.m_velocityUpdateMethod); - - sceneData.m_triangleModelSimulationMethod = -1; - readValue(child.get(), "triangleModelSimulationMethod", sceneData.m_triangleModelSimulationMethod); - - sceneData.m_triangleModelBendingMethod = -1; - readValue(child.get(), "triangleModelBendingMethod", sceneData.m_triangleModelBendingMethod); - - sceneData.m_tetModelSimulationMethod = -1; - readValue(child.get(), "tetModelSimulationMethod", sceneData.m_tetModelSimulationMethod); - - sceneData.m_contactTolerance = 0.0; - readValue(child.get(), "contactTolerance", sceneData.m_contactTolerance); - - sceneData.m_contactStiffnessRigidBody = 1.0; - readValue(child.get(), "contactStiffnessRigidBody", sceneData.m_contactStiffnessRigidBody); - - sceneData.m_contactStiffnessParticleRigidBody = 100.0; - readValue(child.get(), "contactStiffnessParticleRigidBody", sceneData.m_contactStiffnessParticleRigidBody); - - // stiffness - sceneData.m_cloth_stiffness = 1.0; - readValue(child.get(), "cloth_stiffness", sceneData.m_cloth_stiffness); - - // bendingStiffness - sceneData.m_cloth_bendingStiffness = 0.01; - readValue(child.get(), "cloth_bendingStiffness", sceneData.m_cloth_bendingStiffness); - - // xxStiffness, yyStiffness, xyStiffness - sceneData.m_cloth_xxStiffness = 1.0; - sceneData.m_cloth_yyStiffness = 1.0; - sceneData.m_cloth_xyStiffness = 1.0; - readValue(child.get(), "cloth_xxStiffness", sceneData.m_cloth_xxStiffness); - readValue(child.get(), "cloth_yyStiffness", sceneData.m_cloth_yyStiffness); - readValue(child.get(), "cloth_xyStiffness", sceneData.m_cloth_xyStiffness); - - // xyPoissonRatio, yxPoissonRatio - sceneData.m_cloth_xyPoissonRatio = 0.3; - sceneData.m_cloth_yxPoissonRatio = 0.3; - readValue(child.get(), "cloth_xyPoissonRatio", sceneData.m_cloth_xyPoissonRatio); - readValue(child.get(), "cloth_yxPoissonRatio", sceneData.m_cloth_yxPoissonRatio); - - // normalize - sceneData.m_cloth_normalizeStretch = false; - sceneData.m_cloth_normalizeShear = false; - readValue(child.get(), "cloth_normalizeStretch", sceneData.m_cloth_normalizeStretch); - readValue(child.get(), "cloth_normalizeShear", sceneData.m_cloth_normalizeShear); - - // solid stiffness - sceneData.m_cloth_stiffness = 1.0; - readValue(child.get(), "solid_stiffness", sceneData.m_solid_stiffness); - - // Poisson ratio - sceneData.m_cloth_stiffness = 0.3; - readValue(child.get(), "solid_poissonRatio", sceneData.m_solid_poissonRatio); - - // normalize - sceneData.m_solid_normalizeStretch = false; - sceneData.m_solid_normalizeShear = false; - readValue(child.get(), "solid_normalizeStretch", sceneData.m_solid_normalizeStretch); - readValue(child.get(), "solid_normalizeShear", sceneData.m_solid_normalizeShear); -} - -void SceneLoader::readRigidBodies(const boost::optional child, const boost::filesystem::path &basePath, SceneData &sceneData) -{ - sceneData.m_rigidBodyData.reserve(5000); - BOOST_FOREACH(boost::property_tree::ptree::value_type &rigidBodies, child.get()) - { - std::string geomFileName; - if (readValue(rigidBodies.second, "geometryFile", geomFileName)) - { - boost::filesystem::path p(geomFileName); - if (p.is_relative()) - { - geomFileName = boost::filesystem::path(basePath / geomFileName).string(); - } - - RigidBodyData &rbd = sceneData.m_rigidBodyData.create(); - rbd.m_modelFile = geomFileName; - - // id - rbd.m_id = 0; - readValue(rigidBodies.second, "id", rbd.m_id); - - // is dynamic body - rbd.m_isDynamic = true; - readValue(rigidBodies.second, "isDynamic", rbd.m_isDynamic); - - // density - rbd.m_density = 1.0; - readValue(rigidBodies.second, "density", rbd.m_density); - - // translation - rbd.m_x.setZero(); - readVector(rigidBodies.second, "translation", rbd.m_x); - - // rotation axis - Vector3r axis; - axis.setZero(); - Real angle = 0.0; - if (readVector(rigidBodies.second, "rotationAxis", axis) && - readValue(rigidBodies.second, "rotationAngle", angle)) - { - axis.normalize(); - rbd.m_q = Quaternionr(AngleAxisr(angle, axis)); - } - else - rbd.m_q = Quaternionr(1.0, 0.0, 0.0, 0.0); - - // scale - rbd.m_scale = Vector3r(1.0, 1.0, 1.0); - readVector(rigidBodies.second, "scale", rbd.m_scale); - - // velocity - rbd.m_v.setZero(); - readVector(rigidBodies.second, "velocity", rbd.m_v); - - // angular velocity - rbd.m_omega.setZero(); - readVector(rigidBodies.second, "angularVelocity", rbd.m_omega); - - // restitution - rbd.m_restitutionCoeff = 0.6; - readValue(rigidBodies.second, "restitution", rbd.m_restitutionCoeff); - - // friction - rbd.m_frictionCoeff = 0.2; - readValue(rigidBodies.second, "friction", rbd.m_frictionCoeff); - - // collision object type - rbd.m_collisionObjectType = RigidBodyData::CollisionObjectTypes::No_Collision_Object; - readValue(rigidBodies.second, "collisionObjectType", rbd.m_collisionObjectType); - - // test mesh - rbd.m_testMesh = true; - readValue(rigidBodies.second, "testMesh", rbd.m_testMesh); - - // scale - rbd.m_collisionObjectScale = Vector3r(1.0, 1.0, 1.0); - readVector(rigidBodies.second, "collisionObjectScale", rbd.m_collisionObjectScale); - - rbd.pt = &rigidBodies.second; - } - } -} - -void SceneLoader::readTriangleModels(const boost::optional child, const boost::filesystem::path &basePath, SceneData &sceneData) -{ - BOOST_FOREACH(boost::property_tree::ptree::value_type &triModels, child.get()) - { - std::string geomFileName; - if (readValue(triModels.second, "geometryFile", geomFileName)) - { - boost::filesystem::path p(geomFileName); - if (p.is_relative()) - { - geomFileName = boost::filesystem::path(basePath / geomFileName).string(); - } - - TriangleModelData &data = sceneData.m_triangleModelData.create(); - data.m_modelFile = geomFileName; - - // id - data.m_id = 0; - readValue(triModels.second, "id", data.m_id); - - // translation - data.m_x.setZero(); - readVector(triModels.second, "translation", data.m_x); - - // rotation axis - Vector3r axis; - axis.setZero(); - Real angle = 0.0; - if (readVector(triModels.second, "rotationAxis", axis) && - readValue(triModels.second, "rotationAngle", angle)) - { - axis.normalize(); - data.m_q = Quaternionr(AngleAxisr(angle, axis)); - } - else - data.m_q = Quaternionr(1.0, 0.0, 0.0, 0.0); - - // scale - data.m_scale = Vector3r(1.0, 1.0, 1.0); - readVector(triModels.second, "scale", data.m_scale); - - // static particles - unsigned int index = 0; - boost::optional child2 = triModels.second.get_child_optional("staticParticles"); - if (child2) - { - data.m_staticParticles.reserve((unsigned int)child2.get().size()); - for (auto& item : child2.get()) - data.m_staticParticles.push_back(item.second.get_value()); - } - - // restitution - data.m_restitutionCoeff = 0.1; - readValue(triModels.second, "restitution", data.m_restitutionCoeff); - - // friction - data.m_frictionCoeff = 0.2; - readValue(triModels.second, "friction", data.m_frictionCoeff); - - data.pt = &triModels.second; - } - } -} - -void SceneLoader::readTetModels(const boost::optional child, const boost::filesystem::path &basePath, SceneData &sceneData) -{ - BOOST_FOREACH(boost::property_tree::ptree::value_type &tetModels, child.get()) - { - std::string nodeFileName, eleFileName; - if (readValue(tetModels.second, "nodeFile", nodeFileName) && - readValue(tetModels.second, "eleFile", eleFileName)) - { - boost::filesystem::path pNode(nodeFileName); - if (pNode.is_relative()) - { - nodeFileName = boost::filesystem::path(basePath / nodeFileName).string(); - } - - boost::filesystem::path pEle(eleFileName); - if (pEle.is_relative()) - { - eleFileName = boost::filesystem::path(basePath / eleFileName).string(); - } - - std::string visFileName = ""; - if (readValue(tetModels.second, "visFile", visFileName)) - { - boost::filesystem::path pVis(visFileName); - if (pVis.is_relative()) - { - visFileName = boost::filesystem::path(basePath / visFileName).string(); - } - } - - TetModelData &data = sceneData.m_tetModelData.create(); - data.m_modelFileNodes = nodeFileName; - data.m_modelFileElements = eleFileName; - data.m_modelFileVis = visFileName; - - // id - data.m_id = 0; - readValue(tetModels.second, "id", data.m_id); - - // translation - data.m_x.setZero(); - readVector(tetModels.second, "translation", data.m_x); - - // rotation axis - Vector3r axis; - axis.setZero(); - Real angle = 0.0; - if (readVector(tetModels.second, "rotationAxis", axis) && - readValue(tetModels.second, "rotationAngle", angle)) - { - axis.normalize(); - data.m_q = Quaternionr(AngleAxisr(angle, axis)); - } - else - data.m_q = Quaternionr(1.0, 0.0, 0.0, 0.0); - - // scale - data.m_scale = Vector3r(1.0, 1.0, 1.0); - readVector(tetModels.second, "scale", data.m_scale); - - // static particles - unsigned int index = 0; - boost::optional child2 = tetModels.second.get_child_optional("staticParticles"); - if (child2) - { - data.m_staticParticles.reserve((unsigned int)child2.get().size()); - for (auto& item : child2.get()) - data.m_staticParticles.push_back(item.second.get_value()); - } - - // restitution - data.m_restitutionCoeff = 0.1; - readValue(tetModels.second, "restitution", data.m_restitutionCoeff); - - // friction - data.m_frictionCoeff = 0.2; - readValue(tetModels.second, "friction", data.m_frictionCoeff); - - data.pt = &tetModels.second; - } - } -} - -void SceneLoader::readBallJoints(const boost::optional child, SceneData &sceneData) -{ - BOOST_FOREACH(boost::property_tree::ptree::value_type &joints, child.get()) - { - BallJointData jd; - if (readValue(joints.second, "bodyID1", jd.m_bodyID[0]) && - readValue(joints.second, "bodyID2", jd.m_bodyID[1]) && - readVector(joints.second, "position", jd.m_position)) - { - sceneData.m_ballJointData.push_back(jd); - } - } -} - - -void SceneLoader::readBallOnLineJoints(const boost::optional child, SceneData &sceneData) -{ - BOOST_FOREACH(boost::property_tree::ptree::value_type &joints, child.get()) - { - BallOnLineJointData jd; - if (readValue(joints.second, "bodyID1", jd.m_bodyID[0]) && - readValue(joints.second, "bodyID2", jd.m_bodyID[1]) && - readVector(joints.second, "position", jd.m_position) && - readVector(joints.second, "axis", jd.m_axis)) - { - sceneData.m_ballOnLineJointData.push_back(jd); - } - } -} - -void SceneLoader::readHingeJoints(const boost::optional child, SceneData &sceneData) -{ - BOOST_FOREACH(boost::property_tree::ptree::value_type &joints, child.get()) - { - HingeJointData jd; - if (readValue(joints.second, "bodyID1", jd.m_bodyID[0]) && - readValue(joints.second, "bodyID2", jd.m_bodyID[1]) && - readVector(joints.second, "position", jd.m_position) && - readVector(joints.second, "axis", jd.m_axis)) - { - sceneData.m_hingeJointData.push_back(jd); - } - } -} - -void SceneLoader::readUniversalJoints(const boost::optional child, SceneData &sceneData) -{ - BOOST_FOREACH(boost::property_tree::ptree::value_type &joints, child.get()) - { - UniversalJointData jd; - if (readValue(joints.second, "bodyID1", jd.m_bodyID[0]) && - readValue(joints.second, "bodyID2", jd.m_bodyID[1]) && - readVector(joints.second, "position", jd.m_position) && - readVector(joints.second, "axis1", jd.m_axis[0]) && - readVector(joints.second, "axis2", jd.m_axis[1])) - { - sceneData.m_universalJointData.push_back(jd); - } - } -} - -void SceneLoader::readSliderJoints(const boost::optional child, SceneData &sceneData) -{ - BOOST_FOREACH(boost::property_tree::ptree::value_type &joints, child.get()) - { - SliderJointData jd; - if (readValue(joints.second, "bodyID1", jd.m_bodyID[0]) && - readValue(joints.second, "bodyID2", jd.m_bodyID[1]) && - readVector(joints.second, "position", jd.m_position) && - readVector(joints.second, "axis", jd.m_axis)) - { - sceneData.m_sliderJointData.push_back(jd); - } - } -} - -void SceneLoader::readRigidBodyParticleBallJoints(const boost::optional child, SceneData &sceneData) -{ - BOOST_FOREACH(boost::property_tree::ptree::value_type &joints, child.get()) - { - RigidBodyParticleBallJointData jd; - if (readValue(joints.second, "rbID", jd.m_bodyID[0]) && - readValue(joints.second, "particleID", jd.m_bodyID[1])) - { - sceneData.m_rigidBodyParticleBallJointData.push_back(jd); - } - } -} - -void SceneLoader::readTargetAngleMotorHingeJoints(const boost::optional child, SceneData &sceneData) -{ - BOOST_FOREACH(boost::property_tree::ptree::value_type &joints, child.get()) - { - TargetAngleMotorHingeJointData jd; - if (readValue(joints.second, "bodyID1", jd.m_bodyID[0]) && - readValue(joints.second, "bodyID2", jd.m_bodyID[1]) && - readVector(joints.second, "position", jd.m_position) && - readVector(joints.second, "axis", jd.m_axis) && - readValue(joints.second, "target", jd.m_target)) - { - sceneData.m_targetAngleMotorHingeJointData.push_back(jd); - } - } -} - -void SceneLoader::readTargetVelocityMotorHingeJoints(const boost::optional child, SceneData &sceneData) -{ - BOOST_FOREACH(boost::property_tree::ptree::value_type &joints, child.get()) - { - TargetVelocityMotorHingeJointData jd; - if (readValue(joints.second, "bodyID1", jd.m_bodyID[0]) && - readValue(joints.second, "bodyID2", jd.m_bodyID[1]) && - readVector(joints.second, "position", jd.m_position) && - readVector(joints.second, "axis", jd.m_axis) && - readValue(joints.second, "target", jd.m_target)) - { - sceneData.m_targetVelocityMotorHingeJointData.push_back(jd); - } - } -} - -void SceneLoader::readTargetPositionMotorSliderJoints(const boost::optional child, SceneData &sceneData) -{ - BOOST_FOREACH(boost::property_tree::ptree::value_type &joints, child.get()) - { - TargetPositionMotorSliderJointData jd; - if (readValue(joints.second, "bodyID1", jd.m_bodyID[0]) && - readValue(joints.second, "bodyID2", jd.m_bodyID[1]) && - readVector(joints.second, "position", jd.m_position) && - readVector(joints.second, "axis", jd.m_axis) && - readValue(joints.second, "target", jd.m_target)) - { - sceneData.m_targetPositionMotorSliderJointData.push_back(jd); - } - } -} - -void SceneLoader::readTargetVelocityMotorSliderJoints(const boost::optional child, SceneData &sceneData) -{ - BOOST_FOREACH(boost::property_tree::ptree::value_type &joints, child.get()) - { - TargetVelocityMotorSliderJointData jd; - if (readValue(joints.second, "bodyID1", jd.m_bodyID[0]) && - readValue(joints.second, "bodyID2", jd.m_bodyID[1]) && - readVector(joints.second, "position", jd.m_position) && - readVector(joints.second, "axis", jd.m_axis) && - readValue(joints.second, "target", jd.m_target)) - { - sceneData.m_targetVelocityMotorSliderJointData.push_back(jd); - } - } -} \ No newline at end of file diff --git a/Demos/Utils/SceneLoader.h b/Demos/Utils/SceneLoader.h deleted file mode 100644 index 1c0a56d2..00000000 --- a/Demos/Utils/SceneLoader.h +++ /dev/null @@ -1,249 +0,0 @@ -#ifndef __SCENELOADER_H__ -#define __SCENELOADER_H__ - -#include "Demos/Common/Config.h" -#include -#include "ObjectArray.h" -#include -#include "Common/Common.h" -#include - -namespace PBD -{ - class SceneLoader - { - protected: - boost::property_tree::ptree m_ptree; - - public: - struct RigidBodyData - { - enum CollisionObjectTypes {No_Collision_Object=0, Sphere, Box, Cylinder, Torus}; - unsigned int m_id; - std::string m_modelFile; - bool m_isDynamic; - Real m_density; - Vector3r m_x; - Quaternionr m_q; - Vector3r m_scale; - Vector3r m_v; - Vector3r m_omega; - Real m_restitutionCoeff; - Real m_frictionCoeff; - int m_collisionObjectType; - bool m_testMesh; - Vector3r m_collisionObjectScale; - boost::property_tree::ptree *pt; - }; - - struct TriangleModelData - { - unsigned int m_id; - std::string m_modelFile; - Vector3r m_x; - Quaternionr m_q; - Vector3r m_scale; - ObjectArray m_staticParticles; - Real m_restitutionCoeff; - Real m_frictionCoeff; - boost::property_tree::ptree *pt; - }; - - struct TetModelData - { - unsigned int m_id; - std::string m_modelFileTet; - std::string m_modelFileNodes; - std::string m_modelFileElements; - std::string m_modelFileVis; - Vector3r m_x; - Quaternionr m_q; - Vector3r m_scale; - ObjectArray m_staticParticles; - Real m_restitutionCoeff; - Real m_frictionCoeff; - boost::property_tree::ptree *pt; - }; - - struct BallJointData - { - unsigned int m_bodyID[2]; - Vector3r m_position; - }; - - struct BallOnLineJointData - { - unsigned int m_bodyID[2]; - Vector3r m_position; - Vector3r m_axis; - }; - - struct HingeJointData - { - unsigned int m_bodyID[2]; - Vector3r m_position; - Vector3r m_axis; - }; - - struct UniversalJointData - { - unsigned int m_bodyID[2]; - Vector3r m_position; - Vector3r m_axis[2]; - }; - - struct SliderJointData - { - unsigned int m_bodyID[2]; - Vector3r m_position; - Vector3r m_axis; - }; - - struct RigidBodyParticleBallJointData - { - unsigned int m_bodyID[2]; - }; - - struct TargetAngleMotorHingeJointData - { - unsigned int m_bodyID[2]; - Vector3r m_position; - Vector3r m_axis; - Real m_target; - }; - - struct TargetVelocityMotorHingeJointData - { - unsigned int m_bodyID[2]; - Vector3r m_position; - Vector3r m_axis; - Real m_target; - }; - - struct TargetPositionMotorSliderJointData - { - unsigned int m_bodyID[2]; - Vector3r m_position; - Vector3r m_axis; - Real m_target; - }; - - struct TargetVelocityMotorSliderJointData - { - unsigned int m_bodyID[2]; - Vector3r m_position; - Vector3r m_axis; - Real m_target; - }; - - struct SceneData - { - enum TriangleModelSimulationMethodTypes { No_Simulation_Method = 0, Distance_Constraints, FEM_Based_PBD, Strain_Based_Dynamics }; - enum TriangleModelBendingMethodTypes { No_Bending_Method = 0, Dihedral_Angle, Isometric_Bending }; - enum VelocityUpdateMethodTypes { First_Order_Update = 0, Second_Order_Update }; - - std::string m_sceneName; - Vector3r m_camPosition; - Vector3r m_camLookat; - - Real m_timeStepSize; - Vector3r m_gravity; - Real m_contactTolerance; - int m_triangleModelSimulationMethod; - int m_triangleModelBendingMethod; - int m_tetModelSimulationMethod; - Real m_contactStiffnessRigidBody; - Real m_contactStiffnessParticleRigidBody; - - unsigned int m_velocityUpdateMethod; - unsigned int m_maxIter; - unsigned int m_maxIterVel; - - Real m_cloth_stiffness; - Real m_cloth_bendingStiffness; - Real m_cloth_xxStiffness; - Real m_cloth_yyStiffness; - Real m_cloth_xyStiffness; - Real m_cloth_xyPoissonRatio; - Real m_cloth_yxPoissonRatio; - bool m_cloth_normalizeStretch; - bool m_cloth_normalizeShear; - - Real m_solid_stiffness; - Real m_solid_poissonRatio; - bool m_solid_normalizeStretch; - bool m_solid_normalizeShear; - - ObjectArray m_rigidBodyData; - ObjectArray m_triangleModelData; - ObjectArray m_tetModelData; - ObjectArray m_ballJointData; - ObjectArray m_ballOnLineJointData; - ObjectArray m_hingeJointData; - ObjectArray m_universalJointData; - ObjectArray m_sliderJointData; - ObjectArray m_rigidBodyParticleBallJointData; - ObjectArray m_targetAngleMotorHingeJointData; - ObjectArray m_targetVelocityMotorHingeJointData; - ObjectArray m_targetPositionMotorSliderJointData; - ObjectArray m_targetVelocityMotorSliderJointData; - }; - - void readScene(const std::string &fileName, SceneData &sceneData); - void readSimulation(const boost::optional child, SceneData &sceneData); - void readRigidBodies(const boost::optional child, const boost::filesystem::path &basePath, SceneData &sceneData); - void readTriangleModels(const boost::optional child, const boost::filesystem::path &basePath, SceneData &sceneData); - void readTetModels(const boost::optional child, const boost::filesystem::path &basePath, SceneData &sceneData); - void readBallJoints(const boost::optional child, SceneData &sceneData); - void readBallOnLineJoints(const boost::optional child, SceneData &sceneData); - void readHingeJoints(const boost::optional child, SceneData &sceneData); - void readUniversalJoints(const boost::optional child, SceneData &sceneData); - void readSliderJoints(const boost::optional child, SceneData &sceneData); - void readRigidBodyParticleBallJoints(const boost::optional child, SceneData &sceneData); - void readTargetAngleMotorHingeJoints(const boost::optional child, SceneData &sceneData); - void readTargetVelocityMotorHingeJoints(const boost::optional child, SceneData &sceneData); - void readTargetPositionMotorSliderJoints(const boost::optional child, SceneData &sceneData); - void readTargetVelocityMotorSliderJoints(const boost::optional child, SceneData &sceneData); - - template - static bool readValue(const boost::property_tree::ptree &pt, const boost::property_tree::ptree::key_type &key, T &v); - - template - static bool readVector(const boost::property_tree::ptree &pt, const boost::property_tree::ptree::key_type &key, Eigen::Matrix &vec); - }; - - template - bool SceneLoader::readValue(const boost::property_tree::ptree &pt, const boost::property_tree::ptree::key_type &key, T &v) - { - boost::optional val = pt.get_optional(key); - if (val.is_initialized()) - { - v = val.get(); - return true; - } - return false; - } - - template - bool SceneLoader::readVector(const boost::property_tree::ptree &pt, const boost::property_tree::ptree::key_type &key, Eigen::Matrix &vec) - { - unsigned int index = 0; - boost::optional child = pt.get_child_optional(key); - if (child) - { - vec.setZero(); - for (auto& item : child.get()) - { - vec[index++] = item.second.get_value(); - if (index >= size) - break; - } - return true; - } - return false; - } - - -} - -#endif \ No newline at end of file diff --git a/Demos/Utils/Utilities.cpp b/Demos/Utils/Utilities.cpp deleted file mode 100644 index aa6386ef..00000000 --- a/Demos/Utils/Utilities.cpp +++ /dev/null @@ -1,21 +0,0 @@ -#include "Utilities.h" - -using namespace PBD; -using namespace std; - -string Utilities::getFilePath(const string &path) -{ - string result = path; - size_t i = path.rfind('\\', path.length()); - if (i != string::npos) - { - result = path.substr(0, i + 1); - } - i = result.rfind('/', result.length()); - if (i != string::npos) - { - result = (result.substr(0, i + 1)); - } - - return result; -} diff --git a/Demos/Utils/Utilities.h b/Demos/Utils/Utilities.h deleted file mode 100644 index f0015d86..00000000 --- a/Demos/Utils/Utilities.h +++ /dev/null @@ -1,17 +0,0 @@ -#ifndef __UTILITIES_H__ -#define __UTILITIES_H__ - -#include - -namespace PBD -{ - class Utilities - { - public: - /** Extracts the path of a file. - */ - static std::string getFilePath(const std::string &path); - }; -} - -#endif \ No newline at end of file diff --git a/Demos/Visualization/CMakeLists.txt b/Demos/Visualization/CMakeLists.txt index a08a9232..2331f05e 100644 --- a/Demos/Visualization/CMakeLists.txt +++ b/Demos/Visualization/CMakeLists.txt @@ -1,5 +1,3 @@ -include_directories(${PROJECT_PATH}/extern/freeglut/include) - set(VIS_HEADER_FILES ${PROJECT_PATH}/Demos/Visualization/MiniGL.h ${PROJECT_PATH}/Demos/Visualization/Selection.h @@ -9,6 +7,7 @@ set(VIS_HEADER_FILES set(VIS_SOURCE_FILES + ${PROJECT_SOURCE_DIR}/extern/glfw/deps/glad_gl.c ${PROJECT_PATH}/Demos/Visualization/MiniGL.cpp ${PROJECT_PATH}/Demos/Visualization/Shader.cpp ) diff --git a/Demos/Visualization/MiniGL.cpp b/Demos/Visualization/MiniGL.cpp index 64b05459..46b7ac6e 100644 --- a/Demos/Visualization/MiniGL.cpp +++ b/Demos/Visualization/MiniGL.cpp @@ -6,7 +6,10 @@ #include #endif -#include "GL/glew.h" +#include + +#define GLFW_INCLUDE_NONE +#include #ifdef __APPLE__ #include @@ -16,63 +19,61 @@ #include "GL/glu.h" #endif -#include "GL/glut.h" -#include "GL/freeglut_ext.h" - #define _USE_MATH_DEFINES #include "math.h" #include +#include "Utils/Logger.h" using namespace PBD; float MiniGL::fovy = 45; float MiniGL::znear = 0.5f; float MiniGL::zfar = 1000; -void (*MiniGL::scenefunc)(void) = NULL; -void (*MiniGL::idlefunc)(void) = NULL; +MiniGL::SceneFct MiniGL::scenefunc = nullptr; +MiniGL::IdleFct MiniGL::idlefunc = nullptr; +MiniGL::DestroyFct MiniGL::destroyfunc = nullptr; void (*MiniGL::exitfunc)(void) = NULL; -int MiniGL::idlefunchz = 0; -int MiniGL::width = 0; -int MiniGL::height = 0; +int MiniGL::m_width = 0; +int MiniGL::m_height = 0; Quaternionr MiniGL::m_rotation; Real MiniGL::m_zoom = 1.0; Vector3r MiniGL::m_translation; Real MiniGL::movespeed = 1.0; Real MiniGL::turnspeed = 0.01; int MiniGL::mouse_button = -1; +double MiniGL::mouse_wheel_pos = 0; int MiniGL::modifier_key = 0; -int MiniGL::mouse_pos_x_old = 0; -int MiniGL::mouse_pos_y_old = 0; -void (*MiniGL::keyfunc [MAX_KEY_FUNC])(void) = {NULL, NULL}; -unsigned char MiniGL::key [MAX_KEY_FUNC] = {0,0}; -int MiniGL::numberOfKeyFunc = 0; +double MiniGL::mouse_pos_x_old = 0; +double MiniGL::mouse_pos_y_old = 0; +std::vector MiniGL::keyfunc; int MiniGL::drawMode = GL_FILL; -TwBar *MiniGL::m_tweakBar = NULL; -Real MiniGL::m_time = 0.0; -Real MiniGL::m_quat[4] = { 0.0f, 0.0f, 0.0f, 1.0f }; unsigned char MiniGL::texData[IMAGE_ROWS][IMAGE_COLS][3]; unsigned int MiniGL::m_texId = 0; -void(*MiniGL::selectionfunc)(const Eigen::Vector2i&, const Eigen::Vector2i&) = NULL; -void(*MiniGL::mousefunc)(int, int) = NULL; +void(*MiniGL::selectionfunc)(const Vector2i&, const Vector2i&, void*) = NULL; +void *MiniGL::selectionfuncClientData = NULL; +void(*MiniGL::mousefunc)(int, int, void*) = NULL; int MiniGL::mouseFuncButton; -Eigen::Vector2i MiniGL::m_selectionStart; +Vector2i MiniGL::m_selectionStart; GLint MiniGL::m_context_major_version = 0; GLint MiniGL::m_context_minor_version = 0; GLint MiniGL::m_context_profile = 0; bool MiniGL::m_breakPointActive = true; bool MiniGL::m_breakPointLoop = false; -ObjectArray MiniGL::m_drawTriangle; -ObjectArray MiniGL::m_drawLines; -ObjectArray MiniGL::m_drawPoints; - - +GLUquadricObj* MiniGL::m_sphereQuadric = nullptr; +std::vector MiniGL::m_reshapeFct; +std::vector MiniGL::m_keyboardFct; +std::vector MiniGL::m_charFct; +std::vector MiniGL::m_mousePressFct; +std::vector MiniGL::m_mouseMoveFct; +std::vector MiniGL::m_mouseWheelFct; +GLFWwindow* MiniGL::m_glfw_window = nullptr; +std::vector MiniGL::m_drawTriangle; +std::vector MiniGL::m_drawLines; +std::vector MiniGL::m_drawPoints; +bool MiniGL::m_vsync = false; +double MiniGL::m_lastTime; -void MiniGL::drawTime( const Real time ) -{ - m_time = (Real) time; - TwRefreshBar(m_tweakBar); -} void MiniGL::bindTexture() { @@ -149,9 +150,6 @@ void MiniGL::drawVector(const Vector3r &a, const Vector3r &b, const float w, flo glLineWidth (1); } -/** -* Renders a closed cylinder between two points. -*/ void MiniGL::drawCylinder(const Vector3r &a, const Vector3r &b, const float *color, const float radius, const unsigned int subdivisions) { float speccolor[4] = { 1.0, 1.0, 1.0, 1.0 }; @@ -168,7 +166,7 @@ void MiniGL::drawCylinder(const Vector3r &a, const Vector3r &b, const float *col if (vz == 0) vz = .00000001; Real v = sqrt(vx*vx + vy*vy + vz*vz); - Real ax = 57.2957795*acos(vz / v); + Real ax = static_cast(57.2957795)*acos(vz / v); if (vz < 0.0) ax = -ax; Real rx = -vy*vz; @@ -203,25 +201,16 @@ void MiniGL::drawSphere(const Vector3r &translation, float radius, float *color, glMaterialf (GL_FRONT_AND_BACK, GL_SHININESS, 100.0); glColor3fv(color); + if (m_sphereQuadric == nullptr) + { + m_sphereQuadric = gluNewQuadric(); + gluQuadricNormals(m_sphereQuadric, GLU_SMOOTH); + } + glPushMatrix (); glTranslated ((translation)[0], (translation)[1], (translation)[2]); - glutSolidSphere(radius, subDivision, subDivision); - glPopMatrix (); -} - -void MiniGL::drawTorus(const Vector3r &translation, float innerRadius, float outerRadius, float *color, const unsigned int nsides, const unsigned int rings) -{ - float speccolor[4] = { 1.0, 1.0, 1.0, 1.0 }; - glMaterialfv(GL_FRONT_AND_BACK, GL_AMBIENT, color); - glMaterialfv(GL_FRONT_AND_BACK, GL_DIFFUSE, color); - glMaterialfv(GL_FRONT_AND_BACK, GL_SPECULAR, speccolor); - glMaterialf(GL_FRONT_AND_BACK, GL_SHININESS, 100.0); - glColor3fv(color); - glPushMatrix(); - glTranslated((translation)[0], (translation)[1], (translation)[2]); - glRotated(90.0, 1.0, 0.0, 0.0); - glutSolidTorus(innerRadius, outerRadius, nsides, rings); + gluSphere(m_sphereQuadric, radius, subDivision, subDivision); glPopMatrix(); } @@ -243,75 +232,52 @@ void MiniGL::drawPoint(const Vector3r &translation, const float pointSize, const glPointSize(1); } - -void MiniGL::drawCube(const Vector3r &translation, const Matrix3r &rotation, float width, float height, float depth, float *color) +void MiniGL::drawMesh(const std::vector &vertices, const std::vector &faces, + const std::vector &vertexNormals, const float * const color) { - float speccolor [4] = {1.0, 1.0, 1.0, 1.0}; - glMaterialfv (GL_FRONT_AND_BACK, GL_AMBIENT, color); - glMaterialfv (GL_FRONT_AND_BACK, GL_DIFFUSE, color); - glMaterialfv (GL_FRONT_AND_BACK, GL_SPECULAR, speccolor); - glMaterialf (GL_FRONT_AND_BACK, GL_SHININESS, 100.0); - - Real val[16]; - val[0] = width*(rotation)(0,0); val[1] = width*(rotation)(0,1); val[2] = width*(rotation)(0,2); val[3] = 0; - val[4] = height*(rotation)(1,0); val[5] = height*(rotation)(1,1); val[6] = height*(rotation)(1,2); val[7] = 0; - val[8] = depth*(rotation)(2,0); val[9] = depth*(rotation)(2,1); val[10] = depth*(rotation)(2,2); val[11] = 0; - val[12] = (translation)[0]; val[13] = (translation)[1]; val[14] = (translation)[2]; val[15] = 1; - - glPushMatrix (); - glMultMatrix (val); - glutSolidCube(1.0); - glPopMatrix (); -} - - -void MiniGL::drawBitmapText(float x, float y, const char *str, int strLength, float *color) -{ - float speccolor[4] = { 1.0, 1.0, 1.0, 1.0 }; - glMaterialfv (GL_FRONT_AND_BACK, GL_AMBIENT, color); - glMaterialfv (GL_FRONT_AND_BACK, GL_DIFFUSE, color); - glMaterialfv (GL_FRONT_AND_BACK, GL_SPECULAR, speccolor); - glMaterialf (GL_FRONT_AND_BACK, GL_SHININESS, 100.0); - - glPushMatrix (); - glLoadIdentity (); - glMatrixMode (GL_PROJECTION); - glPushMatrix (); - glLoadIdentity (); - glMatrixMode (GL_MODELVIEW); - glRasterPos2f (x,y); - - for (int i=0; i < strLength; i++) - glutBitmapCharacter(GLUT_BITMAP_TIMES_ROMAN_24, str[i]); - glMatrixMode (GL_PROJECTION); - glPopMatrix (); - glMatrixMode (GL_MODELVIEW); - glPopMatrix (); -} - -void MiniGL::drawStrokeText(const Real x, const Real y, const Real z, float scale, const char *str, int strLength, float *color) -{ - float speccolor[4] = { 1.0, 1.0, 1.0, 1.0 }; - glMaterialfv (GL_FRONT_AND_BACK, GL_AMBIENT, color); - glMaterialfv (GL_FRONT_AND_BACK, GL_DIFFUSE, color); - glMaterialfv (GL_FRONT_AND_BACK, GL_SPECULAR, speccolor); - glMaterialf (GL_FRONT_AND_BACK, GL_SHININESS, 100.0); - - glPushMatrix (); - glTranslate (x, y, z); - glScalef (scale, scale, scale); + // draw mesh + if (MiniGL::checkOpenGLVersion(3, 3)) + { + glEnableVertexAttribArray(0); + glVertexAttribPointer(0, 3, GL_REAL, GL_FALSE, 0, &vertices[0][0]); + if (vertexNormals.size() > 0) + { + glEnableVertexAttribArray(2); + glVertexAttribPointer(2, 3, GL_REAL, GL_FALSE, 0, &vertexNormals[0][0]); + } + } + else + { + float speccolor[4] = { 1.0, 1.0, 1.0, 1.0 }; + glMaterialfv(GL_FRONT_AND_BACK, GL_AMBIENT, color); + glMaterialfv(GL_FRONT_AND_BACK, GL_DIFFUSE, color); + glMaterialfv(GL_FRONT_AND_BACK, GL_SPECULAR, speccolor); + glMaterialf(GL_FRONT_AND_BACK, GL_SHININESS, 100.0f); + glColor3fv(color); + + glEnableClientState(GL_VERTEX_ARRAY); + glVertexPointer(3, GL_REAL, 0, &vertices[0][0]); + if (vertexNormals.size() > 0) + { + glEnableClientState(GL_NORMAL_ARRAY); + glNormalPointer(GL_REAL, 0, &vertexNormals[0][0]); + } + } - for (int i=0; i < strLength; i++) - glutStrokeCharacter(GLUT_STROKE_ROMAN, str[i]); - glPopMatrix (); -} + glDrawElements(GL_TRIANGLES, (GLsizei) faces.size(), GL_UNSIGNED_INT, faces.data()); -void MiniGL::drawStrokeText(const Vector3r &pos, float scale, const char *str, int strLength, float *color) -{ - drawStrokeText(pos[0], pos[1], pos[2], scale, str, strLength, color); + if (MiniGL::checkOpenGLVersion(3, 3)) + { + glDisableVertexAttribArray(0); + glDisableVertexAttribArray(2); + } + else + { + glDisableClientState(GL_VERTEX_ARRAY); + glDisableClientState(GL_NORMAL_ARRAY); + } } - void MiniGL::drawQuad(const Vector3r &a, const Vector3r &b, const Vector3r &c, const Vector3r &d, const Vector3r &norm, float *color) { float speccolor[4] = { 1.0, 1.0, 1.0, 1.0 }; @@ -345,8 +311,6 @@ void MiniGL::drawTriangle (const Vector3r &a, const Vector3r &b, const Vector3r glEnd (); } -/** Draw a tetrahedron. - */ void MiniGL::drawTetrahedron(const Vector3r &a, const Vector3r &b, const Vector3r &c, const Vector3r &d, float *color) { Vector3r normal1 = (b-a).cross(c-a); @@ -359,6 +323,64 @@ void MiniGL::drawTetrahedron(const Vector3r &a, const Vector3r &b, const Vector3 drawTriangle(b, c, d, normal4, color); } +void MiniGL::drawGrid_xz(float *color) +{ + float speccolor[4] = { 1.0, 1.0, 1.0, 1.0 }; + glMaterialfv(GL_FRONT_AND_BACK, GL_AMBIENT, color); + glMaterialfv(GL_FRONT_AND_BACK, GL_DIFFUSE, color); + glMaterialfv(GL_FRONT_AND_BACK, GL_SPECULAR, speccolor); + glMaterialf(GL_FRONT_AND_BACK, GL_SHININESS, 100.0); + + const int size = 5; + + glBegin(GL_LINES); + for (int i = -size; i <= size; i++) + { + glVertex3f((float) i, 0.0f, (float) -size); + glVertex3f((float) i, 0.0f, (float) size); + glVertex3f((float) -size, 0.0f, (float) i); + glVertex3f((float) size, 0.0f, (float) i); + } + glEnd(); + + glLineWidth(3.0f); + glBegin(GL_LINES); + glVertex3f((float)-size, 0.0f, 0.0f); + glVertex3f((float)size, 0.0f, 0.0f); + glVertex3f(0.0f, 0.0f, (float) -size); + glVertex3f(0.0f, 0.0f, (float) size); + glEnd(); +} + +void MiniGL::drawGrid_xy(float *color) +{ + float speccolor[4] = { 1.0, 1.0, 1.0, 1.0 }; + glMaterialfv(GL_FRONT_AND_BACK, GL_AMBIENT, color); + glMaterialfv(GL_FRONT_AND_BACK, GL_DIFFUSE, color); + glMaterialfv(GL_FRONT_AND_BACK, GL_SPECULAR, speccolor); + glMaterialf(GL_FRONT_AND_BACK, GL_SHININESS, 100.0); + + const int size = 5; + + glBegin(GL_LINES); + for (int i = -size; i <= size; i++) + { + glVertex3f((float)i, (float)-size, 0.0f ); + glVertex3f((float)i, (float)size, 0.0f); + glVertex3f((float)-size, (float)i, 0.0f); + glVertex3f((float)size, (float)i, 0.0f); + } + glEnd(); + + glLineWidth(3.0f); + glBegin(GL_LINES); + glVertex3f((float)-size, 0.0f, 0.0f); + glVertex3f((float)size, 0.0f, 0.0f); + glVertex3f(0.0f, (float)-size, 0.0f); + glVertex3f(0.0f, (float)size, 0.0f); + glEnd(); +} + void MiniGL::setViewport(float pfovy, float pznear, float pzfar, const Vector3r &peyepoint, const Vector3r &plookat) { fovy = pfovy; @@ -400,73 +422,61 @@ void MiniGL::setViewport(float pfovy, float pznear, float pzfar) zfar = pzfar; } -void MiniGL::setClientSceneFunc (void (*func)(void)) +void MiniGL::setClientSceneFunc (SceneFct func) { scenefunc = func; } -void MiniGL::display () -{ - glPolygonMode (GL_FRONT_AND_BACK, drawMode); - viewport (); - - drawElements(); - - if (scenefunc != NULL) - scenefunc (); - - TwDraw(); // draw the tweak bar(s) - glutSwapBuffers(); -} - -void MiniGL::init(int argc, char **argv, const int width, const int height, const int posx, const int posy, const char *name) +void MiniGL::init(int argc, char **argv, const int width, const int height, const char *name, const bool vsync, const bool maximized) { fovy = 60; znear = 0.5f; zfar = 1000; - scenefunc = NULL; + m_width = width; + m_height = height; + m_vsync = vsync; - glutInit (&argc, argv); - glutInitDisplayMode (GLUT_DOUBLE | GLUT_RGB | GLUT_DEPTH); + scenefunc = nullptr; - atexit(destroy); + glfwSetErrorCallback(error_callback); - glutInitWindowSize (width, height); - glutInitWindowPosition (posx, posy); + if (!glfwInit()) + exit(EXIT_FAILURE); - glutCreateWindow(name); + glfwWindowHint(GLFW_COCOA_RETINA_FRAMEBUFFER, GL_FALSE); + //glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR, 3); + //glfwWindowHint(GLFW_CONTEXT_VERSION_MINOR, 3); + //glfwWindowHint(GLFW_OPENGL_PROFILE, GLFW_OPENGL_CORE_PROFILE); - // Initialize GLEW - glewExperimental = GL_TRUE; - GLenum err = glewInit(); + if (maximized) + glfwWindowHint(GLFW_MAXIMIZED, GLFW_TRUE); - if (GLEW_OK != err) + if (m_vsync) + glfwWindowHint(GLFW_DOUBLEBUFFER, GL_TRUE); + else + glfwWindowHint(GLFW_DOUBLEBUFFER, GL_FALSE); + + m_glfw_window = glfwCreateWindow(width, height, name, NULL, NULL); + if (!m_glfw_window) { - std::cerr << "Error: " << glewGetErrorString(err) << std::endl; + glfwTerminate(); exit(EXIT_FAILURE); } - - getOpenGLVersion(m_context_major_version, m_context_minor_version); - glGetIntegerv(GL_CONTEXT_PROFILE_MASK, &m_context_profile); - std::cout << "OpenGL version " << m_context_major_version << "." << m_context_minor_version << std::endl; - std::cout << "Using GLEW " << glewGetString(GLEW_VERSION) << std::endl; - std::cout << "Vendor: " << glGetString(GL_VENDOR) << std::endl; - std::cout << "Renderer: " << glGetString(GL_RENDERER) << std::endl; - std::cout << "Version: " << glGetString(GL_VERSION) << std::endl; + glfwMakeContextCurrent(m_glfw_window); + gladLoadGL(glfwGetProcAddress); + glfwSwapInterval(0); + glfwSetFramebufferSizeCallback(m_glfw_window, reshape); - // Initialize AntTweakBar - // (note that AntTweakBar could also be initialized after GLUT, no matter) - if( !TwInit(TW_OPENGL, NULL) ) - { - // A fatal error occured - fprintf(stderr, "AntTweakBar initialization failed: %s\n", TwGetLastError()); - exit(1); - } - TwWindowSize(width, height); - initTweakBar(); + getOpenGLVersion(m_context_major_version, m_context_minor_version); + glGetIntegerv(GL_CONTEXT_PROFILE_MASK, &m_context_profile); + + LOG_INFO << "OpenGL version " << m_context_major_version << "." << m_context_minor_version; + LOG_INFO << "Vendor: " << glGetString(GL_VENDOR); + LOG_INFO << "Renderer: " << glGetString(GL_RENDERER); + LOG_INFO << "Version: " << glGetString(GL_VERSION); glEnable (GL_DEPTH_TEST); glEnable (GL_NORMALIZE); @@ -474,31 +484,20 @@ void MiniGL::init(int argc, char **argv, const int width, const int height, cons glEnable (GL_BLEND); glBlendFunc (GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); - glClearColor (0.95f, 0.95f, 1.0f, 1.0f); + glClearColor(0.4f, 0.4f, 0.4f, 1.0f); - glutReshapeFunc (reshape); - glutKeyboardFunc (keyboard); - glutMouseFunc (mousePress); - glutMotionFunc (mouseMove); - glutSpecialFunc (special); - glutDisplayFunc (display); - glutIdleFunc (idlefunc); -#ifndef __APPLE__ - glutMouseWheelFunc(mouseWheel); -#endif + glfwSetKeyCallback(m_glfw_window, keyboard); + glfwSetCharCallback(m_glfw_window, char_callback); + glfwSetMouseButtonCallback(m_glfw_window, mousePress); + glfwSetCursorPosCallback(m_glfw_window, mouseMove); + glfwSetScrollCallback(m_glfw_window, mouseWheel); - // after GLUT initialization - // directly redirect GLUT events to AntTweakBar - glutPassiveMotionFunc((GLUTmousemotionfun)TwEventMouseMotionGLUT); // same as MouseMotion - - // send the ''glutGetModifers'' function pointer to AntTweakBar - TwGLUTModifiersFunc(glutGetModifiers); + int w, h; + glfwGetWindowSize(m_glfw_window, &w, &h); glPolygonMode (GL_FRONT_AND_BACK, GL_FILL); -#ifndef __APPLE__ - glutSetOption(GLUT_ACTION_ON_WINDOW_CLOSE, GLUT_ACTION_GLUTMAINLOOP_RETURNS); -#endif + m_lastTime = glfwGetTime(); } void MiniGL::initTexture() @@ -537,185 +536,113 @@ void MiniGL::initTexture() glBindTexture(GL_TEXTURE_2D, 0); } - -void MiniGL::initTweakBar() -{ - // Create a tweak bar - m_tweakBar = TwNewBar("TweakBar"); - TwDefine(" GLOBAL help='MiniGL TweakBar.' "); // Message added to the help bar. - TwDefine(" TweakBar size='300 600' valueswidth=120 position='5 5' color='96 200 224' text=dark "); // change default tweak bar size and color - - TwAddVarRO(m_tweakBar, "Time", TW_TYPE_REAL, &m_time, " label='Time' precision=5"); - - TwAddVarCB(m_tweakBar, "Rotation", TW_TYPE_QUAT4F, setRotationCB, getRotationCB, &m_quat, - " label='Rotation' open help='Change the rotation.' "); - - // Add callback to toggle auto-rotate mode (callback functions are defined above). - TwAddVarCB(m_tweakBar, "Wireframe", TW_TYPE_BOOL32, setWireframeCB, getWireframeCB, NULL, - " label='Wireframe' key=w help='Toggle wireframe mode.' "); - -} - -void TW_CALL MiniGL::setWireframeCB(const void *value, void *clientData) -{ - const int val = *(const int *)(value); - if (val == 0) - drawMode = GL_FILL; - else - drawMode = GL_LINE; -} - -void TW_CALL MiniGL::getWireframeCB(void *value, void *clientData) -{ - *(int *)(value) = drawMode == GL_LINE; -} - -void TW_CALL MiniGL::setRotationCB(const void *value, void *clientData) -{ - const float *val = (const float *)(value); - m_rotation.x() = (Real) val[0]; - m_rotation.y() = (Real) val[1]; - m_rotation.z() = (Real) val[2]; - m_rotation.w() = -(Real) val[3]; - -} - -void TW_CALL MiniGL::getRotationCB(void *value, void *clientData) -{ - float *val = (float*)(value); - val[0] = (float)m_rotation.x(); - val[1] = (float)m_rotation.y(); - val[2] = (float)m_rotation.z(); - val[3] = -(float)m_rotation.w(); -} - -void MiniGL::setMouseMoveFunc(int button, void(*func) (int, int)) +void MiniGL::setMouseMoveFunc(int button, void(*func) (int, int, void*)) { mousefunc = func; mouseFuncButton = button; } -void MiniGL::setSelectionFunc(void(*func) (const Eigen::Vector2i&, const Eigen::Vector2i&)) +void MiniGL::setSelectionFunc(void(*func) (const Vector2i&, const Vector2i&, void*), void *clientData) { selectionfunc = func; -} - - -void MiniGL::cleanupTweakBar() -{ - + selectionfuncClientData = clientData; } void MiniGL::destroy () { - TwTerminate(); + gluDeleteQuadric(m_sphereQuadric); } -void MiniGL::reshape (int w, int h) +void MiniGL::reshape (GLFWwindow* glfw_window, int w, int h) { if ((w > 0) && (h > 0)) { - width = w; - height = h; - glutReshapeWindow (w,h); + m_width = w; + m_height = h; - TwWindowSize(width, height); - glutPostRedisplay (); + for (auto i = 0; i < m_reshapeFct.size(); i++) + m_reshapeFct[i](m_width, m_height); + glViewport(0, 0, m_width, m_height); } } -void MiniGL::setClientIdleFunc (int hz, void (*func) (void)) +void MiniGL::setClientIdleFunc (IdleFct func) { - if ((hz == 0) || (func == NULL)) - { - idlefunchz = 0; - idlefunc = NULL; - glutIdleFunc (NULL); - } - else - { - idlefunchz = (int) ((1.0/hz)*1000.0); - idlefunc = func; - glutIdleFunc (idle); - } + idlefunc = func; } -void MiniGL::setKeyFunc (int nr, unsigned char k, void (*func) (void)) +void MiniGL::setClientDestroyFunc(DestroyFct func) { - if ((nr >= MAX_KEY_FUNC) || (func == NULL)) - { - return; - } - else - { - keyfunc[nr] = func; - key[nr] = k; - numberOfKeyFunc++; - } + destroyfunc = func; } -void MiniGL::idle () +void MiniGL::addKeyFunc (unsigned char k, std::function const& func) { - idlefunc (); - glutPostRedisplay (); + if (func == nullptr) + return; + else + keyfunc.push_back({ func, k }); } -void MiniGL::keyboard (unsigned char k, int x, int y) +void MiniGL::keyboard(GLFWwindow* window, int key, int scancode, int action, int mods) { - if (TwEventKeyboardGLUT(k, x, y)) // send event to AntTweakBar - return; + // Check if registered listener wants the event + for (auto i=0; i < m_keyboardFct.size(); i++) + { + if (m_keyboardFct[i](key, scancode, action, mods)) + return; + } - if (k == 27) + if (key == GLFW_KEY_ESCAPE) { m_breakPointLoop = false; m_breakPointActive = false; #ifndef __APPLE__ - glutLeaveMainLoop(); + leaveMainLoop(); #else exit(0); #endif return; } - else if (k == 97) + else if (key == GLFW_KEY_A) move (0, 0, movespeed); - else if (k == 121) + else if (key == GLFW_KEY_Y) move (0, 0, -movespeed); - else if (k == 49) - rotateX(-turnspeed); - else if (k == 50) - rotateX(turnspeed); - else if (k == 51) - rotateY(-turnspeed); - else if (k == 52) - rotateY(turnspeed); - else + else if (key == GLFW_KEY_UP) + move(0, -movespeed, 0); + else if (key == GLFW_KEY_DOWN) + move(0, movespeed, 0); + else if (key == GLFW_KEY_LEFT) + move(movespeed, 0, 0); + else if (key == GLFW_KEY_RIGHT) + move(-movespeed, 0, 0); + else if (key == GLFW_KEY_F5) + m_breakPointLoop = false; +} + +void MiniGL::char_callback(GLFWwindow* window, unsigned int codepoint) +{ + // Check if registered listener wants the event + for (auto i = 0; i < m_charFct.size(); i++) { - for (int i=0; i < numberOfKeyFunc; i++) - { - if (k == key[i]) - keyfunc [i] (); - } + if (m_charFct[i](codepoint, GLFW_PRESS)) + return; } - glutPostRedisplay (); -} -void MiniGL::special (int k, int x, int y) -{ - if (TwEventSpecialGLUT(k, x, y)) // send event to AntTweakBar - return; - - if (k == GLUT_KEY_UP) - move (0, -movespeed, 0); - else if (k == GLUT_KEY_DOWN) - move (0, movespeed, 0); - else if (k == GLUT_KEY_LEFT) - move (movespeed, 0, 0); - else if (k == GLUT_KEY_RIGHT) - move (-movespeed, 0, 0); - else if (k == GLUT_KEY_F5) - m_breakPointLoop = false; - glutPostRedisplay (); + for (int i = 0; i < keyfunc.size(); i++) + { + if (codepoint == keyfunc[i].key) + keyfunc[i].fct(); + else if (codepoint == GLFW_KEY_1) + rotateX(-turnspeed); + else if (codepoint == GLFW_KEY_2) + rotateX(turnspeed); + else if (codepoint == GLFW_KEY_3) + rotateY(-turnspeed); + else if (codepoint == GLFW_KEY_4) + rotateY(turnspeed); + } } void MiniGL::setProjectionMatrix (int width, int height) @@ -730,10 +657,11 @@ void MiniGL::viewport () glClear (GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); glRenderMode (GL_RENDER); - glViewport (0, 0, width, height); + glfwGetFramebufferSize(m_glfw_window, &m_width, &m_height); + glViewport (0, 0, m_width, m_height); glMatrixMode (GL_PROJECTION); glLoadIdentity (); - setProjectionMatrix (width, height); + setProjectionMatrix (m_width, m_height); glMatrixMode (GL_MODELVIEW); glTranslatef((float)m_translation[0], (float)m_translation[1], (float)m_translation[2]); @@ -809,90 +737,104 @@ void MiniGL::rotateX(Real x) { AngleAxisr angleAxis(x, Vector3r(1,0,0)); Quaternionr quat(angleAxis); - m_rotation = m_rotation*quat; + m_rotation = quat*m_rotation; } -void MiniGL::mousePress (int button, int state, int x, int y) +void MiniGL::mousePress(GLFWwindow* window, int button, int action, int mods) { - if (TwEventMouseButtonGLUT(button, state, x, y)) // send event to AntTweakBar - return; + //getting cursor position + glfwGetCursorPos(m_glfw_window, &mouse_pos_x_old, &mouse_pos_y_old); + + // Check if registered listener wants the event + for (auto i = 0; i < m_mousePressFct.size(); i++) + { + if (m_mousePressFct[i](button, action, mods)) + return; + } - if (state == GLUT_DOWN) + modifier_key = mods; + + if (action == GLFW_PRESS) mouse_button = button; else mouse_button = -1; - modifier_key = glutGetModifiers (); - mouse_pos_x_old = x; - mouse_pos_y_old = y; - - if (selectionfunc != NULL) + if ((selectionfunc != NULL) && (modifier_key == 0)) { - if (button == GLUT_LEFT_BUTTON) + if (button == GLFW_MOUSE_BUTTON_1) { - if (state == GLUT_DOWN) - m_selectionStart = Eigen::Vector2i(x, y); + if (action == GLFW_PRESS) + m_selectionStart = Vector2i(mouse_pos_x_old, mouse_pos_y_old); else { if (m_selectionStart[0] != -1) { - const Eigen::Vector2i pos(x, y); - selectionfunc(m_selectionStart, pos); + const Vector2i pos(mouse_pos_x_old, mouse_pos_y_old); + selectionfunc(m_selectionStart, pos, selectionfuncClientData); } - m_selectionStart = Eigen::Vector2i(-1, -1); + m_selectionStart = Vector2i(-1, -1); } } } - - glutPostRedisplay (); } -void MiniGL::mouseWheel(int button, int dir, int x, int y) +void MiniGL::mouseWheel(GLFWwindow* window, double xoffset, double yoffset) { - if (dir > 0) + mouse_wheel_pos += yoffset; + + // Check if registered listener wants the event + for (auto i = 0; i < m_mouseWheelFct.size(); i++) + { + if (m_mouseWheelFct[i](static_cast(mouse_wheel_pos), xoffset, yoffset)) + return; + } + + if (yoffset > 0) movespeed *= 2.0; else movespeed *= 0.5; } -void MiniGL::mouseMove (int x, int y) +void MiniGL::mouseMove (GLFWwindow* window, double x, double y) { - if (TwEventMouseMotionGLUT(x, y)) // send event to AntTweakBar - return; + // Check if registered listener wants the event + for (auto i = 0; i < m_mouseMoveFct.size(); i++) + { + if (m_mouseMoveFct[i](static_cast(x), static_cast(y))) + return; + } - int d_x = mouse_pos_x_old - x; - int d_y = y - mouse_pos_y_old; + double d_x = mouse_pos_x_old - x; + double d_y = y - mouse_pos_y_old; - if (mouse_button == GLUT_LEFT_BUTTON) + if (mouse_button == GLFW_MOUSE_BUTTON_1) { // translate scene in z direction - if (modifier_key == GLUT_ACTIVE_CTRL) + if (modifier_key == GLFW_MOD_CONTROL) { - move (0, 0, -(d_x + d_y) / 10.0); + move (0, 0, -static_cast(d_x + d_y) / static_cast(10.0)); } // translate scene in x/y direction - else if (modifier_key == GLUT_ACTIVE_SHIFT) + else if (modifier_key == GLFW_MOD_SHIFT) { - move (-d_x / 20.0f, -d_y / 20.0, 0); + move (-static_cast(d_x) / static_cast(20.0), -static_cast(d_y) / static_cast(20.0), 0); } // rotate scene around x, y axis - else if (modifier_key == GLUT_ACTIVE_ALT) + else if (modifier_key == GLFW_MOD_ALT) { - rotateX(d_y/ 100.0); - rotateY(-d_x/ 100.0); + rotateX(static_cast(d_y)/ static_cast(100.0)); + rotateY(-static_cast(d_x)/ static_cast(100.0)); } } if (mousefunc != NULL) { if ((mouseFuncButton == -1) || (mouseFuncButton == mouse_button)) - mousefunc(x, y); + mousefunc(static_cast(x), static_cast(y), selectionfuncClientData); } mouse_pos_x_old = x; mouse_pos_y_old = y; - - glutPostRedisplay (); } @@ -921,9 +863,23 @@ float MiniGL::getZFar() return zfar; } -TwBar * MiniGL::getTweakBar() +void MiniGL::hsvToRgb(float h, float s, float v, float *rgb) { - return m_tweakBar; + int i = (int)floor(h * 6); + float f = h * 6 - i; + float p = v * (1 - s); + float q = v * (1 - f * s); + float t = v * (1 - (1 - f) * s); + + switch (i % 6) + { + case 0: rgb[0] = v, rgb[1] = t, rgb[2] = p; break; + case 1: rgb[0] = q, rgb[1] = v, rgb[2] = p; break; + case 2: rgb[0] = p, rgb[1] = v, rgb[2] = t; break; + case 3: rgb[0] = p, rgb[1] = q, rgb[2] = v; break; + case 4: rgb[0] = t, rgb[1] = p, rgb[2] = v; break; + case 5: rgb[0] = v, rgb[1] = p, rgb[2] = q; break; + } } bool MiniGL::checkOpenGLVersion(const int major_version, const int minor_version) @@ -973,66 +929,103 @@ void MiniGL::drawElements() } } -void MiniGL::clearPoints() +void MiniGL::setBreakPointActive(const bool active) +{ + m_breakPointActive = active; +} + +void MiniGL::breakPoint() +{ + breakPointMainLoop(); +} + +void MiniGL::error_callback(int error, const char* description) { - m_drawPoints.clear(); + LOG_ERR << description; } -void MiniGL::clearLines() +void MiniGL::mainLoop() { - m_drawLines.clear(); + while (!glfwWindowShouldClose(m_glfw_window)) + { + if (idlefunc != nullptr) + idlefunc(); + + double currentTime = glfwGetTime(); + if (currentTime - m_lastTime >= 1.0 / 60.0) // render at maximum at 60 fps + { + glfwPollEvents(); + + glPolygonMode(GL_FRONT_AND_BACK, drawMode); + viewport(); + + drawElements(); + + if (scenefunc != nullptr) + scenefunc(); + + if (m_vsync) + glfwSwapBuffers(m_glfw_window); + else + glFlush(); + m_lastTime = currentTime; + } + } + + if (destroyfunc != nullptr) + destroyfunc(); + + glfwDestroyWindow(m_glfw_window); + + glfwTerminate(); + + destroy(); } -void MiniGL::clearTriangles() +void MiniGL::leaveMainLoop() { - m_drawTriangle.clear(); + glfwSetWindowShouldClose(m_glfw_window, 1); } -void MiniGL::clearElements() +void MiniGL::swapBuffers() { - clearPoints(); - clearLines(); - clearTriangles(); + if (m_vsync) + glfwSwapBuffers(m_glfw_window); + else + glFlush(); } -void MiniGL::addPoint(const Vector3r &a, const float pointSize, const float *color) +void MiniGL::getWindowPos(int& x, int& y) { - Point &p = m_drawPoints.create(); - p.a = a; - p.pointSize = pointSize; - for (unsigned char i = 0; i < 4; i++) - p.color[i] = color[i]; + glfwGetWindowPos(m_glfw_window, &x, &y); } -void MiniGL::addLine(const Vector3r &a, const Vector3r &b, const float lineWidth, const float *color) +void MiniGL::getWindowSize(int& w, int& h) { - Line &l = m_drawLines.create(); - l.a = a; - l.b = b; - l.lineWidth = lineWidth; - for (unsigned char i = 0; i < 4; i++) - l.color[i] = color[i]; + glfwGetWindowSize(m_glfw_window, &w, &h); } -void MiniGL::addTriangle(const Vector3r &a, const Vector3r &b, const Vector3r &c, const float *color) +void MiniGL::setWindowPos(int x, int y) { - Triangle &t = m_drawTriangle.create(); - t.a = a; - t.b = b; - t.c = c; - for (unsigned char i = 0; i < 4; i++) - t.color[i] = color[i]; + glfwSetWindowPos(m_glfw_window, x, y); } -void MiniGL::setBreakPointActive(const bool active) +void MiniGL::setWindowSize(int w, int h) { - m_breakPointActive = active; + glfwSetWindowSize(m_glfw_window, w, h); } -void MiniGL::breakPoint() +bool MiniGL::getWindowMaximized() { - glutPostRedisplay(); - breakPointMainLoop(); + return glfwGetWindowAttrib(m_glfw_window, GLFW_MAXIMIZED); +} + +void MiniGL::setWindowMaximized(const bool b) +{ + if (b) + glfwRestoreWindow(m_glfw_window); + else + glfwRestoreWindow(m_glfw_window); } void MiniGL::breakPointMainLoop() @@ -1042,7 +1035,17 @@ void MiniGL::breakPointMainLoop() m_breakPointLoop = true; while (m_breakPointLoop) { - glutMainLoopEvent(); + glPolygonMode(GL_FRONT_AND_BACK, drawMode); + viewport(); + + if (scenefunc != nullptr) + scenefunc(); + + if (m_vsync) + glfwSwapBuffers(m_glfw_window); + else + glFlush(); + glfwPollEvents(); } } } diff --git a/Demos/Visualization/MiniGL.h b/Demos/Visualization/MiniGL.h index 933943d8..4907ab6b 100644 --- a/Demos/Visualization/MiniGL.h +++ b/Demos/Visualization/MiniGL.h @@ -1,12 +1,10 @@ -#ifndef __MINIGL_H__ -#define __MINIGL_H__ +#ifndef __MiniGL_h__ +#define __MiniGL_h__ -#include "Demos/Common/Config.h" #include "Common/Common.h" #include -#include "Demos/Visualization/Shader.h" -#include "extern/AntTweakBar/include/AntTweakBar.h" -#include "Demos/Utils/ObjectArray.h" +#include "Shader.h" +#include #ifdef USE_DOUBLE #define glNormal3v glNormal3dv @@ -18,6 +16,7 @@ #define glTranslate glTranslated #define GL_REAL GL_DOUBLE #define TW_TYPE_REAL TW_TYPE_DOUBLE +#define TW_TYPE_DIR3R TW_TYPE_DIR3D #else #define glNormal3v glNormal3fv #define glVertex3v glVertex3fv @@ -28,17 +27,19 @@ #define glTranslate glTranslatef #define GL_REAL GL_FLOAT #define TW_TYPE_REAL TW_TYPE_FLOAT +#define TW_TYPE_DIR3R TW_TYPE_DIR3F #endif +struct GLFWwindow; +typedef class GLUquadric GLUquadricObj; namespace PBD { class MiniGL { - #define MAX_KEY_FUNC 30 #define IMAGE_ROWS 128 #define IMAGE_COLS 128 - + private: struct Line { @@ -63,53 +64,75 @@ namespace PBD float color[4]; }; + struct KeyFunction + { + std::function fct; + unsigned char key; + }; + + typedef std::function SceneFct; + typedef std::function IdleFct; + typedef std::function DestroyFct; + typedef std::function ReshapeFct; + typedef std::function KeyboardFct; + typedef std::function CharFct; + typedef std::function MousePressFct; + typedef std::function MouseMoveFct; + typedef std::function MouseWheelFct; + static float fovy; static float znear; static float zfar; - static void (*scenefunc)(void); + static SceneFct scenefunc; static void (*exitfunc)(void); - static void (*idlefunc)(void); - static void (*keyfunc [MAX_KEY_FUNC])(void); - static unsigned char key [MAX_KEY_FUNC]; - static int numberOfKeyFunc; - static int idlefunchz; - static int width; - static int height; + static IdleFct idlefunc; + static DestroyFct destroyfunc; + static std::vector keyfunc; + static std::vector m_reshapeFct; + static std::vector m_keyboardFct; + static std::vector m_charFct; + static std::vector m_mousePressFct; + static std::vector m_mouseMoveFct; + static std::vector m_mouseWheelFct; + static int m_width; + static int m_height; static Vector3r m_translation; static Quaternionr m_rotation; static Real m_zoom; static Real movespeed; static Real turnspeed; static int mouse_button; + static double mouse_wheel_pos; static int modifier_key; - static int mouse_pos_x_old; - static int mouse_pos_y_old; + static double mouse_pos_x_old; + static double mouse_pos_y_old; static int drawMode; static unsigned char texData[IMAGE_ROWS][IMAGE_COLS][3]; static unsigned int m_texId; - static void(*selectionfunc) (const Eigen::Vector2i&, const Eigen::Vector2i&); - static void(*mousefunc)(int, int); + static void(*selectionfunc) (const Vector2i&, const Vector2i&, void*); + static void* selectionfuncClientData; + static void(*mousefunc)(int, int, void*); static int mouseFuncButton; - static Eigen::Vector2i m_selectionStart; - static TwBar *m_tweakBar; - static Real m_time; - static Real m_quat[4]; - static GLint m_context_major_version; - static GLint m_context_minor_version; - static GLint m_context_profile; + static Vector2i m_selectionStart; + static int m_context_major_version; + static int m_context_minor_version; + static int m_context_profile; static bool m_breakPointActive; static bool m_breakPointLoop; - static ObjectArray m_drawPoints; - static ObjectArray m_drawLines; - static ObjectArray m_drawTriangle; - - static void reshape (int w, int h); - static void idle (); - static void keyboard (unsigned char k, int x, int y); - static void special (int k, int x, int y); - static void mousePress (int button, int state, int x, int y); - static void mouseMove (int x, int y); - static void mouseWheel(int button, int dir, int x, int y); + static std::vector m_drawPoints; + static std::vector m_drawLines; + static std::vector m_drawTriangle; + static GLUquadricObj* m_sphereQuadric; + static GLFWwindow* m_glfw_window; + static bool m_vsync; + static double m_lastTime; + + static void reshape (GLFWwindow* glfw_window, int w, int h); + static void keyboard(GLFWwindow* window, int key, int scancode, int action, int mods); + static void char_callback(GLFWwindow* window, unsigned int codepoint); + static void mousePress(GLFWwindow* window, int button, int action, int mods); + static void mouseMove (GLFWwindow* window, double x, double y); + static void mouseWheel(GLFWwindow* window, double xoffset, double yoffset); static void breakPointMainLoop(); static void drawElements(); @@ -118,24 +141,27 @@ namespace PBD static void getOpenGLVersion(int &major_version, int &minor_version); static void coordinateSystem (); static void drawVector(const Vector3r &a, const Vector3r &b, const float w, float *color); + /** Renders a closed cylinder between two points. + */ static void drawCylinder(const Vector3r &a, const Vector3r &b, const float *color, const float radius = 0.02, const unsigned int subdivisions = 8); static void drawSphere(const Vector3r &translation, float radius, float *color, const unsigned int subDivision = 16); - static void drawTorus(const Vector3r &translation, float innerRadius, float outerRadius, float *color, const unsigned int nsides = 16, const unsigned int rings = 16); static void drawQuad (const Vector3r &a, const Vector3r &b, const Vector3r &c, const Vector3r &d, const Vector3r &norm, float *color); + /** Draw a tetrahedron. + */ static void drawTetrahedron(const Vector3r &a, const Vector3r &b, const Vector3r &c, const Vector3r &d, float *color); static void drawTriangle (const Vector3r &a, const Vector3r &b, const Vector3r &c, const Vector3r &norm, float *color); - static void drawBitmapText (float x, float y, const char *str, int strLength, float *color); - static void drawStrokeText(const Real x, const Real y, const Real z, float scale, const char *str, int strLength, float *color); - static void drawStrokeText (const Vector3r &pos, float scale, const char *str, int strLength, float *color); - static void drawCube (const Vector3r &translation, const Matrix3r &rotation, float width, float height, float depth, float *color); + static void drawGrid_xz(float *color); + static void drawGrid_xy(float *color); static void drawPoint (const Vector3r &translation, const float pointSize, const float * const color); + static void drawMesh(const std::vector &vertices, const std::vector &faces, const std::vector &vertexNormals, const float * const color); static void setViewport (float pfovy, float pznear, float pzfar, const Vector3r &peyepoint, const Vector3r &plookat); static void setViewport (float pfovy, float pznear, float pzfar); - static void setClientSceneFunc (void (*func)(void)); - static void display (); - static void setClientIdleFunc (int hz, void (*func) (void)); - static void setKeyFunc (int nr, unsigned char k, void (*func) (void)); - static void init(int argc, char **argv, const int width, const int height, const int posx, const int posy, const char *name); + static void setClientSceneFunc (SceneFct func); + static void setClientIdleFunc (IdleFct func); + static void setClientDestroyFunc(DestroyFct func); + static void addKeyFunc(unsigned char k, std::function const& func); + static std::vector &getKeyFunc() { return keyfunc; } + static void init(int argc, char **argv, const int width, const int height, const char *name, const bool vsync, const bool maximized = false); static void destroy (); static void viewport (); static void initLights (); @@ -148,30 +174,51 @@ namespace PBD static void rotateX (Real x); static void rotateY (Real y); static void setProjectionMatrix (int width, int height); - static void drawTime(const Real time); - static void setSelectionFunc(void(*func) (const Eigen::Vector2i&, const Eigen::Vector2i&)); - static void setMouseMoveFunc(int button, void(*func) (int, int)); + static void setSelectionFunc(void(*func) (const Vector2i&, const Vector2i&, void*), void *clientData); + static void setMouseMoveFunc(int button, void(*func) (int, int, void*)); static void unproject(const int x, const int y, Vector3r &pos); static float getZNear(); static float getZFar(); + static void hsvToRgb(float h, float s, float v, float *rgb); + static void rgbToHsv(float r, float g, float b, float *hsv); + static int getModifierKey() { return modifier_key; } + + static void addReshapeFunc(ReshapeFct func) { m_reshapeFct.push_back(func); } + static std::vector &getReshapeFunc() { return m_reshapeFct; } + static void addKeyboardFunc(KeyboardFct func) { m_keyboardFct.push_back(func); } + static std::vector &getKeyboardFunc() { return m_keyboardFct; } + static void addCharFunc(CharFct func) { m_charFct.push_back(func); } + static std::vector& getCharFunc() { return m_charFct; } + static void addMousePressFunc(MousePressFct func) { m_mousePressFct.push_back(func); } + static std::vector &getMousePressFunc() { return m_mousePressFct; } + static void addMouseMoveFunc(MouseMoveFct func) { m_mouseMoveFct.push_back(func); } + static std::vector &getMouseMoveFunc() { return m_mouseMoveFct; } + static void addMouseWheelFunc(MouseWheelFct func) { m_mouseWheelFct.push_back(func); } + static std::vector& getMouseWheelFunc() { return m_mouseWheelFct; } static void setBreakPointActive(const bool active); static void breakPoint(); - static void clearPoints(); - static void clearLines(); - static void clearTriangles(); - static void clearElements(); - static void addPoint(const Vector3r &a, const float pointSize, const float *color); - static void addLine(const Vector3r &a, const Vector3r &b, const float lineWidth, const float *color); - static void addTriangle(const Vector3r &a, const Vector3r &b, const Vector3r &c, const float *color); - - static void initTweakBar(); - static TwBar *getTweakBar(); - static void cleanupTweakBar(); - static void TW_CALL setWireframeCB(const void *value, void *clientData); - static void TW_CALL getWireframeCB(void *value, void *clientData); - static void TW_CALL setRotationCB(const void *value, void *clientData); - static void TW_CALL getRotationCB(void *value, void *clientData); + + static int getWidth() { return m_width; } + static int getHeight() { return m_height; } + + static int getDrawMode() { return drawMode; } + static void setDrawMode(int val) { drawMode = val; } + static Quaternionr getRotation() { return m_rotation; } + static void setRotation(Quaternionr val) { m_rotation = val; } + + static void error_callback(int error, const char* description); + static void mainLoop(); + static void leaveMainLoop(); + static void swapBuffers(); + + static GLFWwindow* getWindow() { return m_glfw_window; } + static void getWindowPos(int& x, int& y); + static void getWindowSize(int& w, int& h); + static void setWindowPos(int x, int y); + static void setWindowSize(int w, int h); + static bool getWindowMaximized(); + static void setWindowMaximized(const bool b); }; } diff --git a/Demos/Visualization/Selection.h b/Demos/Visualization/Selection.h index 9841a001..facc890e 100644 --- a/Demos/Visualization/Selection.h +++ b/Demos/Visualization/Selection.h @@ -1,7 +1,6 @@ #ifndef __SELECTION_H__ #define __SELECTION_H__ -#include "Demos/Common/Config.h" #include "MiniGL.h" #ifdef WIN32 diff --git a/Demos/Visualization/Shader.cpp b/Demos/Visualization/Shader.cpp index 670db620..46518ec8 100644 --- a/Demos/Visualization/Shader.cpp +++ b/Demos/Visualization/Shader.cpp @@ -12,6 +12,7 @@ Shader::Shader(void) m_shaders[i] = 0; m_attributes.clear(); m_uniforms.clear(); + m_program = 0; } Shader::~Shader(void) @@ -19,7 +20,8 @@ Shader::~Shader(void) m_initialized = false; m_attributes.clear(); m_uniforms.clear(); - glDeleteProgram(m_program); + if (m_program) + glDeleteProgram(m_program); } void Shader::compileShaderString(GLenum type, const std::string &source) diff --git a/Demos/Visualization/Shader.h b/Demos/Visualization/Shader.h index e4e65c35..4011f436 100644 --- a/Demos/Visualization/Shader.h +++ b/Demos/Visualization/Shader.h @@ -1,9 +1,9 @@ -#ifndef __SHADER_H__ -#define __SHADER_H__ +#ifndef __Shader_h__ +#define __Shader_h__ #include #include -#include "GL/glew.h" +#include namespace PBD { @@ -36,4 +36,4 @@ namespace PBD }; } -#endif \ No newline at end of file +#endif diff --git a/Demos/Visualization/Visualization.h b/Demos/Visualization/Visualization.h index 54becc65..373ac99b 100644 --- a/Demos/Visualization/Visualization.h +++ b/Demos/Visualization/Visualization.h @@ -1,7 +1,6 @@ #ifndef __VISUALIZATION_H__ #define __VISUALIZATION_H__ -#include "Demos/Common/Config.h" #include "Common/Common.h" #include "MiniGL.h" @@ -11,13 +10,13 @@ namespace PBD { public: template - static void drawMesh(const PositionData &pd, const IndexedFaceMesh &mesh, const unsigned int offset, const float * const color); + static void drawMesh(const PositionData &pd, const Utilities::IndexedFaceMesh &mesh, const unsigned int offset, const float * const color); template - static void drawTexturedMesh(const PositionData &pd, const IndexedFaceMesh &mesh, const unsigned int offset, const float * const color); + static void drawTexturedMesh(const PositionData &pd, const Utilities::IndexedFaceMesh &mesh, const unsigned int offset, const float * const color); }; template - void Visualization::drawMesh(const PositionData &pd, const IndexedFaceMesh &mesh, const unsigned int offset, const float * const color) + void Visualization::drawMesh(const PositionData &pd, const Utilities::IndexedFaceMesh &mesh, const unsigned int offset, const float * const color) { // draw mesh const unsigned int *faces = mesh.getFaces().data(); @@ -61,7 +60,7 @@ namespace PBD } template - void Visualization::drawTexturedMesh(const PositionData &pd, const IndexedFaceMesh &mesh, const unsigned int offset, const float * const color) + void Visualization::drawTexturedMesh(const PositionData &pd, const Utilities::IndexedFaceMesh &mesh, const unsigned int offset, const float * const color) { // draw mesh const unsigned int *faces = mesh.getFaces().data(); diff --git a/LICENSE b/LICENSE index 27c3f9b1..f14280d6 100644 --- a/LICENSE +++ b/LICENSE @@ -1,6 +1,6 @@ The MIT License (MIT) -Copyright (c) 2015 Jan Bender +Copyright (c) 2015-present, PositionBasedDynamics contributors Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal diff --git a/MANIFEST.in b/MANIFEST.in new file mode 100644 index 00000000..bec3e4d2 --- /dev/null +++ b/MANIFEST.in @@ -0,0 +1 @@ +recursive-include data * diff --git a/PositionBasedDynamics/CMakeLists.txt b/PositionBasedDynamics/CMakeLists.txt index 5a2af5ca..535d4527 100644 --- a/PositionBasedDynamics/CMakeLists.txt +++ b/PositionBasedDynamics/CMakeLists.txt @@ -1,10 +1,13 @@ add_library(PositionBasedDynamics ${PROJECT_PATH}/Common/Common.h + DirectPositionBasedSolverForStiffRodsInterface.h MathFunctions.cpp MathFunctions.h PositionBasedDynamics.cpp PositionBasedDynamics.h + PositionBasedElasticRods.cpp + PositionBasedElasticRods.h PositionBasedFluids.cpp PositionBasedFluids.h PositionBasedRigidBodyDynamics.cpp @@ -14,6 +17,8 @@ add_library(PositionBasedDynamics SPHKernels.h TimeIntegration.cpp TimeIntegration.h + XPBD.cpp + XPBD.h CMakeLists.txt ) @@ -21,7 +26,14 @@ add_library(PositionBasedDynamics find_package( Eigen3 REQUIRED ) include_directories( ${EIGEN3_INCLUDE_DIR} ) +install(TARGETS PositionBasedDynamics + RUNTIME DESTINATION bin + LIBRARY DESTINATION lib + ARCHIVE DESTINATION lib) +install(DIRECTORY . +DESTINATION include/PositionBasedDynamics +FILES_MATCHING PATTERN "*.h") diff --git a/PositionBasedDynamics/DirectPositionBasedSolverForStiffRodsInterface.h b/PositionBasedDynamics/DirectPositionBasedSolverForStiffRodsInterface.h new file mode 100644 index 00000000..0fdc0dc2 --- /dev/null +++ b/PositionBasedDynamics/DirectPositionBasedSolverForStiffRodsInterface.h @@ -0,0 +1,43 @@ +#ifndef DIRECT_POSITION_BASED_SOLVER_FOR_STIFF_RODS_INTERFACE +#define DIRECT_POSITION_BASED_SOLVER_FOR_STIFF_RODS_INTERFACE + +#include "Common/Common.h" + +namespace PBD{ + // Implementation of "Direct Position-Based Solver for Stiff Rods" paper + // (https://animation.rwth-aachen.de/publication/0557/) + // + // Implemented by: + // + // Crispin Deul + // Graduate School CE + // Technische Universität Darmstadt + // + // deul[at] gsc.tu-darmstadt.de + // + + + class RodSegment + { + public: + virtual bool isDynamic() = 0; + virtual Real Mass() = 0; + virtual const Vector3r & InertiaTensor() = 0; + virtual const Vector3r & Position() = 0; + virtual const Quaternionr & Rotation() = 0; + }; + + class RodConstraint + { + public: + using Vector6r = Eigen::Matrix; + virtual unsigned int segmentIndex(unsigned int i) = 0; + virtual Eigen::Matrix & getConstraintInfo() = 0; + virtual Real getAverageSegmentLength() = 0; + virtual Vector3r &getRestDarbouxVector() = 0; + virtual Vector3r &getStiffnessCoefficientK() = 0; + virtual Vector3r & getStretchCompliance() = 0; + virtual Vector3r & getBendingAndTorsionCompliance() = 0; + }; +} +#endif diff --git a/PositionBasedDynamics/MathFunctions.cpp b/PositionBasedDynamics/MathFunctions.cpp index 335a375d..fe988d44 100644 --- a/PositionBasedDynamics/MathFunctions.cpp +++ b/PositionBasedDynamics/MathFunctions.cpp @@ -15,10 +15,10 @@ void MathFunctions::jacobiRotate(Matrix3r &A, Matrix3r &R, int p, int q) if (A(p, q) == 0.0) return; - Real d = (A(p, p) - A(q, q)) / (2.0*A(p, q)); - Real t = 1.0 / (fabs(d) + sqrt(d*d + 1.0)); + Real d = (A(p, p) - A(q, q)) / (static_cast(2.0)*A(p, q)); + Real t = static_cast(1.0) / (fabs(d) + sqrt(d*d + static_cast(1.0))); if (d < 0.0) t = -t; - Real c = 1.0 / sqrt(t*t + 1); + Real c = static_cast(1.0) / sqrt(t*t + 1); Real s = t*c; A(p, p) += t*A(p, q); A(q, q) -= t*A(p, q); @@ -46,7 +46,7 @@ void MathFunctions::jacobiRotate(Matrix3r &A, Matrix3r &R, int p, int q) void MathFunctions::eigenDecomposition(const Matrix3r &A, Matrix3r &eigenVecs, Vector3r &eigenVals) { const int numJacobiIterations = 10; - const Real epsilon = 1e-15; + const Real epsilon = static_cast(1e-15); Matrix3r D = A; @@ -108,11 +108,11 @@ void MathFunctions::polarDecomposition(const Matrix3r &A, Matrix3r &R, Matrix3r D(1, 1) = d1; D(2, 2) = d2; - const Real eps = 1e-15; + const Real eps = static_cast(1e-15); - Real l0 = eigenVals[0]; if (l0 <= eps) l0 = 0.0; else l0 = 1.0 / d0; - Real l1 = eigenVals[1]; if (l1 <= eps) l1 = 0.0; else l1 = 1.0 / d1; - Real l2 = eigenVals[2]; if (l2 <= eps) l2 = 0.0; else l2 = 1.0 / d2; + Real l0 = eigenVals[0]; if (l0 <= eps) l0 = 0.0; else l0 = static_cast(1.0) / d0; + Real l1 = eigenVals[1]; if (l1 <= eps) l1 = 0.0; else l1 = static_cast(1.0) / d1; + Real l2 = eigenVals[2]; if (l2 <= eps) l2 = 0.0; else l2 = static_cast(1.0) / d2; Matrix3r S1; S1(0, 0) = l0*U(0, 0)*U(0, 0) + l1*U(0, 1)*U(0, 1) + l2*U(0, 2)*U(0, 2); @@ -230,8 +230,8 @@ void MathFunctions::polarDecompositionStable(const Matrix3r &M, const Real toler const Real gamma = sqrt(sqrt((MadjTone*MadjTinf) / (Mone*Minf)) / fabs(det)); - const Real g1 = gamma*0.5; - const Real g2 = 0.5 / (gamma*det); + const Real g1 = gamma* static_cast(0.5); + const Real g2 = static_cast(0.5) / (gamma*det); for (unsigned char i = 0; i < 3; i++) { @@ -274,7 +274,7 @@ void MathFunctions::svdWithInversionHandling(const Matrix3r &A, Vector3r &sigma, const Real detV = V.determinant(); if (detV < 0.0) { - Real minLambda = FLT_MAX; + Real minLambda = REAL_MAX; unsigned char pos = 0; for (unsigned char l = 0; l < 3; l++) { @@ -328,7 +328,7 @@ void MathFunctions::svdWithInversionHandling(const Matrix3r &A, Vector3r &sigma, { for (unsigned char m = 0; m < 3; m++) { - U(m, l) *= 1.0 / sigma[l]; + U(m, l) *= static_cast(1.0) / sigma[l]; } } } @@ -351,7 +351,7 @@ void MathFunctions::svdWithInversionHandling(const Matrix3r &A, Vector3r &sigma, } else { - Vector3r sigmaInv(1.0 / sigma[0], 1.0 / sigma[1], 1.0 / sigma[2]); + Vector3r sigmaInv(static_cast(1.0) / sigma[0], static_cast(1.0) / sigma[1], static_cast(1.0) / sigma[2]); U = A * V; for (unsigned char l = 0; l < 3; l++) { @@ -368,7 +368,7 @@ void MathFunctions::svdWithInversionHandling(const Matrix3r &A, Vector3r &sigma, if (detU < 0.0) { //std::cout << "Inversion!\n"; - Real minLambda = FLT_MAX; + Real minLambda = REAL_MAX; unsigned char pos = 0; for (unsigned char l = 0; l < 3; l++) { @@ -403,3 +403,18 @@ void MathFunctions::crossProductMatrix(const Vector3r &v, Matrix3r &v_hat) -v(1), v(0), 0; } +// ---------------------------------------------------------------------------------------------- +void MathFunctions::extractRotation(const Matrix3r &A, Quaternionr &q, const unsigned int maxIter) +{ + for (unsigned int iter = 0; iter < maxIter; iter++) + { + Matrix3r R = q.matrix(); + Vector3r omega = (R.col(0).cross(A.col(0)) + R.col(1).cross(A.col(1)) + R.col(2).cross(A.col(2))) * + (1.0 / fabs(R.col(0).dot(A.col(0)) + R.col(1).dot(A.col(1)) + R.col(2).dot(A.col(2)) + 1.0e-9)); + Real w = omega.norm(); + if (w < 1.0e-9) + break; + q = Quaternionr(AngleAxisr(w, (1.0 / w) * omega)) * q; + q.normalize(); + } +} \ No newline at end of file diff --git a/PositionBasedDynamics/MathFunctions.h b/PositionBasedDynamics/MathFunctions.h index c61f7d98..0f7aad05 100644 --- a/PositionBasedDynamics/MathFunctions.h +++ b/PositionBasedDynamics/MathFunctions.h @@ -43,6 +43,13 @@ namespace PBD * @param v_hat resulting cross product matrix */ static void crossProductMatrix(const Vector3r &v, Matrix3r &v_hat); + + /** Implementation of the paper: \n + * Matthias Müller, Jan Bender, Nuttapong Chentanez and Miles Macklin, + * "A Robust Method to Extract the Rotational Part of Deformations", + * ACM SIGGRAPH Motion in Games, 2016 + */ + static void extractRotation(const Matrix3r &A, Quaternionr &q, const unsigned int maxIter); }; } diff --git a/PositionBasedDynamics/PositionBasedDynamics.cpp b/PositionBasedDynamics/PositionBasedDynamics.cpp index bd1db9fd..bf3c0e0b 100644 --- a/PositionBasedDynamics/PositionBasedDynamics.cpp +++ b/PositionBasedDynamics/PositionBasedDynamics.cpp @@ -4,7 +4,7 @@ using namespace PBD; -const Real eps = 1e-6; +const Real eps = static_cast(1e-6); ////////////////////////////////////////////////////////////////////////// // PositionBasedDynamics @@ -14,8 +14,7 @@ bool PositionBasedDynamics::solve_DistanceConstraint( const Vector3r &p0, Real invMass0, const Vector3r &p1, Real invMass1, const Real restLength, - const Real compressionStiffness, - const Real stretchStiffness, + const Real stiffness, Vector3r &corr0, Vector3r &corr1) { Real wSum = invMass0 + invMass1; @@ -27,10 +26,7 @@ bool PositionBasedDynamics::solve_DistanceConstraint( n.normalize(); Vector3r corr; - if (d < restLength) - corr = compressionStiffness * n * (d - restLength) / wSum; - else - corr = stretchStiffness * n * (d - restLength) / wSum; + corr = stiffness * n * (d - restLength) / wSum; corr0 = invMass0 * corr; corr1 = -invMass1 * corr; @@ -58,7 +54,7 @@ bool PositionBasedDynamics::solve_DihedralConstraint( if (elen < eps) return false; - Real invElen = 1.0 / elen; + Real invElen = static_cast(1.0) / elen; Vector3r n1 = (p2-p0).cross(p3-p0); n1 /= n1.squaredNorm(); Vector3r n2 = (p3 - p1).cross(p2 - p1); n2 /= n2.squaredNorm(); @@ -110,25 +106,17 @@ bool PositionBasedDynamics::solve_VolumeConstraint( const Vector3r &p1, Real invMass1, const Vector3r &p2, Real invMass2, const Vector3r &p3, Real invMass3, - const Real restVolume, - const Real negVolumeStiffness, - const Real posVolumeStiffness, + const Real restVolume, + const Real stiffness, Vector3r &corr0, Vector3r &corr1, Vector3r &corr2, Vector3r &corr3) { - Vector3r d1 = p1 - p0; - Vector3r d2 = p2 - p0; - Vector3r d3 = p3 - p0; - Real volume = 1.0 / 6.0 * (p1 - p0).cross(p2 - p0).dot(p3 - p0); + Real volume = static_cast(1.0 / 6.0) * (p1 - p0).cross(p2 - p0).dot(p3 - p0); corr0.setZero(); corr1.setZero(); corr2.setZero(); corr3.setZero(); - if (posVolumeStiffness == 0.0 && volume > 0.0) + if (stiffness == 0.0) return false; - if (negVolumeStiffness == 0.0 && volume < 0.0) - return false; - - Vector3r grad0 = (p1 - p2).cross(p3 - p2); Vector3r grad1 = (p2 - p0).cross(p3 - p0); Vector3r grad2 = (p0 - p1).cross(p3 - p1); @@ -143,10 +131,7 @@ bool PositionBasedDynamics::solve_VolumeConstraint( if (fabs(lambda) < eps) return false; - if (volume < 0.0) - lambda = negVolumeStiffness * (volume - restVolume) / lambda; - else - lambda = posVolumeStiffness * (volume - restVolume) / lambda; + lambda = stiffness * (volume - restVolume) / lambda; corr0 = -lambda * invMass0 * grad0; corr1 = -lambda * invMass1 * grad1; @@ -178,8 +163,8 @@ bool PositionBasedDynamics::init_IsometricBendingConstraint( const Real c03 = MathFunctions::cotTheta(-e0, e3); const Real c04 = MathFunctions::cotTheta(-e0, e4); - const Real A0 = 0.5 * (e0.cross(e1)).norm(); - const Real A1 = 0.5 * (e0.cross(e2)).norm(); + const Real A0 = static_cast(0.5) * (e0.cross(e1)).norm(); + const Real A1 = static_cast(0.5) * (e0.cross(e2)).norm(); const Real coef = -3.f / (2.f*(A0 + A1)); const Real K[4] = { c03 + c04, c01 + c02, -c01 - c03, -c02 - c04 }; @@ -266,7 +251,7 @@ bool PositionBasedDynamics::solve_EdgePointDistanceConstraint( t = 0.5; else { Real d2 = d.dot(d); - Real t = d.dot(p - p1) / d2; + t = d.dot(p - p1) / d2; if (t < 0.0) t = 0.0; else if (t > 1.0) @@ -277,7 +262,7 @@ bool PositionBasedDynamics::solve_EdgePointDistanceConstraint( Real dist = n.norm(); n.normalize(); Real C = dist - restDist; - Real b0 = 1.0 - t; + Real b0 = static_cast(1.0) - t; Real b1 = t; Vector3r grad = n; Vector3r grad0 = -n * b0; @@ -315,7 +300,7 @@ bool PositionBasedDynamics::solve_TrianglePointDistanceConstraint( { // find barycentric coordinates of closest point on triangle - Real b0 = 1.0 / 3.0; // for singular case + Real b0 = static_cast(1.0 / 3.0); // for singular case Real b1 = b0; Real b2 = b0; @@ -333,37 +318,37 @@ bool PositionBasedDynamics::solve_TrianglePointDistanceConstraint( if (det != 0.0) { Real s = (c*e - b*f) / det; Real t = (a*f - c*d) / det; - b0 = 1.0 - s - t; // inside triangle + b0 = static_cast(1.0) - s - t; // inside triangle b1 = s; b2 = t; if (b0 < 0.0) { // on edge 1-2 Vector3r d = p2 - p1; Real d2 = d.dot(d); - Real t = (d2 == 0.0) ? 0.5 : d.dot(p - p1) / d2; + Real t = (d2 == static_cast(0.0)) ? static_cast(0.5) : d.dot(p - p1) / d2; if (t < 0.0) t = 0.0; // on point 1 if (t > 1.0) t = 1.0; // on point 2 b0 = 0.0; - b1 = (1.0 - t); + b1 = (static_cast(1.0) - t); b2 = t; } else if (b1 < 0.0) { // on edge 2-0 Vector3r d = p0 - p2; Real d2 = d.dot(d); - Real t = (d2 == 0.0) ? 0.5 : d.dot(p - p2) / d2; + Real t = (d2 == static_cast(0.0)) ? static_cast(0.5) : d.dot(p - p2) / d2; if (t < 0.0) t = 0.0; // on point 2 if (t > 1.0) t = 1.0; // on point 0 b1 = 0.0; - b2 = (1.0 - t); + b2 = (static_cast(1.0) - t); b0 = t; } else if (b2 < 0.0) { // on edge 0-1 Vector3r d = p1 - p0; Real d2 = d.dot(d); - Real t = (d2 == 0.0) ? 0.5 : d.dot(p - p0) / d2; + Real t = (d2 == static_cast(0.0)) ? static_cast(0.5) : d.dot(p - p0) / d2; if (t < 0.0) t = 0.0; // on point 0 if (t > 1.0) t = 1.0; // on point 1 b2 = 0.0; - b0 = (1.0 - t); + b0 = (static_cast(1.0) - t); b1 = t; } } @@ -420,7 +405,7 @@ bool PositionBasedDynamics::solve_EdgeEdgeDistanceConstraint( Real det = a*d - b*c; Real s, t; if (det != 0.0) { - det = 1.0 / det; + det = static_cast(1.0) / det; s = (e*d - b*f) * det; t = (a*f - e*c) * det; } @@ -436,17 +421,17 @@ bool PositionBasedDynamics::solve_EdgeEdgeDistanceConstraint( if (t0 > t1) { Real f = t0; t0 = t1; t1 = f; flip1 = true; } if (s0 >= t1) { - s = !flip0 ? 0.0 : 1.0; - t = !flip1 ? 1.0 : 0.0; + s = !flip0 ? static_cast(0.0) : static_cast(1.0); + t = !flip1 ? static_cast(1.0) : static_cast(0.0); } else if (t0 >= s1) { - s = !flip0 ? 1.0 : 0.0; - t = !flip1 ? 0.0 : 1.0; + s = !flip0 ? static_cast(1.0) : static_cast(0.0); + t = !flip1 ? static_cast(0.0) : static_cast(1.0); } else { // overlap - Real mid = (s0 > t0) ? (s0 + t1) * 0.5 : (t0 + s1) * 0.5; - s = (s0 == s1) ? 0.5 : (mid - s0) / (s1 - s0); - t = (t0 == t1) ? 0.5 : (mid - t0) / (t1 - t0); + Real mid = (s0 > t0) ? (s0 + t1) * static_cast(0.5) : (t0 + s1) * static_cast(0.5); + s = (s0 == s1) ? static_cast(0.5) : (mid - s0) / (s1 - s0); + t = (t0 == t1) ? static_cast(0.5) : (mid - t0) / (t1 - t0); } } if (s < 0.0) s = 0.0; @@ -454,9 +439,9 @@ bool PositionBasedDynamics::solve_EdgeEdgeDistanceConstraint( if (t < 0.0) t = 0.0; if (t > 1.0) t = 1.0; - Real b0 = 1.0 - s; + Real b0 = static_cast(1.0) - s; Real b1 = s; - Real b2 = 1.0 - t; + Real b2 = static_cast(1.0) - t; Real b3 = t; Vector3r q0 = p0 * b0 + p1 * b1; @@ -490,18 +475,18 @@ bool PositionBasedDynamics::solve_EdgeEdgeDistanceConstraint( return true; } +#include + // ---------------------------------------------------------------------------------------------- bool PositionBasedDynamics::init_ShapeMatchingConstraint( const Vector3r x0[], const Real invMasses[], int numPoints, - Vector3r &restCm, Matrix3r &invRestMat) + Vector3r &restCm) { - invRestMat.setIdentity(); - // center of mass restCm.setZero(); Real wsum = 0.0; for (int i = 0; i < numPoints; i++) { - Real wi = 1.0 / (invMasses[i] + eps); + Real wi = static_cast(1.0) / (invMasses[i] + eps); restCm += x0[i] * wi; wsum += wi; } @@ -509,36 +494,13 @@ bool PositionBasedDynamics::init_ShapeMatchingConstraint( return false; restCm /= wsum; - // A - Matrix3r A; - A.setZero(); - for (int i = 0; i < numPoints; i++) { - const Vector3r qi = x0[i] - restCm; - Real wi = 1.0 / (invMasses[i] + eps); - Real x2 = wi * qi[0] * qi[0]; - Real y2 = wi * qi[1] * qi[1]; - Real z2 = wi * qi[2] * qi[2]; - Real xy = wi * qi[0] * qi[1]; - Real xz = wi * qi[0] * qi[2]; - Real yz = wi * qi[1] * qi[2]; - A(0, 0) += x2; A(0, 1) += xy; A(0, 2) += xz; - A(1, 0) += xy; A(1, 1) += y2; A(1, 2) += yz; - A(2, 0) += xz; A(2, 1) += yz; A(2, 2) += z2; - } - Real det = A.determinant(); - if (fabs(det) > eps) - { - invRestMat = A.inverse(); - return true; - } - return false; + return true; } // ---------------------------------------------------------------------------------------------- bool PositionBasedDynamics::solve_ShapeMatchingConstraint( const Vector3r x0[], const Vector3r x[], const Real invMasses[], int numPoints, const Vector3r &restCm, - const Matrix3r &invRestMat, const Real stiffness, const bool allowStretch, Vector3r corr[], Matrix3r *rot) @@ -551,7 +513,7 @@ bool PositionBasedDynamics::solve_ShapeMatchingConstraint( Real wsum = 0.0; for (int i = 0; i < numPoints; i++) { - Real wi = 1.0 / (invMasses[i] + eps); + Real wi = static_cast(1.0) / (invMasses[i] + eps); cm += x[i] * wi; wsum += wi; } @@ -566,7 +528,7 @@ bool PositionBasedDynamics::solve_ShapeMatchingConstraint( Vector3r q = x0[i] - restCm; Vector3r p = x[i] - cm; - Real w = 1.0 / (invMasses[i] + eps); + Real w = static_cast(1.0) / (invMasses[i] + eps); p *= w; mat(0, 0) += p[0] * q[0]; mat(0, 1) += p[0] * q[1]; mat(0, 2) += p[0] * q[2]; @@ -574,7 +536,7 @@ bool PositionBasedDynamics::solve_ShapeMatchingConstraint( mat(2, 0) += p[2] * q[0]; mat(2, 1) += p[2] * q[1]; mat(2, 2) += p[2] * q[2]; } - mat = mat * invRestMat; + //mat = mat * invRestMat; Matrix3r R, U, D; R = mat; @@ -611,7 +573,7 @@ bool PositionBasedDynamics::init_StrainTriangleConstraint( if (fabs(det) < eps) return false; - Real s = 1.0 / det; + Real s = static_cast(1.0) / det; invRestMat(0,0) = d*s; invRestMat(0,1) = -b*s; invRestMat(1,0) = -c*s; invRestMat(1,1) = a*s; @@ -698,19 +660,19 @@ bool PositionBasedDynamics::solve_StrainTriangleConstraint( if (i == 0 && j == 0) { if (normalizeStretch) { Real s = sqrt(Sij); - lambda = 2.0 * s * (s - 1.0) / lambda * xxStiffness; + lambda = static_cast(2.0) * s * (s - static_cast(1.0)) / lambda * xxStiffness; } else { - lambda = (Sij - 1.0) / lambda * xxStiffness; + lambda = (Sij - static_cast(1.0)) / lambda * xxStiffness; } } else if (i == 1 && j == 1) { if (normalizeStretch) { Real s = sqrt(Sij); - lambda = 2.0 * s * (s - 1.0) / lambda * yyStiffness; + lambda = static_cast(2.0) * s * (s - static_cast(1.0)) / lambda * yyStiffness; } else { - lambda = (Sij - 1.0) / lambda * yyStiffness; + lambda = (Sij - static_cast(1.0)) / lambda * yyStiffness; } } else { @@ -791,7 +753,7 @@ bool PositionBasedDynamics::solve_StrainTetraConstraint( if (normalizeShear && i != j) { wi = fi.norm(); wj = fj.norm(); - s1 = 1.0 / (wi*wj); + s1 = static_cast(1.0) / (wi*wj); s3 = s1 * s1 * s1; } @@ -823,10 +785,10 @@ bool PositionBasedDynamics::solve_StrainTetraConstraint( if (i == j) { // diagonal, stretch if (normalizeStretch) { Real s = sqrt(Sij); - lambda = 2.0 * s * (s - 1.0) / lambda * stretchStiffness[i]; + lambda = static_cast(2.0) * s * (s - static_cast(1.0)) / lambda * stretchStiffness[i]; } else { - lambda = (Sij - 1.0) / lambda * stretchStiffness[i]; + lambda = (Sij - static_cast(1.0)) / lambda * stretchStiffness[i]; } } else { // off diagonal, shear @@ -851,7 +813,7 @@ bool PositionBasedDynamics::init_FEMTriangleConstraint( Matrix2r &invRestMat) { Vector3r normal0 = (p1 - p0).cross(p2 - p0); - area = normal0.norm() * 0.5; + area = normal0.norm() * static_cast(0.5); Vector3r axis0_1 = p1 - p0; axis0_1.normalize(); @@ -895,10 +857,10 @@ bool PositionBasedDynamics::solve_FEMTriangleConstraint( // Orthotropic elasticity tensor Matrix3r C; C.setZero(); - C(0, 0) = youngsModulusX / (1.0 - poissonRatioXY*poissonRatioYX); - C(0, 1) = youngsModulusX*poissonRatioYX / (1.0 - poissonRatioXY*poissonRatioYX); - C(1, 1) = youngsModulusY / (1.0 - poissonRatioXY*poissonRatioYX); - C(1, 0) = youngsModulusY*poissonRatioXY / (1.0 - poissonRatioXY*poissonRatioYX); + C(0, 0) = youngsModulusX / (static_cast(1.0) - poissonRatioXY*poissonRatioYX); + C(0, 1) = youngsModulusX*poissonRatioYX / (static_cast(1.0) - poissonRatioXY*poissonRatioYX); + C(1, 1) = youngsModulusY / (static_cast(1.0) - poissonRatioXY*poissonRatioYX); + C(1, 0) = youngsModulusY*poissonRatioXY / (static_cast(1.0) - poissonRatioXY*poissonRatioYX); C(2, 2) = youngsModulusShear; // Determine \partial x/\partial m_i @@ -914,9 +876,9 @@ bool PositionBasedDynamics::solve_FEMTriangleConstraint( // epsilon = 0.5(F^T * F - I) Matrix2r epsilon; - epsilon(0,0) = 0.5*(F(0,0) * F(0,0) + F(1,0) * F(1,0) + F(2,0) * F(2,0) - 1.0); // xx - epsilon(1,1) = 0.5*(F(0,1) * F(0,1) + F(1,1) * F(1,1) + F(2,1) * F(2,1) - 1.0); // yy - epsilon(0,1) = 0.5*(F(0,0) * F(0,1) + F(1,0) * F(1,1) + F(2,0) * F(2,1)); // xy + epsilon(0,0) = static_cast(0.5)*(F(0,0) * F(0,0) + F(1,0) * F(1,0) + F(2,0) * F(2,0) - static_cast(1.0)); // xx + epsilon(1,1) = static_cast(0.5)*(F(0,1) * F(0,1) + F(1,1) * F(1,1) + F(2,1) * F(2,1) - static_cast(1.0)); // yy + epsilon(0,1) = static_cast(0.5)*(F(0,0) * F(0,1) + F(1,0) * F(1,1) + F(2,0) * F(2,1)); // xy epsilon(1,0) = epsilon(0,1); // P(F) = det(F) * C*E * F^-T => E = green strain @@ -932,7 +894,7 @@ bool PositionBasedDynamics::solve_FEMTriangleConstraint( for (unsigned char j = 0; j < 2; j++) for (unsigned char k = 0; k < 2; k++) psi += epsilon(j,k) * stress(j,k); - psi = 0.5*psi; + psi = static_cast(0.5)*psi; Real energy = area*psi; // compute gradient @@ -976,7 +938,7 @@ bool PositionBasedDynamics::init_FEMTetraConstraint( // compute only when rest Real &volume, Matrix3r &invRestMat) { - volume = fabs((1.0 / 6.0) * (p3 - p0).dot((p2 - p0).cross(p1 - p0))); + volume = fabs(static_cast(1.0 / 6.0) * (p3 - p0).dot((p2 - p0).cross(p1 - p0))); Matrix3r m; m.col(0) = p0 - p3; @@ -1018,12 +980,12 @@ void PositionBasedDynamics::computeGreenStrainAndPiolaStress( // epsilon = 1/2 F^T F - I - epsilon(0, 0) = 0.5*(F(0, 0) * F(0, 0) + F(1, 0) * F(1, 0) + F(2, 0) * F(2, 0) - 1.0); // xx - epsilon(1, 1) = 0.5*(F(0, 1) * F(0, 1) + F(1, 1) * F(1, 1) + F(2, 1) * F(2, 1) - 1.0); // yy - epsilon(2, 2) = 0.5*(F(0, 2) * F(0, 2) + F(1, 2) * F(1, 2) + F(2, 2) * F(2, 2) - 1.0); // zz - epsilon(0, 1) = 0.5*(F(0, 0) * F(0, 1) + F(1, 0) * F(1, 1) + F(2, 0) * F(2, 1)); // xy - epsilon(0, 2) = 0.5*(F(0, 0) * F(0, 2) + F(1, 0) * F(1, 2) + F(2, 0) * F(2, 2)); // xz - epsilon(1, 2) = 0.5*(F(0, 1) * F(0, 2) + F(1, 1) * F(1, 2) + F(2, 1) * F(2, 2)); // yz + epsilon(0, 0) = static_cast(0.5)*(F(0, 0) * F(0, 0) + F(1, 0) * F(1, 0) + F(2, 0) * F(2, 0) - static_cast(1.0)); // xx + epsilon(1, 1) = static_cast(0.5)*(F(0, 1) * F(0, 1) + F(1, 1) * F(1, 1) + F(2, 1) * F(2, 1) - static_cast(1.0)); // yy + epsilon(2, 2) = static_cast(0.5)*(F(0, 2) * F(0, 2) + F(1, 2) * F(1, 2) + F(2, 2) * F(2, 2) - static_cast(1.0)); // zz + epsilon(0, 1) = static_cast(0.5)*(F(0, 0) * F(0, 1) + F(1, 0) * F(1, 1) + F(2, 0) * F(2, 1)); // xy + epsilon(0, 2) = static_cast(0.5)*(F(0, 0) * F(0, 2) + F(1, 0) * F(1, 2) + F(2, 0) * F(2, 2)); // xz + epsilon(1, 2) = static_cast(0.5)*(F(0, 1) * F(0, 2) + F(1, 1) * F(1, 2) + F(2, 1) * F(2, 2)); // yz epsilon(1, 0) = epsilon(0, 1); epsilon(2, 0) = epsilon(0, 2); epsilon(2, 1) = epsilon(1, 2); @@ -1041,7 +1003,7 @@ void PositionBasedDynamics::computeGreenStrainAndPiolaStress( for (unsigned char j = 0; j < 3; j++) for (unsigned char k = 0; k < 3; k++) psi += epsilon(j, k) * epsilon(j, k); - psi = mu*psi + 0.5*lambda * trace*trace; + psi = mu*psi + static_cast(0.5)*lambda * trace*trace; energy = restVolume * psi; } @@ -1097,7 +1059,7 @@ void PositionBasedDynamics::computeGreenStrainAndPiolaStressInversion( MathFunctions::svdWithInversionHandling(F, hatF, U, VT); // Clamp small singular values - const Real minXVal = 0.577; + const Real minXVal = static_cast(0.577); for (unsigned char j = 0; j < 3; j++) { @@ -1106,7 +1068,9 @@ void PositionBasedDynamics::computeGreenStrainAndPiolaStressInversion( } // epsilon for hatF - Vector3r epsilonHatF(0.5*(hatF[0]*hatF[0] - 1.0), 0.5*(hatF[1]*hatF[1] - 1.0), 0.5*(hatF[2]*hatF[2] - 1.0)); + Vector3r epsilonHatF( static_cast(0.5)*(hatF[0]*hatF[0] - static_cast(1.0)), + static_cast(0.5)*(hatF[1]*hatF[1] - static_cast(1.0)), + static_cast(0.5)*(hatF[2]*hatF[2] - static_cast(1.0))); const Real trace = epsilonHatF[0] + epsilonHatF[1] + epsilonHatF[2]; const Real ltrace = lambda*trace; @@ -1135,7 +1099,7 @@ void PositionBasedDynamics::computeGreenStrainAndPiolaStressInversion( for (unsigned char j = 0; j < 3; j++) for (unsigned char k = 0; k < 3; k++) psi += epsilon(j, k) * epsilon(j, k); - psi = mu*psi + 0.5*lambda * trace*trace; + psi = mu*psi + static_cast(0.5)*lambda * trace*trace; energy = restVolume*psi; } @@ -1168,10 +1132,10 @@ bool PositionBasedDynamics::solve_FEMTetraConstraint( Real C = 0.0; Vector3r gradC[4]; Matrix3r epsilon, sigma; - Real volume = (p1 - p0).cross(p2 - p0).dot(p3 - p0) / 6.0; + Real volume = (p1 - p0).cross(p2 - p0).dot(p3 - p0) / static_cast(6.0); - Real mu = youngsModulus / 2.0 / (1.0 + poissonRatio); - Real lambda = youngsModulus * poissonRatio / (1.0 + poissonRatio) / (1.0 - 2.0 * poissonRatio); + Real mu = youngsModulus / static_cast(2.0) / (static_cast(1.0) + poissonRatio); + Real lambda = youngsModulus * poissonRatio / (static_cast(1.0) + poissonRatio) / (static_cast(1.0) - static_cast(2.0) * poissonRatio); if (!handleInversion || volume > 0.0) { @@ -1203,3 +1167,161 @@ bool PositionBasedDynamics::solve_FEMTetraConstraint( return true; } + +// ---------------------------------------------------------------------------------------------- +bool PositionBasedDynamics::init_ParticleTetContactConstraint( + const Real invMass0, // inverse mass is zero if particle is static + const Vector3r &x0, // particle which collides with tet + const Vector3r &v0, // velocity of particle + const Real invMass[], // inverse masses of tet particles + const Vector3r x[], // positions of tet particles + const Vector3r v[], // velocities of tet particles + const Vector3r &bary, // barycentric coordinates of contact point in tet + const Vector3r &normal, // contact normal in body 1 + Eigen::Matrix &constraintInfo) +{ + // constraintInfo contains + // 0: contact normal in body 1 (global) + // 1: contact tangent (global) + // 0,1: 1.0 / normal^T * K * normal + // 1,2: maximal impulse in tangent direction + + const Real bary0 = static_cast(1.0) - bary[0] - bary[1] - bary[2]; + + // compute world space contact point in body 2 + const Vector3r v1 = bary0*v[0] + bary[0] * v[1] + bary[1] * v[2] + bary[2] * v[3]; + + // compute goal velocity in normal direction after collision + const Vector3r u_rel = v0 - v1; + const Real u_rel_n = normal.dot(u_rel); + + constraintInfo.col(0) = normal; + + // tangent direction + Vector3r t = u_rel - u_rel_n*normal; + Real tl2 = t.squaredNorm(); + if (tl2 > 1.0e-6) + t *= static_cast(1.0) / sqrt(tl2); + + constraintInfo.col(1) = t; + + // determine 1/(J M^-1 J^T) + const Real JMinvJT = invMass0 + bary0*bary0*invMass[0] + bary[0]*bary[0]*invMass[1] + bary[1]*bary[1]*invMass[2] + bary[2]*bary[2]*invMass[3]; + constraintInfo(0, 2) = static_cast(1.0) / JMinvJT; + + // maximal impulse in tangent direction + constraintInfo(1, 2) = static_cast(1.0) / JMinvJT * u_rel.dot(t); + + return true; +} + +//-------------------------------------------------------------------------------------------- +bool PositionBasedDynamics::solve_ParticleTetContactConstraint( + const Real invMass0, // inverse mass is zero if particle is static + const Vector3r &x0, // particle which collides with tet + const Real invMass[], // inverse masses of tet particles + const Vector3r x[], // positions of tet particles + const Vector3r &bary, // barycentric coordinates of contact point in tet + Eigen::Matrix &constraintInfo, // precomputed contact info + Real &lambda, + Vector3r &corr0, + Vector3r corr[]) +{ + // constraintInfo contains + // 0: contact normal in body 1 (global) + // 1: contact tangent (global) + // 0,2: 1.0 / normal^T * K * normal + // 1,2: maximal impulse in tangent direction + + if ((invMass0 == 0.0) && (invMass[0] == 0.0) && (invMass[1] == 0.0) && (invMass[2] == 0.0)) + return false; + + const Real bary0 = static_cast(1.0) - bary[0] - bary[1] - bary[2]; + + // compute world space contact point in body 2 + const Vector3r cp1 = bary0*x[0] + bary[0] * x[1] + bary[1] * x[2] + bary[2] * x[3]; + + const Vector3r &normal = constraintInfo.col(0); + + // 1.0 / normal^T * K * normal + const Real nKn_inv = constraintInfo(0, 2); + + // penetration depth + const Real C = normal.dot(x0 - cp1); + + lambda = -nKn_inv * C; + + + Vector3r p(lambda * normal); + if (invMass0 != 0.0) + { + corr0 = invMass0*p; + } + + if (invMass[0] != 0.0) + corr[0] = -invMass[0] * bary0*p; + if (invMass[1] != 0.0) + corr[1] = -invMass[1] * bary[0] * p; + if (invMass[2] != 0.0) + corr[2] = -invMass[2] * bary[1] * p; + if (invMass[3] != 0.0) + corr[3] = -invMass[3] * bary[2] * p; + + return true; +} + +//-------------------------------------------------------------------------------------------- +bool PositionBasedDynamics::velocitySolve_ParticleTetContactConstraint( + const Real invMass0, // inverse mass is zero if particle is static + const Vector3r &x0, // particle which collides with tet + const Vector3r &v0, // velocity of particle + const Real invMass[], // inverse masses of tet particles + const Vector3r x[], // positions of tet particles + const Vector3r v[], // velocities of tet particles + const Vector3r &bary, // barycentric coordinates of contact point in tet + const Real lambda, + const Real frictionCoeff, // friction coefficient + Eigen::Matrix &constraintInfo, // precomputed contact info + Vector3r &corr_v0, + Vector3r corr_v[]) +{ + // constraintInfo contains + // 0: contact normal in body 1 (global) + // 1: contact tangent (global) + // 0,2: 1.0 / normal^T * K * normal + // 1,2: maximal impulse in tangent direction + + if ((invMass0 == 0.0) && (invMass[0] == 0.0) && (invMass[1] == 0.0) && (invMass[2] == 0.0)) + return false; + + const Real bary0 = static_cast(1.0) - bary[0] - bary[1] - bary[2]; + + // Friction + // maximal impulse in tangent direction + const Real pMax = constraintInfo(1, 2); + const Vector3r &tangent = constraintInfo.col(1); + Vector3r pv; + if (frictionCoeff * lambda > pMax) + pv = -pMax * tangent; + else if (frictionCoeff * lambda < -pMax) + pv = pMax * tangent; + else + pv = -frictionCoeff * lambda * tangent; + + if (invMass0 != 0.0) + { + corr_v0 = invMass0*pv; + } + + if (invMass[0] != 0.0) + corr_v[0] = -invMass[0] * bary0*pv; + if (invMass[1] != 0.0) + corr_v[1] = -invMass[1] * bary[0] * pv; + if (invMass[2] != 0.0) + corr_v[2] = -invMass[2] * bary[1] * pv; + if (invMass[3] != 0.0) + corr_v[3] = -invMass[3] * bary[2] * pv; + + + return true; +} diff --git a/PositionBasedDynamics/PositionBasedDynamics.h b/PositionBasedDynamics/PositionBasedDynamics.h index fe676723..4a44377f 100644 --- a/PositionBasedDynamics/PositionBasedDynamics.h +++ b/PositionBasedDynamics/PositionBasedDynamics.h @@ -21,8 +21,7 @@ namespace PBD * @param p1 position of second particle * @param invMass1 inverse mass of second particle * @param restLength rest length of distance constraint - * @param compressionStiffness stiffness coefficient for compression - * @param stretchStiffness stiffness coefficient for stretching + * @param stiffness stiffness coefficient * @param corr0 position correction of first particle * @param corr1 position correction of second particle */ @@ -30,8 +29,7 @@ namespace PBD const Vector3r &p0, Real invMass0, const Vector3r &p1, Real invMass1, const Real restLength, - const Real compressionStiffness, - const Real stretchStiffness, + const Real stiffness, Vector3r &corr0, Vector3r &corr1); @@ -99,8 +97,7 @@ namespace PBD * @param p3 position of fourth particle * @param invMass3 inverse mass of fourth particle * @param restVolume rest angle \f$V_0\f$ - * @param negVolumeStiffness stiffness coefficient for compression - * @param posVolumeStiffness stiffness coefficient for stretching + * @param stiffness stiffness coefficient * @param corr0 position correction of first particle * @param corr1 position correction of second particle * @param corr2 position correction of third particle @@ -112,8 +109,7 @@ namespace PBD const Vector3r &p2, Real invMass2, const Vector3r &p3, Real invMass3, const Real restVolume, - const Real negVolumeStiffness, - const Real posVolumeStiffness, + const Real stiffness, Vector3r &corr0, Vector3r &corr1, Vector3r &corr2, Vector3r &corr3); /** Determine the position corrections for a constraint that preserves a @@ -261,11 +257,10 @@ namespace PBD * @param invMasses inverse masses of all particles in the cluster * @param numPoints number of particles in the cluster * @param restCm returns the center of mass of the rest configuration - * @param invRestMat returns a matrix required by the solver */ static bool init_ShapeMatchingConstraint( const Vector3r x0[], const Real invMasses[], const int numPoints, - Vector3r &restCm, Matrix3r &invRestMat); + Vector3r &restCm); /** Determine the position corrections for a shape matching constraint.\n\n * More information can be found in: \cite BMM2015, \cite BMOT2013, \cite BMOTM2014, @@ -276,7 +271,6 @@ namespace PBD * @param invMasses invMasses inverse masses of all particles in the cluster * @param numPoints number of particles in the cluster * @param restCm center of mass of the rest configuration - * @param invRestMat matrix precomputed by init_ShapeMatchingConstraint() * @param stiffness stiffness coefficient * @param allowStretch allow stretching * @param corr position corrections for all particles in the cluster @@ -285,7 +279,6 @@ namespace PBD static bool solve_ShapeMatchingConstraint( const Vector3r x0[], const Vector3r x[], const Real invMasses[], const int numPoints, const Vector3r &restCm, - const Matrix3r &invRestMat, const Real stiffness, const bool allowStretch, // default false Vector3r corr[], Matrix3r *rot = NULL); @@ -374,7 +367,6 @@ namespace PBD // -------------- FEM Based PBD ----------------------------------------------------- - private: static void computeGradCGreen( Real restVolume, const Matrix3r &invRestMat, @@ -397,7 +389,11 @@ namespace PBD public: - /** Initialize rest configuration infos which are required by the solver step. + /** Implementation of the finite element method described in \n\n + * Jan Bender, Dan Koschier, Patrick Charrier and Daniel Weber, \n + * "Position-Based Simulation of Continuous Materials", \n + * Computers & Graphics 44, 2014\n\n + * Initialize rest configuration infos which are required by the solver step. * Recomputation is only necessary when rest shape changes. */ static bool init_FEMTriangleConstraint( @@ -408,6 +404,12 @@ namespace PBD Matrix2r &invRestMat ); + /** Implementation of the finite element method described in \n\n + * Jan Bender, Dan Koschier, Patrick Charrier and Daniel Weber, \n + * "Position-Based Simulation of Continuous Materials", \n + * Computers & Graphics 44, 2014\n\n + * Solve the continuum mechanical constraint defined for a triangle. + */ static bool solve_FEMTriangleConstraint( const Vector3r &p0, Real invMass0, const Vector3r &p1, Real invMass1, @@ -421,7 +423,11 @@ namespace PBD const Real poissonRatioYX, Vector3r &corr0, Vector3r &corr1, Vector3r &corr2); - /** Initialize rest configuration infos which are required by the solver step. + /** Implementation of the finite element method described in \n\n + * Jan Bender, Dan Koschier, Patrick Charrier and Daniel Weber, \n + * "Position-Based Simulation of Continuous Materials", \n + * Computers & Graphics 44, 2014\n\n + * Initialize rest configuration infos which are required by the solver step. * Recomputation is only necessary when rest shape changes. */ static bool init_FEMTetraConstraint( @@ -433,6 +439,12 @@ namespace PBD Matrix3r &invRestMat ); + /** Implementation of the finite element method described in \n\n + * Jan Bender, Dan Koschier, Patrick Charrier and Daniel Weber, \n + * "Position-Based Simulation of Continuous Materials", \n + * Computers & Graphics 44, 2014\n\n + * Solve the continuum mechanical constraint defined for a tetrahedron. + */ static bool solve_FEMTetraConstraint( const Vector3r &p0, Real invMass0, const Vector3r &p1, Real invMass1, @@ -444,7 +456,95 @@ namespace PBD const Real poissonRatio, const bool handleInversion, Vector3r &corr0, Vector3r &corr1, Vector3r &corr2, Vector3r &corr3); + + + /** Initialize contact between a particle and a tetrahedron and return + * info which is required by the solver step. + * + * @param invMass0 inverse mass of particle which collides with tet + * @param x0 particle position + * @param v0 particle velocity + * @param invMass inverse masses of tet particles + * @param x positions of tet particles + * @param v velocities of tet particles + * @param bary barycentric coordinates of contact point in tet + * @param normal contact normal in body 1 + * @param constraintInfo Stores the local and global position of the contact points and + * the contact normal. \n + * The joint info contains the following columns:\n + * 0: contact normal in body 1 (global)\n + * 1: contact tangent (global)\n + * 0,2: 1.0 / normal^T * K * normal\n + * 1,2: maximal impulse in tangent direction\n + */ + static bool init_ParticleTetContactConstraint( + const Real invMass0, // inverse mass is zero if particle is static + const Vector3r &x0, // particle which collides with tet + const Vector3r &v0, // velocity of particle + const Real invMass[], // inverse masses of tet particles + const Vector3r x[], // positions of tet particles + const Vector3r v[], // velocities of tet particles + const Vector3r &bary, // barycentric coordinates of contact point in tet + const Vector3r &normal, // contact normal in body 1 + Eigen::Matrix &constraintInfo); + + + /** Perform a solver step for a contact constraint between a particle and a tetrahedron. + * A contact constraint handles collisions and resting contacts between the bodies. + * The contact info must be generated in each time step. + * + * @param invMass0 inverse mass of particle which collides with tet + * @param x0 particle position + * @param invMass inverse masses of tet particles + * @param x positions of tet particles + * @param bary barycentric coordinates of contact point in tet + * @param constraintInfo information which is required by the solver. This + * information must be generated in the beginning by calling init_RigidBodyContactConstraint(). + * @param corr0 position correction of particle + * @param corr position corrections of tet particles + */ + static bool solve_ParticleTetContactConstraint( + const Real invMass0, // inverse mass is zero if particle is static + const Vector3r &x0, // particle which collides with tet + const Real invMass[], // inverse masses of tet particles + const Vector3r x[], // positions of tet particles + const Vector3r &bary, // barycentric coordinates of contact point in tet + Eigen::Matrix &constraintInfo, // precomputed contact info + Real &lambda, + Vector3r &corr0, + Vector3r corr[]); + + /** Perform a solver step for a contact constraint between a particle and a tetrahedron. + * A contact constraint handles collisions and resting contacts between the bodies. + * The contact info must be generated in each time step. + * + * @param invMass0 inverse mass of particle which collides with tet + * @param x0 particle position + * @param v0 particle velocity + * @param invMass inverse masses of tet particles + * @param x positions of tet particles + * @param v velocities of tet particles + * @param bary barycentric coordinates of contact point in tet + * @param frictionCoeff friction coefficient + * @param constraintInfo information which is required by the solver. This + * information must be generated in the beginning by calling init_RigidBodyContactConstraint(). + * @param corr_v0 velocity correction of particle + * @param corr_v velocity corrections of tet particles + */ + static bool velocitySolve_ParticleTetContactConstraint( + const Real invMass0, // inverse mass is zero if particle is static + const Vector3r &x0, // particle which collides with tet + const Vector3r &v0, // velocity of particle + const Real invMass[], // inverse masses of tet particles + const Vector3r x[], // positions of tet particles + const Vector3r v[], // velocities of tet particles + const Vector3r &bary, // barycentric coordinates of contact point in tet + const Real lambda, + const Real frictionCoeff, // friction coefficient + Eigen::Matrix &constraintInfo, // precomputed contact info + Vector3r &corr_v0, + Vector3r corr_v[]); }; } -#endif \ No newline at end of file +#endif diff --git a/PositionBasedDynamics/PositionBasedElasticRods.cpp b/PositionBasedDynamics/PositionBasedElasticRods.cpp new file mode 100644 index 00000000..0908a6ae --- /dev/null +++ b/PositionBasedDynamics/PositionBasedElasticRods.cpp @@ -0,0 +1,1363 @@ +#include "PositionBasedElasticRods.h" +#include "PositionBasedDynamics/MathFunctions.h" + +#include "Utils/Logger.h" + +#define _USE_MATH_DEFINES +#include "math.h" + +using namespace PBD; + +const Real eps = static_cast(1e-6); + +const int permutation[3][3] = { + 0, 2, 1, + 1, 0, 2, + 2, 1, 0 +}; + +// ---------------------------------------------------------------------------------------------- +bool PositionBasedCosseratRods::solve_StretchShearConstraint( + const Vector3r& p0, Real invMass0, + const Vector3r& p1, Real invMass1, + const Quaternionr& q0, Real invMassq0, + const Vector3r& stretchingAndShearingKs, + const Real restLength, + Vector3r& corr0, Vector3r& corr1, Quaternionr& corrq0) +{ + Vector3r d3; //third director d3 = q0 * e_3 * q0_conjugate + d3[0] = static_cast(2.0) * (q0.x() * q0.z() + q0.w() * q0.y()); + d3[1] = static_cast(2.0) * (q0.y() * q0.z() - q0.w() * q0.x()); + d3[2] = q0.w() * q0.w() - q0.x() * q0.x() - q0.y() * q0.y() + q0.z() * q0.z(); + + Vector3r gamma = (p1 - p0) / restLength - d3; + gamma /= (invMass1 + invMass0) / restLength + invMassq0 * static_cast(4.0)*restLength + eps; + + if (std::abs(stretchingAndShearingKs[0] - stretchingAndShearingKs[1]) < eps && std::abs(stretchingAndShearingKs[0] - stretchingAndShearingKs[2]) < eps) //all Ks are approx. equal + for (int i = 0; i<3; i++) gamma[i] *= stretchingAndShearingKs[i]; + else //diffenent stretching and shearing Ks. Transform diag(Ks[0], Ks[1], Ks[2]) into world space using Ks_w = R(q0) * diag(Ks[0], Ks[1], Ks[2]) * R^T(q0) and multiply it with gamma + { + Matrix3r R = q0.toRotationMatrix(); + gamma = (R.transpose() * gamma).eval(); + for (int i = 0; i<3; i++) gamma[i] *= stretchingAndShearingKs[i]; + gamma = (R * gamma).eval(); + } + + corr0 = invMass0 * gamma; + corr1 = -invMass1 * gamma; + + Quaternionr q_e_3_bar(q0.z(), -q0.y(), q0.x(), -q0.w()); //compute q*e_3.conjugate (cheaper than quaternion product) + corrq0 = Quaternionr(0.0, gamma.x(), gamma.y(), gamma.z()) * q_e_3_bar; + corrq0.coeffs() *= static_cast(2.0) * invMassq0 * restLength; + + return true; +} + +// ---------------------------------------------------------------------------------------------- +bool PositionBasedCosseratRods::solve_BendTwistConstraint( + const Quaternionr& q0, Real invMassq0, + const Quaternionr& q1, Real invMassq1, + const Vector3r& bendingAndTwistingKs, + const Quaternionr& restDarbouxVector, + Quaternionr& corrq0, Quaternionr& corrq1) +{ + Quaternionr omega = q0.conjugate() * q1; //darboux vector + + Quaternionr omega_plus; + omega_plus.coeffs() = omega.coeffs() + restDarbouxVector.coeffs(); //delta Omega with -Omega_0 + omega.coeffs() = omega.coeffs() - restDarbouxVector.coeffs(); //delta Omega with + omega_0 + if (omega.squaredNorm() > omega_plus.squaredNorm()) omega = omega_plus; + + for (int i = 0; i < 3; i++) omega.coeffs()[i] *= bendingAndTwistingKs[i] / (invMassq0 + invMassq1 + static_cast(1.0e-6)); + omega.w() = 0.0; //discrete Darboux vector does not have vanishing scalar part + + corrq0 = q1 * omega; + corrq1 = q0 * omega; + corrq0.coeffs() *= invMassq0; + corrq1.coeffs() *= -invMassq1; + return true; +} + +// ---------------------------------------------------------------------------------------------- +bool PositionBasedElasticRods::solve_PerpendiculaBisectorConstraint( + const Vector3r &p0, Real invMass0, + const Vector3r &p1, Real invMass1, + const Vector3r &p2, Real invMass2, + const Real stiffness, + Vector3r &corr0, Vector3r &corr1, Vector3r &corr2) +{ + const Vector3r pm = 0.5 * (p0 + p1); + const Vector3r p0p2 = p0 - p2; + const Vector3r p2p1 = p2 - p1; + const Vector3r p1p0 = p1 - p0; + const Vector3r p2pm = p2 - pm; + + Real wSum = invMass0 * p0p2.squaredNorm() + invMass1 * p2p1.squaredNorm() + invMass2 * p1p0.squaredNorm(); + if (wSum < eps) + return false; + + const Real lambda = stiffness * p2pm.dot(p1p0) / wSum; + + corr0 = -invMass0 * lambda * p0p2; + corr1 = -invMass1 * lambda * p2p1; + corr2 = -invMass2 * lambda * p1p0; + + return true; +} + +// ---------------------------------------------------------------------------------------------- +bool PositionBasedElasticRods::solve_GhostPointEdgeDistanceConstraint( + const Vector3r& p0, Real invMass0, + const Vector3r& p1, Real invMass1, + const Vector3r& p2, Real invMass2, + const Real stiffness, + const Real ghostEdgeRestLength, + Vector3r& corr0, Vector3r& corr1, Vector3r& corr2) +{ + // Ghost-Edge constraint + Vector3r pm = 0.5 * (p0 + p1); + Vector3r p2pm = p2 - pm; + Real wSum = static_cast(0.25) * invMass0 + static_cast(0.25) * invMass1 + static_cast(1.0) * invMass2; + + if (wSum < eps) + return false; + + Real p2pm_mag = p2pm.norm(); + p2pm *= static_cast(1.0) / p2pm_mag; + + const Real lambda = stiffness * (p2pm_mag - ghostEdgeRestLength) / wSum; + + corr0 = 0.5 * invMass0 * lambda * p2pm; + corr1 = 0.5 * invMass1 * lambda * p2pm; + corr2 = -1.0 * invMass2 * lambda * p2pm; + + return true; +} + +// ---------------------------------------------------------------------------------------------- +bool PositionBasedElasticRods::solve_DarbouxVectorConstraint( + const Vector3r& p0, Real invMass0, + const Vector3r& p1, Real invMass1, + const Vector3r& p2, Real invMass2, + const Vector3r& p3, Real invMass3, + const Vector3r& p4, Real invMass4, + const Vector3r& bendingAndTwistingKs, + const Real midEdgeLength, + const Vector3r& restDarbouxVector, + Vector3r& corr0, Vector3r& corr1, Vector3r& corr2, Vector3r& corr3, Vector3r& corr4) +{ + // Single rod element: + // 3 4 //ghost points + // | | + // --0---1---2-- // rod points + + Vector3r darboux_vector; + Matrix3r d0, d1; + + PositionBasedElasticRods::computeMaterialFrame(p0, p1, p3, d0); + PositionBasedElasticRods::computeMaterialFrame(p1, p2, p4, d1); + + PositionBasedElasticRods::computeDarbouxVector(d0, d1, midEdgeLength, darboux_vector); + + Matrix3r dajpi[3][3]; + computeMaterialFrameDerivative(p0, p1, p3, d0, + dajpi[0][0], dajpi[0][1], dajpi[0][2], + dajpi[1][0], dajpi[1][1], dajpi[1][2], + dajpi[2][0], dajpi[2][1], dajpi[2][2]); + + Matrix3r dbjpi[3][3]; + computeMaterialFrameDerivative(p1, p2, p4, d1, + dbjpi[0][0], dbjpi[0][1], dbjpi[0][2], + dbjpi[1][0], dbjpi[1][1], dbjpi[1][2], + dbjpi[2][0], dbjpi[2][1], dbjpi[2][2]); + + Matrix3r constraint_jacobian[5]; + computeDarbouxGradient( + darboux_vector, midEdgeLength, d0, d1, + dajpi, dbjpi, + //bendingAndTwistingKs, + constraint_jacobian[0], + constraint_jacobian[1], + constraint_jacobian[2], + constraint_jacobian[3], + constraint_jacobian[4]); + + const Vector3r constraint_value(bendingAndTwistingKs[0] * (darboux_vector[0] - restDarbouxVector[0]), + bendingAndTwistingKs[1] * (darboux_vector[1] - restDarbouxVector[1]), + bendingAndTwistingKs[2] * (darboux_vector[2] - restDarbouxVector[2])); + + Matrix3r factor_matrix; + factor_matrix.setZero(); + + Matrix3r tmp_mat; + Real invMasses[]{ invMass0, invMass1, invMass2, invMass3, invMass4 }; + for (int i = 0; i < 5; ++i) + { + tmp_mat = constraint_jacobian[i].transpose() * constraint_jacobian[i]; + tmp_mat.col(0) *= invMasses[i]; + tmp_mat.col(1) *= invMasses[i]; + tmp_mat.col(2) *= invMasses[i]; + + factor_matrix += tmp_mat; + } + + Vector3r dp[5]; + tmp_mat = factor_matrix.inverse(); + + for (int i = 0; i < 5; ++i) + { + constraint_jacobian[i].col(0) *= invMasses[i]; + constraint_jacobian[i].col(1) *= invMasses[i]; + constraint_jacobian[i].col(2) *= invMasses[i]; + dp[i] = -(constraint_jacobian[i]) * (tmp_mat * constraint_value); + } + + corr0 = dp[0]; + corr1 = dp[1]; + corr2 = dp[2]; + corr3 = dp[3]; + corr4 = dp[4]; + + return true; +} + +// ---------------------------------------------------------------------------------------------- +bool PositionBasedElasticRods::computeMaterialFrame( + const Vector3r& p0, + const Vector3r& p1, + const Vector3r& p2, + Matrix3r& frame) +{ + frame.col(2) = (p1 - p0); + frame.col(2).normalize(); + + frame.col(1) = (frame.col(2).cross(p2 - p0)); + frame.col(1).normalize(); + + frame.col(0) = frame.col(1).cross(frame.col(2)); + return true; +} + +// ---------------------------------------------------------------------------------------------- +bool PositionBasedElasticRods::computeDarbouxVector(const Matrix3r& dA, const Matrix3r& dB, const Real mid_edge_length, Vector3r& darboux_vector) +{ + Real factor = static_cast(1.0) + dA.col(0).dot(dB.col(0)) + dA.col(1).dot(dB.col(1)) + dA.col(2).dot(dB.col(2)); + + factor = static_cast(2.0) / (mid_edge_length * factor); + + for (int c = 0; c < 3; ++c) + { + const int i = permutation[c][0]; + const int j = permutation[c][1]; + const int k = permutation[c][2]; + darboux_vector[i] = dA.col(j).dot(dB.col(k)) - dA.col(k).dot(dB.col(j)); + } + darboux_vector *= factor; + return true; +} + +// ---------------------------------------------------------------------------------------------- +bool PositionBasedElasticRods::computeMaterialFrameDerivative( + const Vector3r& p0, const Vector3r& p1, const Vector3r& p2, const Matrix3r& d, + Matrix3r& d1p0, Matrix3r& d1p1, Matrix3r& d1p2, + Matrix3r& d2p0, Matrix3r& d2p1, Matrix3r& d2p2, + Matrix3r& d3p0, Matrix3r& d3p1, Matrix3r& d3p2) +{ + ////////////////////////////////////////////////////////////////////////// + // d3pi + ////////////////////////////////////////////////////////////////////////// + const Vector3r p01 = p1 - p0; + Real length_p01 = p01.norm(); + + d3p0.col(0) = d.col(2)[0] * d.col(2); + d3p0.col(1) = d.col(2)[1] * d.col(2); + d3p0.col(2) = d.col(2)[2] * d.col(2); + + d3p0.col(0)[0] -= 1.0; + d3p0.col(1)[1] -= 1.0; + d3p0.col(2)[2] -= 1.0; + + d3p0.col(0) *= (static_cast(1.0) / length_p01); + d3p0.col(1) *= (static_cast(1.0) / length_p01); + d3p0.col(2) *= (static_cast(1.0) / length_p01); + + d3p1.col(0) = -d3p0.col(0); + d3p1.col(1) = -d3p0.col(1); + d3p1.col(2) = -d3p0.col(2); + + d3p2.col(0).setZero(); + d3p2.col(1).setZero(); + d3p2.col(2).setZero(); + + ////////////////////////////////////////////////////////////////////////// + // d2pi + ////////////////////////////////////////////////////////////////////////// + const Vector3r p02 = p2 - p0; + const Vector3r p01_cross_p02 = p01.cross(p02); + + const Real length_cross = p01_cross_p02.norm(); + + Matrix3r mat; + mat.col(0) = d.col(1)[0] * d.col(1); + mat.col(1) = d.col(1)[1] * d.col(1); + mat.col(2) = d.col(1)[2] * d.col(1); + + mat.col(0)[0] -= 1.0; + mat.col(1)[1] -= 1.0; + mat.col(2)[2] -= 1.0; + + mat.col(0) *= (-static_cast(1.0) / length_cross); + mat.col(1) *= (-static_cast(1.0) / length_cross); + mat.col(2) *= (-static_cast(1.0) / length_cross); + + Matrix3r product_matrix; + MathFunctions::crossProductMatrix(p2 - p1, product_matrix); + d2p0 = mat * product_matrix; + + MathFunctions::crossProductMatrix(p0 - p2, product_matrix); + d2p1 = mat * product_matrix; + + MathFunctions::crossProductMatrix(p1 - p0, product_matrix); + d2p2 = mat * product_matrix; + + ////////////////////////////////////////////////////////////////////////// + // d1pi + ////////////////////////////////////////////////////////////////////////// + Matrix3r product_mat_d3; + Matrix3r product_mat_d2; + MathFunctions::crossProductMatrix(d.col(2), product_mat_d3); + MathFunctions::crossProductMatrix(d.col(1), product_mat_d2); + + d1p0 = product_mat_d2 * d3p0 - product_mat_d3 * d2p0; + d1p1 = product_mat_d2 * d3p1 - product_mat_d3 * d2p1; + d1p2 = -product_mat_d3 * d2p2; + return true; +} + +// ---------------------------------------------------------------------------------------------- +bool PositionBasedElasticRods::computeDarbouxGradient( + const Vector3r& darboux_vector, const Real length, + const Matrix3r& da, const Matrix3r& db, + const Matrix3r dajpi[3][3], const Matrix3r dbjpi[3][3], + //const Vector3r& bendAndTwistKs, + Matrix3r& omega_pa, Matrix3r& omega_pb, Matrix3r& omega_pc, Matrix3r& omega_pd, Matrix3r& omega_pe + ) +{ + Real X = static_cast(1.0) + da.col(0).dot(db.col(0)) + da.col(1).dot(db.col(1)) + da.col(2).dot(db.col(2)); + X = static_cast(2.0) / (length * X); + + for (int c = 0; c < 3; ++c) + { + const int i = permutation[c][0]; + const int j = permutation[c][1]; + const int k = permutation[c][2]; + // pa + { + Vector3r term1(0,0,0); + Vector3r term2(0,0,0); + Vector3r tmp(0,0,0); + + // first term + term1 = dajpi[j][0].transpose() * db.col(k); + tmp = dajpi[k][0].transpose() * db.col(j); + term1 = term1 - tmp; + // second term + for (int n = 0; n < 3; ++n) + { + tmp = dajpi[n][0].transpose() * db.col(n); + term2 = term2 + tmp; + } + omega_pa.col(i) = X * (term1-(0.5 * darboux_vector[i] * length) * term2); + //omega_pa.col(i) *= bendAndTwistKs[i]; + } + // pb + { + Vector3r term1(0, 0, 0); + Vector3r term2(0, 0, 0); + Vector3r tmp(0, 0, 0); + // first term + term1 = dajpi[j][1].transpose() * db.col(k); + tmp = dajpi[k][1].transpose() * db.col(j); + term1 = term1 - tmp; + // third term + tmp = dbjpi[j][0].transpose() * da.col(k); + term1 = term1 - tmp; + + tmp = dbjpi[k][0].transpose() * da.col(j); + term1 = term1 + tmp; + + // second term + for (int n = 0; n < 3; ++n) + { + tmp = dajpi[n][1].transpose() * db.col(n); + term2 = term2 + tmp; + + tmp = dbjpi[n][0].transpose() * da.col(n); + term2 = term2 + tmp; + } + omega_pb.col(i) = X * (term1-(0.5 * darboux_vector[i] * length) * term2); + //omega_pb.col(i) *= bendAndTwistKs[i]; + } + // pc + { + Vector3r term1(0, 0, 0); + Vector3r term2(0, 0, 0); + Vector3r tmp(0, 0, 0); + + // first term + term1 = dbjpi[j][1].transpose() * da.col(k); + tmp = dbjpi[k][1].transpose() * da.col(j); + term1 = term1 - tmp; + + // second term + for (int n = 0; n < 3; ++n) + { + tmp = dbjpi[n][1].transpose() * da.col(n); + term2 = term2 + tmp; + } + omega_pc.col(i) = -X*(term1+(0.5 * darboux_vector[i] * length) * term2); + //omega_pc.col(i) *= bendAndTwistKs[i]; + } + // pd + { + Vector3r term1(0, 0, 0); + Vector3r term2(0, 0, 0); + Vector3r tmp(0, 0, 0); + // first term + term1 = dajpi[j][2].transpose() * db.col(k); + tmp = dajpi[k][2].transpose() * db.col(j); + term1 = term1 - tmp; + // second term + for (int n = 0; n < 3; ++n) { + tmp = dajpi[n][2].transpose() * db.col(n); + term2 = term2 + tmp; + } + omega_pd.col(i) = X*(term1-(0.5 * darboux_vector[i] * length) * term2); + //omega_pd.col(i) *= bendAndTwistKs[i]; + } + // pe + { + Vector3r term1(0, 0, 0); + Vector3r term2(0, 0, 0); + Vector3r tmp(0, 0, 0); + // first term + term1 = dbjpi[j][2].transpose() * da.col(k); + tmp = dbjpi[k][2].transpose() * da.col(j); + term1 -= tmp; + + // second term + for (int n = 0; n < 3; ++n) + { + tmp = dbjpi[n][2].transpose() * da.col(n); + term2 += tmp; + } + + omega_pe.col(i) = -X*(term1+(0.5 * darboux_vector[i] * length) * term2); + //omega_pe.col(i) *= bendAndTwistKs[i]; + } + } + return true; +} +// ---------------------------------------------------------------------------------------------- + + +void PBD::DirectPositionBasedSolverForStiffRods::initLists(int numberOfIntervals, std::list * &forward, std::list * &backward, Node* &root) +{ + if (forward != NULL) + delete[] forward; + if (backward != NULL) + delete[] backward; + if (root != NULL) + delete[] root; + forward = new std::list[numberOfIntervals]; + backward = new std::list[numberOfIntervals]; + root = new Node[numberOfIntervals]; +} + +bool PBD::DirectPositionBasedSolverForStiffRods::isSegmentInInterval(RodSegment *segment, int intervalIndex, Interval* intervals, std::vector &rodConstraints, std::vector &rodSegments) +{ + for (int i = intervals[intervalIndex].start; i <= intervals[intervalIndex].end; i++) + { + if ((segment == rodSegments[rodConstraints[i]->segmentIndex(0)]) + || (segment == rodSegments[rodConstraints[i]->segmentIndex(1)])) + return true; + } + return false; +} + +bool PBD::DirectPositionBasedSolverForStiffRods::isConstraintInInterval(RodConstraint *constraint, int intervalIndex, Interval* intervals, std::vector &rodConstraints) +{ + for (int i = intervals[intervalIndex].start; i <= intervals[intervalIndex].end; i++) + { + if (constraint == rodConstraints[i]) + return true; + } + return false; +} + +void PBD::DirectPositionBasedSolverForStiffRods::initSegmentNode(Node *n, int intervalIndex, std::vector &rodConstraints, std::vector &rodSegments, std::vector &markedConstraints, Interval* intervals) +{ + RodSegment *segment = + (RodSegment*)n->object; + + std::vector constraints; + std::vector constraintIndices; + for (int j = 0; j < static_cast(rodConstraints.size()); ++j) + { + RodConstraint* constraint(rodConstraints[j]); + if (rodSegments[constraint->segmentIndex(0)] == segment + || rodSegments[constraint->segmentIndex(1)] == segment) + { + constraints.push_back(constraint); + constraintIndices.push_back(j); + } + } + + for (unsigned int i = 0; i < constraints.size(); i++) + { + if (!isConstraintInInterval(constraints[i], intervalIndex, intervals, rodConstraints)) + continue; + + // Test whether the edge has been visited before + bool marked = false; + for (unsigned int j = 0; j < markedConstraints.size(); j++) + { + if (constraints[i] == markedConstraints[j]) + { + marked = true; + break; + } + } + if (!marked) + { + Node *constraintNode = new Node(); + constraintNode->index = constraintIndices[i]; + constraintNode->object = constraints[i]; + constraintNode->isconstraint = true; + constraintNode->parent = n; + constraintNode->D.setZero(); + constraintNode->Dinv.setZero(); + constraintNode->J.setZero(); + constraintNode->soln.setZero(); + + n->children.push_back(constraintNode); + + Node *segmentNode = new Node(); + segmentNode->isconstraint = false; + segmentNode->parent = constraintNode; + + // get other segment connected to constraint for new node + if (rodSegments[constraints[i]->segmentIndex(0)] == segment) + { + segmentNode->object = rodSegments[constraints[i]->segmentIndex(1)]; + segmentNode->index = constraints[i]->segmentIndex(1); + } + else + { + segmentNode->object = rodSegments[constraints[i]->segmentIndex(0)]; + segmentNode->index = constraints[i]->segmentIndex(0); + } + + segmentNode->D.setZero(); + segmentNode->Dinv.setZero(); + segmentNode->J.setZero(); + segmentNode->soln.setZero(); + + constraintNode->children.push_back(segmentNode); + + // mark constraint + markedConstraints.push_back(constraints[i]); + + initSegmentNode(segmentNode, intervalIndex, rodConstraints, + rodSegments, markedConstraints, intervals); + } + } +} + +void PBD::DirectPositionBasedSolverForStiffRods::orderMatrix(Node *n, int intervalIndex, std::list * forward, std::list * backward) +{ + for (unsigned int i = 0; i < n->children.size(); i++) + orderMatrix(n->children[i], intervalIndex, forward, backward); + forward[intervalIndex].push_back(n); + backward[intervalIndex].push_front(n); +} + +void PBD::DirectPositionBasedSolverForStiffRods::initNodes(int intervalIndex, std::vector &rodSegments, Node* &root, Interval* intervals, std::vector &rodConstraints, std::list * forward, std::list * backward, std::vector &markedConstraints) +{ + // find root + for (int i = 0; i < (int)rodSegments.size(); i++) + { + RodSegment * rb(rodSegments[i]); + if (!isSegmentInInterval(rb, intervalIndex, intervals, rodConstraints, rodSegments)) + continue; + else + { + if (root[intervalIndex].object == NULL) + { + root[intervalIndex].object = rb; + root[intervalIndex].index = i; + } + } + + if (!rb->isDynamic()) + { + root[intervalIndex].object = rb; + root[intervalIndex].index = i; + break; + } + } + root[intervalIndex].isconstraint = false; + root[intervalIndex].parent = NULL; + + root[intervalIndex].D.setZero(); + root[intervalIndex].Dinv.setZero(); + root[intervalIndex].soln.setZero(); + + initSegmentNode(&root[intervalIndex], intervalIndex, rodConstraints, + rodSegments, markedConstraints, intervals); + orderMatrix(&root[intervalIndex], intervalIndex, forward, backward); +} + +void PBD::DirectPositionBasedSolverForStiffRods::initTree(std::vector &rodConstraints, std::vector & rodSegments, Interval* &intervals, int &numberOfIntervals, std::list * &forward, std::list * &backward, Node* &root) +{ + numberOfIntervals = 1; + intervals = new Interval[1]; + intervals[0].start = 0; + intervals[0].end = (int)rodConstraints.size() - 1; + initLists(numberOfIntervals, forward, backward, root); + + std::vector markedConstraints; + for (int i = 0; i < numberOfIntervals; i++) + { + initNodes(i, rodSegments, root, intervals, rodConstraints, forward, backward, markedConstraints); + markedConstraints.clear(); + } +} + +bool PBD::DirectPositionBasedSolverForStiffRods::computeDarbouxVector(const Quaternionr & q0, const Quaternionr & q1, const Real averageSegmentLength, Vector3r & darbouxVector) +{ + darbouxVector = 2. / averageSegmentLength * (q0.conjugate() * q1).vec(); + return true; +} + +bool PBD::DirectPositionBasedSolverForStiffRods::computeBendingAndTorsionJacobians(const Quaternionr & q0, const Quaternionr & q1, const Real averageSegmentLength, Eigen::Matrix & jOmega0, Eigen::Matrix & jOmega1) +{ + jOmega0 << + -q1.w(), -q1.z(), q1.y(), q1.x(), + q1.z(), -q1.w(), -q1.x(), q1.y(), + -q1.y(), q1.x(), -q1.w(), q1.z(); + jOmega1 << + q0.w(), q0.z(), -q0.y(), -q0.x(), + -q0.z(), q0.w(), q0.x(), -q0.y(), + q0.y(), -q0.x(), q0.w(), -q0.z(); + jOmega0 *= static_cast(2.0) / averageSegmentLength; + jOmega1 *= static_cast(2.0) / averageSegmentLength; + return true; +} + +bool PBD::DirectPositionBasedSolverForStiffRods::computeMatrixG(const Quaternionr & q, Eigen::Matrix & G) +{ + // w component at index 3 + G << + static_cast(0.5)*q.w(), static_cast(0.5)*q.z(), -static_cast(0.5)*q.y(), + -static_cast(0.5)*q.z(), static_cast(0.5)*q.w(), static_cast(0.5)*q.x(), + static_cast(0.5)*q.y(), -static_cast(0.5)*q.x(), static_cast(0.5)*q.w(), + -static_cast(0.5)*q.x(), -static_cast(0.5)*q.y(), -static_cast(0.5)*q.z(); + return true; +} + +void PBD::DirectPositionBasedSolverForStiffRods::computeMatrixK(const Vector3r &connector, const Real invMass, const Vector3r &x, const Matrix3r &inertiaInverseW, Matrix3r &K) +{ + if (invMass != 0.0) + { + const Vector3r v = connector - x; + const Real a = v[0]; + const Real b = v[1]; + const Real c = v[2]; + + // J is symmetric + const Real j11 = inertiaInverseW(0, 0); + const Real j12 = inertiaInverseW(0, 1); + const Real j13 = inertiaInverseW(0, 2); + const Real j22 = inertiaInverseW(1, 1); + const Real j23 = inertiaInverseW(1, 2); + const Real j33 = inertiaInverseW(2, 2); + + K(0, 0) = c*c*j22 - b*c*(j23 + j23) + b*b*j33 + invMass; + K(0, 1) = -(c*c*j12) + a*c*j23 + b*c*j13 - a*b*j33; + K(0, 2) = b*c*j12 - a*c*j22 - b*b*j13 + a*b*j23; + K(1, 0) = K(0, 1); + K(1, 1) = c*c*j11 - a*c*(j13 + j13) + a*a*j33 + invMass; + K(1, 2) = -(b*c*j11) + a*c*j12 + a*b*j13 - a*a*j23; + K(2, 0) = K(0, 2); + K(2, 1) = K(1, 2); + K(2, 2) = b*b*j11 - a*b*(j12 + j12) + a*a*j22 + invMass; + } + else + K.setZero(); +} + +void PBD::DirectPositionBasedSolverForStiffRods::getMassMatrix(RodSegment *segment, Matrix6r &M) +{ + if (!segment->isDynamic()) + { + M = Matrix6r::Identity(); + return; + } + + const Vector3r &inertiaLocal = segment->InertiaTensor(); + Matrix3r rotationMatrix(segment->Rotation().toRotationMatrix()); + Matrix3r inertia(rotationMatrix * + Eigen::DiagonalMatrix(inertiaLocal) * + rotationMatrix.transpose()); + + Real mass = segment->Mass(); + + // Upper half + for (int i = 0; i < 3; i++) + for (int j = 0; j < 6; j++) + if (i == j) + M(i, j) = mass; + else + M(i, j) = 0.0; + + // lower left + for (int i = 3; i < 6; i++) + for (int j = 0; j < 3; j++) + M(i, j) = 0.0; + + // lower right + for (int i = 3; i < 6; i++) + for (int j = 3; j < 6; j++) + M(i, j) = inertia(i - 3, j - 3); +} + +Real PBD::DirectPositionBasedSolverForStiffRods::factor(const int intervalIndex, const std::vector &rodConstraints, std::vector & rodSegments, const Interval* &intervals, std::list * forward, std::list * backward, std::vector & RHS, std::vector & lambdaSums, std::vector> & bendingAndTorsionJacobians) +{ + Real maxError(0.); + + // compute right hand side of linear equation system + for (size_t currentConstraintIndex = 0; currentConstraintIndex < rodConstraints.size(); ++currentConstraintIndex) + { + RodConstraint* currentConstraint = rodConstraints[currentConstraintIndex]; + + RodSegment* segment0 = rodSegments[currentConstraint->segmentIndex(0)]; + RodSegment* segment1 = rodSegments[currentConstraint->segmentIndex(1)]; + + const Quaternionr &q0 = segment0->Rotation(); + const Quaternionr &q1 = segment1->Rotation(); + + const Eigen::Matrix &constraintInfo(currentConstraint->getConstraintInfo()); + Vector6r &rhs(RHS[currentConstraintIndex]); + + // Compute zero-stretch part of constraint violation + const Vector3r &connector0 = constraintInfo.col(2); + const Vector3r &connector1 = constraintInfo.col(3); + Vector3r stretchViolation = connector0 - connector1; + + // compute Darboux vector (Equation (7)) + Vector3r omega; + computeDarbouxVector(q0, q1, currentConstraint->getAverageSegmentLength(), omega); + + // Compute bending and torsion part of constraint violation + Vector3r bendingAndTorsionViolation = omega - currentConstraint->getRestDarbouxVector(); + + // fill right hand side of the linear equation system + const Vector6r &lambdaSum(lambdaSums[currentConstraintIndex]); + rhs.block<3, 1>(0, 0) = -stretchViolation + - Vector3r(currentConstraint->getStretchCompliance().array() * + lambdaSum.block<3, 1>(0, 0).array()); + + rhs.block<3, 1>(3, 0) = -bendingAndTorsionViolation + - Vector3r(currentConstraint->getBendingAndTorsionCompliance().array() * + lambdaSum.block<3, 1>(3, 0).array()); + + // compute max error + for (unsigned char i(0); i < 6; ++i) + { + maxError = std::max(maxError, std::abs(rhs[i])); + } + + // Compute a part of the Jacobian here, because the relationship + // of the first and second segment to the constraint can be determined directly + + // compute G matrices + Eigen::Matrix G0, G1; + computeMatrixG(q0, G0); + computeMatrixG(q1, G1); + + // compute stretching bending Jacobians (Equation (10) and Equation (11)) + Eigen::Matrix jOmega0, jOmega1; + computeBendingAndTorsionJacobians(q0, q1, currentConstraint->getAverageSegmentLength(), jOmega0, jOmega1); + + bendingAndTorsionJacobians[currentConstraintIndex][0] = jOmega0*G0; + bendingAndTorsionJacobians[currentConstraintIndex][1] = jOmega1*G1; + } + + std::list::iterator nodeIter; + for (nodeIter = forward[intervalIndex].begin(); nodeIter != forward[intervalIndex].end(); nodeIter++) + { + Node *node = *nodeIter; + // compute system matrix diagonal + if (node->isconstraint) + { + RodConstraint* currentConstraint = (RodConstraint*)node->object; + //insert compliance + node->D.setZero(); + const Vector3r &stretchCompliance(currentConstraint->getStretchCompliance()); + + node->D(0, 0) -= stretchCompliance[0]; + node->D(1, 1) -= stretchCompliance[1]; + node->D(2, 2) -= stretchCompliance[2]; + + const Vector3r &bendingAndTorsionCompliance(currentConstraint->getBendingAndTorsionCompliance()); + node->D(3, 3) -= bendingAndTorsionCompliance[0]; + node->D(4, 4) -= bendingAndTorsionCompliance[1]; + node->D(5, 5) -= bendingAndTorsionCompliance[2]; + } + else + { + getMassMatrix((RodSegment*)node->object, node->D); + } + + // compute Jacobian + if (node->parent != NULL) + { + if (node->isconstraint) + { + //compute J + RodConstraint *constraint = (RodConstraint*)node->object; + RodSegment *segment = (RodSegment*)node->parent->object; + + Real sign = 1; + int segmentIndex = 0; + if (segment == rodSegments[constraint->segmentIndex(1)]) + { + segmentIndex = 1; + sign = -1; + } + + const Eigen::Matrix &constraintInfo(constraint->getConstraintInfo()); + const Vector3r r = constraintInfo.col(2 + segmentIndex) - segment->Position(); + Matrix3r r_cross; + Real crossSign(-static_cast(1.0)*sign); + MathFunctions::crossProductMatrix(crossSign*r, r_cross); + + Eigen::DiagonalMatrix upperLeft(sign, sign, sign); + node->J.block<3, 3>(0, 0) = upperLeft; + + Matrix3r lowerLeft(Matrix3r::Zero()); + node->J.block<3, 3>(3, 0) = lowerLeft; + + node->J.block<3, 3>(0, 3) = r_cross; + + Matrix3r &lowerRight(bendingAndTorsionJacobians[node->index][segmentIndex]); + node->J.block<3, 3>(3, 3) = lowerRight; + } + else + { + //compute JT + RodConstraint *constraint = (RodConstraint*)node->parent->object; + RodSegment *segment = (RodSegment*)node->object; + + Real sign = 1; + int segmentIndex = 0; + if (segment == rodSegments[constraint->segmentIndex(1)]) + { + segmentIndex = 1; + sign = -1; + } + + const Eigen::Matrix &constraintInfo(constraint->getConstraintInfo()); + const Vector3r r = constraintInfo.col(2 + segmentIndex) - segment->Position(); + Matrix3r r_crossT; + MathFunctions::crossProductMatrix(sign*r, r_crossT); + + Eigen::DiagonalMatrix upperLeft(sign, sign, sign); + node->J.block<3, 3>(0, 0) = upperLeft; + + node->J.block<3, 3>(3, 0) = r_crossT; + + Matrix3r upperRight(Matrix3r::Zero()); + node->J.block<3, 3>(0, 3) = upperRight; + + Matrix3r lowerRight(bendingAndTorsionJacobians[node->parent->index][segmentIndex].transpose()); + node->J.block<3, 3>(3, 3) = lowerRight; + } + } + } + + for (nodeIter = forward[intervalIndex].begin(); nodeIter != forward[intervalIndex].end(); nodeIter++) + { + Node *node = *nodeIter; + std::vector children = node->children; + for (size_t i = 0; i < children.size(); i++) + { + Matrix6r JT = (children[i]->J).transpose(); + Matrix6r &D = children[i]->D; + Matrix6r &J = children[i]->J; + Matrix6r JTDJ = ((JT * D) * J); + node->D = node->D - JTDJ; + } + bool chk = false; + if (!node->isconstraint) + { + RodSegment *segment = (RodSegment*)node->object; + if (!segment->isDynamic()) + { + node->Dinv.setZero(); + chk = true; + } + } + + node->DLDLT.compute(node->D); // result reused in solve() + if (node->parent != NULL) + { + if (!chk) + { + node->J = node->DLDLT.solve(node->J); + } + else + { + node->J.setZero(); + } + } + } + return maxError; +} + +bool PBD::DirectPositionBasedSolverForStiffRods::solve(int intervalIndex, std::list * forward, std::list * backward, std::vector & RHS, std::vector & lambdaSums, std::vector & corr_x, std::vector & corr_q) +{ + std::list::iterator nodeIter; + for (nodeIter = forward[intervalIndex].begin(); nodeIter != forward[intervalIndex].end(); nodeIter++) + { + Node *node = *nodeIter; + if (node->isconstraint) + { + node->soln = -RHS[node->index]; + } + else + { + node->soln.setZero(); + } + std::vector &children = node->children; + for (size_t i = 0; i < children.size(); ++i) + { + Matrix6r cJT = children[i]->J.transpose(); + Vector6r &csoln = children[i]->soln; + Vector6r v = cJT * csoln; + node->soln = node->soln - v; + } + } + + for (nodeIter = backward[intervalIndex].begin(); nodeIter != backward[intervalIndex].end(); nodeIter++) + { + Node *node = *nodeIter; + + bool noZeroDinv(true); + if (!node->isconstraint) + { + RodSegment *segment = (RodSegment*)node->object; + noZeroDinv = segment->isDynamic(); + } + if (noZeroDinv) // if DInv == 0 child value is 0 and node->soln is not altered + { + node->soln = node->DLDLT.solve(node->soln); + + if (node->parent != NULL) + { + node->soln -= node->J * node->parent->soln; + } + } + else + { + node->soln.setZero(); // segment of node is not dynamic + } + + if (node->isconstraint) + { + lambdaSums[node->index] += node->soln; + } + } + + // compute position and orientation updates + for (nodeIter = forward[intervalIndex].begin(); nodeIter != forward[intervalIndex].end(); nodeIter++) + { + Node *node = *nodeIter; + if (!node->isconstraint) + { + RodSegment *segment = (RodSegment *)node->object; + if (!segment->isDynamic()) + { + break; + } + + const Vector6r & soln(node->soln); + Vector3r deltaXSoln = Vector3r(-soln[0], -soln[1], -soln[2]); + corr_x[node->index] = deltaXSoln; + + Eigen::Matrix G; + computeMatrixG(segment->Rotation(), G); + Quaternionr deltaQSoln; + deltaQSoln.coeffs() = G * Vector3r(-soln[3], -soln[4], -soln[5]); + corr_q[node->index] = deltaQSoln; + } + } + return true; +} + +bool PBD::DirectPositionBasedSolverForStiffRods::init_DirectPositionBasedSolverForStiffRodsConstraint( + std::vector &rodConstraints, + std::vector & rodSegments, + Interval* &intervals, + int &numberOfIntervals, + std::list * &forward, + std::list * &backward, + Node* &root, + const std::vector &constraintPositions, + const std::vector &averageRadii, + const std::vector &youngsModuli, + const std::vector &torsionModuli, + std::vector & RHS, + std::vector & lambdaSums, + std::vector> & bendingAndTorsionJacobians, + std::vector & corr_x, + std::vector & corr_q + ) +{ + // init constraints + for (size_t cIdx(0); cIdx < rodConstraints.size(); ++cIdx) + { + RodConstraint * constraint(rodConstraints[cIdx]); + RodSegment * segment0(rodSegments[constraint->segmentIndex(0)]); + RodSegment * segment1(rodSegments[constraint->segmentIndex(1)]); + + init_StretchBendingTwistingConstraint( + segment0->Position(), segment0->Rotation(), segment1->Position(), segment1->Rotation(), + constraintPositions[cIdx], averageRadii[cIdx], constraint->getAverageSegmentLength(), + youngsModuli[cIdx], torsionModuli[cIdx], constraint->getConstraintInfo(), + constraint->getStiffnessCoefficientK(), constraint->getRestDarbouxVector()); + } + + // compute tree data structure for direct solver + initTree(rodConstraints, rodSegments, intervals, numberOfIntervals, forward, backward, root); + + RHS.resize(rodConstraints.size()); + std::fill(RHS.begin(), RHS.end(), Vector6r::Zero()); + + lambdaSums.resize(rodConstraints.size()); + std::fill(lambdaSums.begin(), lambdaSums.end(), Vector6r::Zero()); + + bendingAndTorsionJacobians.resize(rodConstraints.size()); + std::vector sampleJacobians(2); + sampleJacobians[0].setZero(); + sampleJacobians[1].setZero(); + std::fill(bendingAndTorsionJacobians.begin(), bendingAndTorsionJacobians.end(), sampleJacobians); + + corr_x.resize(rodSegments.size()); + std::fill(corr_x.begin(), corr_x.end(), Vector3r::Zero()); + + corr_q.resize(rodSegments.size()); + std::fill(corr_q.begin(), corr_q.end(), Quaternionr::Identity()); + + return true; +} + +bool PBD::DirectPositionBasedSolverForStiffRods::initBeforeProjection_DirectPositionBasedSolverForStiffRodsConstraint( + const std::vector &rodConstraints, + const Real inverseTimeStepSize, + std::vector & lambdaSums + ) +{ + for (size_t cIdx(0); cIdx < rodConstraints.size(); ++cIdx) + { + RodConstraint * constraint(rodConstraints[cIdx]); + + initBeforeProjection_StretchBendingTwistingConstraint( + constraint->getStiffnessCoefficientK(), + inverseTimeStepSize, + constraint->getAverageSegmentLength(), + constraint->getStretchCompliance(), + constraint->getBendingAndTorsionCompliance(), + lambdaSums[cIdx]); + } + return true; +} + + + +bool PBD::DirectPositionBasedSolverForStiffRods::update_DirectPositionBasedSolverForStiffRodsConstraint( + const std::vector &rodConstraints, + const std::vector & rodSegments + ) +{ + // update rod constraints + for (size_t cIdx(0); cIdx < rodConstraints.size(); ++cIdx) + { + RodConstraint * constraint(rodConstraints[cIdx]); + RodSegment * segment0(rodSegments[constraint->segmentIndex(0)]); + RodSegment * segment1(rodSegments[constraint->segmentIndex(1)]); + + update_StretchBendingTwistingConstraint( + segment0->Position(), segment0->Rotation(), segment1->Position(), segment1->Rotation(), + constraint->getConstraintInfo()); + } + return true; +} + + + +bool PBD::DirectPositionBasedSolverForStiffRods::solve_DirectPositionBasedSolverForStiffRodsConstraint( + const std::vector &rodConstraints, + std::vector & rodSegments, + const Interval* intervals, + const int &numberOfIntervals, + std::list * forward, + std::list * backward, + std::vector & RHS, + std::vector & lambdaSums, + std::vector> & bendingAndTorsionJacobians, + std::vector & corr_x, + std::vector & corr_q + ) +{ + for (int i = 0; i < numberOfIntervals; i++) + { + factor(i, rodConstraints, rodSegments, intervals, + forward, backward, RHS, lambdaSums, bendingAndTorsionJacobians); + } + for (int i = 0; i < numberOfIntervals; i++) + { + solve(i, forward, backward, RHS, lambdaSums, corr_x, corr_q); + } + return true; +} + +bool PBD::DirectPositionBasedSolverForStiffRods::init_StretchBendingTwistingConstraint( + const Vector3r &x0, const Quaternionr &q0, + const Vector3r &x1, const Quaternionr &q1, + const Vector3r &constraintPosition, + const Real averageRadius, + const Real averageSegmentLength, + const Real youngsModulus, + const Real torsionModulus, + Eigen::Matrix &constraintInfo, + Vector3r &stiffnessCoefficientK, + Vector3r &restDarbouxVector + ) +{ + // constraintInfo contains + // 0: connector in segment 0 (local) + // 1: connector in segment 1 (local) + // 2: connector in segment 0 (global) + // 3: connector in segment 1 (global) + + // transform in local coordinates + const Matrix3r rot0T = q0.matrix().transpose(); + const Matrix3r rot1T = q1.matrix().transpose(); + + constraintInfo.col(0) = rot0T * (constraintPosition - x0); + constraintInfo.col(1) = rot1T * (constraintPosition - x1); + constraintInfo.col(2) = constraintPosition; + constraintInfo.col(3) = constraintPosition; + + // compute bending and torsion stiffness of the K matrix diagonal; assumption: the rod axis follows the y-axis of the local frame as with Blender's armatures + Real secondMomentOfArea(static_cast(M_PI_4) * std::pow(averageRadius, static_cast(4.0))); + Real bendingStiffness(youngsModulus * secondMomentOfArea); + Real torsionStiffness(static_cast(2.0) * torsionModulus * secondMomentOfArea); + stiffnessCoefficientK = Vector3r(bendingStiffness, torsionStiffness, bendingStiffness); + + // compute rest Darboux vector + computeDarbouxVector(q0, q1, averageSegmentLength, restDarbouxVector); + + return true; +} + +bool PBD::DirectPositionBasedSolverForStiffRods::initBeforeProjection_StretchBendingTwistingConstraint( + const Vector3r &stiffnessCoefficientK, + const Real inverseTimeStepSize, + const Real averageSegmentLength, + Vector3r &stretchCompliance, + Vector3r &bendingAndTorsionCompliance, + Vector6r &lambdaSum + ) +{ + + Real inverseTSQuadratic(inverseTimeStepSize*inverseTimeStepSize); + + // compute compliance parameter of the stretch constraint part + const Real stretchRegularizationParameter(static_cast(1.E-10)); + stretchCompliance << + stretchRegularizationParameter * inverseTSQuadratic, + stretchRegularizationParameter * inverseTSQuadratic, + stretchRegularizationParameter * inverseTSQuadratic; + + // compute compliance parameter of the bending and torsion constraint part + bendingAndTorsionCompliance << + inverseTSQuadratic / stiffnessCoefficientK(0), + inverseTSQuadratic / stiffnessCoefficientK(1), + inverseTSQuadratic / stiffnessCoefficientK(2); + bendingAndTorsionCompliance *= static_cast(1.0) / averageSegmentLength; + + // set sum of delta lambda values to zero + lambdaSum.setZero(); + return true; +} + +bool PBD::DirectPositionBasedSolverForStiffRods::update_StretchBendingTwistingConstraint( + const Vector3r &x0, const Quaternionr &q0, + const Vector3r &x1, const Quaternionr &q1, + Eigen::Matrix &constraintInfo + ) +{ + // constraintInfo contains + // 0: connector in segment 0 (local) + // 1: connector in segment 1 (local) + // 2: connector in segment 0 (global) + // 3: connector in segment 1 (global) + + // compute world space positions of connectors + const Matrix3r rot0 = q0.matrix(); + const Matrix3r rot1 = q1.matrix(); + constraintInfo.col(2) = rot0 * constraintInfo.col(0) + x0; + constraintInfo.col(3) = rot1 * constraintInfo.col(1) + x1; + + return true; +} + +bool PBD::DirectPositionBasedSolverForStiffRods::solve_StretchBendingTwistingConstraint( + const Real invMass0, + const Vector3r &x0, + const Matrix3r &inertiaInverseW0, + const Quaternionr &q0, + const Real invMass1, + const Vector3r &x1, + const Matrix3r &inertiaInverseW1, + const Quaternionr &q1, + const Vector3r &restDarbouxVector, + const Real averageSegmentLength, + const Vector3r &stretchCompliance, + const Vector3r &bendingAndTorsionCompliance, + const Eigen::Matrix &constraintInfo, + Vector3r &corr_x0, Quaternionr &corr_q0, + Vector3r &corr_x1, Quaternionr &corr_q1, + Vector6r &lambdaSum + ) +{ + // compute Darboux vector (Equation (7)) + Vector3r omega; + computeDarbouxVector(q0, q1, averageSegmentLength, omega); + + // compute bending and torsion Jacobians (Equation (10) and Equation (11)) + Eigen::Matrix jOmega0, jOmega1; + computeBendingAndTorsionJacobians(q0, q1, averageSegmentLength, jOmega0, jOmega1); + + // compute G matrices (Equation (27)) + Eigen::Matrix G0, G1; + computeMatrixG(q0, G0); + computeMatrixG(q1, G1); + + Matrix3r jOmegaG0(jOmega0*G0), + jOmegaG1(jOmega1*G1); + + // Compute zero-stretch part of constraint violation (Equation (23)) + const Vector3r &connector0 = constraintInfo.col(2); + const Vector3r &connector1 = constraintInfo.col(3); + Vector3r stretchViolation = connector0 - connector1; + + // Compute bending and torsion part of constraint violation (Equation (23)) + Vector3r bendingAndTorsionViolation = omega - restDarbouxVector; + + // fill right hand side of the linear equation system (Equation (19)) + Vector6r rhs; + rhs.block<3, 1>(0, 0) = -stretchViolation + - Vector3r(stretchCompliance.array() * lambdaSum.block<3, 1>(0, 0).array()); + + rhs.block<3, 1>(3, 0) = -bendingAndTorsionViolation + - Vector3r(bendingAndTorsionCompliance.array() * lambdaSum.block<3, 1>(3, 0).array()); + + // compute matrix of the linear equation system (using Equations (25), (26), and (28) in Equation (19)) + Matrix6r JMJT(Matrix6r::Zero()); + + // compute stretch block + Matrix3r K1, K2; + computeMatrixK(connector0, invMass0, x0, inertiaInverseW0, K1); + computeMatrixK(connector1, invMass1, x1, inertiaInverseW1, K2); + JMJT.block<3, 3>(0, 0) = K1 + K2; + + // compute coupling blocks + const Vector3r ra = connector0 - x0; + const Vector3r rb = connector1 - x1; + + Matrix3r ra_crossT, rb_crossT; + MathFunctions::crossProductMatrix(-ra, ra_crossT); // use -ra to get the transpose + MathFunctions::crossProductMatrix(-rb, rb_crossT); // use -rb to get the transpose + + Matrix3r offdiag(Matrix3r::Zero()); + if (invMass0 != 0.0) + { + offdiag = jOmegaG0 * inertiaInverseW0 * ra_crossT * (-1); + } + + if (invMass1 != 0.0) + { + offdiag += jOmegaG1 * inertiaInverseW1 * rb_crossT; + } + JMJT.block<3, 3>(3, 0) = offdiag; + JMJT.block<3, 3>(0, 3) = offdiag.transpose(); + + // compute bending and torsion block + Matrix3r MInvJT0(inertiaInverseW0 * jOmegaG0.transpose()); + Matrix3r MInvJT1(inertiaInverseW1 * jOmegaG1.transpose()); + + Matrix3r JMJTOmega(Matrix3r::Zero()); + if (invMass0 != 0.0) + { + JMJTOmega = jOmegaG0*MInvJT0; + } + + if (invMass1 != 0.0) + { + JMJTOmega += jOmegaG1*MInvJT1; + } + JMJT.block<3, 3>(3, 3) = JMJTOmega; + + // add compliance + JMJT(0, 0) += stretchCompliance(0); + JMJT(1, 1) += stretchCompliance(1); + JMJT(2, 2) += stretchCompliance(2); + JMJT(3, 3) += bendingAndTorsionCompliance(0); + JMJT(4, 4) += bendingAndTorsionCompliance(1); + JMJT(5, 5) += bendingAndTorsionCompliance(2); + + // solve linear equation system (Equation 19) + auto decomposition(JMJT.ldlt()); + Vector6r deltaLambda(decomposition.solve(rhs)); + + // update sum of delta lambda values for next Gauss-Seidel solver iteration step + lambdaSum += deltaLambda; + + // compute position and orientation updates (using Equations (25), (26), and (28) in Equation (20)) + Vector3r deltaLambdaStretch(deltaLambda.block<3, 1>(0, 0)), + deltaLambdaBendingAndTorsion(deltaLambda.block<3, 1>(3, 0)); + corr_x0.setZero(); + corr_x1.setZero(); + corr_q0.coeffs().setZero(); + corr_q1.coeffs().setZero(); + + if (invMass0 != 0.) + { + corr_x0 += invMass0 * deltaLambdaStretch; + corr_q0.coeffs() += G0 * (inertiaInverseW0 * ra_crossT * (-1 * deltaLambdaStretch) + + MInvJT0 * deltaLambdaBendingAndTorsion); + } + + if (invMass1 != 0.) + { + corr_x1 -= invMass1 * deltaLambdaStretch; + corr_q1.coeffs() += G1 * (inertiaInverseW1 * rb_crossT * deltaLambdaStretch + + MInvJT1 * deltaLambdaBendingAndTorsion); + } + + return true; +} diff --git a/PositionBasedDynamics/PositionBasedElasticRods.h b/PositionBasedDynamics/PositionBasedElasticRods.h new file mode 100644 index 00000000..5496bf67 --- /dev/null +++ b/PositionBasedDynamics/PositionBasedElasticRods.h @@ -0,0 +1,601 @@ +#ifndef POSITION_BASED_ELASTIC_RODS_H +#define POSITION_BASED_ELASTIC_RODS_H + +#include +#include "Common/Common.h" +#include "DirectPositionBasedSolverForStiffRodsInterface.h" + +#include +#include + +// ------------------------------------------------------------------------------------ +namespace PBD +{ + // Implementation of "Direct Position-Based Solver for Stiff Rods" paper + // (https://animation.rwth-aachen.de/publication/0557/) + // + // Implemented by: + // + // Crispin Deul + // Graduate School CE + // Technische Universität Darmstadt + // + // deul[at] gsc.tu-darmstadt.de + // + + using Matrix6r = Eigen::Matrix; + using Vector6r = Eigen::Matrix; + /** Node in the simulated tree structure */ + struct Node { + Node() { + object = NULL; D = Dinv = J = Matrix6r::Zero(); parent = NULL; + soln.setZero(); index = 0; + }; + bool isconstraint; + void *object; + Matrix6r D, Dinv, J; + std::vector children; + Node *parent; + Vector6r soln; + int index; + Eigen::LDLT DLDLT; + }; + + struct Interval + { + int start; + int end; + }; + + class DirectPositionBasedSolverForStiffRods + { + private: + + static void initLists( + int numberOfIntervals, + std::list * &forward, + std::list * &backward, + Node* &root); + + /** Returns, whether the passed segment is connected to a constraint in the + * passed index range of the entire constraints. + */ + static bool isSegmentInInterval( + RodSegment *segment, + int intervalIndex, + Interval* intervals, + std::vector &rodConstraints, + std::vector &rodSegments); + + /** Returns, whether the passed constraint is within the passed index range + * of the entire constraints. + */ + static bool isConstraintInInterval( + RodConstraint *constraint, + int intervalIndex, + Interval* intervals, + std::vector &rodConstraints); + + + /** This method recursively visits all segment nodes and inserts constraint nodes between them. + */ + static void initSegmentNode( + Node *n, + int intervalIndex, + std::vector &rodConstraints, + std::vector &rodSegments, + std::vector &markedConstraints, + Interval* intervals); + + + /** Sorts matrix H. + */ + static void orderMatrix( + Node *n, + int intervalIndex, + std::list * forward, + std::list * backward); + + /** Initializes the nodes. + * The first static node is selected as the root of the tree. + * Then, starting from this node, all edges (joints) are followed + * and the children and the parent node are saved. + */ + static void initNodes( + int intervalIndex, + std::vector &rodSegments, + Node* &root, + Interval* intervals, + std::vector &rodConstraints, + std::list * forward, + std::list * backward, + std::vector &markedConstraints); + + + static void initTree( + std::vector &rodConstraints, + std::vector & rodSegments, + Interval* &intervals, + int &numberOfIntervals, + std::list * &forward, + std::list * &backward, + Node* &root + ); + + + /** Compute the discrete Darboux vector based on Equation (7) + */ + static bool computeDarbouxVector( + const Quaternionr & q0, + const Quaternionr & q1, + const Real averageSegmentLength, + Vector3r & darbouxVector + ); + + static bool computeBendingAndTorsionJacobians( + const Quaternionr & q0, + const Quaternionr & q1, + const Real averageSegmentLength, + Eigen::Matrix & jOmega0, + Eigen::Matrix & jOmega1 + ); + + static bool computeMatrixG( + const Quaternionr & q, + Eigen::Matrix & G + ); + + static void computeMatrixK( + const Vector3r &connector, + const Real invMass, + const Vector3r &x, + const Matrix3r &inertiaInverseW, + Matrix3r &K); + + + /** Returns the 6x6 mass matrix M of a segment + */ + static void getMassMatrix(RodSegment *segment, Matrix6r &M); + + /** Factorizes matrix H and computes the right hand side vector -b. + */ + static Real factor( + const int intervalIndex, + const std::vector &rodConstraints, + std::vector & rodSegments, + const Interval* &intervals, + std::list * forward, + std::list * backward, + std::vector & RHS, + std::vector & lambdaSums, + std::vector> & bendingAndTorsionJacobians + ); + + + /** Solves the system of equations with the factorized matrix H. + */ + static bool solve( + int intervalIndex, + std::list * forward, + std::list * backward, + std::vector & RHS, + std::vector & lambdaSums, + std::vector & corr_x, + std::vector & corr_q + ); + public: + + ///** Initialize the zero-stretch, bending, and torsion constraints of the rod. + //* Computes constraint connectors in segment space, computes the diagonal stiffness matrices + //* and the Darboux vectors of the initial state. Initializes the forward and backward lists + //* of nodes for the direct solver\n\n + //* + //* @param rodConstraints contains the combined zero-stretch, bending + //* and torsion constraints of the rod. The set of constraints must by acyclic. + //* @param rodSegments contains the segments of the rod + //* @param forward list of nodes in the acyclic tree of rod segments and zero-stretch, + //* bending and torsion constraints so that parent nodes occur later in the list than their children + //* @param backward list of nodes in the acyclic tree of rod segments and zero-stretch, + //* bending and torsion constraints. The reverse of the forward list. + //* @param constraintPositions positions of the rod's constraints in world coordinates + //* @param averageRadii the average radii at the constraint positions of the rod. Value in Meters (m) + //* @param averageSegmentLengths vector of the average lengths of the two rod segments + //* connected by a constraint of the rod. Value in Meters (m) + //* @param youngsModuli vector of the Young's modulus of every constraint of the rod. + //* The Young's modulus of the rod material measures + //* stiffness against bending. Value in Pascal (Pa) + //* @param torsionModuli vector of the torsion modulus of every constraint of the rod. + //* The torsion modulus (also called shear modulus) + //* of the rod material measures stiffness against torsion. Value in Pascal (Pa) + //* @param RHS vector with entries for each constraint. In concatenation these entries represent the right hand side of the system of equations to be solved. (eq. 22 in the paper) + //* @param lambdaSums contains entries of the sum of all lambda updates for + //* each constraint in the rod during one time step which is needed by the solver to handle + //* compliance in the correct way (cf. the right hand side of eq. 22 in the paper). + //* @param bendingAndTorsionJacobians this vector is used to temporary + //* save the Jacobians of the bending and torsion part of each constraint + //* during the solution process of the system of equations. Allocating this + //* vector outside of the solve-method avoids repeated reallocation between iterations of the solver + //* @param corr_x vector of position corrections for every segment of the rod (part of delta-x in eq. 22 in the paper) + //* @param corr_q vector of rotation corrections for every segment of the rod (part of delta-x in eq. 22 in the paper) + //*/ + static bool init_DirectPositionBasedSolverForStiffRodsConstraint( + std::vector &rodConstraints, + std::vector & rodSegments, + Interval* &intervals, + int &numberOfIntervals, + std::list * &forward, + std::list * &backward, + Node* &root, + const std::vector &constraintPositions, + const std::vector &averageRadii, + const std::vector &youngsModuli, + const std::vector &torsionModuli, + std::vector & RHS, + std::vector & lambdaSums, + std::vector> & bendingAndTorsionJacobians, + std::vector & corr_x, + std::vector & corr_q + ); + + ///** Update the constraint info data. \n\n + //* + //* @param rodConstraints contains the combined zero-stretch, bending and torsion constraints of the rod. + //* @param rodSegments contains the segments of the rod + //*/ + static bool update_DirectPositionBasedSolverForStiffRodsConstraint( + const std::vector &rodConstraints, + const std::vector & rodSegments + ); + + ///** Initialize the constraint before the projection iterations in each time step. \n\n + //* + //* @param rodConstraints contains the combined zero-stretch, bending and torsion constraints of the rod. + //* @param inverseTimeStepSize inverse of the current time step size used to compute compliance (see computation of alpha-tilde in eq. 17) + //* @param lambdaSums contains entries of the sum of all lambda updates for + //* each constraint in the rod during one time step which is needed by the solver to handle + //* compliance in the correct way (cf. the right hand side of eq. 22 in the paper). + //*/ + static bool initBeforeProjection_DirectPositionBasedSolverForStiffRodsConstraint( + const std::vector &rodConstraints, + const Real inverseTimeStepSize, + std::vector & lambdaSums + ); + + ///** Determine the position and orientation corrections for all combined zero-stretch, bending and twisting constraints of the rod (eq. 22 in the paper). \n\n + //* + //* @param rodConstraints contains the combined zero-stretch, bending and torsion constraints of the rod. The set of constraints must by acyclic. + //* @param rodSegments contains the segments of the rod + //* @param forward list of nodes in the acyclic tree of rod segments and zero-stretch, bending and torsion constraints so that parent nodes occur later in the list than their children + //* @param backward list of nodes in the acyclic tree of rod segments and zero-stretch, bending and torsion constraints. The reverse of the forward list. + //* @param RHS vector with entries for each constraint. In concatenation these entries represent the right hand side of the system of equations to be solved. (eq. 22 in the paper) + //* @param lambdaSums contains entries of the sum of all lambda updates for + //* each constraint in the rod during one time step which is needed by the solver to handle + //* compliance in the correct way. + //* @param bendingAndTorsionJacobians this vector is used to temporary + //* save the Jacobians of the bending and torsion part of each constraint + //* during the solution process of the system of equations. Allocating this + //* vector outside of the solve-method avoids repeated reallocation between iterations of the solver + //* @param corr_x vector of position corrections for every segment of the rod (part of delta-x in eq. 22 in the paper) + //* @param corr_q vector of rotation corrections for every segment of the rod (part of delta-x in eq. 22 in the paper) + //*/ + static bool solve_DirectPositionBasedSolverForStiffRodsConstraint( + const std::vector &rodConstraints, + std::vector & rodSegments, + const Interval* intervals, + const int &numberOfIntervals, + std::list * forward, + std::list * backward, + std::vector & RHS, + std::vector & lambdaSums, + std::vector> & bendingAndTorsionJacobians, + std::vector & corr_x, + std::vector & corr_q + ); + + ///** Initialize the zero-stretch, bending, and torsion constraint. + //* Computes constraint connectors in segment space, computes the diagonal stiffness matrix + //* and the Darboux vector of the initial state. \n\n + //* + //* @param x0 center of mass of body 0 + //* @param q0 rotation of body 0 + //* @param x1 center of mass of body 1 + //* @param q1 rotation of body 1 + //* @param constraintPosition position of the constraint in world coordinates + //* @param averageRadius the average radius of the two rod segments connected by the constraint. Value in Meters (m) + //* @param averageSegmentLength the average length of the two rod segments connected by the constraint. Value in Meters (m) + //* @param youngsModulus the Young's modulus of the rod material measures stiffness against bending. Value in Pascal (Pa) + //* @param torsionModulus the torsion modulus (also called shear modulus) of the rod material measures stiffness against torsion. Value in Pascal (Pa) + //* @param jointInfo joint information which is required by the solver.This + //* information is generated in this method + //* and updated each time the bodies change their state by update_StretchBendingTwistingConstraint(). + //* @param stiffnessCoefficientK diagonal matrix with material parameters for bending and torsion stiffness (eq. 5 in the paper) + //* @param restDarbouxVector the rest Darboux vector computed in this method with the initial constraint configuration + //*/ + static bool init_StretchBendingTwistingConstraint( + const Vector3r &x0, + const Quaternionr &q0, + const Vector3r &x1, + const Quaternionr &q1, + const Vector3r &constraintPosition, + const Real averageRadius, + const Real averageSegmentLength, + const Real youngsModulus, + const Real torsionModulus, + Eigen::Matrix &jointInfo, + Vector3r &stiffnessCoefficientK, + Vector3r &restDarbouxVector + ); + + ///** Initialize the constraint before the projection iterations in each time step. \n\n + //* + //* @param stiffnessCoefficientK diagonal matrix with material parameters for bending and torsion stiffness (eq. 5 in the paper) + //* @param inverseTimeStepSize inverse of the current time step size used to compute compliance (see computation of alpha-tilde in eq. 17) + //* @param bendingAndTorsionCompliance the compliance of the bending and torsion constraint part (eq. 24 in the paper) + //* @param stretchCompliance the compliance of the stretch constraint part (eq. 24 in the paper) + //* @param lambdaSum the sum of all lambda updates of + //* this constraint during one time step which is needed by the solver to handle + //* compliance in the correct way. Is set to zero. (see eq. 19 in the paper) + //*/ + static bool initBeforeProjection_StretchBendingTwistingConstraint( + const Vector3r &stiffnessCoefficientK, + const Real inverseTimeStepSize, + const Real averageSegmentLength, + Vector3r &stretchCompliance, + Vector3r &bendingAndTorsionCompliance, + Vector6r &lambdaSum + ); + + ///** Update the joint info data. \n\n + //* + //* @param x0 center of mass of body 0 + //* @param q0 rotation of body 0 + //* @param x1 center of mass of body 1 + //* @param q1 rotation of body 1 + //* @param jointInfo joint information which is required by the solver.This + //* information is updated by calling this method. + //*/ + static bool update_StretchBendingTwistingConstraint( + const Vector3r &x0, + const Quaternionr &q0, + const Vector3r &x1, + const Quaternionr &q1, + Eigen::Matrix &jointInfo + ); + + ///** Determine the position and orientation corrections for the combined zero-stretch, bending and twisting constraint (eq. 23 in the paper). \n\n + //* + //* @param invMass0 inverse mass of first body; inverse mass is zero if body is static + //* @param x0 center of mass of body 0 + //* @param inertiaInverseW0 inverse inertia tensor (world space) of body 0 + //* @param q0 rotation of body 0 + //* @param invMass1 inverse mass of second body; inverse mass is zero if body is static + //* @param x1 center of mass of body 1 + //* @param inertiaInverseW1 inverse inertia tensor (world space) of body 1 + //* @param q1 rotation of body 1 + //* @param restDarbouxVector the rest Darboux vector of the initial constraint configuration + //* @param averageSegmentLength the average length of the two rod segments connected by the constraint + //* @param stretchCompliance the compliance of the stretch constraint part (eq. 24 in the paper) + //* @param bendingAndTorsionCompliance the compliance of the bending and torsion constraint part (eq. 24 in the paper) + //* @param jointInfo joint information which is required by the solver.This + //* information must be generated in the beginning by calling init_StretchBendingTwistingConstraint() + //* and updated each time the bodies change their state by update_StretchBendingTwistingConstraint(). + //* @param corr_x0 position correction of center of mass of first body + //* @param corr_q0 rotation correction of first body + //* @param corr_x1 position correction of center of mass of second body + //* @param corr_q1 rotation correction of second body + //* @param lambdaSum the sum of all lambda updates of + //* this constraint during one time step which is needed by the solver to handle + //* compliance in the correct way. Must be set to zero before the position + //* projection iterations start at each time step by calling + //* initBeforeProjection_StretchBendingTwistingConstraint(). (see eq. 19 in the paper) + //*/ + static bool solve_StretchBendingTwistingConstraint( + const Real invMass0, + const Vector3r &x0, + const Matrix3r &inertiaInverseW0, + const Quaternionr &q0, + const Real invMass1, + const Vector3r &x1, + const Matrix3r &inertiaInverseW1, + const Quaternionr &q1, + const Vector3r &restDarbouxVector, + const Real averageSegmentLength, + const Vector3r &stretchCompliance, + const Vector3r &bendingAndTorsionCompliance, + const Eigen::Matrix &jointInfo, + Vector3r &corr_x0, Quaternionr &corr_q0, + Vector3r &corr_x1, Quaternionr &corr_q1, + Vector6r &lambdaSum + ); + }; + + + // Implementation of "Position And Orientation Based Cosserat Rods" paper + // (https://animation.rwth-aachen.de/publication/0550/) + // + // Implemented by: + // + // Tassilo Kugelstadt + // Computer Animation Group + // RWTH Aachen University + // + // kugelstadt[at] cs.rwth-aachen.de + // + class PositionBasedCosseratRods + { + public: + /** Determine the position and orientation corrections for the stretch and shear constraint constraint (eq. 37 in the paper). \n\n + * + * @param p0 position of first particle + * @param invMass0 inverse mass of first particle + * @param p1 position of second particle + * @param invMass1 inverse mass of second particle + * @param q0 Quaternionr at the center of the edge + * @param invMassq0 inverse mass of the quaternion + * @param stretchingAndShearingKs stiffness coefficients for stretching and shearing + * @param restLength rest edge length + * @param corr0 position correction of first particle + * @param corr1 position correction of second particle + * @param corrq0 orientation correction of quaternion + */ + static bool solve_StretchShearConstraint( + const Vector3r& p0, Real invMass0, + const Vector3r& p1, Real invMass1, + const Quaternionr& q0, Real invMassq0, + const Vector3r& stretchingAndShearingKs, + const Real restLength, + Vector3r& corr0, Vector3r& corr1, Quaternionr& corrq0); + + /** Determine the position corrections for the bending and torsion constraint constraint (eq. 40 in the paper). \n\n + * + * @param q0 first quaternion + * @param invMassq0 inverse mass of the first quaternion + * @param q1 second quaternion + * @param invMassq1 inverse Mass of the second quaternion + * @param bendingAndTwistingKs stiffness coefficients for stretching and shearing + * @param restDarbouxVector rest Darboux vector + * @param corrq0 position correction of first particle + * @param corrq1 position correction of second particle + */ + static bool solve_BendTwistConstraint( + const Quaternionr& q0, Real invMassq0, + const Quaternionr& q1, Real invMassq1, + const Vector3r& bendingAndTwistingKs, + const Quaternionr& restDarbouxVector, + Quaternionr& corrq0, Quaternionr& corrq1); + }; + + // Implementation of "Position Based Elastic Rods" paper + // (http://www.nobuyuki-umetani.com/PositionBasedElasticRod/2014_sca_PositionBasedElasticRod.html) + // + // The code is based on the implementation of + // + // Przemyslaw Korzeniowski + // Department of Surgery and Cancer + // Imperial College London + // + // http://github.com/korzen/PositionBasedDynamics-ElasticRod + // korzenio[at] gmail.com + // + class PositionBasedElasticRods + { + public: + /** Determine the position corrections for a perpendicular bisector constraint:\n\n + * \f$C(\mathbf{p}_0, \mathbf{p}_1, \mathbf{p}_2) = ( \mathbf{p}_1 - 0.5 (\mathbf{p}_0 + \mathbf{p}_1))^T (\mathbf{p}_1 - \mathbf{p}_0) = 0\f$\n\n + * + * @param p0 position of first particle + * @param invMass0 inverse mass of first particle + * @param p1 position of second particle + * @param invMass1 inverse mass of second particle + * @param p2 position of third particle + * @param invMass2 inverse mass of third particle + * @param stiffness stiffness coefficient + * @param corr0 position correction of first particle + * @param corr1 position correction of second particle + * @param corr2 position correction of third particle + */ + static bool solve_PerpendiculaBisectorConstraint( + const Vector3r &p0, Real invMass0, + const Vector3r &p1, Real invMass1, + const Vector3r &p2, Real invMass2, + const Real stiffness, + Vector3r &corr0, Vector3r &corr1, Vector3r &corr2); + + + /** Determine the position corrections for a constraint that enforces a rest length between an edge and a ghost point:\n\n + * \f$C(\mathbf{p}_0, \mathbf{p}_1, \mathbf{p}_2) = \| ( 0.5 (\mathbf{p}_0 + \mathbf{p}_1) - \mathbf{p}_2 \| - L_0 = 0\f$\n\n + * + * @param p0 position of first particle + * @param invMass0 inverse mass of first particle + * @param p1 position of second particle + * @param invMass1 inverse mass of second particle + * @param p2 position of third particle + * @param invMass2 inverse mass of third particle + * @param stiffness stiffness coefficient + * @param ghostEdgeRestLength rest length + * @param corr0 position correction of first particle + * @param corr1 position correction of second particle + * @param corr2 position correction of third particle + */ + static bool solve_GhostPointEdgeDistanceConstraint( + const Vector3r& p0, Real invMass0, + const Vector3r& p1, Real invMass1, + const Vector3r& p2, Real invMass2, + const Real stiffness, + const Real ghostEdgeRestLength, + Vector3r& corr0, Vector3r& corr1, Vector3r& corr2); + + + /** Determine the position corrections for the Darboux vector constraint (eq. 21 in the paper). See the paper appendix for derivation details\n\n + * + * @param p0 position of first particle + * @param invMass0 inverse mass of first particle + * @param p1 position of second particle + * @param invMass1 inverse mass of second particle + * @param p2 position of third particle + * @param invMass2 inverse mass of third particle + * @param p3 position of fourth particle + * @param invMass3 inverse mass of fourth particle + * @param p4 position of fifth particle + * @param invMass4 inverse mass of fifth particle + * @param bendingAndTwistingKs stiffness coefficients for bending and twisting + * @param midEdgeLength average edge length + * @param restDarbouxVector Darboux vector in rest state + * @param corr0 position correction of first particle + * @param corr1 position correction of second particle + * @param corr2 position correction of third particle + * @param corr3 position correction of fourth particle + * @param corr4 position correction of fifth particle + */ + static bool solve_DarbouxVectorConstraint( + const Vector3r& p0, Real invMass0, + const Vector3r& p1, Real invMass1, + const Vector3r& p2, Real invMass2, + const Vector3r& p3, Real invMass3, + const Vector3r& p4, Real invMass4, + const Vector3r& bendingAndTwistingKs, + const Real midEdgeLength, + const Vector3r& restDarbouxVector, + Vector3r& oa, Vector3r& ob, Vector3r& oc, Vector3r& od, Vector3r& oe); + + /** Computes the material frame (eq. 3 in the paper) + */ + static bool computeMaterialFrame( + const Vector3r& p0, //1st centreline point id + const Vector3r& p1, //2nd centreline point id + const Vector3r& p2, //corresponding ghost point + Matrix3r& frame); //resulting material frame + + /** Computes the Darboux Vector (eq. 10 in the paper) + */ + static bool computeDarbouxVector( + const Matrix3r& dA, //1st material frame + const Matrix3r& dB, //2nd material frame + const Real mid_edge_length, // + Vector3r& darboux_vector); //resulting darboux vector + + /** Computes the material frame derivatives (eq. 43, 44 and 45 in the appendix) + */ + static bool computeMaterialFrameDerivative( + const Vector3r& p0, const Vector3r& p1, const Vector3r& p2, // points + const Matrix3r& d, //corresponding material frame + Matrix3r& d1p0, Matrix3r& d1p1, Matrix3r& d1p2, //resulting matrices + Matrix3r& d2p0, Matrix3r& d2p1, Matrix3r& d2p2, //resulting matrices + Matrix3r& d3p0, Matrix3r& d3p1, Matrix3r& d3p2); //resulting matrices + + /** Compute the Darboux gradient in respect to each point (eq. 49-53 in the appendix) + */ + static bool computeDarbouxGradient( + const Vector3r& darboux_vector, //Darboux vector + const Real length, //element length + const Matrix3r& dA, //1st material frame + const Matrix3r& dB, //2nd material frame + const Matrix3r[3][3], const Matrix3r[3][3], //material frames derivatives + //const Vector3r& bendAndTwistKs, //bending (x,y) and twisting (z) stiffness + Matrix3r& omega_pa, Matrix3r& omega_pb, Matrix3r& omega_pc, Matrix3r& omega_pd, Matrix3r& omega_pe); //resulting matrices + + + }; +} + +#endif diff --git a/PositionBasedDynamics/PositionBasedFluids.cpp b/PositionBasedDynamics/PositionBasedFluids.cpp index 4200d60b..97e690b9 100644 --- a/PositionBasedDynamics/PositionBasedFluids.cpp +++ b/PositionBasedDynamics/PositionBasedFluids.cpp @@ -54,10 +54,10 @@ bool PositionBasedFluids::computePBFLagrangeMultiplier( const bool boundaryHandling, Real &lambda) { - const Real eps = 1.0e-6; + const Real eps = static_cast(1.0e-6); // Evaluate constraint function - const Real C = std::max(density / density0 - 1.0, 0.0); // clamp to prevent particle clumping at surface + const Real C = std::max(density / density0 - static_cast(1.0), static_cast(0.0)); // clamp to prevent particle clumping at surface if (C != 0.0) { diff --git a/PositionBasedDynamics/PositionBasedGenericConstraints.h b/PositionBasedDynamics/PositionBasedGenericConstraints.h index 0d86651b..e2cd47f9 100644 --- a/PositionBasedDynamics/PositionBasedGenericConstraints.h +++ b/PositionBasedDynamics/PositionBasedGenericConstraints.h @@ -71,7 +71,7 @@ namespace PBD void(*constraintFct)( const unsigned int numParticles, const Real invMass[], // inverse mass is zero if particle is static - const Eigen::Vector3d x[], // positions of particles + const Vector3r x[], // positions of particles void *userData, Eigen::Matrix &constraintValue), @@ -96,12 +96,127 @@ namespace PBD void(*constraintFct)( const unsigned int numParticles, const Real invMass[], // inverse mass is zero if particle is static - const Eigen::Vector3d x[], // positions of particles + const Vector3r x[], // positions of particles void *userData, Eigen::Matrix &constraintValue), Eigen::Matrix &jacobian); + + /** Determine the position corrections for a constraint function + * with a known gradient function.\n\n + * More information can be found here: \ref secGenericConstraintsCGFct + * + * @param invMass inverse mass of constrained rigid bodies + * @param x positions of constrained rigid bodies + * @param inertiaInverseW inverse inertia tensor in world coordinates of the rigid bodies + * @param q rotation of the rigid bodies + * @param userData user data which is required in the callback functions + * @param constraintFct constraint callback + * @param gradientFct gradient callback + * @param corr_x position corrections of the constrained rigid bodies + * @param corr_q rotation corrections of the constrained rigid bodies + */ + template + static bool solve_GenericConstraint( + const Real invMass[numberOfRigidBodies], // inverse mass is zero if body is static + const Vector3r x[numberOfRigidBodies], // positions of bodies + const Matrix3r inertiaInverseW[numberOfRigidBodies], // inverse inertia tensor (world space) of bodies + const Quaternionr q[numberOfRigidBodies], // rotation of bodies + void *userData, + + void(*constraintFct)( + const unsigned int numRigidBodies, + const Real invMass[numberOfRigidBodies], // inverse mass is zero if body is static + const Vector3r x[numberOfRigidBodies], // positions of bodies + const Matrix3r inertiaInverseW[numberOfRigidBodies], // inverse inertia tensor (world space) of bodies + const Quaternionr q[numberOfRigidBodies], // rotation of bodies + void *userData, + Eigen::Matrix &constraintValue), + + void(*gradientFct)( + const unsigned int i, // compute dC / dxi + const unsigned int numRigidBodies, + const Real invMass[numberOfRigidBodies], // inverse mass is zero if body is static + const Vector3r x[numberOfRigidBodies], // positions of bodies + const Matrix3r inertiaInverseW[numberOfRigidBodies], // inverse inertia tensor (world space) of bodies + const Quaternionr q[numberOfRigidBodies], // rotation of bodies + void *userData, + Eigen::Matrix &jacobian), + + Vector3r corr_x[numberOfRigidBodies], + Quaternionr corr_q[numberOfRigidBodies]); + + + /** Determine the position corrections for a constraint function. + * This method approximates the gradient using finite differences. + * Note that it is faster to define the gradient function explicitly.\n\n + * More information can be found here: \ref secGenericConstraintsCFct + * + * @param invMass inverse mass of constrained rigid bodies + * @param x positions of constrained rigid bodies + * @param inertiaInverseW inverse inertia tensor in world coordinates of the rigid bodies + * @param q rotation of the rigid bodies + * @param userData user data which is required in the callback functions + * @param constraintFct constraint callback + * @param corr_x position corrections of the constrained rigid bodies + * @param corr_q rotation corrections of the constrained rigid bodies + */ + template + static bool solve_GenericConstraint( + const Real invMass[numberOfRigidBodies], // inverse mass is zero if body is static + const Vector3r x[numberOfRigidBodies], // positions of bodies + const Matrix3r inertiaInverseW[numberOfRigidBodies], // inverse inertia tensor (world space) of bodies + const Quaternionr q[numberOfRigidBodies], + void *userData, + + void(*constraintFct)( + const unsigned int numParticles, + const Real invMass[numberOfRigidBodies], // inverse mass is zero if body is static + const Vector3r x[numberOfRigidBodies], // positions of bodies + const Matrix3r inertiaInverseW[numberOfRigidBodies], // inverse inertia tensor (world space) of bodies + const Quaternionr q[numberOfRigidBodies], + void *userData, + Eigen::Matrix &constraintValue), + + Vector3r corr_x[numberOfRigidBodies], + Quaternionr corr_q[numberOfRigidBodies]); + + /** Determines the Jacobian of the i-th rigid body with finite differences. + * + * @param i index of rigid body for which the gradient should be computed + * @param invMass inverse mass of constrained rigid bodies + * @param x positions of constrained rigid bodies + * @param inertiaInverseW inverse inertia tensor in world coordinates of the rigid bodies + * @param q rotation of the rigid bodies + * @param userData user data which is required in the callback functions + * @param constraintFct constraint callback + * @param jacobian Jacobian of the i-th rigid body + */ + template + static void approximateGradient( + const unsigned int i, // compute dC / dxi + const Real invMass[numberOfRigidBodies], // inverse mass is zero if body is static + const Vector3r x[numberOfRigidBodies], // positions of bodies + const Matrix3r inertiaInverseW[numberOfRigidBodies], // inverse inertia tensor (world space) of bodies + const Quaternionr q[numberOfRigidBodies], + void *userData, + + void(*constraintFct)( + const unsigned int numParticles, + const Real invMass[numberOfRigidBodies], // inverse mass is zero if body is static + const Vector3r x[numberOfRigidBodies], // positions of bodies + const Matrix3r inertiaInverseW[numberOfRigidBodies], // inverse inertia tensor (world space) of bodies + const Quaternionr q[numberOfRigidBodies], + void *userData, + Eigen::Matrix &constraintValue), + + Eigen::Matrix &jacobian); + + /** Compute matrix that is required to transform quaternion in + * a 3D representation. */ + static void computeMatrixG(const Quaternionr &q, Eigen::Matrix &G); + }; @@ -178,7 +293,7 @@ namespace PBD void(*constraintFct)( const unsigned int numParticles, const Real invMass[], // inverse mass is zero if particle is static - const Eigen::Vector3d x[], // positions of particles + const Vector3r x[], // positions of particles void *userData, Eigen::Matrix &constraintValue), @@ -186,7 +301,7 @@ namespace PBD { // evaluate constraint function Eigen::Matrix Cd; - Eigen::Vector3d xTemp[numberOfParticles]; + Vector3r xTemp[numberOfParticles]; for (unsigned int j = 0; j < numberOfParticles; j++) xTemp[j] = x[j].template cast(); @@ -239,19 +354,19 @@ namespace PBD void(*constraintFct)( const unsigned int numParticles, const Real invMass[], // inverse mass is zero if particle is static - const Eigen::Vector3d x[], // positions of particles + const Vector3r x[], // positions of particles void *userData, Eigen::Matrix &constraintValue), Eigen::Matrix &jacobian) { - Eigen::Vector3d xTemp[numberOfParticles]; + Vector3r xTemp[numberOfParticles]; for (unsigned int j = 0; j < numberOfParticles; j++) xTemp[j] = x[j].template cast(); - Real eps = 1.e-6; + Real eps = static_cast(1.e-6); jacobian.setZero(); - Eigen::Vector3d x_i = xTemp[i]; + Vector3r x_i = xTemp[i]; for (unsigned int j = 0; j < 3; j++) { xTemp[i][j] += eps; @@ -268,6 +383,253 @@ namespace PBD } } + + template + bool PositionBasedGenericConstraints::solve_GenericConstraint( + const Real invMass[numberOfRigidBodies], // inverse mass is zero if body is static + const Vector3r x[numberOfRigidBodies], // positions of bodies + const Matrix3r inertiaInverseW[numberOfRigidBodies], // inverse inertia tensor (world space) of bodies + const Quaternionr q[numberOfRigidBodies], + void *userData, + + void(*constraintFct)( + const unsigned int numRigidBodies, + const Real invMass[numberOfRigidBodies], // inverse mass is zero if body is static + const Vector3r x[numberOfRigidBodies], // positions of bodies + const Matrix3r inertiaInverseW[numberOfRigidBodies], // inverse inertia tensor (world space) of bodies + const Quaternionr q[numberOfRigidBodies], + void *userData, + Eigen::Matrix &constraintValue), + + void(*gradientFct)( + const unsigned int i, // compute dC / dxi + const unsigned int numRigidBodies, + const Real invMass[numberOfRigidBodies], // inverse mass is zero if body is static + const Vector3r x[numberOfRigidBodies], // positions of bodies + const Matrix3r inertiaInverseW[numberOfRigidBodies], // inverse inertia tensor (world space) of bodies + const Quaternionr q[numberOfRigidBodies], + void *userData, + Eigen::Matrix &jacobian), + + Vector3r corr_x[numberOfRigidBodies], + Quaternionr corr_q[numberOfRigidBodies]) + { + // evaluate constraint function + Eigen::Matrix C; + constraintFct(numberOfRigidBodies, invMass, x, inertiaInverseW, q, userData, C); + + Eigen::Matrix K; + K.setZero(); + + Eigen::Matrix gradients[numberOfRigidBodies]; + for (unsigned int i = 0u; i < numberOfRigidBodies; i++) + { + if (invMass[i] != 0.0) + { + // compute gradient + gradientFct(i, numberOfRigidBodies, invMass, x, inertiaInverseW, q, userData, gradients[i]); + + // inverse mass matrix + Eigen::Matrix Minv; + Minv.setZero(); + Minv(0, 0) = invMass[i]; + Minv(1, 1) = invMass[i]; + Minv(2, 2) = invMass[i]; + Minv.block<3, 3>(3, 3) = inertiaInverseW[i]; + + K += gradients[i] * Minv * gradients[i].transpose(); + } + } + + Eigen::Matrix Kinv = K.inverse(); + + Eigen::Matrix lambda = -Kinv * C; + + for (unsigned int i = 0u; i < numberOfRigidBodies; i++) + { + if (invMass[i] != 0.0) + { + // compute position correction + const Vector6r pt = gradients[i].transpose() * lambda; + corr_x[i] = invMass[i] * pt.block<3, 1>(0, 0); + const Vector3r ot = (inertiaInverseW[i] * pt.block<3, 1>(3, 0)); + const Quaternionr otQ(0.0, ot[0], ot[1], ot[2]); + corr_q[i].coeffs() = 0.5 *(otQ*q[i]).coeffs(); + } + else + { + corr_x[i].setZero(); + corr_q[i].coeffs().setZero(); + } + } + + return true; + } + + template + bool PositionBasedGenericConstraints::solve_GenericConstraint( + const Real invMass[numberOfRigidBodies], // inverse mass is zero if body is static + const Vector3r x[numberOfRigidBodies], // positions of bodies + const Matrix3r inertiaInverseW[numberOfRigidBodies], // inverse inertia tensor (world space) of bodies + const Quaternionr q[numberOfRigidBodies], + void *userData, + + void(*constraintFct)( + const unsigned int numParticles, + const Real invMass[numberOfRigidBodies], // inverse mass is zero if body is static + const Vector3r x[numberOfRigidBodies], // positions of bodies + const Matrix3r inertiaInverseW[numberOfRigidBodies], // inverse inertia tensor (world space) of bodies + const Quaternionr q[numberOfRigidBodies], + void *userData, + Eigen::Matrix &constraintValue), + + Vector3r corr_x[numberOfRigidBodies], + Quaternionr corr_q[numberOfRigidBodies]) + { + // evaluate constraint function + Eigen::Matrix C; + constraintFct(numberOfRigidBodies, invMass, x, inertiaInverseW, q, userData, C); + + Eigen::Matrix K; + K.setZero(); + + Eigen::Matrix gradients[numberOfRigidBodies]; + for (unsigned int i = 0u; i < numberOfRigidBodies; i++) + { + if (invMass[i] != 0.0) + { + // compute gradient + approximateGradient(i, invMass, x, inertiaInverseW, q, userData, constraintFct, gradients[i]); + + // inverse mass matrix + Eigen::Matrix Minv; + Minv.setZero(); + Minv(0, 0) = invMass[i]; + Minv(1, 1) = invMass[i]; + Minv(2, 2) = invMass[i]; + Minv.block<3, 3>(3, 3) = inertiaInverseW[i]; + + K += gradients[i] * Minv * gradients[i].transpose(); + } + } + + Eigen::Matrix Kinv = K.inverse(); + + Eigen::Matrix lambda = -Kinv * C; + + for (unsigned int i = 0u; i < numberOfRigidBodies; i++) + { + if (invMass[i] != 0.0) + { + // compute position correction + const Vector6r pt = gradients[i].transpose() * lambda; + corr_x[i] = invMass[i] * pt.block<3, 1>(0, 0); + const Vector3r ot = (inertiaInverseW[i] * pt.block<3, 1>(3, 0)); + const Quaternionr otQ(0.0, ot[0], ot[1], ot[2]); + corr_q[i].coeffs() = 0.5 *(otQ*q[i]).coeffs(); + } + else + { + corr_x[i].setZero(); + corr_q[i].coeffs().setZero(); + } + } + + return true; + } + + void PositionBasedGenericConstraints::computeMatrixG(const Quaternionr &q, Eigen::Matrix &G) + { + G(0, 0) = -static_cast(0.5)*q.x(); + G(0, 1) = -static_cast(0.5)*q.y(); + G(0, 2) = -static_cast(0.5)*q.z(); + + G(1, 0) = static_cast(0.5)*q.w(); + G(1, 1) = static_cast(0.5)*q.z(); + G(1, 2) = -static_cast(0.5)*q.y(); + + G(2, 0) = -static_cast(0.5)*q.z(); + G(2, 1) = static_cast(0.5)*q.w(); + G(2, 2) = static_cast(0.5)*q.x(); + + G(3, 0) = static_cast(0.5)*q.y(); + G(3, 1) = -static_cast(0.5)*q.x(); + G(3, 2) = static_cast(0.5)*q.w(); + } + + template + void PositionBasedGenericConstraints::approximateGradient( + const unsigned int i, // compute dC / dxi + const Real invMass[numberOfRigidBodies], // inverse mass is zero if body is static + const Vector3r x[numberOfRigidBodies], // positions of bodies + const Matrix3r inertiaInverseW[numberOfRigidBodies], // inverse inertia tensor (world space) of bodies + const Quaternionr q[numberOfRigidBodies], + void *userData, + + void(*constraintFct)( + const unsigned int numParticles, + const Real invMass[numberOfRigidBodies], // inverse mass is zero if body is static + const Vector3r x[numberOfRigidBodies], // positions of bodies + const Matrix3r inertiaInverseW[numberOfRigidBodies], // inverse inertia tensor (world space) of bodies + const Quaternionr q[numberOfRigidBodies], + void *userData, + Eigen::Matrix &constraintValue), + + Eigen::Matrix &jacobian) + { + Vector3r xTemp[numberOfRigidBodies]; + Quaternionr qTemp[numberOfRigidBodies]; + for (unsigned int j = 0; j < numberOfRigidBodies; j++) + { + xTemp[j] = x[j]; + qTemp[j] = q[j]; + } + + Real eps = static_cast(1.e-6); + jacobian.setZero(); + Vector3r x_i = xTemp[i]; + + // Translation + for (unsigned int j = 0; j < 3; j++) + { + xTemp[i][j] += eps; + + Eigen::Matrix e_p, e_m; + constraintFct(numberOfRigidBodies, invMass, xTemp, inertiaInverseW, q, userData, e_p); + xTemp[i][j] = x_i[j] - eps; + constraintFct(numberOfRigidBodies, invMass, xTemp, inertiaInverseW, q, userData, e_m); + xTemp[i][j] = x_i[j]; + + jacobian.template block(0, j) = (e_p - e_m) * (1.0 / (2.0*eps)); + } + + // Rotation + Quaternionr q_i = qTemp[i]; + Eigen::Matrix jacobian4[4]; + for (unsigned int j = 0; j < 4; j++) + { + qTemp[i].coeffs()[j] += eps; + + Eigen::Matrix e_p, e_m; + constraintFct(numberOfRigidBodies, invMass, x, inertiaInverseW, qTemp, userData, e_p); + qTemp[i].coeffs()[j] = q_i.coeffs()[j] - eps; + constraintFct(numberOfRigidBodies, invMass, x, inertiaInverseW, qTemp, userData, e_m); + qTemp[i].coeffs()[j] = q_i.coeffs()[j]; + + jacobian4[j] = (e_p - e_m) * (1.0 / (2.0*eps)); + } + + Eigen::Matrix G; + computeMatrixG(q[i], G); + // Bring in correct order + Eigen::Matrix jh; + jh.template block(0, 0) = jacobian4[3]; + jh.template block(0, 1) = jacobian4[0]; + jh.template block(0, 2) = jacobian4[1]; + jh.template block(0, 3) = jacobian4[2]; + jacobian.template block(0, 3) = jh * G; + } + } -#endif \ No newline at end of file +#endif diff --git a/PositionBasedDynamics/PositionBasedRigidBodyDynamics.cpp b/PositionBasedDynamics/PositionBasedRigidBodyDynamics.cpp index a01e1a03..e2a92eaa 100644 --- a/PositionBasedDynamics/PositionBasedRigidBodyDynamics.cpp +++ b/PositionBasedDynamics/PositionBasedRigidBodyDynamics.cpp @@ -2,6 +2,8 @@ #include "MathFunctions.h" #include #include +#define _USE_MATH_DEFINES +#include "math.h" using namespace PBD; @@ -85,6 +87,74 @@ void PositionBasedRigidBodyDynamics::computeMatrixK( K.setZero(); } +// ---------------------------------------------------------------------------------------------- +void PositionBasedRigidBodyDynamics::computeMatrixG(const Quaternionr &q, Eigen::Matrix &G) +{ + G(0, 0) = -static_cast(0.5)*q.x(); + G(0, 1) = -static_cast(0.5)*q.y(); + G(0, 2) = -static_cast(0.5)*q.z(); + + G(1, 0) = static_cast(0.5)*q.w(); + G(1, 1) = static_cast(0.5)*q.z(); + G(1, 2) = static_cast(-0.5)*q.y(); + + G(2, 0) = static_cast(-0.5)*q.z(); + G(2, 1) = static_cast(0.5)*q.w(); + G(2, 2) = static_cast(0.5)*q.x(); + + G(3, 0) = static_cast(0.5)*q.y(); + G(3, 1) = static_cast(-0.5)*q.x(); + G(3, 2) = static_cast(0.5)*q.w(); +} + +// ---------------------------------------------------------------------------------------------- +void PositionBasedRigidBodyDynamics::computeMatrixQ(const Quaternionr &q, Eigen::Matrix &Q) +{ + Q(0, 0) = q.w(); + Q(0, 1) = -q.x(); + Q(0, 2) = -q.y(); + Q(0, 3) = -q.z(); + + Q(1, 0) = q.x(); + Q(1, 1) = q.w(); + Q(1, 2) = -q.z(); + Q(1, 3) = q.y(); + + Q(2, 0) = q.y(); + Q(2, 1) = q.z(); + Q(2, 2) = q.w(); + Q(2, 3) = -q.x(); + + Q(3, 0) = q.z(); + Q(3, 1) = -q.y(); + Q(3, 2) = q.x(); + Q(3, 3) = q.w(); +} + +// ---------------------------------------------------------------------------------------------- +void PositionBasedRigidBodyDynamics::computeMatrixQHat(const Quaternionr &q, Eigen::Matrix &Q) +{ + Q(0, 0) = q.w(); + Q(0, 1) = -q.x(); + Q(0, 2) = -q.y(); + Q(0, 3) = -q.z(); + + Q(1, 0) = q.x(); + Q(1, 1) = q.w(); + Q(1, 2) = q.z(); + Q(1, 3) = -q.y(); + + Q(2, 0) = q.y(); + Q(2, 1) = -q.z(); + Q(2, 2) = q.w(); + Q(2, 3) = q.x(); + + Q(3, 0) = q.z(); + Q(3, 1) = q.y(); + Q(3, 2) = -q.x(); + Q(3, 3) = q.w(); +} + // ---------------------------------------------------------------------------------------------- bool PositionBasedRigidBodyDynamics::init_BallJoint( @@ -93,7 +163,7 @@ bool PositionBasedRigidBodyDynamics::init_BallJoint( const Vector3r &x1, const Quaternionr &q1, const Vector3r &ballJointPosition, - Eigen::Matrix &ballJointInfo + Eigen::Matrix &ballJointInfo ) { // jointInfo contains @@ -120,7 +190,7 @@ bool PositionBasedRigidBodyDynamics::update_BallJoint( const Quaternionr &q0, const Vector3r &x1, const Quaternionr &q1, - Eigen::Matrix &ballJointInfo + Eigen::Matrix &ballJointInfo ) { // jointInfo contains @@ -148,7 +218,7 @@ bool PositionBasedRigidBodyDynamics::solve_BallJoint( const Vector3r &x1, const Matrix3r &inertiaInverseW1, const Quaternionr &q1, - const Eigen::Matrix &ballJointInfo, + const Eigen::Matrix &ballJointInfo, Vector3r &corr_x0, Quaternionr &corr_q0, Vector3r &corr_x1, Quaternionr &corr_q1) { @@ -165,9 +235,8 @@ bool PositionBasedRigidBodyDynamics::solve_BallJoint( Matrix3r K1, K2; computeMatrixK(connector0, invMass0, x0, inertiaInverseW0, K1); computeMatrixK(connector1, invMass1, x1, inertiaInverseW1, K2); - const Matrix3r Kinv = (K1 + K2).inverse(); - const Vector3r pt = Kinv * (connector1 - connector0); + const Vector3r pt = (K1 + K2).llt().solve(connector1 - connector0); if (invMass0 != 0.0) { @@ -192,6 +261,159 @@ bool PositionBasedRigidBodyDynamics::solve_BallJoint( return true; } +// ---------------------------------------------------------------------------------------------- +bool PositionBasedRigidBodyDynamics::init_DistanceJoint( + const Vector3r &x0, + const Quaternionr &q0, + const Vector3r &x1, + const Quaternionr &q1, + const Vector3r &pos0, + const Vector3r &pos1, + Eigen::Matrix &jointInfo +) +{ + // jointInfo contains + // 0: connector in body 0 (local) + // 1: connector in body 1 (local) + // 2: connector in body 0 (global) + // 3: connector in body 1 (global) + + // transform in local coordinates + const Matrix3r rot0T = q0.matrix().transpose(); + const Matrix3r rot1T = q1.matrix().transpose(); + + jointInfo.col(0) = rot0T * (pos0 - x0); + jointInfo.col(1) = rot1T * (pos1 - x1); + jointInfo.col(2) = pos0; + jointInfo.col(3) = pos1; + + return true; +} + +// ---------------------------------------------------------------------------------------------- +bool PositionBasedRigidBodyDynamics::update_DistanceJoint( + const Vector3r &x0, + const Quaternionr &q0, + const Vector3r &x1, + const Quaternionr &q1, + Eigen::Matrix &jointInfo +) +{ + // jointInfo contains + // 0: connector in body 0 (local) + // 1: connector in body 1 (local) + // 2: connector in body 0 (global) + // 3: connector in body 1 (global) + + // compute world space positions of connectors + const Matrix3r rot0 = q0.matrix(); + const Matrix3r rot1 = q1.matrix(); + jointInfo.col(2) = rot0 * jointInfo.col(0) + x0; + jointInfo.col(3) = rot1 * jointInfo.col(1) + x1; + + return true; +} + + +// ---------------------------------------------------------------------------------------------- +bool PositionBasedRigidBodyDynamics::solve_DistanceJoint( + const Real invMass0, + const Vector3r &x0, + const Matrix3r &inertiaInverseW0, + const Quaternionr &q0, + const Real invMass1, + const Vector3r &x1, + const Matrix3r &inertiaInverseW1, + const Quaternionr &q1, + const Real stiffness, + const Real restLength, + const Real dt, + const Eigen::Matrix &jointInfo, + Real &lambda, + Vector3r &corr_x0, Quaternionr &corr_q0, + Vector3r &corr_x1, Quaternionr &corr_q1) +{ + // jointInfo contains + // 0: connector in body 0 (local) + // 1: connector in body 1 (local) + // 2: connector in body 0 (global) + // 3: connector in body 1 (global) + + // evaluate constraint function + const Vector3r &c0 = jointInfo.col(2); + const Vector3r &c1 = jointInfo.col(3); + const Real length = (c0 - c1).norm(); + + const Real C = (length - restLength); + + // compute K = J M^-1 J^T + Matrix3r K1, K2; + computeMatrixK(c0, invMass0, x0, inertiaInverseW0, K1); + computeMatrixK(c1, invMass1, x1, inertiaInverseW1, K2); + Vector3r dir = c0 - c1; + if (length > static_cast(1e-5)) + dir /= length; + else + { + corr_x0.setZero(); + corr_x1.setZero(); + corr_q0.setIdentity(); + corr_q1.setIdentity(); + return true; + } + + // J = (dir^T dir^T * r^* ) + + // J = (I r^*) + + Real K = (dir.transpose() * (K1 + K2)).dot(dir); + + Real alpha = 0.0; + if (stiffness != 0.0) + { + alpha = static_cast(1.0) / (stiffness * dt * dt); + K += alpha; + } + + Real Kinv = 0.0; + if (fabs(K) > static_cast(1e-6)) + Kinv = static_cast(1.0) / K; + else + { + corr_x0.setZero(); + corr_x1.setZero(); + corr_q0.setIdentity(); + corr_q1.setIdentity(); + return true; + } + + const Real delta_lambda = -Kinv * (C + alpha * lambda); + lambda += delta_lambda; + const Vector3r pt = dir * delta_lambda; + + + if (invMass0 != 0.0) + { + const Vector3r r0 = c0 - x0; + corr_x0 = invMass0 * pt; + + const Vector3r ot = (inertiaInverseW0 * (r0.cross(pt))); + const Quaternionr otQ(0.0, ot[0], ot[1], ot[2]); + corr_q0.coeffs() = 0.5 *(otQ*q0).coeffs(); + } + + if (invMass1 != 0.0) + { + const Vector3r r1 = c1 - x1; + corr_x1 = -invMass1 * pt; + + const Vector3r ot = (inertiaInverseW1 * (r1.cross(-pt))); + const Quaternionr otQ(0.0, ot[0], ot[1], ot[2]); + corr_q1.coeffs() = 0.5 *(otQ*q1).coeffs(); + } + return true; +} + // ---------------------------------------------------------------------------------------------- bool PositionBasedRigidBodyDynamics::init_BallOnLineJoint( @@ -201,7 +423,7 @@ bool PositionBasedRigidBodyDynamics::init_BallOnLineJoint( const Quaternionr &q1, const Vector3r &position, const Vector3r &direction, - Eigen::Matrix &jointInfo + Eigen::Matrix &jointInfo ) { // jointInfo contains @@ -247,7 +469,7 @@ bool PositionBasedRigidBodyDynamics::update_BallOnLineJoint( const Quaternionr &q0, const Vector3r &x1, const Quaternionr &q1, - Eigen::Matrix &jointInfo + Eigen::Matrix &jointInfo ) { // jointInfo contains @@ -286,7 +508,7 @@ bool PositionBasedRigidBodyDynamics::solve_BallOnLineJoint( const Vector3r &x1, const Matrix3r &inertiaInverseW1, const Quaternionr &q1, - const Eigen::Matrix &jointInfo, + const Eigen::Matrix &jointInfo, Vector3r &corr_x0, Quaternionr &corr_q0, Vector3r &corr_x1, Quaternionr &corr_q1) { @@ -311,9 +533,7 @@ bool PositionBasedRigidBodyDynamics::solve_BallOnLineJoint( const Eigen::Matrix P = PT.transpose(); const Matrix2r K = P * (K1 + K2) * PT; - const Matrix2r Kinv = K.inverse(); - - const Vector2r pt2D = Kinv * (P * (connector1 - connector0)); + const Vector2r pt2D = K.llt().solve(P * (connector1 - connector0)); const Vector3r pt = PT * pt2D; if (invMass0 != 0.0) @@ -347,55 +567,56 @@ bool PositionBasedRigidBodyDynamics::init_HingeJoint( const Quaternionr &q1, const Vector3r &position, const Vector3r &direction, - Eigen::Matrix &jointInfo + Eigen::Matrix &jointInfo ) { // jointInfo contains - // 0: connector in body 0 (local) - // 1: connector in body 1 (local) - // 2-4: coordinate system of body 0 (local) - // 5: joint axis in body 1 (local) - // 6: connector in body 0 (global) - // 7: connector in body 1 (global) - // 8-10:coordinate system of body 0 (global) - // 11: joint axis in body 1 (global) + // 0-1: projection matrix Pr for the rotational part + // 2: connector in body 0 (local) + // 3: connector in body 1 (local) + // 4: connector in body 0 (global) + // 5: connector in body 1 (global) + // 6: hinge axis in body 0 (local) used for rendering // transform in local coordinates const Matrix3r rot0T = q0.matrix().transpose(); const Matrix3r rot1T = q1.matrix().transpose(); // connector in body 0 (local) - jointInfo.col(0) = rot0T * (position - x0); + jointInfo.block<3, 1>(0, 2) = rot0T * (position - x0); // connector in body 1 (local) - jointInfo.col(1) = rot1T * (position - x1); + jointInfo.block<3, 1>(0, 3) = rot1T * (position - x1); // connector in body 0 (global) - jointInfo.col(6) = position; + jointInfo.block<3, 1>(0, 4) = position; // connector in body 1 (global) - jointInfo.col(7) = position; + jointInfo.block<3, 1>(0, 5) = position; + jointInfo.block<3, 1>(0, 6) = rot0T * direction; // determine constraint coordinate system // with direction as x-axis - jointInfo.col(8) = direction; - jointInfo.col(8).normalize(); + Matrix3r R0; + R0.col(0) = direction; + R0.col(0).normalize(); Vector3r v(1.0, 0.0, 0.0); // check if vectors are parallel - if (fabs(v.dot(jointInfo.col(8))) > 0.99) + if (fabs(v.dot(R0.col(0))) > 0.99) v = Vector3r(0.0, 1.0, 0.0); - jointInfo.col(9) = jointInfo.col(8).cross(v); - jointInfo.col(10) = jointInfo.col(8).cross(jointInfo.col(9)); - jointInfo.col(9).normalize(); - jointInfo.col(10).normalize(); + R0.col(1) = R0.col(0).cross(v); + R0.col(2) = R0.col(0).cross(R0.col(1)); + R0.col(1).normalize(); + R0.col(2).normalize(); - // joint axis in body 1 (global) - jointInfo.col(11) = jointInfo.col(8); + Quaternionr qR0(R0); + const Quaternionr q00 = (q0.conjugate() * qR0).conjugate(); + const Quaternionr q10 = (q1.conjugate() * qR0).conjugate(); - // coordinate system of body 0 (local) - jointInfo.block<3, 3>(0, 2) = rot0T * jointInfo.block<3, 3>(0, 8); - - // joint axis in body 1 (local) - jointInfo.col(5) = rot1T * jointInfo.col(11); + Eigen::Matrix Qq00, QHatq10; + computeMatrixQ(q00, Qq00); + computeMatrixQHat(q10, QHatq10); + Eigen::Matrix Pr = (QHatq10.transpose() * Qq00).block<2, 4>(2, 0); + jointInfo.block<4, 2>(0, 0) = Pr.transpose(); return true; } @@ -406,30 +627,22 @@ bool PositionBasedRigidBodyDynamics::update_HingeJoint( const Quaternionr &q0, const Vector3r &x1, const Quaternionr &q1, - Eigen::Matrix &jointInfo + Eigen::Matrix &jointInfo ) { // jointInfo contains - // 0: connector in body 0 (local) - // 1: connector in body 1 (local) - // 2-4: coordinate system of body 0 (local) - // 5: joint axis in body 1 (local) - // 6: connector in body 0 (global) - // 7: connector in body 1 (global) - // 8-10:coordinate system of body 0 (global) - // 11: joint axis in body 1 (global) - + // 0-1: projection matrix Pr for the rotational part + // 2: connector in body 0 (local) + // 3: connector in body 1 (local) + // 4: connector in body 0 (global) + // 5: connector in body 1 (global) + // 6: hinge axis in body 0 (local) used for rendering // compute world space positions of connectors const Matrix3r rot0 = q0.matrix(); const Matrix3r rot1 = q1.matrix(); - jointInfo.col(6) = rot0 * jointInfo.col(0) + x0; - jointInfo.col(7) = rot1 * jointInfo.col(1) + x1; - - // transform constraint coordinate system of body 0 to world space - jointInfo.block<3, 3>(0, 8) = rot0 * jointInfo.block<3, 3>(0, 2); - // transform joint axis of body 1 to world space - jointInfo.col(11) = rot1 * jointInfo.col(5); + jointInfo.block<3, 1>(0, 4) = rot0 * jointInfo.block<3, 1>(0, 2) + x0; + jointInfo.block<3, 1>(0, 5) = rot1 * jointInfo.block<3, 1>(0, 3) + x1; return true; } @@ -444,38 +657,44 @@ bool PositionBasedRigidBodyDynamics::solve_HingeJoint( const Vector3r &x1, const Matrix3r &inertiaInverseW1, const Quaternionr &q1, - const Eigen::Matrix &jointInfo, + const Eigen::Matrix &jointInfo, Vector3r &corr_x0, Quaternionr &corr_q0, Vector3r &corr_x1, Quaternionr &corr_q1) { // jointInfo contains - // 0: connector in body 0 (local) - // 1: connector in body 1 (local) - // 2-4: coordinate system of body 0 (local) - // 5: joint axis in body 1 (local) - // 6: connector in body 0 (global) - // 7: connector in body 1 (global) - // 8-10:coordinate system of body 0 (global) - // 11: joint axis in body 1 (global) - - const Vector3r &c0 = jointInfo.col(6); - const Vector3r &c1 = jointInfo.col(7); - const Vector3r &axis0 = jointInfo.col(8); - const Vector3r &axis1 = jointInfo.col(11); - const Vector3r u = axis0.cross(axis1); - const Vector3r &t1 = jointInfo.col(9); - const Vector3r &t2 = jointInfo.col(10); + // 0-1: projection matrix Pr for the rotational part + // 2: connector in body 0 (local) + // 3: connector in body 1 (local) + // 4: connector in body 0 (global) + // 5: connector in body 1 (global) + // 6: hinge axis in body 0 (local) used for rendering + + + // compute constraint value + const Vector3r &c0 = jointInfo.block<3, 1>(0, 4); + const Vector3r &c1 = jointInfo.block<3, 1>(0, 5); + const Eigen::Matrix &Pr = jointInfo.block<4, 2>(0, 0).transpose(); + + Eigen::Matrix C; + C.block<3, 1>(0, 0) = c0 - c1; + + const Quaternionr tmp = (q0.conjugate() * q1); + const Vector4r qVec(tmp.w(), tmp.x(), tmp.y(), tmp.z()); + C.block<2, 1>(3, 0) = Pr * qVec; + + // compute matrix J M^-1 J^T = K const Vector3r r0 = c0 - x0; const Vector3r r1 = c1 - x1; Matrix3r r0_star, r1_star; MathFunctions::crossProductMatrix(r0, r0_star); MathFunctions::crossProductMatrix(r1, r1_star); + Eigen::Matrix Gq1; + computeMatrixG(q1, Gq1); + Eigen::Matrix Qq0; + computeMatrixQ(q0, Qq0); - Eigen::Matrix b; - b.block<3, 1>(0, 0) = c1 - c0; - b(3, 0) = t1.dot(u); - b(4, 0) = t2.dot(u); + const Eigen::Matrix t = -Pr * (Qq0.transpose() * Gq1); Eigen::Matrix K; K.setZero(); @@ -484,70 +703,56 @@ bool PositionBasedRigidBodyDynamics::solve_HingeJoint( // Jacobian for body 0 is // // (I_3 -r0*) - // (0 t1^T) - // (0 t2^T) + // (0 t) // - // where I_3 is the identity matrix and r0* is the cross product matrix of r0 + // where I_3 is the identity matrix, r0* is the cross product matrix of r0 and + // t = -Pr * (Qq0^T * Gq1) // // J M^-1 J^T = - // ( 1/m I_3-r0 * J0^-1 * r0* -r0 * J0^-1 * t1 -r0 * J0^-1 * t2 ) - // ( (-r0* J0^-1 * t1)^T t1^T * J0^-1 t1 t1^T * J0^-1 t2 ) - // ( (-r0* J0^-1 * t2)^T t2^T * J0^-1 t1 t2^T * J0^-1 t2 ) + // ( 1/m I_3-r0 * J0^-1 * r0* -r0 * J0^-1 * t^T ) + // ( (-r0 * J0^-1 * t^T)^T t * J0^-1 * t^T ) Matrix3r K00; computeMatrixK(c0, invMass0, x0, inertiaInverseW0, K00); K.block<3, 3>(0, 0) = K00; - K.block<3, 1>(0, 3) = -r0_star * inertiaInverseW0 * t1; - K.block<3, 1>(0, 4) = -r0_star * inertiaInverseW0 * t2; - K.block<1, 3>(3, 0) = K.block<3, 1>(0, 3).transpose(); - K.block<1, 3>(4, 0) = K.block<3, 1>(0, 4).transpose(); - K(3, 3) = t1.transpose() * inertiaInverseW0 * t1; - K(3, 4) = t1.transpose() * inertiaInverseW0 * t2; - K(4, 3) = K(3, 4); - K(4, 4) = t2.transpose() * inertiaInverseW0 * t2; + K.block<3, 2>(0, 3) = -r0_star * inertiaInverseW0 * t.transpose(); + K.block<2, 3>(3, 0) = K.block<3, 2>(0, 3).transpose(); + K.block<2, 2>(3, 3) = t * inertiaInverseW0 * t.transpose(); } if (invMass1 != 0.0) { // Jacobian for body 1 is // - // ( -I_3 r1* ) - // ( 0 -t1^T ) - // ( 0 -t2^T ) + // (-I_3 r1*) + // (0 -t) // - // where I_3 is the identity matrix and r1* is the cross product matrix of r1 + // where I_3 is the identity matrix, r1* is the cross product matrix of r1 and + // t = -Pr * (Qq0^T * Gq1) // // J M^-1 J^T = - // ( 1/m I_3-r1 * J1^-1 * r1* -r1 * J1^-1 * t1 -r1 * J1^-1 * t2 ) - // ( (-r1* J1^-1 * t1)^T t1^T * J1^-1 t1 t1^T * J1^-1 t2 ) - // ( (-r1* J1^-1 * t2)^T t2^T * J1^-1 t1 t2^T * J1^-1 t2 ) + // ( 1/m I_3-r1 * J1^-1 * r1* r1 * J1^-1 * t^T ) + // ( (r1 * J1^-1 * t^T)^T t * J1^-1 * t^T ) Matrix3r K11; computeMatrixK(c1, invMass1, x1, inertiaInverseW1, K11); K.block<3, 3>(0, 0) += K11; - const Vector3r K_03 = -r1_star * inertiaInverseW1 * t1; - const Vector3r K_04 = -r1_star * inertiaInverseW1 * t2; - K.block<3, 1>(0, 3) += K_03; - K.block<3, 1>(0, 4) += K_04; - K.block<1, 3>(3, 0) += K_03.transpose(); - K.block<1, 3>(4, 0) += K_04.transpose(); - K(3, 3) += t1.transpose() * inertiaInverseW1 * t1; - const Real K_34 = t1.transpose() * inertiaInverseW1 * t2; - K(3, 4) += K_34; - K(4, 3) += K_34; - K(4, 4) += t2.transpose() * inertiaInverseW1 * t2; + Eigen::Matrix K03 = -r1_star * inertiaInverseW1 * t.transpose(); + K.block<3, 2>(0, 3) += K03; + K.block<2, 3>(3, 0) += K03.transpose(); + K.block<2, 2>(3, 3) += t * inertiaInverseW1 * t.transpose(); } - const Eigen::Matrix Kinv = K.inverse(); + const Eigen::Matrix lambda = K.llt().solve(-C); - const Eigen::Matrix lambda = Kinv * b; const Vector3r pt = lambda.block<3, 1>(0, 0); + const Vector3r amt = t.transpose() * lambda.block<2, 1>(3, 0); if (invMass0 != 0.0) { corr_x0 = invMass0*pt; - const Vector3r ot = (inertiaInverseW0 * (r0.cross(pt) + t1*lambda(3, 0) + t2*lambda(4, 0))); + const Vector3r ot = (inertiaInverseW0 * (r0.cross(pt) + amt)); const Quaternionr otQ(0.0, ot[0], ot[1], ot[2]); corr_q0.coeffs() = 0.5 *(otQ*q0).coeffs(); } @@ -555,12 +760,12 @@ bool PositionBasedRigidBodyDynamics::solve_HingeJoint( if (invMass1 != 0.0) { corr_x1 = -invMass1*pt; - const Vector3r ot = (inertiaInverseW1 * (r1.cross(-pt) - t1*lambda(3, 0) - t2*lambda(4, 0))); + const Vector3r ot = (inertiaInverseW1 * (r1.cross(-pt) - amt)); const Quaternionr otQ(0.0, ot[0], ot[1], ot[2]); corr_q1.coeffs() = 0.5 *(otQ*q1).coeffs(); } - return true; + return true; } // ---------------------------------------------------------------------------------------------- @@ -572,7 +777,7 @@ bool PositionBasedRigidBodyDynamics::init_UniversalJoint( const Vector3r &position, const Vector3r &jointAxis0, const Vector3r &jointAxis1, - Eigen::Matrix &jointInfo + Eigen::Matrix &jointInfo ) { // jointInfo contains @@ -626,7 +831,7 @@ bool PositionBasedRigidBodyDynamics::update_UniversalJoint( const Quaternionr &q0, const Vector3r &x1, const Quaternionr &q1, - Eigen::Matrix &jointInfo + Eigen::Matrix &jointInfo ) { // jointInfo contains @@ -664,7 +869,7 @@ bool PositionBasedRigidBodyDynamics::solve_UniversalJoint( const Vector3r &x1, const Matrix3r &inertiaInverseW1, const Quaternionr &q1, - const Eigen::Matrix &jointInfo, + const Eigen::Matrix &jointInfo, Vector3r &corr_x0, Quaternionr &corr_q0, Vector3r &corr_x1, Quaternionr &corr_q1) { @@ -740,9 +945,8 @@ bool PositionBasedRigidBodyDynamics::solve_UniversalJoint( K(3, 3) += u.transpose() * inertiaInverseW1 * u; } - const Eigen::Matrix Kinv = K.inverse(); + const Eigen::Matrix lambda = K.llt().solve(b); - const Eigen::Matrix lambda = Kinv * b; const Vector3r pt = lambda.block<3, 1>(0, 0); if (invMass0 != 0.0) @@ -771,65 +975,50 @@ bool PositionBasedRigidBodyDynamics::init_SliderJoint( const Quaternionr &q0, const Vector3r &x1, const Quaternionr &q1, - const Vector3r &position, const Vector3r &direction, - Eigen::Matrix &jointInfo + Eigen::Matrix &jointInfo ) { // jointInfo contains - // 0: connector in body 0 (local) - // 1: connector in body 1 (local) - // 2-4: coordinate system of body 0 (local) - // 5: joint axis in body 1 (local) - // 6: connector in body 0 (global) - // 7: connector in body 1 (global) - // 8-10:coordinate system of body 0 (global) - // 11: joint axis in body 1 (global) - // 12: perpendicular vector on joint axis (normalized) in body 1 (local) - // 13: perpendicular vector on joint axis (normalized) in body 1 (global) + // 0: coordinate system in body 0, where the x-axis is the slider axis (local) + // 1: coordinate system in body 0, where the x-axis is the slider axis (global) + // 2: 2D vector d = P * (x0 - x1), where P projects the vector onto a plane perpendicular to the slider axis + // 3-5: projection matrix Pr for the rotational part - // transform in local coordinates - const Matrix3r rot0T = q0.matrix().transpose(); - const Matrix3r rot1T = q1.matrix().transpose(); - - // connector in body 0 (local) - jointInfo.col(0) = rot0T * (position - x0); - // connector in body 1 (local) - jointInfo.col(1) = rot1T * (position - x1); - // connector in body 0 (global) - jointInfo.col(6) = position; - // connector in body 1 (global) - jointInfo.col(7) = position; // determine constraint coordinate system // with direction as x-axis - jointInfo.col(8) = direction; - jointInfo.col(8).normalize(); + Matrix3r R0; + R0.col(0) = direction; + R0.col(0).normalize(); Vector3r v(1.0, 0.0, 0.0); // check if vectors are parallel - if (fabs(v.dot(jointInfo.col(8))) > 0.99) + if (fabs(v.dot(R0.col(0))) > 0.99) v = Vector3r(0.0, 1.0, 0.0); - jointInfo.col(9) = jointInfo.col(8).cross(v); - jointInfo.col(10) = jointInfo.col(8).cross(jointInfo.col(9)); - jointInfo.col(9).normalize(); - jointInfo.col(10).normalize(); + R0.col(1) = R0.col(0).cross(v); + R0.col(2) = R0.col(0).cross(R0.col(1)); + R0.col(1).normalize(); + R0.col(2).normalize(); - // joint axis in body 1 (global) - jointInfo.col(11) = jointInfo.col(8); + Quaternionr qR0(R0); + jointInfo.col(1) = qR0.coeffs(); // coordinate system of body 0 (local) - jointInfo.block<3, 3>(0, 2) = rot0T * jointInfo.block<3, 3>(0, 8); + jointInfo.col(0) = (q0.conjugate() * qR0).coeffs(); - // joint axis in body 1 (local) - jointInfo.col(5) = rot1T * jointInfo.col(11); + const Eigen::Matrix< Real, 2, 3 > P = R0.block<3, 2>(0, 1).transpose(); + jointInfo.block<2, 1>(0, 2) = P * (x0 - x1); - // perpendicular vector on joint axis (normalized) in body 1 (global) - jointInfo.col(13) = jointInfo.col(9); + const Quaternionr q00 = (q0.conjugate() * qR0).conjugate(); + const Quaternionr q10 = (q1.conjugate() * qR0).conjugate(); - // perpendicular vector on joint axis(normalized) in body 1 (local) - jointInfo.col(12) = rot1T * jointInfo.col(13); + Eigen::Matrix Qq00, QHatq10; + computeMatrixQ(q00, Qq00); + computeMatrixQHat(q10, QHatq10); + Eigen::Matrix Pr = (QHatq10.transpose() * Qq00).block<3, 4>(1, 0); + jointInfo.block<4, 3>(0, 3) = Pr.transpose(); return true; } @@ -840,41 +1029,19 @@ bool PositionBasedRigidBodyDynamics::update_SliderJoint( const Quaternionr &q0, const Vector3r &x1, const Quaternionr &q1, - Eigen::Matrix &jointInfo + Eigen::Matrix &jointInfo ) { // jointInfo contains - // 0: connector in body 0 (local) - // 1: connector in body 1 (local) - // 2-4: coordinate system of body 0 (local) - // 5: joint axis in body 1 (local) - // 6: connector in body 0 (global) - // 7: connector in body 1 (global) - // 8-10:coordinate system of body 0 (global) - // 11: joint axis in body 1 (global) - // 12: perpendicular vector on joint axis (normalized) in body 1 (local) - // 13: perpendicular vector on joint axis (normalized) in body 1 (global) - - - // compute world space positions of connectors - const Matrix3r rot0 = q0.matrix(); - const Matrix3r rot1 = q1.matrix(); - jointInfo.col(6) = rot0 * jointInfo.col(0) + x0; - jointInfo.col(7) = rot1 * jointInfo.col(1) + x1; + // 0: coordinate system in body 0, where the x-axis is the slider axis (local) + // 1: coordinate system in body 0, where the x-axis is the slider axis (global) + // 2: 2D vector d = P * (x0 - x1), where P projects the vector onto a plane perpendicular to the slider axis + // 3-5: projection matrix Pr for the rotational part // transform constraint coordinate system of body 0 to world space - jointInfo.block<3, 3>(0, 8) = rot0 * jointInfo.block<3, 3>(0, 2); - // transform joint axis of body 1 to world space - jointInfo.col(11) = rot1 * jointInfo.col(5); - // transform perpendicular vector on joint axis of body 1 to world space - jointInfo.col(13) = rot1 * jointInfo.col(12); - - const Vector3r dir = jointInfo.col(8); - const Vector3r p = jointInfo.col(6); - const Vector3r s = jointInfo.col(7); - // move the joint point of body 0 to the closest point on the line to joint point 1 - jointInfo.col(6) = p + (dir * (((s - p).dot(dir)) / dir.squaredNorm())); - + Quaternionr qR0; + qR0.coeffs() = jointInfo.col(0); + jointInfo.col(1) = (q0 * qR0).coeffs(); return true; } @@ -888,175 +1055,95 @@ bool PositionBasedRigidBodyDynamics::solve_SliderJoint( const Vector3r &x1, const Matrix3r &inertiaInverseW1, const Quaternionr &q1, - const Eigen::Matrix &jointInfo, + const Eigen::Matrix &jointInfo, Vector3r &corr_x0, Quaternionr &corr_q0, Vector3r &corr_x1, Quaternionr &corr_q1) { // jointInfo contains - // 0: connector in body 0 (local) - // 1: connector in body 1 (local) - // 2-4: coordinate system of body 0 (local) - // 5: joint axis in body 1 (local) - // 6: connector in body 0 (global) - // 7: connector in body 1 (global) - // 8-10:coordinate system of body 0 (global) - // 11: joint axis in body 1 (global) - // 12: perpendicular vector on joint axis (normalized) in body 1 (local) - // 13: perpendicular vector on joint axis (normalized) in body 1 (global) - - const Vector3r &c0 = jointInfo.col(6); - const Vector3r &c1 = jointInfo.col(7); - const Vector3r &axis0 = jointInfo.col(8); - const Vector3r &axis1 = jointInfo.col(11); - const Vector3r axis = 0.5 * (axis0 + axis1); - const Vector3r u = axis0.cross(axis1); - const Vector3r &t1 = jointInfo.col(9); - const Vector3r &t2 = jointInfo.col(10); - const Vector3r &t3 = jointInfo.col(13); - const Vector3r r0 = c0 - x0; - const Vector3r r1 = c1 - x1; - Matrix3r r0_star, r1_star; - MathFunctions::crossProductMatrix(r0, r0_star); - MathFunctions::crossProductMatrix(r1, r1_star); + // 0: coordinate system in body 0, where the x-axis is the slider axis (local) + // 1: coordinate system in body 0, where the x-axis is the slider axis (global) + // 2: 2D vector d = P * (x0 - x1), where P projects the vector onto a plane perpendicular to the slider axis + // 3-5: projection matrix Pr for the rotational part - // projection - const Eigen::Matrix PT = jointInfo.block<3, 2>(0, 9); - const Eigen::Matrix P = PT.transpose(); + Eigen::Matrix< Real, 2, 3 > P; + Quaternionr qCoord; + qCoord.coeffs() = jointInfo.col(1); + const Matrix3r &R0 = qCoord.matrix(); + P.row(0) = R0.col(1).transpose(); + P.row(1) = R0.col(2).transpose(); + const Eigen::Matrix &Pr = jointInfo.block<4, 3>(0, 3).transpose(); - Eigen::Matrix b; - b.block<2, 1>(0, 0) = P * (c1 - c0); - b(2, 0) = t1.dot(u); - b(3, 0) = t2.dot(u); + const Vector2r &d = jointInfo.block<2, 1>(0, 2); - // determine correction angle (slider axis) - Real delta = 0.0; - Real c = t1.dot(t3); - c = std::min(1.0, c); - c = std::max(-1.0, c); - if ((t1.cross(t3)).dot(axis) > 0.0) - delta -= acos(c); - else - delta += acos(c); + // evaluate constraint function + Eigen::Matrix C; + C.block<2, 1>(0, 0) = P * (x0 - x1) - d; + const Quaternionr tmp = (q0.conjugate() * q1); + const Vector4r qVec(tmp.w(), tmp.x(), tmp.y(), tmp.z()); + C.block<3, 1>(2, 0) = Pr * qVec; - const Real pi = (Real)M_PI; - if (delta < -pi) - delta += 2.0 * pi; - if (delta > pi) - delta -= 2.0 * pi; - b(4, 0) = -delta; + Eigen::Matrix Gq1; + computeMatrixG(q1, Gq1); + Eigen::Matrix Qq0; + computeMatrixQ(q0, Qq0); + const Matrix3r t = -Pr * (Qq0.transpose() * Gq1); + // compute K = J M^-1 J^T Eigen::Matrix K; K.setZero(); if (invMass0 != 0.0) { // Jacobian for body 0 is // - // (P -P r0*) - // (0 t1^T) - // (0 t2^T) - // (0 axis^T) + // (P 0) + // (0 t) // - // where I_3 is the identity matrix and r0* is the cross product matrix of r0 + // where I_3 is the identity matrix and t = -Pr * (Qq0^T * Gq1) // // J M^-1 J^T = - // ( P (1/m I_3-r0 * J0^-1 * r0*) P^T P (-r0 * J0^-1 * t1) P (-r0 * J0^-1 * t2) P (-r0 * J0^-1 * axis) ) - // ( (-r0 * J0^-1 * t1)^T P^T t1^T * J0^-1 t1 t1^T * J0^-1 * t2 t1^T * J0^-1 * axis ) - // ( (-r0 * J0^-1 * t2)^T P^T t2^T * J0^-1 t1 t2^T * J0^-1 * t2 t2^T * J0^-1 axis ) - // ( (-r0 * J0^-1 * axis)^T P^T axis^T * J0^-1 t1 axis^T * J0^-1 t2 axis^T * J0^-1 axis ) + // ( P (1/m I_3) P^T 0 ) + // ( 0 t * J0^-1 t^T ) - Matrix3r K00; - computeMatrixK(c0, invMass0, x0, inertiaInverseW0, K00); - const Eigen::Matrix neg_P_r0_star_Jinv = -P * r0_star * inertiaInverseW0; - const Vector3r Jinv_axis = inertiaInverseW0 * axis; - const Vector3r Jinv_t1 = inertiaInverseW0 * t1; - const Vector3r Jinv_t2 = inertiaInverseW0 * t2; - - K.block<2, 2>(0, 0) = P * K00 * PT; - K.block<2, 1>(0, 2) = neg_P_r0_star_Jinv * t1; - K.block<2, 1>(0, 3) = neg_P_r0_star_Jinv * t2; - K.block<2, 1>(0, 4) = neg_P_r0_star_Jinv * axis; - K.block<1, 2>(2, 0) = K.block<2, 1>(0, 2).transpose(); - K.block<1, 2>(3, 0) = K.block<2, 1>(0, 3).transpose(); - K.block<1, 2>(4, 0) = K.block<2, 1>(0, 4).transpose(); - K(2, 2) = t1.transpose() * Jinv_t1; - K(2, 3) = t1.transpose() * Jinv_t2; - K(2, 4) = t1.transpose() * Jinv_axis; - K(3, 2) = K(2, 3); - K(4, 2) = K(2, 4); - K(3, 3) = t2.transpose() * Jinv_t2; - K(3, 4) = t2.transpose() * Jinv_axis; - K(4, 3) = K(3, 4); - K(4, 4) = axis.transpose() * Jinv_axis; + K.block<2, 2>(0, 0) = invMass0 * P * P.transpose(); + K.block<3, 3>(2, 2) = t * inertiaInverseW0 * t.transpose(); } if (invMass1 != 0.0) { // Jacobian for body 1 is // - // ( -P P r1* ) - // ( 0 -t1^T ) - // ( 0 -t2^T ) - // ( 0 axis^T) + // ( -P 0 ) + // ( 0 -t ) // - // where I_3 is the identity matrix and r1* is the cross product matrix of r1 + // where I_3 is the identity matrix and t = -Pr * (Qq0^T * Gq1) // // J M^-1 J^T = - // ( P (1/m I_3-r1 * J1^-1 * r1*) P^T P (-r1 * J1^-1 * t1) P (-r1 * J1^-1 * t2) P (-r1 * J1^-1 * axis) ) - // ( (-r1 * J1^-1 * t1)^T P^T t1^T * J1^-1 t1 t1^T * J1^-1 * t2 t1^T * J1^-1 * axis ) - // ( (-r1 * J1^-1 * t2)^T P^T t2^T * J1^-1 t1 t2^T * J1^-1 * t2 t2^T * J1^-1 axis ) - // ( (-r1 * J1^-1 * axis)^T P^T axis^T * J1^-1 t1 axis^T * J1^-1 t2 axis^T * J1^-1 axis ) + // ( P (1/m I_3) P^T 0 ) + // ( 0 t * J1^-1 t^T ) - Matrix3r K11; - computeMatrixK(c1, invMass1, x1, inertiaInverseW1, K11); - const Eigen::Matrix neg_P_r1_star_Jinv = -P * r1_star * inertiaInverseW1; - const Vector3r Jinv_axis = inertiaInverseW1 * axis; - const Vector3r Jinv_t1 = inertiaInverseW1 * t1; - const Vector3r Jinv_t2 = inertiaInverseW1 * t2; - - K.block<2, 2>(0, 0) += P * K11 * PT; - const Vector2r K_02 = neg_P_r1_star_Jinv * t1; - const Vector2r K_03 = neg_P_r1_star_Jinv * t2; - const Vector2r K_04 = neg_P_r1_star_Jinv * axis; - K.block<2, 1>(0, 2) += K_02; - K.block<2, 1>(0, 3) += K_03; - K.block<2, 1>(0, 4) += K_04; - K.block<1, 2>(2, 0) += K_02.transpose(); - K.block<1, 2>(3, 0) += K_03.transpose(); - K.block<1, 2>(4, 0) += K_04.transpose(); - K(2, 2) += t1.transpose() * Jinv_t1; - const Real K_23 = t1.transpose() * Jinv_t2; - K(2, 3) += K_23; - const Real K_24 = t1.transpose() * Jinv_axis; - K(2, 4) += K_24; - K(3, 2) += K_23; - K(3, 3) += t2.transpose() * Jinv_t2; - const Real K_34 = t2.transpose() * Jinv_axis; - K(3, 4) += K_34; - K(4, 2) += K_24; - K(4, 3) += K_34; - K(4, 4) += axis.transpose() * Jinv_axis; + K.block<2, 2>(0, 0) += invMass1 * P * P.transpose(); + K.block<3, 3>(2, 2) += t * inertiaInverseW1 * t.transpose(); } - const Eigen::Matrix Kinv = K.inverse(); - const Eigen::Matrix lambda = Kinv * b; - const Vector3r pt = PT * lambda.block<2, 1>(0, 0); + const Eigen::Matrix lambda = K.llt().solve(-C); - const Vector3r angMomentum = t1*lambda(2, 0) + t2*lambda(3, 0) + axis*lambda(4, 0); + const Vector3r pt = P.transpose() * lambda.block<2, 1>(0, 0); + const Vector3r amt = t.transpose() * lambda.block<3, 1>(2, 0); if (invMass0 != 0.0) { - corr_x0 = invMass0*pt; - const Vector3r ot = (inertiaInverseW0 * (r0.cross(pt) + angMomentum)); + corr_x0 = invMass0 * pt; + const Vector3r ot = inertiaInverseW0 * amt; const Quaternionr otQ(0.0, ot[0], ot[1], ot[2]); corr_q0.coeffs() = 0.5 *(otQ*q0).coeffs(); } if (invMass1 != 0.0) { - corr_x1 = -invMass1*pt; - const Vector3r ot = (inertiaInverseW1 * (r1.cross(-pt) - angMomentum)); + corr_x1 = -invMass1 * pt; + const Vector3r ot = -inertiaInverseW1 * amt; const Quaternionr otQ(0.0, ot[0], ot[1], ot[2]); corr_q1.coeffs() = 0.5 *(otQ*q1).coeffs(); } @@ -1071,65 +1158,49 @@ bool PositionBasedRigidBodyDynamics::init_TargetPositionMotorSliderJoint( const Quaternionr &q0, const Vector3r &x1, const Quaternionr &q1, - const Vector3r &position, const Vector3r &direction, - Eigen::Matrix &jointInfo + Eigen::Matrix &jointInfo ) { // jointInfo contains - // 0: connector in body 0 (local) - // 1: connector in body 1 (local) - // 2-4: coordinate system of body 0 (local) - // 5: joint axis in body 1 (local) - // 6: connector in body 0 (global) - // 7: connector in body 1 (global) - // 8-10:coordinate system of body 0 (global) - // 11: joint axis in body 1 (global) - // 12: perpendicular vector on joint axis (normalized) in body 1 (local) - // 13: perpendicular vector on joint axis (normalized) in body 1 (global) - - // transform in local coordinates - const Matrix3r rot0T = q0.matrix().transpose(); - const Matrix3r rot1T = q1.matrix().transpose(); - - // connector in body 0 (local) - jointInfo.col(0) = rot0T * (position - x0); - // connector in body 1 (local) - jointInfo.col(1) = rot1T * (position - x1); - // connector in body 0 (global) - jointInfo.col(6) = position; - // connector in body 1 (global) - jointInfo.col(7) = position; + // 0: slider axis in body 0 (local) + // 1: slider axis in body 0 (global) + // 2: distance vector d = (x0 - x1) + // 3-5: projection matrix Pr for the rotational part // determine constraint coordinate system // with direction as x-axis - jointInfo.col(8) = direction; - jointInfo.col(8).normalize(); + Matrix3r R0; + R0.col(0) = direction; + R0.col(0).normalize(); Vector3r v(1.0, 0.0, 0.0); // check if vectors are parallel - if (fabs(v.dot(jointInfo.col(8))) > 0.99) + if (fabs(v.dot(R0.col(0))) > 0.99) v = Vector3r(0.0, 1.0, 0.0); - jointInfo.col(9) = jointInfo.col(8).cross(v); - jointInfo.col(10) = jointInfo.col(8).cross(jointInfo.col(9)); - jointInfo.col(9).normalize(); - jointInfo.col(10).normalize(); + R0.col(1) = R0.col(0).cross(v); + R0.col(2) = R0.col(0).cross(R0.col(1)); + R0.col(1).normalize(); + R0.col(2).normalize(); - // joint axis in body 1 (global) - jointInfo.col(11) = jointInfo.col(8); + jointInfo.block<3, 1>(0, 1) = direction; - // coordinate system of body 0 (local) - jointInfo.block<3, 3>(0, 2) = rot0T * jointInfo.block<3, 3>(0, 8); + // slider axis in body 0 (local) + jointInfo.block<3, 1>(0, 0) = q0.matrix().transpose() * direction; - // joint axis in body 1 (local) - jointInfo.col(5) = rot1T * jointInfo.col(11); + const Eigen::Matrix< Real, 2, 3 > P = R0.block<3, 2>(0, 1).transpose(); + jointInfo.block<3, 1>(0, 2) = (x0 - x1); - // perpendicular vector on joint axis (normalized) in body 1 (global) - jointInfo.col(13) = jointInfo.col(9); + Quaternionr qR0(R0); + const Quaternionr q00 = (q0.conjugate() * qR0).conjugate(); + const Quaternionr q10 = (q1.conjugate() * qR0).conjugate(); - // perpendicular vector on joint axis(normalized) in body 1 (local) - jointInfo.col(12) = rot1T * jointInfo.col(13); + Eigen::Matrix Qq00, QHatq10; + computeMatrixQ(q00, Qq00); + computeMatrixQHat(q10, QHatq10); + Eigen::Matrix Pr = (QHatq10.transpose() * Qq00).block<3, 4>(1, 0); + jointInfo.block<4, 3>(0, 3) = Pr.transpose(); return true; } @@ -1140,35 +1211,17 @@ bool PositionBasedRigidBodyDynamics::update_TargetPositionMotorSliderJoint( const Quaternionr &q0, const Vector3r &x1, const Quaternionr &q1, - Eigen::Matrix &jointInfo + Eigen::Matrix &jointInfo ) { // jointInfo contains - // 0: connector in body 0 (local) - // 1: connector in body 1 (local) - // 2-4: coordinate system of body 0 (local) - // 5: joint axis in body 1 (local) - // 6: connector in body 0 (global) - // 7: connector in body 1 (global) - // 8-10:coordinate system of body 0 (global) - // 11: joint axis in body 1 (global) - // 12: perpendicular vector on joint axis (normalized) in body 1 (local) - // 13: perpendicular vector on joint axis (normalized) in body 1 (global) - - - // compute world space positions of connectors - const Matrix3r rot0 = q0.matrix(); - const Matrix3r rot1 = q1.matrix(); - jointInfo.col(6) = rot0 * jointInfo.col(0) + x0; - jointInfo.col(7) = rot1 * jointInfo.col(1) + x1; - - // transform constraint coordinate system of body 0 to world space - jointInfo.block<3, 3>(0, 8) = rot0 * jointInfo.block<3, 3>(0, 2); - // transform joint axis of body 1 to world space - jointInfo.col(11) = rot1 * jointInfo.col(5); - // transform perpendicular vector on joint axis of body 1 to world space - jointInfo.col(13) = rot1 * jointInfo.col(12); + // 0: slider axis in body 0 (local) + // 1: slider axis in body 0 (global) + // 2: distance vector d = (x0 - x1) + // 3-5: projection matrix Pr for the rotational part + // transform slider axis in body 0 to world space + jointInfo.block<3, 1>(0, 1) = q0.matrix() * jointInfo.block<3, 1>(0, 0); return true; } @@ -1183,65 +1236,36 @@ bool PositionBasedRigidBodyDynamics::solve_TargetPositionMotorSliderJoint( const Matrix3r &inertiaInverseW1, const Quaternionr &q1, const Real targetPosition, - const Eigen::Matrix &jointInfo, + const Eigen::Matrix &jointInfo, Vector3r &corr_x0, Quaternionr &corr_q0, Vector3r &corr_x1, Quaternionr &corr_q1) { // jointInfo contains - // 0: connector in body 0 (local) - // 1: connector in body 1 (local) - // 2-4: coordinate system of body 0 (local) - // 5: joint axis in body 1 (local) - // 6: connector in body 0 (global) - // 7: connector in body 1 (global) - // 8-10:coordinate system of body 0 (global) - // 11: joint axis in body 1 (global) - // 12: perpendicular vector on joint axis (normalized) in body 1 (local) - // 13: perpendicular vector on joint axis (normalized) in body 1 (global) - - const Vector3r &c0 = jointInfo.col(6); - const Vector3r &c1 = jointInfo.col(7); - const Vector3r &axis0 = jointInfo.col(8); - const Vector3r &axis1 = jointInfo.col(11); - const Vector3r axis = 0.5 * (axis0 + axis1); - const Vector3r u = axis0.cross(axis1); - const Vector3r &t1 = jointInfo.col(9); - const Vector3r &t2 = jointInfo.col(10); - const Vector3r &t3 = jointInfo.col(13); - const Vector3r r0 = c0 - x0; - const Vector3r r1 = c1 - x1; - Matrix3r r0_star, r1_star; - MathFunctions::crossProductMatrix(r0, r0_star); - MathFunctions::crossProductMatrix(r1, r1_star); + // 0: slider axis in body 0 (local) + // 1: slider axis in body 0 (global) + // 2: distance vector d = (x0 - x1) + // 3-5: projection matrix Pr for the rotational part - // projection - const Eigen::Matrix PT = jointInfo.block<3, 3>(0, 8); - const Eigen::Matrix P = PT.transpose(); - - Eigen::Matrix b; - b.block<3, 1>(0, 0) = P * (c1 - c0); - b(0, 0) = -targetPosition + b(0, 0); - b(3, 0) = t1.dot(u); - b(4, 0) = t2.dot(u); - - // determine correction angle (slider axis) - Real delta = 0.0; - Real c = t1.dot(t3); - c = std::min(1.0, c); - c = std::max(-1.0, c); - if ((t1.cross(t3)).dot(axis) > 0.0) - delta -= acos(c); - else - delta += acos(c); + const Vector3r &axis = jointInfo.block<3, 1>(0, 1); + + const Eigen::Matrix &Pr = jointInfo.block<4, 3>(0, 3).transpose(); - const Real pi = (Real)M_PI; - if (delta < -pi) - delta += 2.0 * pi; - if (delta > pi) - delta -= 2.0 * pi; + const Vector3r &d = jointInfo.block<3, 1>(0, 2); - b(5, 0) = -delta; + // evaluate constraint function + Eigen::Matrix C; + C.block<3, 1>(0, 0) = (x0 - x1) - d; + C.block<3, 1>(0, 0) += targetPosition * axis; + const Quaternionr tmp = (q0.conjugate() * q1); + const Vector4r qVec(tmp.w(), tmp.x(), tmp.y(), tmp.z()); + C.block<3, 1>(3, 0) = Pr * qVec; + Eigen::Matrix Gq1; + computeMatrixG(q1, Gq1); + Eigen::Matrix Qq0; + computeMatrixQ(q0, Qq0); + + const Matrix3r t = -Pr * (Qq0.transpose() * Gq1); Eigen::Matrix K; K.setZero(); @@ -1249,100 +1273,44 @@ bool PositionBasedRigidBodyDynamics::solve_TargetPositionMotorSliderJoint( { // Jacobian for body 0 is // - // (P -P r0*) - // (0 t1^T) - // (0 t2^T) - // (0 axis^T) + // (I 0) + // (0 t) // - // where I_3 is the identity matrix and r0* is the cross product matrix of r0 + // where I_3 is the identity matrix and t = -Pr * (Qq0^T * Gq1) // // J M^-1 J^T = - // ( P (1/m I_3-r0 * J0^-1 * r0*) P^T P (-r0 * J0^-1 * t1) P (-r0 * J0^-1 * t2) P (-r0 * J0^-1 * axis) ) - // ( (-r0 * J0^-1 * t1)^T P^T t1^T * J0^-1 t1 t1^T * J0^-1 * t2 t1^T * J0^-1 * axis ) - // ( (-r0 * J0^-1 * t2)^T P^T t2^T * J0^-1 t1 t2^T * J0^-1 * t2 t2^T * J0^-1 axis ) - // ( (-r0 * J0^-1 * axis)^T P^T axis^T * J0^-1 t1 axis^T * J0^-1 t2 axis^T * J0^-1 axis ) + // ( (1/m I_3) I 0 ) + // ( 0 t * J0^-1 t^T ) - Matrix3r K00; - computeMatrixK(c0, invMass0, x0, inertiaInverseW0, K00); - const Matrix3r neg_P_r0_star_Jinv = -P * r0_star * inertiaInverseW0; - const Vector3r Jinv_axis = inertiaInverseW0 * axis; - const Vector3r Jinv_t1 = inertiaInverseW0 * t1; - const Vector3r Jinv_t2 = inertiaInverseW0 * t2; - - K.block<3, 3>(0, 0) = P * K00 * PT; - K.block<3, 1>(0, 3) = neg_P_r0_star_Jinv * t1; - K.block<3, 1>(0, 4) = neg_P_r0_star_Jinv * t2; - K.block<3, 1>(0, 5) = neg_P_r0_star_Jinv * axis; - K.block<1, 3>(3, 0) = K.block<3, 1>(0, 3).transpose(); - K.block<1, 3>(4, 0) = K.block<3, 1>(0, 4).transpose(); - K.block<1, 3>(5, 0) = K.block<3, 1>(0, 5).transpose(); - K(3, 3) = t1.transpose() * Jinv_t1; - K(3, 4) = t1.transpose() * Jinv_t2; - K(3, 5) = t1.transpose() * Jinv_axis; - K(4, 3) = K(3, 4); - K(5, 3) = K(3, 5); - K(4, 4) = t2.transpose() * Jinv_t2; - K(4, 5) = t2.transpose() * Jinv_axis; - K(5, 4) = K(4, 5); - K(5, 5) = axis.transpose() * Jinv_axis; + K.block<3, 3>(0, 0) = invMass0 * Matrix3r::Identity(); + K.block<3, 3>(3, 3) = t * inertiaInverseW0 * t.transpose(); } if (invMass1 != 0.0) { // Jacobian for body 1 is // - // ( -P P r1* ) - // ( 0 -t1^T ) - // ( 0 -t2^T ) - // ( 0 axis^T) + // ( -I 0 ) + // ( 0 -t ) // - // where I_3 is the identity matrix and r1* is the cross product matrix of r1 + // where I_3 is the identity matrix and t = -Pr * (Qq0^T * Gq1) // // J M^-1 J^T = - // ( P (1/m I_3-r1 * J1^-1 * r1*) P^T P (-r1 * J1^-1 * t1) P (-r1 * J1^-1 * t2) P (-r1 * J1^-1 * axis) ) - // ( (-r1 * J1^-1 * t1)^T P^T t1^T * J1^-1 t1 t1^T * J1^-1 * t2 t1^T * J1^-1 * axis ) - // ( (-r1 * J1^-1 * t2)^T P^T t2^T * J1^-1 t1 t2^T * J1^-1 * t2 t2^T * J1^-1 axis ) - // ( (-r1 * J1^-1 * axis)^T P^T axis^T * J1^-1 t1 axis^T * J1^-1 t2 axis^T * J1^-1 axis ) + // ( (1/m I_3) I 0 ) + // ( 0 t * J1^-1 t^T ) - Matrix3r K11; - computeMatrixK(c1, invMass1, x1, inertiaInverseW1, K11); - const Matrix3r neg_P_r1_star_Jinv = -P * r1_star * inertiaInverseW1; - const Vector3r Jinv_axis = inertiaInverseW1 * axis; - const Vector3r Jinv_t1 = inertiaInverseW1 * t1; - const Vector3r Jinv_t2 = inertiaInverseW1 * t2; - - K.block<3, 3>(0, 0) += P * K11 * PT; - const Vector3r K_03 = neg_P_r1_star_Jinv * t1; - const Vector3r K_04 = neg_P_r1_star_Jinv * t2; - const Vector3r K_05 = neg_P_r1_star_Jinv * axis; - K.block<3, 1>(0, 3) += K_03; - K.block<3, 1>(0, 4) += K_04; - K.block<3, 1>(0, 5) += K_05; - K.block<1, 3>(3, 0) += K_03.transpose(); - K.block<1, 3>(4, 0) += K_04.transpose(); - K.block<1, 3>(5, 0) += K_05.transpose(); - K(3, 3) += t1.transpose() * Jinv_t1; - const Real K_34 = t1.transpose() * Jinv_t2; - K(3, 4) += K_34; - const Real K_35 = t1.transpose() * Jinv_axis; - K(3, 5) += K_35; - K(4, 3) += K_34; - K(4, 4) += t2.transpose() * Jinv_t2; - const Real K_45 = t2.transpose() * Jinv_axis; - K(4, 5) += K_45; - K(5, 3) += K_35; - K(5, 4) += K_45; - K(5, 5) += axis.transpose() * Jinv_axis; + K.block<3, 3>(0, 0) += invMass1 * Matrix3r::Identity(); + K.block<3, 3>(3, 3) += t * inertiaInverseW1 * t.transpose(); } - const Eigen::Matrix Kinv = K.inverse(); - const Eigen::Matrix lambda = Kinv * b; - const Vector3r pt = PT * lambda.block<3, 1>(0, 0); - const Vector3r angMomentum = t1*lambda(3, 0) + t2*lambda(4, 0) + axis*lambda(5, 0); + const Eigen::Matrix lambda = K.llt().solve(-C); + + const Vector3r pt = lambda.block<3, 1>(0, 0); + const Vector3r amt = t.transpose() * lambda.block<3, 1>(3, 0); if (invMass0 != 0.0) { corr_x0 = invMass0*pt; - const Vector3r ot = (inertiaInverseW0 * (r0.cross(pt) + angMomentum)); + const Vector3r ot = inertiaInverseW0 * amt; const Quaternionr otQ(0.0, ot[0], ot[1], ot[2]); corr_q0.coeffs() = 0.5 *(otQ*q0).coeffs(); } @@ -1350,7 +1318,7 @@ bool PositionBasedRigidBodyDynamics::solve_TargetPositionMotorSliderJoint( if (invMass1 != 0.0) { corr_x1 = -invMass1*pt; - const Vector3r ot = (inertiaInverseW1 * (r1.cross(-pt) - angMomentum)); + const Vector3r ot = -inertiaInverseW1 * amt; const Quaternionr otQ(0.0, ot[0], ot[1], ot[2]); corr_q1.coeffs() = 0.5 *(otQ*q1).coeffs(); } @@ -1365,12 +1333,17 @@ bool PositionBasedRigidBodyDynamics::init_TargetVelocityMotorSliderJoint( const Quaternionr &q0, const Vector3r &x1, const Quaternionr &q1, - const Vector3r &position, const Vector3r &direction, - Eigen::Matrix &jointInfo + Eigen::Matrix &jointInfo ) { - return init_TargetPositionMotorSliderJoint(x0, q0, x1, q1, position, direction, jointInfo); + // jointInfo contains + // 0: coordinate system in body 0, where the x-axis is the slider axis (local) + // 1: coordinate system in body 0, where the x-axis is the slider axis (global) + // 2: 2D vector d = P * (x0 - x1), where P projects the vector onto a plane perpendicular to the slider axis + // 3-5: projection matrix Pr for the rotational part + + return init_SliderJoint(x0, q0, x1, q1, direction, jointInfo); } // ---------------------------------------------------------------------------------------------- @@ -1379,10 +1352,16 @@ bool PositionBasedRigidBodyDynamics::update_TargetVelocityMotorSliderJoint( const Quaternionr &q0, const Vector3r &x1, const Quaternionr &q1, - Eigen::Matrix &jointInfo + Eigen::Matrix &jointInfo ) { - return update_TargetPositionMotorSliderJoint(x0, q0, x1, q1, jointInfo); + // jointInfo contains + // 0: coordinate system in body 0, where the x-axis is the slider axis (local) + // 1: coordinate system in body 0, where the x-axis is the slider axis (global) + // 2: 2D vector d = P * (x0 - x1), where P projects the vector onto a plane perpendicular to the slider axis + // 3-5: projection matrix Pr for the rotational part + + return update_SliderJoint(x0, q0, x1, q1, jointInfo); } // ---------------------------------------------------------------------------------------------- @@ -1395,13 +1374,13 @@ bool PositionBasedRigidBodyDynamics::solve_TargetVelocityMotorSliderJoint( const Vector3r &x1, const Matrix3r &inertiaInverseW1, const Quaternionr &q1, - const Eigen::Matrix &jointInfo, + const Eigen::Matrix &jointInfo, Vector3r &corr_x0, Quaternionr &corr_q0, Vector3r &corr_x1, Quaternionr &corr_q1) { - return solve_SliderJoint(invMass0, x0, inertiaInverseW0, q0, - invMass1, x1, inertiaInverseW1, q1, - jointInfo, corr_x0, corr_q0, corr_x1, corr_q1); + return solve_SliderJoint(invMass0, x0, inertiaInverseW0, q0, + invMass1, x1, inertiaInverseW1, q1, + jointInfo, corr_x0, corr_q0, corr_x1, corr_q1); } @@ -1411,46 +1390,46 @@ bool PositionBasedRigidBodyDynamics::velocitySolve_TargetVelocityMotorSliderJoin const Vector3r &x0, const Vector3r &v0, const Matrix3r &inertiaInverseW0, + const Quaternionr &q0, const Vector3r &omega0, const Real invMass1, const Vector3r &x1, const Vector3r &v1, const Matrix3r &inertiaInverseW1, + const Quaternionr &q1, const Vector3r &omega1, - const Real targetAngularVelocity, - const Eigen::Matrix &jointInfo, + const Real targetVelocity, + const Eigen::Matrix &jointInfo, Vector3r &corr_v0, Vector3r &corr_omega0, Vector3r &corr_v1, Vector3r &corr_omega1) { // jointInfo contains - // 0: connector in body 0 (local) - // 1: connector in body 1 (local) - // 2-4: coordinate system of body 0 (local) - // 5: joint axis in body 1 (local) - // 6: connector in body 0 (global) - // 7: connector in body 1 (global) - // 8-10:coordinate system of body 0 (global) - // 11: joint axis in body 1 (global) - // 12: perpendicular vector on joint axis (normalized) in body 1 (local) - // 13: perpendicular vector on joint axis (normalized) in body 1 (global) - - const Vector3r &c0 = jointInfo.col(6); - const Vector3r &c1 = jointInfo.col(7); - const Vector3r r0 = c0 - x0; - const Vector3r r1 = c1 - x1; - Matrix3r r0_star, r1_star; - MathFunctions::crossProductMatrix(r0, r0_star); - MathFunctions::crossProductMatrix(r1, r1_star); - Vector3r deltaOmega = omega1 - omega0; + // 0: coordinate system in body 0, where the x-axis is the slider axis (local) + // 1: coordinate system in body 0, where the x-axis is the slider axis (global) + // 2: 2D vector d = P * (x0 - x1), where P projects the vector onto a plane perpendicular to the slider axis + // 3-5: projection matrix Pr for the rotational part - // projection - const Eigen::Matrix PT = jointInfo.block<3, 3>(0, 8); - const Eigen::Matrix P = PT.transpose(); + Eigen::Matrix C; + Quaternionr qCoord; + qCoord.coeffs() = jointInfo.col(1); + const Matrix3r &R0 = qCoord.matrix(); + + const Vector3r &axis0 = R0.col(0); + + // evaluate constraint function + Vector3r deltaOmega = omega0 - omega1; + C.block<3, 1>(0, 0) = (v0 - v1) + targetVelocity * axis0; + C.block<3, 1>(3, 0) = deltaOmega; - Eigen::Matrix b; - b.block<3, 1>(0, 0) = P * (v1 - v0); - b(0, 0) = -targetAngularVelocity + b(0, 0); - b.block<3, 1>(3, 0) = deltaOmega; + // compute K= J M^1 J^T + const Eigen::Matrix &Pr = jointInfo.block<4, 3>(0, 3).transpose(); + + Eigen::Matrix Gq1; + computeMatrixG(q1, Gq1); + Eigen::Matrix Qq0; + computeMatrixQ(q0, Qq0); + + const Matrix3r t = -Pr * (Qq0.transpose() * Gq1); Eigen::Matrix K; K.setZero(); @@ -1458,64 +1437,50 @@ bool PositionBasedRigidBodyDynamics::velocitySolve_TargetVelocityMotorSliderJoin { // Jacobian for body 0 is // - // (P -P r0*) - // (0 I_3) + // (I 0) + // (0 t) // - // where I_3 is the identity matrix and r0* is the cross product matrix of r0 + // where I_3 is the identity matrix and t = -Pr * (Qq0^T * Gq1) // // J M^-1 J^T = - // ( P (1/m I_3-r0 * J0^-1 * r0*) P^T P (-r0 * J0^-1) ) - // ( (-r0 * J0^-1)^T P^T J0^-1 ) + // ( (1/m I_3) I 0 ) + // ( 0 t * J0^-1 t^T ) - Matrix3r K00; - computeMatrixK(c0, invMass0, x0, inertiaInverseW0, K00); - const Matrix3r neg_P_r0_star_Jinv = -P * r0_star * inertiaInverseW0; - K.block<3, 3>(0, 0) = P * K00 * PT; - K.block<3, 3>(0, 3) = neg_P_r0_star_Jinv; - K.block<3, 3>(3, 0) = K.block<3, 3>(0, 3).transpose(); - K.block<3, 3>(3, 3) = inertiaInverseW0; + K.block<3, 3>(0, 0) = invMass0 * Matrix3r::Identity(); + K.block<3, 3>(3, 3) = t * inertiaInverseW0 * t.transpose(); } if (invMass1 != 0.0) { // Jacobian for body 1 is // - // ( -P P r1* ) - // ( 0 -t1^T ) - // ( 0 -t2^T ) - // ( 0 axis^T) + // ( -I 0 ) + // ( 0 -t ) // - // where I_3 is the identity matrix and r1* is the cross product matrix of r1 + // where I_3 is the identity matrix and t = -Pr * (Qq0^T * Gq1) // // J M^-1 J^T = - // ( P (1/m I_3-r1 * J1^-1 * r1*) P^T P (-r1 * J1^-1) ) - // ( (-r1 * J1^-1)^T P^T J1^-1 ) + // ( (1/m I_3) I 0 ) + // ( 0 t * J1^-1 t^T ) - Matrix3r K11; - computeMatrixK(c1, invMass1, x1, inertiaInverseW1, K11); - const Matrix3r neg_P_r1_star_Jinv = -P * r1_star * inertiaInverseW1; - - K.block<3, 3>(0, 0) += P * K11 * PT; - const Matrix3r K_03 = neg_P_r1_star_Jinv; - K.block<3, 3>(0, 3) += K_03; - K.block<3, 3>(3, 0) += K_03.transpose(); - K.block<3, 3>(3, 3) += inertiaInverseW1; + K.block<3, 3>(0, 0) += invMass1 * Matrix3r::Identity(); + K.block<3, 3>(3, 3) += t * inertiaInverseW1 * t.transpose(); } - const Eigen::Matrix Kinv = K.inverse(); - const Eigen::Matrix lambda = Kinv * b; - const Vector3r p = PT * lambda.block<3, 1>(0, 0); + const Eigen::Matrix lambda = K.llt().solve(-C); + + const Vector3r p = lambda.block<3, 1>(0, 0); const Vector3r angMomentum = lambda.block<3, 1>(3, 0); if (invMass0 != 0.0) { corr_v0 = invMass0*p; - corr_omega0 = (inertiaInverseW0 * (r0.cross(p) + angMomentum)); + corr_omega0 = inertiaInverseW0 * angMomentum; } if (invMass1 != 0.0) { corr_v1 = -invMass1*p; - corr_omega1 = (inertiaInverseW1 * (r1.cross(-p) - angMomentum)); + corr_omega1 = -inertiaInverseW1 * angMomentum; } return true; @@ -1530,63 +1495,56 @@ bool PositionBasedRigidBodyDynamics::init_TargetAngleMotorHingeJoint( const Quaternionr &q1, const Vector3r &position, const Vector3r &direction, - Eigen::Matrix &jointInfo + Eigen::Matrix &jointInfo ) { // jointInfo contains - // 0: connector in body 0 (local) - // 1: connector in body 1 (local) - // 2-4: coordinate system of body 0 (local) - // 5: joint axis in body 1 (local) - // 6: connector in body 0 (global) - // 7: connector in body 1 (global) - // 8-10:coordinate system of body 0 (global) - // 11: joint axis in body 1 (global) - // 12: perpendicular vector on joint axis (normalized) in body 1 (local) - // 13: perpendicular vector on joint axis (normalized) in body 1 (global) + // 0-2: projection matrix Pr for the rotational part + // 3: connector in body 0 (local) + // 4: connector in body 1 (local) + // 5: connector in body 0 (global) + // 6: connector in body 1 (global) + // 7: hinge axis in body 0 (local) used for rendering // transform in local coordinates const Matrix3r rot0T = q0.matrix().transpose(); const Matrix3r rot1T = q1.matrix().transpose(); // connector in body 0 (local) - jointInfo.col(0) = rot0T * (position - x0); + jointInfo.block<3, 1>(0, 3) = rot0T * (position - x0); // connector in body 1 (local) - jointInfo.col(1) = rot1T * (position - x1); + jointInfo.block<3, 1>(0, 4) = rot1T * (position - x1); // connector in body 0 (global) - jointInfo.col(6) = position; + jointInfo.block<3, 1>(0, 5) = position; // connector in body 1 (global) - jointInfo.col(7) = position; + jointInfo.block<3, 1>(0, 6) = position; + jointInfo.block<3, 1>(0, 7) = rot0T * direction; // determine constraint coordinate system // with direction as x-axis - jointInfo.col(8) = direction; - jointInfo.col(8).normalize(); + Matrix3r R0; + R0.col(0) = direction; + R0.col(0).normalize(); Vector3r v(1.0, 0.0, 0.0); // check if vectors are parallel - if (fabs(v.dot(jointInfo.col(8))) > 0.99) + if (fabs(v.dot(R0.col(0))) > 0.99) v = Vector3r(0.0, 1.0, 0.0); - jointInfo.col(9) = jointInfo.col(8).cross(v); - jointInfo.col(10) = jointInfo.col(8).cross(jointInfo.col(9)); - jointInfo.col(9).normalize(); - jointInfo.col(10).normalize(); - - // joint axis in body 1 (global) - jointInfo.col(11) = jointInfo.col(8); - - // coordinate system of body 0 (local) - jointInfo.block<3, 3>(0, 2) = rot0T * jointInfo.block<3, 3>(0, 8); - - // joint axis in body 1 (local) - jointInfo.col(5) = rot1T * jointInfo.col(11); + R0.col(1) = R0.col(0).cross(v); + R0.col(2) = R0.col(0).cross(R0.col(1)); + R0.col(1).normalize(); + R0.col(2).normalize(); - // perpendicular vector on joint axis (normalized) in body 1 (global) - jointInfo.col(13) = jointInfo.col(9); + Quaternionr qR0(R0); + const Quaternionr q00 = (q0.conjugate() * qR0).conjugate(); + const Quaternionr q10 = (q1.conjugate() * qR0).conjugate(); - // perpendicular vector on joint axis(normalized) in body 1 (local) - jointInfo.col(12) = rot1T * jointInfo.col(13); + Eigen::Matrix Qq00, QHatq10; + computeMatrixQ(q00, Qq00); + computeMatrixQHat(q10, QHatq10); + Eigen::Matrix Pr = (QHatq10.transpose() * Qq00).block<3, 4>(1, 0); + jointInfo.block<4, 3>(0, 0) = Pr.transpose(); return true; } @@ -1597,34 +1555,22 @@ bool PositionBasedRigidBodyDynamics::update_TargetAngleMotorHingeJoint( const Quaternionr &q0, const Vector3r &x1, const Quaternionr &q1, - Eigen::Matrix &jointInfo + Eigen::Matrix &jointInfo ) { // jointInfo contains - // 0: connector in body 0 (local) - // 1: connector in body 1 (local) - // 2-4: coordinate system of body 0 (local) - // 5: joint axis in body 1 (local) - // 6: connector in body 0 (global) - // 7: connector in body 1 (global) - // 8-10:coordinate system of body 0 (global) - // 11: joint axis in body 1 (global) - // 12: perpendicular vector on joint axis (normalized) in body 1 (local) - // 13: perpendicular vector on joint axis (normalized) in body 1 (global) - + // 0-2: projection matrix Pr for the rotational part + // 3: connector in body 0 (local) + // 4: connector in body 1 (local) + // 5: connector in body 0 (global) + // 6: connector in body 1 (global) + // 7: hinge axis in body 0 (local) used for rendering // compute world space positions of connectors const Matrix3r rot0 = q0.matrix(); const Matrix3r rot1 = q1.matrix(); - jointInfo.col(6) = rot0 * jointInfo.col(0) + x0; - jointInfo.col(7) = rot1 * jointInfo.col(1) + x1; - - // transform constraint coordinate system of body 0 to world space - jointInfo.block<3, 3>(0, 8) = rot0 * jointInfo.block<3, 3>(0, 2); - // transform joint axis of body 1 to world space - jointInfo.col(11) = rot1 * jointInfo.col(5); - // transform perpendicular vector on joint axis of body 1 to world space - jointInfo.col(13) = rot1 * jointInfo.col(12); + jointInfo.block<3, 1>(0, 5) = rot0 * jointInfo.block<3, 1>(0, 3) + x0; + jointInfo.block<3, 1>(0, 6) = rot1 * jointInfo.block<3, 1>(0, 4) + x1; return true; } @@ -1640,60 +1586,46 @@ bool PositionBasedRigidBodyDynamics::solve_TargetAngleMotorHingeJoint( const Matrix3r &inertiaInverseW1, const Quaternionr &q1, const Real targetAngle, - const Eigen::Matrix &jointInfo, + const Eigen::Matrix &jointInfo, Vector3r &corr_x0, Quaternionr &corr_q0, Vector3r &corr_x1, Quaternionr &corr_q1) { // jointInfo contains - // 0: connector in body 0 (local) - // 1: connector in body 1 (local) - // 2-4: coordinate system of body 0 (local) - // 5: joint axis in body 1 (local) - // 6: connector in body 0 (global) - // 7: connector in body 1 (global) - // 8-10:coordinate system of body 0 (global) - // 11: joint axis in body 1 (global) - // 12: perpendicular vector on joint axis (normalized) in body 1 (local) - // 13: perpendicular vector on joint axis (normalized) in body 1 (global) - - const Vector3r &c0 = jointInfo.col(6); - const Vector3r &c1 = jointInfo.col(7); - const Vector3r &axis0 = jointInfo.col(8); - const Vector3r &axis1 = jointInfo.col(11); - const Vector3r axis = 0.5 * (axis0 + axis1); - const Vector3r u = axis0.cross(axis1); - const Vector3r &t1 = jointInfo.col(9); - const Vector3r &t2 = jointInfo.col(10); - const Vector3r &t3 = jointInfo.col(13); + // 0-2: projection matrix Pr for the rotational part + // 3: connector in body 0 (local) + // 4: connector in body 1 (local) + // 5: connector in body 0 (global) + // 6: connector in body 1 (global) + // 7: hinge axis in body 0 (local) used for rendering + const Vector3r &c0 = jointInfo.block<3, 1>(0, 5); + const Vector3r &c1 = jointInfo.block<3, 1>(0, 6); + + const Eigen::Matrix &Pr = jointInfo.block<4, 3>(0, 0).transpose(); + + // evaluate constraint function + Eigen::Matrix C; + C.block<3, 1>(0, 0) = (c0 - c1); + + const Quaternionr tmp = (q0.conjugate() * q1); + const Vector4r qVec(tmp.w(), tmp.x(), tmp.y(), tmp.z()); + C.block<3, 1>(3, 0) = Pr * qVec; + C(3, 0) -= sin(static_cast(0.5)*targetAngle); + + const Vector3r r0 = c0 - x0; const Vector3r r1 = c1 - x1; Matrix3r r0_star, r1_star; MathFunctions::crossProductMatrix(r0, r0_star); MathFunctions::crossProductMatrix(r1, r1_star); - Eigen::Matrix b; - b.block<3, 1>(0, 0) = c1 - c0; - b(3, 0) = t1.dot(u); - b(4, 0) = t2.dot(u); - - // determine correction angle - Real delta = targetAngle; - Real c = t1.dot(t3); - c = std::min(1.0, c); - c = std::max(-1.0, c); - if ((t1.cross(t3)).dot(axis) > 0.0) - delta -= acos(c); - else - delta += acos(c); - - const Real pi = (Real)M_PI; - if (delta < -pi) - delta += 2.0 * pi; - if (delta > pi) - delta -= 2.0 * pi; - - b(5, 0) = -delta; + Eigen::Matrix Gq1; + computeMatrixG(q1, Gq1); + Eigen::Matrix Qq0; + computeMatrixQ(q0, Qq0); + + const Matrix3r t = -Pr * (Qq0.transpose() * Gq1); + // compute K = J M^-1 J^T Eigen::Matrix K; K.setZero(); if (invMass0 != 0.0) @@ -1701,112 +1633,75 @@ bool PositionBasedRigidBodyDynamics::solve_TargetAngleMotorHingeJoint( // Jacobian for body 0 is // // (I_3 -r0*) - // (0 t1^T) - // (0 t2^T) - // (0 axis^T) + // (0 t) // - // where I_3 is the identity matrix and r0* is the cross product matrix of r0 + // where I_3 is the identity matrix, r0* is the cross product matrix of r0 and + // t = -Pr * (Qq0^T * Gq1) // // J M^-1 J^T = - // ( 1/m I_3-r0 * J0^-1 * r0* -r0 * J0^-1 * t1 -r0 * J0^-1 * t2 -r0 * J0^-1 * axis) - // ( (-r0 * J0^-1 * t1)^T t1^T * J0^-1 t1 t1^T * J0^-1 * t2 t1^T * J0^-1 * axis) - // ( (-r0 * J0^-1 * t2)^T t2^T * J0^-1 t1 t2^T * J0^-1 * t2 t2^T * J0^-1 axis) - // ( (-r0 * J0^-1 * axis)^T axis^T * J0^-1 t1 axis^T * J0^-1 t2 axis^T * J0^-1 axis) + // ( 1/m I_3-r0 * J0^-1 * r0* -r0 * J0^-1 * t^T ) + // ( (-r0 * J0^-1 * t^T)^T t * J0^-1 * t^T ) Matrix3r K00; computeMatrixK(c0, invMass0, x0, inertiaInverseW0, K00); - const Matrix3r neg_P_r0_star_Jinv = -r0_star * inertiaInverseW0; - const Vector3r Jinv_axis = inertiaInverseW0 * axis; - const Vector3r Jinv_t1 = inertiaInverseW0 * t1; - const Vector3r Jinv_t2 = inertiaInverseW0 * t2; K.block<3, 3>(0, 0) = K00; - K.block<3, 1>(0, 3) = neg_P_r0_star_Jinv * t1; - K.block<3, 1>(0, 4) = neg_P_r0_star_Jinv * t2; - K.block<3, 1>(0, 5) = neg_P_r0_star_Jinv * axis; - K.block<1, 3>(3, 0) = K.block<3, 1>(0, 3).transpose(); - K.block<1, 3>(4, 0) = K.block<3, 1>(0, 4).transpose(); - K.block<1, 3>(5, 0) = K.block<3, 1>(0, 5).transpose(); - K(3, 3) = t1.transpose() * Jinv_t1; - K(3, 4) = t1.transpose() * Jinv_t2; - K(3, 5) = t1.transpose() * Jinv_axis; - K(4, 3) = K(3, 4); - K(5, 3) = K(3, 5); - K(4, 4) = t2.transpose() * Jinv_t2; - K(4, 5) = t2.transpose() * Jinv_axis; - K(5, 4) = K(4, 5); - K(5, 5) = axis.transpose() * Jinv_axis; + K.block<3, 3>(0, 3) = -r0_star * inertiaInverseW0 * t.transpose(); + K.block<3, 3>(3, 0) = K.block<3, 3>(0, 3).transpose(); + K.block<3, 3>(3, 3) = t * inertiaInverseW0 * t.transpose(); } if (invMass1 != 0.0) { // Jacobian for body 1 is // - // ( -I_3 r1* ) - // ( 0 -t1^T ) - // ( 0 -t2^T ) - // ( 0 axis^T) + // (-I_3 r1*) + // (0 -t) // - // where I_3 is the identity matrix and r1* is the cross product matrix of r1 + // where I_3 is the identity matrix, r1* is the cross product matrix of r1 and + // t = -Pr * (Qq0^T * Gq1) // // J M^-1 J^T = - // ( 1/m I_3-r1 * J1^-1 * r1* -r1 * J1^-1 * t1 -r1 * J1^-1 * t2 -r1 * J1^-1 * axis) - // ( (-r1 * J1^-1 * t1)^T t1^T * J1^-1 t1 t1^T * J1^-1 t2 t1^T * J1^-1 * axis) - // ( (-r1 * J1^-1 * t2)^T t2^T * J1^-1 t1 t2^T * J1^-1 t2 t2^T * J1^-1 axis) - // ( (-r1 * J1^-1 * axis)^T axis^T * J1^-1 t1 axis^T * J1^-1 t2 axis^T * J1^-1 axis) + // ( 1/m I_3-r1 * J1^-1 * r1* r1 * J1^-1 * t^T ) + // ( (r1 * J1^-1 * t^T)^T t * J1^-1 * t^T ) Matrix3r K11; computeMatrixK(c1, invMass1, x1, inertiaInverseW1, K11); - const Matrix3r neg_P_r1_star_Jinv = -r1_star * inertiaInverseW1; - const Vector3r Jinv_axis = inertiaInverseW1 * axis; - const Vector3r Jinv_t1 = inertiaInverseW1 * t1; - const Vector3r Jinv_t2 = inertiaInverseW1 * t2; K.block<3, 3>(0, 0) += K11; - const Vector3r K_03 = neg_P_r1_star_Jinv * t1; - const Vector3r K_04 = neg_P_r1_star_Jinv * t2; - const Vector3r K_05 = neg_P_r1_star_Jinv * axis; - K.block<3, 1>(0, 3) += K_03; - K.block<3, 1>(0, 4) += K_04; - K.block<3, 1>(0, 5) += K_05; - K.block<1, 3>(3, 0) += K_03.transpose(); - K.block<1, 3>(4, 0) += K_04.transpose(); - K.block<1, 3>(5, 0) += K_05.transpose(); - K(3, 3) += t1.transpose() * Jinv_t1; - const Real K_34 = t1.transpose() * Jinv_t2; - K(3, 4) += K_34; - const Real K_35 = t1.transpose() * Jinv_axis; - K(3, 5) += K_35; - K(4, 3) += K_34; - K(4, 4) += t2.transpose() * Jinv_t2; - const Real K_45 = t2.transpose() * Jinv_axis; - K(4, 5) += K_45; - K(5, 3) += K_35; - K(5, 4) += K_45; - K(5, 5) += axis.transpose() * Jinv_axis; + Eigen::Matrix K03 = -r1_star * inertiaInverseW1 * t.transpose(); + K.block<3, 3>(0, 3) += K03; + K.block<3, 3>(3, 0) += K03.transpose(); + K.block<3, 3>(3, 3) += t * inertiaInverseW1 * t.transpose(); } + auto& llt = K.llt(); + const Eigen::Matrix lambda = llt.solve(-C); + if (llt.info() != Eigen::Success) + { + std::cerr << "Cholesky decomposition failed."; + std::cerr << llt.info(); + return false; + } - const Eigen::Matrix Kinv = K.inverse(); - - const Eigen::Matrix lambda = Kinv * b; const Vector3r pt = lambda.block<3, 1>(0, 0); - - const Vector3r angMomentum = t1*lambda(3, 0) + t2*lambda(4, 0) + axis*lambda(5, 0); + const Vector3r amt = t.transpose() * lambda.block<3, 1>(3, 0); if (invMass0 != 0.0) { - corr_x0 = invMass0*pt; - const Vector3r ot = (inertiaInverseW0 * (r0.cross(pt) + angMomentum)); + corr_x0 = invMass0 * pt; + const Vector3r ot = (inertiaInverseW0 * (r0.cross(pt) + amt)); const Quaternionr otQ(0.0, ot[0], ot[1], ot[2]); corr_q0.coeffs() = 0.5 *(otQ*q0).coeffs(); } if (invMass1 != 0.0) { - corr_x1 = -invMass1*pt; - const Vector3r ot = (inertiaInverseW1 * (r1.cross(-pt) - angMomentum)); + corr_x1 = -invMass1 * pt; + const Vector3r ot = (inertiaInverseW1 * (r1.cross(-pt) - amt)); const Quaternionr otQ(0.0, ot[0], ot[1], ot[2]); corr_q1.coeffs() = 0.5 *(otQ*q1).coeffs(); + + //std::cout << pt.transpose() << ", " << ot.transpose() << "\n"; } return true; @@ -1821,10 +1716,61 @@ bool PositionBasedRigidBodyDynamics::init_TargetVelocityMotorHingeJoint( const Quaternionr &q1, const Vector3r &position, const Vector3r &direction, - Eigen::Matrix &jointInfo + Eigen::Matrix &jointInfo ) { - return init_TargetAngleMotorHingeJoint(x0, q0, x1, q1, position, direction, jointInfo); + // jointInfo contains + // 0-1: projection matrix Pr for the rotational part + // 2: connector in body 0 (local) + // 3: connector in body 1 (local) + // 4: connector in body 0 (global) + // 5: connector in body 1 (global) + // 6: hinge axis in body 0 (local) + // 7: hinge axis in body 0 (global) + + // transform in local coordinates + const Matrix3r rot0T = q0.matrix().transpose(); + const Matrix3r rot1T = q1.matrix().transpose(); + + // connector in body 0 (local) + jointInfo.block<3, 1>(0, 2) = rot0T * (position - x0); + // connector in body 1 (local) + jointInfo.block<3, 1>(0, 3) = rot1T * (position - x1); + // connector in body 0 (global) + jointInfo.block<3, 1>(0, 4) = position; + // connector in body 1 (global) + jointInfo.block<3, 1>(0, 5) = position; + + // determine constraint coordinate system + // with direction as x-axis + Matrix3r R0; + R0.col(0) = direction; + R0.col(0).normalize(); + + Vector3r v(1.0, 0.0, 0.0); + // check if vectors are parallel + if (fabs(v.dot(R0.col(0))) > 0.99) + v = Vector3r(0.0, 1.0, 0.0); + + R0.col(1) = R0.col(0).cross(v); + R0.col(2) = R0.col(0).cross(R0.col(1)); + R0.col(1).normalize(); + R0.col(2).normalize(); + + jointInfo.block<3, 1>(0, 6) = rot0T * direction; + jointInfo.block<3, 1>(0, 7) = direction; + + Quaternionr qR0(R0); + const Quaternionr q00 = (q0.conjugate() * qR0).conjugate(); + const Quaternionr q10 = (q1.conjugate() * qR0).conjugate(); + + Eigen::Matrix Qq00, QHatq10; + computeMatrixQ(q00, Qq00); + computeMatrixQHat(q10, QHatq10); + Eigen::Matrix Pr = (QHatq10.transpose() * Qq00).block<2, 4>(2, 0); + jointInfo.block<4, 2>(0, 0) = Pr.transpose(); + + return true; } // ---------------------------------------------------------------------------------------------- @@ -1833,10 +1779,27 @@ bool PositionBasedRigidBodyDynamics::update_TargetVelocityMotorHingeJoint( const Quaternionr &q0, const Vector3r &x1, const Quaternionr &q1, - Eigen::Matrix &jointInfo + Eigen::Matrix &jointInfo ) { - return update_TargetAngleMotorHingeJoint(x0, q0, x1, q1, jointInfo); + // jointInfo contains + // 0-1: projection matrix Pr for the rotational part + // 2: connector in body 0 (local) + // 3: connector in body 1 (local) + // 4: connector in body 0 (global) + // 5: connector in body 1 (global) + // 6: hinge axis in body 0 (local) + // 7: hinge axis in body 0 (global) + + // compute world space positions of connectors + const Matrix3r rot0 = q0.matrix(); + const Matrix3r rot1 = q1.matrix(); + jointInfo.block<3, 1>(0, 4) = rot0 * jointInfo.block<3, 1>(0, 2) + x0; + jointInfo.block<3, 1>(0, 5) = rot1 * jointInfo.block<3, 1>(0, 3) + x1; + + jointInfo.block<3, 1>(0, 7) = rot0 * jointInfo.block<3, 1>(0, 6); + + return true; } // ---------------------------------------------------------------------------------------------- @@ -1849,11 +1812,11 @@ bool PositionBasedRigidBodyDynamics::solve_TargetVelocityMotorHingeJoint( const Vector3r &x1, const Matrix3r &inertiaInverseW1, const Quaternionr &q1, - const Eigen::Matrix &jointInfo, + const Eigen::Matrix &jointInfo, Vector3r &corr_x0, Quaternionr &corr_q0, Vector3r &corr_x1, Quaternionr &corr_q1) { - Eigen::Matrix hingeJointInfo = jointInfo.block<3, 12>(0, 0); + Eigen::Matrix hingeJointInfo = jointInfo.block<4, 7>(0, 0); const bool res = solve_HingeJoint( invMass0, x0, inertiaInverseW0, q0, invMass1, x1, inertiaInverseW1, q1, hingeJointInfo, corr_x0, corr_q0, corr_x1, corr_q1); @@ -1874,48 +1837,35 @@ bool PositionBasedRigidBodyDynamics::velocitySolve_TargetVelocityMotorHingeJoint const Matrix3r &inertiaInverseW1, const Vector3r &omega1, const Real targetAngularVelocity, - const Eigen::Matrix &jointInfo, + const Eigen::Matrix &jointInfo, Vector3r &corr_v0, Vector3r &corr_omega0, Vector3r &corr_v1, Vector3r &corr_omega1) { // jointInfo contains - // 0: connector in body 0 (local) - // 1: connector in body 1 (local) - // 2-4: coordinate system of body 0 (local) - // 5: joint axis in body 1 (local) - // 6: connector in body 0 (global) - // 7: connector in body 1 (global) - // 8-10:coordinate system of body 0 (global) - // 11: joint axis in body 1 (global) - // 12: perpendicular vector on joint axis (normalized) in body 1 (local) - // 13: perpendicular vector on joint axis (normalized) in body 1 (global) - - const Vector3r &c0 = jointInfo.col(6); - const Vector3r &c1 = jointInfo.col(7); - const Vector3r &axis0 = jointInfo.col(8); - const Vector3r &axis1 = jointInfo.col(11); - const Vector3r axis = 0.5 * (axis0 + axis1); - const Vector3r u = axis0.cross(axis1); - const Vector3r &t1 = jointInfo.col(9); - const Vector3r &t2 = jointInfo.col(10); - const Vector3r &t3 = jointInfo.col(13); + // 0-1: projection matrix Pr for the rotational part + // 2: connector in body 0 (local) + // 3: connector in body 1 (local) + // 4: connector in body 0 (global) + // 5: connector in body 1 (global) + // 6: hinge axis in body 0 (local) + // 7: hinge axis in body 0 (global) + + const Vector3r &axis0 = jointInfo.block<3, 1>(0, 7); + + const Vector3r &c0 = jointInfo.block<3, 1>(0, 4); + const Vector3r &c1 = jointInfo.block<3, 1>(0, 5); + + Vector3r deltaOmega = omega0 - omega1; + Eigen::Matrix C; + C.block<3, 1>(0, 0) = v0 - v1; + C.block<3, 1>(3, 0) = deltaOmega + targetAngularVelocity * axis0; + + // compute matrix J M^-1 J^T = K const Vector3r r0 = c0 - x0; const Vector3r r1 = c1 - x1; Matrix3r r0_star, r1_star; MathFunctions::crossProductMatrix(r0, r0_star); MathFunctions::crossProductMatrix(r1, r1_star); - Vector3r deltaOmega = omega1 - omega0; - - Eigen::Matrix b; - b.block<3, 1>(0, 0) = v1 - v0; - b(3, 0) = t1.dot(deltaOmega); - b(4, 0) = t2.dot(deltaOmega); - - // determine correction angle - Real delta = targetAngularVelocity; - delta -= axis.dot(deltaOmega); - - b(5, 0) = -delta; Eigen::Matrix K; K.setZero(); @@ -1924,88 +1874,51 @@ bool PositionBasedRigidBodyDynamics::velocitySolve_TargetVelocityMotorHingeJoint // Jacobian for body 0 is // // (I_3 -r0*) - // (0 t1^T) - // (0 t2^T) - // (0 axis^T) + // (0 I_3) // // where I_3 is the identity matrix and r0* is the cross product matrix of r0 // // J M^-1 J^T = - // ( 1/m I_3-r0 * J0^-1 * r0* -r0 * J0^-1 * t1 -r0 * J0^-1 * t2 -r0 * J0^-1 * axis) - // ( (-r0 * J0^-1 * t1)^T t1^T * J0^-1 t1 t1^T * J0^-1 * t2 t1^T * J0^-1 * axis) - // ( (-r0 * J0^-1 * t2)^T t2^T * J0^-1 t1 t2^T * J0^-1 * t2 t2^T * J0^-1 axis) - // ( (-r0 * J0^-1 * axis)^T axis^T * J0^-1 t1 axis^T * J0^-1 t2 axis^T * J0^-1 axis) + // ( 1/m I_3-r0 * J0^-1 * r0* -r0 * J0^-1) + // ( (-r0 * J0^-1)^T J0^-1 ) Matrix3r K00; computeMatrixK(c0, invMass0, x0, inertiaInverseW0, K00); K.block<3, 3>(0, 0) = K00; - K.block<3, 1>(0, 3) = -r0_star * inertiaInverseW0 * t1; - K.block<3, 1>(0, 4) = -r0_star * inertiaInverseW0 * t2; - K.block<3, 1>(0, 5) = -r0_star * inertiaInverseW0 * axis; - K.block<1, 3>(3, 0) = K.block<3, 1>(0, 3).transpose(); - K.block<1, 3>(4, 0) = K.block<3, 1>(0, 4).transpose(); - K.block<1, 3>(5, 0) = K.block<3, 1>(0, 5).transpose(); - K(3, 3) = t1.transpose() * inertiaInverseW0 * t1; - K(3, 4) = t1.transpose() * inertiaInverseW0 * t2; - K(3, 5) = t1.transpose() * inertiaInverseW0 * axis; - K(4, 3) = K(3, 4); - K(5, 3) = K(3, 5); - K(4, 4) = t2.transpose() * inertiaInverseW0 * t2; - K(4, 5) = t2.transpose() * inertiaInverseW0 * axis; - K(5, 4) = K(4, 5); - K(5, 5) = axis.transpose() * inertiaInverseW0 * axis; + K.block<3, 3>(0, 3) = -r0_star * inertiaInverseW0; + K.block<3, 3>(3, 0) = K.block<3, 3>(0, 3).transpose(); + K.block<3, 3>(3, 3) = inertiaInverseW0; + } if (invMass1 != 0.0) { // Jacobian for body 1 is // // ( -I_3 r1* ) - // ( 0 -t1^T ) - // ( 0 -t2^T ) - // ( 0 axis^T) + // ( 0 -I_3 ) // // where I_3 is the identity matrix and r1* is the cross product matrix of r1 // // J M^-1 J^T = - // ( 1/m I_3-r1 * J1^-1 * r1* -r1 * J1^-1 * t1 -r1 * J1^-1 * t2 -r1 * J1^-1 * axis) - // ( (-r1 * J1^-1 * t1)^T t1^T * J1^-1 t1 t1^T * J1^-1 t2 t1^T * J1^-1 * axis) - // ( (-r1 * J1^-1 * t2)^T t2^T * J1^-1 t1 t2^T * J1^-1 t2 t2^T * J1^-1 axis) - // ( (-r1 * J1^-1 * axis)^T axis^T * J1^-1 t1 axis^T * J1^-1 t2 axis^T * J1^-1 axis) + // ( 1/m I_3-r1 * J1^-1 * r1* -r1 * J1^-1) + // ( (-r1 * J1^-1)^T J1^-1 ) Matrix3r K11; computeMatrixK(c1, invMass1, x1, inertiaInverseW1, K11); K.block<3, 3>(0, 0) += K11; - const Vector3r K_03 = -r1_star * inertiaInverseW1 * t1; - const Vector3r K_04 = -r1_star * inertiaInverseW1 * t2; - const Vector3r K_05 = -r1_star * inertiaInverseW1 * axis; - K.block<3, 1>(0, 3) += K_03; - K.block<3, 1>(0, 4) += K_04; - K.block<3, 1>(0, 5) += K_05; - K.block<1, 3>(3, 0) += K_03.transpose(); - K.block<1, 3>(4, 0) += K_04.transpose(); - K.block<1, 3>(5, 0) += K_05.transpose(); - K(3, 3) += t1.transpose() * inertiaInverseW1 * t1; - const Real K_34 = t1.transpose() * inertiaInverseW1 * t2; - K(3, 4) += K_34; - const Real K_35 = t1.transpose() * inertiaInverseW1 * axis; - K(3, 5) += K_35; - K(4, 3) += K_34; - K(4, 4) += t2.transpose() * inertiaInverseW1 * t2; - const Real K_45 = t2.transpose() * inertiaInverseW1 * axis; - K(4, 5) += K_45; - K(5, 3) += K_35; - K(5, 4) += K_45; - K(5, 5) += axis.transpose() * inertiaInverseW1 * axis; + Matrix3r K03 = -r1_star * inertiaInverseW1; + K.block<3, 3>(0, 3) += K03; + K.block<3, 3>(3, 0) += K03.transpose(); + K.block<3, 3>(3, 3) += inertiaInverseW1; } - const Eigen::Matrix Kinv = K.inverse(); + const Eigen::Matrix lambda = K.llt().solve(-C); - const Eigen::Matrix lambda = Kinv * b; const Vector3r p = lambda.block<3, 1>(0, 0); - Vector3r angMomentum = t1*lambda(3, 0) + t2*lambda(4, 0) + axis*lambda(5, 0); + Vector3r angMomentum = lambda.block<3, 1>(3, 0); if (invMass0 != 0.0) { @@ -2022,12 +1935,203 @@ bool PositionBasedRigidBodyDynamics::velocitySolve_TargetVelocityMotorHingeJoint return true; } + + // ---------------------------------------------------------------------------------------------- + bool PositionBasedRigidBodyDynamics::init_DamperJoint( + const Vector3r &x0, + const Quaternionr &q0, + const Vector3r &x1, + const Quaternionr &q1, + const Vector3r &direction, + Eigen::Matrix &jointInfo + ) + { + // jointInfo contains + // 0: coordinate system in body 0, where the x-axis is the slider axis (local) + // 1: coordinate system in body 0, where the x-axis is the slider axis (global) + // 2: 3D vector d = R^T * (x0 - x1), where R is a rotation matrix with the slider axis as first column + // 3-5: projection matrix Pr for the rotational part + + + // determine constraint coordinate system + // with direction as x-axis + Matrix3r R0; + R0.col(0) = direction; + R0.col(0).normalize(); + + Vector3r v(1.0, 0.0, 0.0); + // check if vectors are parallel + if (fabs(v.dot(R0.col(0))) > 0.99) + v = Vector3r(0.0, 1.0, 0.0); + + R0.col(1) = R0.col(0).cross(v); + R0.col(2) = R0.col(0).cross(R0.col(1)); + R0.col(1).normalize(); + R0.col(2).normalize(); + + Quaternionr qR0(R0); + jointInfo.col(1) = qR0.coeffs(); + + // coordinate system of body 0 (local) + jointInfo.col(0) = (q0.conjugate() * qR0).coeffs(); + + jointInfo.block<3, 1>(0, 2) = R0.transpose() * (x0 - x1); + + const Quaternionr q00 = (q0.conjugate() * qR0).conjugate(); + const Quaternionr q10 = (q1.conjugate() * qR0).conjugate(); + + Eigen::Matrix Qq00, QHatq10; + computeMatrixQ(q00, Qq00); + computeMatrixQHat(q10, QHatq10); + Eigen::Matrix Pr = (QHatq10.transpose() * Qq00).block<3, 4>(1, 0); + jointInfo.block<4, 3>(0, 3) = Pr.transpose(); + + return true; + } + + // ---------------------------------------------------------------------------------------------- + bool PositionBasedRigidBodyDynamics::update_DamperJoint( + const Vector3r &x0, + const Quaternionr &q0, + const Vector3r &x1, + const Quaternionr &q1, + Eigen::Matrix &jointInfo + ) + { + // jointInfo contains + // 0: coordinate system in body 0, where the x-axis is the slider axis (local) + // 1: coordinate system in body 0, where the x-axis is the slider axis (global) + // 2: 3D vector d = R^T * (x0 - x1), where R is a rotation matrix with the slider axis as first column + // 3-5: projection matrix Pr for the rotational part + + // transform constraint coordinate system of body 0 to world space + Quaternionr qR0; + qR0.coeffs() = jointInfo.col(0); + jointInfo.col(1) = (q0 * qR0).coeffs(); + return true; + } + + // ---------------------------------------------------------------------------------------------- + bool PositionBasedRigidBodyDynamics::solve_DamperJoint( + const Real invMass0, + const Vector3r &x0, + const Matrix3r &inertiaInverseW0, + const Quaternionr &q0, + const Real invMass1, + const Vector3r &x1, + const Matrix3r &inertiaInverseW1, + const Quaternionr &q1, + const Real stiffness, + const Real dt, + const Eigen::Matrix &jointInfo, + Real &lambda, + Vector3r &corr_x0, Quaternionr &corr_q0, + Vector3r &corr_x1, Quaternionr &corr_q1) + { + // jointInfo contains + // 0: coordinate system in body 0, where the x-axis is the slider axis (local) + // 1: coordinate system in body 0, where the x-axis is the slider axis (global) + // 2: 3D vector d = R^T * (x0 - x1), where R is a rotation matrix with the slider axis as first column + // 3-5: projection matrix Pr for the rotational part + + Quaternionr qCoord; + qCoord.coeffs() = jointInfo.col(1); + const Matrix3r &R0 = qCoord.matrix(); + + const Eigen::Matrix &Pr = jointInfo.block<4, 3>(0, 3).transpose(); + + const Vector3r &d = jointInfo.block<3, 1>(0, 2); + + // evaluate constraint function + Eigen::Matrix C; + C.block<3, 1>(0, 0) = R0.transpose() * (x0 - x1) - d; + const Quaternionr tmp = (q0.conjugate() * q1); + const Vector4r qVec(tmp.w(), tmp.x(), tmp.y(), tmp.z()); + C.block<3, 1>(3, 0) = Pr * qVec; + + Eigen::Matrix Gq1; + computeMatrixG(q1, Gq1); + Eigen::Matrix Qq0; + computeMatrixQ(q0, Qq0); + + const Matrix3r t = -Pr * (Qq0.transpose() * Gq1); + + Eigen::Matrix K; + K.setZero(); + if (invMass0 != 0.0) + { + // Jacobian for body 0 is + // + // (I 0) + // (0 t) + // + // where I_3 is the identity matrix and t = -Pr * (Qq0^T * Gq1) + // + // J M^-1 J^T = + // ( (1/m I_3) 0 ) + // ( 0 t * J0^-1 t^T ) + + K.block<3, 3>(0, 0) = invMass0 * Matrix3r::Identity(); + K.block<3, 3>(3, 3) = t * inertiaInverseW0 * t.transpose(); + } + if (invMass1 != 0.0) + { + // Jacobian for body 1 is + // + // ( -I 0 ) + // ( 0 -t ) + // + // where I_3 is the identity matrix and t = -Pr * (Qq0^T * Gq1) + // + // J M^-1 J^T = + // ( (1/m I_3) 0 ) + // ( 0 t * J1^-1 t^T ) + + K.block<3, 3>(0, 0) += invMass1 * Matrix3r::Identity(); + K.block<3, 3>(3, 3) += t * inertiaInverseW1 * t.transpose(); + } + + Real alpha = 0.0; + if (stiffness != 0.0) + { + alpha = static_cast(1.0) / (stiffness * dt * dt); + K(0,0) += alpha; + } + + C(0, 0) += alpha * lambda; + const Eigen::Matrix delta_lambda = K.llt().solve(-C); + + lambda += delta_lambda(0,0); + + const Vector3r pt = R0 * delta_lambda.block<3, 1>(0, 0); + const Vector3r amt = t.transpose() * delta_lambda.block<3, 1>(3, 0); + + if (invMass0 != 0.0) + { + corr_x0 = invMass0 * pt; + const Vector3r ot = inertiaInverseW0 * amt; + const Quaternionr otQ(0.0, ot[0], ot[1], ot[2]); + corr_q0.coeffs() = 0.5 *(otQ*q0).coeffs(); + } + + if (invMass1 != 0.0) + { + corr_x1 = -invMass1 * pt; + const Vector3r ot = -inertiaInverseW1 * amt; + const Quaternionr otQ(0.0, ot[0], ot[1], ot[2]); + corr_q1.coeffs() = 0.5 *(otQ*q1).coeffs(); + } + + return true; + } + + // ---------------------------------------------------------------------------------------------- bool PositionBasedRigidBodyDynamics::init_RigidBodyParticleBallJoint( const Vector3r &x0, const Quaternionr &q0, const Vector3r &x1, - Eigen::Matrix &jointInfo + Eigen::Matrix &jointInfo ) { // jointInfo contains @@ -2048,7 +2152,7 @@ bool PositionBasedRigidBodyDynamics::update_RigidBodyParticleBallJoint( const Vector3r &x0, const Quaternionr &q0, const Vector3r &x1, - Eigen::Matrix &jointInfo + Eigen::Matrix &jointInfo ) { // jointInfo contains @@ -2070,7 +2174,7 @@ bool PositionBasedRigidBodyDynamics::solve_RigidBodyParticleBallJoint( const Quaternionr &q0, const Real invMass1, const Vector3r &x1, - const Eigen::Matrix &jointInfo, + const Eigen::Matrix &jointInfo, Vector3r &corr_x0, Quaternionr &corr_q0, Vector3r &corr_x1) { @@ -2091,9 +2195,8 @@ bool PositionBasedRigidBodyDynamics::solve_RigidBodyParticleBallJoint( K2(1, 1) = invMass1; K2(2, 2) = invMass1; } - const Matrix3r Kinv = (K1 + K2).inverse(); - const Vector3r pt = Kinv * (x1 - connector0); + const Vector3r pt = (K1 + K2).llt().solve(x1 - connector0); if (invMass0 != 0.0) { @@ -2132,7 +2235,7 @@ bool PositionBasedRigidBodyDynamics::init_RigidBodyContactConstraint( const Vector3r &cp1, // contact point of body 1 const Vector3r &normal, // contact normal in body 1 const Real restitutionCoeff, // coefficient of restitution - Eigen::Matrix &constraintInfo) + Eigen::Matrix &constraintInfo) { // constraintInfo contains // 0: contact point in body 0 (global) @@ -2160,7 +2263,7 @@ bool PositionBasedRigidBodyDynamics::init_RigidBodyContactConstraint( Vector3r t = u_rel - u_rel_n*normal; Real tl2 = t.squaredNorm(); if (tl2 > 1.0e-6) - t *= 1.0 / sqrt(tl2); + t *= static_cast(1.0) / sqrt(tl2); constraintInfo.col(3) = t; @@ -2170,10 +2273,10 @@ bool PositionBasedRigidBodyDynamics::init_RigidBodyContactConstraint( computeMatrixK(cp1, invMass1, x1, inertiaInverseW1, K2); Matrix3r K = K1 + K2; - constraintInfo(0, 4) = 1.0 / (normal.dot(K*normal)); + constraintInfo(0, 4) = static_cast(1.0) / (normal.dot(K*normal)); // maximal impulse in tangent direction - constraintInfo(1, 4) = 1.0 / (t.dot(K*t)) * u_rel.dot(t); + constraintInfo(1, 4) = static_cast(1.0) / (t.dot(K*t)) * u_rel.dot(t); // goal velocity in normal direction after collision constraintInfo(2, 4) = 0.0; @@ -2198,7 +2301,7 @@ bool PositionBasedRigidBodyDynamics::velocitySolve_RigidBodyContactConstraint( const Real stiffness, // stiffness parameter of penalty impulse const Real frictionCoeff, // friction coefficient Real &sum_impulses, // sum of all impulses - Eigen::Matrix &constraintInfo, // precomputed contact info + Eigen::Matrix &constraintInfo, // precomputed contact info Vector3r &corr_v0, Vector3r &corr_omega0, Vector3r &corr_v1, Vector3r &corr_omega1) { @@ -2243,8 +2346,8 @@ bool PositionBasedRigidBodyDynamics::velocitySolve_RigidBodyContactConstraint( Real correctionMagnitude = nKn_inv * delta_u_reln; - if (correctionMagnitude < -sum_impulses) - correctionMagnitude = -sum_impulses; + if (correctionMagnitude < -sum_impulses) + correctionMagnitude = -sum_impulses; // add penalty impulse to counteract penetration if (d < 0.0) @@ -2294,7 +2397,7 @@ bool PositionBasedRigidBodyDynamics::init_ParticleRigidBodyContactConstraint( const Vector3r &cp1, // contact point of body 1 const Vector3r &normal, // contact normal in body 1 const Real restitutionCoeff, // coefficient of restitution - Eigen::Matrix &constraintInfo) + Eigen::Matrix &constraintInfo) { // constraintInfo contains // 0: contact point in body 0 (global) @@ -2320,7 +2423,7 @@ bool PositionBasedRigidBodyDynamics::init_ParticleRigidBodyContactConstraint( Vector3r t = u_rel - u_rel_n*normal; Real tl2 = t.squaredNorm(); if (tl2 > 1.0e-6) - t *= 1.0 / sqrt(tl2); + t *= static_cast(1.0) / sqrt(tl2); constraintInfo.col(3) = t; @@ -2334,10 +2437,10 @@ bool PositionBasedRigidBodyDynamics::init_ParticleRigidBodyContactConstraint( K(2, 2) += invMass0; } - constraintInfo(0, 4) = 1.0 / (normal.dot(K*normal)); + constraintInfo(0, 4) = static_cast(1.0) / (normal.dot(K*normal)); // maximal impulse in tangent direction - constraintInfo(1, 4) = 1.0 / (t.dot(K*t)) * u_rel.dot(t); + constraintInfo(1, 4) = static_cast(1.0) / (t.dot(K*t)) * u_rel.dot(t); // goal velocity in normal direction after collision constraintInfo(2, 4) = 0.0; @@ -2360,7 +2463,7 @@ bool PositionBasedRigidBodyDynamics::velocitySolve_ParticleRigidBodyContactConst const Real stiffness, // stiffness parameter of penalty impulse const Real frictionCoeff, // friction coefficient Real &sum_impulses, // sum of all impulses - Eigen::Matrix &constraintInfo, // precomputed contact info + Eigen::Matrix &constraintInfo, // precomputed contact info Vector3r &corr_v0, Vector3r &corr_v1, Vector3r &corr_omega1) { diff --git a/PositionBasedDynamics/PositionBasedRigidBodyDynamics.h b/PositionBasedDynamics/PositionBasedRigidBodyDynamics.h index 82ca4b93..bce08e1d 100644 --- a/PositionBasedDynamics/PositionBasedRigidBodyDynamics.h +++ b/PositionBasedDynamics/PositionBasedRigidBodyDynamics.h @@ -25,6 +25,12 @@ namespace PBD const Matrix3r &inertiaInverseW, Matrix3r &K); + /** Compute matrix that is required to transform quaternion in + * a 3D representation. */ + static void computeMatrixG(const Quaternionr &q, Eigen::Matrix &G); + static void computeMatrixQ(const Quaternionr &q, Eigen::Matrix &Q); + static void computeMatrixQHat(const Quaternionr &q, Eigen::Matrix &Q); + public: /** Initialize ball joint and return info which is required by the solver step. * @@ -49,7 +55,7 @@ namespace PBD const Vector3r &x1, // center of mass of body 1 const Quaternionr &q1, // rotation of body 1 const Vector3r &jointPosition, // position of balljoint - Eigen::Matrix &jointInfo + Eigen::Matrix &jointInfo ); /** Update ball joint info which is required by the solver step. @@ -68,7 +74,7 @@ namespace PBD const Quaternionr &q0, // rotation of body 0 const Vector3r &x1, // center of mass of body 1 const Quaternionr &q1, // rotation of body 1 - Eigen::Matrix &ballJointInfo + Eigen::Matrix &ballJointInfo ); /** Perform a solver step for a ball joint which links two rigid bodies. @@ -106,7 +112,7 @@ namespace PBD const Vector3r &x1, // center of mass of body 1 const Matrix3r &inertiaInverseW1, // inverse inertia tensor (world space) of body 1 const Quaternionr &q1, // rotation of body 1 - const Eigen::Matrix &ballJointInfo, // precomputed ball joint info + const Eigen::Matrix &ballJointInfo, // precomputed ball joint info Vector3r &corr_x0, Quaternionr &corr_q0, Vector3r &corr_x1, Quaternionr &corr_q1); @@ -140,7 +146,7 @@ namespace PBD const Quaternionr &q1, // rotation of body 1 const Vector3r &position, // position of joint const Vector3r &direction, // direction of line - Eigen::Matrix &jointInfo + Eigen::Matrix &jointInfo ); /** Update ball-on-line-joint information which is required by the solver step. @@ -159,7 +165,7 @@ namespace PBD const Quaternionr &q0, // rotation of body 0 const Vector3r &x1, // center of mass of body 1 const Quaternionr &q1, // rotation of body 1 - Eigen::Matrix &jointInfo + Eigen::Matrix &jointInfo ); /** Perform a solver step for a ball-on-line-joint which links two rigid bodies. @@ -197,7 +203,7 @@ namespace PBD const Vector3r &x1, // center of mass of body 1 const Matrix3r &inertiaInverseW1, // inverse inertia tensor (world space) of body 1 const Quaternionr &q1, // rotation of body 1 - const Eigen::Matrix &jointInfo, // precomputed joint info + const Eigen::Matrix &jointInfo, // precomputed joint info Vector3r &corr_x0, Quaternionr &corr_q0, Vector3r &corr_x1, Quaternionr &corr_q1); @@ -211,14 +217,12 @@ namespace PBD * @param hingeJointAxis axis of hinge joint * @param hingeJointInfo Stores the local and global positions of the connector points. * The joint info contains the following columns:\n - * 0: connector in body 0 (local)\n - * 1: connector in body 1 (local)\n - * 2-4: coordinate system of body 0 (local)\n - * 5: joint axis in body 1 (local)\n - * 6: connector in body 0 (global)\n - * 7: connector in body 1 (global)\n - * 8-10: coordinate system of body 0 (global)\n - * 11: joint axis in body 1 (global)\n\n + * 0-1: projection matrix Pr for the rotational part\n + * 2: connector in body 0 (local)\n + * 3: connector in body 1 (local)\n + * 4: connector in body 0 (global)\n + * 5: connector in body 1 (global)\n + * 6: hinge axis in body 0 (local) used for rendering\n\n * The joint info stores first the info of the first body (the connector point and a * full coordinate system where the x-axis is the hinge axis) and then the info of * the second body (the connector point and the hinge axis). @@ -232,7 +236,7 @@ namespace PBD const Quaternionr &q1, // rotation of body 1 const Vector3r &hingeJointPosition, // position of hinge joint const Vector3r &hingeJointAxis, // axis of hinge joint - Eigen::Matrix &hingeJointInfo + Eigen::Matrix &hingeJointInfo ); /** Update hinge joint info which is required by the solver step. @@ -251,7 +255,7 @@ namespace PBD const Quaternionr &q0, // rotation of body 0 const Vector3r &x1, // center of mass of body 1 const Quaternionr &q1, // rotation of body 1 - Eigen::Matrix &hingeJointInfo + Eigen::Matrix &hingeJointInfo ); /** Perform a solver step for a hinge joint which links two rigid bodies. @@ -289,7 +293,7 @@ namespace PBD const Vector3r &x1, // center of mass of body 1 const Matrix3r &inertiaInverseW1, // inverse inertia tensor (world space) of body 1 const Quaternionr &q1, // rotation of body 1 - const Eigen::Matrix &hingeJointInfo, // precomputed hinge joint info + const Eigen::Matrix &hingeJointInfo, // precomputed hinge joint info Vector3r &corr_x0, Quaternionr &corr_q0, Vector3r &corr_x1, Quaternionr &corr_q1); @@ -324,7 +328,7 @@ namespace PBD const Vector3r &jointPosition, // position of universal joint const Vector3r &jointAxis0, // first axis of universal joint const Vector3r &jointAxis1, // second axis of universal joint - Eigen::Matrix &jointInfo + Eigen::Matrix &jointInfo ); /** Update universal joint info which is required by the solver step. @@ -343,7 +347,7 @@ namespace PBD const Quaternionr &q0, // rotation of body 0 const Vector3r &x1, // center of mass of body 1 const Quaternionr &q1, // rotation of body 1 - Eigen::Matrix &jointInfo + Eigen::Matrix &jointInfo ); /** Perform a solver step for a universal joint which links two rigid bodies. @@ -381,7 +385,7 @@ namespace PBD const Vector3r &x1, // center of mass of body 1 const Matrix3r &inertiaInverseW1, // inverse inertia tensor (world space) of body 1 const Quaternionr &q1, // rotation of body 1 - const Eigen::Matrix &jointInfo, // precomputed universal joint info + const Eigen::Matrix &jointInfo, // precomputed universal joint info Vector3r &corr_x0, Quaternionr &corr_q0, Vector3r &corr_x1, Quaternionr &corr_q1); @@ -392,20 +396,14 @@ namespace PBD * @param q0 rotation of first body * @param x1 center of mass of second body * @param q1 rotation of second body - * @param sliderJointPosition position of slider joint * @param sliderJointAxis axis of slider joint * @param jointInfo Stores the local and global positions of the connector points. * The joint info contains the following columns:\n - * 0: connector in body 0 (local)\n - * 1: connector in body 1 (local)\n - * 2-4: coordinate system of body 0 (local)\n - * 5: joint axis in body 1 (local)\n - * 6: connector in body 0 (global)\n - * 7: connector in body 1 (global)\n - * 8-10:coordinate system of body 0 (global)\n - * 11: joint axis in body 1 (global)\n - * 12: perpendicular vector on joint axis (normalized) in body 1 (local)\n - * 13: perpendicular vector on joint axis (normalized) in body 1 (global)\n\n + * jointInfo contains\n + * 0: coordinate system in body 0, where the x-axis is the slider axis (local)\n + * 1: coordinate system in body 0, where the x-axis is the slider axis (global)\n + * 2: 2D vector d = P * (x0 - x1), where P projects the vector onto a plane perpendicular to the slider axis\n + * 3-5: projection matrix Pr for the rotational part\n\n * The info must be updated in each simulation step * by calling update_SliderJoint(). */ @@ -414,9 +412,8 @@ namespace PBD const Quaternionr &q0, // rotation of body 0 const Vector3r &x1, // center of mass of body 1 const Quaternionr &q1, // rotation of body 1 - const Vector3r &sliderJointPosition, // position of slider joint const Vector3r &sliderJointAxis, // axis of slider joint - Eigen::Matrix &jointInfo + Eigen::Matrix &jointInfo ); /** Update slider joint info which is required by the solver step. @@ -435,7 +432,7 @@ namespace PBD const Quaternionr &q0, // rotation of body 0 const Vector3r &x1, // center of mass of body 1 const Quaternionr &q1, // rotation of body 1 - Eigen::Matrix &jointInfo + Eigen::Matrix &jointInfo ); /** Perform a solver step for a slider joint which links two rigid bodies. @@ -473,7 +470,7 @@ namespace PBD const Vector3r &x1, // center of mass of body 1 const Matrix3r &inertiaInverseW1, // inverse inertia tensor (world space) of body 1 const Quaternionr &q1, // rotation of body 1 - const Eigen::Matrix &jointInfo, // precomputed slider joint info + const Eigen::Matrix &jointInfo, // precomputed slider joint info Vector3r &corr_x0, Quaternionr &corr_q0, Vector3r &corr_x1, Quaternionr &corr_q1); @@ -485,20 +482,13 @@ namespace PBD * @param q0 rotation of first body * @param x1 center of mass of second body * @param q1 rotation of second body - * @param sliderJointPosition position of slider joint * @param sliderJointAxis axis of slider joint * @param jointInfo Stores the local and global positions of the connector points. * The joint info contains the following columns:\n - * 0: connector in body 0 (local)\n - * 1: connector in body 1 (local)\n - * 2-4: coordinate system of body 0 (local)\n - * 5: joint axis in body 1 (local)\n - * 6: connector in body 0 (global)\n - * 7: connector in body 1 (global)\n - * 8-10:coordinate system of body 0 (global)\n - * 11: joint axis in body 1 (global)\n - * 12: perpendicular vector on joint axis (normalized) in body 1 (local)\n - * 13: perpendicular vector on joint axis (normalized) in body 1 (global)\n\n + * 0: slider axis in body 0 (local)\n + * 1: slider axis in body 0 (global)\n + * 2: distance vector d = (x0 - x1)\n + * 3-5: projection matrix Pr for the rotational part\n\n * The info must be updated in each simulation step * by calling update_TargetPositionMotorSliderJoint(). */ @@ -507,9 +497,8 @@ namespace PBD const Quaternionr &q0, // rotation of body 0 const Vector3r &x1, // center of mass of body 1 const Quaternionr &q1, // rotation of body 1 - const Vector3r &sliderJointPosition, // position of slider joint const Vector3r &sliderJointAxis, // axis of slider joint - Eigen::Matrix &jointInfo + Eigen::Matrix &jointInfo ); /** Update motor slider joint info which is required by the solver step. @@ -528,7 +517,7 @@ namespace PBD const Quaternionr &q0, // rotation of body 0 const Vector3r &x1, // center of mass of body 1 const Quaternionr &q1, // rotation of body 1 - Eigen::Matrix &jointInfo + Eigen::Matrix &jointInfo ); /** Perform a solver step for a motor slider joint which links two rigid bodies. @@ -569,7 +558,7 @@ namespace PBD const Matrix3r &inertiaInverseW1, // inverse inertia tensor (world space) of body 1 const Quaternionr &q1, // rotation of body 1 const Real targetPosition, // target position of the servo motor - const Eigen::Matrix &jointInfo, // precomputed slider joint info + const Eigen::Matrix &jointInfo, // precomputed slider joint info Vector3r &corr_x0, Quaternionr &corr_q0, Vector3r &corr_x1, Quaternionr &corr_q1); @@ -581,20 +570,13 @@ namespace PBD * @param q0 rotation of first body * @param x1 center of mass of second body * @param q1 rotation of second body - * @param sliderJointPosition position of slider joint * @param sliderJointAxis axis of slider joint * @param jointInfo Stores the local and global positions of the connector points. * The joint info contains the following columns:\n - * 0: connector in body 0 (local)\n - * 1: connector in body 1 (local)\n - * 2-4: coordinate system of body 0 (local)\n - * 5: joint axis in body 1 (local)\n - * 6: connector in body 0 (global)\n - * 7: connector in body 1 (global)\n - * 8-10:coordinate system of body 0 (global)\n - * 11: joint axis in body 1 (global)\n - * 12: perpendicular vector on joint axis (normalized) in body 1 (local)\n - * 13: perpendicular vector on joint axis (normalized) in body 1 (global)\n\n + * 0: coordinate system in body 0, where the x-axis is the slider axis (local)\n + * 1: coordinate system in body 0, where the x-axis is the slider axis (global)\n + * 2: 2D vector d = P * (x0 - x1), where P projects the vector onto a plane perpendicular to the slider axis\n + * 3-5: projection matrix Pr for the rotational part\n\n * The info must be updated in each simulation step * by calling update_TargetVelocityMotorSliderJoint(). */ @@ -603,9 +585,8 @@ namespace PBD const Quaternionr &q0, // rotation of body 0 const Vector3r &x1, // center of mass of body 1 const Quaternionr &q1, // rotation of body 1 - const Vector3r &sliderJointPosition, // position of slider joint const Vector3r &sliderJointAxis, // axis of slider joint - Eigen::Matrix &jointInfo + Eigen::Matrix &jointInfo ); /** Update motor slider joint info which is required by the solver step. @@ -624,7 +605,7 @@ namespace PBD const Quaternionr &q0, // rotation of body 0 const Vector3r &x1, // center of mass of body 1 const Quaternionr &q1, // rotation of body 1 - Eigen::Matrix &jointInfo + Eigen::Matrix &jointInfo ); /** Perform a solver step for a motor slider joint which links two rigid bodies. @@ -663,7 +644,7 @@ namespace PBD const Vector3r &x1, // center of mass of body 1 const Matrix3r &inertiaInverseW1, // inverse inertia tensor (world space) of body 1 const Quaternionr &q1, // rotation of body 1 - const Eigen::Matrix &jointInfo, // precomputed slider joint info + const Eigen::Matrix &jointInfo, // precomputed slider joint info Vector3r &corr_x0, Quaternionr &corr_q0, Vector3r &corr_x1, Quaternionr &corr_q1); @@ -682,11 +663,13 @@ namespace PBD * @param x0 center of mass of first body * @param v0 velocity of body 0 * @param inertiaInverseW0 inverse inertia tensor in world coordinates of first body + * @param q0 rotation of first body * @param omega0 angular velocity of first body * @param invMass1 inverse mass of second body * @param x1 center of mass of second body * @param v1 velocity of body 1 * @param inertiaInverseW1 inverse inertia tensor in world coordinates of second body + * @param q1 rotation of second body * @param omega1 angular velocity of second body * @param targetVelocity target velocity of the motor * @param jointInfo Motor slider joint information which is required by the solver. This @@ -702,14 +685,16 @@ namespace PBD const Vector3r &x0, // center of mass of body 0 const Vector3r &v0, // velocity of body 0 const Matrix3r &inertiaInverseW0, // inverse inertia tensor (world space) of body 0 + const Quaternionr &q0, // rotation of body 0 const Vector3r &omega0, const Real invMass1, // inverse mass is zero if body is static const Vector3r &x1, // center of mass of body 1 const Vector3r &v1, const Matrix3r &inertiaInverseW1, // inverse inertia tensor (world space) of body 1 + const Quaternionr &q1, // rotation of body 1 const Vector3r &omega1, const Real targetVelocity, // target velocity of the servo motor - const Eigen::Matrix &jointInfo, // precomputed joint info + const Eigen::Matrix &jointInfo, // precomputed joint info Vector3r &corr_v0, Vector3r &corr_omega0, Vector3r &corr_v1, Vector3r &corr_omega1); @@ -725,16 +710,12 @@ namespace PBD * @param hingeJointAxis axis of hinge joint * @param jointInfo Stores the local and global positions of the connector points. * The joint info contains the following columns:\n - * 0: connector in body 0 (local)\n - * 1: connector in body 1 (local)\n - * 2-4: coordinate system of body 0 (local)\n - * 5: joint axis in body 1 (local)\n - * 6: connector in body 0 (global)\n - * 7: connector in body 1 (global)\n - * 8-10:coordinate system of body 0 (global)\n - * 11: joint axis in body 1 (global)\n - * 12: perpendicular vector on joint axis (normalized) in body 1 (local)\n - * 13: perpendicular vector on joint axis (normalized) in body 1 (global)\n\n + * 0-2: projection matrix Pr for the rotational part\n + * 3: connector in body 0 (local)\n + * 4: connector in body 1 (local)\n + * 5: connector in body 0 (global)\n + * 6: connector in body 1 (global)\n + * 7: hinge axis in body 0 (local) used for rendering \n\n * The info must be updated in each simulation step * by calling update_TargetAngleMotorHingeJoint(). */ @@ -745,7 +726,7 @@ namespace PBD const Quaternionr &q1, // rotation of body 1 const Vector3r &hingeJointPosition, // position of hinge joint const Vector3r &hingeJointAxis, // axis of hinge joint - Eigen::Matrix &jointInfo + Eigen::Matrix &jointInfo ); /** Update motor hinge joint info which is required by the solver step. @@ -764,7 +745,7 @@ namespace PBD const Quaternionr &q0, // rotation of body 0 const Vector3r &x1, // center of mass of body 1 const Quaternionr &q1, // rotation of body 1 - Eigen::Matrix &jointInfo + Eigen::Matrix &jointInfo ); /** Perform a solver step for a motor hinge joint which links two rigid bodies. @@ -805,7 +786,7 @@ namespace PBD const Matrix3r &inertiaInverseW1, // inverse inertia tensor (world space) of body 1 const Quaternionr &q1, // rotation of body 1 const Real targetAngle, // target angle of the servo motor - const Eigen::Matrix &jointInfo, // precomputed hinge joint info + const Eigen::Matrix &jointInfo, // precomputed hinge joint info Vector3r &corr_x0, Quaternionr &corr_q0, Vector3r &corr_x1, Quaternionr &corr_q1); @@ -820,16 +801,13 @@ namespace PBD * @param hingeJointAxis axis of hinge joint * @param jointInfo Stores the local and global positions of the connector points. * The joint info contains the following columns:\n - * 0: connector in body 0 (local)\n - * 1: connector in body 1 (local)\n - * 2-4: coordinate system of body 0 (local)\n - * 5: joint axis in body 1 (local)\n - * 6: perpendicular vector on joint axis (normalized) in body 1 (local)\n - * 7: connector in body 0 (global)\n - * 8: connector in body 1 (global)\n - * 9-11:coordinate system of body 0 (global)\n - * 12: joint axis in body 1 (global)\n - * 13: perpendicular vector on joint axis (normalized) in body 1 (global)\n\n + * 0-1: projection matrix Pr for the rotational part\n + * 2: connector in body 0 (local)\n + * 3: connector in body 1 (local)\n + * 4: connector in body 0 (global)\n + * 5: connector in body 1 (global)\n + * 6: hinge axis in body 0 (local)\n + * 7: hinge axis in body 0 (global)\n\n * The info must be updated in each simulation step * by calling update_TargetVelocityMotorHingeJoint(). */ @@ -840,7 +818,7 @@ namespace PBD const Quaternionr &q1, // rotation of body 1 const Vector3r &hingeJointPosition, // position of hinge joint const Vector3r &hingeJointAxis, // axis of hinge joint - Eigen::Matrix &jointInfo + Eigen::Matrix &jointInfo ); /** Update motor hinge joint info which is required by the solver step. @@ -859,7 +837,7 @@ namespace PBD const Quaternionr &q0, // rotation of body 0 const Vector3r &x1, // center of mass of body 1 const Quaternionr &q1, // rotation of body 1 - Eigen::Matrix &jointInfo + Eigen::Matrix &jointInfo ); /** Perform a solver step for a motor hinge joint which links two rigid bodies. @@ -899,7 +877,7 @@ namespace PBD const Vector3r &x1, // center of mass of body 1 const Matrix3r &inertiaInverseW1, // inverse inertia tensor (world space) of body 1 const Quaternionr &q1, // rotation of body 1 - const Eigen::Matrix &jointInfo, // precomputed hinge joint info + const Eigen::Matrix &jointInfo, // precomputed hinge joint info Vector3r &corr_x0, Quaternionr &corr_q0, Vector3r &corr_x1, Quaternionr &corr_q1); @@ -945,7 +923,7 @@ namespace PBD const Matrix3r &inertiaInverseW1, // inverse inertia tensor (world space) of body 1 const Vector3r &omega1, const Real targetAngularVelocity, // target angular velocity of the servo motor - const Eigen::Matrix &jointInfo, // precomputed joint info + const Eigen::Matrix &jointInfo, // precomputed joint info Vector3r &corr_v0, Vector3r &corr_omega0, Vector3r &corr_v1, Vector3r &corr_omega1); @@ -966,7 +944,7 @@ namespace PBD const Vector3r &x0, // center of mass of the rigid body const Quaternionr &q0, // rotation of the rigid body body const Vector3r &x1, // position of the particle - Eigen::Matrix &jointInfo + Eigen::Matrix &jointInfo ); /** Update joint info which is required by the solver step. @@ -983,7 +961,7 @@ namespace PBD const Vector3r &x0, // center of mass of the rigid body const Quaternionr &q0, // rotation of the rigid body body const Vector3r &x1, // position of the particle - Eigen::Matrix &jointInfo + Eigen::Matrix &jointInfo ); /** Perform a solver step for a ball joint which links a rigid body and a particle. @@ -1012,7 +990,7 @@ namespace PBD const Quaternionr &q0, // rotation of body 0 const Real invMass1, // inverse mass is zero if particle is static const Vector3r &x1, // position of particle - const Eigen::Matrix &jointInfo, // precomputed joint info + const Eigen::Matrix &jointInfo, // precomputed joint info Vector3r &corr_x0, Quaternionr &corr_q0, Vector3r &corr_x1); @@ -1063,7 +1041,7 @@ namespace PBD const Vector3r &cp1, // contact point of body 1 const Vector3r &normal, // contact normal in body 1 const Real restitutionCoeff, // coefficient of restitution - Eigen::Matrix &constraintInfo); + Eigen::Matrix &constraintInfo); /** Perform a solver step for a contact constraint between two rigid bodies. @@ -1104,7 +1082,7 @@ namespace PBD const Real stiffness, // stiffness parameter of penalty impulse const Real frictionCoeff, // friction coefficient Real &sum_impulses, // sum of all impulses - Eigen::Matrix &constraintInfo, // precomputed contact info + Eigen::Matrix &constraintInfo, // precomputed contact info Vector3r &corr_v0, Vector3r &corr_omega0, Vector3r &corr_v1, Vector3r &corr_omega1); @@ -1150,7 +1128,7 @@ namespace PBD const Vector3r &cp1, // contact point of body 1 const Vector3r &normal, // contact normal in body 1 const Real restitutionCoeff, // coefficient of restitution - Eigen::Matrix &constraintInfo); + Eigen::Matrix &constraintInfo); /** Perform a solver step for a contact constraint between a rigid body and a particle. @@ -1186,10 +1164,192 @@ namespace PBD const Real stiffness, // stiffness parameter of penalty impulse const Real frictionCoeff, // friction coefficient Real &sum_impulses, // sum of all impulses - Eigen::Matrix &constraintInfo, // precomputed contact info + Eigen::Matrix &constraintInfo, // precomputed contact info Vector3r &corr_v0, Vector3r &corr_v1, Vector3r &corr_omega1); + + + /** Initialize distance joint and return info which is required by the solver step. + * + * @param x0 center of mass of first body + * @param q0 rotation of first body + * @param x1 center of mass of second body + * @param q1 rotation of second body + * @param jointPosition position of distance joint + * @param jointInfo Stores the local and global positions of the connector points. + * The first two columns store the local connectors in body 0 and 1, respectively, while + * the last two columns contain the global connector positions which have to be + * updated in each simulation step by calling update_DistanceJoint().\n + * The joint info contains the following columns:\n + * 0: connector in body 0 (local)\n + * 1: connector in body 1 (local)\n + * 2: connector in body 0 (global)\n + * 3: connector in body 1 (global) + */ + static bool init_DistanceJoint( + const Vector3r &x0, // center of mass of body 0 + const Quaternionr &q0, // rotation of body 0 + const Vector3r &x1, // center of mass of body 1 + const Quaternionr &q1, // rotation of body 1 + const Vector3r &pos0, + const Vector3r &pos1, + Eigen::Matrix &jointInfo + ); + + /** Update distance joint info which is required by the solver step. + * The distance joint info must be generated in the initialization process of the model + * by calling the function init_DistanceJoint(). + * This method should be called once per simulation step before executing the solver.\n\n + * + * @param x0 center of mass of first body + * @param q0 rotation of first body + * @param x1 center of mass of second body + * @param q1 rotation of second body + * @param jointInfo joint information which should be updated + */ + static bool update_DistanceJoint( + const Vector3r &x0, // center of mass of body 0 + const Quaternionr &q0, // rotation of body 0 + const Vector3r &x1, // center of mass of body 1 + const Quaternionr &q1, // rotation of body 1 + Eigen::Matrix &jointInfo + ); + + /** Perform a solver step for a distance joint which links two rigid bodies. + * A distance joint removes one translational degrees of freedom between the bodies. + * When setting a stiffness value which is not zero, we get an implicit spring. + * The distance joint info must be generated in the initialization process of the model + * by calling the function init_DistanceJoint() and updated each time the bodies + * change their state by update_DistanceJoint().\n\n + * More information can be found in: \cite Deul2014 + * + * @param invMass0 inverse mass of first body + * @param x0 center of mass of first body + * @param inertiaInverseW0 inverse inertia tensor in world coordinates of first body + * @param q0 rotation of first body + * @param invMass1 inverse mass of second body + * @param x1 center of mass of second body + * @param inertiaInverseW1 inverse inertia tensor in world coordinates of second body + * @param q1 rotation of second body + * @param stiffness Stiffness of the constraint. 0 means it is totally stiff and we get a distance joint otherwise we get an implicit spring. + * @param restLength Rest length of the joint. + * @param dt Time step size (required for XPBD when simulating a spring) + * @param jointInfo Joint information which is required by the solver. This + * information must be generated in the beginning by calling init_DistanceJoint() + * and updated each time the bodies change their state by update_DistanceJoint(). + * @param lambda Lagrange multiplier (required for XPBD). Must be 0 in the first iteration. + * @param corr_x0 position correction of center of mass of first body + * @param corr_q0 rotation correction of first body + * @param corr_x1 position correction of center of mass of second body + * @param corr_q1 rotation correction of second body + */ + static bool solve_DistanceJoint( + const Real invMass0, // inverse mass is zero if body is static + const Vector3r &x0, // center of mass of body 0 + const Matrix3r &inertiaInverseW0, // inverse inertia tensor (world space) of body 0 + const Quaternionr &q0, // rotation of body 0 + const Real invMass1, // inverse mass is zero if body is static + const Vector3r &x1, // center of mass of body 1 + const Matrix3r &inertiaInverseW1, // inverse inertia tensor (world space) of body 1 + const Quaternionr &q1, // rotation of body 1 + const Real stiffness, + const Real restLength, + const Real dt, + const Eigen::Matrix &jointInfo, // precomputed joint info + Real &lambda, + Vector3r &corr_x0, Quaternionr &corr_q0, + Vector3r &corr_x1, Quaternionr &corr_q1); + + /** Initialize a motor slider joint which is able to enforce + * a target position and return info which is required by the solver step. + * + * @param x0 center of mass of first body + * @param q0 rotation of first body + * @param x1 center of mass of second body + * @param q1 rotation of second body + * @param sliderJointPosition position of slider joint + * @param sliderJointAxis axis of slider joint + * @param jointInfo Stores the local and global positions of the connector points. + * The joint info contains the following columns:\n + * 0: coordinate system in body 0, where the x-axis is the slider axis (local)\n + * 1: coordinate system in body 0, where the x-axis is the slider axis (global)\n + * 2: 3D vector d = R^T * (x0 - x1), where R is a rotation matrix with the slider axis as first column\n + * 3-5: projection matrix Pr for the rotational part\n\n + * The info must be updated in each simulation step + * by calling update_TargetPositionMotorSliderJoint(). + */ + static bool init_DamperJoint( + const Vector3r &x0, // center of mass of body 0 + const Quaternionr &q0, // rotation of body 0 + const Vector3r &x1, // center of mass of body 1 + const Quaternionr &q1, // rotation of body 1 + const Vector3r &direction, + Eigen::Matrix &jointInfo + ); + + /** Update motor slider joint info which is required by the solver step. + * The joint info must be generated in the initialization process of the model + * by calling the function init_TargetPositionMotorSliderJoint(). + * This method should be called once per simulation step before executing the solver.\n\n + * + * @param x0 center of mass of first body + * @param q0 rotation of first body + * @param x1 center of mass of second body + * @param q1 rotation of second body + * @param jointInfo slider joint information which should be updated + */ + static bool update_DamperJoint( + const Vector3r &x0, // center of mass of body 0 + const Quaternionr &q0, // rotation of body 0 + const Vector3r &x1, // center of mass of body 1 + const Quaternionr &q1, // rotation of body 1 + Eigen::Matrix &jointInfo + ); + + /** Perform a solver step for a motor slider joint which links two rigid bodies. + * A motor slider joint removes two translational and three rotational degrees of freedom between the bodies. + * Moreover, a target position can be enforced on the remaining translation axis. + * The motor slider joint info must be generated in the initialization process of the model + * by calling the function init_TargetPositionMotorSliderJoint() and updated each time the bodies + * change their state by update_TargetPositionMotorSliderJoint().\n\n + * More information can be found in: \cite Deul2014 + * + * \image html motorsliderjoint.jpg "motor slider joint" + * \image latex motorsliderjoint.jpg "motor slider joint" width=0.5\textwidth + * + * @param invMass0 inverse mass of first body + * @param x0 center of mass of first body + * @param inertiaInverseW0 inverse inertia tensor in world coordinates of first body + * @param q0 rotation of first body + * @param invMass1 inverse mass of second body + * @param x1 center of mass of second body + * @param inertiaInverseW1 inverse inertia tensor in world coordinates of second body + * @param q1 rotation of second body + * @param targetPosition target position of the servo motor + * @param jointInfo Motor slider joint information which is required by the solver. This + * information must be generated in the beginning by calling init_TargetPositionMotorSliderJoint() + * and updated each time the bodies change their state by update_TargetPositionMotorSliderJoint(). + * @param corr_x0 position correction of center of mass of first body + * @param corr_q0 rotation correction of first body + * @param corr_x1 position correction of center of mass of second body + * @param corr_q1 rotation correction of second body + */ + static bool solve_DamperJoint( + const Real invMass0, //inverse mass is zero if body is static + const Vector3r &x0, // center of mass of body 0 + const Matrix3r &inertiaInverseW0, // inverse inertia tensor (world space) of body 0 + const Quaternionr &q0, // rotation of body 0 + const Real invMass1, // inverse mass is zero if body is static + const Vector3r &x1, // center of mass of body 1 + const Matrix3r &inertiaInverseW1, // inverse inertia tensor (world space) of body 1 + const Quaternionr &q1, // rotation of body 1 + const Real stiffness, + const Real dt, + const Eigen::Matrix &jointInfo, // precomputed slider joint info + Real &lambda, + Vector3r &corr_x0, Quaternionr &corr_q0, + Vector3r &corr_x1, Quaternionr &corr_q1); }; } -#endif \ No newline at end of file +#endif diff --git a/PositionBasedDynamics/SPHKernels.h b/PositionBasedDynamics/SPHKernels.h index 084acbfa..b5e40d0a 100644 --- a/PositionBasedDynamics/SPHKernels.h +++ b/PositionBasedDynamics/SPHKernels.h @@ -25,8 +25,8 @@ namespace PBD static const Real pi = static_cast(M_PI); const Real h3 = m_radius*m_radius*m_radius; - m_k = 8.0 / (pi*h3); - m_l = 48.0 / (pi*h3); + m_k = static_cast(8.0) / (pi*h3); + m_l = static_cast(48.0) / (pi*h3); m_W_zero = W(Vector3r(0.0, 0.0, 0.0)); } @@ -46,11 +46,11 @@ namespace PBD { const Real q2 = q*q; const Real q3 = q2*q; - res = m_k * (6.0*q3-6.0*q2+1.0); + res = m_k * (static_cast(6.0)*q3- static_cast(6.0)*q2+ static_cast(1.0)); } else { - res = m_k * (2.0*pow(1.0-q,3)); + res = m_k * (static_cast(2.0)*pow(static_cast(1.0)-q,3)); } } return res; @@ -74,7 +74,7 @@ namespace PBD } else { - const Real factor = 1.0 - q; + const Real factor = static_cast(1.0) - q; res = m_l*(-factor*factor)*gradq; } } diff --git a/PositionBasedDynamics/TimeIntegration.cpp b/PositionBasedDynamics/TimeIntegration.cpp index 16b3def9..81da2381 100644 --- a/PositionBasedDynamics/TimeIntegration.cpp +++ b/PositionBasedDynamics/TimeIntegration.cpp @@ -22,6 +22,7 @@ void TimeIntegration::semiImplicitEuler( void TimeIntegration::semiImplicitEulerRotation( const Real h, const Real mass, + const Matrix3r& invertiaW, const Matrix3r &invInertiaW, Quaternionr &rotation, Vector3r &angularVelocity, @@ -29,8 +30,7 @@ void TimeIntegration::semiImplicitEulerRotation( { if (mass != 0.0) { - // simple form without nutation effect - angularVelocity += h * invInertiaW * torque; + angularVelocity += h * invInertiaW * (torque - (angularVelocity.cross(invertiaW * angularVelocity))); Quaternionr angVelQ(0.0, angularVelocity[0], angularVelocity[1], angularVelocity[2]); rotation.coeffs() += h * 0.5 * (angVelQ * rotation).coeffs(); diff --git a/PositionBasedDynamics/TimeIntegration.h b/PositionBasedDynamics/TimeIntegration.h index 1630fa52..f2a8dd8d 100644 --- a/PositionBasedDynamics/TimeIntegration.h +++ b/PositionBasedDynamics/TimeIntegration.h @@ -33,6 +33,7 @@ namespace PBD static void semiImplicitEulerRotation( const Real h, const Real mass, + const Matrix3r& invertiaW, const Matrix3r &invInertiaW, Quaternionr &rotation, Vector3r &angularVelocity, diff --git a/PositionBasedDynamics/XPBD.cpp b/PositionBasedDynamics/XPBD.cpp new file mode 100644 index 00000000..1efa560e --- /dev/null +++ b/PositionBasedDynamics/XPBD.cpp @@ -0,0 +1,294 @@ +#include "XPBD.h" +#include "PositionBasedDynamics.h" +#include "MathFunctions.h" +#include + +using namespace PBD; + +const Real eps = static_cast(1e-6); + +////////////////////////////////////////////////////////////////////////// +// XPBD +////////////////////////////////////////////////////////////////////////// + +bool XPBD::solve_DistanceConstraint( + const Vector3r &p0, Real invMass0, + const Vector3r &p1, Real invMass1, + const Real restLength, + const Real stiffness, + const Real dt, + Real& lambda, + Vector3r &corr0, Vector3r &corr1) +{ + Real K = invMass0 + invMass1; + Vector3r n = p0 - p1; + Real d = n.norm(); + Real C = d - restLength; + if (d > static_cast(1e-6)) + n /= d; + else + { + corr0.setZero(); + corr1.setZero(); + return true; + } + + Real alpha = 0.0; + if (stiffness != 0.0) + { + alpha = static_cast(1.0) / (stiffness * dt * dt); + K += alpha; + } + + Real Kinv = 0.0; + if (fabs(K) > static_cast(1e-6)) + Kinv = static_cast(1.0) / K; + else + { + corr0.setZero(); + corr1.setZero(); + return true; + } + + const Real delta_lambda = -Kinv * (C + alpha * lambda); + lambda += delta_lambda; + const Vector3r pt = n * delta_lambda; + + corr0 = invMass0 * pt; + corr1 = -invMass1 * pt; + return true; +} + +// ---------------------------------------------------------------------------------------------- +bool XPBD::solve_VolumeConstraint( + const Vector3r& p0, Real invMass0, + const Vector3r& p1, Real invMass1, + const Vector3r& p2, Real invMass2, + const Vector3r& p3, Real invMass3, + const Real restVolume, + const Real stiffness, + const Real dt, + Real& lambda, + Vector3r& corr0, Vector3r& corr1, Vector3r& corr2, Vector3r& corr3) +{ + Real volume = static_cast(1.0 / 6.0) * (p1 - p0).cross(p2 - p0).dot(p3 - p0); + + corr0.setZero(); corr1.setZero(); corr2.setZero(); corr3.setZero(); + + Vector3r grad0 = (p1 - p2).cross(p3 - p2); + Vector3r grad1 = (p2 - p0).cross(p3 - p0); + Vector3r grad2 = (p0 - p1).cross(p3 - p1); + Vector3r grad3 = (p1 - p0).cross(p2 - p0); + + Real K = + invMass0 * grad0.squaredNorm() + + invMass1 * grad1.squaredNorm() + + invMass2 * grad2.squaredNorm() + + invMass3 * grad3.squaredNorm(); + + Real alpha = 0.0; + if (stiffness != 0.0) + { + alpha = static_cast(1.0) / (stiffness * dt * dt); + K += alpha; + } + + if (fabs(K) < eps) + return false; + + const Real C = volume - restVolume; + const Real delta_lambda = -(C + alpha * lambda) / K; + lambda += delta_lambda; + + corr0 = delta_lambda * invMass0 * grad0; + corr1 = delta_lambda * invMass1 * grad1; + corr2 = delta_lambda * invMass2 * grad2; + corr3 = delta_lambda * invMass3 * grad3; + + return true; +} + +// ---------------------------------------------------------------------------------------------- +bool XPBD::init_IsometricBendingConstraint( + const Vector3r& p0, + const Vector3r& p1, + const Vector3r& p2, + const Vector3r& p3, + Matrix4r& Q) +{ + // Compute matrix Q for quadratic bending + const Vector3r* x[4] = { &p2, &p3, &p0, &p1 }; + + const Vector3r e0 = *x[1] - *x[0]; + const Vector3r e1 = *x[2] - *x[0]; + const Vector3r e2 = *x[3] - *x[0]; + const Vector3r e3 = *x[2] - *x[1]; + const Vector3r e4 = *x[3] - *x[1]; + + const Real c01 = MathFunctions::cotTheta(e0, e1); + const Real c02 = MathFunctions::cotTheta(e0, e2); + const Real c03 = MathFunctions::cotTheta(-e0, e3); + const Real c04 = MathFunctions::cotTheta(-e0, e4); + + const Real A0 = static_cast(0.5) * (e0.cross(e1)).norm(); + const Real A1 = static_cast(0.5) * (e0.cross(e2)).norm(); + + const Real coef = -3.f / (2.f * (A0 + A1)); + const Real K[4] = { c03 + c04, c01 + c02, -c01 - c03, -c02 - c04 }; + const Real K2[4] = { coef * K[0], coef * K[1], coef * K[2], coef * K[3] }; + + for (unsigned char j = 0; j < 4; j++) + { + for (unsigned char k = 0; k < j; k++) + { + Q(j, k) = Q(k, j) = K[j] * K2[k]; + } + Q(j, j) = K[j] * K2[j]; + } + + return true; +} + +// ---------------------------------------------------------------------------------------------- +bool XPBD::solve_IsometricBendingConstraint( + const Vector3r& p0, Real invMass0, + const Vector3r& p1, Real invMass1, + const Vector3r& p2, Real invMass2, + const Vector3r& p3, Real invMass3, + const Matrix4r& Q, + const Real stiffness, + const Real dt, + Real& lambda, + Vector3r& corr0, Vector3r& corr1, Vector3r& corr2, Vector3r& corr3) +{ + const Vector3r* x[4] = { &p2, &p3, &p0, &p1 }; + Real invMass[4] = { invMass2, invMass3, invMass0, invMass1 }; + + Real energy = 0.0; + for (unsigned char k = 0; k < 4; k++) + for (unsigned char j = 0; j < 4; j++) + energy += Q(j, k) * (x[k]->dot(*x[j])); + energy *= 0.5; + + Vector3r gradC[4]; + gradC[0].setZero(); + gradC[1].setZero(); + gradC[2].setZero(); + gradC[3].setZero(); + for (unsigned char k = 0; k < 4; k++) + for (unsigned char j = 0; j < 4; j++) + gradC[j] += Q(j, k) * *x[k]; + + + Real sum_normGradC = 0.0; + for (unsigned int j = 0; j < 4; j++) + { + // compute sum of squared gradient norms + if (invMass[j] != 0.0) + sum_normGradC += invMass[j] * gradC[j].squaredNorm(); + } + + Real alpha = 0.0; + if (stiffness != 0.0) + { + alpha = static_cast(1.0) / (stiffness * dt * dt); + sum_normGradC += alpha; + } + + // exit early if required + if (fabs(sum_normGradC) > eps) + { + // compute impulse-based scaling factor + const Real delta_lambda = -(energy + alpha * lambda) / sum_normGradC; + lambda += delta_lambda; + + corr0 = (delta_lambda * invMass[2]) * gradC[2]; + corr1 = (delta_lambda * invMass[3]) * gradC[3]; + corr2 = (delta_lambda * invMass[0]) * gradC[0]; + corr3 = (delta_lambda * invMass[1]) * gradC[1]; + + return true; + } + return false; +} + + +// ---------------------------------------------------------------------------------------------- +bool XPBD::solve_FEMTetraConstraint( + const Vector3r& p0, Real invMass0, + const Vector3r& p1, Real invMass1, + const Vector3r& p2, Real invMass2, + const Vector3r& p3, Real invMass3, + const Real restVolume, + const Matrix3r& invRestMat, + const Real youngsModulus, + const Real poissonRatio, + const bool handleInversion, + const Real dt, + Real& multiplier, + Vector3r& corr0, Vector3r& corr1, Vector3r& corr2, Vector3r& corr3) +{ + corr0.setZero(); + corr1.setZero(); + corr2.setZero(); + corr3.setZero(); + + if (youngsModulus <= 0.0) + return true; + + if (poissonRatio < 0.0 || poissonRatio > 0.49) + return false; + + + Vector3r gradU_[4]; + Matrix3r epsilon, sigma; + Real volume = (p1 - p0).cross(p2 - p0).dot(p3 - p0) / static_cast(6.0); + + // compute the Lame coefficients mu and lambda divided by Young's modulus E + // since we use Young's modulus as compliance factor alpha = 1/E. + Real mu_ = 1.0 / static_cast(2.0) / (static_cast(1.0) + poissonRatio); + Real lambda_ = 1.0 * poissonRatio / (static_cast(1.0) + poissonRatio) / (static_cast(1.0) - static_cast(2.0) * poissonRatio); + + // compute value U' which is the potential energy of the elastic solid U divided by Young's modulus E + // U = E * U' + Real U_ = 0.0; + if (!handleInversion || volume > 0.0) + { + PositionBasedDynamics::computeGreenStrainAndPiolaStress(p0, p1, p2, p3, invRestMat, restVolume, mu_, lambda_, epsilon, sigma, U_); + PositionBasedDynamics::computeGradCGreen(restVolume, invRestMat, sigma, gradU_); + } + else + { + PositionBasedDynamics::computeGreenStrainAndPiolaStressInversion(p0, p1, p2, p3, invRestMat, restVolume, mu_, lambda_, epsilon, sigma, U_); + PositionBasedDynamics::computeGradCGreen(restVolume, invRestMat, sigma, gradU_); + } + + // By choosing the constraint function as sqrt(2 U'), the potential energy used in XPBD: + // U = 0.5 * alpha^-1 * C^2 + // gives us exactly the required potential energy of the elastic solid. + const Real C = sqrt(2.0 * U_); + + Real sum_normGradU_ = + invMass0 * gradU_[0].squaredNorm() + + invMass1 * gradU_[1].squaredNorm() + + invMass2 * gradU_[2].squaredNorm() + + invMass3 * gradU_[3].squaredNorm(); + + Real alpha = static_cast(1.0) / (youngsModulus * dt * dt); + // Note that grad C = 1/C grad U', by multiplying C^2 to alpha, we now can add the factor C^2 to the nominator + sum_normGradU_ += C * C * alpha; + + if (sum_normGradU_ < eps) + return false; + + // compute scaling factor + const Real lambda = -C * (C + alpha * multiplier) / sum_normGradU_; // since in the next step we use gradU instead of gradC, we only add the factor C instead of C^2 + multiplier += lambda; + + corr0 = lambda * invMass0 * gradU_[0]; + corr1 = lambda * invMass1 * gradU_[1]; + corr2 = lambda * invMass2 * gradU_[2]; + corr3 = lambda * invMass3 * gradU_[3]; + + return true; +} diff --git a/PositionBasedDynamics/XPBD.h b/PositionBasedDynamics/XPBD.h new file mode 100644 index 00000000..17846174 --- /dev/null +++ b/PositionBasedDynamics/XPBD.h @@ -0,0 +1,152 @@ +#pragma once + +#include "Common/Common.h" + +// ------------------------------------------------------------------------------------ +namespace PBD +{ + class XPBD + { + public: + // -------------- Distance constraint ----------------------------------------------------- + + /** Determine the position corrections for a distance constraint between two particles using XPBD:\n\n + * \f$C(\mathbf{p}_0, \mathbf{p}_1) = \| \mathbf{p}_0 - \mathbf{p}_1\| - l_0 = 0\f$\n\n + * More information can be found in the following papers: \cite Mueller07, \cite BMOT2013, \cite BMOTM2014, \cite BMM2015, \cite MMC16 + * + * @param p0 position of first particle + * @param invMass0 inverse mass of first particle + * @param p1 position of second particle + * @param invMass1 inverse mass of second particle + * @param restLength rest length of distance constraint + * @param stiffness stiffness coefficient + * @param dt Time step size + * @param lambda Lagrange multiplier (XPBD) + * @param corr0 position correction of first particle + * @param corr1 position correction of second particle + */ + static bool solve_DistanceConstraint( + const Vector3r &p0, Real invMass0, + const Vector3r &p1, Real invMass1, + const Real restLength, + const Real stiffness, + const Real dt, + Real& lambda, + Vector3r &corr0, Vector3r &corr1); + + /** Determine the position corrections for a constraint that conserves the volume + * of single tetrahedron. Such a constraint has the form + * \f{equation*}{ + * C(\mathbf{p}_1, \mathbf{p}_2, \mathbf{p}_3, \mathbf{p}_4) = \frac{1}{6} + * \left(\mathbf{p}_{2,1} \times \mathbf{p}_{3,1}\right) \cdot \mathbf{p}_{4,1} - V_0, + * \f} + * where \f$\mathbf{p}_1\f$, \f$\mathbf{p}_2\f$, \f$\mathbf{p}_3\f$ and \f$\mathbf{p}_4\f$ + * are the four corners of the tetrahedron and \f$V_0\f$ is its rest volume.\n\n + * More information can be found in the following papers: \cite Mueller07, \cite BMOT2013, \cite BMOTM2014, \cite BMM2015, + * + * @param p0 position of first particle + * @param invMass0 inverse mass of first particle + * @param p1 position of second particle + * @param invMass1 inverse mass of second particle + * @param p2 position of third particle + * @param invMass2 inverse mass of third particle + * @param p3 position of fourth particle + * @param invMass3 inverse mass of fourth particle + * @param restVolume rest angle \f$V_0\f$ + * @param stiffness stiffness coefficient + * @param dt Time step size + * @param lambda Lagrange multiplier (XPBD) + * @param corr0 position correction of first particle + * @param corr1 position correction of second particle + * @param corr2 position correction of third particle + * @param corr3 position correction of fourth particle + */ + static bool solve_VolumeConstraint( + const Vector3r& p0, Real invMass0, + const Vector3r& p1, Real invMass1, + const Vector3r& p2, Real invMass2, + const Vector3r& p3, Real invMass3, + const Real restVolume, + const Real stiffness, + const Real dt, + Real& lambda, + Vector3r& corr0, Vector3r& corr1, Vector3r& corr2, Vector3r& corr3); + + + // -------------- Isometric bending ----------------------------------------------------- + + /** Initialize the local stiffness matrix Q. The matrix is + * required by the solver step. It must only be recomputed + * if the rest shape changes. \n\n + * Bending is simulated for the angle on (p2, p3) between + * the triangles (p0, p2, p3) and (p1, p3, p2). + * + * @param p0 point 0 of stencil + * @param p1 point 1 of stencil + * @param p2 point 2 of stencil + * @param p3 point 3 of stencil + * @param Q returns the local stiffness matrix which is required by the solver + */ + static bool init_IsometricBendingConstraint( + const Vector3r& p0, + const Vector3r& p1, + const Vector3r& p2, + const Vector3r& p3, + Matrix4r& Q + ); + + /** Determine the position corrections for the isometric bending constraint using XPBD. + * This constraint can be used for almost inextensible surface models.\n\n + * More information can be found in: \cite BMM2015, \cite Bender2014 + * + * @param p0 position of first particle + * @param invMass0 inverse mass of first particle + * @param p1 position of second particle + * @param invMass1 inverse mass of second particle + * @param p2 position of third particle + * @param invMass2 inverse mass of third particle + * @param p3 position of fourth particle + * @param invMass3 inverse mass of fourth particle + * @param Q local stiffness matrix which must be initialized by calling init_IsometricBendingConstraint() + * @param stiffness stiffness coefficient for bending + * @param dt Time step size + * @param lambda Lagrange multiplier (XPBD) + * @param corr0 position correction of first particle + * @param corr1 position correction of second particle + * @param corr2 position correction of third particle + * @param corr3 position correction of fourth particle + */ + static bool solve_IsometricBendingConstraint( + const Vector3r& p0, Real invMass0, // angle on (p2, p3) between triangles (p0, p2, p3) and (p1, p3, p2) + const Vector3r& p1, Real invMass1, + const Vector3r& p2, Real invMass2, + const Vector3r& p3, Real invMass3, + const Matrix4r& Q, + const Real stiffness, + const Real dt, + Real& lambda, + Vector3r& corr0, Vector3r& corr1, Vector3r& corr2, Vector3r& corr3); + + + /** XPBD implementation of the finite element method described in \n\n + * Jan Bender, Dan Koschier, Patrick Charrier and Daniel Weber, \n + * "Position-Based Simulation of Continuous Materials", \n + * Computers & Graphics 44, 2014\n\n + * Solve the continuum mechanical constraint defined for a tetrahedron. + */ + static bool solve_FEMTetraConstraint( + const Vector3r& p0, Real invMass0, + const Vector3r& p1, Real invMass1, + const Vector3r& p2, Real invMass2, + const Vector3r& p3, Real invMass3, + const Real restVolume, + const Matrix3r& invRestMat, + const Real youngsModulus, + const Real poissonRatio, + const bool handleInversion, + const Real dt, + Real& lambda, + Vector3r& corr0, Vector3r& corr1, Vector3r& corr2, Vector3r& corr3); + }; +} + diff --git a/README.md b/README.md index 8c92a7f9..c39898bf 100644 --- a/README.md +++ b/README.md @@ -1,21 +1,70 @@ # PositionBasedDynamics +

            Documentation Status

+ This library supports the physically-based simulation of mechanical effects. In the last years position-based simulation methods have become popular in the graphics community. In contrast to classical simulation approaches these methods compute the position changes in each simulation step directly, based on the solution of a quasi-static problem. Therefore, position-based approaches are fast, stable and controllable which make them well-suited for use in interactive environments. However, these methods are generally not as accurate as force-based methods but still provide visual plausibility. Hence, the main application areas of position-based simulation are virtual reality, computer games and special effects in movies and commercials. -The PositionBasedDynamics library allows the position-based handling of many types of constraints in a physically-based simulation. The library uses [CMake](http://www.cmake.org/), [Eigen](http://eigen.tuxfamily.org/), [AntTweakBar](http://anttweakbar.sourceforge.net/) (only for the demos) and [Boost](http://www.boost.org/). All external dependencies (except Boost) are included. +The PositionBasedDynamics library allows the position-based handling of many types of constraints in a physically-based simulation. The library uses [CMake](http://www.cmake.org/), [Eigen](http://eigen.tuxfamily.org/), [json](https://github.com/nlohmann/json/), [pybind](https://github.com/pybind/pybind11), [glfw](https://www.glfw.org/), [hapPLY](https://github.com/nmwsharp/happly) and [imgui](https://github.com/ocornut/imgui) (only for the demos). All external dependencies are included. + +Furthermore we use our own library: +- [Discregrid](https://github.com/InteractiveComputerGraphics/Discregrid/) to generate cubic signed distance fields for the collision detection -The library was tested on Windows 7, OpenSuse Linux 13.2, Mac OS X 10.10.5. However, it should also be possible to use it on Mac OS X systems. **Author**: [Jan Bender](http://www.interactive-graphics.de), **License**: MIT +## News + +* We added a Python interface: [pyPBD](https://pypi.org/project/pyPBD/) +* Our new [paper](https://animation.rwth-aachen.de/publication/0557/) about a Direct Position-Based Solver for Stiff Rods uses the PositionBasedDynamics library. You can watch the video [here](https://www.youtube.com/watch?v=EFH9xt4omls). +* PBD now has a collision detection based on cubic signed distance fields +* SPlisHSPlasH is our new open-source fluid simulator which uses the PositionBasedDynamics library to handle rigid-fluid coupling. It can be downloaded here: +[https://github.com/InteractiveComputerGraphics/SPlisHSPlasH](https://github.com/InteractiveComputerGraphics/SPlisHSPlasH) +* Our new [paper](http://interactive-graphics.de/index.php/research/98-hierarchical-hp-adaptive-signed-distance-fields) about adaptive signed distance fields uses the PositionBasedDynamics library. You can watch the video [here](https://www.youtube.com/watch?v=x_Iq2yM4FcA). + ## Documentation -The API documentation can be found here: +The documentation can be found here: + +* [Documentation](https://positionbaseddynamics.readthedocs.io) + +## Forum + +On our [GitHub discussions](https://github.com/InteractiveComputerGraphics/PositionBasedDynamics/discussions) page you can ask questions, discuss about simulation topics, and share ideas. + +## Build Instructions + +This project is based on [CMake](https://cmake.org/). Simply generate project, Makefiles, etc. using [CMake](https://cmake.org/) and compile the project with the compiler of your choice. The code was tested with the following configurations: +- Windows 10 64-bit, CMake 3.9.5, Visual Studio 2019 +- Debian 9 64-bit, CMake 3.12.3, GCC 6.3.0. + +Note: Please use a 64-bit target on a 64-bit operating system. 32-bit builds on a 64-bit OS are not supported. -http://www.interactive-graphics.de/PositionBasedDynamics/doc/html +## Python Installation Instruction + +For Windows and Linux targets there exists prebuilt python wheel files which can be installed using + +``` +pip install pypbd +``` + +These are available for different Python Versions. See also here: [pyPBD](https://pypi.org/project/pyPBD/). +If you do not meet these conditions please refer to the build instructions and to the python binding +[Getting started guide](https://positionbaseddynamics.readthedocs.io/en/latest/py_getting_started.html). ## Latest Important Changes +* GUI is now based on [imgui](https://github.com/ocornut/imgui) +* added support of PLY files +* added Python binding +* added some XPBD constraints +* added OBJ export +* added substepping +* added DamperJoint +* improved implementation of slider and hinge joints/motors +* Crispin Deul added the implementation of his paper Deul, Kugelstadt, Weiler, Bender, "Direct Position-Based Solver for Stiff Rods", Computer Graphics Forum 2018 and a corresponding demo +* added collision detection for arbitrary meshes based on cubic signed distance fields +* added implementation of the paper Kugelstadt, Schoemer, "Position and Orientation Based Cosserat Rods", SCA 2016 +* removed Boost dependency * added SceneGenerator.py to generate new scenarios easily by simple Python scripting * added scene loader based on json * added collision detection based on distance functions @@ -24,37 +73,38 @@ http://www.interactive-graphics.de/PositionBasedDynamics/doc/html * added support for Mac OS X * added automatic computation of inertia tensor for arbitrary triangle meshes * added OBJ file loader -* added target velocity motor slider joint -* added target position motor slider joint -* added slider joint -* added target velocity motor hinge joint -* added target angle motor hinge joint * parallelized unified solver using graph coloring * implemented unified solver for rigid bodies and deformable solids -* added generic constraint + ## Features -* Physically-based simulation with position-based constraint handling. +* Physically-based simulation with (eXtended) position-based constraint handling. * Simple interface * Demos * Library is free even for commercial applications. +* Collision detection based on cubic signed distance fields * Library supports many constraints: + - Elastic rods: + - bend-twist constraint + - stretch-shear constraint + - Cosserat constraint - Deformable solids: - - point-point distance constraint + - point-point distance constraint (PBD & XPBD) - point-edge distance constraint - point-triangle distance constraint - edge-edge distance constraint - dihedral bending constraint - - isometric bending constraint - - volume constraint + - isometric bending constraint (PBD & XPBD) + - volume constraint (PBD & XPBD) - shape matching - FEM-based PBD (2D & 3D) - strain-based dynamics (2D & 3D) - Fluids: - position-based fluids - Rigid bodies: + - contact constraints - ball joint - ball-on-line-joint - hinge joint @@ -65,18 +115,33 @@ http://www.interactive-graphics.de/PositionBasedDynamics/doc/html - target position motor slider joint - target velocity motor slider joint - ball joint between rigid body and particle + - distance joint + - damper joint + - implicit spring - Generic constraints -## Screenshots - -![Cloth demo](http://www.interactive-graphics.de/j_images/PositionBasedDynamics.jpg "Cloth demo") +## Videos + +The following videos were generated using the PositionBasedDynamics library: + +*Hierarchical hp-Adaptive Signed Distance Fields* | *Direct Position-Based Solver for Stiff Rods* +:---:|:---: +[![Video](https://img.youtube.com/vi/x_Iq2yM4FcA/0.jpg)](https://www.youtube.com/watch?v=x_Iq2yM4FcA) | [![Video](https://img.youtube.com/vi/EFH9xt4omls/0.jpg)](https://www.youtube.com/watch?v=EFH9xt4omls) + + +## Screenshots + +|![](https://raw.githubusercontent.com/InteractiveComputerGraphics/PositionBasedDynamics/master/doc/images/PBD1.jpg)|![](https://raw.githubusercontent.com/InteractiveComputerGraphics/PositionBasedDynamics/master/doc/images/PBD2.jpg)| +|--|--| ## References * J. Bender, M. Müller and M. Macklin, "Position-Based Simulation Methods in Computer Graphics", In Tutorial Proceedings of Eurographics, 2015 * J. Bender, D. Koschier, P. Charrier and D. Weber, ""Position-based simulation of continuous materials", Computers & Graphics 44, 2014 * J. Bender, M. Müller, M. A. Otaduy, M. Teschner and M. Macklin, "A Survey on Position-Based Simulation Methods in Computer Graphics", Computer Graphics Forum 33, 6, 2014 +* C. Deul, T. Kugelstadt, M. Weiler, J. Bender, "Direct Position-Based Solver for Stiff Rods", Computer Graphics Forum, 2018 * C. Deul, P. Charrier and J. Bender, "Position-Based Rigid Body Dynamics", Computer Animation and Virtual Worlds, 2014 +* D. Koschier, C. Deul, M. Brand and J. Bender, "An hp-Adaptive Discretization Algorithm for Signed Distance Field Generation", IEEE Transactions on Visualization and Computer Graphics 23, 2017 * M. Macklin, M. Müller, N. Chentanez and T.Y. Kim, "Unified particle physics for real-time applications", ACM Trans. Graph. 33, 4, 2014 * M. Müller, N. Chentanez, T.Y. Kim, M. Macklin, "Strain based dynamics", In Proceedings of the 2014 ACM SIGGRAPH/Eurographics Symposium on Computer Animation, 2014 @@ -87,6 +152,9 @@ SIGGRAPH/Eurographics Symposium on Computer Animation, 2014 * M. Müller, B. Heidelberger, M. Hennix and J. Ratcliff, "Position based dynamics", Journal of Visual Communication and Image Representation 18, 2, 2007 * M. Müller, B. Heidelberger, M. Teschner and M. Gross, "Meshless deformations based on shape matching", ACM Trans. Graph. 24, 3, 2005 * M. Macklin and M. Müller, "Position based fluids", ACM Trans. Graph. 32, 4, 2013 +* Dan Koschier, Crispin Deul and Jan Bender, "Hierarchical hp-Adaptive Signed Distance Fields", In Proceedings of ACM SIGGRAPH / EUROGRAPHICS Symposium on Computer Animation (SCA), 2016 +* Tassilo Kugelstadt, Elmar Schoemer, "Position and Orientation Based Cosserat Rods", In Proceedings of ACM SIGGRAPH / EUROGRAPHICS Symposium on Computer Animation (SCA), 2016 +* M. Macklin, M. Müller and N. Chentanez, "XPBD: Position-based Simulation of Compliant Constrained Dynamics", Proceedings of the 9th International Conference on Motion in Games (MIG), 2016 diff --git a/Demos/Simulation/AABB.h b/Simulation/AABB.h similarity index 98% rename from Demos/Simulation/AABB.h rename to Simulation/AABB.h index 61aa268d..bf05c384 100644 --- a/Demos/Simulation/AABB.h +++ b/Simulation/AABB.h @@ -1,7 +1,6 @@ #ifndef __AABB_H__ #define __AABB_H__ -#include "Demos/Common/Config.h" #include "Common/Common.h" namespace PBD diff --git a/Simulation/BoundingSphere.h b/Simulation/BoundingSphere.h new file mode 100644 index 00000000..58915954 --- /dev/null +++ b/Simulation/BoundingSphere.h @@ -0,0 +1,302 @@ +#ifndef __BOUNDINGSPHERE_H__ +#define __BOUNDINGSPHERE_H__ + +#include "Common/Common.h" +#include + +namespace PBD +{ + /** + * \brief Computes smallest enclosing spheres of pointsets using Welzl's algorithm + * \Author: Tassilo Kugelstadt + */ + class BoundingSphere + { + public: + /** + * \brief default constructor sets the center and radius to zero. + */ + BoundingSphere() : m_x(Vector3r::Zero()), m_r(0.0) {} + + /** + * \brief constructor which sets the center and radius + * + * \param x 3d coordiantes of the center point + * \param r radius of the sphere + */ + BoundingSphere(Vector3r const& x, const Real r) : m_x(x), m_r(r) {} + + /** + * \brief constructs a sphere for one point (with radius 0) + * + * \param a 3d coordinates of point a + */ + BoundingSphere(const Vector3r& a) + { + m_x = a; + m_r = 0.0; + } + + /** + * \brief constructs the smallest enclosing sphere for two points + * + * \param a 3d coordinates of point a + * \param b 3d coordinates of point b + */ + BoundingSphere(const Vector3r& a, const Vector3r& b) + { + const Vector3r ba = b - a; + + m_x = (a + b) * static_cast(0.5); + m_r = static_cast(0.5) * ba.norm(); + } + + /** + * \brief constructs the smallest enclosing sphere for three points + * + * \param a 3d coordinates of point a + * \param b 3d coordinates of point b + * \param c 3d coordinates of point c + */ + BoundingSphere(const Vector3r& a, const Vector3r& b, const Vector3r& c) + { + const Vector3r ba = b - a; + const Vector3r ca = c - a; + const Vector3r baxca = ba.cross(ca); + Vector3r r; + Matrix3r T; + T << ba[0], ba[1], ba[2], + ca[0], ca[1], ca[2], + baxca[0], baxca[1], baxca[2]; + + r[0] = static_cast(0.5) * ba.squaredNorm(); + r[1] = static_cast(0.5) * ca.squaredNorm(); + r[2] = static_cast(0.0); + + m_x = T.inverse() * r; + m_r = m_x.norm(); + m_x += a; + } + + /** + * \brief constructs the smallest enclosing sphere for four points + * + * \param a 3d coordinates of point a + * \param b 3d coordinates of point b + * \param c 3d coordinates of point c + * \param d 3d coordinates of point d + */ + BoundingSphere(const Vector3r& a, const Vector3r& b, const Vector3r& c, const Vector3r& d) + { + const Vector3r ba = b - a; + const Vector3r ca = c - a; + const Vector3r da = d - a; + Vector3r r; + Matrix3r T; + T << ba[0], ba[1], ba[2], + ca[0], ca[1], ca[2], + da[0], da[1], da[2]; + + r[0] = static_cast(0.5) * ba.squaredNorm(); + r[1] = static_cast(0.5) * ca.squaredNorm(); + r[2] = static_cast(0.5) * da.squaredNorm(); + m_x = T.inverse() * r; + m_r = m_x.norm(); + m_x += a; + } + + /** + * \brief constructs the smallest enclosing sphere a given pointset + * + * \param p vertices of the points + */ + BoundingSphere(const std::vector& p) + { + m_r = 0; + m_x.setZero(); + setPoints(p); + } + + /** + * \brief Getter for the center of the sphere + * + * \return const reference of the sphere center + */ + Vector3r const& x() const { return m_x; } + + /** + * \brief Access function for center of the sphere + * + * \return reference of the sphere center + */ + Vector3r& x() { return m_x; } + + /** + * \brief Getter for the radius + * + * \return Radius of the sphere + */ + Real r() const { return m_r; } + + /** + * \brief Access function for the radius + * + * \return Reference to the radius of the sphere + */ + Real& r() { return m_r; } + + /** + * \brief constructs the smallest enclosing sphere a given pointset + * + * \param p vertices of the points + */ + void setPoints(const std::vector& p) + { + //remove duplicates + std::vector v(p); + std::sort(v.begin(), v.end(), [](const Vector3r& a, const Vector3r& b) + { + if (a[0] < b[0]) return true; + if (a[0] > b[0]) return false; + if (a[1] < b[1]) return true; + if (a[1] > b[1]) return false; + return (a[2] < b[2]); + }); + v.erase(std::unique(v.begin(), v.end(), [](Vector3r& a, Vector3r& b) { return a.isApprox(b); }), v.end()); + + Vector3r d; + const int n = int(v.size()); + + //generate random permutation of the points and permute the points by epsilon to avoid corner cases + const double epsilon = 1.0e-6; + for (int i = n - 1; i > 0; i--) + { + const Vector3r epsilon_vec = epsilon * Vector3r::Random(); + const int j = static_cast(floor(i * double(rand()) / RAND_MAX)); + d = v[i] + epsilon_vec; + v[i] = v[j] - epsilon_vec; + v[j] = d; + } + + BoundingSphere S = BoundingSphere(v[0], v[1]); + + for (int i = 2; i < n; i++) + { + //SES0 + d = v[i] - S.x(); + if (d.squaredNorm() > S.r()* S.r()) + S = ses1(i, v, v[i]); + } + + m_x = S.m_x; + m_r = S.m_r + static_cast(epsilon); //add epsilon to make sure that all non-pertubated points are inside the sphere + } + + /** + * \brief intersection test for two spheres + * + * \param other other sphere to be tested for intersection + * \return returns true when this sphere and the other sphere are intersecting + */ + bool overlaps(BoundingSphere const& other) const + { + double rr = m_r + other.m_r; + return (m_x - other.m_x).squaredNorm() < rr * rr; + } + + /** + * \brief tests whether the given sphere other is contained in the sphere + * + * \param other bounding sphere + * \return returns true when the other is contained in this sphere or vice versa + */ + bool contains(BoundingSphere const& other) const + { + double rr = r() - other.r(); + return (x() - other.x()).squaredNorm() < rr * rr; + } + + /** + * \brief tests whether the given point other is contained in the sphere + * + * \param other 3d coordinates of a point + * \return returns true when the point is contained in the sphere + */ + bool contains(Vector3r const& other) const + { + return (x() - other).squaredNorm() < m_r * m_r; + } + + private: + /** + * \brief constructs the smallest enclosing sphere for n points with the points q1, q2, and q3 on the surface of the sphere + * + * \param n number of points + * \param p vertices of the points + * \param q1 3d coordinates of a point on the surface + * \param q2 3d coordinates of a second point on the surface + * \param q3 3d coordinates of a third point on the surface + * \return smallest enclosing sphere + */ + BoundingSphere ses3(int n, std::vector& p, Vector3r& q1, Vector3r& q2, Vector3r& q3) + { + BoundingSphere S(q1, q2, q3); + + for (int i = 0; i < n; i++) + { + Vector3r d = p[i] - S.x(); + if (d.squaredNorm() > S.r()* S.r()) + S = BoundingSphere(q1, q2, q3, p[i]); + } + return S; + } + + /** + * \brief constructs the smallest enclosing sphere for n points with the points q1 and q2 on the surface of the sphere + * + * \param n number of points + * \param p vertices of the points + * \param q1 3d coordinates of a point on the surface + * \param q2 3d coordinates of a second point on the surface + * \return smallest enclosing sphere + */ + BoundingSphere ses2(int n, std::vector& p, Vector3r& q1, Vector3r& q2) + { + BoundingSphere S(q1, q2); + + for (int i = 0; i < n; i++) + { + Vector3r d = p[i] - S.x(); + if (d.squaredNorm() > S.r()* S.r()) + S = ses3(i, p, q1, q2, p[i]); + } + return S; + } + /** + * \brief constructs the smallest enclosing sphere for n points with the point q1 on the surface of the sphere + * + * \param n number of points + * \param p vertices of the points + * \param q1 3d coordinates of a point on the surface + * \return smallest enclosing sphere + */ + BoundingSphere ses1(int n, std::vector& p, Vector3r& q1) + { + BoundingSphere S(p[0], q1); + + for (int i = 1; i < n; i++) + { + Vector3r d = p[i] - S.x(); + if (d.squaredNorm() > S.r()* S.r()) + S = ses2(i, p, q1, p[i]); + } + return S; + } + + Vector3r m_x; + Real m_r; + }; + +} + +#endif diff --git a/Simulation/BoundingSphereHierarchy.cpp b/Simulation/BoundingSphereHierarchy.cpp new file mode 100644 index 00000000..1a0ce16b --- /dev/null +++ b/Simulation/BoundingSphereHierarchy.cpp @@ -0,0 +1,176 @@ + +#include "BoundingSphereHierarchy.h" + +#include +#include +#include + +using namespace Eigen; +using pool_set = std::set; +using namespace PBD; + + +PointCloudBSH::PointCloudBSH() + : super(0, 10) +{ +} + +Vector3r const& PointCloudBSH::entity_position(unsigned int i) const +{ + return m_vertices[i]; +} + +void PointCloudBSH::compute_hull(unsigned int b, unsigned int n, BoundingSphere& hull) const +{ + auto vertices_subset = std::vector(n); + for (unsigned int i=b; i < b+n; ++i) + vertices_subset[i-b] = m_vertices[m_lst[i]]; + + const BoundingSphere s(vertices_subset); + + hull.x() = s.x(); + hull.r() = s.r(); +} + +void PointCloudBSH::compute_hull_approx(unsigned int b, unsigned int n, BoundingSphere& hull) const +{ + // compute center + Vector3r x; + x.setZero(); + for (unsigned int i = b; i < b+n; i++) + x += m_vertices[m_lst[i]]; + x /= (Real)n; + + Real radius2 = 0.0; + for (unsigned int i = b; i < b+n; i++) + { + radius2 = std::max(radius2, (x - m_vertices[m_lst[i]]).squaredNorm()); + } + + hull.x() = x; + hull.r() = sqrt(radius2); +} + +void PointCloudBSH::init(const Vector3r *vertices, const unsigned int numVertices) +{ + m_lst.resize(numVertices); + m_vertices = vertices; + m_numVertices = numVertices; +} + +////////////////////////////////////////////////////////////////////////// + + +TetMeshBSH::TetMeshBSH() + : super(0) +{ +} + +Vector3r const& TetMeshBSH::entity_position(unsigned int i) const +{ + return m_com[i]; +} + +void TetMeshBSH::compute_hull(unsigned int b, unsigned int n, BoundingSphere& hull) const +{ + compute_hull_approx(b, n, hull); +} + +void TetMeshBSH::compute_hull_approx(unsigned int b, unsigned int n, BoundingSphere& hull) const +{ + // compute center + Vector3r x; + x.setZero(); + for (unsigned int i = b; i < b + n; i++) + { + const unsigned int tet = m_lst[i]; + x += m_vertices[m_indices[4 * tet]]; + x += m_vertices[m_indices[4 * tet + 1]]; + x += m_vertices[m_indices[4 * tet + 2]]; + x += m_vertices[m_indices[4 * tet + 3]]; + } + x /= ((Real)4.0* (Real)n); + + Real radius2 = 0.0; + for (unsigned int i = b; i < b + n; i++) + { + const unsigned int tet = m_lst[i]; + radius2 = std::max(radius2, (x - m_vertices[m_indices[4 * tet]]).squaredNorm()); + radius2 = std::max(radius2, (x - m_vertices[m_indices[4 * tet+1]]).squaredNorm()); + radius2 = std::max(radius2, (x - m_vertices[m_indices[4 * tet+2]]).squaredNorm()); + radius2 = std::max(radius2, (x - m_vertices[m_indices[4 * tet+3]]).squaredNorm()); + } + + hull.x() = x; + hull.r() = sqrt(radius2) + m_tolerance; +} + +void TetMeshBSH::init(const Vector3r *vertices, const unsigned int numVertices, const unsigned int *indices, const unsigned int numTets, const Real tolerance) +{ + m_lst.resize(numTets); + m_vertices = vertices; + m_numVertices = numVertices; + m_indices = indices; + m_numTets = numTets; + m_tolerance = tolerance; + m_com.resize(numTets); + for (unsigned int i = 0; i < numTets; i++) + { + m_com[i] = 0.25 * (m_vertices[m_indices[4*i]] + m_vertices[m_indices[4*i+1]] + m_vertices[m_indices[4*i+2]] + m_vertices[m_indices[4*i+3]]); + } +} + +void TetMeshBSH::updateVertices(const Vector3r* vertices) +{ + m_vertices = vertices; +} + + +void BVHTest::traverse(PointCloudBSH const& b1, TetMeshBSH const& b2, TraversalCallback func) +{ + traverse(b1, 0, b2, 0, func); +} + +void BVHTest::traverse(PointCloudBSH const& b1, const unsigned int node_index1, TetMeshBSH const& b2, const unsigned int node_index2, TraversalCallback func) +{ + const BoundingSphere &bs1 = b1.hull(node_index1); + const BoundingSphere &bs2 = b2.hull(node_index2); + if (!bs1.overlaps(bs2)) + return; + + auto const& node1 = b1.node(node_index1); + auto const& node2 = b2.node(node_index2); + if (node1.is_leaf() && node2.is_leaf()) + { + func(node_index1, node_index2); + return; + } + + if (bs1.r() < bs2.r()) + { + if (!node1.is_leaf()) + { + traverse(b1, node1.children[0], b2, node_index2, func); + traverse(b1, node1.children[1], b2, node_index2, func); + } + else + { + traverse(b1, node_index1, b2, node2.children[0], func); + traverse(b1, node_index1, b2, node2.children[1], func); + } + } + else + { + if (!node2.is_leaf()) + { + traverse(b1, node_index1, b2, node2.children[0], func); + traverse(b1, node_index1, b2, node2.children[1], func); + } + else + { + traverse(b1, node1.children[0], b2, node_index2, func); + traverse(b1, node1.children[1], b2, node_index2, func); + } + } + +} \ No newline at end of file diff --git a/Simulation/BoundingSphereHierarchy.h b/Simulation/BoundingSphereHierarchy.h new file mode 100644 index 00000000..86e1714f --- /dev/null +++ b/Simulation/BoundingSphereHierarchy.h @@ -0,0 +1,68 @@ +#ifndef __BOUNDINGSPHEREHIERARCHY_H__ +#define __BOUNDINGSPHEREHIERARCHY_H__ + +#include "Common/Common.h" +#include "BoundingSphere.h" +#include "kdTree.h" + +namespace PBD +{ + class PointCloudBSH : public KDTree + { + + public: + + using super = KDTree; + + PointCloudBSH(); + + void init(const Vector3r *vertices, const unsigned int numVertices); + Vector3r const& entity_position(unsigned int i) const final; + void compute_hull(unsigned int b, unsigned int n, BoundingSphere& hull) + const final; + void compute_hull_approx(unsigned int b, unsigned int n, BoundingSphere& hull) + const final; + + private: + const Vector3r *m_vertices; + unsigned int m_numVertices; + }; + + + class TetMeshBSH : public KDTree + { + + public: + + using super = KDTree; + + TetMeshBSH(); + + void init(const Vector3r *vertices, const unsigned int numVertices, const unsigned int *indices, const unsigned int numTets, const Real tolerance); + Vector3r const& entity_position(unsigned int i) const final; + void compute_hull(unsigned int b, unsigned int n, BoundingSphere& hull) + const final; + void compute_hull_approx(unsigned int b, unsigned int n, BoundingSphere& hull) + const final; + void updateVertices(const Vector3r* vertices); + + private: + const Vector3r *m_vertices; + unsigned int m_numVertices; + const unsigned int *m_indices; + unsigned int m_numTets; + Real m_tolerance; + std::vector m_com; + }; + + class BVHTest + { + public: + using TraversalCallback = std::function ; + + static void traverse(PointCloudBSH const& b1, TetMeshBSH const& b2, TraversalCallback func); + static void traverse(PointCloudBSH const& b1, const unsigned int node_index1, TetMeshBSH const& b2, const unsigned int node_index2, TraversalCallback func); + }; +} + +#endif diff --git a/Simulation/CMakeLists.txt b/Simulation/CMakeLists.txt new file mode 100644 index 00000000..41d0f62f --- /dev/null +++ b/Simulation/CMakeLists.txt @@ -0,0 +1,75 @@ +add_library(Simulation + AABB.h + CollisionDetection.cpp + CollisionDetection.h + Constraints.cpp + Constraints.h + CubicSDFCollisionDetection.cpp + CubicSDFCollisionDetection.h + DistanceFieldCollisionDetection.cpp + DistanceFieldCollisionDetection.h + IDFactory.cpp + IDFactory.h + LineModel.cpp + LineModel.h + NeighborhoodSearchSpatialHashing.cpp + NeighborhoodSearchSpatialHashing.h + ParticleData.h + RigidBody.h + RigidBodyGeometry.cpp + RigidBodyGeometry.h + Simulation.cpp + Simulation.h + SimulationModel.cpp + SimulationModel.h + TetModel.cpp + TetModel.h + TimeManager.cpp + TimeManager.h + TimeStep.cpp + TimeStep.h + TimeStepController.cpp + TimeStepController.h + TriangleModel.cpp + TriangleModel.h + + BoundingSphere.h + BoundingSphereHierarchy.cpp + BoundingSphereHierarchy.h + kdTree.h + kdTree.inl + + CMakeLists.txt +) + +############################################################ +# Discregrid +############################################################ +target_include_directories(Simulation PUBLIC ${Discregrid_INCLUDE_DIR}) +if (TARGET Ext_Discregrid) + add_dependencies(Simulation Ext_Discregrid) +endif() + + +############################################################ +# GenericParameters +############################################################ +target_include_directories(Simulation PUBLIC ${GenericParameters_INCLUDE_DIR}) +if(TARGET Ext_GenericParameters) + add_dependencies(Simulation Ext_GenericParameters) +endif() + +find_package( Eigen3 REQUIRED ) +target_include_directories(Simulation PUBLIC ${EIGEN3_INCLUDE_DIR} ) + +target_link_libraries(Simulation PUBLIC PositionBasedDynamics) + + +install(TARGETS Simulation + RUNTIME DESTINATION bin + LIBRARY DESTINATION lib + ARCHIVE DESTINATION lib) + +install(DIRECTORY . +DESTINATION include/Simulation +FILES_MATCHING PATTERN "*.h" PATTERN "*.inl") \ No newline at end of file diff --git a/Demos/Simulation/CollisionDetection.cpp b/Simulation/CollisionDetection.cpp similarity index 65% rename from Demos/Simulation/CollisionDetection.cpp rename to Simulation/CollisionDetection.cpp index 0b3fbbfe..7537b90c 100644 --- a/Demos/Simulation/CollisionDetection.cpp +++ b/Simulation/CollisionDetection.cpp @@ -1,17 +1,28 @@ #include "CollisionDetection.h" -#include "Demos/Simulation/IDFactory.h" +#include "Simulation/IDFactory.h" using namespace PBD; +using namespace Utilities; +using namespace GenParam; + +int CollisionDetection::CONTACT_TOLERANCE = -1; int CollisionDetection::CollisionObjectWithoutGeometry::TYPE_ID = IDFactory::getId(); +const unsigned int CollisionDetection::RigidBodyContactType = 0; +const unsigned int CollisionDetection::ParticleContactType = 1; +const unsigned int CollisionDetection::ParticleRigidBodyContactType = 2; +const unsigned int CollisionDetection::ParticleSolidContactType = 3; +const unsigned int CollisionDetection::CollisionObject::RigidBodyCollisionObjectType = 0; +const unsigned int CollisionDetection::CollisionObject::TriangleModelCollisionObjectType = 1; +const unsigned int CollisionDetection::CollisionObject::TetModelCollisionObjectType = 2; -CollisionDetection::CollisionDetection() : - m_collisionObjects() +CollisionDetection::CollisionDetection() : m_collisionObjects() { m_collisionObjects.reserve(1000); m_contactCB = NULL; - m_tolerance = 0.01; + m_solidContactCB = NULL; + m_tolerance = static_cast(0.01); } CollisionDetection::~CollisionDetection() @@ -19,6 +30,22 @@ CollisionDetection::~CollisionDetection() cleanup(); } + +void CollisionDetection::init() +{ + initParameters(); +} + +void CollisionDetection::initParameters() +{ + ParameterObject::initParameters(); + + CONTACT_TOLERANCE = createNumericParameter("contactTolerance", "Contact tolerance", &m_tolerance); + setGroup(CONTACT_TOLERANCE, "Simulation|Contact"); + setDescription(CONTACT_TOLERANCE, "Tolerance of the collision detection"); + static_cast*>(getParameter(CONTACT_TOLERANCE))->setMinValue(0.0); +} + void CollisionDetection::cleanup() { for (unsigned int i = 0; i < m_collisionObjects.size(); i++) @@ -27,23 +54,31 @@ void CollisionDetection::cleanup() } void CollisionDetection::addRigidBodyContact(const unsigned int rbIndex1, const unsigned int rbIndex2, - const Vector3r &cp1, const Vector3r &cp2, - const Vector3r &normal, const Real dist, - const Real restitutionCoeff, const Real frictionCoeff) + const Vector3r &cp1, const Vector3r &cp2, + const Vector3r &normal, const Real dist, + const Real restitutionCoeff, const Real frictionCoeff) { if (m_contactCB) m_contactCB(RigidBodyContactType, rbIndex1, rbIndex2, cp1, cp2, normal, dist, restitutionCoeff, frictionCoeff, m_contactCBUserData); } void CollisionDetection::addParticleRigidBodyContact(const unsigned int particleIndex, const unsigned int rbIndex, - const Vector3r &cp1, const Vector3r &cp2, - const Vector3r &normal, const Real dist, - const Real restitutionCoeff, const Real frictionCoeff) + const Vector3r &cp1, const Vector3r &cp2, + const Vector3r &normal, const Real dist, + const Real restitutionCoeff, const Real frictionCoeff) { if (m_contactCB) m_contactCB(ParticleRigidBodyContactType, particleIndex, rbIndex, cp1, cp2, normal, dist, restitutionCoeff, frictionCoeff, m_contactCBUserData); } +void CollisionDetection::addParticleSolidContact(const unsigned int particleIndex, const unsigned int solidIndex, + const unsigned int tetIndex, const Vector3r &bary, const Vector3r &cp1, const Vector3r &cp2, + const Vector3r &normal, const Real dist, const Real restitutionCoeff, const Real frictionCoeff) +{ + if (m_solidContactCB) + m_solidContactCB(ParticleSolidContactType, particleIndex, solidIndex, tetIndex, bary, cp1, cp2, normal, dist, restitutionCoeff, frictionCoeff, m_contactCBUserData); +} + void CollisionDetection::addCollisionObject(const unsigned int bodyIndex, const unsigned int bodyType) { CollisionObjectWithoutGeometry *co = new CollisionObjectWithoutGeometry(); @@ -58,6 +93,12 @@ void CollisionDetection::setContactCallback(CollisionDetection::ContactCallbackF m_contactCBUserData = userData; } +void CollisionDetection::setSolidContactCallback(CollisionDetection::SolidContactCallbackFunction val, void *userData) +{ + m_solidContactCB = val; + m_solidContactCBUserData = userData; +} + void CollisionDetection::updateAABBs(SimulationModel &model) { const SimulationModel::RigidBodyVector &rigidBodies = model.getRigidBodies(); @@ -145,4 +186,4 @@ void CollisionDetection::updateAABB(const Vector3r &p, AABB &aabb) aabb.m_p[1][1] = p[1]; if (aabb.m_p[1][2] < p[2]) aabb.m_p[1][2] = p[2]; -} \ No newline at end of file +} diff --git a/Simulation/CollisionDetection.h b/Simulation/CollisionDetection.h new file mode 100644 index 00000000..33d1b112 --- /dev/null +++ b/Simulation/CollisionDetection.h @@ -0,0 +1,104 @@ +#ifndef _COLLISIONDETECTION_H +#define _COLLISIONDETECTION_H + +#include "Common/Common.h" +#include "SimulationModel.h" +#include "AABB.h" +#include "ParameterObject.h" + +namespace PBD +{ + class CollisionDetection : public GenParam::ParameterObject + { + public: + static int CONTACT_TOLERANCE; + + static const unsigned int RigidBodyContactType; // = 0; + static const unsigned int ParticleContactType; // = 1; + static const unsigned int ParticleRigidBodyContactType; // = 2; + static const unsigned int ParticleSolidContactType; // = 3; + + typedef void (*ContactCallbackFunction)(const unsigned int contactType, const unsigned int bodyIndex1, const unsigned int bodyIndex2, + const Vector3r &cp1, const Vector3r &cp2, + const Vector3r &normal, const Real dist, + const Real restitutionCoeff, const Real frictionCoeff, void *userData); + + typedef void (*SolidContactCallbackFunction)(const unsigned int contactType, const unsigned int bodyIndex1, const unsigned int bodyIndex2, + const unsigned int tetIndex, const Vector3r &bary, + const Vector3r &cp1, const Vector3r &cp2, + const Vector3r &normal, const Real dist, + const Real restitutionCoeff, const Real frictionCoeff, void *userData); + + struct CollisionObject + { + static const unsigned int RigidBodyCollisionObjectType; // = 0; + static const unsigned int TriangleModelCollisionObjectType; // = 1; + static const unsigned int TetModelCollisionObjectType; // = 2; + + AABB m_aabb; + unsigned int m_bodyIndex; + unsigned int m_bodyType; + + virtual ~CollisionObject() {} + virtual int &getTypeId() const = 0; + }; + + struct CollisionObjectWithoutGeometry : public CollisionObject + { + static int TYPE_ID; + virtual int &getTypeId() const { return TYPE_ID; } + virtual ~CollisionObjectWithoutGeometry() {} + }; + + protected: + Real m_tolerance; + ContactCallbackFunction m_contactCB; + SolidContactCallbackFunction m_solidContactCB; + void *m_contactCBUserData; + void *m_solidContactCBUserData; + std::vector m_collisionObjects; + + void updateAABB(const Vector3r &p, AABB &aabb); + virtual void initParameters(); + + public: + CollisionDetection(); + virtual ~CollisionDetection(); + + void init(); + + void cleanup(); + + Real getTolerance() const { return m_tolerance; } + void setTolerance(Real val) { m_tolerance = val; } + + void addRigidBodyContact(const unsigned int rbIndex1, const unsigned int rbIndex2, + const Vector3r &cp1, const Vector3r &cp2, + const Vector3r &normal, const Real dist, + const Real restitutionCoeff, const Real frictionCoeff); + + void addParticleRigidBodyContact(const unsigned int particleIndex, const unsigned int rbIndex, + const Vector3r &cp1, const Vector3r &cp2, + const Vector3r &normal, const Real dist, + const Real restitutionCoeff, const Real frictionCoeff); + + void addParticleSolidContact(const unsigned int particleIndex, const unsigned int solidIndex, + const unsigned int tetIndex, const Vector3r &bary, + const Vector3r &cp1, const Vector3r &cp2, + const Vector3r &normal, const Real dist, + const Real restitutionCoeff, const Real frictionCoeff); + + virtual void addCollisionObject(const unsigned int bodyIndex, const unsigned int bodyType); + + std::vector &getCollisionObjects() { return m_collisionObjects; } + + virtual void collisionDetection(SimulationModel &model) = 0; + + void setContactCallback(CollisionDetection::ContactCallbackFunction val, void *userData); + void setSolidContactCallback(CollisionDetection::SolidContactCallbackFunction val, void *userData); + void updateAABBs(SimulationModel &model); + void updateAABB(SimulationModel &model, CollisionDetection::CollisionObject *co); + }; +} + +#endif diff --git a/Demos/Simulation/Constraints.cpp b/Simulation/Constraints.cpp similarity index 53% rename from Demos/Simulation/Constraints.cpp rename to Simulation/Constraints.cpp index 9c7aebfa..bfe65737 100644 --- a/Demos/Simulation/Constraints.cpp +++ b/Simulation/Constraints.cpp @@ -1,9 +1,15 @@ #include "Constraints.h" #include "SimulationModel.h" #include "PositionBasedDynamics/PositionBasedDynamics.h" +#include "PositionBasedDynamics/XPBD.h" #include "PositionBasedDynamics/PositionBasedRigidBodyDynamics.h" #include "TimeManager.h" -#include "Demos/Simulation/IDFactory.h" +#include "Simulation/IDFactory.h" +#include "PositionBasedDynamics/PositionBasedElasticRods.h" + + +#include +#include using namespace PBD; @@ -13,13 +19,19 @@ int BallOnLineJoint::TYPE_ID = IDFactory::getId(); int HingeJoint::TYPE_ID = IDFactory::getId(); int UniversalJoint::TYPE_ID = IDFactory::getId(); int RigidBodyParticleBallJoint::TYPE_ID = IDFactory::getId(); +int RigidBodySpring::TYPE_ID = IDFactory::getId(); +int DistanceJoint::TYPE_ID = IDFactory::getId(); int DistanceConstraint::TYPE_ID = IDFactory::getId(); +int DistanceConstraint_XPBD::TYPE_ID = IDFactory::getId(); int DihedralConstraint::TYPE_ID = IDFactory::getId(); int IsometricBendingConstraint::TYPE_ID = IDFactory::getId(); +int IsometricBendingConstraint_XPBD::TYPE_ID = IDFactory::getId(); int FEMTriangleConstraint::TYPE_ID = IDFactory::getId(); int StrainTriangleConstraint::TYPE_ID = IDFactory::getId(); int VolumeConstraint::TYPE_ID = IDFactory::getId(); +int VolumeConstraint_XPBD::TYPE_ID = IDFactory::getId(); int FEMTetConstraint::TYPE_ID = IDFactory::getId(); +int XPBD_FEMTetConstraint::TYPE_ID = IDFactory::getId(); int StrainTetConstraint::TYPE_ID = IDFactory::getId(); int ShapeMatchingConstraint::TYPE_ID = IDFactory::getId(); int TargetAngleMotorHingeJoint::TYPE_ID = IDFactory::getId(); @@ -27,8 +39,14 @@ int TargetVelocityMotorHingeJoint::TYPE_ID = IDFactory::getId(); int SliderJoint::TYPE_ID = IDFactory::getId(); int TargetPositionMotorSliderJoint::TYPE_ID = IDFactory::getId(); int TargetVelocityMotorSliderJoint::TYPE_ID = IDFactory::getId(); +int DamperJoint::TYPE_ID = IDFactory::getId(); int RigidBodyContactConstraint::TYPE_ID = IDFactory::getId(); int ParticleRigidBodyContactConstraint::TYPE_ID = IDFactory::getId(); +int ParticleTetContactConstraint::TYPE_ID = IDFactory::getId(); +int StretchShearConstraint::TYPE_ID = IDFactory::getId(); +int BendTwistConstraint::TYPE_ID = IDFactory::getId(); +int StretchBendingTwistingConstraint::TYPE_ID = IDFactory::getId(); +int DirectPositionBasedSolverForStiffRodsConstraint::TYPE_ID = IDFactory::getId(); ////////////////////////////////////////////////////////////////////////// // BallJoint @@ -62,7 +80,7 @@ bool BallJoint::updateConstraint(SimulationModel &model) m_jointInfo); } -bool BallJoint::solvePositionConstraint(SimulationModel &model) +bool BallJoint::solvePositionConstraint(SimulationModel &model, const unsigned int iter) { SimulationModel::RigidBodyVector &rb = model.getRigidBodies(); @@ -139,7 +157,7 @@ bool BallOnLineJoint::updateConstraint(SimulationModel &model) m_jointInfo); } -bool BallOnLineJoint::solvePositionConstraint(SimulationModel &model) +bool BallOnLineJoint::solvePositionConstraint(SimulationModel &model, const unsigned int iter) { SimulationModel::RigidBodyVector &rb = model.getRigidBodies(); @@ -216,7 +234,7 @@ bool HingeJoint::updateConstraint(SimulationModel &model) m_jointInfo); } -bool HingeJoint::solvePositionConstraint(SimulationModel &model) +bool HingeJoint::solvePositionConstraint(SimulationModel &model, const unsigned int iter) { SimulationModel::RigidBodyVector &rb = model.getRigidBodies(); @@ -295,7 +313,7 @@ bool UniversalJoint::updateConstraint(SimulationModel &model) m_jointInfo); } -bool UniversalJoint::solvePositionConstraint(SimulationModel &model) +bool UniversalJoint::solvePositionConstraint(SimulationModel &model, const unsigned int iter) { SimulationModel::RigidBodyVector &rb = model.getRigidBodies(); @@ -343,7 +361,7 @@ bool UniversalJoint::solvePositionConstraint(SimulationModel &model) ////////////////////////////////////////////////////////////////////////// // SliderJoint ////////////////////////////////////////////////////////////////////////// -bool SliderJoint::initConstraint(SimulationModel &model, const unsigned int rbIndex1, const unsigned int rbIndex2, const Vector3r &pos, const Vector3r &axis) +bool SliderJoint::initConstraint(SimulationModel &model, const unsigned int rbIndex1, const unsigned int rbIndex2, const Vector3r &axis) { m_bodies[0] = rbIndex1; m_bodies[1] = rbIndex2; @@ -355,7 +373,7 @@ bool SliderJoint::initConstraint(SimulationModel &model, const unsigned int rbIn rb1.getRotation(), rb2.getPosition(), rb2.getRotation(), - pos, axis, + axis, m_jointInfo); } @@ -372,7 +390,7 @@ bool SliderJoint::updateConstraint(SimulationModel &model) m_jointInfo); } -bool SliderJoint::solvePositionConstraint(SimulationModel &model) +bool SliderJoint::solvePositionConstraint(SimulationModel &model, const unsigned int iter) { SimulationModel::RigidBodyVector &rb = model.getRigidBodies(); @@ -420,7 +438,7 @@ bool SliderJoint::solvePositionConstraint(SimulationModel &model) ////////////////////////////////////////////////////////////////////////// // TargetPositionMotorSliderJoint ////////////////////////////////////////////////////////////////////////// -bool TargetPositionMotorSliderJoint::initConstraint(SimulationModel &model, const unsigned int rbIndex1, const unsigned int rbIndex2, const Vector3r &pos, const Vector3r &axis) +bool TargetPositionMotorSliderJoint::initConstraint(SimulationModel &model, const unsigned int rbIndex1, const unsigned int rbIndex2, const Vector3r &axis) { m_bodies[0] = rbIndex1; m_bodies[1] = rbIndex2; @@ -432,7 +450,7 @@ bool TargetPositionMotorSliderJoint::initConstraint(SimulationModel &model, cons rb1.getRotation(), rb2.getPosition(), rb2.getRotation(), - pos, axis, + axis, m_jointInfo); } @@ -449,7 +467,7 @@ bool TargetPositionMotorSliderJoint::updateConstraint(SimulationModel &model) m_jointInfo); } -bool TargetPositionMotorSliderJoint::solvePositionConstraint(SimulationModel &model) +bool TargetPositionMotorSliderJoint::solvePositionConstraint(SimulationModel &model, const unsigned int iter) { SimulationModel::RigidBodyVector &rb = model.getRigidBodies(); @@ -467,7 +485,7 @@ bool TargetPositionMotorSliderJoint::solvePositionConstraint(SimulationModel &mo rb2.getPosition(), rb2.getInertiaTensorInverseW(), rb2.getRotation(), - m_targetPosition, + m_target, m_jointInfo, corr_x1, corr_q1, @@ -499,7 +517,7 @@ bool TargetPositionMotorSliderJoint::solvePositionConstraint(SimulationModel &mo ////////////////////////////////////////////////////////////////////////// // TargetVelocityMotorSliderJoint ////////////////////////////////////////////////////////////////////////// -bool TargetVelocityMotorSliderJoint::initConstraint(SimulationModel &model, const unsigned int rbIndex1, const unsigned int rbIndex2, const Vector3r &pos, const Vector3r &axis) +bool TargetVelocityMotorSliderJoint::initConstraint(SimulationModel &model, const unsigned int rbIndex1, const unsigned int rbIndex2, const Vector3r &axis) { m_bodies[0] = rbIndex1; m_bodies[1] = rbIndex2; @@ -511,7 +529,7 @@ bool TargetVelocityMotorSliderJoint::initConstraint(SimulationModel &model, cons rb1.getRotation(), rb2.getPosition(), rb2.getRotation(), - pos, axis, + axis, m_jointInfo); } @@ -528,7 +546,7 @@ bool TargetVelocityMotorSliderJoint::updateConstraint(SimulationModel &model) m_jointInfo); } -bool TargetVelocityMotorSliderJoint::solvePositionConstraint(SimulationModel &model) +bool TargetVelocityMotorSliderJoint::solvePositionConstraint(SimulationModel &model, const unsigned int iter) { SimulationModel::RigidBodyVector &rb = model.getRigidBodies(); @@ -573,7 +591,7 @@ bool TargetVelocityMotorSliderJoint::solvePositionConstraint(SimulationModel &mo } -bool TargetVelocityMotorSliderJoint::solveVelocityConstraint(SimulationModel &model) +bool TargetVelocityMotorSliderJoint::solveVelocityConstraint(SimulationModel &model, const unsigned int iter) { SimulationModel::RigidBodyVector &rb = model.getRigidBodies(); @@ -587,13 +605,15 @@ bool TargetVelocityMotorSliderJoint::solveVelocityConstraint(SimulationModel &mo rb1.getPosition(), rb1.getVelocity(), rb1.getInertiaTensorInverseW(), + rb1.getRotation(), rb1.getAngularVelocity(), rb2.getInvMass(), rb2.getPosition(), rb2.getVelocity(), rb2.getInertiaTensorInverseW(), + rb2.getRotation(), rb2.getAngularVelocity(), - m_targetVelocity, + m_target, m_jointInfo, corr_v1, corr_omega1, @@ -648,7 +668,7 @@ bool TargetAngleMotorHingeJoint::updateConstraint(SimulationModel &model) m_jointInfo); } -bool TargetAngleMotorHingeJoint::solvePositionConstraint(SimulationModel &model) +bool TargetAngleMotorHingeJoint::solvePositionConstraint(SimulationModel &model, const unsigned int iter) { SimulationModel::RigidBodyVector &rb = model.getRigidBodies(); @@ -666,7 +686,7 @@ bool TargetAngleMotorHingeJoint::solvePositionConstraint(SimulationModel &model) rb2.getPosition(), rb2.getInertiaTensorInverseW(), rb2.getRotation(), - m_targetAngle, + m_target, m_jointInfo, corr_x1, corr_q1, @@ -725,7 +745,7 @@ bool TargetVelocityMotorHingeJoint::updateConstraint(SimulationModel &model) m_jointInfo); } -bool TargetVelocityMotorHingeJoint::solvePositionConstraint(SimulationModel &model) +bool TargetVelocityMotorHingeJoint::solvePositionConstraint(SimulationModel &model, const unsigned int iter) { SimulationModel::RigidBodyVector &rb = model.getRigidBodies(); @@ -769,7 +789,7 @@ bool TargetVelocityMotorHingeJoint::solvePositionConstraint(SimulationModel &mod return res; } -bool TargetVelocityMotorHingeJoint::solveVelocityConstraint(SimulationModel &model) +bool TargetVelocityMotorHingeJoint::solveVelocityConstraint(SimulationModel &model, const unsigned int iter) { SimulationModel::RigidBodyVector &rb = model.getRigidBodies(); @@ -789,7 +809,7 @@ bool TargetVelocityMotorHingeJoint::solveVelocityConstraint(SimulationModel &mod rb2.getVelocity(), rb2.getInertiaTensorInverseW(), rb2.getAngularVelocity(), - m_targetAngularVelocity, + m_target, m_jointInfo, corr_v1, corr_omega1, @@ -812,6 +832,93 @@ bool TargetVelocityMotorHingeJoint::solveVelocityConstraint(SimulationModel &mod return res; } + +////////////////////////////////////////////////////////////////////////// +// DamperJoint +////////////////////////////////////////////////////////////////////////// +bool DamperJoint::initConstraint(SimulationModel &model, const unsigned int rbIndex1, const unsigned int rbIndex2, const Vector3r &axis, const Real stiffness) +{ + m_stiffness = stiffness; + m_lambda = 0.0; + m_bodies[0] = rbIndex1; + m_bodies[1] = rbIndex2; + SimulationModel::RigidBodyVector &rb = model.getRigidBodies(); + RigidBody &rb1 = *rb[m_bodies[0]]; + RigidBody &rb2 = *rb[m_bodies[1]]; + return PositionBasedRigidBodyDynamics::init_DamperJoint( + rb1.getPosition(), + rb1.getRotation(), + rb2.getPosition(), + rb2.getRotation(), + axis, + m_jointInfo); +} + +bool DamperJoint::updateConstraint(SimulationModel &model) +{ + SimulationModel::RigidBodyVector &rb = model.getRigidBodies(); + RigidBody &rb1 = *rb[m_bodies[0]]; + RigidBody &rb2 = *rb[m_bodies[1]]; + return PositionBasedRigidBodyDynamics::update_DamperJoint( + rb1.getPosition(), + rb1.getRotation(), + rb2.getPosition(), + rb2.getRotation(), + m_jointInfo); +} + +bool DamperJoint::solvePositionConstraint(SimulationModel &model, const unsigned int iter) +{ + SimulationModel::RigidBodyVector &rb = model.getRigidBodies(); + + RigidBody &rb1 = *rb[m_bodies[0]]; + RigidBody &rb2 = *rb[m_bodies[1]]; + + const Real dt = TimeManager::getCurrent()->getTimeStepSize(); + + if (iter == 0) + m_lambda = 0.0; + + Vector3r corr_x1, corr_x2; + Quaternionr corr_q1, corr_q2; + const bool res = PositionBasedRigidBodyDynamics::solve_DamperJoint( + rb1.getInvMass(), + rb1.getPosition(), + rb1.getInertiaTensorInverseW(), + rb1.getRotation(), + rb2.getInvMass(), + rb2.getPosition(), + rb2.getInertiaTensorInverseW(), + rb2.getRotation(), + m_stiffness, + dt, + m_jointInfo, + m_lambda, + corr_x1, + corr_q1, + corr_x2, + corr_q2); + + if (res) + { + if (rb1.getMass() != 0.0) + { + rb1.getPosition() += corr_x1; + rb1.getRotation().coeffs() += corr_q1.coeffs(); + rb1.getRotation().normalize(); + rb1.rotationUpdated(); + } + if (rb2.getMass() != 0.0) + { + rb2.getPosition() += corr_x2; + rb2.getRotation().coeffs() += corr_q2.coeffs(); + rb2.getRotation().normalize(); + rb2.rotationUpdated(); + } + } + return res; +} + ////////////////////////////////////////////////////////////////////////// // RigidBodyParticleBallJoint ////////////////////////////////////////////////////////////////////////// @@ -841,7 +948,7 @@ bool RigidBodyParticleBallJoint::updateConstraint(SimulationModel &model) m_jointInfo); } -bool RigidBodyParticleBallJoint::solvePositionConstraint(SimulationModel &model) +bool RigidBodyParticleBallJoint::solvePositionConstraint(SimulationModel &model, const unsigned int iter) { SimulationModel::RigidBodyVector &rb = model.getRigidBodies(); ParticleData &pd = model.getParticles(); @@ -879,11 +986,186 @@ bool RigidBodyParticleBallJoint::solvePositionConstraint(SimulationModel &model) return res; } +////////////////////////////////////////////////////////////////////////// +// RigidBodySpring +////////////////////////////////////////////////////////////////////////// +bool RigidBodySpring::initConstraint(SimulationModel &model, const unsigned int rbIndex1, const unsigned int rbIndex2, const Vector3r &pos1, const Vector3r &pos2, const Real stiffness) +{ + m_stiffness = stiffness; + m_lambda = 0.0; + m_restLength = (pos1 - pos2).norm(); + m_bodies[0] = rbIndex1; + m_bodies[1] = rbIndex2; + SimulationModel::RigidBodyVector &rb = model.getRigidBodies(); + RigidBody &rb1 = *rb[m_bodies[0]]; + RigidBody &rb2 = *rb[m_bodies[1]]; + return PositionBasedRigidBodyDynamics::init_DistanceJoint( + rb1.getPosition(), + rb1.getRotation(), + rb2.getPosition(), + rb2.getRotation(), + pos1, + pos2, + m_jointInfo); +} + +bool RigidBodySpring::updateConstraint(SimulationModel &model) +{ + SimulationModel::RigidBodyVector &rb = model.getRigidBodies(); + RigidBody &rb1 = *rb[m_bodies[0]]; + RigidBody &rb2 = *rb[m_bodies[1]]; + return PositionBasedRigidBodyDynamics::update_DistanceJoint( + rb1.getPosition(), + rb1.getRotation(), + rb2.getPosition(), + rb2.getRotation(), + m_jointInfo); +} + +bool RigidBodySpring::solvePositionConstraint(SimulationModel &model, const unsigned int iter) +{ + SimulationModel::RigidBodyVector &rb = model.getRigidBodies(); + + RigidBody &rb1 = *rb[m_bodies[0]]; + RigidBody &rb2 = *rb[m_bodies[1]]; + + const Real dt = TimeManager::getCurrent()->getTimeStepSize(); + + if (iter == 0) + m_lambda = 0.0; + + Vector3r corr_x1, corr_x2; + Quaternionr corr_q1, corr_q2; + const bool res = PositionBasedRigidBodyDynamics::solve_DistanceJoint( + rb1.getInvMass(), + rb1.getPosition(), + rb1.getInertiaTensorInverseW(), + rb1.getRotation(), + rb2.getInvMass(), + rb2.getPosition(), + rb2.getInertiaTensorInverseW(), + rb2.getRotation(), + m_stiffness, + m_restLength, + dt, + m_jointInfo, + m_lambda, + corr_x1, + corr_q1, + corr_x2, + corr_q2); + + if (res) + { + if (rb1.getMass() != 0.0) + { + rb1.getPosition() += corr_x1; + rb1.getRotation().coeffs() += corr_q1.coeffs(); + rb1.getRotation().normalize(); + rb1.rotationUpdated(); + } + if (rb2.getMass() != 0.0) + { + rb2.getPosition() += corr_x2; + rb2.getRotation().coeffs() += corr_q2.coeffs(); + rb2.getRotation().normalize(); + rb2.rotationUpdated(); + } + } + return res; +} + + +////////////////////////////////////////////////////////////////////////// +// DistanceJoint +////////////////////////////////////////////////////////////////////////// +bool DistanceJoint::initConstraint(SimulationModel &model, const unsigned int rbIndex1, const unsigned int rbIndex2, const Vector3r &pos1, const Vector3r &pos2) +{ + m_restLength = (pos1 - pos2).norm(); + m_bodies[0] = rbIndex1; + m_bodies[1] = rbIndex2; + SimulationModel::RigidBodyVector &rb = model.getRigidBodies(); + RigidBody &rb1 = *rb[m_bodies[0]]; + RigidBody &rb2 = *rb[m_bodies[1]]; + return PositionBasedRigidBodyDynamics::init_DistanceJoint( + rb1.getPosition(), + rb1.getRotation(), + rb2.getPosition(), + rb2.getRotation(), + pos1, + pos2, + m_jointInfo); +} + +bool DistanceJoint::updateConstraint(SimulationModel &model) +{ + SimulationModel::RigidBodyVector &rb = model.getRigidBodies(); + RigidBody &rb1 = *rb[m_bodies[0]]; + RigidBody &rb2 = *rb[m_bodies[1]]; + return PositionBasedRigidBodyDynamics::update_DistanceJoint( + rb1.getPosition(), + rb1.getRotation(), + rb2.getPosition(), + rb2.getRotation(), + m_jointInfo); +} + +bool DistanceJoint::solvePositionConstraint(SimulationModel &model, const unsigned int iter) +{ + SimulationModel::RigidBodyVector &rb = model.getRigidBodies(); + + RigidBody &rb1 = *rb[m_bodies[0]]; + RigidBody &rb2 = *rb[m_bodies[1]]; + + Real lambda = 0.0; + + Vector3r corr_x1, corr_x2; + Quaternionr corr_q1, corr_q2; + const bool res = PositionBasedRigidBodyDynamics::solve_DistanceJoint( + rb1.getInvMass(), + rb1.getPosition(), + rb1.getInertiaTensorInverseW(), + rb1.getRotation(), + rb2.getInvMass(), + rb2.getPosition(), + rb2.getInertiaTensorInverseW(), + rb2.getRotation(), + 0.0, + m_restLength, + 0.0, + m_jointInfo, + lambda, + corr_x1, + corr_q1, + corr_x2, + corr_q2); + + if (res) + { + if (rb1.getMass() != 0.0) + { + rb1.getPosition() += corr_x1; + rb1.getRotation().coeffs() += corr_q1.coeffs(); + rb1.getRotation().normalize(); + rb1.rotationUpdated(); + } + if (rb2.getMass() != 0.0) + { + rb2.getPosition() += corr_x2; + rb2.getRotation().coeffs() += corr_q2.coeffs(); + rb2.getRotation().normalize(); + rb2.rotationUpdated(); + } + } + return res; +} + ////////////////////////////////////////////////////////////////////////// // DistanceConstraint ////////////////////////////////////////////////////////////////////////// -bool DistanceConstraint::initConstraint(SimulationModel &model, const unsigned int particle1, const unsigned int particle2) +bool DistanceConstraint::initConstraint(SimulationModel &model, const unsigned int particle1, const unsigned int particle2, const Real stiffness) { + m_stiffness = stiffness; m_bodies[0] = particle1; m_bodies[1] = particle2; ParticleData &pd = model.getParticles(); @@ -896,7 +1178,7 @@ bool DistanceConstraint::initConstraint(SimulationModel &model, const unsigned i return true; } -bool DistanceConstraint::solvePositionConstraint(SimulationModel &model) +bool DistanceConstraint::solvePositionConstraint(SimulationModel &model, const unsigned int iter) { ParticleData &pd = model.getParticles(); @@ -911,7 +1193,7 @@ bool DistanceConstraint::solvePositionConstraint(SimulationModel &model) Vector3r corr1, corr2; const bool res = PositionBasedDynamics::solve_DistanceConstraint( x1, invMass1, x2, invMass2, - m_restLength, model.getClothStiffness(), model.getClothStiffness(), corr1, corr2); + m_restLength, m_stiffness, corr1, corr2); if (res) { @@ -923,57 +1205,109 @@ bool DistanceConstraint::solvePositionConstraint(SimulationModel &model) return res; } - ////////////////////////////////////////////////////////////////////////// -// DihedralConstraint +// DistanceConstraint_XPBD ////////////////////////////////////////////////////////////////////////// - -bool DihedralConstraint::initConstraint(SimulationModel &model, const unsigned int particle1, const unsigned int particle2, - const unsigned int particle3, const unsigned int particle4) +bool DistanceConstraint_XPBD::initConstraint(SimulationModel& model, const unsigned int particle1, const unsigned int particle2, const Real stiffness) { + m_stiffness = stiffness; + m_lambda = 0.0; m_bodies[0] = particle1; m_bodies[1] = particle2; - m_bodies[2] = particle3; - m_bodies[3] = particle4; - ParticleData &pd = model.getParticles(); - - const Vector3r &p0 = pd.getPosition0(particle1); - const Vector3r &p1 = pd.getPosition0(particle2); - const Vector3r &p2 = pd.getPosition0(particle3); - const Vector3r &p3 = pd.getPosition0(particle4); - - Vector3r e = p3 - p2; - Real elen = e.norm(); - if (elen < 1e-6) - return false; + ParticleData& pd = model.getParticles(); - Real invElen = 1.0 / elen; + const Vector3r& x1_0 = pd.getPosition0(particle1); + const Vector3r& x2_0 = pd.getPosition0(particle2); - Vector3r n1 = (p2 - p0).cross(p3 - p0); n1 /= n1.squaredNorm(); - Vector3r n2 = (p3 - p1).cross(p2 - p1); n2 /= n2.squaredNorm(); - - n1.normalize(); - n2.normalize(); - Real dot = n1.dot(n2); - - if (dot < -1.0) dot = -1.0; - if (dot > 1.0) dot = 1.0; - - m_restAngle = acos(dot); + m_restLength = (x2_0 - x1_0).norm(); return true; } -bool DihedralConstraint::solvePositionConstraint(SimulationModel &model) +bool DistanceConstraint_XPBD::solvePositionConstraint(SimulationModel& model, const unsigned int iter) { - ParticleData &pd = model.getParticles(); + ParticleData& pd = model.getParticles(); const unsigned i1 = m_bodies[0]; const unsigned i2 = m_bodies[1]; - const unsigned i3 = m_bodies[2]; - const unsigned i4 = m_bodies[3]; - Vector3r &x1 = pd.getPosition(i1); + Vector3r& x1 = pd.getPosition(i1); + Vector3r& x2 = pd.getPosition(i2); + const Real invMass1 = pd.getInvMass(i1); + const Real invMass2 = pd.getInvMass(i2); + + const Real dt = TimeManager::getCurrent()->getTimeStepSize(); + + if (iter == 0) + m_lambda = 0.0; + + Vector3r corr1, corr2; + const bool res = XPBD::solve_DistanceConstraint( + x1, invMass1, x2, invMass2, + m_restLength, m_stiffness, dt, m_lambda, + corr1, corr2); + + if (res) + { + if (invMass1 != 0.0) + x1 += corr1; + if (invMass2 != 0.0) + x2 += corr2; + } + return res; +} + +////////////////////////////////////////////////////////////////////////// +// DihedralConstraint +////////////////////////////////////////////////////////////////////////// + +bool DihedralConstraint::initConstraint(SimulationModel &model, const unsigned int particle1, const unsigned int particle2, + const unsigned int particle3, const unsigned int particle4, const Real stiffness) +{ + m_stiffness = stiffness; + m_bodies[0] = particle1; + m_bodies[1] = particle2; + m_bodies[2] = particle3; + m_bodies[3] = particle4; + ParticleData &pd = model.getParticles(); + + const Vector3r &p0 = pd.getPosition0(particle1); + const Vector3r &p1 = pd.getPosition0(particle2); + const Vector3r &p2 = pd.getPosition0(particle3); + const Vector3r &p3 = pd.getPosition0(particle4); + + Vector3r e = p3 - p2; + Real elen = e.norm(); + if (elen < 1e-6) + return false; + + Real invElen = static_cast(1.0) / elen; + + Vector3r n1 = (p2 - p0).cross(p3 - p0); n1 /= n1.squaredNorm(); + Vector3r n2 = (p3 - p1).cross(p2 - p1); n2 /= n2.squaredNorm(); + + n1.normalize(); + n2.normalize(); + Real dot = n1.dot(n2); + + if (dot < -1.0) dot = -1.0; + if (dot > 1.0) dot = 1.0; + + m_restAngle = acos(dot); + + return true; +} + +bool DihedralConstraint::solvePositionConstraint(SimulationModel &model, const unsigned int iter) +{ + ParticleData &pd = model.getParticles(); + + const unsigned i1 = m_bodies[0]; + const unsigned i2 = m_bodies[1]; + const unsigned i3 = m_bodies[2]; + const unsigned i4 = m_bodies[3]; + + Vector3r &x1 = pd.getPosition(i1); Vector3r &x2 = pd.getPosition(i2); Vector3r &x3 = pd.getPosition(i3); Vector3r &x4 = pd.getPosition(i4); @@ -987,7 +1321,7 @@ bool DihedralConstraint::solvePositionConstraint(SimulationModel &model) const bool res = PositionBasedDynamics::solve_DihedralConstraint( x1, invMass1, x2, invMass2, x3, invMass3, x4, invMass4, m_restAngle, - model.getClothBendingStiffness(), + m_stiffness, corr1, corr2, corr3, corr4); if (res) @@ -1009,8 +1343,9 @@ bool DihedralConstraint::solvePositionConstraint(SimulationModel &model) // IsometricBendingConstraint ////////////////////////////////////////////////////////////////////////// bool IsometricBendingConstraint::initConstraint(SimulationModel &model, const unsigned int particle1, const unsigned int particle2, - const unsigned int particle3, const unsigned int particle4) + const unsigned int particle3, const unsigned int particle4, const Real stiffness) { + m_stiffness = stiffness; m_bodies[0] = particle1; m_bodies[1] = particle2; m_bodies[2] = particle3; @@ -1026,7 +1361,7 @@ bool IsometricBendingConstraint::initConstraint(SimulationModel &model, const un return PositionBasedDynamics::init_IsometricBendingConstraint(x1, x2, x3, x4, m_Q); } -bool IsometricBendingConstraint::solvePositionConstraint(SimulationModel &model) +bool IsometricBendingConstraint::solvePositionConstraint(SimulationModel &model, const unsigned int iter) { ParticleData &pd = model.getParticles(); @@ -1049,7 +1384,76 @@ bool IsometricBendingConstraint::solvePositionConstraint(SimulationModel &model) const bool res = PositionBasedDynamics::solve_IsometricBendingConstraint( x1, invMass1, x2, invMass2, x3, invMass3, x4, invMass4, m_Q, - model.getClothBendingStiffness(), + m_stiffness, + corr1, corr2, corr3, corr4); + + if (res) + { + if (invMass1 != 0.0) + x1 += corr1; + if (invMass2 != 0.0) + x2 += corr2; + if (invMass3 != 0.0) + x3 += corr3; + if (invMass4 != 0.0) + x4 += corr4; + } + return res; +} + +////////////////////////////////////////////////////////////////////////// +// IsometricBendingConstraint_XPBD +////////////////////////////////////////////////////////////////////////// +bool IsometricBendingConstraint_XPBD::initConstraint(SimulationModel& model, const unsigned int particle1, const unsigned int particle2, + const unsigned int particle3, const unsigned int particle4, const Real stiffness) +{ + m_lambda = 0.0; + m_stiffness = stiffness; + m_bodies[0] = particle1; + m_bodies[1] = particle2; + m_bodies[2] = particle3; + m_bodies[3] = particle4; + + ParticleData& pd = model.getParticles(); + + const Vector3r& x1 = pd.getPosition0(particle1); + const Vector3r& x2 = pd.getPosition0(particle2); + const Vector3r& x3 = pd.getPosition0(particle3); + const Vector3r& x4 = pd.getPosition0(particle4); + + return PositionBasedDynamics::init_IsometricBendingConstraint(x1, x2, x3, x4, m_Q); +} + +bool IsometricBendingConstraint_XPBD::solvePositionConstraint(SimulationModel& model, const unsigned int iter) +{ + ParticleData& pd = model.getParticles(); + + const unsigned i1 = m_bodies[0]; + const unsigned i2 = m_bodies[1]; + const unsigned i3 = m_bodies[2]; + const unsigned i4 = m_bodies[3]; + + Vector3r& x1 = pd.getPosition(i1); + Vector3r& x2 = pd.getPosition(i2); + Vector3r& x3 = pd.getPosition(i3); + Vector3r& x4 = pd.getPosition(i4); + + const Real invMass1 = pd.getInvMass(i1); + const Real invMass2 = pd.getInvMass(i2); + const Real invMass3 = pd.getInvMass(i3); + const Real invMass4 = pd.getInvMass(i4); + + const Real dt = TimeManager::getCurrent()->getTimeStepSize(); + + if (iter == 0) + m_lambda = 0.0; + + Vector3r corr1, corr2, corr3, corr4; + const bool res = XPBD::solve_IsometricBendingConstraint( + x1, invMass1, x2, invMass2, x3, invMass3, x4, invMass4, + m_Q, + m_stiffness, + dt, m_lambda, corr1, corr2, corr3, corr4); if (res) @@ -1070,8 +1474,14 @@ bool IsometricBendingConstraint::solvePositionConstraint(SimulationModel &model) // FEMTriangleConstraint ////////////////////////////////////////////////////////////////////////// bool FEMTriangleConstraint::initConstraint(SimulationModel &model, const unsigned int particle1, const unsigned int particle2, - const unsigned int particle3) + const unsigned int particle3, const Real xxStiffness, const Real yyStiffness, const Real xyStiffness, + const Real xyPoissonRatio, const Real yxPoissonRatio) { + m_xxStiffness = xxStiffness; + m_yyStiffness = yyStiffness; + m_xyStiffness = xyStiffness; + m_xyPoissonRatio = xyPoissonRatio; + m_yxPoissonRatio = yxPoissonRatio; m_bodies[0] = particle1; m_bodies[1] = particle2; m_bodies[2] = particle3; @@ -1085,7 +1495,7 @@ bool FEMTriangleConstraint::initConstraint(SimulationModel &model, const unsigne return PositionBasedDynamics::init_FEMTriangleConstraint(x1, x2, x3, m_area, m_invRestMat); } -bool FEMTriangleConstraint::solvePositionConstraint(SimulationModel &model) +bool FEMTriangleConstraint::solvePositionConstraint(SimulationModel &model, const unsigned int iter) { ParticleData &pd = model.getParticles(); @@ -1108,11 +1518,11 @@ bool FEMTriangleConstraint::solvePositionConstraint(SimulationModel &model) x3, invMass3, m_area, m_invRestMat, - model.getClothXXStiffness(), - model.getClothYYStiffness(), - model.getClothXYStiffness(), - model.getClothXYPoissonRatio(), - model.getClothYXPoissonRatio(), + m_xxStiffness, + m_yyStiffness, + m_xyStiffness, + m_xyPoissonRatio, + m_yxPoissonRatio, corr1, corr2, corr3); if (res) @@ -1132,8 +1542,14 @@ bool FEMTriangleConstraint::solvePositionConstraint(SimulationModel &model) // StrainTriangleConstraint ////////////////////////////////////////////////////////////////////////// bool StrainTriangleConstraint::initConstraint(SimulationModel &model, const unsigned int particle1, const unsigned int particle2, - const unsigned int particle3) + const unsigned int particle3, const Real xxStiffness, const Real yyStiffness, const Real xyStiffness, + const bool normalizeStretch, const bool normalizeShear) { + m_xxStiffness = xxStiffness; + m_yyStiffness = yyStiffness; + m_xyStiffness = xyStiffness; + m_normalizeStretch = normalizeStretch; + m_normalizeShear = normalizeShear; m_bodies[0] = particle1; m_bodies[1] = particle2; m_bodies[2] = particle3; @@ -1152,7 +1568,7 @@ bool StrainTriangleConstraint::initConstraint(SimulationModel &model, const unsi return PositionBasedDynamics::init_StrainTriangleConstraint(y1, y2, y3, m_invRestMat); } -bool StrainTriangleConstraint::solvePositionConstraint(SimulationModel &model) +bool StrainTriangleConstraint::solvePositionConstraint(SimulationModel &model, const unsigned int iter) { ParticleData &pd = model.getParticles(); @@ -1174,11 +1590,11 @@ bool StrainTriangleConstraint::solvePositionConstraint(SimulationModel &model) x2, invMass2, x3, invMass3, m_invRestMat, - model.getClothXXStiffness(), - model.getClothYYStiffness(), - model.getClothXYStiffness(), - model.getClothNormalizeStretch(), - model.getClothNormalizeShear(), + m_xxStiffness, + m_yyStiffness, + m_xyStiffness, + m_normalizeStretch, + m_normalizeShear, corr1, corr2, corr3); if (res) @@ -1199,8 +1615,9 @@ bool StrainTriangleConstraint::solvePositionConstraint(SimulationModel &model) ////////////////////////////////////////////////////////////////////////// bool VolumeConstraint::initConstraint(SimulationModel &model, const unsigned int particle1, const unsigned int particle2, - const unsigned int particle3, const unsigned int particle4) + const unsigned int particle3, const unsigned int particle4, const Real stiffness) { + m_stiffness = stiffness; m_bodies[0] = particle1; m_bodies[1] = particle2; m_bodies[2] = particle3; @@ -1212,12 +1629,12 @@ bool VolumeConstraint::initConstraint(SimulationModel &model, const unsigned int const Vector3r &p2 = pd.getPosition0(particle3); const Vector3r &p3 = pd.getPosition0(particle4); - m_restVolume = fabs((1.0 / 6.0) * (p3 - p0).dot((p2 - p0).cross(p1 - p0))); + m_restVolume = fabs(static_cast(1.0 / 6.0) * (p3 - p0).dot((p2 - p0).cross(p1 - p0))); return true; } -bool VolumeConstraint::solvePositionConstraint(SimulationModel &model) +bool VolumeConstraint::solvePositionConstraint(SimulationModel &model, const unsigned int iter) { ParticleData &pd = model.getParticles(); @@ -1242,8 +1659,7 @@ bool VolumeConstraint::solvePositionConstraint(SimulationModel &model) x3, invMass3, x4, invMass4, m_restVolume, - model.getSolidStiffness(), - model.getSolidStiffness(), + m_stiffness, corr1, corr2, corr3, corr4); if (res) @@ -1260,13 +1676,88 @@ bool VolumeConstraint::solvePositionConstraint(SimulationModel &model) return res; } +////////////////////////////////////////////////////////////////////////// +// VolumeConstraint_XPBD +////////////////////////////////////////////////////////////////////////// + +bool VolumeConstraint_XPBD::initConstraint(SimulationModel& model, const unsigned int particle1, const unsigned int particle2, + const unsigned int particle3, const unsigned int particle4, const Real stiffness) +{ + m_stiffness = stiffness; + m_lambda = 0.0; + m_bodies[0] = particle1; + m_bodies[1] = particle2; + m_bodies[2] = particle3; + m_bodies[3] = particle4; + ParticleData& pd = model.getParticles(); + + const Vector3r& p0 = pd.getPosition0(particle1); + const Vector3r& p1 = pd.getPosition0(particle2); + const Vector3r& p2 = pd.getPosition0(particle3); + const Vector3r& p3 = pd.getPosition0(particle4); + + m_restVolume = fabs(static_cast(1.0 / 6.0) * (p3 - p0).dot((p2 - p0).cross(p1 - p0))); + + return true; +} + +bool VolumeConstraint_XPBD::solvePositionConstraint(SimulationModel& model, const unsigned int iter) +{ + ParticleData& pd = model.getParticles(); + + const unsigned i1 = m_bodies[0]; + const unsigned i2 = m_bodies[1]; + const unsigned i3 = m_bodies[2]; + const unsigned i4 = m_bodies[3]; + + Vector3r& x1 = pd.getPosition(i1); + Vector3r& x2 = pd.getPosition(i2); + Vector3r& x3 = pd.getPosition(i3); + Vector3r& x4 = pd.getPosition(i4); + + const Real invMass1 = pd.getInvMass(i1); + const Real invMass2 = pd.getInvMass(i2); + const Real invMass3 = pd.getInvMass(i3); + const Real invMass4 = pd.getInvMass(i4); + + const Real dt = TimeManager::getCurrent()->getTimeStepSize(); + + if (iter == 0) + m_lambda = 0.0; + + Vector3r corr1, corr2, corr3, corr4; + const bool res = XPBD::solve_VolumeConstraint(x1, invMass1, + x2, invMass2, + x3, invMass3, + x4, invMass4, + m_restVolume, + m_stiffness, + dt, m_lambda, + corr1, corr2, corr3, corr4); + + if (res) + { + if (invMass1 != 0.0) + x1 += corr1; + if (invMass2 != 0.0) + x2 += corr2; + if (invMass3 != 0.0) + x3 += corr3; + if (invMass4 != 0.0) + x4 += corr4; + } + return res; +} ////////////////////////////////////////////////////////////////////////// // FEMTetConstraint ////////////////////////////////////////////////////////////////////////// bool FEMTetConstraint::initConstraint(SimulationModel &model, const unsigned int particle1, const unsigned int particle2, - const unsigned int particle3, const unsigned int particle4) + const unsigned int particle3, const unsigned int particle4, + const Real stiffness, const Real poissonRatio) { + m_stiffness = stiffness; + m_poissonRatio = poissonRatio; m_bodies[0] = particle1; m_bodies[1] = particle2; m_bodies[2] = particle3; @@ -1282,7 +1773,7 @@ bool FEMTetConstraint::initConstraint(SimulationModel &model, const unsigned int return PositionBasedDynamics::init_FEMTetraConstraint(x1, x2, x3, x4, m_volume, m_invRestMat); } -bool FEMTetConstraint::solvePositionConstraint(SimulationModel &model) +bool FEMTetConstraint::solvePositionConstraint(SimulationModel &model, const unsigned int iter) { ParticleData &pd = model.getParticles(); @@ -1301,7 +1792,7 @@ bool FEMTetConstraint::solvePositionConstraint(SimulationModel &model) const Real invMass3 = pd.getInvMass(i3); const Real invMass4 = pd.getInvMass(i4); - Real currentVolume = -(1.0 / 6.0) * (x4 - x1).dot((x3 - x1).cross(x2 - x1)); + Real currentVolume = -static_cast(1.0 / 6.0) * (x4 - x1).dot((x3 - x1).cross(x2 - x1)); bool handleInversion = false; if (currentVolume / m_volume < 0.2) // Only 20% of initial volume left handleInversion = true; @@ -1315,8 +1806,89 @@ bool FEMTetConstraint::solvePositionConstraint(SimulationModel &model) x4, invMass4, m_volume, m_invRestMat, - model.getSolidStiffness(), - model.getSolidPoissonRatio(), handleInversion, + m_stiffness, + m_poissonRatio, handleInversion, + corr1, corr2, corr3, corr4); + + if (res) + { + if (invMass1 != 0.0) + x1 += corr1; + if (invMass2 != 0.0) + x2 += corr2; + if (invMass3 != 0.0) + x3 += corr3; + if (invMass4 != 0.0) + x4 += corr4; + } + return res; +} + +////////////////////////////////////////////////////////////////////////// +// XPBD_FEMTetConstraint +////////////////////////////////////////////////////////////////////////// +bool XPBD_FEMTetConstraint::initConstraint(SimulationModel &model, const unsigned int particle1, const unsigned int particle2, + const unsigned int particle3, const unsigned int particle4, + const Real stiffness, const Real poissonRatio) +{ + m_stiffness = stiffness; + m_poissonRatio = poissonRatio; + m_bodies[0] = particle1; + m_bodies[1] = particle2; + m_bodies[2] = particle3; + m_bodies[3] = particle4; + + ParticleData &pd = model.getParticles(); + + Vector3r &x1 = pd.getPosition0(particle1); + Vector3r &x2 = pd.getPosition0(particle2); + Vector3r &x3 = pd.getPosition0(particle3); + Vector3r &x4 = pd.getPosition0(particle4); + + return PositionBasedDynamics::init_FEMTetraConstraint(x1, x2, x3, x4, m_volume, m_invRestMat); +} + +bool XPBD_FEMTetConstraint::solvePositionConstraint(SimulationModel &model, const unsigned int iter) +{ + ParticleData &pd = model.getParticles(); + + const unsigned i1 = m_bodies[0]; + const unsigned i2 = m_bodies[1]; + const unsigned i3 = m_bodies[2]; + const unsigned i4 = m_bodies[3]; + + Vector3r &x1 = pd.getPosition(i1); + Vector3r &x2 = pd.getPosition(i2); + Vector3r &x3 = pd.getPosition(i3); + Vector3r &x4 = pd.getPosition(i4); + + const Real invMass1 = pd.getInvMass(i1); + const Real invMass2 = pd.getInvMass(i2); + const Real invMass3 = pd.getInvMass(i3); + const Real invMass4 = pd.getInvMass(i4); + + Real currentVolume = -static_cast(1.0 / 6.0) * (x4 - x1).dot((x3 - x1).cross(x2 - x1)); + bool handleInversion = false; + if (currentVolume / m_volume < 0.2) // Only 20% of initial volume left + handleInversion = true; + + const Real dt = TimeManager::getCurrent()->getTimeStepSize(); + + if (iter == 0) + m_lambda = 0.0; + + Vector3r corr1, corr2, corr3, corr4; + const bool res = XPBD::solve_FEMTetraConstraint( + x1, invMass1, + x2, invMass2, + x3, invMass3, + x4, invMass4, + m_volume, + m_invRestMat, + m_stiffness, + m_poissonRatio, handleInversion, + dt, + m_lambda, corr1, corr2, corr3, corr4); if (res) @@ -1338,8 +1910,14 @@ bool FEMTetConstraint::solvePositionConstraint(SimulationModel &model) // StrainTetConstraint ////////////////////////////////////////////////////////////////////////// bool StrainTetConstraint::initConstraint(SimulationModel &model, const unsigned int particle1, const unsigned int particle2, - const unsigned int particle3, const unsigned int particle4) + const unsigned int particle3, const unsigned int particle4, + const Real stretchStiffness, const Real shearStiffness, + const bool normalizeStretch, const bool normalizeShear) { + m_stretchStiffness = stretchStiffness; + m_shearStiffness = shearStiffness; + m_normalizeStretch = normalizeStretch; + m_normalizeShear = normalizeShear; m_bodies[0] = particle1; m_bodies[1] = particle2; m_bodies[2] = particle3; @@ -1355,7 +1933,7 @@ bool StrainTetConstraint::initConstraint(SimulationModel &model, const unsigned return PositionBasedDynamics::init_StrainTetraConstraint(x1, x2, x3, x4, m_invRestMat); } -bool StrainTetConstraint::solvePositionConstraint(SimulationModel &model) +bool StrainTetConstraint::solvePositionConstraint(SimulationModel &model, const unsigned int iter) { ParticleData &pd = model.getParticles(); @@ -1374,8 +1952,6 @@ bool StrainTetConstraint::solvePositionConstraint(SimulationModel &model) const Real invMass3 = pd.getInvMass(i3); const Real invMass4 = pd.getInvMass(i4); - Vector3r stiffness(model.getSolidStiffness(), model.getSolidStiffness(), model.getSolidStiffness()); - Vector3r corr1, corr2, corr3, corr4; const bool res = PositionBasedDynamics::solve_StrainTetraConstraint( x1, invMass1, @@ -1383,10 +1959,10 @@ bool StrainTetConstraint::solvePositionConstraint(SimulationModel &model) x3, invMass3, x4, invMass4, m_invRestMat, - stiffness, - stiffness, - model.getSolidNormalizeStretch(), - model.getSolidNormalizeShear(), + m_stretchStiffness * Vector3r::Ones(), + m_shearStiffness * Vector3r::Ones(), + m_normalizeStretch, + m_normalizeShear, corr1, corr2, corr3, corr4); if (res) @@ -1407,10 +1983,12 @@ bool StrainTetConstraint::solvePositionConstraint(SimulationModel &model) // ShapeMatchingConstraint ////////////////////////////////////////////////////////////////////////// bool ShapeMatchingConstraint::initConstraint(SimulationModel &model, - const unsigned int particleIndices[], const unsigned int numClusters[]) + const unsigned int particleIndices[], const unsigned int numClusters[], + const Real stiffness) { + m_stiffness = stiffness; ParticleData &pd = model.getParticles(); - for (unsigned int i = 0; i < m_numberOfBodies; i++) + for (unsigned int i = 0; i < numberOfBodies(); i++) { m_bodies[i] = particleIndices[i]; m_x0[i] = pd.getPosition0(m_bodies[i]); @@ -1418,27 +1996,27 @@ bool ShapeMatchingConstraint::initConstraint(SimulationModel &model, m_numClusters[i] = numClusters[i]; } - const bool res = PositionBasedDynamics::init_ShapeMatchingConstraint(m_x0, m_w, m_numberOfBodies, m_restCm, m_invRestMat); + const bool res = PositionBasedDynamics::init_ShapeMatchingConstraint(m_x0, m_w, numberOfBodies(), m_restCm); return res; } -bool ShapeMatchingConstraint::solvePositionConstraint(SimulationModel &model) +bool ShapeMatchingConstraint::solvePositionConstraint(SimulationModel &model, const unsigned int iter) { ParticleData &pd = model.getParticles(); - for (unsigned int i = 0; i < m_numberOfBodies; i++) + for (unsigned int i = 0; i < numberOfBodies(); i++) { m_x[i] = pd.getPosition(m_bodies[i]); } const bool res = PositionBasedDynamics::solve_ShapeMatchingConstraint( - m_x0, m_x, m_w, m_numberOfBodies, - m_restCm, m_invRestMat, - model.getSolidStiffness(), false, + m_x0, m_x, m_w, numberOfBodies(), + m_restCm, + m_stiffness, false, m_corr); if (res) { - for (unsigned int i = 0; i < m_numberOfBodies; i++) + for (unsigned int i = 0; i < numberOfBodies(); i++) { // Important: Divide position correction by the number of clusters // which contain the vertex. @@ -1482,11 +2060,11 @@ bool RigidBodyContactConstraint::initConstraint(SimulationModel &model, const un rb2.getInertiaTensorInverseW(), rb2.getRotation(), rb2.getAngularVelocity(), - cp1, cp2, normal, restitutionCoeff, + cp1, cp2, normal, restitutionCoeff, m_constraintInfo); } -bool RigidBodyContactConstraint::solveVelocityConstraint(SimulationModel &model) +bool RigidBodyContactConstraint::solveVelocityConstraint(SimulationModel &model, const unsigned int iter) { SimulationModel::RigidBodyVector &rb = model.getRigidBodies(); @@ -1566,7 +2144,7 @@ bool ParticleRigidBodyContactConstraint::initConstraint(SimulationModel &model, m_constraintInfo); } -bool ParticleRigidBodyContactConstraint::solveVelocityConstraint(SimulationModel &model) +bool ParticleRigidBodyContactConstraint::solveVelocityConstraint(SimulationModel &model, const unsigned int iter) { SimulationModel::RigidBodyVector &rbs = model.getRigidBodies(); ParticleData &pd = model.getParticles(); @@ -1607,3 +2185,562 @@ bool ParticleRigidBodyContactConstraint::solveVelocityConstraint(SimulationModel return res; } +////////////////////////////////////////////////////////////////////////// +// ParticleSolidContactConstraint +////////////////////////////////////////////////////////////////////////// +bool ParticleTetContactConstraint::initConstraint(SimulationModel &model, + const unsigned int particleIndex, const unsigned int solidIndex, + const unsigned int tetIndex, const Vector3r &bary, + const Vector3r &cp1, const Vector3r &cp2, + const Vector3r &normal, const Real dist, + const Real frictionCoeff) +{ + m_frictionCoeff = frictionCoeff; + + m_bodies[0] = particleIndex; + m_bodies[1] = solidIndex; + m_tetIndex = tetIndex; + m_solidIndex = solidIndex; + m_bary = bary; + ParticleData &pd = model.getParticles(); + + const SimulationModel::TetModelVector &tetModels = model.getTetModels(); + TetModel *tm = tetModels[solidIndex]; + const unsigned int offset = tm->getIndexOffset(); + const unsigned int *indices = tm->getParticleMesh().getTets().data(); + m_x[0] = pd.getPosition(indices[4 * tetIndex] + offset); + m_x[1] = pd.getPosition(indices[4 * tetIndex + 1] + offset); + m_x[2] = pd.getPosition(indices[4 * tetIndex + 2] + offset); + m_x[3] = pd.getPosition(indices[4 * tetIndex + 3] + offset); + m_v[0] = pd.getVelocity(indices[4 * tetIndex] + offset); + m_v[1] = pd.getVelocity(indices[4 * tetIndex + 1] + offset); + m_v[2] = pd.getVelocity(indices[4 * tetIndex + 2] + offset); + m_v[3] = pd.getVelocity(indices[4 * tetIndex + 3] + offset); + m_invMasses[0] = pd.getInvMass(indices[4 * tetIndex] + offset); + m_invMasses[1] = pd.getInvMass(indices[4 * tetIndex + 1] + offset); + m_invMasses[2] = pd.getInvMass(indices[4 * tetIndex + 2] + offset); + m_invMasses[3] = pd.getInvMass(indices[4 * tetIndex + 3] + offset); + + return PositionBasedDynamics::init_ParticleTetContactConstraint( + pd.getInvMass(particleIndex), + pd.getPosition(particleIndex), + pd.getVelocity(particleIndex), + m_invMasses, + m_x.data(), + m_v.data(), + bary, normal, + m_constraintInfo); +} + +bool ParticleTetContactConstraint::solvePositionConstraint(SimulationModel &model, const unsigned int iter) +{ + ParticleData &pd = model.getParticles(); + + const SimulationModel::TetModelVector &tetModels = model.getTetModels(); + TetModel *tm = tetModels[m_solidIndex]; + const unsigned int offset = tm->getIndexOffset(); + const unsigned int *indices = tm->getParticleMesh().getTets().data(); + Vector3r &x0 = pd.getPosition(indices[4 * m_tetIndex] + offset); + Vector3r &x1 = pd.getPosition(indices[4 * m_tetIndex + 1] + offset); + Vector3r &x2 = pd.getPosition(indices[4 * m_tetIndex + 2] + offset); + Vector3r &x3 = pd.getPosition(indices[4 * m_tetIndex + 3] + offset); + + Vector3r corr0; + Vector3r corr[4]; + const bool res = PositionBasedDynamics::solve_ParticleTetContactConstraint( + pd.getInvMass(m_bodies[0]), + pd.getPosition(m_bodies[0]), + m_invMasses, + m_x.data(), + m_bary, + m_constraintInfo, + m_lambda, + corr0, + corr); + + if (res) + { + if (pd.getMass(m_bodies[0]) != 0.0) + pd.getPosition(m_bodies[0]) += corr0; + if (m_invMasses[0] != 0.0) + x0 += corr[0]; + if (m_invMasses[1] != 0.0) + x1 += corr[1]; + if (m_invMasses[2] != 0.0) + x2 += corr[2]; + if (m_invMasses[3] != 0.0) + x3 += corr[3]; + } + return res; +} + +bool ParticleTetContactConstraint::solveVelocityConstraint(SimulationModel &model, const unsigned int iter) +{ + ParticleData &pd = model.getParticles(); + + const SimulationModel::TetModelVector &tetModels = model.getTetModels(); + TetModel *tm = tetModels[m_solidIndex]; + const unsigned int offset = tm->getIndexOffset(); + const unsigned int *indices = tm->getParticleMesh().getTets().data(); + Vector3r &v0 = pd.getVelocity(indices[4 * m_tetIndex] + offset); + Vector3r &v1 = pd.getVelocity(indices[4 * m_tetIndex + 1] + offset); + Vector3r &v2 = pd.getVelocity(indices[4 * m_tetIndex + 2] + offset); + Vector3r &v3 = pd.getVelocity(indices[4 * m_tetIndex + 3] + offset); + m_v[0] = v0; + m_v[1] = v1; + m_v[2] = v2; + m_v[3] = v3; + + + Vector3r corr_v0; + Vector3r corr_v[4]; + const bool res = PositionBasedDynamics::velocitySolve_ParticleTetContactConstraint( + pd.getInvMass(m_bodies[0]), + pd.getPosition(m_bodies[0]), + pd.getVelocity(m_bodies[0]), + m_invMasses, + m_x.data(), + m_v.data(), + m_bary, + m_lambda, + m_frictionCoeff, + m_constraintInfo, + corr_v0, + corr_v); + + if (res) + { + if (pd.getMass(m_bodies[0]) != 0.0) + pd.getVelocity(m_bodies[0]) += corr_v0; + if (m_invMasses[0] != 0.0) + v0 += corr_v[0]; + if (m_invMasses[1] != 0.0) + v1 += corr_v[1]; + if (m_invMasses[2] != 0.0) + v2 += corr_v[2]; + if (m_invMasses[3] != 0.0) + v3 += corr_v[3]; + } + return res; +} + +////////////////////////////////////////////////////////////////////////// +// StretchShearConstraint +////////////////////////////////////////////////////////////////////////// +bool StretchShearConstraint::initConstraint(SimulationModel &model, const unsigned int particle1, const unsigned int particle2, + const unsigned int quaternion1, const Real stretchingStiffness, + const Real shearingStiffness1, const Real shearingStiffness2) +{ + m_stretchingStiffness = stretchingStiffness; + m_shearingStiffness1 = shearingStiffness1; + m_shearingStiffness2 = shearingStiffness2; + m_bodies[0] = particle1; + m_bodies[1] = particle2; + m_bodies[2] = quaternion1; + ParticleData &pd = model.getParticles(); + + const Vector3r &x1_0 = pd.getPosition0(particle1); + const Vector3r &x2_0 = pd.getPosition0(particle2); + + m_restLength = (x2_0 - x1_0).norm(); + + return true; +} + +bool StretchShearConstraint::solvePositionConstraint(SimulationModel &model, const unsigned int iter) +{ + ParticleData &pd = model.getParticles(); + OrientationData &od = model.getOrientations(); + + const unsigned i1 = m_bodies[0]; + const unsigned i2 = m_bodies[1]; + const unsigned iq1 = m_bodies[2]; + + Vector3r &x1 = pd.getPosition(i1); + Vector3r &x2 = pd.getPosition(i2); + Quaternionr &q1 = od.getQuaternion(iq1); + const Real invMass1 = pd.getInvMass(i1); + const Real invMass2 = pd.getInvMass(i2); + const Real invMassq1 = od.getInvMass(iq1); + Vector3r stiffness(m_shearingStiffness1, + m_shearingStiffness2, + m_stretchingStiffness); + + Vector3r corr1, corr2; + Quaternionr corrq1; + const bool res = PositionBasedCosseratRods::solve_StretchShearConstraint( + x1, invMass1, x2, invMass2, q1, invMassq1, + stiffness, + m_restLength, corr1, corr2, corrq1); + + if (res) + { + if (invMass1 != 0.0) + x1 += corr1; + if (invMass2 != 0.0) + x2 += corr2; + if (invMassq1 != 0.0) + { + q1.coeffs() += corrq1.coeffs(); + q1.normalize(); + } + } + return res; +} + +////////////////////////////////////////////////////////////////////////// +// BendTwistConstraint +////////////////////////////////////////////////////////////////////////// +bool BendTwistConstraint::initConstraint(SimulationModel &model, const unsigned int quaternion1, + const unsigned int quaternion2, const Real twistingStiffness, + const Real bendingStiffness1, const Real bendingStiffness2) +{ + m_twistingStiffness = twistingStiffness; + m_bendingStiffness1 = bendingStiffness1; + m_bendingStiffness2 = bendingStiffness2; + m_bodies[0] = quaternion1; + m_bodies[1] = quaternion2; + OrientationData &od = model.getOrientations(); + + const Quaternionr &q1_0 = od.getQuaternion(quaternion1); + const Quaternionr &q2_0 = od.getQuaternion(quaternion2); + + m_restDarbouxVector = q1_0.conjugate() * q2_0; + Quaternionr omega_plus, omega_minus; + omega_plus.coeffs() = m_restDarbouxVector.coeffs() + Quaternionr(1, 0, 0, 0).coeffs(); + omega_minus.coeffs() = m_restDarbouxVector.coeffs() - Quaternionr(1, 0, 0, 0).coeffs(); + if (omega_minus.squaredNorm() > omega_plus.squaredNorm()) + m_restDarbouxVector.coeffs() *= -1.0; + + return true; +} + +bool BendTwistConstraint::solvePositionConstraint(SimulationModel &model, const unsigned int iter) +{ + OrientationData &od = model.getOrientations(); + + const unsigned i1 = m_bodies[0]; + const unsigned i2 = m_bodies[1]; + + Quaternionr &q1 = od.getQuaternion(i1); + Quaternionr &q2 = od.getQuaternion(i2); + const Real invMass1 = od.getInvMass(i1); + const Real invMass2 = od.getInvMass(i2); + Vector3r stiffness(m_bendingStiffness1, + m_bendingStiffness2, + m_twistingStiffness); + + Quaternionr corr1, corr2; + const bool res = PositionBasedCosseratRods::solve_BendTwistConstraint( + q1, invMass1, q2, invMass2, + stiffness, + m_restDarbouxVector, corr1, corr2); + + if (res) + { + if (invMass1 != 0.0) + { + q1.coeffs() += corr1.coeffs(); + q1.normalize(); + } + + if (invMass2 != 0.0) + { + q2.coeffs() += corr2.coeffs(); + q2.normalize(); + } + } + return res; +} + +////////////////////////////////////////////////////////////////////////// +// StretchBendingTwistingConstraint +////////////////////////////////////////////////////////////////////////// + +bool PBD::StretchBendingTwistingConstraint::initConstraint( + SimulationModel &model, + const unsigned int segmentIndex1, + const unsigned int segmentIndex2, + const Vector3r &pos, + const Real averageRadius, + const Real averageSegmentLength, + Real youngsModulus, + Real torsionModulus) +{ + m_bodies[0] = segmentIndex1; + m_bodies[1] = segmentIndex2; + SimulationModel::RigidBodyVector &rb = model.getRigidBodies(); + const RigidBody &segment1 = *rb[m_bodies[0]]; + const RigidBody &segment2 = *rb[m_bodies[1]]; + + m_lambdaSum.setZero(); + m_averageRadius = averageRadius; + m_averageSegmentLength = averageSegmentLength; + + return DirectPositionBasedSolverForStiffRods::init_StretchBendingTwistingConstraint( + segment1.getPosition(), + segment1.getRotation(), + segment2.getPosition(), + segment2.getRotation(), + pos, + m_averageRadius, + m_averageSegmentLength, + youngsModulus, + torsionModulus, + m_constraintInfo, + m_stiffnessCoefficientK, + m_restDarbouxVector); +} + + +bool StretchBendingTwistingConstraint::initConstraintBeforeProjection(SimulationModel &model) +{ + DirectPositionBasedSolverForStiffRods::initBeforeProjection_StretchBendingTwistingConstraint( + m_stiffnessCoefficientK, + static_cast(1.0) / TimeManager::getCurrent()->getTimeStepSize(), + m_averageSegmentLength, + m_stretchCompliance, + m_bendingAndTorsionCompliance, + m_lambdaSum); + return true; +}; + +bool StretchBendingTwistingConstraint::updateConstraint(SimulationModel &model) +{ + SimulationModel::RigidBodyVector &rb = model.getRigidBodies(); + const RigidBody &segment1 = *rb[m_bodies[0]]; + const RigidBody &segment2 = *rb[m_bodies[1]]; + return DirectPositionBasedSolverForStiffRods::update_StretchBendingTwistingConstraint( + segment1.getPosition(), + segment1.getRotation(), + segment2.getPosition(), + segment2.getRotation(), + m_constraintInfo); +} + +bool StretchBendingTwistingConstraint::solvePositionConstraint(SimulationModel &model, const unsigned int iter) +{ + SimulationModel::RigidBodyVector &rb = model.getRigidBodies(); + + RigidBody &segment1 = *rb[m_bodies[0]]; + RigidBody &segment2 = *rb[m_bodies[1]]; + + Vector3r corr_x1, corr_x2; + Quaternionr corr_q1, corr_q2; + const bool res = DirectPositionBasedSolverForStiffRods::solve_StretchBendingTwistingConstraint( + segment1.getInvMass(), + segment1.getPosition(), + segment1.getInertiaTensorInverseW(), + segment1.getRotation(), + segment2.getInvMass(), + segment2.getPosition(), + segment2.getInertiaTensorInverseW(), + segment2.getRotation(), + m_restDarbouxVector, + m_averageSegmentLength, + m_stretchCompliance, + m_bendingAndTorsionCompliance, + m_constraintInfo, + corr_x1, + corr_q1, + corr_x2, + corr_q2, + m_lambdaSum); + + if (res) + { + if (segment1.getMass() != 0.0) + { + segment1.getPosition() += corr_x1; + segment1.getRotation().coeffs() += corr_q1.coeffs(); + segment1.getRotation().normalize(); + segment1.rotationUpdated(); + } + if (segment2.getMass() != 0.0) + { + segment2.getPosition() += corr_x2; + segment2.getRotation().coeffs() += corr_q2.coeffs(); + segment2.getRotation().normalize(); + segment2.rotationUpdated(); + } + } + return res; +} + +////////////////////////////////////////////////////////////////////////// +// DirectPositionBasedSolverForStiffRodsConstraint +////////////////////////////////////////////////////////////////////////// + +PBD::DirectPositionBasedSolverForStiffRodsConstraint::~DirectPositionBasedSolverForStiffRodsConstraint() +{ + deleteNodes(); + if (intervals != NULL) + delete[] intervals; + if (forward != NULL) + delete[] forward; + if (backward != NULL) + delete[] backward; + if (root != NULL) + delete[] root; + root = NULL; + forward = NULL; + backward = NULL; + intervals = NULL; + numberOfIntervals = 0; +} + +void DirectPositionBasedSolverForStiffRodsConstraint::deleteNodes() +{ + std::list::iterator nodeIter; + for (int i = 0; i < numberOfIntervals; i++) + { + for (nodeIter = forward[i].begin(); nodeIter != forward[i].end(); nodeIter++) + { + Node *node = *nodeIter; + + // Root node does not have to be deleted + if (node->parent != NULL) + delete node; + } + } +} + +bool PBD::DirectPositionBasedSolverForStiffRodsConstraint::initConstraint( + SimulationModel &model, + const std::vector> & constraintSegmentIndices, + const std::vector &constraintPositions, + const std::vector &averageRadii, + const std::vector &averageSegmentLengths, + const std::vector &youngsModuli, + const std::vector &torsionModuli + ) +{ + // create unique segment indices from joints + + std::set uniqueSegmentIndices; + for (auto &idxPair : constraintSegmentIndices) + { + uniqueSegmentIndices.insert(idxPair.first); + uniqueSegmentIndices.insert(idxPair.second); + } + + m_bodies.resize(uniqueSegmentIndices.size()); + + // initialize m_bodies for constraint colouring algorithm of multi threading implementation + + size_t segmentIdx(0); + + for (auto idx : uniqueSegmentIndices) + { + m_bodies[segmentIdx] = idx; + ++segmentIdx; + } + + // create RodSegment instances and map simulation model body indices to RodSegment indices + + std::map idxMap; + unsigned int idx(0); + + m_Segments.reserve(uniqueSegmentIndices.size()); + m_rodSegments.reserve(uniqueSegmentIndices.size()); + for (auto bodyIdx : uniqueSegmentIndices) + { + idx = (unsigned int)m_Segments.size(); + idxMap[bodyIdx] = idx; + m_Segments.push_back(RodSegmentImpl(model, bodyIdx)); + m_rodSegments.push_back(&m_Segments.back()); + } + + // create rod constraints + + m_Constraints.resize(constraintPositions.size()); + m_rodConstraints.resize(constraintPositions.size()); + + for (size_t idx(0); idx < constraintPositions.size(); ++idx) + { + const std::pair &bodyIndices( constraintSegmentIndices[idx]); + unsigned int firstSegmentIndex(idxMap.find(bodyIndices.first)->second); + unsigned int secondSegmentIndex(idxMap.find(bodyIndices.second)->second); + + m_Constraints[idx].m_segments.push_back(firstSegmentIndex); + m_Constraints[idx].m_segments.push_back(secondSegmentIndex); + m_Constraints[idx].m_averageSegmentLength = averageSegmentLengths[idx]; + m_rodConstraints[idx] = &m_Constraints[idx]; + } + + // initialize data of the sparse direct solver + deleteNodes(); + DirectPositionBasedSolverForStiffRods::init_DirectPositionBasedSolverForStiffRodsConstraint( + m_rodConstraints, m_rodSegments, intervals, numberOfIntervals, forward, backward, root, + constraintPositions, averageRadii, youngsModuli, torsionModuli, + m_rightHandSide, m_lambdaSums, m_bendingAndTorsionJacobians, m_corr_x, m_corr_q); + + return true; +} + +bool PBD::DirectPositionBasedSolverForStiffRodsConstraint::initConstraintBeforeProjection(SimulationModel &model) +{ + DirectPositionBasedSolverForStiffRods::initBeforeProjection_DirectPositionBasedSolverForStiffRodsConstraint( + m_rodConstraints, static_cast(1.0) / TimeManager::getCurrent()->getTimeStepSize(), m_lambdaSums); + return true; +} + + +bool PBD::DirectPositionBasedSolverForStiffRodsConstraint::updateConstraint(SimulationModel &model) +{ + DirectPositionBasedSolverForStiffRods::update_DirectPositionBasedSolverForStiffRodsConstraint( + m_rodConstraints, m_rodSegments); + return true; +} + + +bool PBD::DirectPositionBasedSolverForStiffRodsConstraint::solvePositionConstraint(SimulationModel &model, const unsigned int iter) +{ + const bool res = DirectPositionBasedSolverForStiffRods::solve_DirectPositionBasedSolverForStiffRodsConstraint( + m_rodConstraints, m_rodSegments, intervals, numberOfIntervals, forward, backward, + m_rightHandSide, m_lambdaSums, m_bendingAndTorsionJacobians, m_corr_x, m_corr_q + ); + + // apply corrections to bodies + SimulationModel::RigidBodyVector &rbs = model.getRigidBodies(); + + for (size_t i(0); i < m_rodSegments.size(); ++i) + { + RodSegmentImpl & segment = m_Segments[i]; + RigidBody &rb1 = *rbs[segment.m_segmentIdx]; + if (rb1.getMass() != 0.0) + { + rb1.getPosition() += m_corr_x[i]; + rb1.getRotation().coeffs() += m_corr_q[i].coeffs(); + rb1.getRotation().normalize(); + rb1.rotationUpdated(); + } + } + + return res; +} + +bool PBD::DirectPositionBasedSolverForStiffRodsConstraint::RodSegmentImpl::isDynamic() +{ + return 0 != (m_model.getRigidBodies())[m_segmentIdx]->getMass(); +} + +Real PBD::DirectPositionBasedSolverForStiffRodsConstraint::RodSegmentImpl::Mass() +{ + return (m_model.getRigidBodies())[m_segmentIdx]->getMass(); +} + +const Vector3r & PBD::DirectPositionBasedSolverForStiffRodsConstraint::RodSegmentImpl::InertiaTensor() +{ + return (m_model.getRigidBodies())[m_segmentIdx]->getInertiaTensor(); +} + +const Vector3r & PBD::DirectPositionBasedSolverForStiffRodsConstraint::RodSegmentImpl::Position() +{ + return (m_model.getRigidBodies())[m_segmentIdx]->getPosition(); +} + +const Quaternionr & PBD::DirectPositionBasedSolverForStiffRodsConstraint::RodSegmentImpl::Rotation() +{ + return (m_model.getRigidBodies())[m_segmentIdx]->getRotation(); +} diff --git a/Simulation/Constraints.h b/Simulation/Constraints.h new file mode 100644 index 00000000..d91d61b2 --- /dev/null +++ b/Simulation/Constraints.h @@ -0,0 +1,729 @@ +#ifndef _CONSTRAINTS_H +#define _CONSTRAINTS_H + +#include "Common/Common.h" +#define _USE_MATH_DEFINES +#include "math.h" +#include +#include +#include +#include +#include "PositionBasedDynamics/DirectPositionBasedSolverForStiffRodsInterface.h" + +namespace PBD +{ + class SimulationModel; + + class Constraint + { + public: + /** indices of the linked bodies */ + std::vector m_bodies; + + Constraint(const unsigned int numberOfBodies) + { + m_bodies.resize(numberOfBodies); + } + + unsigned int numberOfBodies() const { return static_cast(m_bodies.size()); } + virtual ~Constraint() {}; + virtual int &getTypeId() const = 0; + + virtual bool initConstraintBeforeProjection(SimulationModel &model) { return true; }; + virtual bool updateConstraint(SimulationModel &model) { return true; }; + virtual bool solvePositionConstraint(SimulationModel &model, const unsigned int iter) { return true; }; + virtual bool solveVelocityConstraint(SimulationModel &model, const unsigned int iter) { return true; }; + }; + + class BallJoint : public Constraint + { + public: + static int TYPE_ID; + Eigen::Matrix m_jointInfo; + + BallJoint() : Constraint(2) {} + virtual int &getTypeId() const { return TYPE_ID; } + + bool initConstraint(SimulationModel &model, const unsigned int rbIndex1, const unsigned int rbIndex2, const Vector3r &pos); + virtual bool updateConstraint(SimulationModel &model); + virtual bool solvePositionConstraint(SimulationModel &model, const unsigned int iter); + }; + + class BallOnLineJoint : public Constraint + { + public: + static int TYPE_ID; + Eigen::Matrix m_jointInfo; + + BallOnLineJoint() : Constraint(2) {} + virtual int &getTypeId() const { return TYPE_ID; } + + bool initConstraint(SimulationModel &model, const unsigned int rbIndex1, const unsigned int rbIndex2, const Vector3r &pos, const Vector3r &dir); + virtual bool updateConstraint(SimulationModel &model); + virtual bool solvePositionConstraint(SimulationModel &model, const unsigned int iter); + }; + + class HingeJoint : public Constraint + { + public: + static int TYPE_ID; + Eigen::Matrix m_jointInfo; + + HingeJoint() : Constraint(2) {} + virtual int &getTypeId() const { return TYPE_ID; } + + bool initConstraint(SimulationModel &model, const unsigned int rbIndex1, const unsigned int rbIndex2, const Vector3r &pos, const Vector3r &axis); + virtual bool updateConstraint(SimulationModel &model); + virtual bool solvePositionConstraint(SimulationModel &model, const unsigned int iter); + }; + + class UniversalJoint : public Constraint + { + public: + static int TYPE_ID; + Eigen::Matrix m_jointInfo; + + UniversalJoint() : Constraint(2) {} + virtual int &getTypeId() const { return TYPE_ID; } + + bool initConstraint(SimulationModel &model, const unsigned int rbIndex1, const unsigned int rbIndex2, const Vector3r &pos, const Vector3r &axis1, const Vector3r &axis2); + virtual bool updateConstraint(SimulationModel &model); + virtual bool solvePositionConstraint(SimulationModel &model, const unsigned int iter); + }; + + class SliderJoint : public Constraint + { + public: + static int TYPE_ID; + Eigen::Matrix m_jointInfo; + + SliderJoint() : Constraint(2) {} + virtual int &getTypeId() const { return TYPE_ID; } + + bool initConstraint(SimulationModel &model, const unsigned int rbIndex1, const unsigned int rbIndex2, const Vector3r &axis); + virtual bool updateConstraint(SimulationModel &model); + virtual bool solvePositionConstraint(SimulationModel &model, const unsigned int iter); + }; + + class MotorJoint: public Constraint + { + public: + Real m_target; + std::vector m_targetSequence; + MotorJoint() : Constraint(2) { m_target = 0.0; } + + virtual Real getTarget() const { return m_target; } + virtual void setTarget(const Real val) { m_target = val; } + + virtual std::vector &getTargetSequence() { return m_targetSequence; } + virtual void setTargetSequence(const std::vector &val) { m_targetSequence = val; } + + bool getRepeatSequence() const { return m_repeatSequence; } + void setRepeatSequence(bool val) { m_repeatSequence = val; } + + private: + bool m_repeatSequence; + }; + + class TargetPositionMotorSliderJoint : public MotorJoint + { + public: + static int TYPE_ID; + Eigen::Matrix m_jointInfo; + + TargetPositionMotorSliderJoint() : MotorJoint() {} + virtual int &getTypeId() const { return TYPE_ID; } + + bool initConstraint(SimulationModel &model, const unsigned int rbIndex1, const unsigned int rbIndex2, const Vector3r &axis); + virtual bool updateConstraint(SimulationModel &model); + virtual bool solvePositionConstraint(SimulationModel &model, const unsigned int iter); + }; + + class TargetVelocityMotorSliderJoint : public MotorJoint + { + public: + static int TYPE_ID; + Eigen::Matrix m_jointInfo; + + TargetVelocityMotorSliderJoint() : MotorJoint() {} + virtual int &getTypeId() const { return TYPE_ID; } + + bool initConstraint(SimulationModel &model, const unsigned int rbIndex1, const unsigned int rbIndex2, const Vector3r &axis); + virtual bool updateConstraint(SimulationModel &model); + virtual bool solvePositionConstraint(SimulationModel &model, const unsigned int iter); + virtual bool solveVelocityConstraint(SimulationModel &model, const unsigned int iter); + }; + + class TargetAngleMotorHingeJoint : public MotorJoint + { + public: + static int TYPE_ID; + Eigen::Matrix m_jointInfo; + TargetAngleMotorHingeJoint() : MotorJoint() {} + virtual int &getTypeId() const { return TYPE_ID; } + + virtual void setTarget(const Real val) + { + const Real pi = (Real)M_PI; + m_target = std::max(val, -pi); + m_target = std::min(m_target, pi); + } + + bool initConstraint(SimulationModel &model, const unsigned int rbIndex1, const unsigned int rbIndex2, const Vector3r &pos, const Vector3r &axis); + virtual bool updateConstraint(SimulationModel &model); + virtual bool solvePositionConstraint(SimulationModel &model, const unsigned int iter); + private: + std::vector m_targetSequence; + }; + + class TargetVelocityMotorHingeJoint : public MotorJoint + { + public: + static int TYPE_ID; + Eigen::Matrix m_jointInfo; + TargetVelocityMotorHingeJoint() : MotorJoint() {} + virtual int &getTypeId() const { return TYPE_ID; } + + bool initConstraint(SimulationModel &model, const unsigned int rbIndex1, const unsigned int rbIndex2, const Vector3r &pos, const Vector3r &axis); + virtual bool updateConstraint(SimulationModel &model); + virtual bool solvePositionConstraint(SimulationModel &model, const unsigned int iter); + virtual bool solveVelocityConstraint(SimulationModel &model, const unsigned int iter); + }; + + class DamperJoint : public Constraint + { + public: + static int TYPE_ID; + Real m_stiffness; + Eigen::Matrix m_jointInfo; + Real m_lambda; + + DamperJoint() : Constraint(2) {} + virtual int &getTypeId() const { return TYPE_ID; } + + bool initConstraint(SimulationModel &model, const unsigned int rbIndex1, const unsigned int rbIndex2, const Vector3r &axis, const Real stiffness); + virtual bool updateConstraint(SimulationModel &model); + virtual bool solvePositionConstraint(SimulationModel &model, const unsigned int iter); + }; + + class RigidBodyParticleBallJoint : public Constraint + { + public: + static int TYPE_ID; + Eigen::Matrix m_jointInfo; + + RigidBodyParticleBallJoint() : Constraint(2) {} + virtual int &getTypeId() const { return TYPE_ID; } + + bool initConstraint(SimulationModel &model, const unsigned int rbIndex, const unsigned int particleIndex); + virtual bool updateConstraint(SimulationModel &model); + virtual bool solvePositionConstraint(SimulationModel &model, const unsigned int iter); + }; + + class RigidBodySpring : public Constraint + { + public: + static int TYPE_ID; + Eigen::Matrix m_jointInfo; + Real m_restLength; + Real m_stiffness; + Real m_lambda; + + RigidBodySpring() : Constraint(2) {} + virtual int &getTypeId() const { return TYPE_ID; } + + bool initConstraint(SimulationModel &model, const unsigned int rbIndex1, const unsigned int rbIndex2, const Vector3r &pos1, const Vector3r &pos2, const Real stiffness); + virtual bool updateConstraint(SimulationModel &model); + virtual bool solvePositionConstraint(SimulationModel &model, const unsigned int iter); + }; + + class DistanceJoint : public Constraint + { + public: + static int TYPE_ID; + Eigen::Matrix m_jointInfo; + Real m_restLength; + + DistanceJoint() : Constraint(2) {} + virtual int &getTypeId() const { return TYPE_ID; } + + bool initConstraint(SimulationModel &model, const unsigned int rbIndex1, const unsigned int rbIndex2, const Vector3r &pos1, const Vector3r &pos2); + virtual bool updateConstraint(SimulationModel &model); + virtual bool solvePositionConstraint(SimulationModel &model, const unsigned int iter); + }; + + class DistanceConstraint : public Constraint + { + public: + static int TYPE_ID; + Real m_restLength; + Real m_stiffness; + + DistanceConstraint() : Constraint(2) {} + virtual int &getTypeId() const { return TYPE_ID; } + + virtual bool initConstraint(SimulationModel &model, const unsigned int particle1, const unsigned int particle2, const Real stiffness); + virtual bool solvePositionConstraint(SimulationModel &model, const unsigned int iter); + }; + + class DistanceConstraint_XPBD : public Constraint + { + public: + static int TYPE_ID; + Real m_restLength; + Real m_lambda; + Real m_stiffness; + + DistanceConstraint_XPBD() : Constraint(2) {} + virtual int& getTypeId() const { return TYPE_ID; } + + virtual bool initConstraint(SimulationModel& model, const unsigned int particle1, const unsigned int particle2, const Real stiffness); + virtual bool solvePositionConstraint(SimulationModel& model, const unsigned int iter); + }; + + class DihedralConstraint : public Constraint + { + public: + static int TYPE_ID; + Real m_restAngle; + Real m_stiffness; + + DihedralConstraint() : Constraint(4) {} + virtual int &getTypeId() const { return TYPE_ID; } + + virtual bool initConstraint(SimulationModel &model, const unsigned int particle1, const unsigned int particle2, + const unsigned int particle3, const unsigned int particle4, const Real stiffness); + virtual bool solvePositionConstraint(SimulationModel &model, const unsigned int iter); + }; + + class IsometricBendingConstraint : public Constraint + { + public: + static int TYPE_ID; + Real m_stiffness; + Matrix4r m_Q; + + IsometricBendingConstraint() : Constraint(4) {} + virtual int &getTypeId() const { return TYPE_ID; } + + virtual bool initConstraint(SimulationModel &model, const unsigned int particle1, const unsigned int particle2, + const unsigned int particle3, const unsigned int particle4, const Real stiffness); + virtual bool solvePositionConstraint(SimulationModel &model, const unsigned int iter); + }; + + class IsometricBendingConstraint_XPBD : public Constraint + { + public: + static int TYPE_ID; + Real m_stiffness; + Matrix4r m_Q; + Real m_lambda; + + IsometricBendingConstraint_XPBD() : Constraint(4) {} + virtual int& getTypeId() const { return TYPE_ID; } + + virtual bool initConstraint(SimulationModel& model, const unsigned int particle1, const unsigned int particle2, + const unsigned int particle3, const unsigned int particle4, const Real stiffness); + virtual bool solvePositionConstraint(SimulationModel& model, const unsigned int iter); + }; + + class FEMTriangleConstraint : public Constraint + { + public: + static int TYPE_ID; + Real m_area; + Matrix2r m_invRestMat; + Real m_xxStiffness; + Real m_xyStiffness; + Real m_yyStiffness; + Real m_xyPoissonRatio; + Real m_yxPoissonRatio; + + FEMTriangleConstraint() : Constraint(3) {} + virtual int &getTypeId() const { return TYPE_ID; } + + virtual bool initConstraint(SimulationModel &model, const unsigned int particle1, const unsigned int particle2, + const unsigned int particle3, const Real xxStiffness, const Real yyStiffness, const Real xyStiffness, + const Real xyPoissonRatio, const Real yxPoissonRatio); + virtual bool solvePositionConstraint(SimulationModel &model, const unsigned int iter); + }; + + class StrainTriangleConstraint : public Constraint + { + public: + static int TYPE_ID; + Matrix2r m_invRestMat; + Real m_xxStiffness; + Real m_xyStiffness; + Real m_yyStiffness; + bool m_normalizeStretch; + bool m_normalizeShear; + + StrainTriangleConstraint() : Constraint(3) {} + virtual int &getTypeId() const { return TYPE_ID; } + + virtual bool initConstraint(SimulationModel &model, const unsigned int particle1, const unsigned int particle2, + const unsigned int particle3, const Real xxStiffness, const Real yyStiffness, const Real xyStiffness, + const bool normalizeStretch, const bool normalizeShear); + virtual bool solvePositionConstraint(SimulationModel &model, const unsigned int iter); + }; + + class VolumeConstraint : public Constraint + { + public: + static int TYPE_ID; + Real m_stiffness; + Real m_restVolume; + + VolumeConstraint() : Constraint(4) {} + virtual int &getTypeId() const { return TYPE_ID; } + + virtual bool initConstraint(SimulationModel &model, const unsigned int particle1, const unsigned int particle2, + const unsigned int particle3, const unsigned int particle4, const Real stiffness); + virtual bool solvePositionConstraint(SimulationModel &model, const unsigned int iter); + }; + + class VolumeConstraint_XPBD : public Constraint + { + public: + static int TYPE_ID; + Real m_stiffness; + Real m_restVolume; + Real m_lambda; + + VolumeConstraint_XPBD() : Constraint(4) {} + virtual int& getTypeId() const { return TYPE_ID; } + + virtual bool initConstraint(SimulationModel& model, const unsigned int particle1, const unsigned int particle2, + const unsigned int particle3, const unsigned int particle4, const Real stiffness); + virtual bool solvePositionConstraint(SimulationModel& model, const unsigned int iter); + }; + + class FEMTetConstraint : public Constraint + { + public: + static int TYPE_ID; + Real m_stiffness; + Real m_poissonRatio; + Real m_volume; + Matrix3r m_invRestMat; + + FEMTetConstraint() : Constraint(4) {} + virtual int &getTypeId() const { return TYPE_ID; } + + virtual bool initConstraint(SimulationModel &model, const unsigned int particle1, const unsigned int particle2, + const unsigned int particle3, const unsigned int particle4, + const Real stiffness, const Real poissonRatio); + virtual bool solvePositionConstraint(SimulationModel &model, const unsigned int iter); + }; + + class XPBD_FEMTetConstraint : public Constraint + { + public: + static int TYPE_ID; + Real m_stiffness; + Real m_poissonRatio; + Real m_volume; + Matrix3r m_invRestMat; + Real m_lambda; + + XPBD_FEMTetConstraint() : Constraint(4) {} + virtual int& getTypeId() const { return TYPE_ID; } + + virtual bool initConstraint(SimulationModel &model, const unsigned int particle1, const unsigned int particle2, + const unsigned int particle3, const unsigned int particle4, + const Real stiffness, const Real poissonRatio); + virtual bool solvePositionConstraint(SimulationModel& model, const unsigned int iter); + }; + + class StrainTetConstraint : public Constraint + { + public: + static int TYPE_ID; + Real m_stretchStiffness; + Real m_shearStiffness; + Matrix3r m_invRestMat; + bool m_normalizeStretch; + bool m_normalizeShear; + + StrainTetConstraint() : Constraint(4) {} + virtual int &getTypeId() const { return TYPE_ID; } + + virtual bool initConstraint(SimulationModel &model, const unsigned int particle1, const unsigned int particle2, + const unsigned int particle3, const unsigned int particle4, + const Real stretchStiffness, const Real shearStiffness, + const bool normalizeStretch, const bool normalizeShear); + virtual bool solvePositionConstraint(SimulationModel &model, const unsigned int iter); + }; + + class ShapeMatchingConstraint : public Constraint + { + public: + static int TYPE_ID; + Real m_stiffness; + Vector3r m_restCm; + Real *m_w; + Vector3r *m_x0; + Vector3r *m_x; + Vector3r *m_corr; + unsigned int *m_numClusters; + + ShapeMatchingConstraint(const unsigned int numberOfParticles) : Constraint(numberOfParticles) + { + m_x = new Vector3r[numberOfParticles]; + m_x0 = new Vector3r[numberOfParticles]; + m_corr = new Vector3r[numberOfParticles]; + m_w = new Real[numberOfParticles]; + m_numClusters = new unsigned int[numberOfParticles]; + } + virtual ~ShapeMatchingConstraint() + { + delete[] m_x; + delete[] m_x0; + delete[] m_corr; + delete[] m_w; + delete[] m_numClusters; + } + virtual int &getTypeId() const { return TYPE_ID; } + + virtual bool initConstraint(SimulationModel &model, const unsigned int particleIndices[], const unsigned int numClusters[], const Real stiffness); + virtual bool solvePositionConstraint(SimulationModel &model, const unsigned int iter); + }; + + class RigidBodyContactConstraint + { + public: + static int TYPE_ID; + /** indices of the linked bodies */ + std::array m_bodies; + Real m_stiffness; + Real m_frictionCoeff; + Real m_sum_impulses; + Eigen::Matrix m_constraintInfo; + + RigidBodyContactConstraint() {} + ~RigidBodyContactConstraint() {} + virtual int &getTypeId() const { return TYPE_ID; } + + bool initConstraint(SimulationModel &model, const unsigned int rbIndex1, const unsigned int rbIndex2, + const Vector3r &cp1, const Vector3r &cp2, + const Vector3r &normal, const Real dist, + const Real restitutionCoeff, const Real stiffness, const Real frictionCoeff); + virtual bool solveVelocityConstraint(SimulationModel &model, const unsigned int iter); + }; + + class ParticleRigidBodyContactConstraint + { + public: + static int TYPE_ID; + /** indices of the linked bodies */ + std::array m_bodies; + Real m_stiffness; + Real m_frictionCoeff; + Real m_sum_impulses; + Eigen::Matrix m_constraintInfo; + + ParticleRigidBodyContactConstraint() {} + ~ParticleRigidBodyContactConstraint() {} + virtual int &getTypeId() const { return TYPE_ID; } + + bool initConstraint(SimulationModel &model, const unsigned int particleIndex, const unsigned int rbIndex, + const Vector3r &cp1, const Vector3r &cp2, + const Vector3r &normal, const Real dist, + const Real restitutionCoeff, const Real stiffness, const Real frictionCoeff); + virtual bool solveVelocityConstraint(SimulationModel &model, const unsigned int iter); + }; + + class ParticleTetContactConstraint + { + public: + static int TYPE_ID; + /** indices of the linked bodies */ + std::array m_bodies; + unsigned int m_solidIndex; + unsigned int m_tetIndex; + Vector3r m_bary; + Real m_lambda; + Real m_frictionCoeff; + Eigen::Matrix m_constraintInfo; + Real m_invMasses[4]; + std::array m_x; + std::array m_v; + + ParticleTetContactConstraint() { } + ~ParticleTetContactConstraint() {} + virtual int &getTypeId() const { return TYPE_ID; } + + bool initConstraint(SimulationModel &model, const unsigned int particleIndex, const unsigned int solidIndex, + const unsigned int tetindex, const Vector3r &bary, + const Vector3r &cp1, const Vector3r &cp2, + const Vector3r &normal, const Real dist, + const Real frictionCoeff); + virtual bool solvePositionConstraint(SimulationModel &model, const unsigned int iter); + virtual bool solveVelocityConstraint(SimulationModel &model, const unsigned int iter); + }; + + class StretchShearConstraint : public Constraint + { + public: + static int TYPE_ID; + Real m_restLength; + Real m_shearingStiffness1; + Real m_shearingStiffness2; + Real m_stretchingStiffness; + + StretchShearConstraint() : Constraint(3) {} + virtual int &getTypeId() const { return TYPE_ID; } + + virtual bool initConstraint(SimulationModel &model, const unsigned int particle1, const unsigned int particle2, + const unsigned int quaternion1, const Real stretchingStiffness, + const Real shearingStiffness1, const Real shearingStiffness2); + virtual bool solvePositionConstraint(SimulationModel &model, const unsigned int iter); + }; + + class BendTwistConstraint : public Constraint + { + public: + static int TYPE_ID; + Quaternionr m_restDarbouxVector; + Real m_bendingStiffness1; + Real m_bendingStiffness2; + Real m_twistingStiffness; + + BendTwistConstraint() : Constraint(2) {} + virtual int &getTypeId() const { return TYPE_ID; } + + virtual bool initConstraint(SimulationModel &model, const unsigned int quaternion1, + const unsigned int quaternion2, const Real twistingStiffness, + const Real bendingStiffness1, const Real bendingStiffness2); + virtual bool solvePositionConstraint(SimulationModel &model, const unsigned int iter); + }; + + class StretchBendingTwistingConstraint : public Constraint + { + using Matrix6r = Eigen::Matrix; + using Vector6r = Eigen::Matrix; + public: + static int TYPE_ID; + Eigen::Matrix m_constraintInfo; + + Real m_averageRadius; + Real m_averageSegmentLength; + Vector3r m_restDarbouxVector; + Vector3r m_stiffnessCoefficientK; + Vector3r m_stretchCompliance; + Vector3r m_bendingAndTorsionCompliance; + Vector6r m_lambdaSum; + + StretchBendingTwistingConstraint() : Constraint(2){} + + virtual int &getTypeId() const { return TYPE_ID; } + + bool initConstraint(SimulationModel &model, const unsigned int segmentIndex1, const unsigned int segmentIndex2, const Vector3r &pos, + const Real averageRadius, const Real averageSegmentLength, Real youngsModulus, Real torsionModulus); + virtual bool initConstraintBeforeProjection(SimulationModel &model); + virtual bool updateConstraint(SimulationModel &model); + virtual bool solvePositionConstraint(SimulationModel &model, const unsigned int iter); + }; + + struct Node; + struct Interval; + class SimulationModel; + using Vector6r = Eigen::Matrix; + + class DirectPositionBasedSolverForStiffRodsConstraint : public Constraint + { + class RodSegmentImpl : public RodSegment + { + public: + RodSegmentImpl(SimulationModel &model, unsigned int idx) : + m_model(model), m_segmentIdx(idx) {}; + + virtual bool isDynamic(); + virtual Real Mass(); + virtual const Vector3r & InertiaTensor(); + virtual const Vector3r & Position(); + virtual const Quaternionr & Rotation(); + + SimulationModel &m_model; + unsigned int m_segmentIdx; + }; + + class RodConstraintImpl : public RodConstraint + { + public: + std::vector m_segments; + Eigen::Matrix m_constraintInfo; + + Real m_averageRadius; + Real m_averageSegmentLength; + Vector3r m_restDarbouxVector; + Vector3r m_stiffnessCoefficientK; + Vector3r m_stretchCompliance; + Vector3r m_bendingAndTorsionCompliance; + + virtual unsigned int segmentIndex(unsigned int i){ + if (i < static_cast(m_segments.size())) + return m_segments[i]; + return 0u; + }; + + virtual Eigen::Matrix & getConstraintInfo(){ return m_constraintInfo; } + virtual Real getAverageSegmentLength(){ return m_averageSegmentLength; } + virtual Vector3r &getRestDarbouxVector(){ return m_restDarbouxVector; } + virtual Vector3r &getStiffnessCoefficientK() { return m_stiffnessCoefficientK; }; + virtual Vector3r & getStretchCompliance(){ return m_stretchCompliance; } + virtual Vector3r & getBendingAndTorsionCompliance(){ return m_bendingAndTorsionCompliance; } + }; + + public: + static int TYPE_ID; + + DirectPositionBasedSolverForStiffRodsConstraint() : Constraint(2), + root(NULL), numberOfIntervals(0), intervals(NULL), forward(NULL), backward(NULL){} + ~DirectPositionBasedSolverForStiffRodsConstraint(); + + virtual int &getTypeId() const { return TYPE_ID; } + + bool initConstraint(SimulationModel &model, + const std::vector> & constraintSegmentIndices, + const std::vector &constraintPositions, + const std::vector &averageRadii, + const std::vector &averageSegmentLengths, + const std::vector &youngsModuli, + const std::vector &torsionModuli); + + virtual bool initConstraintBeforeProjection(SimulationModel &model); + virtual bool updateConstraint(SimulationModel &model); + virtual bool solvePositionConstraint(SimulationModel &model, const unsigned int iter); + + protected: + + /** root node */ + Node *root; + /** intervals of constraints */ + Interval *intervals; + /** number of intervals */ + int numberOfIntervals; + /** list to process nodes with increasing row index in the system matrix H (from the leaves to the root) */ + std::list *forward; + /** list to process nodes starting with the highest row index to row index zero in the matrix H (from the root to the leaves) */ + std::list *backward; + + std::vector m_Constraints; + std::vector m_rodConstraints; + + std::vector m_Segments; + std::vector m_rodSegments; + + std::vector m_rightHandSide; + std::vector m_lambdaSums; + std::vector> m_bendingAndTorsionJacobians; + std::vector m_corr_x; + std::vector m_corr_q; + + void deleteNodes(); + }; +} + +#endif diff --git a/Simulation/CubicSDFCollisionDetection.cpp b/Simulation/CubicSDFCollisionDetection.cpp new file mode 100644 index 00000000..2dd1cbf0 --- /dev/null +++ b/Simulation/CubicSDFCollisionDetection.cpp @@ -0,0 +1,98 @@ +#include "CubicSDFCollisionDetection.h" +#include "Simulation/IDFactory.h" +#include "Eigen/Dense" + +using namespace PBD; + +int CubicSDFCollisionDetection::CubicSDFCollisionObject::TYPE_ID = IDFactory::getId(); + +CubicSDFCollisionDetection::CubicSDFCollisionDetection() : + DistanceFieldCollisionDetection() +{ +} + +CubicSDFCollisionDetection::~CubicSDFCollisionDetection() +{ +} + +bool CubicSDFCollisionDetection::isDistanceFieldCollisionObject(CollisionObject *co) const +{ + return DistanceFieldCollisionDetection::isDistanceFieldCollisionObject(co) || + (co->getTypeId() == CubicSDFCollisionDetection::CubicSDFCollisionObject::TYPE_ID); +} + +void CubicSDFCollisionDetection::addCubicSDFCollisionObject(const unsigned int bodyIndex, const unsigned int bodyType, const Vector3r *vertices, const unsigned int numVertices, const std::string &sdfFile, const Vector3r &scale, const bool testMesh, const bool invertSDF) +{ + CubicSDFCollisionDetection::CubicSDFCollisionObject *co = new CubicSDFCollisionDetection::CubicSDFCollisionObject(); + co->m_bodyIndex = bodyIndex; + co->m_bodyType = bodyType; + co->m_sdfFile = sdfFile; + co->m_scale = scale; + co->m_sdf = std::make_shared(co->m_sdfFile); + co->m_bvh.init(vertices, numVertices); + co->m_bvh.construct(); + co->m_testMesh = testMesh; + co->m_invertSDF = 1.0; + if (invertSDF) + co->m_invertSDF = -1.0; + m_collisionObjects.push_back(co); +} + +void PBD::CubicSDFCollisionDetection::addCubicSDFCollisionObject(const unsigned int bodyIndex, const unsigned int bodyType, const Vector3r *vertices, const unsigned int numVertices, GridPtr sdf, const Vector3r &scale, const bool testMesh /*= true*/, const bool invertSDF /*= false*/) +{ + CubicSDFCollisionDetection::CubicSDFCollisionObject *co = new CubicSDFCollisionDetection::CubicSDFCollisionObject(); + co->m_bodyIndex = bodyIndex; + co->m_bodyType = bodyType; + co->m_sdfFile = ""; + co->m_scale = scale; + co->m_sdf = sdf; + co->m_bvh.init(vertices, numVertices); + co->m_bvh.construct(); + co->m_testMesh = testMesh; + co->m_invertSDF = 1.0; + if (invertSDF) + co->m_invertSDF = -1.0; + m_collisionObjects.push_back(co); +} + +CubicSDFCollisionDetection::CubicSDFCollisionObject::CubicSDFCollisionObject() +{ +} + +CubicSDFCollisionDetection::CubicSDFCollisionObject::~CubicSDFCollisionObject() +{ +} + +double CubicSDFCollisionDetection::CubicSDFCollisionObject::distance(const Eigen::Vector3d &x, const Real tolerance) +{ + const Eigen::Vector3d scaled_x = x.cwiseProduct(m_scale.template cast().cwiseInverse()); + const double dist = m_sdf->interpolate(0, scaled_x); + if (dist == std::numeric_limits::max()) + return dist; + return m_invertSDF * m_scale[0]*dist - tolerance; +} + +bool CubicSDFCollisionDetection::CubicSDFCollisionObject::collisionTest(const Vector3r &x, const Real tolerance, Vector3r &cp, Vector3r &n, Real &dist, const Real maxDist) +{ + const Vector3r scaled_x = x.cwiseProduct(m_scale.cwiseInverse()); + + Eigen::Vector3d normal; + double d = m_sdf->interpolate(0, scaled_x.template cast(), &normal); + if (d == std::numeric_limits::max()) + return false; + dist = static_cast(m_invertSDF * d - tolerance); + + normal = m_invertSDF * normal; + if (dist < maxDist) + { + normal.normalize(); + n = normal.template cast(); + + cp = (scaled_x - dist * n); + cp = cp.cwiseProduct(m_scale); + + return true; + } + return false; +} + diff --git a/Simulation/CubicSDFCollisionDetection.h b/Simulation/CubicSDFCollisionDetection.h new file mode 100644 index 00000000..3763c636 --- /dev/null +++ b/Simulation/CubicSDFCollisionDetection.h @@ -0,0 +1,45 @@ +#ifndef _CubicSDFCollisionDetection_H +#define _CubicSDFCollisionDetection_H + +#include "Common/Common.h" +#include "Simulation/DistanceFieldCollisionDetection.h" +#include + +#include "Discregrid/All" + +namespace PBD +{ + /** Collision detection based on cubic signed distance fields. + */ + class CubicSDFCollisionDetection : public DistanceFieldCollisionDetection + { + public: + using Grid = Discregrid::CubicLagrangeDiscreteGrid; + using GridPtr = std::shared_ptr; + + struct CubicSDFCollisionObject : public DistanceFieldCollisionDetection::DistanceFieldCollisionObject + { + std::string m_sdfFile; + Vector3r m_scale; + GridPtr m_sdf; + static int TYPE_ID; + + CubicSDFCollisionObject(); + virtual ~CubicSDFCollisionObject(); + virtual int &getTypeId() const { return TYPE_ID; } + virtual bool collisionTest(const Vector3r &x, const Real tolerance, Vector3r &cp, Vector3r &n, Real &dist, const Real maxDist = 0.0); + virtual double distance(const Eigen::Vector3d &x, const Real tolerance); + }; + + public: + CubicSDFCollisionDetection(); + virtual ~CubicSDFCollisionDetection(); + + virtual bool isDistanceFieldCollisionObject(CollisionObject *co) const; + + void addCubicSDFCollisionObject(const unsigned int bodyIndex, const unsigned int bodyType, const Vector3r *vertices, const unsigned int numVertices, const std::string &sdfFile, const Vector3r &scale, const bool testMesh = true, const bool invertSDF = false); + void addCubicSDFCollisionObject(const unsigned int bodyIndex, const unsigned int bodyType, const Vector3r *vertices, const unsigned int numVertices, GridPtr sdf, const Vector3r &scale, const bool testMesh = true, const bool invertSDF = false); + }; +} + +#endif diff --git a/Simulation/DistanceFieldCollisionDetection.cpp b/Simulation/DistanceFieldCollisionDetection.cpp new file mode 100644 index 00000000..9764d0c0 --- /dev/null +++ b/Simulation/DistanceFieldCollisionDetection.cpp @@ -0,0 +1,814 @@ +#include "DistanceFieldCollisionDetection.h" +#include "Simulation/IDFactory.h" +#include "omp.h" + +using namespace PBD; +using namespace Utilities; + +int DistanceFieldCollisionDetection::DistanceFieldCollisionBox::TYPE_ID = IDFactory::getId(); +int DistanceFieldCollisionDetection::DistanceFieldCollisionSphere::TYPE_ID = IDFactory::getId(); +int DistanceFieldCollisionDetection::DistanceFieldCollisionTorus::TYPE_ID = IDFactory::getId(); +int DistanceFieldCollisionDetection::DistanceFieldCollisionCylinder::TYPE_ID = IDFactory::getId(); +int DistanceFieldCollisionDetection::DistanceFieldCollisionHollowSphere::TYPE_ID = IDFactory::getId(); +int DistanceFieldCollisionDetection::DistanceFieldCollisionHollowBox::TYPE_ID = IDFactory::getId(); +int DistanceFieldCollisionDetection::DistanceFieldCollisionObjectWithoutGeometry::TYPE_ID = IDFactory::getId(); + + +DistanceFieldCollisionDetection::DistanceFieldCollisionDetection() : + CollisionDetection() +{ +} + +DistanceFieldCollisionDetection::~DistanceFieldCollisionDetection() +{ +} + +void DistanceFieldCollisionDetection::collisionDetection(SimulationModel &model) +{ + model.resetContacts(); + const SimulationModel::RigidBodyVector &rigidBodies = model.getRigidBodies(); + const SimulationModel::TriangleModelVector &triModels = model.getTriangleModels(); + const SimulationModel::TetModelVector &tetModels = model.getTetModels(); + const ParticleData &pd = model.getParticles(); + + std::vector < std::pair> coPairs; + for (unsigned int i = 0; i < m_collisionObjects.size(); i++) + { + CollisionDetection::CollisionObject *co1 = m_collisionObjects[i]; + for (unsigned int k = 0; k < m_collisionObjects.size(); k++) + { + CollisionDetection::CollisionObject *co2 = m_collisionObjects[k]; + if ((i != k)) + { + // ToDo: self collisions for deformables + coPairs.push_back({ i, k }); + } + } + } + + //omp_set_num_threads(1); + std::vector > contacts_mt; +#ifdef _DEBUG + const unsigned int maxThreads = 1; +#else + const unsigned int maxThreads = omp_get_max_threads(); +#endif + contacts_mt.resize(maxThreads); + + #pragma omp parallel default(shared) + { + // Update BVHs + #pragma omp for schedule(static) + for (int i = 0; i < (int)m_collisionObjects.size(); i++) + { + CollisionDetection::CollisionObject *co = m_collisionObjects[i]; + updateAABB(model, co); + if (isDistanceFieldCollisionObject(co)) + { + if (co->m_bodyType == CollisionDetection::CollisionObject::TriangleModelCollisionObjectType) + { + DistanceFieldCollisionObject *sco = (DistanceFieldCollisionObject*)co; + + TriangleModel* tm = triModels[co->m_bodyIndex]; + const unsigned int offset = tm->getIndexOffset(); + const IndexedFaceMesh& mesh = tm->getParticleMesh(); + const unsigned int numVert = mesh.numVertices(); + sco->m_bvh.init(&pd.getPosition(offset), numVert); + sco->m_bvh.update(); + } + else if (co->m_bodyType == CollisionDetection::CollisionObject::TetModelCollisionObjectType) + { + TetModel* tm = tetModels[co->m_bodyIndex]; + const unsigned int offset = tm->getIndexOffset(); + const IndexedTetMesh& mesh = tm->getParticleMesh(); + const unsigned int numVert = mesh.numVertices(); + + DistanceFieldCollisionObject *sco = (DistanceFieldCollisionObject*)co; + sco->m_bvh.init(&pd.getPosition(offset), numVert); + sco->m_bvhTets.updateVertices(&pd.getPosition(offset)); + sco->m_bvhTets0.updateVertices(&pd.getPosition(offset)); + + sco->m_bvh.update(); + sco->m_bvhTets.update(); + } + } + } + + #pragma omp for schedule(static) + for (int i = 0; i < (int)coPairs.size(); i++) + { + std::pair &coPair = coPairs[i]; + CollisionDetection::CollisionObject *co1 = m_collisionObjects[coPair.first]; + CollisionDetection::CollisionObject *co2 = m_collisionObjects[coPair.second]; + + if (((co2->m_bodyType != CollisionDetection::CollisionObject::RigidBodyCollisionObjectType) && + (co2->m_bodyType != CollisionDetection::CollisionObject::TetModelCollisionObjectType)) || + !isDistanceFieldCollisionObject(co1) || + !isDistanceFieldCollisionObject(co2) || + !AABB::intersection(co1->m_aabb, co2->m_aabb)) + continue; + + + if ((co1->m_bodyType == CollisionDetection::CollisionObject::RigidBodyCollisionObjectType) && + (co2->m_bodyType == CollisionDetection::CollisionObject::RigidBodyCollisionObjectType) && + ((DistanceFieldCollisionObject*) co1)->m_testMesh) + { + RigidBody *rb1 = rigidBodies[co1->m_bodyIndex]; + RigidBody *rb2 = rigidBodies[co2->m_bodyIndex]; + const Real restitutionCoeff = rb1->getRestitutionCoeff() * rb2->getRestitutionCoeff(); + const Real frictionCoeff = rb1->getFrictionCoeff() + rb2->getFrictionCoeff(); + collisionDetectionRigidBodies(rb1, (DistanceFieldCollisionObject*)co1, rb2, (DistanceFieldCollisionObject*)co2, + restitutionCoeff, frictionCoeff + , contacts_mt + ); + } + else if ((co1->m_bodyType == CollisionDetection::CollisionObject::TriangleModelCollisionObjectType) && + (co2->m_bodyType == CollisionDetection::CollisionObject::RigidBodyCollisionObjectType) && + ((DistanceFieldCollisionObject*)co1)->m_testMesh) + { + TriangleModel *tm = triModels[co1->m_bodyIndex]; + RigidBody *rb2 = rigidBodies[co2->m_bodyIndex]; + const unsigned int offset = tm->getIndexOffset(); + const IndexedFaceMesh &mesh = tm->getParticleMesh(); + const unsigned int numVert = mesh.numVertices(); + const Real restitutionCoeff = tm->getRestitutionCoeff() * rb2->getRestitutionCoeff(); + const Real frictionCoeff = tm->getFrictionCoeff() + rb2->getFrictionCoeff(); + collisionDetectionRBSolid(pd, offset, numVert, (DistanceFieldCollisionObject*)co1, rb2, (DistanceFieldCollisionObject*)co2, + restitutionCoeff, frictionCoeff + , contacts_mt + ); + } + else if ((co1->m_bodyType == CollisionDetection::CollisionObject::TetModelCollisionObjectType) && + (co2->m_bodyType == CollisionDetection::CollisionObject::RigidBodyCollisionObjectType) && + ((DistanceFieldCollisionObject*)co1)->m_testMesh) + { + TetModel *tm = tetModels[co1->m_bodyIndex]; + RigidBody *rb2 = rigidBodies[co2->m_bodyIndex]; + const unsigned int offset = tm->getIndexOffset(); + const IndexedTetMesh &mesh = tm->getParticleMesh(); + const unsigned int numVert = mesh.numVertices(); + const Real restitutionCoeff = tm->getRestitutionCoeff() * rb2->getRestitutionCoeff(); + const Real frictionCoeff = tm->getFrictionCoeff() + rb2->getFrictionCoeff(); + collisionDetectionRBSolid(pd, offset, numVert, (DistanceFieldCollisionObject*)co1, rb2, (DistanceFieldCollisionObject*)co2, + restitutionCoeff, frictionCoeff + , contacts_mt + ); + } + else if ((co1->m_bodyType == CollisionDetection::CollisionObject::TetModelCollisionObjectType) && + (co2->m_bodyType == CollisionDetection::CollisionObject::TetModelCollisionObjectType) && + ((DistanceFieldCollisionObject*)co1)->m_testMesh) + { + TetModel *tm1 = tetModels[co1->m_bodyIndex]; + TetModel *tm2 = tetModels[co2->m_bodyIndex]; + const unsigned int offset = tm1->getIndexOffset(); + const IndexedTetMesh &mesh = tm1->getParticleMesh(); + const unsigned int numVert = mesh.numVertices(); + const Real restitutionCoeff = tm1->getRestitutionCoeff() * tm2->getRestitutionCoeff(); + const Real frictionCoeff = tm1->getFrictionCoeff() + tm2->getFrictionCoeff(); + collisionDetectionSolidSolid(pd, offset, numVert, (DistanceFieldCollisionObject*)co1, tm2, (DistanceFieldCollisionObject*)co2, + restitutionCoeff, frictionCoeff + , contacts_mt + ); + } + } + } + + for (unsigned int i = 0; i < contacts_mt.size(); i++) + { + for (unsigned int j = 0; j < contacts_mt[i].size(); j++) + { + if (contacts_mt[i][j].m_type == 1) + addParticleRigidBodyContact(contacts_mt[i][j].m_index1, contacts_mt[i][j].m_index2, + contacts_mt[i][j].m_cp1, contacts_mt[i][j].m_cp2, contacts_mt[i][j].m_normal, + contacts_mt[i][j].m_dist, contacts_mt[i][j].m_restitution, contacts_mt[i][j].m_friction); + else if (contacts_mt[i][j].m_type == 0) + addRigidBodyContact(contacts_mt[i][j].m_index1, contacts_mt[i][j].m_index2, + contacts_mt[i][j].m_cp1, contacts_mt[i][j].m_cp2, contacts_mt[i][j].m_normal, + contacts_mt[i][j].m_dist, contacts_mt[i][j].m_restitution, contacts_mt[i][j].m_friction); + else if (contacts_mt[i][j].m_type == 2) + { + addParticleSolidContact(contacts_mt[i][j].m_index1, contacts_mt[i][j].m_index2, + contacts_mt[i][j].m_elementIndex2, contacts_mt[i][j].m_bary2, + contacts_mt[i][j].m_cp1, contacts_mt[i][j].m_cp2, contacts_mt[i][j].m_normal, + contacts_mt[i][j].m_dist, contacts_mt[i][j].m_restitution, contacts_mt[i][j].m_friction); + } + } + } +} + +void DistanceFieldCollisionDetection::collisionDetectionRigidBodies(RigidBody *rb1, DistanceFieldCollisionObject *co1, RigidBody *rb2, DistanceFieldCollisionObject *co2, + const Real restitutionCoeff, const Real frictionCoeff + , std::vector > &contacts_mt + ) +{ + if ((rb1->getMass() == 0.0) && (rb2->getMass() == 0.0)) + return; + + const VertexData &vd = rb1->getGeometry().getVertexData(); + + const Vector3r &com2 = rb2->getPosition(); + + // remove the rotation of the main axis transformation that is performed + // to get a diagonal inertia tensor since the distance function is + // evaluated in local coordinates + // + // transformation world to local: + // p_local = R_initial^T ( R_MAT R^T (p_world - x) - x_initial + x_MAT) + // + // transformation local to: + // p_world = R R_MAT^T (R_initial p_local + x_initial - x_MAT) + x + // + const Matrix3r &R = rb2->getTransformationR(); + const Vector3r &v1 = rb2->getTransformationV1(); + const Vector3r &v2 = rb2->getTransformationV2(); + + const PointCloudBSH &bvh = ((DistanceFieldCollisionDetection::DistanceFieldCollisionObject*) co1)->m_bvh; + std::function predicate = [&](unsigned int node_index, unsigned int depth) + { + const BoundingSphere &bs = bvh.hull(node_index); + const Vector3r &sphere_x = bs.x(); + const Vector3r sphere_x_w = rb1->getRotation() * sphere_x + rb1->getPosition(); + + AlignedBox3r box3f; + box3f.extend(co2->m_aabb.m_p[0]); + box3f.extend(co2->m_aabb.m_p[1]); + const Real dist = box3f.exteriorDistance(sphere_x_w); + + // Test if center of bounding sphere intersects AABB + if (dist < bs.r()) + { + // Test if distance of center of bounding sphere to collision object is smaller than the radius + const Vector3r x = R * (sphere_x_w - com2) + v1; + const double dist2 = co2->distance(x.template cast(), m_tolerance); + if (dist2 == std::numeric_limits::max()) + return true; + if (dist2 < bs.r()) + return true; + } + return false; + }; + std::function cb = [&](unsigned int node_index, unsigned int depth) + { + auto const& node = bvh.node(node_index); + if (!node.is_leaf()) + return; + + for (auto i = node.begin; i < node.begin + node.n; ++i) + { + unsigned int index = bvh.entity(i); + const Vector3r &x_w = vd.getPosition(index); + const Vector3r x = R * (x_w - com2) + v1; + Vector3r cp, n; + Real dist; + if (co2->collisionTest(x, m_tolerance, cp, n, dist)) + { + const Vector3r cp_w = R.transpose() * cp + v2; + const Vector3r n_w = R.transpose() * n; + +#ifdef _DEBUG + int tid = 0; +#else + int tid = omp_get_thread_num(); +#endif + + contacts_mt[tid].push_back({ 0, co1->m_bodyIndex, co2->m_bodyIndex, x_w, cp_w, n_w, dist, restitutionCoeff, frictionCoeff }); + } + } + }; + bvh.traverse_depth_first(predicate, cb); +} + + +void DistanceFieldCollisionDetection::collisionDetectionRBSolid(const ParticleData &pd, const unsigned int offset, const unsigned int numVert, + DistanceFieldCollisionObject *co1, RigidBody *rb2, DistanceFieldCollisionObject *co2, + const Real restitutionCoeff, const Real frictionCoeff + , std::vector > &contacts_mt + ) +{ + const Vector3r &com2 = rb2->getPosition(); + + // remove the rotation of the main axis transformation that is performed + // to get a diagonal inertia tensor since the distance function is + // evaluated in local coordinates + // + // transformation world to local: + // p_local = R_initial^T ( R_MAT R^T (p_world - x) - x_initial + x_MAT) + // + // transformation local to: + // p_world = R R_MAT^T (R_initial p_local + x_initial - x_MAT) + x + // + const Matrix3r &R = rb2->getTransformationR(); + const Vector3r &v1 = rb2->getTransformationV1(); + const Vector3r &v2 = rb2->getTransformationV2(); + + const PointCloudBSH &bvh = ((DistanceFieldCollisionDetection::DistanceFieldCollisionObject*) co1)->m_bvh; + + std::function predicate = [&](unsigned int node_index, unsigned int depth) + { + const BoundingSphere &bs = bvh.hull(node_index); + const Vector3r &sphere_x_w = bs.x(); + + AlignedBox3r box3f; + box3f.extend(co2->m_aabb.m_p[0]); + box3f.extend(co2->m_aabb.m_p[1]); + const Real dist = box3f.exteriorDistance(sphere_x_w); + + // Test if center of bounding sphere intersects AABB + if (dist < bs.r()) + { + // Test if distance of center of bounding sphere to collision object is smaller than the radius + const Vector3r x = R * (sphere_x_w - com2) + v1; + const double dist2 = co2->distance(x.template cast(), m_tolerance); + if (dist2 == std::numeric_limits::max()) + return true; + if (dist2 < bs.r()) + return true; + } + return false; + }; + + std::function cb = [&](unsigned int node_index, unsigned int depth) + { + auto const& node = bvh.node(node_index); + if (!node.is_leaf()) + return; + + for (auto i = node.begin; i < node.begin + node.n; ++i) + { + unsigned int index = bvh.entity(i) + offset; + const Vector3r &x_w = pd.getPosition(index); + const Vector3r x = R * (x_w - com2) + v1; + Vector3r cp, n; + Real dist; + if (co2->collisionTest(x, m_tolerance, cp, n, dist)) + { + const Vector3r cp_w = R.transpose() * cp + v2; + const Vector3r n_w = R.transpose() * n; + +#ifdef _DEBUG + int tid = 0; +#else + int tid = omp_get_thread_num(); +#endif + contacts_mt[tid].push_back({ 1, index, co2->m_bodyIndex, x_w, cp_w, n_w, dist, restitutionCoeff, frictionCoeff }); + } + } + }; + + bvh.traverse_depth_first(predicate, cb); +} + +void DistanceFieldCollisionDetection::collisionDetectionSolidSolid(const ParticleData &pd, const unsigned int offset, const unsigned int numVert, + DistanceFieldCollisionObject *co1, TetModel *tm2, DistanceFieldCollisionObject *co2, + const Real restitutionCoeff, const Real frictionCoeff + , std::vector > &contacts_mt +) +{ + const PointCloudBSH &bvh1 = ((DistanceFieldCollisionDetection::DistanceFieldCollisionObject*) co1)->m_bvh; + const TetMeshBSH &bvh2 = ((DistanceFieldCollisionDetection::DistanceFieldCollisionObject*) co2)->m_bvhTets; + const unsigned int *indices = tm2->getParticleMesh().getTets().data(); + const unsigned int offset2 = tm2->getIndexOffset(); + + + // callback function for BVH which is called if a leaf node in the point cloud BVH + // has a collision with a leaf node in the tet BVH + std::function cb = [&](unsigned int node_index1, unsigned int node_index2) + { + auto const& node1 = bvh1.node(node_index1); + auto const& node2 = bvh2.node(node_index2); + + // loop over all primitives (points, tets) in the leaf nodes + for (auto i = node1.begin; i < node1.begin + node1.n; ++i) + { + for (auto j = node2.begin; j < node2.begin + node2.n; ++j) + { + // Get sample point + unsigned int index = bvh1.entity(i) + offset; + const Vector3r &x_w = pd.getPosition(index); + + // Get tet + const unsigned int tetIndex = bvh2.entity(j); + const Vector3r &x0 = pd.getPosition(indices[4 * tetIndex] + offset2); + const Vector3r &x1 = pd.getPosition(indices[4 * tetIndex + 1] + offset2); + const Vector3r &x2 = pd.getPosition(indices[4 * tetIndex + 2] + offset2); + const Vector3r &x3 = pd.getPosition(indices[4 * tetIndex + 3] + offset2); + + // Compute barycentric coordinates of point in tet + Matrix3r A; + A.col(0) = x1 - x0; + A.col(1) = x2 - x0; + A.col(2) = x3 - x0; + Vector3r bary = A.inverse() * (x_w - x0); + + // check if point lies in tet using barycentric coordinates + if ((bary[0] >= 0.0) && (bary[1] >= 0.0) && (bary[2] >= 0.0) && + (bary[0] + bary[1] + bary[2] <= 1.0)) + { + // use barycentric coordinates to determine position of the point in the reference space of the tet + const Vector3r &X0 = pd.getPosition0(indices[4 * tetIndex] + offset2); + const Vector3r &X1 = pd.getPosition0(indices[4 * tetIndex + 1] + offset2); + const Vector3r &X2 = pd.getPosition0(indices[4 * tetIndex + 2] + offset2); + const Vector3r &X3 = pd.getPosition0(indices[4 * tetIndex + 3] + offset2); + + Matrix3r A0; + A0.col(0) = X1 - X0; + A0.col(1) = X2 - X0; + A0.col(2) = X3 - X0; + + // point in reference space of the tet + const Vector3r X = X0 + A0 * bary; + + Vector3r cp_l, n_l; + Real dist; + + // apply inverse initial transform to transform the point in the space of the + // signed distance field + const Vector3r X_l = (tm2->getInitialR().transpose() * (X - tm2->getInitialX())); + + // perform collision test with distance field to get closest point on surface + //if (co2->collisionTest(X_l, m_tolerance, cp_l, n_l, dist)) + if (co2->collisionTest(X_l, 0.0, cp_l, n_l, dist)) + { + unsigned int cp_tetIndex; + Vector3r cp_bary; + + // transform closest point on surface back to the reference space of the tet model + const Vector3r cp0 = (tm2->getInitialR() * cp_l + tm2->getInitialX()); + + // find the tet which contains the resulting point + if (findRefTetAt(pd, tm2, co2, cp0, cp_tetIndex, cp_bary)) + { + // if we are in another tet, update matrix A + Vector3r cp_w; + if (cp_tetIndex != tetIndex) + { + const Vector3r &x0 = pd.getPosition(indices[4 * cp_tetIndex] + offset2); + const Vector3r &x1 = pd.getPosition(indices[4 * cp_tetIndex + 1] + offset2); + const Vector3r &x2 = pd.getPosition(indices[4 * cp_tetIndex + 2] + offset2); + const Vector3r &x3 = pd.getPosition(indices[4 * cp_tetIndex + 3] + offset2); + A.col(0) = x1 - x0; + A.col(1) = x2 - x0; + A.col(2) = x3 - x0; + + // compute world space contact point in body 2 + cp_w = x0 + A * cp_bary; + } + else + // compute world space contact point in body 2 + cp_w = x0 + A * cp_bary; + +#ifdef _DEBUG + int tid = 0; +#else + int tid = omp_get_thread_num(); +#endif + + Vector3r n_w = cp_w - x_w; + + // normalize normal vector + const Real dist = (x_w - cp_w).norm(); + if (dist > 1.0e-6) + n_w /= dist; + + contacts_mt[tid].push_back({ 2, index, co2->m_bodyIndex, x_w, cp_w, n_w, dist, restitutionCoeff, frictionCoeff, tetIndex, cp_tetIndex, bary, cp_bary }); + } + } + } + } + } + }; + + BVHTest::traverse(bvh1, bvh2, cb); + +} + +bool DistanceFieldCollisionDetection::isDistanceFieldCollisionObject(CollisionObject *co) const +{ + return (co->getTypeId() == DistanceFieldCollisionDetection::DistanceFieldCollisionBox::TYPE_ID) || + (co->getTypeId() == DistanceFieldCollisionDetection::DistanceFieldCollisionSphere::TYPE_ID) || + (co->getTypeId() == DistanceFieldCollisionDetection::DistanceFieldCollisionTorus::TYPE_ID) || + (co->getTypeId() == DistanceFieldCollisionDetection::DistanceFieldCollisionCylinder::TYPE_ID) || + (co->getTypeId() == DistanceFieldCollisionDetection::DistanceFieldCollisionHollowSphere::TYPE_ID) || + (co->getTypeId() == DistanceFieldCollisionDetection::DistanceFieldCollisionHollowBox::TYPE_ID) || + (co->getTypeId() == DistanceFieldCollisionDetection::DistanceFieldCollisionObjectWithoutGeometry::TYPE_ID); +} + +void DistanceFieldCollisionDetection::addCollisionBox(const unsigned int bodyIndex, const unsigned int bodyType, const Vector3r *vertices, const unsigned int numVertices, const Vector3r &box, const bool testMesh, const bool invertSDF) +{ + DistanceFieldCollisionDetection::DistanceFieldCollisionBox *cf = new DistanceFieldCollisionDetection::DistanceFieldCollisionBox(); + cf->m_bodyIndex = bodyIndex; + cf->m_bodyType = bodyType; + // distance function requires 0.5*box + cf->m_box = 0.5*box; + cf->m_bvh.init(vertices, numVertices); + cf->m_bvh.construct(); + cf->m_testMesh = testMesh; + if (invertSDF) + cf->m_invertSDF = -1.0; + m_collisionObjects.push_back(cf); +} + +void DistanceFieldCollisionDetection::addCollisionSphere(const unsigned int bodyIndex, const unsigned int bodyType, const Vector3r *vertices, const unsigned int numVertices, const Real radius, const bool testMesh, const bool invertSDF) +{ + DistanceFieldCollisionDetection::DistanceFieldCollisionSphere *cs = new DistanceFieldCollisionDetection::DistanceFieldCollisionSphere(); + cs->m_bodyIndex = bodyIndex; + cs->m_bodyType = bodyType; + cs->m_radius = radius; + cs->m_bvh.init(vertices, numVertices); + cs->m_bvh.construct(); + cs->m_testMesh = testMesh; + if (invertSDF) + cs->m_invertSDF = -1.0; + m_collisionObjects.push_back(cs); +} + +void DistanceFieldCollisionDetection::addCollisionTorus(const unsigned int bodyIndex, const unsigned int bodyType, const Vector3r *vertices, const unsigned int numVertices, const Vector2r &radii, const bool testMesh, const bool invertSDF) +{ + DistanceFieldCollisionDetection::DistanceFieldCollisionTorus *ct = new DistanceFieldCollisionDetection::DistanceFieldCollisionTorus(); + ct->m_bodyIndex = bodyIndex; + ct->m_bodyType = bodyType; + ct->m_radii = radii; + ct->m_bvh.init(vertices, numVertices); + ct->m_bvh.construct(); + ct->m_testMesh = testMesh; + if (invertSDF) + ct->m_invertSDF = -1.0; + m_collisionObjects.push_back(ct); +} + +void DistanceFieldCollisionDetection::addCollisionCylinder(const unsigned int bodyIndex, const unsigned int bodyType, const Vector3r *vertices, const unsigned int numVertices, const Vector2r &dim, const bool testMesh, const bool invertSDF) +{ + DistanceFieldCollisionDetection::DistanceFieldCollisionCylinder *ct = new DistanceFieldCollisionDetection::DistanceFieldCollisionCylinder(); + ct->m_bodyIndex = bodyIndex; + ct->m_bodyType = bodyType; + ct->m_dim = dim; + // distance function uses height/2 + ct->m_dim[1] *= 0.5; + ct->m_bvh.init(vertices, numVertices); + ct->m_bvh.construct(); + ct->m_testMesh = testMesh; + if (invertSDF) + ct->m_invertSDF = -1.0; + m_collisionObjects.push_back(ct); +} + +void DistanceFieldCollisionDetection::addCollisionHollowSphere(const unsigned int bodyIndex, const unsigned int bodyType, const Vector3r *vertices, const unsigned int numVertices, const Real radius, const Real thickness, const bool testMesh, const bool invertSDF) +{ + DistanceFieldCollisionDetection::DistanceFieldCollisionHollowSphere *cs = new DistanceFieldCollisionDetection::DistanceFieldCollisionHollowSphere(); + cs->m_bodyIndex = bodyIndex; + cs->m_bodyType = bodyType; + cs->m_radius = radius; + cs->m_thickness = thickness; + cs->m_bvh.init(vertices, numVertices); + cs->m_bvh.construct(); + cs->m_testMesh = testMesh; + if (invertSDF) + cs->m_invertSDF = -1.0; + m_collisionObjects.push_back(cs); +} + +void DistanceFieldCollisionDetection::addCollisionHollowBox(const unsigned int bodyIndex, const unsigned int bodyType, const Vector3r *vertices, const unsigned int numVertices, const Vector3r &box, const Real thickness, const bool testMesh, const bool invertSDF) +{ + DistanceFieldCollisionDetection::DistanceFieldCollisionHollowBox *cf = new DistanceFieldCollisionDetection::DistanceFieldCollisionHollowBox(); + cf->m_bodyIndex = bodyIndex; + cf->m_bodyType = bodyType; + // distance function requires 0.5*box + cf->m_box = 0.5*box; + cf->m_thickness = thickness; + cf->m_bvh.init(vertices, numVertices); + cf->m_bvh.construct(); + cf->m_testMesh = testMesh; + if (invertSDF) + cf->m_invertSDF = -1.0; + m_collisionObjects.push_back(cf); +} + +void DistanceFieldCollisionDetection::addCollisionObjectWithoutGeometry(const unsigned int bodyIndex, const unsigned int bodyType, const Vector3r *vertices, const unsigned int numVertices, const bool testMesh) +{ + DistanceFieldCollisionObjectWithoutGeometry *co = new DistanceFieldCollisionObjectWithoutGeometry(); + co->m_bodyIndex = bodyIndex; + co->m_bodyType = bodyType; + co->m_bvh.init(vertices, numVertices); + co->m_bvh.construct(); + co->m_testMesh = testMesh; + co->m_invertSDF = 1.0; + m_collisionObjects.push_back(co); +} + +double DistanceFieldCollisionDetection::DistanceFieldCollisionBox::distance(const Eigen::Vector3d &x, const Real tolerance) +{ + const Eigen::Vector3d box_d = m_box.template cast(); + const Eigen::Vector3d x_d = x.template cast(); + const Eigen::Vector3d d(fabs(x_d.x()) - box_d.x(), fabs(x_d.y()) - box_d.y(), fabs(x_d.z()) - box_d.z()); + const Eigen::Vector3d max_d(std::max(d.x(), 0.0), std::max(d.y(), 0.0), std::max(d.z(), 0.0)); + return m_invertSDF*(std::min(std::max(d.x(), std::max(d.y(), d.z())), 0.0) + max_d.norm()) - static_cast(tolerance); +} + +double DistanceFieldCollisionDetection::DistanceFieldCollisionSphere::distance(const Eigen::Vector3d &x, const Real tolerance) +{ + const Eigen::Vector3d d = x.template cast(); + const double dl = d.norm(); + return m_invertSDF*(dl - static_cast(m_radius)) - static_cast(tolerance); +} + +bool DistanceFieldCollisionDetection::DistanceFieldCollisionSphere::collisionTest(const Vector3r &x, const Real tolerance, Vector3r &cp, Vector3r &n, Real &dist, const Real maxDist) +{ + const Vector3r d = x; + const Real dl = d.norm(); + dist = m_invertSDF*(dl - m_radius) - tolerance; + if (dist < maxDist) + { + if (dl < 1.e-6) + n.setZero(); + else + n = m_invertSDF * d / dl; + + cp = ((m_radius+tolerance) * n); + return true; + } + return false; +} + +double DistanceFieldCollisionDetection::DistanceFieldCollisionTorus::distance(const Eigen::Vector3d &x, const Real tolerance) +{ + const Eigen::Vector2d radii_d = m_radii.template cast(); + const Eigen::Vector2d q(Vector2r(x.x(), x.z()).norm() - radii_d.x(), x.y()); + return m_invertSDF*(q.norm() - radii_d.y()) - tolerance; +} + +double DistanceFieldCollisionDetection::DistanceFieldCollisionCylinder::distance(const Eigen::Vector3d &x, const Real tolerance) +{ + const double l = sqrt(x.x()*x.x() + x.z()*x.z()); + const Eigen::Vector2d d = Eigen::Vector2d(fabs(l), fabs(x.y())) - m_dim.template cast(); + const Eigen::Vector2d max_d(std::max(d.x(), 0.0), std::max(d.y(), 0.0)); + return m_invertSDF*(std::min(std::max(d.x(), d.y()), 0.0) + max_d.norm()) - static_cast(tolerance); +} + + +double DistanceFieldCollisionDetection::DistanceFieldCollisionHollowSphere::distance(const Eigen::Vector3d &x, const Real tolerance) +{ + const Eigen::Vector3d d = x.template cast(); + const double dl = d.norm(); + return m_invertSDF*(fabs(dl - static_cast(m_radius)) - static_cast(m_thickness)) - static_cast(tolerance); +} + +bool DistanceFieldCollisionDetection::DistanceFieldCollisionHollowSphere::collisionTest(const Vector3r &x, const Real tolerance, Vector3r &cp, Vector3r &n, Real &dist, const Real maxDist) +{ + const Vector3r d = x; + const Real dl = d.norm(); + dist = m_invertSDF*(fabs(dl - m_radius) - m_thickness) - tolerance; + if (dist < maxDist) + { + if (dl < 1.e-6) + n.setZero(); + else if (dl < m_radius) + n = -m_invertSDF*d / dl; + else + n = m_invertSDF*d / dl; + + cp = x - dist * n; + return true; + } + return false; +} + +double DistanceFieldCollisionDetection::DistanceFieldCollisionHollowBox::distance(const Eigen::Vector3d &x, const Real tolerance) +{ + const Eigen::Vector3d box_d = m_box.template cast(); + const Eigen::Vector3d x_d = x.template cast(); + const Eigen::Vector3d d = x_d.cwiseAbs() - box_d; + const Eigen::Vector3d max_d = d.cwiseMax(Eigen::Vector3d(0.0, 0.0, 0.0)); + return m_invertSDF * (fabs(std::min(d.maxCoeff(), 0.0) + max_d.norm()) - m_thickness) - static_cast(tolerance); +} + +void DistanceFieldCollisionDetection::DistanceFieldCollisionObject::approximateNormal(const Eigen::Vector3d &x, const Real tolerance, Vector3r &n) +{ + // approximate gradient + double eps = 1.e-6; + n.setZero(); + Eigen::Vector3d xTmp = x; + for (unsigned int j = 0; j < 3; j++) + { + xTmp[j] += eps; + + double e_p, e_m; + e_p = distance(xTmp, tolerance); + xTmp[j] = x[j] - eps; + e_m = distance(xTmp, tolerance); + xTmp[j] = x[j]; + + double res = (e_p - e_m) * (1.0 / (2.0*eps)); + + n[j] = static_cast(res); + } + + const Real norm2 = n.squaredNorm(); + if (norm2 < 1.e-6) + n.setZero(); + else + n = n / sqrt(norm2); +} + + +bool DistanceFieldCollisionDetection::DistanceFieldCollisionObject::collisionTest(const Vector3r &x, const Real tolerance, Vector3r &cp, Vector3r &n, Real &dist, const Real maxDist) +{ + const Real t_d = static_cast(tolerance); + dist = static_cast(distance(x.template cast(), t_d)); + if (dist < maxDist) + { + // approximate gradient + const Eigen::Vector3d x_d = x.template cast(); + + approximateNormal(x_d, t_d, n); + + cp = (x - dist * n); + return true; + } + return false; +} + +void DistanceFieldCollisionDetection::DistanceFieldCollisionObject::initTetBVH(const Vector3r *vertices, const unsigned int numVertices, const unsigned int *indices, const unsigned int numTets, const Real tolerance) +{ + if (m_bodyType == CollisionDetection::CollisionObject::TetModelCollisionObjectType) + { + m_bvhTets.init(vertices, numVertices, indices, numTets, tolerance); + m_bvhTets.construct(); + + // ToDo: copy constructor + m_bvhTets0.init(vertices, numVertices, indices, numTets, 0.0); + m_bvhTets0.construct(); + + } +} + +bool DistanceFieldCollisionDetection::findRefTetAt(const ParticleData &pd, TetModel *tm, const DistanceFieldCollisionDetection::DistanceFieldCollisionObject *co, const Vector3r &X, + unsigned int &tetIndex, Vector3r &barycentricCoordinates) +{ + const TetMeshBSH &bvh0 = ((DistanceFieldCollisionDetection::DistanceFieldCollisionObject*) co)->m_bvhTets0; + const unsigned int *indices = tm->getParticleMesh().getTets().data(); + const unsigned int offset = tm->getIndexOffset(); + std::vector bary; + std::vector tets; + bary.reserve(100); + tets.reserve(100); + + std::function predicate = [&](unsigned int node_index, unsigned int depth) + { + const BoundingSphere &bs = bvh0.hull(node_index); + return bs.contains(X); + }; + std::function cb = [&](unsigned int node_index, unsigned int depth) + { + auto const& node = bvh0.node(node_index); + if (!node.is_leaf()) + return; + + for (auto i = node.begin; i < node.begin + node.n; ++i) + { + const unsigned int tetIndex = bvh0.entity(i); + + // use barycentric coordinates to determine position in reference space + const Vector3r &X0 = pd.getPosition0(indices[4 * tetIndex] + offset); + const Vector3r &X1 = pd.getPosition0(indices[4 * tetIndex + 1] + offset); + const Vector3r &X2 = pd.getPosition0(indices[4 * tetIndex + 2] + offset); + const Vector3r &X3 = pd.getPosition0(indices[4 * tetIndex + 3] + offset); + + // Compute barycentric coordinates of point in tet + Matrix3r A; + A.col(0) = X1 - X0; + A.col(1) = X2 - X0; + A.col(2) = X3 - X0; + bary.push_back(A.inverse() * (X - X0)); + tets.push_back(tetIndex); + } + }; + + bvh0.traverse_depth_first(predicate, cb); + + if (bary.size() == 0) + return false; + + // find best set of barycentric coordinates + unsigned int index = 0; + Real minError = REAL_MAX; + for (unsigned int i = 0; i < bary.size(); i++) + { + // Determine if barycentric coordinates are negative and add distance to 0 as error + Real error = std::max(static_cast(0.0), -bary[i][0]); + error += std::max(static_cast(0.0), -bary[i][1]); + error += std::max(static_cast(0.0), -bary[i][2]); + + // Determine if sum of barycentric coordinates is larger than one and add distance to 1 as error + error += std::max(static_cast(0.0), bary[i][0] + bary[i][1] + bary[i][2] - static_cast(1.0)); + + if (error < minError) + { + minError = error; + index = i; + } + } + barycentricCoordinates = bary[index]; + tetIndex = tets[index]; + return true; +} + diff --git a/Demos/Simulation/DistanceFieldCollisionDetection.h b/Simulation/DistanceFieldCollisionDetection.h similarity index 53% rename from Demos/Simulation/DistanceFieldCollisionDetection.h rename to Simulation/DistanceFieldCollisionDetection.h index ee398784..3cf44db5 100644 --- a/Demos/Simulation/DistanceFieldCollisionDetection.h +++ b/Simulation/DistanceFieldCollisionDetection.h @@ -2,7 +2,7 @@ #define _SIMPLECOLLISIONDETECTION_H #include "Common/Common.h" -#include "Demos/Simulation/CollisionDetection.h" +#include "Simulation/CollisionDetection.h" #include "AABB.h" #include "BoundingSphereHierarchy.h" @@ -15,14 +15,18 @@ namespace PBD struct DistanceFieldCollisionObject : public CollisionObject { bool m_testMesh; + Real m_invertSDF; PointCloudBSH m_bvh; + TetMeshBSH m_bvhTets; + TetMeshBSH m_bvhTets0; - DistanceFieldCollisionObject() { m_testMesh = true; } + DistanceFieldCollisionObject() { m_testMesh = true; m_invertSDF = 1.0; } virtual ~DistanceFieldCollisionObject() {} - virtual bool collisionTest(const Vector3r &x, const Real tolerance, Vector3r &cp, Vector3r &n, Real &dist); + virtual bool collisionTest(const Vector3r &x, const Real tolerance, Vector3r &cp, Vector3r &n, Real &dist, const Real maxDist = 0.0); virtual void approximateNormal(const Eigen::Vector3d &x, const Real tolerance, Vector3r &n); - virtual Real distance(const Eigen::Vector3d &x, const Real tolerance) = 0; + virtual double distance(const Eigen::Vector3d &x, const Real tolerance) = 0; + void initTetBVH(const Vector3r *vertices, const unsigned int numVertices, const unsigned int *indices, const unsigned int numTets, const Real tolerance); }; struct DistanceFieldCollisionObjectWithoutGeometry : public DistanceFieldCollisionObject @@ -31,8 +35,8 @@ namespace PBD virtual ~DistanceFieldCollisionObjectWithoutGeometry() {} virtual int &getTypeId() const { return TYPE_ID; } - virtual bool collisionTest(const Vector3r &x, const Real tolerance, Vector3r &cp, Vector3r &n, Real &dist) { return false; } - virtual Real distance(const Eigen::Vector3d &x, const Real tolerance) { return 0.0; } + virtual bool collisionTest(const Vector3r &x, const Real tolerance, Vector3r &cp, Vector3r &n, Real &dist, const Real maxDist = 0.0) { return false; } + virtual double distance(const Eigen::Vector3d &x, const Real tolerance) { return 0.0; } }; struct DistanceFieldCollisionBox : public DistanceFieldCollisionObject @@ -42,7 +46,7 @@ namespace PBD virtual ~DistanceFieldCollisionBox() {} virtual int &getTypeId() const { return TYPE_ID; } - virtual Real distance(const Eigen::Vector3d &x, const Real tolerance); + virtual double distance(const Eigen::Vector3d &x, const Real tolerance); }; struct DistanceFieldCollisionSphere : public DistanceFieldCollisionObject @@ -52,8 +56,8 @@ namespace PBD virtual ~DistanceFieldCollisionSphere() {} virtual int &getTypeId() const { return TYPE_ID; } - virtual bool collisionTest(const Vector3r &x, const Real tolerance, Vector3r &cp, Vector3r &n, Real &dist); - virtual Real distance(const Eigen::Vector3d &x, const Real tolerance); + virtual bool collisionTest(const Vector3r &x, const Real tolerance, Vector3r &cp, Vector3r &n, Real &dist, const Real maxDist = 0.0); + virtual double distance(const Eigen::Vector3d &x, const Real tolerance); }; struct DistanceFieldCollisionTorus : public DistanceFieldCollisionObject @@ -63,7 +67,7 @@ namespace PBD virtual ~DistanceFieldCollisionTorus() {} virtual int &getTypeId() const { return TYPE_ID; } - virtual Real distance(const Eigen::Vector3d &x, const Real tolerance); + virtual double distance(const Eigen::Vector3d &x, const Real tolerance); }; struct DistanceFieldCollisionCylinder : public DistanceFieldCollisionObject @@ -73,7 +77,30 @@ namespace PBD virtual ~DistanceFieldCollisionCylinder() {} virtual int &getTypeId() const { return TYPE_ID; } - virtual Real distance(const Eigen::Vector3d &x, const Real tolerance); + virtual double distance(const Eigen::Vector3d &x, const Real tolerance); + }; + + struct DistanceFieldCollisionHollowSphere : public DistanceFieldCollisionObject + { + Real m_radius; + Real m_thickness; + static int TYPE_ID; + + virtual ~DistanceFieldCollisionHollowSphere() {} + virtual int &getTypeId() const { return TYPE_ID; } + virtual bool collisionTest(const Vector3r &x, const Real tolerance, Vector3r &cp, Vector3r &n, Real &dist, const Real maxDist = 0.0); + virtual double distance(const Eigen::Vector3d &x, const Real tolerance); + }; + + struct DistanceFieldCollisionHollowBox : public DistanceFieldCollisionObject + { + Vector3r m_box; + Real m_thickness; + static int TYPE_ID; + + virtual ~DistanceFieldCollisionHollowBox() {} + virtual int &getTypeId() const { return TYPE_ID; } + virtual double distance(const Eigen::Vector3d &x, const Real tolerance); }; struct ContactData @@ -87,6 +114,12 @@ namespace PBD Real m_dist; Real m_restitution; Real m_friction; + + // Test + unsigned int m_elementIndex1; + unsigned int m_elementIndex2; + Vector3r m_bary1; + Vector3r m_bary2; }; protected: @@ -100,6 +133,15 @@ namespace PBD , std::vector > &contacts_mt ); + void collisionDetectionSolidSolid(const ParticleData &pd, const unsigned int offset, const unsigned int numVert, + DistanceFieldCollisionObject *co1, TetModel *tm2, DistanceFieldCollisionObject *co2, + const Real restitutionCoeff, const Real frictionCoeff + , std::vector > &contacts_mt + ); + + bool findRefTetAt(const ParticleData &pd, TetModel *tm, const DistanceFieldCollisionDetection::DistanceFieldCollisionObject *co, const Vector3r &X, + unsigned int &tetIndex, Vector3r &barycentricCoordinates); + public: DistanceFieldCollisionDetection(); @@ -109,10 +151,12 @@ namespace PBD virtual bool isDistanceFieldCollisionObject(CollisionObject *co) const; - void addCollisionBox(const unsigned int bodyIndex, const unsigned int bodyType, const Vector3r *vertices, const unsigned int numVertices, const Vector3r &box, const bool testMesh = true); - void addCollisionSphere(const unsigned int bodyIndex, const unsigned int bodyType, const Vector3r *vertices, const unsigned int numVertices, const Real radius, const bool testMesh = true); - void addCollisionTorus(const unsigned int bodyIndex, const unsigned int bodyType, const Vector3r *vertices, const unsigned int numVertices, const Vector2r &radii, const bool testMesh = true); - void addCollisionObjectWithoutGeometry(const unsigned int bodyIndex, const unsigned int bodyType, const Vector3r *vertices, const unsigned int numVertices); + void addCollisionBox(const unsigned int bodyIndex, const unsigned int bodyType, const Vector3r *vertices, const unsigned int numVertices, const Vector3r &box, const bool testMesh = true, const bool invertSDF = false); + void addCollisionSphere(const unsigned int bodyIndex, const unsigned int bodyType, const Vector3r *vertices, const unsigned int numVertices, const Real radius, const bool testMesh = true, const bool invertSDF = false); + void addCollisionTorus(const unsigned int bodyIndex, const unsigned int bodyType, const Vector3r *vertices, const unsigned int numVertices, const Vector2r &radii, const bool testMesh = true, const bool invertSDF = false); + void addCollisionObjectWithoutGeometry(const unsigned int bodyIndex, const unsigned int bodyType, const Vector3r *vertices, const unsigned int numVertices, const bool testMesh); + void addCollisionHollowSphere(const unsigned int bodyIndex, const unsigned int bodyType, const Vector3r *vertices, const unsigned int numVertices, const Real radius, const Real thickness, const bool testMesh = true, const bool invertSDF = false); + void addCollisionHollowBox(const unsigned int bodyIndex, const unsigned int bodyType, const Vector3r *vertices, const unsigned int numVertices, const Vector3r &box, const Real thickness, const bool testMesh = true, const bool invertSDF = false); /** Add collision cylinder * @@ -120,7 +164,7 @@ namespace PBD * @param bodyType type of corresponding body * @param dim (radius, height) of cylinder */ - void addCollisionCylinder(const unsigned int bodyIndex, const unsigned int bodyType, const Vector3r *vertices, const unsigned int numVertices, const Vector2r &dim, const bool testMesh = true); + void addCollisionCylinder(const unsigned int bodyIndex, const unsigned int bodyType, const Vector3r *vertices, const unsigned int numVertices, const Vector2r &dim, const bool testMesh = true, const bool invertSDF = false); }; } diff --git a/Demos/Simulation/IDFactory.cpp b/Simulation/IDFactory.cpp similarity index 100% rename from Demos/Simulation/IDFactory.cpp rename to Simulation/IDFactory.cpp diff --git a/Demos/Simulation/IDFactory.h b/Simulation/IDFactory.h similarity index 100% rename from Demos/Simulation/IDFactory.h rename to Simulation/IDFactory.h diff --git a/Simulation/LineModel.cpp b/Simulation/LineModel.cpp new file mode 100644 index 00000000..f4ea7315 --- /dev/null +++ b/Simulation/LineModel.cpp @@ -0,0 +1,47 @@ +#include "LineModel.h" +#include "PositionBasedDynamics/PositionBasedRigidBodyDynamics.h" +#include "PositionBasedDynamics/PositionBasedDynamics.h" +#include "TriangleModel.h" + +using namespace PBD; + +LineModel::LineModel() +{ + m_restitutionCoeff = static_cast(0.6); + m_frictionCoeff = static_cast(0.2); +} + +LineModel::~LineModel(void) +{ + +} + +LineModel::Edges& LineModel::getEdges() +{ + return m_edges; +} + +void LineModel::initMesh(const unsigned int nPoints, const unsigned int nQuaternions, const unsigned int indexOffset, const unsigned int indexOffsetQuaternions, unsigned int* indices, unsigned int* indicesQuaternions) +{ + m_nPoints = nPoints; + m_nQuaternions = nQuaternions; + m_indexOffset = indexOffset; + m_indexOffsetQuaternions = indexOffsetQuaternions; + + m_edges.resize(nPoints - 1); + + for (unsigned int i = 0; i < nPoints-1; i++) + { + m_edges[i] = OrientedEdge(indices[2*i], indices[2*i + 1], indicesQuaternions[i]); + } +} + +unsigned int LineModel::getIndexOffset() const +{ + return m_indexOffset; +} + +unsigned LineModel::getIndexOffsetQuaternions() const +{ + return m_indexOffsetQuaternions; +} \ No newline at end of file diff --git a/Simulation/LineModel.h b/Simulation/LineModel.h new file mode 100644 index 00000000..320b0766 --- /dev/null +++ b/Simulation/LineModel.h @@ -0,0 +1,76 @@ +#ifndef __LINEMODEL_H__ +#define __LINEMODEL_H__ + +#include "Common/Common.h" +#include +#include "Simulation/RigidBody.h" +#include "Utils/IndexedFaceMesh.h" +#include "Simulation/ParticleData.h" +#include "Constraints.h" + +namespace PBD +{ + class LineModel + { + struct OrientedEdge + { + OrientedEdge(){} + OrientedEdge(unsigned int p0, unsigned int p1, unsigned int q0) + { + m_vert[0] = p0; + m_vert[1] = p1; + m_quat = q0; + } + unsigned int m_vert[2]; + unsigned int m_quat; + }; + + public: + typedef std::vector Edges; + + LineModel(); + virtual ~LineModel(); + + protected: + /** offset which must be added to get the correct index in the particles array */ + unsigned int m_indexOffset; + /** offset which must be added to get the correct index in the quaternions array */ + unsigned int m_indexOffsetQuaternions; + unsigned int m_nPoints, m_nQuaternions; + Edges m_edges; + Real m_restitutionCoeff; + Real m_frictionCoeff; + + public: + void updateConstraints(); + + Edges &getEdges(); + + unsigned int getIndexOffset() const; + unsigned int getIndexOffsetQuaternions() const; + + void initMesh(const unsigned int nPoints, const unsigned int nQuaternions, const unsigned int indexOffset, const unsigned int indexOffsetQuaternions, unsigned int* indices, unsigned int* indicesQuaternions); + + FORCE_INLINE Real getRestitutionCoeff() const + { + return m_restitutionCoeff; + } + + FORCE_INLINE void setRestitutionCoeff(Real val) + { + m_restitutionCoeff = val; + } + + FORCE_INLINE Real getFrictionCoeff() const + { + return m_frictionCoeff; + } + + FORCE_INLINE void setFrictionCoeff(Real val) + { + m_frictionCoeff = val; + } + }; +} + +#endif \ No newline at end of file diff --git a/Demos/Simulation/NeighborhoodSearchSpatialHashing.cpp b/Simulation/NeighborhoodSearchSpatialHashing.cpp similarity index 98% rename from Demos/Simulation/NeighborhoodSearchSpatialHashing.cpp rename to Simulation/NeighborhoodSearchSpatialHashing.cpp index b805e453..e2a60efd 100644 --- a/Demos/Simulation/NeighborhoodSearchSpatialHashing.cpp +++ b/Simulation/NeighborhoodSearchSpatialHashing.cpp @@ -1,6 +1,7 @@ #include "NeighborhoodSearchSpatialHashing.h" using namespace PBD; +using namespace Utilities; NeighborhoodSearchSpatialHashing::NeighborhoodSearchSpatialHashing(const unsigned int numParticles, const Real radius, const unsigned int maxNeighbors, const unsigned int maxParticlesPerCell) : m_gridMap(numParticles*2) @@ -87,7 +88,7 @@ void NeighborhoodSearchSpatialHashing::update() void NeighborhoodSearchSpatialHashing::neighborhoodSearch(Vector3r *x) { - const Real factor = 1.0/m_cellGridSize; + const Real factor = static_cast(1.0)/m_cellGridSize; for (int i=0; i < (int) m_numParticles; i++) { const int cellPos1 = NeighborhoodSearchSpatialHashing::floor(x[i][0] * factor)+1; @@ -160,7 +161,7 @@ void NeighborhoodSearchSpatialHashing::neighborhoodSearch(Vector3r *x) void NeighborhoodSearchSpatialHashing::neighborhoodSearch(Vector3r *x, const unsigned int numBoundaryParticles, Vector3r *boundaryX) { - const Real factor = 1.0/m_cellGridSize; + const Real factor = static_cast(1.0)/m_cellGridSize; for (int i=0; i < (int) m_numParticles; i++) { const int cellPos1 = NeighborhoodSearchSpatialHashing::floor(x[i][0] * factor)+1; diff --git a/Demos/Simulation/NeighborhoodSearchSpatialHashing.h b/Simulation/NeighborhoodSearchSpatialHashing.h similarity index 91% rename from Demos/Simulation/NeighborhoodSearchSpatialHashing.h rename to Simulation/NeighborhoodSearchSpatialHashing.h index c3ff87dd..ec7073b2 100644 --- a/Demos/Simulation/NeighborhoodSearchSpatialHashing.h +++ b/Simulation/NeighborhoodSearchSpatialHashing.h @@ -1,15 +1,14 @@ #ifndef __NEIGHBORHOODSEARCHSPATIALHASHING_H__ #define __NEIGHBORHOODSEARCHSPATIALHASHING_H__ -#include "Demos/Common/Config.h" -#include "Demos/Utils/Hashmap.h" +#include "Utils/Hashmap.h" #include #include "Common/Common.h" -namespace PBD -{ - typedef Eigen::Vector3i NeighborhoodSearchCellPos; +typedef Eigen::Vector3i NeighborhoodSearchCellPos; +namespace Utilities +{ template<> inline unsigned int hashFunction(NeighborhoodSearchCellPos* const &key) { @@ -18,7 +17,10 @@ namespace PBD const int p3 = 83492791 * (*key)[2]; return p1 + p2 + p3; } +} +namespace PBD +{ class NeighborhoodSearchSpatialHashing { public: @@ -69,7 +71,7 @@ namespace PBD Real m_cellGridSize; Real m_radius2; unsigned int m_currentTimestamp; - Hashmap m_gridMap; + Utilities::Hashmap m_gridMap; }; } diff --git a/Demos/Simulation/ParticleData.h b/Simulation/ParticleData.h similarity index 55% rename from Demos/Simulation/ParticleData.h rename to Simulation/ParticleData.h index 91a7c4b6..ff2e2eb6 100644 --- a/Demos/Simulation/ParticleData.h +++ b/Simulation/ParticleData.h @@ -1,7 +1,6 @@ #ifndef __PARTICLEDATA_H__ #define __PARTICLEDATA_H__ -#include "Demos/Common/Config.h" #include #include "Common/Common.h" @@ -75,9 +74,9 @@ namespace PBD return (unsigned int)m_x.size(); } - FORCE_INLINE const std::vector* getVertices() + FORCE_INLINE const std::vector& getVertices() const { - return &m_x; + return m_x; } }; @@ -241,7 +240,7 @@ namespace PBD { m_masses[i] = mass; if (mass != 0.0) - m_invMasses[i] = 1.0 / mass; + m_invMasses[i] = static_cast(1.0) / mass; else m_invMasses[i] = 0.0; } @@ -256,6 +255,11 @@ namespace PBD return (unsigned int) m_x.size(); } + FORCE_INLINE const std::vector& getVertices() const + { + return m_x; + } + /** Resize the array containing the particle data. */ FORCE_INLINE void resize(const unsigned int newSize) @@ -305,6 +309,231 @@ namespace PBD return (unsigned int) m_x.size(); } }; + + /** This class encapsulates the state of all orientations of a quaternion model. + * All parameters are stored in individual arrays. + */ + class OrientationData + { + private: + // Mass + // If the mass is zero, the particle is static + std::vector m_masses; + std::vector m_invMasses; + + // Dynamic state + std::vector m_q0; + std::vector m_q; + std::vector m_omega; + std::vector m_alpha; + std::vector m_oldQ; + std::vector m_lastQ; + + public: + FORCE_INLINE OrientationData(void) : + m_masses(), + m_invMasses(), + m_q0(), + m_q(), + m_omega(), + m_alpha(), + m_oldQ(), + m_lastQ() + { + } + + FORCE_INLINE ~OrientationData(void) + { + m_masses.clear(); + m_invMasses.clear(); + m_q0.clear(); + m_q.clear(); + m_omega.clear(); + m_alpha.clear(); + m_oldQ.clear(); + m_lastQ.clear(); + } + + FORCE_INLINE void addQuaternion(const Quaternionr &vertex) + { + m_q0.push_back(vertex); + m_q.push_back(vertex); + m_oldQ.push_back(vertex); + m_lastQ.push_back(vertex); + m_masses.push_back(1.0); + m_invMasses.push_back(1.0); + m_omega.push_back(Vector3r(0.0, 0.0, 0.0)); + m_alpha.push_back(Vector3r(0.0, 0.0, 0.0)); + } + + FORCE_INLINE Quaternionr &getQuaternion(const unsigned int i) + { + return m_q[i]; + } + + FORCE_INLINE const Quaternionr &getQuaternion(const unsigned int i) const + { + return m_q[i]; + } + + FORCE_INLINE void setQuaternion(const unsigned int i, const Quaternionr &pos) + { + m_q[i] = pos; + } + + FORCE_INLINE Quaternionr &getQuaternion0(const unsigned int i) + { + return m_q0[i]; + } + + FORCE_INLINE const Quaternionr &getQuaternion0(const unsigned int i) const + { + return m_q0[i]; + } + + FORCE_INLINE void setQuaternion0(const unsigned int i, const Quaternionr &pos) + { + m_q0[i] = pos; + } + + FORCE_INLINE Quaternionr &getLastQuaternion(const unsigned int i) + { + return m_lastQ[i]; + } + + FORCE_INLINE const Quaternionr &getLastQuaternion(const unsigned int i) const + { + return m_lastQ[i]; + } + + FORCE_INLINE void setLastQuaternion(const unsigned int i, const Quaternionr &pos) + { + m_lastQ[i] = pos; + } + + FORCE_INLINE Quaternionr &getOldQuaternion(const unsigned int i) + { + return m_oldQ[i]; + } + + FORCE_INLINE const Quaternionr &getOldQuaternion(const unsigned int i) const + { + return m_oldQ[i]; + } + + FORCE_INLINE void setOldQuaternion(const unsigned int i, const Quaternionr &pos) + { + m_oldQ[i] = pos; + } + + FORCE_INLINE Vector3r &getVelocity(const unsigned int i) + { + return m_omega[i]; + } + + FORCE_INLINE const Vector3r &getVelocity(const unsigned int i) const + { + return m_omega[i]; + } + + FORCE_INLINE void setVelocity(const unsigned int i, const Vector3r &vel) + { + m_omega[i] = vel; + } + + FORCE_INLINE Vector3r &getAcceleration(const unsigned int i) + { + return m_alpha[i]; + } + + FORCE_INLINE const Vector3r &getAcceleration(const unsigned int i) const + { + return m_alpha[i]; + } + + FORCE_INLINE void setAcceleration(const unsigned int i, const Vector3r &accel) + { + m_alpha[i] = accel; + } + + FORCE_INLINE const Real getMass(const unsigned int i) const + { + return m_masses[i]; + } + + FORCE_INLINE Real& getMass(const unsigned int i) + { + return m_masses[i]; + } + + FORCE_INLINE void setMass(const unsigned int i, const Real mass) + { + m_masses[i] = mass; + if (mass != 0.0) + m_invMasses[i] = static_cast(1.0) / mass; + else + m_invMasses[i] = 0.0; + } + + FORCE_INLINE const Real getInvMass(const unsigned int i) const + { + return m_invMasses[i]; + } + + FORCE_INLINE const unsigned int getNumberOfQuaternions() const + { + return (unsigned int)m_q.size(); + } + + /** Resize the array containing the particle data. + */ + FORCE_INLINE void resize(const unsigned int newSize) + { + m_masses.resize(newSize); + m_invMasses.resize(newSize); + m_q0.resize(newSize); + m_q.resize(newSize); + m_omega.resize(newSize); + m_alpha.resize(newSize); + m_oldQ.resize(newSize); + m_lastQ.resize(newSize); + } + + /** Reserve the array containing the particle data. + */ + FORCE_INLINE void reserve(const unsigned int newSize) + { + m_masses.reserve(newSize); + m_invMasses.reserve(newSize); + m_q0.reserve(newSize); + m_q.reserve(newSize); + m_omega.reserve(newSize); + m_alpha.reserve(newSize); + m_oldQ.reserve(newSize); + m_lastQ.reserve(newSize); + } + + /** Release the array containing the particle data. + */ + FORCE_INLINE void release() + { + m_masses.clear(); + m_invMasses.clear(); + m_q0.clear(); + m_q.clear(); + m_omega.clear(); + m_alpha.clear(); + m_oldQ.clear(); + m_lastQ.clear(); + } + + /** Release the array containing the particle data. + */ + FORCE_INLINE unsigned int size() const + { + return (unsigned int)m_q.size(); + } + }; } #endif diff --git a/Demos/Simulation/RigidBody.h b/Simulation/RigidBody.h similarity index 74% rename from Demos/Simulation/RigidBody.h rename to Simulation/RigidBody.h index d9be00e5..02e9dd3e 100644 --- a/Demos/Simulation/RigidBody.h +++ b/Simulation/RigidBody.h @@ -1,11 +1,10 @@ #ifndef __RIGIDBODY_H__ #define __RIGIDBODY_H__ -#include "Demos/Common/Config.h" #include #include "Common/Common.h" #include "RigidBodyGeometry.h" -#include "Demos/Utils/VolumeIntegration.h" +#include "Utils/VolumeIntegration.h" namespace PBD @@ -26,6 +25,7 @@ namespace PBD Vector3r m_x0; /** center of mass velocity */ Vector3r m_v; + Vector3r m_v0; /** acceleration (by external forces) */ Vector3r m_a; @@ -35,6 +35,8 @@ namespace PBD * are constant over time. */ Vector3r m_inertiaTensor; + /** 3x3 matrix, inertia tensor in world space */ + Matrix3r m_inertiaTensorW; /** Inverse inertia tensor in body space */ Vector3r m_inertiaTensorInverse; /** 3x3 matrix, inverse of the inertia tensor in world space */ @@ -58,6 +60,7 @@ namespace PBD Matrix3r m_rot; /** Angular velocity, defines rotation axis and velocity (magnitude of the vector) */ Vector3r m_omega; + Vector3r m_omega0; /** external torque */ Vector3r m_torque; @@ -65,6 +68,12 @@ namespace PBD Real m_frictionCoeff; RigidBodyGeometry m_geometry; + + // transformation required to transform a point to local space or vice vera + Matrix3r m_transformation_R; + Vector3r m_transformation_v1; + Vector3r m_transformation_v2; + Vector3r m_transformation_R_X_v1; public: RigidBody(void) @@ -77,7 +86,7 @@ namespace PBD void initBody(const Real mass, const Vector3r &x, const Vector3r &inertiaTensor, const Quaternionr &rotation, - const VertexData &vertices, const IndexedFaceMesh &mesh, + const VertexData &vertices, const Utilities::IndexedFaceMesh &mesh, const Vector3r &scale = Vector3r(1.0, 1.0, 1.0)) { setMass(mass); @@ -86,6 +95,7 @@ namespace PBD m_lastX = x; m_oldX = x; m_v.setZero(); + m_v0.setZero(); m_a.setZero(); setInertiaTensor(inertiaTensor); @@ -99,17 +109,18 @@ namespace PBD m_x0_mat.setZero(); rotationUpdated(); m_omega.setZero(); + m_omega0.setZero(); m_torque.setZero(); - m_restitutionCoeff = 0.6; - m_frictionCoeff = 0.2; + m_restitutionCoeff = static_cast(0.6); + m_frictionCoeff = static_cast(0.2); - getGeometry().initMesh(vertices.size(), mesh.numFaces(), &vertices.getPosition(0), mesh.getFaces().data(), mesh.getUVIndices(), mesh.getUVs(), scale); + getGeometry().initMesh(vertices.size(), mesh.numFaces(), &vertices.getPosition(0), mesh.getFaces().data(), mesh.getUVIndices(), mesh.getUVs(), scale, mesh.getFlatShading()); getGeometry().updateMeshTransformation(getPosition(), getRotationMatrix()); } void initBody(const Real density, const Vector3r &x, const Quaternionr &rotation, - const VertexData &vertices, const IndexedFaceMesh &mesh, const Vector3r &scale = Vector3r(1.0, 1.0, 1.0)) + const VertexData &vertices, const Utilities::IndexedFaceMesh &mesh, const Vector3r &scale = Vector3r(1.0, 1.0, 1.0)) { m_mass = 1.0; m_inertiaTensor = Vector3r(1.0, 1.0, 1.0); @@ -118,6 +129,7 @@ namespace PBD m_lastX = x; m_oldX = x; m_v.setZero(); + m_v0.setZero(); m_a.setZero(); m_q = rotation; @@ -127,12 +139,13 @@ namespace PBD m_rot = m_q.matrix(); rotationUpdated(); m_omega.setZero(); + m_omega0.setZero(); m_torque.setZero(); - m_restitutionCoeff = 0.6; - m_frictionCoeff = 0.2; + m_restitutionCoeff = static_cast(0.6); + m_frictionCoeff = static_cast(0.2); - getGeometry().initMesh(vertices.size(), mesh.numFaces(), &vertices.getPosition(0), mesh.getFaces().data(), mesh.getUVIndices(), mesh.getUVs(), scale); + getGeometry().initMesh(vertices.size(), mesh.numFaces(), &vertices.getPosition(0), mesh.getFaces().data(), mesh.getUVIndices(), mesh.getUVs(), scale, mesh.getFlatShading()); determineMassProperties(density); getGeometry().updateMeshTransformation(getPosition(), getRotationMatrix()); } @@ -147,8 +160,8 @@ namespace PBD getOldRotation() = getRotation0(); getLastRotation() = getRotation0(); - getVelocity().setZero(); - getAngularVelocity().setZero(); + getVelocity() = getVelocity0(); + getAngularVelocity() = getAngularVelocity0(); getAcceleration().setZero(); getTorque().setZero(); @@ -156,19 +169,39 @@ namespace PBD rotationUpdated(); } + void updateInverseTransformation() + { + // remove the rotation of the main axis transformation that is performed + // to get a diagonal inertia tensor since the distance function is + // evaluated in local coordinates + // + // transformation world to local: + // p_local = R_initial^T ( R_MAT R^T (p_world - x) - x_initial + x_MAT) + // + // transformation local to world: + // p_world = R R_MAT^T (R_initial p_local + x_initial - x_MAT) + x + // + m_transformation_R = (getRotationInitial().inverse() * getRotationMAT() * getRotation().inverse()).matrix(); + m_transformation_v1 = -getRotationInitial().inverse().matrix() * getPositionInitial_MAT(); + m_transformation_v2 = (getRotation()*getRotationMAT().inverse()).matrix() * getPositionInitial_MAT() + getPosition(); + m_transformation_R_X_v1 = -m_transformation_R * getPosition() + m_transformation_v1; + } + void rotationUpdated() { if (m_mass != 0.0) { m_rot = m_q.matrix(); - updateInverseInertiaW(); + updateInertiaW(); + updateInverseTransformation(); } } - void updateInverseInertiaW() + void updateInertiaW() { if (m_mass != 0.0) { + m_inertiaTensorW = m_rot * m_inertiaTensor.asDiagonal() * m_rot.transpose(); m_inertiaTensorInverseW = m_rot * m_inertiaTensorInverse.asDiagonal() * m_rot.transpose(); } } @@ -179,10 +212,8 @@ namespace PBD { // apply initial rotation VertexData &vd = m_geometry.getVertexDataLocal(); - for (unsigned int i = 0; i < vd.size(); i++) - vd.getPosition(i) = m_rot * vd.getPosition(i) + m_x0; - - VolumeIntegration vi(m_geometry.getMesh(), m_geometry.getVertexDataLocal()); + + Utilities::VolumeIntegration vi(m_geometry.getVertexDataLocal().size(), m_geometry.getMesh().numFaces(), &m_geometry.getVertexDataLocal().getPosition(0), m_geometry.getMesh().getFaces().data()); vi.compute_inertia_tensor(density); // Diagonalize Inertia Tensor @@ -196,16 +227,23 @@ namespace PBD if (R.determinant() < 0.0) R = -R; + for (unsigned int i = 0; i < vd.size(); i++) + vd.getPosition(i) = m_rot * vd.getPosition(i) + m_x0; + + Vector3r x_MAT = vi.getCenterOfMass(); + R = m_rot * R; + x_MAT = m_rot * x_MAT + m_x0; + // rotate vertices back for (unsigned int i = 0; i < vd.size(); i++) - vd.getPosition(i) = R.transpose() * (vd.getPosition(i) - vi.getCenterOfMass()); + vd.getPosition(i) = R.transpose() * (vd.getPosition(i) - x_MAT); // set rotation Quaternionr qR = Quaternionr(R); qR.normalize(); m_q_mat = qR; m_q_initial = m_q0; - m_x0_mat = m_x0 - vi.getCenterOfMass(); + m_x0_mat = m_x0 - x_MAT; m_q0 = qR; m_q = m_q0; @@ -214,12 +252,18 @@ namespace PBD rotationUpdated(); // set translation - m_x0 = vi.getCenterOfMass(); + m_x0 = x_MAT; m_x = m_x0; m_lastX = m_x0; m_oldX = m_x0; + updateInverseTransformation(); } + const Matrix3r &getTransformationR() { return m_transformation_R; } + const Vector3r &getTransformationV1() { return m_transformation_v1; } + const Vector3r &getTransformationV2() { return m_transformation_v2; } + const Vector3r &getTransformationRXV1() { return m_transformation_R_X_v1; } + FORCE_INLINE Real &getMass() { return m_mass; @@ -234,7 +278,7 @@ namespace PBD { m_mass = value; if (m_mass != 0.0) - m_invMass = 1.0 / m_mass; + m_invMass = static_cast(1.0) / m_mass; else m_invMass = 0.0; } @@ -334,6 +378,21 @@ namespace PBD m_v = value; } + FORCE_INLINE Vector3r &getVelocity0() + { + return m_v0; + } + + FORCE_INLINE const Vector3r &getVelocity0() const + { + return m_v0; + } + + FORCE_INLINE void setVelocity0(const Vector3r &value) + { + m_v0 = value; + } + FORCE_INLINE Vector3r &getAcceleration() { return m_a; @@ -357,7 +416,17 @@ namespace PBD FORCE_INLINE void setInertiaTensor(const Vector3r &value) { m_inertiaTensor = value; - m_inertiaTensorInverse = Vector3r(1.0 / value[0], 1.0 / value[1], 1.0 / value[2]); + m_inertiaTensorInverse = Vector3r(static_cast(1.0) / value[0], static_cast(1.0) / value[1], static_cast(1.0) / value[2]); + } + + FORCE_INLINE Matrix3r& getInertiaTensorW() + { + return m_inertiaTensorW; + } + + FORCE_INLINE const Matrix3r& getInertiaTensorW() const + { + return m_inertiaTensorW; } FORCE_INLINE const Vector3r &getInertiaTensorInverse() const @@ -500,6 +569,21 @@ namespace PBD m_omega = value; } + FORCE_INLINE Vector3r &getAngularVelocity0() + { + return m_omega0; + } + + FORCE_INLINE const Vector3r &getAngularVelocity0() const + { + return m_omega0; + } + + FORCE_INLINE void setAngularVelocity0(const Vector3r &value) + { + m_omega0 = value; + } + FORCE_INLINE Vector3r &getTorque() { return m_torque; diff --git a/Demos/Simulation/RigidBodyGeometry.cpp b/Simulation/RigidBodyGeometry.cpp similarity index 94% rename from Demos/Simulation/RigidBodyGeometry.cpp rename to Simulation/RigidBodyGeometry.cpp index b28d49ec..3091ddee 100644 --- a/Demos/Simulation/RigidBodyGeometry.cpp +++ b/Simulation/RigidBodyGeometry.cpp @@ -17,12 +17,13 @@ RigidBodyGeometry::Mesh &RigidBodyGeometry::getMesh() return m_mesh; } -void RigidBodyGeometry::initMesh(const unsigned int nVertices, const unsigned int nFaces, const Vector3r *vertices, const unsigned int* indices, const Mesh::UVIndices& uvIndices, const Mesh::UVs& uvs, const Vector3r &scale) +void RigidBodyGeometry::initMesh(const unsigned int nVertices, const unsigned int nFaces, const Vector3r *vertices, const unsigned int* indices, const Mesh::UVIndices& uvIndices, const Mesh::UVs& uvs, const Vector3r &scale, const bool flatShading) { m_mesh.release(); m_mesh.initMesh(nVertices, nFaces * 2, nFaces); m_vertexData_local.resize(nVertices); m_vertexData.resize(nVertices); + m_mesh.setFlatShading(flatShading); for (unsigned int i = 0; i < nVertices; i++) { m_vertexData_local.getPosition(i) = vertices[i].cwiseProduct(scale); diff --git a/Demos/Simulation/RigidBodyGeometry.h b/Simulation/RigidBodyGeometry.h similarity index 81% rename from Demos/Simulation/RigidBodyGeometry.h rename to Simulation/RigidBodyGeometry.h index 45985797..523e7143 100644 --- a/Demos/Simulation/RigidBodyGeometry.h +++ b/Simulation/RigidBodyGeometry.h @@ -1,10 +1,9 @@ #ifndef __RIGIDBODYGEOMETRY_H__ #define __RIGIDBODYGEOMETRY_H__ -#include "Demos/Common/Config.h" #include "Common/Common.h" -#include "Demos/Utils/IndexedFaceMesh.h" -#include "Demos/Simulation/ParticleData.h" +#include "Utils/IndexedFaceMesh.h" +#include "Simulation/ParticleData.h" #include namespace PBD @@ -15,7 +14,7 @@ namespace PBD RigidBodyGeometry(); virtual ~RigidBodyGeometry(); - typedef IndexedFaceMesh Mesh; + typedef Utilities::IndexedFaceMesh Mesh; protected: Mesh m_mesh; @@ -29,7 +28,7 @@ namespace PBD VertexData &getVertexDataLocal(); const VertexData &getVertexDataLocal() const; - void initMesh(const unsigned int nVertices, const unsigned int nFaces, const Vector3r *vertices, const unsigned int* indices, const Mesh::UVIndices& uvIndices, const Mesh::UVs& uvs, const Vector3r &scale = Vector3r(1.0, 1.0, 1.0)); + void initMesh(const unsigned int nVertices, const unsigned int nFaces, const Vector3r *vertices, const unsigned int* indices, const Mesh::UVIndices& uvIndices, const Mesh::UVs& uvs, const Vector3r &scale = Vector3r(1.0, 1.0, 1.0), const bool flatShading = false); void updateMeshTransformation(const Vector3r &x, const Matrix3r &R); void updateMeshNormals(const VertexData &vd); diff --git a/Simulation/Simulation.cpp b/Simulation/Simulation.cpp new file mode 100644 index 00000000..21510336 --- /dev/null +++ b/Simulation/Simulation.cpp @@ -0,0 +1,76 @@ +#include "Simulation.h" +#include "TimeManager.h" +#include "Utils/Timing.h" +#include "TimeStep.h" +#include "TimeStepController.h" + +using namespace PBD; +using namespace std; +using namespace GenParam; + +Simulation* Simulation::current = nullptr; +int Simulation::GRAVITATION = -1; + +Simulation::Simulation () +{ + m_gravitation = Vector3r(0.0, -9.81, 0.0); + + m_timeStep = nullptr; + m_model = nullptr; +} + +Simulation::~Simulation () +{ + delete m_timeStep; + delete TimeManager::getCurrent(); + + current = nullptr; +} + +Simulation* Simulation::getCurrent () +{ + if (current == nullptr) + { + current = new Simulation (); + current->init(); + } + return current; +} + +void Simulation::setCurrent (Simulation* tm) +{ + current = tm; +} + +bool Simulation::hasCurrent() +{ + return (current != nullptr); +} + +void Simulation::init() +{ + initParameters(); + + m_timeStep = new TimeStepController(); + m_timeStep->init(); + TimeManager::getCurrent()->setTimeStepSize(static_cast(0.005)); +} + +void Simulation::initParameters() +{ + ParameterObject::initParameters(); + + GRAVITATION = createVectorParameter("gravitation", "Gravitation", 3u, m_gravitation.data()); + setGroup(GRAVITATION, "Simulation|General"); + setDescription(GRAVITATION, "Vector to define the gravitational acceleration."); +} + +void Simulation::reset() +{ + m_model->reset(); + if (m_timeStep) + m_timeStep->reset(); + + TimeManager::getCurrent()->setTime(static_cast(0.0)); +} + diff --git a/Simulation/Simulation.h b/Simulation/Simulation.h new file mode 100644 index 00000000..2dc1c705 --- /dev/null +++ b/Simulation/Simulation.h @@ -0,0 +1,53 @@ +#ifndef __Simulation_h__ +#define __Simulation_h__ + +#include "Common/Common.h" +#include "SimulationModel.h" +#include "ParameterObject.h" +#include "TimeStep.h" + + +namespace PBD +{ + /** \brief Class to manage the current simulation time and the time step size. + * This class is a singleton. + */ + class Simulation : public GenParam::ParameterObject + { + public: + static int GRAVITATION; + + protected: + SimulationModel *m_model; + TimeStep *m_timeStep; + Vector3r m_gravitation; + + virtual void initParameters(); + + + private: + static Simulation *current; + + public: + Simulation (); + Simulation(const Simulation&) = delete; + Simulation& operator=(const Simulation&) = delete; + ~Simulation (); + + void init(); + void reset(); + + // Singleton + static Simulation* getCurrent (); + static void setCurrent (Simulation* tm); + static bool hasCurrent(); + + SimulationModel *getModel() { return m_model; } + void setModel(SimulationModel *model) { m_model = model; } + + TimeStep *getTimeStep() { return m_timeStep; } + void setTimeStep(TimeStep *ts) { m_timeStep = ts; } + }; +} + +#endif diff --git a/Simulation/SimulationModel.cpp b/Simulation/SimulationModel.cpp new file mode 100644 index 00000000..f8b40845 --- /dev/null +++ b/Simulation/SimulationModel.cpp @@ -0,0 +1,1485 @@ +#include "SimulationModel.h" +#include "PositionBasedDynamics/PositionBasedRigidBodyDynamics.h" +#include "Constraints.h" + +using namespace PBD; +using namespace GenParam; + +int SimulationModel::CLOTH_SIMULATION_METHOD = -1; +int SimulationModel::ENUM_CLOTHSIM_NONE = -1; +int SimulationModel::ENUM_CLOTHSIM_DISTANCE_CONSTRAINTS = -1; +int SimulationModel::ENUM_CLOTHSIM_FEM_PBD = -1; +int SimulationModel::ENUM_CLOTHSIM_SBD = -1; +int SimulationModel::ENUM_CLOTHSIM_DISTANCE_CONSTRAINTS_XPBD = -1; +int SimulationModel::CLOTH_BENDING_METHOD = -1; +int SimulationModel::ENUM_CLOTH_BENDING_NONE = -1; +int SimulationModel::ENUM_CLOTH_BENDING_DIHEDRAL_ANGLE = -1; +int SimulationModel::ENUM_CLOTH_BENDING_ISOMETRIC = -1; +int SimulationModel::ENUM_CLOTH_BENDING_ISOMETRIX_XPBD = -1; +int SimulationModel::CLOTH_STIFFNESS = -1; +int SimulationModel::CLOTH_STIFFNESS_XX = -1; +int SimulationModel::CLOTH_STIFFNESS_YY = -1; +int SimulationModel::CLOTH_STIFFNESS_XY = -1; +int SimulationModel::CLOTH_POISSON_RATIO_XY = -1; +int SimulationModel::CLOTH_POISSON_RATIO_YX = -1; +int SimulationModel::CLOTH_BENDING_STIFFNESS = -1; +int SimulationModel::CLOTH_NORMALIZE_STRETCH = -1; +int SimulationModel::CLOTH_NORMALIZE_SHEAR = -1; + +int SimulationModel::SOLID_SIMULATION_METHOD = -1; +int SimulationModel::ENUM_SOLIDSIM_NONE = -1; +int SimulationModel::ENUM_SOLIDSIM_DISTANCE_CONSTRAINTS = -1; +int SimulationModel::ENUM_SOLIDSIM_FEM_PBD = -1; +int SimulationModel::ENUM_SOLIDSIM_FEM_XPBD = -1; +int SimulationModel::ENUM_SOLIDSIM_SBD = -1; +int SimulationModel::ENUM_SOLIDSIM_SHAPE_MATCHING = -1; +int SimulationModel::ENUM_SOLIDSIM_DISTANCE_CONSTRAINTS_XPBD = -1; +int SimulationModel::SOLID_STIFFNESS = -1; +int SimulationModel::SOLID_POISSON_RATIO = -1; +int SimulationModel::SOLID_VOLUME_STIFFNESS = -1; +int SimulationModel::SOLID_NORMALIZE_STRETCH = -1; +int SimulationModel::SOLID_NORMALIZE_SHEAR = -1; + +int SimulationModel::ROD_STRETCHING_STIFFNESS = -1; +int SimulationModel::ROD_SHEARING_STIFFNESS_X = -1; +int SimulationModel::ROD_SHEARING_STIFFNESS_Y = -1; +int SimulationModel::ROD_BENDING_STIFFNESS_X = -1; +int SimulationModel::ROD_BENDING_STIFFNESS_Y = -1; +int SimulationModel::ROD_TWISTING_STIFFNESS = -1; + +int SimulationModel::CONTACT_STIFFNESS_RB = -1; +int SimulationModel::CONTACT_STIFFNESS_PARTICLE_RB = -1; + + +SimulationModel::SimulationModel() +{ + m_contactStiffnessRigidBody = 1.0; + m_contactStiffnessParticleRigidBody = 100.0; + + m_clothSimulationMethod = 2; + m_clothBendingMethod = 2; + m_cloth_stiffness = static_cast(1.0); + m_cloth_bendingStiffness = static_cast(0.01); + m_cloth_xxStiffness = static_cast(1.0); + m_cloth_yyStiffness = static_cast(1.0); + m_cloth_xyStiffness = static_cast(1.0); + m_cloth_xyPoissonRatio = static_cast(0.3); + m_cloth_yxPoissonRatio = static_cast(0.3); + m_cloth_normalizeShear = false; + m_cloth_normalizeStretch = false; + + m_solidSimulationMethod = 2; + m_solid_stiffness = static_cast(1.0); + m_solid_poissonRatio = static_cast(0.3); + m_solid_volumeStiffness = static_cast(1.0); + m_solid_normalizeShear = false; + m_solid_normalizeStretch = false; + + m_rod_stretchingStiffness = static_cast(1.0); + m_rod_shearingStiffnessX = static_cast(1.0); + m_rod_shearingStiffnessY = static_cast(1.0); + m_rod_bendingStiffnessX = static_cast(0.5); + m_rod_bendingStiffnessY = static_cast(0.5); + m_rod_twistingStiffness = static_cast(0.5); + + m_groupsInitialized = false; + + m_rigidBodyContactConstraints.reserve(10000); + m_particleRigidBodyContactConstraints.reserve(10000); + m_particleSolidContactConstraints.reserve(10000); + + m_clothSimMethodChanged = nullptr; + m_solidSimMethodChanged = nullptr; +} + +SimulationModel::~SimulationModel(void) +{ + cleanup(); +} + +void SimulationModel::init() +{ + initParameters(); +} + +void SimulationModel::cleanup() +{ + resetContacts(); + for (unsigned int i = 0; i < m_rigidBodies.size(); i++) + delete m_rigidBodies[i]; + m_rigidBodies.clear(); + for (unsigned int i = 0; i < m_triangleModels.size(); i++) + delete m_triangleModels[i]; + m_triangleModels.clear(); + for (unsigned int i = 0; i < m_tetModels.size(); i++) + delete m_tetModels[i]; + m_tetModels.clear(); + for (unsigned int i = 0; i < m_lineModels.size(); i++) + delete m_lineModels[i]; + m_lineModels.clear(); + for (unsigned int i = 0; i < m_constraints.size(); i++) + delete m_constraints[i]; + m_constraints.clear(); + m_particles.release(); + m_orientations.release(); + m_groupsInitialized = false; +} + +void SimulationModel::initParameters() +{ + ParameterObject::initParameters(); + + CLOTH_SIMULATION_METHOD = createEnumParameter("clothSimulationMethod", "Simulation method", std::bind(&SimulationModel::getClothSimulationMethod, this), std::bind(static_cast(&SimulationModel::setClothSimulationMethod), this, std::placeholders::_1)); + setGroup(CLOTH_SIMULATION_METHOD, "Cloth|General"); + setDescription(CLOTH_SIMULATION_METHOD, "Cloth simulation method"); + EnumParameter* enumParam = static_cast(getParameter(CLOTH_SIMULATION_METHOD)); + enumParam->addEnumValue("None", ENUM_CLOTHSIM_NONE); + enumParam->addEnumValue("Distance constraints", ENUM_CLOTHSIM_DISTANCE_CONSTRAINTS); + enumParam->addEnumValue("FEM based PBD", ENUM_CLOTHSIM_FEM_PBD); + enumParam->addEnumValue("Strain based dynamics", ENUM_CLOTHSIM_SBD); + enumParam->addEnumValue("XPBD distance constraints", ENUM_CLOTHSIM_DISTANCE_CONSTRAINTS_XPBD); + + CLOTH_BENDING_METHOD = createEnumParameter("clothBendingMethod", "Bending method", std::bind(&SimulationModel::getClothBendingMethod, this), std::bind(static_cast(&SimulationModel::setClothBendingMethod), this, std::placeholders::_1)); + setGroup(CLOTH_BENDING_METHOD, "Cloth|General"); + setDescription(CLOTH_BENDING_METHOD, "Cloth bending method"); + enumParam = static_cast(getParameter(CLOTH_BENDING_METHOD)); + enumParam->addEnumValue("None", ENUM_CLOTH_BENDING_NONE); + enumParam->addEnumValue("Dihedral angle", ENUM_CLOTH_BENDING_DIHEDRAL_ANGLE); + enumParam->addEnumValue("Isometric bending", ENUM_CLOTH_BENDING_ISOMETRIC); + enumParam->addEnumValue("Isometric bending (XPBD)", ENUM_CLOTH_BENDING_ISOMETRIX_XPBD); + + CLOTH_STIFFNESS = createNumericParameter("cloth_stiffness", "Distance constraint stiffness", std::bind(&SimulationModel::getClothStiffness, this), std::bind(static_cast(&SimulationModel::setClothStiffness), this, std::placeholders::_1)); + setGroup(CLOTH_STIFFNESS, "Cloth|Distance constraints"); + setDescription(CLOTH_STIFFNESS, "Distance constraint stiffness"); + static_cast*>(getParameter(CLOTH_STIFFNESS))->setMinValue(0.0); + + CLOTH_STIFFNESS_XX = createNumericParameter("cloth_xxStiffness", "Youngs modulus XX", std::bind(&SimulationModel::getClothStiffnessXX, this), std::bind(static_cast(&SimulationModel::setClothStiffnessXX), this, std::placeholders::_1)); + setGroup(CLOTH_STIFFNESS_XX, "Cloth|FEM"); + setDescription(CLOTH_STIFFNESS_XX, "XX stiffness of orthotropic cloth models."); + static_cast*>(getParameter(CLOTH_STIFFNESS_XX))->setMinValue(0.0); + + CLOTH_STIFFNESS_YY = createNumericParameter("cloth_yyStiffness", "Youngs modulus YY", std::bind(&SimulationModel::getClothStiffnessYY, this), std::bind(static_cast(&SimulationModel::setClothStiffnessYY), this, std::placeholders::_1)); + setGroup(CLOTH_STIFFNESS_YY, "Cloth|FEM"); + setDescription(CLOTH_STIFFNESS_YY, "YY stiffness of orthotropic cloth models."); + static_cast*>(getParameter(CLOTH_STIFFNESS_YY))->setMinValue(0.0); + + CLOTH_STIFFNESS_XY = createNumericParameter("cloth_xyStiffness", "Youngs modulus XY", std::bind(&SimulationModel::getClothStiffnessXY, this), std::bind(static_cast(&SimulationModel::setClothStiffnessXY), this, std::placeholders::_1)); + setGroup(CLOTH_STIFFNESS_XY, "Cloth|FEM"); + setDescription(CLOTH_STIFFNESS_XY, "XY stiffness of orthotropic cloth models."); + static_cast*>(getParameter(CLOTH_STIFFNESS_XY))->setMinValue(0.0); + + CLOTH_POISSON_RATIO_XY = createNumericParameter("cloth_xyPoissonRatio", "Poisson ratio XY", std::bind(&SimulationModel::getClothPoissonRatioXY, this), std::bind(static_cast(&SimulationModel::setClothPoissonRatioXY), this, std::placeholders::_1)); + setGroup(CLOTH_POISSON_RATIO_XY, "Cloth|FEM"); + setDescription(CLOTH_POISSON_RATIO_XY, "XY Poisson ratio of orthotropic cloth models."); + static_cast*>(getParameter(CLOTH_POISSON_RATIO_XY))->setMinValue(0.0); + + CLOTH_POISSON_RATIO_YX = createNumericParameter("cloth_yxPoissonRatio", "Poisson ratio YX", std::bind(&SimulationModel::getClothPoissonRatioYX, this), std::bind(static_cast(&SimulationModel::setClothPoissonRatioYX), this, std::placeholders::_1)); + setGroup(CLOTH_POISSON_RATIO_YX, "Cloth|FEM"); + setDescription(CLOTH_POISSON_RATIO_YX, "YX Poisson ratio of orthotropic cloth models."); + static_cast*>(getParameter(CLOTH_POISSON_RATIO_YX))->setMinValue(0.0); + + CLOTH_BENDING_STIFFNESS = createNumericParameter("cloth_bendingStiffness", "Bending stiffness", std::bind(&SimulationModel::getClothBendingStiffness, this), std::bind(static_cast(&SimulationModel::setClothBendingStiffness), this, std::placeholders::_1)); + setGroup(CLOTH_BENDING_STIFFNESS, "Cloth|Bending"); + setDescription(CLOTH_BENDING_STIFFNESS, "Bending stiffness of cloth models."); + static_cast*>(getParameter(CLOTH_BENDING_STIFFNESS))->setMinValue(0.0); + + CLOTH_NORMALIZE_STRETCH = createBoolParameter("cloth_normalizeStretch", "Normalize stretch", std::bind(&SimulationModel::getClothNormalizeStretch, this), std::bind(static_cast(&SimulationModel::setClothNormalizeStretch), this, std::placeholders::_1)); + setGroup(CLOTH_NORMALIZE_STRETCH, "Cloth|Strain Based Dynamics"); + setDescription(CLOTH_NORMALIZE_STRETCH, "Normalize stretch (strain based dynamics)"); + + CLOTH_NORMALIZE_SHEAR = createBoolParameter("cloth_normalizeShear", "Normalize shear", std::bind(&SimulationModel::getClothNormalizeShear, this), std::bind(static_cast(&SimulationModel::setClothNormalizeShear), this, std::placeholders::_1)); + setGroup(CLOTH_NORMALIZE_SHEAR, "Cloth|Strain Based Dynamics"); + setDescription(CLOTH_NORMALIZE_SHEAR, "Normalize shear (strain based dynamics)"); + + SOLID_SIMULATION_METHOD = createEnumParameter("solidSimulationMethod", "Simulation method", std::bind(&SimulationModel::getSolidSimulationMethod, this), std::bind(static_cast(&SimulationModel::setSolidSimulationMethod), this, std::placeholders::_1)); + setGroup(SOLID_SIMULATION_METHOD, "Solid|General"); + setDescription(SOLID_SIMULATION_METHOD, "Solid simulation method"); + enumParam = static_cast(getParameter(SOLID_SIMULATION_METHOD)); + enumParam->addEnumValue("None", ENUM_SOLIDSIM_NONE); + enumParam->addEnumValue("Distance constraints", ENUM_SOLIDSIM_DISTANCE_CONSTRAINTS); + enumParam->addEnumValue("FEM based PBD", ENUM_SOLIDSIM_FEM_PBD); + enumParam->addEnumValue("FEM based XPBD", ENUM_SOLIDSIM_FEM_XPBD); + enumParam->addEnumValue("Strain based dynamics (no inversion handling)", ENUM_SOLIDSIM_SBD); + enumParam->addEnumValue("Shape Matching (no inversion handling)", ENUM_SOLIDSIM_SHAPE_MATCHING); + enumParam->addEnumValue("XPBD distance constraints", ENUM_SOLIDSIM_DISTANCE_CONSTRAINTS_XPBD); + + SOLID_STIFFNESS = createNumericParameter("solid_stiffness", "Stiffness/Youngs modulus", std::bind(&SimulationModel::getSolidStiffness, this), std::bind(static_cast(&SimulationModel::setSolidStiffness), this, std::placeholders::_1)); + setGroup(SOLID_STIFFNESS, "Solid|General"); + setDescription(SOLID_STIFFNESS, "Stiffness/Young's modulus of solid models."); + static_cast*>(getParameter(SOLID_STIFFNESS))->setMinValue(0.0); + + SOLID_POISSON_RATIO = createNumericParameter("solid_poissonRatio", "Poisson ratio", std::bind(&SimulationModel::getSolidPoissonRatio, this), std::bind(static_cast(&SimulationModel::setSolidPoissonRatio), this, std::placeholders::_1)); + setGroup(SOLID_POISSON_RATIO, "Solid|FEM"); + setDescription(SOLID_POISSON_RATIO, "Poisson ratio of solid models."); + static_cast*>(getParameter(SOLID_POISSON_RATIO))->setMinValue(0.0); + + SOLID_VOLUME_STIFFNESS = createNumericParameter("solid_volumeStiffness", "Volume stiffness", std::bind(&SimulationModel::getSolidVolumeStiffness, this), std::bind(static_cast(&SimulationModel::setSolidVolumeStiffness), this, std::placeholders::_1)); + setGroup(SOLID_VOLUME_STIFFNESS, "Solid|Volume constraints"); + setDescription(SOLID_VOLUME_STIFFNESS, "Volume stiffness of solid models."); + static_cast*>(getParameter(SOLID_VOLUME_STIFFNESS))->setMinValue(0.0); + + SOLID_NORMALIZE_STRETCH = createBoolParameter("solid_normalizeStretch", "Normalize stretch", std::bind(&SimulationModel::getSolidNormalizeStretch, this), std::bind(static_cast(&SimulationModel::setSolidNormalizeStretch), this, std::placeholders::_1)); + setGroup(SOLID_NORMALIZE_STRETCH, "Solid|Strain Based Dynamics"); + setDescription(SOLID_NORMALIZE_STRETCH, "Normalize stretch (strain based dynamics)"); + + SOLID_NORMALIZE_SHEAR = createBoolParameter("solid_normalizeShear", "Normalize shear", std::bind(&SimulationModel::getSolidNormalizeShear, this), std::bind(static_cast(&SimulationModel::setSolidNormalizeShear), this, std::placeholders::_1)); + setGroup(SOLID_NORMALIZE_SHEAR, "Solid|Strain Based Dynamics"); + setDescription(SOLID_NORMALIZE_SHEAR, "Normalize shear (strain based dynamics)"); + + ROD_STRETCHING_STIFFNESS = createNumericParameter("rod_stretchingStiffness", "Stretching stiffness/Youngs modulus", std::bind(&SimulationModel::getRodStretchingStiffness, this), std::bind(static_cast(&SimulationModel::setRodStretchingStiffness), this, std::placeholders::_1)); + setGroup(ROD_STRETCHING_STIFFNESS, "Elastic Rod|Parameters"); + setDescription(ROD_STRETCHING_STIFFNESS, "Stretching stiffness/Youngs modulus of elastic rod models."); + static_cast*>(getParameter(ROD_STRETCHING_STIFFNESS))->setMinValue(0.0); + + ROD_SHEARING_STIFFNESS_X = createNumericParameter("rod_shearingStiffnessX", "Shearing stiffness x", std::bind(&SimulationModel::getRodShearingStiffnessX, this), std::bind(static_cast(&SimulationModel::setRodShearingStiffnessX), this, std::placeholders::_1)); + setGroup(ROD_SHEARING_STIFFNESS_X, "Elastic Rod|Parameters"); + setDescription(ROD_SHEARING_STIFFNESS_X, "Shearing stiffness of elastic rod models."); + static_cast*>(getParameter(ROD_SHEARING_STIFFNESS_X))->setMinValue(0.0); + + ROD_SHEARING_STIFFNESS_Y = createNumericParameter("rod_shearingStiffnessY", "Shearing stiffness y", std::bind(&SimulationModel::getRodShearingStiffnessY, this), std::bind(static_cast(&SimulationModel::setRodShearingStiffnessY), this, std::placeholders::_1)); + setGroup(ROD_SHEARING_STIFFNESS_Y, "Elastic Rod|Parameters"); + setDescription(ROD_SHEARING_STIFFNESS_Y, "Shearing stiffness of elastic rod models."); + static_cast*>(getParameter(ROD_SHEARING_STIFFNESS_Y))->setMinValue(0.0); + + ROD_BENDING_STIFFNESS_X = createNumericParameter("rod_bendingStiffnessX", "Bending stiffness x", std::bind(&SimulationModel::getRodBendingStiffnessX, this), std::bind(static_cast(&SimulationModel::setRodBendingStiffnessX), this, std::placeholders::_1)); + setGroup(ROD_BENDING_STIFFNESS_X, "Elastic Rod|Parameters"); + setDescription(ROD_BENDING_STIFFNESS_X, "Bending stiffness of elastic rod models."); + static_cast*>(getParameter(ROD_BENDING_STIFFNESS_X))->setMinValue(0.0); + + ROD_BENDING_STIFFNESS_Y = createNumericParameter("rod_bendingStiffnessY", "Bending stiffness y", std::bind(&SimulationModel::getRodBendingStiffnessY, this), std::bind(static_cast(&SimulationModel::setRodBendingStiffnessY), this, std::placeholders::_1)); + setGroup(ROD_BENDING_STIFFNESS_Y, "Elastic Rod|Parameters"); + setDescription(ROD_BENDING_STIFFNESS_Y, "Bending stiffness of elastic rod models."); + static_cast*>(getParameter(ROD_BENDING_STIFFNESS_Y))->setMinValue(0.0); + + ROD_TWISTING_STIFFNESS = createNumericParameter("rod_twistingStiffness", "Twisting stiffness", std::bind(&SimulationModel::getRodTwistingStiffness, this), std::bind(static_cast(&SimulationModel::setRodTwistingStiffness), this, std::placeholders::_1)); + setGroup(ROD_TWISTING_STIFFNESS, "Elastic Rod|Parameters"); + setDescription(ROD_TWISTING_STIFFNESS, "Twisting stiffness of elastic rod models."); + static_cast*>(getParameter(ROD_TWISTING_STIFFNESS))->setMinValue(0.0); + + CONTACT_STIFFNESS_RB = createNumericParameter("contactStiffnessRigidBody", "Contact stiffness RB", std::bind(&SimulationModel::getContactStiffnessRigidBody, this), std::bind(static_cast(&SimulationModel::setContactStiffnessRigidBody), this, std::placeholders::_1)); + setGroup(CONTACT_STIFFNESS_RB, "Simulation|Contact"); + setDescription(CONTACT_STIFFNESS_RB, "Stiffness coefficient for rigid-rigid contact resolution."); + static_cast*>(getParameter(CONTACT_STIFFNESS_RB))->setMinValue(0.0); + + CONTACT_STIFFNESS_PARTICLE_RB = createNumericParameter("contactStiffnessParticleRigidBody", "Contact stiffness Particle-RB", std::bind(&SimulationModel::getContactStiffnessParticleRigidBody, this), std::bind(static_cast(&SimulationModel::setContactStiffnessParticleRigidBody), this, std::placeholders::_1)); + setGroup(CONTACT_STIFFNESS_PARTICLE_RB, "Simulation|Contact"); + setDescription(CONTACT_STIFFNESS_PARTICLE_RB, "Stiffness coefficient for particle-rigid contact resolution."); + static_cast*>(getParameter(CONTACT_STIFFNESS_PARTICLE_RB))->setMinValue(0.0); +} + +void SimulationModel::reset() +{ + resetContacts(); + + // rigid bodies + for (size_t i = 0; i < m_rigidBodies.size(); i++) + { + m_rigidBodies[i]->reset(); + m_rigidBodies[i]->getGeometry().updateMeshTransformation(m_rigidBodies[i]->getPosition(), m_rigidBodies[i]->getRotationMatrix()); + } + + // particles + for (unsigned int i = 0; i < m_particles.size(); i++) + { + const Vector3r& x0 = m_particles.getPosition0(i); + m_particles.getPosition(i) = x0; + m_particles.getLastPosition(i) = m_particles.getPosition(i); + m_particles.getOldPosition(i) = m_particles.getPosition(i); + m_particles.getVelocity(i).setZero(); + m_particles.getAcceleration(i).setZero(); + } + + // orientations + for(unsigned int i = 0; i < m_orientations.size(); i++) + { + const Quaternionr& q0 = m_orientations.getQuaternion0(i); + m_orientations.getQuaternion(i) = q0; + m_orientations.getLastQuaternion(i) = q0; + m_orientations.getOldQuaternion(i) = q0; + m_orientations.getVelocity(i).setZero(); + m_orientations.getAcceleration(i).setZero(); + } + + updateConstraints(); +} + +SimulationModel::RigidBodyVector & SimulationModel::getRigidBodies() +{ + return m_rigidBodies; +} + +ParticleData & SimulationModel::getParticles() +{ + return m_particles; +} + +OrientationData & SimulationModel::getOrientations() +{ + return m_orientations; +} + +SimulationModel::TriangleModelVector & SimulationModel::getTriangleModels() +{ + return m_triangleModels; +} + +SimulationModel::TetModelVector & SimulationModel::getTetModels() +{ + return m_tetModels; +} + +SimulationModel::LineModelVector & SimulationModel::getLineModels() +{ + return m_lineModels; +} + +SimulationModel::ConstraintVector & SimulationModel::getConstraints() +{ + return m_constraints; +} + +SimulationModel::RigidBodyContactConstraintVector & SimulationModel::getRigidBodyContactConstraints() +{ + return m_rigidBodyContactConstraints; +} + +SimulationModel::ParticleRigidBodyContactConstraintVector & SimulationModel::getParticleRigidBodyContactConstraints() +{ + return m_particleRigidBodyContactConstraints; +} + +SimulationModel::ParticleSolidContactConstraintVector & SimulationModel::getParticleSolidContactConstraints() +{ + return m_particleSolidContactConstraints; +} + +SimulationModel::ConstraintGroupVector & SimulationModel::getConstraintGroups() +{ + return m_constraintGroups; +} + +void SimulationModel::updateConstraints() +{ + for (unsigned int i = 0; i < m_constraints.size(); i++) + m_constraints[i]->updateConstraint(*this); +} + + +bool SimulationModel::addBallJoint(const unsigned int rbIndex1, const unsigned int rbIndex2, const Vector3r &pos) +{ + BallJoint *bj = new BallJoint(); + const bool res = bj->initConstraint(*this, rbIndex1, rbIndex2, pos); + if (res) + { + m_constraints.push_back(bj); + m_groupsInitialized = false; + } + return res; +} + +bool SimulationModel::addBallOnLineJoint(const unsigned int rbIndex1, const unsigned int rbIndex2, const Vector3r &pos, const Vector3r &dir) +{ + BallOnLineJoint *bj = new BallOnLineJoint(); + const bool res = bj->initConstraint(*this, rbIndex1, rbIndex2, pos, dir); + if (res) + { + m_constraints.push_back(bj); + m_groupsInitialized = false; + } + return res; +} + +bool SimulationModel::addHingeJoint(const unsigned int rbIndex1, const unsigned int rbIndex2, const Vector3r &pos, const Vector3r &axis) +{ + HingeJoint *hj = new HingeJoint(); + const bool res = hj->initConstraint(*this, rbIndex1, rbIndex2, pos, axis); + if (res) + { + m_constraints.push_back(hj); + m_groupsInitialized = false; + } + return res; +} + +bool SimulationModel::addUniversalJoint(const unsigned int rbIndex1, const unsigned int rbIndex2, const Vector3r &pos, const Vector3r &axis1, const Vector3r &axis2) +{ + UniversalJoint *uj = new UniversalJoint(); + const bool res = uj->initConstraint(*this, rbIndex1, rbIndex2, pos, axis1, axis2); + if (res) + { + m_constraints.push_back(uj); + m_groupsInitialized = false; + } + return res; +} + +bool SimulationModel::addSliderJoint(const unsigned int rbIndex1, const unsigned int rbIndex2, const Vector3r &axis) +{ + SliderJoint *joint = new SliderJoint(); + const bool res = joint->initConstraint(*this, rbIndex1, rbIndex2, axis); + if (res) + { + m_constraints.push_back(joint); + m_groupsInitialized = false; + } + return res; +} + +bool SimulationModel::addTargetPositionMotorSliderJoint(const unsigned int rbIndex1, const unsigned int rbIndex2, const Vector3r &axis) +{ + TargetPositionMotorSliderJoint *joint = new TargetPositionMotorSliderJoint(); + const bool res = joint->initConstraint(*this, rbIndex1, rbIndex2, axis); + if (res) + { + m_constraints.push_back(joint); + m_groupsInitialized = false; + } + return res; +} + +bool SimulationModel::addTargetVelocityMotorSliderJoint(const unsigned int rbIndex1, const unsigned int rbIndex2, const Vector3r &axis) +{ + TargetVelocityMotorSliderJoint *joint = new TargetVelocityMotorSliderJoint(); + const bool res = joint->initConstraint(*this, rbIndex1, rbIndex2, axis); + if (res) + { + m_constraints.push_back(joint); + m_groupsInitialized = false; + } + return res; +} + + +bool SimulationModel::addTargetAngleMotorHingeJoint(const unsigned int rbIndex1, const unsigned int rbIndex2, const Vector3r &pos, const Vector3r &axis) +{ + TargetAngleMotorHingeJoint *hj = new TargetAngleMotorHingeJoint(); + const bool res = hj->initConstraint(*this, rbIndex1, rbIndex2, pos, axis); + if (res) + { + m_constraints.push_back(hj); + m_groupsInitialized = false; + } + return res; +} + +bool SimulationModel::addTargetVelocityMotorHingeJoint(const unsigned int rbIndex1, const unsigned int rbIndex2, const Vector3r &pos, const Vector3r &axis) +{ + TargetVelocityMotorHingeJoint *hj = new TargetVelocityMotorHingeJoint(); + const bool res = hj->initConstraint(*this, rbIndex1, rbIndex2, pos, axis); + if (res) + { + m_constraints.push_back(hj); + m_groupsInitialized = false; + } + return res; +} + +bool SimulationModel::addDamperJoint(const unsigned int rbIndex1, const unsigned int rbIndex2, const Vector3r &axis, const Real stiffness) +{ + DamperJoint *joint = new DamperJoint(); + const bool res = joint->initConstraint(*this, rbIndex1, rbIndex2, axis, stiffness); + if (res) + { + m_constraints.push_back(joint); + m_groupsInitialized = false; + } + return res; +} + +bool SimulationModel::addRigidBodyParticleBallJoint(const unsigned int rbIndex, const unsigned int particleIndex) +{ + RigidBodyParticleBallJoint *bj = new RigidBodyParticleBallJoint(); + const bool res = bj->initConstraint(*this, rbIndex, particleIndex); + if (res) + { + m_constraints.push_back(bj); + m_groupsInitialized = false; + } + return res; +} + +bool SimulationModel::addRigidBodySpring(const unsigned int rbIndex1, const unsigned int rbIndex2, const Vector3r &pos1, const Vector3r &pos2, const Real stiffness) +{ + RigidBodySpring *s = new RigidBodySpring(); + const bool res = s->initConstraint(*this, rbIndex1, rbIndex2, pos1, pos2, stiffness); + if (res) + { + m_constraints.push_back(s); + m_groupsInitialized = false; + } + return res; +} + +bool SimulationModel::addDistanceJoint(const unsigned int rbIndex1, const unsigned int rbIndex2, const Vector3r &pos1, const Vector3r &pos2) +{ + DistanceJoint *j = new DistanceJoint(); + const bool res = j->initConstraint(*this, rbIndex1, rbIndex2, pos1, pos2); + if (res) + { + m_constraints.push_back(j); + m_groupsInitialized = false; + } + return res; +} + +bool SimulationModel::addRigidBodyContactConstraint(const unsigned int rbIndex1, const unsigned int rbIndex2, + const Vector3r &cp1, const Vector3r &cp2, + const Vector3r &normal, const Real dist, + const Real restitutionCoeff, const Real frictionCoeff) +{ + m_rigidBodyContactConstraints.emplace_back(RigidBodyContactConstraint()); + RigidBodyContactConstraint &cc = m_rigidBodyContactConstraints.back(); + const bool res = cc.initConstraint(*this, rbIndex1, rbIndex2, cp1, cp2, normal, dist, restitutionCoeff, m_contactStiffnessRigidBody, frictionCoeff); + if (!res) + m_rigidBodyContactConstraints.pop_back(); + return res; +} + + bool SimulationModel::addParticleRigidBodyContactConstraint(const unsigned int particleIndex, const unsigned int rbIndex, + const Vector3r &cp1, const Vector3r &cp2, + const Vector3r &normal, const Real dist, + const Real restitutionCoeff, const Real frictionCoeff) +{ + m_particleRigidBodyContactConstraints.emplace_back(ParticleRigidBodyContactConstraint()); + ParticleRigidBodyContactConstraint &cc = m_particleRigidBodyContactConstraints.back(); + const bool res = cc.initConstraint(*this, particleIndex, rbIndex, cp1, cp2, normal, dist, restitutionCoeff, m_contactStiffnessParticleRigidBody, frictionCoeff); + if (!res) + m_particleRigidBodyContactConstraints.pop_back(); + return res; +} + +bool SimulationModel::addParticleSolidContactConstraint(const unsigned int particleIndex, const unsigned int solidIndex, + const unsigned int tetIndex, const Vector3r &bary, + const Vector3r &cp1, const Vector3r &cp2, + const Vector3r &normal, const Real dist, + const Real restitutionCoeff, const Real frictionCoeff) +{ + m_particleSolidContactConstraints.emplace_back(ParticleTetContactConstraint()); + ParticleTetContactConstraint &cc = m_particleSolidContactConstraints.back(); + const bool res = cc.initConstraint(*this, particleIndex, solidIndex, tetIndex, bary, cp1, cp2, normal, dist, frictionCoeff); + if (!res) + m_particleSolidContactConstraints.pop_back(); + return res; +} + +bool SimulationModel::addDistanceConstraint(const unsigned int particle1, const unsigned int particle2, const Real stiffness) +{ + DistanceConstraint *c = new DistanceConstraint(); + const bool res = c->initConstraint(*this, particle1, particle2, stiffness); + if (res) + { + m_constraints.push_back(c); + m_groupsInitialized = false; + } + return res; +} + +bool SimulationModel::addDistanceConstraint_XPBD(const unsigned int particle1, const unsigned int particle2, const Real stiffness) +{ + DistanceConstraint_XPBD* c = new DistanceConstraint_XPBD(); + const bool res = c->initConstraint(*this, particle1, particle2, stiffness); + if (res) + { + m_constraints.push_back(c); + m_groupsInitialized = false; + } + return res; +} + +bool SimulationModel::addDihedralConstraint(const unsigned int particle1, const unsigned int particle2, + const unsigned int particle3, const unsigned int particle4, const Real stiffness) +{ + DihedralConstraint *c = new DihedralConstraint(); + const bool res = c->initConstraint(*this, particle1, particle2, particle3, particle4, stiffness); + if (res) + { + m_constraints.push_back(c); + m_groupsInitialized = false; + } + return res; +} + +bool SimulationModel::addIsometricBendingConstraint(const unsigned int particle1, const unsigned int particle2, + const unsigned int particle3, const unsigned int particle4, const Real stiffness) +{ + IsometricBendingConstraint *c = new IsometricBendingConstraint(); + const bool res = c->initConstraint(*this, particle1, particle2, particle3, particle4, stiffness); + if (res) + { + m_constraints.push_back(c); + m_groupsInitialized = false; + } + return res; +} + +bool SimulationModel::addIsometricBendingConstraint_XPBD(const unsigned int particle1, const unsigned int particle2, + const unsigned int particle3, const unsigned int particle4, const Real stiffness) +{ + IsometricBendingConstraint_XPBD* c = new IsometricBendingConstraint_XPBD(); + const bool res = c->initConstraint(*this, particle1, particle2, particle3, particle4, stiffness); + if (res) + { + m_constraints.push_back(c); + m_groupsInitialized = false; + } + return res; +} + +bool SimulationModel::addFEMTriangleConstraint(const unsigned int particle1, const unsigned int particle2, + const unsigned int particle3, const Real xxStiffness, const Real yyStiffness, const Real xyStiffness, + const Real xyPoissonRatio, const Real yxPoissonRatio) +{ + FEMTriangleConstraint *c = new FEMTriangleConstraint(); + const bool res = c->initConstraint(*this, particle1, particle2, particle3, xxStiffness, + yyStiffness, xyStiffness, xyPoissonRatio, yxPoissonRatio); + if (res) + { + m_constraints.push_back(c); + m_groupsInitialized = false; + } + return res; +} + +bool SimulationModel::addStrainTriangleConstraint(const unsigned int particle1, const unsigned int particle2, + const unsigned int particle3, const Real xxStiffness, const Real yyStiffness, const Real xyStiffness, + const bool normalizeStretch, const bool normalizeShear) +{ + StrainTriangleConstraint *c = new StrainTriangleConstraint(); + const bool res = c->initConstraint(*this, particle1, particle2, particle3, xxStiffness, + yyStiffness, xyStiffness, normalizeStretch, normalizeShear); + if (res) + { + m_constraints.push_back(c); + m_groupsInitialized = false; + } + return res; +} + +bool SimulationModel::addVolumeConstraint(const unsigned int particle1, const unsigned int particle2, + const unsigned int particle3, const unsigned int particle4, const Real stiffness) +{ + VolumeConstraint *c = new VolumeConstraint(); + const bool res = c->initConstraint(*this, particle1, particle2, particle3, particle4, stiffness); + if (res) + { + m_constraints.push_back(c); + m_groupsInitialized = false; + } + return res; +} + +bool SimulationModel::addVolumeConstraint_XPBD(const unsigned int particle1, const unsigned int particle2, + const unsigned int particle3, const unsigned int particle4, const Real stiffness) +{ + VolumeConstraint_XPBD* c = new VolumeConstraint_XPBD(); + const bool res = c->initConstraint(*this, particle1, particle2, particle3, particle4, stiffness); + if (res) + { + m_constraints.push_back(c); + m_groupsInitialized = false; + } + return res; +} + +bool SimulationModel::addFEMTetConstraint(const unsigned int particle1, const unsigned int particle2, + const unsigned int particle3, const unsigned int particle4, + const Real stiffness, const Real poissonRatio) +{ + FEMTetConstraint *c = new FEMTetConstraint(); + const bool res = c->initConstraint(*this, particle1, particle2, particle3, particle4, stiffness, poissonRatio); + if (res) + { + m_constraints.push_back(c); + m_groupsInitialized = false; + } + return res; +} + +bool SimulationModel::addFEMTetConstraint_XPBD(const unsigned int particle1, const unsigned int particle2, + const unsigned int particle3, const unsigned int particle4, + const Real stiffness, const Real poissonRatio) +{ + XPBD_FEMTetConstraint *c = new XPBD_FEMTetConstraint(); + const bool res = c->initConstraint(*this, particle1, particle2, particle3, particle4, stiffness, poissonRatio); + if (res) + { + m_constraints.push_back(c); + m_groupsInitialized = false; + } + return res; +} + +bool SimulationModel::addStrainTetConstraint(const unsigned int particle1, const unsigned int particle2, + const unsigned int particle3, const unsigned int particle4, + const Real stretchStiffness, const Real shearStiffness, + const bool normalizeStretch, const bool normalizeShear) +{ + StrainTetConstraint *c = new StrainTetConstraint(); + const bool res = c->initConstraint(*this, particle1, particle2, particle3, particle4, stretchStiffness, shearStiffness, + normalizeStretch, normalizeShear); + if (res) + { + m_constraints.push_back(c); + m_groupsInitialized = false; + } + return res; +} + +bool SimulationModel::addShapeMatchingConstraint(const unsigned int numberOfParticles, const unsigned int particleIndices[], const unsigned int numClusters[], const Real stiffness) +{ + ShapeMatchingConstraint *c = new ShapeMatchingConstraint(numberOfParticles); + const bool res = c->initConstraint(*this, particleIndices, numClusters, stiffness); + if (res) + { + m_constraints.push_back(c); + m_groupsInitialized = false; + } + return res; +} + +bool SimulationModel::addStretchShearConstraint(const unsigned int particle1, const unsigned int particle2, + const unsigned int quaternion1, const Real stretchingStiffness, + const Real shearingStiffness1, const Real shearingStiffness2) +{ + StretchShearConstraint *c = new StretchShearConstraint(); + const bool res = c->initConstraint(*this, particle1, particle2, quaternion1, stretchingStiffness, shearingStiffness1, shearingStiffness2); + if (res) + { + m_constraints.push_back(c); + m_groupsInitialized = false; + } + return res; +} + +bool SimulationModel::addBendTwistConstraint(const unsigned int quaternion1, + const unsigned int quaternion2, const Real twistingStiffness, + const Real bendingStiffness1, const Real bendingStiffness2) +{ + BendTwistConstraint *c = new BendTwistConstraint(); + const bool res = c->initConstraint(*this, quaternion1, quaternion2, twistingStiffness, bendingStiffness1, bendingStiffness2); + if (res) + { + m_constraints.push_back(c); + m_groupsInitialized = false; + } + return res; +} + +bool PBD::SimulationModel::addStretchBendingTwistingConstraint( + const unsigned int rbIndex1, + const unsigned int rbIndex2, + const Vector3r &pos, + const Real averageRadius, + const Real averageSegmentLength, + const Real youngsModulus, + const Real torsionModulus) +{ + StretchBendingTwistingConstraint *c = new StretchBendingTwistingConstraint(); + const bool res = c->initConstraint(*this, rbIndex1, rbIndex2, pos, + averageRadius, averageSegmentLength, youngsModulus, torsionModulus); + if (res) + { + m_constraints.push_back(c); + m_groupsInitialized = false; + } + return res; +} + +bool PBD::SimulationModel::addDirectPositionBasedSolverForStiffRodsConstraint( + const std::vector> & jointSegmentIndices, + const std::vector &jointPositions, + const std::vector &averageRadii, + const std::vector &averageSegmentLengths, + const std::vector &youngsModuli, + const std::vector &torsionModuli + ) +{ + DirectPositionBasedSolverForStiffRodsConstraint *c = new DirectPositionBasedSolverForStiffRodsConstraint(); + const bool res = c->initConstraint(*this, jointSegmentIndices, jointPositions, + averageRadii, averageSegmentLengths, youngsModuli, torsionModuli); + if (res) + { + m_constraints.push_back(c); + m_groupsInitialized = false; + } + return res; +} + +void SimulationModel::addTriangleModel( + const unsigned int nPoints, + const unsigned int nFaces, + Vector3r *points, + unsigned int* indices, + const TriangleModel::ParticleMesh::UVIndices& uvIndices, + const TriangleModel::ParticleMesh::UVs& uvs) +{ + TriangleModel *triModel = new TriangleModel(); + m_triangleModels.push_back(triModel); + + unsigned int startIndex = m_particles.size(); + m_particles.reserve(startIndex + nPoints); + + for (unsigned int i = 0; i < nPoints; i++) + m_particles.addVertex(points[i]); + + triModel->initMesh(nPoints, nFaces, startIndex, indices, uvIndices, uvs); + + // Update normals + triModel->updateMeshNormals(m_particles); +} + +void SimulationModel::addRegularTriangleModel(const int width, const int height, + const Vector3r& translation, + const Matrix3r& rotation, + const Vector2r& scale) +{ + TriangleModel::ParticleMesh::UVs uvs; + uvs.resize(width * height); + + const Real dy = scale[1] / (Real)(height - 1); + const Real dx = scale[0] / (Real)(width - 1); + + std::vector points; + points.resize(width * height); + for (int i = 0; i < height; i++) + { + for (int j = 0; j < width; j++) + { + const Real y = (Real)dy * i; + const Real x = (Real)dx * j; + points[i * width + j] = rotation * Vector3r(x, y, 0.0) + translation; + + uvs[i * width + j][0] = x / scale[0]; + uvs[i * width + j][1] = y / scale[1]; + } + } + const int nIndices = 6 * (height - 1) * (width - 1); + + TriangleModel::ParticleMesh::UVIndices uvIndices; + uvIndices.resize(nIndices); + + std::vector indices; + indices.resize(nIndices); + int index = 0; + for (int i = 0; i < height - 1; i++) + { + for (int j = 0; j < width - 1; j++) + { + int helper = 0; + if (i % 2 == j % 2) + helper = 1; + + indices[index] = i * width + j; + indices[index + 1] = i * width + j + 1; + indices[index + 2] = (i + 1) * width + j + helper; + + uvIndices[index] = i * width + j; + uvIndices[index + 1] = i * width + j + 1; + uvIndices[index + 2] = (i + 1) * width + j + helper; + index += 3; + + indices[index] = (i + 1) * width + j + 1; + indices[index + 1] = (i + 1) * width + j; + indices[index + 2] = i * width + j + 1 - helper; + + uvIndices[index] = (i + 1) * width + j + 1; + uvIndices[index + 1] = (i + 1) * width + j; + uvIndices[index + 2] = i * width + j + 1 - helper; + index += 3; + } + } + + const unsigned int nPoints = height * width; + const unsigned int nFaces = nIndices / 3; + const auto modelIndex = m_triangleModels.size(); + addTriangleModel(nPoints, nFaces, points.data(), indices.data(), uvIndices, uvs); + const auto offset = m_triangleModels[modelIndex]->getIndexOffset(); + + ParticleData& pd = getParticles(); + for (unsigned int i = offset; i < offset + m_triangleModels[modelIndex]->getParticleMesh().numVertices(); i++) + pd.setMass(i, 1.0); +} + +void SimulationModel::addTetModel( + const unsigned int nPoints, + const unsigned int nTets, + Vector3r *points, + unsigned int* indices) +{ + TetModel *tetModel = new TetModel(); + m_tetModels.push_back(tetModel); + + unsigned int startIndex = m_particles.size(); + m_particles.reserve(startIndex + nPoints); + + for (unsigned int i = 0; i < nPoints; i++) + m_particles.addVertex(points[i]); + + tetModel->initMesh(nPoints, nTets, startIndex, indices); +} + +void SimulationModel::addRegularTetModel(const int width, const int height, const int depth, + const Vector3r& translation, + const Matrix3r& rotation, + const Vector3r& scale) +{ + std::vector points; + points.resize(width * height * depth); + + const Real dx = scale[0] / (Real)(width - 1); + const Real dy = scale[1] / (Real)(height - 1); + const Real dz = scale[2] / (Real)(depth - 1); + + // center in origin + const Vector3r t = translation - 0.5*scale; + for (int i = 0; i < width; i++) + { + for (int j = 0; j < height; j++) + { + for (int k = 0; k < depth; k++) + { + const Real x = (Real)dx * i; + const Real y = (Real)dy * j; + const Real z = (Real)dz * k; + + points[i * height * depth + j * depth + k] = rotation * Vector3r(x, y, z) + t; + } + } + } + + std::vector indices; + indices.reserve(width * height * depth * 5); + for (int i = 0; i < width - 1; i++) + { + for (int j = 0; j < height - 1; j++) + { + for (int k = 0; k < depth - 1; k++) + { + // For each block, the 8 corners are numerated as: + // 4*-----*7 + // /| /| + // / | / | + // 5*-----*6 | + // | 0*--|--*3 + // | / | / + // |/ |/ + // 1*-----*2 + unsigned int p0 = i * height * depth + j * depth + k; + unsigned int p1 = p0 + 1; + unsigned int p3 = (i + 1) * height * depth + j * depth + k; + unsigned int p2 = p3 + 1; + unsigned int p7 = (i + 1) * height * depth + (j + 1) * depth + k; + unsigned int p6 = p7 + 1; + unsigned int p4 = i * height * depth + (j + 1) * depth + k; + unsigned int p5 = p4 + 1; + + // Ensure that neighboring tetras are sharing faces + if ((i + j + k) % 2 == 1) + { + indices.push_back(p2); indices.push_back(p1); indices.push_back(p6); indices.push_back(p3); + indices.push_back(p6); indices.push_back(p3); indices.push_back(p4); indices.push_back(p7); + indices.push_back(p4); indices.push_back(p1); indices.push_back(p6); indices.push_back(p5); + indices.push_back(p3); indices.push_back(p1); indices.push_back(p4); indices.push_back(p0); + indices.push_back(p6); indices.push_back(p1); indices.push_back(p4); indices.push_back(p3); + } + else + { + indices.push_back(p0); indices.push_back(p2); indices.push_back(p5); indices.push_back(p1); + indices.push_back(p7); indices.push_back(p2); indices.push_back(p0); indices.push_back(p3); + indices.push_back(p5); indices.push_back(p2); indices.push_back(p7); indices.push_back(p6); + indices.push_back(p7); indices.push_back(p0); indices.push_back(p5); indices.push_back(p4); + indices.push_back(p0); indices.push_back(p2); indices.push_back(p7); indices.push_back(p5); + } + } + } + } + const auto modelIndex = m_tetModels.size(); + addTetModel(width * height * depth, (unsigned int)indices.size() / 4u, points.data(), indices.data()); + const auto offset = m_tetModels[modelIndex]->getIndexOffset(); + + ParticleData& pd = getParticles(); + for (unsigned int i = offset; i < offset + m_tetModels[modelIndex]->getParticleMesh().numVertices(); i++) + { + pd.setMass(i, 1.0); + } +} + +void SimulationModel::addLineModel( + const unsigned int nPoints, + const unsigned int nQuaternions, + Vector3r *points, + Quaternionr *quaternions, + unsigned int *indices, + unsigned int *indicesQuaternions) +{ + LineModel *lineModel = new LineModel(); + m_lineModels.push_back(lineModel); + + unsigned int startIndex = m_particles.size(); + m_particles.reserve(startIndex + nPoints); + + for (unsigned int i = 0; i < nPoints; i++) + m_particles.addVertex(points[i]); + + unsigned int startIndexOrientations = m_orientations.size(); + m_orientations.reserve(startIndexOrientations + nQuaternions); + + for (unsigned int i = 0; i < nQuaternions; i++) + m_orientations.addQuaternion(quaternions[i]); + + lineModel->initMesh(nPoints, nQuaternions, startIndex, startIndexOrientations, indices, indicesQuaternions); +} + +void SimulationModel::initConstraintGroups() +{ + if (m_groupsInitialized) + return; + + const unsigned int numConstraints = (unsigned int) m_constraints.size(); + const unsigned int numParticles = (unsigned int) m_particles.size(); + const unsigned int numRigidBodies = (unsigned int) m_rigidBodies.size(); + const unsigned int numBodies = numParticles + numRigidBodies; + m_constraintGroups.clear(); + + // Maps in which group a particle is or 0 if not yet mapped + std::vector mapping; + + for (unsigned int i = 0; i < numConstraints; i++) + { + Constraint *constraint = m_constraints[i]; + + bool addToNewGroup = true; + for (unsigned int j = 0; j < m_constraintGroups.size(); j++) + { + bool addToThisGroup = true; + + for (unsigned int k = 0; k < constraint->numberOfBodies(); k++) + { + if (mapping[j][constraint->m_bodies[k]] != 0) + { + addToThisGroup = false; + break; + } + } + + if (addToThisGroup) + { + m_constraintGroups[j].push_back(i); + + for (unsigned int k = 0; k < constraint->numberOfBodies(); k++) + mapping[j][constraint->m_bodies[k]] = 1; + + addToNewGroup = false; + break; + } + } + if (addToNewGroup) + { + mapping.push_back(new unsigned char[numBodies]); + memset(mapping[mapping.size() - 1], 0, sizeof(unsigned char)*numBodies); + m_constraintGroups.resize(m_constraintGroups.size() + 1); + m_constraintGroups[m_constraintGroups.size()-1].push_back(i); + for (unsigned int k = 0; k < constraint->numberOfBodies(); k++) + mapping[m_constraintGroups.size() - 1][constraint->m_bodies[k]] = 1; + } + } + + for (unsigned int i = 0; i < mapping.size(); i++) + { + delete[] mapping[i]; + } + mapping.clear(); + + m_groupsInitialized = true; +} + +void PBD::SimulationModel::setClothSimulationMethod(int val) +{ + m_clothSimulationMethod = val; + if (m_clothSimMethodChanged != nullptr) + m_clothSimMethodChanged(); +} + +void PBD::SimulationModel::setClothBendingMethod(int val) +{ + m_clothBendingMethod = val; + if (m_clothBendingMethodChanged != nullptr) + m_clothBendingMethodChanged(); +} + +void PBD::SimulationModel::setSolidSimulationMethod(int val) +{ + m_solidSimulationMethod = val; + if (m_solidSimMethodChanged != nullptr) + m_solidSimMethodChanged(); +} + + +void SimulationModel::resetContacts() +{ + m_rigidBodyContactConstraints.clear(); + m_particleRigidBodyContactConstraints.clear(); + m_particleSolidContactConstraints.clear(); +} + +void SimulationModel::addClothConstraints(const TriangleModel* tm, const unsigned int clothMethod, + const Real distanceStiffness, const Real xxStiffness, const Real yyStiffness, + const Real xyStiffness, const Real xyPoissonRatio, const Real yxPoissonRatio, + const bool normalizeStretch, const bool normalizeShear) +{ + if (clothMethod == 1) + { + const unsigned int offset = tm->getIndexOffset(); + const unsigned int nEdges = tm->getParticleMesh().numEdges(); + const Utilities::IndexedFaceMesh::Edge* edges = tm->getParticleMesh().getEdges().data(); + for (unsigned int i = 0; i < nEdges; i++) + { + const unsigned int v1 = edges[i].m_vert[0] + offset; + const unsigned int v2 = edges[i].m_vert[1] + offset; + + addDistanceConstraint(v1, v2, distanceStiffness); + } + } + else if (clothMethod == 2) + { + const unsigned int offset = tm->getIndexOffset(); + const TriangleModel::ParticleMesh& mesh = tm->getParticleMesh(); + const unsigned int* tris = mesh.getFaces().data(); + const unsigned int nFaces = mesh.numFaces(); + for (unsigned int i = 0; i < nFaces; i++) + { + const unsigned int v1 = tris[3 * i] + offset; + const unsigned int v2 = tris[3 * i + 1] + offset; + const unsigned int v3 = tris[3 * i + 2] + offset; + addFEMTriangleConstraint(v1, v2, v3, xxStiffness, yyStiffness, xyStiffness, xyPoissonRatio, yxPoissonRatio); + } + } + else if (clothMethod == 3) + { + const unsigned int offset = tm->getIndexOffset(); + const TriangleModel::ParticleMesh& mesh = tm->getParticleMesh(); + const unsigned int* tris = mesh.getFaces().data(); + const unsigned int nFaces = mesh.numFaces(); + for (unsigned int i = 0; i < nFaces; i++) + { + const unsigned int v1 = tris[3 * i] + offset; + const unsigned int v2 = tris[3 * i + 1] + offset; + const unsigned int v3 = tris[3 * i + 2] + offset; + addStrainTriangleConstraint(v1, v2, v3, xxStiffness, yyStiffness, xyStiffness, normalizeStretch, normalizeShear); + } + } + else if (clothMethod == 4) + { + const unsigned int offset = tm->getIndexOffset(); + const unsigned int nEdges = tm->getParticleMesh().numEdges(); + const Utilities::IndexedFaceMesh::Edge* edges = tm->getParticleMesh().getEdges().data(); + for (unsigned int i = 0; i < nEdges; i++) + { + const unsigned int v1 = edges[i].m_vert[0] + offset; + const unsigned int v2 = edges[i].m_vert[1] + offset; + + addDistanceConstraint_XPBD(v1, v2, distanceStiffness); + } + } +} + +void SimulationModel::addBendingConstraints(const TriangleModel *tm, const unsigned int bendingMethod, const Real stiffness) +{ + if ((bendingMethod < 1) || (bendingMethod > 3)) + return; + + const unsigned int offset = tm->getIndexOffset(); + const TriangleModel::ParticleMesh& mesh = tm->getParticleMesh(); + unsigned int nEdges = mesh.numEdges(); + const TriangleModel::ParticleMesh::Edge* edges = mesh.getEdges().data(); + const unsigned int* tris = mesh.getFaces().data(); + for (unsigned int i = 0; i < nEdges; i++) + { + const int tri1 = edges[i].m_face[0]; + const int tri2 = edges[i].m_face[1]; + if ((tri1 != 0xffffffff) && (tri2 != 0xffffffff)) + { + // Find the triangle points which do not lie on the axis + const int axisPoint1 = edges[i].m_vert[0]; + const int axisPoint2 = edges[i].m_vert[1]; + int point1 = -1; + int point2 = -1; + for (int j = 0; j < 3; j++) + { + if ((tris[3 * tri1 + j] != axisPoint1) && (tris[3 * tri1 + j] != axisPoint2)) + { + point1 = tris[3 * tri1 + j]; + break; + } + } + for (int j = 0; j < 3; j++) + { + if ((tris[3 * tri2 + j] != axisPoint1) && (tris[3 * tri2 + j] != axisPoint2)) + { + point2 = tris[3 * tri2 + j]; + break; + } + } + if ((point1 != -1) && (point2 != -1)) + { + const unsigned int vertex1 = point1 + offset; + const unsigned int vertex2 = point2 + offset; + const unsigned int vertex3 = edges[i].m_vert[0] + offset; + const unsigned int vertex4 = edges[i].m_vert[1] + offset; + if (bendingMethod == 1) + addDihedralConstraint(vertex1, vertex2, vertex3, vertex4, stiffness); + else if (bendingMethod == 2) + addIsometricBendingConstraint(vertex1, vertex2, vertex3, vertex4, stiffness); + else if (bendingMethod == 3) + { + addIsometricBendingConstraint_XPBD(vertex1, vertex2, vertex3, vertex4, stiffness); + } + } + } + } +} + +void SimulationModel::addSolidConstraints(const TetModel* tm, const unsigned int solidMethod, const Real stiffness, + const Real poissonRatio, const Real volumeStiffness, + const bool normalizeStretch, const bool normalizeShear) +{ + const unsigned int nTets = tm->getParticleMesh().numTets(); + const unsigned int* tets = tm->getParticleMesh().getTets().data(); + const Utilities::IndexedTetMesh::VerticesTets& vTets = tm->getParticleMesh().getVertexTets(); + const unsigned int offset = tm->getIndexOffset(); + if (solidMethod == 1) + { + const unsigned int nEdges = tm->getParticleMesh().numEdges(); + const Utilities::IndexedTetMesh::Edge* edges = tm->getParticleMesh().getEdges().data(); + for (unsigned int i = 0; i < nEdges; i++) + { + const unsigned int v1 = edges[i].m_vert[0] + offset; + const unsigned int v2 = edges[i].m_vert[1] + offset; + + addDistanceConstraint(v1, v2, stiffness); + } + + for (unsigned int i = 0; i < nTets; i++) + { + const unsigned int v1 = tets[4 * i] + offset; + const unsigned int v2 = tets[4 * i + 1] + offset; + const unsigned int v3 = tets[4 * i + 2] + offset; + const unsigned int v4 = tets[4 * i + 3] + offset; + + addVolumeConstraint(v1, v2, v3, v4, volumeStiffness); + } + } + else if (solidMethod == 2) + { + const TetModel::ParticleMesh& mesh = tm->getParticleMesh(); + for (unsigned int i = 0; i < nTets; i++) + { + const unsigned int v1 = tets[4 * i] + offset; + const unsigned int v2 = tets[4 * i + 1] + offset; + const unsigned int v3 = tets[4 * i + 2] + offset; + const unsigned int v4 = tets[4 * i + 3] + offset; + + addFEMTetConstraint(v1, v2, v3, v4, stiffness, poissonRatio); + } + } + else if (solidMethod == 3) + { + const TetModel::ParticleMesh& mesh = tm->getParticleMesh(); + for (unsigned int i = 0; i < nTets; i++) + { + const unsigned int v1 = tets[4 * i] + offset; + const unsigned int v2 = tets[4 * i + 1] + offset; + const unsigned int v3 = tets[4 * i + 2] + offset; + const unsigned int v4 = tets[4 * i + 3] + offset; + + addFEMTetConstraint_XPBD(v1, v2, v3, v4, stiffness, poissonRatio); + } + } + else if (solidMethod == 4) + { + const TetModel::ParticleMesh& mesh = tm->getParticleMesh(); + for (unsigned int i = 0; i < nTets; i++) + { + const unsigned int v1 = tets[4 * i] + offset; + const unsigned int v2 = tets[4 * i + 1] + offset; + const unsigned int v3 = tets[4 * i + 2] + offset; + const unsigned int v4 = tets[4 * i + 3] + offset; + + addStrainTetConstraint(v1, v2, v3, v4, stiffness, stiffness, normalizeStretch, normalizeStretch); + } + } + else if (solidMethod == 5) + { + const TetModel::ParticleMesh& mesh = tm->getParticleMesh(); + for (unsigned int i = 0; i < nTets; i++) + { + const unsigned int v[4] = { tets[4 * i] + offset, + tets[4 * i + 1] + offset, + tets[4 * i + 2] + offset, + tets[4 * i + 3] + offset }; + // Important: Divide position correction by the number of clusters + // which contain the vertex. + const unsigned int nc[4] = { (unsigned int)vTets[v[0]-offset].size(), (unsigned int)vTets[v[1] - offset].size(), (unsigned int)vTets[v[2] - offset].size(), (unsigned int)vTets[v[3] - offset].size() }; + addShapeMatchingConstraint(4, v, nc, stiffness); + } + } + else if (solidMethod == 6) + { + const unsigned int offset = tm->getIndexOffset(); + const unsigned int nEdges = tm->getParticleMesh().numEdges(); + const Utilities::IndexedTetMesh::Edge* edges = tm->getParticleMesh().getEdges().data(); + for (unsigned int i = 0; i < nEdges; i++) + { + const unsigned int v1 = edges[i].m_vert[0] + offset; + const unsigned int v2 = edges[i].m_vert[1] + offset; + + addDistanceConstraint_XPBD(v1, v2, stiffness); + } + + for (unsigned int i = 0; i < nTets; i++) + { + const unsigned int v1 = tets[4 * i] + offset; + const unsigned int v2 = tets[4 * i + 1] + offset; + const unsigned int v3 = tets[4 * i + 2] + offset; + const unsigned int v4 = tets[4 * i + 3] + offset; + + addVolumeConstraint_XPBD(v1, v2, v3, v4, volumeStiffness); + } + } +} + +void PBD::SimulationModel::setClothStiffness(Real val) +{ + m_cloth_stiffness = val; + setConstraintValue(m_cloth_stiffness); + setConstraintValue(m_cloth_stiffness); +} + +void PBD::SimulationModel::setClothStiffnessXX(Real val) +{ + m_cloth_xxStiffness = val; + setConstraintValue(val); + setConstraintValue(val); +} + +void PBD::SimulationModel::setClothStiffnessYY(Real val) +{ + m_cloth_yyStiffness = val; + setConstraintValue(val); + setConstraintValue(val); +} + +void PBD::SimulationModel::setClothStiffnessXY(Real val) +{ + m_cloth_xyStiffness = val; + setConstraintValue(val); + setConstraintValue(val); +} + +void PBD::SimulationModel::setClothPoissonRatioXY(Real val) +{ + m_cloth_xyPoissonRatio = val; + setConstraintValue(val); +} + +void PBD::SimulationModel::setClothPoissonRatioYX(Real val) +{ + m_cloth_yxPoissonRatio = val; + setConstraintValue(val); +} + +void PBD::SimulationModel::setClothBendingStiffness(Real val) +{ + m_cloth_bendingStiffness = val; + setConstraintValue(val); + setConstraintValue(val); + setConstraintValue(val); +} + +void PBD::SimulationModel::setClothNormalizeStretch(bool val) +{ + m_cloth_normalizeStretch = val; + setConstraintValue(val); +} + +void PBD::SimulationModel::setClothNormalizeShear(bool val) +{ + m_cloth_normalizeShear = val; + setConstraintValue(val); +} + +void PBD::SimulationModel::setSolidStiffness(Real val) +{ + m_solid_stiffness = val; + setConstraintValue(val); + setConstraintValue(val); + setConstraintValue(val); + setConstraintValue(val); + setConstraintValue(val); + setConstraintValue(val); + setConstraintValue(val); +} + +void PBD::SimulationModel::setSolidPoissonRatio(Real val) +{ + m_solid_poissonRatio = val; + setConstraintValue(val); + setConstraintValue(val); +} + +void PBD::SimulationModel::setSolidVolumeStiffness(Real val) +{ + m_solid_volumeStiffness = val; + setConstraintValue(val); + setConstraintValue(val); +} + +void PBD::SimulationModel::setSolidNormalizeStretch(bool val) +{ + m_solid_normalizeStretch = val; + setConstraintValue(val); +} + +void PBD::SimulationModel::setSolidNormalizeShear(bool val) +{ + m_solid_normalizeShear = val; + setConstraintValue(val); +} + +void PBD::SimulationModel::setRodStretchingStiffness(Real val) +{ + m_rod_stretchingStiffness = val; + setConstraintValue(val); + setConstraintValue(val); + setConstraintValue(val); +} + +void PBD::SimulationModel::setRodShearingStiffnessX(Real val) +{ + m_rod_shearingStiffnessX = val; + setConstraintValue(val); +} + +void PBD::SimulationModel::setRodShearingStiffnessY(Real val) +{ + m_rod_shearingStiffnessY = val; + setConstraintValue(val); +} + +void PBD::SimulationModel::setRodBendingStiffnessX(Real val) +{ + m_rod_bendingStiffnessX = val; + setConstraintValue(val); +} + +void PBD::SimulationModel::setRodBendingStiffnessY(Real val) +{ + m_rod_bendingStiffnessY = val; + setConstraintValue(val); +} + +void PBD::SimulationModel::setRodTwistingStiffness(Real val) +{ + m_rod_twistingStiffness = val; + setConstraintValue(val); +} diff --git a/Simulation/SimulationModel.h b/Simulation/SimulationModel.h new file mode 100644 index 00000000..78c47592 --- /dev/null +++ b/Simulation/SimulationModel.h @@ -0,0 +1,331 @@ +#ifndef __SIMULATIONMODEL_H__ +#define __SIMULATIONMODEL_H__ + +#include "Common/Common.h" +#include +#include "Simulation/RigidBody.h" +#include "Simulation/ParticleData.h" +#include "TriangleModel.h" +#include "TetModel.h" +#include "LineModel.h" +#include "ParameterObject.h" + +namespace PBD +{ + class Constraint; + + class SimulationModel : public GenParam::ParameterObject + { + public: + static int CLOTH_SIMULATION_METHOD; + static int ENUM_CLOTHSIM_NONE; + static int ENUM_CLOTHSIM_DISTANCE_CONSTRAINTS; + static int ENUM_CLOTHSIM_FEM_PBD; + static int ENUM_CLOTHSIM_SBD; + static int ENUM_CLOTHSIM_DISTANCE_CONSTRAINTS_XPBD; + + static int CLOTH_STIFFNESS; + static int CLOTH_STIFFNESS_XX; + static int CLOTH_STIFFNESS_YY; + static int CLOTH_STIFFNESS_XY; + static int CLOTH_POISSON_RATIO_XY; + static int CLOTH_POISSON_RATIO_YX; + + static int CLOTH_BENDING_METHOD; + static int ENUM_CLOTH_BENDING_NONE; + static int ENUM_CLOTH_BENDING_DIHEDRAL_ANGLE; + static int ENUM_CLOTH_BENDING_ISOMETRIC; + static int ENUM_CLOTH_BENDING_ISOMETRIX_XPBD; + static int CLOTH_BENDING_STIFFNESS; + static int CLOTH_NORMALIZE_STRETCH; + static int CLOTH_NORMALIZE_SHEAR; + + static int SOLID_SIMULATION_METHOD; + static int ENUM_SOLIDSIM_NONE; + static int ENUM_SOLIDSIM_DISTANCE_CONSTRAINTS; + static int ENUM_SOLIDSIM_FEM_PBD; + static int ENUM_SOLIDSIM_FEM_XPBD; + static int ENUM_SOLIDSIM_SBD; + static int ENUM_SOLIDSIM_SHAPE_MATCHING; + static int ENUM_SOLIDSIM_DISTANCE_CONSTRAINTS_XPBD; + + static int SOLID_STIFFNESS; + static int SOLID_POISSON_RATIO; + static int SOLID_VOLUME_STIFFNESS; + static int SOLID_NORMALIZE_STRETCH; + static int SOLID_NORMALIZE_SHEAR; + + static int ROD_STRETCHING_STIFFNESS; + static int ROD_SHEARING_STIFFNESS_X; + static int ROD_SHEARING_STIFFNESS_Y; + static int ROD_BENDING_STIFFNESS_X; + static int ROD_BENDING_STIFFNESS_Y; + static int ROD_TWISTING_STIFFNESS; + + static int CONTACT_STIFFNESS_RB; + static int CONTACT_STIFFNESS_PARTICLE_RB; + + SimulationModel(); + SimulationModel(const SimulationModel&) = delete; + SimulationModel& operator=(const SimulationModel&) = delete; + virtual ~SimulationModel(); + + void init(); + virtual void initParameters(); + + typedef std::vector ConstraintVector; + typedef std::vector RigidBodyContactConstraintVector; + typedef std::vector ParticleRigidBodyContactConstraintVector; + typedef std::vector ParticleSolidContactConstraintVector; + typedef std::vector RigidBodyVector; + typedef std::vector TriangleModelVector; + typedef std::vector TetModelVector; + typedef std::vector LineModelVector; + typedef std::vector ConstraintGroup; + typedef std::vector ConstraintGroupVector; + + + protected: + RigidBodyVector m_rigidBodies; + TriangleModelVector m_triangleModels; + TetModelVector m_tetModels; + LineModelVector m_lineModels; + ParticleData m_particles; + OrientationData m_orientations; + ConstraintVector m_constraints; + RigidBodyContactConstraintVector m_rigidBodyContactConstraints; + ParticleRigidBodyContactConstraintVector m_particleRigidBodyContactConstraints; + ParticleSolidContactConstraintVector m_particleSolidContactConstraints; + ConstraintGroupVector m_constraintGroups; + + int m_clothSimulationMethod; + int m_clothBendingMethod; + Real m_cloth_stiffness; + Real m_cloth_bendingStiffness; + Real m_cloth_xxStiffness; + Real m_cloth_yyStiffness; + Real m_cloth_xyStiffness; + Real m_cloth_xyPoissonRatio; + Real m_cloth_yxPoissonRatio; + bool m_cloth_normalizeStretch; + bool m_cloth_normalizeShear; + + int m_solidSimulationMethod; + Real m_solid_stiffness; + Real m_solid_poissonRatio; + Real m_solid_volumeStiffness; + bool m_solid_normalizeStretch; + bool m_solid_normalizeShear; + + Real m_rod_stretchingStiffness; + Real m_rod_shearingStiffnessX; + Real m_rod_shearingStiffnessY; + Real m_rod_bendingStiffnessX; + Real m_rod_bendingStiffnessY; + Real m_rod_twistingStiffness; + + Real m_contactStiffnessRigidBody; + Real m_contactStiffnessParticleRigidBody; + + std::function m_clothSimMethodChanged; + std::function m_clothBendingMethodChanged; + std::function m_solidSimMethodChanged; + + public: + virtual void reset(); + virtual void cleanup(); + + RigidBodyVector &getRigidBodies(); + ParticleData &getParticles(); + OrientationData &getOrientations(); + TriangleModelVector &getTriangleModels(); + TetModelVector &getTetModels(); + LineModelVector &getLineModels(); + ConstraintVector &getConstraints(); + RigidBodyContactConstraintVector &getRigidBodyContactConstraints(); + ParticleRigidBodyContactConstraintVector &getParticleRigidBodyContactConstraints(); + ParticleSolidContactConstraintVector &getParticleSolidContactConstraints(); + ConstraintGroupVector &getConstraintGroups(); + bool m_groupsInitialized; + + void resetContacts(); + + void addTriangleModel( + const unsigned int nPoints, + const unsigned int nFaces, + Vector3r *points, + unsigned int* indices, + const TriangleModel::ParticleMesh::UVIndices& uvIndices, + const TriangleModel::ParticleMesh::UVs& uvs); + void addRegularTriangleModel(const int width, const int height, + const Vector3r& translation = Vector3r::Zero(), + const Matrix3r& rotation = Matrix3r::Identity(), + const Vector2r& scale = Vector2r::Ones()); + + void addTetModel( + const unsigned int nPoints, + const unsigned int nTets, + Vector3r *points, + unsigned int* indices); + void addRegularTetModel(const int width, const int height, const int depth, + const Vector3r& translation = Vector3r::Zero(), + const Matrix3r& rotation = Matrix3r::Identity(), + const Vector3r& scale = Vector3r::Ones()); + + void addLineModel( + const unsigned int nPoints, + const unsigned int nQuaternions, + Vector3r *points, + Quaternionr *quaternions, + unsigned int *indices, + unsigned int *indicesQuaternions); + + void updateConstraints(); + void initConstraintGroups(); + + bool addBallJoint(const unsigned int rbIndex1, const unsigned int rbIndex2, const Vector3r &pos); + bool addBallOnLineJoint(const unsigned int rbIndex1, const unsigned int rbIndex2, const Vector3r &pos, const Vector3r &dir); + bool addHingeJoint(const unsigned int rbIndex1, const unsigned int rbIndex2, const Vector3r &pos, const Vector3r &axis); + bool addTargetAngleMotorHingeJoint(const unsigned int rbIndex1, const unsigned int rbIndex2, const Vector3r &pos, const Vector3r &axis); + bool addTargetVelocityMotorHingeJoint(const unsigned int rbIndex1, const unsigned int rbIndex2, const Vector3r &pos, const Vector3r &axis); + bool addUniversalJoint(const unsigned int rbIndex1, const unsigned int rbIndex2, const Vector3r &pos, const Vector3r &axis1, const Vector3r &axis2); + bool addSliderJoint(const unsigned int rbIndex1, const unsigned int rbIndex2, const Vector3r &axis); + bool addTargetPositionMotorSliderJoint(const unsigned int rbIndex1, const unsigned int rbIndex2, const Vector3r &axis); + bool addTargetVelocityMotorSliderJoint(const unsigned int rbIndex1, const unsigned int rbIndex2, const Vector3r &axis); + bool addRigidBodyParticleBallJoint(const unsigned int rbIndex, const unsigned int particleIndex); + bool addRigidBodySpring(const unsigned int rbIndex1, const unsigned int rbIndex2, const Vector3r &pos1, const Vector3r &pos2, const Real stiffness); + bool addDistanceJoint(const unsigned int rbIndex1, const unsigned int rbIndex2, const Vector3r &pos1, const Vector3r &pos2); + bool addDamperJoint(const unsigned int rbIndex1, const unsigned int rbIndex2, const Vector3r &axis, const Real stiffness); + bool addRigidBodyContactConstraint(const unsigned int rbIndex1, const unsigned int rbIndex2, + const Vector3r &cp1, const Vector3r &cp2, + const Vector3r &normal, const Real dist, + const Real restitutionCoeff, const Real frictionCoeff); + bool addParticleRigidBodyContactConstraint(const unsigned int particleIndex, const unsigned int rbIndex, + const Vector3r &cp1, const Vector3r &cp2, + const Vector3r &normal, const Real dist, + const Real restitutionCoeff, const Real frictionCoeff); + + bool addParticleSolidContactConstraint(const unsigned int particleIndex, const unsigned int solidIndex, + const unsigned int tetIndex, const Vector3r &bary, + const Vector3r &cp1, const Vector3r &cp2, + const Vector3r &normal, const Real dist, + const Real restitutionCoeff, const Real frictionCoeff); + + bool addDistanceConstraint(const unsigned int particle1, const unsigned int particle2, const Real stiffness); + bool addDistanceConstraint_XPBD(const unsigned int particle1, const unsigned int particle2, const Real stiffness); + bool addDihedralConstraint( const unsigned int particle1, const unsigned int particle2, + const unsigned int particle3, const unsigned int particle4, const Real stiffness); + bool addIsometricBendingConstraint(const unsigned int particle1, const unsigned int particle2, + const unsigned int particle3, const unsigned int particle4, const Real stiffness); + bool addIsometricBendingConstraint_XPBD(const unsigned int particle1, const unsigned int particle2, + const unsigned int particle3, const unsigned int particle4, const Real stiffness); + bool addFEMTriangleConstraint(const unsigned int particle1, const unsigned int particle2, const unsigned int particle3, + const Real xxStiffness, const Real yyStiffness, const Real xyStiffness, + const Real xyPoissonRatio, const Real yxPoissonRatio); + bool addStrainTriangleConstraint(const unsigned int particle1, const unsigned int particle2, + const unsigned int particle3, const Real xxStiffness, const Real yyStiffness, const Real xyStiffness, + const bool normalizeStretch, const bool normalizeShear); + bool addVolumeConstraint(const unsigned int particle1, const unsigned int particle2, + const unsigned int particle3, const unsigned int particle4, const Real stiffness); + bool addVolumeConstraint_XPBD(const unsigned int particle1, const unsigned int particle2, + const unsigned int particle3, const unsigned int particle4, const Real stiffness); + bool addFEMTetConstraint(const unsigned int particle1, const unsigned int particle2, + const unsigned int particle3, const unsigned int particle4, + const Real stiffness, const Real poissonRatio); + bool addFEMTetConstraint_XPBD(const unsigned int particle1, const unsigned int particle2, + const unsigned int particle3, const unsigned int particle4, + const Real stiffness, const Real poissonRatio); + bool addStrainTetConstraint(const unsigned int particle1, const unsigned int particle2, + const unsigned int particle3, const unsigned int particle4, + const Real stretchStiffness, const Real shearStiffness, + const bool normalizeStretch, const bool normalizeShear); + bool addShapeMatchingConstraint(const unsigned int numberOfParticles, const unsigned int particleIndices[], const unsigned int numClusters[], const Real stiffness); + bool addStretchShearConstraint(const unsigned int particle1, const unsigned int particle2, + const unsigned int quaternion1, const Real stretchingStiffness, + const Real shearingStiffness1, const Real shearingStiffness2); + bool addBendTwistConstraint(const unsigned int quaternion1, const unsigned int quaternion2, + const Real twistingStiffness, const Real bendingStiffness1, const Real bendingStiffness2); + bool addStretchBendingTwistingConstraint(const unsigned int rbIndex1, const unsigned int rbIndex2, const Vector3r &pos, const Real averageRadius, const Real averageSegmentLength, const Real youngsModulus, const Real torsionModulus); + bool addDirectPositionBasedSolverForStiffRodsConstraint(const std::vector> & jointSegmentIndices, const std::vector &jointPositions, const std::vector &averageRadii, const std::vector &averageSegmentLengths, const std::vector &youngsModuli, const std::vector &torsionModuli); + + Real getContactStiffnessRigidBody() const { return m_contactStiffnessRigidBody; } + void setContactStiffnessRigidBody(Real val) { m_contactStiffnessRigidBody = val; } + Real getContactStiffnessParticleRigidBody() const { return m_contactStiffnessParticleRigidBody; } + void setContactStiffnessParticleRigidBody(Real val) { m_contactStiffnessParticleRigidBody = val; } + + void addClothConstraints(const TriangleModel* tm, const unsigned int clothMethod, + const Real distanceStiffness, const Real xxStiffness, const Real yyStiffness, + const Real xyStiffness, const Real xyPoissonRatio, const Real yxPoissonRatio, + const bool normalizeStretch, const bool normalizeShear); + void addBendingConstraints(const TriangleModel* tm, const unsigned int bendingMethod, const Real stiffness); + void addSolidConstraints(const TetModel* tm, const unsigned int solidMethod, const Real stiffness, + const Real poissonRatio, const Real volumeStiffness, + const bool normalizeStretch, const bool normalizeShear); + + template + void setConstraintValue(const T v) + { + for (auto i = 0; i < m_constraints.size(); i++) + { + ConstraintType* c = dynamic_cast(m_constraints[i]); + if (c != nullptr) + c->*MemPtr = v; + } + } + + void setClothSimulationMethodChangedCallback(std::function const& callBackFct) { m_clothSimMethodChanged = callBackFct; } + void setClothBendingMethodChangedCallback(std::function const& callBackFct) { m_clothBendingMethodChanged = callBackFct; } + void setSolidSimulationMethodChangedCallback(std::function const& callBackFct) { m_solidSimMethodChanged = callBackFct; } + + virtual int getClothSimulationMethod() { return m_clothSimulationMethod; } + virtual void setClothSimulationMethod(const int val); + virtual int getClothBendingMethod() { return m_clothBendingMethod; } + virtual void setClothBendingMethod(const int val); + virtual Real getClothStiffness() { return m_cloth_stiffness; } + virtual void setClothStiffness(Real val); + virtual Real getClothStiffnessXX() { return m_cloth_xxStiffness; } + virtual void setClothStiffnessXX(Real val); + virtual Real getClothStiffnessYY() { return m_cloth_yyStiffness; } + virtual void setClothStiffnessYY(Real val); + virtual Real getClothStiffnessXY() { return m_cloth_xyStiffness; } + virtual void setClothStiffnessXY(Real val); + virtual Real getClothPoissonRatioXY() { return m_cloth_xyPoissonRatio; } + virtual void setClothPoissonRatioXY(Real val); + virtual Real getClothPoissonRatioYX() { return m_cloth_yxPoissonRatio; } + virtual void setClothPoissonRatioYX(Real val); + virtual Real getClothBendingStiffness() { return m_cloth_bendingStiffness; } + virtual void setClothBendingStiffness(Real val); + virtual bool getClothNormalizeStretch() { return m_cloth_normalizeStretch; } + virtual void setClothNormalizeStretch(bool val); + virtual bool getClothNormalizeShear() { return m_cloth_normalizeShear; } + virtual void setClothNormalizeShear(bool val); + + virtual int getSolidSimulationMethod() { return m_solidSimulationMethod; } + virtual void setSolidSimulationMethod(const int val); + virtual Real getSolidStiffness() { return m_solid_stiffness; } + virtual void setSolidStiffness(Real val); + virtual Real getSolidPoissonRatio() { return m_solid_poissonRatio; } + virtual void setSolidPoissonRatio(Real val); + virtual Real getSolidVolumeStiffness() { return m_solid_volumeStiffness; } + virtual void setSolidVolumeStiffness(Real val); + virtual bool getSolidNormalizeStretch() { return m_solid_normalizeStretch; } + virtual void setSolidNormalizeStretch(bool val); + virtual bool getSolidNormalizeShear() { return m_solid_normalizeShear; } + virtual void setSolidNormalizeShear(bool val); + + virtual Real getRodStretchingStiffness() { return m_rod_stretchingStiffness; } + virtual void setRodStretchingStiffness(Real val); + virtual Real getRodShearingStiffnessX() { return m_rod_shearingStiffnessX; } + virtual void setRodShearingStiffnessX(Real val); + virtual Real getRodShearingStiffnessY() { return m_rod_shearingStiffnessY; } + virtual void setRodShearingStiffnessY(Real val); + virtual Real getRodBendingStiffnessX() { return m_rod_bendingStiffnessX; } + virtual void setRodBendingStiffnessX(Real val); + virtual Real getRodBendingStiffnessY() { return m_rod_bendingStiffnessY; } + virtual void setRodBendingStiffnessY(Real val); + virtual Real getRodTwistingStiffness() { return m_rod_twistingStiffness; } + virtual void setRodTwistingStiffness(Real val); + }; +} + +#endif \ No newline at end of file diff --git a/Demos/Simulation/TetModel.cpp b/Simulation/TetModel.cpp similarity index 94% rename from Demos/Simulation/TetModel.cpp rename to Simulation/TetModel.cpp index 3fd086f9..102bca93 100644 --- a/Demos/Simulation/TetModel.cpp +++ b/Simulation/TetModel.cpp @@ -1,8 +1,10 @@ #include "TetModel.h" #include "PositionBasedDynamics/PositionBasedDynamics.h" #include +#include "Utils/Logger.h" using namespace PBD; +using namespace Utilities; TetModel::TetModel() : m_surfaceMesh(), @@ -10,8 +12,11 @@ TetModel::TetModel() : m_visMesh(), m_particleMesh() { - m_restitutionCoeff = 0.6; - m_frictionCoeff = 0.2; + m_initialX.setZero(); + m_initialR.setIdentity(); + m_initialScale.setOnes(); + m_restitutionCoeff = static_cast(0.6); + m_frictionCoeff = static_cast(0.2); } TetModel::~TetModel(void) @@ -24,11 +29,6 @@ void TetModel::cleanupModel() m_particleMesh.release(); } -TetModel::ParticleMesh &TetModel::getParticleMesh() -{ - return m_particleMesh; -} - TetModel::SurfaceMesh &TetModel::getSurfaceMesh() { return m_surfaceMesh; @@ -93,7 +93,7 @@ void TetModel::updateMeshNormals(const ParticleData &pd) void TetModel::attachVisMesh(const ParticleData &pd) { - const Real eps = 1.0e-6; + const Real eps = static_cast(1.0e-6); // The created surface mesh defines the boundary of the tet mesh unsigned int *faces = m_surfaceMesh.getFaces().data(); @@ -115,7 +115,7 @@ void TetModel::attachVisMesh(const ParticleData &pd) int curT[nNearstT]; for (int k = 0; k < nNearstT; k++) { - curDist[k] = FLT_MAX; + curDist[k] = REAL_MAX; curT[k] = -1; } Vector3r curBary[nNearstT]; @@ -155,12 +155,12 @@ void TetModel::attachVisMesh(const ParticleData &pd) } if (curT[0] == -1) { - std::cout << "ERROR: vertex has no nearest triangle." << std::endl; + LOG_ERR << "ERROR: vertex has no nearest triangle."; continue; } // take the best bary coords we find from the best 5 triangles - Real error = FLT_MAX; + Real error = REAL_MAX; int current_k = 0; Real current_dist = 0.0; Vector3r current_bary; @@ -196,7 +196,7 @@ void TetModel::attachVisMesh(const ParticleData &pd) Real u = curBary[k][0]; Real v = curBary[k][0]; solveQuadraticForZero(F, Fu, Fv, Fuu, Fuv, Fvv, u, v); - Real w = 1.0 - u - v; + Real w = static_cast(1.0) - u - v; if (u < 0) u = 0.0; if (u > 1) u = 1.0; @@ -207,10 +207,10 @@ void TetModel::attachVisMesh(const ParticleData &pd) Real uv = u + v; Real u_ = u; Real v_ = v; - u -= (uv - 1.0)*v_ / uv; - v -= (uv - 1.0)*u_ / uv; + u -= (uv - static_cast(1.0))*v_ / uv; + v -= (uv - static_cast(1.0))*u_ / uv; } - w = 1.0 - u - v; + w = static_cast(1.0) - u - v; Vector3r curInter = p1*u + p2*v + p3*w; Real dist = (p - curInter).norm(); @@ -251,7 +251,7 @@ void TetModel::solveQuadraticForZero(const Vector3r& F, const Vector3r& Fu, cons const Vector3r&Fuv, const Vector3r& Fvv, Real& u, Real& v) { // newton iterations search F(u,v) = [0,0,0] - Real eps = 1.0e-6; + Real eps = static_cast(1.0e-6); unsigned char k; for (k = 0; k < 50; k++) { diff --git a/Demos/Simulation/TetModel.h b/Simulation/TetModel.h similarity index 73% rename from Demos/Simulation/TetModel.h rename to Simulation/TetModel.h index f07ac2c7..a79d122c 100644 --- a/Demos/Simulation/TetModel.h +++ b/Simulation/TetModel.h @@ -1,13 +1,11 @@ #ifndef __TETMODEL_H__ #define __TETMODEL_H__ -#include "Demos/Common/Config.h" #include "Common/Common.h" -#include "Demos/Utils/IndexedFaceMesh.h" -#include "Demos/Utils/IndexedTetMesh.h" -#include "Demos/Simulation/ParticleData.h" +#include "Utils/IndexedFaceMesh.h" +#include "Utils/IndexedTetMesh.h" +#include "Simulation/ParticleData.h" #include -#include "Demos/Utils/ObjectArray.h" namespace PBD { @@ -17,8 +15,8 @@ namespace PBD TetModel(); virtual ~TetModel(); - typedef IndexedFaceMesh SurfaceMesh; - typedef IndexedTetMesh ParticleMesh; + typedef Utilities::IndexedFaceMesh SurfaceMesh; + typedef Utilities::IndexedTetMesh ParticleMesh; struct Attachment { @@ -29,7 +27,14 @@ namespace PBD Real m_minError; }; - protected: + Vector3r& getInitialX() { return m_initialX; } + void setInitialX(const Vector3r &val) { m_initialX = val; } + Matrix3r& getInitialR() { return m_initialR; } + void setInitialR(const Matrix3r &val) { m_initialR = val; } + Vector3r& getInitialScale() { return m_initialScale; } + void setInitialScale(const Vector3r &val) { m_initialScale = val; } + + protected: /** offset which must be added to get the correct index in the particles array */ unsigned int m_indexOffset; /** Tet mesh of particles which represents the simulation model */ @@ -39,7 +44,10 @@ namespace PBD SurfaceMesh m_visMesh; Real m_restitutionCoeff; Real m_frictionCoeff; - ObjectArray m_attachments; + std::vector m_attachments; + Vector3r m_initialX; + Matrix3r m_initialR; + Vector3r m_initialScale; void createSurfaceMesh(); void solveQuadraticForZero(const Vector3r& F, const Vector3r& Fu, @@ -51,12 +59,11 @@ namespace PBD public: - void updateConstraints(); - SurfaceMesh &getSurfaceMesh(); VertexData &getVisVertices(); SurfaceMesh &getVisMesh(); - ParticleMesh &getParticleMesh(); + ParticleMesh& getParticleMesh() { return m_particleMesh; } + const ParticleMesh& getParticleMesh() const { return m_particleMesh; } void cleanupModel(); unsigned int getIndexOffset() const; diff --git a/Demos/Simulation/TimeManager.cpp b/Simulation/TimeManager.cpp similarity index 95% rename from Demos/Simulation/TimeManager.cpp rename to Simulation/TimeManager.cpp index f98451f7..36167616 100644 --- a/Demos/Simulation/TimeManager.cpp +++ b/Simulation/TimeManager.cpp @@ -7,7 +7,7 @@ TimeManager* TimeManager::current = 0; TimeManager::TimeManager () { time = 0; - h = 0.005; + h = static_cast(0.005); } TimeManager::~TimeManager () diff --git a/Demos/Simulation/TimeManager.h b/Simulation/TimeManager.h similarity index 93% rename from Demos/Simulation/TimeManager.h rename to Simulation/TimeManager.h index f0a78ad6..e6fda8b3 100644 --- a/Demos/Simulation/TimeManager.h +++ b/Simulation/TimeManager.h @@ -1,7 +1,6 @@ #ifndef _TIMEMANAGER_H #define _TIMEMANAGER_H -#include "Demos/Common/Config.h" #include "Common/Common.h" namespace PBD diff --git a/Simulation/TimeStep.cpp b/Simulation/TimeStep.cpp new file mode 100644 index 00000000..5d73b935 --- /dev/null +++ b/Simulation/TimeStep.cpp @@ -0,0 +1,101 @@ +#include "TimeStep.h" +#include "TimeManager.h" +#include "Simulation.h" + + +using namespace PBD; +using namespace std; +using namespace GenParam; + +TimeStep::TimeStep() +{ +} + +TimeStep::~TimeStep(void) +{ +} + +void TimeStep::init() +{ + initParameters(); +} + +void TimeStep::initParameters() +{ + ParameterObject::initParameters(); +} + +void TimeStep::clearAccelerations(SimulationModel &model) +{ + ////////////////////////////////////////////////////////////////////////// + // rigid body model + ////////////////////////////////////////////////////////////////////////// + + SimulationModel::RigidBodyVector &rb = model.getRigidBodies(); + Simulation *sim = Simulation::getCurrent(); + const Vector3r grav(sim->getVecValue(Simulation::GRAVITATION)); + for (size_t i = 0; i < rb.size(); i++) + { + // Clear accelerations of dynamic particles + if (rb[i]->getMass() != 0.0) + { + Vector3r &a = rb[i]->getAcceleration(); + a = grav; + } + } + + ////////////////////////////////////////////////////////////////////////// + // particle model + ////////////////////////////////////////////////////////////////////////// + + ParticleData &pd = model.getParticles(); + const unsigned int count = pd.size(); + for (unsigned int i = 0; i < count; i++) + { + // Clear accelerations of dynamic particles + if (pd.getMass(i) != 0.0) + { + Vector3r &a = pd.getAcceleration(i); + a = grav; + } + } +} + +void TimeStep::reset() +{ +} + +void TimeStep::setCollisionDetection(SimulationModel &model, CollisionDetection *cd) +{ + m_collisionDetection = cd; + m_collisionDetection->setContactCallback(contactCallbackFunction, &model); + m_collisionDetection->setSolidContactCallback(solidContactCallbackFunction, &model); +} + +CollisionDetection *TimeStep::getCollisionDetection() +{ + return m_collisionDetection; +} + +void TimeStep::contactCallbackFunction(const unsigned int contactType, const unsigned int bodyIndex1, const unsigned int bodyIndex2, + const Vector3r &cp1, const Vector3r &cp2, + const Vector3r &normal, const Real dist, + const Real restitutionCoeff, const Real frictionCoeff, void *userData) +{ + SimulationModel *model = (SimulationModel*)userData; + if (contactType == CollisionDetection::RigidBodyContactType) + model->addRigidBodyContactConstraint(bodyIndex1, bodyIndex2, cp1, cp2, normal, dist, restitutionCoeff, frictionCoeff); + else if (contactType == CollisionDetection::ParticleRigidBodyContactType) + model->addParticleRigidBodyContactConstraint(bodyIndex1, bodyIndex2, cp1, cp2, normal, dist, restitutionCoeff, frictionCoeff); +} + +void TimeStep::solidContactCallbackFunction(const unsigned int contactType, const unsigned int bodyIndex1, const unsigned int bodyIndex2, + const unsigned int tetIndex, const Vector3r &bary, + const Vector3r &cp1, const Vector3r &cp2, + const Vector3r &normal, const Real dist, + const Real restitutionCoeff, const Real frictionCoeff, void *userData) +{ + SimulationModel *model = (SimulationModel*)userData; + if (contactType == CollisionDetection::ParticleSolidContactType) + model->addParticleSolidContactConstraint(bodyIndex1, bodyIndex2, tetIndex, bary, cp1, cp2, normal, dist, restitutionCoeff, frictionCoeff); +} \ No newline at end of file diff --git a/Simulation/TimeStep.h b/Simulation/TimeStep.h new file mode 100644 index 00000000..c38b2f94 --- /dev/null +++ b/Simulation/TimeStep.h @@ -0,0 +1,51 @@ +#ifndef __TimeStep_h__ +#define __TimeStep_h__ + +#include "Common/Common.h" +#include "SimulationModel.h" +#include "CollisionDetection.h" +#include "ParameterObject.h" + +namespace PBD +{ + /** \brief Base class for the simulation methods. + */ + class TimeStep : public GenParam::ParameterObject + { + protected: + CollisionDetection *m_collisionDetection; + + /** Clear accelerations and add gravitation. + */ + void clearAccelerations(SimulationModel &model); + + virtual void initParameters(); + + static void contactCallbackFunction(const unsigned int contactType, + const unsigned int bodyIndex1, const unsigned int bodyIndex2, + const Vector3r &cp1, const Vector3r &cp2, + const Vector3r &normal, const Real dist, + const Real restitutionCoeff, const Real frictionCoeff, void *userData); + + static void solidContactCallbackFunction(const unsigned int contactType, + const unsigned int bodyIndex1, const unsigned int bodyIndex2, + const unsigned int tetIndex, const Vector3r &bary, + const Vector3r &cp1, const Vector3r &cp2, + const Vector3r &normal, const Real dist, + const Real restitutionCoeff, const Real frictionCoeff, void *userData); + + public: + TimeStep(); + virtual ~TimeStep(void); + + virtual void step(SimulationModel &model) = 0; + virtual void reset(); + + virtual void init(); + + void setCollisionDetection(SimulationModel &model, CollisionDetection *cd); + CollisionDetection *getCollisionDetection(); + }; +} + +#endif diff --git a/Simulation/TimeStepController.cpp b/Simulation/TimeStepController.cpp new file mode 100644 index 00000000..1f4404a2 --- /dev/null +++ b/Simulation/TimeStepController.cpp @@ -0,0 +1,359 @@ +#include "TimeStepController.h" +#include "Simulation/TimeManager.h" +#include "PositionBasedDynamics/PositionBasedRigidBodyDynamics.h" +#include "PositionBasedDynamics/TimeIntegration.h" +#include +#include "PositionBasedDynamics/PositionBasedDynamics.h" +#include "Utils/Timing.h" + +using namespace PBD; +using namespace std; +using namespace GenParam; + +// int TimeStepController::SOLVER_ITERATIONS = -1; +// int TimeStepController::SOLVER_ITERATIONS_V = -1; +int TimeStepController::NUM_SUB_STEPS = -1; +int TimeStepController::MAX_ITERATIONS = -1; +int TimeStepController::MAX_ITERATIONS_V = -1; +int TimeStepController::VELOCITY_UPDATE_METHOD = -1; +int TimeStepController::ENUM_VUPDATE_FIRST_ORDER = -1; +int TimeStepController::ENUM_VUPDATE_SECOND_ORDER = -1; + + +TimeStepController::TimeStepController() +{ + m_velocityUpdateMethod = 0; + m_iterations = 0; + m_iterationsV = 0; + m_maxIterations = 1; + m_maxIterationsV = 5; + m_subSteps = 5; + m_collisionDetection = NULL; +} + +TimeStepController::~TimeStepController(void) +{ +} + +void TimeStepController::initParameters() +{ + TimeStep::initParameters(); + +// SOLVER_ITERATIONS = createNumericParameter("iterations", "Iterations", &m_iterations); +// setGroup(SOLVER_ITERATIONS, "Simulation|PBD"); +// setDescription(SOLVER_ITERATIONS, "Iterations required by the solver."); +// getParameter(SOLVER_ITERATIONS)->setReadOnly(true); + + NUM_SUB_STEPS = createNumericParameter("subSteps", "# sub steps", &m_subSteps); + setGroup(NUM_SUB_STEPS, "Simulation|PBD"); + setDescription(NUM_SUB_STEPS, "Number of sub steps of the solver."); + static_cast*>(getParameter(NUM_SUB_STEPS))->setMinValue(1); + + MAX_ITERATIONS = createNumericParameter("maxIterations", "Max. iterations", &m_maxIterations); + setGroup(MAX_ITERATIONS, "Simulation|PBD"); + setDescription(MAX_ITERATIONS, "Maximal number of iterations of the solver."); + static_cast*>(getParameter(MAX_ITERATIONS))->setMinValue(1); + +// SOLVER_ITERATIONS_V = createNumericParameter("iterationsV", "Velocity iterations", &m_iterationsV); +// setGroup(SOLVER_ITERATIONS_V, "Simulation|PBD"); +// setDescription(SOLVER_ITERATIONS_V, "Iterations required by the velocity solver."); +// getParameter(SOLVER_ITERATIONS_V)->setReadOnly(true); + + MAX_ITERATIONS_V = createNumericParameter("maxIterationsV", "Max. velocity iterations", &m_maxIterationsV); + setGroup(MAX_ITERATIONS_V, "Simulation|PBD"); + setDescription(MAX_ITERATIONS_V, "Maximal number of iterations of the velocity solver."); + static_cast*>(getParameter(MAX_ITERATIONS_V))->setMinValue(0); + + VELOCITY_UPDATE_METHOD = createEnumParameter("velocityUpdateMethod", "Velocity update method", &m_velocityUpdateMethod); + setGroup(VELOCITY_UPDATE_METHOD, "Simulation|PBD"); + setDescription(VELOCITY_UPDATE_METHOD, "Velocity method."); + EnumParameter* enumParam = static_cast(getParameter(VELOCITY_UPDATE_METHOD)); + enumParam->addEnumValue("First Order Update", ENUM_VUPDATE_FIRST_ORDER); + enumParam->addEnumValue("Second Order Update", ENUM_VUPDATE_SECOND_ORDER); +} + +void TimeStepController::step(SimulationModel &model) +{ + START_TIMING("simulation step"); + TimeManager *tm = TimeManager::getCurrent (); + const Real hOld = tm->getTimeStepSize(); + + ////////////////////////////////////////////////////////////////////////// + // rigid body model + ////////////////////////////////////////////////////////////////////////// + clearAccelerations(model); + SimulationModel::RigidBodyVector &rb = model.getRigidBodies(); + ParticleData &pd = model.getParticles(); + OrientationData &od = model.getOrientations(); + + const int numBodies = (int)rb.size(); + + Real h = hOld / (Real)m_subSteps; + tm->setTimeStepSize(h); + for (unsigned int step = 0; step < m_subSteps; step++) + { + #pragma omp parallel if(numBodies > MIN_PARALLEL_SIZE) default(shared) + { + #pragma omp for schedule(static) nowait + for (int i = 0; i < numBodies; i++) + { + rb[i]->getLastPosition() = rb[i]->getOldPosition(); + rb[i]->getOldPosition() = rb[i]->getPosition(); + TimeIntegration::semiImplicitEuler(h, rb[i]->getMass(), rb[i]->getPosition(), rb[i]->getVelocity(), rb[i]->getAcceleration()); + rb[i]->getLastRotation() = rb[i]->getOldRotation(); + rb[i]->getOldRotation() = rb[i]->getRotation(); + TimeIntegration::semiImplicitEulerRotation(h, rb[i]->getMass(), rb[i]->getInertiaTensorW(), rb[i]->getInertiaTensorInverseW(), rb[i]->getRotation(), rb[i]->getAngularVelocity(), rb[i]->getTorque()); + rb[i]->rotationUpdated(); + } + + ////////////////////////////////////////////////////////////////////////// + // particle model + ////////////////////////////////////////////////////////////////////////// + #pragma omp for schedule(static) + for (int i = 0; i < (int) pd.size(); i++) + { + pd.getLastPosition(i) = pd.getOldPosition(i); + pd.getOldPosition(i) = pd.getPosition(i); + TimeIntegration::semiImplicitEuler(h, pd.getMass(i), pd.getPosition(i), pd.getVelocity(i), pd.getAcceleration(i)); + } + + ////////////////////////////////////////////////////////////////////////// + // orientation model + ////////////////////////////////////////////////////////////////////////// + #pragma omp for schedule(static) + for (int i = 0; i < (int)od.size(); i++) + { + od.getLastQuaternion(i) = od.getOldQuaternion(i); + od.getOldQuaternion(i) = od.getQuaternion(i); + TimeIntegration::semiImplicitEulerRotation(h, od.getMass(i), od.getMass(i) * Matrix3r::Identity(), od.getInvMass(i) * Matrix3r::Identity(),od.getQuaternion(i), od.getVelocity(i), Vector3r(0,0,0)); + } + } + + START_TIMING("position constraints projection"); + positionConstraintProjection(model); + STOP_TIMING_AVG; + + #pragma omp parallel if(numBodies > MIN_PARALLEL_SIZE) default(shared) + { + // Update velocities + #pragma omp for schedule(static) nowait + for (int i = 0; i < numBodies; i++) + { + if (m_velocityUpdateMethod == 0) + { + TimeIntegration::velocityUpdateFirstOrder(h, rb[i]->getMass(), rb[i]->getPosition(), rb[i]->getOldPosition(), rb[i]->getVelocity()); + TimeIntegration::angularVelocityUpdateFirstOrder(h, rb[i]->getMass(), rb[i]->getRotation(), rb[i]->getOldRotation(), rb[i]->getAngularVelocity()); + } + else + { + TimeIntegration::velocityUpdateSecondOrder(h, rb[i]->getMass(), rb[i]->getPosition(), rb[i]->getOldPosition(), rb[i]->getLastPosition(), rb[i]->getVelocity()); + TimeIntegration::angularVelocityUpdateSecondOrder(h, rb[i]->getMass(), rb[i]->getRotation(), rb[i]->getOldRotation(), rb[i]->getLastRotation(), rb[i]->getAngularVelocity()); + } + } + + // Update velocities + #pragma omp for schedule(static) + for (int i = 0; i < (int) pd.size(); i++) + { + if (m_velocityUpdateMethod == 0) + TimeIntegration::velocityUpdateFirstOrder(h, pd.getMass(i), pd.getPosition(i), pd.getOldPosition(i), pd.getVelocity(i)); + else + TimeIntegration::velocityUpdateSecondOrder(h, pd.getMass(i), pd.getPosition(i), pd.getOldPosition(i), pd.getLastPosition(i), pd.getVelocity(i)); + } + + // Update velocites of orientations + #pragma omp for schedule(static) + for (int i = 0; i < (int)od.size(); i++) + { + if (m_velocityUpdateMethod == 0) + TimeIntegration::angularVelocityUpdateFirstOrder(h, od.getMass(i), od.getQuaternion(i), od.getOldQuaternion(i), od.getVelocity(i)); + else + TimeIntegration::angularVelocityUpdateSecondOrder(h, od.getMass(i), od.getQuaternion(i), od.getOldQuaternion(i), od.getLastQuaternion(i), od.getVelocity(i)); + } + } + } + h = hOld; + tm->setTimeStepSize(hOld); + + #pragma omp parallel default(shared) + { + #pragma omp for schedule(static) nowait + for (int i = 0; i < numBodies; i++) + { + if (rb[i]->getMass() != 0.0) + rb[i]->getGeometry().updateMeshTransformation(rb[i]->getPosition(), rb[i]->getRotationMatrix()); + } + } + + + if (m_collisionDetection) + { + START_TIMING("collision detection"); + m_collisionDetection->collisionDetection(model); + STOP_TIMING_AVG; + } + + velocityConstraintProjection(model); + + ////////////////////////////////////////////////////////////////////////// + // update motor joint targets + ////////////////////////////////////////////////////////////////////////// + SimulationModel::ConstraintVector &constraints = model.getConstraints(); + for (unsigned int i = 0; i < constraints.size(); i++) + { + if ((constraints[i]->getTypeId() == TargetAngleMotorHingeJoint::TYPE_ID) || + (constraints[i]->getTypeId() == TargetVelocityMotorHingeJoint::TYPE_ID) || + (constraints[i]->getTypeId() == TargetPositionMotorSliderJoint::TYPE_ID) || + (constraints[i]->getTypeId() == TargetVelocityMotorSliderJoint::TYPE_ID)) + { + MotorJoint *motor = (MotorJoint*)constraints[i]; + const std::vector sequence = motor->getTargetSequence(); + if (sequence.size() > 0) + { + Real time = tm->getTime(); + const Real sequenceDuration = sequence[sequence.size() - 2] - sequence[0]; + if (motor->getRepeatSequence()) + { + while (time > sequenceDuration) + time -= sequenceDuration; + } + unsigned int index = 0; + while ((2*index < sequence.size()) && (sequence[2 * index] <= time)) + index++; + + // linear interpolation + Real target = 0.0; + if (2 * index < sequence.size()) + { + const Real alpha = (time - sequence[2 * (index - 1)]) / (sequence[2 * index] - sequence[2 * (index - 1)]); + target = (static_cast(1.0) - alpha) * sequence[2 * index - 1] + alpha * sequence[2 * index + 1]; + } + else + target = sequence[sequence.size() - 1]; + motor->setTarget(target); + } + } + } + + // compute new time + tm->setTime (tm->getTime () + h); + STOP_TIMING_AVG; +} + +void TimeStepController::reset() +{ + m_iterations = 0; + m_iterationsV = 0; + //m_maxIterations = 5; + //m_maxIterationsV = 5; +} + +void TimeStepController::positionConstraintProjection(SimulationModel &model) +{ + m_iterations = 0; + + // init constraint groups if necessary + model.initConstraintGroups(); + + SimulationModel::RigidBodyVector &rb = model.getRigidBodies(); + SimulationModel::ConstraintVector &constraints = model.getConstraints(); + SimulationModel::ConstraintGroupVector &groups = model.getConstraintGroups(); + SimulationModel::RigidBodyContactConstraintVector &contacts = model.getRigidBodyContactConstraints(); + SimulationModel::ParticleSolidContactConstraintVector &particleTetContacts = model.getParticleSolidContactConstraints(); + + // init constraints for this time step if necessary + for (auto & constraint : constraints) + { + constraint->initConstraintBeforeProjection(model); + } + + while (m_iterations < m_maxIterations) + { + for (unsigned int group = 0; group < groups.size(); group++) + { + const int groupSize = (int)groups[group].size(); + #pragma omp parallel if(groupSize > MIN_PARALLEL_SIZE) default(shared) + { + #pragma omp for schedule(static) + for (int i = 0; i < groupSize; i++) + { + const unsigned int constraintIndex = groups[group][i]; + + constraints[constraintIndex]->updateConstraint(model); + constraints[constraintIndex]->solvePositionConstraint(model, m_iterations); + } + } + } + + for (unsigned int i = 0; i < particleTetContacts.size(); i++) + { + particleTetContacts[i].solvePositionConstraint(model, m_iterations); + } + + m_iterations++; + } +} + + +void TimeStepController::velocityConstraintProjection(SimulationModel &model) +{ + m_iterationsV = 0; + + // init constraint groups if necessary + model.initConstraintGroups(); + + SimulationModel::RigidBodyVector &rb = model.getRigidBodies(); + SimulationModel::ConstraintVector &constraints = model.getConstraints(); + SimulationModel::ConstraintGroupVector &groups = model.getConstraintGroups(); + SimulationModel::RigidBodyContactConstraintVector &rigidBodyContacts = model.getRigidBodyContactConstraints(); + SimulationModel::ParticleRigidBodyContactConstraintVector &particleRigidBodyContacts = model.getParticleRigidBodyContactConstraints(); + SimulationModel::ParticleSolidContactConstraintVector &particleTetContacts = model.getParticleSolidContactConstraints(); + + for (unsigned int group = 0; group < groups.size(); group++) + { + const int groupSize = (int)groups[group].size(); + #pragma omp parallel if(groupSize > MIN_PARALLEL_SIZE) default(shared) + { + #pragma omp for schedule(static) + for (int i = 0; i < groupSize; i++) + { + const unsigned int constraintIndex = groups[group][i]; + constraints[constraintIndex]->updateConstraint(model); + } + } + } + + while (m_iterationsV < m_maxIterationsV) + { + for (unsigned int group = 0; group < groups.size(); group++) + { + const int groupSize = (int)groups[group].size(); + #pragma omp parallel if(groupSize > MIN_PARALLEL_SIZE) default(shared) + { + #pragma omp for schedule(static) + for (int i = 0; i < groupSize; i++) + { + const unsigned int constraintIndex = groups[group][i]; + constraints[constraintIndex]->solveVelocityConstraint(model, m_iterationsV); + } + } + } + + // solve contacts + for (unsigned int i = 0; i < rigidBodyContacts.size(); i++) + { + rigidBodyContacts[i].solveVelocityConstraint(model, m_iterationsV); + } + for (unsigned int i = 0; i < particleRigidBodyContacts.size(); i++) + { + particleRigidBodyContacts[i].solveVelocityConstraint(model, m_iterationsV); + } + for (unsigned int i = 0; i < particleTetContacts.size(); i++) + { + particleTetContacts[i].solveVelocityConstraint(model, m_iterationsV); + } + m_iterationsV++; + } +} + + diff --git a/Simulation/TimeStepController.h b/Simulation/TimeStepController.h new file mode 100644 index 00000000..dfb8b41a --- /dev/null +++ b/Simulation/TimeStepController.h @@ -0,0 +1,47 @@ +#ifndef __TIMESTEPCONTROLLER_h__ +#define __TIMESTEPCONTROLLER_h__ + +#include "Common/Common.h" +#include "TimeStep.h" +#include "SimulationModel.h" +#include "CollisionDetection.h" + +namespace PBD +{ + class TimeStepController : public TimeStep + { + public: +// static int SOLVER_ITERATIONS; +// static int SOLVER_ITERATIONS_V; + static int NUM_SUB_STEPS; + static int MAX_ITERATIONS; + static int MAX_ITERATIONS_V; + static int VELOCITY_UPDATE_METHOD; + + static int ENUM_VUPDATE_FIRST_ORDER; + static int ENUM_VUPDATE_SECOND_ORDER; + + protected: + int m_velocityUpdateMethod; + unsigned int m_iterations; + unsigned int m_iterationsV; + unsigned int m_subSteps; + unsigned int m_maxIterations; + unsigned int m_maxIterationsV; + + virtual void initParameters(); + + void positionConstraintProjection(SimulationModel &model); + void velocityConstraintProjection(SimulationModel &model); + + + public: + TimeStepController(); + virtual ~TimeStepController(void); + + virtual void step(SimulationModel &model); + virtual void reset(); + }; +} + +#endif diff --git a/Demos/Simulation/TriangleModel.cpp b/Simulation/TriangleModel.cpp similarity index 88% rename from Demos/Simulation/TriangleModel.cpp rename to Simulation/TriangleModel.cpp index 98340a4d..09d35ad8 100644 --- a/Demos/Simulation/TriangleModel.cpp +++ b/Simulation/TriangleModel.cpp @@ -7,8 +7,8 @@ using namespace PBD; TriangleModel::TriangleModel() : m_particleMesh() { - m_restitutionCoeff = 0.6; - m_frictionCoeff = 0.2; + m_restitutionCoeff = static_cast(0.6); + m_frictionCoeff = static_cast(0.2); } TriangleModel::~TriangleModel(void) @@ -27,11 +27,6 @@ void TriangleModel::updateMeshNormals(const ParticleData &pd) m_particleMesh.updateVertexNormals(pd); } -TriangleModel::ParticleMesh &TriangleModel::getParticleMesh() -{ - return m_particleMesh; -} - void TriangleModel::initMesh(const unsigned int nPoints, const unsigned int nFaces, const unsigned int indexOffset, unsigned int* indices, const ParticleMesh::UVIndices& uvIndices, const ParticleMesh::UVs& uvs) { m_indexOffset = indexOffset; diff --git a/Demos/Simulation/TriangleModel.h b/Simulation/TriangleModel.h similarity index 80% rename from Demos/Simulation/TriangleModel.h rename to Simulation/TriangleModel.h index 2e0c2cef..8acbe411 100644 --- a/Demos/Simulation/TriangleModel.h +++ b/Simulation/TriangleModel.h @@ -1,13 +1,11 @@ #ifndef __TRIANGLEMODEL_H__ #define __TRIANGLEMODEL_H__ -#include "Demos/Common/Config.h" #include "Common/Common.h" #include -#include "Demos/Simulation/RigidBody.h" -#include "Demos/Utils/IndexedFaceMesh.h" -#include "Demos/Simulation/ParticleData.h" -#include +#include "Simulation/RigidBody.h" +#include "Utils/IndexedFaceMesh.h" +#include "Simulation/ParticleData.h" #include "Constraints.h" namespace PBD @@ -18,7 +16,7 @@ namespace PBD TriangleModel(); virtual ~TriangleModel(); - typedef IndexedFaceMesh ParticleMesh; + typedef Utilities::IndexedFaceMesh ParticleMesh; protected: /** offset which must be added to get the correct index in the particles array */ @@ -29,9 +27,9 @@ namespace PBD Real m_frictionCoeff; public: - void updateConstraints(); + ParticleMesh &getParticleMesh() { return m_particleMesh; } + const ParticleMesh& getParticleMesh() const { return m_particleMesh; } - ParticleMesh &getParticleMesh(); void cleanupModel(); unsigned int getIndexOffset() const; diff --git a/Demos/Simulation/kdTree.h b/Simulation/kdTree.h similarity index 94% rename from Demos/Simulation/kdTree.h rename to Simulation/kdTree.h index d30b9727..70497ce3 100644 --- a/Demos/Simulation/kdTree.h +++ b/Simulation/kdTree.h @@ -49,8 +49,8 @@ namespace PBD struct QueueItem { unsigned int n, d; }; using TraversalQueue = std::queue; - KDTree(std::size_t n) - : m_lst(n) {} + KDTree(std::size_t n, unsigned int maxPrimitivesPerLeaf = 1) + : m_lst(n), m_maxPrimitivesPerLeaf(maxPrimitivesPerLeaf) {} virtual ~KDTree() {} @@ -89,6 +89,7 @@ namespace PBD std::vector m_nodes; std::vector m_hulls; + unsigned int m_maxPrimitivesPerLeaf; }; #include "kdTree.inl" diff --git a/Simulation/kdTree.inl b/Simulation/kdTree.inl new file mode 100644 index 00000000..74c1a63b --- /dev/null +++ b/Simulation/kdTree.inl @@ -0,0 +1,213 @@ + +#include "BoundingSphere.h" +#include +#include "omp.h" + +template void +KDTree::construct() +{ + m_nodes.clear(); + m_hulls.clear(); + if (m_lst.empty()) return; + + std::iota(m_lst.begin(), m_lst.end(), 0); + + // Determine bounding box of considered domain. + auto box = AlignedBox3r{}; + for (auto i = 0u; i < m_lst.size(); ++i) + box.extend(entity_position(i)); + + auto ni = add_node(0, static_cast(m_lst.size())); + construct(ni, box, 0, static_cast(m_lst.size())); +} + +template void +KDTree::construct(unsigned int node, AlignedBox3r const& box, unsigned int b, + unsigned int n) +{ + // If only one element is left end recursion. + //if (n == 1) return; + if (n <= m_maxPrimitivesPerLeaf) return; + + // Determine longest side of bounding box. + auto max_dir = 0; + auto d = box.diagonal().eval(); + if (d(1) >= d(0) && d(1) >= d(2)) + max_dir = 1; + else if (d(2) >= d(0) && d(2) >= d(1)) + max_dir = 2; + +#ifdef _DEBUG + for (auto i = 0u; i < n; ++i) + { + if (!box.contains(entity_position(m_lst[b + i]))) + std::cerr << "ERROR: Bounding box wrong!" << std::endl; + } +#endif + + // Sort range according to center of the longest side. + std::sort(m_lst.begin() + b, m_lst.begin() + b + n, + [&](unsigned int a, unsigned int b) + { + return entity_position(a)(max_dir) < entity_position(b)(max_dir); + } + ); + + auto hal = n / 2; + auto n0 = add_node(b , hal ); + auto n1 = add_node(b + hal, n - hal); + m_nodes[node].children[0] = n0; + m_nodes[node].children[1] = n1; + + auto c = static_cast(0.5) * ( + entity_position(m_lst[b + hal -1])(max_dir) + + entity_position(m_lst[b + hal ])(max_dir)); + auto l_box = box; l_box.max()(max_dir) = c; + auto r_box = box; r_box.min()(max_dir) = c; + + construct(m_nodes[node].children[0], l_box, b, hal); + construct(m_nodes[node].children[1], r_box, b + hal, n - hal); +} + +template void +KDTree::traverse_depth_first(TraversalPredicate pred, TraversalCallback cb, + TraversalPriorityLess const& pless) const +{ + if (m_nodes.empty()) + return; + + if (pred(0, 0)) + traverse_depth_first(0, 0, pred, cb, pless); +} + +template void +KDTree::traverse_depth_first(unsigned int node_index, + unsigned int depth, TraversalPredicate pred, TraversalCallback cb, + TraversalPriorityLess const& pless) const +{ + Node const& node = m_nodes[node_index]; + + cb(node_index, depth); + auto is_pred = pred(node_index, depth); + if (!node.is_leaf() && is_pred) + { + if (pless && !pless(node.children)) + { + traverse_depth_first(m_nodes[node_index].children[1], depth + 1, pred, cb, pless); + traverse_depth_first(m_nodes[node_index].children[0], depth + 1, pred, cb, pless); + } + else + { + traverse_depth_first(m_nodes[node_index].children[0], depth + 1, pred, cb, pless); + traverse_depth_first(m_nodes[node_index].children[1], depth + 1, pred, cb, pless); + } + } +} + + +template void +KDTree::traverse_breadth_first(TraversalPredicate const& pred, + TraversalCallback const& cb, unsigned int start_node, TraversalPriorityLess const& pless, + TraversalQueue& pending) const +{ + cb(start_node, 0); + if (pred(start_node, 0)) pending.push({ start_node, 0 }); + traverse_breadth_first(pending, pred, cb, pless); +} + + +template void +KDTree::traverse_breadth_first_parallel(TraversalPredicate pred, + TraversalCallback cb) const +{ + auto start_nodes = std::vector{}; +#ifdef _DEBUG + const unsigned int maxThreads = 1; +#else + const unsigned int maxThreads = omp_get_max_threads(); +#endif + + // compute ceiling of Log2 + // assuming double and long long have the same size. + double d = maxThreads - 1; + long long ll; memcpy( &ll, &d, sizeof(d)); + const unsigned int targetDepth = (ll >> 52) - 1022ll; + + traverse_breadth_first( + [&start_nodes, &maxThreads, &targetDepth](unsigned int node_index, unsigned int depth) + { + return (depth < targetDepth) && (start_nodes.size() < maxThreads); + }, + [&](unsigned int node_index, unsigned int depth) + { + if ((depth == targetDepth) || (node(node_index).is_leaf())) + start_nodes.push_back({ node_index, depth }); + } + ); + + #pragma omp parallel default(shared) + { + #pragma omp for schedule(static) + for (int i = 0; i < start_nodes.size(); i++) + { + QueueItem const& qi = start_nodes[i]; + cb(qi.n, qi.d); + traverse_depth_first(qi.n, qi.d, pred, cb, nullptr); + } + } +} + +template unsigned int +KDTree::add_node(unsigned int b, unsigned int n) +{ + HullType hull; + compute_hull(b, n, hull); + m_hulls.push_back(hull); + m_nodes.push_back({ b, n }); + return static_cast(m_nodes.size() - 1); +} + + + +template +void +KDTree::traverse_breadth_first(TraversalQueue& pending, + TraversalPredicate const& pred, TraversalCallback const& cb, TraversalPriorityLess const& pless) const +{ + while (!pending.empty()) + { + auto n = pending.front().n; + auto d = pending.front().d; + auto const& node = m_nodes[n]; + pending.pop(); + + cb(n, d); + auto is_pred = pred(n, d); + if (!node.is_leaf() && is_pred) + { + if (pless && !pless(node.children)) + { + pending.push({ static_cast(node.children[1]), d + 1 }); + pending.push({ static_cast(node.children[0]), d + 1 }); + } + else + { + pending.push({ static_cast(node.children[0]), d + 1 }); + pending.push({ static_cast(node.children[1]), d + 1 }); + } + } + } +} + +template void +KDTree::update() +{ + traverse_depth_first( + [&](unsigned int, unsigned int) { return true; }, + [&](unsigned int node_index, unsigned int) + { + auto const& nd = node(node_index); + compute_hull_approx(nd.begin, nd.n, m_hulls[node_index]); + } + ); +} diff --git a/Utils/CMakeLists.txt b/Utils/CMakeLists.txt new file mode 100644 index 00000000..0493bd7b --- /dev/null +++ b/Utils/CMakeLists.txt @@ -0,0 +1,58 @@ +include(GetGitRevisionDescription) +get_git_head_revision(GIT_REFSPEC GIT_SHA1) +git_local_changes(GIT_LOCAL_CHANGES) +if (${GIT_LOCAL_CHANGES} STREQUAL "DIRTY") + set(COMPILER_MESSAGE "#pragma WARNING(Local changes not committed.)") +endif() + +file (STRINGS "../version.txt" PBD_VERSION) + +configure_file(${CMAKE_CURRENT_SOURCE_DIR}/Version.h.in ${CMAKE_CURRENT_SOURCE_DIR}/Version.h @ONLY) + +add_library(Utils + FileSystem.h + Hashmap.h + IndexedFaceMesh.cpp + IndexedFaceMesh.h + IndexedTetMesh.cpp + IndexedTetMesh.h + Logger.h + OBJLoader.h + PLYLoader.h + SceneLoader.cpp + SceneLoader.h + StringTools.h + SystemInfo.h + TetGenLoader.cpp + TetGenLoader.h + Timing.h + Version.h + VolumeIntegration.cpp + VolumeIntegration.h + + CMakeLists.txt +) + +############################################################ +# GenericParameters +############################################################ +include_directories(${GenericParameters_INCLUDE_DIR}) +if(TARGET Ext_GenericParameters) + add_dependencies(Utils Ext_GenericParameters) +endif() + +find_package( Eigen3 REQUIRED ) +include_directories( ${EIGEN3_INCLUDE_DIR} ) + +install(TARGETS Utils + RUNTIME DESTINATION bin + LIBRARY DESTINATION lib + ARCHIVE DESTINATION lib) + +install(DIRECTORY . +DESTINATION include/Utils +FILES_MATCHING PATTERN "*.h") + + + + diff --git a/Utils/FileSystem.h b/Utils/FileSystem.h new file mode 100644 index 00000000..fc935249 --- /dev/null +++ b/Utils/FileSystem.h @@ -0,0 +1,406 @@ +#ifndef __FileSystem_h__ +#define __FileSystem_h__ + +#include "StringTools.h" +#include "extern/md5/md5.h" +#include +#ifdef WIN32 +#include +#define NOMINMAX +#include "windows.h" +#include +#else +#include +#include +#endif +#ifdef __APPLE__ +#include +#endif + +#ifndef S_ISDIR +#define S_ISDIR(mode) (((mode) & S_IFMT) == S_IFDIR) +#endif + +#ifndef S_ISREG +#define S_ISREG(mode) (((mode) & S_IFMT) == S_IFREG) +#endif + +namespace Utilities +{ + /** \brief This class implements different file system functions. + */ + class FileSystem + { + public: + + static std::string getFilePath(const std::string &path) + { + std::string npath = normalizePath(path); + + std::string result = npath; + size_t i = result.rfind('.', result.length()); + if (i != std::string::npos) + { + result = result.substr(0, i); + } + size_t p1 = result.rfind('\\', result.length()); + size_t p2 = result.rfind('/', result.length()); + if ((p1 != std::string::npos) && (p2 != std::string::npos)) + result = result.substr(0, std::max(p1, p2)); + else if (p1 != std::string::npos) + result = result.substr(0, p1); + else if (p2 != std::string::npos) + result = result.substr(0, p2); + return result; + } + + static std::string getFileName(const std::string &path) + { + std::string npath = normalizePath(path); + + std::string result = npath; + size_t i = result.rfind('.', result.length()); + if (i != std::string::npos) + { + result = result.substr(0, i); + } + size_t p1 = result.rfind('\\', result.length()); + size_t p2 = result.rfind('/', result.length()); + if ((p1 != std::string::npos) && (p2 != std::string::npos)) + result = result.substr(std::max(p1, p2) + 1, result.length()); + else if (p1 != std::string::npos) + result = result.substr(p1 + 1, result.length()); + else if (p2 != std::string::npos) + result = result.substr(p2 + 1, result.length()); + return result; + } + + static std::string getFileNameWithExt(const std::string &path) + { + std::string npath = normalizePath(path); + + std::string result = npath; + size_t p1 = result.rfind('\\', result.length()); + size_t p2 = result.rfind('/', result.length()); + if ((p1 != std::string::npos) && (p2 != std::string::npos)) + result = result.substr(std::max(p1, p2) + 1, result.length()); + else if (p1 != std::string::npos) + result = result.substr(p1 + 1, result.length()); + else if (p2 != std::string::npos) + result = result.substr(p2 + 1, result.length()); + return result; + } + + static std::string getFileExt(const std::string &path) + { + std::string npath = normalizePath(path); + + std::string result = npath; + size_t i = result.rfind('.', result.length()); + if (i != std::string::npos) + { + result = result.substr(i + 1, result.length()); + } + return result; + } + + static bool isRelativePath(const std::string &path) + { + std::string npath = normalizePath(path); + + // Windows + size_t i = npath.find(":"); + if (i != std::string::npos) + return false; + else if (npath[0] == '/') + return false; + return true; + } + + static int makeDir(const std::string &path) + { + std::string npath = normalizePath(path); + + struct stat st; + int status = 0; + + if (stat(path.c_str(), &st) != 0) + { +#if WIN32 + status = _mkdir(path.c_str()); +#else + status = mkdir(path.c_str(), S_IRWXU | S_IRWXG | S_IROTH | S_IXOTH); +#endif + if (status != 0 && errno != EEXIST) + status = -1; + } + else if (!(S_IFDIR & st.st_mode)) + { + errno = ENOTDIR; + status = -1; + } + + return status; + } + + /** Make all subdirectories. + */ + static int makeDirs(const std::string &path) + { + char *pp; + char *sp; + int status; +#ifdef WIN32 + char *copyOfPath = _strdup(path.c_str()); +#else + char *copyOfPath = strdup(path.c_str()); +#endif + + status = 0; + pp = copyOfPath; + pp = pp + 3; // Cut away Drive: + while ((status == 0) && (((sp = strchr(pp, '/')) != 0) || ((sp = strchr(pp, '\\')) != 0))) + { + if (sp != pp) + { + *sp = '\0'; + status = makeDir(copyOfPath); + *sp = '/'; + } + pp = sp + 1; + } + if (status == 0) + status = makeDir(path); + free(copyOfPath); + return status; + } + + + static std::string normalizePath(const std::string &path) + { + if (path.size() == 0) + return path; + std::string result = path; + std::replace(result.begin(), result.end(), '\\', '/'); + std::vector tokens; + StringTools::tokenize(result, tokens, "/"); + unsigned int index = 0; + while (index < tokens.size()) + { + if ((tokens[index] == "..") && (index > 0)) + { + tokens.erase(tokens.begin() + index - 1, tokens.begin() + index + 1); + index-=2; + } + index++; + } + result = ""; + if (path[0] == '/') + result = "/"; + result = result + tokens[0]; + for (unsigned int i = 1; i < tokens.size(); i++) + result = result + "/" + tokens[i]; + + return result; + } + + static bool fileExists(const std::string& fileName) + { + if (FILE *file = fopen(fileName.c_str(), "r")) + { + fclose(file); + return true; + } + else + return false; + } + + static std::string getProgramPath() + { + char buffer[1000]; +#ifdef WIN32 + GetModuleFileName(NULL, buffer, 1000); +#elif defined(__APPLE__) + uint32_t bufferSize = sizeof(buffer); + _NSGetExecutablePath(buffer, &bufferSize); +#else + char szTmp[32]; + sprintf(szTmp, "/proc/%d/exe", getpid()); + int bytes = std::min((int)readlink(szTmp, buffer, 1000), 999); + buffer[bytes] = '\0'; +#endif + std::string::size_type pos = std::string(buffer).find_last_of("\\/"); + return std::string(buffer).substr(0, pos); + + } + + static bool copyFile(const std::string &source, const std::string &dest) + { + const size_t bufferSize = 8192; + char buffer[bufferSize]; + size_t size; + + FILE* sourceFile = fopen(source.c_str(), "rb"); + FILE* destFile = fopen(dest.c_str(), "wb"); + + if ((sourceFile == NULL) || (destFile == NULL)) + return false; + + while (size = fread(buffer, 1, bufferSize, sourceFile)) + { + fwrite(buffer, 1, size, destFile); + } + + fclose(sourceFile); + fclose(destFile); + + return true; + } + + static bool isFile(const std::string &path) + { + struct stat st; + if (!stat(path.c_str(), &st)) + return S_ISREG(st.st_mode); + return false; + } + + static bool isDirectory(const std::string &path) + { + struct stat st; + if (!stat(path.c_str(), &st)) + return S_ISDIR(st.st_mode); + return false; + } + + static bool getFilesInDirectory(const std::string& path, std::vector &res) + { +#ifdef WIN32 + std::string p = path + "\\*"; + WIN32_FIND_DATA data; + HANDLE hFind = FindFirstFile(p.c_str(), &data); + if (hFind != INVALID_HANDLE_VALUE) + { + do + { + res.push_back(data.cFileName); + } + while (FindNextFile(hFind, &data) != 0); + FindClose(hFind); + return true; + } + return false; +#else + DIR* dir = opendir(path.c_str()); + if (dir != NULL) + { + struct dirent *dp; + while ((dp = readdir(dir)) != NULL) + res.push_back(dp->d_name); + closedir(dir); + return true; + } + return false; +#endif + } + + + /** Compute the MD5 hash of a file. + */ + static std::string getFileMD5(const std::string &filename) + { + std::ifstream file(filename); + + if (!file) + std::cerr << "Cannot open file: " << filename << std::endl; + else + { + MD5 context(file); + char *md5hex = context.hex_digest(); + std::string res(md5hex); + delete[] md5hex; + return res; + } + return ""; + } + + /** Write the MD5 hash of a file to the md5File. + */ + static bool writeMD5File(const std::string& fileName, const std::string& md5File) + { + std::ofstream fstream; + fstream.open(md5File.c_str(), std::ios::out); + if (fstream.fail()) + { + std::cerr << "Failed to open file: " << md5File << "\n"; + return false; + } + std::string md5 = getFileMD5(fileName); + if (md5 != "") + fstream.write(md5.c_str(), md5.size()); + fstream.close(); + return true; + } + + /** Compare an MD5 hash with the hash stored in an MD5 file. + */ + static bool checkMD5(const std::string& md5Hash, const std::string& md5File) + { + std::ifstream fstream; + fstream.open(md5File.c_str(), std::ios::in); + if (fstream.fail()) + { + std::cerr << "Failed to open file: " << md5File << "\n"; + return false; + } + std::string str((std::istreambuf_iterator(fstream)), + std::istreambuf_iterator()); + fstream.close(); + + return str == md5Hash; + } + +#ifdef WIN32 + /** Open windows file dialog.\n + * dialogType 0 = Open file dialog\n + * dialogType 1 = Save file dialog\n + */ + static const std::string fileDialog(int dialogType, + const std::string &initialDir, + const std::string &filter) + { + std::string initDir = normalizePath(initialDir); + std::replace(initDir.begin(), initDir.end(), '/', '\\'); + + OPENFILENAME ofn; // common dialog box structure + char fileNameBuffer[512]; + fileNameBuffer[0] = '\0'; + + const std::string filterWithEscape = filter + '\0'; + + ZeroMemory(&ofn, sizeof(ofn)); + ofn.lStructSize = sizeof(ofn); + ofn.lpstrFile = fileNameBuffer; + ofn.nMaxFile = sizeof(fileNameBuffer); + ofn.lpstrFilter = filterWithEscape.c_str(); + ofn.nFilterIndex = 1; + ofn.lpstrInitialDir = (LPSTR)initDir.c_str(); + ofn.Flags = OFN_PATHMUSTEXIST | OFN_FILEMUSTEXIST | OFN_NOCHANGEDIR; + + if (dialogType == 0) + { + if (GetOpenFileName(&ofn)) + return std::string(fileNameBuffer); + } + else + { + if (GetSaveFileName(&ofn)) + return std::string(fileNameBuffer); + } + return ""; + } +#endif + }; +} + +#endif diff --git a/Demos/Utils/Hashmap.h b/Utils/Hashmap.h similarity index 98% rename from Demos/Utils/Hashmap.h rename to Utils/Hashmap.h index e80de398..929fda30 100644 --- a/Demos/Utils/Hashmap.h +++ b/Utils/Hashmap.h @@ -1,11 +1,11 @@ #ifndef __HASHMAP_H__ #define __HASHMAP_H__ -#include "Demos/Common/Config.h" +#include "Common/Common.h" #include #include -namespace PBD +namespace Utilities { template inline unsigned int hashFunction(const KeyType &key) diff --git a/Demos/Utils/IndexedFaceMesh.cpp b/Utils/IndexedFaceMesh.cpp similarity index 71% rename from Demos/Utils/IndexedFaceMesh.cpp rename to Utils/IndexedFaceMesh.cpp index 12426d1c..ffefd4d6 100644 --- a/Demos/Utils/IndexedFaceMesh.cpp +++ b/Utils/IndexedFaceMesh.cpp @@ -1,29 +1,23 @@ #include "IndexedFaceMesh.h" -using namespace PBD; +using namespace Utilities; IndexedFaceMesh& IndexedFaceMesh::operator=(IndexedFaceMesh const& other) { m_numPoints = other.m_numPoints; m_indices = other.m_indices; m_edges = other.m_edges; - m_faces = other.m_faces; + m_facesEdges = other.m_facesEdges; m_closed = other.m_closed; m_uvIndices = other.m_uvIndices; m_uvs = other.m_uvs; - m_verticesPerFace = other.m_verticesPerFace; m_normals = other.m_normals; m_vertexNormals = other.m_vertexNormals; - for (size_t i(0u); i < m_faces.size(); ++i) + for (size_t i(0u); i < m_facesEdges.size(); ++i) { - m_faces[i].m_edges = new unsigned int[m_verticesPerFace]; -#if defined(WIN32) || defined(_WIN32) || defined(WIN64) - std::copy(other.m_faces[i].m_edges, other.m_faces[i].m_edges + m_verticesPerFace, - stdext::unchecked_array_iterator(m_faces[i].m_edges)); -#else - std::copy(other.m_faces[i].m_edges, other.m_faces[i].m_edges + m_verticesPerFace, m_faces[i].m_edges); -#endif + m_facesEdges[i].resize(m_verticesPerFace); + std::copy(other.m_facesEdges[i].data(), other.m_facesEdges[i].data() + m_verticesPerFace, m_facesEdges[i].data()); } m_verticesEdges.resize(other.m_verticesEdges.size()); @@ -42,10 +36,11 @@ IndexedFaceMesh::IndexedFaceMesh(IndexedFaceMesh const& other) *this = other; } -IndexedFaceMesh::IndexedFaceMesh(const unsigned int verticesPerFace) +IndexedFaceMesh::IndexedFaceMesh() { - m_verticesPerFace = verticesPerFace; m_closed=false; + m_flatShading = false; + m_numPoints = 0; } IndexedFaceMesh::~IndexedFaceMesh() @@ -63,7 +58,7 @@ void IndexedFaceMesh::initMesh(const unsigned int nPoints, const unsigned int nE m_numPoints = nPoints; m_indices.reserve(nFaces*m_verticesPerFace); m_edges.reserve(nEdges); - m_faces.reserve(nFaces); + m_facesEdges.reserve(nFaces); m_uvIndices.reserve(nFaces); m_uvs.reserve(nPoints); m_verticesFaces.reserve(nPoints); @@ -76,9 +71,8 @@ void IndexedFaceMesh::release() { m_indices.clear(); m_edges.clear(); - for(unsigned int i=0; i < m_faces.size(); i++) - delete [] m_faces[i].m_edges; - m_faces.clear(); + m_facesEdges.clear(); + m_facesEdges.clear(); m_uvIndices.clear(); m_uvs.clear(); m_verticesFaces.clear(); @@ -119,22 +113,24 @@ void IndexedFaceMesh::addUVIndex(const unsigned int index) void IndexedFaceMesh::buildNeighbors() { typedef std::vector PEdges; - typedef std::vector VertexFE; PEdges* pEdges = new PEdges[numVertices()]; - VertexFE* vFaces = new VertexFE[numVertices()]; - VertexFE* vEdges = new VertexFE[numVertices()]; - for(unsigned int i=0; i < m_faces.size(); i++) - delete [] m_faces[i].m_edges; + // build vertex-face structure + m_verticesFaces.clear(); // to delete old pointers + m_verticesFaces.resize(numVertices()); + m_verticesEdges.clear(); // to delete old pointers + m_verticesEdges.resize(numVertices()); + m_facesEdges.clear(); + m_facesEdges.resize(numFaces()); + m_edges.clear(); - m_faces.resize(numFaces()); unsigned int *v = new unsigned int[m_verticesPerFace]; unsigned int *edges = new unsigned int[m_verticesPerFace*2]; for(unsigned int i=0; i < numFaces(); i++) { - m_faces[i].m_edges = new unsigned int[m_verticesPerFace]; + m_facesEdges[i].resize(m_verticesPerFace); for (unsigned int j=0u; j < m_verticesPerFace; j++) v[j] = m_indices[m_verticesPerFace*i+j]; @@ -151,9 +147,9 @@ void IndexedFaceMesh::buildNeighbors() // add vertex-face connection const unsigned int vIndex = m_indices[m_verticesPerFace*i+j]; bool found = false; - for(unsigned int k=0; k < vFaces[vIndex].size(); k++) + for(unsigned int k=0; k < m_verticesFaces[vIndex].size(); k++) { - if (vFaces[vIndex][k] == i) + if (m_verticesFaces[vIndex][k] == i) { found = true; break; @@ -161,7 +157,7 @@ void IndexedFaceMesh::buildNeighbors() } if (!found) { - vFaces[vIndex].push_back(i); + m_verticesFaces[vIndex].push_back(i); } // add edge information @@ -191,8 +187,8 @@ void IndexedFaceMesh::buildNeighbors() edge = (unsigned int) m_edges.size() - 1u; // add vertex-edge connection - vEdges[a].push_back(edge); - vEdges[b].push_back(edge); + m_verticesEdges[a].push_back(edge); + m_verticesEdges[b].push_back(edge); } else { @@ -203,28 +199,12 @@ void IndexedFaceMesh::buildNeighbors() pEdges[a].push_back(edge); pEdges[b].push_back(edge); // append face - m_faces[i].m_edges[j] = edge; + m_facesEdges[i][j] = edge; } } delete [] v; delete [] edges; - // build vertex-face structure - m_verticesFaces.clear(); // to delete old pointers - m_verticesFaces.resize(numVertices()); - m_verticesEdges.clear(); // to delete old pointers - m_verticesEdges.resize(numVertices()); - for(unsigned int i=0; i < numVertices(); i++) - { - m_verticesFaces[i].m_numFaces = (unsigned int) vFaces[i].size(); - m_verticesFaces[i].m_fIndices = new unsigned int[m_verticesFaces[i].m_numFaces]; - memcpy(m_verticesFaces[i].m_fIndices, vFaces[i].data(), sizeof(unsigned int)*m_verticesFaces[i].m_numFaces); - - m_verticesEdges[i].m_numEdges = (unsigned int) vEdges[i].size(); - m_verticesEdges[i].m_eIndices = new unsigned int[m_verticesEdges[i].m_numEdges]; - memcpy(m_verticesEdges[i].m_eIndices, vEdges[i].data(), sizeof(unsigned int)*m_verticesEdges[i].m_numEdges); - } - // check for boundary m_closed = true; for (unsigned int i = 0; i < (unsigned int)m_edges.size(); i++) @@ -238,8 +218,6 @@ void IndexedFaceMesh::buildNeighbors() } delete [] pEdges; - delete [] vFaces; - delete [] vEdges; } void IndexedFaceMesh::copyUVs(const UVIndices& uvIndices, const UVs& uvs) diff --git a/Demos/Utils/IndexedFaceMesh.h b/Utils/IndexedFaceMesh.h similarity index 65% rename from Demos/Utils/IndexedFaceMesh.h rename to Utils/IndexedFaceMesh.h index 3826b802..3d35c3e3 100644 --- a/Demos/Utils/IndexedFaceMesh.h +++ b/Utils/IndexedFaceMesh.h @@ -2,105 +2,29 @@ #define __INDEXEDFACEMESH_H__ #include +#include #include "Common/Common.h" #include -namespace PBD +namespace Utilities { class IndexedFaceMesh { public: struct Edge { - unsigned int m_face[2]; - unsigned int m_vert[2]; - }; - - struct Face - { - unsigned int *m_edges; - }; - - // Stores the indices of each face connected to a specific vertex - struct VertexFaces - { - VertexFaces() - { - m_fIndices = 0; - m_numFaces = 0; - } - - VertexFaces(VertexFaces const& other) - { - *this = other; - } - - VertexFaces& operator=(VertexFaces const& other) - { - m_numFaces = other.m_numFaces; - m_fIndices = new unsigned int[m_numFaces]; -#if defined(WIN32) || defined(_WIN32) || defined(WIN64) - std::copy(other.m_fIndices, other.m_fIndices + m_numFaces, - stdext::unchecked_array_iterator(m_fIndices)); -#else - std::copy(other.m_fIndices, other.m_fIndices + m_numFaces, m_fIndices); -#endif - return *this; - } - - ~VertexFaces() - { - delete[] m_fIndices; - } - - unsigned int m_numFaces; - unsigned int* m_fIndices; - }; - - // Stores the indices of each edge connected to a specific vertex - struct VertexEdges - { - VertexEdges() - { - m_eIndices = 0; - m_numEdges = 0; - } - - VertexEdges(VertexEdges const& other) - { - *this = other; - } - - VertexEdges& operator=(VertexEdges const& other) - { - m_numEdges = other.m_numEdges; - m_eIndices = new unsigned int[m_numEdges]; -#if defined(WIN32) || defined(_WIN32) || defined(WIN64) - std::copy(other.m_eIndices, other.m_eIndices + m_numEdges, - stdext::unchecked_array_iterator(m_eIndices)); -#else - std::copy(other.m_eIndices, other.m_eIndices + m_numEdges, m_eIndices); -#endif - return *this; - } - - ~VertexEdges() - { - delete[] m_eIndices; - } - - unsigned int m_numEdges; - unsigned int* m_eIndices; + std::array m_face; + std::array m_vert; }; public: typedef std::vector Faces; typedef std::vector FaceNormals; typedef std::vector VertexNormals; - typedef std::vector FaceData; + typedef std::vector> FacesEdges; typedef std::vector Edges; - typedef std::vector VerticesFaces; - typedef std::vector VerticesEdges; + typedef std::vector> VerticesEdges; + typedef std::vector> VerticesFaces; typedef std::vector UVIndices; typedef std::vector UVs; @@ -108,30 +32,32 @@ namespace PBD unsigned int m_numPoints; Faces m_indices; Edges m_edges; - FaceData m_faces; + FacesEdges m_facesEdges; bool m_closed; UVIndices m_uvIndices; UVs m_uvs; VerticesFaces m_verticesFaces; VerticesEdges m_verticesEdges; - unsigned int m_verticesPerFace; + const unsigned int m_verticesPerFace = 3u; FaceNormals m_normals; VertexNormals m_vertexNormals; + bool m_flatShading; public: - IndexedFaceMesh(const unsigned int verticesPerFace = 3); + IndexedFaceMesh(); IndexedFaceMesh(IndexedFaceMesh const& other); IndexedFaceMesh& operator=(IndexedFaceMesh const& other); ~IndexedFaceMesh(); void release(); bool isClosed() const; + bool getFlatShading() const { return m_flatShading; } + void setFlatShading(const bool v) { m_flatShading = v; } void initMesh(const unsigned int nPoints, const unsigned int nEdges, const unsigned int nFaces); void addFace(const unsigned int * const indices); void addFace(const int * const indices); void addUV(const Real u, const Real v); void addUVIndex(const unsigned int index); - void addVertex(const Vector3r &vertex); const Faces& getFaces() const { return m_indices; } Faces& getFaces(){ return m_indices; } @@ -141,7 +67,7 @@ namespace PBD VertexNormals& getVertexNormals(){ return m_vertexNormals; } Edges& getEdges() { return m_edges; } const Edges& getEdges() const { return m_edges; } - const FaceData& getFaceData() const { return m_faces; } + const FacesEdges& getFacesEdges() const { return m_facesEdges; } const UVIndices& getUVIndices() const { return m_uvIndices; } const UVs& getUVs() const { return m_uvs; } const VerticesFaces& getVertexFaces() const { return m_verticesFaces; } @@ -188,6 +114,9 @@ namespace PBD m_normals[i] = v1.cross(v2); m_normals[i].normalize(); + // fix normals of degenerate triangles that can become zero vectors + if (m_normals[i].squaredNorm() < 1e-6f) + m_normals[i] = Vector3r::UnitX(); } } } diff --git a/Demos/Utils/IndexedTetMesh.cpp b/Utils/IndexedTetMesh.cpp similarity index 74% rename from Demos/Utils/IndexedTetMesh.cpp rename to Utils/IndexedTetMesh.cpp index 44ec9d25..e80ed9dd 100644 --- a/Demos/Utils/IndexedTetMesh.cpp +++ b/Utils/IndexedTetMesh.cpp @@ -1,6 +1,6 @@ #include "IndexedTetMesh.h" -using namespace PBD; +using namespace Utilities; IndexedTetMesh::IndexedTetMesh() { @@ -55,12 +55,15 @@ void IndexedTetMesh::addTet(const int * const indices) void IndexedTetMesh::buildNeighbors() { typedef std::vector VertexEdges; - typedef std::vector VertexFaces; - typedef std::vector VertexTets; - VertexEdges* vEdges = new VertexEdges[numVertices()]; - VertexFaces* vFaces = new VertexFaces[numVertices()]; - VertexTets* vTets = new VertexTets[numVertices()]; + m_verticesEdges.clear(); // to delete old pointers + m_verticesEdges.resize(numVertices()); + + m_verticesFaces.clear(); // to delete old pointers + m_verticesFaces.resize(numVertices()); + + m_verticesTets.clear(); // to delete old pointers + m_verticesTets.resize(numVertices()); m_faces.clear(); m_edges.clear(); @@ -92,7 +95,7 @@ void IndexedTetMesh::buildNeighbors() { // add vertex-tet connection const unsigned int vIndex = m_tetIndices[4*i+j]; - vTets[vIndex].push_back(i); + m_verticesTets[vIndex].push_back(i); } for(unsigned int j=0u; j < 4; j++) @@ -103,15 +106,15 @@ void IndexedTetMesh::buildNeighbors() const unsigned int c = faces[j*3+2]; unsigned int face = 0xffffffff; // find face - for(unsigned int k=0; k < vFaces[a].size(); k++) + for(unsigned int k=0; k < m_verticesFaces[a].size(); k++) { // Check if we already have this face in the list - const unsigned int& faceIndex = vFaces[a][k]; + const unsigned int& faceIndex = m_verticesFaces[a][k]; if(((m_faceIndices[3*faceIndex] == a) || (m_faceIndices[3*faceIndex] == b) || (m_faceIndices[3*faceIndex] == c)) && ((m_faceIndices[3*faceIndex+1] == a) || (m_faceIndices[3*faceIndex+1] == b) || (m_faceIndices[3*faceIndex+1] == c)) && ((m_faceIndices[3*faceIndex+2] == a) || (m_faceIndices[3*faceIndex+2] == b) || (m_faceIndices[3*faceIndex+2] == c))) { - face = vFaces[a][k]; + face = m_verticesFaces[a][k]; break; } } @@ -128,9 +131,9 @@ void IndexedTetMesh::buildNeighbors() m_faces.push_back(f); // add vertex-face connection - vFaces[a].push_back(face); - vFaces[b].push_back(face); - vFaces[c].push_back(face); + m_verticesFaces[a].push_back(face); + m_verticesFaces[b].push_back(face); + m_verticesFaces[c].push_back(face); } else { @@ -148,14 +151,14 @@ void IndexedTetMesh::buildNeighbors() const unsigned int b = edges[j*2+1]; unsigned int edge = 0xffffffff; // find edge - for(unsigned int k=0; k < vEdges[a].size(); k++) + for(unsigned int k=0; k < m_verticesEdges[a].size(); k++) { // Check if we already have this edge in the list - const Edge& e = m_edges[vEdges[a][k]]; + const Edge& e = m_edges[m_verticesEdges[a][k]]; if(((e.m_vert[0] == a) || (e.m_vert[0] == b)) && ((e.m_vert[1] == a) || (e.m_vert[1] == b))) { - edge = vEdges[a][k]; + edge = m_verticesEdges[a][k]; break; } } @@ -169,37 +172,11 @@ void IndexedTetMesh::buildNeighbors() edge = (unsigned int) m_edges.size() - 1u; // add vertex-edge connection - vEdges[a].push_back(edge); - vEdges[b].push_back(edge); + m_verticesEdges[a].push_back(edge); + m_verticesEdges[b].push_back(edge); } // append edge m_tets[i].m_edges[j] = edge; } } - - m_verticesEdges.clear(); // to delete old pointers - m_verticesEdges.resize(numVertices()); - m_verticesFaces.clear(); // to delete old pointers - m_verticesFaces.resize(numVertices()); - m_verticesTets.clear(); // to delete old pointers - m_verticesTets.resize(numVertices()); - for(unsigned int i=0; i < numVertices(); i++) - { - m_verticesEdges[i].m_numEdges = (unsigned int) vEdges[i].size(); - m_verticesEdges[i].m_eIndices = new unsigned int[m_verticesEdges[i].m_numEdges]; - memcpy(m_verticesEdges[i].m_eIndices, vEdges[i].data(), sizeof(unsigned int)*m_verticesEdges[i].m_numEdges); - - m_verticesFaces[i].m_numFaces = (unsigned int) vFaces[i].size(); - m_verticesFaces[i].m_fIndices = new unsigned int[m_verticesFaces[i].m_numFaces]; - memcpy(m_verticesFaces[i].m_fIndices, vFaces[i].data(), sizeof(unsigned int)*m_verticesFaces[i].m_numFaces); - - m_verticesTets[i].m_numTets = (unsigned int) vTets[i].size(); - m_verticesTets[i].m_tIndices = new unsigned int[m_verticesTets[i].m_numTets]; - memcpy(m_verticesTets[i].m_tIndices, vTets[i].data(), sizeof(unsigned int)*m_verticesTets[i].m_numTets); - } - - delete [] vEdges; - delete [] vFaces; - delete [] vTets; - } diff --git a/Demos/Utils/IndexedTetMesh.h b/Utils/IndexedTetMesh.h similarity index 62% rename from Demos/Utils/IndexedTetMesh.h rename to Utils/IndexedTetMesh.h index 3a948b59..d6706949 100644 --- a/Demos/Utils/IndexedTetMesh.h +++ b/Utils/IndexedTetMesh.h @@ -2,84 +2,31 @@ #define __INDEXEDTETMESH_H__ #include +#include #include "Common/Common.h" -namespace PBD +namespace Utilities { class IndexedTetMesh { public: struct Edge { - unsigned int m_vert[2]; + std::array m_vert; }; struct Face { // edge indices - unsigned int m_edges[3]; + std::array m_edges; // tet indices - unsigned int m_tets[2]; + std::array m_tets; }; struct Tet { - unsigned int m_edges[6]; - unsigned int m_faces[4]; - }; - - // Stores the indices of each tet connected to a specific vertex - struct VertexTets - { - VertexTets() - { - m_tIndices = 0; - m_numTets = 0; - } - - ~VertexTets() - { - delete [] m_tIndices; - } - - unsigned int m_numTets; - unsigned int* m_tIndices; - }; - - // Stores the indices of each face connected to a specific vertex - struct VertexFaces - { - VertexFaces() - { - m_fIndices = 0; - m_numFaces = 0; - } - - ~VertexFaces() - { - delete [] m_fIndices; - } - - unsigned int m_numFaces; - unsigned int* m_fIndices; - }; - - // Stores the indices of each edge connected to a specific vertex - struct VertexEdges - { - VertexEdges() - { - m_eIndices = 0; - m_numEdges = 0; - } - - ~VertexEdges() - { - delete [] m_eIndices; - } - - unsigned int m_numEdges; - unsigned int* m_eIndices; + std::array m_edges; + std::array m_faces; }; public: @@ -88,9 +35,9 @@ namespace PBD typedef std::vector TetData; typedef std::vector FaceData; typedef std::vector Edges; - typedef std::vector VerticesTets; - typedef std::vector VerticesFaces; - typedef std::vector VerticesEdges; + typedef std::vector> VerticesTets; + typedef std::vector> VerticesFaces; + typedef std::vector> VerticesEdges; protected: unsigned int m_numPoints; diff --git a/Utils/Logger.h b/Utils/Logger.h new file mode 100644 index 00000000..c7396a29 --- /dev/null +++ b/Utils/Logger.h @@ -0,0 +1,213 @@ +#ifndef __Logger_h__ +#define __Logger_h__ + +#include +#include +#include +#include +#include +#include +#include + + +namespace Utilities +{ + enum LogLevel { DEBUG=0, INFO, WARN, ERR }; + + class LogSink + { + protected: + LogLevel m_minLevel; + public: + LogSink(const LogLevel minLevel) : m_minLevel(minLevel) {} + virtual ~LogSink() {} + virtual void write(const LogLevel level, const std::string &str) = 0; + void setMinLevel(LogLevel level) { m_minLevel = level; } + }; + + class ConsoleSink : public LogSink + { + public: + ConsoleSink(const LogLevel minLevel) : LogSink(minLevel) {} + + virtual void write(const LogLevel level, const std::string &str) + { + if (level < m_minLevel) + return; + +// if (level == LogLevel::INFO) +// std::cout << "Info: "; +// else + if (level == LogLevel::WARN) + std::cout << "Warning: "; + else if (level == LogLevel::ERR) + std::cerr << "Error: "; + + std::cout << str << std::endl; + } + }; + + class FileSink : public LogSink + { + protected: + std::ofstream m_file; + + public: + FileSink(const LogLevel minLevel, const std::string &fileName) + : LogSink(minLevel) + { + m_file.open(fileName.c_str(), std::ios::out); + if (m_file.fail()) + std::cerr << "Failed to open file: " << fileName << "\n"; + } + + virtual ~FileSink() + { + m_file.close(); + } + + virtual void write(const LogLevel level, const std::string &str) + { + if (level < m_minLevel) + return; + + // print time + time_t t = time(0); // get time now + struct tm * now = localtime(&t); + m_file << "[" << (now->tm_year + 1900) << '-' + << std::setfill('0') << std::setw(2) + << (now->tm_mon + 1) << '-' + << std::setfill('0') << std::setw(2) + << now->tm_mday << " " + << std::setfill('0') << std::setw(2) + << now->tm_hour << ":" + << std::setfill('0') << std::setw(2) + << now->tm_min << ":" + << std::setfill('0') + << std::setw(2) << now->tm_sec << "] "; + + // print level + if (level == LogLevel::DEBUG) + m_file << "Debug: "; + else if (level == LogLevel::INFO) + m_file << "Info: "; + else if (level == LogLevel::WARN) + m_file << "Warning: "; + else if (level == LogLevel::ERR) + m_file << "Error: "; + + m_file << str << std::endl; + m_file.flush(); + } + }; + + class BufferSink : public Utilities::LogSink + { + protected: + std::vector> m_buffer; + + public: + BufferSink(const LogLevel minLevel) : LogSink(minLevel) + { + m_buffer.reserve(10000); + } + + virtual void write(const Utilities::LogLevel level, const std::string& str) + { + if (level < m_minLevel) + return; + + m_buffer.push_back({ level, str }); + } + + std::vector>& getBuffer() + { + return m_buffer; + } + + void clearBuffer() + { + m_buffer.clear(); + } + }; + + class Logger + { + public: + Logger() { m_active = true; } + ~Logger() + { + m_sinks.clear(); + } + + protected: + std::vector> m_sinks; + bool m_active; + + public: + // Todo: format + + void addSink(std::shared_ptr sink) + { + m_sinks.push_back(sink); + } + + void removeSink(std::shared_ptr sink) + { + for (auto it = m_sinks.begin(); it != m_sinks.end(); it++) + { + if (*it == sink) + { + m_sinks.erase(it); + break; + } + } + } + + std::vector>& getSinks() + { + return m_sinks; + } + + void write(const LogLevel level, const std::string &str) + { + if (!m_active) + return; + for (unsigned int i = 0; i < m_sinks.size(); i++) + m_sinks[i]->write(level, str); + } + + void activate(const bool b) { m_active = b; } + }; + + class LogStream + { + public: + LogStream(Logger *logger, const LogLevel level) : m_logger(logger), m_level(level) {} + + template + LogStream& operator<<(T const & value) + { + m_buffer << value; + return *this; + } + + ~LogStream() { m_logger->write(m_level, m_buffer.str()); } + + protected: + LogLevel m_level; + Logger *m_logger; + std::ostringstream m_buffer; + }; + + extern Utilities::Logger logger; + + #define LOG_DEBUG Utilities::LogStream(&Utilities::logger, Utilities::LogLevel::DEBUG) + #define LOG_INFO Utilities::LogStream(&Utilities::logger, Utilities::LogLevel::INFO) + #define LOG_WARN Utilities::LogStream(&Utilities::logger, Utilities::LogLevel::WARN) + #define LOG_ERR Utilities::LogStream(&Utilities::logger, Utilities::LogLevel::ERR) + #define INIT_LOGGING Utilities::Logger Utilities::logger; +} + + +#endif diff --git a/Utils/OBJLoader.h b/Utils/OBJLoader.h new file mode 100644 index 00000000..903b3268 --- /dev/null +++ b/Utils/OBJLoader.h @@ -0,0 +1,160 @@ +#ifndef __OBJLoader_h__ +#define __OBJLoader_h__ + +#include +#include "Logger.h" +#include "StringTools.h" +#include + +namespace Utilities +{ + /** \brief Struct to store the position and normal indices + */ + struct MeshFaceIndices + { + std::array posIndices; + std::array texIndices; + std::array normalIndices; + }; + + /** \brief Read for OBJ files. + */ + class OBJLoader + { + public: + using Vec3f = std::array; + using Vec2f = std::array; + + /** This function loads an OBJ file. + * Only triangulated meshes are supported. + */ + + static void loadObj(const std::string &filename, std::vector *x, std::vector *faces, std::vector *normals, std::vector *texcoords, const Vec3f &scale) + { + LOG_INFO << "Loading " << filename; + + std::ifstream filestream; + filestream.open(filename.c_str()); + if (filestream.fail()) + { + LOG_ERR << "Failed to open file: " << filename; + return; + } + + std::string line_stream; + bool vt = false; + bool vn = false; + + std::vector pos_buffer; + std::vector f_buffer; + + while (getline(filestream, line_stream)) + { + std::stringstream str_stream(line_stream); + std::string type_str; + str_stream >> type_str; + + if (type_str == "v") + { + Vec3f pos; + pos_buffer.clear(); + std::string parse_str = line_stream.substr(line_stream.find("v") + 1); + StringTools::tokenize(parse_str, pos_buffer); + for (unsigned int i = 0; i < 3; i++) + pos[i] = stof(pos_buffer[i]) * scale[i]; + + x->push_back(pos); + } + else if (type_str == "vt") + { + if (texcoords != nullptr) + { + Vec2f tex; + pos_buffer.clear(); + std::string parse_str = line_stream.substr(line_stream.find("vt") + 2); + StringTools::tokenize(parse_str, pos_buffer); + for (unsigned int i = 0; i < 2; i++) + tex[i] = stof(pos_buffer[i]); + + texcoords->push_back(tex); + vt = true; + } + } + else if (type_str == "vn") + { + if (normals != nullptr) + { + Vec3f nor; + pos_buffer.clear(); + std::string parse_str = line_stream.substr(line_stream.find("vn") + 2); + StringTools::tokenize(parse_str, pos_buffer); + for (unsigned int i = 0; i < 3; i++) + nor[i] = stof(pos_buffer[i]); + + normals->push_back(nor); + vn = true; + } + } + else if (type_str == "f") + { + MeshFaceIndices faceIndex; + if (vn && vt) + { + f_buffer.clear(); + std::string parse_str = line_stream.substr(line_stream.find("f") + 1); + StringTools::tokenize(parse_str, f_buffer); + for (int i = 0; i < 3; ++i) + { + pos_buffer.clear(); + StringTools::tokenize(f_buffer[i], pos_buffer, "/"); + faceIndex.posIndices[i] = stoi(pos_buffer[0]) - 1; + faceIndex.texIndices[i] = stoi(pos_buffer[1]) - 1; + faceIndex.normalIndices[i] = stoi(pos_buffer[2]) - 1; + } + } + else if (vn) + { + f_buffer.clear(); + std::string parse_str = line_stream.substr(line_stream.find("f") + 1); + StringTools::tokenize(parse_str, f_buffer); + for (int i = 0; i < 3; ++i) + { + pos_buffer.clear(); + StringTools::tokenize(f_buffer[i], pos_buffer, "/"); + faceIndex.posIndices[i] = stoi(pos_buffer[0]) - 1; + faceIndex.normalIndices[i] = stoi(pos_buffer[1]) - 1; + } + } + else if (vt) + { + f_buffer.clear(); + std::string parse_str = line_stream.substr(line_stream.find("f") + 1); + StringTools::tokenize(parse_str, f_buffer); + for (int i = 0; i < 3; ++i) + { + pos_buffer.clear(); + StringTools::tokenize(f_buffer[i], pos_buffer, "/"); + faceIndex.posIndices[i] = stoi(pos_buffer[0]) - 1; + faceIndex.texIndices[i] = stoi(pos_buffer[1]) - 1; + } + } + else + { + f_buffer.clear(); + std::string parse_str = line_stream.substr(line_stream.find("f") + 1); + StringTools::tokenize(parse_str, f_buffer); + for (int i = 0; i < 3; ++i) + { + faceIndex.posIndices[i] = stoi(f_buffer[i]) - 1; + } + } + faces->push_back(faceIndex); + } + } + filestream.close(); + } + + }; +} + +#endif \ No newline at end of file diff --git a/Demos/Utils/ObjectArray.h b/Utils/ObjectArray.h similarity index 98% rename from Demos/Utils/ObjectArray.h rename to Utils/ObjectArray.h index c25a6d88..5a38cfb7 100644 --- a/Demos/Utils/ObjectArray.h +++ b/Utils/ObjectArray.h @@ -1,10 +1,10 @@ #ifndef __OBJECTARRAY_H__ #define __OBJECTARRAY_H__ -#include "Demos/Common/Config.h" #include +#include "Common/Common.h" -namespace PBD +namespace Utilities { template class ObjectArray diff --git a/Utils/PLYLoader.h b/Utils/PLYLoader.h new file mode 100644 index 00000000..e1d32a56 --- /dev/null +++ b/Utils/PLYLoader.h @@ -0,0 +1,46 @@ +#ifndef __PLYLoader_h__ +#define __PLYLoader_h__ + +#include +#include "Logger.h" +#include "extern/happly/happly.h" +#include + +namespace Utilities +{ + /** \brief Read for PLY files. + */ + class PLYLoader + { + public: + /** This function loads an PLY file. + * Only triangulated meshes are supported. + */ + + static void loadPly(const std::string &filename, std::vector> &x, std::vector> &faces, const std::array&scale) + { + LOG_INFO << "Loading " << filename; + + happly::PLYData plyIn(filename.c_str()); + std::vector> vPos = plyIn.getVertexPositions(); + std::vector> fInd = plyIn.getFaceIndices(); + + x.resize(vPos.size()); + for (unsigned int i = 0; i < vPos.size(); i++) + { + x[i] = { + scale[0] * static_cast(vPos[i][0]), + scale[1] * static_cast(vPos[i][1]), + scale[2] * static_cast(vPos[i][2]) + }; + } + + faces.resize(fInd.size()); + for (unsigned int i = 0; i < fInd.size(); i++) + faces[i] = { static_cast(fInd[i][0]), static_cast(fInd[i][1]), static_cast(fInd[i][2]) }; + } + + }; +} + +#endif \ No newline at end of file diff --git a/Utils/SceneLoader.cpp b/Utils/SceneLoader.cpp new file mode 100644 index 00000000..b0766640 --- /dev/null +++ b/Utils/SceneLoader.cpp @@ -0,0 +1,816 @@ +#include "SceneLoader.h" +#include +#include +#include "FileSystem.h" +#include "Logger.h" + +using namespace Utilities; +using namespace GenParam; + + +void SceneLoader::readScene(const std::string &fileName, SceneData &sceneData) +{ + LOG_INFO << "Load scene file: " << fileName; + try + { + std::ifstream input_file(fileName); + if (!input_file.is_open()) + { + LOG_ERR << "Cannot open file!\n"; + return; + } + m_json << input_file; + + std::string basePath = FileSystem::getFilePath(fileName); + + readValue(m_json, "Name", sceneData.m_sceneName); + + sceneData.m_camPosition = Vector3r(5.0, 10.0, 30.0); + readVector(m_json, "cameraPosition", sceneData.m_camPosition); + sceneData.m_camLookat = Vector3r(5.0, 0.0, 0.0); + readVector(m_json, "cameraLookat", sceneData.m_camLookat); + + ////////////////////////////////////////////////////////////////////////// + // read general + ////////////////////////////////////////////////////////////////////////// + sceneData.m_timeStepSize = 0.005; + sceneData.m_gravity = Vector3r(0, -9.81, 0); + if (m_json.find("Simulation") != m_json.end()) + readSimulation(m_json, "Simulation", sceneData); + + ////////////////////////////////////////////////////////////////////////// + // read rigid bodies + ////////////////////////////////////////////////////////////////////////// + if (m_json.find("RigidBodies") != m_json.end()) + readRigidBodies(m_json, "RigidBodies", basePath, sceneData); + + ////////////////////////////////////////////////////////////////////////// + // read triangle models + ////////////////////////////////////////////////////////////////////////// + if (m_json.find("TriangleModels") != m_json.end()) + readTriangleModels(m_json, "TriangleModels", basePath, sceneData); + + ////////////////////////////////////////////////////////////////////////// + // read tet models + ////////////////////////////////////////////////////////////////////////// + if (m_json.find("TetModels") != m_json.end()) + readTetModels(m_json, "TetModels", basePath, sceneData); + + ////////////////////////////////////////////////////////////////////////// + // read ball joints + ////////////////////////////////////////////////////////////////////////// + if (m_json.find("BallJoints") != m_json.end()) + readBallJoints(m_json, "BallJoints", sceneData); + + ////////////////////////////////////////////////////////////////////////// + // read ball-on-line joints + ////////////////////////////////////////////////////////////////////////// + if (m_json.find("BallOnLineJoints") != m_json.end()) + readBallOnLineJoints(m_json, "BallOnLineJoints", sceneData); + + ////////////////////////////////////////////////////////////////////////// + // read hinge joints + ////////////////////////////////////////////////////////////////////////// + if (m_json.find("HingeJoints") != m_json.end()) + readHingeJoints(m_json, "HingeJoints", sceneData); + + ////////////////////////////////////////////////////////////////////////// + // read universal joints + ////////////////////////////////////////////////////////////////////////// + if (m_json.find("UniversalJoints") != m_json.end()) + readUniversalJoints(m_json, "UniversalJoints", sceneData); + + ////////////////////////////////////////////////////////////////////////// + // read slider joints + ////////////////////////////////////////////////////////////////////////// + if (m_json.find("SliderJoints") != m_json.end()) + readSliderJoints(m_json, "SliderJoints", sceneData); + + ////////////////////////////////////////////////////////////////////////// + // read RigidBodyParticleBallJoints + ////////////////////////////////////////////////////////////////////////// + if (m_json.find("RigidBodyParticleBallJoints") != m_json.end()) + readRigidBodyParticleBallJoints(m_json, "RigidBodyParticleBallJoints", sceneData); + + ////////////////////////////////////////////////////////////////////////// + // read RigidBodySprings + ////////////////////////////////////////////////////////////////////////// + if (m_json.find("RigidBodySprings") != m_json.end()) + readRigidBodySprings(m_json, "RigidBodySprings", sceneData); + + ////////////////////////////////////////////////////////////////////////// + // read DistanceJoints + ////////////////////////////////////////////////////////////////////////// + if (m_json.find("DistanceJoints") != m_json.end()) + readDistanceJoints(m_json, "DistanceJoints", sceneData); + + ////////////////////////////////////////////////////////////////////////// + // read DamperJoints + ////////////////////////////////////////////////////////////////////////// + if (m_json.find("DamperJoints") != m_json.end()) + readDamperJoints(m_json, "DamperJoints", sceneData); + + ////////////////////////////////////////////////////////////////////////// + // read TargetAngleMotorHingeJoint + ////////////////////////////////////////////////////////////////////////// + if (m_json.find("TargetAngleMotorHingeJoints") != m_json.end()) + readTargetAngleMotorHingeJoints(m_json, "TargetAngleMotorHingeJoints", sceneData); + + ////////////////////////////////////////////////////////////////////////// + // read TargetVelocityMotorHingeJoint + ////////////////////////////////////////////////////////////////////////// + if (m_json.find("TargetVelocityMotorHingeJoints") != m_json.end()) + readTargetVelocityMotorHingeJoints(m_json, "TargetVelocityMotorHingeJoints", sceneData); + + ////////////////////////////////////////////////////////////////////////// + // read TargetPositionMotorSliderJoint + ////////////////////////////////////////////////////////////////////////// + if (m_json.find("TargetPositionMotorSliderJoints") != m_json.end()) + readTargetPositionMotorSliderJoints(m_json, "TargetPositionMotorSliderJoints", sceneData); + + ////////////////////////////////////////////////////////////////////////// + // read TargetVelocityMotorSliderJoint + ////////////////////////////////////////////////////////////////////////// + if (m_json.find("TargetVelocityMotorSliderJoints") != m_json.end()) + readTargetVelocityMotorSliderJoints(m_json, "TargetVelocityMotorSliderJoints", sceneData); + } + catch (std::exception& e) + { + LOG_ERR << e.what(); + exit(1); + } +} + +void SceneLoader::readSimulation(const nlohmann::json &j, const std::string &key, SceneData &sceneData) +{ + const nlohmann::json &child = j[key]; + + readValue(child, "timeStepSize", sceneData.m_timeStepSize); + readVector(child, "gravity", sceneData.m_gravity); +} + +void SceneLoader::readRigidBodies(const nlohmann::json &j, const std::string &key, const std::string &basePath, SceneData &sceneData) +{ + const nlohmann::json &child = j[key]; + + sceneData.m_rigidBodyData.reserve(5000); + + for (auto& rigidBody : child) + { + std::string geomFileName; + if (readValue(rigidBody, "geometryFile", geomFileName)) + { + if (FileSystem::isRelativePath(geomFileName)) + { + geomFileName = basePath + "/" + geomFileName; + } + + sceneData.m_rigidBodyData.emplace_back(RigidBodyData()); + RigidBodyData &rbd = sceneData.m_rigidBodyData.back(); + rbd.m_modelFile = geomFileName; + + // id + rbd.m_id = 0; + readValue(rigidBody, "id", rbd.m_id); + + // is dynamic body + rbd.m_isDynamic = true; + readValue(rigidBody, "isDynamic", rbd.m_isDynamic); + + // is dynamic body + rbd.m_flatShading = false; + readValue(rigidBody, "flatShading", rbd.m_flatShading); + + // density + rbd.m_density = 1.0; + readValue(rigidBody, "density", rbd.m_density); + + // translation + rbd.m_x.setZero(); + readVector(rigidBody, "translation", rbd.m_x); + + // rotation axis + Vector3r axis; + axis.setZero(); + Real angle = 0.0; + if (readVector(rigidBody, "rotationAxis", axis) && + readValue(rigidBody, "rotationAngle", angle)) + { + axis.normalize(); + rbd.m_q = Quaternionr(AngleAxisr(angle, axis)); + } + else + rbd.m_q = Quaternionr(1.0, 0.0, 0.0, 0.0); + + // scale + rbd.m_scale = Vector3r(1.0, 1.0, 1.0); + readVector(rigidBody, "scale", rbd.m_scale); + + // velocity + rbd.m_v.setZero(); + readVector(rigidBody, "velocity", rbd.m_v); + + // angular velocity + rbd.m_omega.setZero(); + readVector(rigidBody, "angularVelocity", rbd.m_omega); + + // restitution + rbd.m_restitutionCoeff = 0.6; + readValue(rigidBody, "restitution", rbd.m_restitutionCoeff); + + // friction + rbd.m_frictionCoeff = 0.2; + readValue(rigidBody, "friction", rbd.m_frictionCoeff); + + // collision object type + rbd.m_collisionObjectType = CollisionObjectTypes::No_Collision_Object; + readValue(rigidBody, "collisionObjectType", rbd.m_collisionObjectType); + + rbd.m_collisionObjectFileName = ""; + readValue(rigidBody, "collisionObjectFileName", rbd.m_collisionObjectFileName); + + // test mesh + rbd.m_testMesh = true; + readValue(rigidBody, "testMesh", rbd.m_testMesh); + + // scale + rbd.m_collisionObjectScale = Vector3r(1.0, 1.0, 1.0); + readVector(rigidBody, "collisionObjectScale", rbd.m_collisionObjectScale); + + rbd.m_invertSDF = false; + readValue(rigidBody, "invertSDF", rbd.m_invertSDF); + + rbd.m_thicknessSDF = 0.1; + readValue(rigidBody, "thicknessSDF", rbd.m_thicknessSDF); + + rbd.m_resolutionSDF = Eigen::Matrix(10, 10, 10); + readVector(rigidBody, "resolutionSDF", rbd.m_resolutionSDF); + + rbd.m_json = rigidBody; + } + } +} + +void SceneLoader::readTriangleModels(const nlohmann::json &j, const std::string &key, const std::string &basePath, SceneData &sceneData) +{ + const nlohmann::json &child = j[key]; + + for (auto& triModel : child) + { + std::string geomFileName; + if (readValue(triModel, "geometryFile", geomFileName)) + { + if (FileSystem::isRelativePath(geomFileName)) + { + geomFileName = basePath + "/" + geomFileName; + } + + sceneData.m_triangleModelData.emplace_back(TriangleModelData()); + TriangleModelData &data = sceneData.m_triangleModelData.back(); + data.m_modelFile = geomFileName; + + // id + data.m_id = 0; + readValue(triModel, "id", data.m_id); + + // translation + data.m_x.setZero(); + readVector(triModel, "translation", data.m_x); + + // rotation axis + Vector3r axis; + axis.setZero(); + Real angle = 0.0; + if (readVector(triModel, "rotationAxis", axis) && + readValue(triModel, "rotationAngle", angle)) + { + axis.normalize(); + data.m_q = Quaternionr(AngleAxisr(angle, axis)); + } + else + data.m_q = Quaternionr(1.0, 0.0, 0.0, 0.0); + + // scale + data.m_scale = Vector3r(1.0, 1.0, 1.0); + readVector(triModel, "scale", data.m_scale); + + // static particles + unsigned int index = 0; + if (triModel.find("staticParticles") != triModel.end()) + { + data.m_staticParticles.reserve((unsigned int)triModel["staticParticles"].size()); + for (auto& item : triModel["staticParticles"]) + data.m_staticParticles.push_back(item.get()); + } + + // restitution + data.m_restitutionCoeff = 0.1; + readValue(triModel, "restitution", data.m_restitutionCoeff); + + // friction + data.m_frictionCoeff = 0.2; + readValue(triModel, "friction", data.m_frictionCoeff); + + data.m_json = triModel; + } + } +} + +void SceneLoader::readTetModels(const nlohmann::json &j, const std::string &key, const std::string &basePath, SceneData &sceneData) +{ + const nlohmann::json &child = j[key]; + + for (auto& tetModel : child) + { + std::string nodeFileName, eleFileName; + if (readValue(tetModel, "nodeFile", nodeFileName) && + readValue(tetModel, "eleFile", eleFileName)) + { + if (FileSystem::isRelativePath(nodeFileName)) + { + nodeFileName = basePath + "/" + nodeFileName; + } + + if (FileSystem::isRelativePath(eleFileName)) + { + eleFileName = basePath + "/" + eleFileName; + } + + std::string visFileName = ""; + if (readValue(tetModel, "visFile", visFileName)) + { + if (FileSystem::isRelativePath(visFileName)) + { + visFileName = basePath + "/" + visFileName; + } + } + + sceneData.m_tetModelData.emplace_back(TetModelData()); + TetModelData &data = sceneData.m_tetModelData.back(); + data.m_modelFileNodes = nodeFileName; + data.m_modelFileElements = eleFileName; + data.m_modelFileVis = visFileName; + + // id + data.m_id = 0; + readValue(tetModel, "id", data.m_id); + + // translation + data.m_x.setZero(); + readVector(tetModel, "translation", data.m_x); + + // rotation axis + Vector3r axis; + axis.setZero(); + Real angle = 0.0; + if (readVector(tetModel, "rotationAxis", axis) && + readValue(tetModel, "rotationAngle", angle)) + { + axis.normalize(); + data.m_q = Quaternionr(AngleAxisr(angle, axis)); + } + else + data.m_q = Quaternionr(1.0, 0.0, 0.0, 0.0); + + // scale + data.m_scale = Vector3r(1.0, 1.0, 1.0); + readVector(tetModel, "scale", data.m_scale); + + // static particles + unsigned int index = 0; + if (tetModel.find("staticParticles") != tetModel.end()) + { + data.m_staticParticles.reserve((unsigned int)tetModel["staticParticles"].size()); + for (auto& item : tetModel["staticParticles"]) + data.m_staticParticles.push_back(item.get()); + } + + // restitution + data.m_restitutionCoeff = 0.1; + readValue(tetModel, "restitution", data.m_restitutionCoeff); + + // friction + data.m_frictionCoeff = 0.2; + readValue(tetModel, "friction", data.m_frictionCoeff); + + // collision object type + data.m_collisionObjectType = CollisionObjectTypes::No_Collision_Object; + readValue(tetModel, "collisionObjectType", data.m_collisionObjectType); + + data.m_collisionObjectFileName = ""; + readValue(tetModel, "collisionObjectFileName", data.m_collisionObjectFileName); + + // test mesh + data.m_testMesh = true; + readValue(tetModel, "testMesh", data.m_testMesh); + + // scale + data.m_collisionObjectScale = Vector3r(1.0, 1.0, 1.0); + readVector(tetModel, "collisionObjectScale", data.m_collisionObjectScale); + + data.m_invertSDF = false; + readValue(tetModel, "invertSDF", data.m_invertSDF); + + data.m_thicknessSDF = 0.1; + readValue(tetModel, "thicknessSDF", data.m_thicknessSDF); + + data.m_resolutionSDF = Eigen::Matrix(10, 10, 10); + readVector(tetModel, "resolutionSDF", data.m_resolutionSDF); + + data.m_json = tetModel; + } + } +} + +void SceneLoader::readBallJoints(const nlohmann::json &j, const std::string &key, SceneData &sceneData) +{ + const nlohmann::json &child = j[key]; + + for (auto& joint : child) + { + BallJointData jd; + if (readValue(joint, "bodyID1", jd.m_bodyID[0]) && + readValue(joint, "bodyID2", jd.m_bodyID[1]) && + readVector(joint, "position", jd.m_position)) + { + sceneData.m_ballJointData.push_back(jd); + } + } +} + + +void SceneLoader::readBallOnLineJoints(const nlohmann::json &j, const std::string &key, SceneData &sceneData) +{ + const nlohmann::json &child = j[key]; + + for (auto& joint : child) + { + BallOnLineJointData jd; + if (readValue(joint, "bodyID1", jd.m_bodyID[0]) && + readValue(joint, "bodyID2", jd.m_bodyID[1]) && + readVector(joint, "position", jd.m_position) && + readVector(joint, "axis", jd.m_axis)) + { + sceneData.m_ballOnLineJointData.push_back(jd); + } + } +} + +void SceneLoader::readHingeJoints(const nlohmann::json &j, const std::string &key, SceneData &sceneData) +{ + const nlohmann::json &child = j[key]; + + for (auto& joint : child) + { + HingeJointData jd; + if (readValue(joint, "bodyID1", jd.m_bodyID[0]) && + readValue(joint, "bodyID2", jd.m_bodyID[1]) && + readVector(joint, "position", jd.m_position) && + readVector(joint, "axis", jd.m_axis)) + { + sceneData.m_hingeJointData.push_back(jd); + } + } +} + +void SceneLoader::readUniversalJoints(const nlohmann::json &j, const std::string &key, SceneData &sceneData) +{ + const nlohmann::json &child = j[key]; + + for (auto& joint : child) + { + UniversalJointData jd; + if (readValue(joint, "bodyID1", jd.m_bodyID[0]) && + readValue(joint, "bodyID2", jd.m_bodyID[1]) && + readVector(joint, "position", jd.m_position) && + readVector(joint, "axis1", jd.m_axis[0]) && + readVector(joint, "axis2", jd.m_axis[1])) + { + sceneData.m_universalJointData.push_back(jd); + } + } +} + +void SceneLoader::readSliderJoints(const nlohmann::json &j, const std::string &key, SceneData &sceneData) +{ + const nlohmann::json &child = j[key]; + + for (auto& joint : child) + { + SliderJointData jd; + if (readValue(joint, "bodyID1", jd.m_bodyID[0]) && + readValue(joint, "bodyID2", jd.m_bodyID[1]) && + readVector(joint, "axis", jd.m_axis)) + { + sceneData.m_sliderJointData.push_back(jd); + } + } +} + +void SceneLoader::readRigidBodyParticleBallJoints(const nlohmann::json &j, const std::string &key, SceneData &sceneData) +{ + const nlohmann::json &child = j[key]; + + for (auto& joint : child) + { + RigidBodyParticleBallJointData jd; + if (readValue(joint, "rbID", jd.m_bodyID[0]) && + readValue(joint, "particleID", jd.m_bodyID[1])) + { + sceneData.m_rigidBodyParticleBallJointData.push_back(jd); + } + } +} + +void SceneLoader::readTargetAngleMotorHingeJoints(const nlohmann::json &j, const std::string &key, SceneData &sceneData) +{ + const nlohmann::json &child = j[key]; + + for (auto& joint : child) + { + TargetAngleMotorHingeJointData jd; + if (readValue(joint, "bodyID1", jd.m_bodyID[0]) && + readValue(joint, "bodyID2", jd.m_bodyID[1]) && + readVector(joint, "position", jd.m_position) && + readVector(joint, "axis", jd.m_axis)) + { + if (!readValue(joint, "target", jd.m_target)) + { + jd.m_target = 0.0; + + // target sequence + unsigned int index = 0; + if (joint.find("targetSequence") != joint.end()) + { + jd.m_targetSequence.reserve((unsigned int)joint["targetSequence"].size()); + for (auto& item : joint["targetSequence"]) + jd.m_targetSequence.push_back(item.get()); + + // be sure that we have an even number of values + if (jd.m_targetSequence.size() % 2 == 1) + jd.m_targetSequence.pop_back(); + readValue(joint, "repeatSequence", jd.m_repeat); + } + } + sceneData.m_targetAngleMotorHingeJointData.push_back(jd); + } + } +} + +void SceneLoader::readTargetVelocityMotorHingeJoints(const nlohmann::json &j, const std::string &key, SceneData &sceneData) +{ + const nlohmann::json &child = j[key]; + + for (auto& joint : child) + { + TargetVelocityMotorHingeJointData jd; + if (readValue(joint, "bodyID1", jd.m_bodyID[0]) && + readValue(joint, "bodyID2", jd.m_bodyID[1]) && + readVector(joint, "position", jd.m_position) && + readVector(joint, "axis", jd.m_axis)) + { + if (!readValue(joint, "target", jd.m_target)) + { + jd.m_target = 0.0; + + // target sequence + unsigned int index = 0; + if (joint.find("targetSequence") != joint.end()) + { + jd.m_targetSequence.reserve((unsigned int)joint["targetSequence"].size()); + for (auto& item : joint["targetSequence"]) + jd.m_targetSequence.push_back(item.get()); + + // be sure that we have an even number of values + if (jd.m_targetSequence.size() % 2 == 1) + jd.m_targetSequence.pop_back(); + readValue(joint, "repeatSequence", jd.m_repeat); + } + } + sceneData.m_targetVelocityMotorHingeJointData.push_back(jd); + } + } +} + +void SceneLoader::readTargetPositionMotorSliderJoints(const nlohmann::json &j, const std::string &key, SceneData &sceneData) +{ + const nlohmann::json &child = j[key]; + + for (auto& joint : child) + { + TargetPositionMotorSliderJointData jd; + if (readValue(joint, "bodyID1", jd.m_bodyID[0]) && + readValue(joint, "bodyID2", jd.m_bodyID[1]) && + readVector(joint, "axis", jd.m_axis)) + { + if (!readValue(joint, "target", jd.m_target)) + { + jd.m_target = 0.0; + + // target sequence + unsigned int index = 0; + if (joint.find("targetSequence") != joint.end()) + { + jd.m_targetSequence.reserve((unsigned int)joint["targetSequence"].size()); + for (auto& item : joint["targetSequence"]) + jd.m_targetSequence.push_back(item.get()); + + // be sure that we have an even number of values + if (jd.m_targetSequence.size() % 2 == 1) + jd.m_targetSequence.pop_back(); + readValue(joint, "repeatSequence", jd.m_repeat); + } + } + sceneData.m_targetPositionMotorSliderJointData.push_back(jd); + } + } +} + +void SceneLoader::readTargetVelocityMotorSliderJoints(const nlohmann::json &j, const std::string &key, SceneData &sceneData) +{ + const nlohmann::json &child = j[key]; + + for (auto& joint : child) + { + TargetVelocityMotorSliderJointData jd; + if (readValue(joint, "bodyID1", jd.m_bodyID[0]) && + readValue(joint, "bodyID2", jd.m_bodyID[1]) && + readVector(joint, "axis", jd.m_axis)) + { + if (!readValue(joint, "target", jd.m_target)) + { + jd.m_target = 0.0; + + // target sequence + unsigned int index = 0; + if (joint.find("targetSequence") != joint.end()) + { + jd.m_targetSequence.reserve((unsigned int)joint["targetSequence"].size()); + for (auto& item : joint["targetSequence"]) + jd.m_targetSequence.push_back(item.get()); + + // be sure that we have an even number of values + if (jd.m_targetSequence.size() % 2 == 1) + jd.m_targetSequence.pop_back(); + readValue(joint, "repeatSequence", jd.m_repeat); + } + } + sceneData.m_targetVelocityMotorSliderJointData.push_back(jd); + } + } +} + +void SceneLoader::readRigidBodySprings(const nlohmann::json &j, const std::string &key, SceneData &sceneData) +{ + const nlohmann::json &child = j[key]; + + for (auto& joint : child) + { + RigidBodySpringData jd; + if (readValue(joint, "bodyID1", jd.m_bodyID[0]) && + readValue(joint, "bodyID2", jd.m_bodyID[1]) && + readVector(joint, "position1", jd.m_position1) && + readVector(joint, "position2", jd.m_position2) && + readValue(joint, "stiffness", jd.m_stiffness)) + { + sceneData.m_rigidBodySpringData.push_back(jd); + } + } +} + +void SceneLoader::readDistanceJoints(const nlohmann::json &j, const std::string &key, SceneData &sceneData) +{ + const nlohmann::json &child = j[key]; + + for (auto& joint : child) + { + DistanceJointData jd; + if (readValue(joint, "bodyID1", jd.m_bodyID[0]) && + readValue(joint, "bodyID2", jd.m_bodyID[1]) && + readVector(joint, "position1", jd.m_position1) && + readVector(joint, "position2", jd.m_position2)) + { + sceneData.m_distanceJointData.push_back(jd); + } + } +} + +void SceneLoader::readDamperJoints(const nlohmann::json &j, const std::string &key, SceneData &sceneData) +{ + const nlohmann::json &child = j[key]; + + for (auto& joint : child) + { + DamperJointData jd; + if (readValue(joint, "bodyID1", jd.m_bodyID[0]) && + readValue(joint, "bodyID2", jd.m_bodyID[1]) && + readVector(joint, "axis", jd.m_axis) && + readValue(joint, "stiffness", jd.m_stiffness)) + { + sceneData.m_damperJointData.push_back(jd); + } + } +} + +template <> +bool SceneLoader::readValue(const nlohmann::json &j, const std::string &key, bool &v) +{ + if (j.find(key) == j.end()) + return false; + + if (j[key].is_number_integer()) + { + int val = j[key].get(); + v = val != 0; + } + else + v = j[key].get(); + return true; +} + +void SceneLoader::readParameterObject(ParameterObject *paramObj) +{ + if (paramObj == nullptr) + return; + + const unsigned int numParams = paramObj->numParameters(); + + + ////////////////////////////////////////////////////////////////////////// + // read configuration + ////////////////////////////////////////////////////////////////////////// + if (m_json.find("Simulation") != m_json.end()) + { + nlohmann::json config = m_json["Simulation"]; + std::vector newParamList; + + for (unsigned int i = 0; i < numParams; i++) + { + ParameterBase *paramBase = paramObj->getParameter(i); + + if (paramBase->getType() == RealParameterType) + { + Real val; + if (readValue(config, paramBase->getName(), val)) + static_cast*>(paramBase)->setValue(val); + } + else if (paramBase->getType() == ParameterBase::UINT32) + { + unsigned int val; + if (readValue(config, paramBase->getName(), val)) + static_cast*>(paramBase)->setValue(val); + } + else if (paramBase->getType() == ParameterBase::UINT16) + { + unsigned short val; + if (readValue(config, paramBase->getName(), val)) + static_cast*>(paramBase)->setValue(val); + } + else if (paramBase->getType() == ParameterBase::UINT8) + { + unsigned char val; + if (readValue(config, paramBase->getName(), val)) + static_cast*>(paramBase)->setValue(val); + } + else if (paramBase->getType() == ParameterBase::INT32) + { + int val; + if (readValue(config, paramBase->getName(), val)) + static_cast*>(paramBase)->setValue(val); + } + else if (paramBase->getType() == ParameterBase::INT16) + { + short val; + if (readValue(config, paramBase->getName(), val)) + static_cast*>(paramBase)->setValue(val); + } + else if (paramBase->getType() == ParameterBase::INT8) + { + char val; + if (readValue(config, paramBase->getName(), val)) + static_cast*>(paramBase)->setValue(val); + } + else if (paramBase->getType() == ParameterBase::ENUM) + { + int val; + if (readValue(config, paramBase->getName(), val)) + static_cast(paramBase)->setValue(val); + } + else if (paramBase->getType() == ParameterBase::BOOL) + { + bool val; + if (readValue(config, paramBase->getName(), val)) + static_cast(paramBase)->setValue(val); + } + else if (paramBase->getType() == RealVectorParameterType) + { + if (static_cast*>(paramBase)->getDim() == 3) + { + Vector3r val; + if (readVector(config, paramBase->getName(), val)) + static_cast*>(paramBase)->setValue(val.data()); + } + } + } + } +} diff --git a/Utils/SceneLoader.h b/Utils/SceneLoader.h new file mode 100644 index 00000000..3f3f85b0 --- /dev/null +++ b/Utils/SceneLoader.h @@ -0,0 +1,256 @@ +#ifndef __SCENELOADER_H__ +#define __SCENELOADER_H__ + +#include +#include "extern/json/json.hpp" +#include "Common/Common.h" +#include "ParameterObject.h" + +namespace Utilities +{ + class SceneLoader + { + protected: + nlohmann::json m_json; + + public: + enum CollisionObjectTypes { + No_Collision_Object = 0, Sphere, Box, Cylinder, Torus, SDF, HollowSphere, HollowBox + }; + + struct RigidBodyData + { + unsigned int m_id; + std::string m_modelFile; + bool m_flatShading; + bool m_isDynamic; + Real m_density; + Vector3r m_x; + Quaternionr m_q; + Vector3r m_scale; + Vector3r m_v; + Vector3r m_omega; + Real m_restitutionCoeff; + Real m_frictionCoeff; + int m_collisionObjectType; + std::string m_collisionObjectFileName; + bool m_testMesh; + Vector3r m_collisionObjectScale; + bool m_invertSDF; + Real m_thicknessSDF; + Eigen::Matrix m_resolutionSDF; + + nlohmann::json m_json; + }; + + struct TriangleModelData + { + unsigned int m_id; + std::string m_modelFile; + Vector3r m_x; + Quaternionr m_q; + Vector3r m_scale; + std::vector m_staticParticles; + Real m_restitutionCoeff; + Real m_frictionCoeff; + nlohmann::json m_json; + }; + + struct TetModelData + { + unsigned int m_id; + std::string m_modelFileTet; + std::string m_modelFileNodes; + std::string m_modelFileElements; + std::string m_modelFileVis; + Vector3r m_x; + Quaternionr m_q; + Vector3r m_scale; + std::vector m_staticParticles; + Real m_restitutionCoeff; + Real m_frictionCoeff; + int m_collisionObjectType; + std::string m_collisionObjectFileName; + bool m_testMesh; + Vector3r m_collisionObjectScale; + bool m_invertSDF; + Real m_thicknessSDF; + Eigen::Matrix m_resolutionSDF; + nlohmann::json m_json; + }; + + struct BallJointData + { + unsigned int m_bodyID[2]; + Vector3r m_position; + }; + + struct BallOnLineJointData + { + unsigned int m_bodyID[2]; + Vector3r m_position; + Vector3r m_axis; + }; + + struct HingeJointData + { + unsigned int m_bodyID[2]; + Vector3r m_position; + Vector3r m_axis; + }; + + struct UniversalJointData + { + unsigned int m_bodyID[2]; + Vector3r m_position; + Vector3r m_axis[2]; + }; + + struct SliderJointData + { + unsigned int m_bodyID[2]; + Vector3r m_axis; + }; + + struct RigidBodyParticleBallJointData + { + unsigned int m_bodyID[2]; + }; + + struct RigidBodySpringData + { + unsigned int m_bodyID[2]; + Vector3r m_position1; + Vector3r m_position2; + Real m_stiffness; + }; + + struct DistanceJointData + { + unsigned int m_bodyID[2]; + Vector3r m_position1; + Vector3r m_position2; + }; + + struct TargetAngleMotorHingeJointData + { + unsigned int m_bodyID[2]; + Vector3r m_position; + Vector3r m_axis; + Real m_target; + std::vector m_targetSequence; + bool m_repeat; + }; + + struct TargetVelocityMotorHingeJointData + { + unsigned int m_bodyID[2]; + Vector3r m_position; + Vector3r m_axis; + Real m_target; + std::vector m_targetSequence; + bool m_repeat; + }; + + struct TargetPositionMotorSliderJointData + { + unsigned int m_bodyID[2]; + Vector3r m_axis; + Real m_target; + std::vector m_targetSequence; + bool m_repeat; + }; + + struct TargetVelocityMotorSliderJointData + { + unsigned int m_bodyID[2]; + Vector3r m_axis; + Real m_target; + std::vector m_targetSequence; + bool m_repeat; + }; + + struct DamperJointData + { + unsigned int m_bodyID[2]; + Vector3r m_axis; + Real m_stiffness; + }; + + struct SceneData + { + std::string m_sceneName; + Vector3r m_camPosition; + Vector3r m_camLookat; + + Real m_timeStepSize; + Vector3r m_gravity; + + std::vector m_rigidBodyData; + std::vector m_triangleModelData; + std::vector m_tetModelData; + std::vector m_ballJointData; + std::vector m_ballOnLineJointData; + std::vector m_hingeJointData; + std::vector m_universalJointData; + std::vector m_sliderJointData; + std::vector m_rigidBodyParticleBallJointData; + std::vector m_targetAngleMotorHingeJointData; + std::vector m_targetVelocityMotorHingeJointData; + std::vector m_targetPositionMotorSliderJointData; + std::vector m_targetVelocityMotorSliderJointData; + std::vector m_damperJointData; + std::vector m_rigidBodySpringData; + std::vector m_distanceJointData; + }; + + virtual ~SceneLoader() {} + void readScene(const std::string &fileName, SceneData &sceneData); + void readSimulation(const nlohmann::json &child, const std::string &key, SceneData &sceneData); + void readRigidBodies(const nlohmann::json &child, const std::string &key, const std::string &basePath, SceneData &sceneData); + void readTriangleModels(const nlohmann::json &child, const std::string &key, const std::string &basePath, SceneData &sceneData); + void readTetModels(const nlohmann::json &child, const std::string &key, const std::string &basePath, SceneData &sceneData); + void readBallJoints(const nlohmann::json &child, const std::string &key, SceneData &sceneData); + void readBallOnLineJoints(const nlohmann::json &child, const std::string &key, SceneData &sceneData); + void readHingeJoints(const nlohmann::json &child, const std::string &key, SceneData &sceneData); + void readUniversalJoints(const nlohmann::json &child, const std::string &key, SceneData &sceneData); + void readSliderJoints(const nlohmann::json &child, const std::string &key, SceneData &sceneData); + void readRigidBodyParticleBallJoints(const nlohmann::json &child, const std::string &key, SceneData &sceneData); + void readTargetAngleMotorHingeJoints(const nlohmann::json &child, const std::string &key, SceneData &sceneData); + void readTargetVelocityMotorHingeJoints(const nlohmann::json &child, const std::string &key, SceneData &sceneData); + void readTargetPositionMotorSliderJoints(const nlohmann::json &child, const std::string &key, SceneData &sceneData); + void readTargetVelocityMotorSliderJoints(const nlohmann::json &child, const std::string &key, SceneData &sceneData); + void readRigidBodySprings(const nlohmann::json &j, const std::string &key, SceneData &sceneData); + void readDistanceJoints(const nlohmann::json &j, const std::string &key, SceneData &sceneData); + void readDamperJoints(const nlohmann::json &child, const std::string &key, SceneData &sceneData); + + template + static bool readValue(const nlohmann::json &j, const std::string &key, T &v) + { + if (j.find(key) == j.end()) + return false; + + v = j[key].get(); + return true; + } + + template + static bool readVector(const nlohmann::json &j, const std::string &key, Eigen::Matrix &vec) + { + if (j.find(key) == j.end()) + return false; + + std::vector values = j[key].get>(); + for (unsigned int i = 0; i < values.size(); i++) + vec[i] = values[i]; + return true; + } + + void readParameterObject(GenParam::ParameterObject *paramObj); + }; + + template <> + bool SceneLoader::readValue(const nlohmann::json &j, const std::string &key, bool &v); +} + +#endif diff --git a/Utils/StringTools.h b/Utils/StringTools.h new file mode 100644 index 00000000..1f5ad062 --- /dev/null +++ b/Utils/StringTools.h @@ -0,0 +1,31 @@ +#ifndef __StringTools_h__ +#define __StringTools_h__ + +#include +#include + +namespace Utilities +{ + /** \brief Tools to handle std::string objects + */ + class StringTools + { + public: + + static void tokenize(const std::string& str, std::vector& tokens, const std::string& delimiters = " ") + { + std::string::size_type lastPos = str.find_first_not_of(delimiters, 0); + std::string::size_type pos = str.find_first_of(delimiters, lastPos); + + while (std::string::npos != pos || std::string::npos != lastPos) + { + tokens.push_back(str.substr(lastPos, pos - lastPos)); + lastPos = str.find_first_not_of(delimiters, pos); + pos = str.find_first_of(delimiters, lastPos); + } + } + + }; +} + +#endif diff --git a/Utils/SystemInfo.h b/Utils/SystemInfo.h new file mode 100644 index 00000000..264ca432 --- /dev/null +++ b/Utils/SystemInfo.h @@ -0,0 +1,36 @@ +#ifndef __SystemInfo_h__ +#define __SystemInfo_h__ + +#if WIN32 +#define NOMINMAX +#include "windows.h" +#else +#include +#include +#endif + +namespace Utilities +{ + class SystemInfo + { + public: + static std::string getHostName() + { +#ifdef WIN32 + const unsigned int bufferSize = 32767; + TCHAR infoBuf[bufferSize]; + DWORD bufCharCount = bufferSize; + if (!GetComputerName(infoBuf, &bufCharCount)) + return ""; + return infoBuf; +#else + const unsigned int bufferSize = 32767; + char hostname[bufferSize]; + gethostname(hostname, bufferSize); + return hostname; +#endif + } + }; +} + +#endif diff --git a/Demos/Utils/TetGenLoader.cpp b/Utils/TetGenLoader.cpp similarity index 86% rename from Demos/Utils/TetGenLoader.cpp rename to Utils/TetGenLoader.cpp index 56de30cc..85c21ff7 100644 --- a/Demos/Utils/TetGenLoader.cpp +++ b/Utils/TetGenLoader.cpp @@ -2,14 +2,15 @@ #include #include #include +#include "Logger.h" -using namespace PBD; +using namespace Utilities; using namespace std; // Call this function to load a model from a *.tet file void TetGenLoader::loadTetFile(const std::string &filename, std::vector& vertices, std::vector& tets) { - std::cout << "Loading " << filename << std::endl; + LOG_INFO << "Loading " << filename; // variables size_t i, num_materials, num_vertices, num_tetras, num_triangles; @@ -20,7 +21,7 @@ void TetGenLoader::loadTetFile(const std::string &filename, std::vector& vertices, std::vector& tets) { - std::cout << "Loading " << nodeFilename << std::endl; - std::cout << "Loading " << eleFilename << std::endl; + LOG_INFO << "Loading " << nodeFilename; + LOG_INFO << "Loading " << eleFilename; // variables size_t i, num_vertices, num_tetras; @@ -123,12 +124,12 @@ void TetGenLoader::loadTetgenModel(const std::string &nodeFilename, const std::s ifstream finEle(eleFilename.c_str()); if(!finNode) { - std::cout << "'" + nodeFilename + "' file not found. \n"; + LOG_ERR << "'" + nodeFilename + "' file not found."; return; } if(!finEle) { - std::cout << "'" + eleFilename + "' file not found. \n"; + LOG_ERR << "'" + eleFilename + "' file not found."; return; } @@ -183,13 +184,13 @@ void TetGenLoader::loadTetgenModel(const std::string &nodeFilename, const std::s finNode.close(); finEle.close(); - std::cout << "Number of tets: " << num_tetras << "\n"; - std::cout << "Number of vertices: " << num_vertices << "\n"; + LOG_INFO << "Number of tets: " << num_tetras; + LOG_INFO << "Number of vertices: " << num_vertices; } void TetGenLoader::loadMSHModel(const std::string &mshFilename, std::vector& vertices, std::vector& tets) { - std::cout << "Loading " << mshFilename << std::endl; + LOG_INFO << "Loading " << mshFilename; // variables size_t i, num_vertices, num_tetras; @@ -199,7 +200,7 @@ void TetGenLoader::loadMSHModel(const std::string &mshFilename, std::vector #include -#include "Demos/Common/Config.h" #include "Common/Common.h" -namespace PBD +namespace Utilities { class TetGenLoader { diff --git a/Utils/Timing.h b/Utils/Timing.h new file mode 100644 index 00000000..cbdae325 --- /dev/null +++ b/Utils/Timing.h @@ -0,0 +1,188 @@ +#ifndef __Timing_H__ +#define __Timing_H__ + +#include +#include +#include +#include "Logger.h" +#include + +namespace Utilities +{ + #define START_TIMING(timerName) \ + Utilities::Timing::startTiming(timerName); + + #define STOP_TIMING \ + Utilities::Timing::stopTiming(false); + + #define STOP_TIMING_PRINT \ + Utilities::Timing::stopTiming(true); + + #define STOP_TIMING_AVG \ + { \ + static int timing_timerId = -1; \ + Utilities::Timing::stopTiming(false, timing_timerId); \ + } + + #define STOP_TIMING_AVG_PRINT \ + { \ + static int timing_timerId = -1; \ + Utilities::Timing::stopTiming(true, timing_timerId); \ + } + + #define INIT_TIMING \ + int Utilities::IDFactory::id = 0; \ + std::unordered_map Utilities::Timing::m_averageTimes; \ + std::stack Utilities::Timing::m_timingStack; \ + bool Utilities::Timing::m_dontPrintTimes = false; \ + unsigned int Utilities::Timing::m_startCounter = 0; \ + unsigned int Utilities::Timing::m_stopCounter = 0; + + + /** \brief Struct to store a time measurement. + */ + struct TimingHelper + { + std::chrono::time_point start; + std::string name; + }; + + /** \brief Struct to store the total time and the number of steps in order to compute the average time. + */ + struct AverageTime + { + double totalTime; + unsigned int counter; + std::string name; + }; + + /** \brief Factory for unique ids. + */ + class IDFactory + { + private: + /** Current id */ + static int id; + + public: + static int getId() { return id++; } + }; + + /** \brief Class for time measurements. + */ + class Timing + { + public: + static bool m_dontPrintTimes; + static unsigned int m_startCounter; + static unsigned int m_stopCounter; + static std::stack m_timingStack; + static std::unordered_map m_averageTimes; + + static void reset() + { + while (!m_timingStack.empty()) + m_timingStack.pop(); + m_averageTimes.clear(); + m_startCounter = 0; + m_stopCounter = 0; + } + + FORCE_INLINE static void startTiming(const std::string& name = std::string("")) + { + TimingHelper h; + h.start = std::chrono::high_resolution_clock::now(); + h.name = name; + Timing::m_timingStack.push(h); + Timing::m_startCounter++; + } + + FORCE_INLINE static double stopTiming(bool print = true) + { + if (!Timing::m_timingStack.empty()) + { + Timing::m_stopCounter++; + std::chrono::time_point stop = std::chrono::high_resolution_clock::now(); + TimingHelper h = Timing::m_timingStack.top(); + Timing::m_timingStack.pop(); + std::chrono::duration elapsed_seconds = stop - h.start; + double t = elapsed_seconds.count() * 1000.0; + + if (print) + LOG_INFO << "time " << h.name.c_str() << ": " << t << " ms"; + return t; + } + return 0; + } + + FORCE_INLINE static double stopTiming(bool print, int &id) + { + if (id == -1) + id = IDFactory::getId(); + if (!Timing::m_timingStack.empty()) + { + Timing::m_stopCounter++; + std::chrono::time_point stop = std::chrono::high_resolution_clock::now(); + TimingHelper h = Timing::m_timingStack.top(); + Timing::m_timingStack.pop(); + + std::chrono::duration elapsed_seconds = stop - h.start; + double t = elapsed_seconds.count() * 1000.0; + + if (print && !Timing::m_dontPrintTimes) + LOG_INFO << "time " << h.name.c_str() << ": " << t << " ms"; + + if (id >= 0) + { + std::unordered_map::iterator iter; + iter = Timing::m_averageTimes.find(id); + if (iter != Timing::m_averageTimes.end()) + { + Timing::m_averageTimes[id].totalTime += t; + Timing::m_averageTimes[id].counter++; + } + else + { + AverageTime at; + at.counter = 1; + at.totalTime = t; + at.name = h.name; + Timing::m_averageTimes[id] = at; + } + } + return t; + } + return 0; + } + + FORCE_INLINE static void printAverageTimes() + { + std::unordered_map::iterator iter; + for (iter = Timing::m_averageTimes.begin(); iter != Timing::m_averageTimes.end(); iter++) + { + AverageTime &at = iter->second; + const double avgTime = at.totalTime / at.counter; + LOG_INFO << "Average time " << at.name.c_str() << ": " << avgTime << " ms"; + } + if (Timing::m_startCounter != Timing::m_stopCounter) + LOG_INFO << "Problem: " << Timing::m_startCounter << " calls of startTiming and " << Timing::m_stopCounter << " calls of stopTiming. "; + LOG_INFO << "---------------------------------------------------------------------------\n"; + } + + FORCE_INLINE static void printTimeSums() + { + std::unordered_map::iterator iter; + for (iter = Timing::m_averageTimes.begin(); iter != Timing::m_averageTimes.end(); iter++) + { + AverageTime &at = iter->second; + const double timeSum = at.totalTime; + LOG_INFO << "Time sum " << at.name.c_str() << ": " << timeSum << " ms"; + } + if (Timing::m_startCounter != Timing::m_stopCounter) + LOG_INFO << "Problem: " << Timing::m_startCounter << " calls of startTiming and " << Timing::m_stopCounter << " calls of stopTiming. "; + LOG_INFO << "---------------------------------------------------------------------------\n"; + } + }; +} + +#endif \ No newline at end of file diff --git a/Utils/Version.h.in b/Utils/Version.h.in new file mode 100644 index 00000000..7c3a4db6 --- /dev/null +++ b/Utils/Version.h.in @@ -0,0 +1,18 @@ +#ifndef __Version_h__ +#define __Version_h__ + +#define STRINGIZE_HELPER(x) #x +#define STRINGIZE(x) STRINGIZE_HELPER(x) +#define WARNING(desc) message(__FILE__ "(" STRINGIZE(__LINE__) ") : Warning: " #desc) + +#define GIT_SHA1 "@GIT_SHA1@" +#define GIT_REFSPEC "@GIT_REFSPEC@" +#define GIT_LOCAL_STATUS "@GIT_LOCAL_CHANGES@" + +#define PBD_VERSION "@PBD_VERSION@" + +#ifdef DL_OUTPUT +@COMPILER_MESSAGE@ +#endif + +#endif \ No newline at end of file diff --git a/Demos/Utils/VolumeIntegration.cpp b/Utils/VolumeIntegration.cpp similarity index 81% rename from Demos/Utils/VolumeIntegration.cpp rename to Utils/VolumeIntegration.cpp index a5a25027..97ca8fbb 100644 --- a/Demos/Utils/VolumeIntegration.cpp +++ b/Utils/VolumeIntegration.cpp @@ -4,29 +4,29 @@ using namespace std; using namespace Eigen; -using namespace PBD; +using namespace Utilities; #define SQR(x) ((x)*(x)) #define CUBE(x) ((x)*(x)*(x)) -VolumeIntegration::VolumeIntegration(IndexedFaceMesh const& mesh, VertexData const& vertices) - : m_mesh(mesh), m_vertices(vertices), m_face_normals(mesh.numFaces()), m_weights(mesh.numFaces()) +VolumeIntegration::VolumeIntegration(const unsigned int nVertices, const unsigned int nFaces, Vector3r * const vertices, const unsigned int* indices) + : m_nVertices(nVertices), m_nFaces(nFaces), m_indices(indices), m_face_normals(nFaces), m_weights(nFaces) { // compute center of mass m_x.setZero(); - for (unsigned int i(0); i < m_vertices.size(); ++i) - m_x += m_vertices.getPosition(i); - m_x /= (Real)m_vertices.size(); + for (unsigned int i(0); i < m_nVertices; ++i) + m_x += vertices[i]; + m_x /= (Real)m_nVertices; - for (unsigned int i(0); i < m_vertices.size(); ++i) - m_vertices.getPosition(i) = m_vertices.getPosition(i) - m_x; + m_vertices.resize(nVertices); + for (unsigned int i(0); i < m_nVertices; ++i) + m_vertices[i] = vertices[i] - m_x; - const unsigned int *faces = mesh.getFaces().data(); - for (unsigned int i(0); i < mesh.numFaces(); ++i) + for (unsigned int i(0); i < m_nFaces; ++i) { - const Vector3r &a = m_vertices.getPosition(faces[3 * i]); - const Vector3r &b = m_vertices.getPosition(faces[3 * i + 1]); - const Vector3r &c = m_vertices.getPosition(faces[3 * i + 2]); + const Vector3r &a = m_vertices[m_indices[3 * i]]; + const Vector3r &b = m_vertices[m_indices[3 * i + 1]]; + const Vector3r &c = m_vertices[m_indices[3 * i + 2]]; const Vector3r d1 = b - a; const Vector3r d2 = c - a; @@ -84,13 +84,12 @@ void VolumeIntegration::projection_integrals(unsigned int f) P1 = Pa = Pb = Paa = Pab = Pbb = Paaa = Paab = Pabb = Pbbb = 0.0; - const unsigned int *faces = m_mesh.getFaces().data(); for (int i = 0; i < 3; i++) { - a0 = m_vertices.getPosition(faces[3 * f + i])[A]; - b0 = m_vertices.getPosition(faces[3 * f + i])[B]; - a1 = m_vertices.getPosition(faces[3 * f + ((i + 1) % 3)])[A]; - b1 = m_vertices.getPosition(faces[3 * f + ((i + 1) % 3)])[B]; + a0 = m_vertices[m_indices[3 * f + i]][A]; + b0 = m_vertices[m_indices[3 * f + i]][B]; + a1 = m_vertices[m_indices[3 * f + ((i + 1) % 3)]][A]; + b1 = m_vertices[m_indices[3 * f + ((i + 1) % 3)]][B]; da = a1 - a0; db = b1 - b0; @@ -141,7 +140,8 @@ void VolumeIntegration::face_integrals(unsigned int f) w = m_weights[f]; n = m_face_normals[f]; - k1 = 1 / n[C]; k2 = k1 * k1; k3 = k2 * k1; k4 = k3 * k1; + k1 = (n[C] == 0) ? 0 : 1 / n[C]; + k2 = k1 * k1; k3 = k2 * k1; k4 = k3 * k1; Fa = k1 * Pa; Fb = k1 * Pb; @@ -173,7 +173,7 @@ void VolumeIntegration::volume_integrals() = T2[0] = T2[1] = T2[2] = TP[0] = TP[1] = TP[2] = 0; - for (unsigned int i(0); i < m_mesh.numFaces(); ++i) + for (unsigned int i(0); i < m_nFaces; ++i) { Vector3r const& n = m_face_normals[i]; nx = std::abs(n[0]); diff --git a/Demos/Utils/VolumeIntegration.h b/Utils/VolumeIntegration.h similarity index 82% rename from Demos/Utils/VolumeIntegration.h rename to Utils/VolumeIntegration.h index 5859c977..b907da17 100644 --- a/Demos/Utils/VolumeIntegration.h +++ b/Utils/VolumeIntegration.h @@ -7,10 +7,8 @@ #include #include "Common/Common.h" -#include "Demos/Utils/IndexedFaceMesh.h" -#include "Demos/Simulation/ParticleData.h" -namespace PBD +namespace Utilities { class VolumeIntegration { @@ -32,7 +30,7 @@ namespace PBD public: - VolumeIntegration(IndexedFaceMesh const& mesh, VertexData const&vertices); + VolumeIntegration(const unsigned int nVertices, const unsigned int nFaces, Vector3r * const vertices, const unsigned int* indices); /** Compute inertia tensor for given geometry and given density. */ @@ -59,8 +57,10 @@ namespace PBD std::vector m_face_normals; std::vector m_weights; - IndexedFaceMesh const& m_mesh; - VertexData m_vertices; + unsigned int m_nVertices; + unsigned int m_nFaces; + std::vector m_vertices; + const unsigned int* m_indices; Real m_mass, m_volume; Vector3r m_r; diff --git a/bin/ArmadilloCollisionScene.bat b/bin/ArmadilloCollisionScene.bat new file mode 100644 index 00000000..0c7a7cbf --- /dev/null +++ b/bin/ArmadilloCollisionScene.bat @@ -0,0 +1 @@ +.\SceneLoaderDemo.exe ../data/scenes/ArmadilloCollisionScene.json \ No newline at end of file diff --git a/bin/CarScene.bat b/bin/CarScene.bat new file mode 100644 index 00000000..9da941d5 --- /dev/null +++ b/bin/CarScene.bat @@ -0,0 +1 @@ +.\SceneLoaderDemo.exe ../data/scenes/CarScene.json \ No newline at end of file diff --git a/bin/PileScene.bat b/bin/PileScene.bat new file mode 100644 index 00000000..04323ca5 --- /dev/null +++ b/bin/PileScene.bat @@ -0,0 +1 @@ +.\SceneLoaderDemo.exe ../data/scenes/PileScene.json \ No newline at end of file diff --git a/data/models/cylinder_unit_box.obj b/data/models/cylinder_unit_box.obj new file mode 100644 index 00000000..6cbb1e71 --- /dev/null +++ b/data/models/cylinder_unit_box.obj @@ -0,0 +1,1976 @@ +#### +# +# OBJ File Generated by Meshlab +# +#### +# Object cylinder_unit_box.obj +# +# Vertices: 382 +# Faces: 760 +# +#### +mtllib ./cylinder_unit_box.obj.mtl + +vn 0.000000 -9.973934 0.000000 +v 0.095105 -0.500000 -0.030901 0.752941 0.752941 0.752941 +vn 0.000000 -9.973935 0.000000 +v 0.080902 -0.500000 -0.058778 0.752941 0.752941 0.752941 +vn 0.000000 -9.973934 0.000000 +v 0.058778 -0.500000 -0.080902 0.752941 0.752941 0.752941 +vn 0.000000 -9.973934 0.000000 +v 0.030901 -0.500000 -0.095105 0.752941 0.752941 0.752941 +vn 0.000000 -9.973934 0.000000 +v 0.000000 -0.500000 -0.100000 0.752941 0.752941 0.752941 +vn 0.000000 -9.973934 0.000000 +v -0.030901 -0.500000 -0.095105 0.752941 0.752941 0.752941 +vn 0.000000 -9.973935 0.000000 +v -0.058778 -0.500000 -0.080902 0.752941 0.752941 0.752941 +vn 0.000000 -9.973935 0.000000 +v -0.080902 -0.500000 -0.058778 0.752941 0.752941 0.752941 +vn 0.000000 -9.973934 0.000000 +v -0.095105 -0.500000 -0.030901 0.752941 0.752941 0.752941 +vn 0.000000 -9.973934 0.000000 +v -0.100000 -0.500000 0.000000 0.752941 0.752941 0.752941 +vn 0.000000 -9.973934 0.000000 +v -0.095105 -0.500000 0.030901 0.752941 0.752941 0.752941 +vn 0.000000 -9.973935 0.000000 +v -0.080902 -0.500000 0.058778 0.752941 0.752941 0.752941 +vn 0.000000 -9.973935 0.000000 +v -0.058778 -0.500000 0.080902 0.752941 0.752941 0.752941 +vn 0.000000 -9.973934 0.000000 +v -0.030901 -0.500000 0.095105 0.752941 0.752941 0.752941 +vn 0.000000 -9.973934 0.000000 +v 0.000000 -0.500000 0.100000 0.752941 0.752941 0.752941 +vn 0.000000 -9.973934 0.000000 +v 0.030901 -0.500000 0.095105 0.752941 0.752941 0.752941 +vn 0.000000 -9.973935 0.000000 +v 0.058778 -0.500000 0.080902 0.752941 0.752941 0.752941 +vn 0.000000 -9.973935 0.000000 +v 0.080902 -0.500000 0.058778 0.752941 0.752941 0.752941 +vn 0.000000 -9.973934 0.000000 +v 0.095105 -0.500000 0.030901 0.752941 0.752941 0.752941 +vn 0.000000 -9.973934 0.000000 +v 0.100000 -0.500000 0.000000 0.752941 0.752941 0.752941 +vn 0.000000 -9.973935 0.000000 +v 0.190212 -0.500000 -0.061804 0.752941 0.752941 0.752941 +vn 0.000000 -9.973934 0.000000 +v 0.161803 -0.500000 -0.117557 0.752941 0.752941 0.752941 +vn 0.000000 -9.973935 0.000000 +v 0.117557 -0.500000 -0.161803 0.752941 0.752941 0.752941 +vn 0.000000 -9.973934 0.000000 +v 0.061804 -0.500000 -0.190212 0.752941 0.752941 0.752941 +vn 0.000000 -9.973936 0.000000 +v 0.000000 -0.500000 -0.200000 0.752941 0.752941 0.752941 +vn 0.000000 -9.973935 0.000000 +v -0.061804 -0.500000 -0.190212 0.752941 0.752941 0.752941 +vn 0.000000 -9.973934 0.000000 +v -0.117557 -0.500000 -0.161803 0.752941 0.752941 0.752941 +vn 0.000000 -9.973935 0.000000 +v -0.161803 -0.500000 -0.117557 0.752941 0.752941 0.752941 +vn 0.000000 -9.973934 0.000000 +v -0.190212 -0.500000 -0.061804 0.752941 0.752941 0.752941 +vn 0.000000 -9.973936 0.000000 +v -0.200000 -0.500000 0.000000 0.752941 0.752941 0.752941 +vn 0.000000 -9.973935 0.000000 +v -0.190212 -0.500000 0.061804 0.752941 0.752941 0.752941 +vn 0.000000 -9.973934 0.000000 +v -0.161803 -0.500000 0.117557 0.752941 0.752941 0.752941 +vn 0.000000 -9.973935 0.000000 +v -0.117557 -0.500000 0.161803 0.752941 0.752941 0.752941 +vn 0.000000 -9.973934 0.000000 +v -0.061804 -0.500000 0.190212 0.752941 0.752941 0.752941 +vn 0.000000 -9.973936 0.000000 +v 0.000000 -0.500000 0.200000 0.752941 0.752941 0.752941 +vn 0.000000 -9.973935 0.000000 +v 0.061804 -0.500000 0.190212 0.752941 0.752941 0.752941 +vn 0.000000 -9.973934 0.000000 +v 0.117557 -0.500000 0.161803 0.752941 0.752941 0.752941 +vn 0.000000 -9.973935 0.000000 +v 0.161803 -0.500000 0.117557 0.752941 0.752941 0.752941 +vn 0.000000 -9.973934 0.000000 +v 0.190212 -0.500000 0.061804 0.752941 0.752941 0.752941 +vn 0.000000 -9.973936 0.000000 +v 0.200000 -0.500000 0.000000 0.752941 0.752941 0.752941 +vn 0.000000 -9.973935 0.000000 +v 0.285317 -0.500000 -0.092705 0.752941 0.752941 0.752941 +vn 0.000000 -9.973935 0.000000 +v 0.242705 -0.500000 -0.176335 0.752941 0.752941 0.752941 +vn 0.000000 -9.973936 0.000000 +v 0.176335 -0.500000 -0.242705 0.752941 0.752941 0.752941 +vn 0.000000 -9.973934 0.000000 +v 0.092705 -0.500000 -0.285317 0.752941 0.752941 0.752941 +vn 0.000000 -9.973935 0.000000 +v 0.000000 -0.500000 -0.300000 0.752941 0.752941 0.752941 +vn 0.000000 -9.973934 0.000000 +v -0.092705 -0.500000 -0.285317 0.752941 0.752941 0.752941 +vn 0.000000 -9.973935 0.000000 +v -0.176335 -0.500000 -0.242705 0.752941 0.752941 0.752941 +vn 0.000000 -9.973935 0.000000 +v -0.242705 -0.500000 -0.176335 0.752941 0.752941 0.752941 +vn 0.000000 -9.973934 0.000000 +v -0.285317 -0.500000 -0.092705 0.752941 0.752941 0.752941 +vn 0.000000 -9.973935 0.000000 +v -0.300000 -0.500000 0.000000 0.752941 0.752941 0.752941 +vn 0.000000 -9.973935 0.000000 +v -0.285317 -0.500000 0.092705 0.752941 0.752941 0.752941 +vn 0.000000 -9.973935 0.000000 +v -0.242705 -0.500000 0.176335 0.752941 0.752941 0.752941 +vn 0.000000 -9.973935 0.000000 +v -0.176335 -0.500000 0.242705 0.752941 0.752941 0.752941 +vn 0.000000 -9.973934 0.000000 +v -0.092705 -0.500000 0.285317 0.752941 0.752941 0.752941 +vn 0.000000 -9.973935 0.000000 +v 0.000000 -0.500000 0.300000 0.752941 0.752941 0.752941 +vn 0.000000 -9.973935 0.000000 +v 0.092705 -0.500000 0.285317 0.752941 0.752941 0.752941 +vn 0.000000 -9.973935 0.000000 +v 0.176335 -0.500000 0.242705 0.752941 0.752941 0.752941 +vn 0.000000 -9.973935 0.000000 +v 0.242705 -0.500000 0.176335 0.752941 0.752941 0.752941 +vn 0.000000 -9.973934 0.000000 +v 0.285317 -0.500000 0.092705 0.752941 0.752941 0.752941 +vn 0.000000 -9.973935 0.000000 +v 0.300000 -0.500000 0.000000 0.752941 0.752941 0.752941 +vn 0.000000 -9.973935 0.000000 +v 0.380423 -0.500000 -0.123607 0.752941 0.752941 0.752941 +vn 0.000000 -9.973935 0.000000 +v 0.323607 -0.500000 -0.235114 0.752941 0.752941 0.752941 +vn 0.000000 -9.973935 0.000000 +v 0.235114 -0.500000 -0.323607 0.752941 0.752941 0.752941 +vn 0.000000 -9.973934 0.000000 +v 0.123607 -0.500000 -0.380423 0.752941 0.752941 0.752941 +vn 0.000000 -9.973936 0.000000 +v 0.000000 -0.500000 -0.400000 0.752941 0.752941 0.752941 +vn 0.000000 -9.973935 0.000000 +v -0.123607 -0.500000 -0.380423 0.752941 0.752941 0.752941 +vn 0.000000 -9.973934 0.000000 +v -0.235114 -0.500000 -0.323607 0.752941 0.752941 0.752941 +vn 0.000000 -9.973935 0.000000 +v -0.323607 -0.500000 -0.235114 0.752941 0.752941 0.752941 +vn 0.000000 -9.973935 0.000000 +v -0.380423 -0.500000 -0.123607 0.752941 0.752941 0.752941 +vn 0.000000 -9.973935 0.000000 +v -0.400000 -0.500000 0.000000 0.752941 0.752941 0.752941 +vn 0.000000 -9.973935 0.000000 +v -0.380423 -0.500000 0.123607 0.752941 0.752941 0.752941 +vn 0.000000 -9.973934 0.000000 +v -0.323607 -0.500000 0.235114 0.752941 0.752941 0.752941 +vn 0.000000 -9.973935 0.000000 +v -0.235114 -0.500000 0.323607 0.752941 0.752941 0.752941 +vn 0.000000 -9.973935 0.000000 +v -0.123607 -0.500000 0.380423 0.752941 0.752941 0.752941 +vn 0.000000 -9.973935 0.000000 +v 0.000000 -0.500000 0.400000 0.752941 0.752941 0.752941 +vn 0.000000 -9.973935 0.000000 +v 0.123607 -0.500000 0.380423 0.752941 0.752941 0.752941 +vn 0.000000 -9.973934 0.000000 +v 0.235114 -0.500000 0.323607 0.752941 0.752941 0.752941 +vn 0.000000 -9.973935 0.000000 +v 0.323607 -0.500000 0.235114 0.752941 0.752941 0.752941 +vn 0.000000 -9.973935 0.000000 +v 0.380423 -0.500000 0.123607 0.752941 0.752941 0.752941 +vn 0.000000 -9.973934 0.000000 +v 0.400000 -0.500000 0.000000 0.752941 0.752941 0.752941 +vn 2.342249 -4.488272 -0.761037 +v 0.475529 -0.500000 -0.154509 0.752941 0.752941 0.752941 +vn 1.992434 -4.488263 -1.447588 +v 0.404509 -0.500000 -0.293893 0.752941 0.752941 0.752941 +vn 1.447587 -4.488275 -1.992437 +v 0.293893 -0.500000 -0.404509 0.752941 0.752941 0.752941 +vn 0.761041 -4.488267 -2.342248 +v 0.154509 -0.500000 -0.475529 0.752941 0.752941 0.752941 +vn -0.000000 -4.488276 -2.462785 +v 0.000000 -0.500000 -0.500000 0.752941 0.752941 0.752941 +vn -0.761042 -4.488265 -2.342247 +v -0.154509 -0.500000 -0.475529 0.752941 0.752941 0.752941 +vn -1.447590 -4.488274 -1.992433 +v -0.293893 -0.500000 -0.404509 0.752941 0.752941 0.752941 +vn -1.992434 -4.488274 -1.447590 +v -0.404509 -0.500000 -0.293893 0.752941 0.752941 0.752941 +vn -2.342247 -4.488265 -0.761042 +v -0.475529 -0.500000 -0.154509 0.752941 0.752941 0.752941 +vn -2.462785 -4.488276 0.000000 +v -0.500000 -0.500000 0.000000 0.752941 0.752941 0.752941 +vn -2.342247 -4.488265 0.761042 +v -0.475529 -0.500000 0.154509 0.752941 0.752941 0.752941 +vn -1.992433 -4.488274 1.447590 +v -0.404509 -0.500000 0.293893 0.752941 0.752941 0.752941 +vn -1.447590 -4.488274 1.992434 +v -0.293893 -0.500000 0.404509 0.752941 0.752941 0.752941 +vn -0.761042 -4.488265 2.342247 +v -0.154509 -0.500000 0.475529 0.752941 0.752941 0.752941 +vn 0.000000 -4.488276 2.462785 +v 0.000000 -0.500000 0.500000 0.752941 0.752941 0.752941 +vn 0.761042 -4.488265 2.342247 +v 0.154509 -0.500000 0.475529 0.752941 0.752941 0.752941 +vn 1.447590 -4.488274 1.992433 +v 0.293893 -0.500000 0.404509 0.752941 0.752941 0.752941 +vn 1.992434 -4.488274 1.447590 +v 0.404509 -0.500000 0.293893 0.752941 0.752941 0.752941 +vn 2.342247 -4.488265 0.761042 +v 0.475529 -0.500000 0.154509 0.752941 0.752941 0.752941 +vn 2.462785 -4.488276 -0.000000 +v 0.500000 -0.500000 0.000000 0.752941 0.752941 0.752941 +vn 4.684499 0.000000 -1.522075 +v 0.475529 -0.400000 -0.154509 0.752941 0.752941 0.752941 +vn 3.984868 0.000000 -2.895175 +v 0.404509 -0.400000 -0.293893 0.752941 0.752941 0.752941 +vn 2.895174 0.000000 -3.984874 +v 0.293893 -0.400000 -0.404509 0.752941 0.752941 0.752941 +vn 1.522081 0.000000 -4.684495 +v 0.154509 -0.400000 -0.475529 0.752941 0.752941 0.752941 +vn 0.000000 0.000000 -4.925570 +v 0.000000 -0.400000 -0.500000 0.752941 0.752941 0.752941 +vn -1.522084 0.000000 -4.684494 +v -0.154509 -0.400000 -0.475529 0.752941 0.752941 0.752941 +vn -2.895180 0.000000 -3.984867 +v -0.293893 -0.400000 -0.404509 0.752941 0.752941 0.752941 +vn -3.984867 0.000000 -2.895181 +v -0.404509 -0.400000 -0.293893 0.752941 0.752941 0.752941 +vn -4.684493 0.000000 -1.522084 +v -0.475529 -0.400000 -0.154509 0.752941 0.752941 0.752941 +vn -4.925570 0.000000 0.000000 +v -0.500000 -0.400000 0.000000 0.752941 0.752941 0.752941 +vn -4.684494 0.000000 1.522084 +v -0.475529 -0.400000 0.154509 0.752941 0.752941 0.752941 +vn -3.984867 0.000000 2.895180 +v -0.404509 -0.400000 0.293893 0.752941 0.752941 0.752941 +vn -2.895181 0.000000 3.984867 +v -0.293893 -0.400000 0.404509 0.752941 0.752941 0.752941 +vn -1.522084 0.000000 4.684493 +v -0.154509 -0.400000 0.475529 0.752941 0.752941 0.752941 +vn 0.000000 0.000000 4.925570 +v 0.000000 -0.400000 0.500000 0.752941 0.752941 0.752941 +vn 1.522084 0.000000 4.684494 +v 0.154509 -0.400000 0.475529 0.752941 0.752941 0.752941 +vn 2.895180 0.000000 3.984867 +v 0.293893 -0.400000 0.404509 0.752941 0.752941 0.752941 +vn 3.984867 0.000000 2.895181 +v 0.404509 -0.400000 0.293893 0.752941 0.752941 0.752941 +vn 4.684493 0.000000 1.522084 +v 0.475529 -0.400000 0.154509 0.752941 0.752941 0.752941 +vn 4.925570 0.000000 0.000000 +v 0.500000 -0.400000 0.000000 0.752941 0.752941 0.752941 +vn 4.684499 0.000000 -1.522075 +v 0.475529 -0.300000 -0.154509 0.752941 0.752941 0.752941 +vn 3.984868 0.000000 -2.895175 +v 0.404509 -0.300000 -0.293893 0.752941 0.752941 0.752941 +vn 2.895174 0.000000 -3.984873 +v 0.293893 -0.300000 -0.404509 0.752941 0.752941 0.752941 +vn 1.522081 0.000000 -4.684496 +v 0.154509 -0.300000 -0.475529 0.752941 0.752941 0.752941 +vn 0.000000 0.000000 -4.925570 +v 0.000000 -0.300000 -0.500000 0.752941 0.752941 0.752941 +vn -1.522085 0.000000 -4.684494 +v -0.154509 -0.300000 -0.475529 0.752941 0.752941 0.752941 +vn -2.895181 0.000000 -3.984867 +v -0.293893 -0.300000 -0.404509 0.752941 0.752941 0.752941 +vn -3.984867 0.000000 -2.895181 +v -0.404509 -0.300000 -0.293893 0.752941 0.752941 0.752941 +vn -4.684493 0.000000 -1.522084 +v -0.475529 -0.300000 -0.154509 0.752941 0.752941 0.752941 +vn -4.925570 0.000000 0.000000 +v -0.500000 -0.300000 0.000000 0.752941 0.752941 0.752941 +vn -4.684494 0.000000 1.522085 +v -0.475529 -0.300000 0.154509 0.752941 0.752941 0.752941 +vn -3.984867 0.000000 2.895181 +v -0.404509 -0.300000 0.293893 0.752941 0.752941 0.752941 +vn -2.895181 0.000000 3.984867 +v -0.293893 -0.300000 0.404509 0.752941 0.752941 0.752941 +vn -1.522085 0.000000 4.684494 +v -0.154509 -0.300000 0.475529 0.752941 0.752941 0.752941 +vn 0.000000 0.000000 4.925570 +v 0.000000 -0.300000 0.500000 0.752941 0.752941 0.752941 +vn 1.522085 0.000000 4.684494 +v 0.154509 -0.300000 0.475529 0.752941 0.752941 0.752941 +vn 2.895181 0.000000 3.984867 +v 0.293893 -0.300000 0.404509 0.752941 0.752941 0.752941 +vn 3.984867 0.000000 2.895181 +v 0.404509 -0.300000 0.293893 0.752941 0.752941 0.752941 +vn 4.684493 0.000000 1.522084 +v 0.475529 -0.300000 0.154509 0.752941 0.752941 0.752941 +vn 4.925570 0.000000 0.000000 +v 0.500000 -0.300000 0.000000 0.752941 0.752941 0.752941 +vn 4.684498 0.000000 -1.522075 +v 0.475529 -0.200000 -0.154509 0.752941 0.752941 0.752941 +vn 3.984868 0.000000 -2.895175 +v 0.404509 -0.200000 -0.293893 0.752941 0.752941 0.752941 +vn 2.895174 0.000000 -3.984874 +v 0.293893 -0.200000 -0.404509 0.752941 0.752941 0.752941 +vn 1.522081 0.000000 -4.684494 +v 0.154509 -0.200000 -0.475529 0.752941 0.752941 0.752941 +vn 0.000000 0.000000 -4.925570 +v 0.000000 -0.200000 -0.500000 0.752941 0.752941 0.752941 +vn -1.522085 0.000000 -4.684494 +v -0.154509 -0.200000 -0.475529 0.752941 0.752941 0.752941 +vn -2.895181 0.000000 -3.984867 +v -0.293893 -0.200000 -0.404509 0.752941 0.752941 0.752941 +vn -3.984867 0.000000 -2.895181 +v -0.404509 -0.200000 -0.293893 0.752941 0.752941 0.752941 +vn -4.684493 0.000000 -1.522085 +v -0.475529 -0.200000 -0.154509 0.752941 0.752941 0.752941 +vn -4.925570 0.000000 0.000000 +v -0.500000 -0.200000 0.000000 0.752941 0.752941 0.752941 +vn -4.684493 0.000000 1.522085 +v -0.475529 -0.200000 0.154509 0.752941 0.752941 0.752941 +vn -3.984867 0.000000 2.895181 +v -0.404509 -0.200000 0.293893 0.752941 0.752941 0.752941 +vn -2.895181 0.000000 3.984867 +v -0.293893 -0.200000 0.404509 0.752941 0.752941 0.752941 +vn -1.522085 0.000000 4.684493 +v -0.154509 -0.200000 0.475529 0.752941 0.752941 0.752941 +vn 0.000000 0.000000 4.925570 +v 0.000000 -0.200000 0.500000 0.752941 0.752941 0.752941 +vn 1.522085 0.000000 4.684494 +v 0.154509 -0.200000 0.475529 0.752941 0.752941 0.752941 +vn 2.895181 0.000000 3.984867 +v 0.293893 -0.200000 0.404509 0.752941 0.752941 0.752941 +vn 3.984867 0.000000 2.895181 +v 0.404509 -0.200000 0.293893 0.752941 0.752941 0.752941 +vn 4.684493 0.000000 1.522085 +v 0.475529 -0.200000 0.154509 0.752941 0.752941 0.752941 +vn 4.925570 0.000000 0.000000 +v 0.500000 -0.200000 0.000000 0.752941 0.752941 0.752941 +vn 4.684498 0.000000 -1.522075 +v 0.475529 -0.100000 -0.154509 0.752941 0.752941 0.752941 +vn 3.984868 0.000000 -2.895175 +v 0.404509 -0.100000 -0.293893 0.752941 0.752941 0.752941 +vn 2.895174 0.000000 -3.984873 +v 0.293893 -0.100000 -0.404509 0.752941 0.752941 0.752941 +vn 1.522081 0.000000 -4.684494 +v 0.154509 -0.100000 -0.475529 0.752941 0.752941 0.752941 +vn 0.000000 0.000000 -4.925570 +v 0.000000 -0.100000 -0.500000 0.752941 0.752941 0.752941 +vn -1.522085 0.000000 -4.684493 +v -0.154509 -0.100000 -0.475529 0.752941 0.752941 0.752941 +vn -2.895181 0.000000 -3.984867 +v -0.293893 -0.100000 -0.404509 0.752941 0.752941 0.752941 +vn -3.984867 0.000000 -2.895181 +v -0.404509 -0.100000 -0.293893 0.752941 0.752941 0.752941 +vn -4.684493 0.000000 -1.522085 +v -0.475529 -0.100000 -0.154509 0.752941 0.752941 0.752941 +vn -4.925570 0.000000 0.000000 +v -0.500000 -0.100000 0.000000 0.752941 0.752941 0.752941 +vn -4.684493 0.000000 1.522085 +v -0.475529 -0.100000 0.154509 0.752941 0.752941 0.752941 +vn -3.984867 0.000000 2.895181 +v -0.404509 -0.100000 0.293893 0.752941 0.752941 0.752941 +vn -2.895181 0.000000 3.984867 +v -0.293893 -0.100000 0.404509 0.752941 0.752941 0.752941 +vn -1.522085 0.000000 4.684493 +v -0.154509 -0.100000 0.475529 0.752941 0.752941 0.752941 +vn 0.000000 0.000000 4.925570 +v 0.000000 -0.100000 0.500000 0.752941 0.752941 0.752941 +vn 1.522085 0.000000 4.684493 +v 0.154509 -0.100000 0.475529 0.752941 0.752941 0.752941 +vn 2.895181 0.000000 3.984867 +v 0.293893 -0.100000 0.404509 0.752941 0.752941 0.752941 +vn 3.984867 0.000000 2.895181 +v 0.404509 -0.100000 0.293893 0.752941 0.752941 0.752941 +vn 4.684493 0.000000 1.522085 +v 0.475529 -0.100000 0.154509 0.752941 0.752941 0.752941 +vn 4.925570 0.000000 0.000000 +v 0.500000 -0.100000 0.000000 0.752941 0.752941 0.752941 +vn 4.684498 0.000000 -1.522075 +v 0.475529 0.000000 -0.154509 0.752941 0.752941 0.752941 +vn 3.984868 0.000000 -2.895175 +v 0.404509 0.000000 -0.293893 0.752941 0.752941 0.752941 +vn 2.895174 0.000000 -3.984873 +v 0.293893 0.000000 -0.404509 0.752941 0.752941 0.752941 +vn 1.522081 0.000000 -4.684494 +v 0.154509 0.000000 -0.475529 0.752941 0.752941 0.752941 +vn 0.000000 0.000000 -4.925570 +v 0.000000 0.000000 -0.500000 0.752941 0.752941 0.752941 +vn -1.522085 0.000000 -4.684493 +v -0.154509 0.000000 -0.475529 0.752941 0.752941 0.752941 +vn -2.895181 0.000000 -3.984867 +v -0.293893 0.000000 -0.404509 0.752941 0.752941 0.752941 +vn -3.984867 0.000000 -2.895181 +v -0.404509 0.000000 -0.293893 0.752941 0.752941 0.752941 +vn -4.684493 0.000000 -1.522085 +v -0.475529 0.000000 -0.154509 0.752941 0.752941 0.752941 +vn -4.925570 0.000000 0.000000 +v -0.500000 0.000000 0.000000 0.752941 0.752941 0.752941 +vn -4.684493 0.000000 1.522085 +v -0.475529 0.000000 0.154509 0.752941 0.752941 0.752941 +vn -3.984867 0.000000 2.895181 +v -0.404509 0.000000 0.293893 0.752941 0.752941 0.752941 +vn -2.895181 0.000000 3.984867 +v -0.293893 0.000000 0.404509 0.752941 0.752941 0.752941 +vn -1.522085 0.000000 4.684493 +v -0.154509 0.000000 0.475529 0.752941 0.752941 0.752941 +vn 0.000000 0.000000 4.925570 +v 0.000000 0.000000 0.500000 0.752941 0.752941 0.752941 +vn 1.522085 0.000000 4.684493 +v 0.154509 0.000000 0.475529 0.752941 0.752941 0.752941 +vn 2.895181 0.000000 3.984867 +v 0.293893 0.000000 0.404509 0.752941 0.752941 0.752941 +vn 3.984867 0.000000 2.895181 +v 0.404509 0.000000 0.293893 0.752941 0.752941 0.752941 +vn 4.684493 0.000000 1.522085 +v 0.475529 0.000000 0.154509 0.752941 0.752941 0.752941 +vn 4.925570 0.000000 0.000000 +v 0.500000 0.000000 0.000000 0.752941 0.752941 0.752941 +vn 4.684498 0.000000 -1.522075 +v 0.475529 0.100000 -0.154509 0.752941 0.752941 0.752941 +vn 3.984868 0.000000 -2.895175 +v 0.404509 0.100000 -0.293893 0.752941 0.752941 0.752941 +vn 2.895174 0.000000 -3.984873 +v 0.293893 0.100000 -0.404509 0.752941 0.752941 0.752941 +vn 1.522081 0.000000 -4.684494 +v 0.154509 0.100000 -0.475529 0.752941 0.752941 0.752941 +vn 0.000000 0.000000 -4.925570 +v 0.000000 0.100000 -0.500000 0.752941 0.752941 0.752941 +vn -1.522085 0.000000 -4.684493 +v -0.154509 0.100000 -0.475529 0.752941 0.752941 0.752941 +vn -2.895181 0.000000 -3.984867 +v -0.293893 0.100000 -0.404509 0.752941 0.752941 0.752941 +vn -3.984867 0.000000 -2.895181 +v -0.404509 0.100000 -0.293893 0.752941 0.752941 0.752941 +vn -4.684493 0.000000 -1.522085 +v -0.475529 0.100000 -0.154509 0.752941 0.752941 0.752941 +vn -4.925570 0.000000 0.000000 +v -0.500000 0.100000 0.000000 0.752941 0.752941 0.752941 +vn -4.684493 0.000000 1.522085 +v -0.475529 0.100000 0.154509 0.752941 0.752941 0.752941 +vn -3.984867 0.000000 2.895181 +v -0.404509 0.100000 0.293893 0.752941 0.752941 0.752941 +vn -2.895181 0.000000 3.984867 +v -0.293893 0.100000 0.404509 0.752941 0.752941 0.752941 +vn -1.522085 0.000000 4.684493 +v -0.154509 0.100000 0.475529 0.752941 0.752941 0.752941 +vn 0.000000 0.000000 4.925570 +v 0.000000 0.100000 0.500000 0.752941 0.752941 0.752941 +vn 1.522085 0.000000 4.684493 +v 0.154509 0.100000 0.475529 0.752941 0.752941 0.752941 +vn 2.895181 0.000000 3.984867 +v 0.293893 0.100000 0.404509 0.752941 0.752941 0.752941 +vn 3.984867 0.000000 2.895181 +v 0.404509 0.100000 0.293893 0.752941 0.752941 0.752941 +vn 4.684493 0.000000 1.522085 +v 0.475529 0.100000 0.154509 0.752941 0.752941 0.752941 +vn 4.925570 0.000000 0.000000 +v 0.500000 0.100000 0.000000 0.752941 0.752941 0.752941 +vn 4.684498 0.000000 -1.522075 +v 0.475529 0.200000 -0.154509 0.752941 0.752941 0.752941 +vn 3.984868 0.000000 -2.895175 +v 0.404509 0.200000 -0.293893 0.752941 0.752941 0.752941 +vn 2.895174 0.000000 -3.984873 +v 0.293893 0.200000 -0.404509 0.752941 0.752941 0.752941 +vn 1.522081 0.000000 -4.684495 +v 0.154509 0.200000 -0.475529 0.752941 0.752941 0.752941 +vn 0.000000 0.000000 -4.925570 +v 0.000000 0.200000 -0.500000 0.752941 0.752941 0.752941 +vn -1.522085 0.000000 -4.684494 +v -0.154509 0.200000 -0.475529 0.752941 0.752941 0.752941 +vn -2.895181 0.000000 -3.984867 +v -0.293893 0.200000 -0.404509 0.752941 0.752941 0.752941 +vn -3.984867 0.000000 -2.895181 +v -0.404509 0.200000 -0.293893 0.752941 0.752941 0.752941 +vn -4.684493 0.000000 -1.522085 +v -0.475529 0.200000 -0.154509 0.752941 0.752941 0.752941 +vn -4.925570 0.000000 0.000000 +v -0.500000 0.200000 0.000000 0.752941 0.752941 0.752941 +vn -4.684494 0.000000 1.522085 +v -0.475529 0.200000 0.154509 0.752941 0.752941 0.752941 +vn -3.984867 0.000000 2.895181 +v -0.404509 0.200000 0.293893 0.752941 0.752941 0.752941 +vn -2.895181 0.000000 3.984867 +v -0.293893 0.200000 0.404509 0.752941 0.752941 0.752941 +vn -1.522085 0.000000 4.684494 +v -0.154509 0.200000 0.475529 0.752941 0.752941 0.752941 +vn 0.000000 0.000000 4.925570 +v 0.000000 0.200000 0.500000 0.752941 0.752941 0.752941 +vn 1.522085 0.000000 4.684494 +v 0.154509 0.200000 0.475529 0.752941 0.752941 0.752941 +vn 2.895181 0.000000 3.984867 +v 0.293893 0.200000 0.404509 0.752941 0.752941 0.752941 +vn 3.984867 0.000000 2.895181 +v 0.404509 0.200000 0.293893 0.752941 0.752941 0.752941 +vn 4.684493 0.000000 1.522085 +v 0.475529 0.200000 0.154509 0.752941 0.752941 0.752941 +vn 4.925570 0.000000 0.000000 +v 0.500000 0.200000 0.000000 0.752941 0.752941 0.752941 +vn 4.684499 0.000000 -1.522075 +v 0.475529 0.300000 -0.154509 0.752941 0.752941 0.752941 +vn 3.984868 0.000000 -2.895175 +v 0.404509 0.300000 -0.293893 0.752941 0.752941 0.752941 +vn 2.895174 0.000000 -3.984874 +v 0.293893 0.300000 -0.404509 0.752941 0.752941 0.752941 +vn 1.522081 0.000000 -4.684495 +v 0.154509 0.300000 -0.475529 0.752941 0.752941 0.752941 +vn 0.000000 0.000000 -4.925570 +v 0.000000 0.300000 -0.500000 0.752941 0.752941 0.752941 +vn -1.522085 0.000000 -4.684494 +v -0.154509 0.300000 -0.475529 0.752941 0.752941 0.752941 +vn -2.895180 0.000000 -3.984867 +v -0.293893 0.300000 -0.404509 0.752941 0.752941 0.752941 +vn -3.984867 0.000000 -2.895181 +v -0.404509 0.300000 -0.293893 0.752941 0.752941 0.752941 +vn -4.684494 0.000000 -1.522085 +v -0.475529 0.300000 -0.154509 0.752941 0.752941 0.752941 +vn -4.925570 0.000000 0.000000 +v -0.500000 0.300000 0.000000 0.752941 0.752941 0.752941 +vn -4.684494 0.000000 1.522085 +v -0.475529 0.300000 0.154509 0.752941 0.752941 0.752941 +vn -3.984867 0.000000 2.895180 +v -0.404509 0.300000 0.293893 0.752941 0.752941 0.752941 +vn -2.895181 0.000000 3.984867 +v -0.293893 0.300000 0.404509 0.752941 0.752941 0.752941 +vn -1.522085 0.000000 4.684494 +v -0.154509 0.300000 0.475529 0.752941 0.752941 0.752941 +vn 0.000000 0.000000 4.925570 +v 0.000000 0.300000 0.500000 0.752941 0.752941 0.752941 +vn 1.522085 0.000000 4.684494 +v 0.154509 0.300000 0.475529 0.752941 0.752941 0.752941 +vn 2.895180 0.000000 3.984867 +v 0.293893 0.300000 0.404509 0.752941 0.752941 0.752941 +vn 3.984867 0.000000 2.895181 +v 0.404509 0.300000 0.293893 0.752941 0.752941 0.752941 +vn 4.684494 0.000000 1.522085 +v 0.475529 0.300000 0.154509 0.752941 0.752941 0.752941 +vn 4.925570 0.000000 0.000000 +v 0.500000 0.300000 0.000000 0.752941 0.752941 0.752941 +vn 4.684499 0.000000 -1.522075 +v 0.475529 0.400000 -0.154509 0.752941 0.752941 0.752941 +vn 3.984868 0.000000 -2.895175 +v 0.404509 0.400000 -0.293893 0.752941 0.752941 0.752941 +vn 2.895174 0.000000 -3.984874 +v 0.293893 0.400000 -0.404509 0.752941 0.752941 0.752941 +vn 1.522081 0.000000 -4.684495 +v 0.154509 0.400000 -0.475529 0.752941 0.752941 0.752941 +vn 0.000000 0.000000 -4.925570 +v 0.000000 0.400000 -0.500000 0.752941 0.752941 0.752941 +vn -1.522084 0.000000 -4.684494 +v -0.154509 0.400000 -0.475529 0.752941 0.752941 0.752941 +vn -2.895180 0.000000 -3.984867 +v -0.293893 0.400000 -0.404509 0.752941 0.752941 0.752941 +vn -3.984867 0.000000 -2.895181 +v -0.404509 0.400000 -0.293893 0.752941 0.752941 0.752941 +vn -4.684493 0.000000 -1.522084 +v -0.475529 0.400000 -0.154509 0.752941 0.752941 0.752941 +vn -4.925570 0.000000 0.000000 +v -0.500000 0.400000 0.000000 0.752941 0.752941 0.752941 +vn -4.684494 0.000000 1.522084 +v -0.475529 0.400000 0.154509 0.752941 0.752941 0.752941 +vn -3.984867 0.000000 2.895180 +v -0.404509 0.400000 0.293893 0.752941 0.752941 0.752941 +vn -2.895181 0.000000 3.984867 +v -0.293893 0.400000 0.404509 0.752941 0.752941 0.752941 +vn -1.522084 0.000000 4.684493 +v -0.154509 0.400000 0.475529 0.752941 0.752941 0.752941 +vn 0.000000 0.000000 4.925570 +v 0.000000 0.400000 0.500000 0.752941 0.752941 0.752941 +vn 1.522084 0.000000 4.684494 +v 0.154509 0.400000 0.475529 0.752941 0.752941 0.752941 +vn 2.895180 0.000000 3.984867 +v 0.293893 0.400000 0.404509 0.752941 0.752941 0.752941 +vn 3.984867 0.000000 2.895181 +v 0.404509 0.400000 0.293893 0.752941 0.752941 0.752941 +vn 4.684493 0.000000 1.522084 +v 0.475529 0.400000 0.154509 0.752941 0.752941 0.752941 +vn 4.925570 0.000000 0.000000 +v 0.500000 0.400000 0.000000 0.752941 0.752941 0.752941 +vn 2.342249 4.488272 -0.761037 +v 0.475529 0.500000 -0.154509 0.752941 0.752941 0.752941 +vn 1.992434 4.488263 -1.447588 +v 0.404509 0.500000 -0.293893 0.752941 0.752941 0.752941 +vn 1.447587 4.488275 -1.992437 +v 0.293893 0.500000 -0.404509 0.752941 0.752941 0.752941 +vn 0.761041 4.488267 -2.342248 +v 0.154509 0.500000 -0.475529 0.752941 0.752941 0.752941 +vn 0.000000 4.488276 -2.462785 +v 0.000000 0.500000 -0.500000 0.752941 0.752941 0.752941 +vn -0.761042 4.488265 -2.342247 +v -0.154509 0.500000 -0.475529 0.752941 0.752941 0.752941 +vn -1.447590 4.488273 -1.992433 +v -0.293893 0.500000 -0.404509 0.752941 0.752941 0.752941 +vn -1.992434 4.488273 -1.447590 +v -0.404509 0.500000 -0.293893 0.752941 0.752941 0.752941 +vn -2.342247 4.488265 -0.761042 +v -0.475529 0.500000 -0.154509 0.752941 0.752941 0.752941 +vn -2.462785 4.488276 -0.000000 +v -0.500000 0.500000 0.000000 0.752941 0.752941 0.752941 +vn -2.342247 4.488265 0.761042 +v -0.475529 0.500000 0.154509 0.752941 0.752941 0.752941 +vn -1.992433 4.488274 1.447590 +v -0.404509 0.500000 0.293893 0.752941 0.752941 0.752941 +vn -1.447590 4.488273 1.992434 +v -0.293893 0.500000 0.404509 0.752941 0.752941 0.752941 +vn -0.761042 4.488265 2.342247 +v -0.154509 0.500000 0.475529 0.752941 0.752941 0.752941 +vn -0.000000 4.488276 2.462785 +v 0.000000 0.500000 0.500000 0.752941 0.752941 0.752941 +vn 0.761042 4.488265 2.342247 +v 0.154509 0.500000 0.475529 0.752941 0.752941 0.752941 +vn 1.447590 4.488274 1.992433 +v 0.293893 0.500000 0.404509 0.752941 0.752941 0.752941 +vn 1.992434 4.488273 1.447590 +v 0.404509 0.500000 0.293893 0.752941 0.752941 0.752941 +vn 2.342247 4.488265 0.761042 +v 0.475529 0.500000 0.154509 0.752941 0.752941 0.752941 +vn 2.462785 4.488276 0.000000 +v 0.500000 0.500000 0.000000 0.752941 0.752941 0.752941 +vn 0.000000 9.973935 0.000000 +v 0.380423 0.500000 -0.123607 0.752941 0.752941 0.752941 +vn 0.000000 9.973935 0.000000 +v 0.323607 0.500000 -0.235114 0.752941 0.752941 0.752941 +vn 0.000000 9.973934 0.000000 +v 0.235114 0.500000 -0.323607 0.752941 0.752941 0.752941 +vn 0.000000 9.973935 0.000000 +v 0.123607 0.500000 -0.380423 0.752941 0.752941 0.752941 +vn 0.000000 9.973935 0.000000 +v 0.000000 0.500000 -0.400000 0.752941 0.752941 0.752941 +vn 0.000000 9.973934 0.000000 +v -0.123607 0.500000 -0.380423 0.752941 0.752941 0.752941 +vn 0.000000 9.973935 0.000000 +v -0.235114 0.500000 -0.323607 0.752941 0.752941 0.752941 +vn 0.000000 9.973935 0.000000 +v -0.323607 0.500000 -0.235114 0.752941 0.752941 0.752941 +vn 0.000000 9.973935 0.000000 +v -0.380423 0.500000 -0.123607 0.752941 0.752941 0.752941 +vn 0.000000 9.973934 0.000000 +v -0.400000 0.500000 0.000000 0.752941 0.752941 0.752941 +vn 0.000000 9.973936 0.000000 +v -0.380423 0.500000 0.123607 0.752941 0.752941 0.752941 +vn 0.000000 9.973935 0.000000 +v -0.323607 0.500000 0.235114 0.752941 0.752941 0.752941 +vn 0.000000 9.973935 0.000000 +v -0.235114 0.500000 0.323607 0.752941 0.752941 0.752941 +vn 0.000000 9.973935 0.000000 +v -0.123607 0.500000 0.380423 0.752941 0.752941 0.752941 +vn 0.000000 9.973934 0.000000 +v 0.000000 0.500000 0.400000 0.752941 0.752941 0.752941 +vn 0.000000 9.973936 0.000000 +v 0.123607 0.500000 0.380423 0.752941 0.752941 0.752941 +vn 0.000000 9.973935 0.000000 +v 0.235114 0.500000 0.323607 0.752941 0.752941 0.752941 +vn 0.000000 9.973935 0.000000 +v 0.323607 0.500000 0.235114 0.752941 0.752941 0.752941 +vn 0.000000 9.973935 0.000000 +v 0.380423 0.500000 0.123607 0.752941 0.752941 0.752941 +vn 0.000000 9.973934 0.000000 +v 0.400000 0.500000 0.000000 0.752941 0.752941 0.752941 +vn 0.000000 9.973934 0.000000 +v 0.285317 0.500000 -0.092705 0.752941 0.752941 0.752941 +vn 0.000000 9.973935 0.000000 +v 0.242705 0.500000 -0.176335 0.752941 0.752941 0.752941 +vn 0.000000 9.973935 0.000000 +v 0.176335 0.500000 -0.242705 0.752941 0.752941 0.752941 +vn 0.000000 9.973934 0.000000 +v 0.092705 0.500000 -0.285317 0.752941 0.752941 0.752941 +vn 0.000000 9.973936 0.000000 +v 0.000000 0.500000 -0.300000 0.752941 0.752941 0.752941 +vn 0.000000 9.973935 0.000000 +v -0.092705 0.500000 -0.285317 0.752941 0.752941 0.752941 +vn 0.000000 9.973935 0.000000 +v -0.176335 0.500000 -0.242705 0.752941 0.752941 0.752941 +vn 0.000000 9.973934 0.000000 +v -0.242705 0.500000 -0.176335 0.752941 0.752941 0.752941 +vn 0.000000 9.973934 0.000000 +v -0.285317 0.500000 -0.092705 0.752941 0.752941 0.752941 +vn 0.000000 9.973936 0.000000 +v -0.300000 0.500000 0.000000 0.752941 0.752941 0.752941 +vn 0.000000 9.973935 0.000000 +v -0.285317 0.500000 0.092705 0.752941 0.752941 0.752941 +vn 0.000000 9.973935 0.000000 +v -0.242705 0.500000 0.176335 0.752941 0.752941 0.752941 +vn 0.000000 9.973934 0.000000 +v -0.176335 0.500000 0.242705 0.752941 0.752941 0.752941 +vn 0.000000 9.973934 0.000000 +v -0.092705 0.500000 0.285317 0.752941 0.752941 0.752941 +vn 0.000000 9.973936 0.000000 +v 0.000000 0.500000 0.300000 0.752941 0.752941 0.752941 +vn 0.000000 9.973935 0.000000 +v 0.092705 0.500000 0.285317 0.752941 0.752941 0.752941 +vn 0.000000 9.973935 0.000000 +v 0.176335 0.500000 0.242705 0.752941 0.752941 0.752941 +vn 0.000000 9.973934 0.000000 +v 0.242705 0.500000 0.176335 0.752941 0.752941 0.752941 +vn 0.000000 9.973934 0.000000 +v 0.285317 0.500000 0.092705 0.752941 0.752941 0.752941 +vn 0.000000 9.973936 0.000000 +v 0.300000 0.500000 0.000000 0.752941 0.752941 0.752941 +vn 0.000000 9.973935 0.000000 +v 0.190212 0.500000 -0.061804 0.752941 0.752941 0.752941 +vn 0.000000 9.973934 0.000000 +v 0.161803 0.500000 -0.117557 0.752941 0.752941 0.752941 +vn 0.000000 9.973934 0.000000 +v 0.117557 0.500000 -0.161803 0.752941 0.752941 0.752941 +vn 0.000000 9.973936 0.000000 +v 0.061804 0.500000 -0.190212 0.752941 0.752941 0.752941 +vn 0.000000 9.973935 0.000000 +v 0.000000 0.500000 -0.200000 0.752941 0.752941 0.752941 +vn 0.000000 9.973935 0.000000 +v -0.061804 0.500000 -0.190212 0.752941 0.752941 0.752941 +vn 0.000000 9.973935 0.000000 +v -0.117557 0.500000 -0.161803 0.752941 0.752941 0.752941 +vn 0.000000 9.973933 0.000000 +v -0.161803 0.500000 -0.117557 0.752941 0.752941 0.752941 +vn 0.000000 9.973936 0.000000 +v -0.190212 0.500000 -0.061804 0.752941 0.752941 0.752941 +vn 0.000000 9.973935 0.000000 +v -0.200000 0.500000 0.000000 0.752941 0.752941 0.752941 +vn 0.000000 9.973935 0.000000 +v -0.190212 0.500000 0.061804 0.752941 0.752941 0.752941 +vn 0.000000 9.973935 0.000000 +v -0.161803 0.500000 0.117557 0.752941 0.752941 0.752941 +vn 0.000000 9.973933 0.000000 +v -0.117557 0.500000 0.161803 0.752941 0.752941 0.752941 +vn 0.000000 9.973936 0.000000 +v -0.061804 0.500000 0.190212 0.752941 0.752941 0.752941 +vn 0.000000 9.973935 0.000000 +v 0.000000 0.500000 0.200000 0.752941 0.752941 0.752941 +vn 0.000000 9.973935 0.000000 +v 0.061804 0.500000 0.190212 0.752941 0.752941 0.752941 +vn 0.000000 9.973935 0.000000 +v 0.117557 0.500000 0.161803 0.752941 0.752941 0.752941 +vn 0.000000 9.973933 0.000000 +v 0.161803 0.500000 0.117557 0.752941 0.752941 0.752941 +vn 0.000000 9.973936 0.000000 +v 0.190212 0.500000 0.061804 0.752941 0.752941 0.752941 +vn 0.000000 9.973935 0.000000 +v 0.200000 0.500000 0.000000 0.752941 0.752941 0.752941 +vn 0.000000 9.973934 0.000000 +v 0.095105 0.500000 -0.030901 0.752941 0.752941 0.752941 +vn 0.000000 9.973935 0.000000 +v 0.080902 0.500000 -0.058778 0.752941 0.752941 0.752941 +vn 0.000000 9.973934 0.000000 +v 0.058778 0.500000 -0.080902 0.752941 0.752941 0.752941 +vn 0.000000 9.973934 0.000000 +v 0.030901 0.500000 -0.095105 0.752941 0.752941 0.752941 +vn 0.000000 9.973934 0.000000 +v 0.000000 0.500000 -0.100000 0.752941 0.752941 0.752941 +vn 0.000000 9.973934 0.000000 +v -0.030901 0.500000 -0.095105 0.752941 0.752941 0.752941 +vn 0.000000 9.973935 0.000000 +v -0.058778 0.500000 -0.080902 0.752941 0.752941 0.752941 +vn 0.000000 9.973935 0.000000 +v -0.080902 0.500000 -0.058778 0.752941 0.752941 0.752941 +vn 0.000000 9.973934 0.000000 +v -0.095105 0.500000 -0.030901 0.752941 0.752941 0.752941 +vn 0.000000 9.973934 0.000000 +v -0.100000 0.500000 0.000000 0.752941 0.752941 0.752941 +vn 0.000000 9.973934 0.000000 +v -0.095105 0.500000 0.030901 0.752941 0.752941 0.752941 +vn 0.000000 9.973935 0.000000 +v -0.080902 0.500000 0.058778 0.752941 0.752941 0.752941 +vn 0.000000 9.973935 0.000000 +v -0.058778 0.500000 0.080902 0.752941 0.752941 0.752941 +vn 0.000000 9.973934 0.000000 +v -0.030901 0.500000 0.095105 0.752941 0.752941 0.752941 +vn 0.000000 9.973934 0.000000 +v 0.000000 0.500000 0.100000 0.752941 0.752941 0.752941 +vn 0.000000 9.973934 0.000000 +v 0.030901 0.500000 0.095105 0.752941 0.752941 0.752941 +vn 0.000000 9.973935 0.000000 +v 0.058778 0.500000 0.080902 0.752941 0.752941 0.752941 +vn 0.000000 9.973935 0.000000 +v 0.080902 0.500000 0.058778 0.752941 0.752941 0.752941 +vn 0.000000 9.973934 0.000000 +v 0.095105 0.500000 0.030901 0.752941 0.752941 0.752941 +vn 0.000000 9.973934 0.000000 +v 0.100000 0.500000 0.000000 0.752941 0.752941 0.752941 +vn 0.000000 -9.973940 0.000000 +v 0.000000 -0.500000 0.000000 0.752941 0.752941 0.752941 +vn 0.000000 9.973940 0.000000 +v 0.000000 0.500000 0.000000 0.752941 0.752941 0.752941 +# 382 vertices, 0 vertices normals + + +usemtl material_0 +vt 0.529721 0.146593 +vt 0.525282 0.137882 +vt 0.559441 0.136936 +f 1/1/1 2/2/2 21/3/21 +vt 0.550564 0.119513 +f 21/3/21 2/2/2 22/4/22 +vt 0.518368 0.130968 +f 2/2/2 3/5/3 22/4/22 +vt 0.536737 0.105686 +f 22/4/22 3/5/3 23/6/23 +vt 0.509657 0.126529 +f 3/5/3 4/7/4 23/6/23 +vt 0.519314 0.096809 +f 23/6/23 4/7/4 24/8/24 +vt 0.500000 0.125000 +f 4/7/4 5/9/5 24/8/24 +vt 0.500000 0.093750 +f 24/8/24 5/9/5 25/10/25 +vt 0.490343 0.126529 +f 5/9/5 6/11/6 25/10/25 +vt 0.480686 0.096809 +f 25/10/25 6/11/6 26/12/26 +vt 0.481632 0.130968 +f 6/11/6 7/13/7 26/12/26 +vt 0.463263 0.105686 +f 26/12/26 7/13/7 27/14/27 +vt 0.474718 0.137882 +f 7/13/7 8/15/8 27/14/27 +vt 0.449436 0.119513 +f 27/14/27 8/15/8 28/16/28 +vt 0.470279 0.146593 +f 8/15/8 9/17/9 28/16/28 +vt 0.440559 0.136936 +f 28/16/28 9/17/9 29/18/29 +vt 0.468750 0.156250 +f 9/17/9 10/19/10 29/18/29 +vt 0.437500 0.156250 +f 29/18/29 10/19/10 30/20/30 +vt 0.470279 0.165907 +f 10/19/10 11/21/11 30/20/30 +vt 0.440559 0.175564 +f 30/20/30 11/21/11 31/22/31 +vt 0.474718 0.174618 +f 11/21/11 12/23/12 31/22/31 +vt 0.449436 0.192987 +f 31/22/31 12/23/12 32/24/32 +vt 0.481632 0.181532 +f 12/23/12 13/25/13 32/24/32 +vt 0.463263 0.206814 +f 32/24/32 13/25/13 33/26/33 +vt 0.490343 0.185971 +f 13/25/13 14/27/14 33/26/33 +vt 0.480686 0.215691 +f 33/26/33 14/27/14 34/28/34 +vt 0.500000 0.187500 +f 14/27/14 15/29/15 34/28/34 +vt 0.500000 0.218750 +f 34/28/34 15/29/15 35/30/35 +vt 0.509657 0.185971 +f 15/29/15 16/31/16 35/30/35 +vt 0.519314 0.215691 +f 35/30/35 16/31/16 36/32/36 +vt 0.518368 0.181532 +f 16/31/16 17/33/17 36/32/36 +vt 0.536737 0.206814 +f 36/32/36 17/33/17 37/34/37 +vt 0.525282 0.174618 +f 17/33/17 18/35/18 37/34/37 +vt 0.550564 0.192987 +f 37/34/37 18/35/18 38/36/38 +vt 0.529721 0.165907 +f 18/35/18 19/37/19 38/36/38 +vt 0.559441 0.175564 +f 38/36/38 19/37/19 39/38/39 +vt 0.531250 0.156250 +f 19/37/19 20/39/20 39/38/39 +vt 0.562500 0.156250 +f 39/38/39 20/39/20 40/40/40 +f 20/39/20 1/1/1 40/40/40 +f 40/40/40 1/1/1 21/3/21 +vt 0.589162 0.127280 +f 21/3/21 22/4/22 41/41/41 +vt 0.575845 0.101145 +f 41/41/41 22/4/22 42/42/42 +f 22/4/22 23/6/23 42/42/42 +vt 0.555105 0.080405 +f 42/42/42 23/6/23 43/43/43 +f 23/6/23 24/8/24 43/43/43 +vt 0.528970 0.067088 +f 43/43/43 24/8/24 44/44/44 +f 24/8/24 25/10/25 44/44/44 +vt 0.500000 0.062500 +f 44/44/44 25/10/25 45/45/45 +f 25/10/25 26/12/26 45/45/45 +vt 0.471030 0.067088 +f 45/45/45 26/12/26 46/46/46 +f 26/12/26 27/14/27 46/46/46 +vt 0.444895 0.080405 +f 46/46/46 27/14/27 47/47/47 +f 27/14/27 28/16/28 47/47/47 +vt 0.424155 0.101145 +f 47/47/47 28/16/28 48/48/48 +f 28/16/28 29/18/29 48/48/48 +vt 0.410838 0.127280 +f 48/48/48 29/18/29 49/49/49 +f 29/18/29 30/20/30 49/49/49 +vt 0.406250 0.156250 +f 49/49/49 30/20/30 50/50/50 +f 30/20/30 31/22/31 50/50/50 +vt 0.410838 0.185220 +f 50/50/50 31/22/31 51/51/51 +f 31/22/31 32/24/32 51/51/51 +vt 0.424155 0.211355 +f 51/51/51 32/24/32 52/52/52 +f 32/24/32 33/26/33 52/52/52 +vt 0.444895 0.232095 +f 52/52/52 33/26/33 53/53/53 +f 33/26/33 34/28/34 53/53/53 +vt 0.471030 0.245412 +f 53/53/53 34/28/34 54/54/54 +f 34/28/34 35/30/35 54/54/54 +vt 0.500000 0.250000 +f 54/54/54 35/30/35 55/55/55 +f 35/30/35 36/32/36 55/55/55 +vt 0.528970 0.245412 +f 55/55/55 36/32/36 56/56/56 +f 36/32/36 37/34/37 56/56/56 +vt 0.555105 0.232095 +f 56/56/56 37/34/37 57/57/57 +f 37/34/37 38/36/38 57/57/57 +vt 0.575845 0.211355 +f 57/57/57 38/36/38 58/58/58 +f 38/36/38 39/38/39 58/58/58 +vt 0.589162 0.185220 +f 58/58/58 39/38/39 59/59/59 +f 39/38/39 40/40/40 59/59/59 +vt 0.593750 0.156250 +f 59/59/59 40/40/40 60/60/60 +f 40/40/40 21/3/21 60/60/60 +f 60/60/60 21/3/21 41/41/41 +vt 0.618882 0.117623 +f 41/41/41 42/42/42 61/61/61 +vt 0.601127 0.082777 +f 61/61/61 42/42/42 62/62/62 +f 42/42/42 43/43/43 62/62/62 +vt 0.573473 0.055123 +f 62/62/62 43/43/43 63/63/63 +f 43/43/43 44/44/44 63/63/63 +vt 0.538627 0.037368 +f 63/63/63 44/44/44 64/64/64 +f 44/44/44 45/45/45 64/64/64 +vt 0.500000 0.031250 +f 64/64/64 45/45/45 65/65/65 +f 45/45/45 46/46/46 65/65/65 +vt 0.461373 0.037368 +f 65/65/65 46/46/46 66/66/66 +f 46/46/46 47/47/47 66/66/66 +vt 0.426527 0.055123 +f 66/66/66 47/47/47 67/67/67 +f 47/47/47 48/48/48 67/67/67 +vt 0.398873 0.082777 +f 67/67/67 48/48/48 68/68/68 +f 48/48/48 49/49/49 68/68/68 +vt 0.381118 0.117623 +f 68/68/68 49/49/49 69/69/69 +f 49/49/49 50/50/50 69/69/69 +vt 0.375000 0.156250 +f 69/69/69 50/50/50 70/70/70 +f 50/50/50 51/51/51 70/70/70 +vt 0.381118 0.194877 +f 70/70/70 51/51/51 71/71/71 +f 51/51/51 52/52/52 71/71/71 +vt 0.398873 0.229723 +f 71/71/71 52/52/52 72/72/72 +f 52/52/52 53/53/53 72/72/72 +vt 0.426527 0.257377 +f 72/72/72 53/53/53 73/73/73 +f 53/53/53 54/54/54 73/73/73 +vt 0.461373 0.275132 +f 73/73/73 54/54/54 74/74/74 +f 54/54/54 55/55/55 74/74/74 +vt 0.500000 0.281250 +f 74/74/74 55/55/55 75/75/75 +f 55/55/55 56/56/56 75/75/75 +vt 0.538627 0.275132 +f 75/75/75 56/56/56 76/76/76 +f 56/56/56 57/57/57 76/76/76 +vt 0.573473 0.257377 +f 76/76/76 57/57/57 77/77/77 +f 57/57/57 58/58/58 77/77/77 +vt 0.601127 0.229723 +f 77/77/77 58/58/58 78/78/78 +f 58/58/58 59/59/59 78/78/78 +vt 0.618882 0.194877 +f 78/78/78 59/59/59 79/79/79 +f 59/59/59 60/60/60 79/79/79 +vt 0.625000 0.156250 +f 79/79/79 60/60/60 80/80/80 +f 60/60/60 41/41/41 80/80/80 +f 80/80/80 41/41/41 61/61/61 +vt 0.648603 0.107966 +f 61/61/61 62/62/62 81/81/81 +vt 0.626409 0.064408 +f 81/81/81 62/62/62 82/82/82 +f 62/62/62 63/63/63 82/82/82 +vt 0.591842 0.029841 +f 82/82/82 63/63/63 83/83/83 +f 63/63/63 64/64/64 83/83/83 +vt 0.548284 0.007647 +f 83/83/83 64/64/64 84/84/84 +f 64/64/64 65/65/65 84/84/84 +vt 0.500000 -0.000000 +f 84/84/84 65/65/65 85/85/85 +f 65/65/65 66/66/66 85/85/85 +vt 0.451716 0.007647 +f 85/85/85 66/66/66 86/86/86 +f 66/66/66 67/67/67 86/86/86 +vt 0.408159 0.029841 +f 86/86/86 67/67/67 87/87/87 +f 67/67/67 68/68/68 87/87/87 +vt 0.373591 0.064409 +f 87/87/87 68/68/68 88/88/88 +f 68/68/68 69/69/69 88/88/88 +vt 0.351397 0.107966 +f 88/88/88 69/69/69 89/89/89 +f 69/69/69 70/70/70 89/89/89 +vt 0.343750 0.156250 +f 89/89/89 70/70/70 90/90/90 +f 70/70/70 71/71/71 90/90/90 +vt 0.351397 0.204534 +f 90/90/90 71/71/71 91/91/91 +f 71/71/71 72/72/72 91/91/91 +vt 0.373591 0.248091 +f 91/91/91 72/72/72 92/92/92 +f 72/72/72 73/73/73 92/92/92 +vt 0.408159 0.282659 +f 92/92/92 73/73/73 93/93/93 +f 73/73/73 74/74/74 93/93/93 +vt 0.451716 0.304853 +f 93/93/93 74/74/74 94/94/94 +f 74/74/74 75/75/75 94/94/94 +vt 0.500000 0.312500 +f 94/94/94 75/75/75 95/95/95 +f 75/75/75 76/76/76 95/95/95 +vt 0.548284 0.304853 +f 95/95/95 76/76/76 96/96/96 +f 76/76/76 77/77/77 96/96/96 +vt 0.591841 0.282659 +f 96/96/96 77/77/77 97/97/97 +f 77/77/77 78/78/78 97/97/97 +vt 0.626409 0.248091 +f 97/97/97 78/78/78 98/98/98 +f 78/78/78 79/79/79 98/98/98 +vt 0.648603 0.204534 +f 98/98/98 79/79/79 99/99/99 +f 79/79/79 80/80/80 99/99/99 +vt 0.656250 0.156250 +f 99/99/99 80/80/80 100/100/100 +f 80/80/80 61/61/61 100/100/100 +f 100/100/100 61/61/61 81/81/81 +vt 0.375000 0.312500 +vt 0.387500 0.312500 +vt 0.375000 0.350094 +f 81/101/81 82/102/82 101/103/101 +vt 0.387500 0.350094 +f 101/103/101 82/102/82 102/104/102 +vt 0.400000 0.312500 +f 82/102/82 83/105/83 102/104/102 +vt 0.400000 0.350094 +f 102/104/102 83/105/83 103/106/103 +vt 0.412500 0.312500 +f 83/105/83 84/107/84 103/106/103 +vt 0.412500 0.350094 +f 103/106/103 84/107/84 104/108/104 +vt 0.425000 0.312500 +f 84/107/84 85/109/85 104/108/104 +vt 0.425000 0.350094 +f 104/108/104 85/109/85 105/110/105 +vt 0.437500 0.312500 +f 85/109/85 86/111/86 105/110/105 +vt 0.437500 0.350094 +f 105/110/105 86/111/86 106/112/106 +vt 0.450000 0.312500 +f 86/111/86 87/113/87 106/112/106 +vt 0.450000 0.350094 +f 106/112/106 87/113/87 107/114/107 +vt 0.462500 0.312500 +f 87/113/87 88/115/88 107/114/107 +vt 0.462500 0.350094 +f 107/114/107 88/115/88 108/116/108 +vt 0.475000 0.312500 +f 88/115/88 89/117/89 108/116/108 +vt 0.475000 0.350094 +f 108/116/108 89/117/89 109/118/109 +vt 0.487500 0.312500 +f 89/117/89 90/119/90 109/118/109 +vt 0.487500 0.350094 +f 109/118/109 90/119/90 110/120/110 +f 90/119/90 91/95/91 110/120/110 +vt 0.500000 0.350094 +f 110/120/110 91/95/91 111/121/111 +vt 0.512500 0.312500 +f 91/95/91 92/122/92 111/121/111 +vt 0.512500 0.350094 +f 111/121/111 92/122/92 112/123/112 +vt 0.525000 0.312500 +f 92/122/92 93/124/93 112/123/112 +vt 0.525000 0.350094 +f 112/123/112 93/124/93 113/125/113 +vt 0.537500 0.312500 +f 93/124/93 94/126/94 113/125/113 +vt 0.537500 0.350094 +f 113/125/113 94/126/94 114/127/114 +vt 0.550000 0.312500 +f 94/126/94 95/128/95 114/127/114 +vt 0.550000 0.350094 +f 114/127/114 95/128/95 115/129/115 +vt 0.562500 0.312500 +f 95/128/95 96/130/96 115/129/115 +vt 0.562500 0.350094 +f 115/129/115 96/130/96 116/131/116 +vt 0.575000 0.312500 +f 96/130/96 97/132/97 116/131/116 +vt 0.575000 0.350094 +f 116/131/116 97/132/97 117/133/117 +vt 0.587500 0.312500 +f 97/132/97 98/134/98 117/133/117 +vt 0.587500 0.350094 +f 117/133/117 98/134/98 118/135/118 +vt 0.600000 0.312500 +f 98/134/98 99/136/99 118/135/118 +vt 0.600000 0.350094 +f 118/135/118 99/136/99 119/137/119 +vt 0.612500 0.312500 +f 99/136/99 100/138/100 119/137/119 +vt 0.612500 0.350094 +f 119/137/119 100/138/100 120/139/120 +vt 0.625000 0.312500 +f 100/138/100 81/140/81 120/139/120 +vt 0.625000 0.350094 +f 120/139/120 81/140/81 101/141/101 +vt 0.375000 0.387688 +f 101/103/101 102/104/102 121/142/121 +vt 0.387500 0.387688 +f 121/142/121 102/104/102 122/143/122 +f 102/104/102 103/106/103 122/143/122 +vt 0.400000 0.387688 +f 122/143/122 103/106/103 123/144/123 +f 103/106/103 104/108/104 123/144/123 +vt 0.412500 0.387688 +f 123/144/123 104/108/104 124/145/124 +f 104/108/104 105/110/105 124/145/124 +vt 0.425000 0.387688 +f 124/145/124 105/110/105 125/146/125 +f 105/110/105 106/112/106 125/146/125 +vt 0.437500 0.387688 +f 125/146/125 106/112/106 126/147/126 +f 106/112/106 107/114/107 126/147/126 +vt 0.450000 0.387688 +f 126/147/126 107/114/107 127/148/127 +f 107/114/107 108/116/108 127/148/127 +vt 0.462500 0.387688 +f 127/148/127 108/116/108 128/149/128 +f 108/116/108 109/118/109 128/149/128 +vt 0.475000 0.387688 +f 128/149/128 109/118/109 129/150/129 +f 109/118/109 110/120/110 129/150/129 +vt 0.487500 0.387688 +f 129/150/129 110/120/110 130/151/130 +f 110/120/110 111/121/111 130/151/130 +vt 0.500000 0.387688 +f 130/151/130 111/121/111 131/152/131 +f 111/121/111 112/123/112 131/152/131 +vt 0.512500 0.387688 +f 131/152/131 112/123/112 132/153/132 +f 112/123/112 113/125/113 132/153/132 +vt 0.525000 0.387688 +f 132/153/132 113/125/113 133/154/133 +f 113/125/113 114/127/114 133/154/133 +vt 0.537500 0.387688 +f 133/154/133 114/127/114 134/155/134 +f 114/127/114 115/129/115 134/155/134 +vt 0.550000 0.387688 +f 134/155/134 115/129/115 135/156/135 +f 115/129/115 116/131/116 135/156/135 +vt 0.562500 0.387688 +f 135/156/135 116/131/116 136/157/136 +f 116/131/116 117/133/117 136/157/136 +vt 0.575000 0.387688 +f 136/157/136 117/133/117 137/158/137 +f 117/133/117 118/135/118 137/158/137 +vt 0.587500 0.387688 +f 137/158/137 118/135/118 138/159/138 +f 118/135/118 119/137/119 138/159/138 +vt 0.600000 0.387688 +f 138/159/138 119/137/119 139/160/139 +f 119/137/119 120/139/120 139/160/139 +vt 0.612500 0.387688 +f 139/160/139 120/139/120 140/161/140 +f 120/139/120 101/141/101 140/161/140 +vt 0.625000 0.387688 +f 140/161/140 101/141/101 121/162/121 +vt 0.375000 0.425282 +f 121/142/121 122/143/122 141/163/141 +vt 0.387500 0.425282 +f 141/163/141 122/143/122 142/164/142 +f 122/143/122 123/144/123 142/164/142 +vt 0.400000 0.425282 +f 142/164/142 123/144/123 143/165/143 +f 123/144/123 124/145/124 143/165/143 +vt 0.412500 0.425282 +f 143/165/143 124/145/124 144/166/144 +f 124/145/124 125/146/125 144/166/144 +vt 0.425000 0.425282 +f 144/166/144 125/146/125 145/167/145 +f 125/146/125 126/147/126 145/167/145 +vt 0.437500 0.425282 +f 145/167/145 126/147/126 146/168/146 +f 126/147/126 127/148/127 146/168/146 +vt 0.450000 0.425282 +f 146/168/146 127/148/127 147/169/147 +f 127/148/127 128/149/128 147/169/147 +vt 0.462500 0.425282 +f 147/169/147 128/149/128 148/170/148 +f 128/149/128 129/150/129 148/170/148 +vt 0.475000 0.425282 +f 148/170/148 129/150/129 149/171/149 +f 129/150/129 130/151/130 149/171/149 +vt 0.487500 0.425282 +f 149/171/149 130/151/130 150/172/150 +f 130/151/130 131/152/131 150/172/150 +vt 0.500000 0.425282 +f 150/172/150 131/152/131 151/173/151 +f 131/152/131 132/153/132 151/173/151 +vt 0.512500 0.425282 +f 151/173/151 132/153/132 152/174/152 +f 132/153/132 133/154/133 152/174/152 +vt 0.525000 0.425282 +f 152/174/152 133/154/133 153/175/153 +f 133/154/133 134/155/134 153/175/153 +vt 0.537500 0.425282 +f 153/175/153 134/155/134 154/176/154 +f 134/155/134 135/156/135 154/176/154 +vt 0.550000 0.425282 +f 154/176/154 135/156/135 155/177/155 +f 135/156/135 136/157/136 155/177/155 +vt 0.562500 0.425282 +f 155/177/155 136/157/136 156/178/156 +f 136/157/136 137/158/137 156/178/156 +vt 0.575000 0.425282 +f 156/178/156 137/158/137 157/179/157 +f 137/158/137 138/159/138 157/179/157 +vt 0.587500 0.425282 +f 157/179/157 138/159/138 158/180/158 +f 138/159/138 139/160/139 158/180/158 +vt 0.600000 0.425282 +f 158/180/158 139/160/139 159/181/159 +f 139/160/139 140/161/140 159/181/159 +vt 0.612500 0.425282 +f 159/181/159 140/161/140 160/182/160 +f 140/161/140 121/162/121 160/182/160 +vt 0.625000 0.425282 +f 160/182/160 121/162/121 141/183/141 +vt 0.375000 0.462876 +f 141/163/141 142/164/142 161/184/161 +vt 0.387500 0.462876 +f 161/184/161 142/164/142 162/185/162 +f 142/164/142 143/165/143 162/185/162 +vt 0.400000 0.462876 +f 162/185/162 143/165/143 163/186/163 +f 143/165/143 144/166/144 163/186/163 +vt 0.412500 0.462876 +f 163/186/163 144/166/144 164/187/164 +f 144/166/144 145/167/145 164/187/164 +vt 0.425000 0.462876 +f 164/187/164 145/167/145 165/188/165 +f 145/167/145 146/168/146 165/188/165 +vt 0.437500 0.462876 +f 165/188/165 146/168/146 166/189/166 +f 146/168/146 147/169/147 166/189/166 +vt 0.450000 0.462876 +f 166/189/166 147/169/147 167/190/167 +f 147/169/147 148/170/148 167/190/167 +vt 0.462500 0.462876 +f 167/190/167 148/170/148 168/191/168 +f 148/170/148 149/171/149 168/191/168 +vt 0.475000 0.462876 +f 168/191/168 149/171/149 169/192/169 +f 149/171/149 150/172/150 169/192/169 +vt 0.487500 0.462876 +f 169/192/169 150/172/150 170/193/170 +f 150/172/150 151/173/151 170/193/170 +vt 0.500000 0.462876 +f 170/193/170 151/173/151 171/194/171 +f 151/173/151 152/174/152 171/194/171 +vt 0.512500 0.462876 +f 171/194/171 152/174/152 172/195/172 +f 152/174/152 153/175/153 172/195/172 +vt 0.525000 0.462876 +f 172/195/172 153/175/153 173/196/173 +f 153/175/153 154/176/154 173/196/173 +vt 0.537500 0.462876 +f 173/196/173 154/176/154 174/197/174 +f 154/176/154 155/177/155 174/197/174 +vt 0.550000 0.462876 +f 174/197/174 155/177/155 175/198/175 +f 155/177/155 156/178/156 175/198/175 +vt 0.562500 0.462876 +f 175/198/175 156/178/156 176/199/176 +f 156/178/156 157/179/157 176/199/176 +vt 0.575000 0.462876 +f 176/199/176 157/179/157 177/200/177 +f 157/179/157 158/180/158 177/200/177 +vt 0.587500 0.462876 +f 177/200/177 158/180/158 178/201/178 +f 158/180/158 159/181/159 178/201/178 +vt 0.600000 0.462876 +f 178/201/178 159/181/159 179/202/179 +f 159/181/159 160/182/160 179/202/179 +vt 0.612500 0.462876 +f 179/202/179 160/182/160 180/203/180 +f 160/182/160 141/183/141 180/203/180 +vt 0.625000 0.462876 +f 180/203/180 141/183/141 161/204/161 +vt 0.375000 0.500470 +f 161/184/161 162/185/162 181/205/181 +vt 0.387500 0.500470 +f 181/205/181 162/185/162 182/206/182 +f 162/185/162 163/186/163 182/206/182 +vt 0.400000 0.500470 +f 182/206/182 163/186/163 183/207/183 +f 163/186/163 164/187/164 183/207/183 +vt 0.412500 0.500470 +f 183/207/183 164/187/164 184/208/184 +f 164/187/164 165/188/165 184/208/184 +vt 0.425000 0.500470 +f 184/208/184 165/188/165 185/209/185 +f 165/188/165 166/189/166 185/209/185 +vt 0.437500 0.500470 +f 185/209/185 166/189/166 186/210/186 +f 166/189/166 167/190/167 186/210/186 +vt 0.450000 0.500470 +f 186/210/186 167/190/167 187/211/187 +f 167/190/167 168/191/168 187/211/187 +vt 0.462500 0.500470 +f 187/211/187 168/191/168 188/212/188 +f 168/191/168 169/192/169 188/212/188 +vt 0.475000 0.500470 +f 188/212/188 169/192/169 189/213/189 +f 169/192/169 170/193/170 189/213/189 +vt 0.487500 0.500470 +f 189/213/189 170/193/170 190/214/190 +f 170/193/170 171/194/171 190/214/190 +vt 0.500000 0.500470 +f 190/214/190 171/194/171 191/215/191 +f 171/194/171 172/195/172 191/215/191 +vt 0.512500 0.500470 +f 191/215/191 172/195/172 192/216/192 +f 172/195/172 173/196/173 192/216/192 +vt 0.525000 0.500470 +f 192/216/192 173/196/173 193/217/193 +f 173/196/173 174/197/174 193/217/193 +vt 0.537500 0.500470 +f 193/217/193 174/197/174 194/218/194 +f 174/197/174 175/198/175 194/218/194 +vt 0.550000 0.500470 +f 194/218/194 175/198/175 195/219/195 +f 175/198/175 176/199/176 195/219/195 +vt 0.562500 0.500470 +f 195/219/195 176/199/176 196/220/196 +f 176/199/176 177/200/177 196/220/196 +vt 0.575000 0.500470 +f 196/220/196 177/200/177 197/221/197 +f 177/200/177 178/201/178 197/221/197 +vt 0.587500 0.500470 +f 197/221/197 178/201/178 198/222/198 +f 178/201/178 179/202/179 198/222/198 +vt 0.600000 0.500470 +f 198/222/198 179/202/179 199/223/199 +f 179/202/179 180/203/180 199/223/199 +vt 0.612500 0.500470 +f 199/223/199 180/203/180 200/224/200 +f 180/203/180 161/204/161 200/224/200 +vt 0.625000 0.500470 +f 200/224/200 161/204/161 181/225/181 +vt 0.375000 0.538064 +f 181/205/181 182/206/182 201/226/201 +vt 0.387500 0.538064 +f 201/226/201 182/206/182 202/227/202 +f 182/206/182 183/207/183 202/227/202 +vt 0.400000 0.538064 +f 202/227/202 183/207/183 203/228/203 +f 183/207/183 184/208/184 203/228/203 +vt 0.412500 0.538064 +f 203/228/203 184/208/184 204/229/204 +f 184/208/184 185/209/185 204/229/204 +vt 0.425000 0.538064 +f 204/229/204 185/209/185 205/230/205 +f 185/209/185 186/210/186 205/230/205 +vt 0.437500 0.538064 +f 205/230/205 186/210/186 206/231/206 +f 186/210/186 187/211/187 206/231/206 +vt 0.450000 0.538064 +f 206/231/206 187/211/187 207/232/207 +f 187/211/187 188/212/188 207/232/207 +vt 0.462500 0.538064 +f 207/232/207 188/212/188 208/233/208 +f 188/212/188 189/213/189 208/233/208 +vt 0.475000 0.538064 +f 208/233/208 189/213/189 209/234/209 +f 189/213/189 190/214/190 209/234/209 +vt 0.487500 0.538064 +f 209/234/209 190/214/190 210/235/210 +f 190/214/190 191/215/191 210/235/210 +vt 0.500000 0.538064 +f 210/235/210 191/215/191 211/236/211 +f 191/215/191 192/216/192 211/236/211 +vt 0.512500 0.538064 +f 211/236/211 192/216/192 212/237/212 +f 192/216/192 193/217/193 212/237/212 +vt 0.525000 0.538064 +f 212/237/212 193/217/193 213/238/213 +f 193/217/193 194/218/194 213/238/213 +vt 0.537500 0.538064 +f 213/238/213 194/218/194 214/239/214 +f 194/218/194 195/219/195 214/239/214 +vt 0.550000 0.538064 +f 214/239/214 195/219/195 215/240/215 +f 195/219/195 196/220/196 215/240/215 +vt 0.562500 0.538064 +f 215/240/215 196/220/196 216/241/216 +f 196/220/196 197/221/197 216/241/216 +vt 0.575000 0.538064 +f 216/241/216 197/221/197 217/242/217 +f 197/221/197 198/222/198 217/242/217 +vt 0.587500 0.538064 +f 217/242/217 198/222/198 218/243/218 +f 198/222/198 199/223/199 218/243/218 +vt 0.600000 0.538064 +f 218/243/218 199/223/199 219/244/219 +f 199/223/199 200/224/200 219/244/219 +vt 0.612500 0.538064 +f 219/244/219 200/224/200 220/245/220 +f 200/224/200 181/225/181 220/245/220 +vt 0.625000 0.538064 +f 220/245/220 181/225/181 201/246/201 +vt 0.375000 0.575658 +f 201/226/201 202/227/202 221/247/221 +vt 0.387500 0.575658 +f 221/247/221 202/227/202 222/248/222 +f 202/227/202 203/228/203 222/248/222 +vt 0.400000 0.575658 +f 222/248/222 203/228/203 223/249/223 +f 203/228/203 204/229/204 223/249/223 +vt 0.412500 0.575658 +f 223/249/223 204/229/204 224/250/224 +f 204/229/204 205/230/205 224/250/224 +vt 0.425000 0.575658 +f 224/250/224 205/230/205 225/251/225 +f 205/230/205 206/231/206 225/251/225 +vt 0.437500 0.575658 +f 225/251/225 206/231/206 226/252/226 +f 206/231/206 207/232/207 226/252/226 +vt 0.450000 0.575658 +f 226/252/226 207/232/207 227/253/227 +f 207/232/207 208/233/208 227/253/227 +vt 0.462500 0.575658 +f 227/253/227 208/233/208 228/254/228 +f 208/233/208 209/234/209 228/254/228 +vt 0.475000 0.575658 +f 228/254/228 209/234/209 229/255/229 +f 209/234/209 210/235/210 229/255/229 +vt 0.487500 0.575658 +f 229/255/229 210/235/210 230/256/230 +f 210/235/210 211/236/211 230/256/230 +vt 0.500000 0.575658 +f 230/256/230 211/236/211 231/257/231 +f 211/236/211 212/237/212 231/257/231 +vt 0.512500 0.575658 +f 231/257/231 212/237/212 232/258/232 +f 212/237/212 213/238/213 232/258/232 +vt 0.525000 0.575658 +f 232/258/232 213/238/213 233/259/233 +f 213/238/213 214/239/214 233/259/233 +vt 0.537500 0.575658 +f 233/259/233 214/239/214 234/260/234 +f 214/239/214 215/240/215 234/260/234 +vt 0.550000 0.575658 +f 234/260/234 215/240/215 235/261/235 +f 215/240/215 216/241/216 235/261/235 +vt 0.562500 0.575658 +f 235/261/235 216/241/216 236/262/236 +f 216/241/216 217/242/217 236/262/236 +vt 0.575000 0.575658 +f 236/262/236 217/242/217 237/263/237 +f 217/242/217 218/243/218 237/263/237 +vt 0.587500 0.575658 +f 237/263/237 218/243/218 238/264/238 +f 218/243/218 219/244/219 238/264/238 +vt 0.600000 0.575658 +f 238/264/238 219/244/219 239/265/239 +f 219/244/219 220/245/220 239/265/239 +vt 0.612500 0.575658 +f 239/265/239 220/245/220 240/266/240 +f 220/245/220 201/246/201 240/266/240 +vt 0.625000 0.575658 +f 240/266/240 201/246/201 221/267/221 +vt 0.375000 0.613252 +f 221/247/221 222/248/222 241/268/241 +vt 0.387500 0.613252 +f 241/268/241 222/248/222 242/269/242 +f 222/248/222 223/249/223 242/269/242 +vt 0.400000 0.613252 +f 242/269/242 223/249/223 243/270/243 +f 223/249/223 224/250/224 243/270/243 +vt 0.412500 0.613252 +f 243/270/243 224/250/224 244/271/244 +f 224/250/224 225/251/225 244/271/244 +vt 0.425000 0.613252 +f 244/271/244 225/251/225 245/272/245 +f 225/251/225 226/252/226 245/272/245 +vt 0.437500 0.613252 +f 245/272/245 226/252/226 246/273/246 +f 226/252/226 227/253/227 246/273/246 +vt 0.450000 0.613252 +f 246/273/246 227/253/227 247/274/247 +f 227/253/227 228/254/228 247/274/247 +vt 0.462500 0.613252 +f 247/274/247 228/254/228 248/275/248 +f 228/254/228 229/255/229 248/275/248 +vt 0.475000 0.613252 +f 248/275/248 229/255/229 249/276/249 +f 229/255/229 230/256/230 249/276/249 +vt 0.487500 0.613252 +f 249/276/249 230/256/230 250/277/250 +f 230/256/230 231/257/231 250/277/250 +vt 0.500000 0.613252 +f 250/277/250 231/257/231 251/278/251 +f 231/257/231 232/258/232 251/278/251 +vt 0.512500 0.613252 +f 251/278/251 232/258/232 252/279/252 +f 232/258/232 233/259/233 252/279/252 +vt 0.525000 0.613252 +f 252/279/252 233/259/233 253/280/253 +f 233/259/233 234/260/234 253/280/253 +vt 0.537500 0.613252 +f 253/280/253 234/260/234 254/281/254 +f 234/260/234 235/261/235 254/281/254 +vt 0.550000 0.613252 +f 254/281/254 235/261/235 255/282/255 +f 235/261/235 236/262/236 255/282/255 +vt 0.562500 0.613252 +f 255/282/255 236/262/236 256/283/256 +f 236/262/236 237/263/237 256/283/256 +vt 0.575000 0.613252 +f 256/283/256 237/263/237 257/284/257 +f 237/263/237 238/264/238 257/284/257 +vt 0.587500 0.613252 +f 257/284/257 238/264/238 258/285/258 +f 238/264/238 239/265/239 258/285/258 +vt 0.600000 0.613252 +f 258/285/258 239/265/239 259/286/259 +f 239/265/239 240/266/240 259/286/259 +vt 0.612500 0.613252 +f 259/286/259 240/266/240 260/287/260 +f 240/266/240 221/267/221 260/287/260 +vt 0.625000 0.613252 +f 260/287/260 221/267/221 241/288/241 +vt 0.375000 0.650846 +f 241/268/241 242/269/242 261/289/261 +vt 0.387500 0.650846 +f 261/289/261 242/269/242 262/290/262 +f 242/269/242 243/270/243 262/290/262 +vt 0.400000 0.650846 +f 262/290/262 243/270/243 263/291/263 +f 243/270/243 244/271/244 263/291/263 +vt 0.412500 0.650846 +f 263/291/263 244/271/244 264/292/264 +f 244/271/244 245/272/245 264/292/264 +vt 0.425000 0.650846 +f 264/292/264 245/272/245 265/293/265 +f 245/272/245 246/273/246 265/293/265 +vt 0.437500 0.650846 +f 265/293/265 246/273/246 266/294/266 +f 246/273/246 247/274/247 266/294/266 +vt 0.450000 0.650846 +f 266/294/266 247/274/247 267/295/267 +f 247/274/247 248/275/248 267/295/267 +vt 0.462500 0.650846 +f 267/295/267 248/275/248 268/296/268 +f 248/275/248 249/276/249 268/296/268 +vt 0.475000 0.650846 +f 268/296/268 249/276/249 269/297/269 +f 249/276/249 250/277/250 269/297/269 +vt 0.487500 0.650846 +f 269/297/269 250/277/250 270/298/270 +f 250/277/250 251/278/251 270/298/270 +vt 0.500000 0.650846 +f 270/298/270 251/278/251 271/299/271 +f 251/278/251 252/279/252 271/299/271 +vt 0.512500 0.650846 +f 271/299/271 252/279/252 272/300/272 +f 252/279/252 253/280/253 272/300/272 +vt 0.525000 0.650846 +f 272/300/272 253/280/253 273/301/273 +f 253/280/253 254/281/254 273/301/273 +vt 0.537500 0.650846 +f 273/301/273 254/281/254 274/302/274 +f 254/281/254 255/282/255 274/302/274 +vt 0.550000 0.650846 +f 274/302/274 255/282/255 275/303/275 +f 255/282/255 256/283/256 275/303/275 +vt 0.562500 0.650846 +f 275/303/275 256/283/256 276/304/276 +f 256/283/256 257/284/257 276/304/276 +vt 0.575000 0.650846 +f 276/304/276 257/284/257 277/305/277 +f 257/284/257 258/285/258 277/305/277 +vt 0.587500 0.650846 +f 277/305/277 258/285/258 278/306/278 +f 258/285/258 259/286/259 278/306/278 +vt 0.600000 0.650846 +f 278/306/278 259/286/259 279/307/279 +f 259/286/259 260/287/260 279/307/279 +vt 0.612500 0.650846 +f 279/307/279 260/287/260 280/308/280 +f 260/287/260 241/288/241 280/308/280 +vt 0.625000 0.650846 +f 280/308/280 241/288/241 261/309/261 +vt 0.375000 0.688440 +f 261/289/261 262/290/262 281/310/281 +vt 0.387500 0.688440 +f 281/310/281 262/290/262 282/311/282 +f 262/290/262 263/291/263 282/311/282 +vt 0.400000 0.688440 +f 282/311/282 263/291/263 283/312/283 +f 263/291/263 264/292/264 283/312/283 +vt 0.412500 0.688440 +f 283/312/283 264/292/264 284/313/284 +f 264/292/264 265/293/265 284/313/284 +vt 0.425000 0.688440 +f 284/313/284 265/293/265 285/314/285 +f 265/293/265 266/294/266 285/314/285 +vt 0.437500 0.688440 +f 285/314/285 266/294/266 286/315/286 +f 266/294/266 267/295/267 286/315/286 +vt 0.450000 0.688440 +f 286/315/286 267/295/267 287/316/287 +f 267/295/267 268/296/268 287/316/287 +vt 0.462500 0.688440 +f 287/316/287 268/296/268 288/317/288 +f 268/296/268 269/297/269 288/317/288 +vt 0.475000 0.688440 +f 288/317/288 269/297/269 289/318/289 +f 269/297/269 270/298/270 289/318/289 +vt 0.487500 0.688440 +f 289/318/289 270/298/270 290/319/290 +f 270/298/270 271/299/271 290/319/290 +vt 0.500000 0.688440 +f 290/319/290 271/299/271 291/320/291 +f 271/299/271 272/300/272 291/320/291 +vt 0.512500 0.688440 +f 291/320/291 272/300/272 292/321/292 +f 272/300/272 273/301/273 292/321/292 +vt 0.525000 0.688440 +f 292/321/292 273/301/273 293/322/293 +f 273/301/273 274/302/274 293/322/293 +vt 0.537500 0.688440 +f 293/322/293 274/302/274 294/323/294 +f 274/302/274 275/303/275 294/323/294 +vt 0.550000 0.688440 +f 294/323/294 275/303/275 295/324/295 +f 275/303/275 276/304/276 295/324/295 +vt 0.562500 0.688440 +f 295/324/295 276/304/276 296/325/296 +f 276/304/276 277/305/277 296/325/296 +vt 0.575000 0.688440 +f 296/325/296 277/305/277 297/326/297 +f 277/305/277 278/306/278 297/326/297 +vt 0.587500 0.688440 +f 297/326/297 278/306/278 298/327/298 +f 278/306/278 279/307/279 298/327/298 +vt 0.600000 0.688440 +f 298/327/298 279/307/279 299/328/299 +f 279/307/279 280/308/280 299/328/299 +vt 0.612500 0.688440 +f 299/328/299 280/308/280 300/329/300 +f 280/308/280 261/309/261 300/329/300 +vt 0.625000 0.688440 +f 300/329/300 261/309/261 281/330/281 +vt 0.648603 0.892034 +vt 0.626409 0.935591 +vt 0.618882 0.882377 +f 281/331/281 282/332/282 301/333/301 +vt 0.601127 0.917223 +f 301/333/301 282/332/282 302/334/302 +vt 0.591841 0.970159 +f 282/332/282 283/335/283 302/334/302 +vt 0.573473 0.944877 +f 302/334/302 283/335/283 303/336/303 +vt 0.548284 0.992353 +f 283/335/283 284/337/284 303/336/303 +vt 0.538627 0.962632 +f 303/336/303 284/337/284 304/338/304 +vt 0.500000 1.000000 +f 284/337/284 285/339/285 304/338/304 +vt 0.500000 0.968750 +f 304/338/304 285/339/285 305/340/305 +vt 0.451716 0.992353 +f 285/339/285 286/341/286 305/340/305 +vt 0.461373 0.962632 +f 305/340/305 286/341/286 306/342/306 +vt 0.408159 0.970159 +f 286/341/286 287/343/287 306/342/306 +vt 0.426527 0.944877 +f 306/342/306 287/343/287 307/344/307 +vt 0.373591 0.935591 +f 287/343/287 288/345/288 307/344/307 +vt 0.398873 0.917223 +f 307/344/307 288/345/288 308/346/308 +vt 0.351397 0.892034 +f 288/345/288 289/347/289 308/346/308 +vt 0.381118 0.882377 +f 308/346/308 289/347/289 309/348/309 +vt 0.343750 0.843750 +f 289/347/289 290/349/290 309/348/309 +vt 0.375000 0.843750 +f 309/348/309 290/349/290 310/350/310 +vt 0.351397 0.795466 +f 290/349/290 291/351/291 310/350/310 +vt 0.381118 0.805123 +f 310/350/310 291/351/291 311/352/311 +vt 0.373591 0.751909 +f 291/351/291 292/353/292 311/352/311 +vt 0.398873 0.770277 +f 311/352/311 292/353/292 312/354/312 +vt 0.408159 0.717341 +f 292/353/292 293/355/293 312/354/312 +vt 0.426527 0.742623 +f 312/354/312 293/355/293 313/356/313 +vt 0.451716 0.695147 +f 293/355/293 294/357/294 313/356/313 +vt 0.461373 0.724868 +f 313/356/313 294/357/294 314/358/314 +vt 0.500000 0.687500 +f 294/357/294 295/359/295 314/358/314 +vt 0.500000 0.718750 +f 314/358/314 295/359/295 315/360/315 +vt 0.548284 0.695147 +f 295/359/295 296/361/296 315/360/315 +vt 0.538627 0.724868 +f 315/360/315 296/361/296 316/362/316 +vt 0.591842 0.717341 +f 296/361/296 297/363/297 316/362/316 +vt 0.573473 0.742623 +f 316/362/316 297/363/297 317/364/317 +vt 0.626409 0.751908 +f 297/363/297 298/365/298 317/364/317 +vt 0.601127 0.770277 +f 317/364/317 298/365/298 318/366/318 +vt 0.648603 0.795466 +f 298/365/298 299/367/299 318/366/318 +vt 0.618882 0.805123 +f 318/366/318 299/367/299 319/368/319 +vt 0.656250 0.843750 +f 299/367/299 300/369/300 319/368/319 +vt 0.625000 0.843750 +f 319/368/319 300/369/300 320/370/320 +f 300/369/300 281/331/281 320/370/320 +f 320/370/320 281/331/281 301/333/301 +vt 0.589162 0.872720 +f 301/333/301 302/334/302 321/371/321 +vt 0.575845 0.898855 +f 321/371/321 302/334/302 322/372/322 +f 302/334/302 303/336/303 322/372/322 +vt 0.555105 0.919595 +f 322/372/322 303/336/303 323/373/323 +f 303/336/303 304/338/304 323/373/323 +vt 0.528970 0.932912 +f 323/373/323 304/338/304 324/374/324 +f 304/338/304 305/340/305 324/374/324 +vt 0.500000 0.937500 +f 324/374/324 305/340/305 325/375/325 +f 305/340/305 306/342/306 325/375/325 +vt 0.471030 0.932912 +f 325/375/325 306/342/306 326/376/326 +f 306/342/306 307/344/307 326/376/326 +vt 0.444895 0.919595 +f 326/376/326 307/344/307 327/377/327 +f 307/344/307 308/346/308 327/377/327 +vt 0.424155 0.898855 +f 327/377/327 308/346/308 328/378/328 +f 308/346/308 309/348/309 328/378/328 +vt 0.410838 0.872720 +f 328/378/328 309/348/309 329/379/329 +f 309/348/309 310/350/310 329/379/329 +vt 0.406250 0.843750 +f 329/379/329 310/350/310 330/380/330 +f 310/350/310 311/352/311 330/380/330 +vt 0.410838 0.814780 +f 330/380/330 311/352/311 331/381/331 +f 311/352/311 312/354/312 331/381/331 +vt 0.424155 0.788645 +f 331/381/331 312/354/312 332/382/332 +f 312/354/312 313/356/313 332/382/332 +vt 0.444895 0.767905 +f 332/382/332 313/356/313 333/383/333 +f 313/356/313 314/358/314 333/383/333 +vt 0.471030 0.754588 +f 333/383/333 314/358/314 334/384/334 +f 314/358/314 315/360/315 334/384/334 +vt 0.500000 0.750000 +f 334/384/334 315/360/315 335/385/335 +f 315/360/315 316/362/316 335/385/335 +vt 0.528970 0.754588 +f 335/385/335 316/362/316 336/386/336 +f 316/362/316 317/364/317 336/386/336 +vt 0.555105 0.767905 +f 336/386/336 317/364/317 337/387/337 +f 317/364/317 318/366/318 337/387/337 +vt 0.575845 0.788645 +f 337/387/337 318/366/318 338/388/338 +f 318/366/318 319/368/319 338/388/338 +vt 0.589162 0.814780 +f 338/388/338 319/368/319 339/389/339 +f 319/368/319 320/370/320 339/389/339 +vt 0.593750 0.843750 +f 339/389/339 320/370/320 340/390/340 +f 320/370/320 301/333/301 340/390/340 +f 340/390/340 301/333/301 321/371/321 +vt 0.559441 0.863064 +f 321/371/321 322/372/322 341/391/341 +vt 0.550564 0.880487 +f 341/391/341 322/372/322 342/392/342 +f 322/372/322 323/373/323 342/392/342 +vt 0.536737 0.894314 +f 342/392/342 323/373/323 343/393/343 +f 323/373/323 324/374/324 343/393/343 +vt 0.519314 0.903191 +f 343/393/343 324/374/324 344/394/344 +f 324/374/324 325/375/325 344/394/344 +vt 0.500000 0.906250 +f 344/394/344 325/375/325 345/395/345 +f 325/375/325 326/376/326 345/395/345 +vt 0.480686 0.903191 +f 345/395/345 326/376/326 346/396/346 +f 326/376/326 327/377/327 346/396/346 +vt 0.463263 0.894314 +f 346/396/346 327/377/327 347/397/347 +f 327/377/327 328/378/328 347/397/347 +vt 0.449436 0.880487 +f 347/397/347 328/378/328 348/398/348 +f 328/378/328 329/379/329 348/398/348 +vt 0.440559 0.863064 +f 348/398/348 329/379/329 349/399/349 +f 329/379/329 330/380/330 349/399/349 +vt 0.437500 0.843750 +f 349/399/349 330/380/330 350/400/350 +f 330/380/330 331/381/331 350/400/350 +vt 0.440559 0.824436 +f 350/400/350 331/381/331 351/401/351 +f 331/381/331 332/382/332 351/401/351 +vt 0.449436 0.807013 +f 351/401/351 332/382/332 352/402/352 +f 332/382/332 333/383/333 352/402/352 +vt 0.463263 0.793186 +f 352/402/352 333/383/333 353/403/353 +f 333/383/333 334/384/334 353/403/353 +vt 0.480686 0.784309 +f 353/403/353 334/384/334 354/404/354 +f 334/384/334 335/385/335 354/404/354 +vt 0.500000 0.781250 +f 354/404/354 335/385/335 355/405/355 +f 335/385/335 336/386/336 355/405/355 +vt 0.519314 0.784309 +f 355/405/355 336/386/336 356/406/356 +f 336/386/336 337/387/337 356/406/356 +vt 0.536737 0.793186 +f 356/406/356 337/387/337 357/407/357 +f 337/387/337 338/388/338 357/407/357 +vt 0.550564 0.807013 +f 357/407/357 338/388/338 358/408/358 +f 338/388/338 339/389/339 358/408/358 +vt 0.559441 0.824436 +f 358/408/358 339/389/339 359/409/359 +f 339/389/339 340/390/340 359/409/359 +vt 0.562500 0.843750 +f 359/409/359 340/390/340 360/410/360 +f 340/390/340 321/371/321 360/410/360 +f 360/410/360 321/371/321 341/391/341 +vt 0.529721 0.853407 +f 341/391/341 342/392/342 361/411/361 +vt 0.525282 0.862118 +f 361/411/361 342/392/342 362/412/362 +f 342/392/342 343/393/343 362/412/362 +vt 0.518368 0.869032 +f 362/412/362 343/393/343 363/413/363 +f 343/393/343 344/394/344 363/413/363 +vt 0.509657 0.873471 +f 363/413/363 344/394/344 364/414/364 +f 344/394/344 345/395/345 364/414/364 +vt 0.500000 0.875000 +f 364/414/364 345/395/345 365/415/365 +f 345/395/345 346/396/346 365/415/365 +vt 0.490343 0.873471 +f 365/415/365 346/396/346 366/416/366 +f 346/396/346 347/397/347 366/416/366 +vt 0.481632 0.869032 +f 366/416/366 347/397/347 367/417/367 +f 347/397/347 348/398/348 367/417/367 +vt 0.474718 0.862118 +f 367/417/367 348/398/348 368/418/368 +f 348/398/348 349/399/349 368/418/368 +vt 0.470279 0.853407 +f 368/418/368 349/399/349 369/419/369 +f 349/399/349 350/400/350 369/419/369 +vt 0.468750 0.843750 +f 369/419/369 350/400/350 370/420/370 +f 350/400/350 351/401/351 370/420/370 +vt 0.470279 0.834093 +f 370/420/370 351/401/351 371/421/371 +f 351/401/351 352/402/352 371/421/371 +vt 0.474718 0.825382 +f 371/421/371 352/402/352 372/422/372 +f 352/402/352 353/403/353 372/422/372 +vt 0.481632 0.818468 +f 372/422/372 353/403/353 373/423/373 +f 353/403/353 354/404/354 373/423/373 +vt 0.490343 0.814029 +f 373/423/373 354/404/354 374/424/374 +f 354/404/354 355/405/355 374/424/374 +vt 0.500000 0.812500 +f 374/424/374 355/405/355 375/425/375 +f 355/405/355 356/406/356 375/425/375 +vt 0.509657 0.814029 +f 375/425/375 356/406/356 376/426/376 +f 356/406/356 357/407/357 376/426/376 +vt 0.518368 0.818468 +f 376/426/376 357/407/357 377/427/377 +f 357/407/357 358/408/358 377/427/377 +vt 0.525282 0.825382 +f 377/427/377 358/408/358 378/428/378 +f 358/408/358 359/409/359 378/428/378 +vt 0.529721 0.834093 +f 378/428/378 359/409/359 379/429/379 +f 359/409/359 360/410/360 379/429/379 +vt 0.531250 0.843750 +f 379/429/379 360/410/360 380/430/380 +f 360/410/360 341/391/341 380/430/380 +f 380/430/380 341/391/341 361/411/361 +vt 0.500000 0.150000 +f 2/2/2 1/1/1 381/431/381 +f 3/5/3 2/2/2 381/431/381 +f 4/7/4 3/5/3 381/431/381 +f 5/9/5 4/7/4 381/431/381 +f 6/11/6 5/9/5 381/431/381 +f 7/13/7 6/11/6 381/431/381 +f 8/15/8 7/13/7 381/431/381 +f 9/17/9 8/15/8 381/431/381 +f 10/19/10 9/17/9 381/431/381 +f 11/21/11 10/19/10 381/431/381 +f 12/23/12 11/21/11 381/431/381 +f 13/25/13 12/23/12 381/431/381 +f 14/27/14 13/25/13 381/431/381 +f 15/29/15 14/27/14 381/431/381 +f 16/31/16 15/29/15 381/431/381 +f 17/33/17 16/31/16 381/431/381 +f 18/35/18 17/33/17 381/431/381 +f 19/37/19 18/35/18 381/431/381 +f 20/39/20 19/37/19 381/431/381 +f 1/1/1 20/39/20 381/431/381 +vt 0.500000 0.837500 +f 361/411/361 362/412/362 382/432/382 +f 362/412/362 363/413/363 382/432/382 +f 363/413/363 364/414/364 382/432/382 +f 364/414/364 365/415/365 382/432/382 +f 365/415/365 366/416/366 382/432/382 +f 366/416/366 367/417/367 382/432/382 +f 367/417/367 368/418/368 382/432/382 +f 368/418/368 369/419/369 382/432/382 +f 369/419/369 370/420/370 382/432/382 +f 370/420/370 371/421/371 382/432/382 +f 371/421/371 372/422/372 382/432/382 +f 372/422/372 373/423/373 382/432/382 +f 373/423/373 374/424/374 382/432/382 +f 374/424/374 375/425/375 382/432/382 +f 375/425/375 376/426/376 382/432/382 +f 376/426/376 377/427/377 382/432/382 +f 377/427/377 378/428/378 382/432/382 +f 378/428/378 379/429/379 382/432/382 +f 379/429/379 380/430/380 382/432/382 +f 380/430/380 361/411/361 382/432/382 +# 760 faces, 432 coords texture + +# End of File \ No newline at end of file diff --git a/data/models/sphere.obj b/data/models/sphere.obj index a3e93aa1..ad6c7376 100644 --- a/data/models/sphere.obj +++ b/data/models/sphere.obj @@ -1963,3929 +1963,3 @@ f 377/395/377 378/396/378 382/436/382 f 378/396/378 379/397/379 382/437/382 f 379/397/379 380/398/380 382/438/382 f 380/398/380 361/399/361 382/439/382 -v 0.148778 -0.987688 -0.048341 -v 0.126558 -0.987688 -0.091950 -v 0.091950 -0.987688 -0.126558 -v 0.048341 -0.987688 -0.148778 -v 0.000000 -0.987688 -0.156435 -v -0.048341 -0.987688 -0.148778 -v -0.091950 -0.987688 -0.126558 -v -0.126558 -0.987688 -0.091950 -v -0.148778 -0.987688 -0.048341 -v -0.156435 -0.987688 0.000000 -v -0.148778 -0.987688 0.048341 -v -0.126558 -0.987688 0.091950 -v -0.091950 -0.987688 0.126558 -v -0.048341 -0.987688 0.148778 -v -0.000000 -0.987688 0.156434 -v 0.048341 -0.987688 0.148778 -v 0.091950 -0.987688 0.126558 -v 0.126558 -0.987688 0.091950 -v 0.148778 -0.987688 0.048341 -v 0.156434 -0.987688 0.000000 -v 0.293893 -0.951057 -0.095492 -v 0.250000 -0.951057 -0.181636 -v 0.181636 -0.951057 -0.250000 -v 0.095492 -0.951057 -0.293893 -v 0.000000 -0.951057 -0.309017 -v -0.095492 -0.951057 -0.293893 -v -0.181636 -0.951057 -0.250000 -v -0.250000 -0.951057 -0.181636 -v -0.293893 -0.951057 -0.095492 -v -0.309017 -0.951057 0.000000 -v -0.293893 -0.951057 0.095492 -v -0.250000 -0.951057 0.181636 -v -0.181636 -0.951057 0.250000 -v -0.095492 -0.951057 0.293893 -v -0.000000 -0.951057 0.309017 -v 0.095491 -0.951057 0.293893 -v 0.181636 -0.951057 0.250000 -v 0.250000 -0.951057 0.181636 -v 0.293893 -0.951057 0.095492 -v 0.309017 -0.951057 0.000000 -v 0.431771 -0.891007 -0.140291 -v 0.367286 -0.891007 -0.266849 -v 0.266849 -0.891007 -0.367286 -v 0.140291 -0.891007 -0.431771 -v 0.000000 -0.891007 -0.453991 -v -0.140291 -0.891007 -0.431771 -v -0.266849 -0.891007 -0.367286 -v -0.367286 -0.891007 -0.266849 -v -0.431771 -0.891007 -0.140291 -v -0.453991 -0.891007 0.000000 -v -0.431771 -0.891007 0.140291 -v -0.367286 -0.891007 0.266849 -v -0.266849 -0.891007 0.367286 -v -0.140291 -0.891007 0.431771 -v -0.000000 -0.891007 0.453991 -v 0.140291 -0.891007 0.431771 -v 0.266849 -0.891007 0.367286 -v 0.367286 -0.891007 0.266849 -v 0.431771 -0.891007 0.140291 -v 0.453991 -0.891007 0.000000 -v 0.559017 -0.809017 -0.181636 -v 0.475529 -0.809017 -0.345492 -v 0.345492 -0.809017 -0.475529 -v 0.181636 -0.809017 -0.559017 -v 0.000000 -0.809017 -0.587786 -v -0.181636 -0.809017 -0.559017 -v -0.345492 -0.809017 -0.475528 -v -0.475528 -0.809017 -0.345492 -v -0.559017 -0.809017 -0.181636 -v -0.587785 -0.809017 0.000000 -v -0.559017 -0.809017 0.181636 -v -0.475528 -0.809017 0.345492 -v -0.345492 -0.809017 0.475528 -v -0.181636 -0.809017 0.559017 -v -0.000000 -0.809017 0.587785 -v 0.181636 -0.809017 0.559017 -v 0.345491 -0.809017 0.475528 -v 0.475528 -0.809017 0.345492 -v 0.559017 -0.809017 0.181636 -v 0.587785 -0.809017 0.000000 -v 0.672499 -0.707107 -0.218508 -v 0.572062 -0.707107 -0.415627 -v 0.415627 -0.707107 -0.572062 -v 0.218508 -0.707107 -0.672499 -v 0.000000 -0.707107 -0.707107 -v -0.218508 -0.707107 -0.672499 -v -0.415627 -0.707107 -0.572062 -v -0.572062 -0.707107 -0.415627 -v -0.672499 -0.707107 -0.218508 -v -0.707107 -0.707107 0.000000 -v -0.672499 -0.707107 0.218508 -v -0.572062 -0.707107 0.415627 -v -0.415627 -0.707107 0.572061 -v -0.218508 -0.707107 0.672499 -v -0.000000 -0.707107 0.707107 -v 0.218508 -0.707107 0.672499 -v 0.415627 -0.707107 0.572061 -v 0.572061 -0.707107 0.415627 -v 0.672499 -0.707107 0.218508 -v 0.707107 -0.707107 0.000000 -v 0.769421 -0.587785 -0.250000 -v 0.654509 -0.587785 -0.475529 -v 0.475529 -0.587785 -0.654509 -v 0.250000 -0.587785 -0.769421 -v 0.000000 -0.587785 -0.809017 -v -0.250000 -0.587785 -0.769421 -v -0.475528 -0.587785 -0.654509 -v -0.654509 -0.587785 -0.475528 -v -0.769421 -0.587785 -0.250000 -v -0.809017 -0.587785 0.000000 -v -0.769421 -0.587785 0.250000 -v -0.654509 -0.587785 0.475528 -v -0.475528 -0.587785 0.654509 -v -0.250000 -0.587785 0.769421 -v -0.000000 -0.587785 0.809017 -v 0.250000 -0.587785 0.769421 -v 0.475528 -0.587785 0.654509 -v 0.654509 -0.587785 0.475528 -v 0.769421 -0.587785 0.250000 -v 0.809017 -0.587785 0.000000 -v 0.847398 -0.453991 -0.275336 -v 0.720840 -0.453991 -0.523721 -v 0.523721 -0.453991 -0.720840 -v 0.275336 -0.453991 -0.847398 -v 0.000000 -0.453991 -0.891007 -v -0.275336 -0.453991 -0.847398 -v -0.523721 -0.453991 -0.720840 -v -0.720840 -0.453991 -0.523721 -v -0.847398 -0.453991 -0.275336 -v -0.891007 -0.453991 0.000000 -v -0.847398 -0.453991 0.275336 -v -0.720840 -0.453991 0.523721 -v -0.523721 -0.453991 0.720840 -v -0.275336 -0.453991 0.847398 -v -0.000000 -0.453991 0.891007 -v 0.275336 -0.453991 0.847398 -v 0.523721 -0.453991 0.720840 -v 0.720839 -0.453991 0.523721 -v 0.847398 -0.453991 0.275336 -v 0.891007 -0.453991 0.000000 -v 0.904509 -0.309017 -0.293893 -v 0.769421 -0.309017 -0.559017 -v 0.559017 -0.309017 -0.769421 -v 0.293893 -0.309017 -0.904509 -v 0.000000 -0.309017 -0.951057 -v -0.293893 -0.309017 -0.904509 -v -0.559017 -0.309017 -0.769421 -v -0.769421 -0.309017 -0.559017 -v -0.904509 -0.309017 -0.293893 -v -0.951057 -0.309017 0.000000 -v -0.904509 -0.309017 0.293893 -v -0.769421 -0.309017 0.559017 -v -0.559017 -0.309017 0.769421 -v -0.293893 -0.309017 0.904509 -v -0.000000 -0.309017 0.951057 -v 0.293893 -0.309017 0.904509 -v 0.559017 -0.309017 0.769421 -v 0.769421 -0.309017 0.559017 -v 0.904509 -0.309017 0.293893 -v 0.951057 -0.309017 0.000000 -v 0.939348 -0.156434 -0.305213 -v 0.799057 -0.156434 -0.580549 -v 0.580549 -0.156434 -0.799057 -v 0.305213 -0.156434 -0.939348 -v 0.000000 -0.156434 -0.987689 -v -0.305213 -0.156434 -0.939348 -v -0.580549 -0.156434 -0.799057 -v -0.799057 -0.156434 -0.580549 -v -0.939348 -0.156434 -0.305213 -v -0.987689 -0.156434 0.000000 -v -0.939348 -0.156434 0.305213 -v -0.799057 -0.156434 0.580549 -v -0.580549 -0.156434 0.799057 -v -0.305213 -0.156434 0.939348 -v -0.000000 -0.156434 0.987688 -v 0.305212 -0.156434 0.939348 -v 0.580549 -0.156434 0.799057 -v 0.799057 -0.156434 0.580549 -v 0.939348 -0.156434 0.305212 -v 0.987688 -0.156434 0.000000 -v 0.951057 0.000000 -0.309017 -v 0.809018 0.000000 -0.587786 -v 0.587786 0.000000 -0.809017 -v 0.309017 0.000000 -0.951057 -v 0.000000 0.000000 -1.000000 -v -0.309017 0.000000 -0.951057 -v -0.587785 0.000000 -0.809017 -v -0.809017 0.000000 -0.587785 -v -0.951057 0.000000 -0.309017 -v -1.000000 0.000000 0.000000 -v -0.951057 0.000000 0.309017 -v -0.809017 0.000000 0.587785 -v -0.587785 0.000000 0.809017 -v -0.309017 0.000000 0.951057 -v -0.000000 0.000000 1.000000 -v 0.309017 0.000000 0.951057 -v 0.587785 0.000000 0.809017 -v 0.809017 0.000000 0.587785 -v 0.951057 0.000000 0.309017 -v 1.000000 0.000000 0.000000 -v 0.939348 0.156434 -0.305213 -v 0.799057 0.156434 -0.580549 -v 0.580549 0.156434 -0.799057 -v 0.305213 0.156434 -0.939348 -v 0.000000 0.156434 -0.987689 -v -0.305213 0.156434 -0.939348 -v -0.580549 0.156434 -0.799057 -v -0.799057 0.156434 -0.580549 -v -0.939348 0.156434 -0.305213 -v -0.987689 0.156434 0.000000 -v -0.939348 0.156434 0.305213 -v -0.799057 0.156434 0.580549 -v -0.580549 0.156434 0.799057 -v -0.305213 0.156434 0.939348 -v -0.000000 0.156434 0.987688 -v 0.305212 0.156434 0.939348 -v 0.580549 0.156434 0.799057 -v 0.799057 0.156434 0.580549 -v 0.939348 0.156434 0.305212 -v 0.987688 0.156434 0.000000 -v 0.904509 0.309017 -0.293893 -v 0.769421 0.309017 -0.559017 -v 0.559017 0.309017 -0.769421 -v 0.293893 0.309017 -0.904509 -v 0.000000 0.309017 -0.951057 -v -0.293893 0.309017 -0.904509 -v -0.559017 0.309017 -0.769421 -v -0.769421 0.309017 -0.559017 -v -0.904509 0.309017 -0.293893 -v -0.951057 0.309017 0.000000 -v -0.904509 0.309017 0.293893 -v -0.769421 0.309017 0.559017 -v -0.559017 0.309017 0.769421 -v -0.293893 0.309017 0.904509 -v -0.000000 0.309017 0.951057 -v 0.293893 0.309017 0.904509 -v 0.559017 0.309017 0.769421 -v 0.769421 0.309017 0.559017 -v 0.904509 0.309017 0.293893 -v 0.951057 0.309017 0.000000 -v 0.847398 0.453991 -0.275336 -v 0.720840 0.453991 -0.523721 -v 0.523721 0.453991 -0.720840 -v 0.275336 0.453991 -0.847398 -v 0.000000 0.453991 -0.891007 -v -0.275336 0.453991 -0.847398 -v -0.523721 0.453991 -0.720840 -v -0.720840 0.453991 -0.523721 -v -0.847398 0.453991 -0.275336 -v -0.891007 0.453991 0.000000 -v -0.847398 0.453991 0.275336 -v -0.720840 0.453991 0.523721 -v -0.523721 0.453991 0.720840 -v -0.275336 0.453991 0.847398 -v -0.000000 0.453991 0.891007 -v 0.275336 0.453991 0.847398 -v 0.523721 0.453991 0.720840 -v 0.720839 0.453991 0.523721 -v 0.847398 0.453991 0.275336 -v 0.891007 0.453991 0.000000 -v 0.769421 0.587785 -0.250000 -v 0.654509 0.587785 -0.475529 -v 0.475529 0.587785 -0.654509 -v 0.250000 0.587785 -0.769421 -v 0.000000 0.587785 -0.809017 -v -0.250000 0.587785 -0.769421 -v -0.475528 0.587785 -0.654509 -v -0.654509 0.587785 -0.475528 -v -0.769421 0.587785 -0.250000 -v -0.809017 0.587785 0.000000 -v -0.769421 0.587785 0.250000 -v -0.654509 0.587785 0.475528 -v -0.475528 0.587785 0.654509 -v -0.250000 0.587785 0.769421 -v -0.000000 0.587785 0.809017 -v 0.250000 0.587785 0.769421 -v 0.475528 0.587785 0.654509 -v 0.654509 0.587785 0.475528 -v 0.769421 0.587785 0.250000 -v 0.809017 0.587785 0.000000 -v 0.672499 0.707107 -0.218508 -v 0.572062 0.707107 -0.415627 -v 0.415627 0.707107 -0.572062 -v 0.218508 0.707107 -0.672499 -v 0.000000 0.707107 -0.707107 -v -0.218508 0.707107 -0.672499 -v -0.415627 0.707107 -0.572062 -v -0.572062 0.707107 -0.415627 -v -0.672499 0.707107 -0.218508 -v -0.707107 0.707107 0.000000 -v -0.672499 0.707107 0.218508 -v -0.572062 0.707107 0.415627 -v -0.415627 0.707107 0.572061 -v -0.218508 0.707107 0.672499 -v -0.000000 0.707107 0.707107 -v 0.218508 0.707107 0.672499 -v 0.415627 0.707107 0.572061 -v 0.572061 0.707107 0.415627 -v 0.672499 0.707107 0.218508 -v 0.707107 0.707107 0.000000 -v 0.559017 0.809017 -0.181636 -v 0.475529 0.809017 -0.345492 -v 0.345492 0.809017 -0.475529 -v 0.181636 0.809017 -0.559017 -v 0.000000 0.809017 -0.587786 -v -0.181636 0.809017 -0.559017 -v -0.345492 0.809017 -0.475528 -v -0.475528 0.809017 -0.345492 -v -0.559017 0.809017 -0.181636 -v -0.587785 0.809017 0.000000 -v -0.559017 0.809017 0.181636 -v -0.475528 0.809017 0.345492 -v -0.345492 0.809017 0.475528 -v -0.181636 0.809017 0.559017 -v -0.000000 0.809017 0.587785 -v 0.181636 0.809017 0.559017 -v 0.345491 0.809017 0.475528 -v 0.475528 0.809017 0.345492 -v 0.559017 0.809017 0.181636 -v 0.587785 0.809017 0.000000 -v 0.431771 0.891007 -0.140291 -v 0.367286 0.891007 -0.266849 -v 0.266849 0.891007 -0.367286 -v 0.140291 0.891007 -0.431771 -v 0.000000 0.891007 -0.453991 -v -0.140291 0.891007 -0.431771 -v -0.266849 0.891007 -0.367286 -v -0.367286 0.891007 -0.266849 -v -0.431771 0.891007 -0.140291 -v -0.453991 0.891007 0.000000 -v -0.431771 0.891007 0.140291 -v -0.367286 0.891007 0.266849 -v -0.266849 0.891007 0.367286 -v -0.140291 0.891007 0.431771 -v -0.000000 0.891007 0.453991 -v 0.140291 0.891007 0.431771 -v 0.266849 0.891007 0.367286 -v 0.367286 0.891007 0.266849 -v 0.431771 0.891007 0.140291 -v 0.453991 0.891007 0.000000 -v 0.293893 0.951057 -0.095492 -v 0.250000 0.951057 -0.181636 -v 0.181636 0.951057 -0.250000 -v 0.095492 0.951057 -0.293893 -v 0.000000 0.951057 -0.309017 -v -0.095492 0.951057 -0.293893 -v -0.181636 0.951057 -0.250000 -v -0.250000 0.951057 -0.181636 -v -0.293893 0.951057 -0.095492 -v -0.309017 0.951057 0.000000 -v -0.293893 0.951057 0.095492 -v -0.250000 0.951057 0.181636 -v -0.181636 0.951057 0.250000 -v -0.095492 0.951057 0.293893 -v -0.000000 0.951057 0.309017 -v 0.095491 0.951057 0.293893 -v 0.181636 0.951057 0.250000 -v 0.250000 0.951057 0.181636 -v 0.293893 0.951057 0.095492 -v 0.309017 0.951057 0.000000 -v 0.148778 0.987688 -0.048341 -v 0.126558 0.987688 -0.091950 -v 0.091950 0.987688 -0.126558 -v 0.048341 0.987688 -0.148778 -v 0.000000 0.987688 -0.156435 -v -0.048341 0.987688 -0.148778 -v -0.091950 0.987688 -0.126558 -v -0.126558 0.987688 -0.091950 -v -0.148778 0.987688 -0.048341 -v -0.156435 0.987688 0.000000 -v -0.148778 0.987688 0.048341 -v -0.126558 0.987688 0.091950 -v -0.091950 0.987688 0.126558 -v -0.048341 0.987688 0.148778 -v -0.000000 0.987688 0.156434 -v 0.048341 0.987688 0.148778 -v 0.091950 0.987688 0.126558 -v 0.126558 0.987688 0.091950 -v 0.148778 0.987688 0.048341 -v 0.156434 0.987688 0.000000 -v 0.000000 -1.000000 0.000000 -v 0.000000 1.000000 0.000000 -vt 0.000000 0.050000 -vt 0.050000 0.050000 -vt 0.100000 0.050000 -vt 0.150000 0.050000 -vt 0.200000 0.050000 -vt 0.250000 0.050000 -vt 0.300000 0.050000 -vt 0.350000 0.050000 -vt 0.400000 0.050000 -vt 0.450000 0.050000 -vt 0.500000 0.050000 -vt 0.550000 0.050000 -vt 0.600000 0.050000 -vt 0.650000 0.050000 -vt 0.700000 0.050000 -vt 0.750000 0.050000 -vt 0.800000 0.050000 -vt 0.850000 0.050000 -vt 0.900000 0.050000 -vt 0.950000 0.050000 -vt 1.000000 0.050000 -vt 0.000000 0.100000 -vt 0.050000 0.100000 -vt 0.100000 0.100000 -vt 0.150000 0.100000 -vt 0.200000 0.100000 -vt 0.250000 0.100000 -vt 0.300000 0.100000 -vt 0.350000 0.100000 -vt 0.400000 0.100000 -vt 0.450000 0.100000 -vt 0.500000 0.100000 -vt 0.550000 0.100000 -vt 0.600000 0.100000 -vt 0.650000 0.100000 -vt 0.700000 0.100000 -vt 0.750000 0.100000 -vt 0.800000 0.100000 -vt 0.850000 0.100000 -vt 0.900000 0.100000 -vt 0.950000 0.100000 -vt 1.000000 0.100000 -vt 0.000000 0.150000 -vt 0.050000 0.150000 -vt 0.100000 0.150000 -vt 0.150000 0.150000 -vt 0.200000 0.150000 -vt 0.250000 0.150000 -vt 0.300000 0.150000 -vt 0.350000 0.150000 -vt 0.400000 0.150000 -vt 0.450000 0.150000 -vt 0.500000 0.150000 -vt 0.550000 0.150000 -vt 0.600000 0.150000 -vt 0.650000 0.150000 -vt 0.700000 0.150000 -vt 0.750000 0.150000 -vt 0.800000 0.150000 -vt 0.850000 0.150000 -vt 0.900000 0.150000 -vt 0.950000 0.150000 -vt 1.000000 0.150000 -vt 0.000000 0.200000 -vt 0.050000 0.200000 -vt 0.100000 0.200000 -vt 0.150000 0.200000 -vt 0.200000 0.200000 -vt 0.250000 0.200000 -vt 0.300000 0.200000 -vt 0.350000 0.200000 -vt 0.400000 0.200000 -vt 0.450000 0.200000 -vt 0.500000 0.200000 -vt 0.550000 0.200000 -vt 0.600000 0.200000 -vt 0.650000 0.200000 -vt 0.700000 0.200000 -vt 0.750000 0.200000 -vt 0.800000 0.200000 -vt 0.850000 0.200000 -vt 0.900000 0.200000 -vt 0.950000 0.200000 -vt 1.000000 0.200000 -vt 0.000000 0.250000 -vt 0.050000 0.250000 -vt 0.100000 0.250000 -vt 0.150000 0.250000 -vt 0.200000 0.250000 -vt 0.250000 0.250000 -vt 0.300000 0.250000 -vt 0.350000 0.250000 -vt 0.400000 0.250000 -vt 0.450000 0.250000 -vt 0.500000 0.250000 -vt 0.550000 0.250000 -vt 0.600000 0.250000 -vt 0.650000 0.250000 -vt 0.700000 0.250000 -vt 0.750000 0.250000 -vt 0.800000 0.250000 -vt 0.850000 0.250000 -vt 0.900000 0.250000 -vt 0.950000 0.250000 -vt 1.000000 0.250000 -vt 0.000000 0.300000 -vt 0.050000 0.300000 -vt 0.100000 0.300000 -vt 0.150000 0.300000 -vt 0.200000 0.300000 -vt 0.250000 0.300000 -vt 0.300000 0.300000 -vt 0.350000 0.300000 -vt 0.400000 0.300000 -vt 0.450000 0.300000 -vt 0.500000 0.300000 -vt 0.550000 0.300000 -vt 0.600000 0.300000 -vt 0.650000 0.300000 -vt 0.700000 0.300000 -vt 0.750000 0.300000 -vt 0.800000 0.300000 -vt 0.850000 0.300000 -vt 0.900000 0.300000 -vt 0.950000 0.300000 -vt 1.000000 0.300000 -vt 0.000000 0.350000 -vt 0.050000 0.350000 -vt 0.100000 0.350000 -vt 0.150000 0.350000 -vt 0.200000 0.350000 -vt 0.250000 0.350000 -vt 0.300000 0.350000 -vt 0.350000 0.350000 -vt 0.400000 0.350000 -vt 0.450000 0.350000 -vt 0.500000 0.350000 -vt 0.550000 0.350000 -vt 0.600000 0.350000 -vt 0.650000 0.350000 -vt 0.700000 0.350000 -vt 0.750000 0.350000 -vt 0.800000 0.350000 -vt 0.850000 0.350000 -vt 0.900000 0.350000 -vt 0.950000 0.350000 -vt 1.000000 0.350000 -vt 0.000000 0.400000 -vt 0.050000 0.400000 -vt 0.100000 0.400000 -vt 0.150000 0.400000 -vt 0.200000 0.400000 -vt 0.250000 0.400000 -vt 0.300000 0.400000 -vt 0.350000 0.400000 -vt 0.400000 0.400000 -vt 0.450000 0.400000 -vt 0.500000 0.400000 -vt 0.550000 0.400000 -vt 0.600000 0.400000 -vt 0.650000 0.400000 -vt 0.700000 0.400000 -vt 0.750000 0.400000 -vt 0.800000 0.400000 -vt 0.850000 0.400000 -vt 0.900000 0.400000 -vt 0.950000 0.400000 -vt 1.000000 0.400000 -vt 0.000000 0.450000 -vt 0.050000 0.450000 -vt 0.100000 0.450000 -vt 0.150000 0.450000 -vt 0.200000 0.450000 -vt 0.250000 0.450000 -vt 0.300000 0.450000 -vt 0.350000 0.450000 -vt 0.400000 0.450000 -vt 0.450000 0.450000 -vt 0.500000 0.450000 -vt 0.550000 0.450000 -vt 0.600000 0.450000 -vt 0.650000 0.450000 -vt 0.700000 0.450000 -vt 0.750000 0.450000 -vt 0.800000 0.450000 -vt 0.850000 0.450000 -vt 0.900000 0.450000 -vt 0.950000 0.450000 -vt 1.000000 0.450000 -vt 0.000000 0.500000 -vt 0.050000 0.500000 -vt 0.100000 0.500000 -vt 0.150000 0.500000 -vt 0.200000 0.500000 -vt 0.250000 0.500000 -vt 0.300000 0.500000 -vt 0.350000 0.500000 -vt 0.400000 0.500000 -vt 0.450000 0.500000 -vt 0.500000 0.500000 -vt 0.550000 0.500000 -vt 0.600000 0.500000 -vt 0.650000 0.500000 -vt 0.700000 0.500000 -vt 0.750000 0.500000 -vt 0.800000 0.500000 -vt 0.850000 0.500000 -vt 0.900000 0.500000 -vt 0.950000 0.500000 -vt 1.000000 0.500000 -vt 0.000000 0.550000 -vt 0.050000 0.550000 -vt 0.100000 0.550000 -vt 0.150000 0.550000 -vt 0.200000 0.550000 -vt 0.250000 0.550000 -vt 0.300000 0.550000 -vt 0.350000 0.550000 -vt 0.400000 0.550000 -vt 0.450000 0.550000 -vt 0.500000 0.550000 -vt 0.550000 0.550000 -vt 0.600000 0.550000 -vt 0.650000 0.550000 -vt 0.700000 0.550000 -vt 0.750000 0.550000 -vt 0.800000 0.550000 -vt 0.850000 0.550000 -vt 0.900000 0.550000 -vt 0.950000 0.550000 -vt 1.000000 0.550000 -vt 0.000000 0.600000 -vt 0.050000 0.600000 -vt 0.100000 0.600000 -vt 0.150000 0.600000 -vt 0.200000 0.600000 -vt 0.250000 0.600000 -vt 0.300000 0.600000 -vt 0.350000 0.600000 -vt 0.400000 0.600000 -vt 0.450000 0.600000 -vt 0.500000 0.600000 -vt 0.550000 0.600000 -vt 0.600000 0.600000 -vt 0.650000 0.600000 -vt 0.700000 0.600000 -vt 0.750000 0.600000 -vt 0.800000 0.600000 -vt 0.850000 0.600000 -vt 0.900000 0.600000 -vt 0.950000 0.600000 -vt 1.000000 0.600000 -vt 0.000000 0.650000 -vt 0.050000 0.650000 -vt 0.100000 0.650000 -vt 0.150000 0.650000 -vt 0.200000 0.650000 -vt 0.250000 0.650000 -vt 0.300000 0.650000 -vt 0.350000 0.650000 -vt 0.400000 0.650000 -vt 0.450000 0.650000 -vt 0.500000 0.650000 -vt 0.550000 0.650000 -vt 0.600000 0.650000 -vt 0.650000 0.650000 -vt 0.700000 0.650000 -vt 0.750000 0.650000 -vt 0.800000 0.650000 -vt 0.850000 0.650000 -vt 0.900000 0.650000 -vt 0.950000 0.650000 -vt 1.000000 0.650000 -vt 0.000000 0.700000 -vt 0.050000 0.700000 -vt 0.100000 0.700000 -vt 0.150000 0.700000 -vt 0.200000 0.700000 -vt 0.250000 0.700000 -vt 0.300000 0.700000 -vt 0.350000 0.700000 -vt 0.400000 0.700000 -vt 0.450000 0.700000 -vt 0.500000 0.700000 -vt 0.550000 0.700000 -vt 0.600000 0.700000 -vt 0.650000 0.700000 -vt 0.700000 0.700000 -vt 0.750000 0.700000 -vt 0.800000 0.700000 -vt 0.850000 0.700000 -vt 0.900000 0.700000 -vt 0.950000 0.700000 -vt 1.000000 0.700000 -vt 0.000000 0.750000 -vt 0.050000 0.750000 -vt 0.100000 0.750000 -vt 0.150000 0.750000 -vt 0.200000 0.750000 -vt 0.250000 0.750000 -vt 0.300000 0.750000 -vt 0.350000 0.750000 -vt 0.400000 0.750000 -vt 0.450000 0.750000 -vt 0.500000 0.750000 -vt 0.550000 0.750000 -vt 0.600000 0.750000 -vt 0.650000 0.750000 -vt 0.700000 0.750000 -vt 0.750000 0.750000 -vt 0.800000 0.750000 -vt 0.850000 0.750000 -vt 0.900000 0.750000 -vt 0.950000 0.750000 -vt 1.000000 0.750000 -vt 0.000000 0.800000 -vt 0.050000 0.800000 -vt 0.100000 0.800000 -vt 0.150000 0.800000 -vt 0.200000 0.800000 -vt 0.250000 0.800000 -vt 0.300000 0.800000 -vt 0.350000 0.800000 -vt 0.400000 0.800000 -vt 0.450000 0.800000 -vt 0.500000 0.800000 -vt 0.550000 0.800000 -vt 0.600000 0.800000 -vt 0.650000 0.800000 -vt 0.700000 0.800000 -vt 0.750000 0.800000 -vt 0.800000 0.800000 -vt 0.850000 0.800000 -vt 0.900000 0.800000 -vt 0.950000 0.800000 -vt 1.000000 0.800000 -vt 0.000000 0.850000 -vt 0.050000 0.850000 -vt 0.100000 0.850000 -vt 0.150000 0.850000 -vt 0.200000 0.850000 -vt 0.250000 0.850000 -vt 0.300000 0.850000 -vt 0.350000 0.850000 -vt 0.400000 0.850000 -vt 0.450000 0.850000 -vt 0.500000 0.850000 -vt 0.550000 0.850000 -vt 0.600000 0.850000 -vt 0.650000 0.850000 -vt 0.700000 0.850000 -vt 0.750000 0.850000 -vt 0.800000 0.850000 -vt 0.850000 0.850000 -vt 0.900000 0.850000 -vt 0.950000 0.850000 -vt 1.000000 0.850000 -vt 0.000000 0.900000 -vt 0.050000 0.900000 -vt 0.100000 0.900000 -vt 0.150000 0.900000 -vt 0.200000 0.900000 -vt 0.250000 0.900000 -vt 0.300000 0.900000 -vt 0.350000 0.900000 -vt 0.400000 0.900000 -vt 0.450000 0.900000 -vt 0.500000 0.900000 -vt 0.550000 0.900000 -vt 0.600000 0.900000 -vt 0.650000 0.900000 -vt 0.700000 0.900000 -vt 0.750000 0.900000 -vt 0.800000 0.900000 -vt 0.850000 0.900000 -vt 0.900000 0.900000 -vt 0.950000 0.900000 -vt 1.000000 0.900000 -vt 0.000000 0.950000 -vt 0.050000 0.950000 -vt 0.100000 0.950000 -vt 0.150000 0.950000 -vt 0.200000 0.950000 -vt 0.250000 0.950000 -vt 0.300000 0.950000 -vt 0.350000 0.950000 -vt 0.400000 0.950000 -vt 0.450000 0.950000 -vt 0.500000 0.950000 -vt 0.550000 0.950000 -vt 0.600000 0.950000 -vt 0.650000 0.950000 -vt 0.700000 0.950000 -vt 0.750000 0.950000 -vt 0.800000 0.950000 -vt 0.850000 0.950000 -vt 0.900000 0.950000 -vt 0.950000 0.950000 -vt 1.000000 0.950000 -vt 0.025000 0.000000 -vt 0.075000 0.000000 -vt 0.125000 0.000000 -vt 0.175000 0.000000 -vt 0.225000 0.000000 -vt 0.275000 0.000000 -vt 0.325000 0.000000 -vt 0.375000 0.000000 -vt 0.425000 0.000000 -vt 0.475000 0.000000 -vt 0.525000 0.000000 -vt 0.575000 0.000000 -vt 0.625000 0.000000 -vt 0.675000 0.000000 -vt 0.725000 0.000000 -vt 0.775000 0.000000 -vt 0.825000 0.000000 -vt 0.875000 0.000000 -vt 0.925000 0.000000 -vt 0.975000 0.000000 -vt 0.025000 1.000000 -vt 0.075000 1.000000 -vt 0.125000 1.000000 -vt 0.175000 1.000000 -vt 0.225000 1.000000 -vt 0.275000 1.000000 -vt 0.325000 1.000000 -vt 0.375000 1.000000 -vt 0.425000 1.000000 -vt 0.475000 1.000000 -vt 0.525000 1.000000 -vt 0.575000 1.000000 -vt 0.625000 1.000000 -vt 0.675000 1.000000 -vt 0.725000 1.000000 -vt 0.775000 1.000000 -vt 0.825000 1.000000 -vt 0.875000 1.000000 -vt 0.925000 1.000000 -vt 0.975000 1.000000 -vn 0.162626 -0.985443 -0.049557 -vn 0.139353 -0.985443 -0.097386 -vn 0.307374 -0.946801 -0.095332 -vn 0.262871 -0.946801 -0.185651 -vn 0.102439 -0.985443 -0.135681 -vn 0.192636 -0.946801 -0.257796 -vn 0.055497 -0.985443 -0.160696 -vn 0.103544 -0.946801 -0.304706 -vn 0.003123 -0.985443 -0.169981 -vn 0.004317 -0.946801 -0.321789 -vn -0.049557 -0.985442 -0.162626 -vn -0.095333 -0.946801 -0.307374 -vn -0.097386 -0.985442 -0.139353 -vn -0.185651 -0.946801 -0.262871 -vn -0.135682 -0.985443 -0.102439 -vn -0.257796 -0.946801 -0.192635 -vn -0.160696 -0.985443 -0.055497 -vn -0.304706 -0.946801 -0.103544 -vn -0.169981 -0.985443 -0.003123 -vn -0.321790 -0.946801 -0.004318 -vn -0.162626 -0.985443 0.049556 -vn -0.307374 -0.946801 0.095333 -vn -0.139353 -0.985443 0.097384 -vn -0.262871 -0.946801 0.185651 -vn -0.102439 -0.985443 0.135680 -vn -0.192636 -0.946801 0.257796 -vn -0.055497 -0.985442 0.160696 -vn -0.103544 -0.946801 0.304707 -vn -0.003123 -0.985443 0.169981 -vn -0.004317 -0.946802 0.321789 -vn 0.049557 -0.985442 0.162627 -vn 0.095333 -0.946801 0.307374 -vn 0.097386 -0.985442 0.139354 -vn 0.185651 -0.946801 0.262871 -vn 0.135682 -0.985442 0.102439 -vn 0.257796 -0.946801 0.192636 -vn 0.160696 -0.985443 0.055497 -vn 0.304706 -0.946801 0.103544 -vn 0.169981 -0.985443 0.003123 -vn 0.321790 -0.946801 0.004317 -vn 0.443773 -0.885332 -0.138754 -vn 0.379175 -0.885332 -0.269096 -vn 0.277462 -0.885332 -0.373097 -vn 0.148589 -0.885333 -0.440577 -vn 0.005170 -0.885332 -0.464930 -vn -0.138754 -0.885332 -0.443773 -vn -0.269096 -0.885332 -0.379175 -vn -0.373097 -0.885332 -0.277462 -vn -0.440577 -0.885332 -0.148589 -vn -0.464930 -0.885332 -0.005171 -vn -0.443773 -0.885332 0.138754 -vn -0.379176 -0.885332 0.269096 -vn -0.277462 -0.885332 0.373097 -vn -0.148589 -0.885332 0.440577 -vn -0.005170 -0.885332 0.464930 -vn 0.138754 -0.885332 0.443773 -vn 0.269096 -0.885332 0.379176 -vn 0.373097 -0.885332 0.277462 -vn 0.440577 -0.885332 0.148589 -vn 0.464930 -0.885332 0.005171 -vn 0.569006 -0.802583 -0.179146 -vn 0.485797 -0.802583 -0.346211 -vn 0.355036 -0.802583 -0.479386 -vn 0.189521 -0.802583 -0.565635 -vn 0.005454 -0.802583 -0.596516 -vn -0.179147 -0.802583 -0.569006 -vn -0.346211 -0.802583 -0.485797 -vn -0.479386 -0.802583 -0.355036 -vn -0.565635 -0.802583 -0.189521 -vn -0.596516 -0.802583 -0.005454 -vn -0.569006 -0.802583 0.179146 -vn -0.485798 -0.802583 0.346211 -vn -0.355036 -0.802583 0.479386 -vn -0.189521 -0.802583 0.565635 -vn -0.005454 -0.802583 0.596516 -vn 0.179146 -0.802583 0.569006 -vn 0.346211 -0.802582 0.485798 -vn 0.479386 -0.802583 0.355036 -vn 0.565635 -0.802583 0.189521 -vn 0.596516 -0.802583 0.005455 -vn 0.680269 -0.700559 -0.215525 -vn 0.580373 -0.700559 -0.415192 -vn 0.423666 -0.700559 -0.574216 -vn 0.225488 -0.700559 -0.677032 -vn 0.005237 -0.700559 -0.713576 -vn -0.215526 -0.700559 -0.680269 -vn -0.415192 -0.700559 -0.580373 -vn -0.574217 -0.700559 -0.423666 -vn -0.677032 -0.700559 -0.225488 -vn -0.713576 -0.700559 -0.005237 -vn -0.680269 -0.700559 0.215526 -vn -0.580373 -0.700559 0.415192 -vn -0.423666 -0.700559 0.574217 -vn -0.225488 -0.700559 0.677033 -vn -0.005237 -0.700559 0.713576 -vn 0.215526 -0.700559 0.680269 -vn 0.415192 -0.700559 0.580373 -vn 0.574217 -0.700559 0.423666 -vn 0.677032 -0.700559 0.225488 -vn 0.713576 -0.700558 0.005238 -vn 0.774995 -0.581722 -0.246947 -vn 0.660752 -0.581722 -0.474348 -vn 0.481831 -0.581722 -0.655315 -vn 0.255745 -0.581722 -0.772136 -vn 0.004625 -0.581722 -0.813375 -vn -0.246948 -0.581722 -0.774994 -vn -0.474348 -0.581722 -0.660752 -vn -0.655315 -0.581722 -0.481831 -vn -0.772136 -0.581722 -0.255745 -vn -0.813375 -0.581722 -0.004625 -vn -0.774994 -0.581722 0.246948 -vn -0.660752 -0.581722 0.474348 -vn -0.481831 -0.581722 0.655315 -vn -0.255745 -0.581722 0.772136 -vn -0.004625 -0.581722 0.813375 -vn 0.246948 -0.581722 0.774995 -vn 0.474348 -0.581722 0.660753 -vn 0.655315 -0.581722 0.481832 -vn 0.772136 -0.581722 0.255745 -vn 0.813375 -0.581722 0.004626 -vn 0.850971 -0.448937 -0.272589 -vn 0.725086 -0.448937 -0.522213 -vn 0.528225 -0.448937 -0.720718 -vn 0.279658 -0.448937 -0.848674 -vn 0.003715 -0.448937 -0.893556 -vn -0.272590 -0.448937 -0.850970 -vn -0.522213 -0.448937 -0.725085 -vn -0.720718 -0.448937 -0.528225 -vn -0.848674 -0.448937 -0.279657 -vn -0.893556 -0.448937 -0.003716 -vn -0.850970 -0.448937 0.272590 -vn -0.725086 -0.448937 0.522213 -vn -0.528225 -0.448937 0.720718 -vn -0.279658 -0.448937 0.848674 -vn -0.003716 -0.448937 0.893556 -vn 0.272590 -0.448937 0.850970 -vn 0.522213 -0.448937 0.725086 -vn 0.720718 -0.448937 0.528225 -vn 0.848674 -0.448937 0.279658 -vn 0.893556 -0.448937 0.003716 -vn 0.906418 -0.305397 -0.291786 -vn 0.771887 -0.305397 -0.557605 -vn 0.561799 -0.305397 -0.768840 -vn 0.296718 -0.305397 -0.904815 -vn 0.002592 -0.305397 -0.952222 -vn -0.291788 -0.305397 -0.906417 -vn -0.557605 -0.305397 -0.771887 -vn -0.768840 -0.305397 -0.561799 -vn -0.904816 -0.305397 -0.296718 -vn -0.952222 -0.305397 -0.002592 -vn -0.906418 -0.305397 0.291787 -vn -0.771887 -0.305397 0.557605 -vn -0.561799 -0.305397 0.768840 -vn -0.296718 -0.305397 0.904816 -vn -0.002592 -0.305397 0.952222 -vn 0.291787 -0.305397 0.906418 -vn 0.557605 -0.305397 0.771887 -vn 0.768840 -0.305397 0.561799 -vn 0.904816 -0.305397 0.296718 -vn 0.952222 -0.305397 0.002593 -vn 0.940040 -0.154547 -0.304038 -vn 0.800078 -0.154547 -0.579647 -vn 0.581799 -0.154547 -0.798515 -vn 0.306569 -0.154547 -0.939218 -vn 0.001330 -0.154547 -0.987985 -vn -0.304039 -0.154547 -0.940040 -vn -0.579647 -0.154547 -0.800078 -vn -0.798515 -0.154547 -0.581799 -vn -0.939218 -0.154547 -0.306569 -vn -0.987985 -0.154547 -0.001330 -vn -0.940040 -0.154547 0.304039 -vn -0.800078 -0.154547 0.579647 -vn -0.581799 -0.154547 0.798514 -vn -0.306569 -0.154547 0.939218 -vn -0.001330 -0.154547 0.987985 -vn 0.304039 -0.154547 0.940040 -vn 0.579647 -0.154547 0.800078 -vn 0.798514 -0.154547 0.581799 -vn 0.939218 -0.154547 0.306569 -vn 0.987985 -0.154547 0.001331 -vn 0.951057 -0.000000 -0.309016 -vn 0.809017 0.000000 -0.587785 -vn 0.587785 0.000000 -0.809017 -vn 0.309017 -0.000000 -0.951057 -vn -0.000000 0.000000 -1.000000 -vn -0.309017 0.000000 -0.951057 -vn -0.587785 -0.000000 -0.809017 -vn -0.809017 -0.000000 -0.587785 -vn -0.951057 0.000000 -0.309017 -vn -1.000000 0.000000 0.000000 -vn -0.951057 0.000000 0.309017 -vn -0.809017 0.000000 0.587785 -vn -0.587785 0.000000 0.809017 -vn -0.309017 0.000000 0.951057 -vn 0.000000 0.000000 1.000000 -vn 0.309017 0.000000 0.951057 -vn 0.587785 -0.000000 0.809017 -vn 0.809017 0.000000 0.587785 -vn 0.951057 -0.000000 0.309017 -vn 1.000000 0.000000 0.000001 -vn 0.939218 0.154547 -0.306568 -vn 0.798514 0.154548 -0.581799 -vn 0.579647 0.154547 -0.800078 -vn 0.304039 0.154547 -0.940040 -vn -0.001330 0.154547 -0.987985 -vn -0.306569 0.154547 -0.939218 -vn -0.581799 0.154547 -0.798514 -vn -0.800078 0.154547 -0.579646 -vn -0.940040 0.154547 -0.304039 -vn -0.987985 0.154547 0.001330 -vn -0.939218 0.154547 0.306569 -vn -0.798514 0.154547 0.581799 -vn -0.579646 0.154547 0.800078 -vn -0.304039 0.154547 0.940040 -vn 0.001330 0.154547 0.987985 -vn 0.306569 0.154547 0.939218 -vn 0.581799 0.154547 0.798514 -vn 0.800078 0.154547 0.579647 -vn 0.940040 0.154547 0.304039 -vn 0.987984 0.154547 -0.001329 -vn 0.904816 0.305397 -0.296717 -vn 0.768840 0.305397 -0.561799 -vn 0.557605 0.305397 -0.771887 -vn 0.291787 0.305397 -0.906418 -vn -0.002592 0.305397 -0.952222 -vn -0.296718 0.305397 -0.904815 -vn -0.561799 0.305397 -0.768840 -vn -0.771887 0.305397 -0.557604 -vn -0.906417 0.305397 -0.291787 -vn -0.952222 0.305397 0.002592 -vn -0.904816 0.305397 0.296718 -vn -0.768840 0.305397 0.561799 -vn -0.557605 0.305397 0.771887 -vn -0.291787 0.305397 0.906418 -vn 0.002592 0.305397 0.952222 -vn 0.296718 0.305397 0.904816 -vn 0.561799 0.305397 0.768840 -vn 0.771887 0.305397 0.557605 -vn 0.906418 0.305397 0.291787 -vn 0.952222 0.305397 -0.002591 -vn 0.848674 0.448937 -0.279657 -vn 0.720718 0.448937 -0.528225 -vn 0.522213 0.448937 -0.725086 -vn 0.272590 0.448937 -0.850970 -vn -0.003716 0.448937 -0.893556 -vn -0.279658 0.448937 -0.848674 -vn -0.528225 0.448937 -0.720718 -vn -0.725086 0.448937 -0.522213 -vn -0.850970 0.448937 -0.272590 -vn -0.893556 0.448937 0.003716 -vn -0.848674 0.448937 0.279658 -vn -0.720718 0.448937 0.528225 -vn -0.522213 0.448937 0.725086 -vn -0.272590 0.448937 0.850970 -vn 0.003716 0.448937 0.893556 -vn 0.279658 0.448937 0.848674 -vn 0.528225 0.448937 0.720718 -vn 0.725086 0.448937 0.522213 -vn 0.850970 0.448937 0.272590 -vn 0.893556 0.448937 -0.003715 -vn 0.772136 0.581722 -0.255745 -vn 0.655315 0.581722 -0.481832 -vn 0.474347 0.581722 -0.660752 -vn 0.246948 0.581722 -0.774994 -vn -0.004625 0.581722 -0.813375 -vn -0.255746 0.581722 -0.772136 -vn -0.481832 0.581722 -0.655315 -vn -0.660753 0.581722 -0.474348 -vn -0.774994 0.581722 -0.246948 -vn -0.813375 0.581722 0.004625 -vn -0.772136 0.581722 0.255745 -vn -0.655315 0.581722 0.481832 -vn -0.474347 0.581722 0.660753 -vn -0.246948 0.581722 0.774995 -vn 0.004625 0.581722 0.813375 -vn 0.255746 0.581722 0.772136 -vn 0.481831 0.581722 0.655315 -vn 0.660752 0.581722 0.474348 -vn 0.774994 0.581722 0.246948 -vn 0.813375 0.581722 -0.004624 -vn 0.677033 0.700559 -0.225487 -vn 0.574216 0.700559 -0.423666 -vn 0.415192 0.700559 -0.580373 -vn 0.215526 0.700559 -0.680269 -vn -0.005237 0.700559 -0.713576 -vn -0.225488 0.700559 -0.677032 -vn -0.423666 0.700559 -0.574216 -vn -0.580373 0.700559 -0.415192 -vn -0.680269 0.700559 -0.215526 -vn -0.713576 0.700559 0.005237 -vn -0.677032 0.700559 0.225488 -vn -0.574217 0.700558 0.423666 -vn -0.415192 0.700559 0.580373 -vn -0.215526 0.700559 0.680269 -vn 0.005237 0.700559 0.713576 -vn 0.225488 0.700559 0.677032 -vn 0.423666 0.700559 0.574216 -vn 0.580373 0.700559 0.415192 -vn 0.680269 0.700559 0.215526 -vn 0.713576 0.700559 -0.005236 -vn 0.565635 0.802583 -0.189520 -vn 0.479385 0.802583 -0.355036 -vn 0.346211 0.802583 -0.485798 -vn 0.179146 0.802583 -0.569006 -vn -0.005454 0.802583 -0.596516 -vn -0.189521 0.802583 -0.565635 -vn -0.355036 0.802583 -0.479386 -vn -0.485798 0.802583 -0.346211 -vn -0.569006 0.802583 -0.179146 -vn -0.596516 0.802583 0.005454 -vn -0.565635 0.802583 0.189521 -vn -0.479386 0.802583 0.355036 -vn -0.346211 0.802583 0.485798 -vn -0.179146 0.802583 0.569006 -vn 0.005454 0.802583 0.596516 -vn 0.189521 0.802583 0.565635 -vn 0.355036 0.802583 0.479386 -vn 0.485798 0.802583 0.346211 -vn 0.569006 0.802583 0.179146 -vn 0.596516 0.802583 -0.005454 -vn 0.440577 0.885332 -0.148588 -vn 0.373097 0.885332 -0.277462 -vn 0.269096 0.885332 -0.379176 -vn 0.138754 0.885332 -0.443772 -vn -0.005171 0.885332 -0.464930 -vn -0.148589 0.885332 -0.440577 -vn -0.277462 0.885332 -0.373097 -vn -0.379176 0.885332 -0.269096 -vn -0.443773 0.885332 -0.138754 -vn -0.464930 0.885332 0.005170 -vn -0.440577 0.885332 0.148588 -vn -0.373097 0.885332 0.277462 -vn -0.269096 0.885332 0.379176 -vn -0.138754 0.885332 0.443773 -vn 0.005171 0.885332 0.464930 -vn 0.148589 0.885332 0.440577 -vn 0.277462 0.885332 0.373097 -vn 0.379176 0.885332 0.269096 -vn 0.443773 0.885332 0.138754 -vn 0.464930 0.885332 -0.005170 -vn 0.304706 0.946801 -0.103544 -vn 0.257796 0.946801 -0.192636 -vn 0.185651 0.946801 -0.262871 -vn 0.095333 0.946801 -0.307374 -vn -0.004317 0.946801 -0.321789 -vn -0.103544 0.946801 -0.304706 -vn -0.192636 0.946801 -0.257796 -vn -0.262871 0.946801 -0.185651 -vn -0.307374 0.946801 -0.095333 -vn -0.321790 0.946801 0.004317 -vn -0.304706 0.946801 0.103544 -vn -0.257796 0.946801 0.192636 -vn -0.185651 0.946801 0.262871 -vn -0.095333 0.946801 0.307374 -vn 0.004317 0.946801 0.321789 -vn 0.103544 0.946801 0.304706 -vn 0.192636 0.946801 0.257796 -vn 0.262871 0.946801 0.185651 -vn 0.307374 0.946801 0.095333 -vn 0.321790 0.946801 -0.004317 -vn 0.160696 0.985443 -0.055497 -vn 0.135682 0.985443 -0.102438 -vn 0.097386 0.985443 -0.139352 -vn 0.049557 0.985442 -0.162627 -vn -0.003123 0.985443 -0.169981 -vn -0.055497 0.985443 -0.160696 -vn -0.102439 0.985443 -0.135680 -vn -0.139353 0.985443 -0.097384 -vn -0.162626 0.985443 -0.049557 -vn -0.169981 0.985442 0.003123 -vn -0.160696 0.985442 0.055497 -vn -0.135682 0.985442 0.102439 -vn -0.097386 0.985442 0.139353 -vn -0.049557 0.985443 0.162627 -vn 0.003123 0.985442 0.169981 -vn 0.055497 0.985443 0.160696 -vn 0.102439 0.985443 0.135680 -vn 0.139353 0.985443 0.097385 -vn 0.162626 0.985443 0.049557 -vn 0.169981 0.985443 -0.003123 -vn -0.000000 -1.000000 -0.000000 -vn -0.000000 1.000000 0.000000 -f 383/440/383 384/441/384 403/461/385 -f 403/461/385 384/441/384 404/462/386 -f 384/441/384 385/442/387 404/462/386 -f 404/462/386 385/442/387 405/463/388 -f 385/442/387 386/443/389 405/463/388 -f 405/463/388 386/443/389 406/464/390 -f 386/443/389 387/444/391 406/464/390 -f 406/464/390 387/444/391 407/465/392 -f 387/444/391 388/445/393 407/465/392 -f 407/465/392 388/445/393 408/466/394 -f 388/445/393 389/446/395 408/466/394 -f 408/466/394 389/446/395 409/467/396 -f 389/446/395 390/447/397 409/467/396 -f 409/467/396 390/447/397 410/468/398 -f 390/447/397 391/448/399 410/468/398 -f 410/468/398 391/448/399 411/469/400 -f 391/448/399 392/449/401 411/469/400 -f 411/469/400 392/449/401 412/470/402 -f 392/449/401 393/450/403 412/470/402 -f 412/470/402 393/450/403 413/471/404 -f 393/450/403 394/451/405 413/471/404 -f 413/471/404 394/451/405 414/472/406 -f 394/451/405 395/452/407 414/472/406 -f 414/472/406 395/452/407 415/473/408 -f 395/452/407 396/453/409 415/473/408 -f 415/473/408 396/453/409 416/474/410 -f 396/453/409 397/454/411 416/474/410 -f 416/474/410 397/454/411 417/475/412 -f 397/454/411 398/455/413 417/475/412 -f 417/475/412 398/455/413 418/476/414 -f 398/455/413 399/456/415 418/476/414 -f 418/476/414 399/456/415 419/477/416 -f 399/456/415 400/457/417 419/477/416 -f 419/477/416 400/457/417 420/478/418 -f 400/457/417 401/458/419 420/478/418 -f 420/478/418 401/458/419 421/479/420 -f 401/458/419 402/459/421 421/479/420 -f 421/479/420 402/459/421 422/480/422 -f 402/459/421 383/460/383 422/480/422 -f 422/480/422 383/460/383 403/481/385 -f 403/461/385 404/462/386 423/482/423 -f 423/482/423 404/462/386 424/483/424 -f 404/462/386 405/463/388 424/483/424 -f 424/483/424 405/463/388 425/484/425 -f 405/463/388 406/464/390 425/484/425 -f 425/484/425 406/464/390 426/485/426 -f 406/464/390 407/465/392 426/485/426 -f 426/485/426 407/465/392 427/486/427 -f 407/465/392 408/466/394 427/486/427 -f 427/486/427 408/466/394 428/487/428 -f 408/466/394 409/467/396 428/487/428 -f 428/487/428 409/467/396 429/488/429 -f 409/467/396 410/468/398 429/488/429 -f 429/488/429 410/468/398 430/489/430 -f 410/468/398 411/469/400 430/489/430 -f 430/489/430 411/469/400 431/490/431 -f 411/469/400 412/470/402 431/490/431 -f 431/490/431 412/470/402 432/491/432 -f 412/470/402 413/471/404 432/491/432 -f 432/491/432 413/471/404 433/492/433 -f 413/471/404 414/472/406 433/492/433 -f 433/492/433 414/472/406 434/493/434 -f 414/472/406 415/473/408 434/493/434 -f 434/493/434 415/473/408 435/494/435 -f 415/473/408 416/474/410 435/494/435 -f 435/494/435 416/474/410 436/495/436 -f 416/474/410 417/475/412 436/495/436 -f 436/495/436 417/475/412 437/496/437 -f 417/475/412 418/476/414 437/496/437 -f 437/496/437 418/476/414 438/497/438 -f 418/476/414 419/477/416 438/497/438 -f 438/497/438 419/477/416 439/498/439 -f 419/477/416 420/478/418 439/498/439 -f 439/498/439 420/478/418 440/499/440 -f 420/478/418 421/479/420 440/499/440 -f 440/499/440 421/479/420 441/500/441 -f 421/479/420 422/480/422 441/500/441 -f 441/500/441 422/480/422 442/501/442 -f 422/480/422 403/481/385 442/501/442 -f 442/501/442 403/481/385 423/502/423 -f 423/482/423 424/483/424 443/503/443 -f 443/503/443 424/483/424 444/504/444 -f 424/483/424 425/484/425 444/504/444 -f 444/504/444 425/484/425 445/505/445 -f 425/484/425 426/485/426 445/505/445 -f 445/505/445 426/485/426 446/506/446 -f 426/485/426 427/486/427 446/506/446 -f 446/506/446 427/486/427 447/507/447 -f 427/486/427 428/487/428 447/507/447 -f 447/507/447 428/487/428 448/508/448 -f 428/487/428 429/488/429 448/508/448 -f 448/508/448 429/488/429 449/509/449 -f 429/488/429 430/489/430 449/509/449 -f 449/509/449 430/489/430 450/510/450 -f 430/489/430 431/490/431 450/510/450 -f 450/510/450 431/490/431 451/511/451 -f 431/490/431 432/491/432 451/511/451 -f 451/511/451 432/491/432 452/512/452 -f 432/491/432 433/492/433 452/512/452 -f 452/512/452 433/492/433 453/513/453 -f 433/492/433 434/493/434 453/513/453 -f 453/513/453 434/493/434 454/514/454 -f 434/493/434 435/494/435 454/514/454 -f 454/514/454 435/494/435 455/515/455 -f 435/494/435 436/495/436 455/515/455 -f 455/515/455 436/495/436 456/516/456 -f 436/495/436 437/496/437 456/516/456 -f 456/516/456 437/496/437 457/517/457 -f 437/496/437 438/497/438 457/517/457 -f 457/517/457 438/497/438 458/518/458 -f 438/497/438 439/498/439 458/518/458 -f 458/518/458 439/498/439 459/519/459 -f 439/498/439 440/499/440 459/519/459 -f 459/519/459 440/499/440 460/520/460 -f 440/499/440 441/500/441 460/520/460 -f 460/520/460 441/500/441 461/521/461 -f 441/500/441 442/501/442 461/521/461 -f 461/521/461 442/501/442 462/522/462 -f 442/501/442 423/502/423 462/522/462 -f 462/522/462 423/502/423 443/523/443 -f 443/503/443 444/504/444 463/524/463 -f 463/524/463 444/504/444 464/525/464 -f 444/504/444 445/505/445 464/525/464 -f 464/525/464 445/505/445 465/526/465 -f 445/505/445 446/506/446 465/526/465 -f 465/526/465 446/506/446 466/527/466 -f 446/506/446 447/507/447 466/527/466 -f 466/527/466 447/507/447 467/528/467 -f 447/507/447 448/508/448 467/528/467 -f 467/528/467 448/508/448 468/529/468 -f 448/508/448 449/509/449 468/529/468 -f 468/529/468 449/509/449 469/530/469 -f 449/509/449 450/510/450 469/530/469 -f 469/530/469 450/510/450 470/531/470 -f 450/510/450 451/511/451 470/531/470 -f 470/531/470 451/511/451 471/532/471 -f 451/511/451 452/512/452 471/532/471 -f 471/532/471 452/512/452 472/533/472 -f 452/512/452 453/513/453 472/533/472 -f 472/533/472 453/513/453 473/534/473 -f 453/513/453 454/514/454 473/534/473 -f 473/534/473 454/514/454 474/535/474 -f 454/514/454 455/515/455 474/535/474 -f 474/535/474 455/515/455 475/536/475 -f 455/515/455 456/516/456 475/536/475 -f 475/536/475 456/516/456 476/537/476 -f 456/516/456 457/517/457 476/537/476 -f 476/537/476 457/517/457 477/538/477 -f 457/517/457 458/518/458 477/538/477 -f 477/538/477 458/518/458 478/539/478 -f 458/518/458 459/519/459 478/539/478 -f 478/539/478 459/519/459 479/540/479 -f 459/519/459 460/520/460 479/540/479 -f 479/540/479 460/520/460 480/541/480 -f 460/520/460 461/521/461 480/541/480 -f 480/541/480 461/521/461 481/542/481 -f 461/521/461 462/522/462 481/542/481 -f 481/542/481 462/522/462 482/543/482 -f 462/522/462 443/523/443 482/543/482 -f 482/543/482 443/523/443 463/544/463 -f 463/524/463 464/525/464 483/545/483 -f 483/545/483 464/525/464 484/546/484 -f 464/525/464 465/526/465 484/546/484 -f 484/546/484 465/526/465 485/547/485 -f 465/526/465 466/527/466 485/547/485 -f 485/547/485 466/527/466 486/548/486 -f 466/527/466 467/528/467 486/548/486 -f 486/548/486 467/528/467 487/549/487 -f 467/528/467 468/529/468 487/549/487 -f 487/549/487 468/529/468 488/550/488 -f 468/529/468 469/530/469 488/550/488 -f 488/550/488 469/530/469 489/551/489 -f 469/530/469 470/531/470 489/551/489 -f 489/551/489 470/531/470 490/552/490 -f 470/531/470 471/532/471 490/552/490 -f 490/552/490 471/532/471 491/553/491 -f 471/532/471 472/533/472 491/553/491 -f 491/553/491 472/533/472 492/554/492 -f 472/533/472 473/534/473 492/554/492 -f 492/554/492 473/534/473 493/555/493 -f 473/534/473 474/535/474 493/555/493 -f 493/555/493 474/535/474 494/556/494 -f 474/535/474 475/536/475 494/556/494 -f 494/556/494 475/536/475 495/557/495 -f 475/536/475 476/537/476 495/557/495 -f 495/557/495 476/537/476 496/558/496 -f 476/537/476 477/538/477 496/558/496 -f 496/558/496 477/538/477 497/559/497 -f 477/538/477 478/539/478 497/559/497 -f 497/559/497 478/539/478 498/560/498 -f 478/539/478 479/540/479 498/560/498 -f 498/560/498 479/540/479 499/561/499 -f 479/540/479 480/541/480 499/561/499 -f 499/561/499 480/541/480 500/562/500 -f 480/541/480 481/542/481 500/562/500 -f 500/562/500 481/542/481 501/563/501 -f 481/542/481 482/543/482 501/563/501 -f 501/563/501 482/543/482 502/564/502 -f 482/543/482 463/544/463 502/564/502 -f 502/564/502 463/544/463 483/565/483 -f 483/545/483 484/546/484 503/566/503 -f 503/566/503 484/546/484 504/567/504 -f 484/546/484 485/547/485 504/567/504 -f 504/567/504 485/547/485 505/568/505 -f 485/547/485 486/548/486 505/568/505 -f 505/568/505 486/548/486 506/569/506 -f 486/548/486 487/549/487 506/569/506 -f 506/569/506 487/549/487 507/570/507 -f 487/549/487 488/550/488 507/570/507 -f 507/570/507 488/550/488 508/571/508 -f 488/550/488 489/551/489 508/571/508 -f 508/571/508 489/551/489 509/572/509 -f 489/551/489 490/552/490 509/572/509 -f 509/572/509 490/552/490 510/573/510 -f 490/552/490 491/553/491 510/573/510 -f 510/573/510 491/553/491 511/574/511 -f 491/553/491 492/554/492 511/574/511 -f 511/574/511 492/554/492 512/575/512 -f 492/554/492 493/555/493 512/575/512 -f 512/575/512 493/555/493 513/576/513 -f 493/555/493 494/556/494 513/576/513 -f 513/576/513 494/556/494 514/577/514 -f 494/556/494 495/557/495 514/577/514 -f 514/577/514 495/557/495 515/578/515 -f 495/557/495 496/558/496 515/578/515 -f 515/578/515 496/558/496 516/579/516 -f 496/558/496 497/559/497 516/579/516 -f 516/579/516 497/559/497 517/580/517 -f 497/559/497 498/560/498 517/580/517 -f 517/580/517 498/560/498 518/581/518 -f 498/560/498 499/561/499 518/581/518 -f 518/581/518 499/561/499 519/582/519 -f 499/561/499 500/562/500 519/582/519 -f 519/582/519 500/562/500 520/583/520 -f 500/562/500 501/563/501 520/583/520 -f 520/583/520 501/563/501 521/584/521 -f 501/563/501 502/564/502 521/584/521 -f 521/584/521 502/564/502 522/585/522 -f 502/564/502 483/565/483 522/585/522 -f 522/585/522 483/565/483 503/586/503 -f 503/566/503 504/567/504 523/587/523 -f 523/587/523 504/567/504 524/588/524 -f 504/567/504 505/568/505 524/588/524 -f 524/588/524 505/568/505 525/589/525 -f 505/568/505 506/569/506 525/589/525 -f 525/589/525 506/569/506 526/590/526 -f 506/569/506 507/570/507 526/590/526 -f 526/590/526 507/570/507 527/591/527 -f 507/570/507 508/571/508 527/591/527 -f 527/591/527 508/571/508 528/592/528 -f 508/571/508 509/572/509 528/592/528 -f 528/592/528 509/572/509 529/593/529 -f 509/572/509 510/573/510 529/593/529 -f 529/593/529 510/573/510 530/594/530 -f 510/573/510 511/574/511 530/594/530 -f 530/594/530 511/574/511 531/595/531 -f 511/574/511 512/575/512 531/595/531 -f 531/595/531 512/575/512 532/596/532 -f 512/575/512 513/576/513 532/596/532 -f 532/596/532 513/576/513 533/597/533 -f 513/576/513 514/577/514 533/597/533 -f 533/597/533 514/577/514 534/598/534 -f 514/577/514 515/578/515 534/598/534 -f 534/598/534 515/578/515 535/599/535 -f 515/578/515 516/579/516 535/599/535 -f 535/599/535 516/579/516 536/600/536 -f 516/579/516 517/580/517 536/600/536 -f 536/600/536 517/580/517 537/601/537 -f 517/580/517 518/581/518 537/601/537 -f 537/601/537 518/581/518 538/602/538 -f 518/581/518 519/582/519 538/602/538 -f 538/602/538 519/582/519 539/603/539 -f 519/582/519 520/583/520 539/603/539 -f 539/603/539 520/583/520 540/604/540 -f 520/583/520 521/584/521 540/604/540 -f 540/604/540 521/584/521 541/605/541 -f 521/584/521 522/585/522 541/605/541 -f 541/605/541 522/585/522 542/606/542 -f 522/585/522 503/586/503 542/606/542 -f 542/606/542 503/586/503 523/607/523 -f 523/587/523 524/588/524 543/608/543 -f 543/608/543 524/588/524 544/609/544 -f 524/588/524 525/589/525 544/609/544 -f 544/609/544 525/589/525 545/610/545 -f 525/589/525 526/590/526 545/610/545 -f 545/610/545 526/590/526 546/611/546 -f 526/590/526 527/591/527 546/611/546 -f 546/611/546 527/591/527 547/612/547 -f 527/591/527 528/592/528 547/612/547 -f 547/612/547 528/592/528 548/613/548 -f 528/592/528 529/593/529 548/613/548 -f 548/613/548 529/593/529 549/614/549 -f 529/593/529 530/594/530 549/614/549 -f 549/614/549 530/594/530 550/615/550 -f 530/594/530 531/595/531 550/615/550 -f 550/615/550 531/595/531 551/616/551 -f 531/595/531 532/596/532 551/616/551 -f 551/616/551 532/596/532 552/617/552 -f 532/596/532 533/597/533 552/617/552 -f 552/617/552 533/597/533 553/618/553 -f 533/597/533 534/598/534 553/618/553 -f 553/618/553 534/598/534 554/619/554 -f 534/598/534 535/599/535 554/619/554 -f 554/619/554 535/599/535 555/620/555 -f 535/599/535 536/600/536 555/620/555 -f 555/620/555 536/600/536 556/621/556 -f 536/600/536 537/601/537 556/621/556 -f 556/621/556 537/601/537 557/622/557 -f 537/601/537 538/602/538 557/622/557 -f 557/622/557 538/602/538 558/623/558 -f 538/602/538 539/603/539 558/623/558 -f 558/623/558 539/603/539 559/624/559 -f 539/603/539 540/604/540 559/624/559 -f 559/624/559 540/604/540 560/625/560 -f 540/604/540 541/605/541 560/625/560 -f 560/625/560 541/605/541 561/626/561 -f 541/605/541 542/606/542 561/626/561 -f 561/626/561 542/606/542 562/627/562 -f 542/606/542 523/607/523 562/627/562 -f 562/627/562 523/607/523 543/628/543 -f 543/608/543 544/609/544 563/629/563 -f 563/629/563 544/609/544 564/630/564 -f 544/609/544 545/610/545 564/630/564 -f 564/630/564 545/610/545 565/631/565 -f 545/610/545 546/611/546 565/631/565 -f 565/631/565 546/611/546 566/632/566 -f 546/611/546 547/612/547 566/632/566 -f 566/632/566 547/612/547 567/633/567 -f 547/612/547 548/613/548 567/633/567 -f 567/633/567 548/613/548 568/634/568 -f 548/613/548 549/614/549 568/634/568 -f 568/634/568 549/614/549 569/635/569 -f 549/614/549 550/615/550 569/635/569 -f 569/635/569 550/615/550 570/636/570 -f 550/615/550 551/616/551 570/636/570 -f 570/636/570 551/616/551 571/637/571 -f 551/616/551 552/617/552 571/637/571 -f 571/637/571 552/617/552 572/638/572 -f 552/617/552 553/618/553 572/638/572 -f 572/638/572 553/618/553 573/639/573 -f 553/618/553 554/619/554 573/639/573 -f 573/639/573 554/619/554 574/640/574 -f 554/619/554 555/620/555 574/640/574 -f 574/640/574 555/620/555 575/641/575 -f 555/620/555 556/621/556 575/641/575 -f 575/641/575 556/621/556 576/642/576 -f 556/621/556 557/622/557 576/642/576 -f 576/642/576 557/622/557 577/643/577 -f 557/622/557 558/623/558 577/643/577 -f 577/643/577 558/623/558 578/644/578 -f 558/623/558 559/624/559 578/644/578 -f 578/644/578 559/624/559 579/645/579 -f 559/624/559 560/625/560 579/645/579 -f 579/645/579 560/625/560 580/646/580 -f 560/625/560 561/626/561 580/646/580 -f 580/646/580 561/626/561 581/647/581 -f 561/626/561 562/627/562 581/647/581 -f 581/647/581 562/627/562 582/648/582 -f 562/627/562 543/628/543 582/648/582 -f 582/648/582 543/628/543 563/649/563 -f 563/629/563 564/630/564 583/650/583 -f 583/650/583 564/630/564 584/651/584 -f 564/630/564 565/631/565 584/651/584 -f 584/651/584 565/631/565 585/652/585 -f 565/631/565 566/632/566 585/652/585 -f 585/652/585 566/632/566 586/653/586 -f 566/632/566 567/633/567 586/653/586 -f 586/653/586 567/633/567 587/654/587 -f 567/633/567 568/634/568 587/654/587 -f 587/654/587 568/634/568 588/655/588 -f 568/634/568 569/635/569 588/655/588 -f 588/655/588 569/635/569 589/656/589 -f 569/635/569 570/636/570 589/656/589 -f 589/656/589 570/636/570 590/657/590 -f 570/636/570 571/637/571 590/657/590 -f 590/657/590 571/637/571 591/658/591 -f 571/637/571 572/638/572 591/658/591 -f 591/658/591 572/638/572 592/659/592 -f 572/638/572 573/639/573 592/659/592 -f 592/659/592 573/639/573 593/660/593 -f 573/639/573 574/640/574 593/660/593 -f 593/660/593 574/640/574 594/661/594 -f 574/640/574 575/641/575 594/661/594 -f 594/661/594 575/641/575 595/662/595 -f 575/641/575 576/642/576 595/662/595 -f 595/662/595 576/642/576 596/663/596 -f 576/642/576 577/643/577 596/663/596 -f 596/663/596 577/643/577 597/664/597 -f 577/643/577 578/644/578 597/664/597 -f 597/664/597 578/644/578 598/665/598 -f 578/644/578 579/645/579 598/665/598 -f 598/665/598 579/645/579 599/666/599 -f 579/645/579 580/646/580 599/666/599 -f 599/666/599 580/646/580 600/667/600 -f 580/646/580 581/647/581 600/667/600 -f 600/667/600 581/647/581 601/668/601 -f 581/647/581 582/648/582 601/668/601 -f 601/668/601 582/648/582 602/669/602 -f 582/648/582 563/649/563 602/669/602 -f 602/669/602 563/649/563 583/670/583 -f 583/650/583 584/651/584 603/671/603 -f 603/671/603 584/651/584 604/672/604 -f 584/651/584 585/652/585 604/672/604 -f 604/672/604 585/652/585 605/673/605 -f 585/652/585 586/653/586 605/673/605 -f 605/673/605 586/653/586 606/674/606 -f 586/653/586 587/654/587 606/674/606 -f 606/674/606 587/654/587 607/675/607 -f 587/654/587 588/655/588 607/675/607 -f 607/675/607 588/655/588 608/676/608 -f 588/655/588 589/656/589 608/676/608 -f 608/676/608 589/656/589 609/677/609 -f 589/656/589 590/657/590 609/677/609 -f 609/677/609 590/657/590 610/678/610 -f 590/657/590 591/658/591 610/678/610 -f 610/678/610 591/658/591 611/679/611 -f 591/658/591 592/659/592 611/679/611 -f 611/679/611 592/659/592 612/680/612 -f 592/659/592 593/660/593 612/680/612 -f 612/680/612 593/660/593 613/681/613 -f 593/660/593 594/661/594 613/681/613 -f 613/681/613 594/661/594 614/682/614 -f 594/661/594 595/662/595 614/682/614 -f 614/682/614 595/662/595 615/683/615 -f 595/662/595 596/663/596 615/683/615 -f 615/683/615 596/663/596 616/684/616 -f 596/663/596 597/664/597 616/684/616 -f 616/684/616 597/664/597 617/685/617 -f 597/664/597 598/665/598 617/685/617 -f 617/685/617 598/665/598 618/686/618 -f 598/665/598 599/666/599 618/686/618 -f 618/686/618 599/666/599 619/687/619 -f 599/666/599 600/667/600 619/687/619 -f 619/687/619 600/667/600 620/688/620 -f 600/667/600 601/668/601 620/688/620 -f 620/688/620 601/668/601 621/689/621 -f 601/668/601 602/669/602 621/689/621 -f 621/689/621 602/669/602 622/690/622 -f 602/669/602 583/670/583 622/690/622 -f 622/690/622 583/670/583 603/691/603 -f 603/671/603 604/672/604 623/692/623 -f 623/692/623 604/672/604 624/693/624 -f 604/672/604 605/673/605 624/693/624 -f 624/693/624 605/673/605 625/694/625 -f 605/673/605 606/674/606 625/694/625 -f 625/694/625 606/674/606 626/695/626 -f 606/674/606 607/675/607 626/695/626 -f 626/695/626 607/675/607 627/696/627 -f 607/675/607 608/676/608 627/696/627 -f 627/696/627 608/676/608 628/697/628 -f 608/676/608 609/677/609 628/697/628 -f 628/697/628 609/677/609 629/698/629 -f 609/677/609 610/678/610 629/698/629 -f 629/698/629 610/678/610 630/699/630 -f 610/678/610 611/679/611 630/699/630 -f 630/699/630 611/679/611 631/700/631 -f 611/679/611 612/680/612 631/700/631 -f 631/700/631 612/680/612 632/701/632 -f 612/680/612 613/681/613 632/701/632 -f 632/701/632 613/681/613 633/702/633 -f 613/681/613 614/682/614 633/702/633 -f 633/702/633 614/682/614 634/703/634 -f 614/682/614 615/683/615 634/703/634 -f 634/703/634 615/683/615 635/704/635 -f 615/683/615 616/684/616 635/704/635 -f 635/704/635 616/684/616 636/705/636 -f 616/684/616 617/685/617 636/705/636 -f 636/705/636 617/685/617 637/706/637 -f 617/685/617 618/686/618 637/706/637 -f 637/706/637 618/686/618 638/707/638 -f 618/686/618 619/687/619 638/707/638 -f 638/707/638 619/687/619 639/708/639 -f 619/687/619 620/688/620 639/708/639 -f 639/708/639 620/688/620 640/709/640 -f 620/688/620 621/689/621 640/709/640 -f 640/709/640 621/689/621 641/710/641 -f 621/689/621 622/690/622 641/710/641 -f 641/710/641 622/690/622 642/711/642 -f 622/690/622 603/691/603 642/711/642 -f 642/711/642 603/691/603 623/712/623 -f 623/692/623 624/693/624 643/713/643 -f 643/713/643 624/693/624 644/714/644 -f 624/693/624 625/694/625 644/714/644 -f 644/714/644 625/694/625 645/715/645 -f 625/694/625 626/695/626 645/715/645 -f 645/715/645 626/695/626 646/716/646 -f 626/695/626 627/696/627 646/716/646 -f 646/716/646 627/696/627 647/717/647 -f 627/696/627 628/697/628 647/717/647 -f 647/717/647 628/697/628 648/718/648 -f 628/697/628 629/698/629 648/718/648 -f 648/718/648 629/698/629 649/719/649 -f 629/698/629 630/699/630 649/719/649 -f 649/719/649 630/699/630 650/720/650 -f 630/699/630 631/700/631 650/720/650 -f 650/720/650 631/700/631 651/721/651 -f 631/700/631 632/701/632 651/721/651 -f 651/721/651 632/701/632 652/722/652 -f 632/701/632 633/702/633 652/722/652 -f 652/722/652 633/702/633 653/723/653 -f 633/702/633 634/703/634 653/723/653 -f 653/723/653 634/703/634 654/724/654 -f 634/703/634 635/704/635 654/724/654 -f 654/724/654 635/704/635 655/725/655 -f 635/704/635 636/705/636 655/725/655 -f 655/725/655 636/705/636 656/726/656 -f 636/705/636 637/706/637 656/726/656 -f 656/726/656 637/706/637 657/727/657 -f 637/706/637 638/707/638 657/727/657 -f 657/727/657 638/707/638 658/728/658 -f 638/707/638 639/708/639 658/728/658 -f 658/728/658 639/708/639 659/729/659 -f 639/708/639 640/709/640 659/729/659 -f 659/729/659 640/709/640 660/730/660 -f 640/709/640 641/710/641 660/730/660 -f 660/730/660 641/710/641 661/731/661 -f 641/710/641 642/711/642 661/731/661 -f 661/731/661 642/711/642 662/732/662 -f 642/711/642 623/712/623 662/732/662 -f 662/732/662 623/712/623 643/733/643 -f 643/713/643 644/714/644 663/734/663 -f 663/734/663 644/714/644 664/735/664 -f 644/714/644 645/715/645 664/735/664 -f 664/735/664 645/715/645 665/736/665 -f 645/715/645 646/716/646 665/736/665 -f 665/736/665 646/716/646 666/737/666 -f 646/716/646 647/717/647 666/737/666 -f 666/737/666 647/717/647 667/738/667 -f 647/717/647 648/718/648 667/738/667 -f 667/738/667 648/718/648 668/739/668 -f 648/718/648 649/719/649 668/739/668 -f 668/739/668 649/719/649 669/740/669 -f 649/719/649 650/720/650 669/740/669 -f 669/740/669 650/720/650 670/741/670 -f 650/720/650 651/721/651 670/741/670 -f 670/741/670 651/721/651 671/742/671 -f 651/721/651 652/722/652 671/742/671 -f 671/742/671 652/722/652 672/743/672 -f 652/722/652 653/723/653 672/743/672 -f 672/743/672 653/723/653 673/744/673 -f 653/723/653 654/724/654 673/744/673 -f 673/744/673 654/724/654 674/745/674 -f 654/724/654 655/725/655 674/745/674 -f 674/745/674 655/725/655 675/746/675 -f 655/725/655 656/726/656 675/746/675 -f 675/746/675 656/726/656 676/747/676 -f 656/726/656 657/727/657 676/747/676 -f 676/747/676 657/727/657 677/748/677 -f 657/727/657 658/728/658 677/748/677 -f 677/748/677 658/728/658 678/749/678 -f 658/728/658 659/729/659 678/749/678 -f 678/749/678 659/729/659 679/750/679 -f 659/729/659 660/730/660 679/750/679 -f 679/750/679 660/730/660 680/751/680 -f 660/730/660 661/731/661 680/751/680 -f 680/751/680 661/731/661 681/752/681 -f 661/731/661 662/732/662 681/752/681 -f 681/752/681 662/732/662 682/753/682 -f 662/732/662 643/733/643 682/753/682 -f 682/753/682 643/733/643 663/754/663 -f 663/734/663 664/735/664 683/755/683 -f 683/755/683 664/735/664 684/756/684 -f 664/735/664 665/736/665 684/756/684 -f 684/756/684 665/736/665 685/757/685 -f 665/736/665 666/737/666 685/757/685 -f 685/757/685 666/737/666 686/758/686 -f 666/737/666 667/738/667 686/758/686 -f 686/758/686 667/738/667 687/759/687 -f 667/738/667 668/739/668 687/759/687 -f 687/759/687 668/739/668 688/760/688 -f 668/739/668 669/740/669 688/760/688 -f 688/760/688 669/740/669 689/761/689 -f 669/740/669 670/741/670 689/761/689 -f 689/761/689 670/741/670 690/762/690 -f 670/741/670 671/742/671 690/762/690 -f 690/762/690 671/742/671 691/763/691 -f 671/742/671 672/743/672 691/763/691 -f 691/763/691 672/743/672 692/764/692 -f 672/743/672 673/744/673 692/764/692 -f 692/764/692 673/744/673 693/765/693 -f 673/744/673 674/745/674 693/765/693 -f 693/765/693 674/745/674 694/766/694 -f 674/745/674 675/746/675 694/766/694 -f 694/766/694 675/746/675 695/767/695 -f 675/746/675 676/747/676 695/767/695 -f 695/767/695 676/747/676 696/768/696 -f 676/747/676 677/748/677 696/768/696 -f 696/768/696 677/748/677 697/769/697 -f 677/748/677 678/749/678 697/769/697 -f 697/769/697 678/749/678 698/770/698 -f 678/749/678 679/750/679 698/770/698 -f 698/770/698 679/750/679 699/771/699 -f 679/750/679 680/751/680 699/771/699 -f 699/771/699 680/751/680 700/772/700 -f 680/751/680 681/752/681 700/772/700 -f 700/772/700 681/752/681 701/773/701 -f 681/752/681 682/753/682 701/773/701 -f 701/773/701 682/753/682 702/774/702 -f 682/753/682 663/754/663 702/774/702 -f 702/774/702 663/754/663 683/775/683 -f 683/755/683 684/756/684 703/776/703 -f 703/776/703 684/756/684 704/777/704 -f 684/756/684 685/757/685 704/777/704 -f 704/777/704 685/757/685 705/778/705 -f 685/757/685 686/758/686 705/778/705 -f 705/778/705 686/758/686 706/779/706 -f 686/758/686 687/759/687 706/779/706 -f 706/779/706 687/759/687 707/780/707 -f 687/759/687 688/760/688 707/780/707 -f 707/780/707 688/760/688 708/781/708 -f 688/760/688 689/761/689 708/781/708 -f 708/781/708 689/761/689 709/782/709 -f 689/761/689 690/762/690 709/782/709 -f 709/782/709 690/762/690 710/783/710 -f 690/762/690 691/763/691 710/783/710 -f 710/783/710 691/763/691 711/784/711 -f 691/763/691 692/764/692 711/784/711 -f 711/784/711 692/764/692 712/785/712 -f 692/764/692 693/765/693 712/785/712 -f 712/785/712 693/765/693 713/786/713 -f 693/765/693 694/766/694 713/786/713 -f 713/786/713 694/766/694 714/787/714 -f 694/766/694 695/767/695 714/787/714 -f 714/787/714 695/767/695 715/788/715 -f 695/767/695 696/768/696 715/788/715 -f 715/788/715 696/768/696 716/789/716 -f 696/768/696 697/769/697 716/789/716 -f 716/789/716 697/769/697 717/790/717 -f 697/769/697 698/770/698 717/790/717 -f 717/790/717 698/770/698 718/791/718 -f 698/770/698 699/771/699 718/791/718 -f 718/791/718 699/771/699 719/792/719 -f 699/771/699 700/772/700 719/792/719 -f 719/792/719 700/772/700 720/793/720 -f 700/772/700 701/773/701 720/793/720 -f 720/793/720 701/773/701 721/794/721 -f 701/773/701 702/774/702 721/794/721 -f 721/794/721 702/774/702 722/795/722 -f 702/774/702 683/775/683 722/795/722 -f 722/795/722 683/775/683 703/796/703 -f 703/776/703 704/777/704 723/797/723 -f 723/797/723 704/777/704 724/798/724 -f 704/777/704 705/778/705 724/798/724 -f 724/798/724 705/778/705 725/799/725 -f 705/778/705 706/779/706 725/799/725 -f 725/799/725 706/779/706 726/800/726 -f 706/779/706 707/780/707 726/800/726 -f 726/800/726 707/780/707 727/801/727 -f 707/780/707 708/781/708 727/801/727 -f 727/801/727 708/781/708 728/802/728 -f 708/781/708 709/782/709 728/802/728 -f 728/802/728 709/782/709 729/803/729 -f 709/782/709 710/783/710 729/803/729 -f 729/803/729 710/783/710 730/804/730 -f 710/783/710 711/784/711 730/804/730 -f 730/804/730 711/784/711 731/805/731 -f 711/784/711 712/785/712 731/805/731 -f 731/805/731 712/785/712 732/806/732 -f 712/785/712 713/786/713 732/806/732 -f 732/806/732 713/786/713 733/807/733 -f 713/786/713 714/787/714 733/807/733 -f 733/807/733 714/787/714 734/808/734 -f 714/787/714 715/788/715 734/808/734 -f 734/808/734 715/788/715 735/809/735 -f 715/788/715 716/789/716 735/809/735 -f 735/809/735 716/789/716 736/810/736 -f 716/789/716 717/790/717 736/810/736 -f 736/810/736 717/790/717 737/811/737 -f 717/790/717 718/791/718 737/811/737 -f 737/811/737 718/791/718 738/812/738 -f 718/791/718 719/792/719 738/812/738 -f 738/812/738 719/792/719 739/813/739 -f 719/792/719 720/793/720 739/813/739 -f 739/813/739 720/793/720 740/814/740 -f 720/793/720 721/794/721 740/814/740 -f 740/814/740 721/794/721 741/815/741 -f 721/794/721 722/795/722 741/815/741 -f 741/815/741 722/795/722 742/816/742 -f 722/795/722 703/796/703 742/816/742 -f 742/816/742 703/796/703 723/817/723 -f 723/797/723 724/798/724 743/818/743 -f 743/818/743 724/798/724 744/819/744 -f 724/798/724 725/799/725 744/819/744 -f 744/819/744 725/799/725 745/820/745 -f 725/799/725 726/800/726 745/820/745 -f 745/820/745 726/800/726 746/821/746 -f 726/800/726 727/801/727 746/821/746 -f 746/821/746 727/801/727 747/822/747 -f 727/801/727 728/802/728 747/822/747 -f 747/822/747 728/802/728 748/823/748 -f 728/802/728 729/803/729 748/823/748 -f 748/823/748 729/803/729 749/824/749 -f 729/803/729 730/804/730 749/824/749 -f 749/824/749 730/804/730 750/825/750 -f 730/804/730 731/805/731 750/825/750 -f 750/825/750 731/805/731 751/826/751 -f 731/805/731 732/806/732 751/826/751 -f 751/826/751 732/806/732 752/827/752 -f 732/806/732 733/807/733 752/827/752 -f 752/827/752 733/807/733 753/828/753 -f 733/807/733 734/808/734 753/828/753 -f 753/828/753 734/808/734 754/829/754 -f 734/808/734 735/809/735 754/829/754 -f 754/829/754 735/809/735 755/830/755 -f 735/809/735 736/810/736 755/830/755 -f 755/830/755 736/810/736 756/831/756 -f 736/810/736 737/811/737 756/831/756 -f 756/831/756 737/811/737 757/832/757 -f 737/811/737 738/812/738 757/832/757 -f 757/832/757 738/812/738 758/833/758 -f 738/812/738 739/813/739 758/833/758 -f 758/833/758 739/813/739 759/834/759 -f 739/813/739 740/814/740 759/834/759 -f 759/834/759 740/814/740 760/835/760 -f 740/814/740 741/815/741 760/835/760 -f 760/835/760 741/815/741 761/836/761 -f 741/815/741 742/816/742 761/836/761 -f 761/836/761 742/816/742 762/837/762 -f 742/816/742 723/817/723 762/837/762 -f 762/837/762 723/817/723 743/838/743 -f 384/441/384 383/440/383 763/839/763 -f 385/442/387 384/441/384 763/840/763 -f 386/443/389 385/442/387 763/841/763 -f 387/444/391 386/443/389 763/842/763 -f 388/445/393 387/444/391 763/843/763 -f 389/446/395 388/445/393 763/844/763 -f 390/447/397 389/446/395 763/845/763 -f 391/448/399 390/447/397 763/846/763 -f 392/449/401 391/448/399 763/847/763 -f 393/450/403 392/449/401 763/848/763 -f 394/451/405 393/450/403 763/849/763 -f 395/452/407 394/451/405 763/850/763 -f 396/453/409 395/452/407 763/851/763 -f 397/454/411 396/453/409 763/852/763 -f 398/455/413 397/454/411 763/853/763 -f 399/456/415 398/455/413 763/854/763 -f 400/457/417 399/456/415 763/855/763 -f 401/458/419 400/457/417 763/856/763 -f 402/459/421 401/458/419 763/857/763 -f 383/460/383 402/459/421 763/858/763 -f 743/818/743 744/819/744 764/859/764 -f 744/819/744 745/820/745 764/860/764 -f 745/820/745 746/821/746 764/861/764 -f 746/821/746 747/822/747 764/862/764 -f 747/822/747 748/823/748 764/863/764 -f 748/823/748 749/824/749 764/864/764 -f 749/824/749 750/825/750 764/865/764 -f 750/825/750 751/826/751 764/866/764 -f 751/826/751 752/827/752 764/867/764 -f 752/827/752 753/828/753 764/868/764 -f 753/828/753 754/829/754 764/869/764 -f 754/829/754 755/830/755 764/870/764 -f 755/830/755 756/831/756 764/871/764 -f 756/831/756 757/832/757 764/872/764 -f 757/832/757 758/833/758 764/873/764 -f 758/833/758 759/834/759 764/874/764 -f 759/834/759 760/835/760 764/875/764 -f 760/835/760 761/836/761 764/876/764 -f 761/836/761 762/837/762 764/877/764 -f 762/837/762 743/838/743 764/878/764 -v 0.148778 -0.987688 -0.048341 -v 0.126558 -0.987688 -0.091950 -v 0.091950 -0.987688 -0.126558 -v 0.048341 -0.987688 -0.148778 -v 0.000000 -0.987688 -0.156435 -v -0.048341 -0.987688 -0.148778 -v -0.091950 -0.987688 -0.126558 -v -0.126558 -0.987688 -0.091950 -v -0.148778 -0.987688 -0.048341 -v -0.156435 -0.987688 0.000000 -v -0.148778 -0.987688 0.048341 -v -0.126558 -0.987688 0.091950 -v -0.091950 -0.987688 0.126558 -v -0.048341 -0.987688 0.148778 -v -0.000000 -0.987688 0.156434 -v 0.048341 -0.987688 0.148778 -v 0.091950 -0.987688 0.126558 -v 0.126558 -0.987688 0.091950 -v 0.148778 -0.987688 0.048341 -v 0.156434 -0.987688 0.000000 -v 0.293893 -0.951057 -0.095492 -v 0.250000 -0.951057 -0.181636 -v 0.181636 -0.951057 -0.250000 -v 0.095492 -0.951057 -0.293893 -v 0.000000 -0.951057 -0.309017 -v -0.095492 -0.951057 -0.293893 -v -0.181636 -0.951057 -0.250000 -v -0.250000 -0.951057 -0.181636 -v -0.293893 -0.951057 -0.095492 -v -0.309017 -0.951057 0.000000 -v -0.293893 -0.951057 0.095492 -v -0.250000 -0.951057 0.181636 -v -0.181636 -0.951057 0.250000 -v -0.095492 -0.951057 0.293893 -v -0.000000 -0.951057 0.309017 -v 0.095491 -0.951057 0.293893 -v 0.181636 -0.951057 0.250000 -v 0.250000 -0.951057 0.181636 -v 0.293893 -0.951057 0.095492 -v 0.309017 -0.951057 0.000000 -v 0.431771 -0.891007 -0.140291 -v 0.367286 -0.891007 -0.266849 -v 0.266849 -0.891007 -0.367286 -v 0.140291 -0.891007 -0.431771 -v 0.000000 -0.891007 -0.453991 -v -0.140291 -0.891007 -0.431771 -v -0.266849 -0.891007 -0.367286 -v -0.367286 -0.891007 -0.266849 -v -0.431771 -0.891007 -0.140291 -v -0.453991 -0.891007 0.000000 -v -0.431771 -0.891007 0.140291 -v -0.367286 -0.891007 0.266849 -v -0.266849 -0.891007 0.367286 -v -0.140291 -0.891007 0.431771 -v -0.000000 -0.891007 0.453991 -v 0.140291 -0.891007 0.431771 -v 0.266849 -0.891007 0.367286 -v 0.367286 -0.891007 0.266849 -v 0.431771 -0.891007 0.140291 -v 0.453991 -0.891007 0.000000 -v 0.559017 -0.809017 -0.181636 -v 0.475529 -0.809017 -0.345492 -v 0.345492 -0.809017 -0.475529 -v 0.181636 -0.809017 -0.559017 -v 0.000000 -0.809017 -0.587786 -v -0.181636 -0.809017 -0.559017 -v -0.345492 -0.809017 -0.475528 -v -0.475528 -0.809017 -0.345492 -v -0.559017 -0.809017 -0.181636 -v -0.587785 -0.809017 0.000000 -v -0.559017 -0.809017 0.181636 -v -0.475528 -0.809017 0.345492 -v -0.345492 -0.809017 0.475528 -v -0.181636 -0.809017 0.559017 -v -0.000000 -0.809017 0.587785 -v 0.181636 -0.809017 0.559017 -v 0.345491 -0.809017 0.475528 -v 0.475528 -0.809017 0.345492 -v 0.559017 -0.809017 0.181636 -v 0.587785 -0.809017 0.000000 -v 0.672499 -0.707107 -0.218508 -v 0.572062 -0.707107 -0.415627 -v 0.415627 -0.707107 -0.572062 -v 0.218508 -0.707107 -0.672499 -v 0.000000 -0.707107 -0.707107 -v -0.218508 -0.707107 -0.672499 -v -0.415627 -0.707107 -0.572062 -v -0.572062 -0.707107 -0.415627 -v -0.672499 -0.707107 -0.218508 -v -0.707107 -0.707107 0.000000 -v -0.672499 -0.707107 0.218508 -v -0.572062 -0.707107 0.415627 -v -0.415627 -0.707107 0.572061 -v -0.218508 -0.707107 0.672499 -v -0.000000 -0.707107 0.707107 -v 0.218508 -0.707107 0.672499 -v 0.415627 -0.707107 0.572061 -v 0.572061 -0.707107 0.415627 -v 0.672499 -0.707107 0.218508 -v 0.707107 -0.707107 0.000000 -v 0.769421 -0.587785 -0.250000 -v 0.654509 -0.587785 -0.475529 -v 0.475529 -0.587785 -0.654509 -v 0.250000 -0.587785 -0.769421 -v 0.000000 -0.587785 -0.809017 -v -0.250000 -0.587785 -0.769421 -v -0.475528 -0.587785 -0.654509 -v -0.654509 -0.587785 -0.475528 -v -0.769421 -0.587785 -0.250000 -v -0.809017 -0.587785 0.000000 -v -0.769421 -0.587785 0.250000 -v -0.654509 -0.587785 0.475528 -v -0.475528 -0.587785 0.654509 -v -0.250000 -0.587785 0.769421 -v -0.000000 -0.587785 0.809017 -v 0.250000 -0.587785 0.769421 -v 0.475528 -0.587785 0.654509 -v 0.654509 -0.587785 0.475528 -v 0.769421 -0.587785 0.250000 -v 0.809017 -0.587785 0.000000 -v 0.847398 -0.453991 -0.275336 -v 0.720840 -0.453991 -0.523721 -v 0.523721 -0.453991 -0.720840 -v 0.275336 -0.453991 -0.847398 -v 0.000000 -0.453991 -0.891007 -v -0.275336 -0.453991 -0.847398 -v -0.523721 -0.453991 -0.720840 -v -0.720840 -0.453991 -0.523721 -v -0.847398 -0.453991 -0.275336 -v -0.891007 -0.453991 0.000000 -v -0.847398 -0.453991 0.275336 -v -0.720840 -0.453991 0.523721 -v -0.523721 -0.453991 0.720840 -v -0.275336 -0.453991 0.847398 -v -0.000000 -0.453991 0.891007 -v 0.275336 -0.453991 0.847398 -v 0.523721 -0.453991 0.720840 -v 0.720839 -0.453991 0.523721 -v 0.847398 -0.453991 0.275336 -v 0.891007 -0.453991 0.000000 -v 0.904509 -0.309017 -0.293893 -v 0.769421 -0.309017 -0.559017 -v 0.559017 -0.309017 -0.769421 -v 0.293893 -0.309017 -0.904509 -v 0.000000 -0.309017 -0.951057 -v -0.293893 -0.309017 -0.904509 -v -0.559017 -0.309017 -0.769421 -v -0.769421 -0.309017 -0.559017 -v -0.904509 -0.309017 -0.293893 -v -0.951057 -0.309017 0.000000 -v -0.904509 -0.309017 0.293893 -v -0.769421 -0.309017 0.559017 -v -0.559017 -0.309017 0.769421 -v -0.293893 -0.309017 0.904509 -v -0.000000 -0.309017 0.951057 -v 0.293893 -0.309017 0.904509 -v 0.559017 -0.309017 0.769421 -v 0.769421 -0.309017 0.559017 -v 0.904509 -0.309017 0.293893 -v 0.951057 -0.309017 0.000000 -v 0.939348 -0.156434 -0.305213 -v 0.799057 -0.156434 -0.580549 -v 0.580549 -0.156434 -0.799057 -v 0.305213 -0.156434 -0.939348 -v 0.000000 -0.156434 -0.987689 -v -0.305213 -0.156434 -0.939348 -v -0.580549 -0.156434 -0.799057 -v -0.799057 -0.156434 -0.580549 -v -0.939348 -0.156434 -0.305213 -v -0.987689 -0.156434 0.000000 -v -0.939348 -0.156434 0.305213 -v -0.799057 -0.156434 0.580549 -v -0.580549 -0.156434 0.799057 -v -0.305213 -0.156434 0.939348 -v -0.000000 -0.156434 0.987688 -v 0.305212 -0.156434 0.939348 -v 0.580549 -0.156434 0.799057 -v 0.799057 -0.156434 0.580549 -v 0.939348 -0.156434 0.305212 -v 0.987688 -0.156434 0.000000 -v 0.951057 0.000000 -0.309017 -v 0.809018 0.000000 -0.587786 -v 0.587786 0.000000 -0.809017 -v 0.309017 0.000000 -0.951057 -v 0.000000 0.000000 -1.000000 -v -0.309017 0.000000 -0.951057 -v -0.587785 0.000000 -0.809017 -v -0.809017 0.000000 -0.587785 -v -0.951057 0.000000 -0.309017 -v -1.000000 0.000000 0.000000 -v -0.951057 0.000000 0.309017 -v -0.809017 0.000000 0.587785 -v -0.587785 0.000000 0.809017 -v -0.309017 0.000000 0.951057 -v -0.000000 0.000000 1.000000 -v 0.309017 0.000000 0.951057 -v 0.587785 0.000000 0.809017 -v 0.809017 0.000000 0.587785 -v 0.951057 0.000000 0.309017 -v 1.000000 0.000000 0.000000 -v 0.939348 0.156434 -0.305213 -v 0.799057 0.156434 -0.580549 -v 0.580549 0.156434 -0.799057 -v 0.305213 0.156434 -0.939348 -v 0.000000 0.156434 -0.987689 -v -0.305213 0.156434 -0.939348 -v -0.580549 0.156434 -0.799057 -v -0.799057 0.156434 -0.580549 -v -0.939348 0.156434 -0.305213 -v -0.987689 0.156434 0.000000 -v -0.939348 0.156434 0.305213 -v -0.799057 0.156434 0.580549 -v -0.580549 0.156434 0.799057 -v -0.305213 0.156434 0.939348 -v -0.000000 0.156434 0.987688 -v 0.305212 0.156434 0.939348 -v 0.580549 0.156434 0.799057 -v 0.799057 0.156434 0.580549 -v 0.939348 0.156434 0.305212 -v 0.987688 0.156434 0.000000 -v 0.904509 0.309017 -0.293893 -v 0.769421 0.309017 -0.559017 -v 0.559017 0.309017 -0.769421 -v 0.293893 0.309017 -0.904509 -v 0.000000 0.309017 -0.951057 -v -0.293893 0.309017 -0.904509 -v -0.559017 0.309017 -0.769421 -v -0.769421 0.309017 -0.559017 -v -0.904509 0.309017 -0.293893 -v -0.951057 0.309017 0.000000 -v -0.904509 0.309017 0.293893 -v -0.769421 0.309017 0.559017 -v -0.559017 0.309017 0.769421 -v -0.293893 0.309017 0.904509 -v -0.000000 0.309017 0.951057 -v 0.293893 0.309017 0.904509 -v 0.559017 0.309017 0.769421 -v 0.769421 0.309017 0.559017 -v 0.904509 0.309017 0.293893 -v 0.951057 0.309017 0.000000 -v 0.847398 0.453991 -0.275336 -v 0.720840 0.453991 -0.523721 -v 0.523721 0.453991 -0.720840 -v 0.275336 0.453991 -0.847398 -v 0.000000 0.453991 -0.891007 -v -0.275336 0.453991 -0.847398 -v -0.523721 0.453991 -0.720840 -v -0.720840 0.453991 -0.523721 -v -0.847398 0.453991 -0.275336 -v -0.891007 0.453991 0.000000 -v -0.847398 0.453991 0.275336 -v -0.720840 0.453991 0.523721 -v -0.523721 0.453991 0.720840 -v -0.275336 0.453991 0.847398 -v -0.000000 0.453991 0.891007 -v 0.275336 0.453991 0.847398 -v 0.523721 0.453991 0.720840 -v 0.720839 0.453991 0.523721 -v 0.847398 0.453991 0.275336 -v 0.891007 0.453991 0.000000 -v 0.769421 0.587785 -0.250000 -v 0.654509 0.587785 -0.475529 -v 0.475529 0.587785 -0.654509 -v 0.250000 0.587785 -0.769421 -v 0.000000 0.587785 -0.809017 -v -0.250000 0.587785 -0.769421 -v -0.475528 0.587785 -0.654509 -v -0.654509 0.587785 -0.475528 -v -0.769421 0.587785 -0.250000 -v -0.809017 0.587785 0.000000 -v -0.769421 0.587785 0.250000 -v -0.654509 0.587785 0.475528 -v -0.475528 0.587785 0.654509 -v -0.250000 0.587785 0.769421 -v -0.000000 0.587785 0.809017 -v 0.250000 0.587785 0.769421 -v 0.475528 0.587785 0.654509 -v 0.654509 0.587785 0.475528 -v 0.769421 0.587785 0.250000 -v 0.809017 0.587785 0.000000 -v 0.672499 0.707107 -0.218508 -v 0.572062 0.707107 -0.415627 -v 0.415627 0.707107 -0.572062 -v 0.218508 0.707107 -0.672499 -v 0.000000 0.707107 -0.707107 -v -0.218508 0.707107 -0.672499 -v -0.415627 0.707107 -0.572062 -v -0.572062 0.707107 -0.415627 -v -0.672499 0.707107 -0.218508 -v -0.707107 0.707107 0.000000 -v -0.672499 0.707107 0.218508 -v -0.572062 0.707107 0.415627 -v -0.415627 0.707107 0.572061 -v -0.218508 0.707107 0.672499 -v -0.000000 0.707107 0.707107 -v 0.218508 0.707107 0.672499 -v 0.415627 0.707107 0.572061 -v 0.572061 0.707107 0.415627 -v 0.672499 0.707107 0.218508 -v 0.707107 0.707107 0.000000 -v 0.559017 0.809017 -0.181636 -v 0.475529 0.809017 -0.345492 -v 0.345492 0.809017 -0.475529 -v 0.181636 0.809017 -0.559017 -v 0.000000 0.809017 -0.587786 -v -0.181636 0.809017 -0.559017 -v -0.345492 0.809017 -0.475528 -v -0.475528 0.809017 -0.345492 -v -0.559017 0.809017 -0.181636 -v -0.587785 0.809017 0.000000 -v -0.559017 0.809017 0.181636 -v -0.475528 0.809017 0.345492 -v -0.345492 0.809017 0.475528 -v -0.181636 0.809017 0.559017 -v -0.000000 0.809017 0.587785 -v 0.181636 0.809017 0.559017 -v 0.345491 0.809017 0.475528 -v 0.475528 0.809017 0.345492 -v 0.559017 0.809017 0.181636 -v 0.587785 0.809017 0.000000 -v 0.431771 0.891007 -0.140291 -v 0.367286 0.891007 -0.266849 -v 0.266849 0.891007 -0.367286 -v 0.140291 0.891007 -0.431771 -v 0.000000 0.891007 -0.453991 -v -0.140291 0.891007 -0.431771 -v -0.266849 0.891007 -0.367286 -v -0.367286 0.891007 -0.266849 -v -0.431771 0.891007 -0.140291 -v -0.453991 0.891007 0.000000 -v -0.431771 0.891007 0.140291 -v -0.367286 0.891007 0.266849 -v -0.266849 0.891007 0.367286 -v -0.140291 0.891007 0.431771 -v -0.000000 0.891007 0.453991 -v 0.140291 0.891007 0.431771 -v 0.266849 0.891007 0.367286 -v 0.367286 0.891007 0.266849 -v 0.431771 0.891007 0.140291 -v 0.453991 0.891007 0.000000 -v 0.293893 0.951057 -0.095492 -v 0.250000 0.951057 -0.181636 -v 0.181636 0.951057 -0.250000 -v 0.095492 0.951057 -0.293893 -v 0.000000 0.951057 -0.309017 -v -0.095492 0.951057 -0.293893 -v -0.181636 0.951057 -0.250000 -v -0.250000 0.951057 -0.181636 -v -0.293893 0.951057 -0.095492 -v -0.309017 0.951057 0.000000 -v -0.293893 0.951057 0.095492 -v -0.250000 0.951057 0.181636 -v -0.181636 0.951057 0.250000 -v -0.095492 0.951057 0.293893 -v -0.000000 0.951057 0.309017 -v 0.095491 0.951057 0.293893 -v 0.181636 0.951057 0.250000 -v 0.250000 0.951057 0.181636 -v 0.293893 0.951057 0.095492 -v 0.309017 0.951057 0.000000 -v 0.148778 0.987688 -0.048341 -v 0.126558 0.987688 -0.091950 -v 0.091950 0.987688 -0.126558 -v 0.048341 0.987688 -0.148778 -v 0.000000 0.987688 -0.156435 -v -0.048341 0.987688 -0.148778 -v -0.091950 0.987688 -0.126558 -v -0.126558 0.987688 -0.091950 -v -0.148778 0.987688 -0.048341 -v -0.156435 0.987688 0.000000 -v -0.148778 0.987688 0.048341 -v -0.126558 0.987688 0.091950 -v -0.091950 0.987688 0.126558 -v -0.048341 0.987688 0.148778 -v -0.000000 0.987688 0.156434 -v 0.048341 0.987688 0.148778 -v 0.091950 0.987688 0.126558 -v 0.126558 0.987688 0.091950 -v 0.148778 0.987688 0.048341 -v 0.156434 0.987688 0.000000 -v 0.000000 -1.000000 0.000000 -v 0.000000 1.000000 0.000000 -vt 0.000000 0.050000 -vt 0.050000 0.050000 -vt 0.100000 0.050000 -vt 0.150000 0.050000 -vt 0.200000 0.050000 -vt 0.250000 0.050000 -vt 0.300000 0.050000 -vt 0.350000 0.050000 -vt 0.400000 0.050000 -vt 0.450000 0.050000 -vt 0.500000 0.050000 -vt 0.550000 0.050000 -vt 0.600000 0.050000 -vt 0.650000 0.050000 -vt 0.700000 0.050000 -vt 0.750000 0.050000 -vt 0.800000 0.050000 -vt 0.850000 0.050000 -vt 0.900000 0.050000 -vt 0.950000 0.050000 -vt 1.000000 0.050000 -vt 0.000000 0.100000 -vt 0.050000 0.100000 -vt 0.100000 0.100000 -vt 0.150000 0.100000 -vt 0.200000 0.100000 -vt 0.250000 0.100000 -vt 0.300000 0.100000 -vt 0.350000 0.100000 -vt 0.400000 0.100000 -vt 0.450000 0.100000 -vt 0.500000 0.100000 -vt 0.550000 0.100000 -vt 0.600000 0.100000 -vt 0.650000 0.100000 -vt 0.700000 0.100000 -vt 0.750000 0.100000 -vt 0.800000 0.100000 -vt 0.850000 0.100000 -vt 0.900000 0.100000 -vt 0.950000 0.100000 -vt 1.000000 0.100000 -vt 0.000000 0.150000 -vt 0.050000 0.150000 -vt 0.100000 0.150000 -vt 0.150000 0.150000 -vt 0.200000 0.150000 -vt 0.250000 0.150000 -vt 0.300000 0.150000 -vt 0.350000 0.150000 -vt 0.400000 0.150000 -vt 0.450000 0.150000 -vt 0.500000 0.150000 -vt 0.550000 0.150000 -vt 0.600000 0.150000 -vt 0.650000 0.150000 -vt 0.700000 0.150000 -vt 0.750000 0.150000 -vt 0.800000 0.150000 -vt 0.850000 0.150000 -vt 0.900000 0.150000 -vt 0.950000 0.150000 -vt 1.000000 0.150000 -vt 0.000000 0.200000 -vt 0.050000 0.200000 -vt 0.100000 0.200000 -vt 0.150000 0.200000 -vt 0.200000 0.200000 -vt 0.250000 0.200000 -vt 0.300000 0.200000 -vt 0.350000 0.200000 -vt 0.400000 0.200000 -vt 0.450000 0.200000 -vt 0.500000 0.200000 -vt 0.550000 0.200000 -vt 0.600000 0.200000 -vt 0.650000 0.200000 -vt 0.700000 0.200000 -vt 0.750000 0.200000 -vt 0.800000 0.200000 -vt 0.850000 0.200000 -vt 0.900000 0.200000 -vt 0.950000 0.200000 -vt 1.000000 0.200000 -vt 0.000000 0.250000 -vt 0.050000 0.250000 -vt 0.100000 0.250000 -vt 0.150000 0.250000 -vt 0.200000 0.250000 -vt 0.250000 0.250000 -vt 0.300000 0.250000 -vt 0.350000 0.250000 -vt 0.400000 0.250000 -vt 0.450000 0.250000 -vt 0.500000 0.250000 -vt 0.550000 0.250000 -vt 0.600000 0.250000 -vt 0.650000 0.250000 -vt 0.700000 0.250000 -vt 0.750000 0.250000 -vt 0.800000 0.250000 -vt 0.850000 0.250000 -vt 0.900000 0.250000 -vt 0.950000 0.250000 -vt 1.000000 0.250000 -vt 0.000000 0.300000 -vt 0.050000 0.300000 -vt 0.100000 0.300000 -vt 0.150000 0.300000 -vt 0.200000 0.300000 -vt 0.250000 0.300000 -vt 0.300000 0.300000 -vt 0.350000 0.300000 -vt 0.400000 0.300000 -vt 0.450000 0.300000 -vt 0.500000 0.300000 -vt 0.550000 0.300000 -vt 0.600000 0.300000 -vt 0.650000 0.300000 -vt 0.700000 0.300000 -vt 0.750000 0.300000 -vt 0.800000 0.300000 -vt 0.850000 0.300000 -vt 0.900000 0.300000 -vt 0.950000 0.300000 -vt 1.000000 0.300000 -vt 0.000000 0.350000 -vt 0.050000 0.350000 -vt 0.100000 0.350000 -vt 0.150000 0.350000 -vt 0.200000 0.350000 -vt 0.250000 0.350000 -vt 0.300000 0.350000 -vt 0.350000 0.350000 -vt 0.400000 0.350000 -vt 0.450000 0.350000 -vt 0.500000 0.350000 -vt 0.550000 0.350000 -vt 0.600000 0.350000 -vt 0.650000 0.350000 -vt 0.700000 0.350000 -vt 0.750000 0.350000 -vt 0.800000 0.350000 -vt 0.850000 0.350000 -vt 0.900000 0.350000 -vt 0.950000 0.350000 -vt 1.000000 0.350000 -vt 0.000000 0.400000 -vt 0.050000 0.400000 -vt 0.100000 0.400000 -vt 0.150000 0.400000 -vt 0.200000 0.400000 -vt 0.250000 0.400000 -vt 0.300000 0.400000 -vt 0.350000 0.400000 -vt 0.400000 0.400000 -vt 0.450000 0.400000 -vt 0.500000 0.400000 -vt 0.550000 0.400000 -vt 0.600000 0.400000 -vt 0.650000 0.400000 -vt 0.700000 0.400000 -vt 0.750000 0.400000 -vt 0.800000 0.400000 -vt 0.850000 0.400000 -vt 0.900000 0.400000 -vt 0.950000 0.400000 -vt 1.000000 0.400000 -vt 0.000000 0.450000 -vt 0.050000 0.450000 -vt 0.100000 0.450000 -vt 0.150000 0.450000 -vt 0.200000 0.450000 -vt 0.250000 0.450000 -vt 0.300000 0.450000 -vt 0.350000 0.450000 -vt 0.400000 0.450000 -vt 0.450000 0.450000 -vt 0.500000 0.450000 -vt 0.550000 0.450000 -vt 0.600000 0.450000 -vt 0.650000 0.450000 -vt 0.700000 0.450000 -vt 0.750000 0.450000 -vt 0.800000 0.450000 -vt 0.850000 0.450000 -vt 0.900000 0.450000 -vt 0.950000 0.450000 -vt 1.000000 0.450000 -vt 0.000000 0.500000 -vt 0.050000 0.500000 -vt 0.100000 0.500000 -vt 0.150000 0.500000 -vt 0.200000 0.500000 -vt 0.250000 0.500000 -vt 0.300000 0.500000 -vt 0.350000 0.500000 -vt 0.400000 0.500000 -vt 0.450000 0.500000 -vt 0.500000 0.500000 -vt 0.550000 0.500000 -vt 0.600000 0.500000 -vt 0.650000 0.500000 -vt 0.700000 0.500000 -vt 0.750000 0.500000 -vt 0.800000 0.500000 -vt 0.850000 0.500000 -vt 0.900000 0.500000 -vt 0.950000 0.500000 -vt 1.000000 0.500000 -vt 0.000000 0.550000 -vt 0.050000 0.550000 -vt 0.100000 0.550000 -vt 0.150000 0.550000 -vt 0.200000 0.550000 -vt 0.250000 0.550000 -vt 0.300000 0.550000 -vt 0.350000 0.550000 -vt 0.400000 0.550000 -vt 0.450000 0.550000 -vt 0.500000 0.550000 -vt 0.550000 0.550000 -vt 0.600000 0.550000 -vt 0.650000 0.550000 -vt 0.700000 0.550000 -vt 0.750000 0.550000 -vt 0.800000 0.550000 -vt 0.850000 0.550000 -vt 0.900000 0.550000 -vt 0.950000 0.550000 -vt 1.000000 0.550000 -vt 0.000000 0.600000 -vt 0.050000 0.600000 -vt 0.100000 0.600000 -vt 0.150000 0.600000 -vt 0.200000 0.600000 -vt 0.250000 0.600000 -vt 0.300000 0.600000 -vt 0.350000 0.600000 -vt 0.400000 0.600000 -vt 0.450000 0.600000 -vt 0.500000 0.600000 -vt 0.550000 0.600000 -vt 0.600000 0.600000 -vt 0.650000 0.600000 -vt 0.700000 0.600000 -vt 0.750000 0.600000 -vt 0.800000 0.600000 -vt 0.850000 0.600000 -vt 0.900000 0.600000 -vt 0.950000 0.600000 -vt 1.000000 0.600000 -vt 0.000000 0.650000 -vt 0.050000 0.650000 -vt 0.100000 0.650000 -vt 0.150000 0.650000 -vt 0.200000 0.650000 -vt 0.250000 0.650000 -vt 0.300000 0.650000 -vt 0.350000 0.650000 -vt 0.400000 0.650000 -vt 0.450000 0.650000 -vt 0.500000 0.650000 -vt 0.550000 0.650000 -vt 0.600000 0.650000 -vt 0.650000 0.650000 -vt 0.700000 0.650000 -vt 0.750000 0.650000 -vt 0.800000 0.650000 -vt 0.850000 0.650000 -vt 0.900000 0.650000 -vt 0.950000 0.650000 -vt 1.000000 0.650000 -vt 0.000000 0.700000 -vt 0.050000 0.700000 -vt 0.100000 0.700000 -vt 0.150000 0.700000 -vt 0.200000 0.700000 -vt 0.250000 0.700000 -vt 0.300000 0.700000 -vt 0.350000 0.700000 -vt 0.400000 0.700000 -vt 0.450000 0.700000 -vt 0.500000 0.700000 -vt 0.550000 0.700000 -vt 0.600000 0.700000 -vt 0.650000 0.700000 -vt 0.700000 0.700000 -vt 0.750000 0.700000 -vt 0.800000 0.700000 -vt 0.850000 0.700000 -vt 0.900000 0.700000 -vt 0.950000 0.700000 -vt 1.000000 0.700000 -vt 0.000000 0.750000 -vt 0.050000 0.750000 -vt 0.100000 0.750000 -vt 0.150000 0.750000 -vt 0.200000 0.750000 -vt 0.250000 0.750000 -vt 0.300000 0.750000 -vt 0.350000 0.750000 -vt 0.400000 0.750000 -vt 0.450000 0.750000 -vt 0.500000 0.750000 -vt 0.550000 0.750000 -vt 0.600000 0.750000 -vt 0.650000 0.750000 -vt 0.700000 0.750000 -vt 0.750000 0.750000 -vt 0.800000 0.750000 -vt 0.850000 0.750000 -vt 0.900000 0.750000 -vt 0.950000 0.750000 -vt 1.000000 0.750000 -vt 0.000000 0.800000 -vt 0.050000 0.800000 -vt 0.100000 0.800000 -vt 0.150000 0.800000 -vt 0.200000 0.800000 -vt 0.250000 0.800000 -vt 0.300000 0.800000 -vt 0.350000 0.800000 -vt 0.400000 0.800000 -vt 0.450000 0.800000 -vt 0.500000 0.800000 -vt 0.550000 0.800000 -vt 0.600000 0.800000 -vt 0.650000 0.800000 -vt 0.700000 0.800000 -vt 0.750000 0.800000 -vt 0.800000 0.800000 -vt 0.850000 0.800000 -vt 0.900000 0.800000 -vt 0.950000 0.800000 -vt 1.000000 0.800000 -vt 0.000000 0.850000 -vt 0.050000 0.850000 -vt 0.100000 0.850000 -vt 0.150000 0.850000 -vt 0.200000 0.850000 -vt 0.250000 0.850000 -vt 0.300000 0.850000 -vt 0.350000 0.850000 -vt 0.400000 0.850000 -vt 0.450000 0.850000 -vt 0.500000 0.850000 -vt 0.550000 0.850000 -vt 0.600000 0.850000 -vt 0.650000 0.850000 -vt 0.700000 0.850000 -vt 0.750000 0.850000 -vt 0.800000 0.850000 -vt 0.850000 0.850000 -vt 0.900000 0.850000 -vt 0.950000 0.850000 -vt 1.000000 0.850000 -vt 0.000000 0.900000 -vt 0.050000 0.900000 -vt 0.100000 0.900000 -vt 0.150000 0.900000 -vt 0.200000 0.900000 -vt 0.250000 0.900000 -vt 0.300000 0.900000 -vt 0.350000 0.900000 -vt 0.400000 0.900000 -vt 0.450000 0.900000 -vt 0.500000 0.900000 -vt 0.550000 0.900000 -vt 0.600000 0.900000 -vt 0.650000 0.900000 -vt 0.700000 0.900000 -vt 0.750000 0.900000 -vt 0.800000 0.900000 -vt 0.850000 0.900000 -vt 0.900000 0.900000 -vt 0.950000 0.900000 -vt 1.000000 0.900000 -vt 0.000000 0.950000 -vt 0.050000 0.950000 -vt 0.100000 0.950000 -vt 0.150000 0.950000 -vt 0.200000 0.950000 -vt 0.250000 0.950000 -vt 0.300000 0.950000 -vt 0.350000 0.950000 -vt 0.400000 0.950000 -vt 0.450000 0.950000 -vt 0.500000 0.950000 -vt 0.550000 0.950000 -vt 0.600000 0.950000 -vt 0.650000 0.950000 -vt 0.700000 0.950000 -vt 0.750000 0.950000 -vt 0.800000 0.950000 -vt 0.850000 0.950000 -vt 0.900000 0.950000 -vt 0.950000 0.950000 -vt 1.000000 0.950000 -vt 0.025000 0.000000 -vt 0.075000 0.000000 -vt 0.125000 0.000000 -vt 0.175000 0.000000 -vt 0.225000 0.000000 -vt 0.275000 0.000000 -vt 0.325000 0.000000 -vt 0.375000 0.000000 -vt 0.425000 0.000000 -vt 0.475000 0.000000 -vt 0.525000 0.000000 -vt 0.575000 0.000000 -vt 0.625000 0.000000 -vt 0.675000 0.000000 -vt 0.725000 0.000000 -vt 0.775000 0.000000 -vt 0.825000 0.000000 -vt 0.875000 0.000000 -vt 0.925000 0.000000 -vt 0.975000 0.000000 -vt 0.025000 1.000000 -vt 0.075000 1.000000 -vt 0.125000 1.000000 -vt 0.175000 1.000000 -vt 0.225000 1.000000 -vt 0.275000 1.000000 -vt 0.325000 1.000000 -vt 0.375000 1.000000 -vt 0.425000 1.000000 -vt 0.475000 1.000000 -vt 0.525000 1.000000 -vt 0.575000 1.000000 -vt 0.625000 1.000000 -vt 0.675000 1.000000 -vt 0.725000 1.000000 -vt 0.775000 1.000000 -vt 0.825000 1.000000 -vt 0.875000 1.000000 -vt 0.925000 1.000000 -vt 0.975000 1.000000 -vn 0.162626 -0.985443 -0.049557 -vn 0.139353 -0.985443 -0.097386 -vn 0.307374 -0.946801 -0.095332 -vn 0.262871 -0.946801 -0.185651 -vn 0.102439 -0.985443 -0.135681 -vn 0.192636 -0.946801 -0.257796 -vn 0.055497 -0.985443 -0.160696 -vn 0.103544 -0.946801 -0.304706 -vn 0.003123 -0.985443 -0.169981 -vn 0.004317 -0.946801 -0.321789 -vn -0.049557 -0.985442 -0.162626 -vn -0.095333 -0.946801 -0.307374 -vn -0.097386 -0.985442 -0.139353 -vn -0.185651 -0.946801 -0.262871 -vn -0.135682 -0.985443 -0.102439 -vn -0.257796 -0.946801 -0.192635 -vn -0.160696 -0.985443 -0.055497 -vn -0.304706 -0.946801 -0.103544 -vn -0.169981 -0.985443 -0.003123 -vn -0.321790 -0.946801 -0.004318 -vn -0.162626 -0.985443 0.049556 -vn -0.307374 -0.946801 0.095333 -vn -0.139353 -0.985443 0.097384 -vn -0.262871 -0.946801 0.185651 -vn -0.102439 -0.985443 0.135680 -vn -0.192636 -0.946801 0.257796 -vn -0.055497 -0.985442 0.160696 -vn -0.103544 -0.946801 0.304707 -vn -0.003123 -0.985443 0.169981 -vn -0.004317 -0.946802 0.321789 -vn 0.049557 -0.985442 0.162627 -vn 0.095333 -0.946801 0.307374 -vn 0.097386 -0.985442 0.139354 -vn 0.185651 -0.946801 0.262871 -vn 0.135682 -0.985442 0.102439 -vn 0.257796 -0.946801 0.192636 -vn 0.160696 -0.985443 0.055497 -vn 0.304706 -0.946801 0.103544 -vn 0.169981 -0.985443 0.003123 -vn 0.321790 -0.946801 0.004317 -vn 0.443773 -0.885332 -0.138754 -vn 0.379175 -0.885332 -0.269096 -vn 0.277462 -0.885332 -0.373097 -vn 0.148589 -0.885333 -0.440577 -vn 0.005170 -0.885332 -0.464930 -vn -0.138754 -0.885332 -0.443773 -vn -0.269096 -0.885332 -0.379175 -vn -0.373097 -0.885332 -0.277462 -vn -0.440577 -0.885332 -0.148589 -vn -0.464930 -0.885332 -0.005171 -vn -0.443773 -0.885332 0.138754 -vn -0.379176 -0.885332 0.269096 -vn -0.277462 -0.885332 0.373097 -vn -0.148589 -0.885332 0.440577 -vn -0.005170 -0.885332 0.464930 -vn 0.138754 -0.885332 0.443773 -vn 0.269096 -0.885332 0.379176 -vn 0.373097 -0.885332 0.277462 -vn 0.440577 -0.885332 0.148589 -vn 0.464930 -0.885332 0.005171 -vn 0.569006 -0.802583 -0.179146 -vn 0.485797 -0.802583 -0.346211 -vn 0.355036 -0.802583 -0.479386 -vn 0.189521 -0.802583 -0.565635 -vn 0.005454 -0.802583 -0.596516 -vn -0.179147 -0.802583 -0.569006 -vn -0.346211 -0.802583 -0.485797 -vn -0.479386 -0.802583 -0.355036 -vn -0.565635 -0.802583 -0.189521 -vn -0.596516 -0.802583 -0.005454 -vn -0.569006 -0.802583 0.179146 -vn -0.485798 -0.802583 0.346211 -vn -0.355036 -0.802583 0.479386 -vn -0.189521 -0.802583 0.565635 -vn -0.005454 -0.802583 0.596516 -vn 0.179146 -0.802583 0.569006 -vn 0.346211 -0.802582 0.485798 -vn 0.479386 -0.802583 0.355036 -vn 0.565635 -0.802583 0.189521 -vn 0.596516 -0.802583 0.005455 -vn 0.680269 -0.700559 -0.215525 -vn 0.580373 -0.700559 -0.415192 -vn 0.423666 -0.700559 -0.574216 -vn 0.225488 -0.700559 -0.677032 -vn 0.005237 -0.700559 -0.713576 -vn -0.215526 -0.700559 -0.680269 -vn -0.415192 -0.700559 -0.580373 -vn -0.574217 -0.700559 -0.423666 -vn -0.677032 -0.700559 -0.225488 -vn -0.713576 -0.700559 -0.005237 -vn -0.680269 -0.700559 0.215526 -vn -0.580373 -0.700559 0.415192 -vn -0.423666 -0.700559 0.574217 -vn -0.225488 -0.700559 0.677033 -vn -0.005237 -0.700559 0.713576 -vn 0.215526 -0.700559 0.680269 -vn 0.415192 -0.700559 0.580373 -vn 0.574217 -0.700559 0.423666 -vn 0.677032 -0.700559 0.225488 -vn 0.713576 -0.700558 0.005238 -vn 0.774995 -0.581722 -0.246947 -vn 0.660752 -0.581722 -0.474348 -vn 0.481831 -0.581722 -0.655315 -vn 0.255745 -0.581722 -0.772136 -vn 0.004625 -0.581722 -0.813375 -vn -0.246948 -0.581722 -0.774994 -vn -0.474348 -0.581722 -0.660752 -vn -0.655315 -0.581722 -0.481831 -vn -0.772136 -0.581722 -0.255745 -vn -0.813375 -0.581722 -0.004625 -vn -0.774994 -0.581722 0.246948 -vn -0.660752 -0.581722 0.474348 -vn -0.481831 -0.581722 0.655315 -vn -0.255745 -0.581722 0.772136 -vn -0.004625 -0.581722 0.813375 -vn 0.246948 -0.581722 0.774995 -vn 0.474348 -0.581722 0.660753 -vn 0.655315 -0.581722 0.481832 -vn 0.772136 -0.581722 0.255745 -vn 0.813375 -0.581722 0.004626 -vn 0.850971 -0.448937 -0.272589 -vn 0.725086 -0.448937 -0.522213 -vn 0.528225 -0.448937 -0.720718 -vn 0.279658 -0.448937 -0.848674 -vn 0.003715 -0.448937 -0.893556 -vn -0.272590 -0.448937 -0.850970 -vn -0.522213 -0.448937 -0.725085 -vn -0.720718 -0.448937 -0.528225 -vn -0.848674 -0.448937 -0.279657 -vn -0.893556 -0.448937 -0.003716 -vn -0.850970 -0.448937 0.272590 -vn -0.725086 -0.448937 0.522213 -vn -0.528225 -0.448937 0.720718 -vn -0.279658 -0.448937 0.848674 -vn -0.003716 -0.448937 0.893556 -vn 0.272590 -0.448937 0.850970 -vn 0.522213 -0.448937 0.725086 -vn 0.720718 -0.448937 0.528225 -vn 0.848674 -0.448937 0.279658 -vn 0.893556 -0.448937 0.003716 -vn 0.906418 -0.305397 -0.291786 -vn 0.771887 -0.305397 -0.557605 -vn 0.561799 -0.305397 -0.768840 -vn 0.296718 -0.305397 -0.904815 -vn 0.002592 -0.305397 -0.952222 -vn -0.291788 -0.305397 -0.906417 -vn -0.557605 -0.305397 -0.771887 -vn -0.768840 -0.305397 -0.561799 -vn -0.904816 -0.305397 -0.296718 -vn -0.952222 -0.305397 -0.002592 -vn -0.906418 -0.305397 0.291787 -vn -0.771887 -0.305397 0.557605 -vn -0.561799 -0.305397 0.768840 -vn -0.296718 -0.305397 0.904816 -vn -0.002592 -0.305397 0.952222 -vn 0.291787 -0.305397 0.906418 -vn 0.557605 -0.305397 0.771887 -vn 0.768840 -0.305397 0.561799 -vn 0.904816 -0.305397 0.296718 -vn 0.952222 -0.305397 0.002593 -vn 0.940040 -0.154547 -0.304038 -vn 0.800078 -0.154547 -0.579647 -vn 0.581799 -0.154547 -0.798515 -vn 0.306569 -0.154547 -0.939218 -vn 0.001330 -0.154547 -0.987985 -vn -0.304039 -0.154547 -0.940040 -vn -0.579647 -0.154547 -0.800078 -vn -0.798515 -0.154547 -0.581799 -vn -0.939218 -0.154547 -0.306569 -vn -0.987985 -0.154547 -0.001330 -vn -0.940040 -0.154547 0.304039 -vn -0.800078 -0.154547 0.579647 -vn -0.581799 -0.154547 0.798514 -vn -0.306569 -0.154547 0.939218 -vn -0.001330 -0.154547 0.987985 -vn 0.304039 -0.154547 0.940040 -vn 0.579647 -0.154547 0.800078 -vn 0.798514 -0.154547 0.581799 -vn 0.939218 -0.154547 0.306569 -vn 0.987985 -0.154547 0.001331 -vn 0.951057 -0.000000 -0.309016 -vn 0.809017 0.000000 -0.587785 -vn 0.587785 0.000000 -0.809017 -vn 0.309017 -0.000000 -0.951057 -vn -0.000000 0.000000 -1.000000 -vn -0.309017 0.000000 -0.951057 -vn -0.587785 -0.000000 -0.809017 -vn -0.809017 -0.000000 -0.587785 -vn -0.951057 0.000000 -0.309017 -vn -1.000000 0.000000 0.000000 -vn -0.951057 0.000000 0.309017 -vn -0.809017 0.000000 0.587785 -vn -0.587785 0.000000 0.809017 -vn -0.309017 0.000000 0.951057 -vn 0.000000 0.000000 1.000000 -vn 0.309017 0.000000 0.951057 -vn 0.587785 -0.000000 0.809017 -vn 0.809017 0.000000 0.587785 -vn 0.951057 -0.000000 0.309017 -vn 1.000000 0.000000 0.000001 -vn 0.939218 0.154547 -0.306568 -vn 0.798514 0.154548 -0.581799 -vn 0.579647 0.154547 -0.800078 -vn 0.304039 0.154547 -0.940040 -vn -0.001330 0.154547 -0.987985 -vn -0.306569 0.154547 -0.939218 -vn -0.581799 0.154547 -0.798514 -vn -0.800078 0.154547 -0.579646 -vn -0.940040 0.154547 -0.304039 -vn -0.987985 0.154547 0.001330 -vn -0.939218 0.154547 0.306569 -vn -0.798514 0.154547 0.581799 -vn -0.579646 0.154547 0.800078 -vn -0.304039 0.154547 0.940040 -vn 0.001330 0.154547 0.987985 -vn 0.306569 0.154547 0.939218 -vn 0.581799 0.154547 0.798514 -vn 0.800078 0.154547 0.579647 -vn 0.940040 0.154547 0.304039 -vn 0.987984 0.154547 -0.001329 -vn 0.904816 0.305397 -0.296717 -vn 0.768840 0.305397 -0.561799 -vn 0.557605 0.305397 -0.771887 -vn 0.291787 0.305397 -0.906418 -vn -0.002592 0.305397 -0.952222 -vn -0.296718 0.305397 -0.904815 -vn -0.561799 0.305397 -0.768840 -vn -0.771887 0.305397 -0.557604 -vn -0.906417 0.305397 -0.291787 -vn -0.952222 0.305397 0.002592 -vn -0.904816 0.305397 0.296718 -vn -0.768840 0.305397 0.561799 -vn -0.557605 0.305397 0.771887 -vn -0.291787 0.305397 0.906418 -vn 0.002592 0.305397 0.952222 -vn 0.296718 0.305397 0.904816 -vn 0.561799 0.305397 0.768840 -vn 0.771887 0.305397 0.557605 -vn 0.906418 0.305397 0.291787 -vn 0.952222 0.305397 -0.002591 -vn 0.848674 0.448937 -0.279657 -vn 0.720718 0.448937 -0.528225 -vn 0.522213 0.448937 -0.725086 -vn 0.272590 0.448937 -0.850970 -vn -0.003716 0.448937 -0.893556 -vn -0.279658 0.448937 -0.848674 -vn -0.528225 0.448937 -0.720718 -vn -0.725086 0.448937 -0.522213 -vn -0.850970 0.448937 -0.272590 -vn -0.893556 0.448937 0.003716 -vn -0.848674 0.448937 0.279658 -vn -0.720718 0.448937 0.528225 -vn -0.522213 0.448937 0.725086 -vn -0.272590 0.448937 0.850970 -vn 0.003716 0.448937 0.893556 -vn 0.279658 0.448937 0.848674 -vn 0.528225 0.448937 0.720718 -vn 0.725086 0.448937 0.522213 -vn 0.850970 0.448937 0.272590 -vn 0.893556 0.448937 -0.003715 -vn 0.772136 0.581722 -0.255745 -vn 0.655315 0.581722 -0.481832 -vn 0.474347 0.581722 -0.660752 -vn 0.246948 0.581722 -0.774994 -vn -0.004625 0.581722 -0.813375 -vn -0.255746 0.581722 -0.772136 -vn -0.481832 0.581722 -0.655315 -vn -0.660753 0.581722 -0.474348 -vn -0.774994 0.581722 -0.246948 -vn -0.813375 0.581722 0.004625 -vn -0.772136 0.581722 0.255745 -vn -0.655315 0.581722 0.481832 -vn -0.474347 0.581722 0.660753 -vn -0.246948 0.581722 0.774995 -vn 0.004625 0.581722 0.813375 -vn 0.255746 0.581722 0.772136 -vn 0.481831 0.581722 0.655315 -vn 0.660752 0.581722 0.474348 -vn 0.774994 0.581722 0.246948 -vn 0.813375 0.581722 -0.004624 -vn 0.677033 0.700559 -0.225487 -vn 0.574216 0.700559 -0.423666 -vn 0.415192 0.700559 -0.580373 -vn 0.215526 0.700559 -0.680269 -vn -0.005237 0.700559 -0.713576 -vn -0.225488 0.700559 -0.677032 -vn -0.423666 0.700559 -0.574216 -vn -0.580373 0.700559 -0.415192 -vn -0.680269 0.700559 -0.215526 -vn -0.713576 0.700559 0.005237 -vn -0.677032 0.700559 0.225488 -vn -0.574217 0.700558 0.423666 -vn -0.415192 0.700559 0.580373 -vn -0.215526 0.700559 0.680269 -vn 0.005237 0.700559 0.713576 -vn 0.225488 0.700559 0.677032 -vn 0.423666 0.700559 0.574216 -vn 0.580373 0.700559 0.415192 -vn 0.680269 0.700559 0.215526 -vn 0.713576 0.700559 -0.005236 -vn 0.565635 0.802583 -0.189520 -vn 0.479385 0.802583 -0.355036 -vn 0.346211 0.802583 -0.485798 -vn 0.179146 0.802583 -0.569006 -vn -0.005454 0.802583 -0.596516 -vn -0.189521 0.802583 -0.565635 -vn -0.355036 0.802583 -0.479386 -vn -0.485798 0.802583 -0.346211 -vn -0.569006 0.802583 -0.179146 -vn -0.596516 0.802583 0.005454 -vn -0.565635 0.802583 0.189521 -vn -0.479386 0.802583 0.355036 -vn -0.346211 0.802583 0.485798 -vn -0.179146 0.802583 0.569006 -vn 0.005454 0.802583 0.596516 -vn 0.189521 0.802583 0.565635 -vn 0.355036 0.802583 0.479386 -vn 0.485798 0.802583 0.346211 -vn 0.569006 0.802583 0.179146 -vn 0.596516 0.802583 -0.005454 -vn 0.440577 0.885332 -0.148588 -vn 0.373097 0.885332 -0.277462 -vn 0.269096 0.885332 -0.379176 -vn 0.138754 0.885332 -0.443772 -vn -0.005171 0.885332 -0.464930 -vn -0.148589 0.885332 -0.440577 -vn -0.277462 0.885332 -0.373097 -vn -0.379176 0.885332 -0.269096 -vn -0.443773 0.885332 -0.138754 -vn -0.464930 0.885332 0.005170 -vn -0.440577 0.885332 0.148588 -vn -0.373097 0.885332 0.277462 -vn -0.269096 0.885332 0.379176 -vn -0.138754 0.885332 0.443773 -vn 0.005171 0.885332 0.464930 -vn 0.148589 0.885332 0.440577 -vn 0.277462 0.885332 0.373097 -vn 0.379176 0.885332 0.269096 -vn 0.443773 0.885332 0.138754 -vn 0.464930 0.885332 -0.005170 -vn 0.304706 0.946801 -0.103544 -vn 0.257796 0.946801 -0.192636 -vn 0.185651 0.946801 -0.262871 -vn 0.095333 0.946801 -0.307374 -vn -0.004317 0.946801 -0.321789 -vn -0.103544 0.946801 -0.304706 -vn -0.192636 0.946801 -0.257796 -vn -0.262871 0.946801 -0.185651 -vn -0.307374 0.946801 -0.095333 -vn -0.321790 0.946801 0.004317 -vn -0.304706 0.946801 0.103544 -vn -0.257796 0.946801 0.192636 -vn -0.185651 0.946801 0.262871 -vn -0.095333 0.946801 0.307374 -vn 0.004317 0.946801 0.321789 -vn 0.103544 0.946801 0.304706 -vn 0.192636 0.946801 0.257796 -vn 0.262871 0.946801 0.185651 -vn 0.307374 0.946801 0.095333 -vn 0.321790 0.946801 -0.004317 -vn 0.160696 0.985443 -0.055497 -vn 0.135682 0.985443 -0.102438 -vn 0.097386 0.985443 -0.139352 -vn 0.049557 0.985442 -0.162627 -vn -0.003123 0.985443 -0.169981 -vn -0.055497 0.985443 -0.160696 -vn -0.102439 0.985443 -0.135680 -vn -0.139353 0.985443 -0.097384 -vn -0.162626 0.985443 -0.049557 -vn -0.169981 0.985442 0.003123 -vn -0.160696 0.985442 0.055497 -vn -0.135682 0.985442 0.102439 -vn -0.097386 0.985442 0.139353 -vn -0.049557 0.985443 0.162627 -vn 0.003123 0.985442 0.169981 -vn 0.055497 0.985443 0.160696 -vn 0.102439 0.985443 0.135680 -vn 0.139353 0.985443 0.097385 -vn 0.162626 0.985443 0.049557 -vn 0.169981 0.985443 -0.003123 -vn -0.000000 -1.000000 -0.000000 -vn -0.000000 1.000000 0.000000 -f 765/879/765 766/880/766 785/900/767 -f 785/900/767 766/880/766 786/901/768 -f 766/880/766 767/881/769 786/901/768 -f 786/901/768 767/881/769 787/902/770 -f 767/881/769 768/882/771 787/902/770 -f 787/902/770 768/882/771 788/903/772 -f 768/882/771 769/883/773 788/903/772 -f 788/903/772 769/883/773 789/904/774 -f 769/883/773 770/884/775 789/904/774 -f 789/904/774 770/884/775 790/905/776 -f 770/884/775 771/885/777 790/905/776 -f 790/905/776 771/885/777 791/906/778 -f 771/885/777 772/886/779 791/906/778 -f 791/906/778 772/886/779 792/907/780 -f 772/886/779 773/887/781 792/907/780 -f 792/907/780 773/887/781 793/908/782 -f 773/887/781 774/888/783 793/908/782 -f 793/908/782 774/888/783 794/909/784 -f 774/888/783 775/889/785 794/909/784 -f 794/909/784 775/889/785 795/910/786 -f 775/889/785 776/890/787 795/910/786 -f 795/910/786 776/890/787 796/911/788 -f 776/890/787 777/891/789 796/911/788 -f 796/911/788 777/891/789 797/912/790 -f 777/891/789 778/892/791 797/912/790 -f 797/912/790 778/892/791 798/913/792 -f 778/892/791 779/893/793 798/913/792 -f 798/913/792 779/893/793 799/914/794 -f 779/893/793 780/894/795 799/914/794 -f 799/914/794 780/894/795 800/915/796 -f 780/894/795 781/895/797 800/915/796 -f 800/915/796 781/895/797 801/916/798 -f 781/895/797 782/896/799 801/916/798 -f 801/916/798 782/896/799 802/917/800 -f 782/896/799 783/897/801 802/917/800 -f 802/917/800 783/897/801 803/918/802 -f 783/897/801 784/898/803 803/918/802 -f 803/918/802 784/898/803 804/919/804 -f 784/898/803 765/899/765 804/919/804 -f 804/919/804 765/899/765 785/920/767 -f 785/900/767 786/901/768 805/921/805 -f 805/921/805 786/901/768 806/922/806 -f 786/901/768 787/902/770 806/922/806 -f 806/922/806 787/902/770 807/923/807 -f 787/902/770 788/903/772 807/923/807 -f 807/923/807 788/903/772 808/924/808 -f 788/903/772 789/904/774 808/924/808 -f 808/924/808 789/904/774 809/925/809 -f 789/904/774 790/905/776 809/925/809 -f 809/925/809 790/905/776 810/926/810 -f 790/905/776 791/906/778 810/926/810 -f 810/926/810 791/906/778 811/927/811 -f 791/906/778 792/907/780 811/927/811 -f 811/927/811 792/907/780 812/928/812 -f 792/907/780 793/908/782 812/928/812 -f 812/928/812 793/908/782 813/929/813 -f 793/908/782 794/909/784 813/929/813 -f 813/929/813 794/909/784 814/930/814 -f 794/909/784 795/910/786 814/930/814 -f 814/930/814 795/910/786 815/931/815 -f 795/910/786 796/911/788 815/931/815 -f 815/931/815 796/911/788 816/932/816 -f 796/911/788 797/912/790 816/932/816 -f 816/932/816 797/912/790 817/933/817 -f 797/912/790 798/913/792 817/933/817 -f 817/933/817 798/913/792 818/934/818 -f 798/913/792 799/914/794 818/934/818 -f 818/934/818 799/914/794 819/935/819 -f 799/914/794 800/915/796 819/935/819 -f 819/935/819 800/915/796 820/936/820 -f 800/915/796 801/916/798 820/936/820 -f 820/936/820 801/916/798 821/937/821 -f 801/916/798 802/917/800 821/937/821 -f 821/937/821 802/917/800 822/938/822 -f 802/917/800 803/918/802 822/938/822 -f 822/938/822 803/918/802 823/939/823 -f 803/918/802 804/919/804 823/939/823 -f 823/939/823 804/919/804 824/940/824 -f 804/919/804 785/920/767 824/940/824 -f 824/940/824 785/920/767 805/941/805 -f 805/921/805 806/922/806 825/942/825 -f 825/942/825 806/922/806 826/943/826 -f 806/922/806 807/923/807 826/943/826 -f 826/943/826 807/923/807 827/944/827 -f 807/923/807 808/924/808 827/944/827 -f 827/944/827 808/924/808 828/945/828 -f 808/924/808 809/925/809 828/945/828 -f 828/945/828 809/925/809 829/946/829 -f 809/925/809 810/926/810 829/946/829 -f 829/946/829 810/926/810 830/947/830 -f 810/926/810 811/927/811 830/947/830 -f 830/947/830 811/927/811 831/948/831 -f 811/927/811 812/928/812 831/948/831 -f 831/948/831 812/928/812 832/949/832 -f 812/928/812 813/929/813 832/949/832 -f 832/949/832 813/929/813 833/950/833 -f 813/929/813 814/930/814 833/950/833 -f 833/950/833 814/930/814 834/951/834 -f 814/930/814 815/931/815 834/951/834 -f 834/951/834 815/931/815 835/952/835 -f 815/931/815 816/932/816 835/952/835 -f 835/952/835 816/932/816 836/953/836 -f 816/932/816 817/933/817 836/953/836 -f 836/953/836 817/933/817 837/954/837 -f 817/933/817 818/934/818 837/954/837 -f 837/954/837 818/934/818 838/955/838 -f 818/934/818 819/935/819 838/955/838 -f 838/955/838 819/935/819 839/956/839 -f 819/935/819 820/936/820 839/956/839 -f 839/956/839 820/936/820 840/957/840 -f 820/936/820 821/937/821 840/957/840 -f 840/957/840 821/937/821 841/958/841 -f 821/937/821 822/938/822 841/958/841 -f 841/958/841 822/938/822 842/959/842 -f 822/938/822 823/939/823 842/959/842 -f 842/959/842 823/939/823 843/960/843 -f 823/939/823 824/940/824 843/960/843 -f 843/960/843 824/940/824 844/961/844 -f 824/940/824 805/941/805 844/961/844 -f 844/961/844 805/941/805 825/962/825 -f 825/942/825 826/943/826 845/963/845 -f 845/963/845 826/943/826 846/964/846 -f 826/943/826 827/944/827 846/964/846 -f 846/964/846 827/944/827 847/965/847 -f 827/944/827 828/945/828 847/965/847 -f 847/965/847 828/945/828 848/966/848 -f 828/945/828 829/946/829 848/966/848 -f 848/966/848 829/946/829 849/967/849 -f 829/946/829 830/947/830 849/967/849 -f 849/967/849 830/947/830 850/968/850 -f 830/947/830 831/948/831 850/968/850 -f 850/968/850 831/948/831 851/969/851 -f 831/948/831 832/949/832 851/969/851 -f 851/969/851 832/949/832 852/970/852 -f 832/949/832 833/950/833 852/970/852 -f 852/970/852 833/950/833 853/971/853 -f 833/950/833 834/951/834 853/971/853 -f 853/971/853 834/951/834 854/972/854 -f 834/951/834 835/952/835 854/972/854 -f 854/972/854 835/952/835 855/973/855 -f 835/952/835 836/953/836 855/973/855 -f 855/973/855 836/953/836 856/974/856 -f 836/953/836 837/954/837 856/974/856 -f 856/974/856 837/954/837 857/975/857 -f 837/954/837 838/955/838 857/975/857 -f 857/975/857 838/955/838 858/976/858 -f 838/955/838 839/956/839 858/976/858 -f 858/976/858 839/956/839 859/977/859 -f 839/956/839 840/957/840 859/977/859 -f 859/977/859 840/957/840 860/978/860 -f 840/957/840 841/958/841 860/978/860 -f 860/978/860 841/958/841 861/979/861 -f 841/958/841 842/959/842 861/979/861 -f 861/979/861 842/959/842 862/980/862 -f 842/959/842 843/960/843 862/980/862 -f 862/980/862 843/960/843 863/981/863 -f 843/960/843 844/961/844 863/981/863 -f 863/981/863 844/961/844 864/982/864 -f 844/961/844 825/962/825 864/982/864 -f 864/982/864 825/962/825 845/983/845 -f 845/963/845 846/964/846 865/984/865 -f 865/984/865 846/964/846 866/985/866 -f 846/964/846 847/965/847 866/985/866 -f 866/985/866 847/965/847 867/986/867 -f 847/965/847 848/966/848 867/986/867 -f 867/986/867 848/966/848 868/987/868 -f 848/966/848 849/967/849 868/987/868 -f 868/987/868 849/967/849 869/988/869 -f 849/967/849 850/968/850 869/988/869 -f 869/988/869 850/968/850 870/989/870 -f 850/968/850 851/969/851 870/989/870 -f 870/989/870 851/969/851 871/990/871 -f 851/969/851 852/970/852 871/990/871 -f 871/990/871 852/970/852 872/991/872 -f 852/970/852 853/971/853 872/991/872 -f 872/991/872 853/971/853 873/992/873 -f 853/971/853 854/972/854 873/992/873 -f 873/992/873 854/972/854 874/993/874 -f 854/972/854 855/973/855 874/993/874 -f 874/993/874 855/973/855 875/994/875 -f 855/973/855 856/974/856 875/994/875 -f 875/994/875 856/974/856 876/995/876 -f 856/974/856 857/975/857 876/995/876 -f 876/995/876 857/975/857 877/996/877 -f 857/975/857 858/976/858 877/996/877 -f 877/996/877 858/976/858 878/997/878 -f 858/976/858 859/977/859 878/997/878 -f 878/997/878 859/977/859 879/998/879 -f 859/977/859 860/978/860 879/998/879 -f 879/998/879 860/978/860 880/999/880 -f 860/978/860 861/979/861 880/999/880 -f 880/999/880 861/979/861 881/1000/881 -f 861/979/861 862/980/862 881/1000/881 -f 881/1000/881 862/980/862 882/1001/882 -f 862/980/862 863/981/863 882/1001/882 -f 882/1001/882 863/981/863 883/1002/883 -f 863/981/863 864/982/864 883/1002/883 -f 883/1002/883 864/982/864 884/1003/884 -f 864/982/864 845/983/845 884/1003/884 -f 884/1003/884 845/983/845 865/1004/865 -f 865/984/865 866/985/866 885/1005/885 -f 885/1005/885 866/985/866 886/1006/886 -f 866/985/866 867/986/867 886/1006/886 -f 886/1006/886 867/986/867 887/1007/887 -f 867/986/867 868/987/868 887/1007/887 -f 887/1007/887 868/987/868 888/1008/888 -f 868/987/868 869/988/869 888/1008/888 -f 888/1008/888 869/988/869 889/1009/889 -f 869/988/869 870/989/870 889/1009/889 -f 889/1009/889 870/989/870 890/1010/890 -f 870/989/870 871/990/871 890/1010/890 -f 890/1010/890 871/990/871 891/1011/891 -f 871/990/871 872/991/872 891/1011/891 -f 891/1011/891 872/991/872 892/1012/892 -f 872/991/872 873/992/873 892/1012/892 -f 892/1012/892 873/992/873 893/1013/893 -f 873/992/873 874/993/874 893/1013/893 -f 893/1013/893 874/993/874 894/1014/894 -f 874/993/874 875/994/875 894/1014/894 -f 894/1014/894 875/994/875 895/1015/895 -f 875/994/875 876/995/876 895/1015/895 -f 895/1015/895 876/995/876 896/1016/896 -f 876/995/876 877/996/877 896/1016/896 -f 896/1016/896 877/996/877 897/1017/897 -f 877/996/877 878/997/878 897/1017/897 -f 897/1017/897 878/997/878 898/1018/898 -f 878/997/878 879/998/879 898/1018/898 -f 898/1018/898 879/998/879 899/1019/899 -f 879/998/879 880/999/880 899/1019/899 -f 899/1019/899 880/999/880 900/1020/900 -f 880/999/880 881/1000/881 900/1020/900 -f 900/1020/900 881/1000/881 901/1021/901 -f 881/1000/881 882/1001/882 901/1021/901 -f 901/1021/901 882/1001/882 902/1022/902 -f 882/1001/882 883/1002/883 902/1022/902 -f 902/1022/902 883/1002/883 903/1023/903 -f 883/1002/883 884/1003/884 903/1023/903 -f 903/1023/903 884/1003/884 904/1024/904 -f 884/1003/884 865/1004/865 904/1024/904 -f 904/1024/904 865/1004/865 885/1025/885 -f 885/1005/885 886/1006/886 905/1026/905 -f 905/1026/905 886/1006/886 906/1027/906 -f 886/1006/886 887/1007/887 906/1027/906 -f 906/1027/906 887/1007/887 907/1028/907 -f 887/1007/887 888/1008/888 907/1028/907 -f 907/1028/907 888/1008/888 908/1029/908 -f 888/1008/888 889/1009/889 908/1029/908 -f 908/1029/908 889/1009/889 909/1030/909 -f 889/1009/889 890/1010/890 909/1030/909 -f 909/1030/909 890/1010/890 910/1031/910 -f 890/1010/890 891/1011/891 910/1031/910 -f 910/1031/910 891/1011/891 911/1032/911 -f 891/1011/891 892/1012/892 911/1032/911 -f 911/1032/911 892/1012/892 912/1033/912 -f 892/1012/892 893/1013/893 912/1033/912 -f 912/1033/912 893/1013/893 913/1034/913 -f 893/1013/893 894/1014/894 913/1034/913 -f 913/1034/913 894/1014/894 914/1035/914 -f 894/1014/894 895/1015/895 914/1035/914 -f 914/1035/914 895/1015/895 915/1036/915 -f 895/1015/895 896/1016/896 915/1036/915 -f 915/1036/915 896/1016/896 916/1037/916 -f 896/1016/896 897/1017/897 916/1037/916 -f 916/1037/916 897/1017/897 917/1038/917 -f 897/1017/897 898/1018/898 917/1038/917 -f 917/1038/917 898/1018/898 918/1039/918 -f 898/1018/898 899/1019/899 918/1039/918 -f 918/1039/918 899/1019/899 919/1040/919 -f 899/1019/899 900/1020/900 919/1040/919 -f 919/1040/919 900/1020/900 920/1041/920 -f 900/1020/900 901/1021/901 920/1041/920 -f 920/1041/920 901/1021/901 921/1042/921 -f 901/1021/901 902/1022/902 921/1042/921 -f 921/1042/921 902/1022/902 922/1043/922 -f 902/1022/902 903/1023/903 922/1043/922 -f 922/1043/922 903/1023/903 923/1044/923 -f 903/1023/903 904/1024/904 923/1044/923 -f 923/1044/923 904/1024/904 924/1045/924 -f 904/1024/904 885/1025/885 924/1045/924 -f 924/1045/924 885/1025/885 905/1046/905 -f 905/1026/905 906/1027/906 925/1047/925 -f 925/1047/925 906/1027/906 926/1048/926 -f 906/1027/906 907/1028/907 926/1048/926 -f 926/1048/926 907/1028/907 927/1049/927 -f 907/1028/907 908/1029/908 927/1049/927 -f 927/1049/927 908/1029/908 928/1050/928 -f 908/1029/908 909/1030/909 928/1050/928 -f 928/1050/928 909/1030/909 929/1051/929 -f 909/1030/909 910/1031/910 929/1051/929 -f 929/1051/929 910/1031/910 930/1052/930 -f 910/1031/910 911/1032/911 930/1052/930 -f 930/1052/930 911/1032/911 931/1053/931 -f 911/1032/911 912/1033/912 931/1053/931 -f 931/1053/931 912/1033/912 932/1054/932 -f 912/1033/912 913/1034/913 932/1054/932 -f 932/1054/932 913/1034/913 933/1055/933 -f 913/1034/913 914/1035/914 933/1055/933 -f 933/1055/933 914/1035/914 934/1056/934 -f 914/1035/914 915/1036/915 934/1056/934 -f 934/1056/934 915/1036/915 935/1057/935 -f 915/1036/915 916/1037/916 935/1057/935 -f 935/1057/935 916/1037/916 936/1058/936 -f 916/1037/916 917/1038/917 936/1058/936 -f 936/1058/936 917/1038/917 937/1059/937 -f 917/1038/917 918/1039/918 937/1059/937 -f 937/1059/937 918/1039/918 938/1060/938 -f 918/1039/918 919/1040/919 938/1060/938 -f 938/1060/938 919/1040/919 939/1061/939 -f 919/1040/919 920/1041/920 939/1061/939 -f 939/1061/939 920/1041/920 940/1062/940 -f 920/1041/920 921/1042/921 940/1062/940 -f 940/1062/940 921/1042/921 941/1063/941 -f 921/1042/921 922/1043/922 941/1063/941 -f 941/1063/941 922/1043/922 942/1064/942 -f 922/1043/922 923/1044/923 942/1064/942 -f 942/1064/942 923/1044/923 943/1065/943 -f 923/1044/923 924/1045/924 943/1065/943 -f 943/1065/943 924/1045/924 944/1066/944 -f 924/1045/924 905/1046/905 944/1066/944 -f 944/1066/944 905/1046/905 925/1067/925 -f 925/1047/925 926/1048/926 945/1068/945 -f 945/1068/945 926/1048/926 946/1069/946 -f 926/1048/926 927/1049/927 946/1069/946 -f 946/1069/946 927/1049/927 947/1070/947 -f 927/1049/927 928/1050/928 947/1070/947 -f 947/1070/947 928/1050/928 948/1071/948 -f 928/1050/928 929/1051/929 948/1071/948 -f 948/1071/948 929/1051/929 949/1072/949 -f 929/1051/929 930/1052/930 949/1072/949 -f 949/1072/949 930/1052/930 950/1073/950 -f 930/1052/930 931/1053/931 950/1073/950 -f 950/1073/950 931/1053/931 951/1074/951 -f 931/1053/931 932/1054/932 951/1074/951 -f 951/1074/951 932/1054/932 952/1075/952 -f 932/1054/932 933/1055/933 952/1075/952 -f 952/1075/952 933/1055/933 953/1076/953 -f 933/1055/933 934/1056/934 953/1076/953 -f 953/1076/953 934/1056/934 954/1077/954 -f 934/1056/934 935/1057/935 954/1077/954 -f 954/1077/954 935/1057/935 955/1078/955 -f 935/1057/935 936/1058/936 955/1078/955 -f 955/1078/955 936/1058/936 956/1079/956 -f 936/1058/936 937/1059/937 956/1079/956 -f 956/1079/956 937/1059/937 957/1080/957 -f 937/1059/937 938/1060/938 957/1080/957 -f 957/1080/957 938/1060/938 958/1081/958 -f 938/1060/938 939/1061/939 958/1081/958 -f 958/1081/958 939/1061/939 959/1082/959 -f 939/1061/939 940/1062/940 959/1082/959 -f 959/1082/959 940/1062/940 960/1083/960 -f 940/1062/940 941/1063/941 960/1083/960 -f 960/1083/960 941/1063/941 961/1084/961 -f 941/1063/941 942/1064/942 961/1084/961 -f 961/1084/961 942/1064/942 962/1085/962 -f 942/1064/942 943/1065/943 962/1085/962 -f 962/1085/962 943/1065/943 963/1086/963 -f 943/1065/943 944/1066/944 963/1086/963 -f 963/1086/963 944/1066/944 964/1087/964 -f 944/1066/944 925/1067/925 964/1087/964 -f 964/1087/964 925/1067/925 945/1088/945 -f 945/1068/945 946/1069/946 965/1089/965 -f 965/1089/965 946/1069/946 966/1090/966 -f 946/1069/946 947/1070/947 966/1090/966 -f 966/1090/966 947/1070/947 967/1091/967 -f 947/1070/947 948/1071/948 967/1091/967 -f 967/1091/967 948/1071/948 968/1092/968 -f 948/1071/948 949/1072/949 968/1092/968 -f 968/1092/968 949/1072/949 969/1093/969 -f 949/1072/949 950/1073/950 969/1093/969 -f 969/1093/969 950/1073/950 970/1094/970 -f 950/1073/950 951/1074/951 970/1094/970 -f 970/1094/970 951/1074/951 971/1095/971 -f 951/1074/951 952/1075/952 971/1095/971 -f 971/1095/971 952/1075/952 972/1096/972 -f 952/1075/952 953/1076/953 972/1096/972 -f 972/1096/972 953/1076/953 973/1097/973 -f 953/1076/953 954/1077/954 973/1097/973 -f 973/1097/973 954/1077/954 974/1098/974 -f 954/1077/954 955/1078/955 974/1098/974 -f 974/1098/974 955/1078/955 975/1099/975 -f 955/1078/955 956/1079/956 975/1099/975 -f 975/1099/975 956/1079/956 976/1100/976 -f 956/1079/956 957/1080/957 976/1100/976 -f 976/1100/976 957/1080/957 977/1101/977 -f 957/1080/957 958/1081/958 977/1101/977 -f 977/1101/977 958/1081/958 978/1102/978 -f 958/1081/958 959/1082/959 978/1102/978 -f 978/1102/978 959/1082/959 979/1103/979 -f 959/1082/959 960/1083/960 979/1103/979 -f 979/1103/979 960/1083/960 980/1104/980 -f 960/1083/960 961/1084/961 980/1104/980 -f 980/1104/980 961/1084/961 981/1105/981 -f 961/1084/961 962/1085/962 981/1105/981 -f 981/1105/981 962/1085/962 982/1106/982 -f 962/1085/962 963/1086/963 982/1106/982 -f 982/1106/982 963/1086/963 983/1107/983 -f 963/1086/963 964/1087/964 983/1107/983 -f 983/1107/983 964/1087/964 984/1108/984 -f 964/1087/964 945/1088/945 984/1108/984 -f 984/1108/984 945/1088/945 965/1109/965 -f 965/1089/965 966/1090/966 985/1110/985 -f 985/1110/985 966/1090/966 986/1111/986 -f 966/1090/966 967/1091/967 986/1111/986 -f 986/1111/986 967/1091/967 987/1112/987 -f 967/1091/967 968/1092/968 987/1112/987 -f 987/1112/987 968/1092/968 988/1113/988 -f 968/1092/968 969/1093/969 988/1113/988 -f 988/1113/988 969/1093/969 989/1114/989 -f 969/1093/969 970/1094/970 989/1114/989 -f 989/1114/989 970/1094/970 990/1115/990 -f 970/1094/970 971/1095/971 990/1115/990 -f 990/1115/990 971/1095/971 991/1116/991 -f 971/1095/971 972/1096/972 991/1116/991 -f 991/1116/991 972/1096/972 992/1117/992 -f 972/1096/972 973/1097/973 992/1117/992 -f 992/1117/992 973/1097/973 993/1118/993 -f 973/1097/973 974/1098/974 993/1118/993 -f 993/1118/993 974/1098/974 994/1119/994 -f 974/1098/974 975/1099/975 994/1119/994 -f 994/1119/994 975/1099/975 995/1120/995 -f 975/1099/975 976/1100/976 995/1120/995 -f 995/1120/995 976/1100/976 996/1121/996 -f 976/1100/976 977/1101/977 996/1121/996 -f 996/1121/996 977/1101/977 997/1122/997 -f 977/1101/977 978/1102/978 997/1122/997 -f 997/1122/997 978/1102/978 998/1123/998 -f 978/1102/978 979/1103/979 998/1123/998 -f 998/1123/998 979/1103/979 999/1124/999 -f 979/1103/979 980/1104/980 999/1124/999 -f 999/1124/999 980/1104/980 1000/1125/1000 -f 980/1104/980 981/1105/981 1000/1125/1000 -f 1000/1125/1000 981/1105/981 1001/1126/1001 -f 981/1105/981 982/1106/982 1001/1126/1001 -f 1001/1126/1001 982/1106/982 1002/1127/1002 -f 982/1106/982 983/1107/983 1002/1127/1002 -f 1002/1127/1002 983/1107/983 1003/1128/1003 -f 983/1107/983 984/1108/984 1003/1128/1003 -f 1003/1128/1003 984/1108/984 1004/1129/1004 -f 984/1108/984 965/1109/965 1004/1129/1004 -f 1004/1129/1004 965/1109/965 985/1130/985 -f 985/1110/985 986/1111/986 1005/1131/1005 -f 1005/1131/1005 986/1111/986 1006/1132/1006 -f 986/1111/986 987/1112/987 1006/1132/1006 -f 1006/1132/1006 987/1112/987 1007/1133/1007 -f 987/1112/987 988/1113/988 1007/1133/1007 -f 1007/1133/1007 988/1113/988 1008/1134/1008 -f 988/1113/988 989/1114/989 1008/1134/1008 -f 1008/1134/1008 989/1114/989 1009/1135/1009 -f 989/1114/989 990/1115/990 1009/1135/1009 -f 1009/1135/1009 990/1115/990 1010/1136/1010 -f 990/1115/990 991/1116/991 1010/1136/1010 -f 1010/1136/1010 991/1116/991 1011/1137/1011 -f 991/1116/991 992/1117/992 1011/1137/1011 -f 1011/1137/1011 992/1117/992 1012/1138/1012 -f 992/1117/992 993/1118/993 1012/1138/1012 -f 1012/1138/1012 993/1118/993 1013/1139/1013 -f 993/1118/993 994/1119/994 1013/1139/1013 -f 1013/1139/1013 994/1119/994 1014/1140/1014 -f 994/1119/994 995/1120/995 1014/1140/1014 -f 1014/1140/1014 995/1120/995 1015/1141/1015 -f 995/1120/995 996/1121/996 1015/1141/1015 -f 1015/1141/1015 996/1121/996 1016/1142/1016 -f 996/1121/996 997/1122/997 1016/1142/1016 -f 1016/1142/1016 997/1122/997 1017/1143/1017 -f 997/1122/997 998/1123/998 1017/1143/1017 -f 1017/1143/1017 998/1123/998 1018/1144/1018 -f 998/1123/998 999/1124/999 1018/1144/1018 -f 1018/1144/1018 999/1124/999 1019/1145/1019 -f 999/1124/999 1000/1125/1000 1019/1145/1019 -f 1019/1145/1019 1000/1125/1000 1020/1146/1020 -f 1000/1125/1000 1001/1126/1001 1020/1146/1020 -f 1020/1146/1020 1001/1126/1001 1021/1147/1021 -f 1001/1126/1001 1002/1127/1002 1021/1147/1021 -f 1021/1147/1021 1002/1127/1002 1022/1148/1022 -f 1002/1127/1002 1003/1128/1003 1022/1148/1022 -f 1022/1148/1022 1003/1128/1003 1023/1149/1023 -f 1003/1128/1003 1004/1129/1004 1023/1149/1023 -f 1023/1149/1023 1004/1129/1004 1024/1150/1024 -f 1004/1129/1004 985/1130/985 1024/1150/1024 -f 1024/1150/1024 985/1130/985 1005/1151/1005 -f 1005/1131/1005 1006/1132/1006 1025/1152/1025 -f 1025/1152/1025 1006/1132/1006 1026/1153/1026 -f 1006/1132/1006 1007/1133/1007 1026/1153/1026 -f 1026/1153/1026 1007/1133/1007 1027/1154/1027 -f 1007/1133/1007 1008/1134/1008 1027/1154/1027 -f 1027/1154/1027 1008/1134/1008 1028/1155/1028 -f 1008/1134/1008 1009/1135/1009 1028/1155/1028 -f 1028/1155/1028 1009/1135/1009 1029/1156/1029 -f 1009/1135/1009 1010/1136/1010 1029/1156/1029 -f 1029/1156/1029 1010/1136/1010 1030/1157/1030 -f 1010/1136/1010 1011/1137/1011 1030/1157/1030 -f 1030/1157/1030 1011/1137/1011 1031/1158/1031 -f 1011/1137/1011 1012/1138/1012 1031/1158/1031 -f 1031/1158/1031 1012/1138/1012 1032/1159/1032 -f 1012/1138/1012 1013/1139/1013 1032/1159/1032 -f 1032/1159/1032 1013/1139/1013 1033/1160/1033 -f 1013/1139/1013 1014/1140/1014 1033/1160/1033 -f 1033/1160/1033 1014/1140/1014 1034/1161/1034 -f 1014/1140/1014 1015/1141/1015 1034/1161/1034 -f 1034/1161/1034 1015/1141/1015 1035/1162/1035 -f 1015/1141/1015 1016/1142/1016 1035/1162/1035 -f 1035/1162/1035 1016/1142/1016 1036/1163/1036 -f 1016/1142/1016 1017/1143/1017 1036/1163/1036 -f 1036/1163/1036 1017/1143/1017 1037/1164/1037 -f 1017/1143/1017 1018/1144/1018 1037/1164/1037 -f 1037/1164/1037 1018/1144/1018 1038/1165/1038 -f 1018/1144/1018 1019/1145/1019 1038/1165/1038 -f 1038/1165/1038 1019/1145/1019 1039/1166/1039 -f 1019/1145/1019 1020/1146/1020 1039/1166/1039 -f 1039/1166/1039 1020/1146/1020 1040/1167/1040 -f 1020/1146/1020 1021/1147/1021 1040/1167/1040 -f 1040/1167/1040 1021/1147/1021 1041/1168/1041 -f 1021/1147/1021 1022/1148/1022 1041/1168/1041 -f 1041/1168/1041 1022/1148/1022 1042/1169/1042 -f 1022/1148/1022 1023/1149/1023 1042/1169/1042 -f 1042/1169/1042 1023/1149/1023 1043/1170/1043 -f 1023/1149/1023 1024/1150/1024 1043/1170/1043 -f 1043/1170/1043 1024/1150/1024 1044/1171/1044 -f 1024/1150/1024 1005/1151/1005 1044/1171/1044 -f 1044/1171/1044 1005/1151/1005 1025/1172/1025 -f 1025/1152/1025 1026/1153/1026 1045/1173/1045 -f 1045/1173/1045 1026/1153/1026 1046/1174/1046 -f 1026/1153/1026 1027/1154/1027 1046/1174/1046 -f 1046/1174/1046 1027/1154/1027 1047/1175/1047 -f 1027/1154/1027 1028/1155/1028 1047/1175/1047 -f 1047/1175/1047 1028/1155/1028 1048/1176/1048 -f 1028/1155/1028 1029/1156/1029 1048/1176/1048 -f 1048/1176/1048 1029/1156/1029 1049/1177/1049 -f 1029/1156/1029 1030/1157/1030 1049/1177/1049 -f 1049/1177/1049 1030/1157/1030 1050/1178/1050 -f 1030/1157/1030 1031/1158/1031 1050/1178/1050 -f 1050/1178/1050 1031/1158/1031 1051/1179/1051 -f 1031/1158/1031 1032/1159/1032 1051/1179/1051 -f 1051/1179/1051 1032/1159/1032 1052/1180/1052 -f 1032/1159/1032 1033/1160/1033 1052/1180/1052 -f 1052/1180/1052 1033/1160/1033 1053/1181/1053 -f 1033/1160/1033 1034/1161/1034 1053/1181/1053 -f 1053/1181/1053 1034/1161/1034 1054/1182/1054 -f 1034/1161/1034 1035/1162/1035 1054/1182/1054 -f 1054/1182/1054 1035/1162/1035 1055/1183/1055 -f 1035/1162/1035 1036/1163/1036 1055/1183/1055 -f 1055/1183/1055 1036/1163/1036 1056/1184/1056 -f 1036/1163/1036 1037/1164/1037 1056/1184/1056 -f 1056/1184/1056 1037/1164/1037 1057/1185/1057 -f 1037/1164/1037 1038/1165/1038 1057/1185/1057 -f 1057/1185/1057 1038/1165/1038 1058/1186/1058 -f 1038/1165/1038 1039/1166/1039 1058/1186/1058 -f 1058/1186/1058 1039/1166/1039 1059/1187/1059 -f 1039/1166/1039 1040/1167/1040 1059/1187/1059 -f 1059/1187/1059 1040/1167/1040 1060/1188/1060 -f 1040/1167/1040 1041/1168/1041 1060/1188/1060 -f 1060/1188/1060 1041/1168/1041 1061/1189/1061 -f 1041/1168/1041 1042/1169/1042 1061/1189/1061 -f 1061/1189/1061 1042/1169/1042 1062/1190/1062 -f 1042/1169/1042 1043/1170/1043 1062/1190/1062 -f 1062/1190/1062 1043/1170/1043 1063/1191/1063 -f 1043/1170/1043 1044/1171/1044 1063/1191/1063 -f 1063/1191/1063 1044/1171/1044 1064/1192/1064 -f 1044/1171/1044 1025/1172/1025 1064/1192/1064 -f 1064/1192/1064 1025/1172/1025 1045/1193/1045 -f 1045/1173/1045 1046/1174/1046 1065/1194/1065 -f 1065/1194/1065 1046/1174/1046 1066/1195/1066 -f 1046/1174/1046 1047/1175/1047 1066/1195/1066 -f 1066/1195/1066 1047/1175/1047 1067/1196/1067 -f 1047/1175/1047 1048/1176/1048 1067/1196/1067 -f 1067/1196/1067 1048/1176/1048 1068/1197/1068 -f 1048/1176/1048 1049/1177/1049 1068/1197/1068 -f 1068/1197/1068 1049/1177/1049 1069/1198/1069 -f 1049/1177/1049 1050/1178/1050 1069/1198/1069 -f 1069/1198/1069 1050/1178/1050 1070/1199/1070 -f 1050/1178/1050 1051/1179/1051 1070/1199/1070 -f 1070/1199/1070 1051/1179/1051 1071/1200/1071 -f 1051/1179/1051 1052/1180/1052 1071/1200/1071 -f 1071/1200/1071 1052/1180/1052 1072/1201/1072 -f 1052/1180/1052 1053/1181/1053 1072/1201/1072 -f 1072/1201/1072 1053/1181/1053 1073/1202/1073 -f 1053/1181/1053 1054/1182/1054 1073/1202/1073 -f 1073/1202/1073 1054/1182/1054 1074/1203/1074 -f 1054/1182/1054 1055/1183/1055 1074/1203/1074 -f 1074/1203/1074 1055/1183/1055 1075/1204/1075 -f 1055/1183/1055 1056/1184/1056 1075/1204/1075 -f 1075/1204/1075 1056/1184/1056 1076/1205/1076 -f 1056/1184/1056 1057/1185/1057 1076/1205/1076 -f 1076/1205/1076 1057/1185/1057 1077/1206/1077 -f 1057/1185/1057 1058/1186/1058 1077/1206/1077 -f 1077/1206/1077 1058/1186/1058 1078/1207/1078 -f 1058/1186/1058 1059/1187/1059 1078/1207/1078 -f 1078/1207/1078 1059/1187/1059 1079/1208/1079 -f 1059/1187/1059 1060/1188/1060 1079/1208/1079 -f 1079/1208/1079 1060/1188/1060 1080/1209/1080 -f 1060/1188/1060 1061/1189/1061 1080/1209/1080 -f 1080/1209/1080 1061/1189/1061 1081/1210/1081 -f 1061/1189/1061 1062/1190/1062 1081/1210/1081 -f 1081/1210/1081 1062/1190/1062 1082/1211/1082 -f 1062/1190/1062 1063/1191/1063 1082/1211/1082 -f 1082/1211/1082 1063/1191/1063 1083/1212/1083 -f 1063/1191/1063 1064/1192/1064 1083/1212/1083 -f 1083/1212/1083 1064/1192/1064 1084/1213/1084 -f 1064/1192/1064 1045/1193/1045 1084/1213/1084 -f 1084/1213/1084 1045/1193/1045 1065/1214/1065 -f 1065/1194/1065 1066/1195/1066 1085/1215/1085 -f 1085/1215/1085 1066/1195/1066 1086/1216/1086 -f 1066/1195/1066 1067/1196/1067 1086/1216/1086 -f 1086/1216/1086 1067/1196/1067 1087/1217/1087 -f 1067/1196/1067 1068/1197/1068 1087/1217/1087 -f 1087/1217/1087 1068/1197/1068 1088/1218/1088 -f 1068/1197/1068 1069/1198/1069 1088/1218/1088 -f 1088/1218/1088 1069/1198/1069 1089/1219/1089 -f 1069/1198/1069 1070/1199/1070 1089/1219/1089 -f 1089/1219/1089 1070/1199/1070 1090/1220/1090 -f 1070/1199/1070 1071/1200/1071 1090/1220/1090 -f 1090/1220/1090 1071/1200/1071 1091/1221/1091 -f 1071/1200/1071 1072/1201/1072 1091/1221/1091 -f 1091/1221/1091 1072/1201/1072 1092/1222/1092 -f 1072/1201/1072 1073/1202/1073 1092/1222/1092 -f 1092/1222/1092 1073/1202/1073 1093/1223/1093 -f 1073/1202/1073 1074/1203/1074 1093/1223/1093 -f 1093/1223/1093 1074/1203/1074 1094/1224/1094 -f 1074/1203/1074 1075/1204/1075 1094/1224/1094 -f 1094/1224/1094 1075/1204/1075 1095/1225/1095 -f 1075/1204/1075 1076/1205/1076 1095/1225/1095 -f 1095/1225/1095 1076/1205/1076 1096/1226/1096 -f 1076/1205/1076 1077/1206/1077 1096/1226/1096 -f 1096/1226/1096 1077/1206/1077 1097/1227/1097 -f 1077/1206/1077 1078/1207/1078 1097/1227/1097 -f 1097/1227/1097 1078/1207/1078 1098/1228/1098 -f 1078/1207/1078 1079/1208/1079 1098/1228/1098 -f 1098/1228/1098 1079/1208/1079 1099/1229/1099 -f 1079/1208/1079 1080/1209/1080 1099/1229/1099 -f 1099/1229/1099 1080/1209/1080 1100/1230/1100 -f 1080/1209/1080 1081/1210/1081 1100/1230/1100 -f 1100/1230/1100 1081/1210/1081 1101/1231/1101 -f 1081/1210/1081 1082/1211/1082 1101/1231/1101 -f 1101/1231/1101 1082/1211/1082 1102/1232/1102 -f 1082/1211/1082 1083/1212/1083 1102/1232/1102 -f 1102/1232/1102 1083/1212/1083 1103/1233/1103 -f 1083/1212/1083 1084/1213/1084 1103/1233/1103 -f 1103/1233/1103 1084/1213/1084 1104/1234/1104 -f 1084/1213/1084 1065/1214/1065 1104/1234/1104 -f 1104/1234/1104 1065/1214/1065 1085/1235/1085 -f 1085/1215/1085 1086/1216/1086 1105/1236/1105 -f 1105/1236/1105 1086/1216/1086 1106/1237/1106 -f 1086/1216/1086 1087/1217/1087 1106/1237/1106 -f 1106/1237/1106 1087/1217/1087 1107/1238/1107 -f 1087/1217/1087 1088/1218/1088 1107/1238/1107 -f 1107/1238/1107 1088/1218/1088 1108/1239/1108 -f 1088/1218/1088 1089/1219/1089 1108/1239/1108 -f 1108/1239/1108 1089/1219/1089 1109/1240/1109 -f 1089/1219/1089 1090/1220/1090 1109/1240/1109 -f 1109/1240/1109 1090/1220/1090 1110/1241/1110 -f 1090/1220/1090 1091/1221/1091 1110/1241/1110 -f 1110/1241/1110 1091/1221/1091 1111/1242/1111 -f 1091/1221/1091 1092/1222/1092 1111/1242/1111 -f 1111/1242/1111 1092/1222/1092 1112/1243/1112 -f 1092/1222/1092 1093/1223/1093 1112/1243/1112 -f 1112/1243/1112 1093/1223/1093 1113/1244/1113 -f 1093/1223/1093 1094/1224/1094 1113/1244/1113 -f 1113/1244/1113 1094/1224/1094 1114/1245/1114 -f 1094/1224/1094 1095/1225/1095 1114/1245/1114 -f 1114/1245/1114 1095/1225/1095 1115/1246/1115 -f 1095/1225/1095 1096/1226/1096 1115/1246/1115 -f 1115/1246/1115 1096/1226/1096 1116/1247/1116 -f 1096/1226/1096 1097/1227/1097 1116/1247/1116 -f 1116/1247/1116 1097/1227/1097 1117/1248/1117 -f 1097/1227/1097 1098/1228/1098 1117/1248/1117 -f 1117/1248/1117 1098/1228/1098 1118/1249/1118 -f 1098/1228/1098 1099/1229/1099 1118/1249/1118 -f 1118/1249/1118 1099/1229/1099 1119/1250/1119 -f 1099/1229/1099 1100/1230/1100 1119/1250/1119 -f 1119/1250/1119 1100/1230/1100 1120/1251/1120 -f 1100/1230/1100 1101/1231/1101 1120/1251/1120 -f 1120/1251/1120 1101/1231/1101 1121/1252/1121 -f 1101/1231/1101 1102/1232/1102 1121/1252/1121 -f 1121/1252/1121 1102/1232/1102 1122/1253/1122 -f 1102/1232/1102 1103/1233/1103 1122/1253/1122 -f 1122/1253/1122 1103/1233/1103 1123/1254/1123 -f 1103/1233/1103 1104/1234/1104 1123/1254/1123 -f 1123/1254/1123 1104/1234/1104 1124/1255/1124 -f 1104/1234/1104 1085/1235/1085 1124/1255/1124 -f 1124/1255/1124 1085/1235/1085 1105/1256/1105 -f 1105/1236/1105 1106/1237/1106 1125/1257/1125 -f 1125/1257/1125 1106/1237/1106 1126/1258/1126 -f 1106/1237/1106 1107/1238/1107 1126/1258/1126 -f 1126/1258/1126 1107/1238/1107 1127/1259/1127 -f 1107/1238/1107 1108/1239/1108 1127/1259/1127 -f 1127/1259/1127 1108/1239/1108 1128/1260/1128 -f 1108/1239/1108 1109/1240/1109 1128/1260/1128 -f 1128/1260/1128 1109/1240/1109 1129/1261/1129 -f 1109/1240/1109 1110/1241/1110 1129/1261/1129 -f 1129/1261/1129 1110/1241/1110 1130/1262/1130 -f 1110/1241/1110 1111/1242/1111 1130/1262/1130 -f 1130/1262/1130 1111/1242/1111 1131/1263/1131 -f 1111/1242/1111 1112/1243/1112 1131/1263/1131 -f 1131/1263/1131 1112/1243/1112 1132/1264/1132 -f 1112/1243/1112 1113/1244/1113 1132/1264/1132 -f 1132/1264/1132 1113/1244/1113 1133/1265/1133 -f 1113/1244/1113 1114/1245/1114 1133/1265/1133 -f 1133/1265/1133 1114/1245/1114 1134/1266/1134 -f 1114/1245/1114 1115/1246/1115 1134/1266/1134 -f 1134/1266/1134 1115/1246/1115 1135/1267/1135 -f 1115/1246/1115 1116/1247/1116 1135/1267/1135 -f 1135/1267/1135 1116/1247/1116 1136/1268/1136 -f 1116/1247/1116 1117/1248/1117 1136/1268/1136 -f 1136/1268/1136 1117/1248/1117 1137/1269/1137 -f 1117/1248/1117 1118/1249/1118 1137/1269/1137 -f 1137/1269/1137 1118/1249/1118 1138/1270/1138 -f 1118/1249/1118 1119/1250/1119 1138/1270/1138 -f 1138/1270/1138 1119/1250/1119 1139/1271/1139 -f 1119/1250/1119 1120/1251/1120 1139/1271/1139 -f 1139/1271/1139 1120/1251/1120 1140/1272/1140 -f 1120/1251/1120 1121/1252/1121 1140/1272/1140 -f 1140/1272/1140 1121/1252/1121 1141/1273/1141 -f 1121/1252/1121 1122/1253/1122 1141/1273/1141 -f 1141/1273/1141 1122/1253/1122 1142/1274/1142 -f 1122/1253/1122 1123/1254/1123 1142/1274/1142 -f 1142/1274/1142 1123/1254/1123 1143/1275/1143 -f 1123/1254/1123 1124/1255/1124 1143/1275/1143 -f 1143/1275/1143 1124/1255/1124 1144/1276/1144 -f 1124/1255/1124 1105/1256/1105 1144/1276/1144 -f 1144/1276/1144 1105/1256/1105 1125/1277/1125 -f 766/880/766 765/879/765 1145/1278/1145 -f 767/881/769 766/880/766 1145/1279/1145 -f 768/882/771 767/881/769 1145/1280/1145 -f 769/883/773 768/882/771 1145/1281/1145 -f 770/884/775 769/883/773 1145/1282/1145 -f 771/885/777 770/884/775 1145/1283/1145 -f 772/886/779 771/885/777 1145/1284/1145 -f 773/887/781 772/886/779 1145/1285/1145 -f 774/888/783 773/887/781 1145/1286/1145 -f 775/889/785 774/888/783 1145/1287/1145 -f 776/890/787 775/889/785 1145/1288/1145 -f 777/891/789 776/890/787 1145/1289/1145 -f 778/892/791 777/891/789 1145/1290/1145 -f 779/893/793 778/892/791 1145/1291/1145 -f 780/894/795 779/893/793 1145/1292/1145 -f 781/895/797 780/894/795 1145/1293/1145 -f 782/896/799 781/895/797 1145/1294/1145 -f 783/897/801 782/896/799 1145/1295/1145 -f 784/898/803 783/897/801 1145/1296/1145 -f 765/899/765 784/898/803 1145/1297/1145 -f 1125/1257/1125 1126/1258/1126 1146/1298/1146 -f 1126/1258/1126 1127/1259/1127 1146/1299/1146 -f 1127/1259/1127 1128/1260/1128 1146/1300/1146 -f 1128/1260/1128 1129/1261/1129 1146/1301/1146 -f 1129/1261/1129 1130/1262/1130 1146/1302/1146 -f 1130/1262/1130 1131/1263/1131 1146/1303/1146 -f 1131/1263/1131 1132/1264/1132 1146/1304/1146 -f 1132/1264/1132 1133/1265/1133 1146/1305/1146 -f 1133/1265/1133 1134/1266/1134 1146/1306/1146 -f 1134/1266/1134 1135/1267/1135 1146/1307/1146 -f 1135/1267/1135 1136/1268/1136 1146/1308/1146 -f 1136/1268/1136 1137/1269/1137 1146/1309/1146 -f 1137/1269/1137 1138/1270/1138 1146/1310/1146 -f 1138/1270/1138 1139/1271/1139 1146/1311/1146 -f 1139/1271/1139 1140/1272/1140 1146/1312/1146 -f 1140/1272/1140 1141/1273/1141 1146/1313/1146 -f 1141/1273/1141 1142/1274/1142 1146/1314/1146 -f 1142/1274/1142 1143/1275/1143 1146/1315/1146 -f 1143/1275/1143 1144/1276/1144 1146/1316/1146 -f 1144/1276/1144 1125/1277/1125 1146/1317/1146 diff --git a/data/models/torus.obj b/data/models/torus.obj index b351b4f7..de3b85da 100644 --- a/data/models/torus.obj +++ b/data/models/torus.obj @@ -2041,2044 +2041,3 @@ f 400/419/400 399/418/399 20/440/39 f 20/440/39 399/418/399 19/439/37 f 381/420/382 400/419/400 1/441/2 f 1/441/2 400/419/400 20/440/39 -v 0.475529 0.000000 -0.154509 -v 0.404509 0.000000 -0.293893 -v 0.293893 0.000000 -0.404509 -v 0.154509 0.000000 -0.475529 -v 0.000000 0.000000 -0.500000 -v -0.154509 0.000000 -0.475528 -v -0.293893 0.000000 -0.404509 -v -0.404509 0.000000 -0.293893 -v -0.475528 0.000000 -0.154509 -v -0.500000 0.000000 0.000000 -v -0.475528 0.000000 0.154509 -v -0.404509 0.000000 0.293893 -v -0.293893 0.000000 0.404509 -v -0.154509 0.000000 0.475528 -v -0.000000 0.000000 0.500000 -v 0.154508 0.000000 0.475528 -v 0.293893 0.000000 0.404509 -v 0.404509 0.000000 0.293893 -v 0.475528 0.000000 0.154509 -v 0.500000 0.000000 0.000000 -v 0.498803 0.154509 -0.162071 -v 0.424307 0.154509 -0.308277 -v 0.308277 0.154509 -0.424307 -v 0.162071 0.154509 -0.498803 -v 0.000000 0.154509 -0.524472 -v -0.162071 0.154509 -0.498803 -v -0.308277 0.154509 -0.424307 -v -0.424307 0.154509 -0.308277 -v -0.498802 0.154509 -0.162071 -v -0.524472 0.154509 0.000000 -v -0.498802 0.154509 0.162071 -v -0.424307 0.154509 0.308277 -v -0.308277 0.154509 0.424307 -v -0.162071 0.154509 0.498802 -v -0.000000 0.154509 0.524472 -v 0.162071 0.154509 0.498802 -v 0.308277 0.154509 0.424307 -v 0.424307 0.154509 0.308277 -v 0.498802 0.154509 0.162071 -v 0.524472 0.154509 0.000000 -v 0.566346 0.293893 -0.184017 -v 0.481763 0.293893 -0.350021 -v 0.350021 0.293893 -0.481763 -v 0.184017 0.293893 -0.566346 -v 0.000000 0.293893 -0.595492 -v -0.184017 0.293893 -0.566346 -v -0.350021 0.293893 -0.481763 -v -0.481763 0.293893 -0.350021 -v -0.566346 0.293893 -0.184017 -v -0.595492 0.293893 0.000000 -v -0.566346 0.293893 0.184017 -v -0.481763 0.293893 0.350021 -v -0.350021 0.293893 0.481763 -v -0.184017 0.293893 0.566346 -v -0.000000 0.293893 0.595492 -v 0.184017 0.293893 0.566346 -v 0.350021 0.293893 0.481763 -v 0.481763 0.293893 0.350021 -v 0.566346 0.293893 0.184017 -v 0.595492 0.293893 0.000000 -v 0.671548 0.404509 -0.218199 -v 0.571253 0.404509 -0.415040 -v 0.415040 0.404509 -0.571253 -v 0.218199 0.404509 -0.671548 -v 0.000000 0.404509 -0.706108 -v -0.218199 0.404509 -0.671548 -v -0.415040 0.404509 -0.571253 -v -0.571253 0.404509 -0.415040 -v -0.671548 0.404509 -0.218199 -v -0.706108 0.404509 0.000000 -v -0.671548 0.404509 0.218199 -v -0.571253 0.404509 0.415040 -v -0.415040 0.404509 0.571253 -v -0.218199 0.404509 0.671548 -v -0.000000 0.404509 0.706107 -v 0.218199 0.404509 0.671548 -v 0.415040 0.404509 0.571253 -v 0.571253 0.404509 0.415040 -v 0.671548 0.404509 0.218199 -v 0.706107 0.404509 0.000000 -v 0.804111 0.475528 -0.261271 -v 0.684017 0.475528 -0.496968 -v 0.496968 0.475528 -0.684017 -v 0.261271 0.475528 -0.804111 -v 0.000000 0.475528 -0.845492 -v -0.261271 0.475528 -0.804111 -v -0.496968 0.475528 -0.684017 -v -0.684017 0.475528 -0.496968 -v -0.804110 0.475528 -0.261271 -v -0.845492 0.475528 0.000000 -v -0.804110 0.475528 0.261271 -v -0.684017 0.475528 0.496968 -v -0.496968 0.475528 0.684017 -v -0.261271 0.475528 0.804110 -v -0.000000 0.475528 0.845492 -v 0.261271 0.475528 0.804110 -v 0.496967 0.475528 0.684017 -v 0.684017 0.475528 0.496967 -v 0.804110 0.475528 0.261271 -v 0.845492 0.475528 0.000000 -v 0.951057 0.500000 -0.309017 -v 0.809018 0.500000 -0.587786 -v 0.587786 0.500000 -0.809017 -v 0.309017 0.500000 -0.951057 -v 0.000000 0.500000 -1.000000 -v -0.309017 0.500000 -0.951057 -v -0.587785 0.500000 -0.809017 -v -0.809017 0.500000 -0.587785 -v -0.951057 0.500000 -0.309017 -v -1.000000 0.500000 0.000000 -v -0.951057 0.500000 0.309017 -v -0.809017 0.500000 0.587785 -v -0.587785 0.500000 0.809017 -v -0.309017 0.500000 0.951057 -v -0.000000 0.500000 1.000000 -v 0.309017 0.500000 0.951057 -v 0.587785 0.500000 0.809017 -v 0.809017 0.500000 0.587785 -v 0.951057 0.500000 0.309017 -v 1.000000 0.500000 0.000000 -v 1.098004 0.475528 -0.356763 -v 0.934018 0.475528 -0.678604 -v 0.678604 0.475528 -0.934018 -v 0.356763 0.475528 -1.098004 -v 0.000000 0.475528 -1.154509 -v -0.356763 0.475528 -1.098003 -v -0.678603 0.475528 -0.934017 -v -0.934017 0.475528 -0.678603 -v -1.098003 0.475528 -0.356763 -v -1.154509 0.475528 0.000000 -v -1.098003 0.475528 0.356763 -v -0.934017 0.475528 0.678603 -v -0.678603 0.475528 0.934017 -v -0.356763 0.475528 1.098003 -v -0.000000 0.475528 1.154509 -v 0.356763 0.475528 1.098003 -v 0.678603 0.475528 0.934017 -v 0.934017 0.475528 0.678603 -v 1.098003 0.475528 0.356763 -v 1.154509 0.475528 0.000000 -v 1.230566 0.404509 -0.399835 -v 1.046782 0.404509 -0.760531 -v 0.760531 0.404509 -1.046782 -v 0.399835 0.404509 -1.230566 -v 0.000000 0.404509 -1.293893 -v -0.399835 0.404509 -1.230566 -v -0.760531 0.404509 -1.046782 -v -1.046781 0.404509 -0.760531 -v -1.230565 0.404509 -0.399835 -v -1.293893 0.404509 0.000000 -v -1.230565 0.404509 0.399835 -v -1.046781 0.404509 0.760531 -v -0.760531 0.404509 1.046781 -v -0.399835 0.404509 1.230565 -v -0.000000 0.404509 1.293893 -v 0.399835 0.404509 1.230565 -v 0.760531 0.404509 1.046781 -v 1.046781 0.404509 0.760531 -v 1.230565 0.404509 0.399835 -v 1.293893 0.404509 0.000000 -v 1.335768 0.293893 -0.434017 -v 1.136272 0.293893 -0.825550 -v 0.825550 0.293893 -1.136272 -v 0.434017 0.293893 -1.335768 -v 0.000000 0.293893 -1.404509 -v -0.434017 0.293893 -1.335768 -v -0.825550 0.293893 -1.136272 -v -1.136272 0.293893 -0.825550 -v -1.335767 0.293893 -0.434017 -v -1.404509 0.293893 0.000000 -v -1.335767 0.293893 0.434017 -v -1.136272 0.293893 0.825550 -v -0.825550 0.293893 1.136271 -v -0.434017 0.293893 1.335767 -v -0.000000 0.293893 1.404509 -v 0.434017 0.293893 1.335767 -v 0.825549 0.293893 1.136271 -v 1.136271 0.293893 0.825549 -v 1.335767 0.293893 0.434017 -v 1.404509 0.293893 0.000000 -v 1.403312 0.154509 -0.455964 -v 1.193728 0.154509 -0.867294 -v 0.867294 0.154509 -1.193728 -v 0.455964 0.154509 -1.403312 -v 0.000000 0.154509 -1.475529 -v -0.455964 0.154509 -1.403311 -v -0.867294 0.154509 -1.193728 -v -1.193728 0.154509 -0.867294 -v -1.403311 0.154509 -0.455963 -v -1.475529 0.154509 0.000000 -v -1.403311 0.154509 0.455963 -v -1.193728 0.154509 0.867294 -v -0.867294 0.154509 1.193728 -v -0.455963 0.154509 1.403311 -v -0.000000 0.154509 1.475528 -v 0.455963 0.154509 1.403311 -v 0.867294 0.154509 1.193728 -v 1.193727 0.154509 0.867294 -v 1.403311 0.154509 0.455963 -v 1.475528 0.154509 0.000000 -v 1.426586 0.000000 -0.463526 -v 1.213526 0.000000 -0.881678 -v 0.881678 0.000000 -1.213526 -v 0.463526 0.000000 -1.426586 -v 0.000000 0.000000 -1.500001 -v -0.463526 0.000000 -1.426586 -v -0.881678 0.000000 -1.213526 -v -1.213526 0.000000 -0.881678 -v -1.426585 0.000000 -0.463526 -v -1.500000 0.000000 0.000000 -v -1.426585 0.000000 0.463526 -v -1.213526 0.000000 0.881678 -v -0.881678 0.000000 1.213526 -v -0.463526 0.000000 1.426585 -v -0.000000 0.000000 1.500000 -v 0.463526 0.000000 1.426585 -v 0.881678 0.000000 1.213526 -v 1.213526 0.000000 0.881678 -v 1.426585 0.000000 0.463526 -v 1.500000 0.000000 0.000000 -v 1.403312 -0.154509 -0.455964 -v 1.193728 -0.154509 -0.867294 -v 0.867294 -0.154509 -1.193728 -v 0.455964 -0.154509 -1.403312 -v 0.000000 -0.154509 -1.475529 -v -0.455964 -0.154509 -1.403311 -v -0.867294 -0.154509 -1.193728 -v -1.193728 -0.154509 -0.867294 -v -1.403311 -0.154509 -0.455963 -v -1.475529 -0.154509 0.000000 -v -1.403311 -0.154509 0.455963 -v -1.193728 -0.154509 0.867294 -v -0.867294 -0.154509 1.193728 -v -0.455963 -0.154509 1.403311 -v -0.000000 -0.154509 1.475528 -v 0.455963 -0.154509 1.403311 -v 0.867294 -0.154509 1.193728 -v 1.193727 -0.154509 0.867294 -v 1.403311 -0.154509 0.455963 -v 1.475528 -0.154509 0.000000 -v 1.335768 -0.293893 -0.434017 -v 1.136272 -0.293893 -0.825550 -v 0.825550 -0.293893 -1.136272 -v 0.434017 -0.293893 -1.335768 -v 0.000000 -0.293893 -1.404509 -v -0.434017 -0.293893 -1.335768 -v -0.825550 -0.293893 -1.136272 -v -1.136272 -0.293893 -0.825550 -v -1.335767 -0.293893 -0.434017 -v -1.404509 -0.293893 0.000000 -v -1.335767 -0.293893 0.434017 -v -1.136272 -0.293893 0.825550 -v -0.825550 -0.293893 1.136271 -v -0.434017 -0.293893 1.335767 -v -0.000000 -0.293893 1.404509 -v 0.434017 -0.293893 1.335767 -v 0.825549 -0.293893 1.136271 -v 1.136271 -0.293893 0.825549 -v 1.335767 -0.293893 0.434017 -v 1.404509 -0.293893 0.000000 -v 1.230566 -0.404509 -0.399835 -v 1.046782 -0.404509 -0.760532 -v 0.760532 -0.404509 -1.046782 -v 0.399835 -0.404509 -1.230566 -v 0.000000 -0.404509 -1.293893 -v -0.399835 -0.404509 -1.230566 -v -0.760531 -0.404509 -1.046782 -v -1.046782 -0.404509 -0.760531 -v -1.230565 -0.404509 -0.399835 -v -1.293893 -0.404509 0.000000 -v -1.230565 -0.404509 0.399835 -v -1.046781 -0.404509 0.760531 -v -0.760531 -0.404509 1.046781 -v -0.399835 -0.404509 1.230565 -v -0.000000 -0.404509 1.293893 -v 0.399835 -0.404509 1.230565 -v 0.760531 -0.404509 1.046781 -v 1.046781 -0.404509 0.760531 -v 1.230565 -0.404509 0.399835 -v 1.293893 -0.404509 0.000000 -v 1.098004 -0.475528 -0.356763 -v 0.934018 -0.475528 -0.678604 -v 0.678604 -0.475528 -0.934018 -v 0.356763 -0.475528 -1.098004 -v 0.000000 -0.475528 -1.154509 -v -0.356763 -0.475528 -1.098003 -v -0.678603 -0.475528 -0.934017 -v -0.934017 -0.475528 -0.678603 -v -1.098003 -0.475528 -0.356763 -v -1.154509 -0.475528 0.000000 -v -1.098003 -0.475528 0.356763 -v -0.934017 -0.475528 0.678603 -v -0.678603 -0.475528 0.934017 -v -0.356763 -0.475528 1.098003 -v -0.000000 -0.475528 1.154509 -v 0.356763 -0.475528 1.098003 -v 0.678603 -0.475528 0.934017 -v 0.934017 -0.475528 0.678603 -v 1.098003 -0.475528 0.356763 -v 1.154509 -0.475528 0.000000 -v 0.951057 -0.500000 -0.309017 -v 0.809018 -0.500000 -0.587786 -v 0.587786 -0.500000 -0.809017 -v 0.309017 -0.500000 -0.951057 -v 0.000000 -0.500000 -1.000000 -v -0.309017 -0.500000 -0.951057 -v -0.587785 -0.500000 -0.809017 -v -0.809017 -0.500000 -0.587785 -v -0.951057 -0.500000 -0.309017 -v -1.000000 -0.500000 0.000000 -v -0.951057 -0.500000 0.309017 -v -0.809017 -0.500000 0.587785 -v -0.587785 -0.500000 0.809017 -v -0.309017 -0.500000 0.951057 -v -0.000000 -0.500000 1.000000 -v 0.309017 -0.500000 0.951057 -v 0.587785 -0.500000 0.809017 -v 0.809017 -0.500000 0.587785 -v 0.951057 -0.500000 0.309017 -v 1.000000 -0.500000 0.000000 -v 0.804111 -0.475529 -0.261271 -v 0.684017 -0.475529 -0.496968 -v 0.496968 -0.475529 -0.684017 -v 0.261271 -0.475529 -0.804111 -v 0.000000 -0.475529 -0.845492 -v -0.261271 -0.475529 -0.804110 -v -0.496968 -0.475529 -0.684017 -v -0.684017 -0.475529 -0.496968 -v -0.804110 -0.475529 -0.261271 -v -0.845492 -0.475529 0.000000 -v -0.804110 -0.475529 0.261271 -v -0.684017 -0.475529 0.496967 -v -0.496967 -0.475529 0.684017 -v -0.261271 -0.475529 0.804110 -v -0.000000 -0.475529 0.845492 -v 0.261271 -0.475529 0.804110 -v 0.496967 -0.475529 0.684017 -v 0.684017 -0.475529 0.496967 -v 0.804110 -0.475529 0.261271 -v 0.845491 -0.475529 0.000000 -v 0.671548 -0.404509 -0.218199 -v 0.571253 -0.404509 -0.415040 -v 0.415040 -0.404509 -0.571253 -v 0.218199 -0.404509 -0.671548 -v 0.000000 -0.404509 -0.706108 -v -0.218199 -0.404509 -0.671548 -v -0.415040 -0.404509 -0.571253 -v -0.571253 -0.404509 -0.415040 -v -0.671548 -0.404509 -0.218199 -v -0.706107 -0.404509 0.000000 -v -0.671548 -0.404509 0.218199 -v -0.571253 -0.404509 0.415039 -v -0.415039 -0.404509 0.571253 -v -0.218199 -0.404509 0.671548 -v -0.000000 -0.404509 0.706107 -v 0.218199 -0.404509 0.671548 -v 0.415039 -0.404509 0.571253 -v 0.571253 -0.404509 0.415039 -v 0.671548 -0.404509 0.218199 -v 0.706107 -0.404509 0.000000 -v 0.566346 -0.293893 -0.184017 -v 0.481763 -0.293893 -0.350021 -v 0.350021 -0.293893 -0.481763 -v 0.184017 -0.293893 -0.566346 -v 0.000000 -0.293893 -0.595492 -v -0.184017 -0.293893 -0.566346 -v -0.350021 -0.293893 -0.481763 -v -0.481763 -0.293893 -0.350021 -v -0.566346 -0.293893 -0.184017 -v -0.595491 -0.293893 0.000000 -v -0.566346 -0.293893 0.184017 -v -0.481763 -0.293893 0.350021 -v -0.350021 -0.293893 0.481763 -v -0.184017 -0.293893 0.566346 -v -0.000000 -0.293893 0.595491 -v 0.184017 -0.293893 0.566346 -v 0.350021 -0.293893 0.481763 -v 0.481763 -0.293893 0.350021 -v 0.566346 -0.293893 0.184017 -v 0.595491 -0.293893 0.000000 -v 0.498802 -0.154509 -0.162071 -v 0.424307 -0.154509 -0.308277 -v 0.308277 -0.154509 -0.424307 -v 0.162071 -0.154509 -0.498802 -v 0.000000 -0.154509 -0.524472 -v -0.162071 -0.154509 -0.498802 -v -0.308277 -0.154509 -0.424306 -v -0.424306 -0.154509 -0.308277 -v -0.498802 -0.154509 -0.162071 -v -0.524472 -0.154509 0.000000 -v -0.498802 -0.154509 0.162071 -v -0.424306 -0.154509 0.308277 -v -0.308277 -0.154509 0.424306 -v -0.162071 -0.154509 0.498802 -v -0.000000 -0.154509 0.524471 -v 0.162071 -0.154509 0.498802 -v 0.308277 -0.154509 0.424306 -v 0.424306 -0.154509 0.308277 -v 0.498802 -0.154509 0.162071 -v 0.524471 -0.154509 0.000000 -vt 0.000000 1.000000 -vt 0.050000 1.000000 -vt 0.100000 1.000000 -vt 0.150000 1.000000 -vt 0.200000 1.000000 -vt 0.250000 1.000000 -vt 0.300000 1.000000 -vt 0.350000 1.000000 -vt 0.400000 1.000000 -vt 0.450000 1.000000 -vt 0.500000 1.000000 -vt 0.550000 1.000000 -vt 0.600000 1.000000 -vt 0.650000 1.000000 -vt 0.700000 1.000000 -vt 0.750000 1.000000 -vt 0.800000 1.000000 -vt 0.850000 1.000000 -vt 0.900000 1.000000 -vt 0.950000 1.000000 -vt 1.000000 1.000000 -vt 0.000000 0.950000 -vt 0.050000 0.950000 -vt 0.100000 0.950000 -vt 0.150000 0.950000 -vt 0.200000 0.950000 -vt 0.250000 0.950000 -vt 0.300000 0.950000 -vt 0.350000 0.950000 -vt 0.400000 0.950000 -vt 0.450000 0.950000 -vt 0.500000 0.950000 -vt 0.550000 0.950000 -vt 0.600000 0.950000 -vt 0.650000 0.950000 -vt 0.700000 0.950000 -vt 0.750000 0.950000 -vt 0.800000 0.950000 -vt 0.850000 0.950000 -vt 0.900000 0.950000 -vt 0.950000 0.950000 -vt 1.000000 0.950000 -vt 0.000000 0.900000 -vt 0.050000 0.900000 -vt 0.100000 0.900000 -vt 0.150000 0.900000 -vt 0.200000 0.900000 -vt 0.250000 0.900000 -vt 0.300000 0.900000 -vt 0.350000 0.900000 -vt 0.400000 0.900000 -vt 0.450000 0.900000 -vt 0.500000 0.900000 -vt 0.550000 0.900000 -vt 0.600000 0.900000 -vt 0.650000 0.900000 -vt 0.700000 0.900000 -vt 0.750000 0.900000 -vt 0.800000 0.900000 -vt 0.850000 0.900000 -vt 0.900000 0.900000 -vt 0.950000 0.900000 -vt 1.000000 0.900000 -vt 0.000000 0.850000 -vt 0.050000 0.850000 -vt 0.100000 0.850000 -vt 0.150000 0.850000 -vt 0.200000 0.850000 -vt 0.250000 0.850000 -vt 0.300000 0.850000 -vt 0.350000 0.850000 -vt 0.400000 0.850000 -vt 0.450000 0.850000 -vt 0.500000 0.850000 -vt 0.550000 0.850000 -vt 0.600000 0.850000 -vt 0.650000 0.850000 -vt 0.700000 0.850000 -vt 0.750000 0.850000 -vt 0.800000 0.850000 -vt 0.850000 0.850000 -vt 0.900000 0.850000 -vt 0.950000 0.850000 -vt 1.000000 0.850000 -vt 0.000000 0.800000 -vt 0.050000 0.800000 -vt 0.100000 0.800000 -vt 0.150000 0.800000 -vt 0.200000 0.800000 -vt 0.250000 0.800000 -vt 0.300000 0.800000 -vt 0.350000 0.800000 -vt 0.400000 0.800000 -vt 0.450000 0.800000 -vt 0.500000 0.800000 -vt 0.550000 0.800000 -vt 0.600000 0.800000 -vt 0.650000 0.800000 -vt 0.700000 0.800000 -vt 0.750000 0.800000 -vt 0.800000 0.800000 -vt 0.850000 0.800000 -vt 0.900000 0.800000 -vt 0.950000 0.800000 -vt 1.000000 0.800000 -vt 0.000000 0.750000 -vt 0.050000 0.750000 -vt 0.100000 0.750000 -vt 0.150000 0.750000 -vt 0.200000 0.750000 -vt 0.250000 0.750000 -vt 0.300000 0.750000 -vt 0.350000 0.750000 -vt 0.400000 0.750000 -vt 0.450000 0.750000 -vt 0.500000 0.750000 -vt 0.550000 0.750000 -vt 0.600000 0.750000 -vt 0.650000 0.750000 -vt 0.700000 0.750000 -vt 0.750000 0.750000 -vt 0.800000 0.750000 -vt 0.850000 0.750000 -vt 0.900000 0.750000 -vt 0.950000 0.750000 -vt 1.000000 0.750000 -vt 0.000000 0.700000 -vt 0.050000 0.700000 -vt 0.100000 0.700000 -vt 0.150000 0.700000 -vt 0.200000 0.700000 -vt 0.250000 0.700000 -vt 0.300000 0.700000 -vt 0.350000 0.700000 -vt 0.400000 0.700000 -vt 0.450000 0.700000 -vt 0.500000 0.700000 -vt 0.550000 0.700000 -vt 0.600000 0.700000 -vt 0.650000 0.700000 -vt 0.700000 0.700000 -vt 0.750000 0.700000 -vt 0.800000 0.700000 -vt 0.850000 0.700000 -vt 0.900000 0.700000 -vt 0.950000 0.700000 -vt 1.000000 0.700000 -vt 0.000000 0.650000 -vt 0.050000 0.650000 -vt 0.100000 0.650000 -vt 0.150000 0.650000 -vt 0.200000 0.650000 -vt 0.250000 0.650000 -vt 0.300000 0.650000 -vt 0.350000 0.650000 -vt 0.400000 0.650000 -vt 0.450000 0.650000 -vt 0.500000 0.650000 -vt 0.550000 0.650000 -vt 0.600000 0.650000 -vt 0.650000 0.650000 -vt 0.700000 0.650000 -vt 0.750000 0.650000 -vt 0.800000 0.650000 -vt 0.850000 0.650000 -vt 0.900000 0.650000 -vt 0.950000 0.650000 -vt 1.000000 0.650000 -vt 0.000000 0.600000 -vt 0.050000 0.600000 -vt 0.100000 0.600000 -vt 0.150000 0.600000 -vt 0.200000 0.600000 -vt 0.250000 0.600000 -vt 0.300000 0.600000 -vt 0.350000 0.600000 -vt 0.400000 0.600000 -vt 0.450000 0.600000 -vt 0.500000 0.600000 -vt 0.550000 0.600000 -vt 0.600000 0.600000 -vt 0.650000 0.600000 -vt 0.700000 0.600000 -vt 0.750000 0.600000 -vt 0.800000 0.600000 -vt 0.850000 0.600000 -vt 0.900000 0.600000 -vt 0.950000 0.600000 -vt 1.000000 0.600000 -vt 0.000000 0.550000 -vt 0.050000 0.550000 -vt 0.100000 0.550000 -vt 0.150000 0.550000 -vt 0.200000 0.550000 -vt 0.250000 0.550000 -vt 0.300000 0.550000 -vt 0.350000 0.550000 -vt 0.400000 0.550000 -vt 0.450000 0.550000 -vt 0.500000 0.550000 -vt 0.550000 0.550000 -vt 0.600000 0.550000 -vt 0.650000 0.550000 -vt 0.700000 0.550000 -vt 0.750000 0.550000 -vt 0.800000 0.550000 -vt 0.850000 0.550000 -vt 0.900000 0.550000 -vt 0.950000 0.550000 -vt 1.000000 0.550000 -vt 0.000000 0.500000 -vt 0.050000 0.500000 -vt 0.100000 0.500000 -vt 0.150000 0.500000 -vt 0.200000 0.500000 -vt 0.250000 0.500000 -vt 0.300000 0.500000 -vt 0.350000 0.500000 -vt 0.400000 0.500000 -vt 0.450000 0.500000 -vt 0.500000 0.500000 -vt 0.550000 0.500000 -vt 0.600000 0.500000 -vt 0.650000 0.500000 -vt 0.700000 0.500000 -vt 0.750000 0.500000 -vt 0.800000 0.500000 -vt 0.850000 0.500000 -vt 0.900000 0.500000 -vt 0.950000 0.500000 -vt 1.000000 0.500000 -vt 0.000000 0.450000 -vt 0.050000 0.450000 -vt 0.100000 0.450000 -vt 0.150000 0.450000 -vt 0.200000 0.450000 -vt 0.250000 0.450000 -vt 0.300000 0.450000 -vt 0.350000 0.450000 -vt 0.400000 0.450000 -vt 0.450000 0.450000 -vt 0.500000 0.450000 -vt 0.550000 0.450000 -vt 0.600000 0.450000 -vt 0.650000 0.450000 -vt 0.700000 0.450000 -vt 0.750000 0.450000 -vt 0.800000 0.450000 -vt 0.850000 0.450000 -vt 0.900000 0.450000 -vt 0.950000 0.450000 -vt 1.000000 0.450000 -vt 0.000000 0.400000 -vt 0.050000 0.400000 -vt 0.100000 0.400000 -vt 0.150000 0.400000 -vt 0.200000 0.400000 -vt 0.250000 0.400000 -vt 0.300000 0.400000 -vt 0.350000 0.400000 -vt 0.400000 0.400000 -vt 0.450000 0.400000 -vt 0.500000 0.400000 -vt 0.550000 0.400000 -vt 0.600000 0.400000 -vt 0.650000 0.400000 -vt 0.700000 0.400000 -vt 0.750000 0.400000 -vt 0.800000 0.400000 -vt 0.850000 0.400000 -vt 0.900000 0.400000 -vt 0.950000 0.400000 -vt 1.000000 0.400000 -vt 0.000000 0.350000 -vt 0.050000 0.350000 -vt 0.100000 0.350000 -vt 0.150000 0.350000 -vt 0.200000 0.350000 -vt 0.250000 0.350000 -vt 0.300000 0.350000 -vt 0.350000 0.350000 -vt 0.400000 0.350000 -vt 0.450000 0.350000 -vt 0.500000 0.350000 -vt 0.550000 0.350000 -vt 0.600000 0.350000 -vt 0.650000 0.350000 -vt 0.700000 0.350000 -vt 0.750000 0.350000 -vt 0.800000 0.350000 -vt 0.850000 0.350000 -vt 0.900000 0.350000 -vt 0.950000 0.350000 -vt 1.000000 0.350000 -vt 0.000000 0.300000 -vt 0.050000 0.300000 -vt 0.100000 0.300000 -vt 0.150000 0.300000 -vt 0.200000 0.300000 -vt 0.250000 0.300000 -vt 0.300000 0.300000 -vt 0.350000 0.300000 -vt 0.400000 0.300000 -vt 0.450000 0.300000 -vt 0.500000 0.300000 -vt 0.550000 0.300000 -vt 0.600000 0.300000 -vt 0.650000 0.300000 -vt 0.700000 0.300000 -vt 0.750000 0.300000 -vt 0.800000 0.300000 -vt 0.850000 0.300000 -vt 0.900000 0.300000 -vt 0.950000 0.300000 -vt 1.000000 0.300000 -vt 0.000000 0.250000 -vt 0.050000 0.250000 -vt 0.100000 0.250000 -vt 0.150000 0.250000 -vt 0.200000 0.250000 -vt 0.250000 0.250000 -vt 0.300000 0.250000 -vt 0.350000 0.250000 -vt 0.400000 0.250000 -vt 0.450000 0.250000 -vt 0.500000 0.250000 -vt 0.550000 0.250000 -vt 0.600000 0.250000 -vt 0.650000 0.250000 -vt 0.700000 0.250000 -vt 0.750000 0.250000 -vt 0.800000 0.250000 -vt 0.850000 0.250000 -vt 0.900000 0.250000 -vt 0.950000 0.250000 -vt 1.000000 0.250000 -vt 0.000000 0.200000 -vt 0.050000 0.200000 -vt 0.100000 0.200000 -vt 0.150000 0.200000 -vt 0.200000 0.200000 -vt 0.250000 0.200000 -vt 0.300000 0.200000 -vt 0.350000 0.200000 -vt 0.400000 0.200000 -vt 0.450000 0.200000 -vt 0.500000 0.200000 -vt 0.550000 0.200000 -vt 0.600000 0.200000 -vt 0.650000 0.200000 -vt 0.700000 0.200000 -vt 0.750000 0.200000 -vt 0.800000 0.200000 -vt 0.850000 0.200000 -vt 0.900000 0.200000 -vt 0.950000 0.200000 -vt 1.000000 0.200000 -vt 0.000000 0.150000 -vt 0.050000 0.150000 -vt 0.100000 0.150000 -vt 0.150000 0.150000 -vt 0.200000 0.150000 -vt 0.250000 0.150000 -vt 0.300000 0.150000 -vt 0.350000 0.150000 -vt 0.400000 0.150000 -vt 0.450000 0.150000 -vt 0.500000 0.150000 -vt 0.550000 0.150000 -vt 0.600000 0.150000 -vt 0.650000 0.150000 -vt 0.700000 0.150000 -vt 0.750000 0.150000 -vt 0.800000 0.150000 -vt 0.850000 0.150000 -vt 0.900000 0.150000 -vt 0.950000 0.150000 -vt 1.000000 0.150000 -vt 0.000000 0.100000 -vt 0.050000 0.100000 -vt 0.100000 0.100000 -vt 0.150000 0.100000 -vt 0.200000 0.100000 -vt 0.250000 0.100000 -vt 0.300000 0.100000 -vt 0.350000 0.100000 -vt 0.400000 0.100000 -vt 0.450000 0.100000 -vt 0.500000 0.100000 -vt 0.550000 0.100000 -vt 0.600000 0.100000 -vt 0.650000 0.100000 -vt 0.700000 0.100000 -vt 0.750000 0.100000 -vt 0.800000 0.100000 -vt 0.850000 0.100000 -vt 0.900000 0.100000 -vt 0.950000 0.100000 -vt 1.000000 0.100000 -vt 0.000000 0.050000 -vt 0.050000 0.050000 -vt 0.100000 0.050000 -vt 0.150000 0.050000 -vt 0.200000 0.050000 -vt 0.250000 0.050000 -vt 0.300000 0.050000 -vt 0.350000 0.050000 -vt 0.400000 0.050000 -vt 0.450000 0.050000 -vt 0.500000 0.050000 -vt 0.550000 0.050000 -vt 0.600000 0.050000 -vt 0.650000 0.050000 -vt 0.700000 0.050000 -vt 0.750000 0.050000 -vt 0.800000 0.050000 -vt 0.850000 0.050000 -vt 0.900000 0.050000 -vt 0.950000 0.050000 -vt 1.000000 0.050000 -vt 0.000000 -0.000000 -vt 0.050000 -0.000000 -vt 0.100000 -0.000000 -vt 0.150000 -0.000000 -vt 0.200000 -0.000000 -vt 0.250000 -0.000000 -vt 0.300000 -0.000000 -vt 0.350000 -0.000000 -vt 0.400000 -0.000000 -vt 0.450000 -0.000000 -vt 0.500000 -0.000000 -vt 0.550000 -0.000000 -vt 0.600000 -0.000000 -vt 0.650000 -0.000000 -vt 0.700000 -0.000000 -vt 0.750000 -0.000000 -vt 0.800000 -0.000000 -vt 0.850000 -0.000000 -vt 0.900000 -0.000000 -vt 0.950000 -0.000000 -vt 1.000000 -0.000000 -vn -0.809017 0.000001 0.587785 -vn -0.951057 0.000001 0.309016 -vn -0.765110 0.317182 0.560360 -vn -0.900823 0.317182 0.296501 -vn -0.587785 0.000001 0.809017 -vn -0.554502 0.317182 0.769366 -vn -0.309017 0.000001 0.951057 -vn -0.289615 0.317182 0.903060 -vn 0.000000 0.000001 1.000000 -vn 0.003620 0.317182 0.948358 -vn 0.309017 0.000001 0.951056 -vn 0.296502 0.317182 0.900823 -vn 0.587786 0.000001 0.809017 -vn 0.560360 0.317182 0.765109 -vn 0.809017 0.000001 0.587785 -vn 0.769366 0.317182 0.554502 -vn 0.951057 0.000001 0.309017 -vn 0.903060 0.317182 0.289615 -vn 1.000000 0.000001 -0.000000 -vn 0.948358 0.317182 -0.003620 -vn 0.951057 0.000001 -0.309017 -vn 0.900823 0.317182 -0.296502 -vn 0.809017 0.000001 -0.587785 -vn 0.765109 0.317182 -0.560360 -vn 0.587785 0.000001 -0.809017 -vn 0.554502 0.317182 -0.769365 -vn 0.309017 0.000001 -0.951057 -vn 0.289616 0.317182 -0.903061 -vn 0.000000 0.000001 -1.000000 -vn -0.003620 0.317182 -0.948358 -vn -0.309017 0.000001 -0.951057 -vn -0.296502 0.317182 -0.900823 -vn -0.587785 0.000001 -0.809017 -vn -0.560360 0.317182 -0.765110 -vn -0.809017 0.000001 -0.587785 -vn -0.769365 0.317182 -0.554502 -vn -0.951057 0.000001 -0.309017 -vn -0.903061 0.317182 -0.289616 -vn -1.000000 0.000001 -0.000001 -vn -0.948358 0.317182 0.003619 -vn -0.643706 0.600534 0.474343 -vn -0.758781 0.600534 0.252211 -vn -0.465620 0.600534 0.650043 -vn -0.241957 0.600534 0.762113 -vn 0.005391 0.600534 0.799581 -vn 0.252212 0.600534 0.758781 -vn 0.474344 0.600534 0.643706 -vn 0.650044 0.600534 0.465620 -vn 0.762113 0.600534 0.241957 -vn 0.799581 0.600534 -0.005391 -vn 0.758781 0.600534 -0.252211 -vn 0.643706 0.600534 -0.474344 -vn 0.465620 0.600534 -0.650044 -vn 0.241957 0.600534 -0.762113 -vn -0.005391 0.600534 -0.799581 -vn -0.252211 0.600534 -0.758781 -vn -0.474344 0.600534 -0.643706 -vn -0.650043 0.600534 -0.465621 -vn -0.762113 0.600534 -0.241957 -vn -0.799581 0.600534 0.005390 -vn -0.458876 0.821164 0.339297 -vn -0.541266 0.821164 0.180890 -vn -0.331568 0.821164 0.464491 -vn -0.171804 0.821164 0.544218 -vn 0.004777 0.821164 0.570672 -vn 0.180890 0.821164 0.541265 -vn 0.339297 0.821164 0.458876 -vn 0.464491 0.821164 0.331568 -vn 0.544218 0.821164 0.171804 -vn 0.570672 0.821164 -0.004777 -vn 0.541265 0.821164 -0.180890 -vn 0.458876 0.821164 -0.339297 -vn 0.331568 0.821164 -0.464491 -vn 0.171804 0.821164 -0.544218 -vn -0.004777 0.821164 -0.570672 -vn -0.180890 0.821164 -0.541266 -vn -0.339297 0.821164 -0.458876 -vn -0.464491 0.821164 -0.331568 -vn -0.544218 0.821164 -0.171805 -vn -0.570673 0.821164 0.004776 -vn -0.230217 0.958112 0.170356 -vn -0.271593 0.958112 0.090877 -vn -0.166307 0.958112 0.233160 -vn -0.086117 0.958112 0.273140 -vn 0.002503 0.958112 0.286383 -vn 0.090878 0.958112 0.271593 -vn 0.170356 0.958112 0.230218 -vn 0.233160 0.958112 0.166307 -vn 0.273140 0.958112 0.086117 -vn 0.286383 0.958112 -0.002503 -vn 0.271593 0.958112 -0.090877 -vn 0.230217 0.958112 -0.170356 -vn 0.166307 0.958112 -0.233160 -vn 0.086117 0.958112 -0.273140 -vn -0.002503 0.958112 -0.286383 -vn -0.090878 0.958112 -0.271593 -vn -0.170356 0.958112 -0.230218 -vn -0.233160 0.958112 -0.166307 -vn -0.273140 0.958112 -0.086117 -vn -0.286383 0.958112 0.002503 -vn 0.019333 0.999711 -0.014327 -vn 0.022814 0.999711 -0.007651 -vn 0.013959 0.999711 -0.019600 -vn 0.007219 0.999711 -0.022954 -vn -0.000227 0.999711 -0.024062 -vn -0.007652 0.999711 -0.022814 -vn -0.014327 0.999711 -0.019333 -vn -0.019600 0.999711 -0.013959 -vn -0.022954 0.999711 -0.007219 -vn -0.024062 0.999711 0.000227 -vn -0.022814 0.999711 0.007652 -vn -0.019333 0.999711 0.014327 -vn -0.013959 0.999711 0.019600 -vn -0.007219 0.999711 0.022954 -vn 0.000227 0.999711 0.024062 -vn 0.007652 0.999711 0.022814 -vn 0.014327 0.999711 0.019333 -vn 0.019600 0.999711 0.013959 -vn 0.022954 0.999711 0.007219 -vn 0.024061 0.999711 -0.000227 -vn 0.265646 0.943948 -0.195947 -vn 0.313195 0.943948 -0.104268 -vn 0.192093 0.943948 -0.268446 -vn 0.099737 0.943948 -0.314667 -vn -0.002382 0.943948 -0.330087 -vn -0.104268 0.943948 -0.313195 -vn -0.195948 0.943948 -0.265645 -vn -0.268446 0.943948 -0.192093 -vn -0.314667 0.943948 -0.099737 -vn -0.330087 0.943948 0.002382 -vn -0.313195 0.943948 0.104268 -vn -0.265646 0.943948 0.195948 -vn -0.192093 0.943947 0.268447 -vn -0.099737 0.943948 0.314667 -vn 0.002382 0.943948 0.330087 -vn 0.104268 0.943947 0.313195 -vn 0.195948 0.943948 0.265646 -vn 0.268446 0.943948 0.192093 -vn 0.314668 0.943948 0.099737 -vn 0.330087 0.943948 -0.002382 -vn 0.485568 0.797995 -0.356972 -vn 0.572113 0.797995 -0.189451 -vn 0.351492 0.797994 -0.489549 -vn 0.183010 0.797995 -0.574206 -vn -0.003387 0.797995 -0.602655 -vn -0.189452 0.797995 -0.572113 -vn -0.356972 0.797995 -0.485567 -vn -0.489549 0.797995 -0.351492 -vn -0.574205 0.797995 -0.183010 -vn -0.602655 0.797995 0.003387 -vn -0.572113 0.797994 0.189452 -vn -0.485567 0.797995 0.356971 -vn -0.351492 0.797994 0.489549 -vn -0.183010 0.797995 0.574206 -vn 0.003387 0.797995 0.602655 -vn 0.189452 0.797994 0.572113 -vn 0.356972 0.797994 0.485568 -vn 0.489549 0.797994 0.351492 -vn 0.574206 0.797995 0.183010 -vn 0.602655 0.797995 -0.003386 -vn 0.658909 0.577013 -0.482592 -vn 0.775789 0.577013 -0.255357 -vn 0.477531 0.577013 -0.662586 -vn 0.249408 0.577013 -0.777722 -vn -0.003128 0.577013 -0.816729 -vn -0.255358 0.577013 -0.775789 -vn -0.482592 0.577013 -0.658909 -vn -0.662586 0.577013 -0.477531 -vn -0.777722 0.577013 -0.249408 -vn -0.816729 0.577013 0.003128 -vn -0.775789 0.577013 0.255358 -vn -0.658909 0.577013 0.482592 -vn -0.477531 0.577013 0.662586 -vn -0.249408 0.577013 0.777722 -vn 0.003128 0.577013 0.816729 -vn 0.255358 0.577013 0.775789 -vn 0.482592 0.577013 0.658909 -vn 0.662586 0.577013 0.477531 -vn 0.777722 0.577013 0.249408 -vn 0.816729 0.577013 -0.003127 -vn 0.770043 0.302442 -0.561750 -vn 0.905944 0.302443 -0.296299 -vn 0.558764 0.302443 -0.772212 -vn 0.292789 0.302443 -0.907085 -vn -0.001846 0.302442 -0.953166 -vn -0.296300 0.302443 -0.905944 -vn -0.561750 0.302443 -0.770042 -vn -0.772212 0.302443 -0.558764 -vn -0.907085 0.302442 -0.292789 -vn -0.953166 0.302442 0.001846 -vn -0.905944 0.302443 0.296300 -vn -0.770042 0.302442 0.561750 -vn -0.558764 0.302443 0.772212 -vn -0.292789 0.302442 0.907085 -vn 0.001846 0.302443 0.953166 -vn 0.296300 0.302442 0.905944 -vn 0.561750 0.302443 0.770043 -vn 0.772212 0.302442 0.558764 -vn 0.907085 0.302443 0.292789 -vn 0.953166 0.302442 -0.001845 -vn 0.809017 -0.000000 -0.587785 -vn 0.951057 0.000000 -0.309016 -vn 0.587785 -0.000000 -0.809017 -vn 0.309017 0.000000 -0.951057 -vn -0.000000 0.000000 -1.000000 -vn -0.309017 0.000000 -0.951057 -vn -0.587786 0.000000 -0.809017 -vn -0.809017 0.000000 -0.587785 -vn -0.951057 -0.000000 -0.309017 -vn -1.000000 0.000000 0.000000 -vn -0.951057 0.000000 0.309017 -vn -0.809017 -0.000000 0.587785 -vn -0.587785 0.000000 0.809017 -vn -0.309017 -0.000000 0.951057 -vn -0.000000 0.000000 1.000000 -vn 0.309017 -0.000000 0.951057 -vn 0.587785 0.000000 0.809017 -vn 0.809017 -0.000000 0.587785 -vn 0.951057 0.000000 0.309017 -vn 1.000000 -0.000000 0.000001 -vn 0.772212 -0.302443 -0.558764 -vn 0.907085 -0.302442 -0.292788 -vn 0.561750 -0.302443 -0.770042 -vn 0.296300 -0.302443 -0.905944 -vn 0.001845 -0.302442 -0.953166 -vn -0.292789 -0.302443 -0.907085 -vn -0.558764 -0.302442 -0.772212 -vn -0.770043 -0.302442 -0.561750 -vn -0.905944 -0.302443 -0.296300 -vn -0.953166 -0.302442 -0.001846 -vn -0.907085 -0.302443 0.292789 -vn -0.772212 -0.302443 0.558764 -vn -0.561750 -0.302442 0.770043 -vn -0.296300 -0.302442 0.905944 -vn -0.001845 -0.302443 0.953166 -vn 0.292789 -0.302442 0.907085 -vn 0.558764 -0.302442 0.772212 -vn 0.770042 -0.302443 0.561750 -vn 0.905944 -0.302442 0.296300 -vn 0.953166 -0.302443 0.001846 -vn 0.662586 -0.577013 -0.477531 -vn 0.777723 -0.577012 -0.249408 -vn 0.482592 -0.577013 -0.658909 -vn 0.255358 -0.577013 -0.775789 -vn 0.003128 -0.577013 -0.816729 -vn -0.249409 -0.577013 -0.777722 -vn -0.477531 -0.577013 -0.662586 -vn -0.658910 -0.577012 -0.482592 -vn -0.775789 -0.577013 -0.255358 -vn -0.816729 -0.577012 -0.003128 -vn -0.777722 -0.577013 0.249409 -vn -0.662586 -0.577013 0.477531 -vn -0.482592 -0.577013 0.658909 -vn -0.255358 -0.577013 0.775789 -vn -0.003128 -0.577013 0.816729 -vn 0.249409 -0.577013 0.777722 -vn 0.477531 -0.577012 0.662586 -vn 0.658909 -0.577013 0.482592 -vn 0.775789 -0.577012 0.255358 -vn 0.816729 -0.577013 0.003129 -vn 0.489549 -0.797994 -0.351492 -vn 0.574206 -0.797995 -0.183009 -vn 0.356972 -0.797995 -0.485568 -vn 0.189452 -0.797994 -0.572113 -vn 0.003387 -0.797994 -0.602655 -vn -0.183010 -0.797994 -0.574206 -vn -0.351492 -0.797994 -0.489549 -vn -0.485568 -0.797994 -0.356972 -vn -0.572113 -0.797995 -0.189451 -vn -0.602655 -0.797995 -0.003387 -vn -0.574206 -0.797994 0.183010 -vn -0.489549 -0.797995 0.351492 -vn -0.356972 -0.797994 0.485568 -vn -0.189452 -0.797994 0.572113 -vn -0.003386 -0.797994 0.602655 -vn 0.183010 -0.797994 0.574206 -vn 0.351492 -0.797994 0.489549 -vn 0.485568 -0.797994 0.356972 -vn 0.572113 -0.797994 0.189452 -vn 0.602655 -0.797994 0.003387 -vn 0.268446 -0.943947 -0.192093 -vn 0.314668 -0.943947 -0.099736 -vn 0.195948 -0.943948 -0.265646 -vn 0.104268 -0.943948 -0.313195 -vn 0.002382 -0.943947 -0.330087 -vn -0.099737 -0.943948 -0.314668 -vn -0.192093 -0.943948 -0.268446 -vn -0.265646 -0.943948 -0.195948 -vn -0.313195 -0.943948 -0.104268 -vn -0.330087 -0.943948 -0.002382 -vn -0.314668 -0.943947 0.099737 -vn -0.268446 -0.943948 0.192093 -vn -0.195948 -0.943947 0.265646 -vn -0.104268 -0.943947 0.313195 -vn -0.002382 -0.943947 0.330087 -vn 0.099737 -0.943947 0.314668 -vn 0.192093 -0.943948 0.268446 -vn 0.265646 -0.943947 0.195948 -vn 0.313195 -0.943948 0.104268 -vn 0.330087 -0.943947 0.002383 -vn 0.019600 -0.999711 -0.013959 -vn 0.022954 -0.999711 -0.007219 -vn 0.014327 -0.999710 -0.019333 -vn 0.007652 -0.999711 -0.022814 -vn 0.000227 -0.999711 -0.024062 -vn -0.007219 -0.999711 -0.022954 -vn -0.013959 -0.999711 -0.019600 -vn -0.019333 -0.999711 -0.014327 -vn -0.022814 -0.999711 -0.007652 -vn -0.024062 -0.999711 -0.000227 -vn -0.022954 -0.999711 0.007219 -vn -0.019600 -0.999711 0.013959 -vn -0.014327 -0.999710 0.019333 -vn -0.007652 -0.999711 0.022814 -vn -0.000227 -0.999711 0.024062 -vn 0.007219 -0.999711 0.022954 -vn 0.013959 -0.999711 0.019600 -vn 0.019333 -0.999711 0.014327 -vn 0.022814 -0.999711 0.007651 -vn 0.024062 -0.999711 0.000227 -vn -0.233159 -0.958112 0.166307 -vn -0.273139 -0.958112 0.086116 -vn -0.170356 -0.958112 0.230217 -vn -0.090877 -0.958112 0.271593 -vn -0.002503 -0.958112 0.286383 -vn 0.086117 -0.958112 0.273139 -vn 0.166307 -0.958112 0.233159 -vn 0.230217 -0.958112 0.170356 -vn 0.271593 -0.958112 0.090877 -vn 0.286383 -0.958112 0.002503 -vn 0.273139 -0.958112 -0.086117 -vn 0.233160 -0.958112 -0.166307 -vn 0.170356 -0.958112 -0.230217 -vn 0.090877 -0.958112 -0.271592 -vn 0.002503 -0.958112 -0.286383 -vn -0.086117 -0.958112 -0.273139 -vn -0.166307 -0.958112 -0.233159 -vn -0.230217 -0.958112 -0.170356 -vn -0.271593 -0.958112 -0.090877 -vn -0.286383 -0.958112 -0.002503 -vn -0.464491 -0.821164 0.331568 -vn -0.544217 -0.821164 0.171804 -vn -0.339297 -0.821164 0.458876 -vn -0.180890 -0.821164 0.541265 -vn -0.004777 -0.821164 0.570672 -vn 0.171805 -0.821164 0.544217 -vn 0.331568 -0.821164 0.464491 -vn 0.458876 -0.821164 0.339297 -vn 0.541265 -0.821164 0.180890 -vn 0.570672 -0.821164 0.004777 -vn 0.544218 -0.821164 -0.171804 -vn 0.464491 -0.821164 -0.331568 -vn 0.339297 -0.821164 -0.458876 -vn 0.180890 -0.821164 -0.541265 -vn 0.004777 -0.821164 -0.570672 -vn -0.171805 -0.821164 -0.544218 -vn -0.331568 -0.821164 -0.464491 -vn -0.458876 -0.821164 -0.339297 -vn -0.541265 -0.821164 -0.180890 -vn -0.570672 -0.821164 -0.004777 -vn -0.650043 -0.600534 0.465620 -vn -0.762113 -0.600534 0.241956 -vn -0.474343 -0.600534 0.643706 -vn -0.252211 -0.600534 0.758781 -vn -0.005391 -0.600534 0.799581 -vn 0.241957 -0.600534 0.762113 -vn 0.465621 -0.600534 0.650043 -vn 0.643706 -0.600534 0.474343 -vn 0.758781 -0.600534 0.252211 -vn 0.799581 -0.600534 0.005391 -vn 0.762113 -0.600534 -0.241957 -vn 0.650043 -0.600534 -0.465621 -vn 0.474343 -0.600534 -0.643706 -vn 0.252211 -0.600534 -0.758781 -vn 0.005391 -0.600534 -0.799581 -vn -0.241957 -0.600534 -0.762113 -vn -0.465620 -0.600534 -0.650043 -vn -0.643706 -0.600534 -0.474344 -vn -0.758781 -0.600534 -0.252211 -vn -0.799581 -0.600534 -0.005392 -vn -0.769366 -0.317181 0.554502 -vn -0.903061 -0.317181 0.289615 -vn -0.560360 -0.317181 0.765110 -vn -0.296501 -0.317181 0.900823 -vn -0.003620 -0.317181 0.948358 -vn 0.289616 -0.317181 0.903061 -vn 0.554502 -0.317181 0.769366 -vn 0.765110 -0.317181 0.560360 -vn 0.900823 -0.317181 0.296502 -vn 0.948358 -0.317181 0.003620 -vn 0.903061 -0.317181 -0.289616 -vn 0.769366 -0.317181 -0.554502 -vn 0.560360 -0.317181 -0.765110 -vn 0.296502 -0.317181 -0.900823 -vn 0.003620 -0.317181 -0.948358 -vn -0.289616 -0.317181 -0.903061 -vn -0.554502 -0.317181 -0.769366 -vn -0.765110 -0.317181 -0.560360 -vn -0.900823 -0.317181 -0.296502 -vn -0.948358 -0.317181 -0.003621 -f 402/443/401 401/442/402 422/464/403 -f 422/464/403 401/442/402 421/463/404 -f 403/444/405 402/443/401 423/465/406 -f 423/465/406 402/443/401 422/464/403 -f 404/445/407 403/444/405 424/466/408 -f 424/466/408 403/444/405 423/465/406 -f 405/446/409 404/445/407 425/467/410 -f 425/467/410 404/445/407 424/466/408 -f 406/447/411 405/446/409 426/468/412 -f 426/468/412 405/446/409 425/467/410 -f 407/448/413 406/447/411 427/469/414 -f 427/469/414 406/447/411 426/468/412 -f 408/449/415 407/448/413 428/470/416 -f 428/470/416 407/448/413 427/469/414 -f 409/450/417 408/449/415 429/471/418 -f 429/471/418 408/449/415 428/470/416 -f 410/451/419 409/450/417 430/472/420 -f 430/472/420 409/450/417 429/471/418 -f 411/452/421 410/451/419 431/473/422 -f 431/473/422 410/451/419 430/472/420 -f 412/453/423 411/452/421 432/474/424 -f 432/474/424 411/452/421 431/473/422 -f 413/454/425 412/453/423 433/475/426 -f 433/475/426 412/453/423 432/474/424 -f 414/455/427 413/454/425 434/476/428 -f 434/476/428 413/454/425 433/475/426 -f 415/456/429 414/455/427 435/477/430 -f 435/477/430 414/455/427 434/476/428 -f 416/457/431 415/456/429 436/478/432 -f 436/478/432 415/456/429 435/477/430 -f 417/458/433 416/457/431 437/479/434 -f 437/479/434 416/457/431 436/478/432 -f 418/459/435 417/458/433 438/480/436 -f 438/480/436 417/458/433 437/479/434 -f 419/460/437 418/459/435 439/481/438 -f 439/481/438 418/459/435 438/480/436 -f 420/461/439 419/460/437 440/482/440 -f 440/482/440 419/460/437 439/481/438 -f 401/462/402 420/461/439 421/483/404 -f 421/483/404 420/461/439 440/482/440 -f 422/464/403 421/463/404 442/485/441 -f 442/485/441 421/463/404 441/484/442 -f 423/465/406 422/464/403 443/486/443 -f 443/486/443 422/464/403 442/485/441 -f 424/466/408 423/465/406 444/487/444 -f 444/487/444 423/465/406 443/486/443 -f 425/467/410 424/466/408 445/488/445 -f 445/488/445 424/466/408 444/487/444 -f 426/468/412 425/467/410 446/489/446 -f 446/489/446 425/467/410 445/488/445 -f 427/469/414 426/468/412 447/490/447 -f 447/490/447 426/468/412 446/489/446 -f 428/470/416 427/469/414 448/491/448 -f 448/491/448 427/469/414 447/490/447 -f 429/471/418 428/470/416 449/492/449 -f 449/492/449 428/470/416 448/491/448 -f 430/472/420 429/471/418 450/493/450 -f 450/493/450 429/471/418 449/492/449 -f 431/473/422 430/472/420 451/494/451 -f 451/494/451 430/472/420 450/493/450 -f 432/474/424 431/473/422 452/495/452 -f 452/495/452 431/473/422 451/494/451 -f 433/475/426 432/474/424 453/496/453 -f 453/496/453 432/474/424 452/495/452 -f 434/476/428 433/475/426 454/497/454 -f 454/497/454 433/475/426 453/496/453 -f 435/477/430 434/476/428 455/498/455 -f 455/498/455 434/476/428 454/497/454 -f 436/478/432 435/477/430 456/499/456 -f 456/499/456 435/477/430 455/498/455 -f 437/479/434 436/478/432 457/500/457 -f 457/500/457 436/478/432 456/499/456 -f 438/480/436 437/479/434 458/501/458 -f 458/501/458 437/479/434 457/500/457 -f 439/481/438 438/480/436 459/502/459 -f 459/502/459 438/480/436 458/501/458 -f 440/482/440 439/481/438 460/503/460 -f 460/503/460 439/481/438 459/502/459 -f 421/483/404 440/482/440 441/504/442 -f 441/504/442 440/482/440 460/503/460 -f 442/485/441 441/484/442 462/506/461 -f 462/506/461 441/484/442 461/505/462 -f 443/486/443 442/485/441 463/507/463 -f 463/507/463 442/485/441 462/506/461 -f 444/487/444 443/486/443 464/508/464 -f 464/508/464 443/486/443 463/507/463 -f 445/488/445 444/487/444 465/509/465 -f 465/509/465 444/487/444 464/508/464 -f 446/489/446 445/488/445 466/510/466 -f 466/510/466 445/488/445 465/509/465 -f 447/490/447 446/489/446 467/511/467 -f 467/511/467 446/489/446 466/510/466 -f 448/491/448 447/490/447 468/512/468 -f 468/512/468 447/490/447 467/511/467 -f 449/492/449 448/491/448 469/513/469 -f 469/513/469 448/491/448 468/512/468 -f 450/493/450 449/492/449 470/514/470 -f 470/514/470 449/492/449 469/513/469 -f 451/494/451 450/493/450 471/515/471 -f 471/515/471 450/493/450 470/514/470 -f 452/495/452 451/494/451 472/516/472 -f 472/516/472 451/494/451 471/515/471 -f 453/496/453 452/495/452 473/517/473 -f 473/517/473 452/495/452 472/516/472 -f 454/497/454 453/496/453 474/518/474 -f 474/518/474 453/496/453 473/517/473 -f 455/498/455 454/497/454 475/519/475 -f 475/519/475 454/497/454 474/518/474 -f 456/499/456 455/498/455 476/520/476 -f 476/520/476 455/498/455 475/519/475 -f 457/500/457 456/499/456 477/521/477 -f 477/521/477 456/499/456 476/520/476 -f 458/501/458 457/500/457 478/522/478 -f 478/522/478 457/500/457 477/521/477 -f 459/502/459 458/501/458 479/523/479 -f 479/523/479 458/501/458 478/522/478 -f 460/503/460 459/502/459 480/524/480 -f 480/524/480 459/502/459 479/523/479 -f 441/504/442 460/503/460 461/525/462 -f 461/525/462 460/503/460 480/524/480 -f 462/506/461 461/505/462 482/527/481 -f 482/527/481 461/505/462 481/526/482 -f 463/507/463 462/506/461 483/528/483 -f 483/528/483 462/506/461 482/527/481 -f 464/508/464 463/507/463 484/529/484 -f 484/529/484 463/507/463 483/528/483 -f 465/509/465 464/508/464 485/530/485 -f 485/530/485 464/508/464 484/529/484 -f 466/510/466 465/509/465 486/531/486 -f 486/531/486 465/509/465 485/530/485 -f 467/511/467 466/510/466 487/532/487 -f 487/532/487 466/510/466 486/531/486 -f 468/512/468 467/511/467 488/533/488 -f 488/533/488 467/511/467 487/532/487 -f 469/513/469 468/512/468 489/534/489 -f 489/534/489 468/512/468 488/533/488 -f 470/514/470 469/513/469 490/535/490 -f 490/535/490 469/513/469 489/534/489 -f 471/515/471 470/514/470 491/536/491 -f 491/536/491 470/514/470 490/535/490 -f 472/516/472 471/515/471 492/537/492 -f 492/537/492 471/515/471 491/536/491 -f 473/517/473 472/516/472 493/538/493 -f 493/538/493 472/516/472 492/537/492 -f 474/518/474 473/517/473 494/539/494 -f 494/539/494 473/517/473 493/538/493 -f 475/519/475 474/518/474 495/540/495 -f 495/540/495 474/518/474 494/539/494 -f 476/520/476 475/519/475 496/541/496 -f 496/541/496 475/519/475 495/540/495 -f 477/521/477 476/520/476 497/542/497 -f 497/542/497 476/520/476 496/541/496 -f 478/522/478 477/521/477 498/543/498 -f 498/543/498 477/521/477 497/542/497 -f 479/523/479 478/522/478 499/544/499 -f 499/544/499 478/522/478 498/543/498 -f 480/524/480 479/523/479 500/545/500 -f 500/545/500 479/523/479 499/544/499 -f 461/525/462 480/524/480 481/546/482 -f 481/546/482 480/524/480 500/545/500 -f 482/527/481 481/526/482 502/548/501 -f 502/548/501 481/526/482 501/547/502 -f 483/528/483 482/527/481 503/549/503 -f 503/549/503 482/527/481 502/548/501 -f 484/529/484 483/528/483 504/550/504 -f 504/550/504 483/528/483 503/549/503 -f 485/530/485 484/529/484 505/551/505 -f 505/551/505 484/529/484 504/550/504 -f 486/531/486 485/530/485 506/552/506 -f 506/552/506 485/530/485 505/551/505 -f 487/532/487 486/531/486 507/553/507 -f 507/553/507 486/531/486 506/552/506 -f 488/533/488 487/532/487 508/554/508 -f 508/554/508 487/532/487 507/553/507 -f 489/534/489 488/533/488 509/555/509 -f 509/555/509 488/533/488 508/554/508 -f 490/535/490 489/534/489 510/556/510 -f 510/556/510 489/534/489 509/555/509 -f 491/536/491 490/535/490 511/557/511 -f 511/557/511 490/535/490 510/556/510 -f 492/537/492 491/536/491 512/558/512 -f 512/558/512 491/536/491 511/557/511 -f 493/538/493 492/537/492 513/559/513 -f 513/559/513 492/537/492 512/558/512 -f 494/539/494 493/538/493 514/560/514 -f 514/560/514 493/538/493 513/559/513 -f 495/540/495 494/539/494 515/561/515 -f 515/561/515 494/539/494 514/560/514 -f 496/541/496 495/540/495 516/562/516 -f 516/562/516 495/540/495 515/561/515 -f 497/542/497 496/541/496 517/563/517 -f 517/563/517 496/541/496 516/562/516 -f 498/543/498 497/542/497 518/564/518 -f 518/564/518 497/542/497 517/563/517 -f 499/544/499 498/543/498 519/565/519 -f 519/565/519 498/543/498 518/564/518 -f 500/545/500 499/544/499 520/566/520 -f 520/566/520 499/544/499 519/565/519 -f 481/546/482 500/545/500 501/567/502 -f 501/567/502 500/545/500 520/566/520 -f 502/548/501 501/547/502 522/569/521 -f 522/569/521 501/547/502 521/568/522 -f 503/549/503 502/548/501 523/570/523 -f 523/570/523 502/548/501 522/569/521 -f 504/550/504 503/549/503 524/571/524 -f 524/571/524 503/549/503 523/570/523 -f 505/551/505 504/550/504 525/572/525 -f 525/572/525 504/550/504 524/571/524 -f 506/552/506 505/551/505 526/573/526 -f 526/573/526 505/551/505 525/572/525 -f 507/553/507 506/552/506 527/574/527 -f 527/574/527 506/552/506 526/573/526 -f 508/554/508 507/553/507 528/575/528 -f 528/575/528 507/553/507 527/574/527 -f 509/555/509 508/554/508 529/576/529 -f 529/576/529 508/554/508 528/575/528 -f 510/556/510 509/555/509 530/577/530 -f 530/577/530 509/555/509 529/576/529 -f 511/557/511 510/556/510 531/578/531 -f 531/578/531 510/556/510 530/577/530 -f 512/558/512 511/557/511 532/579/532 -f 532/579/532 511/557/511 531/578/531 -f 513/559/513 512/558/512 533/580/533 -f 533/580/533 512/558/512 532/579/532 -f 514/560/514 513/559/513 534/581/534 -f 534/581/534 513/559/513 533/580/533 -f 515/561/515 514/560/514 535/582/535 -f 535/582/535 514/560/514 534/581/534 -f 516/562/516 515/561/515 536/583/536 -f 536/583/536 515/561/515 535/582/535 -f 517/563/517 516/562/516 537/584/537 -f 537/584/537 516/562/516 536/583/536 -f 518/564/518 517/563/517 538/585/538 -f 538/585/538 517/563/517 537/584/537 -f 519/565/519 518/564/518 539/586/539 -f 539/586/539 518/564/518 538/585/538 -f 520/566/520 519/565/519 540/587/540 -f 540/587/540 519/565/519 539/586/539 -f 501/567/502 520/566/520 521/588/522 -f 521/588/522 520/566/520 540/587/540 -f 522/569/521 521/568/522 542/590/541 -f 542/590/541 521/568/522 541/589/542 -f 523/570/523 522/569/521 543/591/543 -f 543/591/543 522/569/521 542/590/541 -f 524/571/524 523/570/523 544/592/544 -f 544/592/544 523/570/523 543/591/543 -f 525/572/525 524/571/524 545/593/545 -f 545/593/545 524/571/524 544/592/544 -f 526/573/526 525/572/525 546/594/546 -f 546/594/546 525/572/525 545/593/545 -f 527/574/527 526/573/526 547/595/547 -f 547/595/547 526/573/526 546/594/546 -f 528/575/528 527/574/527 548/596/548 -f 548/596/548 527/574/527 547/595/547 -f 529/576/529 528/575/528 549/597/549 -f 549/597/549 528/575/528 548/596/548 -f 530/577/530 529/576/529 550/598/550 -f 550/598/550 529/576/529 549/597/549 -f 531/578/531 530/577/530 551/599/551 -f 551/599/551 530/577/530 550/598/550 -f 532/579/532 531/578/531 552/600/552 -f 552/600/552 531/578/531 551/599/551 -f 533/580/533 532/579/532 553/601/553 -f 553/601/553 532/579/532 552/600/552 -f 534/581/534 533/580/533 554/602/554 -f 554/602/554 533/580/533 553/601/553 -f 535/582/535 534/581/534 555/603/555 -f 555/603/555 534/581/534 554/602/554 -f 536/583/536 535/582/535 556/604/556 -f 556/604/556 535/582/535 555/603/555 -f 537/584/537 536/583/536 557/605/557 -f 557/605/557 536/583/536 556/604/556 -f 538/585/538 537/584/537 558/606/558 -f 558/606/558 537/584/537 557/605/557 -f 539/586/539 538/585/538 559/607/559 -f 559/607/559 538/585/538 558/606/558 -f 540/587/540 539/586/539 560/608/560 -f 560/608/560 539/586/539 559/607/559 -f 521/588/522 540/587/540 541/609/542 -f 541/609/542 540/587/540 560/608/560 -f 542/590/541 541/589/542 562/611/561 -f 562/611/561 541/589/542 561/610/562 -f 543/591/543 542/590/541 563/612/563 -f 563/612/563 542/590/541 562/611/561 -f 544/592/544 543/591/543 564/613/564 -f 564/613/564 543/591/543 563/612/563 -f 545/593/545 544/592/544 565/614/565 -f 565/614/565 544/592/544 564/613/564 -f 546/594/546 545/593/545 566/615/566 -f 566/615/566 545/593/545 565/614/565 -f 547/595/547 546/594/546 567/616/567 -f 567/616/567 546/594/546 566/615/566 -f 548/596/548 547/595/547 568/617/568 -f 568/617/568 547/595/547 567/616/567 -f 549/597/549 548/596/548 569/618/569 -f 569/618/569 548/596/548 568/617/568 -f 550/598/550 549/597/549 570/619/570 -f 570/619/570 549/597/549 569/618/569 -f 551/599/551 550/598/550 571/620/571 -f 571/620/571 550/598/550 570/619/570 -f 552/600/552 551/599/551 572/621/572 -f 572/621/572 551/599/551 571/620/571 -f 553/601/553 552/600/552 573/622/573 -f 573/622/573 552/600/552 572/621/572 -f 554/602/554 553/601/553 574/623/574 -f 574/623/574 553/601/553 573/622/573 -f 555/603/555 554/602/554 575/624/575 -f 575/624/575 554/602/554 574/623/574 -f 556/604/556 555/603/555 576/625/576 -f 576/625/576 555/603/555 575/624/575 -f 557/605/557 556/604/556 577/626/577 -f 577/626/577 556/604/556 576/625/576 -f 558/606/558 557/605/557 578/627/578 -f 578/627/578 557/605/557 577/626/577 -f 559/607/559 558/606/558 579/628/579 -f 579/628/579 558/606/558 578/627/578 -f 560/608/560 559/607/559 580/629/580 -f 580/629/580 559/607/559 579/628/579 -f 541/609/542 560/608/560 561/630/562 -f 561/630/562 560/608/560 580/629/580 -f 562/611/561 561/610/562 582/632/581 -f 582/632/581 561/610/562 581/631/582 -f 563/612/563 562/611/561 583/633/583 -f 583/633/583 562/611/561 582/632/581 -f 564/613/564 563/612/563 584/634/584 -f 584/634/584 563/612/563 583/633/583 -f 565/614/565 564/613/564 585/635/585 -f 585/635/585 564/613/564 584/634/584 -f 566/615/566 565/614/565 586/636/586 -f 586/636/586 565/614/565 585/635/585 -f 567/616/567 566/615/566 587/637/587 -f 587/637/587 566/615/566 586/636/586 -f 568/617/568 567/616/567 588/638/588 -f 588/638/588 567/616/567 587/637/587 -f 569/618/569 568/617/568 589/639/589 -f 589/639/589 568/617/568 588/638/588 -f 570/619/570 569/618/569 590/640/590 -f 590/640/590 569/618/569 589/639/589 -f 571/620/571 570/619/570 591/641/591 -f 591/641/591 570/619/570 590/640/590 -f 572/621/572 571/620/571 592/642/592 -f 592/642/592 571/620/571 591/641/591 -f 573/622/573 572/621/572 593/643/593 -f 593/643/593 572/621/572 592/642/592 -f 574/623/574 573/622/573 594/644/594 -f 594/644/594 573/622/573 593/643/593 -f 575/624/575 574/623/574 595/645/595 -f 595/645/595 574/623/574 594/644/594 -f 576/625/576 575/624/575 596/646/596 -f 596/646/596 575/624/575 595/645/595 -f 577/626/577 576/625/576 597/647/597 -f 597/647/597 576/625/576 596/646/596 -f 578/627/578 577/626/577 598/648/598 -f 598/648/598 577/626/577 597/647/597 -f 579/628/579 578/627/578 599/649/599 -f 599/649/599 578/627/578 598/648/598 -f 580/629/580 579/628/579 600/650/600 -f 600/650/600 579/628/579 599/649/599 -f 561/630/562 580/629/580 581/651/582 -f 581/651/582 580/629/580 600/650/600 -f 582/632/581 581/631/582 602/653/601 -f 602/653/601 581/631/582 601/652/602 -f 583/633/583 582/632/581 603/654/603 -f 603/654/603 582/632/581 602/653/601 -f 584/634/584 583/633/583 604/655/604 -f 604/655/604 583/633/583 603/654/603 -f 585/635/585 584/634/584 605/656/605 -f 605/656/605 584/634/584 604/655/604 -f 586/636/586 585/635/585 606/657/606 -f 606/657/606 585/635/585 605/656/605 -f 587/637/587 586/636/586 607/658/607 -f 607/658/607 586/636/586 606/657/606 -f 588/638/588 587/637/587 608/659/608 -f 608/659/608 587/637/587 607/658/607 -f 589/639/589 588/638/588 609/660/609 -f 609/660/609 588/638/588 608/659/608 -f 590/640/590 589/639/589 610/661/610 -f 610/661/610 589/639/589 609/660/609 -f 591/641/591 590/640/590 611/662/611 -f 611/662/611 590/640/590 610/661/610 -f 592/642/592 591/641/591 612/663/612 -f 612/663/612 591/641/591 611/662/611 -f 593/643/593 592/642/592 613/664/613 -f 613/664/613 592/642/592 612/663/612 -f 594/644/594 593/643/593 614/665/614 -f 614/665/614 593/643/593 613/664/613 -f 595/645/595 594/644/594 615/666/615 -f 615/666/615 594/644/594 614/665/614 -f 596/646/596 595/645/595 616/667/616 -f 616/667/616 595/645/595 615/666/615 -f 597/647/597 596/646/596 617/668/617 -f 617/668/617 596/646/596 616/667/616 -f 598/648/598 597/647/597 618/669/618 -f 618/669/618 597/647/597 617/668/617 -f 599/649/599 598/648/598 619/670/619 -f 619/670/619 598/648/598 618/669/618 -f 600/650/600 599/649/599 620/671/620 -f 620/671/620 599/649/599 619/670/619 -f 581/651/582 600/650/600 601/672/602 -f 601/672/602 600/650/600 620/671/620 -f 602/653/601 601/652/602 622/674/621 -f 622/674/621 601/652/602 621/673/622 -f 603/654/603 602/653/601 623/675/623 -f 623/675/623 602/653/601 622/674/621 -f 604/655/604 603/654/603 624/676/624 -f 624/676/624 603/654/603 623/675/623 -f 605/656/605 604/655/604 625/677/625 -f 625/677/625 604/655/604 624/676/624 -f 606/657/606 605/656/605 626/678/626 -f 626/678/626 605/656/605 625/677/625 -f 607/658/607 606/657/606 627/679/627 -f 627/679/627 606/657/606 626/678/626 -f 608/659/608 607/658/607 628/680/628 -f 628/680/628 607/658/607 627/679/627 -f 609/660/609 608/659/608 629/681/629 -f 629/681/629 608/659/608 628/680/628 -f 610/661/610 609/660/609 630/682/630 -f 630/682/630 609/660/609 629/681/629 -f 611/662/611 610/661/610 631/683/631 -f 631/683/631 610/661/610 630/682/630 -f 612/663/612 611/662/611 632/684/632 -f 632/684/632 611/662/611 631/683/631 -f 613/664/613 612/663/612 633/685/633 -f 633/685/633 612/663/612 632/684/632 -f 614/665/614 613/664/613 634/686/634 -f 634/686/634 613/664/613 633/685/633 -f 615/666/615 614/665/614 635/687/635 -f 635/687/635 614/665/614 634/686/634 -f 616/667/616 615/666/615 636/688/636 -f 636/688/636 615/666/615 635/687/635 -f 617/668/617 616/667/616 637/689/637 -f 637/689/637 616/667/616 636/688/636 -f 618/669/618 617/668/617 638/690/638 -f 638/690/638 617/668/617 637/689/637 -f 619/670/619 618/669/618 639/691/639 -f 639/691/639 618/669/618 638/690/638 -f 620/671/620 619/670/619 640/692/640 -f 640/692/640 619/670/619 639/691/639 -f 601/672/602 620/671/620 621/693/622 -f 621/693/622 620/671/620 640/692/640 -f 622/674/621 621/673/622 642/695/641 -f 642/695/641 621/673/622 641/694/642 -f 623/675/623 622/674/621 643/696/643 -f 643/696/643 622/674/621 642/695/641 -f 624/676/624 623/675/623 644/697/644 -f 644/697/644 623/675/623 643/696/643 -f 625/677/625 624/676/624 645/698/645 -f 645/698/645 624/676/624 644/697/644 -f 626/678/626 625/677/625 646/699/646 -f 646/699/646 625/677/625 645/698/645 -f 627/679/627 626/678/626 647/700/647 -f 647/700/647 626/678/626 646/699/646 -f 628/680/628 627/679/627 648/701/648 -f 648/701/648 627/679/627 647/700/647 -f 629/681/629 628/680/628 649/702/649 -f 649/702/649 628/680/628 648/701/648 -f 630/682/630 629/681/629 650/703/650 -f 650/703/650 629/681/629 649/702/649 -f 631/683/631 630/682/630 651/704/651 -f 651/704/651 630/682/630 650/703/650 -f 632/684/632 631/683/631 652/705/652 -f 652/705/652 631/683/631 651/704/651 -f 633/685/633 632/684/632 653/706/653 -f 653/706/653 632/684/632 652/705/652 -f 634/686/634 633/685/633 654/707/654 -f 654/707/654 633/685/633 653/706/653 -f 635/687/635 634/686/634 655/708/655 -f 655/708/655 634/686/634 654/707/654 -f 636/688/636 635/687/635 656/709/656 -f 656/709/656 635/687/635 655/708/655 -f 637/689/637 636/688/636 657/710/657 -f 657/710/657 636/688/636 656/709/656 -f 638/690/638 637/689/637 658/711/658 -f 658/711/658 637/689/637 657/710/657 -f 639/691/639 638/690/638 659/712/659 -f 659/712/659 638/690/638 658/711/658 -f 640/692/640 639/691/639 660/713/660 -f 660/713/660 639/691/639 659/712/659 -f 621/693/622 640/692/640 641/714/642 -f 641/714/642 640/692/640 660/713/660 -f 642/695/641 641/694/642 662/716/661 -f 662/716/661 641/694/642 661/715/662 -f 643/696/643 642/695/641 663/717/663 -f 663/717/663 642/695/641 662/716/661 -f 644/697/644 643/696/643 664/718/664 -f 664/718/664 643/696/643 663/717/663 -f 645/698/645 644/697/644 665/719/665 -f 665/719/665 644/697/644 664/718/664 -f 646/699/646 645/698/645 666/720/666 -f 666/720/666 645/698/645 665/719/665 -f 647/700/647 646/699/646 667/721/667 -f 667/721/667 646/699/646 666/720/666 -f 648/701/648 647/700/647 668/722/668 -f 668/722/668 647/700/647 667/721/667 -f 649/702/649 648/701/648 669/723/669 -f 669/723/669 648/701/648 668/722/668 -f 650/703/650 649/702/649 670/724/670 -f 670/724/670 649/702/649 669/723/669 -f 651/704/651 650/703/650 671/725/671 -f 671/725/671 650/703/650 670/724/670 -f 652/705/652 651/704/651 672/726/672 -f 672/726/672 651/704/651 671/725/671 -f 653/706/653 652/705/652 673/727/673 -f 673/727/673 652/705/652 672/726/672 -f 654/707/654 653/706/653 674/728/674 -f 674/728/674 653/706/653 673/727/673 -f 655/708/655 654/707/654 675/729/675 -f 675/729/675 654/707/654 674/728/674 -f 656/709/656 655/708/655 676/730/676 -f 676/730/676 655/708/655 675/729/675 -f 657/710/657 656/709/656 677/731/677 -f 677/731/677 656/709/656 676/730/676 -f 658/711/658 657/710/657 678/732/678 -f 678/732/678 657/710/657 677/731/677 -f 659/712/659 658/711/658 679/733/679 -f 679/733/679 658/711/658 678/732/678 -f 660/713/660 659/712/659 680/734/680 -f 680/734/680 659/712/659 679/733/679 -f 641/714/642 660/713/660 661/735/662 -f 661/735/662 660/713/660 680/734/680 -f 662/716/661 661/715/662 682/737/681 -f 682/737/681 661/715/662 681/736/682 -f 663/717/663 662/716/661 683/738/683 -f 683/738/683 662/716/661 682/737/681 -f 664/718/664 663/717/663 684/739/684 -f 684/739/684 663/717/663 683/738/683 -f 665/719/665 664/718/664 685/740/685 -f 685/740/685 664/718/664 684/739/684 -f 666/720/666 665/719/665 686/741/686 -f 686/741/686 665/719/665 685/740/685 -f 667/721/667 666/720/666 687/742/687 -f 687/742/687 666/720/666 686/741/686 -f 668/722/668 667/721/667 688/743/688 -f 688/743/688 667/721/667 687/742/687 -f 669/723/669 668/722/668 689/744/689 -f 689/744/689 668/722/668 688/743/688 -f 670/724/670 669/723/669 690/745/690 -f 690/745/690 669/723/669 689/744/689 -f 671/725/671 670/724/670 691/746/691 -f 691/746/691 670/724/670 690/745/690 -f 672/726/672 671/725/671 692/747/692 -f 692/747/692 671/725/671 691/746/691 -f 673/727/673 672/726/672 693/748/693 -f 693/748/693 672/726/672 692/747/692 -f 674/728/674 673/727/673 694/749/694 -f 694/749/694 673/727/673 693/748/693 -f 675/729/675 674/728/674 695/750/695 -f 695/750/695 674/728/674 694/749/694 -f 676/730/676 675/729/675 696/751/696 -f 696/751/696 675/729/675 695/750/695 -f 677/731/677 676/730/676 697/752/697 -f 697/752/697 676/730/676 696/751/696 -f 678/732/678 677/731/677 698/753/698 -f 698/753/698 677/731/677 697/752/697 -f 679/733/679 678/732/678 699/754/699 -f 699/754/699 678/732/678 698/753/698 -f 680/734/680 679/733/679 700/755/700 -f 700/755/700 679/733/679 699/754/699 -f 661/735/662 680/734/680 681/756/682 -f 681/756/682 680/734/680 700/755/700 -f 682/737/681 681/736/682 702/758/701 -f 702/758/701 681/736/682 701/757/702 -f 683/738/683 682/737/681 703/759/703 -f 703/759/703 682/737/681 702/758/701 -f 684/739/684 683/738/683 704/760/704 -f 704/760/704 683/738/683 703/759/703 -f 685/740/685 684/739/684 705/761/705 -f 705/761/705 684/739/684 704/760/704 -f 686/741/686 685/740/685 706/762/706 -f 706/762/706 685/740/685 705/761/705 -f 687/742/687 686/741/686 707/763/707 -f 707/763/707 686/741/686 706/762/706 -f 688/743/688 687/742/687 708/764/708 -f 708/764/708 687/742/687 707/763/707 -f 689/744/689 688/743/688 709/765/709 -f 709/765/709 688/743/688 708/764/708 -f 690/745/690 689/744/689 710/766/710 -f 710/766/710 689/744/689 709/765/709 -f 691/746/691 690/745/690 711/767/711 -f 711/767/711 690/745/690 710/766/710 -f 692/747/692 691/746/691 712/768/712 -f 712/768/712 691/746/691 711/767/711 -f 693/748/693 692/747/692 713/769/713 -f 713/769/713 692/747/692 712/768/712 -f 694/749/694 693/748/693 714/770/714 -f 714/770/714 693/748/693 713/769/713 -f 695/750/695 694/749/694 715/771/715 -f 715/771/715 694/749/694 714/770/714 -f 696/751/696 695/750/695 716/772/716 -f 716/772/716 695/750/695 715/771/715 -f 697/752/697 696/751/696 717/773/717 -f 717/773/717 696/751/696 716/772/716 -f 698/753/698 697/752/697 718/774/718 -f 718/774/718 697/752/697 717/773/717 -f 699/754/699 698/753/698 719/775/719 -f 719/775/719 698/753/698 718/774/718 -f 700/755/700 699/754/699 720/776/720 -f 720/776/720 699/754/699 719/775/719 -f 681/756/682 700/755/700 701/777/702 -f 701/777/702 700/755/700 720/776/720 -f 702/758/701 701/757/702 722/779/721 -f 722/779/721 701/757/702 721/778/722 -f 703/759/703 702/758/701 723/780/723 -f 723/780/723 702/758/701 722/779/721 -f 704/760/704 703/759/703 724/781/724 -f 724/781/724 703/759/703 723/780/723 -f 705/761/705 704/760/704 725/782/725 -f 725/782/725 704/760/704 724/781/724 -f 706/762/706 705/761/705 726/783/726 -f 726/783/726 705/761/705 725/782/725 -f 707/763/707 706/762/706 727/784/727 -f 727/784/727 706/762/706 726/783/726 -f 708/764/708 707/763/707 728/785/728 -f 728/785/728 707/763/707 727/784/727 -f 709/765/709 708/764/708 729/786/729 -f 729/786/729 708/764/708 728/785/728 -f 710/766/710 709/765/709 730/787/730 -f 730/787/730 709/765/709 729/786/729 -f 711/767/711 710/766/710 731/788/731 -f 731/788/731 710/766/710 730/787/730 -f 712/768/712 711/767/711 732/789/732 -f 732/789/732 711/767/711 731/788/731 -f 713/769/713 712/768/712 733/790/733 -f 733/790/733 712/768/712 732/789/732 -f 714/770/714 713/769/713 734/791/734 -f 734/791/734 713/769/713 733/790/733 -f 715/771/715 714/770/714 735/792/735 -f 735/792/735 714/770/714 734/791/734 -f 716/772/716 715/771/715 736/793/736 -f 736/793/736 715/771/715 735/792/735 -f 717/773/717 716/772/716 737/794/737 -f 737/794/737 716/772/716 736/793/736 -f 718/774/718 717/773/717 738/795/738 -f 738/795/738 717/773/717 737/794/737 -f 719/775/719 718/774/718 739/796/739 -f 739/796/739 718/774/718 738/795/738 -f 720/776/720 719/775/719 740/797/740 -f 740/797/740 719/775/719 739/796/739 -f 701/777/702 720/776/720 721/798/722 -f 721/798/722 720/776/720 740/797/740 -f 722/779/721 721/778/722 742/800/741 -f 742/800/741 721/778/722 741/799/742 -f 723/780/723 722/779/721 743/801/743 -f 743/801/743 722/779/721 742/800/741 -f 724/781/724 723/780/723 744/802/744 -f 744/802/744 723/780/723 743/801/743 -f 725/782/725 724/781/724 745/803/745 -f 745/803/745 724/781/724 744/802/744 -f 726/783/726 725/782/725 746/804/746 -f 746/804/746 725/782/725 745/803/745 -f 727/784/727 726/783/726 747/805/747 -f 747/805/747 726/783/726 746/804/746 -f 728/785/728 727/784/727 748/806/748 -f 748/806/748 727/784/727 747/805/747 -f 729/786/729 728/785/728 749/807/749 -f 749/807/749 728/785/728 748/806/748 -f 730/787/730 729/786/729 750/808/750 -f 750/808/750 729/786/729 749/807/749 -f 731/788/731 730/787/730 751/809/751 -f 751/809/751 730/787/730 750/808/750 -f 732/789/732 731/788/731 752/810/752 -f 752/810/752 731/788/731 751/809/751 -f 733/790/733 732/789/732 753/811/753 -f 753/811/753 732/789/732 752/810/752 -f 734/791/734 733/790/733 754/812/754 -f 754/812/754 733/790/733 753/811/753 -f 735/792/735 734/791/734 755/813/755 -f 755/813/755 734/791/734 754/812/754 -f 736/793/736 735/792/735 756/814/756 -f 756/814/756 735/792/735 755/813/755 -f 737/794/737 736/793/736 757/815/757 -f 757/815/757 736/793/736 756/814/756 -f 738/795/738 737/794/737 758/816/758 -f 758/816/758 737/794/737 757/815/757 -f 739/796/739 738/795/738 759/817/759 -f 759/817/759 738/795/738 758/816/758 -f 740/797/740 739/796/739 760/818/760 -f 760/818/760 739/796/739 759/817/759 -f 721/798/722 740/797/740 741/819/742 -f 741/819/742 740/797/740 760/818/760 -f 742/800/741 741/799/742 762/821/761 -f 762/821/761 741/799/742 761/820/762 -f 743/801/743 742/800/741 763/822/763 -f 763/822/763 742/800/741 762/821/761 -f 744/802/744 743/801/743 764/823/764 -f 764/823/764 743/801/743 763/822/763 -f 745/803/745 744/802/744 765/824/765 -f 765/824/765 744/802/744 764/823/764 -f 746/804/746 745/803/745 766/825/766 -f 766/825/766 745/803/745 765/824/765 -f 747/805/747 746/804/746 767/826/767 -f 767/826/767 746/804/746 766/825/766 -f 748/806/748 747/805/747 768/827/768 -f 768/827/768 747/805/747 767/826/767 -f 749/807/749 748/806/748 769/828/769 -f 769/828/769 748/806/748 768/827/768 -f 750/808/750 749/807/749 770/829/770 -f 770/829/770 749/807/749 769/828/769 -f 751/809/751 750/808/750 771/830/771 -f 771/830/771 750/808/750 770/829/770 -f 752/810/752 751/809/751 772/831/772 -f 772/831/772 751/809/751 771/830/771 -f 753/811/753 752/810/752 773/832/773 -f 773/832/773 752/810/752 772/831/772 -f 754/812/754 753/811/753 774/833/774 -f 774/833/774 753/811/753 773/832/773 -f 755/813/755 754/812/754 775/834/775 -f 775/834/775 754/812/754 774/833/774 -f 756/814/756 755/813/755 776/835/776 -f 776/835/776 755/813/755 775/834/775 -f 757/815/757 756/814/756 777/836/777 -f 777/836/777 756/814/756 776/835/776 -f 758/816/758 757/815/757 778/837/778 -f 778/837/778 757/815/757 777/836/777 -f 759/817/759 758/816/758 779/838/779 -f 779/838/779 758/816/758 778/837/778 -f 760/818/760 759/817/759 780/839/780 -f 780/839/780 759/817/759 779/838/779 -f 741/819/742 760/818/760 761/840/762 -f 761/840/762 760/818/760 780/839/780 -f 762/821/761 761/820/762 782/842/781 -f 782/842/781 761/820/762 781/841/782 -f 763/822/763 762/821/761 783/843/783 -f 783/843/783 762/821/761 782/842/781 -f 764/823/764 763/822/763 784/844/784 -f 784/844/784 763/822/763 783/843/783 -f 765/824/765 764/823/764 785/845/785 -f 785/845/785 764/823/764 784/844/784 -f 766/825/766 765/824/765 786/846/786 -f 786/846/786 765/824/765 785/845/785 -f 767/826/767 766/825/766 787/847/787 -f 787/847/787 766/825/766 786/846/786 -f 768/827/768 767/826/767 788/848/788 -f 788/848/788 767/826/767 787/847/787 -f 769/828/769 768/827/768 789/849/789 -f 789/849/789 768/827/768 788/848/788 -f 770/829/770 769/828/769 790/850/790 -f 790/850/790 769/828/769 789/849/789 -f 771/830/771 770/829/770 791/851/791 -f 791/851/791 770/829/770 790/850/790 -f 772/831/772 771/830/771 792/852/792 -f 792/852/792 771/830/771 791/851/791 -f 773/832/773 772/831/772 793/853/793 -f 793/853/793 772/831/772 792/852/792 -f 774/833/774 773/832/773 794/854/794 -f 794/854/794 773/832/773 793/853/793 -f 775/834/775 774/833/774 795/855/795 -f 795/855/795 774/833/774 794/854/794 -f 776/835/776 775/834/775 796/856/796 -f 796/856/796 775/834/775 795/855/795 -f 777/836/777 776/835/776 797/857/797 -f 797/857/797 776/835/776 796/856/796 -f 778/837/778 777/836/777 798/858/798 -f 798/858/798 777/836/777 797/857/797 -f 779/838/779 778/837/778 799/859/799 -f 799/859/799 778/837/778 798/858/798 -f 780/839/780 779/838/779 800/860/800 -f 800/860/800 779/838/779 799/859/799 -f 761/840/762 780/839/780 781/861/782 -f 781/861/782 780/839/780 800/860/800 -f 782/842/781 781/841/782 402/863/401 -f 402/863/401 781/841/782 401/862/402 -f 783/843/783 782/842/781 403/864/405 -f 403/864/405 782/842/781 402/863/401 -f 784/844/784 783/843/783 404/865/407 -f 404/865/407 783/843/783 403/864/405 -f 785/845/785 784/844/784 405/866/409 -f 405/866/409 784/844/784 404/865/407 -f 786/846/786 785/845/785 406/867/411 -f 406/867/411 785/845/785 405/866/409 -f 787/847/787 786/846/786 407/868/413 -f 407/868/413 786/846/786 406/867/411 -f 788/848/788 787/847/787 408/869/415 -f 408/869/415 787/847/787 407/868/413 -f 789/849/789 788/848/788 409/870/417 -f 409/870/417 788/848/788 408/869/415 -f 790/850/790 789/849/789 410/871/419 -f 410/871/419 789/849/789 409/870/417 -f 791/851/791 790/850/790 411/872/421 -f 411/872/421 790/850/790 410/871/419 -f 792/852/792 791/851/791 412/873/423 -f 412/873/423 791/851/791 411/872/421 -f 793/853/793 792/852/792 413/874/425 -f 413/874/425 792/852/792 412/873/423 -f 794/854/794 793/853/793 414/875/427 -f 414/875/427 793/853/793 413/874/425 -f 795/855/795 794/854/794 415/876/429 -f 415/876/429 794/854/794 414/875/427 -f 796/856/796 795/855/795 416/877/431 -f 416/877/431 795/855/795 415/876/429 -f 797/857/797 796/856/796 417/878/433 -f 417/878/433 796/856/796 416/877/431 -f 798/858/798 797/857/797 418/879/435 -f 418/879/435 797/857/797 417/878/433 -f 799/859/799 798/858/798 419/880/437 -f 419/880/437 798/858/798 418/879/435 -f 800/860/800 799/859/799 420/881/439 -f 420/881/439 799/859/799 419/880/437 -f 781/861/782 800/860/800 401/882/402 -f 401/882/402 800/860/800 420/881/439 diff --git a/data/scenes/ArmadilloCollisionScene.json b/data/scenes/ArmadilloCollisionScene.json new file mode 100644 index 00000000..5d765aa3 --- /dev/null +++ b/data/scenes/ArmadilloCollisionScene.json @@ -0,0 +1,129 @@ +{ + "Name": "DeformableSolidCollisionScene1", + "Simulation": + { + "timeStepSize": 0.01, + "numberOfStepsPerRenderUpdate": 4, + "subSteps": 5, + "maxIterations" : 1, + "maxIterationsV" : 5, + "velocityUpdateMethod" : 0, + "contactTolerance": 0.0, + "tetModelSimulationMethod": 2, + "clothSimulationMethod": 2, + "clothBendingMethod": 2, + "contactStiffnessRigidBody" : 1.0, + "contactStiffnessParticleRigidBody": 100.0, + "cloth_stiffness": 1.0, + "cloth_bendingStiffness": 0.005, + "cloth_xxStiffness": 1.0, + "cloth_yyStiffness": 1.0, + "cloth_xyStiffness": 1.0, + "cloth_xyPoissonRatio": 0.3, + "cloth_yxPoissonRatio": 0.3, + "cloth_normalizeStretch": 0, + "cloth_normalizeShear": 0, + "solid_stiffness": 1.0, + "solid_poissonRatio": 0.2, + "solid_normalizeStretch": 0, + "solid_normalizeShear": 0 + }, + "cameraLookat": [ + 0, + 0, + 0 + ], + "cameraPosition": [ + 0, + 10, + 30 + ], + "TetModels": [ + { + "id": 0, + "nodeFile": "../models/armadillo_4k.node", + "eleFile": "../models/armadillo_4k.ele", + "visFile": "../models/armadillo.obj", + "resolutionSDF": [20,20,20], + "translation": [0,10,0], + "rotationAxis": [0, 1, 0], + "rotationAngle": 1.57, + "scale": [2,2,2], + "staticParticles": [], + "restitution" : 0.1, + "friction" : 0.3, + "collisionObjectType": 5, + "collisionObjectFileName": "", + "collisionObjectScale": [ + 2, + 2, + 2 + ], + "testMesh": 1 + }, + { + "id": 1, + "nodeFile": "../models/armadillo_4k.node", + "eleFile": "../models/armadillo_4k.ele", + "visFile": "../models/armadillo.obj", + "resolutionSDF": [20,20,20], + "translation": [0,4,0], + "rotationAxis": [0, 0, 1], + "rotationAngle": 0.1, + "scale": [2,2,2], + "staticParticles": [], + "restitution" : 0.0, + "friction" : 0.3, + "collisionObjectType": 5, + "collisionObjectFileName": "", + "collisionObjectScale": [ + 2, + 2, + 2 + ], + "testMesh": 1 + }, + { + "id": 1, + "nodeFile": "../models/armadillo_4k.node", + "eleFile": "../models/armadillo_4k.ele", + "visFile": "../models/armadillo.obj", + "resolutionSDF": [20,20,20], + "translation": [0,18,0], + "rotationAxis": [0, 0, 1], + "rotationAngle": 0.5, + "scale": [2,2,2], + "staticParticles": [], + "restitution" : 0.0, + "friction" : 0.3, + "collisionObjectType": 5, + "collisionObjectFileName": "", + "collisionObjectScale": [ + 2, + 2, + 2 + ], + "testMesh": 1 + } + ], + "RigidBodies": [ + { + "id": 2, + "geometryFile": "../models/cube.obj", + "flatShading": true, + "isDynamic": 0, + "density": 500, + "translation": [0,0,0], + "rotationAxis": [1, 0, 0], + "rotationAngle": 0.0, + "scale": [100, 1, 100], + "restitution" : 0.6, + "friction" : 0.0, + "comment": "collisionObjectType = 1: Sphere, 2: Box, 3: Cylinder, 4: Torus, 5: SDF, 6: HollowSphere, 7: HollowBox", + "collisionObjectType": 2, + "collisionObjectScale": [100, 1, 100] + } + ] +} + + diff --git a/data/scenes/CarScene.json b/data/scenes/CarScene.json new file mode 100644 index 00000000..af5eaa5b --- /dev/null +++ b/data/scenes/CarScene.json @@ -0,0 +1,662 @@ +{ + "BallJoints": [], + "BallOnLineJoints": [], + "DamperJoints": [ + { + "axis": [ + 0, + 1, + 0 + ], + "bodyID1": 2, + "bodyID2": 3, + "stiffness": 500000.0 + }, + { + "axis": [ + 0, + 1, + 0 + ], + "bodyID1": 2, + "bodyID2": 4, + "stiffness": 500000.0 + }, + { + "axis": [ + 0, + 1, + 0 + ], + "bodyID1": 7, + "bodyID2": 5, + "stiffness": 500000.0 + }, + { + "axis": [ + 0, + 1, + 0 + ], + "bodyID1": 7, + "bodyID2": 6, + "stiffness": 500000.0 + } + ], + "DistanceJoints": [], + "HingeJoints": [], + "Name": "CarScene", + "RigidBodies": [ + { + "angularVelocity": [ + 0, + 0, + 0 + ], + "collisionObjectFileName": "", + "collisionObjectScale": [ + 1000, + 1, + 1000 + ], + "collisionObjectType": 2, + "density": 500, + "flatShading": true, + "friction": 0.3, + "geometryFile": "../models/cube.obj", + "id": 1, + "isDynamic": 0, + "restitution": 0.5, + "rotationAngle": 0.0, + "rotationAxis": [ + 1, + 0, + 0 + ], + "scale": [ + 1000, + 1, + 1000 + ], + "testMesh": 1, + "translation": [ + 0, + -0.5, + 0 + ], + "velocity": [ + 0, + 0, + 0 + ] + }, + { + "angularVelocity": [ + 0, + 0, + 0 + ], + "collisionObjectFileName": "", + "collisionObjectScale": [ + 2.5, + 0.4, + 1 + ], + "collisionObjectType": 0, + "density": 200, + "flatShading": true, + "friction": 0.0, + "geometryFile": "../models/cube.obj", + "id": 2, + "isDynamic": 1, + "restitution": 0.6, + "rotationAngle": 0.0, + "rotationAxis": [ + 1, + 0, + 0 + ], + "scale": [ + 2.5, + 0.4, + 1 + ], + "testMesh": 1, + "translation": [ + 0, + 1.9, + 0.1 + ], + "velocity": [ + 0, + 0, + 0 + ] + }, + { + "angularVelocity": [ + 0, + 0, + 0 + ], + "collisionObjectFileName": "", + "collisionObjectScale": [ + 0.2, + 0.1, + 0.2 + ], + "collisionObjectType": 0, + "density": 50000, + "flatShading": true, + "friction": 0.3, + "geometryFile": "../models/cube.obj", + "id": 3, + "isDynamic": 1, + "restitution": 0.6, + "rotationAngle": 0.0, + "rotationAxis": [ + 1, + 0, + 0 + ], + "scale": [ + 0.2, + 0.1, + 0.2 + ], + "testMesh": 1, + "translation": [ + 1.75, + 1.3, + 0.5 + ], + "velocity": [ + 0, + 0, + 0 + ] + }, + { + "angularVelocity": [ + 0, + 0, + 0 + ], + "collisionObjectFileName": "", + "collisionObjectScale": [ + 0.2, + 0.1, + 0.2 + ], + "collisionObjectType": 0, + "density": 50000, + "flatShading": true, + "friction": 0.3, + "geometryFile": "../models/cube.obj", + "id": 4, + "isDynamic": 1, + "restitution": 0.6, + "rotationAngle": 0.0, + "rotationAxis": [ + 1, + 0, + 0 + ], + "scale": [ + 0.2, + 0.1, + 0.2 + ], + "testMesh": 1, + "translation": [ + 1.75, + 1.3, + -0.5 + ], + "velocity": [ + 0, + 0, + 0 + ] + }, + { + "angularVelocity": [ + 0, + 0, + 0 + ], + "collisionObjectFileName": "", + "collisionObjectScale": [ + 0.2, + 0.1, + 0.2 + ], + "collisionObjectType": 0, + "density": 50000, + "flatShading": true, + "friction": 0.3, + "geometryFile": "../models/cube.obj", + "id": 5, + "isDynamic": 1, + "restitution": 0.6, + "rotationAngle": 0.0, + "rotationAxis": [ + 1, + 0, + 0 + ], + "scale": [ + 0.2, + 0.1, + 0.2 + ], + "testMesh": 1, + "translation": [ + -1.75, + 1.3, + 0.5 + ], + "velocity": [ + 0, + 0, + 0 + ] + }, + { + "angularVelocity": [ + 0, + 0, + 0 + ], + "collisionObjectFileName": "", + "collisionObjectScale": [ + 0.2, + 0.1, + 0.2 + ], + "collisionObjectType": 0, + "density": 50000, + "flatShading": true, + "friction": 0.3, + "geometryFile": "../models/cube.obj", + "id": 6, + "isDynamic": 1, + "restitution": 0.6, + "rotationAngle": 0.0, + "rotationAxis": [ + 1, + 0, + 0 + ], + "scale": [ + 0.2, + 0.1, + 0.2 + ], + "testMesh": 1, + "translation": [ + -1.75, + 1.3, + -0.5 + ], + "velocity": [ + 0, + 0, + 0 + ] + }, + { + "angularVelocity": [ + 0, + 0, + 0 + ], + "collisionObjectFileName": "", + "collisionObjectScale": [ + 0.2, + 0.1, + 1 + ], + "collisionObjectType": 0, + "density": 10000, + "flatShading": true, + "friction": 0.3, + "geometryFile": "../models/cube.obj", + "id": 7, + "isDynamic": 1, + "restitution": 0.6, + "rotationAngle": 0.0, + "rotationAxis": [ + 1, + 0, + 0 + ], + "scale": [ + 0.2, + 0.1, + 1 + ], + "testMesh": 1, + "translation": [ + -1.75, + 1.85, + 0 + ], + "velocity": [ + 0, + 0, + 0 + ] + }, + { + "angularVelocity": [ + 0, + 0, + 0 + ], + "collisionObjectFileName": "", + "collisionObjectScale": [ + 0.3, + 0.3, + 0.3 + ], + "collisionObjectType": 1, + "density": 600, + "flatShading": false, + "friction": 0.4, + "geometryFile": "../models/sphere.obj", + "id": 8, + "isDynamic": 1, + "restitution": 0.6, + "rotationAngle": 0.0, + "rotationAxis": [ + 1, + 0, + 0 + ], + "scale": [ + 0.3, + 0.3, + 0.3 + ], + "testMesh": 1, + "translation": [ + 1.75, + 1.3, + 0.9 + ], + "velocity": [ + 0, + 0, + 0 + ] + }, + { + "angularVelocity": [ + 0, + 0, + 0 + ], + "collisionObjectFileName": "", + "collisionObjectScale": [ + 0.3, + 0.3, + 0.3 + ], + "collisionObjectType": 1, + "density": 600, + "flatShading": false, + "friction": 0.4, + "geometryFile": "../models/sphere.obj", + "id": 9, + "isDynamic": 1, + "restitution": 0.6, + "rotationAngle": 0.0, + "rotationAxis": [ + 1, + 0, + 0 + ], + "scale": [ + 0.3, + 0.3, + 0.3 + ], + "testMesh": 1, + "translation": [ + 1.75, + 1.3, + -0.9 + ], + "velocity": [ + 0, + 0, + 0 + ] + }, + { + "angularVelocity": [ + 0, + 0, + 0 + ], + "collisionObjectFileName": "", + "collisionObjectScale": [ + 0.3, + 0.3, + 0.3 + ], + "collisionObjectType": 1, + "density": 600, + "flatShading": false, + "friction": 0.4, + "geometryFile": "../models/sphere.obj", + "id": 10, + "isDynamic": 1, + "restitution": 0.6, + "rotationAngle": 0.0, + "rotationAxis": [ + 1, + 0, + 0 + ], + "scale": [ + 0.3, + 0.3, + 0.3 + ], + "testMesh": 1, + "translation": [ + -1.75, + 1.3, + 0.9 + ], + "velocity": [ + 0, + 0, + 0 + ] + }, + { + "angularVelocity": [ + 0, + 0, + 0 + ], + "collisionObjectFileName": "", + "collisionObjectScale": [ + 0.3, + 0.3, + 0.3 + ], + "collisionObjectType": 1, + "density": 600, + "flatShading": false, + "friction": 0.4, + "geometryFile": "../models/sphere.obj", + "id": 11, + "isDynamic": 1, + "restitution": 0.6, + "rotationAngle": 0.0, + "rotationAxis": [ + 1, + 0, + 0 + ], + "scale": [ + 0.3, + 0.3, + 0.3 + ], + "testMesh": 1, + "translation": [ + -1.75, + 1.3, + -0.9 + ], + "velocity": [ + 0, + 0, + 0 + ] + } + ], + "RigidBodyParticleBallJoints": [], + "RigidBodySprings": [], + "Simulation": { + "cloth_bendingStiffness": 0.005, + "cloth_normalizeShear": 0, + "cloth_normalizeStretch": 0, + "cloth_stiffness": 1.0, + "cloth_xxStiffness": 1.0, + "cloth_xyPoissonRatio": 0.3, + "cloth_xyStiffness": 1.0, + "cloth_yxPoissonRatio": 0.3, + "cloth_yyStiffness": 1.0, + "contactStiffnessParticleRigidBody": 100.0, + "contactStiffnessRigidBody": 1.0, + "contactTolerance": 0.01, + "gravity": [ + 0, + -2, + 0 + ], + "maxIterations": 1, + "maxIterationsV": 5, + "numberOfStepsPerRenderUpdate": 10, + "subSteps": 5, + "timeStepSize": 0.005, + "clothBendingMethod": 2, + "clothSimulationMethod": 2, + "velocityUpdateMethod": 0 + }, + "SliderJoints": [], + "TargetAngleMotorHingeJoints": [ + { + "axis": [ + 0, + 1, + 0 + ], + "bodyID1": 2, + "bodyID2": 7, + "position": [ + -1.75, + 1.6, + 0 + ], + "repeatSequence": 1, + "targetSequence": [ + 0, + 0, + 2, + 0.707, + 8, + 0.707, + 12, + -0.707, + 18, + -0.707, + 20, + 0 + ] + } + ], + "TargetPositionMotorSliderJoints": [], + "TargetVelocityMotorHingeJoints": [ + { + "axis": [ + 0, + 0, + 1 + ], + "bodyID1": 3, + "bodyID2": 8, + "position": [ + 1.75, + 1.3, + 0.7 + ], + "target": 10.0 + }, + { + "axis": [ + 0, + 0, + 1 + ], + "bodyID1": 4, + "bodyID2": 9, + "position": [ + 1.75, + 1.3, + -0.7 + ], + "target": 10.0 + }, + { + "axis": [ + 0, + 0, + 1 + ], + "bodyID1": 5, + "bodyID2": 10, + "position": [ + -1.75, + 1.3, + 0.7 + ], + "target": 10.0 + }, + { + "axis": [ + 0, + 0, + 1 + ], + "bodyID1": 6, + "bodyID2": 11, + "position": [ + -1.75, + 1.3, + -0.7 + ], + "target": 10.0 + } + ], + "TargetVelocityMotorSliderJoints": [], + "TetModels": [], + "TriangleModels": [], + "UniversalJoints": [], + "cameraLookat": [ + 0, + 0, + 0 + ], + "cameraPosition": [ + 1, + 5, + 20 + ] +} \ No newline at end of file diff --git a/data/scenes/CarScene.py b/data/scenes/CarScene.py new file mode 100644 index 00000000..38926678 --- /dev/null +++ b/data/scenes/CarScene.py @@ -0,0 +1,101 @@ +from SceneGenerator import * +import math +import random + +def scale(vec, s): + vec[0] *= s + vec[1] *= s + vec[2] *= s + return vec + +s = 1 + +scene = generateScene('CarScene', camPosition=[1,5,20], camLookat=[0,0,0]) +addParameters(scene, h=0.005, maxIter=1, maxIterVel=5, subSteps=5, contactTolerance=0.01, gravity=[0,-2,0], numberOfStepsPerRenderUpdate=10) + +# floor +floorScale=[1000, 1, 1000] +floorScale = scale(floorScale, s) +floorT = [0,-0.5,0] +floorT = scale(floorT, s) +addRigidBody(scene, '../models/cube.obj', 2, coScale=floorScale, + scale=floorScale, translation=floorT, + dynamic=0, rest= 0.5, flatShading=True) + +carX = [0,2,0] + +# chassis +restitution = 0.6 +frict = 0.4 +chassisX = add_vector(carX, [0,-0.1,0.1]) +chassisScale = [2.5,0.4,1] +chassisScale = scale(chassisScale, s) +chassis = addRigidBody(scene, '../models/cube.obj', 0, coScale=chassisScale, scale=chassisScale, + translation=chassisX, dynamic=1, rest=restitution, friction=0.0, density = 200, flatShading=True) + +# damper bodies +damperScale = [0.2,0.1,0.2] +damperScale = scale(damperScale, s) +damperDensity = 50000; +damperX1 = add_vector(carX, [1.75, -0.7, 0.5]) +dBody1 = addRigidBody(scene, '../models/cube.obj', 0, coScale=damperScale, scale=damperScale, + translation=damperX1, dynamic=1, rest=restitution, density = damperDensity, flatShading=True) + +damperX2 = add_vector(carX, [1.75, -0.7, -0.5]) +dBody2 = addRigidBody(scene, '../models/cube.obj', 0, coScale=damperScale, scale=damperScale, + translation=damperX2, dynamic=1, rest=restitution, density = damperDensity, flatShading=True) + +damperX3 = add_vector(carX, [-1.75, -0.7, 0.5]) +dBody3 = addRigidBody(scene, '../models/cube.obj', 0, coScale=damperScale, scale=damperScale, + translation=damperX3, dynamic=1, rest=restitution, density = damperDensity, flatShading=True) + +damperX4 = add_vector(carX, [-1.75, -0.7, -0.5]) +dBody4 = addRigidBody(scene, '../models/cube.obj', 0, coScale=damperScale, scale=damperScale, + translation=damperX4, dynamic=1, rest=restitution, density = damperDensity, flatShading=True) + +# steering +steeringBodyX = add_vector(carX, [-1.75, -0.15, 0]) +steeringBodyScale = [0.2,0.1,1] +steeringBodyScale = scale(steeringBodyScale, s) +steeringBody = addRigidBody(scene, '../models/cube.obj', 0, coScale=steeringBodyScale, scale=steeringBodyScale, + translation=steeringBodyX, dynamic=1, rest=restitution, density = 10000, flatShading=True) + +steeringMotorX = add_vector(carX, [-1.75, -0.4, 0]) +addTargetAngleMotorHingeJoint(scene, chassis, steeringBody, steeringMotorX, [0, 1, 0], 0.707, [0,0, 2, 0.707, 8, 0.707, 12, -0.707, 18, -0.707, 20, 0], 1) + + +# wheels +wheelScale = [0.3,0.3,0.3] +wheelScale = scale(wheelScale, s) +wheelDensity = 600 +wheelX1 = add_vector(carX, [1.75, -0.7, 0.9]) +wheel1 = addRigidBody(scene, '../models/sphere.obj', 1, coScale=wheelScale, scale=wheelScale, + translation=wheelX1, dynamic=1, rest=restitution, friction=frict, density=wheelDensity) + +wheelX2 = add_vector(carX, [1.75, -0.7, -0.9]) +wheel2 = addRigidBody(scene, '../models/sphere.obj', 1, coScale=wheelScale, scale=wheelScale, + translation=wheelX2, dynamic=1, rest=restitution, friction=frict, density=wheelDensity) + +wheelX3 = add_vector(carX, [-1.75, -0.7, 0.9]) +wheel3 = addRigidBody(scene, '../models/sphere.obj', 1, coScale=wheelScale, scale=wheelScale, + translation=wheelX3, dynamic=1, rest=restitution, friction=frict, density=wheelDensity) + +wheelX4 = add_vector(carX, [-1.75, -0.7, -0.9]) +wheel4 = addRigidBody(scene, '../models/sphere.obj', 1, coScale=wheelScale, scale=wheelScale, + translation=wheelX4, dynamic=1, rest=restitution, friction=frict, density=wheelDensity) + +motorX1 = add_vector(carX, [1.75, -0.7, 0.7]) +motorX2 = add_vector(carX, [1.75, -0.7, -0.7]) +motorX3 = add_vector(carX, [-1.75, -0.7, 0.7]) +motorX4 = add_vector(carX, [-1.75, -0.7, -0.7]) +addTargetVelocityMotorHingeJoint(scene, dBody1, wheel1, motorX1, [0, 0, 1], 10.0) +addTargetVelocityMotorHingeJoint(scene, dBody2, wheel2, motorX2, [0, 0, 1], 10.0) +addTargetVelocityMotorHingeJoint(scene, dBody3, wheel3, motorX3, [0, 0, 1], 10.0) +addTargetVelocityMotorHingeJoint(scene, dBody4, wheel4, motorX4, [0, 0, 1], 10.0) + +addDamperJoint(scene, chassis, dBody1, [0, 1, 0], 500000.0) +addDamperJoint(scene, chassis, dBody2, [0, 1, 0], 500000.0) +addDamperJoint(scene, steeringBody, dBody3, [0, 1, 0], 500000.0) +addDamperJoint(scene, steeringBody, dBody4, [0, 1, 0], 500000.0) + +writeScene(scene, 'CarScene.json') diff --git a/data/scenes/ClothCollisionScene.json b/data/scenes/ClothCollisionScene.json index 51b45c1c..c72f575d 100644 --- a/data/scenes/ClothCollisionScene.json +++ b/data/scenes/ClothCollisionScene.json @@ -2,17 +2,18 @@ "Name": "ClothCollisionScene1", "Simulation": { - "timeStepSize": 0.0025, - "maxIter" : 5, + "timeStepSize": 0.005, + "maxIterations" : 1, + "subSteps": 2, "maxIterVel" : 5, "velocityUpdateMethod" : 0, "contactTolerance": 0.05, - "triangleModelSimulationMethod": 2, - "triangleModelBendingMethod": 2, + "clothSimulationMethod": 2, + "clothBendingMethod": 2, "contactStiffnessRigidBody" : 1.0, "contactStiffnessParticleRigidBody": 100.0, "cloth_stiffness": 1.0, - "cloth_bendingStiffness": 0.005, + "cloth_bendingStiffness": 0.01, "cloth_xxStiffness": 1.0, "cloth_yyStiffness": 1.0, "cloth_xyStiffness": 1.0, @@ -38,6 +39,7 @@ { "id": 1, "geometryFile": "../models/cube.obj", + "flatShading": true, "isDynamic": 0, "density": 500, "translation": [0,0,0], @@ -46,6 +48,7 @@ "scale": [100, 1, 100], "restitution" : 0.6, "friction" : 0.0, + "comment": "collisionObjectType = 1: Sphere, 2: Box, 3: Cylinder, 4: Torus, 5: SDF, 6: HollowSphere, 7: HollowBox", "collisionObjectType": 2, "collisionObjectScale": [100, 1, 100] }, @@ -61,6 +64,7 @@ "velocity": [0,0,0], "restitution" : 0.6, "friction" : 0.2, + "comment": "collisionObjectType = 1: Sphere, 2: Box, 3: Cylinder, 4: Torus, 5: SDF, 6: HollowSphere, 7: HollowBox", "collisionObjectType": 1, "collisionObjectScale": [1.5, 1.5, 1.5] }, @@ -76,6 +80,7 @@ "angularVelocity": [1,0,0], "restitution" : 0.6, "friction" : 0.2, + "comment": "collisionObjectType = 1: Sphere, 2: Box, 3: Cylinder, 4: Torus, 5: SDF, 6: HollowSphere, 7: HollowBox", "collisionObjectType": 3, "collisionObjectScale": [0.25, 3, 0.25] }, @@ -90,6 +95,7 @@ "scale": [1.5, 1.5, 1.5], "restitution" : 0.6, "friction" : 0.2, + "comment": "collisionObjectType = 1: Sphere, 2: Box, 3: Cylinder, 4: Torus, 5: SDF, 6: HollowSphere, 7: HollowBox", "collisionObjectType": 4, "collisionObjectScale": [1.5, 0.75, 1.5] } diff --git a/data/scenes/ClothOnBunny.json b/data/scenes/ClothOnBunny.json new file mode 100644 index 00000000..dc28064a --- /dev/null +++ b/data/scenes/ClothOnBunny.json @@ -0,0 +1,76 @@ +{ + "Name": "ClothCollisionScene1", + "Simulation": + { + "timeStepSize": 0.005, + "maxIterations" : 1, + "subSteps": 2, + "maxIterVel" : 5, + "velocityUpdateMethod" : 0, + "contactTolerance": 0.1, + "triangleModelSimulationMethod": 2, + "triangleModelBendingMethod": 2, + "contactStiffnessRigidBody" : 1.0, + "contactStiffnessParticleRigidBody": 100.0, + "cloth_stiffness": 1.0, + "cloth_bendingStiffness": 0.1, + "cloth_xxStiffness": 1.0, + "cloth_yyStiffness": 1.0, + "cloth_xyStiffness": 1.0, + "cloth_xyPoissonRatio": 0.3, + "cloth_yxPoissonRatio": 0.3, + "cloth_normalizeStretch": 0, + "cloth_normalizeShear": 0 + }, + "TriangleModels": [ + { + "id": 0, + "geometryFile": "../models/plane_50x50.obj", + "translation": [5,8,0], + "rotationAxis": [1, 0, 0], + "rotationAngle": 0.0, + "scale": [10, 10, 10], + "restitution" : 0.1, + "friction" : 0.1 + } + ], + "RigidBodies": [ + { + "id": 1, + "geometryFile": "../models/cube.obj", + "flatShading": true, + "isDynamic": 0, + "density": 500, + "translation": [0,0,0], + "rotationAxis": [1, 0, 0], + "rotationAngle": 0.0, + "scale": [100, 1, 100], + "restitution" : 0.6, + "friction" : 0.0, + "comment": "collisionObjectType = 1: Sphere, 2: Box, 3: Cylinder, 4: Torus, 5: SDF, 6: HollowSphere, 7: HollowBox", + "collisionObjectType": 2, + "collisionObjectScale": [100, 1, 100] + }, + { + "id": 2, + "geometryFile": "../models/bunny_10k.obj", + "comment": "collisionObjectFileName can contain the path of an SDF file or if it is empty, the simulator will generate an SDF using the mesh in the geometryFile", + "collisionObjectFileName": "", + "resolutionSDF": [40,40,40], + "isDynamic": 1, + "density": 500, + "translation": [5,1,0], + "rotationAxis": [1, 0, 0], + "rotationAngle": 0.0, + "scale": [4, 4, 4], + "velocity": [0,0,0], + "restitution" : 0.6, + "friction" : 0.2, + "comment": "collisionObjectType = 1: Sphere, 2: Box, 3: Cylinder, 4: Torus, 5: SDF, 6: HollowSphere, 7: HollowBox", + "collisionObjectType": 5, + "collisionObjectScale": [4, 4, 4] + } + ] +} + + diff --git a/data/scenes/DeformableSolidCollisionScene.json b/data/scenes/DeformableSolidCollisionScene.json index 422ae205..1bafd18d 100644 --- a/data/scenes/DeformableSolidCollisionScene.json +++ b/data/scenes/DeformableSolidCollisionScene.json @@ -8,8 +8,8 @@ "velocityUpdateMethod" : 0, "contactTolerance": 0.05, "tetModelSimulationMethod": 2, - "triangleModelSimulationMethod": 2, - "triangleModelBendingMethod": 2, + "clothSimulationMethod": 2, + "clothBendingMethod": 2, "contactStiffnessRigidBody" : 1.0, "contactStiffnessParticleRigidBody": 100.0, "cloth_stiffness": 1.0, @@ -48,13 +48,22 @@ "scale": [2, 2, 2], "staticParticles": [], "restitution" : 0.1, - "friction" : 0.1 + "friction" : 0.1, + "collisionObjectType": 5, + "collisionObjectFileName": "", + "collisionObjectScale": [ + 1, + 1, + 1 + ], + "testMesh": 1 } ], "RigidBodies": [ { "id": 1, "geometryFile": "../models/cube.obj", + "flatShading": true, "isDynamic": 0, "density": 500, "translation": [0,0,0], @@ -63,6 +72,7 @@ "scale": [100, 1, 100], "restitution" : 0.6, "friction" : 0.0, + "comment": "collisionObjectType = 1: Sphere, 2: Box, 3: Cylinder, 4: Torus, 5: SDF, 6: HollowSphere, 7: HollowBox", "collisionObjectType": 2, "collisionObjectScale": [100, 1, 100] }, @@ -78,6 +88,7 @@ "velocity": [0,0,0], "restitution" : 0.6, "friction" : 0.2, + "comment": "collisionObjectType = 1: Sphere, 2: Box, 3: Cylinder, 4: Torus, 5: SDF, 6: HollowSphere, 7: HollowBox", "collisionObjectType": 1, "collisionObjectScale": [1.5, 1.5, 1.5] }, @@ -93,6 +104,7 @@ "angularVelocity": [1,0,0], "restitution" : 0.6, "friction" : 0.2, + "comment": "collisionObjectType = 1: Sphere, 2: Box, 3: Cylinder, 4: Torus, 5: SDF, 6: HollowSphere, 7: HollowBox", "collisionObjectType": 3, "collisionObjectScale": [0.5, 3, 0.5] }, @@ -107,6 +119,7 @@ "scale": [2.5, 2.5, 2.5], "restitution" : 0.6, "friction" : 0.2, + "comment": "collisionObjectType = 1: Sphere, 2: Box, 3: Cylinder, 4: Torus, 5: SDF, 6: HollowSphere, 7: HollowBox", "collisionObjectType": 4, "collisionObjectScale": [2.5, 1.25, 2.5] } diff --git a/data/scenes/PileScene.json b/data/scenes/PileScene.json new file mode 100644 index 00000000..abf62886 --- /dev/null +++ b/data/scenes/PileScene.json @@ -0,0 +1,1481 @@ +{ + "BallJoints": [], + "BallOnLineJoints": [], + "HingeJoints": [], + "Name": "PileScene", + "RigidBodies": [ + { + "angularVelocity": [ + 0, + 0, + 0 + ], + "collisionObjectFileName": "", + "collisionObjectScale": [ + 500, + 1, + 500 + ], + "collisionObjectType": 2, + "density": 500, + "friction": 0.3, + "geometryFile": "../models/cube.obj", + "flatShading": true, + "id": 1, + "isDynamic": 0, + "restitution": 0.5, + "rotationAngle": 0.0, + "rotationAxis": [ + 1, + 0, + 0 + ], + "scale": [ + 500, + 1, + 500 + ], + "testMesh": 1, + "translation": [ + 0, + -0.5, + 0 + ], + "velocity": [ + 0, + 0, + 0 + ] + }, + { + "angularVelocity": [ + 0, + 0, + 0 + ], + "collisionObjectFileName": "", + "collisionObjectScale": [ + 0.25, + 10, + 0.25 + ], + "collisionObjectType": 3, + "density": 500, + "friction": 0.3, + "geometryFile": "../models/cylinder.obj", + "id": 2, + "isDynamic": 0, + "restitution": 0.6, + "rotationAngle": 0.0, + "rotationAxis": [ + 1, + 0, + 0 + ], + "scale": [ + 0.25, + 10, + 0.25 + ], + "testMesh": 1, + "translation": [ + -10.0, + 5.0, + -10.0 + ], + "velocity": [ + 0, + 0, + 0 + ] + }, + { + "angularVelocity": [ + 0, + 0, + 0 + ], + "collisionObjectFileName": "", + "collisionObjectScale": [ + 0.25, + 10, + 0.25 + ], + "collisionObjectType": 3, + "density": 500, + "friction": 0.3, + "geometryFile": "../models/cylinder.obj", + "id": 3, + "isDynamic": 0, + "restitution": 0.6, + "rotationAngle": 0.0, + "rotationAxis": [ + 1, + 0, + 0 + ], + "scale": [ + 0.25, + 10, + 0.25 + ], + "testMesh": 1, + "translation": [ + -5.0, + 5.0, + -10.0 + ], + "velocity": [ + 0, + 0, + 0 + ] + }, + { + "angularVelocity": [ + 0, + 0, + 0 + ], + "collisionObjectFileName": "", + "collisionObjectScale": [ + 0.25, + 10, + 0.25 + ], + "collisionObjectType": 3, + "density": 500, + "friction": 0.3, + "geometryFile": "../models/cylinder.obj", + "id": 4, + "isDynamic": 0, + "restitution": 0.6, + "rotationAngle": 0.0, + "rotationAxis": [ + 1, + 0, + 0 + ], + "scale": [ + 0.25, + 10, + 0.25 + ], + "testMesh": 1, + "translation": [ + 0.0, + 5.0, + -10.0 + ], + "velocity": [ + 0, + 0, + 0 + ] + }, + { + "angularVelocity": [ + 0, + 0, + 0 + ], + "collisionObjectFileName": "", + "collisionObjectScale": [ + 0.25, + 10, + 0.25 + ], + "collisionObjectType": 3, + "density": 500, + "friction": 0.3, + "geometryFile": "../models/cylinder.obj", + "id": 5, + "isDynamic": 0, + "restitution": 0.6, + "rotationAngle": 0.0, + "rotationAxis": [ + 1, + 0, + 0 + ], + "scale": [ + 0.25, + 10, + 0.25 + ], + "testMesh": 1, + "translation": [ + 5.0, + 5.0, + -10.0 + ], + "velocity": [ + 0, + 0, + 0 + ] + }, + { + "angularVelocity": [ + 0, + 0, + 0 + ], + "collisionObjectFileName": "", + "collisionObjectScale": [ + 0.25, + 10, + 0.25 + ], + "collisionObjectType": 3, + "density": 500, + "friction": 0.3, + "geometryFile": "../models/cylinder.obj", + "id": 6, + "isDynamic": 0, + "restitution": 0.6, + "rotationAngle": 0.0, + "rotationAxis": [ + 1, + 0, + 0 + ], + "scale": [ + 0.25, + 10, + 0.25 + ], + "testMesh": 1, + "translation": [ + 10.0, + 5.0, + -10.0 + ], + "velocity": [ + 0, + 0, + 0 + ] + }, + { + "angularVelocity": [ + 0, + 0, + 0 + ], + "collisionObjectFileName": "", + "collisionObjectScale": [ + 0.25, + 10, + 0.25 + ], + "collisionObjectType": 3, + "density": 500, + "friction": 0.3, + "geometryFile": "../models/cylinder.obj", + "id": 7, + "isDynamic": 0, + "restitution": 0.6, + "rotationAngle": 0.0, + "rotationAxis": [ + 1, + 0, + 0 + ], + "scale": [ + 0.25, + 10, + 0.25 + ], + "testMesh": 1, + "translation": [ + -10.0, + 5.0, + -5.0 + ], + "velocity": [ + 0, + 0, + 0 + ] + }, + { + "angularVelocity": [ + 0, + 0, + 0 + ], + "collisionObjectFileName": "", + "collisionObjectScale": [ + 0.25, + 10, + 0.25 + ], + "collisionObjectType": 3, + "density": 500, + "friction": 0.3, + "geometryFile": "../models/cylinder.obj", + "id": 8, + "isDynamic": 0, + "restitution": 0.6, + "rotationAngle": 0.0, + "rotationAxis": [ + 1, + 0, + 0 + ], + "scale": [ + 0.25, + 10, + 0.25 + ], + "testMesh": 1, + "translation": [ + -5.0, + 5.0, + -5.0 + ], + "velocity": [ + 0, + 0, + 0 + ] + }, + { + "angularVelocity": [ + 0, + 0, + 0 + ], + "collisionObjectFileName": "", + "collisionObjectScale": [ + 0.25, + 10, + 0.25 + ], + "collisionObjectType": 3, + "density": 500, + "friction": 0.3, + "geometryFile": "../models/cylinder.obj", + "id": 9, + "isDynamic": 0, + "restitution": 0.6, + "rotationAngle": 0.0, + "rotationAxis": [ + 1, + 0, + 0 + ], + "scale": [ + 0.25, + 10, + 0.25 + ], + "testMesh": 1, + "translation": [ + 0.0, + 5.0, + -5.0 + ], + "velocity": [ + 0, + 0, + 0 + ] + }, + { + "angularVelocity": [ + 0, + 0, + 0 + ], + "collisionObjectFileName": "", + "collisionObjectScale": [ + 0.25, + 10, + 0.25 + ], + "collisionObjectType": 3, + "density": 500, + "friction": 0.3, + "geometryFile": "../models/cylinder.obj", + "id": 10, + "isDynamic": 0, + "restitution": 0.6, + "rotationAngle": 0.0, + "rotationAxis": [ + 1, + 0, + 0 + ], + "scale": [ + 0.25, + 10, + 0.25 + ], + "testMesh": 1, + "translation": [ + 5.0, + 5.0, + -5.0 + ], + "velocity": [ + 0, + 0, + 0 + ] + }, + { + "angularVelocity": [ + 0, + 0, + 0 + ], + "collisionObjectFileName": "", + "collisionObjectScale": [ + 0.25, + 10, + 0.25 + ], + "collisionObjectType": 3, + "density": 500, + "friction": 0.3, + "geometryFile": "../models/cylinder.obj", + "id": 11, + "isDynamic": 0, + "restitution": 0.6, + "rotationAngle": 0.0, + "rotationAxis": [ + 1, + 0, + 0 + ], + "scale": [ + 0.25, + 10, + 0.25 + ], + "testMesh": 1, + "translation": [ + 10.0, + 5.0, + -5.0 + ], + "velocity": [ + 0, + 0, + 0 + ] + }, + { + "angularVelocity": [ + 0, + 0, + 0 + ], + "collisionObjectFileName": "", + "collisionObjectScale": [ + 0.25, + 10, + 0.25 + ], + "collisionObjectType": 3, + "density": 500, + "friction": 0.3, + "geometryFile": "../models/cylinder.obj", + "id": 12, + "isDynamic": 0, + "restitution": 0.6, + "rotationAngle": 0.0, + "rotationAxis": [ + 1, + 0, + 0 + ], + "scale": [ + 0.25, + 10, + 0.25 + ], + "testMesh": 1, + "translation": [ + -10.0, + 5.0, + 0.0 + ], + "velocity": [ + 0, + 0, + 0 + ] + }, + { + "angularVelocity": [ + 0, + 0, + 0 + ], + "collisionObjectFileName": "", + "collisionObjectScale": [ + 0.25, + 10, + 0.25 + ], + "collisionObjectType": 3, + "density": 500, + "friction": 0.3, + "geometryFile": "../models/cylinder.obj", + "id": 13, + "isDynamic": 0, + "restitution": 0.6, + "rotationAngle": 0.0, + "rotationAxis": [ + 1, + 0, + 0 + ], + "scale": [ + 0.25, + 10, + 0.25 + ], + "testMesh": 1, + "translation": [ + -5.0, + 5.0, + 0.0 + ], + "velocity": [ + 0, + 0, + 0 + ] + }, + { + "angularVelocity": [ + 0, + 0, + 0 + ], + "collisionObjectFileName": "", + "collisionObjectScale": [ + 0.25, + 10, + 0.25 + ], + "collisionObjectType": 3, + "density": 500, + "friction": 0.3, + "geometryFile": "../models/cylinder.obj", + "id": 14, + "isDynamic": 0, + "restitution": 0.6, + "rotationAngle": 0.0, + "rotationAxis": [ + 1, + 0, + 0 + ], + "scale": [ + 0.25, + 10, + 0.25 + ], + "testMesh": 1, + "translation": [ + 0.0, + 5.0, + 0.0 + ], + "velocity": [ + 0, + 0, + 0 + ] + }, + { + "angularVelocity": [ + 0, + 0, + 0 + ], + "collisionObjectFileName": "", + "collisionObjectScale": [ + 0.25, + 10, + 0.25 + ], + "collisionObjectType": 3, + "density": 500, + "friction": 0.3, + "geometryFile": "../models/cylinder.obj", + "id": 15, + "isDynamic": 0, + "restitution": 0.6, + "rotationAngle": 0.0, + "rotationAxis": [ + 1, + 0, + 0 + ], + "scale": [ + 0.25, + 10, + 0.25 + ], + "testMesh": 1, + "translation": [ + 5.0, + 5.0, + 0.0 + ], + "velocity": [ + 0, + 0, + 0 + ] + }, + { + "angularVelocity": [ + 0, + 0, + 0 + ], + "collisionObjectFileName": "", + "collisionObjectScale": [ + 0.25, + 10, + 0.25 + ], + "collisionObjectType": 3, + "density": 500, + "friction": 0.3, + "geometryFile": "../models/cylinder.obj", + "id": 16, + "isDynamic": 0, + "restitution": 0.6, + "rotationAngle": 0.0, + "rotationAxis": [ + 1, + 0, + 0 + ], + "scale": [ + 0.25, + 10, + 0.25 + ], + "testMesh": 1, + "translation": [ + 10.0, + 5.0, + 0.0 + ], + "velocity": [ + 0, + 0, + 0 + ] + }, + { + "angularVelocity": [ + 0, + 0, + 0 + ], + "collisionObjectFileName": "", + "collisionObjectScale": [ + 0.25, + 10, + 0.25 + ], + "collisionObjectType": 3, + "density": 500, + "friction": 0.3, + "geometryFile": "../models/cylinder.obj", + "id": 17, + "isDynamic": 0, + "restitution": 0.6, + "rotationAngle": 0.0, + "rotationAxis": [ + 1, + 0, + 0 + ], + "scale": [ + 0.25, + 10, + 0.25 + ], + "testMesh": 1, + "translation": [ + -10.0, + 5.0, + 5.0 + ], + "velocity": [ + 0, + 0, + 0 + ] + }, + { + "angularVelocity": [ + 0, + 0, + 0 + ], + "collisionObjectFileName": "", + "collisionObjectScale": [ + 0.25, + 10, + 0.25 + ], + "collisionObjectType": 3, + "density": 500, + "friction": 0.3, + "geometryFile": "../models/cylinder.obj", + "id": 18, + "isDynamic": 0, + "restitution": 0.6, + "rotationAngle": 0.0, + "rotationAxis": [ + 1, + 0, + 0 + ], + "scale": [ + 0.25, + 10, + 0.25 + ], + "testMesh": 1, + "translation": [ + -5.0, + 5.0, + 5.0 + ], + "velocity": [ + 0, + 0, + 0 + ] + }, + { + "angularVelocity": [ + 0, + 0, + 0 + ], + "collisionObjectFileName": "", + "collisionObjectScale": [ + 0.25, + 10, + 0.25 + ], + "collisionObjectType": 3, + "density": 500, + "friction": 0.3, + "geometryFile": "../models/cylinder.obj", + "id": 19, + "isDynamic": 0, + "restitution": 0.6, + "rotationAngle": 0.0, + "rotationAxis": [ + 1, + 0, + 0 + ], + "scale": [ + 0.25, + 10, + 0.25 + ], + "testMesh": 1, + "translation": [ + 0.0, + 5.0, + 5.0 + ], + "velocity": [ + 0, + 0, + 0 + ] + }, + { + "angularVelocity": [ + 0, + 0, + 0 + ], + "collisionObjectFileName": "", + "collisionObjectScale": [ + 0.25, + 10, + 0.25 + ], + "collisionObjectType": 3, + "density": 500, + "friction": 0.3, + "geometryFile": "../models/cylinder.obj", + "id": 20, + "isDynamic": 0, + "restitution": 0.6, + "rotationAngle": 0.0, + "rotationAxis": [ + 1, + 0, + 0 + ], + "scale": [ + 0.25, + 10, + 0.25 + ], + "testMesh": 1, + "translation": [ + 5.0, + 5.0, + 5.0 + ], + "velocity": [ + 0, + 0, + 0 + ] + }, + { + "angularVelocity": [ + 0, + 0, + 0 + ], + "collisionObjectFileName": "", + "collisionObjectScale": [ + 0.25, + 10, + 0.25 + ], + "collisionObjectType": 3, + "density": 500, + "friction": 0.3, + "geometryFile": "../models/cylinder.obj", + "id": 21, + "isDynamic": 0, + "restitution": 0.6, + "rotationAngle": 0.0, + "rotationAxis": [ + 1, + 0, + 0 + ], + "scale": [ + 0.25, + 10, + 0.25 + ], + "testMesh": 1, + "translation": [ + 10.0, + 5.0, + 5.0 + ], + "velocity": [ + 0, + 0, + 0 + ] + }, + { + "angularVelocity": [ + 0, + 0, + 0 + ], + "collisionObjectFileName": "", + "collisionObjectScale": [ + 0.25, + 10, + 0.25 + ], + "collisionObjectType": 3, + "density": 500, + "friction": 0.3, + "geometryFile": "../models/cylinder.obj", + "id": 22, + "isDynamic": 0, + "restitution": 0.6, + "rotationAngle": 0.0, + "rotationAxis": [ + 1, + 0, + 0 + ], + "scale": [ + 0.25, + 10, + 0.25 + ], + "testMesh": 1, + "translation": [ + -10.0, + 5.0, + 10.0 + ], + "velocity": [ + 0, + 0, + 0 + ] + }, + { + "angularVelocity": [ + 0, + 0, + 0 + ], + "collisionObjectFileName": "", + "collisionObjectScale": [ + 0.25, + 10, + 0.25 + ], + "collisionObjectType": 3, + "density": 500, + "friction": 0.3, + "geometryFile": "../models/cylinder.obj", + "id": 23, + "isDynamic": 0, + "restitution": 0.6, + "rotationAngle": 0.0, + "rotationAxis": [ + 1, + 0, + 0 + ], + "scale": [ + 0.25, + 10, + 0.25 + ], + "testMesh": 1, + "translation": [ + -5.0, + 5.0, + 10.0 + ], + "velocity": [ + 0, + 0, + 0 + ] + }, + { + "angularVelocity": [ + 0, + 0, + 0 + ], + "collisionObjectFileName": "", + "collisionObjectScale": [ + 0.25, + 10, + 0.25 + ], + "collisionObjectType": 3, + "density": 500, + "friction": 0.3, + "geometryFile": "../models/cylinder.obj", + "id": 24, + "isDynamic": 0, + "restitution": 0.6, + "rotationAngle": 0.0, + "rotationAxis": [ + 1, + 0, + 0 + ], + "scale": [ + 0.25, + 10, + 0.25 + ], + "testMesh": 1, + "translation": [ + 0.0, + 5.0, + 10.0 + ], + "velocity": [ + 0, + 0, + 0 + ] + }, + { + "angularVelocity": [ + 0, + 0, + 0 + ], + "collisionObjectFileName": "", + "collisionObjectScale": [ + 0.25, + 10, + 0.25 + ], + "collisionObjectType": 3, + "density": 500, + "friction": 0.3, + "geometryFile": "../models/cylinder.obj", + "id": 25, + "isDynamic": 0, + "restitution": 0.6, + "rotationAngle": 0.0, + "rotationAxis": [ + 1, + 0, + 0 + ], + "scale": [ + 0.25, + 10, + 0.25 + ], + "testMesh": 1, + "translation": [ + 5.0, + 5.0, + 10.0 + ], + "velocity": [ + 0, + 0, + 0 + ] + }, + { + "angularVelocity": [ + 0, + 0, + 0 + ], + "collisionObjectFileName": "", + "collisionObjectScale": [ + 0.25, + 10, + 0.25 + ], + "collisionObjectType": 3, + "density": 500, + "friction": 0.3, + "geometryFile": "../models/cylinder.obj", + "id": 26, + "isDynamic": 0, + "restitution": 0.6, + "rotationAngle": 0.0, + "rotationAxis": [ + 1, + 0, + 0 + ], + "scale": [ + 0.25, + 10, + 0.25 + ], + "testMesh": 1, + "translation": [ + 10.0, + 5.0, + 10.0 + ], + "velocity": [ + 0, + 0, + 0 + ] + }, + { + "angularVelocity": [ + 0, + 0, + 0 + ], + "collisionObjectFileName": "../sdf/bunny_10k.csdf", + "collisionObjectScale": [ + 4, + 4, + 4 + ], + "collisionObjectType": 5, + "density": 300, + "friction": 0.1, + "geometryFile": "../models/bunny_10k.obj", + "id": 27, + "isDynamic": 1, + "restitution": 0.6, + "rotationAngle": 0.801322977421273, + "rotationAxis": [ + 0.13436424411240122, + 0.8474337369372327, + 0.763774618976614 + ], + "scale": [ + 4, + 4, + 4 + ], + "testMesh": 1, + "translation": [ + -5.25, + 20.0, + -3.5 + ], + "velocity": [ + 0, + 0, + 0 + ] + }, + { + "angularVelocity": [ + 0, + 0, + 0 + ], + "collisionObjectFileName": "", + "collisionObjectScale": [ + 2, + 2, + 2 + ], + "collisionObjectType": 5, + "density": 300, + "friction": 0.1, + "geometryFile": "../models/armadillo.obj", + "id": 28, + "isDynamic": 1, + "restitution": 0.6, + "rotationAngle": 0.29486858827891005, + "rotationAxis": [ + 0.4494910647887381, + 0.651592972722763, + 0.7887233511355132 + ], + "scale": [ + 2, + 2, + 2 + ], + "testMesh": 1, + "translation": [ + 1.75, + 20.0, + -3.5 + ], + "velocity": [ + 0, + 0, + 0 + ] + }, + { + "angularVelocity": [ + 0, + 0, + 0 + ], + "collisionObjectFileName": "../sdf/bunny_10k.csdf", + "collisionObjectScale": [ + 4, + 4, + 4 + ], + "collisionObjectType": 5, + "density": 300, + "friction": 0.1, + "geometryFile": "../models/bunny_10k.obj", + "id": 29, + "isDynamic": 1, + "restitution": 0.6, + "rotationAngle": 0.006616361735917517, + "rotationAxis": [ + 0.8357651039198697, + 0.43276706790505337, + 0.762280082457942 + ], + "scale": [ + 4, + 4, + 4 + ], + "testMesh": 1, + "translation": [ + -1.75, + 20.0, + 3.5 + ], + "velocity": [ + 0, + 0, + 0 + ] + }, + { + "angularVelocity": [ + 0, + 0, + 0 + ], + "collisionObjectFileName": "", + "collisionObjectScale": [ + 2, + 2, + 2 + ], + "collisionObjectType": 5, + "density": 300, + "friction": 0.1, + "geometryFile": "../models/armadillo.obj", + "id": 30, + "isDynamic": 1, + "restitution": 0.6, + "rotationAngle": 2.8319178785763612, + "rotationAxis": [ + 0.7215400323407826, + 0.22876222127045265, + 0.9452706955539223 + ], + "scale": [ + 2, + 2, + 2 + ], + "testMesh": 1, + "translation": [ + 5.25, + 20.0, + 3.5 + ], + "velocity": [ + 0, + 0, + 0 + ] + }, + { + "angularVelocity": [ + 0, + 0, + 0 + ], + "collisionObjectFileName": "", + "collisionObjectScale": [ + 2, + 2, + 2 + ], + "collisionObjectType": 5, + "density": 300, + "friction": 0.1, + "geometryFile": "../models/armadillo.obj", + "id": 31, + "isDynamic": 1, + "restitution": 0.6, + "rotationAngle": 1.1975884326385855, + "rotationAxis": [ + 0.0254458609934608, + 0.5414124727934966, + 0.9391491627785106 + ], + "scale": [ + 2, + 2, + 2 + ], + "testMesh": 1, + "translation": [ + -5.25, + 27.0, + -3.5 + ], + "velocity": [ + 0, + 0, + 0 + ] + }, + { + "angularVelocity": [ + 0, + 0, + 0 + ], + "collisionObjectFileName": "", + "collisionObjectScale": [ + 2, + 2, + 2 + ], + "collisionObjectType": 5, + "density": 300, + "friction": 0.1, + "geometryFile": "../models/armadillo.obj", + "id": 32, + "isDynamic": 1, + "restitution": 0.6, + "rotationAngle": 1.3756644473107498, + "rotationAxis": [ + 0.4221165755827173, + 0.029040787574867943, + 0.22169166627303505 + ], + "scale": [ + 2, + 2, + 2 + ], + "testMesh": 1, + "translation": [ + 1.75, + 27.0, + -3.5 + ], + "velocity": [ + 0, + 0, + 0 + ] + }, + { + "angularVelocity": [ + 0, + 0, + 0 + ], + "collisionObjectFileName": "", + "collisionObjectScale": [ + 2, + 2, + 2 + ], + "collisionObjectType": 5, + "density": 300, + "friction": 0.1, + "geometryFile": "../models/armadillo.obj", + "id": 33, + "isDynamic": 1, + "restitution": 0.6, + "rotationAngle": 1.443886871526072, + "rotationAxis": [ + 0.23308445025757263, + 0.2308665415409843, + 0.2187810373376886 + ], + "scale": [ + 2, + 2, + 2 + ], + "testMesh": 1, + "translation": [ + -1.75, + 27.0, + 3.5 + ], + "velocity": [ + 0, + 0, + 0 + ] + }, + { + "angularVelocity": [ + 0, + 0, + 0 + ], + "collisionObjectFileName": "", + "collisionObjectScale": [ + 2, + 2, + 2 + ], + "collisionObjectType": 5, + "density": 300, + "friction": 0.1, + "geometryFile": "../models/armadillo.obj", + "id": 34, + "isDynamic": 1, + "restitution": 0.6, + "rotationAngle": 2.0178272520307075, + "rotationAxis": [ + 0.021489705265908876, + 0.8375779756625729, + 0.5564543226524334 + ], + "scale": [ + 2, + 2, + 2 + ], + "testMesh": 1, + "translation": [ + 5.25, + 27.0, + 3.5 + ], + "velocity": [ + 0, + 0, + 0 + ] + } + ], + "RigidBodyParticleBallJoints": [], + "Simulation": { + "cloth_bendingStiffness": 0.005, + "cloth_normalizeShear": 0, + "cloth_normalizeStretch": 0, + "cloth_stiffness": 1.0, + "cloth_xxStiffness": 1.0, + "cloth_xyPoissonRatio": 0.3, + "cloth_xyStiffness": 1.0, + "cloth_yxPoissonRatio": 0.3, + "cloth_yyStiffness": 1.0, + "contactStiffnessParticleRigidBody": 100.0, + "contactStiffnessRigidBody": 1.0, + "contactTolerance": 0.01, + "gravity": [ + 0, + -9.81, + 0 + ], + "maxIter": 5, + "maxIterVel": 5, + "timeStepSize": 0.005, + "clothBendingMethod": 2, + "clothSimulationMethod": 2, + "velocityUpdateMethod": 0 + }, + "SliderJoints": [], + "TargetAngleMotorHingeJoints": [], + "TargetPositionMotorSliderJoints": [], + "TargetVelocityMotorHingeJoints": [], + "TargetVelocityMotorSliderJoints": [], + "TetModels": [], + "TriangleModels": [], + "UniversalJoints": [], + "cameraLookat": [ + 10, + 0, + 0 + ], + "cameraPosition": [ + 10, + 20, + 60 + ] +} \ No newline at end of file diff --git a/data/scenes/PileScene.py b/data/scenes/PileScene.py new file mode 100644 index 00000000..357f4bcc --- /dev/null +++ b/data/scenes/PileScene.py @@ -0,0 +1,110 @@ +from SceneGenerator import * +import math +import random + +def scale(vec, s): + vec[0] *= s + vec[1] *= s + vec[2] *= s + return vec + + +random.seed(1) + +s = 1 + +scene = generateScene('PileScene', camPosition=[10,20,60], camLookat=[10,0,0]) +addParameters(scene, h=0.005, maxIterVel=5, contactTolerance=0.01) + +# floor +floorScale=[500, 1, 500] +floorScale = scale(floorScale, s) +floorT = [0,-0.5,0] +floorT = scale(floorT, s) +addRigidBody(scene, '../models/cube.obj', 2, coScale=floorScale, + scale=floorScale, translation=floorT, + dynamic=0, rest= 0.5) + +# piles +restitution = 0.6 +num_piles_x = 5 +num_piles_z = 5 +dx_piles = 5.0 +dz_piles = 5.0 +startx_piles = -0.5 * (num_piles_x - 1.0)*dx_piles +startz_piles = -0.5 * (num_piles_z - 1.0)*dz_piles +pileScale = [0.25,10,0.25] +pileScale = scale(pileScale, s) + +current_z = startz_piles +for i in range(0,num_piles_z): + current_x = startx_piles + for j in range(0,num_piles_x): + t = [s*current_x, 0.5*pileScale[1], s*current_z] + addRigidBody(scene, '../models/cylinder.obj', 3, coScale=pileScale, scale=pileScale, + translation=t, dynamic=0, rest=restitution) + current_x += dx_piles + current_z += dz_piles + +# rigid bodies + +num_bodies_x = 2 +num_bodies_y = 2 +num_bodies_z = 2 +dx_bodies = 7.0 +dy_bodies = 7.0 +dz_bodies = 7.0 +startx_bodies = -0.5 * (num_bodies_x - 1.0)*dx_bodies +starty_bodies = 20.0 +startz_bodies = -0.5 * (num_bodies_z - 1.0)*dz_bodies + +armadilloScale = [2,2,2] +bunnyScale = [4,4,4] +armadilloScale = scale(armadilloScale, s) +bunnyScale = scale(bunnyScale, s) +density = 300 +friction = 0.1 +restitution = 0.6 + +current_y = starty_bodies +index = 0 +numTypes = 2 +for k in range(0,num_bodies_y): + current_z = startz_bodies + for i in range(0,num_bodies_z): + current_x = startx_bodies - 0.25*dx_bodies + for j in range(0,num_bodies_x): + rand_x = 0 + rand_z = 0 + x = [current_x+rand_x, current_y, current_z+rand_z] + t = x + if i%2 == 1: + t[0] += 0.5*dx_bodies + t = scale(t, s) + + rotaxis = [random.random(), random.random(), random.random()] + rotangle = 1.0 * random.random()*math.pi + + #rotaxis = [1,0,0] + #rotangle = 0.0 + + index = random.randint(1, 3000) + + if index%numTypes == 1: + addRigidBody(scene, '../models/bunny_10k.obj', 5, coFile='../sdf/bunny_10k.csdf', coScale=bunnyScale, + translation=t, axis=rotaxis, angle=rotangle, scale=bunnyScale, + dynamic=1, density=density, friction=friction, rest=restitution) + else: + addRigidBody(scene, '../models/armadillo.obj', 5, coFile='', coScale=armadilloScale, + translation=t, axis=rotaxis, angle=rotangle, scale=armadilloScale, + dynamic=1, density=density, friction=friction, rest=restitution) + + index += 1 + current_x += dx_bodies + current_z += dz_bodies + current_y += dy_bodies + + + + +writeScene(scene, 'PileScene.json') diff --git a/data/scenes/SceneGenerator.py b/data/scenes/SceneGenerator.py index 5dba5315..f155261c 100644 --- a/data/scenes/SceneGenerator.py +++ b/data/scenes/SceneGenerator.py @@ -4,18 +4,20 @@ ###################################################### # add parameters ###################################################### -def addParameters(scene, h=0.005, maxIter=5, maxIterVel=5, velocityUpdateMethod=0, contactTolerance=0.05, triangleModelSimulationMethod=2, triangleModelBendingMethod=2, +def addParameters(scene, h=0.005, maxIter=5, maxIterVel=5, subSteps=5, velocityUpdateMethod=0, contactTolerance=0.05, clothSimulationMethod=2, clothBendingMethod=2, contactStiffnessRigidBody=1.0, contactStiffnessParticleRigidBody=100.0, cloth_stiffness=1.0, cloth_bendingStiffness=0.005, cloth_xxStiffness=1.0, cloth_yyStiffness=1.0, cloth_xyStiffness=1.0, - cloth_xyPoissonRatio=0.3, cloth_yxPoissonRatio=0.3, cloth_normalizeStretch=0, cloth_normalizeShear=0, gravity=[0,-9.81,0]): + cloth_xyPoissonRatio=0.3, cloth_yxPoissonRatio=0.3, cloth_normalizeStretch=0, cloth_normalizeShear=0, gravity=[0,-9.81,0], numberOfStepsPerRenderUpdate=4): parameters = { 'timeStepSize': h, 'gravity': gravity, - 'maxIter' : maxIter, - 'maxIterVel' : maxIterVel, + 'maxIterations' : maxIter, + 'maxIterationsV' : maxIterVel, + 'subSteps': subSteps, + 'numberOfStepsPerRenderUpdate': numberOfStepsPerRenderUpdate, 'velocityUpdateMethod' : velocityUpdateMethod, 'contactTolerance': contactTolerance, - 'triangleModelSimulationMethod': triangleModelSimulationMethod, - 'triangleModelBendingMethod': triangleModelBendingMethod, + 'clothSimulationMethod': clothSimulationMethod, + 'clothBendingMethod': clothBendingMethod, 'contactStiffnessRigidBody' : contactStiffnessRigidBody, 'contactStiffnessParticleRigidBody': contactStiffnessParticleRigidBody, 'cloth_stiffness': cloth_stiffness, @@ -36,7 +38,7 @@ def addParameters(scene, h=0.005, maxIter=5, maxIterVel=5, velocityUpdateMethod= ###################################################### def addRigidBody(scene, geoFile, coType, coFile='', coScale=[1,1,1], translation=[0,0,0], axis=[1,0,0], angle=0.0, scale=[1,1,1], v=[0,0,0], omega=[0,0,0], dynamic=1, density=500, rest=0.6, friction=0.3, - testMesh = 1): + testMesh = 1, flatShading=False): global current_id rb = { 'id': current_id, 'geometryFile': geoFile, @@ -53,7 +55,8 @@ def addRigidBody(scene, geoFile, coType, coFile='', coScale=[1,1,1], translation 'collisionObjectType': coType, 'collisionObjectScale': coScale, 'collisionObjectFileName': coFile, - 'testMesh': testMesh + 'testMesh': testMesh, + 'flatShading': flatShading } current_id += 1 @@ -164,15 +167,27 @@ def addUniversalJoint(scene, rbId1, rbId2, position, axis1, axis2): ###################################################### # add slider joint ###################################################### -def addSliderJoint(scene, rbId1, rbId2, position, axis): +def addSliderJoint(scene, rbId1, rbId2, axis): joint = { 'bodyID1': rbId1, 'bodyID2': rbId2, - 'position': position, 'axis': axis } scene['SliderJoints'].append(joint) return + +###################################################### +# add damper joint +###################################################### +def addDamperJoint(scene, rbId1, rbId2, axis, stiffness): + joint = { + 'bodyID1': rbId1, + 'bodyID2': rbId2, + 'axis': axis, + 'stiffness': stiffness + } + scene['DamperJoints'].append(joint) + return ###################################################### # add RigidBodyParticleBallJoint @@ -189,16 +204,21 @@ def addRigidBodyParticleBallJoint(scene, rbId, particleId): ###################################################### # add TargetAngleMotorHingeJoint ###################################################### -def addTargetAngleMotorHingeJoint(scene, rbId1, rbId2, position, axis, target): - joint = { - 'bodyID1': rbId1, +def addTargetAngleMotorHingeJoint(scene, rbId1, rbId2, position, axis, target, targetSequence=None, repeatSequence=0): + joint = { + 'bodyID1': rbId1, 'bodyID2': rbId2, 'position': position, - 'axis': axis, - 'target': target + 'axis': axis } - scene['TargetAngleMotorHingeJoints'].append(joint) - return + + if targetSequence != None: + joint['targetSequence'] = targetSequence + joint['repeatSequence'] = repeatSequence + else: + joint['target'] = target + scene['TargetAngleMotorHingeJoints'].append(joint) + return ###################################################### # add TargetVelocityMotorHingeJoint @@ -217,11 +237,10 @@ def addTargetVelocityMotorHingeJoint(scene, rbId1, rbId2, position, axis, target ###################################################### # add TargetPositionMotorSliderJoint ###################################################### -def addTargetPositionMotorSliderJoint(scene, rbId1, rbId2, position, axis, target): +def addTargetPositionMotorSliderJoint(scene, rbId1, rbId2, axis, target): joint = { 'bodyID1': rbId1, 'bodyID2': rbId2, - 'position': position, 'axis': axis, 'target': target } @@ -231,16 +250,42 @@ def addTargetPositionMotorSliderJoint(scene, rbId1, rbId2, position, axis, targe ###################################################### # add TargetVelocityMotorSliderJoint ###################################################### -def addTargetVelocityMotorSliderJoint(scene, rbId1, rbId2, position, axis, target): +def addTargetVelocityMotorSliderJoint(scene, rbId1, rbId2, axis, target): joint = { 'bodyID1': rbId1, 'bodyID2': rbId2, - 'position': position, 'axis': axis, 'target': target } scene['TargetVelocityMotorSliderJoints'].append(joint) return + +###################################################### +# add spring +###################################################### +def addRigidBodySpring(scene, rbId1, rbId2, position1, position2, stiffness): + joint = { + 'bodyID1': rbId1, + 'bodyID2': rbId2, + 'position1': position1, + 'position2': position2, + 'stiffness': stiffness + } + scene['RigidBodySprings'].append(joint) + return + +###################################################### +# add distance joint +###################################################### +def addDistanceJoint(scene, rbId1, rbId2, position1, position2): + joint = { + 'bodyID1': rbId1, + 'bodyID2': rbId2, + 'position1': position1, + 'position2': position2 + } + scene['DistanceJoints'].append(joint) + return ###################################################### # generate scene @@ -255,11 +300,14 @@ def generateScene(name, camPosition=[0, 10, 30], camLookat=[0,0,0]): scene['HingeJoints'] = [] scene['UniversalJoints'] = [] scene['SliderJoints'] = [] + scene['DamperJoints'] = [] scene['RigidBodyParticleBallJoints'] = [] scene['TargetAngleMotorHingeJoints'] = [] scene['TargetVelocityMotorHingeJoints'] = [] scene['TargetPositionMotorSliderJoints'] = [] scene['TargetVelocityMotorSliderJoints'] = [] + scene['RigidBodySprings'] = [] + scene['DistanceJoints'] = [] scene['TriangleModels'] = [] scene['TetModels'] = [] @@ -284,7 +332,7 @@ def rotation_matrix(axis, angle): z = axis[2] d = math.sqrt(x*x + y*y + z*z) if d < 1.0e-6: - print "Vector of rotation matrix is zero!" + print ("Vector of rotation matrix is zero!") return x = x/d; y = y/d; @@ -336,5 +384,15 @@ def scale_vector(v, s): res[1] = s*v[1]; res[2] = s*v[2]; return res + +###################################################### +# add vector +###################################################### +def add_vector(v1, v2): + res = [0,0,0] + res[0] = v1[0] + v2[0]; + res[1] = v1[1] + v2[1]; + res[2] = v1[2] + v2[2]; + return res current_id=1 \ No newline at end of file diff --git a/data/scenes/Wilberforce_scene.json b/data/scenes/Wilberforce_scene.json new file mode 100644 index 00000000..57d7e61a --- /dev/null +++ b/data/scenes/Wilberforce_scene.json @@ -0,0 +1,5072 @@ +{ + "BallJoints": [], + "BallOnLineJoints": [], + "CompactTreeModels": [], + "CosseratJoints": [ + { + "bodyID1": 1, + "bodyID2": 2, + "id": 82, + "position": [ + 0.0038494583961264928, + -0.06188118811881188, + 0.24749481763865086 + ], + "stiffnessModifier": [ + 1.0, + 1.0, + 1.0 + ] + }, + { + "bodyID1": 2, + "bodyID2": 3, + "id": 83, + "position": [ + -0.3145115448890112, + -0.09900990099009901, + 0.24068621904179482 + ], + "stiffnessModifier": [ + 1.0, + 1.0, + 1.0 + ] + }, + { + "bodyID1": 3, + "bodyID2": 4, + "id": 84, + "position": [ + -0.4948100407386079, + -0.12376237623762378, + 0.015395971420711481 + ], + "stiffnessModifier": [ + 1.0, + 1.0, + 1.0 + ] + }, + { + "bodyID1": 4, + "bodyID2": 5, + "id": 85, + "position": [ + -0.49329979174146393, + -0.14851485148514854, + -0.3310013493240168 + ], + "stiffnessModifier": [ + 1.0, + 1.0, + 1.0 + ] + }, + { + "bodyID1": 5, + "bodyID2": 6, + "id": 86, + "position": [ + -0.24266189547918185, + -0.1732673267326733, + -0.6491997140263094 + ], + "stiffnessModifier": [ + 1.0, + 1.0, + 1.0 + ] + }, + { + "bodyID1": 6, + "bodyID2": 7, + "id": 87, + "position": [ + 0.2069876619507816, + -0.19801980198019806, + -0.7645558053017311 + ], + "stiffnessModifier": [ + 1.0, + 1.0, + 1.0 + ] + }, + { + "bodyID1": 7, + "bodyID2": 8, + "id": 88, + "position": [ + 0.45799361915111286, + -0.21039603960396042, + -0.7060493895708473 + ], + "stiffnessModifier": [ + 1.0, + 1.0, + 1.0 + ] + }, + { + "bodyID1": 8, + "bodyID2": 9, + "id": 89, + "position": [ + 0.690466729101586, + -0.22277227722772278, + -0.5632898863137552 + ], + "stiffnessModifier": [ + 1.0, + 1.0, + 1.0 + ] + }, + { + "bodyID1": 9, + "bodyID2": 10, + "id": 90, + "position": [ + 0.8758285732601756, + -0.23514851485148516, + -0.34298905937477353 + ], + "stiffnessModifier": [ + 1.0, + 1.0, + 1.0 + ] + }, + { + "bodyID1": 10, + "bodyID2": 11, + "id": 91, + "position": [ + 0.9881837595382127, + -0.24752475247524755, + -0.06155409646681034 + ], + "stiffnessModifier": [ + 1.0, + 1.0, + 1.0 + ] + }, + { + "bodyID1": 11, + "bodyID2": 12, + "id": 92, + "position": [ + 0.9691989991996659, + -0.2599009900990099, + 0.24627890683200235 + ], + "stiffnessModifier": [ + 1.0, + 1.0, + 1.0 + ] + }, + { + "bodyID1": 12, + "bodyID2": 13, + "id": 93, + "position": [ + 0.8473147049577766, + -0.2722772277227723, + 0.5310911322572766 + ], + "stiffnessModifier": [ + 1.0, + 1.0, + 1.0 + ] + }, + { + "bodyID1": 13, + "bodyID2": 14, + "id": 94, + "position": [ + 0.6441104114503966, + -0.2846534653465347, + 0.7649325315746486 + ], + "stiffnessModifier": [ + 1.0, + 1.0, + 1.0 + ] + }, + { + "bodyID1": 14, + "bodyID2": 15, + "id": 95, + "position": [ + 0.37908840384037734, + -0.2970297029702971, + 0.9253604606172424 + ], + "stiffnessModifier": [ + 1.0, + 1.0, + 1.0 + ] + }, + { + "bodyID1": 15, + "bodyID2": 16, + "id": 96, + "position": [ + 0.07768384728900339, + -0.3094059405940595, + 0.9969780438256295 + ], + "stiffnessModifier": [ + 1.0, + 1.0, + 1.0 + ] + }, + { + "bodyID1": 16, + "bodyID2": 17, + "id": 97, + "position": [ + -0.23117632211497305, + -0.3217821782178219, + 0.9729118706714366 + ], + "stiffnessModifier": [ + 1.0, + 1.0, + 1.0 + ] + }, + { + "bodyID1": 17, + "bodyID2": 18, + "id": 98, + "position": [ + -0.5178496248983283, + -0.33415841584158434, + 0.8554716628811622 + ], + "stiffnessModifier": [ + 1.0, + 1.0, + 1.0 + ] + }, + { + "bodyID1": 18, + "bodyID2": 19, + "id": 99, + "position": [ + -0.754822939153259, + -0.34653465346534673, + 0.6559286016999376 + ], + "stiffnessModifier": [ + 1.0, + 1.0, + 1.0 + ] + }, + { + "bodyID1": 19, + "bodyID2": 20, + "id": 100, + "position": [ + -0.9193530389822375, + -0.3589108910891091, + 0.39343358996674965 + ], + "stiffnessModifier": [ + 1.0, + 1.0, + 1.0 + ] + }, + { + "bodyID1": 20, + "bodyID2": 21, + "id": 101, + "position": [ + -0.995649347969019, + -0.3712871287128715, + 0.09317926748406709 + ], + "stiffnessModifier": [ + 1.0, + 1.0, + 1.0 + ] + }, + { + "bodyID1": 21, + "bodyID2": 22, + "id": 102, + "position": [ + -0.9763894205636061, + -0.3836633663366339, + -0.2160178219764877 + ], + "stiffnessModifier": [ + 1.0, + 1.0, + 1.0 + ] + }, + { + "bodyID1": 22, + "bodyID2": 23, + "id": 103, + "position": [ + -0.8634217048966615, + -0.3960396039603963, + -0.5044828634486432 + ], + "stiffnessModifier": [ + 1.0, + 1.0, + 1.0 + ] + }, + { + "bodyID1": 23, + "bodyID2": 24, + "id": 104, + "position": [ + -0.6675881402161506, + -0.40841584158415867, + -0.7445307750810178 + ], + "stiffnessModifier": [ + 1.0, + 1.0, + 1.0 + ] + }, + { + "bodyID1": 24, + "bodyID2": 25, + "id": 105, + "position": [ + -0.40768361494168387, + -0.420792079207921, + -0.9131232502286211 + ], + "stiffnessModifier": [ + 1.0, + 1.0, + 1.0 + ] + }, + { + "bodyID1": 25, + "bodyID2": 26, + "id": 106, + "position": [ + -0.1086521500854693, + -0.4331683168316834, + -0.9940798309400531 + ], + "stiffnessModifier": [ + 1.0, + 1.0, + 1.0 + ] + }, + { + "bodyID1": 26, + "bodyID2": 27, + "id": 107, + "position": [ + 0.20080707285572344, + -0.4455445544554458, + -0.9796308077490806 + ], + "stiffnessModifier": [ + 1.0, + 1.0, + 1.0 + ] + }, + { + "bodyID1": 27, + "bodyID2": 28, + "id": 108, + "position": [ + 0.4909940809733265, + -0.4579207920792081, + -0.8711629080999481 + ], + "stiffnessModifier": [ + 1.0, + 1.0, + 1.0 + ] + }, + { + "bodyID1": 28, + "bodyID2": 29, + "id": 109, + "position": [ + 0.7340585287594644, + -0.4702970297029705, + -0.6790862068658813 + ], + "stiffnessModifier": [ + 1.0, + 1.0, + 1.0 + ] + }, + { + "bodyID1": 29, + "bodyID2": 30, + "id": 110, + "position": [ + 0.9066726011770752, + -0.4826732673267329, + -0.4218350320620567 + ], + "stiffnessModifier": [ + 1.0, + 1.0, + 1.0 + ] + }, + { + "bodyID1": 30, + "bodyID2": 31, + "id": 111, + "position": [ + 0.9922698723632772, + -0.49504950495049527, + -0.1240987526132534 + ], + "stiffnessModifier": [ + 1.0, + 1.0, + 1.0 + ] + }, + { + "bodyID1": 31, + "bodyID2": 32, + "id": 112, + "position": [ + 0.9826352482222627, + -0.5074257425742575, + 0.18554775382949892 + ], + "stiffnessModifier": [ + 1.0, + 1.0, + 1.0 + ] + }, + { + "bodyID1": 32, + "bodyID2": 33, + "id": 113, + "position": [ + 0.8786934000992661, + -0.51980198019802, + 0.47738654005113196 + ], + "stiffnessModifier": [ + 1.0, + 1.0, + 1.0 + ] + }, + { + "bodyID1": 33, + "bodyID2": 34, + "id": 114, + "position": [ + 0.6904200205717429, + -0.5321782178217824, + 0.7234087331472534 + ], + "stiffnessModifier": [ + 1.0, + 1.0, + 1.0 + ] + }, + { + "bodyID1": 34, + "bodyID2": 35, + "id": 115, + "position": [ + 0.4358844184753665, + -0.5445544554455448, + 0.9000026520685324 + ], + "stiffnessModifier": [ + 1.0, + 1.0, + 1.0 + ] + }, + { + "bodyID1": 35, + "bodyID2": 36, + "id": 116, + "position": [ + 0.13951533894391638, + -0.5569306930693072, + 0.9902199100196704 + ], + "stiffnessModifier": [ + 1.0, + 1.0, + 1.0 + ] + }, + { + "bodyID1": 36, + "bodyID2": 37, + "id": 117, + "position": [ + -0.170243555722405, + -0.5693069306930696, + 0.9854020152886802 + ], + "stiffnessModifier": [ + 1.0, + 1.0, + 1.0 + ] + }, + { + "bodyID1": 37, + "bodyID2": 38, + "id": 118, + "position": [ + -0.4636635319853329, + -0.581683168316832, + 0.8860113594683119 + ], + "stiffnessModifier": [ + 1.0, + 1.0, + 1.0 + ] + }, + { + "bodyID1": 38, + "bodyID2": 39, + "id": 119, + "position": [ + -0.7125839641475125, + -0.5940594059405944, + 0.701586839984771 + ], + "stiffnessModifier": [ + 1.0, + 1.0, + 1.0 + ] + }, + { + "bodyID1": 39, + "bodyID2": 40, + "id": 120, + "position": [ + -0.893115016186795, + -0.6064356435643568, + 0.4498283760076289 + ], + "stiffnessModifier": [ + 1.0, + 1.0, + 1.0 + ] + }, + { + "bodyID1": 40, + "bodyID2": 41, + "id": 121, + "position": [ + -0.9879304397407579, + -0.6188118811881193, + 0.15489818021407728 + ], + "stiffnessModifier": [ + 1.0, + 1.0, + 1.0 + ] + }, + { + "bodyID1": 41, + "bodyID2": 42, + "id": 122, + "position": [ + -0.9879304397407556, + -0.6311881188118816, + -0.15489818021409188 + ], + "stiffnessModifier": [ + 1.0, + 1.0, + 1.0 + ] + }, + { + "bodyID1": 42, + "bodyID2": 43, + "id": 123, + "position": [ + -0.8931150161867885, + -0.6435643564356439, + -0.44982837600764214 + ], + "stiffnessModifier": [ + 1.0, + 1.0, + 1.0 + ] + }, + { + "bodyID1": 43, + "bodyID2": 44, + "id": 124, + "position": [ + -0.7125839641475008, + -0.6559405940594063, + -0.7015868399847828 + ], + "stiffnessModifier": [ + 1.0, + 1.0, + 1.0 + ] + }, + { + "bodyID1": 44, + "bodyID2": 45, + "id": 125, + "position": [ + -0.46366353198531823, + -0.6683168316831687, + -0.8860113594683195 + ], + "stiffnessModifier": [ + 1.0, + 1.0, + 1.0 + ] + }, + { + "bodyID1": 45, + "bodyID2": 46, + "id": 126, + "position": [ + -0.17024355572239042, + -0.6806930693069311, + -0.9854020152886828 + ], + "stiffnessModifier": [ + 1.0, + 1.0, + 1.0 + ] + }, + { + "bodyID1": 46, + "bodyID2": 47, + "id": 127, + "position": [ + 0.13951533894393278, + -0.6930693069306935, + -0.9902199100196681 + ], + "stiffnessModifier": [ + 1.0, + 1.0, + 1.0 + ] + }, + { + "bodyID1": 47, + "bodyID2": 48, + "id": 128, + "position": [ + 0.4358844184753782, + -0.7054455445544559, + -0.9000026520685267 + ], + "stiffnessModifier": [ + 1.0, + 1.0, + 1.0 + ] + }, + { + "bodyID1": 48, + "bodyID2": 49, + "id": 129, + "position": [ + 0.6904200205717536, + -0.7178217821782182, + -0.7234087331472432 + ], + "stiffnessModifier": [ + 1.0, + 1.0, + 1.0 + ] + }, + { + "bodyID1": 49, + "bodyID2": 50, + "id": 130, + "position": [ + 0.878693400099274, + -0.7301980198019806, + -0.4773865400511174 + ], + "stiffnessModifier": [ + 1.0, + 1.0, + 1.0 + ] + }, + { + "bodyID1": 50, + "bodyID2": 51, + "id": 131, + "position": [ + 0.9826352482222653, + -0.7425742574257429, + -0.18554775382948444 + ], + "stiffnessModifier": [ + 1.0, + 1.0, + 1.0 + ] + }, + { + "bodyID1": 51, + "bodyID2": 52, + "id": 132, + "position": [ + 0.9922698723632752, + -0.7549504950495053, + 0.12409875261326982 + ], + "stiffnessModifier": [ + 1.0, + 1.0, + 1.0 + ] + }, + { + "bodyID1": 52, + "bodyID2": 53, + "id": 133, + "position": [ + 0.9066726011770675, + -0.7673267326732677, + 0.4218350320620733 + ], + "stiffnessModifier": [ + 1.0, + 1.0, + 1.0 + ] + }, + { + "bodyID1": 53, + "bodyID2": 54, + "id": 134, + "position": [ + 0.7340585287594532, + -0.7797029702970302, + 0.6790862068658934 + ], + "stiffnessModifier": [ + 1.0, + 1.0, + 1.0 + ] + }, + { + "bodyID1": 54, + "bodyID2": 55, + "id": 135, + "position": [ + 0.49099408097331204, + -0.7920792079207926, + 0.8711629080999562 + ], + "stiffnessModifier": [ + 1.0, + 1.0, + 1.0 + ] + }, + { + "bodyID1": 55, + "bodyID2": 56, + "id": 136, + "position": [ + 0.2008070728557055, + -0.804455445544555, + 0.9796308077490843 + ], + "stiffnessModifier": [ + 1.0, + 1.0, + 1.0 + ] + }, + { + "bodyID1": 56, + "bodyID2": 57, + "id": 137, + "position": [ + -0.10865215008548572, + -0.8168316831683173, + 0.9940798309400514 + ], + "stiffnessModifier": [ + 1.0, + 1.0, + 1.0 + ] + }, + { + "bodyID1": 57, + "bodyID2": 58, + "id": 138, + "position": [ + -0.4076836149417005, + -0.8292079207920797, + 0.9131232502286135 + ], + "stiffnessModifier": [ + 1.0, + 1.0, + 1.0 + ] + }, + { + "bodyID1": 58, + "bodyID2": 59, + "id": 139, + "position": [ + -0.6675881402161616, + -0.8415841584158421, + 0.744530775081008 + ], + "stiffnessModifier": [ + 1.0, + 1.0, + 1.0 + ] + }, + { + "bodyID1": 59, + "bodyID2": 60, + "id": 140, + "position": [ + -0.8634217048966698, + -0.8539603960396045, + 0.504482863448629 + ], + "stiffnessModifier": [ + 1.0, + 1.0, + 1.0 + ] + }, + { + "bodyID1": 60, + "bodyID2": 61, + "id": 141, + "position": [ + -0.9763894205636101, + -0.866336633663367, + 0.2160178219764698 + ], + "stiffnessModifier": [ + 1.0, + 1.0, + 1.0 + ] + }, + { + "bodyID1": 61, + "bodyID2": 62, + "id": 142, + "position": [ + -0.9956493479690175, + -0.8787128712871294, + -0.09317926748408356 + ], + "stiffnessModifier": [ + 1.0, + 1.0, + 1.0 + ] + }, + { + "bodyID1": 62, + "bodyID2": 63, + "id": 143, + "position": [ + -0.919353038982231, + -0.8910891089108918, + -0.39343358996676486 + ], + "stiffnessModifier": [ + 1.0, + 1.0, + 1.0 + ] + }, + { + "bodyID1": 63, + "bodyID2": 64, + "id": 144, + "position": [ + -0.754822939153247, + -0.903465346534654, + -0.6559286016999515 + ], + "stiffnessModifier": [ + 1.0, + 1.0, + 1.0 + ] + }, + { + "bodyID1": 64, + "bodyID2": 65, + "id": 145, + "position": [ + -0.517849624898314, + -0.9158415841584164, + -0.8554716628811707 + ], + "stiffnessModifier": [ + 1.0, + 1.0, + 1.0 + ] + }, + { + "bodyID1": 65, + "bodyID2": 66, + "id": 146, + "position": [ + -0.2311763221149552, + -0.9282178217821788, + -0.9729118706714408 + ], + "stiffnessModifier": [ + 1.0, + 1.0, + 1.0 + ] + }, + { + "bodyID1": 66, + "bodyID2": 67, + "id": 147, + "position": [ + 0.07768384728901903, + -0.9405940594059412, + -0.9969780438256283 + ], + "stiffnessModifier": [ + 1.0, + 1.0, + 1.0 + ] + }, + { + "bodyID1": 67, + "bodyID2": 68, + "id": 148, + "position": [ + 0.3790884038403927, + -0.9529702970297036, + -0.9253604606172361 + ], + "stiffnessModifier": [ + 1.0, + 1.0, + 1.0 + ] + }, + { + "bodyID1": 68, + "bodyID2": 69, + "id": 149, + "position": [ + 0.64411041145041, + -0.965346534653466, + -0.7649325315746374 + ], + "stiffnessModifier": [ + 1.0, + 1.0, + 1.0 + ] + }, + { + "bodyID1": 69, + "bodyID2": 70, + "id": 150, + "position": [ + 0.847314704957785, + -0.9777227722772284, + -0.5310911322572632 + ], + "stiffnessModifier": [ + 1.0, + 1.0, + 1.0 + ] + }, + { + "bodyID1": 70, + "bodyID2": 71, + "id": 151, + "position": [ + 0.96919899919967, + -0.9900990099009906, + -0.2462789068319863 + ], + "stiffnessModifier": [ + 1.0, + 1.0, + 1.0 + ] + }, + { + "bodyID1": 71, + "bodyID2": 72, + "id": 152, + "position": [ + 0.9881837595382087, + -1.0024752475247531, + 0.061554096466829133 + ], + "stiffnessModifier": [ + 1.0, + 1.0, + 1.0 + ] + }, + { + "bodyID1": 72, + "bodyID2": 73, + "id": 153, + "position": [ + 0.8758285732601672, + -1.0148514851485155, + 0.3429890593747869 + ], + "stiffnessModifier": [ + 1.0, + 1.0, + 1.0 + ] + }, + { + "bodyID1": 73, + "bodyID2": 74, + "id": 154, + "position": [ + 0.6904667291015736, + -1.027227722772278, + 0.563289886313766 + ], + "stiffnessModifier": [ + 1.0, + 1.0, + 1.0 + ] + }, + { + "bodyID1": 74, + "bodyID2": 75, + "id": 155, + "position": [ + 0.45799361915109776, + -1.0396039603960403, + 0.7060493895708535 + ], + "stiffnessModifier": [ + 1.0, + 1.0, + 1.0 + ] + }, + { + "bodyID1": 75, + "bodyID2": 76, + "id": 156, + "position": [ + 0.20698766195076757, + -1.0519801980198027, + 0.7645558053017318 + ], + "stiffnessModifier": [ + 1.0, + 1.0, + 1.0 + ] + }, + { + "bodyID1": 76, + "bodyID2": 77, + "id": 157, + "position": [ + -0.034633953257996355, + -1.064356435643565, + 0.741766147160351 + ], + "stiffnessModifier": [ + 1.0, + 1.0, + 1.0 + ] + }, + { + "bodyID1": 77, + "bodyID2": 78, + "id": 158, + "position": [ + -0.3990160453955553, + -1.0891089108910899, + 0.5049369033763648 + ], + "stiffnessModifier": [ + 1.0, + 1.0, + 1.0 + ] + }, + { + "bodyID1": 78, + "bodyID2": 79, + "id": 159, + "position": [ + -0.5233554625933643, + -1.1138613861386146, + 0.15046133961677902 + ], + "stiffnessModifier": [ + 1.0, + 1.0, + 1.0 + ] + }, + { + "bodyID1": 79, + "bodyID2": 80, + "id": 160, + "position": [ + -0.41971823619949405, + -1.1386138613861394, + -0.14948763228603337 + ], + "stiffnessModifier": [ + 1.0, + 1.0, + 1.0 + ] + }, + { + "bodyID1": 80, + "bodyID2": 81, + "id": 161, + "position": [ + -0.19753593106417455, + -1.1633663366336642, + -0.28472060338330835 + ], + "stiffnessModifier": [ + 1.0, + 1.0, + 1.0 + ] + }, + { + "bodyID1": 81, + "bodyID2": 162, + "id": 163, + "position": [ + 7.35091209884241e-17, + -1.2004950495049513, + 0.0 + ], + "stiffnessModifier": [ + 1.0, + 1.0, + 1.0 + ] + } + ], + "HingeJoints": [], + "MayaExport": 1, + "MayaFPS": 25, + "Name": "Wilberforce", + "RigidBodies": [ + { + "angularVelocity": [ + 0, + 0, + 0 + ], + "collisionCategoryBits": 1, + "collisionFilterMaskBits": -1, + "collisionObjectFileName": "", + "collisionObjectScale": [ + 0.1, + 0.25514267485257797, + 0.1 + ], + "collisionObjectType": 5, + "density": 7800, + "friction": 0.5, + "geometryFile": "../models/cylinder_unit_box.obj", + "id": 1, + "isDynamic": 1, + "restitution": 0.78, + "rotationAngle": 2.176698385685082, + "rotationAxis": [ + 0.6616024770427719, + -0.45642723475679253, + -0.5949423011882214 + ], + "scale": [ + 0.1, + 0.25514267485257797, + 0.1 + ], + "testMesh": 1, + "translation": [ + 0.0019247291980632464, + -0.03094059405940594, + 0.12374740881932543 + ], + "velocity": [ + 0, + 0, + 0 + ] + }, + { + "angularVelocity": [ + 0, + 0, + 0 + ], + "collisionCategoryBits": 1, + "collisionFilterMaskBits": -1, + "collisionObjectFileName": "", + "collisionObjectScale": [ + 0.1, + 0.32059105843278135, + 0.1 + ], + "collisionObjectType": 5, + "density": 7800, + "friction": 0.5, + "geometryFile": "../models/cylinder_unit_box.obj", + "id": 2, + "isDynamic": 1, + "restitution": 0.78, + "rotationAngle": 3.320125647109884, + "rotationAxis": [ + 0.7451262471764586, + -0.6615315076852156, + -0.08463415450308873 + ], + "scale": [ + 0.1, + 0.32059105843278135, + 0.1 + ], + "testMesh": 1, + "translation": [ + -0.15533104324644234, + -0.08044554455445545, + 0.24409051834022283 + ], + "velocity": [ + 0, + 0, + 0 + ] + }, + { + "angularVelocity": [ + 0, + 0, + 0 + ], + "collisionCategoryBits": 1, + "collisionFilterMaskBits": -1, + "collisionObjectFileName": "", + "collisionObjectScale": [ + 0.1, + 0.2896134118263093, + 0.1 + ], + "collisionObjectType": 5, + "density": 7800, + "friction": 0.5, + "geometryFile": "../models/cylinder_unit_box.obj", + "id": 3, + "isDynamic": 1, + "restitution": 0.78, + "rotationAngle": 3.9476674233488165, + "rotationAxis": [ + 0.77031792442471, + -0.5988307578844478, + 0.21911645013906317 + ], + "scale": [ + 0.1, + 0.2896134118263093, + 0.1 + ], + "testMesh": 1, + "translation": [ + -0.4046607928138095, + -0.1113861386138614, + 0.12804109523125315 + ], + "velocity": [ + 0, + 0, + 0 + ] + }, + { + "angularVelocity": [ + 0, + 0, + 0 + ], + "collisionCategoryBits": 1, + "collisionFilterMaskBits": -1, + "collisionObjectFileName": "", + "collisionObjectScale": [ + 0.1, + 0.3472838460136591, + 0.1 + ], + "collisionObjectType": 5, + "density": 7800, + "friction": 0.5, + "geometryFile": "../models/cylinder_unit_box.obj", + "id": 4, + "isDynamic": 1, + "restitution": 0.78, + "rotationAngle": 4.350298402817463, + "rotationAxis": [ + 0.73950324864577, + -0.4571017533484153, + 0.49415881286096386 + ], + "scale": [ + 0.1, + 0.3472838460136591, + 0.1 + ], + "testMesh": 1, + "translation": [ + -0.49405491624003595, + -0.13613861386138615, + -0.15780268895165267 + ], + "velocity": [ + 0, + 0, + 0 + ] + }, + { + "angularVelocity": [ + 0, + 0, + 0 + ], + "collisionCategoryBits": 1, + "collisionFilterMaskBits": -1, + "collisionObjectFileName": "", + "collisionObjectScale": [ + 0.1, + 0.40581059544185755, + 0.1 + ], + "collisionObjectType": 5, + "density": 7800, + "friction": 0.5, + "geometryFile": "../models/cylinder_unit_box.obj", + "id": 5, + "isDynamic": 1, + "restitution": 0.78, + "rotationAngle": 4.602133383292902, + "rotationAxis": [ + 0.6094522905479435, + -0.2101817694245385, + 0.7644550538438708 + ], + "scale": [ + 0.1, + 0.40581059544185755, + 0.1 + ], + "testMesh": 1, + "translation": [ + -0.3679808436103229, + -0.16089108910891092, + -0.4901005316751631 + ], + "velocity": [ + 0, + 0, + 0 + ] + }, + { + "angularVelocity": [ + 0, + 0, + 0 + ], + "collisionCategoryBits": 1, + "collisionFilterMaskBits": -1, + "collisionObjectFileName": "", + "collisionObjectScale": [ + 0.1, + 0.46487034463620586, + 0.1 + ], + "collisionObjectType": 5, + "density": 7800, + "friction": 0.5, + "geometryFile": "../models/cylinder_unit_box.obj", + "id": 6, + "isDynamic": 1, + "restitution": 0.78, + "rotationAngle": 4.646628715484816, + "rotationAxis": [ + 0.3559101608438169, + 0.10815813466164671, + 0.9282401495920339 + ], + "scale": [ + 0.1, + 0.46487034463620586, + 0.1 + ], + "testMesh": 1, + "translation": [ + -0.01783711676420012, + -0.1856435643564357, + -0.7068777596640202 + ], + "velocity": [ + 0, + 0, + 0 + ] + }, + { + "angularVelocity": [ + 0, + 0, + 0 + ], + "collisionCategoryBits": 1, + "collisionFilterMaskBits": -1, + "collisionObjectFileName": "", + "collisionObjectScale": [ + 0.1, + 0.2580313207528291, + 0.1 + ], + "collisionObjectType": 5, + "density": 7800, + "friction": 0.5, + "geometryFile": "../models/cylinder_unit_box.obj", + "id": 7, + "isDynamic": 1, + "restitution": 0.78, + "rotationAngle": 4.54071706378374, + "rotationAxis": [ + 0.13057385034669974, + 0.32394304795348305, + 0.937022609806319 + ], + "scale": [ + 0.1, + 0.2580313207528291, + 0.1 + ], + "testMesh": 1, + "translation": [ + 0.33249064055094724, + -0.20420792079207922, + -0.7353025974362892 + ], + "velocity": [ + 0, + 0, + 0 + ] + }, + { + "angularVelocity": [ + 0, + 0, + 0 + ], + "collisionCategoryBits": 1, + "collisionFilterMaskBits": -1, + "collisionObjectFileName": "", + "collisionObjectScale": [ + 0.1, + 0.273088252910989, + 0.1 + ], + "collisionObjectType": 5, + "density": 7800, + "friction": 0.5, + "geometryFile": "../models/cylinder_unit_box.obj", + "id": 8, + "isDynamic": 1, + "restitution": 0.78, + "rotationAngle": 4.413752423147752, + "rotationAxis": [ + -0.013329436733712714, + 0.4385377080632731, + 0.8986139353042403 + ], + "scale": [ + 0.1, + 0.273088252910989, + 0.1 + ], + "testMesh": 1, + "translation": [ + 0.5742301741263495, + -0.2165841584158416, + -0.6346696379423012 + ], + "velocity": [ + 0, + 0, + 0 + ] + }, + { + "angularVelocity": [ + 0, + 0, + 0 + ], + "collisionCategoryBits": 1, + "collisionFilterMaskBits": -1, + "collisionObjectFileName": "", + "collisionObjectScale": [ + 0.1, + 0.2881746673071598, + 0.1 + ], + "collisionObjectType": 5, + "density": 7800, + "friction": 0.5, + "geometryFile": "../models/cylinder_unit_box.obj", + "id": 9, + "isDynamic": 1, + "restitution": 0.78, + "rotationAngle": 4.253144299486996, + "rotationAxis": [ + -0.14213828361809866, + 0.5266619456794989, + 0.8381073339991637 + ], + "scale": [ + 0.1, + 0.2881746673071598, + 0.1 + ], + "testMesh": 1, + "translation": [ + 0.7831476511808808, + -0.22896039603960397, + -0.45313947284426437 + ], + "velocity": [ + 0, + 0, + 0 + ] + }, + { + "angularVelocity": [ + 0, + 0, + 0 + ], + "collisionCategoryBits": 1, + "collisionFilterMaskBits": -1, + "collisionObjectFileName": "", + "collisionObjectScale": [ + 0.1, + 0.30328616435356703, + 0.1 + ], + "collisionObjectType": 5, + "density": 7800, + "friction": 0.5, + "geometryFile": "../models/cylinder_unit_box.obj", + "id": 10, + "isDynamic": 1, + "restitution": 0.78, + "rotationAngle": 4.067557078959673, + "rotationAxis": [ + -0.2544433652351181, + 0.5915470260183228, + 0.7650690752453048 + ], + "scale": [ + 0.1, + 0.30328616435356703, + 0.1 + ], + "testMesh": 1, + "translation": [ + 0.9320061663991941, + -0.24133663366336636, + -0.20227157792079192 + ], + "velocity": [ + 0, + 0, + 0 + ] + }, + { + "angularVelocity": [ + 0, + 0, + 0 + ], + "collisionCategoryBits": 1, + "collisionFilterMaskBits": -1, + "collisionObjectFileName": "", + "collisionObjectScale": [ + 0.1, + 0.30866608220340425, + 0.1 + ], + "collisionObjectType": 5, + "density": 7800, + "friction": 0.5, + "geometryFile": "../models/cylinder_unit_box.obj", + "id": 11, + "isDynamic": 1, + "restitution": 0.78, + "rotationAngle": 3.781327540083696, + "rotationAxis": [ + -0.3858151931627455, + 0.6503011932094196, + 0.654411945822506 + ], + "scale": [ + 0.1, + 0.30866608220340425, + 0.1 + ], + "testMesh": 1, + "translation": [ + 0.9786913793689394, + -0.2537128712871287, + 0.092362405182596 + ], + "velocity": [ + 0, + 0, + 0 + ] + }, + { + "angularVelocity": [ + 0, + 0, + 0 + ], + "collisionCategoryBits": 1, + "collisionFilterMaskBits": -1, + "collisionObjectFileName": "", + "collisionObjectScale": [ + 0.1, + 0.31004347468098803, + 0.1 + ], + "collisionObjectType": 5, + "density": 7800, + "friction": 0.5, + "geometryFile": "../models/cylinder_unit_box.obj", + "id": 12, + "isDynamic": 1, + "restitution": 0.78, + "rotationAngle": 3.5442742353665095, + "rotationAxis": [ + -0.4725149659218057, + 0.6770376355063591, + 0.5642248196312116 + ], + "scale": [ + 0.1, + 0.31004347468098803, + 0.1 + ], + "testMesh": 1, + "translation": [ + 0.9082568520787213, + -0.2660891089108911, + 0.38868501954463947 + ], + "velocity": [ + 0, + 0, + 0 + ] + }, + { + "angularVelocity": [ + 0, + 0, + 0 + ], + "collisionCategoryBits": 1, + "collisionFilterMaskBits": -1, + "collisionObjectFileName": "", + "collisionObjectScale": [ + 0.1, + 0.31004347468098714, + 0.1 + ], + "collisionObjectType": 5, + "density": 7800, + "friction": 0.5, + "geometryFile": "../models/cylinder_unit_box.obj", + "id": 13, + "isDynamic": 1, + "restitution": 0.78, + "rotationAngle": 3.322878311144199, + "rotationAxis": [ + -0.5422600483108113, + 0.6897431192284669, + 0.4798004475643406 + ], + "scale": [ + 0.1, + 0.31004347468098714, + 0.1 + ], + "testMesh": 1, + "translation": [ + 0.7457125582040867, + -0.2784653465346535, + 0.6480118319159626 + ], + "velocity": [ + 0, + 0, + 0 + ] + }, + { + "angularVelocity": [ + 0, + 0, + 0 + ], + "collisionCategoryBits": 1, + "collisionFilterMaskBits": -1, + "collisionObjectFileName": "", + "collisionObjectScale": [ + 0.1, + 0.31004347468098803, + 0.1 + ], + "collisionObjectType": 5, + "density": 7800, + "friction": 0.5, + "geometryFile": "../models/cylinder_unit_box.obj", + "id": 14, + "isDynamic": 1, + "restitution": 0.78, + "rotationAngle": 3.0989699211453017, + "rotationAxis": [ + -0.6052256869261916, + 0.6926795088416826, + 0.3922970378623381 + ], + "scale": [ + 0.1, + 0.31004347468098803, + 0.1 + ], + "testMesh": 1, + "translation": [ + 0.5115994076453869, + -0.2908415841584159, + 0.8451464960959455 + ], + "velocity": [ + 0, + 0, + 0 + ] + }, + { + "angularVelocity": [ + 0, + 0, + 0 + ], + "collisionCategoryBits": 1, + "collisionFilterMaskBits": -1, + "collisionObjectFileName": "", + "collisionObjectScale": [ + 0.1, + 0.310043474680988, + 0.1 + ], + "collisionObjectType": 5, + "density": 7800, + "friction": 0.5, + "geometryFile": "../models/cylinder_unit_box.obj", + "id": 15, + "isDynamic": 1, + "restitution": 0.78, + "rotationAngle": 2.8756461606993238, + "rotationAxis": [ + -0.6625348647063218, + 0.6861033452755824, + 0.30051581098210267 + ], + "scale": [ + 0.1, + 0.310043474680988, + 0.1 + ], + "testMesh": 1, + "translation": [ + 0.22838612556469037, + -0.3032178217821783, + 0.9611692522214359 + ], + "velocity": [ + 0, + 0, + 0 + ] + }, + { + "angularVelocity": [ + 0, + 0, + 0 + ], + "collisionCategoryBits": 1, + "collisionFilterMaskBits": -1, + "collisionObjectFileName": "", + "collisionObjectScale": [ + 0.1, + 0.310043474680988, + 0.1 + ], + "collisionObjectType": 5, + "density": 7800, + "friction": 0.5, + "geometryFile": "../models/cylinder_unit_box.obj", + "id": 16, + "isDynamic": 1, + "restitution": 0.78, + "rotationAngle": 2.6560551725861234, + "rotationAxis": [ + -0.7146357672954456, + 0.6694407658884086, + 0.20284176362078546 + ], + "scale": [ + 0.1, + 0.310043474680988, + 0.1 + ], + "testMesh": 1, + "translation": [ + -0.07674623741298484, + -0.3155940594059407, + 0.984944957248533 + ], + "velocity": [ + 0, + 0, + 0 + ] + }, + { + "angularVelocity": [ + 0, + 0, + 0 + ], + "collisionCategoryBits": 1, + "collisionFilterMaskBits": -1, + "collisionObjectFileName": "", + "collisionObjectScale": [ + 0.1, + 0.3100434746809872, + 0.1 + ], + "collisionObjectType": 5, + "density": 7800, + "friction": 0.5, + "geometryFile": "../models/cylinder_unit_box.obj", + "id": 17, + "isDynamic": 1, + "restitution": 0.78, + "rotationAngle": 2.4436693188635337, + "rotationAxis": [ + -0.7611210897274905, + 0.6412523445010094, + 0.09741723381412644 + ], + "scale": [ + 0.1, + 0.3100434746809872, + 0.1 + ], + "testMesh": 1, + "translation": [ + -0.3745129735066507, + -0.32797029702970315, + 0.9141917667762993 + ], + "velocity": [ + 0, + 0, + 0 + ] + }, + { + "angularVelocity": [ + 0, + 0, + 0 + ], + "collisionCategoryBits": 1, + "collisionFilterMaskBits": -1, + "collisionObjectFileName": "", + "collisionObjectScale": [ + 0.1, + 0.31004347468098714, + 0.1 + ], + "collisionObjectType": 5, + "density": 7800, + "friction": 0.5, + "geometryFile": "../models/cylinder_unit_box.obj", + "id": 18, + "isDynamic": 1, + "restitution": 0.78, + "rotationAngle": 2.242574339050333, + "rotationAxis": [ + -0.8004212318396853, + 0.5991799568757226, + -0.017584962287368784 + ], + "scale": [ + 0.1, + 0.31004347468098714, + 0.1 + ], + "testMesh": 1, + "translation": [ + -0.6363362820257936, + -0.34034653465346554, + 0.7557001322905499 + ], + "velocity": [ + 0, + 0, + 0 + ] + }, + { + "angularVelocity": [ + 0, + 0, + 0 + ], + "collisionCategoryBits": 1, + "collisionFilterMaskBits": -1, + "collisionObjectFileName": "", + "collisionObjectScale": [ + 0.1, + 0.3100434746809872, + 0.1 + ], + "collisionObjectType": 5, + "density": 7800, + "friction": 0.5, + "geometryFile": "../models/cylinder_unit_box.obj", + "id": 19, + "isDynamic": 1, + "restitution": 0.78, + "rotationAngle": 2.0577652650524003, + "rotationAxis": [ + -0.8293651325690412, + 0.5399858409568609, + -0.14341815939708755 + ], + "scale": [ + 0.1, + 0.3100434746809872, + 0.1 + ], + "testMesh": 1, + "translation": [ + -0.8370879890677483, + -0.3527227722772279, + 0.5246810958333437 + ], + "velocity": [ + 0, + 0, + 0 + ] + }, + { + "angularVelocity": [ + 0, + 0, + 0 + ], + "collisionCategoryBits": 1, + "collisionFilterMaskBits": -1, + "collisionObjectFileName": "", + "collisionObjectScale": [ + 0.1, + 0.3100434746809889, + 0.1 + ], + "collisionObjectType": 5, + "density": 7800, + "friction": 0.5, + "geometryFile": "../models/cylinder_unit_box.obj", + "id": 20, + "isDynamic": 1, + "restitution": 0.78, + "rotationAngle": 1.895383770514096, + "rotationAxis": [ + -0.8427386110510756, + 0.4599316285943241, + -0.2797401123583754 + ], + "scale": [ + 0.1, + 0.3100434746809889, + 0.1 + ], + "testMesh": 1, + "translation": [ + -0.9575011934756283, + -0.3650990099009903, + 0.24330642872540836 + ], + "velocity": [ + 0, + 0, + 0 + ] + }, + { + "angularVelocity": [ + 0, + 0, + 0 + ], + "collisionCategoryBits": 1, + "collisionFilterMaskBits": -1, + "collisionObjectFileName": "", + "collisionObjectScale": [ + 0.1, + 0.3100434746809872, + 0.1 + ], + "collisionObjectType": 5, + "density": 7800, + "friction": 0.5, + "geometryFile": "../models/cylinder_unit_box.obj", + "id": 21, + "isDynamic": 1, + "restitution": 0.78, + "rotationAngle": 1.7627237430502283, + "rotationAxis": [ + -0.8332892438069258, + 0.3559085430639104, + -0.4230344491052783 + ], + "scale": [ + 0.1, + 0.3100434746809872, + 0.1 + ], + "testMesh": 1, + "translation": [ + -0.9860193842663125, + -0.3774752475247527, + -0.0614192772462103 + ], + "velocity": [ + 0, + 0, + 0 + ] + }, + { + "angularVelocity": [ + 0, + 0, + 0 + ], + "collisionCategoryBits": 1, + "collisionFilterMaskBits": -1, + "collisionObjectFileName": "", + "collisionObjectScale": [ + 0.1, + 0.31004347468098714, + 0.1 + ], + "collisionObjectType": 5, + "density": 7800, + "friction": 0.5, + "geometryFile": "../models/cylinder_unit_box.obj", + "id": 22, + "isDynamic": 1, + "restitution": 0.78, + "rotationAngle": 1.667699392987108, + "rotationAxis": [ + -0.7930592890298371, + 0.2276402069144075, + -0.5650105311226111 + ], + "scale": [ + 0.1, + 0.31004347468098714, + 0.1 + ], + "testMesh": 1, + "translation": [ + -0.9199055627301338, + -0.3898514851485151, + -0.36025034271256545 + ], + "velocity": [ + 0, + 0, + 0 + ] + }, + { + "angularVelocity": [ + 0, + 0, + 0 + ], + "collisionCategoryBits": 1, + "collisionFilterMaskBits": -1, + "collisionObjectFileName": "", + "collisionObjectScale": [ + 0.1, + 0.31004347468098725, + 0.1 + ], + "collisionObjectType": 5, + "density": 7800, + "friction": 0.5, + "geometryFile": "../models/cylinder_unit_box.obj", + "id": 23, + "isDynamic": 1, + "restitution": 0.78, + "rotationAngle": 1.6174874559858867, + "rotationAxis": [ + -0.7167719726089654, + 0.08034381911276753, + -0.6926635619206682 + ], + "scale": [ + 0.1, + 0.31004347468098725, + 0.1 + ], + "testMesh": 1, + "translation": [ + -0.7655049225564061, + -0.4022277227722775, + -0.6245068192648305 + ], + "velocity": [ + 0, + 0, + 0 + ] + }, + { + "angularVelocity": [ + 0, + 0, + 0 + ], + "collisionCategoryBits": 1, + "collisionFilterMaskBits": -1, + "collisionObjectFileName": "", + "collisionObjectScale": [ + 0.1, + 0.31004347468098886, + 0.1 + ], + "collisionObjectType": 5, + "density": 7800, + "friction": 0.5, + "geometryFile": "../models/cylinder_unit_box.obj", + "id": 24, + "isDynamic": 1, + "restitution": 0.78, + "rotationAngle": 1.616528858554694, + "rotationAxis": [ + -0.6060717165028568, + -0.07446696893306963, + -0.791916501275988 + ], + "scale": [ + 0.1, + 0.31004347468098886, + 0.1 + ], + "testMesh": 1, + "translation": [ + -0.5376358775789173, + -0.41460396039603986, + -0.8288270126548194 + ], + "velocity": [ + 0, + 0, + 0 + ] + }, + { + "angularVelocity": [ + 0, + 0, + 0 + ], + "collisionCategoryBits": 1, + "collisionFilterMaskBits": -1, + "collisionObjectFileName": "", + "collisionObjectScale": [ + 0.1, + 0.31004347468098714, + 0.1 + ], + "collisionObjectType": 5, + "density": 7800, + "friction": 0.5, + "geometryFile": "../models/cylinder_unit_box.obj", + "id": 25, + "isDynamic": 1, + "restitution": 0.78, + "rotationAngle": 1.664913353923805, + "rotationAxis": [ + -0.47082289003468686, + -0.22229785401237256, + -0.853761951788014 + ], + "scale": [ + 0.1, + 0.31004347468098714, + 0.1 + ], + "testMesh": 1, + "translation": [ + -0.2581678825135766, + -0.4269801980198022, + -0.9536015405843371 + ], + "velocity": [ + 0, + 0, + 0 + ] + }, + { + "angularVelocity": [ + 0, + 0, + 0 + ], + "collisionCategoryBits": 1, + "collisionFilterMaskBits": -1, + "collisionObjectFileName": "", + "collisionObjectScale": [ + 0.1, + 0.31004347468098714, + 0.1 + ], + "collisionObjectType": 5, + "density": 7800, + "friction": 0.5, + "geometryFile": "../models/cylinder_unit_box.obj", + "id": 26, + "isDynamic": 1, + "restitution": 0.78, + "rotationAngle": 1.7583438608589204, + "rotationAxis": [ + -0.32515908751285, + -0.35143247162527047, + -0.8779332467193414 + ], + "scale": [ + 0.1, + 0.31004347468098714, + 0.1 + ], + "testMesh": 1, + "translation": [ + 0.04607746138512707, + -0.4393564356435646, + -0.9868553193445668 + ], + "velocity": [ + 0, + 0, + 0 + ] + }, + { + "angularVelocity": [ + 0, + 0, + 0 + ], + "collisionCategoryBits": 1, + "collisionFilterMaskBits": -1, + "collisionObjectFileName": "", + "collisionObjectScale": [ + 0.1, + 0.31004347468098714, + 0.1 + ], + "collisionObjectType": 5, + "density": 7800, + "friction": 0.5, + "geometryFile": "../models/cylinder_unit_box.obj", + "id": 27, + "isDynamic": 1, + "restitution": 0.78, + "rotationAngle": 1.8897097879571159, + "rotationAxis": [ + -0.18151033817457635, + -0.456405541837509, + -0.8710614091530866 + ], + "scale": [ + 0.1, + 0.31004347468098714, + 0.1 + ], + "testMesh": 1, + "translation": [ + 0.34590057691452497, + -0.4517326732673269, + -0.9253968579245144 + ], + "velocity": [ + 0, + 0, + 0 + ] + }, + { + "angularVelocity": [ + 0, + 0, + 0 + ], + "collisionCategoryBits": 1, + "collisionFilterMaskBits": -1, + "collisionObjectFileName": "", + "collisionObjectScale": [ + 0.1, + 0.31004347468098886, + 0.1 + ], + "collisionObjectType": 5, + "density": 7800, + "friction": 0.5, + "geometryFile": "../models/cylinder_unit_box.obj", + "id": 28, + "isDynamic": 1, + "restitution": 0.78, + "rotationAngle": 2.051094511933818, + "rotationAxis": [ + -0.0473496625794636, + -0.5373296782215117, + -0.8420420573557936 + ], + "scale": [ + 0.1, + 0.31004347468098886, + 0.1 + ], + "testMesh": 1, + "translation": [ + 0.6125263048663955, + -0.4641089108910893, + -0.7751245574829146 + ], + "velocity": [ + 0, + 0, + 0 + ] + }, + { + "angularVelocity": [ + 0, + 0, + 0 + ], + "collisionCategoryBits": 1, + "collisionFilterMaskBits": -1, + "collisionObjectFileName": "", + "collisionObjectScale": [ + 0.1, + 0.31004347468098714, + 0.1 + ], + "collisionObjectType": 5, + "density": 7800, + "friction": 0.5, + "geometryFile": "../models/cylinder_unit_box.obj", + "id": 29, + "isDynamic": 1, + "restitution": 0.78, + "rotationAngle": 2.235166020855436, + "rotationAxis": [ + 0.07455770426620026, + -0.59725259514806, + -0.7985802942243575 + ], + "scale": [ + 0.1, + 0.31004347468098714, + 0.1 + ], + "testMesh": 1, + "translation": [ + 0.8203655649682697, + -0.4764851485148517, + -0.550460619463969 + ], + "velocity": [ + 0, + 0, + 0 + ] + }, + { + "angularVelocity": [ + 0, + 0, + 0 + ], + "collisionCategoryBits": 1, + "collisionFilterMaskBits": -1, + "collisionObjectFileName": "", + "collisionObjectScale": [ + 0.1, + 0.3100434746809872, + 0.1 + ], + "collisionObjectType": 5, + "density": 7800, + "friction": 0.5, + "geometryFile": "../models/cylinder_unit_box.obj", + "id": 30, + "isDynamic": 1, + "restitution": 0.78, + "rotationAngle": 2.4357363249357507, + "rotationAxis": [ + 0.18442149931309842, + -0.63991566811517, + -0.7459870295734534 + ], + "scale": [ + 0.1, + 0.3100434746809872, + 0.1 + ], + "testMesh": 1, + "translation": [ + 0.9494712367701762, + -0.4888613861386141, + -0.27296689233765503 + ], + "velocity": [ + 0, + 0, + 0 + ] + }, + { + "angularVelocity": [ + 0, + 0, + 0 + ], + "collisionCategoryBits": 1, + "collisionFilterMaskBits": -1, + "collisionObjectFileName": "", + "collisionObjectScale": [ + 0.1, + 0.31004347468098714, + 0.1 + ], + "collisionObjectType": 5, + "density": 7800, + "friction": 0.5, + "geometryFile": "../models/cylinder_unit_box.obj", + "id": 31, + "isDynamic": 1, + "restitution": 0.78, + "rotationAngle": 2.6477701129570548, + "rotationAxis": [ + 0.28383821547447513, + -0.6685861216629271, + -0.6873343184768175 + ], + "scale": [ + 0.1, + 0.31004347468098714, + 0.1 + ], + "testMesh": 1, + "translation": [ + 0.98745256029277, + -0.5012376237623763, + 0.030724500608122762 + ], + "velocity": [ + 0, + 0, + 0 + ] + }, + { + "angularVelocity": [ + 0, + 0, + 0 + ], + "collisionCategoryBits": 1, + "collisionFilterMaskBits": -1, + "collisionObjectFileName": "", + "collisionObjectScale": [ + 0.1, + 0.3100434746809872, + 0.1 + ], + "collisionObjectType": 5, + "density": 7800, + "friction": 0.5, + "geometryFile": "../models/cylinder_unit_box.obj", + "id": 32, + "isDynamic": 1, + "restitution": 0.78, + "rotationAngle": 2.867152222262333, + "rotationAxis": [ + 0.37480765498905555, + -0.6856576364787121, + -0.6240134832678148 + ], + "scale": [ + 0.1, + 0.3100434746809872, + 0.1 + ], + "testMesh": 1, + "translation": [ + 0.9306643241607644, + -0.5136138613861387, + 0.3314671469403154 + ], + "velocity": [ + 0, + 0, + 0 + ] + }, + { + "angularVelocity": [ + 0, + 0, + 0 + ], + "collisionCategoryBits": 1, + "collisionFilterMaskBits": -1, + "collisionObjectFileName": "", + "collisionObjectScale": [ + 0.1, + 0.3100434746809871, + 0.1 + ], + "collisionObjectType": 5, + "density": 7800, + "friction": 0.5, + "geometryFile": "../models/cylinder_unit_box.obj", + "id": 33, + "isDynamic": 1, + "restitution": 0.78, + "rotationAngle": 3.090392252713499, + "rotationAxis": [ + 0.45923252620732563, + -0.6926039351169353, + -0.5562421019068713 + ], + "scale": [ + 0.1, + 0.3100434746809871, + 0.1 + ], + "testMesh": 1, + "translation": [ + 0.7845567103355044, + -0.5259900990099012, + 0.6003976365991927 + ], + "velocity": [ + 0, + 0, + 0 + ] + }, + { + "angularVelocity": [ + 0, + 0, + 0 + ], + "collisionCategoryBits": 1, + "collisionFilterMaskBits": -1, + "collisionObjectFileName": "", + "collisionObjectScale": [ + 0.1, + 0.31004347468098714, + 0.1 + ], + "collisionObjectType": 5, + "density": 7800, + "friction": 0.5, + "geometryFile": "../models/cylinder_unit_box.obj", + "id": 34, + "isDynamic": 1, + "restitution": 0.78, + "rotationAngle": 3.314334755556532, + "rotationAxis": [ + 0.5386781303183542, + -0.6900310726227518, + -0.4834076858427231 + ], + "scale": [ + 0.1, + 0.31004347468098714, + 0.1 + ], + "testMesh": 1, + "translation": [ + 0.5631522195235548, + -0.5383663366336636, + 0.8117056926078929 + ], + "velocity": [ + 0, + 0, + 0 + ] + }, + { + "angularVelocity": [ + 0, + 0, + 0 + ], + "collisionCategoryBits": 1, + "collisionFilterMaskBits": -1, + "collisionObjectFileName": "", + "collisionObjectScale": [ + 0.1, + 0.3100434746809889, + 0.1 + ], + "collisionObjectType": 5, + "density": 7800, + "friction": 0.5, + "geometryFile": "../models/cylinder_unit_box.obj", + "id": 35, + "isDynamic": 1, + "restitution": 0.78, + "rotationAngle": 3.5358856158648377, + "rotationAxis": [ + 0.6142209958566808, + -0.6777142534715207, + -0.40427213469439965 + ], + "scale": [ + 0.1, + 0.3100434746809889, + 0.1 + ], + "testMesh": 1, + "translation": [ + 0.2876998787096414, + -0.550742574257426, + 0.9451112810441014 + ], + "velocity": [ + 0, + 0, + 0 + ] + }, + { + "angularVelocity": [ + 0, + 0, + 0 + ], + "collisionCategoryBits": 1, + "collisionFilterMaskBits": -1, + "collisionObjectFileName": "", + "collisionObjectScale": [ + 0.1, + 0.3100434746809871, + 0.1 + ], + "collisionObjectType": 5, + "density": 7800, + "friction": 0.5, + "geometryFile": "../models/cylinder_unit_box.obj", + "id": 36, + "isDynamic": 1, + "restitution": 0.78, + "rotationAngle": 3.7517422941456884, + "rotationAxis": [ + 0.6862701876304093, + -0.6545832024200954, + -0.3171026027631675 + ], + "scale": [ + 0.1, + 0.3100434746809871, + 0.1 + ], + "testMesh": 1, + "translation": [ + -0.015364108389244305, + -0.5631188118811884, + 0.9878109626541753 + ], + "velocity": [ + 0, + 0, + 0 + ] + }, + { + "angularVelocity": [ + 0, + 0, + 0 + ], + "collisionCategoryBits": 1, + "collisionFilterMaskBits": -1, + "collisionObjectFileName": "", + "collisionObjectScale": [ + 0.1, + 0.31004347468098714, + 0.1 + ], + "collisionObjectType": 5, + "density": 7800, + "friction": 0.5, + "geometryFile": "../models/cylinder_unit_box.obj", + "id": 37, + "isDynamic": 1, + "restitution": 0.78, + "rotationAngle": 3.958112057729686, + "rotationAxis": [ + 0.7542735864790023, + -0.6186686574711826, + -0.21981912792772965 + ], + "scale": [ + 0.1, + 0.31004347468098714, + 0.1 + ], + "testMesh": 1, + "translation": [ + -0.3169535438538689, + -0.5754950495049508, + 0.935706687378496 + ], + "velocity": [ + 0, + 0, + 0 + ] + }, + { + "angularVelocity": [ + 0, + 0, + 0 + ], + "collisionCategoryBits": 1, + "collisionFilterMaskBits": -1, + "collisionObjectFileName": "", + "collisionObjectScale": [ + 0.1, + 0.3100434746809889, + 0.1 + ], + "collisionObjectType": 5, + "density": 7800, + "friction": 0.5, + "geometryFile": "../models/cylinder_unit_box.obj", + "id": 38, + "isDynamic": 1, + "restitution": 0.78, + "rotationAngle": 4.150415197983216, + "rotationAxis": [ + 0.8162430938384999, + -0.5670822018277566, + -0.11029500501444846 + ], + "scale": [ + 0.1, + 0.3100434746809889, + 0.1 + ], + "testMesh": 1, + "translation": [ + -0.5881237480664226, + -0.5878712871287132, + 0.7937990997265414 + ], + "velocity": [ + 0, + 0, + 0 + ] + }, + { + "angularVelocity": [ + 0, + 0, + 0 + ], + "collisionCategoryBits": 1, + "collisionFilterMaskBits": -1, + "collisionObjectFileName": "", + "collisionObjectScale": [ + 0.1, + 0.31004347468098714, + 0.1 + ], + "collisionObjectType": 5, + "density": 7800, + "friction": 0.5, + "geometryFile": "../models/cylinder_unit_box.obj", + "id": 39, + "isDynamic": 1, + "restitution": 0.78, + "rotationAngle": 4.323009574022748, + "rotationAxis": [ + 0.8681046505397725, + -0.496211412798289, + 0.012982662282665772 + ], + "scale": [ + 0.1, + 0.31004347468098714, + 0.1 + ], + "testMesh": 1, + "translation": [ + -0.8028494901671537, + -0.6002475247524756, + 0.5757076079962 + ], + "velocity": [ + 0, + 0, + 0 + ] + }, + { + "angularVelocity": [ + 0, + 0, + 0 + ], + "collisionCategoryBits": 1, + "collisionFilterMaskBits": -1, + "collisionObjectFileName": "", + "collisionObjectScale": [ + 0.1, + 0.31004347468098714, + 0.1 + ], + "collisionObjectType": 5, + "density": 7800, + "friction": 0.5, + "geometryFile": "../models/cylinder_unit_box.obj", + "id": 40, + "isDynamic": 1, + "restitution": 0.78, + "rotationAngle": 4.469057945597955, + "rotationAxis": [ + 0.9031129754708705, + -0.40247956377146954, + 0.14965678829401147 + ], + "scale": [ + 0.1, + 0.31004347468098714, + 0.1 + ], + "testMesh": 1, + "translation": [ + -0.9405227279637765, + -0.6126237623762381, + 0.3023632781108531 + ], + "velocity": [ + 0, + 0, + 0 + ] + }, + { + "angularVelocity": [ + 0, + 0, + 0 + ], + "collisionCategoryBits": 1, + "collisionFilterMaskBits": -1, + "collisionObjectFileName": "", + "collisionObjectScale": [ + 0.1, + 0.31004347468098714, + 0.1 + ], + "collisionObjectType": 5, + "density": 7800, + "friction": 0.5, + "geometryFile": "../models/cylinder_unit_box.obj", + "id": 41, + "isDynamic": 1, + "restitution": 0.78, + "rotationAngle": 4.580791872108043, + "rotationAxis": [ + 0.9120690141274866, + -0.2840939437823437, + 0.29566999268561084 + ], + "scale": [ + 0.1, + 0.31004347468098714, + 0.1 + ], + "testMesh": 1, + "translation": [ + -0.9879304397407567, + -0.6250000000000004, + -7.299716386910404e-15 + ], + "velocity": [ + 0, + 0, + 0 + ] + }, + { + "angularVelocity": [ + 0, + 0, + 0 + ], + "collisionCategoryBits": 1, + "collisionFilterMaskBits": -1, + "collisionObjectFileName": "", + "collisionObjectScale": [ + 0.1, + 0.31004347468098714, + 0.1 + ], + "collisionObjectType": 5, + "density": 7800, + "friction": 0.5, + "geometryFile": "../models/cylinder_unit_box.obj", + "id": 42, + "isDynamic": 1, + "restitution": 0.78, + "rotationAngle": 4.650505716543979, + "rotationAxis": [ + 0.8855408294774771, + -0.1436976412609186, + 0.44177870843261596 + ], + "scale": [ + 0.1, + 0.31004347468098714, + 0.1 + ], + "testMesh": 1, + "translation": [ + -0.940522727963772, + -0.6373762376237628, + -0.302363278110867 + ], + "velocity": [ + 0, + 0, + 0 + ] + }, + { + "angularVelocity": [ + 0, + 0, + 0 + ], + "collisionCategoryBits": 1, + "collisionFilterMaskBits": -1, + "collisionObjectFileName": "", + "collisionObjectScale": [ + 0.1, + 0.3100434746809889, + 0.1 + ], + "collisionObjectType": 5, + "density": 7800, + "friction": 0.5, + "geometryFile": "../models/cylinder_unit_box.obj", + "id": 43, + "isDynamic": 1, + "restitution": 0.78, + "rotationAngle": 4.672362987551147, + "rotationAxis": [ + 0.8184524643754914, + 0.00968522403918014, + 0.5744926109124434 + ], + "scale": [ + 0.1, + 0.3100434746809889, + 0.1 + ], + "testMesh": 1, + "translation": [ + -0.8028494901671446, + -0.6497524752475251, + -0.5757076079962125 + ], + "velocity": [ + 0, + 0, + 0 + ] + }, + { + "angularVelocity": [ + 0, + 0, + 0 + ], + "collisionCategoryBits": 1, + "collisionFilterMaskBits": -1, + "collisionObjectFileName": "", + "collisionObjectScale": [ + 0.1, + 0.31004347468098886, + 0.1 + ], + "collisionObjectType": 5, + "density": 7800, + "friction": 0.5, + "geometryFile": "../models/cylinder_unit_box.obj", + "id": 44, + "isDynamic": 1, + "restitution": 0.78, + "rotationAngle": 4.6443388038657565, + "rotationAxis": [ + 0.714371173510752, + 0.16214843708193372, + 0.6807214634553236 + ], + "scale": [ + 0.1, + 0.31004347468098886, + 0.1 + ], + "testMesh": 1, + "translation": [ + -0.5881237480664095, + -0.6621287128712875, + -0.7937990997265512 + ], + "velocity": [ + 0, + 0, + 0 + ] + }, + { + "angularVelocity": [ + 0, + 0, + 0 + ], + "collisionCategoryBits": 1, + "collisionFilterMaskBits": -1, + "collisionObjectFileName": "", + "collisionObjectScale": [ + 0.1, + 0.3100434746809854, + 0.1 + ], + "collisionObjectType": 5, + "density": 7800, + "friction": 0.5, + "geometryFile": "../models/cylinder_unit_box.obj", + "id": 45, + "isDynamic": 1, + "restitution": 0.78, + "rotationAngle": 4.5690115333695624, + "rotationAxis": [ + 0.5850322190359787, + 0.3001591469097377, + 0.7534200615966217 + ], + "scale": [ + 0.1, + 0.3100434746809854, + 0.1 + ], + "testMesh": 1, + "translation": [ + -0.3169535438538543, + -0.6745049504950499, + -0.9357066873785012 + ], + "velocity": [ + 0, + 0, + 0 + ] + }, + { + "angularVelocity": [ + 0, + 0, + 0 + ], + "collisionCategoryBits": 1, + "collisionFilterMaskBits": -1, + "collisionObjectFileName": "", + "collisionObjectScale": [ + 0.1, + 0.3100434746809889, + 0.1 + ], + "collisionObjectType": 5, + "density": 7800, + "friction": 0.5, + "geometryFile": "../models/cylinder_unit_box.obj", + "id": 46, + "isDynamic": 1, + "restitution": 0.78, + "rotationAngle": 4.452565350164573, + "rotationAxis": [ + 0.44482227203879815, + 0.4154991210299188, + 0.7934063440139651 + ], + "scale": [ + 0.1, + 0.3100434746809889, + 0.1 + ], + "testMesh": 1, + "translation": [ + -0.015364108389228817, + -0.6868811881188123, + -0.9878109626541755 + ], + "velocity": [ + 0, + 0, + 0 + ] + }, + { + "angularVelocity": [ + 0, + 0, + 0 + ], + "collisionCategoryBits": 1, + "collisionFilterMaskBits": -1, + "collisionObjectFileName": "", + "collisionObjectScale": [ + 0.1, + 0.3100434746809854, + 0.1 + ], + "collisionObjectType": 5, + "density": 7800, + "friction": 0.5, + "geometryFile": "../models/cylinder_unit_box.obj", + "id": 47, + "isDynamic": 1, + "restitution": 0.78, + "rotationAngle": 4.302798243256005, + "rotationAxis": [ + 0.3051866951487389, + 0.5062246647992157, + 0.8065963487724901 + ], + "scale": [ + 0.1, + 0.3100434746809854, + 0.1 + ], + "testMesh": 1, + "translation": [ + 0.28769987870965547, + -0.6992574257425747, + -0.9451112810440974 + ], + "velocity": [ + 0, + 0, + 0 + ] + }, + { + "angularVelocity": [ + 0, + 0, + 0 + ], + "collisionCategoryBits": 1, + "collisionFilterMaskBits": -1, + "collisionObjectFileName": "", + "collisionObjectScale": [ + 0.1, + 0.3100434746809889, + 0.1 + ], + "collisionObjectType": 5, + "density": 7800, + "friction": 0.5, + "geometryFile": "../models/cylinder_unit_box.obj", + "id": 48, + "isDynamic": 1, + "restitution": 0.78, + "rotationAngle": 4.127399048398732, + "rotationAxis": [ + 0.17258890897298293, + 0.5744844209288359, + 0.8001129411586688 + ], + "scale": [ + 0.1, + 0.3100434746809889, + 0.1 + ], + "testMesh": 1, + "translation": [ + 0.5631522195235659, + -0.711633663366337, + -0.8117056926078849 + ], + "velocity": [ + 0, + 0, + 0 + ] + }, + { + "angularVelocity": [ + 0, + 0, + 0 + ], + "collisionCategoryBits": 1, + "collisionFilterMaskBits": -1, + "collisionObjectFileName": "", + "collisionObjectScale": [ + 0.1, + 0.31004347468098886, + 0.1 + ], + "collisionObjectType": 5, + "density": 7800, + "friction": 0.5, + "geometryFile": "../models/cylinder_unit_box.obj", + "id": 49, + "isDynamic": 1, + "restitution": 0.78, + "rotationAngle": 3.9330591571289815, + "rotationAxis": [ + 0.04934476394580925, + 0.62393153929296, + 0.7799195654339298 + ], + "scale": [ + 0.1, + 0.31004347468098886, + 0.1 + ], + "testMesh": 1, + "translation": [ + 0.7845567103355138, + -0.7240099009900994, + -0.6003976365991803 + ], + "velocity": [ + 0, + 0, + 0 + ] + }, + { + "angularVelocity": [ + 0, + 0, + 0 + ], + "collisionCategoryBits": 1, + "collisionFilterMaskBits": -1, + "collisionObjectFileName": "", + "collisionObjectScale": [ + 0.1, + 0.31004347468098536, + 0.1 + ], + "collisionObjectType": 5, + "density": 7800, + "friction": 0.5, + "geometryFile": "../models/cylinder_unit_box.obj", + "id": 50, + "isDynamic": 1, + "restitution": 0.78, + "rotationAngle": 3.7252763181019204, + "rotationAxis": [ + -0.06473190232485924, + 0.6581138098570049, + 0.7501306513514182 + ], + "scale": [ + 0.1, + 0.31004347468098536, + 0.1 + ], + "testMesh": 1, + "translation": [ + 0.9306643241607697, + -0.7363861386138617, + -0.33146714694030094 + ], + "velocity": [ + 0, + 0, + 0 + ] + }, + { + "angularVelocity": [ + 0, + 0, + 0 + ], + "collisionCategoryBits": 1, + "collisionFilterMaskBits": -1, + "collisionObjectFileName": "", + "collisionObjectScale": [ + 0.1, + 0.3100434746809889, + 0.1 + ], + "collisionObjectType": 5, + "density": 7800, + "friction": 0.5, + "geometryFile": "../models/cylinder_unit_box.obj", + "id": 51, + "isDynamic": 1, + "restitution": 0.78, + "rotationAngle": 3.5085160014002907, + "rotationAxis": [ + -0.1710118282718616, + 0.6798087460119733, + 0.7131725060858304 + ], + "scale": [ + 0.1, + 0.3100434746809889, + 0.1 + ], + "testMesh": 1, + "translation": [ + 0.9874525602927703, + -0.7487623762376241, + -0.03072450060810731 + ], + "velocity": [ + 0, + 0, + 0 + ] + }, + { + "angularVelocity": [ + 0, + 0, + 0 + ], + "collisionCategoryBits": 1, + "collisionFilterMaskBits": -1, + "collisionObjectFileName": "", + "collisionObjectScale": [ + 0.1, + 0.3100434746809889, + 0.1 + ], + "collisionObjectType": 5, + "density": 7800, + "friction": 0.5, + "geometryFile": "../models/cylinder_unit_box.obj", + "id": 52, + "isDynamic": 1, + "restitution": 0.78, + "rotationAngle": 3.2864938550611322, + "rotationAxis": [ + -0.27126141489076877, + 0.6908706357582132, + 0.670160435596209 + ], + "scale": [ + 0.1, + 0.3100434746809889, + 0.1 + ], + "testMesh": 1, + "translation": [ + 0.9494712367701714, + -0.7611386138613865, + 0.2729668923376716 + ], + "velocity": [ + 0, + 0, + 0 + ] + }, + { + "angularVelocity": [ + 0, + 0, + 0 + ], + "collisionCategoryBits": 1, + "collisionFilterMaskBits": -1, + "collisionObjectFileName": "", + "collisionObjectScale": [ + 0.1, + 0.3100434746809854, + 0.1 + ], + "collisionObjectType": 5, + "density": 7800, + "friction": 0.5, + "geometryFile": "../models/cylinder_unit_box.obj", + "id": 53, + "isDynamic": 1, + "restitution": 0.78, + "rotationAngle": 3.0624714406192495, + "rotationAxis": [ + -0.36722824917934527, + 0.6922618857096794, + 0.6212220976416981 + ], + "scale": [ + 0.1, + 0.3100434746809854, + 0.1 + ], + "testMesh": 1, + "translation": [ + 0.8203655649682604, + -0.7735148514851489, + 0.5504606194639834 + ], + "velocity": [ + 0, + 0, + 0 + ] + }, + { + "angularVelocity": [ + 0, + 0, + 0 + ], + "collisionCategoryBits": 1, + "collisionFilterMaskBits": -1, + "collisionObjectFileName": "", + "collisionObjectScale": [ + 0.1, + 0.3100434746809889, + 0.1 + ], + "collisionObjectType": 5, + "density": 7800, + "friction": 0.5, + "geometryFile": "../models/cylinder_unit_box.obj", + "id": 54, + "isDynamic": 1, + "restitution": 0.78, + "rotationAngle": 2.8395358904590915, + "rotationAxis": [ + -0.460412619550457, + 0.6841040700647628, + 0.5657047295891313 + ], + "scale": [ + 0.1, + 0.3100434746809889, + 0.1 + ], + "testMesh": 1, + "translation": [ + 0.6125263048663826, + -0.7858910891089114, + 0.7751245574829249 + ], + "velocity": [ + 0, + 0, + 0 + ] + }, + { + "angularVelocity": [ + 0, + 0, + 0 + ], + "collisionCategoryBits": 1, + "collisionFilterMaskBits": -1, + "collisionObjectFileName": "", + "collisionObjectScale": [ + 0.1, + 0.31004347468098886, + 0.1 + ], + "collisionObjectType": 5, + "density": 7800, + "friction": 0.5, + "geometryFile": "../models/cylinder_unit_box.obj", + "id": 55, + "isDynamic": 1, + "restitution": 0.78, + "rotationAngle": 2.620869210100161, + "rotationAxis": [ + -0.5518799718710169, + 0.6656859015767099, + 0.5022855533355987 + ], + "scale": [ + 0.1, + 0.31004347468098886, + 0.1 + ], + "testMesh": 1, + "translation": [ + 0.34590057691450876, + -0.7982673267326738, + 0.9253968579245202 + ], + "velocity": [ + 0, + 0, + 0 + ] + }, + { + "angularVelocity": [ + 0, + 0, + 0 + ], + "collisionCategoryBits": 1, + "collisionFilterMaskBits": -1, + "collisionObjectFileName": "", + "collisionObjectScale": [ + 0.1, + 0.31004347468098536, + 0.1 + ], + "collisionObjectType": 5, + "density": 7800, + "friction": 0.5, + "geometryFile": "../models/cylinder_unit_box.obj", + "id": 56, + "isDynamic": 1, + "restitution": 0.78, + "rotationAngle": 2.410023483810413, + "rotationAxis": [ + -0.6420011847348516, + 0.6354213752941928, + 0.42903864000609954 + ], + "scale": [ + 0.1, + 0.31004347468098536, + 0.1 + ], + "testMesh": 1, + "translation": [ + 0.046077461385109895, + -0.8106435643564361, + 0.9868553193445678 + ], + "velocity": [ + 0, + 0, + 0 + ] + }, + { + "angularVelocity": [ + 0, + 0, + 0 + ], + "collisionCategoryBits": 1, + "collisionFilterMaskBits": -1, + "collisionObjectFileName": "", + "collisionObjectScale": [ + 0.1, + 0.31004347468098886, + 0.1 + ], + "collisionObjectType": 5, + "density": 7800, + "friction": 0.5, + "geometryFile": "../models/cylinder_unit_box.obj", + "id": 57, + "isDynamic": 1, + "restitution": 0.78, + "rotationAngle": 2.2112127219951603, + "rotationAxis": [ + -0.7300188236609931, + 0.5908013575436001, + 0.343549520484688 + ], + "scale": [ + 0.1, + 0.31004347468098886, + 0.1 + ], + "testMesh": 1, + "translation": [ + -0.2581678825135931, + -0.8230198019801985, + 0.9536015405843324 + ], + "velocity": [ + 0, + 0, + 0 + ] + }, + { + "angularVelocity": [ + 0, + 0, + 0 + ], + "collisionCategoryBits": 1, + "collisionFilterMaskBits": -1, + "collisionObjectFileName": "", + "collisionObjectScale": [ + 0.1, + 0.31004347468098536, + 0.1 + ], + "collisionObjectType": 5, + "density": 7800, + "friction": 0.5, + "geometryFile": "../models/cylinder_unit_box.obj", + "id": 58, + "isDynamic": 1, + "restitution": 0.78, + "rotationAngle": 2.0296058544105935, + "rotationAxis": [ + -0.813361862545008, + 0.5284665331869973, + 0.24323980730676456 + ], + "scale": [ + 0.1, + 0.31004347468098536, + 0.1 + ], + "testMesh": 1, + "translation": [ + -0.537635877578931, + -0.8353960396039609, + 0.8288270126548107 + ], + "velocity": [ + 0, + 0, + 0 + ] + }, + { + "angularVelocity": [ + 0, + 0, + 0 + ], + "collisionCategoryBits": 1, + "collisionFilterMaskBits": -1, + "collisionObjectFileName": "", + "collisionObjectScale": [ + 0.1, + 0.3100434746809889, + 0.1 + ], + "collisionObjectType": 5, + "density": 7800, + "friction": 0.5, + "geometryFile": "../models/cylinder_unit_box.obj", + "id": 59, + "isDynamic": 1, + "restitution": 0.78, + "rotationAngle": 1.8715417528961145, + "rotationAxis": [ + -0.8867610710818087, + 0.44467752748038064, + 0.12616140205220805 + ], + "scale": [ + 0.1, + 0.3100434746809889, + 0.1 + ], + "testMesh": 1, + "translation": [ + -0.7655049225564157, + -0.8477722772277233, + 0.6245068192648184 + ], + "velocity": [ + 0, + 0, + 0 + ] + }, + { + "angularVelocity": [ + 0, + 0, + 0 + ], + "collisionCategoryBits": 1, + "collisionFilterMaskBits": -1, + "collisionObjectFileName": "", + "collisionObjectScale": [ + 0.1, + 0.310043474680989, + 0.1 + ], + "collisionObjectType": 5, + "density": 7800, + "friction": 0.5, + "geometryFile": "../models/cylinder_unit_box.obj", + "id": 60, + "isDynamic": 1, + "restitution": 0.78, + "rotationAngle": 1.7444709600608537, + "rotationAxis": [ + -0.9416148304639536, + 0.33660894701731103, + -0.007478491708696746 + ], + "scale": [ + 0.1, + 0.310043474680989, + 0.1 + ], + "testMesh": 1, + "translation": [ + -0.91990556273014, + -0.8601485148514858, + 0.3602503427125494 + ], + "velocity": [ + 0, + 0, + 0 + ] + }, + { + "angularVelocity": [ + 0, + 0, + 0 + ], + "collisionCategoryBits": 1, + "collisionFilterMaskBits": -1, + "collisionObjectFileName": "", + "collisionObjectScale": [ + 0.1, + 0.31004347468098536, + 0.1 + ], + "collisionObjectType": 5, + "density": 7800, + "friction": 0.5, + "geometryFile": "../models/cylinder_unit_box.obj", + "id": 61, + "isDynamic": 1, + "restitution": 0.78, + "rotationAngle": 1.6563034551914455, + "rotationAxis": [ + -0.9667520501802646, + 0.2047102782105891, + -0.15324547454068052 + ], + "scale": [ + 0.1, + 0.31004347468098536, + 0.1 + ], + "testMesh": 1, + "translation": [ + -0.9860193842663139, + -0.8725247524752482, + 0.061419277246193116 + ], + "velocity": [ + 0, + 0, + 0 + ] + }, + { + "angularVelocity": [ + 0, + 0, + 0 + ], + "collisionCategoryBits": 1, + "collisionFilterMaskBits": -1, + "collisionObjectFileName": "", + "collisionObjectScale": [ + 0.1, + 0.3100434746809889, + 0.1 + ], + "collisionObjectType": 5, + "density": 7800, + "friction": 0.5, + "geometryFile": "../models/cylinder_unit_box.obj", + "id": 62, + "isDynamic": 1, + "restitution": 0.78, + "rotationAngle": 1.6139130434156015, + "rotationAxis": [ + -0.9519464822100152, + 0.055262762649827865, + -0.3012373185252553 + ], + "scale": [ + 0.1, + 0.3100434746809889, + 0.1 + ], + "testMesh": 1, + "translation": [ + -0.9575011934756242, + -0.8849009900990106, + -0.2433064287254242 + ], + "velocity": [ + 0, + 0, + 0 + ] + }, + { + "angularVelocity": [ + 0, + 0, + 0 + ], + "collisionCategoryBits": 1, + "collisionFilterMaskBits": -1, + "collisionObjectFileName": "", + "collisionObjectScale": [ + 0.1, + 0.3100434746809889, + 0.1 + ], + "collisionObjectType": 5, + "density": 7800, + "friction": 0.5, + "geometryFile": "../models/cylinder_unit_box.obj", + "id": 63, + "isDynamic": 1, + "restitution": 0.78, + "rotationAngle": 1.621111637770188, + "rotationAxis": [ + -0.8934893357273334, + -0.09939545472234793, + -0.43794674393362754 + ], + "scale": [ + 0.1, + 0.3100434746809889, + 0.1 + ], + "testMesh": 1, + "translation": [ + -0.837087989067739, + -0.897277227722773, + -0.5246810958333582 + ], + "velocity": [ + 0, + 0, + 0 + ] + }, + { + "angularVelocity": [ + 0, + 0, + 0 + ], + "collisionCategoryBits": 1, + "collisionFilterMaskBits": -1, + "collisionObjectFileName": "", + "collisionObjectScale": [ + 0.1, + 0.3100434746809855, + 0.1 + ], + "collisionObjectType": 5, + "density": 7800, + "friction": 0.5, + "geometryFile": "../models/cylinder_unit_box.obj", + "id": 64, + "isDynamic": 1, + "restitution": 0.78, + "rotationAngle": 1.677225996643341, + "rotationAxis": [ + -0.7974666214738741, + -0.24483339301891266, + -0.5514558888051619 + ], + "scale": [ + 0.1, + 0.3100434746809855, + 0.1 + ], + "testMesh": 1, + "translation": [ + -0.6363362820257805, + -0.9096534653465352, + -0.7557001322905611 + ], + "velocity": [ + 0, + 0, + 0 + ] + }, + { + "angularVelocity": [ + 0, + 0, + 0 + ], + "collisionCategoryBits": 1, + "collisionFilterMaskBits": -1, + "collisionObjectFileName": "", + "collisionObjectScale": [ + 0.1, + 0.3100434746809888, + 0.1 + ], + "collisionObjectType": 5, + "density": 7800, + "friction": 0.5, + "geometryFile": "../models/cylinder_unit_box.obj", + "id": 65, + "isDynamic": 1, + "restitution": 0.78, + "rotationAngle": 1.7773647614370784, + "rotationAxis": [ + -0.6769843685996129, + -0.3702311747368142, + -0.6360982958040229 + ], + "scale": [ + 0.1, + 0.3100434746809888, + 0.1 + ], + "testMesh": 1, + "translation": [ + -0.3745129735066346, + -0.9220297029702976, + -0.9141917667763058 + ], + "velocity": [ + 0, + 0, + 0 + ] + }, + { + "angularVelocity": [ + 0, + 0, + 0 + ], + "collisionCategoryBits": 1, + "collisionFilterMaskBits": -1, + "collisionObjectFileName": "", + "collisionObjectScale": [ + 0.1, + 0.31004347468098536, + 0.1 + ], + "collisionObjectType": 5, + "density": 7800, + "friction": 0.5, + "geometryFile": "../models/cylinder_unit_box.obj", + "id": 66, + "isDynamic": 1, + "restitution": 0.78, + "rotationAngle": 1.9141569438303876, + "rotationAxis": [ + -0.5458402465173806, + -0.47116766997667126, + -0.6928632275208434 + ], + "scale": [ + 0.1, + 0.31004347468098536, + 0.1 + ], + "testMesh": 1, + "translation": [ + -0.07674623741296809, + -0.93440594059406, + -0.9849449572485345 + ], + "velocity": [ + 0, + 0, + 0 + ] + }, + { + "angularVelocity": [ + 0, + 0, + 0 + ], + "collisionCategoryBits": 1, + "collisionFilterMaskBits": -1, + "collisionObjectFileName": "", + "collisionObjectScale": [ + 0.1, + 0.31004347468098886, + 0.1 + ], + "collisionObjectType": 5, + "density": 7800, + "friction": 0.5, + "geometryFile": "../models/cylinder_unit_box.obj", + "id": 67, + "isDynamic": 1, + "restitution": 0.78, + "rotationAngle": 2.0797097896143217, + "rotationAxis": [ + -0.41403513991069074, + -0.5484232812947191, + -0.7265031365748315 + ], + "scale": [ + 0.1, + 0.31004347468098886, + 0.1 + ], + "testMesh": 1, + "translation": [ + 0.2283861255647059, + -0.9467821782178224, + -0.9611692522214321 + ], + "velocity": [ + 0, + 0, + 0 + ] + }, + { + "angularVelocity": [ + 0, + 0, + 0 + ], + "collisionCategoryBits": 1, + "collisionFilterMaskBits": -1, + "collisionObjectFileName": "", + "collisionObjectScale": [ + 0.1, + 0.31004347468098886, + 0.1 + ], + "collisionObjectType": 5, + "density": 7800, + "friction": 0.5, + "geometryFile": "../models/cylinder_unit_box.obj", + "id": 68, + "isDynamic": 1, + "restitution": 0.78, + "rotationAngle": 2.2668584334677426, + "rotationAxis": [ + -0.28690559036078406, + -0.6052832120383987, + -0.7425075187795803 + ], + "scale": [ + 0.1, + 0.31004347468098886, + 0.1 + ], + "testMesh": 1, + "translation": [ + 0.5115994076454013, + -0.9591584158415848, + -0.8451464960959367 + ], + "velocity": [ + 0, + 0, + 0 + ] + }, + { + "angularVelocity": [ + 0, + 0, + 0 + ], + "collisionCategoryBits": 1, + "collisionFilterMaskBits": -1, + "collisionObjectFileName": "", + "collisionObjectScale": [ + 0.1, + 0.3100434746809854, + 0.1 + ], + "collisionObjectType": 5, + "density": 7800, + "friction": 0.5, + "geometryFile": "../models/cylinder_unit_box.obj", + "id": 69, + "isDynamic": 1, + "restitution": 0.78, + "rotationAngle": 2.4696115789096242, + "rotationAxis": [ + -0.16628093903301497, + -0.645465226409081, + -0.7454698456751772 + ], + "scale": [ + 0.1, + 0.3100434746809854, + 0.1 + ], + "testMesh": 1, + "translation": [ + 0.7457125582040975, + -0.9715346534653472, + -0.6480118319159502 + ], + "velocity": [ + 0, + 0, + 0 + ] + }, + { + "angularVelocity": [ + 0, + 0, + 0 + ], + "collisionCategoryBits": 1, + "collisionFilterMaskBits": -1, + "collisionObjectFileName": "", + "collisionObjectScale": [ + 0.1, + 0.31004347468098886, + 0.1 + ], + "collisionObjectType": 5, + "density": 7800, + "friction": 0.5, + "geometryFile": "../models/cylinder_unit_box.obj", + "id": 70, + "isDynamic": 1, + "restitution": 0.78, + "rotationAngle": 2.6831027622620813, + "rotationAxis": [ + -0.05193481770550873, + -0.6721078216855724, + -0.738629711519223 + ], + "scale": [ + 0.1, + 0.31004347468098886, + 0.1 + ], + "testMesh": 1, + "translation": [ + 0.9082568520787275, + -0.9839108910891095, + -0.38868501954462475 + ], + "velocity": [ + 0, + 0, + 0 + ] + }, + { + "angularVelocity": [ + 0, + 0, + 0 + ], + "collisionCategoryBits": 1, + "collisionFilterMaskBits": -1, + "collisionObjectFileName": "", + "collisionObjectScale": [ + 0.1, + 0.3086660822034065, + 0.1 + ], + "collisionObjectType": 5, + "density": 7800, + "friction": 0.5, + "geometryFile": "../models/cylinder_unit_box.obj", + "id": 71, + "isDynamic": 1, + "restitution": 0.78, + "rotationAngle": 2.9260973186891555, + "rotationAxis": [ + 0.06827269956085491, + -0.6883803420149132, + -0.7221297274189067 + ], + "scale": [ + 0.1, + 0.3086660822034065, + 0.1 + ], + "testMesh": 1, + "translation": [ + 0.9786913793689394, + -0.9962871287128718, + -0.09236240518257859 + ], + "velocity": [ + 0, + 0, + 0 + ] + }, + { + "angularVelocity": [ + 0, + 0, + 0 + ], + "collisionCategoryBits": 1, + "collisionFilterMaskBits": -1, + "collisionObjectFileName": "", + "collisionObjectScale": [ + 0.1, + 0.30328616435356365, + 0.1 + ], + "collisionObjectType": 5, + "density": 7800, + "friction": 0.5, + "geometryFile": "../models/cylinder_unit_box.obj", + "id": 72, + "isDynamic": 1, + "restitution": 0.78, + "rotationAngle": 3.243946097491642, + "rotationAxis": [ + 0.21753429194960253, + -0.6915425407422012, + -0.6888016740468959 + ], + "scale": [ + 0.1, + 0.30328616435356365, + 0.1 + ], + "testMesh": 1, + "translation": [ + 0.9320061663991879, + -1.0086633663366342, + 0.20227157792080802 + ], + "velocity": [ + 0, + 0, + 0 + ] + }, + { + "angularVelocity": [ + 0, + 0, + 0 + ], + "collisionCategoryBits": 1, + "collisionFilterMaskBits": -1, + "collisionObjectFileName": "", + "collisionObjectScale": [ + 0.1, + 0.2881746673071604, + 0.1 + ], + "collisionObjectType": 5, + "density": 7800, + "friction": 0.5, + "geometryFile": "../models/cylinder_unit_box.obj", + "id": 73, + "isDynamic": 1, + "restitution": 0.78, + "rotationAngle": 3.472647883530725, + "rotationAxis": [ + 0.3243589983017314, + -0.6811558874179101, + -0.6563671969687522 + ], + "scale": [ + 0.1, + 0.2881746673071604, + 0.1 + ], + "testMesh": 1, + "translation": [ + 0.7831476511808704, + -1.0210396039603968, + 0.45313947284427647 + ], + "velocity": [ + 0, + 0, + 0 + ] + }, + { + "angularVelocity": [ + 0, + 0, + 0 + ], + "collisionCategoryBits": 1, + "collisionFilterMaskBits": -1, + "collisionObjectFileName": "", + "collisionObjectScale": [ + 0.1, + 0.27308825291098887, + 0.1 + ], + "collisionObjectType": 5, + "density": 7800, + "friction": 0.5, + "geometryFile": "../models/cylinder_unit_box.obj", + "id": 74, + "isDynamic": 1, + "restitution": 0.78, + "rotationAngle": 3.6968869655458363, + "rotationAxis": [ + 0.4319651908808718, + -0.6594578124633982, + -0.6152409832319702 + ], + "scale": [ + 0.1, + 0.27308825291098887, + 0.1 + ], + "testMesh": 1, + "translation": [ + 0.5742301741263357, + -1.033415841584159, + 0.6346696379423098 + ], + "velocity": [ + 0, + 0, + 0 + ] + }, + { + "angularVelocity": [ + 0, + 0, + 0 + ], + "collisionCategoryBits": 1, + "collisionFilterMaskBits": -1, + "collisionObjectFileName": "", + "collisionObjectScale": [ + 0.1, + 0.2580313207528268, + 0.1 + ], + "collisionObjectType": 5, + "density": 7800, + "friction": 0.5, + "geometryFile": "../models/cylinder_unit_box.obj", + "id": 75, + "isDynamic": 1, + "restitution": 0.78, + "rotationAngle": 3.9125558262740614, + "rotationAxis": [ + 0.5412461182065398, + -0.6242909890455881, + -0.5633057788828674 + ], + "scale": [ + 0.1, + 0.2580313207528268, + 0.1 + ], + "testMesh": 1, + "translation": [ + 0.3324906405509327, + -1.0457920792079216, + 0.7353025974362927 + ], + "velocity": [ + 0, + 0, + 0 + ] + }, + { + "angularVelocity": [ + 0, + 0, + 0 + ], + "collisionCategoryBits": 1, + "collisionFilterMaskBits": -1, + "collisionObjectFileName": "", + "collisionObjectScale": [ + 0.1, + 0.2430093510793624, + 0.1 + ], + "collisionObjectType": 5, + "density": 7800, + "friction": 0.5, + "geometryFile": "../models/cylinder_unit_box.obj", + "id": 76, + "isDynamic": 1, + "restitution": 0.78, + "rotationAngle": 4.114535480168538, + "rotationAxis": [ + 0.651860123770832, + -0.5723324723877025, + -0.49750770857149074 + ], + "scale": [ + 0.1, + 0.2430093510793624, + 0.1 + ], + "testMesh": 1, + "translation": [ + 0.08617685434638561, + -1.0581683168316838, + 0.7531609762310414 + ], + "velocity": [ + 0, + 0, + 0 + ] + }, + { + "angularVelocity": [ + 0, + 0, + 0 + ], + "collisionCategoryBits": 1, + "collisionFilterMaskBits": -1, + "collisionObjectFileName": "", + "collisionObjectScale": [ + 0.1, + 0.4352873588937756, + 0.1 + ], + "collisionObjectType": 5, + "density": 7800, + "friction": 0.5, + "geometryFile": "../models/cylinder_unit_box.obj", + "id": 77, + "isDynamic": 1, + "restitution": 0.78, + "rotationAngle": 4.37407968946502, + "rotationAxis": [ + 0.8119071119253541, + -0.4544162454699513, + -0.36648699493709663 + ], + "scale": [ + 0.1, + 0.4352873588937756, + 0.1 + ], + "testMesh": 1, + "translation": [ + -0.21682499932677582, + -1.0767326732673275, + 0.6233515252683579 + ], + "velocity": [ + 0, + 0, + 0 + ] + }, + { + "angularVelocity": [ + 0, + 0, + 0 + ], + "collisionCategoryBits": 1, + "collisionFilterMaskBits": -1, + "collisionObjectFileName": "", + "collisionObjectScale": [ + 0.1, + 0.3764650063454056, + 0.1 + ], + "collisionObjectType": 5, + "density": 7800, + "friction": 0.5, + "geometryFile": "../models/cylinder_unit_box.obj", + "id": 78, + "isDynamic": 1, + "restitution": 0.78, + "rotationAngle": 4.601519542006067, + "rotationAxis": [ + 0.9729573981536024, + -0.20104846290410125, + -0.11372518165327675 + ], + "scale": [ + 0.1, + 0.3764650063454056, + 0.1 + ], + "testMesh": 1, + "translation": [ + -0.4611857539944598, + -1.1014851485148522, + 0.3276991214965719 + ], + "velocity": [ + 0, + 0, + 0 + ] + }, + { + "angularVelocity": [ + 0, + 0, + 0 + ], + "collisionCategoryBits": 1, + "collisionFilterMaskBits": -1, + "collisionObjectFileName": "", + "collisionObjectScale": [ + 0.1, + 0.3183123394891373, + 0.1 + ], + "collisionObjectType": 5, + "density": 7800, + "friction": 0.5, + "geometryFile": "../models/cylinder_unit_box.obj", + "id": 79, + "isDynamic": 1, + "restitution": 0.78, + "rotationAngle": 4.616779724716343, + "rotationAxis": [ + 0.973341110716522, + 0.1271197325977654, + 0.1909126914937818 + ], + "scale": [ + 0.1, + 0.3183123394891373, + 0.1 + ], + "testMesh": 1, + "translation": [ + -0.47153684939642915, + -1.126237623762377, + 0.0004868536653728217 + ], + "velocity": [ + 0, + 0, + 0 + ] + }, + { + "angularVelocity": [ + 0, + 0, + 0 + ], + "collisionCategoryBits": 1, + "collisionFilterMaskBits": -1, + "collisionObjectFileName": "", + "collisionObjectScale": [ + 0.1, + 0.26127689951069144, + 0.1 + ], + "collisionObjectType": 5, + "density": 7800, + "friction": 0.5, + "geometryFile": "../models/cylinder_unit_box.obj", + "id": 80, + "isDynamic": 1, + "restitution": 0.78, + "rotationAngle": 4.392028423791716, + "rotationAxis": [ + 0.7970840247033039, + 0.4091979570189401, + 0.4440879299579179 + ], + "scale": [ + 0.1, + 0.26127689951069144, + 0.1 + ], + "testMesh": 1, + "translation": [ + -0.30862708363183433, + -1.1509900990099018, + -0.21710411783467087 + ], + "velocity": [ + 0, + 0, + 0 + ] + }, + { + "angularVelocity": [ + 0, + 0, + 0 + ], + "collisionCategoryBits": 1, + "collisionFilterMaskBits": -1, + "collisionObjectFileName": "", + "collisionObjectScale": [ + 0.1, + 0.3485180158497176, + 0.1 + ], + "collisionObjectType": 5, + "density": 7800, + "friction": 0.5, + "geometryFile": "../models/cylinder_unit_box.obj", + "id": 81, + "isDynamic": 1, + "restitution": 0.78, + "rotationAngle": 3.414628417523031, + "rotationAxis": [ + 0.29340952902148654, + 0.6605245298206888, + 0.6910992647836832 + ], + "scale": [ + 0.1, + 0.3485180158497176, + 0.1 + ], + "testMesh": 1, + "translation": [ + -0.09876796553208723, + -1.1819306930693076, + -0.14236030169165417 + ], + "velocity": [ + 0, + 0, + 0 + ] + }, + { + "angularVelocity": [ + 0, + 0, + 0 + ], + "collisionCategoryBits": 1, + "collisionFilterMaskBits": -1, + "collisionObjectFileName": "", + "collisionObjectScale": [ + 2.508994322242706, + 0.8405234248910028, + 2.508994322242706 + ], + "collisionObjectType": 5, + "density": 7800, + "friction": 0.5, + "geometryFile": "../models/cylinder_unit_box.obj", + "id": 162, + "isDynamic": 1, + "restitution": 0.78, + "rotationAngle": 3.1415926535897927, + "rotationAxis": [ + 0.0, + 0.0, + -1.0 + ], + "scale": [ + 2.508994322242706, + 0.8405234248910028, + 2.508994322242706 + ], + "testMesh": 1, + "translation": [ + 9.924272903595253e-17, + -1.6207567619504528, + 0.0 + ], + "velocity": [ + 0, + 0, + 0 + ] + } + ], + "RigidBodyParticleBallJoints": [], + "RodAnimators": [], + "Rods": [], + "Simulation": { + "cloth_bendingStiffness": 0.005, + "cloth_normalizeShear": 0, + "cloth_normalizeStretch": 0, + "cloth_stiffness": 1.0, + "cloth_xxStiffness": 1.0, + "cloth_xyPoissonRatio": 0.3, + "cloth_xyStiffness": 1.0, + "cloth_yxPoissonRatio": 0.3, + "cloth_yyStiffness": 1.0, + "contactStiffnessParticleRigidBody": 100.0, + "contactStiffnessRigidBody": 1.0, + "contactTolerance": 0.04, + "gravity": [ + 6.006892549817768e-16, + -9.81, + 0.0 + ], + "maxIterations": 3, + "maxIterationsV": 0, + "timeStepSize": 0.005, + "clothBendingMethod": 2, + "clothSimulationMethod": 2, + "velocityUpdateMethod": 0 + }, + "SkinningMeshes": [], + "SliderJoints": [], + "TargetAngleMotorHingeJoints": [], + "TargetPositionMotorSliderJoints": [], + "TargetVelocityMotorHingeJoints": [], + "TargetVelocityMotorSliderJoints": [], + "TetModels": [], + "TreeModels": [ + { + "id": 164, + "jIds": [ + 82, + 83, + 84, + 85, + 86, + 87, + 88, + 89, + 90, + 91, + 92, + 93, + 94, + 95, + 96, + 97, + 98, + 99, + 100, + 101, + 102, + 103, + 104, + 105, + 106, + 107, + 108, + 109, + 110, + 111, + 112, + 113, + 114, + 115, + 116, + 117, + 118, + 119, + 120, + 121, + 122, + 123, + 124, + 125, + 126, + 127, + 128, + 129, + 130, + 131, + 132, + 133, + 134, + 135, + 136, + 137, + 138, + 139, + 140, + 141, + 142, + 143, + 144, + 145, + 146, + 147, + 148, + 149, + 150, + 151, + 152, + 153, + 154, + 155, + 156, + 157, + 158, + 159, + 160, + 161, + 163 + ], + "rbIds": [ + 1, + 2, + 3, + 4, + 5, + 6, + 7, + 8, + 9, + 10, + 11, + 12, + 13, + 14, + 15, + 16, + 17, + 18, + 19, + 20, + 21, + 22, + 23, + 24, + 25, + 26, + 27, + 28, + 29, + 30, + 31, + 32, + 33, + 34, + 35, + 36, + 37, + 38, + 39, + 40, + 41, + 42, + 43, + 44, + 45, + 46, + 47, + 48, + 49, + 50, + 51, + 52, + 53, + 54, + 55, + 56, + 57, + 58, + 59, + 60, + 61, + 62, + 63, + 64, + 65, + 66, + 67, + 68, + 69, + 70, + 71, + 72, + 73, + 74, + 75, + 76, + 77, + 78, + 79, + 80, + 81, + 162 + ], + "rotationAngle": 0.0, + "rotationAxis": [ + 1, + 0, + 0 + ], + "solverType": 12, + "staticSegments": [ + 1 + ], + "torsionModulus": 79000000000.0, + "translation": [ + 0, + 0, + 0 + ], + "youngsModulus": 209000000000.0 + } + ], + "TriangleModels": [], + "UniversalJoints": [], + "cameraLookat": [ + 5.202150662428556e-16, + -8.495756761950458, + 0.0 + ], + "cameraPosition": [ + 5.202150662428556e-16, + -8.495756761950458, + 25.0 + ] +} \ No newline at end of file diff --git a/data/sdf/bunny_10k.csdf b/data/sdf/bunny_10k.csdf new file mode 100644 index 00000000..bcc8bd98 Binary files /dev/null and b/data/sdf/bunny_10k.csdf differ diff --git a/Doxyfile b/doc/Doxyfile similarity index 99% rename from Doxyfile rename to doc/Doxyfile index 1342db57..cf0e5bc0 100644 --- a/Doxyfile +++ b/doc/Doxyfile @@ -38,13 +38,13 @@ PROJECT_NAME = PositionBasedDynamics # could be handy for archiving the generated documentation or if some version # control system is used. -PROJECT_NUMBER = 1.5.0 +PROJECT_NUMBER = $(PBD_VERSION) # Using the PROJECT_BRIEF tag one can provide an optional one line description # for a project that appears at the top of each page and should give viewer a # quick idea about the purpose of the project. Keep the description short. -PROJECT_BRIEF = +PROJECT_BRIEF = "PositionBasedDynamics is a library for the physically-based simulation of rigid bodies, deformable solids and fluids." # With the PROJECT_LOGO tag one can specify a logo or an icon that is included # in the documentation. The maximum height of the logo should not exceed 55 @@ -58,7 +58,7 @@ PROJECT_LOGO = # entered, it will be relative to the location where doxygen was started. If # left blank the current directory will be used. -OUTPUT_DIRECTORY = ./doc +OUTPUT_DIRECTORY = ./doxyoutput/ # If the CREATE_SUBDIRS tag is set to YES then doxygen will create 4096 sub- # directories (in 2 levels) under the output directory of each output format and @@ -704,7 +704,7 @@ LAYOUT_FILE = # LATEX_BIB_STYLE. To use this feature you need bibtex and perl available in the # search path. See also \cite for info how to create references. -CITE_BIB_FILES = ./doc/bibliography.bib +CITE_BIB_FILES = ./bibliography.bib #--------------------------------------------------------------------------- # Configuration options related to warning and progress messages @@ -781,8 +781,9 @@ WARN_LOGFILE = # spaces. See also FILE_PATTERNS and EXTENSION_MAPPING # Note: If this tag is empty the current directory is searched. -INPUT = ./PositionBasedDynamics \ - ./doc +INPUT = ../PositionBasedDynamics \ + ../Utils \ + ../Simulation # This tag can be used to specify the character encoding of the source files # that doxygen parses. Internally doxygen uses the UTF-8 encoding. Doxygen uses @@ -916,7 +917,7 @@ EXAMPLE_RECURSIVE = NO # that contain images that are to be included in the documentation (see the # \image command). -IMAGE_PATH = ./doc/images +IMAGE_PATH = ./images # The INPUT_FILTER tag can be used to specify a program that doxygen should # invoke to filter for each input file. Doxygen will invoke the filter program @@ -1936,7 +1937,7 @@ MAN_LINKS = NO # captures the structure of the code including all documentation. # The default value is: NO. -GENERATE_XML = NO +GENERATE_XML = YES # The XML_OUTPUT tag is used to specify where the XML pages will be put. If a # relative path is entered the value of OUTPUT_DIRECTORY will be put in front of @@ -2160,7 +2161,7 @@ EXTERNAL_PAGES = YES # interpreter (i.e. the result of 'which perl'). # The default file (with absolute path) is: /usr/bin/perl. -PERL_PATH = /usr/bin/perl +PERL_PATH = "C:\Program Files\Perl64\bin" #--------------------------------------------------------------------------- # Configuration options related to the dot tool diff --git a/doc/Makefile b/doc/Makefile new file mode 100644 index 00000000..2b9c8f7f --- /dev/null +++ b/doc/Makefile @@ -0,0 +1,24 @@ +# Minimal makefile for Sphinx documentation +# + +# You can set these variables from the command line, and also +# from the environment for the first two. +SPHINXOPTS ?= +SPHINXBUILD ?= sphinx-build +SOURCEDIR = . +BUILDDIR = _build + +# Put it first so that "make" without argument is like "make help". +help: + @$(SPHINXBUILD) -M help "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O) + +.PHONY: help Makefile clean + +clean: + rm -rf doxyoutput/ api/ + @$(SPHINXBUILD) -M clean "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O) + +# Catch-all target: route all unknown targets to Sphinx using the new +# "make mode" option. $(O) is meant as a shortcut for $(SPHINXOPTS). +%: Makefile + @$(SPHINXBUILD) -M $@ "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O) \ No newline at end of file diff --git a/doc/about.md b/doc/about.md new file mode 100644 index 00000000..b420bf72 --- /dev/null +++ b/doc/about.md @@ -0,0 +1,70 @@ +# About PositionBasedDynamics + +PositionBasedDynamics is an open-source library which enables the physically-based simulation of mechanical effects. In the last years position-based simulation methods have become popular in the graphics community. In contrast to classical simulation approaches these methods compute the position changes in each simulation step directly, based on the solution of a quasi-static problem. Therefore, position-based approaches are fast, stable and controllable which make them well-suited for use in interactive environments. However, these methods are generally not as accurate as force-based methods but still provide visual plausibility. Hence, the main application areas of position-based simulation are virtual reality, computer games and special effects in movies and commercials. + + +## Main features + +* Physically-based simulation with position-based constraint handling. +* Simple interface +* Demos +* Library is free even for commercial applications. +* Collision detection based on cubic signed distance fields +* Library supports many constraints: + - Elastic rods: + - bend-twist constraint + - stretch-shear constraint + - Cosserat constraint + - Deformable solids: + - point-point distance constraint (PBD & XPBD) + - point-edge distance constraint + - point-triangle distance constraint + - edge-edge distance constraint + - dihedral bending constraint + - isometric bending constraint (PBD & XPBD) + - volume constraint (PBD & XPBD) + - shape matching + - FEM-based PBD (2D & 3D) + - strain-based dynamics (2D & 3D) + - Fluids: + - position-based fluids + - Rigid bodies: + - contact constraints + - ball joint + - ball-on-line-joint + - hinge joint + - target angle motor hinge joint + - target velocity motor hinge joint + - universal joint + - slider joint + - target position motor slider joint + - target velocity motor slider joint + - ball joint between rigid body and particle + - distance joint + - damper joint + - implicit spring + - Generic constraints +- +## License + +The MIT License (MIT) + +Copyright (c) 2015-present, PositionBasedDynamics contributors + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. \ No newline at end of file diff --git a/doc/bibliography.bib b/doc/bibliography.bib index b32fb7a8..09a80c9a 100644 --- a/doc/bibliography.bib +++ b/doc/bibliography.bib @@ -1,5 +1,5 @@ @ARTICLE{Mueller07, - author = {Matthias M\"{u}ller and Bruno Heidelberger and Marcus Hennix and + author = {Matthias Müller and Bruno Heidelberger and Marcus Hennix and John Ratcliff}, title = {Position based dynamics}, journal = {Journal of Visual Communication and Image Representation}, @@ -24,7 +24,7 @@ @INPROCEEDINGS{Diziol2011 } @ARTICLE{Muller2005, - author = {M\"{u}ller, Matthias and Heidelberger, Bruno and Teschner, Matthias + author = {Müller, Matthias and Heidelberger, Bruno and Teschner, Matthias and Gross, Markus}, title = {Meshless deformations based on shape matching}, journal = {ACM Trans. Graph.}, @@ -53,7 +53,7 @@ @ARTICLE{Bender2013 } @article{Macklin:2013:PBF, - author = {Macklin, Miles and M\"{u}ller, Matthias}, + author = {Macklin, Miles and Müller, Matthias}, title = {Position based fluids}, journal = {ACM Trans. Graph.}, issue_date = {July 2013}, @@ -74,7 +74,7 @@ @article{Macklin:2013:PBF @article{BMOTM2014, title = "A Survey on Position-Based Simulation Methods in Computer Graphics", -author = "Jan Bender and Matthias M{\"{u}}ller and Miguel A. Otaduy and Matthias Teschner and Miles Macklin", +author = "Jan Bender and Matthias Müller and Miguel A. Otaduy and Matthias Teschner and Miles Macklin", year = {2014}, volume = {33}, pages = {228--251}, @@ -109,7 +109,7 @@ @article{Deul2014 } @INPROCEEDINGS{Mueller2014, - author = {M\"{u}ller, Matthias and Chentanez, Nuttapong and Kim, Tae-Yong and Macklin, Miles}, + author = {Müller, Matthias and Chentanez, Nuttapong and Kim, Tae-Yong and Macklin, Miles}, title = {Strain Based Dynamics}, booktitle = {Proceedings of ACM SIGGRAPH/Eurographics Symposium on Computer Animation}, @@ -120,7 +120,7 @@ @INPROCEEDINGS{Mueller2014 @inproceedings{BMOT2013, title = "Position-based Methods for the Simulation of Solid Objects in Computer Graphics", - author = "Jan Bender and Matthias M{\"u}ller and Miguel A. Otaduy and Matthias Teschner", + author = "Jan Bender and Matthias Müller and Miguel A. Otaduy and Matthias Teschner", year = "2013", booktitle = "EUROGRAPHICS 2013 State of the Art Reports", publisher = "Eurographics Association", @@ -129,7 +129,7 @@ @inproceedings{BMOT2013 @inproceedings{BMM2015, title = "Position-Based Simulation Methods in Computer Graphics", - author = "Jan Bender and Matthias M{\"u}ller and Miles Macklin", + author = "Jan Bender and Matthias Müller and Miles Macklin", year = "2015", booktitle = "EUROGRAPHICS 2015 Tutorials", publisher = "Eurographics Association", @@ -155,4 +155,21 @@ @article{Akinci:2012 publisher = {ACM}, address = {New York, NY, USA}, keywords = {fluid simulation, fluid-solid coupling, physically-based animation, smoothed particle hydrodynamics}, -} \ No newline at end of file +} + +@InProceedings{MMC16, + author = {Macklin, Miles and Müller, Matthias and Chentanez, Nuttapong}, + title = {XPBD: Position-based Simulation of Compliant Constrained Dynamics}, + booktitle = {ACM Motion in Games}, + year = {2016}, + series = {MIG '16}, + pages = {49--54}, + publisher = {ACM}, + acmid = {2994272}, + doi = {10.1145/2994258.2994272}, + isbn = {978-1-4503-4592-7}, + keywords = {constrained dynamics, physics simulation, position based dynamics}, + location = {Burlingame, California}, + numpages = {6}, + url = {http://doi.acm.org/10.1145/2994258.2994272}, +} \ No newline at end of file diff --git a/doc/bibliography.rst b/doc/bibliography.rst new file mode 100644 index 00000000..74cedc0b --- /dev/null +++ b/doc/bibliography.rst @@ -0,0 +1,6 @@ +References +========== + +.. bibliography:: bibliography.bib + :all: + diff --git a/doc/build_from_source.md b/doc/build_from_source.md new file mode 100644 index 00000000..77e6c0ec --- /dev/null +++ b/doc/build_from_source.md @@ -0,0 +1,147 @@ +# Installation Instructions - Linux + +## Ubuntu Fresh Install + +### Installation List + +```bash +sudo apt install git cmake xorg-dev freeglut3-dev build-essential +``` + +### Python Bindings + +If you plan on using the python bindings by specifying `-DUSE_PYTHON_BINDINGS=On`, then you should also have a working python installation in your path. This installs an additional tool `pipx`, which allows the installation of packages as executables in virtualized environments. + +```bash +sudo apt install python3-dev python3-pip python3-venv +python3 -m pip install pipx +python3 -m pipx ensurepath +``` + +Alternatively to this you may also install other Python Distributions such as Anaconda (personal preference). + +### Building Instructions + +```bash +git clone https://github.com/InteractiveComputerGraphics/PositionBasedDynamics.git +cd PositionBasedDynamics +mkdir build && cd build +cmake -DCMAKE_BUILD_TYPE=Release -DUSE_PYTHON_BINDINGS= .. +make -j 4 +``` + +### Run Executable + +Run any demo in the folder `bin`, e.g.: +``` +cd ../bin +./SceneLoaderDemo ../data/Scenes/CarScene.json +``` + +On some systems it may be necessary to define an OpenGL override like so + +```bash +cd ../bin +MESA_GL_VERSION_OVERRIDE=3.3 ./SceneLoaderDemo ../data/Scenes/CarScene.json +``` + +The command loads the selected scene. To start the simulation disable the pause mode by clicking the checkbox or pressing [Space]. More hotkeys are listed [here](getting_started.md). + +### Using Bindings + +Assuming that the python bindings were generated in the default location `Project Root/build/lib/pypbd.cpython-38-x86_64-linux-gnu.so`, you can use the bindings by adding this path to `sys.path` within your python script, or by calling your scripts within the directory containing the `.so` file. You can test that the bindings work using the following command. + +``` +cd lib +python3 -c "import pypbd" +``` + +### Installing Bindings + +If you followed the above instructions for building PositionBasedDynamics using CMake and generated the python bindings, then these commands should work automatically. + +**Note:** You don't have to clone the repository again. This only shows, that the command should be run in the project root directory. It is also recommended, that you create and activate a virtual environment before installing, so that your base python installation is not affected by any new generated files. + +```bash +git clone https://github.com/InteractiveComputerGraphics/PositionBasedDynamics.git +cd PositionBasedDynamics +python setup.py bdist_wheel +pip install build/dist/*.whl +``` + +If you specified any additional CMake variables in the form of `-DVAR_NAME=Value`, you can just append them after `bdist_wheel` + +Alternatively you may also run the following command, which essentially combines all of the above commands into a single command. + +```bash +pip install git+https://github.com/InteractiveComputerGraphics/PositionBasedDynamics.git +``` + +**Drawbacks:** You lose the ability for incremental rebuilds, i.e. if you want to modify the source code and build the bindings anew, you would have to build the entire project every time. + +# Installation Instructions - Windows + +## Visual Studio + +### Dependencies + +To build PositionBasedDynamics on Windows you need to install [CMake](https://cmake.org) and [git](https://git-scm.com/). + +### Python Bindings + +If you plan on using the python bindings by specifying `-DUSE_PYTHON_BINDINGS=On`, then you should also have a working Python installation in your path. Moreover, you require the Python Package Installer (pip). + +### Building Instructions + +First, clone the repository by + +```bash +git clone https://github.com/InteractiveComputerGraphics/PositionBasedDynamics.git +``` + +Then run cmake-gui and set "Where is the source code:" to the [PositionBasedDynamics-dir] and "Where to build the binaries:" to [PositionBasedDynamics-dir]/build. + +Now run Configure and select the correct Visual Studio version. Ensure that you choose a x64 build on a 64bit system. Finally, run Generate and open the project. Now you can build the project in Visual Studio. Note that you have to select the "Release" build, if you want to have an optimized executable. + + +### Run Executable + +Execute any demo in the folder "bin" to start the simulator. Alternatively, you can start the simulation by loading a json scene file in the command line: + +``` +./SceneLoaderDemo ../data/scenes/CarScene.json +``` + +The command loads the selected scene. To start the simulation disable the pause mode by clicking the checkbox or pressing [Space]. More hotkeys are listed [here](getting_started.md). + +### Using Bindings + +Assuming that the python bindings were generated in the default location [PositionBasedDynamics-dir]/build/lib/pypbd.cp37-win_amd64.pyd, you can use the bindings by adding this path to `sys.path` within your python script, or by calling your scripts within the directory containing the `.pyd` file. You can test that the bindings work using the following command. + +``` +cd lib +python3 -c "import pypbd" +``` + +### Installing Bindings + +If you followed the above instructions for building PositionBasedDynamics using CMake and generated the python bindings, then these commands should work automatically. + +**Note:** You don't have to clone the repository again. This only shows, that the command should be run in the project root directory. It is also recommended, that you create and activate a virtual environment before installing, so that your base python installation is not affected by any new generated files. + +```bash +git clone https://github.com/InteractiveComputerGraphics/PositionBasedDynamics.git +cd PositionBasedDynamics +python setup.py bdist_wheel +pip install build/dist/pyPBD-2.1.0-cp38-cp38-win_amd64.whl +``` + +If you specified any additional CMake variables in the form of `-DVAR_NAME=Value`, you can just append them after `bdist_wheel` + +Alternatively you may also run the following command, which essentially combines all of the above commands into a single command. + +```bash +pip install git+https://github.com/InteractiveComputerGraphics/PositionBasedDynamics.git +``` + +**Drawbacks:** You lose the ability for incremental rebuilds, i.e. if you want to modify the source code and build the bindings anew, you would have to build the entire project every time. diff --git a/doc/cmake_options.md b/doc/cmake_options.md new file mode 100644 index 00000000..6d0ef873 --- /dev/null +++ b/doc/cmake_options.md @@ -0,0 +1,17 @@ +# CMake Options + +This page should give you a short overview over the CMake options of PositionBasedDynamics. + +## USE_DOUBLE_PRECISION + +If this flag is enabled, then all computations with floating point values are performed using double precision (double). Otherwise single precision (float) is used. + +## USE_OpenMP + +Enable the OpenMP parallelization which lets the simulation run in parallel on all available cores of the CPU. + +## USE_PYTHON_BINDINGS + +Generate a shared library object which can be imported into python scripts and exposes C++ functionality to the python interpreter. +*Default:On* +*Options:* diff --git a/doc/conf.py b/doc/conf.py new file mode 100644 index 00000000..2bd828d8 --- /dev/null +++ b/doc/conf.py @@ -0,0 +1,101 @@ +# Configuration file for the Sphinx documentation builder. +# +# This file only contains a selection of the most common options. For a full +# list see the documentation: +# https://www.sphinx-doc.org/en/master/usage/configuration.html + +# -- Path setup -------------------------------------------------------------- + +# If extensions (or modules to document with autodoc) are in another directory, +# add these directories to sys.path here. If the directory is relative to the +# documentation root, use os.path.abspath to make it absolute, like shown here. +# +import os +import sys +sys.path.insert(0, os.path.abspath('.')) + + +# -- Project information ----------------------------------------------------- + +project = 'PositionBasedDynamics' +copyright = '2015, Interactive Computer Graphics' +author = 'Interactive Computer Graphics' + +# The full version, including alpha/beta/rc tags +f = open("../version.txt", "r") +release = f.readline() +f.close() +os.environ["PBD_VERSION"] = release + + +# -- General configuration --------------------------------------------------- + +# Add any Sphinx extension module names here, as strings. They can be +# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom +# ones. +extensions = [ + 'breathe', + 'exhale', + 'sphinx_rtd_theme', + 'recommonmark', + 'sphinxcontrib.bibtex' +] +bibtex_bibfiles = ['bibliography.bib'] + +# Setup the breathe extension +breathe_projects = { + project: "./doxyoutput/xml" +} +breathe_default_project = project + +# Setup the exhale extension +exhale_args = { + # These arguments are required + "containmentFolder": "./api", + "rootFileName": "library_root.rst", + "rootFileTitle": "Library API", + "doxygenStripFromPath": "..", + # Suggested optional arguments + "createTreeView": True, + "verboseBuild": False, + # TIP: if using the sphinx-bootstrap-theme, you need + # "treeViewIsBootstrap": True, + "exhaleExecutesDoxygen": True, + "exhaleUseDoxyfile": True + # "exhaleDoxygenStdin": "CITE_BIB_FILES=./bibliography.bib\nGENERATE_HTML=TRUE\nINPUT=../SPlisHSPlasH/" +} + +# Tell sphinx what the primary language being documented is. +primary_domain = 'cpp' + +# Tell sphinx what the pygments highlight language should be. +highlight_language = 'cpp' + +# Tell sphinx about file endings +source_suffix = { + '.rst': 'restructuredtext', + '.md': 'markdown', +} + +# Add any paths that contain templates here, relative to this directory. +templates_path = ['_templates'] + +# List of patterns, relative to source directory, that match files and +# directories to ignore when looking for source files. +# This pattern also affects html_static_path and html_extra_path. +exclude_patterns = ['_build', 'Thumbs.db', '.DS_Store'] + + +# -- Options for HTML output ------------------------------------------------- +# on_rtd is whether we are on readthedocs.org, this line of code grabbed from docs.readthedocs.org +on_rtd = os.environ.get('READTHEDOCS', None) == 'True' + +html_theme = 'sphinx_rtd_theme' +if not on_rtd: # only import and set the theme if we're building docs locally + import sphinx_rtd_theme + html_theme_path = [sphinx_rtd_theme.get_html_theme_path()] + +# Add any paths that contain custom static files (such as style sheets) here, +# relative to this directory. They are copied after the builtin static files, +# so a file named "default.css" will overwrite the builtin "default.css". +html_static_path = ['_static'] \ No newline at end of file diff --git a/doc/file_format.md b/doc/file_format.md new file mode 100644 index 00000000..62c6fbcc --- /dev/null +++ b/doc/file_format.md @@ -0,0 +1,595 @@ +# PositionBasedDynamics Scene Files + +A PositionBasedDynamics scene file is a json file which can contain the following blocks: + +* Name +* Camera parameters +* Simulation +* TriangleModels +* TetModels +* RigidBodies +* Joints + + +## Name + +Each scene has a name. + +Example code: +```json +"Name": "ExampleScene" +``` + +## Camera parameters + +Here parameters for the initial camera position can be defined. + +* cameraPosition (vec3): Initial position of the camera. +* cameraLookat (vec3): Lookat point of the camera. + +## Simulation + +This part contains the general settings of the simulation. + +Example code: +```json +"Simulation": + { + "pause": false, + "pauseAt": 10.0, + "timeStepSize": 0.01, + "numberOfStepsPerRenderUpdate": 4, + "subSteps": 5, + "maxIterations" : 1, + "maxIterationsV" : 5, + "velocityUpdateMethod" : 0, + "contactTolerance": 0.0, + "tetModelSimulationMethod": 2, + "clothSimulationMethod": 2, + "clothBendingMethod": 2, + "contactStiffnessRigidBody" : 1.0, + "contactStiffnessParticleRigidBody": 100.0, + "cloth_stiffness": 1.0, + "cloth_bendingStiffness": 0.005, + "cloth_xxStiffness": 1.0, + "cloth_yyStiffness": 1.0, + "cloth_xyStiffness": 1.0, + "cloth_xyPoissonRatio": 0.3, + "cloth_yxPoissonRatio": 0.3, + "cloth_normalizeStretch": 0, + "cloth_normalizeShear": 0, + "solid_stiffness": 1.0, + "solid_poissonRatio": 0.2, + "solid_normalizeStretch": 0, + "solid_normalizeShear": 0 + } +``` + +##### General: + +* pause (bool): Pause simulation at beginning (default: true). +* pauseAt (float): Pause simulation at the given time. When the value is negative, the simulation is not paused (default: -1). + +##### Simulation: + +* timeStepSize (float): The time step size used for the time integration. (default: 0.005). +* gravitation (vec3): Vector to define the gravitational acceleration (default: [0,-9.81,0]). +* velocityUpdateMethod (int) (default: 1): + - 0: First Order Update + - 1: Second Order Update +* maxIterations (int): Number of iterations of the PBD solver (default: 1). +* maxIterationsV (int): Number of iterations of the velocity solver (default: 5). +* subSteps (int): Number of sub steps of the PBD solver (default: 5). + + +##### Cloth Simulation + +* clothSimulationMethod (int): Cloth simulation method (default: 2): + - 0: None + - 1: Distance constraints + - 2: FEM based PBD + - 3: Strain based dynamics + - 4: XPBD distance constraints +* clothBendingMethod (int): Cloth bending method (default: 2): + - 0: None + - 1: Dihedral angle + - 2: Isometric bending + - 3: Isometric bending (XPBD) +* cloth_stiffness (float): Stiffness coefficient for the distance constraints (if there are any in the simulation) (default: 1.0). +* cloth_xxStiffness (float): XX stiffness of orthotropic cloth models (only used for FEM based PBD) (default: 1.0). +* cloth_yyStiffness (float): YY stiffness of orthotropic cloth models (only used for FEM based PBD) (default: 1.0). +* cloth_xyPoissonRatio (float): XY stiffness of orthotropic cloth models (only used for FEM based PBD) (default: 1.0). +* cloth_xyStiffness (float): XY Poisson ratio of orthotropic cloth models (only used for FEM based PBD) (default: 0.3). +* cloth_yyStiffness (float): YX Poisson ratio of orthotropic cloth models (only used for FEM based PBD) (default: 0.3). +* cloth_bendingStiffness (float): Bending stiffness of cloth models (default: 0.01). +* cloth_normalizeStretch (bool): Normalize stretch (only used for strain based dynamics) (default: false). +* cloth_normalizeShear (bool): Normalize shear (only used for strain based dynamics) (default: false). + +##### Solid Simulation + +* solidSimulationMethod (int): Solid simulation method (default: 2): + - 0: None + - 1: Distance & volume constraints + - 2: FEM based PBD + - 3: FEM based XPBD + - 4: Strain based dynamics (no inversion handling) + - 5: Shape Matching (no inversion handling) + - 6: XPBD distance constraints +* solid_stiffness (float): Stiffness/Young's modulus of solid models (default: 1.0). +* solid_poissonRatio (float): Poisson ratio of solid models (only used for FEM based PBD/XPBD) (default: 0.3). +* solid_volumeStiffness (float): Stiffness coefficient for the volume constraints (if there are any in the simulation) (default: 1.0). +* solid_normalizeStretch (bool): Normalize stretch (only used for strain based dynamics) (default: false). +* solid_normalizeShear (bool): Normalize shear (only used for strain based dynamics) (default: false). + +##### Rod Simulation + +* rod_stretchingStiffness (float): Stretching stiffness/Youngs modulus of elastic rod models (default: 1.0). +* rod_shearingStiffnessX (float): X shearing stiffness of elastic rod models (default: 1.0). +* rod_shearingStiffnessY (float): Y Shearing stiffness of elastic rod models (default: 1.0). +* rod_bendingStiffnessX (float): X bending stiffness of elastic rod models (default: 0.5). +* rod_bendingStiffnessY (float): Y bending stiffness of elastic rod models (default: 0.5). +* rod_twistingStiffness (float): Twisting stiffness of elastic rod models (default: 0.5). + +##### Contact Handling + +* contactTolerance (float): Tolerance of the collision detection (default: 0.01). +* contactStiffnessRigidBody (float): Stiffness coefficient for rigid-rigid contact resolution (default: 1.0). +* contactStiffnessParticleRigidBody (float): Stiffness coefficient for particle-rigid contact resolution (default: 100.0). + +##### Visualization: + +* numberOfStepsPerRenderUpdate (int): Number of simulation steps per rendered frame +* renderTets (bool): Render tet models (default: false). +* renderTets0 (bool): Render initial state of tet models (default: false). +* renderContacts (bool): Render contact points and normals (default: false). +* renderAABB (bool): Render axis-aligned bounding boxes (default: false). +* renderSDF (bool): Render signed distance fields (SDFs) (default: false). +* renderBVH (int): Render bounding volume hierarchies (BVHs) until given depth (default: -1). +* renderBVHDepthTets (int): Render bounding volume hierarchies (BVHs) of tets until given depth (default: -1). + +##### Export + +* exportOBJ (bool): Enable/disable OBJ file export (default: false). +* exportPLY (bool): Enable/disable PLY file export (default: false). +* exportFPS (float): Frame rate of file export (default: 25). + + + +## Triangle Models + +The simulation library supports triangle models to simulate cloth. In the following example a triangle mesh is loaded to simulate a quadratic piece of cloth where two particles are fixed. + +Example code: +```json +"TriangleModels": [ + { + "id": 0, + "geometryFile": "../models/plane_50x50.obj", + "translation": [5,8,0], + "rotationAxis": [1, 0, 0], + "rotationAngle": 0.0, + "scale": [10, 10, 10], + "staticParticles": [0,49], + "restitution" : 0.1, + "friction" : 0.1 + } +] +``` + +* id (int): ID of the triangle model (default: 0). +* geometryFile (string): File path of a triangle mesh file which should be loaded (default: ""). +* translation (vec3): Translation vector of the triangle model (default: [0,0,0]). +* scale (vec3): Scaling vector of the triangle model (default: [1,1,1]). +* rotationAxis (vec3): Axis used to rotate the triangle model after loading (default: [0,0,0]). +* rotationAngle (float): Rotation angle for the initial rotation of the triangle model (default: 0.0). +* staticParticles (array): List of particle indices to define static particles that do not move during the simulation (default: []). +* restitution (float): Resitution coefficient of the triangle model (default: 0.1). +* friction (float): Friction coefficient of the triangle model (default: 0.2). + + +## Tet Models + +The simulation library supports tet models to simulate deformable solids. In the following example a tet mesh is loaded to simulate an elastic Armadillo model. + +Example code: +```json +"TetModels": [ + { + "id": 0, + "nodeFile": "../models/armadillo_4k.node", + "eleFile": "../models/armadillo_4k.ele", + "visFile": "../models/armadillo.obj", + "translation": [0,8,0], + "rotationAxis": [1, 0, 0], + "rotationAngle": 1.57, + "scale": [2, 2, 2], + "staticParticles": [], + "restitution" : 0.1, + "friction" : 0.1, + "collisionObjectType": 5, + "collisionObjectFileName": "", + "collisionObjectScale": [ + 1, + 1, + 1 + ], + "testMesh": 1 + } +] +``` + +* id (int): ID of the tet model (default: 0). +* nodeFile (string): File path of a tet nodes file which should be loaded. Such a tet file can be generated from a surface mesh using TetGen (default: ""). +* eleFile (string): File path of a tet elements file which should be loaded. Such a tet file can be generated from a surface mesh using TetGen (default: ""). +* visFile (string): File path of a visualization triangle mesh file which should be loaded. This mesh is used only for the visualization and the mesh export (default: ""). +* translation (vec3): Translation vector of the tet model (default: [0,0,0]). +* scale (vec3): Scaling vector of the tet model (default: [1,1,1]). +* rotationAxis (vec3): Axis used to rotate the tet model after loading (default: [0,0,0]). +* rotationAngle (float): Rotation angle for the initial rotation of the tet model (default: 0.0). +* staticParticles (array): List of particle indices to define static particles that do not move during the simulation (default: []). +* restitution (float): Resitution coefficient of the tet model (default: 0.1). +* friction (float): Friction coefficient of the tet model (default: 0.2). +* collisionObjectType (int): The PBD simulator uses a collision detection based on signed distance functions or signed distance fields (SDF). If simple shapes like spheres and boxes are simulated an analytic signed distance function can be used for the detection. For arbitrary geometries a signed distance field is precomputed. Therefore, the correct type of geometry has to be chosen here (default: 0): + - 0: no collision object + - 1: sphere + - 2: box + - 3: cylinder + - 4: torus + - 5: Signed Distance Field (SDF) + - 6: hollow sphere + - 7: hollow box +* collisionObjectFileName (string): File path of a geometry file which contains the collision geometry of the solid. This is used to generate an SDF if collisionObjectType 5 is chosen (default: ""). +* testMesh (bool): Defines if the vertices of the solid geometry are tested against the signed distance fields of other objects for collisions (default: true). +* collisionObjectScale (vec3): Scaling vector of the collision object of the solid. In most cases this should be the same value as for "scale" (default: [1,1,1]). +* invertSDF (bool): Invert the signed distance field, flips inside/outside (default: false) +* thicknessSDF (float): Additional thickness of a signed distance field. The geometry is extended by this distance (default: 0.1). +* resolutionSDF (vec3): Resolution of the signed distance field. Using a higher resolution means that the original geometry can be represented more accurately. Since the field is precomputed, a higher resolution does not directly affect the simulation performance (defaut: [10,10,10]). + + + +## RigidBodies + +Here, the static and dynamic rigid bodies are defined for the simulation. If you want to connect two rigid bodies by a joint, make sure to give them an ID. The ID can then be usd for the joint definition. + +Example code: +```json +"RigidBodies": [ + { + "angularVelocity": [0, 0, 0], + "collisionObjectFileName": "", + "collisionObjectScale": [500, 1, 500], + "collisionObjectType": 2, + "density": 500, + "friction": 0.3, + "geometryFile": "../models/cube.obj", + "flatShading": true, + "id": 1, + "isDynamic": false, + "restitution": 0.5, + "rotationAngle": 0.0, + "rotationAxis": [1, 0, 0], + "scale": [500, 1, 500], + "testMesh": 1, + "translation": [0, -0.5, 0], + "velocity": [0, 0, 0] + } +] +``` + +* id (int): ID of the rigid body which is required for joint definitions (default: 0). +* translation (vec3): Translation vector of the rigid body (default: [0,0,0]). +* scale (vec3): Scaling vector of the rigid body (default: [1,1,1]). +* rotationAxis (vec3): Axis used to rotate the rigid body after loading (default: [0,0,0]). +* rotationAngle (float): Rotation angle for the initial rotation of the rigid body (default: 0.0). +* isDynamic (bool): Defines if the body is static or dynamic. +* density (float): Density of the rigid body (default: 1.0). +* flatShading (bool): Enables/disables flat shading (default: false). +* velocity (vec3): Initial velocity of the rigid body (default: [0,0,0]). +* angularVelocity (vec3): Initial angular velocity of the rigid body (default: [0,0,0]). +* restitution (float): Resitution coefficient of the rigid body (default: 0.6). +* friction (float): Friction coefficient of the rigid body (default: 0.2). +* collisionObjectType (int): The PBD simulator uses a collision detection based on signed distance functions or signed distance fields (SDF). If simple shapes like spheres and boxes are simulated an analytic signed distance function can be used for the detection. For arbitrary geometries a signed distance field is precomputed. Therefore, the correct type of geometry has to be chosen here (default: 0): + - 0: no collision object + - 1: sphere + - 2: box + - 3: cylinder + - 4: torus + - 5: Signed Distance Field (SDF) + - 6: hollow sphere + - 7: hollow box +* collisionObjectFileName (string): File path of a geometry file which contains the collision geometry of the rigid body. This is used to generate an SDF if collisionObjectType 5 is chosen (default: ""). +* testMesh (bool): Defines if the vertices of the rigid body geometry are tested against the signed distance fields of other objects for collisions (default: true). +* collisionObjectScale (vec3): Scaling vector of the collision object of the rigid body. In most cases this should be the same value as for "scale" (default: [1,1,1]). +* invertSDF (bool): Invert the signed distance field, flips inside/outside (default: false) +* thicknessSDF (float): Additional thickness of a signed distance field. The geometry is extended by this distance (default: 0.1). +* resolutionSDF (vec3): Resolution of the signed distance field. Using a higher resolution means that the original geometry can be represented more accurately. Since the field is precomputed, a higher resolution does not directly affect the simulation performance (defaut: [10,10,10]). + +## Joints + +### BallJoints + +This joint links two rigid bodies in a common point so that both can rotate around this point. + +Example code: +```json +"BallJoints": [ + { + "bodyID1": 1, + "bodyID2": 2, + "position": [0,1,0] + } +] +``` + +* bodyID1 (int): ID of the first rigid body of the joint. +* bodyID2 (int): ID of the second rigid body of the joint. +* position (vec3): Position of the common connector point. + +### BallOnLineJoints + +This joint is like a ball joint that can move on a given line. + +Example code: +```json +"BallOnLineJoints": [ + { + "bodyID1": 1, + "bodyID2": 2, + "position": [0,1,0], + "axis": [1,0,0] + } +] +``` + +* bodyID1 (int): ID of the first rigid body of the joint. +* bodyID2 (int): ID of the second rigid body of the joint. +* position (vec3): Point on the line. +* axis (vec3): Direction vector of the line. + +### HingeJoints + +This joint links two rigid bodies so that both can rotate around a common axis. + +Example code: +```json +"HingeJoints": [ + { + "bodyID1": 1, + "bodyID2": 2, + "position": [0,1,0], + "axis": [1,0,0] + } +] +``` + +* bodyID1 (int): ID of the first rigid body of the joint. +* bodyID2 (int): ID of the second rigid body of the joint. +* position (vec3): Point on the rotation axis. +* axis (vec3): Direction vector of the rotation axis. + +### UniversalJoints + +This joint links two rigid bodies so that both can rotate around two common axes. + +Example code: +```json +"HingeJoints": [ + { + "bodyID1": 1, + "bodyID2": 2, + "position": [0,1,0], + "axis1": [1,0,0], + "axis2": [0,1,0] + } +] +``` + +* bodyID1 (int): ID of the first rigid body of the joint. +* bodyID2 (int): ID of the second rigid body of the joint. +* position (vec3): Point on both rotation axes. +* axis1 (vec3): Direction vector of the first rotation axis. +* axis2 (vec3): Direction vector of the second rotation axis. + +### SliderJoints + +This joint links two rigid bodies so that they can slide on a common axis. + +Example code: +```json +"SliderJoints": [ + { + "bodyID1": 1, + "bodyID2": 2, + "axis": [1,0,0] + } +] +``` + +* bodyID1 (int): ID of the first rigid body of the joint. +* bodyID2 (int): ID of the second rigid body of the joint. +* axis (vec3): Direction vector of the slider axis. + +### RigidBodyParticleBallJoints + +This joint links a rigid body and a particle by a ball joint so that the rigid body can rotate around the particle. + +Example code: +```json +"RigidBodyParticleBallJoints": [ + { + "rbID": 1, + "particleID": 2 + } +] +``` + +* rbID (int): ID of the rigid body of the joint. +* particleID (int): ID of the particle of the joint. +* position (vec3): Position of the common connector point. + +### RigidBodySprings + +This joint links two rigid bodies by a spring. + +Example code: +```json +"RigidBodySprings": [ + { + "bodyID1": 1, + "bodyID2": 2, + "position1": [1,0,0], + "position2": [2,0,0], + "stiffness": 10000.0 + } +] +``` + +* bodyID1 (int): ID of the first rigid body of the joint. +* bodyID2 (int): ID of the second rigid body of the joint. +* position1 (vec3): Position of connector point in body 1. +* position2 (vec3): Position of connector point in body 2. +* stiffness (float): Stiffness of the spring. + +### DistanceJoints + +This joint links two rigid bodies by a distance constraint so that the connector points in both bodies have a constant distance during the simulation. + +Example code: +```json +"DistanceJoints": [ + { + "bodyID1": 1, + "bodyID2": 2, + "position1": [1,0,0], + "position2": [2,0,0] + } +] +``` + +* bodyID1 (int): ID of the first rigid body of the joint. +* bodyID2 (int): ID of the second rigid body of the joint. +* position1 (vec3): Position of connector point in body 1. +* position2 (vec3): Position of connector point in body 2. + +### DamperJoints + +This joint links two rigid bodies so that they can slide on a common axis while a spring force is also acting on this axis. + +Example code: +```json +"DamperJoints": [ + { + "bodyID1": 2, + "bodyID2": 3, + "axis": [0,1,0], + "stiffness": 500000.0 + } +] +``` + +* bodyID1 (int): ID of the first rigid body of the joint. +* bodyID2 (int): ID of the second rigid body of the joint. +* axis (vec3): Direction vector of the slider axis. +* stiffness (float): Stiffness of the spring. + +### TargetAngleMotorHingeJoints + +This joint links two rigid bodies by a angular motor so that both can rotate around a common axis. Moreover, a target angle can be defined. + +Example code: +```json +"TargetAngleMotorHingeJoints": [ + { + "bodyID1": 1, + "bodyID2": 2, + "position": [0,1,0], + "axis": [1,0,0], + "repeatSequence": true, + "targetSequence": [0,0,2,0.707,8,0.707,12,-0.707,18,-0.707,20,0] + } +] +``` + +* bodyID1 (int): ID of the first rigid body of the joint. +* bodyID2 (int): ID of the second rigid body of the joint. +* position (vec3): Point on the rotation axis. +* axis (vec3): Direction vector of the rotation axis. +* target (float): Target angle of the motor. Either you can define a target angle or a target angle sequence. If both are defined, only the target angle is considered. +* targetSequence (array): This array defines pairs (time,target angle). So in the example above at time 0 the target angle is 0, at time 2 the angle is 0.707 and so on. In this way a sequence of angles for an animation can be defined (see also the CarScene.json example). +* repeatSequence (bool): Defines if the targetSequence is repeated in a loop. + + +### TargetVelocityMotorHingeJoints + +This joint links two rigid bodies by a angular motor so that both can rotate around a common axis. Moreover, a target angular velocity can be defined. + +Example code: +```json +"TargetVelocityMotorHingeJoints": [ + { + "bodyID1": 1, + "bodyID2": 2, + "position": [0,1,0], + "axis": [1,0,0], + "repeatSequence": false, + "targetSequence": [0,0,2,0.5,3,2] + } +] +``` + +* bodyID1 (int): ID of the first rigid body of the joint. +* bodyID2 (int): ID of the second rigid body of the joint. +* position (vec3): Point on the rotation axis. +* axis (vec3): Direction vector of the rotation axis. +* target (float): Target angular velocity of the motor. Either you can define a target velocity or a target velocity sequence. If both are defined, only the target velocity is considered. +* targetSequence (array): This array defines pairs (time,target angular velocity). So in the example above at time 0 the target velocity is 0, at time 2 the angle is 0.5 and so on. In this way a sequence of velocities for an animation can be defined. +* repeatSequence (bool): Defines if the targetSequence is repeated in a loop. + +### TargetPositionMotorSliderJoints + +This joint links two rigid bodies by a slider motor so that both can slide on a common axis. Moreover, a target position can be defined. + +Example code: +```json +"TargetPositionMotorSliderJoints": [ + { + "bodyID1": 1, + "bodyID2": 2, + "axis": [1,0,0], + "repeatSequence": true, + "targetSequence": [0,0,2,0.5,3,2] + } +] +``` + +* bodyID1 (int): ID of the first rigid body of the joint. +* bodyID2 (int): ID of the second rigid body of the joint. +* axis (vec3): Direction vector of the slider axis. +* target (float): Target position of the motor. Either you can define a target position or a target position sequence. If both are defined, only the target position is considered. +* targetSequence (array): This array defines pairs (time,target position). So in the example above at time 0 the target position is 0, at time 2 the position is 0.5 and so on. In this way a sequence of positions for an animation can be defined. +* repeatSequence (bool): Defines if the targetSequence is repeated in a loop. + + +### TargetVelocityMotorSliderJoints + +This joint links two rigid bodies by a slider motor so that both can slide on a common axis. Moreover, a target velocity can be defined. + +Example code: +```json +"TargetPositionMotorSliderJoints": [ + { + "bodyID1": 1, + "bodyID2": 2, + "axis": [1,0,0], + "repeatSequence": true, + "targetSequence": [0,0,2,0.5,3,2] + } +] +``` + +* bodyID1 (int): ID of the first rigid body of the joint. +* bodyID2 (int): ID of the second rigid body of the joint. +* axis (vec3): Direction vector of the slider axis. +* target (float): Target velocity of the motor. Either you can define a target velocity or a target velocity sequence. If both are defined, only the target velocity is considered. +* targetSequence (array): This array defines pairs (time,target velocity). So in the example above at time 0 the target velocity is 0, at time 2 the velocity is 0.5 and so on. In this way a sequence of velocities for an animation can be defined. +* repeatSequence (bool): Defines if the targetSequence is repeated in a loop. \ No newline at end of file diff --git a/doc/getting_started.md b/doc/getting_started.md new file mode 100644 index 00000000..dec89ce9 --- /dev/null +++ b/doc/getting_started.md @@ -0,0 +1,50 @@ +# Getting started + +This page should give you a short overview of PositionBasedDynamics. + +## Demos + +After building the PositionBasedDynamics library, there are several demos which can by executed in the binary folder. To execute a demo, you can call, e.g.: + +``` +cd ../bin +./BarDemo +``` + +## SceneLoaderDemo + +This special demo reads a PositionBasedDynamics scene file and performs a simulation of the scene. You can start this simulator, e.g., by calling: + +``` +cd ../bin +./SceneLoaderDemo ../data/Scenes/CarScene.json +``` + +The scene file format is explained [here.](file_format.md) + +##### Hotkeys + +* Space: pause/contiunue simulation +* r: reset simulation +* w: wireframe rendering of meshes +* ESC: exit + +## Python bindings + +PositionBasedDynamics implements bindings for python using [pybind11](https://github.com/pybind/pybind11). +See the [getting started guide](./py_getting_started.md). + +### Impatient installation guide + +In order to install, simply clone the repository and run pip install on the repository. +It is recommended, that you set up a **virtual environment** for this, because cache files will be stored in the directory of the python installation along with models and scene files. + +```shell script +git clone https://github.com/InteractiveComputerGraphics/PositionBasedDynamics.git +pip install PositionBasedDynamics/ +``` + + + + + diff --git a/doc/images/PBD1.jpg b/doc/images/PBD1.jpg new file mode 100644 index 00000000..f19f42da Binary files /dev/null and b/doc/images/PBD1.jpg differ diff --git a/doc/images/PBD2.jpg b/doc/images/PBD2.jpg new file mode 100644 index 00000000..35a4f15f Binary files /dev/null and b/doc/images/PBD2.jpg differ diff --git a/doc/index.rst b/doc/index.rst new file mode 100644 index 00000000..e09431e0 --- /dev/null +++ b/doc/index.rst @@ -0,0 +1,39 @@ +.. toctree:: + :maxdepth: 2 + :caption: Introduction: + + about + getting_started + file_format + +.. toctree:: + :maxdepth: 2 + :caption: Developer Guide: + + build_from_source + cmake_options + +.. toctree:: + :maxdepth: 2 + :caption: Python Package: + + py_getting_started + +.. toctree:: + :maxdepth: 2 + :caption: API Documentation: + + api/library_root + +.. toctree:: + :caption: References + + bibliography + + +Indices and tables +================== + +* :ref:`genindex` +* :ref:`search` + diff --git a/doc/mainpage.dox b/doc/mainpage.dox index 75b774ee..dd447d91 100644 --- a/doc/mainpage.dox +++ b/doc/mainpage.dox @@ -10,7 +10,7 @@ This is the API documentation for PositionBasedDynamics. The MIT License (MIT) -Copyright (c) 2015-2016 Jan Bender +Copyright (c) 2015-present, PositionBasedDynamics contributors Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal diff --git a/doc/make.bat b/doc/make.bat new file mode 100644 index 00000000..922152e9 --- /dev/null +++ b/doc/make.bat @@ -0,0 +1,35 @@ +@ECHO OFF + +pushd %~dp0 + +REM Command file for Sphinx documentation + +if "%SPHINXBUILD%" == "" ( + set SPHINXBUILD=sphinx-build +) +set SOURCEDIR=. +set BUILDDIR=_build + +if "%1" == "" goto help + +%SPHINXBUILD% >NUL 2>NUL +if errorlevel 9009 ( + echo. + echo.The 'sphinx-build' command was not found. Make sure you have Sphinx + echo.installed, then set the SPHINXBUILD environment variable to point + echo.to the full path of the 'sphinx-build' executable. Alternatively you + echo.may add the Sphinx directory to PATH. + echo. + echo.If you don't have Sphinx installed, grab it from + echo.http://sphinx-doc.org/ + exit /b 1 +) + +%SPHINXBUILD% -M %1 %SOURCEDIR% %BUILDDIR% %SPHINXOPTS% %O% +goto end + +:help +%SPHINXBUILD% -M help %SOURCEDIR% %BUILDDIR% %SPHINXOPTS% %O% + +:end +popd diff --git a/doc/py_getting_started.md b/doc/py_getting_started.md new file mode 100644 index 00000000..379f195f --- /dev/null +++ b/doc/py_getting_started.md @@ -0,0 +1,75 @@ +# pyPBD + +## Python bindings for the PositionBasedDynamics library + +## Requirements + +Currently the generation of python bindings is only tested on + +- Linux Debian, gcc 8.3, Python 3.7/3.8 (Anaconda), CMake 3.13 +- Windows 10, Visual Studio 15/17/19, Python 3.7/3.8 (Anaconda), CMake 3.13 + +Note that the compiler, the python installation as well as cmake have to be available from the command line for the installation process to work. MacOS builds should work but have not been tested. + +## Installation + +In order to install it is advised that you create a new virtual environment so that any faults during installation can not mess up your python installation. This is done as follows for + +**conda** + +```shell script +conda create --name venv python=3.7 +conda activate venv +``` + +**virtualenv** + +```shell script +python3 -m virtualenv venv --python=python3.7 +source venv/bin/activate +``` + +Now you can clone the repository by + +```shell script +git clone https://github.com/InteractiveComputerGraphics/PositionBasedDynamics.git +``` + +And finally you should be able to install PositionBasedDynamics using pip. +**The trailing slash is important** otherwise pip will try to download the package, which is not supported yet at least. +Also note, that `pip install PositionBasedDynamics` should be called from **one directory above** the cloned source directory and **not within** the directory itself. + +```shell script +pip install PositionBasedDynamics/ +``` + +While `pip install` is useful if PositionBasedDynamics should only be installed once, for development purposes it might be more sensible to build differently. +Change into the PositionBasedDynamics directory and build a python wheel file as follows + +```shell script +cd PositionBasedDynamics +python setup.py bdist_wheel +pip install -I build/dist/*.whl +``` + +When building a new version of PositionBasedDynamics simply run these commands again and the installation will be updated. +The compile times will be lower, because the build files from previous installations remain. +If you are getting compile errors please try to compile the pypbd target of the CMake project separately. + +Now check your installation by running + +```shell script +python -c "import pypbd" +``` + +**Note**: You may have to install numpy. +Future releases may already contain numpy as a dependency. + +```shell script +pip install numpy +``` + +## Examples + +In the folder "pyPBD/examples" you can find several examples which use the Python interface. + diff --git a/doc/requirements.txt b/doc/requirements.txt new file mode 100644 index 00000000..ec90ed28 --- /dev/null +++ b/doc/requirements.txt @@ -0,0 +1,6 @@ +exhale +recommonmark +Sphinx==5.2.3 +sphinx_rtd_theme==1.3.0 +sphinxcontrib.bibtex==2.6.1 +docutils==0.16 diff --git a/extern/AntTweakBar/CMakeLists.txt b/extern/AntTweakBar/CMakeLists.txt deleted file mode 100644 index 93ca3b01..00000000 --- a/extern/AntTweakBar/CMakeLists.txt +++ /dev/null @@ -1,71 +0,0 @@ -set(ATB_SOURCES - src/AntPerfTimer.h - src/LoadOGL.cpp - src/LoadOGL.h - src/LoadOGLCore.cpp - src/LoadOGLCore.h - src/MiniGLFW.h - src/MiniGLUT.h - src/MiniSDL12.h - src/MiniSDL13.h - src/MiniSFML16.h - src/TwBar.cpp - src/TwBar.h - src/TwColors.cpp - src/TwColors.h - src/TwEventGLFW.c - src/TwEventGLUT.c - src/TwEventSDL.c - src/TwEventSDL12.c - src/TwEventSDL13.c - src/TwEventSFML.cpp - src/TwFonts.cpp - src/TwFonts.h - src/TwGraph.h - src/TwMgr.cpp - src/TwMgr.h - src/TwOpenGL.cpp - src/TwOpenGL.h - src/TwOpenGLCore.cpp - src/TwOpenGLCore.h - src/TwPrecomp.cpp - src/TwPrecomp.h -) - -set(ATB_HEADERS - include/AntTweakBar.h -) - -add_definitions(-DTW_EXPORTS -DTW_STATIC) - -if (WIN32) - list(APPEND ATB_SOURCES src/TwEventWin.c) - set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -wd4005") -endif() - -if (APPLE) - include_directories ( /System/Library/Frameworks ) - find_library(APPKIT_LIBRARY AppKit) - set(EXTRA_LIBS ${APPKIT_LIBRARY}) - set(CMAKE_CXX_FLAGS "-g -Wall -ObjC++ -fPIC -fno-strict-aliasing -D__PLACEMENT_NEW_INLINE") - add_definitions(-D_MACOSX) -elseif (UNIX) - add_definitions(-D_UNIX -D__PLACEMENT_NEW_INLINE) -endif() - -include_directories(include) - -add_library(AntTweakBar STATIC ${ATB_HEADERS} ${ATB_SOURCES}) - -set_target_properties(AntTweakBar PROPERTIES FOLDER "External Dependencies") - -if (APPLE) - target_link_libraries(AntTweakBar) -elseif (UNIX) - target_link_libraries(AntTweakBar X11) -endif() - -set(AntTweakBar_INCLUDE_DIRS ${CMAKE_CURRENT_SOURCE_DIR}/include - CACHE INTERNAL "AntTweakBar include directory") -set(AntTweakBar_LIBRARIES AntTweakBar - CACHE INTERNAL "AntTweakBar library") diff --git a/extern/AntTweakBar/License.txt b/extern/AntTweakBar/License.txt deleted file mode 100644 index edee7193..00000000 --- a/extern/AntTweakBar/License.txt +++ /dev/null @@ -1,22 +0,0 @@ ---- AntTweakBar license --- - -Copyright (C) 2005-2013 Philippe Decaudin - -This software is provided 'as-is', without any express or implied warranty. -In no event will the authors be held liable for any damages arising from the -use of this software. - -Permission is granted to anyone to use this software for any purpose, including -commercial applications, and to alter it and redistribute it freely, subject to -the following restrictions: - -1. The origin of this software must not be misrepresented; you must not claim -that you wrote the original software. If you use this software in a product, -an acknowledgment in the product documentation would be appreciated but is not -required. - -2. Altered source versions must be plainly marked as such, and must not be -misrepresented as being the original software. - -3. This notice may not be removed or altered from any source distribution. - diff --git a/extern/AntTweakBar/include/AntTweakBar.h b/extern/AntTweakBar/include/AntTweakBar.h deleted file mode 100644 index b3745396..00000000 --- a/extern/AntTweakBar/include/AntTweakBar.h +++ /dev/null @@ -1,378 +0,0 @@ -// ---------------------------------------------------------------------------- -// -// @file AntTweakBar.h -// -// @brief AntTweakBar is a light and intuitive graphical user interface -// that can be readily integrated into OpenGL and DirectX -// applications in order to interactively tweak parameters. -// -// @author Philippe Decaudin -// -// @doc http://anttweakbar.sourceforge.net/doc -// -// @license This file is part of the AntTweakBar library. -// AntTweakBar is a free software released under the zlib license. -// For conditions of distribution and use, see License.txt -// -// ---------------------------------------------------------------------------- - - -#if !defined TW_INCLUDED -#define TW_INCLUDED - -#include - -#define TW_VERSION 116 // Version Mmm : M=Major mm=minor (e.g., 102 is version 1.02) - - -#ifdef __cplusplus -# if defined(_MSC_VER) -# pragma warning(push) -# pragma warning(disable: 4995 4530) -# include -# pragma warning(pop) -# else -# include -# endif - extern "C" { -#endif // __cplusplus - - -// ---------------------------------------------------------------------------- -// OS specific definitions -// ---------------------------------------------------------------------------- - -#if (defined(_WIN32) || defined(_WIN64)) //&& !defined(TW_STATIC) -# define TW_CALL __stdcall -# define TW_CDECL_CALL __cdecl -# define TW_EXPORT_API __declspec(dllexport) -# define TW_IMPORT_API __declspec(dllimport) -#else -# define TW_CALL -# define TW_CDECL_CALL -# define TW_EXPORT_API -# define TW_IMPORT_API -#endif - -#if defined TW_EXPORTS -# define TW_API TW_EXPORT_API -#elif defined TW_STATIC -# define TW_API -// # if defined(_MSC_VER) && !defined(TW_NO_LIB_PRAGMA) -// # ifdef _WIN64 -// # pragma comment(lib, "AntTweakBarStatic64") -// # else -// # pragma comment(lib, "AntTweakBarStatic") -// # endif -// # endif -#else -# define TW_API TW_IMPORT_API -// # if defined(_MSC_VER) && !defined(TW_NO_LIB_PRAGMA) -// # ifdef _WIN64 -// # pragma comment(lib, "AntTweakBar64") -// # else -// # pragma comment(lib, "AntTweakBar") -// # endif -// # endif -#endif - - -// ---------------------------------------------------------------------------- -// Bar functions and definitions -// ---------------------------------------------------------------------------- - -typedef struct CTwBar TwBar; // structure CTwBar is not exposed. - -TW_API TwBar * TW_CALL TwNewBar(const char *barName); -TW_API int TW_CALL TwDeleteBar(TwBar *bar); -TW_API int TW_CALL TwDeleteAllBars(); -TW_API int TW_CALL TwSetTopBar(const TwBar *bar); -TW_API TwBar * TW_CALL TwGetTopBar(); -TW_API int TW_CALL TwSetBottomBar(const TwBar *bar); -TW_API TwBar * TW_CALL TwGetBottomBar(); -TW_API const char * TW_CALL TwGetBarName(const TwBar *bar); -TW_API int TW_CALL TwGetBarCount(); -TW_API TwBar * TW_CALL TwGetBarByIndex(int barIndex); -TW_API TwBar * TW_CALL TwGetBarByName(const char *barName); -TW_API int TW_CALL TwRefreshBar(TwBar *bar); - -// ---------------------------------------------------------------------------- -// Var functions and definitions -// ---------------------------------------------------------------------------- - -typedef enum ETwType -{ - TW_TYPE_UNDEF = 0, -#ifdef __cplusplus - TW_TYPE_BOOLCPP = 1, -#endif // __cplusplus - TW_TYPE_BOOL8 = 2, - TW_TYPE_BOOL16, - TW_TYPE_BOOL32, - TW_TYPE_CHAR, - TW_TYPE_INT8, - TW_TYPE_UINT8, - TW_TYPE_INT16, - TW_TYPE_UINT16, - TW_TYPE_INT32, - TW_TYPE_UINT32, - TW_TYPE_FLOAT, - TW_TYPE_DOUBLE, - TW_TYPE_COLOR32, // 32 bits color. Order is RGBA if API is OpenGL or Direct3D10, and inversed if API is Direct3D9 (can be modified by defining 'colorOrder=...', see doc) - TW_TYPE_COLOR3F, // 3 floats color. Order is RGB. - TW_TYPE_COLOR4F, // 4 floats color. Order is RGBA. - TW_TYPE_CDSTRING, // Null-terminated C Dynamic String (pointer to an array of char dynamically allocated with malloc/realloc/strdup) -#ifdef __cplusplus -# if defined(_MSC_VER) && (_MSC_VER == 1600) - TW_TYPE_STDSTRING = (0x2ffe0000+sizeof(std::string)), // VS2010 C++ STL string (std::string) -# else - TW_TYPE_STDSTRING = (0x2fff0000+sizeof(std::string)), // C++ STL string (std::string) -# endif -#endif // __cplusplus - TW_TYPE_QUAT4F = TW_TYPE_CDSTRING+2, // 4 floats encoding a quaternion {qx,qy,qz,qs} - TW_TYPE_QUAT4D, // 4 doubles encoding a quaternion {qx,qy,qz,qs} - TW_TYPE_DIR3F, // direction vector represented by 3 floats - TW_TYPE_DIR3D // direction vector represented by 3 doubles -} TwType; -#define TW_TYPE_CSSTRING(n) ((TwType)(0x30000000+((n)&0xfffffff))) // Null-terminated C Static String of size n (defined as char[n], with n<2^28) - -typedef void (TW_CALL * TwSetVarCallback)(const void *value, void *clientData); -typedef void (TW_CALL * TwGetVarCallback)(void *value, void *clientData); -typedef void (TW_CALL * TwButtonCallback)(void *clientData); - -TW_API int TW_CALL TwAddVarRW(TwBar *bar, const char *name, TwType type, void *var, const char *def); -TW_API int TW_CALL TwAddVarRO(TwBar *bar, const char *name, TwType type, const void *var, const char *def); -TW_API int TW_CALL TwAddVarCB(TwBar *bar, const char *name, TwType type, TwSetVarCallback setCallback, TwGetVarCallback getCallback, void *clientData, const char *def); -TW_API int TW_CALL TwAddButton(TwBar *bar, const char *name, TwButtonCallback callback, void *clientData, const char *def); -TW_API int TW_CALL TwAddSeparator(TwBar *bar, const char *name, const char *def); -TW_API int TW_CALL TwRemoveVar(TwBar *bar, const char *name); -TW_API int TW_CALL TwRemoveAllVars(TwBar *bar); - -typedef struct CTwEnumVal -{ - int Value; - const char * Label; -} TwEnumVal; -typedef struct CTwStructMember -{ - const char * Name; - TwType Type; - size_t Offset; - const char * DefString; -} TwStructMember; -typedef void (TW_CALL * TwSummaryCallback)(char *summaryString, size_t summaryMaxLength, const void *value, void *clientData); - -TW_API int TW_CALL TwDefine(const char *def); -TW_API TwType TW_CALL TwDefineEnum(const char *name, const TwEnumVal *enumValues, unsigned int nbValues); -TW_API TwType TW_CALL TwDefineEnumFromString(const char *name, const char *enumString); -TW_API TwType TW_CALL TwDefineStruct(const char *name, const TwStructMember *structMembers, unsigned int nbMembers, size_t structSize, TwSummaryCallback summaryCallback, void *summaryClientData); - -typedef void (TW_CALL * TwCopyCDStringToClient)(char **destinationClientStringPtr, const char *sourceString); -TW_API void TW_CALL TwCopyCDStringToClientFunc(TwCopyCDStringToClient copyCDStringFunc); -TW_API void TW_CALL TwCopyCDStringToLibrary(char **destinationLibraryStringPtr, const char *sourceClientString); -#ifdef __cplusplus -typedef void (TW_CALL * TwCopyStdStringToClient)(std::string& destinationClientString, const std::string& sourceString); -TW_API void TW_CALL TwCopyStdStringToClientFunc(TwCopyStdStringToClient copyStdStringToClientFunc); -TW_API void TW_CALL TwCopyStdStringToLibrary(std::string& destinationLibraryString, const std::string& sourceClientString); -#endif // __cplusplus - -typedef enum ETwParamValueType -{ - TW_PARAM_INT32, - TW_PARAM_FLOAT, - TW_PARAM_DOUBLE, - TW_PARAM_CSTRING // Null-terminated array of char (ie, c-string) -} TwParamValueType; -TW_API int TW_CALL TwGetParam(TwBar *bar, const char *varName, const char *paramName, TwParamValueType paramValueType, unsigned int outValueMaxCount, void *outValues); -TW_API int TW_CALL TwSetParam(TwBar *bar, const char *varName, const char *paramName, TwParamValueType paramValueType, unsigned int inValueCount, const void *inValues); - - -// ---------------------------------------------------------------------------- -// Management functions and definitions -// ---------------------------------------------------------------------------- - -typedef enum ETwGraphAPI -{ - TW_OPENGL = 1, - TW_DIRECT3D9 = 2, - TW_DIRECT3D10 = 3, - TW_DIRECT3D11 = 4, - TW_OPENGL_CORE = 5 -} TwGraphAPI; - -TW_API int TW_CALL TwInit(TwGraphAPI graphAPI, void *device); -TW_API int TW_CALL TwTerminate(); - -TW_API int TW_CALL TwDraw(); -TW_API int TW_CALL TwWindowSize(int width, int height); - -TW_API int TW_CALL TwSetCurrentWindow(int windowID); // multi-windows support -TW_API int TW_CALL TwGetCurrentWindow(); -TW_API int TW_CALL TwWindowExists(int windowID); - -typedef enum ETwKeyModifier -{ - TW_KMOD_NONE = 0x0000, // same codes as SDL keysym.mod - TW_KMOD_SHIFT = 0x0003, - TW_KMOD_CTRL = 0x00c0, - TW_KMOD_ALT = 0x0100, - TW_KMOD_META = 0x0c00 -} TwKeyModifier; -typedef enum EKeySpecial -{ - TW_KEY_BACKSPACE = '\b', - TW_KEY_TAB = '\t', - TW_KEY_CLEAR = 0x0c, - TW_KEY_RETURN = '\r', - TW_KEY_PAUSE = 0x13, - TW_KEY_ESCAPE = 0x1b, - TW_KEY_SPACE = ' ', - TW_KEY_DELETE = 0x7f, - TW_KEY_UP = 273, // same codes and order as SDL 1.2 keysym.sym - TW_KEY_DOWN, - TW_KEY_RIGHT, - TW_KEY_LEFT, - TW_KEY_INSERT, - TW_KEY_HOME, - TW_KEY_END, - TW_KEY_PAGE_UP, - TW_KEY_PAGE_DOWN, - TW_KEY_F1, - TW_KEY_F2, - TW_KEY_F3, - TW_KEY_F4, - TW_KEY_F5, - TW_KEY_F6, - TW_KEY_F7, - TW_KEY_F8, - TW_KEY_F9, - TW_KEY_F10, - TW_KEY_F11, - TW_KEY_F12, - TW_KEY_F13, - TW_KEY_F14, - TW_KEY_F15, - TW_KEY_LAST -} TwKeySpecial; - -TW_API int TW_CALL TwKeyPressed(int key, int modifiers); -TW_API int TW_CALL TwKeyTest(int key, int modifiers); - -typedef enum ETwMouseAction -{ - TW_MOUSE_RELEASED, - TW_MOUSE_PRESSED -} TwMouseAction; -typedef enum ETwMouseButtonID -{ - TW_MOUSE_LEFT = 1, // same code as SDL_BUTTON_LEFT - TW_MOUSE_MIDDLE = 2, // same code as SDL_BUTTON_MIDDLE - TW_MOUSE_RIGHT = 3 // same code as SDL_BUTTON_RIGHT -} TwMouseButtonID; - -TW_API int TW_CALL TwMouseButton(TwMouseAction action, TwMouseButtonID button); -TW_API int TW_CALL TwMouseMotion(int mouseX, int mouseY); -TW_API int TW_CALL TwMouseWheel(int pos); - -TW_API const char * TW_CALL TwGetLastError(); -typedef void (TW_CALL * TwErrorHandler)(const char *errorMessage); -TW_API void TW_CALL TwHandleErrors(TwErrorHandler errorHandler); - - -// ---------------------------------------------------------------------------- -// Helper functions to translate events from some common window management -// frameworks to AntTweakBar. -// They call TwKeyPressed, TwMouse* and TwWindowSize for you (implemented in -// files TwEventWin.c TwEventSDL*.c TwEventGLFW.c TwEventGLUT.c) -// ---------------------------------------------------------------------------- - -// For Windows message proc -#ifndef _W64 // Microsoft specific (detection of 64 bits portability issues) -# define _W64 -#endif // _W64 -#ifdef _WIN64 - TW_API int TW_CALL TwEventWin(void *wnd, unsigned int msg, unsigned __int64 _W64 wParam, __int64 _W64 lParam); -#else - TW_API int TW_CALL TwEventWin(void *wnd, unsigned int msg, unsigned int _W64 wParam, int _W64 lParam); -#endif -#define TwEventWin32 TwEventWin // For compatibility with AntTweakBar versions prior to 1.11 - -// For libSDL event loop -TW_API int TW_CALL TwEventSDL(const void *sdlEvent, unsigned char sdlMajorVersion, unsigned char sdlMinorVersion); - -// For GLFW event callbacks -// You should define GLFW_CDECL before including AntTweakBar.h if your version of GLFW uses cdecl calling convensions -#ifdef GLFW_CDECL - TW_API int TW_CDECL_CALL TwEventMouseButtonGLFWcdecl(int glfwButton, int glfwAction); - TW_API int TW_CDECL_CALL TwEventKeyGLFWcdecl(int glfwKey, int glfwAction); - TW_API int TW_CDECL_CALL TwEventCharGLFWcdecl(int glfwChar, int glfwAction); - TW_API int TW_CDECL_CALL TwEventMousePosGLFWcdecl(int mouseX, int mouseY); - TW_API int TW_CDECL_CALL TwEventMouseWheelGLFWcdecl(int wheelPos); -# define TwEventMouseButtonGLFW TwEventMouseButtonGLFWcdecl -# define TwEventKeyGLFW TwEventKeyGLFWcdecl -# define TwEventCharGLFW TwEventCharGLFWcdecl -# define TwEventMousePosGLFW TwEventMousePosGLFWcdecl -# define TwEventMouseWheelGLFW TwEventMouseWheelGLFWcdecl -#else - TW_API int TW_CALL TwEventMouseButtonGLFW(int glfwButton, int glfwAction); - TW_API int TW_CALL TwEventKeyGLFW(int glfwKey, int glfwAction); - TW_API int TW_CALL TwEventCharGLFW(int glfwChar, int glfwAction); -# define TwEventMousePosGLFW TwMouseMotion -# define TwEventMouseWheelGLFW TwMouseWheel -#endif - -// For GLUT event callbacks (Windows calling convention for GLUT callbacks is cdecl) -#if defined(_WIN32) || defined(_WIN64) -# define TW_GLUT_CALL TW_CDECL_CALL -#else -# define TW_GLUT_CALL -#endif -TW_API int TW_GLUT_CALL TwEventMouseButtonGLUT(int glutButton, int glutState, int mouseX, int mouseY); -TW_API int TW_GLUT_CALL TwEventMouseMotionGLUT(int mouseX, int mouseY); -TW_API int TW_GLUT_CALL TwEventKeyboardGLUT(unsigned char glutKey, int mouseX, int mouseY); -TW_API int TW_GLUT_CALL TwEventSpecialGLUT(int glutKey, int mouseX, int mouseY); -TW_API int TW_CALL TwGLUTModifiersFunc(int (TW_CALL *glutGetModifiersFunc)(void)); -typedef void (TW_GLUT_CALL *GLUTmousebuttonfun)(int glutButton, int glutState, int mouseX, int mouseY); -typedef void (TW_GLUT_CALL *GLUTmousemotionfun)(int mouseX, int mouseY); -typedef void (TW_GLUT_CALL *GLUTkeyboardfun)(unsigned char glutKey, int mouseX, int mouseY); -typedef void (TW_GLUT_CALL *GLUTspecialfun)(int glutKey, int mouseX, int mouseY); - -// For SFML event loop -TW_API int TW_CALL TwEventSFML(const void *sfmlEvent, unsigned char sfmlMajorVersion, unsigned char sfmlMinorVersion); - -// For X11 event loop -#if defined(_UNIX) - TW_API int TW_CDECL_CALL TwEventX11(void *xevent); -#endif - -// ---------------------------------------------------------------------------- -// Make sure the types have the right sizes -// ---------------------------------------------------------------------------- - -#define TW_COMPILE_TIME_ASSERT(name, x) typedef int TW_DUMMY_ ## name[(x) * 2 - 1] - -TW_COMPILE_TIME_ASSERT(TW_CHAR, sizeof(char) == 1); -TW_COMPILE_TIME_ASSERT(TW_SHORT, sizeof(short) == 2); -TW_COMPILE_TIME_ASSERT(TW_INT, sizeof(int) == 4); -TW_COMPILE_TIME_ASSERT(TW_FLOAT, sizeof(float) == 4); -TW_COMPILE_TIME_ASSERT(TW_DOUBLE, sizeof(double) == 8); - -// Check pointer size on Windows -#if !defined(_WIN64) && defined(_WIN32) - // If the following assert failed, the platform is not 32-bit and _WIN64 is not defined. - // When targetting 64-bit Windows platform, _WIN64 must be defined. - TW_COMPILE_TIME_ASSERT(TW_PTR32, sizeof(void*) == 4); -#elif defined(_WIN64) - // If the following assert failed, _WIN64 is defined but the targeted platform is not 64-bit. - TW_COMPILE_TIME_ASSERT(TW_PTR64, sizeof(void*) == 8); -#endif - -// --------------------------------------------------------------------------- - - -#ifdef __cplusplus - } // extern "C" -#endif // __cplusplus - - -#endif // !defined TW_INCLUDED diff --git a/extern/AntTweakBar/src/AntPerfTimer.h b/extern/AntTweakBar/src/AntPerfTimer.h deleted file mode 100644 index 87a09159..00000000 --- a/extern/AntTweakBar/src/AntPerfTimer.h +++ /dev/null @@ -1,56 +0,0 @@ -// --------------------------------------------------------------------------- -// -// @file AntPerfTimer.h -// @brief A performance (precision) timer for benchs -// @author Philippe Decaudin -// @license This file is part of the AntTweakBar library. -// For conditions of distribution and use, see License.txt -// -// note: No cpp file is needed, everything is defined in this header -// -// --------------------------------------------------------------------------- - -#if !defined ANT_PERF_TIMER_INCLUDED -#define ANT_PERF_TIMER_INCLUDED - -#ifndef __cplusplus -# error This is a C++ header -#endif // __cplusplus - - -#if defined(WIN32) || defined(WIN64) || defined(_WIN32) || defined(_WIN64) - - #include - #include - - struct PerfTimer - { - inline PerfTimer() { if( !QueryPerformanceFrequency(&Freq) ) MessageBox(NULL, _T("Precision timer not supported"), _T("Problem"), MB_ICONEXCLAMATION); Reset(); } - inline void Reset() { QueryPerformanceCounter(&Start); } - inline double GetTime() { if( QueryPerformanceCounter(&End) ) return ((double)End.QuadPart - (double)Start.QuadPart)/((double)Freq.QuadPart); else return 0; } - protected: - LARGE_INTEGER Start, End, Freq; - }; - -#else // !_WIN (-> LINUX) - - #include - #include - - struct PerfTimer - { - inline PerfTimer() { Reset(); } - inline void Reset() { gettimeofday(&Start, &TZ); } - inline double GetTime() { gettimeofday(&End,&TZ); - double t1 = (double)Start.tv_sec + (double)Start.tv_usec/(1000*1000); - double t2 = (double)End.tv_sec + (double)End.tv_usec/(1000*1000); - return t2-t1; } - protected: - struct timeval Start, End; - struct timezone TZ; - }; - -#endif // _WIN - - -#endif // ANT_PERF_TIMER_INCLUDED diff --git a/extern/AntTweakBar/src/AntTweakBar.rc b/extern/AntTweakBar/src/AntTweakBar.rc deleted file mode 100644 index 8ff7072f..00000000 --- a/extern/AntTweakBar/src/AntTweakBar.rc +++ /dev/null @@ -1,83 +0,0 @@ -// Microsoft Visual C++ generated resource script. -// -#include "resource.h" - -#define APSTUDIO_READONLY_SYMBOLS -///////////////////////////////////////////////////////////////////////////// -// -// Generated from the TEXTINCLUDE 2 resource. -// -//#include "afxres.h" - -///////////////////////////////////////////////////////////////////////////// -#undef APSTUDIO_READONLY_SYMBOLS - -///////////////////////////////////////////////////////////////////////////// -// Français (France) resources - -#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_FRA) -#ifdef _WIN32 -//LANGUAGE LANG_FRENCH, SUBLANG_FRENCH -#pragma code_page(1252) -#endif //_WIN32 - -#ifdef APSTUDIO_INVOKED -///////////////////////////////////////////////////////////////////////////// -// -// TEXTINCLUDE -// - -1 TEXTINCLUDE -BEGIN - "resource.h\0" -END - -2 TEXTINCLUDE -BEGIN - "#include ""afxres.h""\r\n" - "\0" -END - -3 TEXTINCLUDE -BEGIN - "\r\n" - "\0" -END - -#endif // APSTUDIO_INVOKED - - -///////////////////////////////////////////////////////////////////////////// -// -// Cursor -// - -IDC_CURSOR1 CURSOR "res\\cur00013.cur" -IDC_CURSOR2 CURSOR "res\\cur00000.cur" -IDC_CURSOR3 CURSOR "res\\cur00001.cur" -IDC_CURSOR4 CURSOR "res\\cur00002.cur" -IDC_CURSOR5 CURSOR "res\\cur00003.cur" -IDC_CURSOR6 CURSOR "res\\cur00004.cur" -IDC_CURSOR7 CURSOR "res\\cur00005.cur" -IDC_CURSOR8 CURSOR "res\\cur00006.cur" -IDC_CURSOR9 CURSOR "res\\cur00007.cur" -IDC_CURSOR10 CURSOR "res\\cur00008.cur" -IDC_CURSOR11 CURSOR "res\\cur00009.cur" -IDC_CURSOR12 CURSOR "res\\cur00010.cur" -IDC_CURSOR13 CURSOR "res\\cur00011.cur" -IDC_CURSOR14 CURSOR "res\\cur00012.cur" -#endif // Français (France) resources -///////////////////////////////////////////////////////////////////////////// - - - -#ifndef APSTUDIO_INVOKED -///////////////////////////////////////////////////////////////////////////// -// -// Generated from the TEXTINCLUDE 3 resource. -// - - -///////////////////////////////////////////////////////////////////////////// -#endif // not APSTUDIO_INVOKED - diff --git a/extern/AntTweakBar/src/LoadOGL.cpp b/extern/AntTweakBar/src/LoadOGL.cpp deleted file mode 100644 index d24a2c2f..00000000 --- a/extern/AntTweakBar/src/LoadOGL.cpp +++ /dev/null @@ -1,545 +0,0 @@ -// --------------------------------------------------------------------------- -// -// @file LoadOGL.cpp -// @author Philippe Decaudin -// @license This file is part of the AntTweakBar library. -// For conditions of distribution and use, see License.txt -// -// --------------------------------------------------------------------------- - - -#include "TwPrecomp.h" -#include "LoadOGL.h" - - -// --------------------------------------------------------------------------- - -#define ANT_NB_OGL_FUNC_MAX 1024 - -struct COGLFuncRec -{ - const char * m_Name; - GL::PFNOpenGL * m_FuncPtr; - COGLFuncRec() : m_Name(NULL), m_FuncPtr(NULL) {} -}; -COGLFuncRec g_OGLFuncRec[ANT_NB_OGL_FUNC_MAX]; -int g_NbOGLFunc = 0; -#if defined(ANT_WINDOWS) -HMODULE g_OGLModule = NULL; -#endif - -// --------------------------------------------------------------------------- - -ANT_GL_IMPL(glAccum) -ANT_GL_IMPL(glAlphaFunc) -ANT_GL_IMPL(glAreTexturesResident) -ANT_GL_IMPL(glArrayElement) -ANT_GL_IMPL(glBegin) -ANT_GL_IMPL(glBindTexture) -ANT_GL_IMPL(glBitmap) -ANT_GL_IMPL(glBlendFunc) -ANT_GL_IMPL(glCallList) -ANT_GL_IMPL(glCallLists) -ANT_GL_IMPL(glClear) -ANT_GL_IMPL(glClearAccum) -ANT_GL_IMPL(glClearColor) -ANT_GL_IMPL(glClearDepth) -ANT_GL_IMPL(glClearIndex) -ANT_GL_IMPL(glClearStencil) -ANT_GL_IMPL(glClipPlane) -ANT_GL_IMPL(glColor3b) -ANT_GL_IMPL(glColor3bv) -ANT_GL_IMPL(glColor3d) -ANT_GL_IMPL(glColor3dv) -ANT_GL_IMPL(glColor3f) -ANT_GL_IMPL(glColor3fv) -ANT_GL_IMPL(glColor3i) -ANT_GL_IMPL(glColor3iv) -ANT_GL_IMPL(glColor3s) -ANT_GL_IMPL(glColor3sv) -ANT_GL_IMPL(glColor3ub) -ANT_GL_IMPL(glColor3ubv) -ANT_GL_IMPL(glColor3ui) -ANT_GL_IMPL(glColor3uiv) -ANT_GL_IMPL(glColor3us) -ANT_GL_IMPL(glColor3usv) -ANT_GL_IMPL(glColor4b) -ANT_GL_IMPL(glColor4bv) -ANT_GL_IMPL(glColor4d) -ANT_GL_IMPL(glColor4dv) -ANT_GL_IMPL(glColor4f) -ANT_GL_IMPL(glColor4fv) -ANT_GL_IMPL(glColor4i) -ANT_GL_IMPL(glColor4iv) -ANT_GL_IMPL(glColor4s) -ANT_GL_IMPL(glColor4sv) -ANT_GL_IMPL(glColor4ub) -ANT_GL_IMPL(glColor4ubv) -ANT_GL_IMPL(glColor4ui) -ANT_GL_IMPL(glColor4uiv) -ANT_GL_IMPL(glColor4us) -ANT_GL_IMPL(glColor4usv) -ANT_GL_IMPL(glColorMask) -ANT_GL_IMPL(glColorMaterial) -ANT_GL_IMPL(glColorPointer) -ANT_GL_IMPL(glCopyPixels) -ANT_GL_IMPL(glCopyTexImage1D) -ANT_GL_IMPL(glCopyTexImage2D) -ANT_GL_IMPL(glCopyTexSubImage1D) -ANT_GL_IMPL(glCopyTexSubImage2D) -ANT_GL_IMPL(glCullFace) -ANT_GL_IMPL(glDeleteLists) -ANT_GL_IMPL(glDeleteTextures) -ANT_GL_IMPL(glDepthFunc) -ANT_GL_IMPL(glDepthMask) -ANT_GL_IMPL(glDepthRange) -ANT_GL_IMPL(glDisable) -ANT_GL_IMPL(glDisableClientState) -ANT_GL_IMPL(glDrawArrays) -ANT_GL_IMPL(glDrawBuffer) -ANT_GL_IMPL(glDrawElements) -ANT_GL_IMPL(glDrawPixels) -ANT_GL_IMPL(glEdgeFlag) -ANT_GL_IMPL(glEdgeFlagPointer) -ANT_GL_IMPL(glEdgeFlagv) -ANT_GL_IMPL(glEnable) -ANT_GL_IMPL(glEnableClientState) -ANT_GL_IMPL(glEnd) -ANT_GL_IMPL(glEndList) -ANT_GL_IMPL(glEvalCoord1d) -ANT_GL_IMPL(glEvalCoord1dv) -ANT_GL_IMPL(glEvalCoord1f) -ANT_GL_IMPL(glEvalCoord1fv) -ANT_GL_IMPL(glEvalCoord2d) -ANT_GL_IMPL(glEvalCoord2dv) -ANT_GL_IMPL(glEvalCoord2f) -ANT_GL_IMPL(glEvalCoord2fv) -ANT_GL_IMPL(glEvalMesh1) -ANT_GL_IMPL(glEvalMesh2) -ANT_GL_IMPL(glEvalPoint1) -ANT_GL_IMPL(glEvalPoint2) -ANT_GL_IMPL(glFeedbackBuffer) -ANT_GL_IMPL(glFinish) -ANT_GL_IMPL(glFlush) -ANT_GL_IMPL(glFogf) -ANT_GL_IMPL(glFogfv) -ANT_GL_IMPL(glFogi) -ANT_GL_IMPL(glFogiv) -ANT_GL_IMPL(glFrontFace) -ANT_GL_IMPL(glFrustum) -ANT_GL_IMPL(glGenLists) -ANT_GL_IMPL(glGenTextures) -ANT_GL_IMPL(glGetBooleanv) -ANT_GL_IMPL(glGetClipPlane) -ANT_GL_IMPL(glGetDoublev) -ANT_GL_IMPL(glGetError) -ANT_GL_IMPL(glGetFloatv) -ANT_GL_IMPL(glGetIntegerv) -ANT_GL_IMPL(glGetLightfv) -ANT_GL_IMPL(glGetLightiv) -ANT_GL_IMPL(glGetMapdv) -ANT_GL_IMPL(glGetMapfv) -ANT_GL_IMPL(glGetMapiv) -ANT_GL_IMPL(glGetMaterialfv) -ANT_GL_IMPL(glGetMaterialiv) -ANT_GL_IMPL(glGetPixelMapfv) -ANT_GL_IMPL(glGetPixelMapuiv) -ANT_GL_IMPL(glGetPixelMapusv) -ANT_GL_IMPL(glGetPointerv) -ANT_GL_IMPL(glGetPolygonStipple) -ANT_GL_IMPL(glGetString) -ANT_GL_IMPL(glGetTexEnvfv) -ANT_GL_IMPL(glGetTexEnviv) -ANT_GL_IMPL(glGetTexGendv) -ANT_GL_IMPL(glGetTexGenfv) -ANT_GL_IMPL(glGetTexGeniv) -ANT_GL_IMPL(glGetTexImage) -ANT_GL_IMPL(glGetTexLevelParameterfv) -ANT_GL_IMPL(glGetTexLevelParameteriv) -ANT_GL_IMPL(glGetTexParameterfv) -ANT_GL_IMPL(glGetTexParameteriv) -ANT_GL_IMPL(glHint) -ANT_GL_IMPL(glIndexMask) -ANT_GL_IMPL(glIndexPointer) -ANT_GL_IMPL(glIndexd) -ANT_GL_IMPL(glIndexdv) -ANT_GL_IMPL(glIndexf) -ANT_GL_IMPL(glIndexfv) -ANT_GL_IMPL(glIndexi) -ANT_GL_IMPL(glIndexiv) -ANT_GL_IMPL(glIndexs) -ANT_GL_IMPL(glIndexsv) -ANT_GL_IMPL(glIndexub) -ANT_GL_IMPL(glIndexubv) -ANT_GL_IMPL(glInitNames) -ANT_GL_IMPL(glInterleavedArrays) -ANT_GL_IMPL(glIsEnabled) -ANT_GL_IMPL(glIsList) -ANT_GL_IMPL(glIsTexture) -ANT_GL_IMPL(glLightModelf) -ANT_GL_IMPL(glLightModelfv) -ANT_GL_IMPL(glLightModeli) -ANT_GL_IMPL(glLightModeliv) -ANT_GL_IMPL(glLightf) -ANT_GL_IMPL(glLightfv) -ANT_GL_IMPL(glLighti) -ANT_GL_IMPL(glLightiv) -ANT_GL_IMPL(glLineStipple) -ANT_GL_IMPL(glLineWidth) -ANT_GL_IMPL(glListBase) -ANT_GL_IMPL(glLoadIdentity) -ANT_GL_IMPL(glLoadMatrixd) -ANT_GL_IMPL(glLoadMatrixf) -ANT_GL_IMPL(glLoadName) -ANT_GL_IMPL(glLogicOp) -ANT_GL_IMPL(glMap1d) -ANT_GL_IMPL(glMap1f) -ANT_GL_IMPL(glMap2d) -ANT_GL_IMPL(glMap2f) -ANT_GL_IMPL(glMapGrid1d) -ANT_GL_IMPL(glMapGrid1f) -ANT_GL_IMPL(glMapGrid2d) -ANT_GL_IMPL(glMapGrid2f) -ANT_GL_IMPL(glMaterialf) -ANT_GL_IMPL(glMaterialfv) -ANT_GL_IMPL(glMateriali) -ANT_GL_IMPL(glMaterialiv) -ANT_GL_IMPL(glMatrixMode) -ANT_GL_IMPL(glMultMatrixd) -ANT_GL_IMPL(glMultMatrixf) -ANT_GL_IMPL(glNewList) -ANT_GL_IMPL(glNormal3b) -ANT_GL_IMPL(glNormal3bv) -ANT_GL_IMPL(glNormal3d) -ANT_GL_IMPL(glNormal3dv) -ANT_GL_IMPL(glNormal3f) -ANT_GL_IMPL(glNormal3fv) -ANT_GL_IMPL(glNormal3i) -ANT_GL_IMPL(glNormal3iv) -ANT_GL_IMPL(glNormal3s) -ANT_GL_IMPL(glNormal3sv) -ANT_GL_IMPL(glNormalPointer) -ANT_GL_IMPL(glOrtho) -ANT_GL_IMPL(glPassThrough) -ANT_GL_IMPL(glPixelMapfv) -ANT_GL_IMPL(glPixelMapuiv) -ANT_GL_IMPL(glPixelMapusv) -ANT_GL_IMPL(glPixelStoref) -ANT_GL_IMPL(glPixelStorei) -ANT_GL_IMPL(glPixelTransferf) -ANT_GL_IMPL(glPixelTransferi) -ANT_GL_IMPL(glPixelZoom) -ANT_GL_IMPL(glPointSize) -ANT_GL_IMPL(glPolygonMode) -ANT_GL_IMPL(glPolygonOffset) -ANT_GL_IMPL(glPolygonStipple) -ANT_GL_IMPL(glPopAttrib) -ANT_GL_IMPL(glPopClientAttrib) -ANT_GL_IMPL(glPopMatrix) -ANT_GL_IMPL(glPopName) -ANT_GL_IMPL(glPrioritizeTextures) -ANT_GL_IMPL(glPushAttrib) -ANT_GL_IMPL(glPushClientAttrib) -ANT_GL_IMPL(glPushMatrix) -ANT_GL_IMPL(glPushName) -ANT_GL_IMPL(glRasterPos2d) -ANT_GL_IMPL(glRasterPos2dv) -ANT_GL_IMPL(glRasterPos2f) -ANT_GL_IMPL(glRasterPos2fv) -ANT_GL_IMPL(glRasterPos2i) -ANT_GL_IMPL(glRasterPos2iv) -ANT_GL_IMPL(glRasterPos2s) -ANT_GL_IMPL(glRasterPos2sv) -ANT_GL_IMPL(glRasterPos3d) -ANT_GL_IMPL(glRasterPos3dv) -ANT_GL_IMPL(glRasterPos3f) -ANT_GL_IMPL(glRasterPos3fv) -ANT_GL_IMPL(glRasterPos3i) -ANT_GL_IMPL(glRasterPos3iv) -ANT_GL_IMPL(glRasterPos3s) -ANT_GL_IMPL(glRasterPos3sv) -ANT_GL_IMPL(glRasterPos4d) -ANT_GL_IMPL(glRasterPos4dv) -ANT_GL_IMPL(glRasterPos4f) -ANT_GL_IMPL(glRasterPos4fv) -ANT_GL_IMPL(glRasterPos4i) -ANT_GL_IMPL(glRasterPos4iv) -ANT_GL_IMPL(glRasterPos4s) -ANT_GL_IMPL(glRasterPos4sv) -ANT_GL_IMPL(glReadBuffer) -ANT_GL_IMPL(glReadPixels) -ANT_GL_IMPL(glRectd) -ANT_GL_IMPL(glRectdv) -ANT_GL_IMPL(glRectf) -ANT_GL_IMPL(glRectfv) -ANT_GL_IMPL(glRecti) -ANT_GL_IMPL(glRectiv) -ANT_GL_IMPL(glRects) -ANT_GL_IMPL(glRectsv) -ANT_GL_IMPL(glRenderMode) -ANT_GL_IMPL(glRotated) -ANT_GL_IMPL(glRotatef) -ANT_GL_IMPL(glScaled) -ANT_GL_IMPL(glScalef) -ANT_GL_IMPL(glScissor) -ANT_GL_IMPL(glSelectBuffer) -ANT_GL_IMPL(glShadeModel) -ANT_GL_IMPL(glStencilFunc) -ANT_GL_IMPL(glStencilMask) -ANT_GL_IMPL(glStencilOp) -ANT_GL_IMPL(glTexCoord1d) -ANT_GL_IMPL(glTexCoord1dv) -ANT_GL_IMPL(glTexCoord1f) -ANT_GL_IMPL(glTexCoord1fv) -ANT_GL_IMPL(glTexCoord1i) -ANT_GL_IMPL(glTexCoord1iv) -ANT_GL_IMPL(glTexCoord1s) -ANT_GL_IMPL(glTexCoord1sv) -ANT_GL_IMPL(glTexCoord2d) -ANT_GL_IMPL(glTexCoord2dv) -ANT_GL_IMPL(glTexCoord2f) -ANT_GL_IMPL(glTexCoord2fv) -ANT_GL_IMPL(glTexCoord2i) -ANT_GL_IMPL(glTexCoord2iv) -ANT_GL_IMPL(glTexCoord2s) -ANT_GL_IMPL(glTexCoord2sv) -ANT_GL_IMPL(glTexCoord3d) -ANT_GL_IMPL(glTexCoord3dv) -ANT_GL_IMPL(glTexCoord3f) -ANT_GL_IMPL(glTexCoord3fv) -ANT_GL_IMPL(glTexCoord3i) -ANT_GL_IMPL(glTexCoord3iv) -ANT_GL_IMPL(glTexCoord3s) -ANT_GL_IMPL(glTexCoord3sv) -ANT_GL_IMPL(glTexCoord4d) -ANT_GL_IMPL(glTexCoord4dv) -ANT_GL_IMPL(glTexCoord4f) -ANT_GL_IMPL(glTexCoord4fv) -ANT_GL_IMPL(glTexCoord4i) -ANT_GL_IMPL(glTexCoord4iv) -ANT_GL_IMPL(glTexCoord4s) -ANT_GL_IMPL(glTexCoord4sv) -ANT_GL_IMPL(glTexCoordPointer) -ANT_GL_IMPL(glTexEnvf) -ANT_GL_IMPL(glTexEnvfv) -ANT_GL_IMPL(glTexEnvi) -ANT_GL_IMPL(glTexEnviv) -ANT_GL_IMPL(glTexGend) -ANT_GL_IMPL(glTexGendv) -ANT_GL_IMPL(glTexGenf) -ANT_GL_IMPL(glTexGenfv) -ANT_GL_IMPL(glTexGeni) -ANT_GL_IMPL(glTexGeniv) -ANT_GL_IMPL(glTexImage1D) -ANT_GL_IMPL(glTexImage2D) -ANT_GL_IMPL(glTexParameterf) -ANT_GL_IMPL(glTexParameterfv) -ANT_GL_IMPL(glTexParameteri) -ANT_GL_IMPL(glTexParameteriv) -ANT_GL_IMPL(glTexSubImage1D) -ANT_GL_IMPL(glTexSubImage2D) -ANT_GL_IMPL(glTranslated) -ANT_GL_IMPL(glTranslatef) -ANT_GL_IMPL(glVertex2d) -ANT_GL_IMPL(glVertex2dv) -ANT_GL_IMPL(glVertex2f) -ANT_GL_IMPL(glVertex2fv) -ANT_GL_IMPL(glVertex2i) -ANT_GL_IMPL(glVertex2iv) -ANT_GL_IMPL(glVertex2s) -ANT_GL_IMPL(glVertex2sv) -ANT_GL_IMPL(glVertex3d) -ANT_GL_IMPL(glVertex3dv) -ANT_GL_IMPL(glVertex3f) -ANT_GL_IMPL(glVertex3fv) -ANT_GL_IMPL(glVertex3i) -ANT_GL_IMPL(glVertex3iv) -ANT_GL_IMPL(glVertex3s) -ANT_GL_IMPL(glVertex3sv) -ANT_GL_IMPL(glVertex4d) -ANT_GL_IMPL(glVertex4dv) -ANT_GL_IMPL(glVertex4f) -ANT_GL_IMPL(glVertex4fv) -ANT_GL_IMPL(glVertex4i) -ANT_GL_IMPL(glVertex4iv) -ANT_GL_IMPL(glVertex4s) -ANT_GL_IMPL(glVertex4sv) -ANT_GL_IMPL(glVertexPointer) -ANT_GL_IMPL(glViewport) -#if defined(ANT_WINDOWS) -ANT_GL_IMPL(wglGetProcAddress) -#endif - -namespace GL { PFNGLGetProcAddress _glGetProcAddress = NULL; } - -// --------------------------------------------------------------------------- - -#if defined(ANT_WINDOWS) - - // --------------------------------------------------------------------------- - - int LoadOpenGL() - { - if( g_OGLModule!=NULL ) - { - return 1; // "OpenGL library already loaded" - } - - g_OGLModule = LoadLibrary("OPENGL32.DLL"); - if( g_OGLModule ) - { - // Info(VERB_LOW, "Load %d OpenGL functions", g_NbOGLFunc); - - int Res = 1; - for(int i=0; i0); - *(g_OGLFuncRec[i].m_FuncPtr) = reinterpret_cast(GetProcAddress(g_OGLModule, g_OGLFuncRec[i].m_Name)); - if( *(g_OGLFuncRec[i].m_FuncPtr)==NULL ) - Res = 0; // Error("cannot find OpenGL function"); - - } - - _glGetProcAddress = reinterpret_cast(_wglGetProcAddress); - if( _glGetProcAddress==NULL ) - Res = 0; - - return Res; - } - else - { - // InternDisplayLastErrorWIN("Cannot load opengl32 DLL", false); - return 0; // cannot load DLL - } - } - - // --------------------------------------------------------------------------- - - int UnloadOpenGL() - { - if( g_OGLModule==NULL ) - { - return 1; // "OpenGL library not loaded" - } - - // Info(VERB_LOW, "Unload %d OpenGL functions", g_NbOGLFunc); - for(int i=0; i0); - *(g_OGLFuncRec[i].m_FuncPtr) = NULL; - } - if( FreeLibrary(g_OGLModule) ) - { - // Info(VERB_LOW, "OpenGL library unloaded"); - g_OGLModule = NULL; - return 1; - } - else - { - // InternDisplayLastErrorWIN("Cannot unload opengl32 DLL", false); - return 0; // cannot unload opengl32.dll - } - } - - // --------------------------------------------------------------------------- - - namespace GL - { - - PFNOpenGL Record(const char *_FuncName, PFNOpenGL *_FuncPtr) - { - if( g_NbOGLFunc>=ANT_NB_OGL_FUNC_MAX ) - { - fprintf(stderr, "Too many OpenGL functions declared. Change ANT_NB_OGL_FUNC_MAX."); - exit(-1); - } - - g_OGLFuncRec[g_NbOGLFunc].m_Name = _FuncName; - g_OGLFuncRec[g_NbOGLFunc].m_FuncPtr = _FuncPtr; - ++g_NbOGLFunc; - - return NULL; - } - - } // namespace GL - - // --------------------------------------------------------------------------- - -#endif // defined(ANT_WINDOWS) - -// --------------------------------------------------------------------------- - -#if defined(ANT_UNIX) - - int LoadOpenGL() - { - _glGetProcAddress = reinterpret_cast(glXGetProcAddressARB); - - return 1; // "OpenGL library is statically linked" - } - - int UnloadOpenGL() - { - return 1; // "OpenGL library is statically linked" - } - -#elif defined(ANT_OSX) - - #include - - static void *gl_dyld = NULL; - static const char *gl_prefix = "_"; - void *NSGLGetProcAddressNew(const GLubyte *name) - { - void *proc=NULL; - if (gl_dyld == NULL) - { - gl_dyld = dlopen("OpenGL",RTLD_LAZY); - } - if (gl_dyld) - { - NSString *sym = [[NSString alloc] initWithFormat: @"%s%s",gl_prefix,name]; - proc = dlsym(gl_dyld,[sym UTF8String]); - [sym release]; - } - return proc; - } - - int LoadOpenGL() - { - _glGetProcAddress = reinterpret_cast(NSGLGetProcAddressNew); - - // try to load a symbol - if (_glGetProcAddress("glBindBufferARB") == NULL) - { - // remove the symbols underscore prefix (OSX 10.7 and later) - gl_prefix = ""; - if (_glGetProcAddress("glBindBufferARB") == NULL) - { - // fail: fall back to underscore - gl_prefix = "_"; - } - } - - return 1; - } - - int UnloadOpenGL() - { - if (gl_dyld) - { - dlclose(gl_dyld); - gl_dyld = NULL; - } - return 1; - } - -#endif // defined(ANT_UNIX) - -// --------------------------------------------------------------------------- diff --git a/extern/AntTweakBar/src/LoadOGL.h b/extern/AntTweakBar/src/LoadOGL.h deleted file mode 100644 index 1772a037..00000000 --- a/extern/AntTweakBar/src/LoadOGL.h +++ /dev/null @@ -1,397 +0,0 @@ -// --------------------------------------------------------------------------- -// -// @file LoadOGL.h -// @brief OpenGL declarations for dynamic loading -// @author Philippe Decaudin -// @license This file is part of the AntTweakBar library. -// For conditions of distribution and use, see License.txt -// -// note: Private header -// -// --------------------------------------------------------------------------- - - -#if !defined ANT_LOAD_OGL_INCLUDED -#define ANT_LOAD_OGL_INCLUDED - - -#define ANT_GL_DECL(_Ret, _Fct, _Params) \ - extern "C" { typedef _Ret (APIENTRY* PFN##_Fct)_Params; } \ - namespace GL { extern PFN##_Fct _##_Fct; } \ - using GL::_##_Fct; - -#if defined(ANT_WINDOWS) -# define ANT_GL_IMPL(_Fct) \ - namespace GL { PFN##_Fct _##_Fct = (PFN##_Fct)Record(#_Fct, (PFNOpenGL*)(&_##_Fct)); } -#elif defined(ANT_UNIX) || defined(ANT_OSX) -# define ANT_GL_IMPL(_Fct) \ - namespace GL { PFN##_Fct _##_Fct = _Fct; } -# if !defined(APIENTRY) -# define APIENTRY -# endif -#endif - - -int LoadOpenGL(); -int UnloadOpenGL(); - -namespace GL -{ - extern "C" { typedef void (APIENTRY* PFNOpenGL)(); } - PFNOpenGL Record(const char *_FuncName, PFNOpenGL *_FuncPtr); - - extern "C" { typedef PFNOpenGL (APIENTRY *PFNGLGetProcAddress)(const char *); } - extern PFNGLGetProcAddress _glGetProcAddress; -} -using GL::_glGetProcAddress; - - -ANT_GL_DECL(void, glAccum, (GLenum op, GLfloat value)) -ANT_GL_DECL(void, glAlphaFunc, (GLenum func, GLclampf ref)) -ANT_GL_DECL(GLboolean, glAreTexturesResident, (GLsizei n, const GLuint *textures, GLboolean *residences)) -ANT_GL_DECL(void, glArrayElement, (GLint i)) -ANT_GL_DECL(void, glBegin, (GLenum mode)) -ANT_GL_DECL(void, glBindTexture, (GLenum target, GLuint texture)) -ANT_GL_DECL(void, glBitmap, (GLsizei width, GLsizei height, GLfloat xorig, GLfloat yorig, GLfloat xmove, GLfloat ymove, const GLubyte *bitmap)) -ANT_GL_DECL(void, glBlendFunc, (GLenum sfactor, GLenum dfactor)) -ANT_GL_DECL(void, glCallList, (GLuint list)) -ANT_GL_DECL(void, glCallLists, (GLsizei n, GLenum type, const GLvoid *lists)) -ANT_GL_DECL(void, glClear, (GLbitfield mask)) -ANT_GL_DECL(void, glClearAccum, (GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha)) -ANT_GL_DECL(void, glClearColor, (GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha)) -ANT_GL_DECL(void, glClearDepth, (GLclampd depth)) -ANT_GL_DECL(void, glClearIndex, (GLfloat c)) -ANT_GL_DECL(void, glClearStencil, (GLint s)) -ANT_GL_DECL(void, glClipPlane, (GLenum plane, const GLdouble *equation)) -ANT_GL_DECL(void, glColor3b, (GLbyte red, GLbyte green, GLbyte blue)) -ANT_GL_DECL(void, glColor3bv, (const GLbyte *v)) -ANT_GL_DECL(void, glColor3d, (GLdouble red, GLdouble green, GLdouble blue)) -ANT_GL_DECL(void, glColor3dv, (const GLdouble *v)) -ANT_GL_DECL(void, glColor3f, (GLfloat red, GLfloat green, GLfloat blue)) -ANT_GL_DECL(void, glColor3fv, (const GLfloat *v)) -ANT_GL_DECL(void, glColor3i, (GLint red, GLint green, GLint blue)) -ANT_GL_DECL(void, glColor3iv, (const GLint *v)) -ANT_GL_DECL(void, glColor3s, (GLshort red, GLshort green, GLshort blue)) -ANT_GL_DECL(void, glColor3sv, (const GLshort *v)) -ANT_GL_DECL(void, glColor3ub, (GLubyte red, GLubyte green, GLubyte blue)) -ANT_GL_DECL(void, glColor3ubv, (const GLubyte *v)) -ANT_GL_DECL(void, glColor3ui, (GLuint red, GLuint green, GLuint blue)) -ANT_GL_DECL(void, glColor3uiv, (const GLuint *v)) -ANT_GL_DECL(void, glColor3us, (GLushort red, GLushort green, GLushort blue)) -ANT_GL_DECL(void, glColor3usv, (const GLushort *v)) -ANT_GL_DECL(void, glColor4b, (GLbyte red, GLbyte green, GLbyte blue, GLbyte alpha)) -ANT_GL_DECL(void, glColor4bv, (const GLbyte *v)) -ANT_GL_DECL(void, glColor4d, (GLdouble red, GLdouble green, GLdouble blue, GLdouble alpha)) -ANT_GL_DECL(void, glColor4dv, (const GLdouble *v)) -ANT_GL_DECL(void, glColor4f, (GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha)) -ANT_GL_DECL(void, glColor4fv, (const GLfloat *v)) -ANT_GL_DECL(void, glColor4i, (GLint red, GLint green, GLint blue, GLint alpha)) -ANT_GL_DECL(void, glColor4iv, (const GLint *v)) -ANT_GL_DECL(void, glColor4s, (GLshort red, GLshort green, GLshort blue, GLshort alpha)) -ANT_GL_DECL(void, glColor4sv, (const GLshort *v)) -ANT_GL_DECL(void, glColor4ub, (GLubyte red, GLubyte green, GLubyte blue, GLubyte alpha)) -ANT_GL_DECL(void, glColor4ubv, (const GLubyte *v)) -ANT_GL_DECL(void, glColor4ui, (GLuint red, GLuint green, GLuint blue, GLuint alpha)) -ANT_GL_DECL(void, glColor4uiv, (const GLuint *v)) -ANT_GL_DECL(void, glColor4us, (GLushort red, GLushort green, GLushort blue, GLushort alpha)) -ANT_GL_DECL(void, glColor4usv, (const GLushort *v)) -ANT_GL_DECL(void, glColorMask, (GLboolean red, GLboolean green, GLboolean blue, GLboolean alpha)) -ANT_GL_DECL(void, glColorMaterial, (GLenum face, GLenum mode)) -ANT_GL_DECL(void, glColorPointer, (GLint size, GLenum type, GLsizei stride, const GLvoid *pointer)) -ANT_GL_DECL(void, glCopyPixels, (GLint x, GLint y, GLsizei width, GLsizei height, GLenum type)) -ANT_GL_DECL(void, glCopyTexImage1D, (GLenum target, GLint level, GLenum internalFormat, GLint x, GLint y, GLsizei width, GLint border)) -ANT_GL_DECL(void, glCopyTexImage2D, (GLenum target, GLint level, GLenum internalFormat, GLint x, GLint y, GLsizei width, GLsizei height, GLint border)) -ANT_GL_DECL(void, glCopyTexSubImage1D, (GLenum target, GLint level, GLint xoffset, GLint x, GLint y, GLsizei width)) -ANT_GL_DECL(void, glCopyTexSubImage2D, (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint x, GLint y, GLsizei width, GLsizei height)) -ANT_GL_DECL(void, glCullFace, (GLenum mode)) -ANT_GL_DECL(void, glDeleteLists, (GLuint list, GLsizei range)) -ANT_GL_DECL(void, glDeleteTextures, (GLsizei n, const GLuint *textures)) -ANT_GL_DECL(void, glDepthFunc, (GLenum func)) -ANT_GL_DECL(void, glDepthMask, (GLboolean flag)) -ANT_GL_DECL(void, glDepthRange, (GLclampd zNear, GLclampd zFar)) -ANT_GL_DECL(void, glDisable, (GLenum cap)) -ANT_GL_DECL(void, glDisableClientState, (GLenum array)) -ANT_GL_DECL(void, glDrawArrays, (GLenum mode, GLint first, GLsizei count)) -ANT_GL_DECL(void, glDrawBuffer, (GLenum mode)) -ANT_GL_DECL(void, glDrawElements, (GLenum mode, GLsizei count, GLenum type, const GLvoid *indices)) -ANT_GL_DECL(void, glDrawPixels, (GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid *pixels)) -ANT_GL_DECL(void, glEdgeFlag, (GLboolean flag)) -ANT_GL_DECL(void, glEdgeFlagPointer, (GLsizei stride, const void *pointer)) -ANT_GL_DECL(void, glEdgeFlagv, (const GLboolean *flag)) -ANT_GL_DECL(void, glEnable, (GLenum cap)) -ANT_GL_DECL(void, glEnableClientState, (GLenum array)) -ANT_GL_DECL(void, glEnd, (void)) -ANT_GL_DECL(void, glEndList, (void)) -ANT_GL_DECL(void, glEvalCoord1d, (GLdouble u)) -ANT_GL_DECL(void, glEvalCoord1dv, (const GLdouble *u)) -ANT_GL_DECL(void, glEvalCoord1f, (GLfloat u)) -ANT_GL_DECL(void, glEvalCoord1fv, (const GLfloat *u)) -ANT_GL_DECL(void, glEvalCoord2d, (GLdouble u, GLdouble v)) -ANT_GL_DECL(void, glEvalCoord2dv, (const GLdouble *u)) -ANT_GL_DECL(void, glEvalCoord2f, (GLfloat u, GLfloat v)) -ANT_GL_DECL(void, glEvalCoord2fv, (const GLfloat *u)) -ANT_GL_DECL(void, glEvalMesh1, (GLenum mode, GLint i1, GLint i2)) -ANT_GL_DECL(void, glEvalMesh2, (GLenum mode, GLint i1, GLint i2, GLint j1, GLint j2)) -ANT_GL_DECL(void, glEvalPoint1, (GLint i)) -ANT_GL_DECL(void, glEvalPoint2, (GLint i, GLint j)) -ANT_GL_DECL(void, glFeedbackBuffer, (GLsizei size, GLenum type, GLfloat *buffer)) -ANT_GL_DECL(void, glFinish, (void)) -ANT_GL_DECL(void, glFlush, (void)) -ANT_GL_DECL(void, glFogf, (GLenum pname, GLfloat param)) -ANT_GL_DECL(void, glFogfv, (GLenum pname, const GLfloat *params)) -ANT_GL_DECL(void, glFogi, (GLenum pname, GLint param)) -ANT_GL_DECL(void, glFogiv, (GLenum pname, const GLint *params)) -ANT_GL_DECL(void, glFrontFace, (GLenum mode)) -ANT_GL_DECL(void, glFrustum, (GLdouble left, GLdouble right, GLdouble bottom, GLdouble top, GLdouble zNear, GLdouble zFar)) -ANT_GL_DECL(GLuint, glGenLists, (GLsizei range)) -ANT_GL_DECL(void, glGenTextures, (GLsizei n, GLuint *textures)) -ANT_GL_DECL(void, glGetBooleanv, (GLenum pname, GLboolean *params)) -ANT_GL_DECL(void, glGetClipPlane, (GLenum plane, GLdouble *equation)) -ANT_GL_DECL(void, glGetDoublev, (GLenum pname, GLdouble *params)) -ANT_GL_DECL(GLenum, glGetError, (void)) -ANT_GL_DECL(void, glGetFloatv, (GLenum pname, GLfloat *params)) -ANT_GL_DECL(void, glGetIntegerv, (GLenum pname, GLint *params)) -ANT_GL_DECL(void, glGetLightfv, (GLenum light, GLenum pname, GLfloat *params)) -ANT_GL_DECL(void, glGetLightiv, (GLenum light, GLenum pname, GLint *params)) -ANT_GL_DECL(void, glGetMapdv, (GLenum target, GLenum query, GLdouble *v)) -ANT_GL_DECL(void, glGetMapfv, (GLenum target, GLenum query, GLfloat *v)) -ANT_GL_DECL(void, glGetMapiv, (GLenum target, GLenum query, GLint *v)) -ANT_GL_DECL(void, glGetMaterialfv, (GLenum face, GLenum pname, GLfloat *params)) -ANT_GL_DECL(void, glGetMaterialiv, (GLenum face, GLenum pname, GLint *params)) -ANT_GL_DECL(void, glGetPixelMapfv, (GLenum map, GLfloat *values)) -ANT_GL_DECL(void, glGetPixelMapuiv, (GLenum map, GLuint *values)) -ANT_GL_DECL(void, glGetPixelMapusv, (GLenum map, GLushort *values)) -ANT_GL_DECL(void, glGetPointerv, (GLenum pname, GLvoid* *params)) -ANT_GL_DECL(void, glGetPolygonStipple, (GLubyte *mask)) -ANT_GL_DECL(const GLubyte *, glGetString, (GLenum name)) -ANT_GL_DECL(void, glGetTexEnvfv, (GLenum target, GLenum pname, GLfloat *params)) -ANT_GL_DECL(void, glGetTexEnviv, (GLenum target, GLenum pname, GLint *params)) -ANT_GL_DECL(void, glGetTexGendv, (GLenum coord, GLenum pname, GLdouble *params)) -ANT_GL_DECL(void, glGetTexGenfv, (GLenum coord, GLenum pname, GLfloat *params)) -ANT_GL_DECL(void, glGetTexGeniv, (GLenum coord, GLenum pname, GLint *params)) -ANT_GL_DECL(void, glGetTexImage, (GLenum target, GLint level, GLenum format, GLenum type, GLvoid *pixels)) -ANT_GL_DECL(void, glGetTexLevelParameterfv, (GLenum target, GLint level, GLenum pname, GLfloat *params)) -ANT_GL_DECL(void, glGetTexLevelParameteriv, (GLenum target, GLint level, GLenum pname, GLint *params)) -ANT_GL_DECL(void, glGetTexParameterfv, (GLenum target, GLenum pname, GLfloat *params)) -ANT_GL_DECL(void, glGetTexParameteriv, (GLenum target, GLenum pname, GLint *params)) -ANT_GL_DECL(void, glHint, (GLenum target, GLenum mode)) -ANT_GL_DECL(void, glIndexMask, (GLuint mask)) -ANT_GL_DECL(void, glIndexPointer, (GLenum type, GLsizei stride, const GLvoid *pointer)) -ANT_GL_DECL(void, glIndexd, (GLdouble c)) -ANT_GL_DECL(void, glIndexdv, (const GLdouble *c)) -ANT_GL_DECL(void, glIndexf, (GLfloat c)) -ANT_GL_DECL(void, glIndexfv, (const GLfloat *c)) -ANT_GL_DECL(void, glIndexi, (GLint c)) -ANT_GL_DECL(void, glIndexiv, (const GLint *c)) -ANT_GL_DECL(void, glIndexs, (GLshort c)) -ANT_GL_DECL(void, glIndexsv, (const GLshort *c)) -ANT_GL_DECL(void, glIndexub, (GLubyte c)) -ANT_GL_DECL(void, glIndexubv, (const GLubyte *c)) -ANT_GL_DECL(void, glInitNames, (void)) -ANT_GL_DECL(void, glInterleavedArrays, (GLenum format, GLsizei stride, const GLvoid *pointer)) -ANT_GL_DECL(GLboolean, glIsEnabled, (GLenum cap)) -ANT_GL_DECL(GLboolean, glIsList, (GLuint list)) -ANT_GL_DECL(GLboolean, glIsTexture, (GLuint texture)) -ANT_GL_DECL(void, glLightModelf, (GLenum pname, GLfloat param)) -ANT_GL_DECL(void, glLightModelfv, (GLenum pname, const GLfloat *params)) -ANT_GL_DECL(void, glLightModeli, (GLenum pname, GLint param)) -ANT_GL_DECL(void, glLightModeliv, (GLenum pname, const GLint *params)) -ANT_GL_DECL(void, glLightf, (GLenum light, GLenum pname, GLfloat param)) -ANT_GL_DECL(void, glLightfv, (GLenum light, GLenum pname, const GLfloat *params)) -ANT_GL_DECL(void, glLighti, (GLenum light, GLenum pname, GLint param)) -ANT_GL_DECL(void, glLightiv, (GLenum light, GLenum pname, const GLint *params)) -ANT_GL_DECL(void, glLineStipple, (GLint factor, GLushort pattern)) -ANT_GL_DECL(void, glLineWidth, (GLfloat width)) -ANT_GL_DECL(void, glListBase, (GLuint base)) -ANT_GL_DECL(void, glLoadIdentity, (void)) -ANT_GL_DECL(void, glLoadMatrixd, (const GLdouble *m)) -ANT_GL_DECL(void, glLoadMatrixf, (const GLfloat *m)) -ANT_GL_DECL(void, glLoadName, (GLuint name)) -ANT_GL_DECL(void, glLogicOp, (GLenum opcode)) -ANT_GL_DECL(void, glMap1d, (GLenum target, GLdouble u1, GLdouble u2, GLint stride, GLint order, const GLdouble *points)) -ANT_GL_DECL(void, glMap1f, (GLenum target, GLfloat u1, GLfloat u2, GLint stride, GLint order, const GLfloat *points)) -ANT_GL_DECL(void, glMap2d, (GLenum target, GLdouble u1, GLdouble u2, GLint ustride, GLint uorder, GLdouble v1, GLdouble v2, GLint vstride, GLint vorder, const GLdouble *points)) -ANT_GL_DECL(void, glMap2f, (GLenum target, GLfloat u1, GLfloat u2, GLint ustride, GLint uorder, GLfloat v1, GLfloat v2, GLint vstride, GLint vorder, const GLfloat *points)) -ANT_GL_DECL(void, glMapGrid1d, (GLint un, GLdouble u1, GLdouble u2)) -ANT_GL_DECL(void, glMapGrid1f, (GLint un, GLfloat u1, GLfloat u2)) -ANT_GL_DECL(void, glMapGrid2d, (GLint un, GLdouble u1, GLdouble u2, GLint vn, GLdouble v1, GLdouble v2)) -ANT_GL_DECL(void, glMapGrid2f, (GLint un, GLfloat u1, GLfloat u2, GLint vn, GLfloat v1, GLfloat v2)) -ANT_GL_DECL(void, glMaterialf, (GLenum face, GLenum pname, GLfloat param)) -ANT_GL_DECL(void, glMaterialfv, (GLenum face, GLenum pname, const GLfloat *params)) -ANT_GL_DECL(void, glMateriali, (GLenum face, GLenum pname, GLint param)) -ANT_GL_DECL(void, glMaterialiv, (GLenum face, GLenum pname, const GLint *params)) -ANT_GL_DECL(void, glMatrixMode, (GLenum mode)) -ANT_GL_DECL(void, glMultMatrixd, (const GLdouble *m)) -ANT_GL_DECL(void, glMultMatrixf, (const GLfloat *m)) -ANT_GL_DECL(void, glNewList, (GLuint list, GLenum mode)) -ANT_GL_DECL(void, glNormal3b, (GLbyte nx, GLbyte ny, GLbyte nz)) -ANT_GL_DECL(void, glNormal3bv, (const GLbyte *v)) -ANT_GL_DECL(void, glNormal3d, (GLdouble nx, GLdouble ny, GLdouble nz)) -ANT_GL_DECL(void, glNormal3dv, (const GLdouble *v)) -ANT_GL_DECL(void, glNormal3f, (GLfloat nx, GLfloat ny, GLfloat nz)) -ANT_GL_DECL(void, glNormal3fv, (const GLfloat *v)) -ANT_GL_DECL(void, glNormal3i, (GLint nx, GLint ny, GLint nz)) -ANT_GL_DECL(void, glNormal3iv, (const GLint *v)) -ANT_GL_DECL(void, glNormal3s, (GLshort nx, GLshort ny, GLshort nz)) -ANT_GL_DECL(void, glNormal3sv, (const GLshort *v)) -ANT_GL_DECL(void, glNormalPointer, (GLenum type, GLsizei stride, const GLvoid *pointer)) -ANT_GL_DECL(void, glOrtho, (GLdouble left, GLdouble right, GLdouble bottom, GLdouble top, GLdouble zNear, GLdouble zFar)) -ANT_GL_DECL(void, glPassThrough, (GLfloat token)) -ANT_GL_DECL(void, glPixelMapfv, (GLenum map, GLsizei mapsize, const GLfloat *values)) -ANT_GL_DECL(void, glPixelMapuiv, (GLenum map, GLsizei mapsize, const GLuint *values)) -ANT_GL_DECL(void, glPixelMapusv, (GLenum map, GLsizei mapsize, const GLushort *values)) -ANT_GL_DECL(void, glPixelStoref, (GLenum pname, GLfloat param)) -ANT_GL_DECL(void, glPixelStorei, (GLenum pname, GLint param)) -ANT_GL_DECL(void, glPixelTransferf, (GLenum pname, GLfloat param)) -ANT_GL_DECL(void, glPixelTransferi, (GLenum pname, GLint param)) -ANT_GL_DECL(void, glPixelZoom, (GLfloat xfactor, GLfloat yfactor)) -ANT_GL_DECL(void, glPointSize, (GLfloat size)) -ANT_GL_DECL(void, glPolygonMode, (GLenum face, GLenum mode)) -ANT_GL_DECL(void, glPolygonOffset, (GLfloat factor, GLfloat units)) -ANT_GL_DECL(void, glPolygonStipple, (const GLubyte *mask)) -ANT_GL_DECL(void, glPopAttrib, (void)) -ANT_GL_DECL(void, glPopClientAttrib, (void)) -ANT_GL_DECL(void, glPopMatrix, (void)) -ANT_GL_DECL(void, glPopName, (void)) -ANT_GL_DECL(void, glPrioritizeTextures, (GLsizei n, const GLuint *textures, const GLclampf *priorities)) -ANT_GL_DECL(void, glPushAttrib, (GLbitfield mask)) -ANT_GL_DECL(void, glPushClientAttrib, (GLbitfield mask)) -ANT_GL_DECL(void, glPushMatrix, (void)) -ANT_GL_DECL(void, glPushName, (GLuint name)) -ANT_GL_DECL(void, glRasterPos2d, (GLdouble x, GLdouble y)) -ANT_GL_DECL(void, glRasterPos2dv, (const GLdouble *v)) -ANT_GL_DECL(void, glRasterPos2f, (GLfloat x, GLfloat y)) -ANT_GL_DECL(void, glRasterPos2fv, (const GLfloat *v)) -ANT_GL_DECL(void, glRasterPos2i, (GLint x, GLint y)) -ANT_GL_DECL(void, glRasterPos2iv, (const GLint *v)) -ANT_GL_DECL(void, glRasterPos2s, (GLshort x, GLshort y)) -ANT_GL_DECL(void, glRasterPos2sv, (const GLshort *v)) -ANT_GL_DECL(void, glRasterPos3d, (GLdouble x, GLdouble y, GLdouble z)) -ANT_GL_DECL(void, glRasterPos3dv, (const GLdouble *v)) -ANT_GL_DECL(void, glRasterPos3f, (GLfloat x, GLfloat y, GLfloat z)) -ANT_GL_DECL(void, glRasterPos3fv, (const GLfloat *v)) -ANT_GL_DECL(void, glRasterPos3i, (GLint x, GLint y, GLint z)) -ANT_GL_DECL(void, glRasterPos3iv, (const GLint *v)) -ANT_GL_DECL(void, glRasterPos3s, (GLshort x, GLshort y, GLshort z)) -ANT_GL_DECL(void, glRasterPos3sv, (const GLshort *v)) -ANT_GL_DECL(void, glRasterPos4d, (GLdouble x, GLdouble y, GLdouble z, GLdouble w)) -ANT_GL_DECL(void, glRasterPos4dv, (const GLdouble *v)) -ANT_GL_DECL(void, glRasterPos4f, (GLfloat x, GLfloat y, GLfloat z, GLfloat w)) -ANT_GL_DECL(void, glRasterPos4fv, (const GLfloat *v)) -ANT_GL_DECL(void, glRasterPos4i, (GLint x, GLint y, GLint z, GLint w)) -ANT_GL_DECL(void, glRasterPos4iv, (const GLint *v)) -ANT_GL_DECL(void, glRasterPos4s, (GLshort x, GLshort y, GLshort z, GLshort w)) -ANT_GL_DECL(void, glRasterPos4sv, (const GLshort *v)) -ANT_GL_DECL(void, glReadBuffer, (GLenum mode)) -ANT_GL_DECL(void, glReadPixels, (GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, GLvoid *pixels)) -ANT_GL_DECL(void, glRectd, (GLdouble x1, GLdouble y1, GLdouble x2, GLdouble y2)) -ANT_GL_DECL(void, glRectdv, (const GLdouble *v1, const GLdouble *v2)) -ANT_GL_DECL(void, glRectf, (GLfloat x1, GLfloat y1, GLfloat x2, GLfloat y2)) -ANT_GL_DECL(void, glRectfv, (const GLfloat *v1, const GLfloat *v2)) -ANT_GL_DECL(void, glRecti, (GLint x1, GLint y1, GLint x2, GLint y2)) -ANT_GL_DECL(void, glRectiv, (const GLint *v1, const GLint *v2)) -ANT_GL_DECL(void, glRects, (GLshort x1, GLshort y1, GLshort x2, GLshort y2)) -ANT_GL_DECL(void, glRectsv, (const GLshort *v1, const GLshort *v2)) -ANT_GL_DECL(GLint, glRenderMode, (GLenum mode)) -ANT_GL_DECL(void, glRotated, (GLdouble angle, GLdouble x, GLdouble y, GLdouble z)) -ANT_GL_DECL(void, glRotatef, (GLfloat angle, GLfloat x, GLfloat y, GLfloat z)) -ANT_GL_DECL(void, glScaled, (GLdouble x, GLdouble y, GLdouble z)) -ANT_GL_DECL(void, glScalef, (GLfloat x, GLfloat y, GLfloat z)) -ANT_GL_DECL(void, glScissor, (GLint x, GLint y, GLsizei width, GLsizei height)) -ANT_GL_DECL(void, glSelectBuffer, (GLsizei size, GLuint *buffer)) -ANT_GL_DECL(void, glShadeModel, (GLenum mode)) -ANT_GL_DECL(void, glStencilFunc, (GLenum func, GLint ref, GLuint mask)) -ANT_GL_DECL(void, glStencilMask, (GLuint mask)) -ANT_GL_DECL(void, glStencilOp, (GLenum fail, GLenum zfail, GLenum zpass)) -ANT_GL_DECL(void, glTexCoord1d, (GLdouble s)) -ANT_GL_DECL(void, glTexCoord1dv, (const GLdouble *v)) -ANT_GL_DECL(void, glTexCoord1f, (GLfloat s)) -ANT_GL_DECL(void, glTexCoord1fv, (const GLfloat *v)) -ANT_GL_DECL(void, glTexCoord1i, (GLint s)) -ANT_GL_DECL(void, glTexCoord1iv, (const GLint *v)) -ANT_GL_DECL(void, glTexCoord1s, (GLshort s)) -ANT_GL_DECL(void, glTexCoord1sv, (const GLshort *v)) -ANT_GL_DECL(void, glTexCoord2d, (GLdouble s, GLdouble t)) -ANT_GL_DECL(void, glTexCoord2dv, (const GLdouble *v)) -ANT_GL_DECL(void, glTexCoord2f, (GLfloat s, GLfloat t)) -ANT_GL_DECL(void, glTexCoord2fv, (const GLfloat *v)) -ANT_GL_DECL(void, glTexCoord2i, (GLint s, GLint t)) -ANT_GL_DECL(void, glTexCoord2iv, (const GLint *v)) -ANT_GL_DECL(void, glTexCoord2s, (GLshort s, GLshort t)) -ANT_GL_DECL(void, glTexCoord2sv, (const GLshort *v)) -ANT_GL_DECL(void, glTexCoord3d, (GLdouble s, GLdouble t, GLdouble r)) -ANT_GL_DECL(void, glTexCoord3dv, (const GLdouble *v)) -ANT_GL_DECL(void, glTexCoord3f, (GLfloat s, GLfloat t, GLfloat r)) -ANT_GL_DECL(void, glTexCoord3fv, (const GLfloat *v)) -ANT_GL_DECL(void, glTexCoord3i, (GLint s, GLint t, GLint r)) -ANT_GL_DECL(void, glTexCoord3iv, (const GLint *v)) -ANT_GL_DECL(void, glTexCoord3s, (GLshort s, GLshort t, GLshort r)) -ANT_GL_DECL(void, glTexCoord3sv, (const GLshort *v)) -ANT_GL_DECL(void, glTexCoord4d, (GLdouble s, GLdouble t, GLdouble r, GLdouble q)) -ANT_GL_DECL(void, glTexCoord4dv, (const GLdouble *v)) -ANT_GL_DECL(void, glTexCoord4f, (GLfloat s, GLfloat t, GLfloat r, GLfloat q)) -ANT_GL_DECL(void, glTexCoord4fv, (const GLfloat *v)) -ANT_GL_DECL(void, glTexCoord4i, (GLint s, GLint t, GLint r, GLint q)) -ANT_GL_DECL(void, glTexCoord4iv, (const GLint *v)) -ANT_GL_DECL(void, glTexCoord4s, (GLshort s, GLshort t, GLshort r, GLshort q)) -ANT_GL_DECL(void, glTexCoord4sv, (const GLshort *v)) -ANT_GL_DECL(void, glTexCoordPointer, (GLint size, GLenum type, GLsizei stride, const GLvoid *pointer)) -ANT_GL_DECL(void, glTexEnvf, (GLenum target, GLenum pname, GLfloat param)) -ANT_GL_DECL(void, glTexEnvfv, (GLenum target, GLenum pname, const GLfloat *params)) -ANT_GL_DECL(void, glTexEnvi, (GLenum target, GLenum pname, GLint param)) -ANT_GL_DECL(void, glTexEnviv, (GLenum target, GLenum pname, const GLint *params)) -ANT_GL_DECL(void, glTexGend, (GLenum coord, GLenum pname, GLdouble param)) -ANT_GL_DECL(void, glTexGendv, (GLenum coord, GLenum pname, const GLdouble *params)) -ANT_GL_DECL(void, glTexGenf, (GLenum coord, GLenum pname, GLfloat param)) -ANT_GL_DECL(void, glTexGenfv, (GLenum coord, GLenum pname, const GLfloat *params)) -ANT_GL_DECL(void, glTexGeni, (GLenum coord, GLenum pname, GLint param)) -ANT_GL_DECL(void, glTexGeniv, (GLenum coord, GLenum pname, const GLint *params)) -#if defined(ANT_OSX) && (MAC_OS_X_VERSION_MAX_ALLOWED < 1070) -// Mac OSX < 10.7 redefines these OpenGL calls: glTexImage1D, glTexImage2D -ANT_GL_DECL(void, glTexImage1D, (GLenum target, GLint level, GLenum internalformat, GLsizei width, GLint border, GLenum format, GLenum type, const GLvoid *pixels)) -ANT_GL_DECL(void, glTexImage2D, (GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLint border, GLenum format, GLenum type, const GLvoid *pixels)) -#else -ANT_GL_DECL(void, glTexImage1D, (GLenum target, GLint level, GLint internalformat, GLsizei width, GLint border, GLenum format, GLenum type, const GLvoid *pixels)) -ANT_GL_DECL(void, glTexImage2D, (GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLint border, GLenum format, GLenum type, const GLvoid *pixels)) -#endif -ANT_GL_DECL(void, glTexParameterf, (GLenum target, GLenum pname, GLfloat param)) -ANT_GL_DECL(void, glTexParameterfv, (GLenum target, GLenum pname, const GLfloat *params)) -ANT_GL_DECL(void, glTexParameteri, (GLenum target, GLenum pname, GLint param)) -ANT_GL_DECL(void, glTexParameteriv, (GLenum target, GLenum pname, const GLint *params)) -ANT_GL_DECL(void, glTexSubImage1D, (GLenum target, GLint level, GLint xoffset, GLsizei width, GLenum format, GLenum type, const GLvoid *pixels)) -ANT_GL_DECL(void, glTexSubImage2D, (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid *pixels)) -ANT_GL_DECL(void, glTranslated, (GLdouble x, GLdouble y, GLdouble z)) -ANT_GL_DECL(void, glTranslatef, (GLfloat x, GLfloat y, GLfloat z)) -ANT_GL_DECL(void, glVertex2d, (GLdouble x, GLdouble y)) -ANT_GL_DECL(void, glVertex2dv, (const GLdouble *v)) -ANT_GL_DECL(void, glVertex2f, (GLfloat x, GLfloat y)) -ANT_GL_DECL(void, glVertex2fv, (const GLfloat *v)) -ANT_GL_DECL(void, glVertex2i, (GLint x, GLint y)) -ANT_GL_DECL(void, glVertex2iv, (const GLint *v)) -ANT_GL_DECL(void, glVertex2s, (GLshort x, GLshort y)) -ANT_GL_DECL(void, glVertex2sv, (const GLshort *v)) -ANT_GL_DECL(void, glVertex3d, (GLdouble x, GLdouble y, GLdouble z)) -ANT_GL_DECL(void, glVertex3dv, (const GLdouble *v)) -ANT_GL_DECL(void, glVertex3f, (GLfloat x, GLfloat y, GLfloat z)) -ANT_GL_DECL(void, glVertex3fv, (const GLfloat *v)) -ANT_GL_DECL(void, glVertex3i, (GLint x, GLint y, GLint z)) -ANT_GL_DECL(void, glVertex3iv, (const GLint *v)) -ANT_GL_DECL(void, glVertex3s, (GLshort x, GLshort y, GLshort z)) -ANT_GL_DECL(void, glVertex3sv, (const GLshort *v)) -ANT_GL_DECL(void, glVertex4d, (GLdouble x, GLdouble y, GLdouble z, GLdouble w)) -ANT_GL_DECL(void, glVertex4dv, (const GLdouble *v)) -ANT_GL_DECL(void, glVertex4f, (GLfloat x, GLfloat y, GLfloat z, GLfloat w)) -ANT_GL_DECL(void, glVertex4fv, (const GLfloat *v)) -ANT_GL_DECL(void, glVertex4i, (GLint x, GLint y, GLint z, GLint w)) -ANT_GL_DECL(void, glVertex4iv, (const GLint *v)) -ANT_GL_DECL(void, glVertex4s, (GLshort x, GLshort y, GLshort z, GLshort w)) -ANT_GL_DECL(void, glVertex4sv, (const GLshort *v)) -ANT_GL_DECL(void, glVertexPointer, (GLint size, GLenum type, GLsizei stride, const GLvoid *pointer)) -ANT_GL_DECL(void, glViewport, (GLint x, GLint y, GLsizei width, GLsizei height)) - -#ifdef ANT_WINDOWS -ANT_GL_DECL(PROC, wglGetProcAddress, (LPCSTR)) -#endif - - -#endif // !defined ANT_LOAD_OGL_INCLUDED diff --git a/extern/AntTweakBar/src/LoadOGLCore.cpp b/extern/AntTweakBar/src/LoadOGLCore.cpp deleted file mode 100644 index 243df5ed..00000000 --- a/extern/AntTweakBar/src/LoadOGLCore.cpp +++ /dev/null @@ -1,539 +0,0 @@ -// --------------------------------------------------------------------------- -// -// @file LoadOGLCore.cpp -// @author Philippe Decaudin -// @license This file is part of the AntTweakBar library. -// For conditions of distribution and use, see License.txt -// -// --------------------------------------------------------------------------- - - -#include "TwPrecomp.h" -#include "LoadOGLCore.h" - -// --------------------------------------------------------------------------- - -#define ANT_NB_OGL_CORE_FUNC_MAX 512 - -struct COGLCoreFuncRec -{ - const char * m_Name; - GLCore::PFNOpenGL * m_FuncPtr; - COGLCoreFuncRec() : m_Name(NULL), m_FuncPtr(NULL) {} -}; -COGLCoreFuncRec g_OGLCoreFuncRec[ANT_NB_OGL_CORE_FUNC_MAX]; -int g_NbOGLCoreFunc = 0; -#if defined(ANT_WINDOWS) -HMODULE g_OGLCoreModule = NULL; -#endif - -// --------------------------------------------------------------------------- - -// GL 1.0 -ANT_GL_CORE_IMPL(glCullFace) -ANT_GL_CORE_IMPL(glFrontFace) -ANT_GL_CORE_IMPL(glHint) -ANT_GL_CORE_IMPL(glLineWidth) -ANT_GL_CORE_IMPL(glPointSize) -ANT_GL_CORE_IMPL(glPolygonMode) -ANT_GL_CORE_IMPL(glScissor) -ANT_GL_CORE_IMPL(glTexParameterf) -ANT_GL_CORE_IMPL(glTexParameterfv) -ANT_GL_CORE_IMPL(glTexParameteri) -ANT_GL_CORE_IMPL(glTexParameteriv) -ANT_GL_CORE_IMPL(glTexImage1D) -ANT_GL_CORE_IMPL(glTexImage2D) -ANT_GL_CORE_IMPL(glDrawBuffer) -ANT_GL_CORE_IMPL(glClear) -ANT_GL_CORE_IMPL(glClearColor) -ANT_GL_CORE_IMPL(glClearStencil) -ANT_GL_CORE_IMPL(glClearDepth) -ANT_GL_CORE_IMPL(glStencilMask) -ANT_GL_CORE_IMPL(glColorMask) -ANT_GL_CORE_IMPL(glDepthMask) -ANT_GL_CORE_IMPL(glDisable) -ANT_GL_CORE_IMPL(glEnable) -ANT_GL_CORE_IMPL(glFinish) -ANT_GL_CORE_IMPL(glFlush) -ANT_GL_CORE_IMPL(glBlendFunc) -ANT_GL_CORE_IMPL(glLogicOp) -ANT_GL_CORE_IMPL(glStencilFunc) -ANT_GL_CORE_IMPL(glStencilOp) -ANT_GL_CORE_IMPL(glDepthFunc) -ANT_GL_CORE_IMPL(glPixelStoref) -ANT_GL_CORE_IMPL(glPixelStorei) -ANT_GL_CORE_IMPL(glReadBuffer) -ANT_GL_CORE_IMPL(glReadPixels) -ANT_GL_CORE_IMPL(glGetBooleanv) -ANT_GL_CORE_IMPL(glGetDoublev) -ANT_GL_CORE_IMPL(glGetError) -ANT_GL_CORE_IMPL(glGetFloatv) -ANT_GL_CORE_IMPL(glGetIntegerv) -ANT_GL_CORE_IMPL(glGetString) -ANT_GL_CORE_IMPL(glGetTexImage) -ANT_GL_CORE_IMPL(glGetTexParameterfv) -ANT_GL_CORE_IMPL(glGetTexParameteriv) -ANT_GL_CORE_IMPL(glGetTexLevelParameterfv) -ANT_GL_CORE_IMPL(glGetTexLevelParameteriv) -ANT_GL_CORE_IMPL(glIsEnabled) -ANT_GL_CORE_IMPL(glDepthRange) -ANT_GL_CORE_IMPL(glViewport) -// GL 1.1 -ANT_GL_CORE_IMPL(glDrawArrays) -ANT_GL_CORE_IMPL(glDrawElements) -ANT_GL_CORE_IMPL(glGetPointerv) -ANT_GL_CORE_IMPL(glPolygonOffset) -ANT_GL_CORE_IMPL(glCopyTexImage1D) -ANT_GL_CORE_IMPL(glCopyTexImage2D) -ANT_GL_CORE_IMPL(glCopyTexSubImage1D) -ANT_GL_CORE_IMPL(glCopyTexSubImage2D) -ANT_GL_CORE_IMPL(glTexSubImage1D) -ANT_GL_CORE_IMPL(glTexSubImage2D) -ANT_GL_CORE_IMPL(glBindTexture) -ANT_GL_CORE_IMPL(glDeleteTextures) -ANT_GL_CORE_IMPL(glGenTextures) -ANT_GL_CORE_IMPL(glIsTexture) -// GL 1.2 -ANT_GL_CORE_IMPL(glBlendColor) -ANT_GL_CORE_IMPL(glBlendEquation) -ANT_GL_CORE_IMPL(glDrawRangeElements) -ANT_GL_CORE_IMPL(glTexImage3D) -ANT_GL_CORE_IMPL(glTexSubImage3D) -ANT_GL_CORE_IMPL(glCopyTexSubImage3D) -// GL 1.3 -ANT_GL_CORE_IMPL(glActiveTexture) -ANT_GL_CORE_IMPL(glSampleCoverage) -ANT_GL_CORE_IMPL(glCompressedTexImage3D) -ANT_GL_CORE_IMPL(glCompressedTexImage2D) -ANT_GL_CORE_IMPL(glCompressedTexImage1D) -ANT_GL_CORE_IMPL(glCompressedTexSubImage3D) -ANT_GL_CORE_IMPL(glCompressedTexSubImage2D) -ANT_GL_CORE_IMPL(glCompressedTexSubImage1D) -ANT_GL_CORE_IMPL(glGetCompressedTexImage) -// GL 1.4 -ANT_GL_CORE_IMPL(glBlendFuncSeparate) -ANT_GL_CORE_IMPL(glMultiDrawArrays) -ANT_GL_CORE_IMPL(glMultiDrawElements) -ANT_GL_CORE_IMPL(glPointParameterf) -ANT_GL_CORE_IMPL(glPointParameterfv) -ANT_GL_CORE_IMPL(glPointParameteri) -ANT_GL_CORE_IMPL(glPointParameteriv) -// GL 1.5 -ANT_GL_CORE_IMPL(glGenQueries) -ANT_GL_CORE_IMPL(glDeleteQueries) -ANT_GL_CORE_IMPL(glIsQuery) -ANT_GL_CORE_IMPL(glBeginQuery) -ANT_GL_CORE_IMPL(glEndQuery) -ANT_GL_CORE_IMPL(glGetQueryiv) -ANT_GL_CORE_IMPL(glGetQueryObjectiv) -ANT_GL_CORE_IMPL(glGetQueryObjectuiv) -ANT_GL_CORE_IMPL(glBindBuffer) -ANT_GL_CORE_IMPL(glDeleteBuffers) -ANT_GL_CORE_IMPL(glGenBuffers) -ANT_GL_CORE_IMPL(glIsBuffer) -ANT_GL_CORE_IMPL(glBufferData) -ANT_GL_CORE_IMPL(glBufferSubData) -ANT_GL_CORE_IMPL(glGetBufferSubData) -ANT_GL_CORE_IMPL(glMapBuffer) -ANT_GL_CORE_IMPL(glUnmapBuffer) -ANT_GL_CORE_IMPL(glGetBufferParameteriv) -ANT_GL_CORE_IMPL(glGetBufferPointerv) -// GL 2.0 -ANT_GL_CORE_IMPL(glBlendEquationSeparate) -ANT_GL_CORE_IMPL(glDrawBuffers) -ANT_GL_CORE_IMPL(glStencilOpSeparate) -ANT_GL_CORE_IMPL(glStencilFuncSeparate) -ANT_GL_CORE_IMPL(glStencilMaskSeparate) -ANT_GL_CORE_IMPL(glAttachShader) -ANT_GL_CORE_IMPL(glBindAttribLocation) -ANT_GL_CORE_IMPL(glCompileShader) -ANT_GL_CORE_IMPL(glCreateProgram) -ANT_GL_CORE_IMPL(glCreateShader) -ANT_GL_CORE_IMPL(glDeleteProgram) -ANT_GL_CORE_IMPL(glDeleteShader) -ANT_GL_CORE_IMPL(glDetachShader) -ANT_GL_CORE_IMPL(glDisableVertexAttribArray) -ANT_GL_CORE_IMPL(glEnableVertexAttribArray) -ANT_GL_CORE_IMPL(glGetActiveAttrib) -ANT_GL_CORE_IMPL(glGetActiveUniform) -ANT_GL_CORE_IMPL(glGetAttachedShaders) -ANT_GL_CORE_IMPL(glGetAttribLocation) -ANT_GL_CORE_IMPL(glGetProgramiv) -ANT_GL_CORE_IMPL(glGetProgramInfoLog) -ANT_GL_CORE_IMPL(glGetShaderiv) -ANT_GL_CORE_IMPL(glGetShaderInfoLog) -ANT_GL_CORE_IMPL(glGetShaderSource) -ANT_GL_CORE_IMPL(glGetUniformLocation) -ANT_GL_CORE_IMPL(glGetUniformfv) -ANT_GL_CORE_IMPL(glGetUniformiv) -ANT_GL_CORE_IMPL(glGetVertexAttribdv) -ANT_GL_CORE_IMPL(glGetVertexAttribfv) -ANT_GL_CORE_IMPL(glGetVertexAttribiv) -ANT_GL_CORE_IMPL(glGetVertexAttribPointerv) -ANT_GL_CORE_IMPL(glIsProgram) -ANT_GL_CORE_IMPL(glIsShader) -ANT_GL_CORE_IMPL(glLinkProgram) -ANT_GL_CORE_IMPL(glShaderSource) -ANT_GL_CORE_IMPL(glUseProgram) -ANT_GL_CORE_IMPL(glUniform1f) -ANT_GL_CORE_IMPL(glUniform2f) -ANT_GL_CORE_IMPL(glUniform3f) -ANT_GL_CORE_IMPL(glUniform4f) -ANT_GL_CORE_IMPL(glUniform1i) -ANT_GL_CORE_IMPL(glUniform2i) -ANT_GL_CORE_IMPL(glUniform3i) -ANT_GL_CORE_IMPL(glUniform4i) -ANT_GL_CORE_IMPL(glUniform1fv) -ANT_GL_CORE_IMPL(glUniform2fv) -ANT_GL_CORE_IMPL(glUniform3fv) -ANT_GL_CORE_IMPL(glUniform4fv) -ANT_GL_CORE_IMPL(glUniform1iv) -ANT_GL_CORE_IMPL(glUniform2iv) -ANT_GL_CORE_IMPL(glUniform3iv) -ANT_GL_CORE_IMPL(glUniform4iv) -ANT_GL_CORE_IMPL(glUniformMatrix2fv) -ANT_GL_CORE_IMPL(glUniformMatrix3fv) -ANT_GL_CORE_IMPL(glUniformMatrix4fv) -ANT_GL_CORE_IMPL(glValidateProgram) -ANT_GL_CORE_IMPL(glVertexAttrib1d) -ANT_GL_CORE_IMPL(glVertexAttrib1dv) -ANT_GL_CORE_IMPL(glVertexAttrib1f) -ANT_GL_CORE_IMPL(glVertexAttrib1fv) -ANT_GL_CORE_IMPL(glVertexAttrib1s) -ANT_GL_CORE_IMPL(glVertexAttrib1sv) -ANT_GL_CORE_IMPL(glVertexAttrib2d) -ANT_GL_CORE_IMPL(glVertexAttrib2dv) -ANT_GL_CORE_IMPL(glVertexAttrib2f) -ANT_GL_CORE_IMPL(glVertexAttrib2fv) -ANT_GL_CORE_IMPL(glVertexAttrib2s) -ANT_GL_CORE_IMPL(glVertexAttrib2sv) -ANT_GL_CORE_IMPL(glVertexAttrib3d) -ANT_GL_CORE_IMPL(glVertexAttrib3dv) -ANT_GL_CORE_IMPL(glVertexAttrib3f) -ANT_GL_CORE_IMPL(glVertexAttrib3fv) -ANT_GL_CORE_IMPL(glVertexAttrib3s) -ANT_GL_CORE_IMPL(glVertexAttrib3sv) -ANT_GL_CORE_IMPL(glVertexAttrib4Nbv) -ANT_GL_CORE_IMPL(glVertexAttrib4Niv) -ANT_GL_CORE_IMPL(glVertexAttrib4Nsv) -ANT_GL_CORE_IMPL(glVertexAttrib4Nub) -ANT_GL_CORE_IMPL(glVertexAttrib4Nubv) -ANT_GL_CORE_IMPL(glVertexAttrib4Nuiv) -ANT_GL_CORE_IMPL(glVertexAttrib4Nusv) -ANT_GL_CORE_IMPL(glVertexAttrib4bv) -ANT_GL_CORE_IMPL(glVertexAttrib4d) -ANT_GL_CORE_IMPL(glVertexAttrib4dv) -ANT_GL_CORE_IMPL(glVertexAttrib4f) -ANT_GL_CORE_IMPL(glVertexAttrib4fv) -ANT_GL_CORE_IMPL(glVertexAttrib4iv) -ANT_GL_CORE_IMPL(glVertexAttrib4s) -ANT_GL_CORE_IMPL(glVertexAttrib4sv) -ANT_GL_CORE_IMPL(glVertexAttrib4ubv) -ANT_GL_CORE_IMPL(glVertexAttrib4uiv) -ANT_GL_CORE_IMPL(glVertexAttrib4usv) -ANT_GL_CORE_IMPL(glVertexAttribPointer) -/* -// GL 2.1 -ANT_GL_CORE_IMPL(glUniformMatrix2x3fv) -ANT_GL_CORE_IMPL(glUniformMatrix3x2fv) -ANT_GL_CORE_IMPL(glUniformMatrix2x4fv) -ANT_GL_CORE_IMPL(glUniformMatrix4x2fv) -ANT_GL_CORE_IMPL(glUniformMatrix3x4fv) -ANT_GL_CORE_IMPL(glUniformMatrix4x3fv) -// GL 3.0 -ANT_GL_CORE_IMPL(glColorMaski) -ANT_GL_CORE_IMPL(glGetBooleani_v) -ANT_GL_CORE_IMPL(glGetIntegeri_v) -ANT_GL_CORE_IMPL(glEnablei) -ANT_GL_CORE_IMPL(glDisablei) -ANT_GL_CORE_IMPL(glIsEnabledi) -ANT_GL_CORE_IMPL(glBeginTransformFeedback) -ANT_GL_CORE_IMPL(glEndTransformFeedback) -ANT_GL_CORE_IMPL(glBindBufferRange) -ANT_GL_CORE_IMPL(glBindBufferBase) -ANT_GL_CORE_IMPL(glTransformFeedbackVaryings) -ANT_GL_CORE_IMPL(glGetTransformFeedbackVarying) -ANT_GL_CORE_IMPL(glClampColor) -ANT_GL_CORE_IMPL(glBeginConditionalRender) -ANT_GL_CORE_IMPL(glEndConditionalRender) -ANT_GL_CORE_IMPL(glVertexAttribIPointer) -ANT_GL_CORE_IMPL(glGetVertexAttribIiv) -ANT_GL_CORE_IMPL(glGetVertexAttribIuiv) -ANT_GL_CORE_IMPL(glVertexAttribI1i) -ANT_GL_CORE_IMPL(glVertexAttribI2i) -ANT_GL_CORE_IMPL(glVertexAttribI3i) -ANT_GL_CORE_IMPL(glVertexAttribI4i) -ANT_GL_CORE_IMPL(glVertexAttribI1ui) -ANT_GL_CORE_IMPL(glVertexAttribI2ui) -ANT_GL_CORE_IMPL(glVertexAttribI3ui) -ANT_GL_CORE_IMPL(glVertexAttribI4ui) -ANT_GL_CORE_IMPL(glVertexAttribI1iv) -ANT_GL_CORE_IMPL(glVertexAttribI2iv) -ANT_GL_CORE_IMPL(glVertexAttribI3iv) -ANT_GL_CORE_IMPL(glVertexAttribI4iv) -ANT_GL_CORE_IMPL(glVertexAttribI1uiv) -ANT_GL_CORE_IMPL(glVertexAttribI2uiv) -ANT_GL_CORE_IMPL(glVertexAttribI3uiv) -ANT_GL_CORE_IMPL(glVertexAttribI4uiv) -ANT_GL_CORE_IMPL(glVertexAttribI4bv) -ANT_GL_CORE_IMPL(glVertexAttribI4sv) -ANT_GL_CORE_IMPL(glVertexAttribI4ubv) -ANT_GL_CORE_IMPL(glVertexAttribI4usv) -ANT_GL_CORE_IMPL(glGetUniformuiv) -ANT_GL_CORE_IMPL(glBindFragDataLocation) -ANT_GL_CORE_IMPL(glGetFragDataLocation) -ANT_GL_CORE_IMPL(glUniform1ui) -ANT_GL_CORE_IMPL(glUniform2ui) -ANT_GL_CORE_IMPL(glUniform3ui) -ANT_GL_CORE_IMPL(glUniform4ui) -ANT_GL_CORE_IMPL(glUniform1uiv) -ANT_GL_CORE_IMPL(glUniform2uiv) -ANT_GL_CORE_IMPL(glUniform3uiv) -ANT_GL_CORE_IMPL(glUniform4uiv) -ANT_GL_CORE_IMPL(glTexParameterIiv) -ANT_GL_CORE_IMPL(glTexParameterIuiv) -ANT_GL_CORE_IMPL(glGetTexParameterIiv) -ANT_GL_CORE_IMPL(glGetTexParameterIuiv) -ANT_GL_CORE_IMPL(glClearBufferiv) -ANT_GL_CORE_IMPL(glClearBufferuiv) -ANT_GL_CORE_IMPL(glClearBufferfv) -ANT_GL_CORE_IMPL(glClearBufferfi) -ANT_GL_CORE_IMPL(glGetStringi) -// GL 3.1 -ANT_GL_CORE_IMPL(glDrawArraysInstanced) -ANT_GL_CORE_IMPL(glDrawElementsInstanced) -ANT_GL_CORE_IMPL(glTexBuffer) -ANT_GL_CORE_IMPL(glPrimitiveRestartIndex) -// GL 3.2 -//ANT_GL_CORE_IMPL(glGetInteger64i_v) -//ANT_GL_CORE_IMPL(glGetBufferParameteri64v) -ANT_GL_CORE_IMPL(glFramebufferTexture) -*/ - -// GL_ARB_vertex_array_object -#if defined(ANT_WINDOWS) - ANT_GL_CORE_IMPL(glBindVertexArray) - ANT_GL_CORE_IMPL(glDeleteVertexArrays) - ANT_GL_CORE_IMPL(glGenVertexArrays) - ANT_GL_CORE_IMPL(glIsVertexArray) -#else - // these extensions are loaded explicitely by LoadOpenGLCore - // because they may not be avialable on non-OpenGL 3.2 environments - namespace GLCore - { - PFNglBindVertexArray _glBindVertexArray = NULL; - PFNglDeleteVertexArrays _glDeleteVertexArrays = NULL; - PFNglGenVertexArrays _glGenVertexArrays = NULL; - PFNglIsVertexArray _glIsVertexArray = NULL; - } -#endif - -#if defined(ANT_WINDOWS) - ANT_GL_CORE_IMPL(wglGetProcAddress) -#endif - -namespace GLCore { PFNGLGetProcAddress _glGetProcAddress = NULL; } - -// --------------------------------------------------------------------------- - -#if defined(ANT_WINDOWS) - - // --------------------------------------------------------------------------- - - int LoadOpenGLCore() - { - if( g_OGLCoreModule!=NULL ) - { - return 1; // "OpenGL library already loaded" - } - - g_OGLCoreModule = LoadLibrary("OPENGL32.DLL"); - if( g_OGLCoreModule ) - { - // Info(VERB_LOW, "Load %d OpenGL Core functions", g_NbOGLCoreFunc); - - int Res = 1; - - // Use wglGetProcAddress to retreive Core functions - _glGetProcAddress = reinterpret_cast(GetProcAddress(g_OGLCoreModule, "wglGetProcAddress")); - if( _glGetProcAddress!=NULL ) - for(int i=0; i0); - // Try to get the function pointer with wglGetProcAddress - *(g_OGLCoreFuncRec[i].m_FuncPtr) = reinterpret_cast(_glGetProcAddress(g_OGLCoreFuncRec[i].m_Name)); - if( *(g_OGLCoreFuncRec[i].m_FuncPtr)==NULL ) - { - // Try to get the function pointer with GetProcAddress - *(g_OGLCoreFuncRec[i].m_FuncPtr) = reinterpret_cast(GetProcAddress(g_OGLCoreModule, g_OGLCoreFuncRec[i].m_Name)); - if( *(g_OGLCoreFuncRec[i].m_FuncPtr)==NULL ) - { - #ifdef _DEBUG - fprintf(stderr, "AntTweakBar: Cannot load function %s\n", g_OGLCoreFuncRec[i].m_Name); - #endif - Res = 0; // Error("cannot find OpenGL Core function"); - } - } - - } - - return Res; - } - else - { - // InternDisplayLastErrorWIN("Cannot load opengl32 DLL", false); - return 0; // cannot load DLL - } - } - - // --------------------------------------------------------------------------- - - int UnloadOpenGLCore() - { - if( g_OGLCoreModule==NULL ) - { - return 1; // "OpenGL library not loaded" - } - - // Info(VERB_LOW, "Unload %d OpenGL Core functions", g_NbOGLCoreFunc); - for(int i=0; i0); - *(g_OGLCoreFuncRec[i].m_FuncPtr) = NULL; - } - if( FreeLibrary(g_OGLCoreModule) ) - { - // Info(VERB_LOW, "OpenGL library unloaded"); - g_OGLCoreModule = NULL; - return 1; - } - else - { - // InternDisplayLastErrorWIN("Cannot unload opengl32 DLL", false); - return 0; // cannot unload opengl32.dll - } - } - - // --------------------------------------------------------------------------- - - namespace GLCore - { - - PFNOpenGL Record(const char *_FuncName, PFNOpenGL *_FuncPtr) - { - if( g_NbOGLCoreFunc>=ANT_NB_OGL_CORE_FUNC_MAX ) - { - fprintf(stderr, "Too many OpenGL Core functions declared. Change ANT_NB_OGL_CORE_FUNC_MAX."); - exit(-1); - } - - g_OGLCoreFuncRec[g_NbOGLCoreFunc].m_Name = _FuncName; - g_OGLCoreFuncRec[g_NbOGLCoreFunc].m_FuncPtr = _FuncPtr; - ++g_NbOGLCoreFunc; - - return NULL; - } - - } // namespace GL - - // --------------------------------------------------------------------------- - -#endif // defined(ANT_WINDOWS) - -// --------------------------------------------------------------------------- - -#if defined(ANT_UNIX) - - int LoadOpenGLCore() - { - _glGetProcAddress = reinterpret_cast(glXGetProcAddressARB); - - _glBindVertexArray = reinterpret_cast(_glGetProcAddress("glBindVertexArray")); - _glDeleteVertexArrays = reinterpret_cast(_glGetProcAddress("glDeleteVertexArrays")); - _glGenVertexArrays = reinterpret_cast(_glGetProcAddress("glGenVertexArrays")); - _glIsVertexArray = reinterpret_cast(_glGetProcAddress("glIsVertexArray")); - - if( _glBindVertexArray==NULL || _glDeleteVertexArrays==NULL || _glGenVertexArrays==NULL || _glIsVertexArray==NULL ) - { - fprintf(stderr, "AntTweakBar: OpenGL Core Profile functions cannot be loaded.\n"); - return 0; - } - else - return 1; - } - - int UnloadOpenGLCore() - { - return 1; - } - -#elif defined(ANT_OSX) - - #include - - static void *gl_dyld = NULL; - static const char *gl_prefix = "_"; - void *NSGLCoreGetProcAddressNew(const GLubyte *name) - { - void *proc=NULL; - if (gl_dyld == NULL) - { - gl_dyld = dlopen("OpenGL",RTLD_LAZY); - } - if (gl_dyld) - { - NSString *sym = [[NSString alloc] initWithFormat: @"%s%s",gl_prefix,name]; - proc = dlsym(gl_dyld,[sym UTF8String]); - [sym release]; - } - return proc; - } - - int LoadOpenGLCore() - { - _glGetProcAddress = reinterpret_cast(NSGLCoreGetProcAddressNew); - - _glBindVertexArray = reinterpret_cast(_glGetProcAddress("glBindVertexArray")); - _glDeleteVertexArrays = reinterpret_cast(_glGetProcAddress("glDeleteVertexArrays")); - _glGenVertexArrays = reinterpret_cast(_glGetProcAddress("glGenVertexArrays")); - _glIsVertexArray = reinterpret_cast(_glGetProcAddress("glIsVertexArray")); - - if( _glBindVertexArray==NULL || _glDeleteVertexArrays==NULL || _glGenVertexArrays==NULL || _glIsVertexArray==NULL ) - { - // remove the symbols underscore prefix (OSX 10.7 and later) - gl_prefix = ""; - - _glBindVertexArray = reinterpret_cast(_glGetProcAddress("glBindVertexArray")); - _glDeleteVertexArrays = reinterpret_cast(_glGetProcAddress("glDeleteVertexArrays")); - _glGenVertexArrays = reinterpret_cast(_glGetProcAddress("glGenVertexArrays")); - _glIsVertexArray = reinterpret_cast(_glGetProcAddress("glIsVertexArray")); - - if( _glBindVertexArray==NULL || _glDeleteVertexArrays==NULL || _glGenVertexArrays==NULL || _glIsVertexArray==NULL ) - { - fprintf(stderr, "AntTweakBar: OpenGL Core Profile functions cannot be loaded.\n"); - return 0; - } - } - - return 1; - } - - int UnloadOpenGLCore() - { - if (gl_dyld) - { - dlclose(gl_dyld); - gl_dyld = NULL; - } - return 1; - } - -#endif - -// --------------------------------------------------------------------------- diff --git a/extern/AntTweakBar/src/LoadOGLCore.h b/extern/AntTweakBar/src/LoadOGLCore.h deleted file mode 100644 index 5460f302..00000000 --- a/extern/AntTweakBar/src/LoadOGLCore.h +++ /dev/null @@ -1,411 +0,0 @@ -// --------------------------------------------------------------------------- -// -// @file LoadOGLCore.h -// @brief OpenGL Core Profile declarations for dynamic loading -// @author Philippe Decaudin -// @license This file is part of the AntTweakBar library. -// For conditions of distribution and use, see License.txt -// -// note: Private header -// -// --------------------------------------------------------------------------- - - -#if !defined ANT_LOAD_OGL_CORE_INCLUDED -#define ANT_LOAD_OGL_CORE_INCLUDED - - -#define ANT_GL_CORE_DECL_NO_FORWARD(_Ret, _Fct, _Params) \ - extern "C" { typedef _Ret (APIENTRY* PFN##_Fct)_Params; } \ - namespace GLCore { extern PFN##_Fct _##_Fct; } \ - using GLCore::_##_Fct; - -#if defined(ANT_WINDOWS) -# define ANT_GL_CORE_DECL(_Ret, _Fct, _Params) \ - ANT_GL_CORE_DECL_NO_FORWARD(_Ret, _Fct, _Params) -# define ANT_GL_CORE_IMPL(_Fct) \ - namespace GLCore { PFN##_Fct _##_Fct = (PFN##_Fct)Record(#_Fct, (PFNOpenGL*)(&_##_Fct)); } -#elif defined(ANT_UNIX) || defined(ANT_OSX) -# if !defined(APIENTRY) -# define APIENTRY -# endif -# define ANT_GL_CORE_DECL(_Ret, _Fct, _Params) \ - ANT_GL_CORE_DECL_NO_FORWARD(_Ret, _Fct, _Params) \ - extern "C" { _Ret APIENTRY _Fct _Params; } -# define ANT_GL_CORE_IMPL(_Fct) \ - namespace GLCore { PFN##_Fct _##_Fct = _Fct; } -#endif - - -int LoadOpenGLCore(); -int UnloadOpenGLCore(); - -namespace GLCore -{ - extern "C" { typedef void (APIENTRY* PFNOpenGL)(); } - PFNOpenGL Record(const char *_FuncName, PFNOpenGL *_FuncPtr); - - extern "C" { typedef PFNOpenGL (APIENTRY *PFNGLGetProcAddress)(const char *); } - extern PFNGLGetProcAddress _glGetProcAddress; -} -using GLCore::_glGetProcAddress; - - -// GL 1.0 -ANT_GL_CORE_DECL(void, glCullFace, (GLenum mode)) -ANT_GL_CORE_DECL(void, glFrontFace, (GLenum mode)) -ANT_GL_CORE_DECL(void, glHint, (GLenum target, GLenum mode)) -ANT_GL_CORE_DECL(void, glLineWidth, (GLfloat width)) -ANT_GL_CORE_DECL(void, glPointSize, (GLfloat size)) -ANT_GL_CORE_DECL(void, glPolygonMode, (GLenum face, GLenum mode)) -ANT_GL_CORE_DECL(void, glScissor, (GLint x, GLint y, GLsizei width, GLsizei height)) -ANT_GL_CORE_DECL(void, glTexParameterf, (GLenum target, GLenum pname, GLfloat param)) -ANT_GL_CORE_DECL(void, glTexParameterfv, (GLenum target, GLenum pname, const GLfloat *params)) -ANT_GL_CORE_DECL(void, glTexParameteri, (GLenum target, GLenum pname, GLint param)) -ANT_GL_CORE_DECL(void, glTexParameteriv, (GLenum target, GLenum pname, const GLint *params)) -#if defined(ANT_OSX) && (MAC_OS_X_VERSION_MAX_ALLOWED < 1070) -// Mac OSX < 10.7 redefines these OpenGL calls: glTexImage1D, glTexImage2D -ANT_GL_CORE_DECL(void, glTexImage1D, (GLenum target, GLint level, GLenum internalformat, GLsizei width, GLint border, GLenum format, GLenum type, const GLvoid *pixels)) -ANT_GL_CORE_DECL(void, glTexImage2D, (GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLint border, GLenum format, GLenum type, const GLvoid *pixels)) -#else -ANT_GL_CORE_DECL(void, glTexImage1D, (GLenum target, GLint level, GLint internalformat, GLsizei width, GLint border, GLenum format, GLenum type, const GLvoid *pixels)) -ANT_GL_CORE_DECL(void, glTexImage2D, (GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLint border, GLenum format, GLenum type, const GLvoid *pixels)) -#endif -ANT_GL_CORE_DECL(void, glDrawBuffer, (GLenum mode)) -ANT_GL_CORE_DECL(void, glClear, (GLbitfield mask)) -ANT_GL_CORE_DECL(void, glClearColor, (GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha)) -ANT_GL_CORE_DECL(void, glClearStencil, (GLint s)) -ANT_GL_CORE_DECL(void, glClearDepth, (GLclampd depth)) -ANT_GL_CORE_DECL(void, glStencilMask, (GLuint mask)) -ANT_GL_CORE_DECL(void, glColorMask, (GLboolean red, GLboolean green, GLboolean blue, GLboolean alpha)) -ANT_GL_CORE_DECL(void, glDepthMask, (GLboolean flag)) -ANT_GL_CORE_DECL(void, glDisable, (GLenum cap)) -ANT_GL_CORE_DECL(void, glEnable, (GLenum cap)) -ANT_GL_CORE_DECL(void, glFinish, (void)) -ANT_GL_CORE_DECL(void, glFlush, (void)) -ANT_GL_CORE_DECL(void, glBlendFunc, (GLenum sfactor, GLenum dfactor)) -ANT_GL_CORE_DECL(void, glLogicOp, (GLenum opcode)) -ANT_GL_CORE_DECL(void, glStencilFunc, (GLenum func, GLint ref, GLuint mask)) -ANT_GL_CORE_DECL(void, glStencilOp, (GLenum fail, GLenum zfail, GLenum zpass)) -ANT_GL_CORE_DECL(void, glDepthFunc, (GLenum func)) -ANT_GL_CORE_DECL(void, glPixelStoref, (GLenum pname, GLfloat param)) -ANT_GL_CORE_DECL(void, glPixelStorei, (GLenum pname, GLint param)) -ANT_GL_CORE_DECL(void, glReadBuffer, (GLenum mode)) -ANT_GL_CORE_DECL(void, glReadPixels, (GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, GLvoid *pixels)) -ANT_GL_CORE_DECL(void, glGetBooleanv, (GLenum pname, GLboolean *params)) -ANT_GL_CORE_DECL(void, glGetDoublev, (GLenum pname, GLdouble *params)) -ANT_GL_CORE_DECL(GLenum, glGetError, (void)) -ANT_GL_CORE_DECL(void, glGetFloatv, (GLenum pname, GLfloat *params)) -ANT_GL_CORE_DECL(void, glGetIntegerv, (GLenum pname, GLint *params)) -ANT_GL_CORE_DECL(const GLubyte *, glGetString, (GLenum name)) -ANT_GL_CORE_DECL(void, glGetTexImage, (GLenum target, GLint level, GLenum format, GLenum type, GLvoid *pixels)) -ANT_GL_CORE_DECL(void, glGetTexParameterfv, (GLenum target, GLenum pname, GLfloat *params)) -ANT_GL_CORE_DECL(void, glGetTexParameteriv, (GLenum target, GLenum pname, GLint *params)) -ANT_GL_CORE_DECL(void, glGetTexLevelParameterfv, (GLenum target, GLint level, GLenum pname, GLfloat *params)) -ANT_GL_CORE_DECL(void, glGetTexLevelParameteriv, (GLenum target, GLint level, GLenum pname, GLint *params)) -ANT_GL_CORE_DECL(GLboolean, glIsEnabled, (GLenum cap)) -ANT_GL_CORE_DECL(void, glDepthRange, (GLclampd near, GLclampd far)) -ANT_GL_CORE_DECL(void, glViewport, (GLint x, GLint y, GLsizei width, GLsizei height)) -// GL 1.1 -ANT_GL_CORE_DECL(void, glDrawArrays, (GLenum mode, GLint first, GLsizei count)) -ANT_GL_CORE_DECL(void, glDrawElements, (GLenum mode, GLsizei count, GLenum type, const GLvoid *indices)) -ANT_GL_CORE_DECL(void, glGetPointerv, (GLenum pname, GLvoid* *params)) -ANT_GL_CORE_DECL(void, glPolygonOffset, (GLfloat factor, GLfloat units)) -ANT_GL_CORE_DECL(void, glCopyTexImage1D, (GLenum target, GLint level, GLenum internalformat, GLint x, GLint y, GLsizei width, GLint border)) -ANT_GL_CORE_DECL(void, glCopyTexImage2D, (GLenum target, GLint level, GLenum internalformat, GLint x, GLint y, GLsizei width, GLsizei height, GLint border)) -ANT_GL_CORE_DECL(void, glCopyTexSubImage1D, (GLenum target, GLint level, GLint xoffset, GLint x, GLint y, GLsizei width)) -ANT_GL_CORE_DECL(void, glCopyTexSubImage2D, (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint x, GLint y, GLsizei width, GLsizei height)) -ANT_GL_CORE_DECL(void, glTexSubImage1D, (GLenum target, GLint level, GLint xoffset, GLsizei width, GLenum format, GLenum type, const GLvoid *pixels)) -ANT_GL_CORE_DECL(void, glTexSubImage2D, (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid *pixels)) -ANT_GL_CORE_DECL(void, glBindTexture, (GLenum target, GLuint texture)) -ANT_GL_CORE_DECL(void, glDeleteTextures, (GLsizei n, const GLuint *textures)) -ANT_GL_CORE_DECL(void, glGenTextures, (GLsizei n, GLuint *textures)) -ANT_GL_CORE_DECL(GLboolean, glIsTexture, (GLuint texture)) -// GL 1.2 -ANT_GL_CORE_DECL(void, glBlendColor, (GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha)) -ANT_GL_CORE_DECL(void, glBlendEquation, (GLenum mode)) -ANT_GL_CORE_DECL(void, glDrawRangeElements, (GLenum mode, GLuint start, GLuint end, GLsizei count, GLenum type, const GLvoid *indices)) -#if defined(ANT_OSX) && (MAC_OS_X_VERSION_MAX_ALLOWED < 1070) -// Mac OSX < 10.7 redefines this OpenGL call: glTexImage3D -ANT_GL_CORE_DECL(void, glTexImage3D, (GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLenum format, GLenum type, const GLvoid *pixels)) -#else -ANT_GL_CORE_DECL(void, glTexImage3D, (GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLenum format, GLenum type, const GLvoid *pixels)) -#endif -ANT_GL_CORE_DECL(void, glTexSubImage3D, (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type, const GLvoid *pixels)) -ANT_GL_CORE_DECL(void, glCopyTexSubImage3D, (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLint x, GLint y, GLsizei width, GLsizei height)) -// GL 1.3 -ANT_GL_CORE_DECL(void, glActiveTexture, (GLenum texture)) -ANT_GL_CORE_DECL(void, glSampleCoverage, (GLclampf value, GLboolean invert)) -ANT_GL_CORE_DECL(void, glCompressedTexImage3D, (GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLsizei imageSize, const GLvoid *data)) -ANT_GL_CORE_DECL(void, glCompressedTexImage2D, (GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLint border, GLsizei imageSize, const GLvoid *data)) -ANT_GL_CORE_DECL(void, glCompressedTexImage1D, (GLenum target, GLint level, GLenum internalformat, GLsizei width, GLint border, GLsizei imageSize, const GLvoid *data)) -ANT_GL_CORE_DECL(void, glCompressedTexSubImage3D, (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLsizei imageSize, const GLvoid *data)) -ANT_GL_CORE_DECL(void, glCompressedTexSubImage2D, (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLsizei imageSize, const GLvoid *data)) -ANT_GL_CORE_DECL(void, glCompressedTexSubImage1D, (GLenum target, GLint level, GLint xoffset, GLsizei width, GLenum format, GLsizei imageSize, const GLvoid *data)) -ANT_GL_CORE_DECL(void, glGetCompressedTexImage, (GLenum target, GLint level, GLvoid *img)) -// GL 1.4 -ANT_GL_CORE_DECL(void, glBlendFuncSeparate, (GLenum sfactorRGB, GLenum dfactorRGB, GLenum sfactorAlpha, GLenum dfactorAlpha)) -ANT_GL_CORE_DECL(void, glMultiDrawArrays, (GLenum mode, const GLint *first, const GLsizei *count, GLsizei primcount)) -#if defined(ANT_OSX) -ANT_GL_CORE_DECL(void, glMultiDrawElements, (GLenum mode, const GLsizei *count, GLenum type, const GLvoid* const *indices, GLsizei primcount)) -#else -ANT_GL_CORE_DECL(void, glMultiDrawElements, (GLenum mode, const GLsizei *count, GLenum type, const GLvoid* *indices, GLsizei primcount)) -#endif -ANT_GL_CORE_DECL(void, glPointParameterf, (GLenum pname, GLfloat param)) -ANT_GL_CORE_DECL(void, glPointParameterfv, (GLenum pname, const GLfloat *params)) -ANT_GL_CORE_DECL(void, glPointParameteri, (GLenum pname, GLint param)) -ANT_GL_CORE_DECL(void, glPointParameteriv, (GLenum pname, const GLint *params)) -// GL 1.5 -#ifndef ANT_OSX - typedef ptrdiff_t GLintptr; - typedef ptrdiff_t GLsizeiptr; -#endif -ANT_GL_CORE_DECL(void, glGenQueries, (GLsizei n, GLuint *ids)) -ANT_GL_CORE_DECL(void, glDeleteQueries, (GLsizei n, const GLuint *ids)) -ANT_GL_CORE_DECL(GLboolean, glIsQuery, (GLuint id)) -ANT_GL_CORE_DECL(void, glBeginQuery, (GLenum target, GLuint id)) -ANT_GL_CORE_DECL(void, glEndQuery, (GLenum target)) -ANT_GL_CORE_DECL(void, glGetQueryiv, (GLenum target, GLenum pname, GLint *params)) -ANT_GL_CORE_DECL(void, glGetQueryObjectiv, (GLuint id, GLenum pname, GLint *params)) -ANT_GL_CORE_DECL(void, glGetQueryObjectuiv, (GLuint id, GLenum pname, GLuint *params)) -ANT_GL_CORE_DECL(void, glBindBuffer, (GLenum target, GLuint buffer)) -ANT_GL_CORE_DECL(void, glDeleteBuffers, (GLsizei n, const GLuint *buffers)) -ANT_GL_CORE_DECL(void, glGenBuffers, (GLsizei n, GLuint *buffers)) -ANT_GL_CORE_DECL(GLboolean, glIsBuffer, (GLuint buffer)) -ANT_GL_CORE_DECL(void, glBufferData, (GLenum target, GLsizeiptr size, const GLvoid *data, GLenum usage)) -ANT_GL_CORE_DECL(void, glBufferSubData, (GLenum target, GLintptr offset, GLsizeiptr size, const GLvoid *data)) -ANT_GL_CORE_DECL(void, glGetBufferSubData, (GLenum target, GLintptr offset, GLsizeiptr size, GLvoid *data)) -ANT_GL_CORE_DECL(GLvoid*, glMapBuffer, (GLenum target, GLenum access)) -ANT_GL_CORE_DECL(GLboolean, glUnmapBuffer, (GLenum target)) -ANT_GL_CORE_DECL(void, glGetBufferParameteriv, (GLenum target, GLenum pname, GLint *params)) -ANT_GL_CORE_DECL(void, glGetBufferPointerv, (GLenum target, GLenum pname, GLvoid* *params)) -// GL 2.0 -typedef char GLchar; -ANT_GL_CORE_DECL(void, glBlendEquationSeparate, (GLenum modeRGB, GLenum modeAlpha)) -ANT_GL_CORE_DECL(void, glDrawBuffers, (GLsizei n, const GLenum *bufs)) -ANT_GL_CORE_DECL(void, glStencilOpSeparate, (GLenum face, GLenum sfail, GLenum dpfail, GLenum dppass)) -ANT_GL_CORE_DECL(void, glStencilFuncSeparate, (GLenum face, GLenum func, GLint ref, GLuint mask)) -ANT_GL_CORE_DECL(void, glStencilMaskSeparate, (GLenum face, GLuint mask)) -ANT_GL_CORE_DECL(void, glAttachShader, (GLuint program, GLuint shader)) -ANT_GL_CORE_DECL(void, glBindAttribLocation, (GLuint program, GLuint index, const GLchar *name)) -ANT_GL_CORE_DECL(void, glCompileShader, (GLuint shader)) -ANT_GL_CORE_DECL(GLuint, glCreateProgram, (void)) -ANT_GL_CORE_DECL(GLuint, glCreateShader, (GLenum type)) -ANT_GL_CORE_DECL(void, glDeleteProgram, (GLuint program)) -ANT_GL_CORE_DECL(void, glDeleteShader, (GLuint shader)) -ANT_GL_CORE_DECL(void, glDetachShader, (GLuint program, GLuint shader)) -ANT_GL_CORE_DECL(void, glDisableVertexAttribArray, (GLuint index)) -ANT_GL_CORE_DECL(void, glEnableVertexAttribArray, (GLuint index)) -ANT_GL_CORE_DECL(void, glGetActiveAttrib, (GLuint program, GLuint index, GLsizei bufSize, GLsizei *length, GLint *size, GLenum *type, GLchar *name)) -ANT_GL_CORE_DECL(void, glGetActiveUniform, (GLuint program, GLuint index, GLsizei bufSize, GLsizei *length, GLint *size, GLenum *type, GLchar *name)) -ANT_GL_CORE_DECL(void, glGetAttachedShaders, (GLuint program, GLsizei maxCount, GLsizei *count, GLuint *obj)) -ANT_GL_CORE_DECL(GLint, glGetAttribLocation, (GLuint program, const GLchar *name)) -ANT_GL_CORE_DECL(void, glGetProgramiv, (GLuint program, GLenum pname, GLint *params)) -ANT_GL_CORE_DECL(void, glGetProgramInfoLog, (GLuint program, GLsizei bufSize, GLsizei *length, GLchar *infoLog)) -ANT_GL_CORE_DECL(void, glGetShaderiv, (GLuint shader, GLenum pname, GLint *params)) -ANT_GL_CORE_DECL(void, glGetShaderInfoLog, (GLuint shader, GLsizei bufSize, GLsizei *length, GLchar *infoLog)) -ANT_GL_CORE_DECL(void, glGetShaderSource, (GLuint shader, GLsizei bufSize, GLsizei *length, GLchar *source)) -ANT_GL_CORE_DECL(GLint, glGetUniformLocation, (GLuint program, const GLchar *name)) -ANT_GL_CORE_DECL(void, glGetUniformfv, (GLuint program, GLint location, GLfloat *params)) -ANT_GL_CORE_DECL(void, glGetUniformiv, (GLuint program, GLint location, GLint *params)) -ANT_GL_CORE_DECL(void, glGetVertexAttribdv, (GLuint index, GLenum pname, GLdouble *params)) -ANT_GL_CORE_DECL(void, glGetVertexAttribfv, (GLuint index, GLenum pname, GLfloat *params)) -ANT_GL_CORE_DECL(void, glGetVertexAttribiv, (GLuint index, GLenum pname, GLint *params)) -ANT_GL_CORE_DECL(void, glGetVertexAttribPointerv, (GLuint index, GLenum pname, GLvoid* *pointer)) -ANT_GL_CORE_DECL(GLboolean, glIsProgram, (GLuint program)) -ANT_GL_CORE_DECL(GLboolean, glIsShader, (GLuint shader)) -ANT_GL_CORE_DECL(void, glLinkProgram, (GLuint program)) -#ifdef __APPLE__ -ANT_GL_CORE_DECL(void, glShaderSource, (GLuint shader, GLsizei count, const GLchar* const *string, const GLint *length)) -#else -ANT_GL_CORE_DECL(void, glShaderSource, (GLuint shader, GLsizei count, const GLchar* *string, const GLint *length)) -#endif -ANT_GL_CORE_DECL(void, glUseProgram, (GLuint program)) -ANT_GL_CORE_DECL(void, glUniform1f, (GLint location, GLfloat v0)) -ANT_GL_CORE_DECL(void, glUniform2f, (GLint location, GLfloat v0, GLfloat v1)) -ANT_GL_CORE_DECL(void, glUniform3f, (GLint location, GLfloat v0, GLfloat v1, GLfloat v2)) -ANT_GL_CORE_DECL(void, glUniform4f, (GLint location, GLfloat v0, GLfloat v1, GLfloat v2, GLfloat v3)) -ANT_GL_CORE_DECL(void, glUniform1i, (GLint location, GLint v0)) -ANT_GL_CORE_DECL(void, glUniform2i, (GLint location, GLint v0, GLint v1)) -ANT_GL_CORE_DECL(void, glUniform3i, (GLint location, GLint v0, GLint v1, GLint v2)) -ANT_GL_CORE_DECL(void, glUniform4i, (GLint location, GLint v0, GLint v1, GLint v2, GLint v3)) -ANT_GL_CORE_DECL(void, glUniform1fv, (GLint location, GLsizei count, const GLfloat *value)) -ANT_GL_CORE_DECL(void, glUniform2fv, (GLint location, GLsizei count, const GLfloat *value)) -ANT_GL_CORE_DECL(void, glUniform3fv, (GLint location, GLsizei count, const GLfloat *value)) -ANT_GL_CORE_DECL(void, glUniform4fv, (GLint location, GLsizei count, const GLfloat *value)) -ANT_GL_CORE_DECL(void, glUniform1iv, (GLint location, GLsizei count, const GLint *value)) -ANT_GL_CORE_DECL(void, glUniform2iv, (GLint location, GLsizei count, const GLint *value)) -ANT_GL_CORE_DECL(void, glUniform3iv, (GLint location, GLsizei count, const GLint *value)) -ANT_GL_CORE_DECL(void, glUniform4iv, (GLint location, GLsizei count, const GLint *value)) -ANT_GL_CORE_DECL(void, glUniformMatrix2fv, (GLint location, GLsizei count, GLboolean transpose, const GLfloat *value)) -ANT_GL_CORE_DECL(void, glUniformMatrix3fv, (GLint location, GLsizei count, GLboolean transpose, const GLfloat *value)) -ANT_GL_CORE_DECL(void, glUniformMatrix4fv, (GLint location, GLsizei count, GLboolean transpose, const GLfloat *value)) -ANT_GL_CORE_DECL(void, glValidateProgram, (GLuint program)) -ANT_GL_CORE_DECL(void, glVertexAttrib1d, (GLuint index, GLdouble x)) -ANT_GL_CORE_DECL(void, glVertexAttrib1dv, (GLuint index, const GLdouble *v)) -ANT_GL_CORE_DECL(void, glVertexAttrib1f, (GLuint index, GLfloat x)) -ANT_GL_CORE_DECL(void, glVertexAttrib1fv, (GLuint index, const GLfloat *v)) -ANT_GL_CORE_DECL(void, glVertexAttrib1s, (GLuint index, GLshort x)) -ANT_GL_CORE_DECL(void, glVertexAttrib1sv, (GLuint index, const GLshort *v)) -ANT_GL_CORE_DECL(void, glVertexAttrib2d, (GLuint index, GLdouble x, GLdouble y)) -ANT_GL_CORE_DECL(void, glVertexAttrib2dv, (GLuint index, const GLdouble *v)) -ANT_GL_CORE_DECL(void, glVertexAttrib2f, (GLuint index, GLfloat x, GLfloat y)) -ANT_GL_CORE_DECL(void, glVertexAttrib2fv, (GLuint index, const GLfloat *v)) -ANT_GL_CORE_DECL(void, glVertexAttrib2s, (GLuint index, GLshort x, GLshort y)) -ANT_GL_CORE_DECL(void, glVertexAttrib2sv, (GLuint index, const GLshort *v)) -ANT_GL_CORE_DECL(void, glVertexAttrib3d, (GLuint index, GLdouble x, GLdouble y, GLdouble z)) -ANT_GL_CORE_DECL(void, glVertexAttrib3dv, (GLuint index, const GLdouble *v)) -ANT_GL_CORE_DECL(void, glVertexAttrib3f, (GLuint index, GLfloat x, GLfloat y, GLfloat z)) -ANT_GL_CORE_DECL(void, glVertexAttrib3fv, (GLuint index, const GLfloat *v)) -ANT_GL_CORE_DECL(void, glVertexAttrib3s, (GLuint index, GLshort x, GLshort y, GLshort z)) -ANT_GL_CORE_DECL(void, glVertexAttrib3sv, (GLuint index, const GLshort *v)) -ANT_GL_CORE_DECL(void, glVertexAttrib4Nbv, (GLuint index, const GLbyte *v)) -ANT_GL_CORE_DECL(void, glVertexAttrib4Niv, (GLuint index, const GLint *v)) -ANT_GL_CORE_DECL(void, glVertexAttrib4Nsv, (GLuint index, const GLshort *v)) -ANT_GL_CORE_DECL(void, glVertexAttrib4Nub, (GLuint index, GLubyte x, GLubyte y, GLubyte z, GLubyte w)) -ANT_GL_CORE_DECL(void, glVertexAttrib4Nubv, (GLuint index, const GLubyte *v)) -ANT_GL_CORE_DECL(void, glVertexAttrib4Nuiv, (GLuint index, const GLuint *v)) -ANT_GL_CORE_DECL(void, glVertexAttrib4Nusv, (GLuint index, const GLushort *v)) -ANT_GL_CORE_DECL(void, glVertexAttrib4bv, (GLuint index, const GLbyte *v)) -ANT_GL_CORE_DECL(void, glVertexAttrib4d, (GLuint index, GLdouble x, GLdouble y, GLdouble z, GLdouble w)) -ANT_GL_CORE_DECL(void, glVertexAttrib4dv, (GLuint index, const GLdouble *v)) -ANT_GL_CORE_DECL(void, glVertexAttrib4f, (GLuint index, GLfloat x, GLfloat y, GLfloat z, GLfloat w)) -ANT_GL_CORE_DECL(void, glVertexAttrib4fv, (GLuint index, const GLfloat *v)) -ANT_GL_CORE_DECL(void, glVertexAttrib4iv, (GLuint index, const GLint *v)) -ANT_GL_CORE_DECL(void, glVertexAttrib4s, (GLuint index, GLshort x, GLshort y, GLshort z, GLshort w)) -ANT_GL_CORE_DECL(void, glVertexAttrib4sv, (GLuint index, const GLshort *v)) -ANT_GL_CORE_DECL(void, glVertexAttrib4ubv, (GLuint index, const GLubyte *v)) -ANT_GL_CORE_DECL(void, glVertexAttrib4uiv, (GLuint index, const GLuint *v)) -ANT_GL_CORE_DECL(void, glVertexAttrib4usv, (GLuint index, const GLushort *v)) -ANT_GL_CORE_DECL(void, glVertexAttribPointer, (GLuint index, GLint size, GLenum type, GLboolean normalized, GLsizei stride, const GLvoid *pointer)) -/* -// GL 2.1 -ANT_GL_CORE_DECL(void, glUniformMatrix2x3fv, (GLint location, GLsizei count, GLboolean transpose, const GLfloat *value)) -ANT_GL_CORE_DECL(void, glUniformMatrix3x2fv, (GLint location, GLsizei count, GLboolean transpose, const GLfloat *value)) -ANT_GL_CORE_DECL(void, glUniformMatrix2x4fv, (GLint location, GLsizei count, GLboolean transpose, const GLfloat *value)) -ANT_GL_CORE_DECL(void, glUniformMatrix4x2fv, (GLint location, GLsizei count, GLboolean transpose, const GLfloat *value)) -ANT_GL_CORE_DECL(void, glUniformMatrix3x4fv, (GLint location, GLsizei count, GLboolean transpose, const GLfloat *value)) -ANT_GL_CORE_DECL(void, glUniformMatrix4x3fv, (GLint location, GLsizei count, GLboolean transpose, const GLfloat *value)) -// GL 3.0 -ANT_GL_CORE_DECL(void, glColorMaski, (GLuint index, GLboolean r, GLboolean g, GLboolean b, GLboolean a)) -ANT_GL_CORE_DECL(void, glGetBooleani_v, (GLenum target, GLuint index, GLboolean *data)) -ANT_GL_CORE_DECL(void, glGetIntegeri_v, (GLenum target, GLuint index, GLint *data)) -ANT_GL_CORE_DECL(void, glEnablei, (GLenum target, GLuint index)) -ANT_GL_CORE_DECL(void, glDisablei, (GLenum target, GLuint index)) -ANT_GL_CORE_DECL(GLboolean, glIsEnabledi, (GLenum target, GLuint index)) -ANT_GL_CORE_DECL(void, glBeginTransformFeedback, (GLenum primitiveMode)) -ANT_GL_CORE_DECL(void, glEndTransformFeedback, (void)) -ANT_GL_CORE_DECL(void, glBindBufferRange, (GLenum target, GLuint index, GLuint buffer, GLintptr offset, GLsizeiptr size)) -ANT_GL_CORE_DECL(void, glBindBufferBase, (GLenum target, GLuint index, GLuint buffer)) -ANT_GL_CORE_DECL(void, glTransformFeedbackVaryings, (GLuint program, GLsizei count, const GLchar* *varyings, GLenum bufferMode)) -ANT_GL_CORE_DECL(void, glGetTransformFeedbackVarying, (GLuint program, GLuint index, GLsizei bufSize, GLsizei *length, GLsizei *size, GLenum *type, GLchar *name)) -ANT_GL_CORE_DECL(void, glClampColor, (GLenum target, GLenum clamp)) -ANT_GL_CORE_DECL(void, glBeginConditionalRender, (GLuint id, GLenum mode)) -ANT_GL_CORE_DECL(void, glEndConditionalRender, (void)) -ANT_GL_CORE_DECL(void, glVertexAttribIPointer, (GLuint index, GLint size, GLenum type, GLsizei stride, const GLvoid *pointer)) -ANT_GL_CORE_DECL(void, glGetVertexAttribIiv, (GLuint index, GLenum pname, GLint *params)) -ANT_GL_CORE_DECL(void, glGetVertexAttribIuiv, (GLuint index, GLenum pname, GLuint *params)) -ANT_GL_CORE_DECL(void, glVertexAttribI1i, (GLuint index, GLint x)) -ANT_GL_CORE_DECL(void, glVertexAttribI2i, (GLuint index, GLint x, GLint y)) -ANT_GL_CORE_DECL(void, glVertexAttribI3i, (GLuint index, GLint x, GLint y, GLint z)) -ANT_GL_CORE_DECL(void, glVertexAttribI4i, (GLuint index, GLint x, GLint y, GLint z, GLint w)) -ANT_GL_CORE_DECL(void, glVertexAttribI1ui, (GLuint index, GLuint x)) -ANT_GL_CORE_DECL(void, glVertexAttribI2ui, (GLuint index, GLuint x, GLuint y)) -ANT_GL_CORE_DECL(void, glVertexAttribI3ui, (GLuint index, GLuint x, GLuint y, GLuint z)) -ANT_GL_CORE_DECL(void, glVertexAttribI4ui, (GLuint index, GLuint x, GLuint y, GLuint z, GLuint w)) -ANT_GL_CORE_DECL(void, glVertexAttribI1iv, (GLuint index, const GLint *v)) -ANT_GL_CORE_DECL(void, glVertexAttribI2iv, (GLuint index, const GLint *v)) -ANT_GL_CORE_DECL(void, glVertexAttribI3iv, (GLuint index, const GLint *v)) -ANT_GL_CORE_DECL(void, glVertexAttribI4iv, (GLuint index, const GLint *v)) -ANT_GL_CORE_DECL(void, glVertexAttribI1uiv, (GLuint index, const GLuint *v)) -ANT_GL_CORE_DECL(void, glVertexAttribI2uiv, (GLuint index, const GLuint *v)) -ANT_GL_CORE_DECL(void, glVertexAttribI3uiv, (GLuint index, const GLuint *v)) -ANT_GL_CORE_DECL(void, glVertexAttribI4uiv, (GLuint index, const GLuint *v)) -ANT_GL_CORE_DECL(void, glVertexAttribI4bv, (GLuint index, const GLbyte *v)) -ANT_GL_CORE_DECL(void, glVertexAttribI4sv, (GLuint index, const GLshort *v)) -ANT_GL_CORE_DECL(void, glVertexAttribI4ubv, (GLuint index, const GLubyte *v)) -ANT_GL_CORE_DECL(void, glVertexAttribI4usv, (GLuint index, const GLushort *v)) -ANT_GL_CORE_DECL(void, glGetUniformuiv, (GLuint program, GLint location, GLuint *params)) -ANT_GL_CORE_DECL(void, glBindFragDataLocation, (GLuint program, GLuint color, const GLchar *name)) -ANT_GL_CORE_DECL(GLint, glGetFragDataLocation, (GLuint program, const GLchar *name)) -ANT_GL_CORE_DECL(void, glUniform1ui, (GLint location, GLuint v0)) -ANT_GL_CORE_DECL(void, glUniform2ui, (GLint location, GLuint v0, GLuint v1)) -ANT_GL_CORE_DECL(void, glUniform3ui, (GLint location, GLuint v0, GLuint v1, GLuint v2)) -ANT_GL_CORE_DECL(void, glUniform4ui, (GLint location, GLuint v0, GLuint v1, GLuint v2, GLuint v3)) -ANT_GL_CORE_DECL(void, glUniform1uiv, (GLint location, GLsizei count, const GLuint *value)) -ANT_GL_CORE_DECL(void, glUniform2uiv, (GLint location, GLsizei count, const GLuint *value)) -ANT_GL_CORE_DECL(void, glUniform3uiv, (GLint location, GLsizei count, const GLuint *value)) -ANT_GL_CORE_DECL(void, glUniform4uiv, (GLint location, GLsizei count, const GLuint *value)) -ANT_GL_CORE_DECL(void, glTexParameterIiv, (GLenum target, GLenum pname, const GLint *params)) -ANT_GL_CORE_DECL(void, glTexParameterIuiv, (GLenum target, GLenum pname, const GLuint *params)) -ANT_GL_CORE_DECL(void, glGetTexParameterIiv, (GLenum target, GLenum pname, GLint *params)) -ANT_GL_CORE_DECL(void, glGetTexParameterIuiv, (GLenum target, GLenum pname, GLuint *params)) -ANT_GL_CORE_DECL(void, glClearBufferiv, (GLenum buffer, GLint drawbuffer, const GLint *value)) -ANT_GL_CORE_DECL(void, glClearBufferuiv, (GLenum buffer, GLint drawbuffer, const GLuint *value)) -ANT_GL_CORE_DECL(void, glClearBufferfv, (GLenum buffer, GLint drawbuffer, const GLfloat *value)) -ANT_GL_CORE_DECL(void, glClearBufferfi, (GLenum buffer, GLint drawbuffer, GLfloat depth, GLint stencil)) -ANT_GL_CORE_DECL(const GLubyte *, glGetStringi, (GLenum name, GLuint index)) -// GL 3.1 -ANT_GL_CORE_DECL(void, glDrawArraysInstanced, (GLenum mode, GLint first, GLsizei count, GLsizei primcount)) -ANT_GL_CORE_DECL(void, glDrawElementsInstanced, (GLenum mode, GLsizei count, GLenum type, const GLvoid *indices, GLsizei primcount)) -ANT_GL_CORE_DECL(void, glTexBuffer, (GLenum target, GLenum internalformat, GLuint buffer)) -ANT_GL_CORE_DECL(void, glPrimitiveRestartIndex, (GLuint index)) -// GL 3.2 -//typedef int64_t GLint64; -//ANT_GL_CORE_DECL(void, glGetInteger64i_v, (GLenum target, GLuint index, GLint64 *data)) -//ANT_GL_CORE_DECL(void, glGetBufferParameteri64v, (GLenum target, GLenum pname, GLint64 *params)) -ANT_GL_CORE_DECL(void, glFramebufferTexture, (GLenum target, GLenum attachment, GLuint texture, GLint level)) -*/ -// GL_ARB_vertex_array_object -ANT_GL_CORE_DECL_NO_FORWARD(void, glBindVertexArray, (GLuint array)) -ANT_GL_CORE_DECL_NO_FORWARD(void, glDeleteVertexArrays, (GLsizei n, const GLuint *arrays)) -ANT_GL_CORE_DECL_NO_FORWARD(void, glGenVertexArrays, (GLsizei n, GLuint *arrays)) -ANT_GL_CORE_DECL_NO_FORWARD(GLboolean, glIsVertexArray, (GLuint array)) - - -#ifdef ANT_WINDOWS -ANT_GL_CORE_DECL(PROC, wglGetProcAddress, (LPCSTR)) -#endif - -#ifndef GL_CLAMP_TO_EDGE -# define GL_CLAMP_TO_EDGE 0x812F -#endif -#ifndef GL_COMPILE_STATUS -# define GL_COMPILE_STATUS 0x8B81 -#endif -#ifndef GL_INFO_LOG_LENGTH -# define GL_INFO_LOG_LENGTH 0x8B84 -#endif -#ifndef GL_LINK_STATUS -# define GL_LINK_STATUS 0x8B82 -#endif -#ifndef GL_ARRAY_BUFFER -# define GL_ARRAY_BUFFER 0x8892 -#endif -#ifndef GL_DYNAMIC_DRAW -# define GL_DYNAMIC_DRAW 0x88E8 -#endif -#ifndef GL_VERTEX_SHADER -# define GL_VERTEX_SHADER 0x8B31 -#endif -#ifndef GL_FRAGMENT_SHADER -# define GL_FRAGMENT_SHADER 0x8B30 -#endif -#ifndef GL_VERTEX_ARRAY_BINDING -# define GL_VERTEX_ARRAY_BINDING 0x85B5 -#endif -#ifndef GL_CURRENT_PROGRAM -# define GL_CURRENT_PROGRAM 0x8B8D -#endif -#ifndef GL_ACTIVE_TEXTURE -# define GL_ACTIVE_TEXTURE 0x84E0 -#endif -#ifndef GL_TEXTURE0 -# define GL_TEXTURE0 0x84C0 -#endif -#ifndef GL_BGRA -# define GL_BGRA 0x80E1 -#endif - - -#endif // !defined ANT_LOAD_OGL_CORE_INCLUDED diff --git a/extern/AntTweakBar/src/MiniGLFW.h b/extern/AntTweakBar/src/MiniGLFW.h deleted file mode 100644 index 3f20a95a..00000000 --- a/extern/AntTweakBar/src/MiniGLFW.h +++ /dev/null @@ -1,109 +0,0 @@ -// --------------------------------------------------------------------------- -// -// @file MiniGLFW.h -// @brief A subset of GLFW definitions needed to compile helper functions -// implemented in TwEventGLFW.c -// -// notes: - Private header -// - AntTweakBar.dll does not need to link with GLFW, -// it just needs some definitions for its helper functions. -// - This header is provided to avoid the need of having GLFW -// installed to recompile AntTweakBar. -// - Do not use this header in your own programs, better use the -// glfw.h header from the actual GLFW library SDK : -// http://www.glfw.org -// -// --------------------------------------------------------------------------- - -#if !defined MINI_GLFW_INCLUDED -#define MINI_GLFW_INCLUDED - -#ifdef __cplusplus -extern "C" { -#endif - - -// Key and button state/action definitions -#define GLFW_RELEASE 0 -#define GLFW_PRESS 1 - -// Keyboard key definitions -#define GLFW_KEY_UNKNOWN -1 -#define GLFW_KEY_SPACE 32 -#define GLFW_KEY_SPECIAL 256 -#define GLFW_KEY_ESC (GLFW_KEY_SPECIAL+1) -#define GLFW_KEY_F1 (GLFW_KEY_SPECIAL+2) -#define GLFW_KEY_F2 (GLFW_KEY_SPECIAL+3) -#define GLFW_KEY_F3 (GLFW_KEY_SPECIAL+4) -#define GLFW_KEY_F4 (GLFW_KEY_SPECIAL+5) -#define GLFW_KEY_F5 (GLFW_KEY_SPECIAL+6) -#define GLFW_KEY_F6 (GLFW_KEY_SPECIAL+7) -#define GLFW_KEY_F7 (GLFW_KEY_SPECIAL+8) -#define GLFW_KEY_F8 (GLFW_KEY_SPECIAL+9) -#define GLFW_KEY_F9 (GLFW_KEY_SPECIAL+10) -#define GLFW_KEY_F10 (GLFW_KEY_SPECIAL+11) -#define GLFW_KEY_F11 (GLFW_KEY_SPECIAL+12) -#define GLFW_KEY_F12 (GLFW_KEY_SPECIAL+13) -#define GLFW_KEY_F13 (GLFW_KEY_SPECIAL+14) -#define GLFW_KEY_F14 (GLFW_KEY_SPECIAL+15) -#define GLFW_KEY_F15 (GLFW_KEY_SPECIAL+16) -#define GLFW_KEY_F16 (GLFW_KEY_SPECIAL+17) -#define GLFW_KEY_F17 (GLFW_KEY_SPECIAL+18) -#define GLFW_KEY_F18 (GLFW_KEY_SPECIAL+19) -#define GLFW_KEY_F19 (GLFW_KEY_SPECIAL+20) -#define GLFW_KEY_F20 (GLFW_KEY_SPECIAL+21) -#define GLFW_KEY_F21 (GLFW_KEY_SPECIAL+22) -#define GLFW_KEY_F22 (GLFW_KEY_SPECIAL+23) -#define GLFW_KEY_F23 (GLFW_KEY_SPECIAL+24) -#define GLFW_KEY_F24 (GLFW_KEY_SPECIAL+25) -#define GLFW_KEY_F25 (GLFW_KEY_SPECIAL+26) -#define GLFW_KEY_UP (GLFW_KEY_SPECIAL+27) -#define GLFW_KEY_DOWN (GLFW_KEY_SPECIAL+28) -#define GLFW_KEY_LEFT (GLFW_KEY_SPECIAL+29) -#define GLFW_KEY_RIGHT (GLFW_KEY_SPECIAL+30) -#define GLFW_KEY_LSHIFT (GLFW_KEY_SPECIAL+31) -#define GLFW_KEY_RSHIFT (GLFW_KEY_SPECIAL+32) -#define GLFW_KEY_LCTRL (GLFW_KEY_SPECIAL+33) -#define GLFW_KEY_RCTRL (GLFW_KEY_SPECIAL+34) -#define GLFW_KEY_LALT (GLFW_KEY_SPECIAL+35) -#define GLFW_KEY_RALT (GLFW_KEY_SPECIAL+36) -#define GLFW_KEY_TAB (GLFW_KEY_SPECIAL+37) -#define GLFW_KEY_ENTER (GLFW_KEY_SPECIAL+38) -#define GLFW_KEY_BACKSPACE (GLFW_KEY_SPECIAL+39) -#define GLFW_KEY_INSERT (GLFW_KEY_SPECIAL+40) -#define GLFW_KEY_DEL (GLFW_KEY_SPECIAL+41) -#define GLFW_KEY_PAGEUP (GLFW_KEY_SPECIAL+42) -#define GLFW_KEY_PAGEDOWN (GLFW_KEY_SPECIAL+43) -#define GLFW_KEY_HOME (GLFW_KEY_SPECIAL+44) -#define GLFW_KEY_END (GLFW_KEY_SPECIAL+45) -#define GLFW_KEY_KP_0 (GLFW_KEY_SPECIAL+46) -#define GLFW_KEY_KP_1 (GLFW_KEY_SPECIAL+47) -#define GLFW_KEY_KP_2 (GLFW_KEY_SPECIAL+48) -#define GLFW_KEY_KP_3 (GLFW_KEY_SPECIAL+49) -#define GLFW_KEY_KP_4 (GLFW_KEY_SPECIAL+50) -#define GLFW_KEY_KP_5 (GLFW_KEY_SPECIAL+51) -#define GLFW_KEY_KP_6 (GLFW_KEY_SPECIAL+52) -#define GLFW_KEY_KP_7 (GLFW_KEY_SPECIAL+53) -#define GLFW_KEY_KP_8 (GLFW_KEY_SPECIAL+54) -#define GLFW_KEY_KP_9 (GLFW_KEY_SPECIAL+55) -#define GLFW_KEY_KP_DIVIDE (GLFW_KEY_SPECIAL+56) -#define GLFW_KEY_KP_MULTIPLY (GLFW_KEY_SPECIAL+57) -#define GLFW_KEY_KP_SUBTRACT (GLFW_KEY_SPECIAL+58) -#define GLFW_KEY_KP_ADD (GLFW_KEY_SPECIAL+59) -#define GLFW_KEY_KP_DECIMAL (GLFW_KEY_SPECIAL+60) -#define GLFW_KEY_KP_EQUAL (GLFW_KEY_SPECIAL+61) -#define GLFW_KEY_KP_ENTER (GLFW_KEY_SPECIAL+62) -#define GLFW_KEY_LAST GLFW_KEY_KP_ENTER - -// Mouse button -#define GLFW_MOUSE_BUTTON_LEFT 0 -#define GLFW_MOUSE_BUTTON_RIGHT 1 -#define GLFW_MOUSE_BUTTON_MIDDLE 2 - - -#ifdef __cplusplus -} -#endif - -#endif // !defined MINI_GLFW_INCLUDED - diff --git a/extern/AntTweakBar/src/MiniGLUT.h b/extern/AntTweakBar/src/MiniGLUT.h deleted file mode 100644 index 12af0fdd..00000000 --- a/extern/AntTweakBar/src/MiniGLUT.h +++ /dev/null @@ -1,142 +0,0 @@ -// --------------------------------------------------------------------------- -// -// @file MiniGLUT.h -// @brief A subset of GLUT definitions needed to compile helper functions -// implemented in TwEventGLUT.c -// -// notes: - Private header -// - AntTweakBar.dll does not need to link with GLUT, -// it just needs some definitions for its helper functions. -// - This header is provided to avoid the need of having GLUT -// installed to recompile AntTweakBar. -// - Do not use this header in your own programs, better use the -// GLUT.h header from the actual GLUT library SDK : -// http://opengl.org/resources/libraries/glut -// -// --------------------------------------------------------------------------- - -#if !defined MINI_GLUT_INCLUDED -#define MINI_GLUT_INCLUDED - -#if defined(_WIN32) || defined(_WIN64) -# define WIN32_LEAN_AND_MEAN -# include // needed by gl.h -# define GLUT_CALL __stdcall -# define GLUT_CALLBACK __cdecl -# define GLUT_API __declspec(dllimport) -#else -# define GLUT_CALL -# define GLUT_CALLBACK -# define GLUT_API extern -#endif - -#if defined(_MACOSX) -# include -# include -#else -# include // must be included after windows.h -# include -#endif - -#ifdef __cplusplus -extern "C" { -#endif - - -// Mouse buttons -#define GLUT_LEFT_BUTTON 0 -#define GLUT_MIDDLE_BUTTON 1 -#define GLUT_RIGHT_BUTTON 2 - -// Mouse button state -#define GLUT_DOWN 0 -#define GLUT_UP 1 - -// glutGetModifiers return mask -#define GLUT_ACTIVE_SHIFT 1 -#define GLUT_ACTIVE_CTRL 2 -#define GLUT_ACTIVE_ALT 4 - -// function keys -#define GLUT_KEY_F1 1 -#define GLUT_KEY_F2 2 -#define GLUT_KEY_F3 3 -#define GLUT_KEY_F4 4 -#define GLUT_KEY_F5 5 -#define GLUT_KEY_F6 6 -#define GLUT_KEY_F7 7 -#define GLUT_KEY_F8 8 -#define GLUT_KEY_F9 9 -#define GLUT_KEY_F10 10 -#define GLUT_KEY_F11 11 -#define GLUT_KEY_F12 12 - -// directional keys -#define GLUT_KEY_LEFT 100 -#define GLUT_KEY_UP 101 -#define GLUT_KEY_RIGHT 102 -#define GLUT_KEY_DOWN 103 -#define GLUT_KEY_PAGE_UP 104 -#define GLUT_KEY_PAGE_DOWN 105 -#define GLUT_KEY_HOME 106 -#define GLUT_KEY_END 107 -#define GLUT_KEY_INSERT 108 - -// display mode bit masks -#define GLUT_RGB 0 -#define GLUT_RGBA GLUT_RGB -#define GLUT_INDEX 1 -#define GLUT_SINGLE 0 -#define GLUT_DOUBLE 2 -#define GLUT_ACCUM 4 -#define GLUT_ALPHA 8 -#define GLUT_DEPTH 16 -#define GLUT_STENCIL 32 - -// timer -#define GLUT_ELAPSED_TIME ((GLenum) 700) - - -// functions subset -GLUT_API void GLUT_CALL glutInit(int *argcp, char **argv); -GLUT_API void GLUT_CALL glutInitDisplayMode(unsigned int mode); -GLUT_API int GLUT_CALL glutCreateWindow(const char *title); -GLUT_API int GLUT_CALL glutGetWindow(void); -GLUT_API void GLUT_CALL glutSetWindow(int win); -GLUT_API int GLUT_CALL glutCreateSubWindow(int win, int x, int y, int width, int height); -GLUT_API int GLUT_CALL glutGet(GLenum type); -GLUT_API void GLUT_CALL glutSwapBuffers(); -GLUT_API void GLUT_CALL glutPostRedisplay(); -GLUT_API void GLUT_CALL glutInitWindowPosition(int x, int y); -GLUT_API void GLUT_CALL glutInitWindowSize(int width, int height); -GLUT_API void GLUT_CALL glutPositionWindow(int x, int y); -GLUT_API void GLUT_CALL glutReshapeWindow(int width, int height); -GLUT_API void GLUT_CALL glutMainLoop(); -GLUT_API int GLUT_CALL glutCreateMenu(void (GLUT_CALLBACK *func)(int)); -GLUT_API void GLUT_CALL glutDisplayFunc(void (GLUT_CALLBACK *func)(void)); -GLUT_API void GLUT_CALL glutReshapeFunc(void (GLUT_CALLBACK *func)(int width, int height)); -GLUT_API void GLUT_CALL glutKeyboardFunc(void (GLUT_CALLBACK *func)(unsigned char key, int x, int y)); -GLUT_API void GLUT_CALL glutMouseFunc(void (GLUT_CALLBACK *func)(int button, int state, int x, int y)); -GLUT_API void GLUT_CALL glutMotionFunc(void (GLUT_CALLBACK *func)(int x, int y)); -GLUT_API void GLUT_CALL glutPassiveMotionFunc(void (GLUT_CALLBACK *func)(int x, int y)); -GLUT_API void GLUT_CALL glutSpecialFunc(void (GLUT_CALLBACK *func)(int key, int x, int y)); -GLUT_API int GLUT_CALL glutGetModifiers(void); -GLUT_API void GLUT_CALL glutSolidTorus(GLdouble innerRadius, GLdouble outerRadius, GLint sides, GLint rings); -GLUT_API void GLUT_CALL glutSolidCone(GLdouble base, GLdouble height, GLint slices, GLint stacks); -GLUT_API void GLUT_CALL glutSolidTeapot(GLdouble size); - -// GLUT exit problem workaround (see glut.h) -#if (defined(_WIN32) || defined(_WIN64)) && !defined(GLUT_DISABLE_ATEXIT_HACK) - extern void __cdecl exit(int); - GLUT_API void GLUT_CALL __glutInitWithExit(int *argcp, char **argv, void (__cdecl *exitfunc)(int)); - static void GLUT_CALL glutInit_ATEXIT_HACK(int *argcp, char **argv) { __glutInitWithExit(argcp, argv, exit); } - #define glutInit glutInit_ATEXIT_HACK -#endif - - -#ifdef __cplusplus -} -#endif - -#endif // !defined MINI_GLUT_INCLUDED - diff --git a/extern/AntTweakBar/src/MiniSDL12.h b/extern/AntTweakBar/src/MiniSDL12.h deleted file mode 100644 index 1d8270af..00000000 --- a/extern/AntTweakBar/src/MiniSDL12.h +++ /dev/null @@ -1,339 +0,0 @@ -// --------------------------------------------------------------------------- -// -// @file MiniSDL12.h -// @brief A subset of SDL 1.2 definitions needed to compile helper -// functions implemented in TwEventSDL12.c -// -// notes: - Private header -// - AntTweakBar.dll does not need to link with SDL, -// it just needs some definitions for its helper functions. -// - This header is provided to avoid the need of having SDL -// installed to recompile AntTweakBar. -// - Do not use this header in your own programs, better use the -// SDL.h header from the actual SDL library SDK : -// http://www.libsdl.org -// -// --------------------------------------------------------------------------- - -#if !defined MINI_SDL12_INCLUDED -#define MINI_SDL12_INCLUDED - -#ifdef __cplusplus -extern "C" { -#endif - -#define SDL_MAJOR_VERSION 1 -#define SDL_MINOR_VERSION 2 - -#if defined(_WIN32) || defined(_WIN64) -# define SDL_DECLSPEC __declspec(dllimport) -# define SDL_CALL __cdecl -#else -# define SDL_DECLSPEC -# define SDL_CALL -#endif - -typedef unsigned char Uint8; -typedef signed char Sint8; -typedef unsigned short Uint16; -typedef signed short Sint16; -typedef unsigned int Uint32; -typedef signed int Sint32; - -// Subset of SDL keysym -typedef enum { - SDLK_BACKSPACE = 8, - SDLK_TAB = 9, - SDLK_CLEAR = 12, - SDLK_RETURN = 13, - SDLK_PAUSE = 19, - SDLK_ESCAPE = 27, - SDLK_DELETE = 127, - SDLK_UP = 273, - SDLK_DOWN = 274, - SDLK_RIGHT = 275, - SDLK_LEFT = 276, - SDLK_INSERT = 277, - SDLK_HOME = 278, - SDLK_END = 279, - SDLK_PAGEUP = 280, - SDLK_PAGEDOWN = 281, - SDLK_F1 = 282, - SDLK_F2 = 283, - SDLK_F3 = 284, - SDLK_F4 = 285, - SDLK_F5 = 286, - SDLK_F6 = 287, - SDLK_F7 = 288, - SDLK_F8 = 289, - SDLK_F9 = 290, - SDLK_F10 = 291, - SDLK_F11 = 292, - SDLK_F12 = 293, -} SDLKey; - -typedef enum { - KMOD_NONE = 0x0000, - KMOD_LSHIFT = 0x0001, - KMOD_RSHIFT = 0x0002, - KMOD_LCTRL = 0x0040, - KMOD_RCTRL = 0x0080, - KMOD_LALT = 0x0100, - KMOD_RALT = 0x0200, - KMOD_LMETA = 0x0400, - KMOD_RMETA = 0x0800, - KMOD_NUM = 0x1000, - KMOD_CAPS = 0x2000, - KMOD_MODE = 0x4000, - KMOD_RESERVED = 0x8000 -} SDLMod; - -#define KMOD_CTRL (KMOD_LCTRL|KMOD_RCTRL) -#define KMOD_SHIFT (KMOD_LSHIFT|KMOD_RSHIFT) -#define KMOD_ALT (KMOD_LALT|KMOD_RALT) -#define KMOD_META (KMOD_LMETA|KMOD_RMETA) - -typedef enum { - SDL_NOEVENT = 0, - SDL_ACTIVEEVENT, - SDL_KEYDOWN, - SDL_KEYUP, - SDL_MOUSEMOTION, - SDL_MOUSEBUTTONDOWN, - SDL_MOUSEBUTTONUP, - SDL_JOYAXISMOTION, - SDL_JOYBALLMOTION, - SDL_JOYHATMOTION, - SDL_JOYBUTTONDOWN, - SDL_JOYBUTTONUP, - SDL_QUIT, - SDL_SYSWMEVENT, - SDL_EVENT_RESERVEDA, - SDL_EVENT_RESERVEDB, - SDL_VIDEORESIZE, - SDL_VIDEOEXPOSE, - SDL_EVENT_RESERVED2, - SDL_EVENT_RESERVED3, - SDL_EVENT_RESERVED4, - SDL_EVENT_RESERVED5, - SDL_EVENT_RESERVED6, - SDL_EVENT_RESERVED7, - SDL_USEREVENT = 24, - SDL_NUMEVENTS = 32 -} SDLEventEnum; - -typedef struct SDL_keysym { - Uint8 scancode; - SDLKey sym; - SDLMod mod; - Uint16 unicode; -} SDL_keysym; - -typedef struct SDL_ActiveEvent { - Uint8 type; - Uint8 gain; - Uint8 state; -} SDL_ActiveEvent; - -typedef struct SDL_KeyboardEvent { - Uint8 type; - Uint8 which; - Uint8 state; - SDL_keysym keysym; -} SDL_KeyboardEvent; - -typedef struct SDL_MouseMotionEvent { - Uint8 type; - Uint8 which; - Uint8 state; - Uint16 x, y; - Sint16 xrel; - Sint16 yrel; -} SDL_MouseMotionEvent; - -typedef struct SDL_MouseButtonEvent { - Uint8 type; - Uint8 which; - Uint8 button; - Uint8 state; - Uint16 x, y; -} SDL_MouseButtonEvent; - -typedef struct SDL_JoyAxisEvent { - Uint8 type; - Uint8 which; - Uint8 axis; - Sint16 value; -} SDL_JoyAxisEvent; - -typedef struct SDL_JoyBallEvent { - Uint8 type; - Uint8 which; - Uint8 ball; - Sint16 xrel; - Sint16 yrel; -} SDL_JoyBallEvent; - -typedef struct SDL_JoyHatEvent { - Uint8 type; - Uint8 which; - Uint8 hat; - Uint8 value; -} SDL_JoyHatEvent; - -typedef struct SDL_JoyButtonEvent { - Uint8 type; - Uint8 which; - Uint8 button; - Uint8 state; -} SDL_JoyButtonEvent; - -typedef struct SDL_ResizeEvent { - Uint8 type; - int w; - int h; -} SDL_ResizeEvent; - -typedef struct SDL_ExposeEvent { - Uint8 type; -} SDL_ExposeEvent; - -typedef struct SDL_QuitEvent { - Uint8 type; -} SDL_QuitEvent; - -typedef struct SDL_UserEvent { - Uint8 type; - int code; - void *data1; - void *data2; -} SDL_UserEvent; - -struct SDL_SysWMmsg; -typedef struct SDL_SysWMmsg SDL_SysWMmsg; -typedef struct SDL_SysWMEvent { - Uint8 type; - SDL_SysWMmsg *msg; -} SDL_SysWMEvent; - -typedef union { - Uint8 type; - SDL_ActiveEvent active; - SDL_KeyboardEvent key; - SDL_MouseMotionEvent motion; - SDL_MouseButtonEvent button; - SDL_JoyAxisEvent jaxis; - SDL_JoyBallEvent jball; - SDL_JoyHatEvent jhat; - SDL_JoyButtonEvent jbutton; - SDL_ResizeEvent resize; - SDL_ExposeEvent expose; - SDL_QuitEvent quit; - SDL_UserEvent user; - SDL_SysWMEvent syswm; -char full[56]; -} SDL_Event; - -typedef struct SDL_PixelFormat { - void *palette; - Uint8 BitsPerPixel; - Uint8 BytesPerPixel; - Uint8 Rloss; - Uint8 Gloss; - Uint8 Bloss; - Uint8 Aloss; - Uint8 Rshift; - Uint8 Gshift; - Uint8 Bshift; - Uint8 Ashift; - Uint32 Rmask; - Uint32 Gmask; - Uint32 Bmask; - Uint32 Amask; - Uint32 colorkey; - Uint8 alpha; -} SDL_PixelFormat; - -typedef enum { - SDL_GL_RED_SIZE, - SDL_GL_GREEN_SIZE, - SDL_GL_BLUE_SIZE, - SDL_GL_ALPHA_SIZE, - SDL_GL_BUFFER_SIZE, - SDL_GL_DOUBLEBUFFER, - SDL_GL_DEPTH_SIZE, - SDL_GL_STENCIL_SIZE, - SDL_GL_ACCUM_RED_SIZE, - SDL_GL_ACCUM_GREEN_SIZE, - SDL_GL_ACCUM_BLUE_SIZE, - SDL_GL_ACCUM_ALPHA_SIZE, - SDL_GL_STEREO, - SDL_GL_MULTISAMPLEBUFFERS, - SDL_GL_MULTISAMPLESAMPLES, - SDL_GL_ACCELERATED_VISUAL, - SDL_GL_RETAINED_BACKING, - SDL_GL_CONTEXT_MAJOR_VERSION, - SDL_GL_CONTEXT_MINOR_VERSION -} SDL_GLattr; - -typedef struct SDL_VideoInfo { - Uint32 hw_available :1; - Uint32 wm_available :1; - Uint32 UnusedBits1 :6; - Uint32 UnusedBits2 :1; - Uint32 blit_hw :1; - Uint32 blit_hw_CC :1; - Uint32 blit_hw_A :1; - Uint32 blit_sw :1; - Uint32 blit_sw_CC :1; - Uint32 blit_sw_A :1; - Uint32 blit_fill :1; - Uint32 UnusedBits3 :16; - Uint32 video_mem; - SDL_PixelFormat *vfmt; - int current_w; - int current_h; -} SDL_VideoInfo; - -#define SDL_INIT_VIDEO 0x00000020 - -#define SDL_SWSURFACE 0x00000000 -#define SDL_HWSURFACE 0x00000001 -#define SDL_ASYNCBLIT 0x00000004 -#define SDL_ANYFORMAT 0x10000000 -#define SDL_HWPALETTE 0x20000000 -#define SDL_DOUBLEBUF 0x40000000 -#define SDL_FULLSCREEN 0x80000000 -#define SDL_OPENGL 0x00000002 -#define SDL_OPENGLBLIT 0x0000000A -#define SDL_RESIZABLE 0x00000010 -#define SDL_NOFRAME 0x00000020 - -#define SDL_DEFAULT_REPEAT_DELAY 500 -#define SDL_DEFAULT_REPEAT_INTERVAL 30 - - -// functions subset -extern SDL_DECLSPEC int SDL_CALL SDL_Init(Uint32 flags); -extern SDL_DECLSPEC void SDL_CALL SDL_Quit(); -extern SDL_DECLSPEC char * SDL_CALL SDL_GetError(); -extern SDL_DECLSPEC const SDL_VideoInfo * SDL_CALL SDL_GetVideoInfo(); -extern SDL_DECLSPEC struct SDL_Surface * SDL_CALL SDL_SetVideoMode(int width, int height, int bpp, Uint32 flags); -extern SDL_DECLSPEC int SDL_CALL SDL_GL_SetAttribute(SDL_GLattr attr, int value); -extern SDL_DECLSPEC void SDL_CALL SDL_GL_SwapBuffers(); -extern SDL_DECLSPEC void SDL_CALL SDL_WM_SetCaption(const char *title, const char *icon); -extern SDL_DECLSPEC void SDL_CALL SDL_WM_GetCaption(char **title, char **icon); -extern SDL_DECLSPEC int SDL_CALL SDL_EnableUNICODE(int enable); -extern SDL_DECLSPEC int SDL_CALL SDL_EnableKeyRepeat(int delay, int interval); -extern SDL_DECLSPEC Uint32 SDL_CALL SDL_GetTicks(); -extern SDL_DECLSPEC int SDL_CALL SDL_PollEvent(SDL_Event *event); -extern SDL_DECLSPEC int SDL_CALL SDL_WaitEvent(SDL_Event *event); -extern SDL_DECLSPEC int SDL_CALL SDL_PushEvent(SDL_Event *event); - - -#ifdef __cplusplus -} -#endif - -#endif // !defined MINI_SDL12_INCLUDED - diff --git a/extern/AntTweakBar/src/MiniSDL13.h b/extern/AntTweakBar/src/MiniSDL13.h deleted file mode 100644 index fa782133..00000000 --- a/extern/AntTweakBar/src/MiniSDL13.h +++ /dev/null @@ -1,428 +0,0 @@ -// --------------------------------------------------------------------------- -// -// @file MiniSDL13.h -// @brief A subset of SDL 1.3 definitions needed to compile helper -// functions implemented in TwEventSDL13.c -// -// notes: - Private header -// - AntTweakBar.dll does not need to link with SDL, -// it just needs some definitions for its helper functions. -// - This header is provided to avoid the need of having SDL -// installed to recompile AntTweakBar. -// - Do not use this header in your own programs, better use the -// SDL.h header from the actual SDL library SDK : -// http://www.libsdl.org -// -// --------------------------------------------------------------------------- - -#if !defined MINI_SDL_INCLUDED -#define MINI_SDL_INCLUDED - -#ifdef __cplusplus -extern "C" { -#endif - -#define SDL_MAJOR_VERSION 1 -#define SDL_MINOR_VERSION 3 - -#if defined(_WIN32) || defined(_WIN64) -# define SDL_DECLSPEC __declspec(dllimport) -# define SDL_CALL __cdecl -#else -# define SDL_DECLSPEC -# define SDL_CALL -#endif - -typedef unsigned char Uint8; -typedef signed char Sint8; -typedef unsigned short Uint16; -typedef signed short Sint16; -typedef unsigned int Uint32; -typedef signed int Sint32; - -#define SDLK_SCANCODE_MASK (1<<30) -#define SDL_SCANCODE_TO_KEYCODE(X) (X | SDLK_SCANCODE_MASK) - -// Subset of SDL scancodes. -// Note: some SDL scancodes seems to be wrong in the original -// SDL scancode header file. -typedef enum { - SDL_SCANCODE_F1 = 58, - SDL_SCANCODE_F2 = 59, - SDL_SCANCODE_F3 = 60, - SDL_SCANCODE_F4 = 61, - SDL_SCANCODE_F5 = 62, - SDL_SCANCODE_F6 = 63, - SDL_SCANCODE_F7 = 64, - SDL_SCANCODE_F8 = 65, - SDL_SCANCODE_F9 = 66, - SDL_SCANCODE_F10 = 67, - SDL_SCANCODE_F11 = 68, - SDL_SCANCODE_F12 = 69, - SDL_SCANCODE_INSERT = 98, //73, - SDL_SCANCODE_HOME = 95, //74, - SDL_SCANCODE_PAGEUP = 97, //75, - SDL_SCANCODE_DELETE = 99, //76, - SDL_SCANCODE_END = 89, //77, - SDL_SCANCODE_PAGEDOWN = 91, //78, - SDL_SCANCODE_RIGHT = 94, //79, - SDL_SCANCODE_LEFT = 92, //80, - SDL_SCANCODE_DOWN = 90, //81, - SDL_SCANCODE_UP = 96 //82 -} SDL_scancode; - -// Subset of SDL keysym -typedef enum { - SDLK_BACKSPACE = 8, - SDLK_TAB = 9, - SDLK_CLEAR = 12, - SDLK_RETURN = 13, - SDLK_PAUSE = 19, - SDLK_ESCAPE = 27, - SDLK_DELETE = 127, - SDLK_UP = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_UP), - SDLK_DOWN = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_DOWN), - SDLK_RIGHT = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_RIGHT), - SDLK_LEFT = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_LEFT), - SDLK_INSERT = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_INSERT), - SDLK_HOME = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_HOME), - SDLK_END = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_END), - SDLK_PAGEUP = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_PAGEUP), - SDLK_PAGEDOWN = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_PAGEDOWN), - SDLK_F1 = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_F1), - SDLK_F2 = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_F2), - SDLK_F3 = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_F3), - SDLK_F4 = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_F4), - SDLK_F5 = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_F5), - SDLK_F6 = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_F6), - SDLK_F7 = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_F7), - SDLK_F8 = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_F8), - SDLK_F9 = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_F9), - SDLK_F10 = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_F10), - SDLK_F11 = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_F11), - SDLK_F12 = SDL_SCANCODE_TO_KEYCODE(SDL_SCANCODE_F12) -} SDLKey; - -typedef enum { - KMOD_NONE = 0x0000, - KMOD_LSHIFT = 0x0001, - KMOD_RSHIFT = 0x0002, - KMOD_LCTRL = 0x0040, - KMOD_RCTRL = 0x0080, - KMOD_LALT = 0x0100, - KMOD_RALT = 0x0200, - KMOD_LGUI = 0x0400, - KMOD_RGUI = 0x0800, - KMOD_NUM = 0x1000, - KMOD_CAPS = 0x2000, - KMOD_MODE = 0x4000, - KMOD_RESERVED = 0x8000 -} SDLMod; - -#define KMOD_CTRL (KMOD_LCTRL|KMOD_RCTRL) -#define KMOD_SHIFT (KMOD_LSHIFT|KMOD_RSHIFT) -#define KMOD_ALT (KMOD_LALT|KMOD_RALT) -#define KMOD_GUI (KMOD_LGUI|KMOD_RGUI) - -typedef enum { - SDL_NOEVENT = 0, - SDL_WINDOWEVENT, - SDL_KEYDOWN, - SDL_KEYUP, - SDL_TEXTEDITING, - SDL_TEXTINPUT, - SDL_MOUSEMOTION, - SDL_MOUSEBUTTONDOWN, - SDL_MOUSEBUTTONUP, - SDL_MOUSEWHEEL, - SDL_JOYAXISMOTION, - SDL_JOYBALLMOTION, - SDL_JOYHATMOTION, - SDL_JOYBUTTONDOWN, - SDL_JOYBUTTONUP, - SDL_QUIT, - SDL_SYSWMEVENT, - SDL_PROXIMITYIN, - SDL_PROXIMITYOUT, - SDL_EVENT_RESERVED1, - SDL_EVENT_RESERVED2, - SDL_EVENT_RESERVED3, - SDL_USEREVENT = 24, - SDL_NUMEVENTS = 32 -} SDL_EventType; - -#define SDL_ACTIVEEVENT SDL_EVENT_RESERVED1 -#define SDL_VIDEORESIZE SDL_EVENT_RESERVED2 -#define SDL_VIDEOEXPOSE SDL_EVENT_RESERVED3 - -typedef Uint32 SDL_WindowID; - -typedef struct SDL_keysym { - SDL_scancode scancode; - SDLKey sym; - Uint16 mod; - Uint32 unicode; -} SDL_keysym; - -typedef struct SDL_WindowEvent { - Uint8 type; - SDL_WindowID windowID; - Uint8 event; - int data1; - int data2; -} SDL_WindowEvent; - -typedef struct SDL_KeyboardEvent { - Uint8 type; - SDL_WindowID windowID; - Uint8 which; - Uint8 state; - SDL_keysym keysym; -} SDL_KeyboardEvent; - -#define SDL_TEXTEDITINGEVENT_TEXT_SIZE (32) -typedef struct SDL_TextEditingEvent { - Uint8 type; - char text[SDL_TEXTEDITINGEVENT_TEXT_SIZE]; - int start; - int length; -} SDL_TextEditingEvent; - -#define SDL_TEXTINPUTEVENT_TEXT_SIZE (32) -typedef struct SDL_TextInputEvent { - Uint8 type; - SDL_WindowID windowID; - Uint8 which; - char text[SDL_TEXTINPUTEVENT_TEXT_SIZE]; -} SDL_TextInputEvent; - -typedef struct SDL_MouseMotionEvent { - Uint8 type; - SDL_WindowID windowID; - Uint8 which; - Uint8 state; - int x; - int y; - int z; - int pressure; - int pressure_max; - int pressure_min; - int rotation; - int tilt; - int cursor; - int xrel; - int yrel; -} SDL_MouseMotionEvent; - -typedef struct SDL_MouseButtonEvent { - Uint8 type; - SDL_WindowID windowID; - Uint8 which; - Uint8 button; - Uint8 state; - int x; - int y; -} SDL_MouseButtonEvent; - -typedef struct SDL_MouseWheelEvent { - Uint8 type; - SDL_WindowID windowID; - Uint8 which; - int x; - int y; -} SDL_MouseWheelEvent; - -typedef struct SDL_JoyAxisEvent { - Uint8 type; - Uint8 which; - Uint8 axis; - Sint16 value; -} SDL_JoyAxisEvent; - -typedef struct SDL_JoyBallEvent { - Uint8 type; - Uint8 which; - Uint8 ball; - Sint16 xrel; - Sint16 yrel; -} SDL_JoyBallEvent; - -typedef struct SDL_JoyHatEvent { - Uint8 type; - Uint8 which; - Uint8 hat; - Uint8 value; -} SDL_JoyHatEvent; - -typedef struct SDL_JoyButtonEvent { - Uint8 type; - Uint8 which; - Uint8 button; - Uint8 state; -} SDL_JoyButtonEvent; - -typedef struct SDL_ActiveEvent -{ - Uint8 type; - Uint8 gain; - Uint8 state; -} SDL_ActiveEvent; - -typedef struct SDL_ResizeEvent { - Uint8 type; - int w; - int h; -} SDL_ResizeEvent; - -typedef struct SDL_ExposeEvent { - Uint8 type; -} SDL_ExposeEvent; - -typedef struct SDL_QuitEvent { - Uint8 type; -} SDL_QuitEvent; - -typedef struct SDL_UserEvent { - Uint8 type; - SDL_WindowID windowID; - int code; - void *data1; - void *data2; -} SDL_UserEvent; - -struct SDL_SysWMmsg; -typedef struct SDL_SysWMmsg SDL_SysWMmsg; -typedef struct SDL_SysWMEvent { - Uint8 type; - SDL_SysWMmsg *msg; -} SDL_SysWMEvent; - -typedef struct SDL_ProximityEvent -{ - Uint8 type; - SDL_WindowID windowID; - Uint8 which; - int cursor; - int x; - int y; -} SDL_ProximityEvent; - -typedef union SDL_Event { - Uint8 type; - SDL_WindowEvent window; - SDL_KeyboardEvent key; - SDL_TextEditingEvent edit; - SDL_TextInputEvent text; - SDL_MouseMotionEvent motion; - SDL_MouseButtonEvent button; - SDL_MouseWheelEvent wheel; - SDL_JoyAxisEvent jaxis; - SDL_JoyBallEvent jball; - SDL_JoyHatEvent jhat; - SDL_JoyButtonEvent jbutton; - SDL_QuitEvent quit; - SDL_UserEvent user; - SDL_SysWMEvent syswm; - SDL_ProximityEvent proximity; - SDL_ActiveEvent active; - SDL_ResizeEvent resize; -} SDL_Event; - -typedef struct SDL_PixelFormat { - void *palette; - Uint8 BitsPerPixel; - Uint8 BytesPerPixel; - Uint8 Rloss; - Uint8 Gloss; - Uint8 Bloss; - Uint8 Aloss; - Uint8 Rshift; - Uint8 Gshift; - Uint8 Bshift; - Uint8 Ashift; - Uint32 Rmask; - Uint32 Gmask; - Uint32 Bmask; - Uint32 Amask; -} SDL_PixelFormat; - -typedef enum SDL_GLattr { - SDL_GL_RED_SIZE, - SDL_GL_GREEN_SIZE, - SDL_GL_BLUE_SIZE, - SDL_GL_ALPHA_SIZE, - SDL_GL_BUFFER_SIZE, - SDL_GL_DOUBLEBUFFER, - SDL_GL_DEPTH_SIZE, - SDL_GL_STENCIL_SIZE, - SDL_GL_ACCUM_RED_SIZE, - SDL_GL_ACCUM_GREEN_SIZE, - SDL_GL_ACCUM_BLUE_SIZE, - SDL_GL_ACCUM_ALPHA_SIZE, - SDL_GL_STEREO, - SDL_GL_MULTISAMPLEBUFFERS, - SDL_GL_MULTISAMPLESAMPLES, - SDL_GL_ACCELERATED_VISUAL, - SDL_GL_RETAINED_BACKING, - SDL_GL_CONTEXT_MAJOR_VERSION, - SDL_GL_CONTEXT_MINOR_VERSION -} SDL_GLattr; - -typedef struct SDL_VideoInfo { - Uint32 hw_available :1; - Uint32 wm_available :1; - Uint32 UnusedBits1 :6; - Uint32 UnusedBits2 :1; - Uint32 blit_hw :1; - Uint32 blit_hw_CC :1; - Uint32 blit_hw_A :1; - Uint32 blit_sw :1; - Uint32 blit_sw_CC :1; - Uint32 blit_sw_A :1; - Uint32 blit_fill :1; - Uint32 UnusedBits3 :16; - Uint32 video_mem; - SDL_PixelFormat *vfmt; - int current_w; - int current_h; -} SDL_VideoInfo; - -#define SDL_INIT_VIDEO 0x00000020 - -#define SDL_ANYFORMAT 0x00100000 -#define SDL_HWPALETTE 0x00200000 -#define SDL_DOUBLEBUF 0x00400000 -#define SDL_FULLSCREEN 0x00800000 -#define SDL_RESIZABLE 0x01000000 -#define SDL_NOFRAME 0x02000000 -#define SDL_OPENGL 0x04000000 -#define SDL_HWSURFACE 0x08000001 - -#define SDL_DEFAULT_REPEAT_DELAY 500 -#define SDL_DEFAULT_REPEAT_INTERVAL 30 - - -// functions subset -extern SDL_DECLSPEC int SDL_CALL SDL_Init(Uint32 flags); -extern SDL_DECLSPEC void SDL_CALL SDL_Quit(); -extern SDL_DECLSPEC char * SDL_CALL SDL_GetError(); -extern SDL_DECLSPEC const SDL_VideoInfo * SDL_CALL SDL_GetVideoInfo(); -extern SDL_DECLSPEC struct SDL_Surface * SDL_CALL SDL_SetVideoMode(int width, int height, int bpp, Uint32 flags); -extern SDL_DECLSPEC int SDL_CALL SDL_GL_SetAttribute(SDL_GLattr attr, int value); -extern SDL_DECLSPEC void SDL_CALL SDL_GL_SwapBuffers(); -extern SDL_DECLSPEC void SDL_CALL SDL_WM_SetCaption(const char *title, const char *icon); -extern SDL_DECLSPEC void SDL_CALL SDL_WM_GetCaption(char **title, char **icon); -extern SDL_DECLSPEC int SDL_CALL SDL_EnableUNICODE(int enable); -extern SDL_DECLSPEC int SDL_CALL SDL_EnableKeyRepeat(int delay, int interval); -extern SDL_DECLSPEC Uint32 SDL_CALL SDL_GetTicks(); -extern SDL_DECLSPEC int SDL_CALL SDL_PollEvent(SDL_Event *event); -extern SDL_DECLSPEC int SDL_CALL SDL_WaitEvent(SDL_Event *event); -extern SDL_DECLSPEC int SDL_CALL SDL_PushEvent(SDL_Event *event); - - -#ifdef __cplusplus -} -#endif - -#endif // !defined MINI_SDL_INCLUDED - diff --git a/extern/AntTweakBar/src/MiniSFML16.h b/extern/AntTweakBar/src/MiniSFML16.h deleted file mode 100644 index e254c01b..00000000 --- a/extern/AntTweakBar/src/MiniSFML16.h +++ /dev/null @@ -1,220 +0,0 @@ -// --------------------------------------------------------------------------- -// -// @file MiniSFML16.h -// @brief A subset of SFML 1.6 definitions needed to compile helper -// functions implemented in TwEventSFML.cpp -// -// notes: - Private header -// - AntTweakBar.dll does not need to link with SFML, -// it just needs some definitions for its helper functions. -// - This header is provided to avoid the need of having SFML -// installed to recompile AntTweakBar. -// It declares a small and incomplete part of SFML classes. -// For instance, many non-virtual methods have been stripped out. -// - Do not use this header in your own programs, better use the -// SFML headers from the actual SFML library SDK : -// http://www.sfml-dev.org -// -// --------------------------------------------------------------------------- - -#if !defined MINI_SFML16_INCLUDED -#define MINI_SFML16_INCLUDED - -namespace sf -{ - - namespace Key { enum Code - { - A = 'a', B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R, S, T, U, V, W, X, Y, Z, - Num0 = '0', Num1, Num2, Num3, Num4, Num5, Num6, Num7, Num8, Num9, - Escape = 256, - LControl, LShift, LAlt, LSystem, - RControl, RShift, RAlt, RSystem, Menu, - LBracket, RBracket, SemiColon, Comma, Period, Quote, Slash, BackSlash, - Tilde, Equal, Dash, Space, Return, Back, Tab, - PageUp, PageDown, End, Home, Insert, Delete, - Add, Subtract, Multiply, Divide, Left, Right, Up, Down, - Numpad0, Numpad1, Numpad2, Numpad3, Numpad4, Numpad5, Numpad6, Numpad7, Numpad8, Numpad9, - F1, F2, F3, F4, F5, F6, F7, F8, F9, F10, F11, F12, F13, F14, F15, Pause, - Count - }; } - - namespace Mouse { enum Button { Left, Right, Middle, XButton1, XButton2, Count }; } - - namespace Joy { enum Axis { AxisX, AxisY, AxisZ, AxisR, AxisU, AxisV, AxisPOV, AxisCount }; - enum { Count = 4, ButtonCount = 32}; } - - typedef unsigned char Uint8; - typedef unsigned int Uint32; - - class Event - { - public : - struct KeyEvent { Key::Code Code; bool Alt, Control, Shift; }; - struct TextEvent { Uint32 Unicode; }; - struct MouseMoveEvent { int X, Y; }; - struct MouseButtonEvent { Mouse::Button Button; int X, Y; }; - struct MouseWheelEvent { int Delta; }; - struct JoyMoveEvent { unsigned int JoystickId; Joy::Axis Axis; float Position; }; - struct JoyButtonEvent { unsigned int JoystickId, Button; }; - struct SizeEvent { unsigned int Width, Height; }; - enum EventType - { - Closed, Resized, LostFocus, GainedFocus, TextEntered, KeyPressed, KeyReleased, - MouseWheelMoved, MouseButtonPressed, MouseButtonReleased, MouseMoved, MouseEntered, MouseLeft, - JoyButtonPressed, JoyButtonReleased, JoyMoved - }; - EventType Type; - union - { - KeyEvent Key; - TextEvent Text; - MouseMoveEvent MouseMove; - MouseButtonEvent MouseButton; - MouseWheelEvent MouseWheel; - JoyMoveEvent JoyMove; - JoyButtonEvent JoyButton; - SizeEvent Size; - }; - }; - -} // namespace sf - - -#ifdef USE_MINI_SFML -// we also need some the definition of sf::RenderWindow to compile our SFML example - -#include -#include - -namespace sf -{ - - class Input; - class Drawable; - typedef void* WindowHandle; - namespace priv { class WindowImpl; } - - class WindowListener - { - public : - virtual void OnEvent(const Event& EventReceived) = 0; - protected : - virtual ~WindowListener(); - }; - - class VideoMode - { - public : - VideoMode(unsigned int ModeWidth, unsigned int ModeHeight, unsigned int ModeBpp = 32); - unsigned int Width, Height, BitsPerPixel; - }; - - namespace Style { enum { None = 0, Titlebar = 1 << 0, Resize = 1 << 1, Close = 1 << 2, Fullscreen = 1 << 3 }; } - - struct WindowSettings - { - explicit WindowSettings(unsigned int Depth = 24, unsigned int Stencil = 8, unsigned int Antialiasing = 0); - unsigned int DepthBits, StencilBits, AntialiasingLevel; - }; - - class Clock - { - public : - Clock(); - float GetElapsedTime() const; - void Reset(); - private : - double myStartTime; - }; - - class Input : public WindowListener - { - private : - virtual void OnEvent(const Event& EventReceived); - bool myKeys[Key::Count]; - bool myMouseButtons[Mouse::Count]; - int myMouseX; - int myMouseY; - bool myJoystickButtons[Joy::Count][Joy::ButtonCount]; - float myJoystickAxis[Joy::Count][Joy::AxisCount]; - }; - - class Window : public WindowListener - { - public : - Window(VideoMode Mode, const std::string& Title, unsigned long WindowStyle = Style::Resize | Style::Close, const WindowSettings& Params = WindowSettings()); - virtual ~Window(); - void Close(); - bool IsOpened() const; - unsigned int GetWidth() const; - unsigned int GetHeight() const; - bool GetEvent(Event& EventReceived); - void Display(); - private : - virtual void OnCreate(); - virtual void OnEvent(const Event& EventReceived); - priv::WindowImpl* myWindow; - std::queue myEvents; - Input myInput; - Clock myClock; - WindowSettings mySettings; - float myLastFrameTime; - bool myIsExternal; - unsigned int myFramerateLimit; - int mySetCursorPosX; - int mySetCursorPosY; - }; - - template class Vector2 { public : T x, y; }; - typedef Vector2 Vector2f; - - template class Rect { public : T Left, Top, Right, Bottom; }; - typedef Rect FloatRect; - - class Matrix3 { private : float myData[16]; }; - - class View - { - private : - sf::Vector2f myCenter; - sf::Vector2f myHalfSize; - FloatRect myRect; - Matrix3 myMatrix; - bool myNeedUpdate; - }; - - class RenderTarget - { - public : - virtual ~RenderTarget(); - virtual void Draw(const Drawable& Object); - virtual unsigned int GetWidth() const = 0; - virtual unsigned int GetHeight() const = 0; - void PreserveOpenGLStates(bool Preserve); - private : - virtual bool Activate(bool Active) = 0; - View myDefaultView; - const View* myCurrentView; - bool myPreserveStates; - bool myIsDrawing; - }; - - class RenderWindow : public Window, public RenderTarget - { - public : - RenderWindow(VideoMode Mode, const std::string& Title, unsigned long WindowStyle = Style::Resize | Style::Close, const WindowSettings& Params = WindowSettings()); - virtual ~RenderWindow(); - virtual unsigned int GetWidth() const; - virtual unsigned int GetHeight() const; - private : - virtual void OnCreate(); - virtual bool Activate(bool Active); - }; - -} // namespace sf - -#endif // USE_MINI_SFML - -#endif // !defined MINI_SFML16_INCLUDED - diff --git a/extern/AntTweakBar/src/TwBar.cpp b/extern/AntTweakBar/src/TwBar.cpp deleted file mode 100644 index 01b80548..00000000 --- a/extern/AntTweakBar/src/TwBar.cpp +++ /dev/null @@ -1,7771 +0,0 @@ -// --------------------------------------------------------------------------- -// -// @file TwBar.cpp -// @author Philippe Decaudin -// @license This file is part of the AntTweakBar library. -// For conditions of distribution and use, see License.txt -// -// --------------------------------------------------------------------------- - - -#include "TwPrecomp.h" -#include -#include "TwMgr.h" -#include "TwBar.h" -#include "TwColors.h" - -using namespace std; - -extern const char *g_ErrNotFound; -const char *g_ErrUnknownAttrib = "Unknown parameter"; -const char *g_ErrInvalidAttrib = "Invalid parameter"; -const char *g_ErrNotGroup = "Value is not a group"; -const char *g_ErrNoValue = "Value required"; -const char *g_ErrBadValue = "Bad value"; -const char *g_ErrUnknownType = "Unknown type"; -const char *g_ErrNotEnum = "Must be of type Enum"; - -#undef PERF // comment to print benchs -#define PERF(cmd) - - -PerfTimer g_BarTimer; - -#define ANT_SET_CURSOR(_Name) g_TwMgr->SetCursor(g_TwMgr->m_Cursor##_Name) -#define ANT_SET_ROTO_CURSOR(_Num) g_TwMgr->SetCursor(g_TwMgr->m_RotoCursors[_Num]) - -#if !defined(ANT_WINDOWS) -# define _stricmp strcasecmp -# define _strdup strdup -#endif // defined(ANT_WINDOWS) - -#if !defined(M_PI) -# define M_PI 3.1415926535897932384626433832795 -#endif // !defined(M_PI) - -const float FLOAT_MAX = 3.0e+38f; -const double DOUBLE_MAX = 1.0e+308; -const double DOUBLE_EPS = 1.0e-307; - -bool IsCustomType(int _Type) -{ - return (g_TwMgr && _Type>=TW_TYPE_CUSTOM_BASE && _Typem_Customs.size()); -} - -bool IsCSStringType(int _Type) -{ - return (_Type>TW_TYPE_CSSTRING_BASE && _Type<=TW_TYPE_CSSTRING_MAX); -} - -bool IsEnumType(int _Type) -{ - return (g_TwMgr && _Type>=TW_TYPE_ENUM_BASE && _Typem_Enums.size()); -} - -// --------------------------------------------------------------------------- - -CTwVar::CTwVar() -{ - m_IsRoot = false; - m_DontClip = false; - m_Visible = true; - m_LeftMargin = 0; - m_TopMargin = 0; - m_ColorPtr = &COLOR32_WHITE; - m_BgColorPtr = &COLOR32_ZERO; // default -} - -CTwVarAtom::CTwVarAtom() -{ - m_Type = TW_TYPE_UNDEF; - m_Ptr = NULL; - m_SetCallback = NULL; - m_GetCallback = NULL; - m_ClientData = NULL; - m_ReadOnly = false; - m_NoSlider = false; - m_KeyIncr[0] = 0; - m_KeyIncr[1] = 0; - m_KeyDecr[0] = 0; - m_KeyDecr[1] = 0; - memset(&m_Val, 0, sizeof(UVal)); -} - -CTwVarAtom::~CTwVarAtom() -{ - if( m_Type==TW_TYPE_BOOL8 || m_Type==TW_TYPE_BOOL16 || m_Type==TW_TYPE_BOOL32 || m_Type==TW_TYPE_BOOLCPP ) - { - if( m_Val.m_Bool.m_FreeTrueString && m_Val.m_Bool.m_TrueString!=NULL ) - { - free(m_Val.m_Bool.m_TrueString); - m_Val.m_Bool.m_TrueString = NULL; - } - if( m_Val.m_Bool.m_FreeFalseString && m_Val.m_Bool.m_FalseString!=NULL ) - { - free(m_Val.m_Bool.m_FalseString); - m_Val.m_Bool.m_FalseString = NULL; - } - } - else if( m_Type==TW_TYPE_CDSTDSTRING && m_GetCallback==CTwMgr::CCDStdString::GetCB && m_ClientData!=NULL && g_TwMgr!=NULL ) - { - // delete corresponding g_TwMgr->m_CDStdStrings element - const CTwMgr::CCDStdString *CDStdString = (const CTwMgr::CCDStdString *)m_ClientData; - //if( &(*CDStdString->m_This)==CDStdString ) - // g_TwMgr->m_CDStdStrings.erase(CDStdString->m_This); - for( list::iterator it=g_TwMgr->m_CDStdStrings.begin(); it!=g_TwMgr->m_CDStdStrings.end(); ++it ) - if( &(*it)==CDStdString ) - { - g_TwMgr->m_CDStdStrings.erase(it); - break; - } - } - /* - else if( m_Type==TW_TYPE_ENUM8 || m_Type==TW_TYPE_ENUM16 || m_Type==TW_TYPE_ENUM32 ) - { - if( m_Val.m_Enum.m_Entries!=NULL ) - { - delete m_Val.m_Enum.m_Entries; - m_Val.m_Enum.m_Entries = NULL; - } - } - */ -} - -// --------------------------------------------------------------------------- - -void CTwVarAtom::ValueToString(string *_Str) const -{ - assert(_Str!=NULL); - static const char *ErrStr = "unreachable"; - char Tmp[1024]; - if( m_Type==TW_TYPE_UNDEF || m_Type==TW_TYPE_HELP_ATOM || m_Type==TW_TYPE_HELP_GRP || m_Type==TW_TYPE_BUTTON ) // has no value - { - *_Str = ""; - return; - } - else if( m_Type==TW_TYPE_HELP_HEADER ) - { - *_Str = "SHORTCUTS"; - return; - } - else if( m_Type==TW_TYPE_SHORTCUT ) // special case for help bar: display shortcut - { - *_Str = ""; - if( m_ReadOnly && m_Val.m_Shortcut.m_Incr[0]==0 && m_Val.m_Shortcut.m_Decr[0]==0 ) - (*_Str) = "(read only)"; - else - { - if( m_Val.m_Shortcut.m_Incr[0]>0 ) - TwGetKeyString(_Str, m_Val.m_Shortcut.m_Incr[0], m_Val.m_Shortcut.m_Incr[1]); - else - (*_Str) += "(none)"; - if( m_Val.m_Shortcut.m_Decr[0]>0 ) - { - (*_Str) += " "; - TwGetKeyString(_Str, m_Val.m_Shortcut.m_Decr[0], m_Val.m_Shortcut.m_Decr[1]); - } - } - return; - } - else if( m_Type==TW_TYPE_HELP_STRUCT ) - { - int idx = m_Val.m_HelpStruct.m_StructType - TW_TYPE_STRUCT_BASE; - if( idx>=0 && idx<(int)g_TwMgr->m_Structs.size() ) - { - if( g_TwMgr->m_Structs[idx].m_Name.length()>0 ) - (*_Str) = '{' + g_TwMgr->m_Structs[idx].m_Name + '}'; - else - (*_Str) = "{struct}"; - } - return; - } - - if( m_Ptr==NULL && m_GetCallback==NULL ) - { - *_Str = ErrStr; - return; - } - bool UseGet = (m_GetCallback!=NULL); - switch( m_Type ) - { - case TW_TYPE_BOOLCPP: - { - bool Val = 0; - if( UseGet ) - m_GetCallback(&Val, m_ClientData); - else - Val = *(bool *)m_Ptr; - if( Val ) - *_Str = (m_Val.m_Bool.m_TrueString!=NULL) ? m_Val.m_Bool.m_TrueString : "1"; - else - *_Str = (m_Val.m_Bool.m_FalseString!=NULL) ? m_Val.m_Bool.m_FalseString : "0"; - } - break; - case TW_TYPE_BOOL8: - { - char Val = 0; - if( UseGet ) - m_GetCallback(&Val, m_ClientData); - else - Val = *(char *)m_Ptr; - if( Val ) - *_Str = (m_Val.m_Bool.m_TrueString!=NULL) ? m_Val.m_Bool.m_TrueString : "1"; - else - *_Str = (m_Val.m_Bool.m_FalseString!=NULL) ? m_Val.m_Bool.m_FalseString : "0"; - } - break; - case TW_TYPE_BOOL16: - { - short Val = 0; - if( UseGet ) - m_GetCallback(&Val, m_ClientData); - else - Val = *(short *)m_Ptr; - if( Val ) - *_Str = (m_Val.m_Bool.m_TrueString!=NULL) ? m_Val.m_Bool.m_TrueString : "1"; - else - *_Str = (m_Val.m_Bool.m_FalseString!=NULL) ? m_Val.m_Bool.m_FalseString : "0"; - } - break; - case TW_TYPE_BOOL32: - { - int Val = 0; - if( UseGet ) - m_GetCallback(&Val, m_ClientData); - else - Val = *(int *)m_Ptr; - if( Val ) - *_Str = (m_Val.m_Bool.m_TrueString!=NULL) ? m_Val.m_Bool.m_TrueString : "1"; - else - *_Str = (m_Val.m_Bool.m_FalseString!=NULL) ? m_Val.m_Bool.m_FalseString : "0"; - } - break; - case TW_TYPE_CHAR: - { - unsigned char Val = 0; - if( UseGet ) - m_GetCallback(&Val, m_ClientData); - else - Val = *(unsigned char *)m_Ptr; - if( Val!=0 ) - { - int d = Val; - if( m_Val.m_Char.m_Hexa ) - sprintf(Tmp, "%c (0x%.2X)", Val, d); - else - sprintf(Tmp, "%c (%d)", Val, d); - *_Str = Tmp; - } - else - { - *_Str = " (0)"; - const_cast(_Str->c_str())[0] = '\0'; - } - } - break; - case TW_TYPE_INT8: - { - signed char Val = 0; - if( UseGet ) - m_GetCallback(&Val, m_ClientData); - else - Val = *(signed char *)m_Ptr; - int d = Val; - if( m_Val.m_Int8.m_Hexa ) - sprintf(Tmp, "0x%.2X", d&0xff); - else - sprintf(Tmp, "%d", d); - *_Str = Tmp; - } - break; - case TW_TYPE_UINT8: - { - unsigned char Val = 0; - if( UseGet ) - m_GetCallback(&Val, m_ClientData); - else - Val = *(unsigned char *)m_Ptr; - unsigned int d = Val; - if( m_Val.m_UInt8.m_Hexa ) - sprintf(Tmp, "0x%.2X", d); - else - sprintf(Tmp, "%u", d); - *_Str = Tmp; - } - break; - case TW_TYPE_INT16: - { - short Val = 0; - if( UseGet ) - m_GetCallback(&Val, m_ClientData); - else - Val = *(short *)m_Ptr; - int d = Val; - if( m_Val.m_Int16.m_Hexa ) - sprintf(Tmp, "0x%.4X", d&0xffff); - else - sprintf(Tmp, "%d", d); - *_Str = Tmp; - } - break; - case TW_TYPE_UINT16: - { - unsigned short Val = 0; - if( UseGet ) - m_GetCallback(&Val, m_ClientData); - else - Val = *(unsigned short *)m_Ptr; - unsigned int d = Val; - if( m_Val.m_UInt16.m_Hexa ) - sprintf(Tmp, "0x%.4X", d); - else - sprintf(Tmp, "%u", d); - *_Str = Tmp; - } - break; - case TW_TYPE_INT32: - { - int Val = 0; - if( UseGet ) - m_GetCallback(&Val, m_ClientData); - else - Val = *(int *)m_Ptr; - if( m_Val.m_Int32.m_Hexa ) - sprintf(Tmp, "0x%.8X", Val); - else - sprintf(Tmp, "%d", Val); - *_Str = Tmp; - } - break; - case TW_TYPE_UINT32: - { - unsigned int Val = 0; - if( UseGet ) - m_GetCallback(&Val, m_ClientData); - else - Val = *(unsigned int *)m_Ptr; - if( m_Val.m_UInt32.m_Hexa ) - sprintf(Tmp, "0x%.8X", Val); - else - sprintf(Tmp, "%u", Val); - *_Str = Tmp; - } - break; - case TW_TYPE_FLOAT: - { - float Val = 0; - if( UseGet ) - m_GetCallback(&Val, m_ClientData); - else - Val = *(float *)m_Ptr; - if( m_Val.m_Float32.m_Precision<0 ) - sprintf(Tmp, "%g", Val); - else - { - char Fmt[64]; - sprintf(Fmt, "%%.%df", (int)m_Val.m_Float32.m_Precision); - sprintf(Tmp, Fmt, Val); - } - *_Str = Tmp; - } - break; - case TW_TYPE_DOUBLE: - { - double Val = 0; - if( UseGet ) - m_GetCallback(&Val, m_ClientData); - else - Val = *(double *)m_Ptr; - if( m_Val.m_Float64.m_Precision<0 ) - sprintf(Tmp, "%g", Val); - else - { - char Fmt[128]; - sprintf(Fmt, "%%.%dlf", (int)m_Val.m_Float64.m_Precision); - sprintf(Tmp, Fmt, Val); - } - *_Str = Tmp; - } - break; - case TW_TYPE_STDSTRING: - { - if( UseGet ) - m_GetCallback(_Str, m_ClientData); - else - *_Str = *(std::string *)m_Ptr; - } - break; - /* - case TW_TYPE_ENUM8: - case TW_TYPE_ENUM16: - case TW_TYPE_ENUM32: - { - unsigned int d = 0; - if( m_Type==TW_TYPE_ENUM8 ) - { - unsigned char Val = 0; - if( UseGet ) - m_GetCallback(&Val, m_ClientData); - else - Val = *(unsigned char *)m_Ptr; - d = Val; - } - else if( m_Type==TW_TYPE_ENUM16 ) - { - unsigned short Val = 0; - if( UseGet ) - m_GetCallback(&Val, m_ClientData); - else - Val = *(unsigned short *)m_Ptr; - d = Val; - } - else - { - assert(m_Type==TW_TYPE_ENUM32); - unsigned int Val = 0; - if( UseGet ) - m_GetCallback(&Val, m_ClientData); - else - Val = *(unsigned int *)m_Ptr; - d = Val; - } - bool Found = false; - if( m_Val.m_Enum.m_Entries!=NULL ) - { - UVal::CEnumVal::CEntries::iterator It = m_Val.m_Enum.m_Entries->find(d); - if( It!=m_Val.m_Enum.m_Entries->end() ) - { - *_Str = It->second; - Found = true; - } - } - if( !Found ) - { - sprintf(Tmp, "%u", d); - *_Str = Tmp; - } - } - break; - */ - default: - if( IsEnumType(m_Type) ) - { - unsigned int Val = 0; - if( UseGet ) - m_GetCallback(&Val, m_ClientData); - else - Val = *(unsigned int *)m_Ptr; - - CTwMgr::CEnum& e = g_TwMgr->m_Enums[m_Type-TW_TYPE_ENUM_BASE]; - CTwMgr::CEnum::CEntries::iterator It = e.m_Entries.find(Val); - if( It!=e.m_Entries.end() ) - *_Str = It->second; - else - { - sprintf(Tmp, "%u", Val); - *_Str = Tmp; - } - } - else if( IsCSStringType(m_Type) ) - { - char *Val = NULL; - if( UseGet ) - { - int n = TW_CSSTRING_SIZE(m_Type); - if( n+32>(int)g_TwMgr->m_CSStringBuffer.size() ) - g_TwMgr->m_CSStringBuffer.resize(n+32); - Val = &(g_TwMgr->m_CSStringBuffer[0]); - m_GetCallback(Val , m_ClientData); - Val[n] = '\0'; - } - else - Val = (char *)m_Ptr; - if( Val!=NULL ) - *_Str = Val; - else - *_Str = ""; - } - else if( m_Type==TW_TYPE_CDSTRING || m_Type==TW_TYPE_CDSTDSTRING ) - { - char *Val = NULL; - if( UseGet ) - m_GetCallback(&Val , m_ClientData); - else - Val = *(char **)m_Ptr; - if( Val!=NULL ) - *_Str = Val; - else - *_Str = ""; - } - else if( IsCustom() ) // m_Type>=TW_TYPE_CUSTOM_BASE && m_Typem_Customs.size() ) - { - *_Str = ""; - } - else - { - *_Str = "unknown type"; - const_cast(this)->m_ReadOnly = true; - } - } -} - -// --------------------------------------------------------------------------- - -double CTwVarAtom::ValueToDouble() const -{ - if( m_Ptr==NULL && m_GetCallback==NULL ) - return 0; // unreachable - bool UseGet = (m_GetCallback!=NULL); - switch( m_Type ) - { - case TW_TYPE_BOOLCPP: - { - bool Val = 0; - if( UseGet ) - m_GetCallback(&Val, m_ClientData); - else - Val = *(bool *)m_Ptr; - if( Val ) - return 1; - else - return 0; - } - break; - case TW_TYPE_BOOL8: - { - char Val = 0; - if( UseGet ) - m_GetCallback(&Val, m_ClientData); - else - Val = *(char *)m_Ptr; - if( Val ) - return 1; - else - return 0; - } - break; - case TW_TYPE_BOOL16: - { - short Val = 0; - if( UseGet ) - m_GetCallback(&Val, m_ClientData); - else - Val = *(short *)m_Ptr; - if( Val ) - return 1; - else - return 0; - } - break; - case TW_TYPE_BOOL32: - { - int Val = 0; - if( UseGet ) - m_GetCallback(&Val, m_ClientData); - else - Val = *(int *)m_Ptr; - if( Val ) - return 1; - else - return 0; - } - break; - case TW_TYPE_CHAR: - { - unsigned char Val = 0; - if( UseGet ) - m_GetCallback(&Val, m_ClientData); - else - Val = *(unsigned char *)m_Ptr; - return Val; - } - break; - case TW_TYPE_INT8: - { - signed char Val = 0; - if( UseGet ) - m_GetCallback(&Val, m_ClientData); - else - Val = *(signed char *)m_Ptr; - int d = Val; - return d; - } - break; - case TW_TYPE_UINT8: - { - unsigned char Val = 0; - if( UseGet ) - m_GetCallback(&Val, m_ClientData); - else - Val = *(unsigned char *)m_Ptr; - unsigned int d = Val; - return d; - } - break; - case TW_TYPE_INT16: - { - short Val = 0; - if( UseGet ) - m_GetCallback(&Val, m_ClientData); - else - Val = *(short *)m_Ptr; - int d = Val; - return d; - } - break; - case TW_TYPE_UINT16: - { - unsigned short Val = 0; - if( UseGet ) - m_GetCallback(&Val, m_ClientData); - else - Val = *(unsigned short *)m_Ptr; - unsigned int d = Val; - return d; - } - break; - case TW_TYPE_INT32: - { - int Val = 0; - if( UseGet ) - m_GetCallback(&Val, m_ClientData); - else - Val = *(int *)m_Ptr; - return Val; - } - break; - case TW_TYPE_UINT32: - { - unsigned int Val = 0; - if( UseGet ) - m_GetCallback(&Val, m_ClientData); - else - Val = *(unsigned int *)m_Ptr; - return Val; - } - break; - case TW_TYPE_FLOAT: - { - float Val = 0; - if( UseGet ) - m_GetCallback(&Val, m_ClientData); - else - Val = *(float *)m_Ptr; - return Val; - } - break; - case TW_TYPE_DOUBLE: - { - double Val = 0; - if( UseGet ) - m_GetCallback(&Val, m_ClientData); - else - Val = *(double *)m_Ptr; - return Val; - } - break; - /* - case TW_TYPE_ENUM8: - case TW_TYPE_ENUM16: - case TW_TYPE_ENUM32: - { - unsigned int d = 0; - if( m_Type==TW_TYPE_ENUM8 ) - { - unsigned char Val = 0; - if( UseGet ) - m_GetCallback(&Val, m_ClientData); - else - Val = *(unsigned char *)m_Ptr; - d = Val; - } - else if( m_Type==TW_TYPE_ENUM16 ) - { - unsigned short Val = 0; - if( UseGet ) - m_GetCallback(&Val, m_ClientData); - else - Val = *(unsigned short *)m_Ptr; - d = Val; - } - else - { - assert(m_Type==TW_TYPE_ENUM32); - unsigned int Val = 0; - if( UseGet ) - m_GetCallback(&Val, m_ClientData); - else - Val = *(unsigned int *)m_Ptr; - d = Val; - } - return d; - } - break; - */ - default: - if( IsEnumType(m_Type) ) - { - unsigned int Val = 0; - if( UseGet ) - m_GetCallback(&Val, m_ClientData); - else - Val = *(unsigned int *)m_Ptr; - return Val; - } - else - return 0; // unknown type - } -} - -// --------------------------------------------------------------------------- - -void CTwVarAtom::ValueFromDouble(double _Val) -{ - if( m_Ptr==NULL && m_SetCallback==NULL ) - return; // unreachable - bool UseSet = (m_SetCallback!=NULL); - switch( m_Type ) - { - case TW_TYPE_BOOLCPP: - { - bool Val = (_Val!=0); - if( UseSet ) - m_SetCallback(&Val, m_ClientData); - else - *(bool*)m_Ptr = Val; - } - break; - case TW_TYPE_BOOL8: - { - char Val = (_Val!=0) ? 1 : 0; - if( UseSet ) - m_SetCallback(&Val, m_ClientData); - else - *(char*)m_Ptr = Val; - } - break; - case TW_TYPE_BOOL16: - { - short Val = (_Val!=0) ? 1 : 0; - if( UseSet ) - m_SetCallback(&Val, m_ClientData); - else - *(short*)m_Ptr = Val; - } - break; - case TW_TYPE_BOOL32: - { - int Val = (_Val!=0) ? 1 : 0; - if( UseSet ) - m_SetCallback(&Val, m_ClientData); - else - *(int*)m_Ptr = Val; - } - break; - case TW_TYPE_CHAR: - { - unsigned char Val = (unsigned char)_Val; - if( UseSet ) - m_SetCallback(&Val, m_ClientData); - else - *(unsigned char*)m_Ptr = Val; - } - break; - case TW_TYPE_INT8: - { - signed char Val = (signed char)_Val; - if( UseSet ) - m_SetCallback(&Val, m_ClientData); - else - *(signed char*)m_Ptr = Val; - } - break; - case TW_TYPE_UINT8: - //case TW_TYPE_ENUM8: - { - unsigned char Val = (unsigned char)_Val; - if( UseSet ) - m_SetCallback(&Val, m_ClientData); - else - *(unsigned char*)m_Ptr = Val; - } - break; - case TW_TYPE_INT16: - { - short Val = (short)_Val; - if( UseSet ) - m_SetCallback(&Val, m_ClientData); - else - *(short*)m_Ptr = Val; - } - break; - case TW_TYPE_UINT16: - //case TW_TYPE_ENUM16: - { - unsigned short Val = (unsigned short)_Val; - if( UseSet ) - m_SetCallback(&Val, m_ClientData); - else - *(unsigned short*)m_Ptr = Val; - } - break; - case TW_TYPE_INT32: - { - int Val = (int)_Val; - if( UseSet ) - m_SetCallback(&Val, m_ClientData); - else - *(int*)m_Ptr = Val; - } - break; - case TW_TYPE_UINT32: - //case TW_TYPE_ENUM32: - { - unsigned int Val = (unsigned int)_Val; - if( UseSet ) - m_SetCallback(&Val, m_ClientData); - else - *(unsigned int*)m_Ptr = Val; - } - break; - case TW_TYPE_FLOAT: - { - float Val = (float)_Val; - if( UseSet ) - m_SetCallback(&Val, m_ClientData); - else - *(float*)m_Ptr = Val; - } - break; - case TW_TYPE_DOUBLE: - { - double Val = (double)_Val; - if( UseSet ) - m_SetCallback(&Val, m_ClientData); - else - *(double*)m_Ptr = Val; - } - break; - default: - if( IsEnumType(m_Type) ) - { - unsigned int Val = (unsigned int)_Val; - if( UseSet ) - m_SetCallback(&Val, m_ClientData); - else - *(unsigned int*)m_Ptr = Val; - } - } -} - -// --------------------------------------------------------------------------- - -void CTwVarAtom::MinMaxStepToDouble(double *_Min, double *_Max, double *_Step) const -{ - double max = DOUBLE_MAX; - double min = -DOUBLE_MAX; - double step = 1; - - switch( m_Type ) - { - case TW_TYPE_BOOLCPP: - case TW_TYPE_BOOL8: - case TW_TYPE_BOOL16: - case TW_TYPE_BOOL32: - min = 0; - max = 1; - step = 1; - break; - case TW_TYPE_CHAR: - min = (double)m_Val.m_Char.m_Min; - max = (double)m_Val.m_Char.m_Max; - step = (double)m_Val.m_Char.m_Step; - break; - case TW_TYPE_INT8: - min = (double)m_Val.m_Int8.m_Min; - max = (double)m_Val.m_Int8.m_Max; - step = (double)m_Val.m_Int8.m_Step; - break; - case TW_TYPE_UINT8: - min = (double)m_Val.m_UInt8.m_Min; - max = (double)m_Val.m_UInt8.m_Max; - step = (double)m_Val.m_UInt8.m_Step; - break; - case TW_TYPE_INT16: - min = (double)m_Val.m_Int16.m_Min; - max = (double)m_Val.m_Int16.m_Max; - step = (double)m_Val.m_Int16.m_Step; - break; - case TW_TYPE_UINT16: - min = (double)m_Val.m_UInt16.m_Min; - max = (double)m_Val.m_UInt16.m_Max; - step = (double)m_Val.m_UInt16.m_Step; - break; - case TW_TYPE_INT32: - min = (double)m_Val.m_Int32.m_Min; - max = (double)m_Val.m_Int32.m_Max; - step = (double)m_Val.m_Int32.m_Step; - break; - case TW_TYPE_UINT32: - min = (double)m_Val.m_UInt32.m_Min; - max = (double)m_Val.m_UInt32.m_Max; - step = (double)m_Val.m_UInt32.m_Step; - break; - case TW_TYPE_FLOAT: - min = (double)m_Val.m_Float32.m_Min; - max = (double)m_Val.m_Float32.m_Max; - step = (double)m_Val.m_Float32.m_Step; - break; - case TW_TYPE_DOUBLE: - min = m_Val.m_Float64.m_Min; - max = m_Val.m_Float64.m_Max; - step = m_Val.m_Float64.m_Step; - break; - default: - {} // nothing - } - - if( _Min!=NULL ) - *_Min = min; - if( _Max!=NULL ) - *_Max = max; - if( _Step!=NULL ) - *_Step = step; -} - -// --------------------------------------------------------------------------- - -const CTwVar *CTwVarAtom::Find(const char *_Name, CTwVarGroup **_Parent, int *_Index) const -{ - if( strcmp(_Name, m_Name.c_str())==0 ) - { - if( _Parent!=NULL ) - *_Parent = NULL; - if( _Index!=NULL ) - *_Index = -1; - return this; - } - else - return NULL; -} - -// --------------------------------------------------------------------------- - -enum EVarAttribs -{ - V_LABEL = 1, - V_HELP, - V_GROUP, - V_SHOW, - V_HIDE, - V_READONLY, - V_READWRITE, - V_ORDER, - V_VISIBLE, - V_ENDTAG -}; - -int CTwVar::HasAttrib(const char *_Attrib, bool *_HasValue) const -{ - *_HasValue = true; - if( _stricmp(_Attrib, "label")==0 ) - return V_LABEL; - else if( _stricmp(_Attrib, "help")==0 ) - return V_HELP; - else if( _stricmp(_Attrib, "group")==0 ) - return V_GROUP; - else if( _stricmp(_Attrib, "order")==0 ) - return V_ORDER; - else if( _stricmp(_Attrib, "visible")==0 ) - return V_VISIBLE; - else if( _stricmp(_Attrib, "readonly")==0 ) - return V_READONLY; - - // for backward compatibility - *_HasValue = false; - if( _stricmp(_Attrib, "show")==0 ) - return V_SHOW; - else if( _stricmp(_Attrib, "hide")==0 ) - return V_HIDE; - if( _stricmp(_Attrib, "readonly")==0 ) - return V_READONLY; - else if( _stricmp(_Attrib, "readwrite")==0 ) - return V_READWRITE; - - return 0; // not found -} - -int CTwVar::SetAttrib(int _AttribID, const char *_Value, TwBar *_Bar, struct CTwVarGroup *_VarParent, int _VarIndex) -{ - switch( _AttribID ) - { - case V_LABEL: - case V_HELP: - if( _Value && strlen(_Value)>0 ) - { - /* - if( IsGroup() && static_cast(this)->m_StructValuePtr!=NULL ) - { - int Idx = static_cast(this)->m_StructType-TW_TYPE_STRUCT_BASE; - if( Idx>=0 && Idx<(int)g_TwMgr->m_Structs.size() ) - if( _AttribID==V_LABEL ) - g_TwMgr->m_Structs[Idx].m_Label = _Value; - else // V_HELP - g_TwMgr->m_Structs[Idx].m_Help = _Value; - } - else - */ - { - CTwVarGroup *Parent = NULL; - CTwVar *ThisVar = _Bar->Find(m_Name.c_str(), &Parent); - if( this==ThisVar && Parent!=NULL && Parent->m_StructValuePtr!=NULL ) - { - int Idx = Parent->m_StructType-TW_TYPE_STRUCT_BASE; - if( Idx>=0 && Idx<(int)g_TwMgr->m_Structs.size() ) - { - size_t nl = m_Name.length(); - for( size_t im=0; imm_Structs[Idx].m_Members.size(); ++im ) - { - size_t ml = g_TwMgr->m_Structs[Idx].m_Members[im].m_Name.length(); - if( nl>=ml && strcmp(g_TwMgr->m_Structs[Idx].m_Members[im].m_Name.c_str(), m_Name.c_str()+(nl-ml))==0 ) - { - // TODO: would have to be applied to other vars already created - if( _AttribID==V_LABEL ) - { - g_TwMgr->m_Structs[Idx].m_Members[im].m_Label = _Value; -// m_Label = _Value; - } - else // V_HELP - g_TwMgr->m_Structs[Idx].m_Members[im].m_Help = _Value; - break; - } - } - } - } - else - { - if( _AttribID==V_LABEL ) - m_Label = _Value; - else // V_HELP - m_Help = _Value; - } - } - _Bar->NotUpToDate(); - return 1; - } - else - { - g_TwMgr->SetLastError(g_ErrNoValue); - return 0; - } - case V_GROUP: - { - CTwVarGroup *Grp = NULL; - if( _Value==NULL || strlen(_Value)<=0 ) - Grp = &(_Bar->m_VarRoot); - else - { - CTwVar *v = _Bar->Find(_Value, NULL, NULL); - if( v && !v->IsGroup() ) - { - g_TwMgr->SetLastError(g_ErrNotGroup); - return 0; - } - Grp = static_cast(v); - if( Grp==NULL ) - { - Grp = new CTwVarGroup; - Grp->m_Name = _Value; - Grp->m_Open = true; - Grp->m_SummaryCallback = NULL; - Grp->m_SummaryClientData = NULL; - Grp->m_StructValuePtr = NULL; - Grp->m_ColorPtr = &(_Bar->m_ColGrpText); - _Bar->m_VarRoot.m_Vars.push_back(Grp); - } - } - Grp->m_Vars.push_back(this); - if( _VarParent!=NULL && _VarIndex>=0 ) - { - _VarParent->m_Vars.erase(_VarParent->m_Vars.begin()+_VarIndex); - if( _VarParent!=&(_Bar->m_VarRoot) && _VarParent->m_Vars.size()<=0 ) - TwRemoveVar(_Bar, _VarParent->m_Name.c_str()); - } - _Bar->NotUpToDate(); - return 1; - } - case V_SHOW: // for backward compatibility - if( !m_Visible ) - { - m_Visible = true; - _Bar->NotUpToDate(); - } - return 1; - case V_HIDE: // for backward compatibility - if( m_Visible ) - { - m_Visible = false; - _Bar->NotUpToDate(); - } - return 1; - /* - case V_READONLY: - SetReadOnly(true); - _Bar->NotUpToDate(); - return 1; - */ - case V_READWRITE: // for backward compatibility - SetReadOnly(false); - _Bar->NotUpToDate(); - return 1; - case V_ORDER: - // a special case for compatibility with deprecated command 'option=ogl/dx' - if( IsGroup() && _Value!=NULL && static_cast(this)->m_SummaryCallback==CColorExt::SummaryCB && static_cast(this)->m_StructValuePtr!=NULL ) // is tw_type_color? - { - if( _stricmp(_Value, "ogl")==0 ) - { - static_cast(static_cast(this)->m_StructValuePtr)->m_OGL = true; - return 1; - } - else if( _stricmp(_Value, "dx")==0 ) - { - static_cast(static_cast(this)->m_StructValuePtr)->m_OGL = false; - return 1; - } - } - // todo: general 'order' command (no else) - return 0; - case V_VISIBLE: - if( _Value!=NULL && strlen(_Value)>0 ) - { - if( _stricmp(_Value, "true")==0 || _stricmp(_Value, "1")==0 ) - { - if( !m_Visible ) - { - m_Visible = true; - _Bar->NotUpToDate(); - } - return 1; - } - else if( _stricmp(_Value, "false")==0 || _stricmp(_Value, "0")==0 ) - { - if( m_Visible ) - { - m_Visible = false; - _Bar->NotUpToDate(); - } - return 1; - } - else - { - g_TwMgr->SetLastError(g_ErrBadValue); - return 0; - } - } - else - { - g_TwMgr->SetLastError(g_ErrNoValue); - return 0; - } - case V_READONLY: - if( _Value==NULL || strlen(_Value)==0 // no value is acceptable (for backward compatibility) - || _stricmp(_Value, "true")==0 || _stricmp(_Value, "1")==0 ) - { - if( !IsReadOnly() ) - { - SetReadOnly(true); - _Bar->NotUpToDate(); - } - return 1; - } - else if( _stricmp(_Value, "false")==0 || _stricmp(_Value, "0")==0 ) - { - if( IsReadOnly() ) - { - SetReadOnly(false); - _Bar->NotUpToDate(); - } - return 1; - } - else - { - g_TwMgr->SetLastError(g_ErrBadValue); - return 0; - } - default: - g_TwMgr->SetLastError(g_ErrUnknownAttrib); - return 0; - } -} - - -ERetType CTwVar::GetAttrib(int _AttribID, TwBar * /*_Bar*/, CTwVarGroup * _VarParent, int /*_VarIndex*/, std::vector& outDoubles, std::ostringstream& outString) const -{ - outDoubles.clear(); - outString.clear(); - - switch( _AttribID ) - { - case V_LABEL: - outString << m_Label; - return RET_STRING; - case V_HELP: - outString << m_Help; - return RET_STRING; - case V_GROUP: - if( _VarParent!=NULL ) - outString << _VarParent->m_Name; - return RET_STRING; - case V_VISIBLE: - outDoubles.push_back(m_Visible ? 1 : 0); - return RET_DOUBLE; - case V_READONLY: - outDoubles.push_back(IsReadOnly() ? 1 : 0); - return RET_DOUBLE; - default: - g_TwMgr->SetLastError(g_ErrUnknownAttrib); - return RET_ERROR; - } -} - - -// --------------------------------------------------------------------------- - -enum EVarAtomAttribs -{ - VA_KEY_INCR = V_ENDTAG+1, - VA_KEY_DECR, - VA_MIN, - VA_MAX, - VA_STEP, - VA_PRECISION, - VA_HEXA, - VA_DECIMAL, // for backward compatibility - VA_TRUE, - VA_FALSE, - VA_ENUM, - VA_VALUE -}; - -int CTwVarAtom::HasAttrib(const char *_Attrib, bool *_HasValue) const -{ - *_HasValue = true; - if( _stricmp(_Attrib, "keyincr")==0 || _stricmp(_Attrib, "key")==0 ) - return VA_KEY_INCR; - else if( _stricmp(_Attrib, "keydecr")==0 ) - return VA_KEY_DECR; - else if( _stricmp(_Attrib, "min")==0 ) - return VA_MIN; - else if( _stricmp(_Attrib, "max")==0 ) - return VA_MAX; - else if( _stricmp(_Attrib, "step")==0 ) - return VA_STEP; - else if( _stricmp(_Attrib, "precision")==0 ) - return VA_PRECISION; - else if( _stricmp(_Attrib, "hexa")==0 ) - return VA_HEXA; - else if( _stricmp(_Attrib, "decimal")==0 ) // for backward compatibility - { - *_HasValue = false; - return VA_DECIMAL; - } - else if( _stricmp(_Attrib, "true")==0 ) - return VA_TRUE; - else if( _stricmp(_Attrib, "false")==0 ) - return VA_FALSE; - else if( _stricmp(_Attrib, "enum")==0 - || _stricmp(_Attrib, "val")==0 ) // for backward compatibility - return VA_ENUM; - else if( _stricmp(_Attrib, "value")==0 ) - return VA_VALUE; - - return CTwVar::HasAttrib(_Attrib, _HasValue); -} - -int CTwVarAtom::SetAttrib(int _AttribID, const char *_Value, TwBar *_Bar, struct CTwVarGroup *_VarParent, int _VarIndex) -{ - switch( _AttribID ) - { - case VA_KEY_INCR: - { - int Key = 0; - int Mod = 0; - if( TwGetKeyCode(&Key, &Mod, _Value) ) - { - m_KeyIncr[0] = Key; - m_KeyIncr[1] = Mod; - return 1; - } - else - return 0; - } - case VA_KEY_DECR: - { - int Key = 0; - int Mod = 0; - if( TwGetKeyCode(&Key, &Mod, _Value) ) - { - m_KeyDecr[0] = Key; - m_KeyDecr[1] = Mod; - return 1; - } - else - return 0; - } - case VA_TRUE: - if( (m_Type==TW_TYPE_BOOL8 || m_Type==TW_TYPE_BOOL16 || m_Type==TW_TYPE_BOOL32 || m_Type==TW_TYPE_BOOLCPP) && _Value!=NULL ) - { - if( m_Val.m_Bool.m_FreeTrueString && m_Val.m_Bool.m_TrueString!=NULL ) - free(m_Val.m_Bool.m_TrueString); - m_Val.m_Bool.m_TrueString = _strdup(_Value); - m_Val.m_Bool.m_FreeTrueString = true; - return 1; - } - else - return 0; - case VA_FALSE: - if( (m_Type==TW_TYPE_BOOL8 || m_Type==TW_TYPE_BOOL16 || m_Type==TW_TYPE_BOOL32 || m_Type==TW_TYPE_BOOLCPP) && _Value!=NULL ) - { - if( m_Val.m_Bool.m_FreeFalseString && m_Val.m_Bool.m_FalseString!=NULL ) - free(m_Val.m_Bool.m_FalseString); - m_Val.m_Bool.m_FalseString = _strdup(_Value); - m_Val.m_Bool.m_FreeFalseString = true; - return 1; - } - else - return 0; - case VA_MIN: - case VA_MAX: - case VA_STEP: - if( _Value && strlen(_Value)>0 ) - { - void *Ptr = NULL; - const char *Fmt = NULL; - int d = 0; - unsigned int u = 0; - int Num = (_AttribID==VA_STEP) ? 2 : ((_AttribID==VA_MAX) ? 1 : 0); - switch( m_Type ) - { - case TW_TYPE_CHAR: - //Ptr = (&m_Val.m_Char.m_Min) + Num; - //Fmt = "%c"; - Ptr = &u; - Fmt = "%u"; - break; - case TW_TYPE_INT16: - Ptr = (&m_Val.m_Int16.m_Min) + Num; - Fmt = "%hd"; - break; - case TW_TYPE_INT32: - Ptr = (&m_Val.m_Int32.m_Min) + Num; - Fmt = "%d"; - break; - case TW_TYPE_UINT16: - Ptr = (&m_Val.m_UInt16.m_Min) + Num; - Fmt = "%hu"; - break; - case TW_TYPE_UINT32: - Ptr = (&m_Val.m_UInt32.m_Min) + Num; - Fmt = "%u"; - break; - case TW_TYPE_FLOAT: - Ptr = (&m_Val.m_Float32.m_Min) + Num; - Fmt = "%f"; - break; - case TW_TYPE_DOUBLE: - Ptr = (&m_Val.m_Float64.m_Min) + Num; - Fmt = "%lf"; - break; - case TW_TYPE_INT8: - Ptr = &d; - Fmt = "%d"; - break; - case TW_TYPE_UINT8: - Ptr = &u; - Fmt = "%u"; - break; - default: - g_TwMgr->SetLastError(g_ErrUnknownType); - return 0; - } - - if( Fmt!=NULL && Ptr!=NULL && sscanf(_Value, Fmt, Ptr)==1 ) - { - if( m_Type==TW_TYPE_CHAR ) - *((&m_Val.m_Char.m_Min)+Num) = (unsigned char)(u); - else if( m_Type==TW_TYPE_INT8 ) - *((&m_Val.m_Int8.m_Min)+Num) = (signed char)(d); - else if( m_Type==TW_TYPE_UINT8 ) - *((&m_Val.m_UInt8.m_Min)+Num) = (unsigned char)(u); - - // set precision - if( _AttribID==VA_STEP && ((m_Type==TW_TYPE_FLOAT && m_Val.m_Float32.m_Precision<0) || (m_Type==TW_TYPE_DOUBLE && m_Val.m_Float64.m_Precision<0)) ) - { - double Step = fabs( (m_Type==TW_TYPE_FLOAT) ? m_Val.m_Float32.m_Step : m_Val.m_Float64.m_Step ); - signed char *Precision = (m_Type==TW_TYPE_FLOAT) ? &m_Val.m_Float32.m_Precision : &m_Val.m_Float64.m_Precision; - const double K_EPS = 1.0 - 1.0e-6; - if( Step>=1 ) - *Precision = 0; - else if( Step>=0.1*K_EPS ) - *Precision = 1; - else if( Step>=0.01*K_EPS ) - *Precision = 2; - else if( Step>=0.001*K_EPS ) - *Precision = 3; - else if( Step>=0.0001*K_EPS ) - *Precision = 4; - else if( Step>=0.00001*K_EPS ) - *Precision = 5; - else if( Step>=0.000001*K_EPS ) - *Precision = 6; - else if( Step>=0.0000001*K_EPS ) - *Precision = 7; - else if( Step>=0.00000001*K_EPS ) - *Precision = 8; - else if( Step>=0.000000001*K_EPS ) - *Precision = 9; - else if( Step>=0.0000000001*K_EPS ) - *Precision = 10; - else if( Step>=0.00000000001*K_EPS ) - *Precision = 11; - else if( Step>=0.000000000001*K_EPS ) - *Precision = 12; - else - *Precision = -1; - } - - return 1; - } - else - { - g_TwMgr->SetLastError(g_ErrBadValue); - return 0; - } - } - else - { - g_TwMgr->SetLastError(g_ErrNoValue); - return 0; - } - case VA_PRECISION: - if( _Value && strlen(_Value)>0 ) - { - int Precision = 0; - if( sscanf(_Value, "%d", &Precision)==1 && Precision>=-1 && Precision<=12 ) - { - if( m_Type==TW_TYPE_FLOAT ) - m_Val.m_Float32.m_Precision = (signed char)Precision; - else if ( m_Type==TW_TYPE_DOUBLE ) - m_Val.m_Float64.m_Precision = (signed char)Precision; - return 1; - } - else - { - g_TwMgr->SetLastError(g_ErrBadValue); - return 0; - } - } - else - { - g_TwMgr->SetLastError(g_ErrNoValue); - return 0; - } - case VA_HEXA: - case VA_DECIMAL: - { - bool hexa = false; - if (_AttribID==VA_HEXA) - { - if( _Value==NULL || strlen(_Value)==0 // no value is acceptable (for backward compatibility) - || _stricmp(_Value, "true")==0 || _stricmp(_Value, "1")==0 ) - hexa = true; - } - - switch( m_Type ) - { - case TW_TYPE_CHAR: - m_Val.m_Char.m_Hexa = hexa; - return 1; - case TW_TYPE_INT8: - m_Val.m_Int8.m_Hexa = hexa; - return 1; - case TW_TYPE_INT16: - m_Val.m_Int16.m_Hexa = hexa; - return 1; - case TW_TYPE_INT32: - m_Val.m_Int32.m_Hexa = hexa; - return 1; - case TW_TYPE_UINT8: - m_Val.m_UInt8.m_Hexa = hexa; - return 1; - case TW_TYPE_UINT16: - m_Val.m_UInt16.m_Hexa = hexa; - return 1; - case TW_TYPE_UINT32: - m_Val.m_UInt32.m_Hexa = hexa; - return 1; - default: - return 0; - } - } - case VA_ENUM: - if( _Value && strlen(_Value)>0 && IsEnumType(m_Type) ) - { - const char *s = _Value; - int n = 0, i = 0; - unsigned int u; - bool Cont; - g_TwMgr->m_Enums[m_Type-TW_TYPE_ENUM_BASE].m_Entries.clear(); // anyway reset entries - do - { - Cont = false; - i = 0; - char Sep; - n = sscanf(s, "%u %c%n", &u, &Sep, &i); - if( n==2 && i>0 && ( Sep=='<' || Sep=='{' || Sep=='[' || Sep=='(' ) ) - { - if( Sep=='<' ) // Change to closing separator - Sep = '>'; - else if( Sep=='{' ) - Sep = '}'; - else if( Sep=='[' ) - Sep = ']'; - else if( Sep=='(' ) - Sep = ')'; - s += i; - i = 0; - while( s[i]!=Sep && s[i]!=0 ) - ++i; - if( s[i]==Sep ) - { - //if( m_Val.m_Enum.m_Entries==NULL ) - // m_Val.m_Enum.m_Entries = new UVal::CEnumVal::CEntries; - //UVal::CEnumVal::CEntries::value_type v(u, ""); - CTwMgr::CEnum::CEntries::value_type v(u, ""); - if( i>0 ) - v.second.assign(s, i); - //m_Val.m_Enum.m_Entries->insert(v); - pair ret; - ret = g_TwMgr->m_Enums[m_Type-TW_TYPE_ENUM_BASE].m_Entries.insert(v); - if( !ret.second ) // force overwrite if element already exists - { - g_TwMgr->m_Enums[m_Type-TW_TYPE_ENUM_BASE].m_Entries.erase(ret.first); - g_TwMgr->m_Enums[m_Type-TW_TYPE_ENUM_BASE].m_Entries.insert(v); - } - - s += i+1; - i = 0; - n = sscanf(s, " ,%n", &i); - if( n==0 && i>=1 ) - { - s += i; - Cont = true; - } - } - else - { - g_TwMgr->SetLastError(g_ErrBadValue); - return 0; - } - } - else - { - g_TwMgr->SetLastError(g_ErrBadValue); - return 0; - } - } while( Cont ); - return 1; - } - else - { - g_TwMgr->SetLastError(g_ErrNoValue); - return 0; - } - break; - case VA_VALUE: - if( _Value!=NULL && strlen(_Value)>0 ) // do not check ReadOnly here. - { - if( !( m_Type==TW_TYPE_BUTTON || IsCustom() ) ) // || (m_Type>=TW_TYPE_CUSTOM_BASE && m_Typem_Customs.size()) ) ) - { - if( m_Type==TW_TYPE_CDSTRING || m_Type==TW_TYPE_CDSTDSTRING ) - { - if( m_SetCallback!=NULL ) - { - m_SetCallback(&_Value, m_ClientData); - if( g_TwMgr!=NULL ) // Mgr might have been destroyed by the client inside a callback call - _Bar->NotUpToDate(); - return 1; - } - else if( m_Type!=TW_TYPE_CDSTDSTRING ) - { - char **StringPtr = (char **)m_Ptr; - if( StringPtr!=NULL && g_TwMgr->m_CopyCDStringToClient!=NULL ) - { - g_TwMgr->m_CopyCDStringToClient(StringPtr, _Value); - _Bar->NotUpToDate(); - return 1; - } - } - } - else if( IsCSStringType(m_Type) ) - { - int n = TW_CSSTRING_SIZE(m_Type); - if( n>0 ) - { - string str = _Value; - if( (int)str.length()>n-1 ) - str.resize(n-1); - if( m_SetCallback!=NULL ) - { - m_SetCallback(str.c_str(), m_ClientData); - if( g_TwMgr!=NULL ) // Mgr might have been destroyed by the client inside a callback call - _Bar->NotUpToDate(); - return 1; - } - else if( m_Ptr!=NULL ) - { - if( n>1 ) - strncpy((char *)m_Ptr, str.c_str(), n-1); - ((char *)m_Ptr)[n-1] = '\0'; - _Bar->NotUpToDate(); - return 1; - } - } - } - else - { - double dbl; - if( sscanf(_Value, "%lf", &dbl)==1 ) - { - ValueFromDouble(dbl); - if( g_TwMgr!=NULL ) // Mgr might have been destroyed by the client inside a callback call - _Bar->NotUpToDate(); - return 1; - } - } - } - } - return 0; - default: - return CTwVar::SetAttrib(_AttribID, _Value, _Bar, _VarParent, _VarIndex); - } -} - -ERetType CTwVarAtom::GetAttrib(int _AttribID, TwBar *_Bar, CTwVarGroup *_VarParent, int _VarIndex, std::vector& outDoubles, std::ostringstream& outString) const -{ - outDoubles.clear(); - outString.clear(); - std::string str; - int num = 0; - - switch( _AttribID ) - { - case VA_KEY_INCR: - if( TwGetKeyString(&str, m_KeyIncr[0], m_KeyIncr[1]) ) - outString << str; - return RET_STRING; - case VA_KEY_DECR: - if( TwGetKeyString(&str, m_KeyDecr[0], m_KeyDecr[1]) ) - outString << str; - return RET_STRING; - case VA_TRUE: - if( m_Type==TW_TYPE_BOOL8 || m_Type==TW_TYPE_BOOL16 || m_Type==TW_TYPE_BOOL32 || m_Type==TW_TYPE_BOOLCPP ) - { - outString << m_Val.m_Bool.m_TrueString; - return RET_STRING; - } - else - { - g_TwMgr->SetLastError(g_ErrInvalidAttrib); - return RET_ERROR; - } - case VA_FALSE: - if( m_Type==TW_TYPE_BOOL8 || m_Type==TW_TYPE_BOOL16 || m_Type==TW_TYPE_BOOL32 || m_Type==TW_TYPE_BOOLCPP ) - { - outString << m_Val.m_Bool.m_FalseString; - return RET_STRING; - } - else - { - g_TwMgr->SetLastError(g_ErrInvalidAttrib); - return RET_ERROR; - } - case VA_MIN: - case VA_MAX: - case VA_STEP: - num = (_AttribID==VA_STEP) ? 2 : ((_AttribID==VA_MAX) ? 1 : 0); - switch( m_Type ) - { - case TW_TYPE_CHAR: - outDoubles.push_back( *((&m_Val.m_Char.m_Min) + num) ); - return RET_DOUBLE; - case TW_TYPE_INT8: - outDoubles.push_back( *((&m_Val.m_Int8.m_Min) + num) ); - return RET_DOUBLE; - case TW_TYPE_UINT8: - outDoubles.push_back( *((&m_Val.m_UInt8.m_Min) + num) ); - return RET_DOUBLE; - case TW_TYPE_INT16: - outDoubles.push_back( *((&m_Val.m_Int16.m_Min) + num) ); - return RET_DOUBLE; - case TW_TYPE_INT32: - outDoubles.push_back( *((&m_Val.m_Int32.m_Min) + num) ); - return RET_DOUBLE; - case TW_TYPE_UINT16: - outDoubles.push_back( *((&m_Val.m_UInt16.m_Min) + num) ); - return RET_DOUBLE; - case TW_TYPE_UINT32: - outDoubles.push_back( *((&m_Val.m_UInt32.m_Min) + num) ); - return RET_DOUBLE; - case TW_TYPE_FLOAT: - outDoubles.push_back( *((&m_Val.m_Float32.m_Min) + num) ); - return RET_DOUBLE; - case TW_TYPE_DOUBLE: - outDoubles.push_back( *((&m_Val.m_Float64.m_Min) + num) ); - return RET_DOUBLE; - default: - g_TwMgr->SetLastError(g_ErrInvalidAttrib); - return RET_ERROR; - } - case VA_PRECISION: - if( m_Type==TW_TYPE_FLOAT ) - { - outDoubles.push_back( m_Val.m_Float32.m_Precision ); - return RET_DOUBLE; - } - else if ( m_Type==TW_TYPE_DOUBLE ) - { - outDoubles.push_back( m_Val.m_Float64.m_Precision ); - return RET_DOUBLE; - } - else - { - g_TwMgr->SetLastError(g_ErrInvalidAttrib); - return RET_ERROR; - } - case VA_HEXA: - switch( m_Type ) - { - case TW_TYPE_CHAR: - outDoubles.push_back( m_Val.m_Char.m_Hexa ); - return RET_DOUBLE; - case TW_TYPE_INT8: - outDoubles.push_back( m_Val.m_Int8.m_Hexa ); - return RET_DOUBLE; - case TW_TYPE_INT16: - outDoubles.push_back( m_Val.m_Int16.m_Hexa ); - return RET_DOUBLE; - case TW_TYPE_INT32: - outDoubles.push_back( m_Val.m_Int32.m_Hexa ); - return RET_DOUBLE; - case TW_TYPE_UINT8: - outDoubles.push_back( m_Val.m_UInt8.m_Hexa ); - return RET_DOUBLE; - case TW_TYPE_UINT16: - outDoubles.push_back( m_Val.m_UInt16.m_Hexa ); - return RET_DOUBLE; - case TW_TYPE_UINT32: - outDoubles.push_back( m_Val.m_UInt32.m_Hexa ); - return RET_DOUBLE; - default: - g_TwMgr->SetLastError(g_ErrInvalidAttrib); - return RET_ERROR; - } - case VA_ENUM: - if( IsEnumType(m_Type) ) - { - CTwMgr::CEnum::CEntries::iterator it = g_TwMgr->m_Enums[m_Type-TW_TYPE_ENUM_BASE].m_Entries.begin(); - for( ; it != g_TwMgr->m_Enums[m_Type-TW_TYPE_ENUM_BASE].m_Entries.end(); ++it ) - { - if( it != g_TwMgr->m_Enums[m_Type-TW_TYPE_ENUM_BASE].m_Entries.begin() ) - outString << ','; - outString << it->first << ' '; - if( it->second.find_first_of("{}")==std::string::npos ) - outString << '{' << it->second << '}'; - else if ( it->second.find_first_of("<>")==std::string::npos ) - outString << '<' << it->second << '>'; - else if ( it->second.find_first_of("()")==std::string::npos ) - outString << '(' << it->second << ')'; - else if ( it->second.find_first_of("[]")==std::string::npos ) - outString << '[' << it->second << ']'; - else - outString << '{' << it->second << '}'; // should not occured (use braces) - } - return RET_STRING; - } - g_TwMgr->SetLastError(g_ErrInvalidAttrib); - return RET_ERROR; - case VA_VALUE: - if( !( m_Type==TW_TYPE_BUTTON || IsCustom() ) ) // || (m_Type>=TW_TYPE_CUSTOM_BASE && m_Typem_Customs.size()) ) ) - { - if( m_Type==TW_TYPE_CDSTRING || m_Type==TW_TYPE_CDSTDSTRING || IsCSStringType(m_Type) ) - { - string str; - ValueToString(&str); - outString << str; - return RET_STRING; - } - else - { - outDoubles.push_back( ValueToDouble() ); - return RET_DOUBLE; - } - } - g_TwMgr->SetLastError(g_ErrInvalidAttrib); - return RET_ERROR; - default: - return CTwVar::GetAttrib(_AttribID, _Bar, _VarParent, _VarIndex, outDoubles, outString); - } -} - -// --------------------------------------------------------------------------- - -void CTwVarAtom::Increment(int _Step) -{ - if( _Step==0 ) - return; - switch( m_Type ) - { - case TW_TYPE_BOOL8: - { - char v = false; - if( m_Ptr!=NULL ) - v = *((char *)m_Ptr); - else if( m_GetCallback!=NULL ) - m_GetCallback(&v, m_ClientData); - if( v ) - v = false; - else - v = true; - if( m_Ptr!=NULL ) - *((char *)m_Ptr) = v; - else if( m_SetCallback!=NULL ) - m_SetCallback(&v, m_ClientData); - } - break; - case TW_TYPE_BOOL16: - { - short v = false; - if( m_Ptr!=NULL ) - v = *((short *)m_Ptr); - else if( m_GetCallback!=NULL ) - m_GetCallback(&v, m_ClientData); - if( v ) - v = false; - else - v = true; - if( m_Ptr!=NULL ) - *((short *)m_Ptr) = v; - else if( m_SetCallback!=NULL ) - m_SetCallback(&v, m_ClientData); - } - break; - case TW_TYPE_BOOL32: - { - int v = false; - if( m_Ptr!=NULL ) - v = *((int *)m_Ptr); - else if( m_GetCallback!=NULL ) - m_GetCallback(&v, m_ClientData); - if( v ) - v = false; - else - v = true; - if( m_Ptr!=NULL ) - *((int *)m_Ptr) = v; - else if( m_SetCallback!=NULL ) - m_SetCallback(&v, m_ClientData); - } - break; - case TW_TYPE_BOOLCPP: - { - bool v = false; - if( m_Ptr!=NULL ) - v = *((bool *)m_Ptr); - else if( m_GetCallback!=NULL ) - m_GetCallback(&v, m_ClientData); - if( v ) - v = false; - else - v = true; - if( m_Ptr!=NULL ) - *((bool *)m_Ptr) = v; - else if( m_SetCallback!=NULL ) - m_SetCallback(&v, m_ClientData); - } - break; - case TW_TYPE_CHAR: - { - unsigned char v = 0; - if( m_Ptr!=NULL ) - v = *((unsigned char *)m_Ptr); - else if( m_GetCallback!=NULL ) - m_GetCallback(&v, m_ClientData); - int iv = _Step*(int)m_Val.m_Char.m_Step + (int)v; - if( ivm_Val.m_Char.m_Max ) - iv = m_Val.m_Char.m_Max; - if( iv<0 ) - iv = 0; - else if( iv>0xff ) - iv = 0xff; - v = (unsigned char)iv; - if( m_Ptr!=NULL ) - *((unsigned char *)m_Ptr) = v; - else if( m_SetCallback!=NULL ) - m_SetCallback(&v, m_ClientData); - } - break; - case TW_TYPE_INT8: - { - signed char v = 0; - if( m_Ptr!=NULL ) - v = *((signed char *)m_Ptr); - else if( m_GetCallback!=NULL ) - m_GetCallback(&v, m_ClientData); - int iv = _Step*(int)m_Val.m_Int8.m_Step + (int)v; - if( ivm_Val.m_Int8.m_Max ) - iv = m_Val.m_Int8.m_Max; - v = (signed char)iv; - if( m_Ptr!=NULL ) - *((signed char *)m_Ptr) = v; - else if( m_SetCallback!=NULL ) - m_SetCallback(&v, m_ClientData); - } - break; - case TW_TYPE_UINT8: - { - unsigned char v = 0; - if( m_Ptr!=NULL ) - v = *((unsigned char *)m_Ptr); - else if( m_GetCallback!=NULL ) - m_GetCallback(&v, m_ClientData); - int iv = _Step*(int)m_Val.m_UInt8.m_Step + (int)v; - if( ivm_Val.m_UInt8.m_Max ) - iv = m_Val.m_UInt8.m_Max; - if( iv<0 ) - iv = 0; - else if( iv>0xff ) - iv = 0xff; - v = (unsigned char)iv; - if( m_Ptr!=NULL ) - *((unsigned char *)m_Ptr) = v; - else if( m_SetCallback!=NULL ) - m_SetCallback(&v, m_ClientData); - } - break; - case TW_TYPE_INT16: - { - short v = 0; - if( m_Ptr!=NULL ) - v = *((short *)m_Ptr); - else if( m_GetCallback!=NULL ) - m_GetCallback(&v, m_ClientData); - int iv = _Step*(int)m_Val.m_Int16.m_Step + (int)v; - if( ivm_Val.m_Int16.m_Max ) - iv = m_Val.m_Int16.m_Max; - v = (short)iv; - if( m_Ptr!=NULL ) - *((short *)m_Ptr) = v; - else if( m_SetCallback!=NULL ) - m_SetCallback(&v, m_ClientData); - } - break; - case TW_TYPE_UINT16: - { - unsigned short v = 0; - if( m_Ptr!=NULL ) - v = *((unsigned short *)m_Ptr); - else if( m_GetCallback!=NULL ) - m_GetCallback(&v, m_ClientData); - int iv = _Step*(int)m_Val.m_UInt16.m_Step + (int)v; - if( ivm_Val.m_UInt16.m_Max ) - iv = m_Val.m_UInt16.m_Max; - if( iv<0 ) - iv = 0; - else if( iv>0xffff ) - iv = 0xffff; - v = (unsigned short)iv; - if( m_Ptr!=NULL ) - *((unsigned short *)m_Ptr) = v; - else if( m_SetCallback!=NULL ) - m_SetCallback(&v, m_ClientData); - } - break; - case TW_TYPE_INT32: - { - int v = 0; - if( m_Ptr!=NULL ) - v = *((int *)m_Ptr); - else if( m_GetCallback!=NULL ) - m_GetCallback(&v, m_ClientData); - double dv = (double)_Step*(double)m_Val.m_Int32.m_Step + (double)v; - if( dv>(double)0x7fffffff ) - v = 0x7fffffff; - else if( dv<(double)(-0x7fffffff-1) ) - v = -0x7fffffff-1; - else - v = _Step*m_Val.m_Int32.m_Step + v; - if( vm_Val.m_Int32.m_Max ) - v = m_Val.m_Int32.m_Max; - if( m_Ptr!=NULL ) - *((int *)m_Ptr) = v; - else if( m_SetCallback!=NULL ) - m_SetCallback(&v, m_ClientData); - } - break; - case TW_TYPE_UINT32: - { - unsigned int v = 0; - if( m_Ptr!=NULL ) - v = *((unsigned int *)m_Ptr); - else if( m_GetCallback!=NULL ) - m_GetCallback(&v, m_ClientData); - double dv = (double)_Step*(double)m_Val.m_UInt32.m_Step + (double)v; - if( dv>(double)0xffffffff ) - v = 0xffffffff; - else if( dv<0 ) - v = 0; - else - v = _Step*m_Val.m_UInt32.m_Step + v; - if( vm_Val.m_UInt32.m_Max ) - v = m_Val.m_UInt32.m_Max; - if( m_Ptr!=NULL ) - *((unsigned int *)m_Ptr) = v; - else if( m_SetCallback!=NULL ) - m_SetCallback(&v, m_ClientData); - } - break; - case TW_TYPE_FLOAT: - { - float v = 0; - if( m_Ptr!=NULL ) - v = *((float *)m_Ptr); - else if( m_GetCallback!=NULL ) - m_GetCallback(&v, m_ClientData); - v += _Step*m_Val.m_Float32.m_Step; - if( vm_Val.m_Float32.m_Max ) - v = m_Val.m_Float32.m_Max; - if( m_Ptr!=NULL ) - *((float *)m_Ptr) = v; - else if( m_SetCallback!=NULL ) - m_SetCallback(&v, m_ClientData); - } - break; - case TW_TYPE_DOUBLE: - { - double v = 0; - if( m_Ptr!=NULL ) - v = *((double *)m_Ptr); - else if( m_GetCallback!=NULL ) - m_GetCallback(&v, m_ClientData); - v += _Step*m_Val.m_Float64.m_Step; - if( vm_Val.m_Float64.m_Max ) - v = m_Val.m_Float64.m_Max; - if( m_Ptr!=NULL ) - *((double *)m_Ptr) = v; - else if( m_SetCallback!=NULL ) - m_SetCallback(&v, m_ClientData); - } - break; - /* - case TW_TYPE_ENUM8: - { - assert(_Step==1 || _Step==-1); - unsigned char v = 0; - if( m_Ptr!=NULL ) - v = *((unsigned char *)m_Ptr); - else if( m_GetCallback!=NULL ) - m_GetCallback(&v, m_ClientData); - if( m_Val.m_Enum.m_Entries!=NULL ) - { - UVal::CEnumVal::CEntries::iterator It = m_Val.m_Enum.m_Entries->find(v); - if( It==m_Val.m_Enum.m_Entries->end() ) - It = m_Val.m_Enum.m_Entries->begin(); - else if( _Step==1 ) - { - ++It; - if( It==m_Val.m_Enum.m_Entries->end() ) - It = m_Val.m_Enum.m_Entries->begin(); - } - else if( _Step==-1 ) - { - if( It==m_Val.m_Enum.m_Entries->begin() ) - It = m_Val.m_Enum.m_Entries->end(); - if( It!=m_Val.m_Enum.m_Entries->begin() ) - --It; - } - if( It != m_Val.m_Enum.m_Entries->end() ) - { - v = (unsigned char)(It->first); - if( m_Ptr!=NULL ) - *((unsigned char *)m_Ptr) = v; - else if( m_SetCallback!=NULL ) - m_SetCallback(&v, m_ClientData); - } - } - } - break; - case TW_TYPE_ENUM16: - { - assert(_Step==1 || _Step==-1); - unsigned short v = 0; - if( m_Ptr!=NULL ) - v = *((unsigned short *)m_Ptr); - else if( m_GetCallback!=NULL ) - m_GetCallback(&v, m_ClientData); - if( m_Val.m_Enum.m_Entries!=NULL ) - { - UVal::CEnumVal::CEntries::iterator It = m_Val.m_Enum.m_Entries->find(v); - if( It==m_Val.m_Enum.m_Entries->end() ) - It = m_Val.m_Enum.m_Entries->begin(); - else if( _Step==1 ) - { - ++It; - if( It==m_Val.m_Enum.m_Entries->end() ) - It = m_Val.m_Enum.m_Entries->begin(); - } - else if( _Step==-1 ) - { - if( It==m_Val.m_Enum.m_Entries->begin() ) - It = m_Val.m_Enum.m_Entries->end(); - if( It!=m_Val.m_Enum.m_Entries->begin() ) - --It; - } - if( It != m_Val.m_Enum.m_Entries->end() ) - { - v = (unsigned short)(It->first); - if( m_Ptr!=NULL ) - *((unsigned short *)m_Ptr) = v; - else if( m_SetCallback!=NULL ) - m_SetCallback(&v, m_ClientData); - } - } - } - break; - case TW_TYPE_ENUM32: - { - assert(_Step==1 || _Step==-1); - unsigned int v = 0; - if( m_Ptr!=NULL ) - v = *((unsigned int *)m_Ptr); - else if( m_GetCallback!=NULL ) - m_GetCallback(&v, m_ClientData); - if( m_Val.m_Enum.m_Entries!=NULL ) - { - UVal::CEnumVal::CEntries::iterator It = m_Val.m_Enum.m_Entries->find(v); - if( It==m_Val.m_Enum.m_Entries->end() ) - It = m_Val.m_Enum.m_Entries->begin(); - else if( _Step==1 ) - { - ++It; - if( It==m_Val.m_Enum.m_Entries->end() ) - It = m_Val.m_Enum.m_Entries->begin(); - } - else if( _Step==-1 ) - { - if( It==m_Val.m_Enum.m_Entries->begin() ) - It = m_Val.m_Enum.m_Entries->end(); - if( It!=m_Val.m_Enum.m_Entries->begin() ) - --It; - } - if( It!=m_Val.m_Enum.m_Entries->end() ) - { - v = (unsigned int)(It->first); - if( m_Ptr!=NULL ) - *((unsigned int *)m_Ptr) = v; - else if( m_SetCallback!=NULL ) - m_SetCallback(&v, m_ClientData); - } - } - } - break; - */ - default: - if( m_Type==TW_TYPE_BUTTON ) - { - if( m_Val.m_Button.m_Callback!=NULL ) - { - m_Val.m_Button.m_Callback(m_ClientData); - if( g_TwMgr==NULL ) // Mgr might have been destroyed by the client inside a callback call - return; - } - } - else if( IsEnumType(m_Type) ) - { - assert(_Step==1 || _Step==-1); - unsigned int v = 0; - if( m_Ptr!=NULL ) - v = *((unsigned int *)m_Ptr); - else if( m_GetCallback!=NULL ) - m_GetCallback(&v, m_ClientData); - CTwMgr::CEnum& e = g_TwMgr->m_Enums[m_Type-TW_TYPE_ENUM_BASE]; - CTwMgr::CEnum::CEntries::iterator It = e.m_Entries.find(v); - if( It==e.m_Entries.end() ) - It = e.m_Entries.begin(); - else if( _Step==1 ) - { - ++It; - if( It==e.m_Entries.end() ) - It = e.m_Entries.begin(); - } - else if( _Step==-1 ) - { - if( It==e.m_Entries.begin() ) - It = e.m_Entries.end(); - if( It!=e.m_Entries.begin() ) - --It; - } - if( It!=e.m_Entries.end() ) - { - v = (unsigned int)(It->first); - if( m_Ptr!=NULL ) - *((unsigned int *)m_Ptr) = v; - else if( m_SetCallback!=NULL ) - m_SetCallback(&v, m_ClientData); - } - } - else - fprintf(stderr, "CTwVarAtom::Increment : unknown or unimplemented type\n"); - } -} - -// --------------------------------------------------------------------------- - -void CTwVarAtom::SetDefaults() -{ - switch( m_Type ) - { - case TW_TYPE_BOOL8: - case TW_TYPE_BOOL16: - case TW_TYPE_BOOL32: - case TW_TYPE_BOOLCPP: - m_NoSlider = true; - break; - case TW_TYPE_CHAR: - m_Val.m_Char.m_Max = 0xff; - m_Val.m_Char.m_Min = 0; - m_Val.m_Char.m_Step = 1; - m_Val.m_Char.m_Precision = -1; - m_Val.m_Char.m_Hexa = false; - break; - case TW_TYPE_INT8: - m_Val.m_Int8.m_Max = 0x7f; - m_Val.m_Int8.m_Min = -m_Val.m_Int8.m_Max-1; - m_Val.m_Int8.m_Step = 1; - m_Val.m_Int8.m_Precision = -1; - m_Val.m_Int8.m_Hexa = false; - break; - case TW_TYPE_UINT8: - m_Val.m_UInt8.m_Max = 0xff; - m_Val.m_UInt8.m_Min = 0; - m_Val.m_UInt8.m_Step = 1; - m_Val.m_UInt8.m_Precision = -1; - m_Val.m_UInt8.m_Hexa = false; - break; - case TW_TYPE_INT16: - m_Val.m_Int16.m_Max = 0x7fff; - m_Val.m_Int16.m_Min = -m_Val.m_Int16.m_Max-1; - m_Val.m_Int16.m_Step = 1; - m_Val.m_Int16.m_Precision = -1; - m_Val.m_Int16.m_Hexa = false; - break; - case TW_TYPE_UINT16: - m_Val.m_UInt16.m_Max = 0xffff; - m_Val.m_UInt16.m_Min = 0; - m_Val.m_UInt16.m_Step = 1; - m_Val.m_UInt16.m_Precision = -1; - m_Val.m_UInt16.m_Hexa = false; - break; - case TW_TYPE_INT32: - m_Val.m_Int32.m_Max = 0x7fffffff; - m_Val.m_Int32.m_Min = -m_Val.m_Int32.m_Max-1; - m_Val.m_Int32.m_Step = 1; - m_Val.m_Int32.m_Precision = -1; - m_Val.m_Int32.m_Hexa = false; - break; - case TW_TYPE_UINT32: - m_Val.m_UInt32.m_Max = 0xffffffff; - m_Val.m_UInt32.m_Min = 0; - m_Val.m_UInt32.m_Step = 1; - m_Val.m_UInt32.m_Precision = -1; - m_Val.m_UInt32.m_Hexa = false; - break; - case TW_TYPE_FLOAT: - m_Val.m_Float32.m_Max = FLOAT_MAX; - m_Val.m_Float32.m_Min = -FLOAT_MAX; - m_Val.m_Float32.m_Step = 1; - m_Val.m_Float32.m_Precision = -1; - m_Val.m_Float32.m_Hexa = false; - break; - case TW_TYPE_DOUBLE: - m_Val.m_Float64.m_Max = DOUBLE_MAX; - m_Val.m_Float64.m_Min = -DOUBLE_MAX; - m_Val.m_Float64.m_Step = 1; - m_Val.m_Float64.m_Precision = -1; - m_Val.m_Float64.m_Hexa = false; - break; - case TW_TYPE_CDSTRING: - case TW_TYPE_STDSTRING: - m_NoSlider = true; - break; - /* - case TW_TYPE_ENUM8: - case TW_TYPE_ENUM16: - case TW_TYPE_ENUM32: - m_NoSlider = true; - break; - */ - default: - {} // nothing - } - - // special types - if( m_Type==TW_TYPE_BUTTON - || IsEnumType(m_Type) // (m_Type>=TW_TYPE_ENUM_BASE && m_Typem_Enums.size()) - || IsCSStringType(m_Type) // (m_Type>=TW_TYPE_CSSTRING_BASE && m_Type<=TW_TYPE_CSSTRING_MAX) - || m_Type==TW_TYPE_CDSTDSTRING - || IsCustom() ) // (m_Type>=TW_TYPE_CUSTOM_BASE && m_Typem_Customs.size()) ) - m_NoSlider = true; -} - -// --------------------------------------------------------------------------- - -/* -int CTwVarAtom::DefineEnum(const TwEnumVal *_EnumValues, unsigned int _NbValues) -{ - assert(_EnumValues!=NULL); - if( m_Type!=TW_TYPE_ENUM8 && m_Type!=TW_TYPE_ENUM16 && m_Type!=TW_TYPE_ENUM32 ) - { - g_TwMgr->SetLastError(g_ErrNotEnum); - return 0; - } - if( m_Val.m_Enum.m_Entries==NULL ) - m_Val.m_Enum.m_Entries = new UVal::CEnumVal::CEntries; - for(unsigned int i=0; i<_NbValues; ++i) - { - UVal::CEnumVal::CEntries::value_type Entry(_EnumValues[i].Value, (_EnumValues[i].Label!=NULL)?_EnumValues[i].Label:""); - pair Result = m_Val.m_Enum.m_Entries->insert(Entry); - if( !Result.second ) - (Result.first)->second = Entry.second; - } - return 1; -} -*/ - -// --------------------------------------------------------------------------- - -enum EVarGroupAttribs -{ - VG_OPEN = V_ENDTAG+1, // for backward compatibility - VG_CLOSE, // for backward compatibility - VG_OPENED, - VG_TYPEID, // used internally for structs - VG_VALPTR, // used internally for structs - VG_ALPHA, // for backward compatibility - VG_NOALPHA, // for backward compatibility - VG_COLORALPHA, // tw_type_color* only - VG_HLS, // for backward compatibility - VG_RGB, // for backward compatibility - VG_COLORMODE, // tw_type_color* only - VG_COLORORDER, // tw_type_color* only - VG_ARROW, // tw_type_quat* only - VG_ARROWCOLOR, // tw_type_quat* only - VG_AXISX, // tw_type_quat* only - VG_AXISY, // tw_type_quat* only - VG_AXISZ, // tw_type_quat* only - VG_SHOWVAL // tw_type_quat* only -}; - -int CTwVarGroup::HasAttrib(const char *_Attrib, bool *_HasValue) const -{ - *_HasValue = false; - if( _stricmp(_Attrib, "open")==0 ) // for backward compatibility - return VG_OPEN; - else if( _stricmp(_Attrib, "close")==0 ) // for backward compatibility - return VG_CLOSE; - else if( _stricmp(_Attrib, "opened")==0 ) - { - *_HasValue = true; - return VG_OPENED; - } - else if( _stricmp(_Attrib, "typeid")==0 ) - { - *_HasValue = true; - return VG_TYPEID; - } - else if( _stricmp(_Attrib, "valptr")==0 ) - { - *_HasValue = true; - return VG_VALPTR; - } - else if( _stricmp(_Attrib, "alpha")==0 ) // for backward compatibility - return VG_ALPHA; - else if( _stricmp(_Attrib, "noalpha")==0 ) // for backward compatibility - return VG_NOALPHA; - else if( _stricmp(_Attrib, "coloralpha")==0 ) - { - *_HasValue = true; - return VG_COLORALPHA; - } - else if( _stricmp(_Attrib, "hls")==0 ) // for backward compatibility - return VG_HLS; - else if( _stricmp(_Attrib, "rgb")==0 ) // for backward compatibility - return VG_RGB; - else if( _stricmp(_Attrib, "colormode")==0 ) - { - *_HasValue = true; - return VG_COLORMODE; - } - else if( _stricmp(_Attrib, "colororder")==0 ) - { - *_HasValue = true; - return VG_COLORORDER; - } - else if( _stricmp(_Attrib, "arrow")==0 ) - { - *_HasValue = true; - return VG_ARROW; - } - else if( _stricmp(_Attrib, "arrowcolor")==0 ) - { - *_HasValue = true; - return VG_ARROWCOLOR; - } - else if( _stricmp(_Attrib, "axisx")==0 ) - { - *_HasValue = true; - return VG_AXISX; - } - else if( _stricmp(_Attrib, "axisy")==0 ) - { - *_HasValue = true; - return VG_AXISY; - } - else if( _stricmp(_Attrib, "axisz")==0 ) - { - *_HasValue = true; - return VG_AXISZ; - } - else if( _stricmp(_Attrib, "showval")==0 ) - { - *_HasValue = true; - return VG_SHOWVAL; - } - - return CTwVar::HasAttrib(_Attrib, _HasValue); -} - -int CTwVarGroup::SetAttrib(int _AttribID, const char *_Value, TwBar *_Bar, struct CTwVarGroup *_VarParent, int _VarIndex) -{ - switch( _AttribID ) - { - case VG_OPEN: // for backward compatibility - if( !m_Open ) - { - m_Open = true; - _Bar->NotUpToDate(); - } - return 1; - case VG_CLOSE: // for backward compatibility - if( m_Open ) - { - m_Open = false; - _Bar->NotUpToDate(); - } - return 1; - case VG_OPENED: - if( _Value!=NULL && strlen(_Value)>0 ) - { - if( _stricmp(_Value, "true")==0 || _stricmp(_Value, "1")==0 ) - { - if( !m_Open ) - { - m_Open = true; - _Bar->NotUpToDate(); - } - return 1; - } - else if( _stricmp(_Value, "false")==0 || _stricmp(_Value, "0")==0 ) - { - if( m_Open ) - { - m_Open = false; - _Bar->NotUpToDate(); - } - return 1; - } - else - { - g_TwMgr->SetLastError(g_ErrBadValue); - return 0; - } - } - else - { - g_TwMgr->SetLastError(g_ErrNoValue); - return 0; - } - case VG_TYPEID: - { - int type = TW_TYPE_UNDEF; - if( _Value!=NULL && sscanf(_Value, "%d", &type)==1 ) - { - int idx = type - TW_TYPE_STRUCT_BASE; - if( idx>=0 && idx<(int)g_TwMgr->m_Structs.size() ) - { - m_SummaryCallback = g_TwMgr->m_Structs[idx].m_SummaryCallback; - m_SummaryClientData = g_TwMgr->m_Structs[idx].m_SummaryClientData; - m_StructType = (TwType)type; - return 1; - } - } - return 0; - } - case VG_VALPTR: - { - void *structValuePtr = NULL; - if( _Value!=NULL && sscanf(_Value, "%p", &structValuePtr)==1 ) - { - m_StructValuePtr = structValuePtr; - m_ColorPtr = &(_Bar->m_ColStructText); - return 1; - } - return 0; - } - case VG_ALPHA: // for backward compatibility - if( m_SummaryCallback==CColorExt::SummaryCB && m_StructValuePtr!=NULL ) // is tw_type_color? - if( static_cast(m_StructValuePtr)->m_CanHaveAlpha ) - { - static_cast(m_StructValuePtr)->m_HasAlpha = true; - _Bar->NotUpToDate(); - return 1; - } - return 0; - case VG_NOALPHA: // for backward compatibility - if( m_SummaryCallback==CColorExt::SummaryCB && m_StructValuePtr!=NULL ) // is tw_type_color? - { - static_cast(m_StructValuePtr)->m_HasAlpha = false; - _Bar->NotUpToDate(); - return 1; - } - else - return 0; - case VG_COLORALPHA: - if( _Value!=NULL && strlen(_Value)>0 ) - { - if( m_SummaryCallback==CColorExt::SummaryCB && m_StructValuePtr!=NULL ) // is tw_type_color? - { - if( _stricmp(_Value, "true")==0 || _stricmp(_Value, "1")==0 ) - { - if( static_cast(m_StructValuePtr)->m_CanHaveAlpha ) - { - if( !static_cast(m_StructValuePtr)->m_HasAlpha ) - { - static_cast(m_StructValuePtr)->m_HasAlpha = true; - _Bar->NotUpToDate(); - } - return 1; - } - } - else if( _stricmp(_Value, "false")==0 || _stricmp(_Value, "0")==0 ) - { - if( static_cast(m_StructValuePtr)->m_HasAlpha ) - { - static_cast(m_StructValuePtr)->m_HasAlpha = false; - _Bar->NotUpToDate(); - } - return 1; - } - } - } - return 0; - case VG_HLS: // for backward compatibility - if( m_SummaryCallback==CColorExt::SummaryCB && m_StructValuePtr!=NULL ) // is tw_type_color? - { - static_cast(m_StructValuePtr)->m_HLS = true; - _Bar->NotUpToDate(); - return 1; - } - else - return 0; - case VG_RGB: // for backward compatibility - if( m_SummaryCallback==CColorExt::SummaryCB && m_StructValuePtr!=NULL ) // is tw_type_color? - { - static_cast(m_StructValuePtr)->m_HLS = false; - _Bar->NotUpToDate(); - return 1; - } - else - return 0; - case VG_COLORMODE: - if( _Value!=NULL && strlen(_Value)>0 ) - { - if( m_SummaryCallback==CColorExt::SummaryCB && m_StructValuePtr!=NULL ) // is tw_type_color? - { - if( _stricmp(_Value, "hls")==0 ) - { - if( !static_cast(m_StructValuePtr)->m_HLS ) - { - static_cast(m_StructValuePtr)->m_HLS = true; - _Bar->NotUpToDate(); - } - return 1; - } - else if( _stricmp(_Value, "rgb")==0 ) - { - if( static_cast(m_StructValuePtr)->m_HLS ) - { - static_cast(m_StructValuePtr)->m_HLS = false; - _Bar->NotUpToDate(); - } - return 1; - } - } - } - return 0; - case VG_COLORORDER: - if( m_SummaryCallback==CColorExt::SummaryCB && m_StructValuePtr!=NULL ) // is tw_type_color? - { - if( _Value!=NULL ) - { - if( _stricmp(_Value, "rgba")==0 ) - static_cast(m_StructValuePtr)->m_OGL = true; - else if( _stricmp(_Value, "argb")==0 ) - static_cast(m_StructValuePtr)->m_OGL = false; - else - return 0; - return 1; - } - return 0; - } - else - return 0; - case VG_ARROW: - if( m_SummaryCallback==CQuaternionExt::SummaryCB && m_StructValuePtr!=NULL ) // is tw_type_quat? - { - if( _Value!=NULL ) - { - double *dir = static_cast(m_StructValuePtr)->m_Dir; - double x, y, z; - if( sscanf(_Value, "%lf %lf %lf", &x, &y, &z)==3 ) - { - dir[0] = x; - dir[1] = y; - dir[2] = z; - } - else if( _stricmp(_Value, "off")==0 || _stricmp(_Value, "0")==0 ) - dir[0] = dir[1] = dir[2] = 0; - else - return 0; - return 1; - } - return 0; - } - else - return 0; - case VG_ARROWCOLOR: - if( m_SummaryCallback==CQuaternionExt::SummaryCB && m_StructValuePtr!=NULL ) // is tw_type_quat? - { - if( _Value!=NULL ) - { - int r, g, b; - if( sscanf(_Value, "%d %d %d", &r, &g, &b)==3 ) - static_cast(m_StructValuePtr)->m_DirColor = Color32FromARGBi(255, r, g, b); - else - return 0; - return 1; - } - return 0; - } - else - return 0; - case VG_AXISX: - case VG_AXISY: - case VG_AXISZ: - if( m_SummaryCallback==CQuaternionExt::SummaryCB && m_StructValuePtr!=NULL ) // is tw_type_quat? - { - if( _Value!=NULL ) - { - float x = 0, y = 0, z = 0; - if( _stricmp(_Value, "x")==0 || _stricmp(_Value, "+x")==0 ) - x = 1; - else if( _stricmp(_Value, "-x")==0 ) - x = -1; - else if( _stricmp(_Value, "y")==0 || _stricmp(_Value, "+y")==0 ) - y = 1; - else if( _stricmp(_Value, "-y")==0 ) - y = -1; - else if( _stricmp(_Value, "z")==0 || _stricmp(_Value, "+z")==0 ) - z = 1; - else if( _stricmp(_Value, "-z")==0 ) - z = -1; - else - return 0; - int i = (_AttribID==VG_AXISX) ? 0 : ((_AttribID==VG_AXISY) ? 1 : 2); - static_cast(m_StructValuePtr)->m_Permute[i][0] = x; - static_cast(m_StructValuePtr)->m_Permute[i][1] = y; - static_cast(m_StructValuePtr)->m_Permute[i][2] = z; - return 1; - } - return 0; - } - else - return 0; - case VG_SHOWVAL: - if( m_SummaryCallback==CQuaternionExt::SummaryCB && m_StructValuePtr!=NULL ) // is tw_type_quat? - { - if( _Value!=NULL ) - { - if( _stricmp(_Value, "true")==0 || _stricmp(_Value, "on")==0 || _stricmp(_Value, "1")==0 ) - { - static_cast(m_StructValuePtr)->m_ShowVal = true; - _Bar->NotUpToDate(); - return 1; - } - else if( _stricmp(_Value, "false")==0 || _stricmp(_Value, "off")==0 || _stricmp(_Value, "0")==0 ) - { - static_cast(m_StructValuePtr)->m_ShowVal = false; - _Bar->NotUpToDate(); - return 1; - } - } - return 0; - } - else - return 0; - default: - return CTwVar::SetAttrib(_AttribID, _Value, _Bar, _VarParent, _VarIndex); - } -} - -ERetType CTwVarGroup::GetAttrib(int _AttribID, TwBar *_Bar, struct CTwVarGroup *_VarParent, int _VarIndex, std::vector& outDoubles, std::ostringstream& outString) const -{ - outDoubles.clear(); - outString.clear(); - - switch( _AttribID ) - { - case VG_OPENED: - outDoubles.push_back( m_Open ); - return RET_DOUBLE; - case VG_COLORALPHA: - if( m_SummaryCallback==CColorExt::SummaryCB && m_StructValuePtr!=NULL ) // is tw_type_color? - { - outDoubles.push_back( static_cast(m_StructValuePtr)->m_HasAlpha ); - return RET_DOUBLE; - } - g_TwMgr->SetLastError(g_ErrInvalidAttrib); - return RET_ERROR; - case VG_COLORMODE: - if( m_SummaryCallback==CColorExt::SummaryCB && m_StructValuePtr!=NULL ) // is tw_type_color? - { - if( static_cast(m_StructValuePtr)->m_HLS ) - outString << "hls"; - else - outString << "rgb"; - return RET_STRING; - } - g_TwMgr->SetLastError(g_ErrInvalidAttrib); - return RET_ERROR; - case VG_COLORORDER: - if( m_SummaryCallback==CColorExt::SummaryCB && m_StructValuePtr!=NULL ) // is tw_type_color? - { - if( static_cast(m_StructValuePtr)->m_OGL ) - outString << "rgba"; - else - outString << "argb"; - return RET_STRING; - } - g_TwMgr->SetLastError(g_ErrInvalidAttrib); - return RET_ERROR; - case VG_ARROW: - if( m_SummaryCallback==CQuaternionExt::SummaryCB && m_StructValuePtr!=NULL ) // is tw_type_quat? - { - double *dir = static_cast(m_StructValuePtr)->m_Dir; - outDoubles.push_back(dir[0]); - outDoubles.push_back(dir[1]); - outDoubles.push_back(dir[2]); - return RET_DOUBLE; - } - g_TwMgr->SetLastError(g_ErrInvalidAttrib); - return RET_ERROR; - case VG_ARROWCOLOR: - if( m_SummaryCallback==CQuaternionExt::SummaryCB && m_StructValuePtr!=NULL ) // is tw_type_quat? - { - int a, r, g, b; - a = r = g = b = 0; - Color32ToARGBi(static_cast(m_StructValuePtr)->m_DirColor, &a, &r, &g, &b); - outDoubles.push_back(r); - outDoubles.push_back(g); - outDoubles.push_back(b); - return RET_DOUBLE; - } - g_TwMgr->SetLastError(g_ErrInvalidAttrib); - return RET_ERROR; - case VG_AXISX: - case VG_AXISY: - case VG_AXISZ: - if( m_SummaryCallback==CQuaternionExt::SummaryCB && m_StructValuePtr!=NULL ) // is tw_type_quat? - { - int i = (_AttribID==VG_AXISX) ? 0 : ((_AttribID==VG_AXISY) ? 1 : 2); - float x = static_cast(m_StructValuePtr)->m_Permute[i][0]; - float y = static_cast(m_StructValuePtr)->m_Permute[i][1]; - float z = static_cast(m_StructValuePtr)->m_Permute[i][2]; - if( x>0 ) - outString << "+x"; - else if( x<0 ) - outString << "-x"; - else if( y>0 ) - outString << "+y"; - else if( y<0 ) - outString << "-y"; - else if( z>0 ) - outString << "+z"; - else if( z<0 ) - outString << "-z"; - else - outString << "0"; // should not happened - return RET_DOUBLE; - } - g_TwMgr->SetLastError(g_ErrInvalidAttrib); - return RET_ERROR; - case VG_SHOWVAL: - if( m_SummaryCallback==CQuaternionExt::SummaryCB && m_StructValuePtr!=NULL ) // is tw_type_quat? - { - outDoubles.push_back( static_cast(m_StructValuePtr)->m_ShowVal ); - return RET_DOUBLE; - } - g_TwMgr->SetLastError(g_ErrInvalidAttrib); - return RET_ERROR; - default: - return CTwVar::GetAttrib(_AttribID, _Bar, _VarParent, _VarIndex, outDoubles, outString); - } -} - -// --------------------------------------------------------------------------- - -const CTwVar *CTwVarGroup::Find(const char *_Name, CTwVarGroup **_Parent, int *_Index) const -{ - if( strcmp(_Name, m_Name.c_str())==0 ) - { - if( _Parent!=NULL ) - *_Parent = NULL; - if( _Index!=NULL ) - *_Index = -1; - return this; - } - else - { - const CTwVar *v; - for( size_t i=0; iFind(_Name, _Parent, _Index); - if( v!=NULL ) - { - if( _Parent!=NULL && *_Parent==NULL ) - { - *_Parent = const_cast(this); - if( _Index!=NULL ) - *_Index = (int)i; - } - return v; - } - } - return NULL; - } -} - -// --------------------------------------------------------------------------- - -size_t CTwVar::GetDataSize(TwType _Type) -{ - switch( _Type ) - { - case TW_TYPE_BOOLCPP: - return sizeof(bool); - case TW_TYPE_BOOL8: - case TW_TYPE_CHAR: - case TW_TYPE_INT8: - case TW_TYPE_UINT8: - //case TW_TYPE_ENUM8: - return 1; - case TW_TYPE_BOOL16: - case TW_TYPE_INT16: - case TW_TYPE_UINT16: - //case TW_TYPE_ENUM16: - return 2; - case TW_TYPE_BOOL32: - case TW_TYPE_INT32: - case TW_TYPE_UINT32: - case TW_TYPE_FLOAT: - //case TW_TYPE_ENUM32: - return 4; - case TW_TYPE_DOUBLE: - return 8; - case TW_TYPE_CDSTRING: - return sizeof(char *); - case TW_TYPE_STDSTRING: - return (g_TwMgr!=0) ? g_TwMgr->m_ClientStdStringStructSize : sizeof(std::string); - default: - if( g_TwMgr && _Type>=TW_TYPE_STRUCT_BASE && _Typem_Structs.size() ) - { - const CTwMgr::CStruct& s = g_TwMgr->m_Structs[_Type-TW_TYPE_STRUCT_BASE]; - return s.m_Size; - /* - size_t size = 0; - for( size_t i=0; im_ClientStdStringStructSize : sizeof(std::string); - else // includes TW_TYPE_BUTTON - return 0; - } -} - -// --------------------------------------------------------------------------- - -CTwBar::CTwBar(const char *_Name) -{ - assert(g_TwMgr!=NULL && g_TwMgr->m_Graph!=NULL); - - m_Name = _Name; - m_Visible = true; - m_VarRoot.m_IsRoot = true; - m_VarRoot.m_Open = true; - m_VarRoot.m_SummaryCallback = NULL; - m_VarRoot.m_SummaryClientData = NULL; - m_VarRoot.m_StructValuePtr = NULL; - - m_UpToDate = false; - int n = (int)g_TwMgr->m_Bars.size(); - m_PosX = 24*n-8; - m_PosY = 24*n-8; - m_Width = 200; - m_Height = 320; - int cr, cg, cb; - if( g_TwMgr->m_UseOldColorScheme ) - { - ColorHLSToRGBi(g_TwMgr->m_BarInitColorHue%256, 180, 200, &cr, &cg, &cb); - m_Color = Color32FromARGBi(0xf0, cr, cg, cb); - m_DarkText = true; - } - else - { - ColorHLSToRGBi(g_TwMgr->m_BarInitColorHue%256, 80, 200, &cr, &cg, &cb); - m_Color = Color32FromARGBi(64, cr, cg, cb); - m_DarkText = false; - } - g_TwMgr->m_BarInitColorHue -= 16; - if( g_TwMgr->m_BarInitColorHue<0 ) - g_TwMgr->m_BarInitColorHue += 256; - m_Font = g_TwMgr->m_CurrentFont; - //m_Font = g_DefaultNormalFont; - //m_Font = g_DefaultSmallFont; - //m_Font = g_DefaultLargeFont; - m_TitleWidth = 0; - m_Sep = 1; -//#pragma warning "lineSep WIP" - m_LineSep = 1; - m_ValuesWidth = 10*(m_Font->m_CharHeight/2); // about 10 characters - m_NbHierLines = 0; - m_NbDisplayedLines = 0; - m_FirstLine = 0; - m_LastUpdateTime = 0; - m_UpdatePeriod = 2; - m_ScrollYW = 0; - m_ScrollYH = 0; - m_ScrollY0 = 0; - m_ScrollY1 = 0; - - m_DrawHandles = false; - m_DrawIncrDecrBtn = false; - m_DrawRotoBtn = false; - m_DrawClickBtn = false; - m_DrawListBtn = false; - m_DrawBoolBtn = false; - m_MouseDrag = false; - m_MouseDragVar = false; - m_MouseDragTitle = false; - m_MouseDragScroll = false; - m_MouseDragResizeUR = false; - m_MouseDragResizeUL = false; - m_MouseDragResizeLR = false; - m_MouseDragResizeLL = false; - m_MouseDragValWidth = false; - m_MouseOriginX = 0; - m_MouseOriginY = 0; - m_ValuesWidthRatio = 0; - m_VarHasBeenIncr = true; - m_FirstLine0 = 0; - m_HighlightedLine = -1; - m_HighlightedLinePrev = -1; - m_HighlightedLineLastValid = -1; - m_HighlightIncrBtn = false; - m_HighlightDecrBtn = false; - m_HighlightRotoBtn = false; - m_HighlightClickBtn = false; - m_HighlightClickBtnAuto = 0; - m_HighlightListBtn = false; - m_HighlightBoolBtn = false; - m_HighlightTitle = false; - m_HighlightScroll = false; - m_HighlightUpScroll = false; - m_HighlightDnScroll = false; - m_HighlightMinimize = false; - m_HighlightFont = false; - m_HighlightValWidth = false; - m_HighlightLabelsHeader = false; - m_HighlightValuesHeader = false; - m_ButtonAlign = g_TwMgr->m_ButtonAlign; - - m_IsMinimized = false; - m_MinNumber = 0; - m_MinPosX = 0; - m_MinPosY = 0; - m_HighlightMaximize = false; - m_IsHelpBar = false; - m_IsPopupList = false; - m_VarEnumLinkedToPopupList = NULL; - m_BarLinkedToPopupList = NULL; - - m_Resizable = true; - m_Movable = true; - m_Iconifiable = true; - m_Contained = g_TwMgr->m_Contained; - - m_TitleTextObj = g_TwMgr->m_Graph->NewTextObj(); - m_LabelsTextObj = g_TwMgr->m_Graph->NewTextObj(); - m_ValuesTextObj = g_TwMgr->m_Graph->NewTextObj(); - m_ShortcutTextObj = g_TwMgr->m_Graph->NewTextObj(); - m_HeadersTextObj = g_TwMgr->m_Graph->NewTextObj(); - m_ShortcutLine = -1; - - m_RotoMinRadius = 24; - m_RotoNbSubdiv = 256; // number of steps for one turn - - m_CustomActiveStructProxy = NULL; - - UpdateColors(); - NotUpToDate(); -} - -// --------------------------------------------------------------------------- - -CTwBar::~CTwBar() -{ - if( m_IsMinimized ) - g_TwMgr->Maximize(this); - if( m_TitleTextObj ) - g_TwMgr->m_Graph->DeleteTextObj(m_TitleTextObj); - if( m_LabelsTextObj ) - g_TwMgr->m_Graph->DeleteTextObj(m_LabelsTextObj); - if( m_ValuesTextObj ) - g_TwMgr->m_Graph->DeleteTextObj(m_ValuesTextObj); - if( m_ShortcutTextObj ) - g_TwMgr->m_Graph->DeleteTextObj(m_ShortcutTextObj); - if( m_HeadersTextObj ) - g_TwMgr->m_Graph->DeleteTextObj(m_HeadersTextObj); -} - -// --------------------------------------------------------------------------- - -const CTwVar *CTwBar::Find(const char *_Name, CTwVarGroup **_Parent, int *_Index) const -{ - return m_VarRoot.Find(_Name, _Parent, _Index); -} - -CTwVar *CTwBar::Find(const char *_Name, CTwVarGroup **_Parent, int *_Index) -{ - return const_cast(const_cast(this)->Find(_Name, _Parent, _Index)); -} - -// --------------------------------------------------------------------------- - -enum EBarAttribs -{ - BAR_LABEL = 1, - BAR_HELP, - BAR_COLOR, - BAR_ALPHA, - BAR_TEXT, - BAR_SHOW, // deprecated, used BAR_VISIBLE instead - BAR_HIDE, // deprecated, used BAR_VISIBLE instead - BAR_ICONIFY, // deprecated, used BAR_ICONIFIED instead - BAR_VISIBLE, - BAR_ICONIFIED, - BAR_SIZE, - BAR_POSITION, - BAR_REFRESH, - BAR_FONT_SIZE, - BAR_FONT_STYLE, - BAR_VALUES_WIDTH, - BAR_ICON_POS, - BAR_ICON_ALIGN, - BAR_ICON_MARGIN, - BAR_RESIZABLE, - BAR_MOVABLE, - BAR_ICONIFIABLE, - BAR_FONT_RESIZABLE, - BAR_ALWAYS_TOP, - BAR_ALWAYS_BOTTOM, - BAR_COLOR_SCHEME, - BAR_CONTAINED, - BAR_BUTTON_ALIGN -}; - -int CTwBar::HasAttrib(const char *_Attrib, bool *_HasValue) const -{ - *_HasValue = true; - if( _stricmp(_Attrib, "label")==0 ) - return BAR_LABEL; - else if( _stricmp(_Attrib, "help")==0 ) - return BAR_HELP; - else if( _stricmp(_Attrib, "color")==0 ) - return BAR_COLOR; - else if( _stricmp(_Attrib, "alpha")==0 ) - return BAR_ALPHA; - else if( _stricmp(_Attrib, "text")==0 ) - return BAR_TEXT; - else if( _stricmp(_Attrib, "size")==0 ) - return BAR_SIZE; - else if( _stricmp(_Attrib, "position")==0 ) - return BAR_POSITION; - else if( _stricmp(_Attrib, "refresh")==0 ) - return BAR_REFRESH; - else if( _stricmp(_Attrib, "fontsize")==0 ) - return BAR_FONT_SIZE; - else if( _stricmp(_Attrib, "fontstyle")==0 ) - return BAR_FONT_STYLE; - else if( _stricmp(_Attrib, "valueswidth")==0 ) - return BAR_VALUES_WIDTH; - else if( _stricmp(_Attrib, "iconpos")==0 ) - return BAR_ICON_POS; - else if( _stricmp(_Attrib, "iconalign")==0 ) - return BAR_ICON_ALIGN; - else if( _stricmp(_Attrib, "iconmargin")==0 ) - return BAR_ICON_MARGIN; - else if( _stricmp(_Attrib, "resizable")==0 ) - return BAR_RESIZABLE; - else if( _stricmp(_Attrib, "movable")==0 ) - return BAR_MOVABLE; - else if( _stricmp(_Attrib, "iconifiable")==0 ) - return BAR_ICONIFIABLE; - else if( _stricmp(_Attrib, "fontresizable")==0 ) - return BAR_FONT_RESIZABLE; - else if( _stricmp(_Attrib, "alwaystop")==0 ) - return BAR_ALWAYS_TOP; - else if( _stricmp(_Attrib, "alwaysbottom")==0 ) - return BAR_ALWAYS_BOTTOM; - else if( _stricmp(_Attrib, "visible")==0 ) - return BAR_VISIBLE; - else if( _stricmp(_Attrib, "iconified")==0 ) - return BAR_ICONIFIED; - else if( _stricmp(_Attrib, "colorscheme")==0 ) - return BAR_COLOR_SCHEME; - else if( _stricmp(_Attrib, "contained")==0 ) - return BAR_CONTAINED; - else if( _stricmp(_Attrib, "buttonalign")==0 ) - return BAR_BUTTON_ALIGN; - - *_HasValue = false; - if( _stricmp(_Attrib, "show")==0 ) // for backward compatibility - return BAR_SHOW; - else if( _stricmp(_Attrib, "hide")==0 ) // for backward compatibility - return BAR_HIDE; - else if( _stricmp(_Attrib, "iconify")==0 ) // for backward compatibility - return BAR_ICONIFY; - - return 0; // not found -} - -int CTwBar::SetAttrib(int _AttribID, const char *_Value) -{ - switch( _AttribID ) - { - case BAR_LABEL: - if( _Value && strlen(_Value)>0 ) - { - m_Label = _Value; - NotUpToDate(); - return 1; - } - else - { - g_TwMgr->SetLastError(g_ErrNoValue); - return 0; - } - case BAR_HELP: - if( _Value && strlen(_Value)>0 ) - { - m_Help = _Value; - NotUpToDate(); - return 1; - } - else - { - g_TwMgr->SetLastError(g_ErrNoValue); - return 0; - } - case BAR_COLOR: - if( _Value && strlen(_Value)>0 ) - { - int v0, v1, v2, v3; - int n = sscanf(_Value, "%d%d%d%d", &v0, &v1, &v2, &v3); - color32 c; - int alpha = (m_Color>>24) & 0xff; - if( n==3 && v0>=0 && v0<=255 && v1>=0 && v1<=255 && v2>=0 && v2<=255 ) - c = Color32FromARGBi(alpha, v0, v1, v2); - else if( n==4 && v0>=0 && v0<=255 && v1>=0 && v1<=255 && v2>=0 && v2<=255 && v3>=0 && v3<=255 ) - c = Color32FromARGBi(v0, v1, v2, v3); - else - { - g_TwMgr->SetLastError(g_ErrBadValue); - return 0; - } - m_Color = c; - NotUpToDate(); - return 1; - } - else - { - g_TwMgr->SetLastError(g_ErrNoValue); - return 0; - } - case BAR_ALPHA: - if( _Value && strlen(_Value)>0 ) - { - int alpha = 255; - int n = sscanf(_Value, "%d", &alpha); - if( n==1 && alpha>=0 && alpha<=255 ) - m_Color = (alpha<<24) | (m_Color & 0xffffff); - else - { - g_TwMgr->SetLastError(g_ErrBadValue); - return 0; - } - NotUpToDate(); - return 1; - } - else - { - g_TwMgr->SetLastError(g_ErrNoValue); - return 0; - } - case BAR_TEXT: - if( _Value && strlen(_Value)>0 ) - { - if( _stricmp(_Value, "dark")==0 ) - m_DarkText = true; - else if( _stricmp(_Value, "light")==0 ) - m_DarkText = false; - else - { - g_TwMgr->SetLastError(g_ErrBadValue); - return 0; - } - NotUpToDate(); - return 1; - } - else - { - g_TwMgr->SetLastError(g_ErrNoValue); - return 0; - } - case BAR_SIZE: - if( _Value && strlen(_Value)>0 ) - { - int sx, sy; - int n = sscanf(_Value, "%d%d", &sx, &sy); - if( n==2 && sx>0 && sy>0 ) - { - m_Width = sx; - m_Height = sy; - NotUpToDate(); - return 1; - } - else - { - g_TwMgr->SetLastError(g_ErrBadValue); - return 0; - } - } - else - { - g_TwMgr->SetLastError(g_ErrNoValue); - return 0; - } - case BAR_POSITION: - if( _Value && strlen(_Value)>0 ) - { - int x, y; - int n = sscanf(_Value, "%d%d", &x, &y); - if( n==2 && x>=0 && y>=0 ) - { - m_PosX = x; - m_PosY = y; - NotUpToDate(); - return 1; - } - else - { - g_TwMgr->SetLastError(g_ErrBadValue); - return 0; - } - } - else - { - g_TwMgr->SetLastError(g_ErrNoValue); - return 0; - } - case BAR_REFRESH: - if( _Value && strlen(_Value)>0 ) - { - float r; - int n = sscanf(_Value, "%f", &r); - if( n==1 && r>=0 ) - { - m_UpdatePeriod = r; - return 1; - } - else - { - g_TwMgr->SetLastError(g_ErrBadValue); - return 0; - } - } - else - { - g_TwMgr->SetLastError(g_ErrNoValue); - return 0; - } - case BAR_VALUES_WIDTH: - if( _Value && strlen(_Value)>0 ) - { - if( _stricmp(_Value, "fit")==0 ) - { - m_ValuesWidth = VALUES_WIDTH_FIT; - NotUpToDate(); - return 1; - } - else - { - int w; - int n = sscanf(_Value, "%d", &w); - if( n==1 && w>0 ) - { - m_ValuesWidth = w; - NotUpToDate(); - return 1; - } - else - { - g_TwMgr->SetLastError(g_ErrBadValue); - return 0; - } - } - } - else - { - g_TwMgr->SetLastError(g_ErrNoValue); - return 0; - } - case BAR_FONT_SIZE: - return g_TwMgr->SetAttrib(MGR_FONT_SIZE, _Value); - case BAR_FONT_STYLE: - return g_TwMgr->SetAttrib(MGR_FONT_STYLE, _Value); - case BAR_ICON_POS: - return g_TwMgr->SetAttrib(MGR_ICON_POS, _Value); - case BAR_ICON_ALIGN: - return g_TwMgr->SetAttrib(MGR_ICON_ALIGN, _Value); - case BAR_ICON_MARGIN: - return g_TwMgr->SetAttrib(MGR_ICON_MARGIN, _Value); - case BAR_SHOW: // deprecated - TwSetBarState(this, TW_STATE_SHOWN); - return 1; - case BAR_HIDE: // deprecated - TwSetBarState(this, TW_STATE_HIDDEN); - return 1; - case BAR_ICONIFY: // deprecated - TwSetBarState(this, TW_STATE_ICONIFIED); - return 1; - case BAR_RESIZABLE: - if( _Value && strlen(_Value)>0 ) - { - if( _stricmp(_Value, "1")==0 || _stricmp(_Value, "true")==0 ) - { - m_Resizable = true; - return 1; - } - else if( _stricmp(_Value, "0")==0 || _stricmp(_Value, "false")==0 ) - { - m_Resizable = false; - return 1; - } - else - { - g_TwMgr->SetLastError(g_ErrBadValue); - return 0; - } - } - else - { - g_TwMgr->SetLastError(g_ErrNoValue); - return 0; - } - case BAR_MOVABLE: - if( _Value && strlen(_Value)>0 ) - { - if( _stricmp(_Value, "1")==0 || _stricmp(_Value, "true")==0 ) - { - m_Movable = true; - return 1; - } - else if( _stricmp(_Value, "0")==0 || _stricmp(_Value, "false")==0 ) - { - m_Movable = false; - return 1; - } - else - { - g_TwMgr->SetLastError(g_ErrBadValue); - return 0; - } - } - else - { - g_TwMgr->SetLastError(g_ErrNoValue); - return 0; - } - case BAR_ICONIFIABLE: - if( _Value && strlen(_Value)>0 ) - { - if( _stricmp(_Value, "1")==0 || _stricmp(_Value, "true")==0 ) - { - m_Iconifiable = true; - return 1; - } - else if( _stricmp(_Value, "0")==0 || _stricmp(_Value, "false")==0 ) - { - m_Iconifiable = false; - return 1; - } - else - { - g_TwMgr->SetLastError(g_ErrBadValue); - return 0; - } - } - else - { - g_TwMgr->SetLastError(g_ErrNoValue); - return 0; - } - case BAR_FONT_RESIZABLE: - return g_TwMgr->SetAttrib(MGR_FONT_RESIZABLE, _Value); - case BAR_ALWAYS_TOP: - if( _Value && strlen(_Value)>0 ) - { - if( _stricmp(_Value, "1")==0 || _stricmp(_Value, "true")==0 ) - { - g_TwMgr->m_BarAlwaysOnTop = m_Name; - if( g_TwMgr->m_BarAlwaysOnBottom.length()>0 && strcmp(g_TwMgr->m_BarAlwaysOnBottom.c_str(), m_Name.c_str())==0 ) - g_TwMgr->m_BarAlwaysOnBottom.clear(); - TwSetTopBar(this); - return 1; - } - else if( _stricmp(_Value, "0")==0 || _stricmp(_Value, "false")==0 ) - { - if( g_TwMgr->m_BarAlwaysOnTop.length()>0 && strcmp(g_TwMgr->m_BarAlwaysOnTop.c_str(), m_Name.c_str())==0 ) - g_TwMgr->m_BarAlwaysOnTop.clear(); - return 1; - } - else - { - g_TwMgr->SetLastError(g_ErrBadValue); - return 0; - } - } - else - { - g_TwMgr->SetLastError(g_ErrNoValue); - return 0; - } - case BAR_ALWAYS_BOTTOM: - if( _Value && strlen(_Value)>0 ) - { - if( _stricmp(_Value, "1")==0 || _stricmp(_Value, "true")==0 ) - { - g_TwMgr->m_BarAlwaysOnBottom = m_Name; - if( g_TwMgr->m_BarAlwaysOnTop.length()>0 && strcmp(g_TwMgr->m_BarAlwaysOnTop.c_str(), m_Name.c_str())==0 ) - g_TwMgr->m_BarAlwaysOnTop.clear(); - TwSetBottomBar(this); - return 1; - } - else if( _stricmp(_Value, "0")==0 || _stricmp(_Value, "false")==0 ) - { - if( g_TwMgr->m_BarAlwaysOnBottom.length()>0 && strcmp(g_TwMgr->m_BarAlwaysOnBottom.c_str(), m_Name.c_str())==0 ) - g_TwMgr->m_BarAlwaysOnBottom.clear(); - return 1; - } - else - { - g_TwMgr->SetLastError(g_ErrBadValue); - return 0; - } - } - else - { - g_TwMgr->SetLastError(g_ErrNoValue); - return 0; - } - case BAR_VISIBLE: - if( _Value && strlen(_Value)>0 ) - { - if( _stricmp(_Value, "1")==0 || _stricmp(_Value, "true")==0 ) - { - TwSetBarState(this, TW_STATE_SHOWN); - return 1; - } - else if( _stricmp(_Value, "0")==0 || _stricmp(_Value, "false")==0 ) - { - TwSetBarState(this, TW_STATE_HIDDEN); - return 1; - } - else - { - g_TwMgr->SetLastError(g_ErrBadValue); - return 0; - } - } - else - { - g_TwMgr->SetLastError(g_ErrNoValue); - return 0; - } - case BAR_ICONIFIED: - if( _Value && strlen(_Value)>0 ) - { - if( _stricmp(_Value, "1")==0 || _stricmp(_Value, "true")==0 ) - { - TwSetBarState(this, TW_STATE_ICONIFIED); - return 1; - } - else if( _stricmp(_Value, "0")==0 || _stricmp(_Value, "false")==0 ) - { - TwSetBarState(this, TW_STATE_UNICONIFIED); - return 1; - } - else - { - g_TwMgr->SetLastError(g_ErrBadValue); - return 0; - } - } - else - { - g_TwMgr->SetLastError(g_ErrNoValue); - return 0; - } - case BAR_COLOR_SCHEME: - return g_TwMgr->SetAttrib(MGR_COLOR_SCHEME, _Value); - case BAR_CONTAINED: - if( _Value && strlen(_Value)>0 ) - { - if( _stricmp(_Value, "1")==0 || _stricmp(_Value, "true")==0 ) - { - m_Contained = true; - return 1; - } - else if( _stricmp(_Value, "0")==0 || _stricmp(_Value, "false")==0 ) - { - m_Contained = false; - return 1; - } - else - { - g_TwMgr->SetLastError(g_ErrBadValue); - return 0; - } - } - else - { - g_TwMgr->SetLastError(g_ErrNoValue); - return 0; - } - case BAR_BUTTON_ALIGN: - if( _Value && strlen(_Value)>0 ) - { - if( _stricmp(_Value, "left")==0 ) - { - m_ButtonAlign = BUTTON_ALIGN_LEFT; - return 1; - } - else if( _stricmp(_Value, "center")==0 ) - { - m_ButtonAlign = BUTTON_ALIGN_CENTER; - return 1; - } - if( _stricmp(_Value, "right")==0 ) - { - m_ButtonAlign = BUTTON_ALIGN_RIGHT; - return 1; - } - else - { - g_TwMgr->SetLastError(g_ErrBadValue); - return 0; - } - } - else - { - g_TwMgr->SetLastError(g_ErrNoValue); - return 0; - } - default: - g_TwMgr->SetLastError(g_ErrUnknownAttrib); - return 0; - } -} - -ERetType CTwBar::GetAttrib(int _AttribID, std::vector& outDoubles, std::ostringstream& outString) const -{ - outDoubles.clear(); - outString.clear(); - - switch( _AttribID ) - { - case BAR_LABEL: - outString << m_Label; - return RET_STRING; - case BAR_HELP: - outString << m_Help; - return RET_STRING; - case BAR_COLOR: - { - int a, r, g, b; - a = r = g = b = 0; - Color32ToARGBi(m_Color, &a, &r, &g, &b); - outDoubles.push_back(r); - outDoubles.push_back(g); - outDoubles.push_back(b); - return RET_DOUBLE; - } - case BAR_ALPHA: - { - int a, r, g, b; - a = r = g = b = 0; - Color32ToARGBi(m_Color, &a, &r, &g, &b); - outDoubles.push_back(a); - return RET_DOUBLE; - } - case BAR_TEXT: - if( m_DarkText ) - outString << "dark"; - else - outString << "light"; - return RET_STRING; - case BAR_SIZE: - outDoubles.push_back(m_Width); - outDoubles.push_back(m_Height); - return RET_DOUBLE; - case BAR_POSITION: - outDoubles.push_back(m_PosX); - outDoubles.push_back(m_PosY); - return RET_DOUBLE; - case BAR_REFRESH: - outDoubles.push_back(m_UpdatePeriod); - return RET_DOUBLE; - case BAR_VALUES_WIDTH: - outDoubles.push_back(m_ValuesWidth); - return RET_DOUBLE; - case BAR_FONT_SIZE: - return g_TwMgr->GetAttrib(MGR_FONT_SIZE, outDoubles, outString); - case BAR_FONT_STYLE: - return g_TwMgr->GetAttrib(MGR_FONT_STYLE, outDoubles, outString); - case BAR_ICON_POS: - return g_TwMgr->GetAttrib(MGR_ICON_POS, outDoubles, outString); - case BAR_ICON_ALIGN: - return g_TwMgr->GetAttrib(MGR_ICON_ALIGN, outDoubles, outString); - case BAR_ICON_MARGIN: - return g_TwMgr->GetAttrib(MGR_ICON_MARGIN, outDoubles, outString); - case BAR_RESIZABLE: - outDoubles.push_back(m_Resizable); - return RET_DOUBLE; - case BAR_MOVABLE: - outDoubles.push_back(m_Movable); - return RET_DOUBLE; - case BAR_ICONIFIABLE: - outDoubles.push_back(m_Iconifiable); - return RET_DOUBLE; - case BAR_FONT_RESIZABLE: - return g_TwMgr->GetAttrib(MGR_FONT_RESIZABLE, outDoubles, outString); - case BAR_ALWAYS_TOP: - outDoubles.push_back( g_TwMgr->m_BarAlwaysOnTop == m_Name ); - return RET_DOUBLE; - case BAR_ALWAYS_BOTTOM: - outDoubles.push_back( g_TwMgr->m_BarAlwaysOnBottom == m_Name ); - return RET_DOUBLE; - case BAR_VISIBLE: - outDoubles.push_back(m_Visible); - return RET_DOUBLE; - case BAR_ICONIFIED: - outDoubles.push_back(m_IsMinimized); - return RET_DOUBLE; - case BAR_COLOR_SCHEME: - return g_TwMgr->GetAttrib(MGR_COLOR_SCHEME, outDoubles, outString); - case BAR_CONTAINED: - outDoubles.push_back(m_Contained); - return RET_DOUBLE; - case BAR_BUTTON_ALIGN: - if( m_ButtonAlign==BUTTON_ALIGN_LEFT ) - outString << "left"; - else if( m_ButtonAlign==BUTTON_ALIGN_CENTER ) - outString << "center"; - else - outString << "right"; - return RET_STRING; - default: - g_TwMgr->SetLastError(g_ErrUnknownAttrib); - return RET_ERROR; - } -} - -// --------------------------------------------------------------------------- - -void CTwBar::NotUpToDate() -{ - m_UpToDate = false; -} - -// --------------------------------------------------------------------------- - -void CTwBar::UpdateColors() -{ - float a, r, g, b, h, l, s; - Color32ToARGBf(m_Color, &a, &r, &g, &b); - ColorRGBToHLSf(r, g, b, &h, &l, &s); - bool lightText = !m_DarkText; - - // Colors independant of m_Color - - // Highlighted line background ramp - m_ColHighBg0 = lightText ? Color32FromARGBf(0.4f, 0.9f, 0.9f, 0.9f) : Color32FromARGBf(0.4f, 1.0f, 1.0f, 1.0f); - m_ColHighBg1 = lightText ? Color32FromARGBf(0.4f, 0.2f, 0.2f, 0.2f) : Color32FromARGBf(0.1f, 0.7f, 0.7f, 0.7f); - - // Text colors & background - m_ColLabelText = lightText ? COLOR32_WHITE : COLOR32_BLACK; - m_ColStructText = lightText ? 0xffefef00 : 0xff303000; - - m_ColValText = lightText ? 0xffc7d7ff : 0xff000080; - m_ColValTextRO = lightText ? 0xffb7b7b7 : 0xff505050; - m_ColValMin = lightText ? 0xff9797ff : 0xff0000f0; - m_ColValMax = m_ColValMin; - m_ColValTextNE = lightText ? 0xff97f797 : 0xff004000; - - m_ColValBg = lightText ? Color32FromARGBf(0.2f+0.3f*a, 0.1f, 0.1f, 0.1f) : Color32FromARGBf(0.2f+0.3f*a, 1, 1, 1); - m_ColStructBg = lightText ? Color32FromARGBf(0.4f*a, 0, 0, 0) : Color32FromARGBf(0.4f*a, 1, 1, 1); - - m_ColLine = lightText ? Color32FromARGBf(0.6f, 1, 1, 1) : Color32FromARGBf(0.6f, 0.3f, 0.3f, 0.3f); - m_ColLineShadow = lightText ? Color32FromARGBf(0.6f, 0, 0, 0) : Color32FromARGBf(0.6f, 0, 0, 0); - m_ColUnderline = lightText ? 0xffd0d0d0 : 0xff202000; - - m_ColGrpBg = lightText ? Color32FromARGBf(0.1f+0.25f*a, 1, 1, 1) : Color32FromARGBf(0.1f+0.05f*a, 0, 0, 0); - m_ColGrpText = lightText ? 0xffffff80 : 0xff000000; - - m_ColShortcutText = lightText ? 0xffffb060 : 0xff802000; - m_ColShortcutBg = lightText ? Color32FromARGBf(0.4f*a, 0.2f, 0.2f, 0.2f) : Color32FromARGBf(0.4f*a, 0.8f, 0.8f, 0.8f); - m_ColInfoText = Color32FromARGBf(1.0f, 0.5f, 0.5f, 0.5f); - - m_ColRoto = lightText ? Color32FromARGBf(0.8f, 0.85f, 0.85f, 0.85f) : Color32FromARGBf(0.8f, 0.1f, 0.1f, 0.1f); - m_ColRotoVal = Color32FromARGBf(1, 1.0f, 0.2f, 0.2f); - m_ColRotoBound = lightText ? Color32FromARGBf(0.8f, 0.6f, 0.6f, 0.6f) : Color32FromARGBf(0.8f, 0.3f, 0.3f, 0.3f); - - m_ColEditText = lightText ? COLOR32_WHITE : COLOR32_BLACK; - m_ColEditBg = lightText ? 0xff575757 : 0xffc7c7c7; // must be opaque - m_ColEditSelText = lightText ? COLOR32_BLACK : COLOR32_WHITE; - m_ColEditSelBg = lightText ? 0xffc7c7c7 : 0xff575757; - - // Colors dependant of m_Colors - - // Bar background - ColorHLSToRGBf(h, l, s, &r, &g, &b); - m_ColBg = Color32FromARGBf(a, r, g, b); - ColorHLSToRGBf(h, l-0.05f, s, &r, &g, &b); - m_ColBg1 = Color32FromARGBf(a, r, g, b); - ColorHLSToRGBf(h, l-0.1f, s, &r, &g, &b); - m_ColBg2 = Color32FromARGBf(a, r, g, b); - - ColorHLSToRGBf(h, l-0.15f, s, &r, &g, &b); - m_ColTitleBg = Color32FromARGBf(a+0.9f, r, g, b); - m_ColTitleText = lightText ? COLOR32_WHITE : COLOR32_BLACK; - m_ColTitleShadow = lightText ? 0x40000000 : 0x00000000; - ColorHLSToRGBf(h, l-0.25f, s, &r, &g, &b); - m_ColTitleHighBg = Color32FromARGBf(a+0.8f, r, g, b); - ColorHLSToRGBf(h, l-0.3f, s, &r, &g, &b); - m_ColTitleUnactiveBg = Color32FromARGBf(a+0.2f, r, g, b); - - ColorHLSToRGBf(h, l-0.2f, s, &r, &g, &b); - m_ColHierBg = Color32FromARGBf(a, r, g, b); - - ColorHLSToRGBf(h, l+0.1f, s, &r, &g, &b); - m_ColBtn = Color32FromARGBf(0.2f+0.4f*a, r, g, b); - ColorHLSToRGBf(h, l-0.35f, s, &r, &g, &b); - m_ColHighBtn = Color32FromARGBf(0.4f+0.4f*a, r, g, b); - ColorHLSToRGBf(h, l-0.25f, s, &r, &g, &b); - m_ColFold = Color32FromARGBf(0.1f+0.4f*a, r, g, b); - ColorHLSToRGBf(h, l-0.35f, s, &r, &g, &b); - m_ColHighFold = Color32FromARGBf(0.3f+0.4f*a, r, g, b); - - ColorHLSToRGBf(h, 0.75f, s, &r, &g, &b); - m_ColHelpBg = Color32FromARGBf(0.2f, 1, 1, 1); - m_ColHelpText = lightText ? Color32FromARGBf(1, 0.2f, 1.0f, 0.2f) : Color32FromARGBf(1, 0, 0.4f, 0); - m_ColSeparator = m_ColValTextRO; - m_ColStaticText = m_ColHelpText; -} - -/* -void CTwBar::UpdateColors() -{ - float a, r, g, b, h, l, s; - Color32ToARGBf(m_Color, &a, &r, &g, &b); - ColorRGBToHLSf(r, g, b, &h, &l, &s); - bool lightText = !m_DarkText; // (l<=0.45f); - l = 0.2f + 0.6f*l; - - ColorHLSToRGBf(h, l, s, &r, &g, &b); - m_ColBg = Color32FromARGBf(a, r, g, b); - ColorHLSToRGBf(h, l-0.1f, s, &r, &g, &b); - m_ColBg1 = Color32FromARGBf(a, r, g, b); - ColorHLSToRGBf(h, l-0.2f, s, &r, &g, &b); - m_ColBg2 = Color32FromARGBf(a, r, g, b); - - ColorHLSToRGBf(h, l+0.1f, s, &r, &g, &b); - m_ColHighBg = Color32FromARGBf(0.4f, r, g, b); - //m_ColHighBg = Color32FromARGBf(a, 0.95f, 0.95f, 0.2f); - - m_ColLabelText = lightText ? COLOR32_WHITE : COLOR32_BLACK; - m_ColStructText = lightText ? 0xffefef00 : 0xff505000; - - m_ColValText = lightText ? 0xffb7b7ff : 0xff000080; - m_ColValTextRO = lightText ? 0xffb7b7b7 : 0xff505050; - m_ColValMin = lightText ? 0xff9797ff : 0xff0000f0; - m_ColValMax = m_ColValMin; - m_ColValTextNE = lightText ? 0xff97f797 : 0xff006000; - - ColorHLSToRGBf(h, lightText ? (min(l+0.2f, 0.3f)) : (max(l-0.2f, 0.6f)), s, &r, &g, &b); - m_ColValBg = Color32FromARGBf(0.4f*a, 0, 0, 0); - m_ColStructBg = Color32FromARGBf(0.4f*a, 0, 0, 0); - - ColorHLSToRGBf(h, 0.4f, s, &r, &g, &b); - m_ColTitleBg = Color32FromARGBf(a+0.4f, r, g, b); - m_ColTitleText = lightText ? COLOR32_WHITE : COLOR32_BLACK; - m_ColTitleShadow = lightText ? 0x80000000 : 0x80ffffff; - ColorHLSToRGBf(h, 0.3f, s, &r, &g, &b); - m_ColTitleHighBg = Color32FromARGBf(a+0.4f, r, g, b); - ColorHLSToRGBf(h, 0.4f, s, &r, &g, &b); - m_ColTitleUnactiveBg = Color32FromARGBf(a+0.2f, r, g, b); - - ColorHLSToRGBf(h, 0.8f, s, &r, &g, &b); - m_ColLine = Color32FromARGBf(0.6f, r, g, b); // 0xfff0f0f0; - m_ColLineShadow = Color32FromARGBf(0.6f, 0, 0, 0); //COLOR32_BLACK; - m_ColUnderline = lightText ? 0xffd0d0d0 : 0xff202000; - ColorHLSToRGBf(h, 0.7f, s, &r, &g, &b); - m_ColBtn = Color32FromARGBf(0.6f, r, g, b); - ColorHLSToRGBf(h, 0.4f, s, &r, &g, &b); - m_ColHighBtn = Color32FromARGBf(0.6f, r, g, b); - ColorHLSToRGBf(h, 0.6f, s, &r, &g, &b); - m_ColFold = Color32FromARGBf(0.3f*a, r, g, b); - ColorHLSToRGBf(h, 0.4f, s, &r, &g, &b); - m_ColHighFold = Color32FromARGBf(0.3f, r, g, b); - - ColorHLSToRGBf(h, lightText ? l+0.2f : l-0.2f, s, &r, &g, &b); - m_ColGrpBg = Color32FromARGBf(0.5f*a, r, g, b); - m_ColGrpText = lightText ? 0xffffff80 : 0xff404000; - - ColorHLSToRGBf(h, 0.75f, s, &r, &g, &b); - m_ColHelpBg = Color32FromARGBf(a, r, g, b); - m_ColHelpText = Color32FromARGBf(1, 0, 0.4f, 0); - - ColorHLSToRGBf(h, 0.45f, s, &r, &g, &b); - m_ColHierBg = Color32FromARGBf(0.75f*a, r, g, b); - - m_ColShortcutText = lightText ? 0xffff8040 : 0xff802000; //0xfff0f0f0; - m_ColShortcutBg = Color32FromARGBf(0.4f*a, 0.2f, 0.2f, 0.2f); - m_ColInfoText = Color32FromARGBf(1.0f, 0.7f, 0.7f, 0.7f); - - m_ColRoto = Color32FromARGBf(1, 0.75f, 0.75f, 0.75f); - m_ColRotoVal = Color32FromARGBf(1, 1.0f, 0.2f, 0.2f); - m_ColRotoBound = Color32FromARGBf(1, 0.4f, 0.4f, 0.4f); - - m_ColEditText = lightText ? COLOR32_WHITE : COLOR32_BLACK; - m_ColEditBg = lightText ? 0xb7575757 : 0xb7c7c7c7; - m_ColEditSelText = lightText ? COLOR32_BLACK : COLOR32_WHITE; - m_ColEditSelBg = lightText ? 0xffc7c7c7 : 0xff575757; - - m_ColSeparator = m_ColValTextRO; - m_ColStaticText = m_ColHelpText; -} -*/ - -// --------------------------------------------------------------------------- - -CTwVarGroup::~CTwVarGroup() -{ - for( vector::iterator it= m_Vars.begin(); it!=m_Vars.end(); ++it ) - if( *it != NULL ) - { - CTwVar *Var = *it; - delete Var; - *it = NULL; - } -} - -// --------------------------------------------------------------------------- - -static inline int IncrBtnWidth(int _CharHeight) -{ - return ((2*_CharHeight)/3+2)&0xfffe; // force even value -} - -// --------------------------------------------------------------------------- - -void CTwBar::BrowseHierarchy(int *_CurrLine, int _CurrLevel, const CTwVar *_Var, int _First, int _Last) -{ - assert(_Var!=NULL); - if( !_Var->m_IsRoot ) - { - if( (*_CurrLine)>=_First && (*_CurrLine)<=_Last ) - { - CHierTag Tag; - Tag.m_Level = _CurrLevel; - Tag.m_Var = const_cast(_Var); - Tag.m_Closing = false; - m_HierTags.push_back(Tag); - } - *_CurrLine += 1; - } - else - { - *_CurrLine = 0; - _CurrLevel = -1; - m_HierTags.resize(0); - } - - if( _Var->IsGroup() ) - { - const CTwVarGroup *Grp = static_cast(_Var); - if( Grp->m_Open ) - for( vector::const_iterator it=Grp->m_Vars.begin(); it!=Grp->m_Vars.end(); ++it ) - if( (*it)->m_Visible ) - BrowseHierarchy(_CurrLine, _CurrLevel+1, *it, _First, _Last); - if( m_HierTags.size()>0 ) - m_HierTags[m_HierTags.size()-1].m_Closing = true; - } -} - -// --------------------------------------------------------------------------- - -void CTwBar::ListLabels(vector& _Labels, vector& _Colors, vector& _BgColors, bool *_HasBgColors, const CTexFont *_Font, int _AtomWidthMax, int _GroupWidthMax) -{ - const int NbEtc = 2; - string ValStr; - int Len, i, x, Etc, s; - const unsigned char *Text; - unsigned char ch; - int WidthMax; - - int Space = _Font->m_CharWidth[(int)' ']; - int LevelSpace = max(_Font->m_CharHeight-6, 4); // space used by DrawHierHandles - - int nh = (int)m_HierTags.size(); - for( int h=0; hm_Label.length(); - if( Len>0 ) - Text = (const unsigned char *)(m_HierTags[h].m_Var->m_Label.c_str()); - else - { - Text = (const unsigned char *)(m_HierTags[h].m_Var->m_Name.c_str()); - Len = (int)m_HierTags[h].m_Var->m_Name.length(); - } - x = 0; - Etc = 0; - _Labels.push_back(""); // add a new text line - if( !m_HierTags[h].m_Var->IsGroup() && static_cast(m_HierTags[h].m_Var)->m_Type==TW_TYPE_BUTTON && static_cast(m_HierTags[h].m_Var)->m_ReadOnly && static_cast(m_HierTags[h].m_Var)->m_Val.m_Button.m_Callback!=NULL ) - _Colors.push_back(m_ColValTextRO); // special case for read-only buttons - else - _Colors.push_back(m_HierTags[h].m_Var->m_ColorPtr!=NULL ? *(m_HierTags[h].m_Var->m_ColorPtr) : COLOR32_WHITE); - color32 bg = m_HierTags[h].m_Var->m_BgColorPtr!=NULL ? *(m_HierTags[h].m_Var->m_BgColorPtr) : 0; - _BgColors.push_back(bg); - if( _HasBgColors!=NULL && bg!=0 ) - *_HasBgColors = true; - bool IsCustom = m_HierTags[h].m_Var->IsCustom(); // !m_HierTags[h].m_Var->IsGroup() && (static_cast(m_HierTags[h].m_Var)->m_Type>=TW_TYPE_CUSTOM_BASE && static_cast(m_HierTags[h].m_Var)->m_Typem_Customs.size()); - if( !IsCustom ) - { - string& CurrentLabel = _Labels[_Labels.size()-1]; - if( m_HierTags[h].m_Var->IsGroup() && static_cast(m_HierTags[h].m_Var)->m_SummaryCallback==NULL ) - WidthMax = _GroupWidthMax; - else if( !m_HierTags[h].m_Var->IsGroup() && static_cast(m_HierTags[h].m_Var)->m_Type==TW_TYPE_BUTTON ) - { - if( static_cast(m_HierTags[h].m_Var)->m_Val.m_Button.m_Callback==NULL ) - WidthMax = _GroupWidthMax; - else if( m_ButtonAlign == BUTTON_ALIGN_RIGHT ) - WidthMax = _GroupWidthMax - 2*IncrBtnWidth(m_Font->m_CharHeight); - else - WidthMax = _AtomWidthMax; - } - //else if( m_HighlightedLine==h && m_DrawRotoBtn ) - // WidthMax = _AtomWidthMax - IncrBtnWidth(m_Font->m_CharHeight); - else - WidthMax = _AtomWidthMax; - if( Space>0 ) - for( s=0; sm_CharWidth[(int)'.']m_DontClip) - for( i=0; im_CharWidth[(int)ch]; - if( Etc>0 ) - { - ++Etc; - if( Etc>NbEtc ) - break; - } - else if( im_CharWidth[(int)'.']>=WidthMax && !(m_HierTags[h].m_Var->m_DontClip)) - Etc = 1; - } - } - } -} - -// --------------------------------------------------------------------------- - -void CTwBar::ListValues(vector& _Values, vector& _Colors, vector& _BgColors, const CTexFont *_Font, int _WidthMax) -{ - CTwFPU fpu; // force fpu precision - - const int NbEtc = 2; - const CTwVarAtom *Atom = NULL; - string ValStr; - int Len, i, x, Etc; - const unsigned char *Text; - unsigned char ch; - bool ReadOnly; - bool IsMax; - bool IsMin; - bool IsROText; - bool HasBgColor; - bool AcceptEdit; - size_t SummaryMaxLength = max(_WidthMax/_Font->m_CharWidth[(int)'I'], 4); - static vector Summary; - Summary.resize(SummaryMaxLength+32); - - int nh = (int)m_HierTags.size(); - for( int h=0; hIsGroup() || m_IsHelpBar - || (m_HierTags[h].m_Var->IsGroup() && static_cast(m_HierTags[h].m_Var)->m_SummaryCallback!=NULL) ) - { - ReadOnly = true; - IsMax = false; - IsMin = false; - IsROText = false; - HasBgColor = true; - AcceptEdit = false; - if( !m_HierTags[h].m_Var->IsGroup() ) - { - Atom = static_cast(m_HierTags[h].m_Var); - Atom->ValueToString(&ValStr); - if( !m_IsHelpBar || (Atom->m_Type==TW_TYPE_SHORTCUT && (Atom->m_Val.m_Shortcut.m_Incr[0]>0 || Atom->m_Val.m_Shortcut.m_Decr[0]>0)) ) - ReadOnly = Atom->m_ReadOnly; - if( !Atom->m_NoSlider ) - { - double v, vmin, vmax; - v = Atom->ValueToDouble(); - Atom->MinMaxStepToDouble(&vmin, &vmax, NULL); - IsMax = (v>=vmax); - IsMin = (v<=vmin); - } - if( Atom->m_Type==TW_TYPE_BOOLCPP || Atom->m_Type==TW_TYPE_BOOL8 || Atom->m_Type==TW_TYPE_BOOL16 || Atom->m_Type==TW_TYPE_BOOL32 ) - { - if (ValStr=="1") - ValStr = "\x7f"; // check sign - else if (ValStr=="0") - ValStr = " -"; //"\x97"; // uncheck sign - } - if( (Atom->m_Type==TW_TYPE_CDSTRING && Atom->m_SetCallback==NULL && g_TwMgr->m_CopyCDStringToClient==NULL) - || (Atom->m_Type==TW_TYPE_CDSTDSTRING && Atom->m_SetCallback==NULL) - || (Atom->m_Type==TW_TYPE_STDSTRING && Atom->m_SetCallback==NULL && g_TwMgr->m_CopyStdStringToClient==NULL) ) - IsROText = true; - if( Atom->m_Type==TW_TYPE_HELP_ATOM || Atom->m_Type==TW_TYPE_HELP_GRP || Atom->m_Type==TW_TYPE_BUTTON || Atom->IsCustom() ) // (Atom->m_Type>=TW_TYPE_CUSTOM_BASE && Atom->m_Typem_Customs.size()) ) - HasBgColor = false; - AcceptEdit = EditInPlaceAcceptVar(Atom) || (Atom->m_Type==TW_TYPE_SHORTCUT); - } - else if(m_HierTags[h].m_Var->IsGroup() && static_cast(m_HierTags[h].m_Var)->m_SummaryCallback!=NULL) - { - const CTwVarGroup *Grp = static_cast(m_HierTags[h].m_Var); - // force internal value update - for( size_t v=0; vm_Vars.size(); v++ ) - if( Grp->m_Vars[v]!=NULL && !Grp->m_Vars[v]->IsGroup() && Grp->m_Vars[v]->m_Visible ) - static_cast(Grp->m_Vars[v])->ValueToDouble(); - - Summary[0] = '\0'; - if( Grp->m_SummaryCallback==CTwMgr::CStruct::DefaultSummary ) - Grp->m_SummaryCallback(&Summary[0], SummaryMaxLength, Grp, Grp->m_SummaryClientData); - else - Grp->m_SummaryCallback(&Summary[0], SummaryMaxLength, Grp->m_StructValuePtr, Grp->m_SummaryClientData); - ValStr = (const char *)(&Summary[0]); - } - else - { - ValStr = ""; // is a group in the help bar - HasBgColor = false; - } - Len = (int)ValStr.length(); - Text = (const unsigned char *)(ValStr.c_str()); - x = 0; - Etc = 0; - _Values.push_back(""); // add a new text line - if( ReadOnly || (IsMin && IsMax) || IsROText ) - _Colors.push_back(m_ColValTextRO); - else if( IsMin ) - _Colors.push_back(m_ColValMin); - else if( IsMax ) - _Colors.push_back(m_ColValMax); - else if( !AcceptEdit ) - _Colors.push_back(m_ColValTextNE); - else - _Colors.push_back(m_ColValText); - if( !HasBgColor ) - _BgColors.push_back(0x00000000); - else if( m_HierTags[h].m_Var->IsGroup() ) - { - const CTwVarGroup *Grp = static_cast(m_HierTags[h].m_Var); - // if typecolor set bgcolor - if( Grp->m_SummaryCallback==CColorExt::SummaryCB ) - _BgColors.push_back(0xff000000); - else - _BgColors.push_back(m_ColStructBg); - } - else - _BgColors.push_back(m_ColValBg); - - string& CurrentValue = _Values[_Values.size()-1]; - int wmax = _WidthMax; - if( m_HighlightedLine==h && m_DrawRotoBtn ) - wmax -= 3*IncrBtnWidth(m_Font->m_CharHeight); - else if( m_HighlightedLine==h && m_DrawIncrDecrBtn ) - wmax -= 2*IncrBtnWidth(m_Font->m_CharHeight); - else if( m_HighlightedLine==h && m_DrawListBtn ) - wmax -= 1*IncrBtnWidth(m_Font->m_CharHeight); - else if( m_HighlightedLine==h && m_DrawBoolBtn ) - wmax -= 1*IncrBtnWidth(m_Font->m_CharHeight); - for( i=0; im_CharWidth[(int)ch]; - if( Etc>0 ) - { - ++Etc; - if( Etc>NbEtc ) - break; - } - else if( im_CharWidth[(int)'.'])>=wmax ) - Etc = 1; - } - } - else - { - _Values.push_back(""); // add a new empty line - _Colors.push_back(COLOR32_BLACK); - _BgColors.push_back(0x00000000); - } -} - -// --------------------------------------------------------------------------- - -int CTwBar::ComputeLabelsWidth(const CTexFont *_Font) -{ - int Len, i, x, s; - const unsigned char *Text; - int LabelsWidth = 0; - int Space = _Font->m_CharWidth[(int)' ']; - int LevelSpace = max(_Font->m_CharHeight-6, 4); // space used by DrawHierHandles - - int nh = (int)m_HierTags.size(); - for( int h=0; hm_Label.length(); - if( Len>0 ) - Text = (const unsigned char *)(m_HierTags[h].m_Var->m_Label.c_str()); - else - { - Text = (const unsigned char *)(m_HierTags[h].m_Var->m_Name.c_str()); - Len = (int)m_HierTags[h].m_Var->m_Name.length(); - } - x = 0; - bool IsCustom = m_HierTags[h].m_Var->IsCustom(); // !m_HierTags[h].m_Var->IsGroup() && (static_cast(m_HierTags[h].m_Var)->m_Type>=TW_TYPE_CUSTOM_BASE && static_cast(m_HierTags[h].m_Var)->m_Typem_Customs.size()); - if( !IsCustom ) - { - if( Space>0 ) - for( s=0; sm_CharWidth[(int)Text[i]]; - x += 3*Space; // add little margin - } - if (x > LabelsWidth) - LabelsWidth = x; - } - - return LabelsWidth; -} - -int CTwBar::ComputeValuesWidth(const CTexFont *_Font) -{ - CTwFPU fpu; // force fpu precision - - const CTwVarAtom *Atom = NULL; - string ValStr; - int Len, i, x; - int Space = _Font->m_CharWidth[(int)' ']; - const unsigned char *Text; - int ValuesWidth = 0; - - int nh = (int)m_HierTags.size(); - for( int h=0; hIsGroup() ) - { - Atom = static_cast(m_HierTags[h].m_Var); - Atom->ValueToString(&ValStr); - - Len = (int)ValStr.length(); - Text = (const unsigned char *)(ValStr.c_str()); - x = 0; - for( i=0; im_CharWidth[(int)Text[i]]; - x += 2*Space; // add little margin - if (x > ValuesWidth) - ValuesWidth = x; - } - - return ValuesWidth; -} - -// --------------------------------------------------------------------------- - -static int ClampText(string& _Text, const CTexFont *_Font, int _WidthMax) -{ - int Len = (int)_Text.length(); - unsigned char ch; - int Width = 0; - int i; - for( i=0; im_CharWidth[(int)'.']>=_WidthMax ) - break; - Width += _Font->m_CharWidth[ch]; - } - if( im_CharWidth[(int)'.']; - } - return Width; -} - -// --------------------------------------------------------------------------- - -void CTwBar::Update() -{ - assert(m_UpToDate==false); - assert(m_Font); - ITwGraph *Gr = g_TwMgr->m_Graph; - - if( g_TwMgr->m_WndWidth<=0 || g_TwMgr->m_WndHeight<=0 ) - return; // graphic window is not ready - - bool DoEndDraw = false; - if( !Gr->IsDrawing() ) - { - Gr->BeginDraw(g_TwMgr->m_WndWidth, g_TwMgr->m_WndHeight); - DoEndDraw = true; - } - - bool ValuesWidthFit = false; - if( m_ValuesWidth==VALUES_WIDTH_FIT ) - { - ValuesWidthFit = true; - m_ValuesWidth = 0; - } - int PrevPosY = m_PosY; - int vpx, vpy, vpw, vph; - vpx = 0; - vpy = 0; - vpw = g_TwMgr->m_WndWidth; - vph = g_TwMgr->m_WndHeight; - if( !m_IsMinimized && vpw>0 && vph>0 ) - { - bool Modif = false; - if( m_Resizable ) - { - if( m_Width>vpw && m_Contained ) - { - m_Width = vpw; - Modif = true; - } - if( m_Width<8*m_Font->m_CharHeight ) - { - m_Width = 8*m_Font->m_CharHeight; - Modif = true; - } - if( m_Height>vph && m_Contained ) - { - m_Height = vph; - Modif = true; - } - if( m_Height<5*m_Font->m_CharHeight ) - { - m_Height = 5*m_Font->m_CharHeight; - Modif = true; - } - } - if( m_Movable && m_Contained ) - { - if( m_PosX+m_Width>vpx+vpw ) - m_PosX = vpx+vpw-m_Width; - if( m_PosXvpy+vph ) - m_PosY = vpy+vph-m_Height; - if( m_PosYm_CharHeight ) - { - m_ValuesWidth = 2*m_Font->m_CharHeight; - Modif = true; - } - if( m_ValuesWidth>m_Width-4*m_Font->m_CharHeight ) - { - m_ValuesWidth = m_Width-4*m_Font->m_CharHeight; - Modif = true; - } - if (ValuesWidthFit) - Modif = true; - if( Modif && m_IsHelpBar ) - { - g_TwMgr->m_HelpBarNotUpToDate = true; - g_TwMgr->m_KeyPressedBuildText = true; - g_TwMgr->m_InfoBuildText = true; - } - } - - UpdateColors(); - - // update geometry relatively to (m_PosX, m_PosY) - if( !m_IsPopupList ) - { - //m_VarX0 = 2*m_Font->m_CharHeight+m_Sep; - m_VarX0 = m_Font->m_CharHeight+m_Sep; - //m_VarX2 = m_Width - 4; - m_VarX2 = m_Width - m_Font->m_CharHeight - m_Sep-2; - m_VarX1 = m_VarX2 - m_ValuesWidth; - } - else - { - //m_VarX0 = m_Font->m_CharHeight+6+m_Sep; - m_VarX0 = 2; - //m_VarX2 = m_Width - 4; - m_VarX2 = m_Width - m_Font->m_CharHeight - m_Sep-2; - m_VarX1 = m_VarX2; - } - if( m_VarX1m_VarX2 ) - m_VarX1 = m_VarX2; - if( !m_IsPopupList ) - { - m_VarY0 = m_Font->m_CharHeight+2+m_Sep+6; - m_VarY1 = m_Height-m_Font->m_CharHeight-2-m_Sep; - m_VarY2 = m_Height-1; - } - else - { - m_VarY0 = 4; - m_VarY1 = m_Height-2-m_Sep; - m_VarY2 = m_Height-1; - } - - int NbLines = (m_VarY1-m_VarY0+1)/(m_Font->m_CharHeight+m_LineSep); - if( NbLines<= 0 ) - NbLines = 1; - if( !m_IsMinimized ) - { - int LineNum = 0; - BrowseHierarchy(&LineNum, 0, &m_VarRoot, m_FirstLine, m_FirstLine+NbLines); // add a dummy tag at the end to avoid wrong 'tag-closing' problems - if( (int)m_HierTags.size()>NbLines ) - m_HierTags.resize(NbLines); // remove the last dummy tag - m_NbHierLines = LineNum; - m_NbDisplayedLines = (int)m_HierTags.size(); - - if( ValuesWidthFit ) - { - m_ValuesWidth = ComputeValuesWidth(m_Font); - if( m_ValuesWidth<2*m_Font->m_CharHeight ) - m_ValuesWidth = 2*m_Font->m_CharHeight; // enough to draw buttons - if( m_ValuesWidth>m_VarX2 - m_VarX0 ) - m_ValuesWidth = max(m_VarX2 - m_VarX0 - m_Font->m_CharHeight, 0); - m_VarX1 = m_VarX2 - m_ValuesWidth; - if( m_VarX1m_VarX2 ) - m_VarX1 = m_VarX2; - m_ValuesWidth = m_VarX2 - m_VarX1; - } - } - - // scroll bar - int y0 = m_PosY+m_VarY0; - int y1 = m_PosY+m_VarY1; - int x0 = m_PosX+2; - int x1 = m_PosX+m_Font->m_CharHeight-2; - if( ((x0+x1)&1)==1 ) - x1 += 1; - int w = x1-x0+1; - int h = y1-y0-2*w; - int hscr = (m_NbHierLines>0) ? ((h*m_NbDisplayedLines)/m_NbHierLines) : h; - if( hscr<=4 ) - hscr = 4; - if( hscr>h ) - hscr = h; - int yscr = (m_NbHierLines>0) ? ((h*m_FirstLine)/m_NbHierLines) : 0; - if( yscr<=0 ) - yscr = 0; - if( yscr>h-4 ) - yscr = h-4; - if( yscr+hscr>h ) - hscr = h-yscr; - if( hscr>h ) - hscr = h; - if( hscr<=4 ) - hscr = 4; - m_ScrollYW = w; - m_ScrollYH = h; - m_ScrollY0 = y0+w+yscr; - m_ScrollY1 = y0+w+yscr+hscr; - - // Build title - string Title; - if( m_Label.size()>0 ) - Title = m_Label; - else - Title = m_Name; - m_TitleWidth = ClampText(Title, m_Font, (!m_IsMinimized)?(m_Width-5*m_Font->m_CharHeight):(16*m_Font->m_CharHeight)); - Gr->BuildText(m_TitleTextObj, &Title, NULL, NULL, 1, m_Font, 0, 0); - - if( !m_IsMinimized ) - { - // Build labels - vector Labels; - vector Colors; - vector BgColors; - bool HasBgColors = false; - ListLabels(Labels, Colors, BgColors, &HasBgColors, m_Font, m_VarX1-m_VarX0, m_VarX2-m_VarX0); - assert( Labels.size()==Colors.size() && Labels.size()==BgColors.size() ); - if( Labels.size()>0 ) - Gr->BuildText(m_LabelsTextObj, &(Labels[0]), &(Colors[0]), &(BgColors[0]), (int)Labels.size(), m_Font, m_LineSep, HasBgColors ? m_VarX1-m_VarX0-m_Font->m_CharHeight+2 : 0); - else - Gr->BuildText(m_LabelsTextObj, NULL, NULL, NULL, 0, m_Font, m_LineSep, 0); - - // Should draw click button? - m_DrawClickBtn = ( m_VarX2-m_VarX1>4*IncrBtnWidth(m_Font->m_CharHeight) - && m_HighlightedLine>=0 && m_HighlightedLine<(int)m_HierTags.size() - && m_HierTags[m_HighlightedLine].m_Var!=NULL - && !m_HierTags[m_HighlightedLine].m_Var->IsGroup() - && !static_cast(m_HierTags[m_HighlightedLine].m_Var)->m_ReadOnly - && ( static_cast(m_HierTags[m_HighlightedLine].m_Var)->m_Type==TW_TYPE_BUTTON )); - // || static_cast(m_HierTags[m_HighlightedLine].m_Var)->m_Type==TW_TYPE_BOOLCPP - // || static_cast(m_HierTags[m_HighlightedLine].m_Var)->m_Type==TW_TYPE_BOOL8 - // || static_cast(m_HierTags[m_HighlightedLine].m_Var)->m_Type==TW_TYPE_BOOL16 - // || static_cast(m_HierTags[m_HighlightedLine].m_Var)->m_Type==TW_TYPE_BOOL32 )); - - // Should draw [-/+] button? - m_DrawIncrDecrBtn = ( m_VarX2-m_VarX1>5*IncrBtnWidth(m_Font->m_CharHeight) - && m_HighlightedLine>=0 && m_HighlightedLine<(int)m_HierTags.size() - && m_HierTags[m_HighlightedLine].m_Var!=NULL - && !m_HierTags[m_HighlightedLine].m_Var->IsGroup() - && static_cast(m_HierTags[m_HighlightedLine].m_Var)->m_Type!=TW_TYPE_BUTTON - && !static_cast(m_HierTags[m_HighlightedLine].m_Var)->m_ReadOnly - && !static_cast(m_HierTags[m_HighlightedLine].m_Var)->m_NoSlider - && !(m_EditInPlace.m_Active && m_EditInPlace.m_Var==m_HierTags[m_HighlightedLine].m_Var) ); - - // Should draw [v] button (list)? - m_DrawListBtn = ( m_VarX2-m_VarX1>2*IncrBtnWidth(m_Font->m_CharHeight) - && m_HighlightedLine>=0 && m_HighlightedLine<(int)m_HierTags.size() - && m_HierTags[m_HighlightedLine].m_Var!=NULL - && !m_HierTags[m_HighlightedLine].m_Var->IsGroup() - && IsEnumType(static_cast(m_HierTags[m_HighlightedLine].m_Var)->m_Type) - && !static_cast(m_HierTags[m_HighlightedLine].m_Var)->m_ReadOnly ); - - // Should draw [<>] button (bool)? - m_DrawBoolBtn = ( m_VarX2-m_VarX1>4*IncrBtnWidth(m_Font->m_CharHeight) - && m_HighlightedLine>=0 && m_HighlightedLine<(int)m_HierTags.size() - && m_HierTags[m_HighlightedLine].m_Var!=NULL - && !m_HierTags[m_HighlightedLine].m_Var->IsGroup() - && !static_cast(m_HierTags[m_HighlightedLine].m_Var)->m_ReadOnly - && ( static_cast(m_HierTags[m_HighlightedLine].m_Var)->m_Type==TW_TYPE_BOOLCPP - || static_cast(m_HierTags[m_HighlightedLine].m_Var)->m_Type==TW_TYPE_BOOL8 - || static_cast(m_HierTags[m_HighlightedLine].m_Var)->m_Type==TW_TYPE_BOOL16 - || static_cast(m_HierTags[m_HighlightedLine].m_Var)->m_Type==TW_TYPE_BOOL32 )); - - // Should draw [o] button? - m_DrawRotoBtn = m_DrawIncrDecrBtn; - /* - m_DrawRotoBtn = ( m_HighlightedLine>=0 && m_HighlightedLine<(int)m_HierTags.size() - && m_HierTags[m_HighlightedLine].m_Var!=NULL - && !m_HierTags[m_HighlightedLine].m_Var->IsGroup() - && static_cast(m_HierTags[m_HighlightedLine].m_Var)->m_Type!=TW_TYPE_BUTTON - && !static_cast(m_HierTags[m_HighlightedLine].m_Var)->m_ReadOnly - && !static_cast(m_HierTags[m_HighlightedLine].m_Var)->m_NoSlider ); - */ - - // Build values - vector& Values = Labels; // reuse - Values.resize(0); - Colors.resize(0); - BgColors.resize(0); - ListValues(Values, Colors, BgColors, m_Font, m_VarX2-m_VarX1); - assert( BgColors.size()==Values.size() && Colors.size()==Values.size() ); - if( Values.size()>0 ) - Gr->BuildText(m_ValuesTextObj, &(Values[0]), &(Colors[0]), &(BgColors[0]), (int)Values.size(), m_Font, m_LineSep, m_VarX2-m_VarX1); - else - Gr->BuildText(m_ValuesTextObj, NULL, NULL, NULL, 0, m_Font, m_LineSep, m_VarX2-m_VarX1); - - // Build key shortcut text - string Shortcut; - m_ShortcutLine = -1; - if( m_HighlightedLine>=0 && m_HighlightedLine<(int)m_HierTags.size() && m_HierTags[m_HighlightedLine].m_Var!=NULL && !m_HierTags[m_HighlightedLine].m_Var->IsGroup() ) - { - const CTwVarAtom *Atom = static_cast(m_HierTags[m_HighlightedLine].m_Var); - if( Atom->m_KeyIncr[0]>0 || Atom->m_KeyDecr[0]>0 ) - { - if( Atom->m_KeyIncr[0]>0 && Atom->m_KeyDecr[0]>0 ) - Shortcut = "Keys: "; - else - Shortcut = "Key: "; - if( Atom->m_KeyIncr[0]>0 ) - TwGetKeyString(&Shortcut, Atom->m_KeyIncr[0], Atom->m_KeyIncr[1]); - else - Shortcut += "(none)"; - if( Atom->m_KeyDecr[0]>0 ) - { - Shortcut += " "; - TwGetKeyString(&Shortcut, Atom->m_KeyDecr[0], Atom->m_KeyDecr[1]); - } - m_ShortcutLine = m_HighlightedLine; - } - } - ClampText(Shortcut, m_Font, m_Width-3*m_Font->m_CharHeight); - Gr->BuildText(m_ShortcutTextObj, &Shortcut, NULL, NULL, 1, m_Font, 0, 0); - - // build headers text - if (m_HighlightLabelsHeader || m_HighlightValuesHeader) { - std::string HeadersText = "Fit column content"; - ClampText(HeadersText, m_Font, m_Width-3*m_Font->m_CharHeight); - Gr->BuildText(m_HeadersTextObj, &HeadersText, NULL, NULL, 1, m_Font, 0, 0); - } - } - - if( DoEndDraw ) - Gr->EndDraw(); - - m_UpToDate = true; - m_LastUpdateTime = float(g_BarTimer.GetTime()); -} - -// --------------------------------------------------------------------------- - -void CTwBar::DrawHierHandle() -{ - assert(m_Font); - ITwGraph *Gr = g_TwMgr->m_Graph; - - //int x0 = m_PosX+m_Font->m_CharHeight+1; - int x0 = m_PosX+3; - //int x2 = m_PosX+m_VarX0-5; - //int x2 = m_PosX+3*m_Font->m_CharWidth[(int)' ']-2; - int x2 = m_PosX+m_Font->m_CharHeight-3; - if( x2-x0<4 ) - x2 = x0+4; - if( (x2-x0)&1 ) - --x2; - int x1 = (x0+x2)/2; - int w = x2-x0+1; - int y0 = m_PosY+m_VarY0 +1; - int y1; - int dh0 = (m_Font->m_CharHeight+m_Sep-1-w)/2; - if( dh0<0 ) - dh0 = 0; - int dh1 = dh0+w-1; - int i, h=0; - - if( !m_IsPopupList ) - { - CTwVarGroup *Grp; - int nh = (int)m_HierTags.size(); - for( h=0; hm_CharHeight+m_Sep-1; - if( m_HierTags[h].m_Var->IsGroup() ) - Grp = static_cast(m_HierTags[h].m_Var); - else - Grp = NULL; - - int dx = m_HierTags[h].m_Level * (x2-x0); - - if( Grp ) - { - if( m_ColGrpBg!=0 && Grp->m_StructValuePtr==NULL ) - { - color32 cb = (Grp->m_StructType==TW_TYPE_HELP_STRUCT) ? m_ColStructBg : m_ColGrpBg; - //Gr->DrawRect(x0+dx-1, y0, m_PosX+m_VarX2, y0+m_Font->m_CharHeight-1, cb); - Gr->DrawRect(x2+dx+3, y0, m_PosX+m_VarX2, y0+m_Font->m_CharHeight-1+m_LineSep-1, cb); - } - - if( m_DrawHandles ) - { - Gr->DrawLine(dx+x2+1,y0+dh0+1, dx+x2+1,y0+dh1+1, m_ColLineShadow); - Gr->DrawLine(dx+x0+1,y0+dh1+1, dx+x2+2,y0+dh1+1, m_ColLineShadow); - } - - //Gr->DrawRect(x0+1,y0+dh0+1,x2-1,y0+dh1-1, (h==m_HighlightedLine) ? m_ColHighBtn : m_ColBtn); - Gr->DrawRect(dx+x0, y0+dh0, dx+x2, y0+dh1, (h==m_HighlightedLine) ? m_ColHighFold : m_ColFold); - if( m_DrawHandles ) - { - Gr->DrawLine(dx+x0,y0+dh0, dx+x2,y0+dh0, m_ColLine); - Gr->DrawLine(dx+x2,y0+dh0, dx+x2,y0+dh1+1, m_ColLine); - Gr->DrawLine(dx+x2,y0+dh1, dx+x0,y0+dh1, m_ColLine); - Gr->DrawLine(dx+x0,y0+dh1, dx+x0,y0+dh0, m_ColLine); - } - - Gr->DrawLine(dx+x0+2,y0+dh0+w/2, dx+x2-1,y0+dh0+w/2, m_ColTitleText); - if( !Grp->m_Open ) - Gr->DrawLine(dx+x1,y0+dh0+2, dx+x1,y0+dh1-1, m_ColTitleText); - - /* - if( m_ColGrpBg!=0 && Grp->m_StructValuePtr==NULL ) - { - color32 cb = (Grp->m_StructType==TW_TYPE_HELP_STRUCT) ? m_ColStructBg : m_ColGrpBg; - //int decal = m_Font->m_CharHeight/2-2+2*m_HierTags[h].m_Level; - //if( decal>m_Font->m_CharHeight-3 ) - // decal = m_Font->m_CharHeight-3; - int margin = dx; //m_Font->m_CharWidth[(int)' ']*m_HierTags[h].m_Level; - //Gr->DrawRect(m_PosX+m_VarX0+margin, y0+decal, m_PosX+m_VarX2, y0+m_Font->m_CharHeight-1, cb); - Gr->DrawRect(m_PosX+m_VarX0+margin-1, y0+1, m_PosX+m_VarX2, y0+m_Font->m_CharHeight, cb);// m_ColHierBg); - //Gr->DrawRect(m_PosX+m_VarX0-4, y0+m_Font->m_CharHeight/2-1, m_PosX+m_VarX0+margin-2, y0+m_Font->m_CharHeight/2, m_ColHierBg); - } - */ - } - else if( static_cast(m_HierTags[h].m_Var)->m_Type==TW_TYPE_HELP_GRP && m_ColHelpBg!=0 ) - Gr->DrawRect(m_PosX+m_VarX0+m_HierTags[h].m_Var->m_LeftMargin, y0+m_HierTags[h].m_Var->m_TopMargin, m_PosX+m_VarX2, y0+m_Font->m_CharHeight-1, m_ColHelpBg); - //else if( static_cast(m_HierTags[h].m_Var)->m_Type==TW_TYPE_HELP_HEADER && m_ColHelpBg!=0 ) - // Gr->DrawRect(m_PosX+m_VarX0+m_HierTags[h].m_Var->m_LeftMargin, y0+m_HierTags[h].m_Var->m_TopMargin, m_PosX+m_VarX2, y0+m_Font->m_CharHeight-1, m_ColHelpBg); - /* - else if( static_cast(m_HierTags[h].m_Var)->m_Type==TW_TYPE_BUTTON && m_ColBtn!=0 ) - { - // draw button - int cbx0 = m_PosX+m_VarX2-2*bw+bw/2, cby0 = y0+2, cbx1 = m_PosX+m_VarX2-2-bw/2, cby1 = y0+m_Font->m_CharHeight-4; - if( m_HighlightClickBtn ) - { - Gr->DrawRect(cbx0+2, cby0+2, cbx1+2, cby1+2, m_ColBtn); - Gr->DrawLine(cbx0+3, cby1+3, cbx1+4, cby1+3, 0x7F000000); - Gr->DrawLine(cbx1+3, cby0+3, cbx1+3, cby1+3, 0x7F000000); - } - else - { - Gr->DrawRect(cbx0+3, cby1+1, cbx1+3, cby1+3, 0x7F000000); - Gr->DrawRect(cbx1+1, cby0+3, cbx1+3, cby1, 0x7F000000); - Gr->DrawRect(cbx0, cby0, cbx1, cby1, m_ColBtn); - } - } - */ - - y0 = y1+m_LineSep; - } - } - - if( m_NbDisplayedLinesm_CharHeight-2; - x0 = m_PosX + m_VarX2+4; - x1 = x0 + m_Font->m_CharHeight-4; - if( ((x0+x1)&1)==1 ) - x1 += 1; - w = m_ScrollYW; - h = m_ScrollYH; - - Gr->DrawRect(x0+2,y0+w, x1-2,y1-1-w, (m_ColBg&0xffffff)|0x11000000); - if( m_DrawHandles || m_IsPopupList ) - { - // scroll handle shadow lines - Gr->DrawLine(x1-1,m_ScrollY0+1, x1-1,m_ScrollY1+1, m_ColLineShadow); - Gr->DrawLine(x0+2,m_ScrollY1+1, x1,m_ScrollY1+1, m_ColLineShadow); - - // up & down arrow - for( i=0; i<(x1-x0-2)/2; ++i ) - { - Gr->DrawLine(x0+2+i,y0+w-2*i, x1-i,y0+w-2*i, m_ColLineShadow); - Gr->DrawLine(x0+1+i,y0+w-1-2*i, x1-1-i,y0+w-1-2*i, m_HighlightUpScroll?((m_ColLine&0xffffff)|0x4f000000):m_ColLine); - - Gr->DrawLine(x0+2+i,y1-w+2+2*i, x1-i,y1-w+2+2*i, m_ColLineShadow); - Gr->DrawLine(x0+1+i,y1-w+1+2*i, x1-1-i,y1-w+1+2*i, m_HighlightDnScroll?((m_ColLine&0xffffff)|0x4f000000):m_ColLine); - } - - // middle lines - Gr->DrawLine((x0+x1)/2-1,y0+w, (x0+x1)/2-1,m_ScrollY0, m_ColLine); - Gr->DrawLine((x0+x1)/2,y0+w, (x0+x1)/2,m_ScrollY0, m_ColLine); - Gr->DrawLine((x0+x1)/2+1,y0+w, (x0+x1)/2+1,m_ScrollY0, m_ColLineShadow); - Gr->DrawLine((x0+x1)/2-1,m_ScrollY1, (x0+x1)/2-1,y1-w+1, m_ColLine); - Gr->DrawLine((x0+x1)/2,m_ScrollY1, (x0+x1)/2,y1-w+1, m_ColLine); - Gr->DrawLine((x0+x1)/2+1,m_ScrollY1, (x0+x1)/2+1,y1-w+1, m_ColLineShadow); - // scroll handle lines - Gr->DrawRect(x0+2,m_ScrollY0+1, x1-3,m_ScrollY1-1, m_HighlightScroll?m_ColHighBtn:m_ColBtn); - Gr->DrawLine(x1-2,m_ScrollY0, x1-2,m_ScrollY1, m_ColLine); - Gr->DrawLine(x0+1,m_ScrollY0, x0+1,m_ScrollY1, m_ColLine); - Gr->DrawLine(x0+1,m_ScrollY1, x1-1,m_ScrollY1, m_ColLine); - Gr->DrawLine(x0+1,m_ScrollY0, x1-2,m_ScrollY0, m_ColLine); - } - else - Gr->DrawRect(x0+3,m_ScrollY0+1, x1-3,m_ScrollY1-1, m_ColBtn); - } - - if( m_DrawHandles && !m_IsPopupList ) - { - if( m_Resizable ) // Draw resize handles - { - // lower-left - Gr->DrawLine(m_PosX+3, m_PosY+m_Height-m_Font->m_CharHeight+3, m_PosX+3, m_PosY+m_Height-4, m_ColLine); - Gr->DrawLine(m_PosX+4, m_PosY+m_Height-m_Font->m_CharHeight+4, m_PosX+4, m_PosY+m_Height-3, m_ColLineShadow); - Gr->DrawLine(m_PosX+3, m_PosY+m_Height-4, m_PosX+m_Font->m_CharHeight-4, m_PosY+m_Height-4, m_ColLine); - Gr->DrawLine(m_PosX+4, m_PosY+m_Height-3, m_PosX+m_Font->m_CharHeight-3, m_PosY+m_Height-3, m_ColLineShadow); - // lower-right - Gr->DrawLine(m_PosX+m_Width-4, m_PosY+m_Height-m_Font->m_CharHeight+3, m_PosX+m_Width-4, m_PosY+m_Height-4, m_ColLine); - Gr->DrawLine(m_PosX+m_Width-3, m_PosY+m_Height-m_Font->m_CharHeight+4, m_PosX+m_Width-3, m_PosY+m_Height-3, m_ColLineShadow); - Gr->DrawLine(m_PosX+m_Width-4, m_PosY+m_Height-4, m_PosX+m_Width-m_Font->m_CharHeight+3, m_PosY+m_Height-4, m_ColLine); - Gr->DrawLine(m_PosX+m_Width-3, m_PosY+m_Height-3, m_PosX+m_Width-m_Font->m_CharHeight+4, m_PosY+m_Height-3, m_ColLineShadow); - // upper-left - Gr->DrawLine(m_PosX+3, m_PosY+m_Font->m_CharHeight-4, m_PosX+3, m_PosY+3, m_ColLine); - Gr->DrawLine(m_PosX+4, m_PosY+m_Font->m_CharHeight-3, m_PosX+4, m_PosY+4, m_ColLineShadow); - Gr->DrawLine(m_PosX+3, m_PosY+3, m_PosX+m_Font->m_CharHeight-4, m_PosY+3, m_ColLine); - Gr->DrawLine(m_PosX+4, m_PosY+4, m_PosX+m_Font->m_CharHeight-3, m_PosY+4, m_ColLineShadow); - // upper-right - Gr->DrawLine(m_PosX+m_Width-4, m_PosY+3, m_PosX+m_Width-m_Font->m_CharHeight+3, m_PosY+3, m_ColLine); - Gr->DrawLine(m_PosX+m_Width-3, m_PosY+4, m_PosX+m_Width-m_Font->m_CharHeight+4, m_PosY+4, m_ColLineShadow); - Gr->DrawLine(m_PosX+m_Width-4, m_PosY+m_Font->m_CharHeight-4, m_PosX+m_Width-4, m_PosY+3, m_ColLine); - Gr->DrawLine(m_PosX+m_Width-3, m_PosY+m_Font->m_CharHeight-3, m_PosX+m_Width-3, m_PosY+4, m_ColLineShadow); - } - - int xm = m_PosX+m_Width-2*m_Font->m_CharHeight, wm=m_Font->m_CharHeight-6; - wm = (wm<6) ? 6 : wm; - if( m_Iconifiable ) // Draw minimize button - { - Gr->DrawRect(xm+1, m_PosY+4, xm+wm-1, m_PosY+3+wm, m_HighlightMinimize?m_ColHighBtn:((m_ColBtn&0xffffff)|0x4f000000)); - Gr->DrawLine(xm, m_PosY+3, xm+wm, m_PosY+3, m_ColLine); - Gr->DrawLine(xm+wm, m_PosY+3, xm+wm, m_PosY+3+wm, m_ColLine); - Gr->DrawLine(xm+wm, m_PosY+3+wm, xm, m_PosY+3+wm, m_ColLine); - Gr->DrawLine(xm, m_PosY+3+wm, xm, m_PosY+3, m_ColLine); - Gr->DrawLine(xm+wm+1, m_PosY+4, xm+wm+1, m_PosY+4+wm, m_ColLineShadow); - Gr->DrawLine(xm+wm+1, m_PosY+4+wm, xm, m_PosY+4+wm, m_ColLineShadow); - Gr->DrawLine(xm+wm/3+((wm<9)?1:0)-1, m_PosY+4+wm/3-((wm<9)?0:1), xm+wm/2, m_PosY+2+wm-1, m_ColTitleText, true); - Gr->DrawLine(xm+wm-wm/3+((wm<9)?0:1), m_PosY+4+wm/3-((wm<9)?0:1), xm+wm/2, m_PosY+2+wm-1, m_ColTitleText, true); - } - - if( g_TwMgr->m_FontResizable ) // Draw font button - { - xm = m_PosX+m_Font->m_CharHeight+2; - Gr->DrawRect(xm+1, m_PosY+4, xm+wm-1, m_PosY+3+wm, m_HighlightFont?m_ColHighBtn:((m_ColBtn&0xffffff)|0x4f000000)); - Gr->DrawLine(xm, m_PosY+3, xm+wm, m_PosY+3, m_ColLine); - Gr->DrawLine(xm+wm, m_PosY+3, xm+wm, m_PosY+3+wm, m_ColLine); - Gr->DrawLine(xm+wm, m_PosY+3+wm, xm, m_PosY+3+wm, m_ColLine); - Gr->DrawLine(xm, m_PosY+3+wm, xm, m_PosY+3, m_ColLine); - Gr->DrawLine(xm+wm+1, m_PosY+4, xm+wm+1, m_PosY+4+wm, m_ColLineShadow); - Gr->DrawLine(xm+wm+1, m_PosY+4+wm, xm, m_PosY+4+wm, m_ColLineShadow); - Gr->DrawLine(xm+wm/2-wm/6, m_PosY+3+wm/3, xm+wm/2+wm/6+1, m_PosY+3+wm/3, m_ColTitleText); - Gr->DrawLine(xm+wm/2-wm/6, m_PosY+3+wm/3, xm+wm/2-wm/6, m_PosY+4+wm-wm/3+(wm>11?1:0), m_ColTitleText); - Gr->DrawLine(xm+wm/2-wm/6, m_PosY+3+wm/2+(wm>11?1:0), xm+wm/2+wm/6, m_PosY+3+wm/2+(wm>11?1:0), m_ColTitleText); - } - } -} - -// --------------------------------------------------------------------------- - -void CTwBar::Draw(int _DrawPart) -{ - PERF( PerfTimer Timer; double DT; ) - - assert(m_Font); - ITwGraph *Gr = g_TwMgr->m_Graph; - - m_CustomRecords.clear(); - - if( float(g_BarTimer.GetTime())>m_LastUpdateTime+m_UpdatePeriod ) - NotUpToDate(); - - if( m_HighlightedLine!=m_HighlightedLinePrev ) - { - m_HighlightedLinePrev = m_HighlightedLine; - NotUpToDate(); - } - - if( m_IsHelpBar && g_TwMgr->m_HelpBarNotUpToDate ) - g_TwMgr->UpdateHelpBar(); - - if( !m_UpToDate ) - Update(); - - if( !m_IsMinimized ) - { - int y = m_PosY+1; - int LevelSpace = max(m_Font->m_CharHeight-6, 4); // space used by DrawHierHandles - - color32 colBg = m_ColBg, colBg1 = m_ColBg1, colBg2 = m_ColBg2; - if( m_DrawHandles || m_IsPopupList ) - { - unsigned int alphaMin = 0x70; - if( m_IsPopupList ) - alphaMin = 0xa0; - if( (colBg>>24)>24)>24)DrawRect(m_PosX, m_PosY, m_PosX+m_Width-1, m_PosY+m_Font->m_CharHeight+1, (m_HighlightTitle||m_MouseDragTitle) ? m_ColTitleHighBg : (m_DrawHandles ? m_ColTitleBg : m_ColTitleUnactiveBg)); - if( m_HighlightTitle || m_MouseDragTitle ) - Gr->DrawRect(m_PosX, m_PosY, m_PosX+m_Width-1, m_PosY+m_Font->m_CharHeight+1, m_ColTitleHighBg); - else if (m_DrawHandles) - Gr->DrawRect(m_PosX, m_PosY, m_PosX+m_Width-1, m_PosY+m_Font->m_CharHeight+1, m_ColTitleBg, m_ColTitleBg, colBg2, colBg1); - else - Gr->DrawRect(m_PosX, m_PosY, m_PosX+m_Width-1, m_PosY+m_Font->m_CharHeight+1, m_ColTitleBg, m_ColTitleBg, colBg2, colBg1); - } - if( _DrawPart&DRAW_CONTENT ) - { - const color32 COL0 = 0x50ffffff; - const color32 COL1 = 0x501f1f1f; - Gr->DrawRect(m_PosX, m_PosY, m_PosX+m_Width-1, y, COL0, COL0, COL1, COL1); - if( m_ColTitleShadow!=0 ) - Gr->DrawText(m_TitleTextObj, m_PosX+(m_Width-m_TitleWidth)/2+1, m_PosY+1, m_ColTitleShadow, 0); - Gr->DrawText(m_TitleTextObj, m_PosX+(m_Width-m_TitleWidth)/2, m_PosY, m_ColTitleText, 0); - } - y = m_PosY+m_Font->m_CharHeight+1; - if( _DrawPart&DRAW_CONTENT && m_DrawHandles ) - Gr->DrawLine(m_PosX, y, m_PosX+m_Width-1, y, 0x30ffffff); // 0x80afafaf); - y++; - PERF( DT = Timer.GetTime(); printf("Title=%.4fms ", 1000.0*DT); ) - } - - // Draw background - PERF( Timer.Reset(); ) - if( _DrawPart&DRAW_BG ) - { - Gr->DrawRect(m_PosX, y, m_PosX+m_Width-1, m_PosY+m_Height-1, colBg2, colBg1, colBg1, colBg); - //Gr->DrawRect(m_PosX, y, m_PosX+m_VarX0-5, m_PosY+m_Height-1, m_ColHierBg); - Gr->DrawRect(m_PosX+m_VarX2+3, y, m_PosX+m_Width-1, m_PosY+m_Height-1, m_ColHierBg); - } - - if( _DrawPart&DRAW_CONTENT ) - { - // Draw highlighted line - if( m_HighlightedLine>=0 && m_HighlightedLine<(int)m_HierTags.size() && m_HierTags[m_HighlightedLine].m_Var!=NULL - && (m_HierTags[m_HighlightedLine].m_Var->IsGroup() - || (!static_cast(m_HierTags[m_HighlightedLine].m_Var)->m_ReadOnly && !m_IsHelpBar - && !m_HierTags[m_HighlightedLine].m_Var->IsCustom() ) ) ) // !(static_cast(m_HierTags[m_HighlightedLine].m_Var)->m_Type>=TW_TYPE_CUSTOM_BASE && static_cast(m_HierTags[m_HighlightedLine].m_Var)->m_Typem_Customs.size()))) ) - { - int y0 = m_PosY + m_VarY0 + m_HighlightedLine*(m_Font->m_CharHeight+m_LineSep); - Gr->DrawRect(m_PosX+LevelSpace+6+LevelSpace*m_HierTags[m_HighlightedLine].m_Level, y0+1, m_PosX+m_VarX2, y0+m_Font->m_CharHeight-1+m_LineSep-1, m_ColHighBg0, m_ColHighBg0, m_ColHighBg1, m_ColHighBg1); - int eps = (g_TwMgr->m_GraphAPI==TW_OPENGL || g_TwMgr->m_GraphAPI==TW_OPENGL_CORE) ? 1 : 0; - if( !m_EditInPlace.m_Active ) - Gr->DrawLine(m_PosX+LevelSpace+6+LevelSpace*m_HierTags[m_HighlightedLine].m_Level, y0+m_Font->m_CharHeight+m_LineSep-1+eps, m_PosX+m_VarX2, y0+m_Font->m_CharHeight+m_LineSep-1+eps, m_ColUnderline); - } - else if( m_HighlightedLine>=0 && m_HighlightedLine<(int)m_HierTags.size() && !m_HierTags[m_HighlightedLine].m_Var->IsGroup() ) - { - int y0 = m_PosY + m_VarY0 + m_HighlightedLine*(m_Font->m_CharHeight+m_LineSep); - color32 col = ColorBlend(m_ColHighBg0, m_ColHighBg1, 0.5f); - CTwVarAtom *Atom = static_cast(m_HierTags[m_HighlightedLine].m_Var); - if( !Atom->IsCustom() // !(Atom->m_Type>=TW_TYPE_CUSTOM_BASE && Atom->m_Typem_Customs.size()) - && !(Atom->m_Type==TW_TYPE_BUTTON && Atom->m_Val.m_Button.m_Callback==NULL) ) - Gr->DrawRect(m_PosX+LevelSpace+6+LevelSpace*m_HierTags[m_HighlightedLine].m_Level, y0+1, m_PosX+m_VarX2, y0+m_Font->m_CharHeight-1+m_LineSep-1, col); - else - Gr->DrawRect(m_PosX+LevelSpace+6+LevelSpace*m_HierTags[m_HighlightedLine].m_Level, y0+1, m_PosX+LevelSpace+6+LevelSpace*m_HierTags[m_HighlightedLine].m_Level+4, y0+m_Font->m_CharHeight-1+m_LineSep-1, col); - } - color32 clight = 0x5FFFFFFF; // bar contour - Gr->DrawLine(m_PosX, m_PosY, m_PosX, m_PosY+m_Height, clight); - Gr->DrawLine(m_PosX, m_PosY, m_PosX+m_Width, m_PosY, clight); - Gr->DrawLine(m_PosX+m_Width, m_PosY, m_PosX+m_Width, m_PosY+m_Height, clight); - Gr->DrawLine(m_PosX, m_PosY+m_Height, m_PosX+m_Width, m_PosY+m_Height, clight); - int dshad = 3; // bar shadows - color32 cshad = (((m_Color>>24)/2)<<24) & 0xFF000000; - Gr->DrawRect(m_PosX, m_PosY+m_Height, m_PosX+dshad, m_PosY+m_Height+dshad, 0, cshad, 0, 0); - Gr->DrawRect(m_PosX+dshad+1, m_PosY+m_Height, m_PosX+m_Width-1, m_PosY+m_Height+dshad, cshad, cshad, 0, 0); - Gr->DrawRect(m_PosX+m_Width, m_PosY+m_Height, m_PosX+m_Width+dshad, m_PosY+m_Height+dshad, cshad, 0, 0, 0); - Gr->DrawRect(m_PosX+m_Width, m_PosY, m_PosX+m_Width+dshad, m_PosY+dshad, 0, 0, cshad, 0); - Gr->DrawRect(m_PosX+m_Width, m_PosY+dshad+1, m_PosX+m_Width+dshad, m_PosY+m_Height-1, cshad, 0, cshad, 0); - PERF( DT = Timer.GetTime(); printf("Bg=%.4fms ", 1000.0*DT); ) - - // Draw hierarchy handle - PERF( Timer.Reset(); ) - DrawHierHandle(); - PERF( DT = Timer.GetTime(); printf("Handles=%.4fms ", 1000.0*DT); ) - - // Draw labels - PERF( Timer.Reset(); ) - Gr->DrawText(m_LabelsTextObj, m_PosX+LevelSpace+6, m_PosY+m_VarY0, 0 /*m_ColLabelText*/, 0); - PERF( DT = Timer.GetTime(); printf("Labels=%.4fms ", 1000.0*DT); ) - - // Draw values - if( !m_IsPopupList ) - { - PERF( Timer.Reset(); ) - Gr->DrawText(m_ValuesTextObj, m_PosX+m_VarX1, m_PosY+m_VarY0, 0 /*m_ColValText*/, 0 /*m_ColValBg*/); - PERF( DT = Timer.GetTime(); printf("Values=%.4fms ", 1000.0*DT); ) - } - - // Draw preview for color values and draw buttons and custom types - int h, nh = (int)m_HierTags.size(); - int yh = m_PosY+m_VarY0; - int bw = IncrBtnWidth(m_Font->m_CharHeight); - for( h=0; hIsGroup() ) - { - const CTwVarGroup * Grp = static_cast(m_HierTags[h].m_Var); - if( Grp->m_SummaryCallback==CColorExt::SummaryCB && Grp->m_StructValuePtr!=NULL ) - { - // draw color value - if( Grp->m_Vars.size()>0 && Grp->m_Vars[0]!=NULL && !Grp->m_Vars[0]->IsGroup() ) - static_cast(Grp->m_Vars[0])->ValueToDouble(); // force ext update - int ydecal = (g_TwMgr->m_GraphAPI==TW_OPENGL || g_TwMgr->m_GraphAPI==TW_OPENGL_CORE) ? 1 : 0; - const int checker = 8; - for( int c=0; cDrawRect(m_PosX+m_VarX1+(c*(m_VarX2-m_VarX1))/checker, yh+1+ydecal+((c%2)*(m_Font->m_CharHeight-2))/2, m_PosX+m_VarX1-1+((c+1)*(m_VarX2-m_VarX1))/checker, yh+ydecal+(((c%2)+1)*(m_Font->m_CharHeight-2))/2, 0xffffffff); - Gr->DrawRect(m_PosX+m_VarX1, yh+1+ydecal, m_PosX+m_VarX2-1, yh+ydecal+m_Font->m_CharHeight-2, 0xbfffffff); - const CColorExt *colExt = static_cast(Grp->m_StructValuePtr); - color32 col = Color32FromARGBi((colExt->m_HasAlpha ? colExt->A : 255), colExt->R, colExt->G, colExt->B); - if( col!=0 ) - Gr->DrawRect(m_PosX+m_VarX1, yh+1+ydecal, m_PosX+m_VarX2-1, yh+ydecal+m_Font->m_CharHeight-2, col); - /* - Gr->DrawLine(m_PosX+m_VarX1-1, yh, m_PosX+m_VarX2+1, yh, 0xff000000); - Gr->DrawLine(m_PosX+m_VarX1-1, yh+m_Font->m_CharHeight, m_PosX+m_VarX2+1, yh+m_Font->m_CharHeight, 0xff000000); - Gr->DrawLine(m_PosX+m_VarX1-1, yh, m_PosX+m_VarX1-1, yh+m_Font->m_CharHeight, 0xff000000); - Gr->DrawLine(m_PosX+m_VarX2, yh, m_PosX+m_VarX2, yh+m_Font->m_CharHeight, 0xff000000); - */ - } - //else if( Grp->m_SummaryCallback==CustomTypeSummaryCB && Grp->m_StructValuePtr!=NULL ) - //{ - //} - } - else if( static_cast(m_HierTags[h].m_Var)->m_Type==TW_TYPE_BUTTON && !m_IsPopupList ) - { - // draw button - int cbx0, cbx1; - if( m_ButtonAlign == BUTTON_ALIGN_LEFT ) - { - cbx0 = m_PosX+m_VarX1+2; - cbx1 = m_PosX+m_VarX1+bw; - } - else if( m_ButtonAlign == BUTTON_ALIGN_CENTER ) - { - cbx0 = m_PosX+(m_VarX1+m_VarX2)/2-bw/2+1; - cbx1 = m_PosX+(m_VarX1+m_VarX2)/2+bw/2-1; - } - else - { - cbx0 = m_PosX+m_VarX2-2*bw+bw/2; - cbx1 = m_PosX+m_VarX2-2-bw/2; - } - int cby0 = yh+3; - int cby1 = yh+m_Font->m_CharHeight-3; - if( !static_cast(m_HierTags[h].m_Var)->m_ReadOnly ) - { - double BtnAutoDelta = g_TwMgr->m_Timer.GetTime() - m_HighlightClickBtnAuto; - if( (m_HighlightClickBtn || (BtnAutoDelta>=0 && BtnAutoDelta<0.1)) && h==m_HighlightedLine ) - { - cbx0--; cby0--; cbx1--; cby1--; - Gr->DrawRect(cbx0+2, cby0+2, cbx1+2, cby1+2, m_ColHighBtn); - Gr->DrawLine(cbx0+3, cby1+3, cbx1+4, cby1+3, 0xAF000000); - Gr->DrawLine(cbx1+3, cby0+3, cbx1+3, cby1+3, 0xAF000000); - Gr->DrawLine(cbx0+2, cby0+2, cbx0+2, cby1+2, m_ColLine); - Gr->DrawLine(cbx0+2, cby1+2, cbx1+2, cby1+2, m_ColLine); - Gr->DrawLine(cbx1+2, cby1+2, cbx1+2, cby0+2, m_ColLine); - Gr->DrawLine(cbx1+2, cby0+2, cbx0+2, cby0+2, m_ColLine); - } - else - { - Gr->DrawRect(cbx0+2, cby1+1, cbx1+2, cby1+2, (h==m_HighlightedLine)?0xAF000000:0x7F000000); - Gr->DrawRect(cbx1+1, cby0+2, cbx1+2, cby1, (h==m_HighlightedLine)?0xAF000000:0x7F000000); - Gr->DrawRect(cbx0, cby0, cbx1, cby1, (h==m_HighlightedLine)?m_ColHighBtn:m_ColBtn); - Gr->DrawLine(cbx0, cby0, cbx0, cby1, m_ColLine); - Gr->DrawLine(cbx0, cby1, cbx1, cby1, m_ColLine); - Gr->DrawLine(cbx1, cby1, cbx1, cby0, m_ColLine); - Gr->DrawLine(cbx1, cby0, cbx0, cby0, m_ColLine); - } - } - else if( static_cast(m_HierTags[h].m_Var)->m_Val.m_Button.m_Callback!=NULL ) - { - Gr->DrawRect(cbx0+1, cby0+1, cbx1+1, cby1+1, m_ColBtn); - } - else if( static_cast(m_HierTags[h].m_Var)->m_Val.m_Button.m_Separator==1 ) - { - int LevelSpace = max(m_Font->m_CharHeight-6, 4); // space used by DrawHierHandles - Gr->DrawLine(m_PosX+m_VarX0+m_HierTags[h].m_Level*LevelSpace, yh+m_Font->m_CharHeight/2, m_PosX+m_VarX2, yh+m_Font->m_CharHeight/2, m_ColSeparator ); - } - } - else if( m_HierTags[h].m_Var->IsCustom() ) //static_cast(m_HierTags[h].m_Var)->m_Type>=TW_TYPE_CUSTOM_BASE && static_cast(m_HierTags[h].m_Var)->m_Typem_Customs.size() ) - { // record custom types - CTwMgr::CMemberProxy *mProxy = static_cast(m_HierTags[h].m_Var)->m_Val.m_Custom.m_MemberProxy; - if( mProxy!=NULL && mProxy->m_StructProxy!=NULL ) - { - CustomMap::iterator it = m_CustomRecords.find(mProxy->m_StructProxy); - int xMin = m_PosX + m_VarX0 + m_HierTags[h].m_Level*LevelSpace; - int xMax = m_PosX + m_VarX2 - 2; - int yMin = yh + 1; - int yMax = yh + m_Font->m_CharHeight; - if( it==m_CustomRecords.end() ) - { - std::pair pr; - pr.first = mProxy->m_StructProxy; - pr.second.m_IndexMin = pr.second.m_IndexMax = mProxy->m_MemberIndex; - pr.second.m_XMin = xMin; - pr.second.m_XMax = xMax; - pr.second.m_YMin = yMin; - pr.second.m_YMax = yMax; - pr.second.m_Y0 = 0; // will be filled by the draw loop below - pr.second.m_Y1 = 0; // will be filled by the draw loop below - pr.second.m_Var = mProxy->m_VarParent; - m_CustomRecords.insert(pr); - } - else - { - it->second.m_IndexMin = min(it->second.m_IndexMin, mProxy->m_MemberIndex); - it->second.m_IndexMax = min(it->second.m_IndexMax, mProxy->m_MemberIndex); - it->second.m_XMin = min(it->second.m_XMin, xMin); - it->second.m_XMax = max(it->second.m_XMax, xMax); - it->second.m_YMin = min(it->second.m_YMin, yMin); - it->second.m_YMax = max(it->second.m_YMax, yMax); - it->second.m_Y0 = 0; - it->second.m_Y1 = 0; - assert( it->second.m_Var==mProxy->m_VarParent ); - } - } - } - - yh += m_Font->m_CharHeight+m_LineSep; - } - - // Draw custom types - for( CustomMap::iterator it = m_CustomRecords.begin(); it!=m_CustomRecords.end(); ++it ) - { - CTwMgr::CStructProxy *sProxy = it->first; - assert( sProxy!=NULL ); - CCustomRecord& r = it->second; - if( sProxy->m_CustomDrawCallback!=NULL ) - { - int y0 = r.m_YMin - max(r.m_IndexMin - sProxy->m_CustomIndexFirst, 0)*(m_Font->m_CharHeight + m_LineSep); - int y1 = y0 + max(sProxy->m_CustomIndexLast - sProxy->m_CustomIndexFirst + 1, 0)*(m_Font->m_CharHeight + m_LineSep) - 2; - if( y0ChangeViewport(r.m_XMin, r.m_YMin, r.m_XMax-r.m_XMin+1, r.m_YMax-r.m_YMin+1, 0, y0-r.m_YMin+1); - sProxy->m_CustomDrawCallback(r.m_XMax-r.m_XMin, y1-y0, sProxy->m_StructExtData, sProxy->m_StructClientData, this, r.m_Var); - Gr->RestoreViewport(); - } - } - } - - if( m_DrawHandles && !m_IsPopupList ) - { - // Draw -/+/o/click/v buttons - if( (m_DrawIncrDecrBtn || m_DrawClickBtn || m_DrawListBtn || m_DrawBoolBtn || m_DrawRotoBtn) && m_HighlightedLine>=0 && m_HighlightedLine<(int)m_HierTags.size() ) - { - int y0 = m_PosY + m_VarY0 + m_HighlightedLine*(m_Font->m_CharHeight+m_LineSep); - if( m_DrawIncrDecrBtn ) - { - bool IsMin = false; - bool IsMax = false; - if( !m_HierTags[m_HighlightedLine].m_Var->IsGroup() ) - { - const CTwVarAtom *Atom = static_cast(m_HierTags[m_HighlightedLine].m_Var); - double v, vmin, vmax; - v = Atom->ValueToDouble(); - Atom->MinMaxStepToDouble(&vmin, &vmax, NULL); - IsMax = (v>=vmax); - IsMin = (v<=vmin); - } - - /* - Gr->DrawRect(m_PosX+m_VarX2-2*bw+1, y0+1, m_PosX+m_VarX2-bw-1, y0+m_Font->m_CharHeight-2, (m_HighlightDecrBtn && !IsMin)?m_ColHighBtn:m_ColBtn); - Gr->DrawRect(m_PosX+m_VarX2-bw+1, y0+1, m_PosX+m_VarX2-1, y0+m_Font->m_CharHeight-2, (m_HighlightIncrBtn && !IsMax)?m_ColHighBtn:m_ColBtn); - // [-] - Gr->DrawLine(m_PosX+m_VarX2-2*bw+3+(bw>8?1:0), y0+m_Font->m_CharHeight/2, m_PosX+m_VarX2-bw-2-(bw>8?1:0), y0+m_Font->m_CharHeight/2, IsMin?m_ColValTextRO:m_ColTitleText); - // [+] - Gr->DrawLine(m_PosX+m_VarX2-bw+3, y0+m_Font->m_CharHeight/2, m_PosX+m_VarX2-2, y0+m_Font->m_CharHeight/2, IsMax?m_ColValTextRO:m_ColTitleText); - Gr->DrawLine(m_PosX+m_VarX2-bw/2, y0+m_Font->m_CharHeight/2-bw/2+2, m_PosX+m_VarX2-bw/2, y0+m_Font->m_CharHeight/2+bw/2-1, IsMax?m_ColValTextRO:m_ColTitleText); - */ - Gr->DrawRect(m_PosX+m_VarX2-3*bw+1, y0+1, m_PosX+m_VarX2-2*bw-1, y0+m_Font->m_CharHeight-2, (m_HighlightDecrBtn && !IsMin)?m_ColHighBtn:m_ColBtn); - Gr->DrawRect(m_PosX+m_VarX2-2*bw+1, y0+1, m_PosX+m_VarX2-bw-1, y0+m_Font->m_CharHeight-2, (m_HighlightIncrBtn && !IsMax)?m_ColHighBtn:m_ColBtn); - // [-] - Gr->DrawLine(m_PosX+m_VarX2-3*bw+3+(bw>8?1:0), y0+m_Font->m_CharHeight/2, m_PosX+m_VarX2-2*bw-2-(bw>8?1:0), y0+m_Font->m_CharHeight/2, IsMin?m_ColValTextRO:m_ColTitleText); - // [+] - Gr->DrawLine(m_PosX+m_VarX2-2*bw+3, y0+m_Font->m_CharHeight/2, m_PosX+m_VarX2-bw-2, y0+m_Font->m_CharHeight/2, IsMax?m_ColValTextRO:m_ColTitleText); - Gr->DrawLine(m_PosX+m_VarX2-bw-bw/2, y0+m_Font->m_CharHeight/2-bw/2+2, m_PosX+m_VarX2-bw-bw/2, y0+m_Font->m_CharHeight/2+bw/2-1, IsMax?m_ColValTextRO:m_ColTitleText); - } - else if( m_DrawListBtn ) - { - // [v] - int eps = 1; - int dx = -1; - Gr->DrawRect(m_PosX+m_VarX2-bw+1, y0+1, m_PosX+m_VarX2-1, y0+m_Font->m_CharHeight-2, m_HighlightListBtn?m_ColHighBtn:m_ColBtn); - Gr->DrawLine(m_PosX+m_VarX2-bw+4+dx, y0+m_Font->m_CharHeight/2-eps, m_PosX+m_VarX2-bw/2+1+dx, y0+m_Font->m_CharHeight-4, m_ColTitleText, true); - Gr->DrawLine(m_PosX+m_VarX2-bw/2+1+dx, y0+m_Font->m_CharHeight-4, m_PosX+m_VarX2-2+dx, y0+m_Font->m_CharHeight/2-1, m_ColTitleText, true); - } - else if( m_DrawBoolBtn ) - { - Gr->DrawRect(m_PosX+m_VarX2-bw+1, y0+1, m_PosX+m_VarX2-1, y0+m_Font->m_CharHeight-2, m_HighlightBoolBtn?m_ColHighBtn:m_ColBtn); - // [x] - //Gr->DrawLine(m_PosX+m_VarX2-bw/2-bw/6, y0+m_Font->m_CharHeight/2-bw/6, m_PosX+m_VarX2-bw/2+bw/6, y0+m_Font->m_CharHeight/2+bw/6, m_ColTitleText, true); - //Gr->DrawLine(m_PosX+m_VarX2-bw/2-bw/6, y0+m_Font->m_CharHeight/2+bw/6, m_PosX+m_VarX2-bw/2+bw/6, y0+m_Font->m_CharHeight/2-bw/6, m_ColTitleText, true); - // [<>] - int s = bw/4; - int eps = 1; - Gr->DrawLine(m_PosX+m_VarX2-bw/2-1, y0+m_Font->m_CharHeight/2-s, m_PosX+m_VarX2-bw/2-s-1, y0+m_Font->m_CharHeight/2, m_ColTitleText, true); - Gr->DrawLine(m_PosX+m_VarX2-bw/2-s-1, y0+m_Font->m_CharHeight/2, m_PosX+m_VarX2-bw/2-eps, y0+m_Font->m_CharHeight/2+s+1-eps, m_ColTitleText, true); - //Gr->DrawLine(m_PosX+m_VarX2-bw/2+1, y0+m_Font->m_CharHeight/2+s, m_PosX+m_VarX2-bw/2+s+1, y0+m_Font->m_CharHeight/2, m_ColTitleText, true); - //Gr->DrawLine(m_PosX+m_VarX2-bw/2+s+1, y0+m_Font->m_CharHeight/2, m_PosX+m_VarX2-bw/2+1, y0+m_Font->m_CharHeight/2-s, m_ColTitleText, true); - Gr->DrawLine(m_PosX+m_VarX2-bw/2+2, y0+m_Font->m_CharHeight/2-s, m_PosX+m_VarX2-bw/2+s+2, y0+m_Font->m_CharHeight/2, m_ColTitleText, true); - Gr->DrawLine(m_PosX+m_VarX2-bw/2+s+2, y0+m_Font->m_CharHeight/2, m_PosX+m_VarX2-bw/2+1+eps, y0+m_Font->m_CharHeight/2+s+1-eps, m_ColTitleText, true); - } - - if( m_DrawRotoBtn ) - { - // [o] rotoslider button - /* - Gr->DrawRect(m_PosX+m_VarX1-bw-1, y0+1, m_PosX+m_VarX1-3, y0+m_Font->m_CharHeight-2, m_HighlightRotoBtn?m_ColHighBtn:m_ColBtn); - Gr->DrawLine(m_PosX+m_VarX1-bw+bw/2-2, y0+m_Font->m_CharHeight/2-1, m_PosX+m_VarX1-bw+bw/2-1, y0+m_Font->m_CharHeight/2-1, m_ColTitleText); - Gr->DrawLine(m_PosX+m_VarX1-bw+bw/2-3, y0+m_Font->m_CharHeight/2+0, m_PosX+m_VarX1-bw+bw/2+0, y0+m_Font->m_CharHeight/2+0, m_ColTitleText); - Gr->DrawLine(m_PosX+m_VarX1-bw+bw/2-3, y0+m_Font->m_CharHeight/2+1, m_PosX+m_VarX1-bw+bw/2+0, y0+m_Font->m_CharHeight/2+1, m_ColTitleText); - Gr->DrawLine(m_PosX+m_VarX1-bw+bw/2-2, y0+m_Font->m_CharHeight/2+2, m_PosX+m_VarX1-bw+bw/2-1, y0+m_Font->m_CharHeight/2+2, m_ColTitleText); - */ - /* - Gr->DrawRect(m_PosX+m_VarX2-3*bw+1, y0+1, m_PosX+m_VarX2-2*bw-1, y0+m_Font->m_CharHeight-2, m_HighlightRotoBtn?m_ColHighBtn:m_ColBtn); - Gr->DrawLine(m_PosX+m_VarX2-3*bw+bw/2+0, y0+m_Font->m_CharHeight/2-1, m_PosX+m_VarX2-3*bw+bw/2+1, y0+m_Font->m_CharHeight/2-1, m_ColTitleText); - Gr->DrawLine(m_PosX+m_VarX2-3*bw+bw/2-1, y0+m_Font->m_CharHeight/2+0, m_PosX+m_VarX2-3*bw+bw/2+2, y0+m_Font->m_CharHeight/2+0, m_ColTitleText); - Gr->DrawLine(m_PosX+m_VarX2-3*bw+bw/2-1, y0+m_Font->m_CharHeight/2+1, m_PosX+m_VarX2-3*bw+bw/2+2, y0+m_Font->m_CharHeight/2+1, m_ColTitleText); - Gr->DrawLine(m_PosX+m_VarX2-3*bw+bw/2+0, y0+m_Font->m_CharHeight/2+2, m_PosX+m_VarX2-3*bw+bw/2+1, y0+m_Font->m_CharHeight/2+2, m_ColTitleText); - */ - int dy = 0; - Gr->DrawRect(m_PosX+m_VarX2-bw+1, y0+1, m_PosX+m_VarX2-1, y0+m_Font->m_CharHeight-2, m_HighlightRotoBtn?m_ColHighBtn:m_ColBtn); - Gr->DrawLine(m_PosX+m_VarX2-bw+bw/2+0, y0+m_Font->m_CharHeight/2-1+dy, m_PosX+m_VarX2-bw+bw/2+1, y0+m_Font->m_CharHeight/2-1+dy, m_ColTitleText, true); - Gr->DrawLine(m_PosX+m_VarX2-bw+bw/2-1, y0+m_Font->m_CharHeight/2+0+dy, m_PosX+m_VarX2-bw+bw/2+2, y0+m_Font->m_CharHeight/2+0+dy, m_ColTitleText, true); - Gr->DrawLine(m_PosX+m_VarX2-bw+bw/2-1, y0+m_Font->m_CharHeight/2+1+dy, m_PosX+m_VarX2-bw+bw/2+2, y0+m_Font->m_CharHeight/2+1+dy, m_ColTitleText, true); - Gr->DrawLine(m_PosX+m_VarX2-bw+bw/2+0, y0+m_Font->m_CharHeight/2+2+dy, m_PosX+m_VarX2-bw+bw/2+1, y0+m_Font->m_CharHeight/2+2+dy, m_ColTitleText, true); - } - } - - - // Draw value width slider - if( !m_HighlightValWidth ) - { - color32 col = m_DarkText ? COLOR32_WHITE : m_ColTitleText; - Gr->DrawRect(m_PosX+m_VarX1-2, m_PosY+m_VarY0-8, m_PosX+m_VarX1-1, m_PosY+m_VarY0-4, col); - Gr->DrawLine(m_PosX+m_VarX1-1, m_PosY+m_VarY0-3, m_PosX+m_VarX1, m_PosY+m_VarY0-3, m_ColLineShadow); - Gr->DrawLine(m_PosX+m_VarX1, m_PosY+m_VarY0-3, m_PosX+m_VarX1, m_PosY+m_VarY0-8, m_ColLineShadow); - } - else - { - color32 col = m_DarkText ? COLOR32_WHITE : m_ColTitleText; - Gr->DrawRect(m_PosX+m_VarX1-2, m_PosY+m_VarY0-8, m_PosX+m_VarX1-1, m_PosY+m_VarY1, col); - Gr->DrawLine(m_PosX+m_VarX1-1, m_PosY+m_VarY1+1, m_PosX+m_VarX1, m_PosY+m_VarY1+1, m_ColLineShadow); - Gr->DrawLine(m_PosX+m_VarX1, m_PosY+m_VarY1+1, m_PosX+m_VarX1, m_PosY+m_VarY0-8, m_ColLineShadow); - } - - // Draw labels & values headers - if (m_HighlightLabelsHeader) - { - Gr->DrawRect(m_PosX+m_VarX0, m_PosY+m_Font->m_CharHeight+2, m_PosX+m_VarX1-4, m_PosY+m_VarY0-1, m_ColHighBg0, m_ColHighBg0, m_ColHighBg1, m_ColHighBg1); - } - if (m_HighlightValuesHeader) - { - Gr->DrawRect(m_PosX+m_VarX1+2, m_PosY+m_Font->m_CharHeight+2, m_PosX+m_VarX2, m_PosY+m_VarY0-1, m_ColHighBg0, m_ColHighBg0, m_ColHighBg1, m_ColHighBg1); - } - } - - // Draw key shortcut text - if( m_HighlightedLine>=0 && m_HighlightedLine==m_ShortcutLine && !m_IsPopupList && !m_EditInPlace.m_Active ) - { - PERF( Timer.Reset(); ) - Gr->DrawRect(m_PosX+m_Font->m_CharHeight-2, m_PosY+m_VarY1+1, m_PosX+m_Width-m_Font->m_CharHeight-2, m_PosY+m_VarY1+1+m_Font->m_CharHeight, m_ColShortcutBg); - Gr->DrawText(m_ShortcutTextObj, m_PosX+m_Font->m_CharHeight, m_PosY+m_VarY1+1, m_ColShortcutText, 0); - PERF( DT = Timer.GetTime(); printf("Shortcut=%.4fms ", 1000.0*DT); ) - } - else if( (m_HighlightLabelsHeader || m_HighlightValuesHeader) && !m_IsPopupList && !m_EditInPlace.m_Active ) - { - Gr->DrawRect(m_PosX+m_Font->m_CharHeight-2, m_PosY+m_VarY1+1, m_PosX+m_Width-m_Font->m_CharHeight-2, m_PosY+m_VarY1+1+m_Font->m_CharHeight, m_ColShortcutBg); - Gr->DrawText(m_HeadersTextObj, m_PosX+m_Font->m_CharHeight, m_PosY+m_VarY1+1, m_ColShortcutText, 0); - } - else if( m_IsHelpBar ) - { - if( g_TwMgr->m_KeyPressedTextObj && g_TwMgr->m_KeyPressedStr.size()>0 ) // Draw key pressed - { - if( g_TwMgr->m_KeyPressedBuildText ) - { - string Str = g_TwMgr->m_KeyPressedStr; - ClampText(Str, m_Font, m_Width-2*m_Font->m_CharHeight); - g_TwMgr->m_Graph->BuildText(g_TwMgr->m_KeyPressedTextObj, &Str, NULL, NULL, 1, g_TwMgr->m_HelpBar->m_Font, 0, 0); - g_TwMgr->m_KeyPressedBuildText = false; - g_TwMgr->m_KeyPressedTime = (float)g_BarTimer.GetTime(); - } - if( (float)g_BarTimer.GetTime()>g_TwMgr->m_KeyPressedTime+1.0f ) // draw key pressed at least 1 second - g_TwMgr->m_KeyPressedStr = ""; - PERF( Timer.Reset(); ) - Gr->DrawRect(m_PosX+m_Font->m_CharHeight-2, m_PosY+m_VarY1+1, m_PosX+m_Width-m_Font->m_CharHeight-2, m_PosY+m_VarY1+1+m_Font->m_CharHeight, m_ColShortcutBg); - Gr->DrawText(g_TwMgr->m_KeyPressedTextObj, m_PosX+m_Font->m_CharHeight, m_PosY+m_VarY1+1, m_ColShortcutText, 0); - PERF( DT = Timer.GetTime(); printf("KeyPressed=%.4fms ", 1000.0*DT); ) - } - else - { - if( g_TwMgr->m_InfoBuildText ) - { - string Info = "atb "; - char Ver[64]; - sprintf(Ver, " %d.%02d", TW_VERSION/100, TW_VERSION%100); - Info += Ver; - ClampText(Info, m_Font, m_Width-2*m_Font->m_CharHeight); - g_TwMgr->m_Graph->BuildText(g_TwMgr->m_InfoTextObj, &Info, NULL, NULL, 1, g_TwMgr->m_HelpBar->m_Font, 0, 0); - g_TwMgr->m_InfoBuildText = false; - } - PERF( Timer.Reset(); ) - Gr->DrawRect(m_PosX+m_Font->m_CharHeight-2, m_PosY+m_VarY1+1, m_PosX+m_Width-m_Font->m_CharHeight-2, m_PosY+m_VarY1+1+m_Font->m_CharHeight, m_ColShortcutBg); - Gr->DrawText(g_TwMgr->m_InfoTextObj, m_PosX+m_Font->m_CharHeight, m_PosY+m_VarY1+1, m_ColInfoText, 0); - PERF( DT = Timer.GetTime(); printf("Info=%.4fms ", 1000.0*DT); ) - } - } - - if( !m_IsPopupList ) - { - // Draw RotoSlider - RotoDraw(); - - // Draw EditInPlace - EditInPlaceDraw(); - } - - if( g_TwMgr->m_PopupBar!=NULL && this!=g_TwMgr->m_PopupBar ) - { - // darken bar if a popup bar is displayed - Gr->DrawRect(m_PosX, m_PosY, m_PosX+m_Width-1, m_PosY+m_Height-1, 0x1F000000); - } - } - } - else // minimized - { - int vpx, vpy, vpw, vph; - vpx = 0; - vpy = 0; - vpw = g_TwMgr->m_WndWidth; - vph = g_TwMgr->m_WndHeight; - if( g_TwMgr->m_IconMarginX>0 ) - { - vpx = min(g_TwMgr->m_IconMarginX, vpw/3); - vpw -= 2 * vpx; - } - if( g_TwMgr->m_IconMarginY>0 ) - { - vpy = min(g_TwMgr->m_IconMarginY, vph/3); - vph -= 2 * vpy; - } - - int MinXOffset = 0, MinYOffset = 0; - if( g_TwMgr->m_IconPos==3 ) // top-right - { - if( g_TwMgr->m_IconAlign==1 ) // horizontal - { - int n = max(1, vpw/m_Font->m_CharHeight-1); - m_MinPosX = vpx + vpw-((m_MinNumber%n)+1)*m_Font->m_CharHeight; - m_MinPosY = vpy + (m_MinNumber/n)*m_Font->m_CharHeight; - MinYOffset = m_Font->m_CharHeight; - MinXOffset = -m_TitleWidth; - } - else // vertical - { - int n = max(1, vph/m_Font->m_CharHeight-1); - m_MinPosY = vpy + (m_MinNumber%n)*m_Font->m_CharHeight; - m_MinPosX = vpx + vpw-((m_MinNumber/n)+1)*m_Font->m_CharHeight; - MinXOffset = -m_TitleWidth-m_Font->m_CharHeight; - } - } - else if( g_TwMgr->m_IconPos==2 ) // top-left - { - if( g_TwMgr->m_IconAlign==1 ) // horizontal - { - int n = max(1, vpw/m_Font->m_CharHeight-1); - m_MinPosX = vpx + (m_MinNumber%n)*m_Font->m_CharHeight; - m_MinPosY = vpy + (m_MinNumber/n)*m_Font->m_CharHeight; - MinYOffset = m_Font->m_CharHeight; - } - else // vertical - { - int n = max(1, vph/m_Font->m_CharHeight-1); - m_MinPosY = vpy + (m_MinNumber%n)*m_Font->m_CharHeight; - m_MinPosX = vpx + (m_MinNumber/n)*m_Font->m_CharHeight; - MinXOffset = m_Font->m_CharHeight; - } - } - else if( g_TwMgr->m_IconPos==1 ) // bottom-right - { - if( g_TwMgr->m_IconAlign==1 ) // horizontal - { - int n = max(1, vpw/m_Font->m_CharHeight-1); - m_MinPosX = vpx + vpw-((m_MinNumber%n)+1)*m_Font->m_CharHeight; - m_MinPosY = vpy + vph-((m_MinNumber/n)+1)*m_Font->m_CharHeight; - MinYOffset = -m_Font->m_CharHeight; - MinXOffset = -m_TitleWidth; - } - else // vertical - { - int n = max(1, vph/m_Font->m_CharHeight-1); - m_MinPosY = vpy + vph-((m_MinNumber%n)+1)*m_Font->m_CharHeight; - m_MinPosX = vpx + vpw-((m_MinNumber/n)+1)*m_Font->m_CharHeight; - MinXOffset = -m_TitleWidth-m_Font->m_CharHeight; - } - } - else // bottom-left - { - if( g_TwMgr->m_IconAlign==1 ) // horizontal - { - int n = max(1, vpw/m_Font->m_CharHeight-1); - m_MinPosX = vpx + (m_MinNumber%n)*m_Font->m_CharHeight; - m_MinPosY = vpy + vph-((m_MinNumber/n)+1)*m_Font->m_CharHeight; - MinYOffset = -m_Font->m_CharHeight; - } - else // vertical - { - int n = max(1, vph/m_Font->m_CharHeight-1); - m_MinPosY = vpy + vph-((m_MinNumber%n)+1)*m_Font->m_CharHeight; - m_MinPosX = vpx + (m_MinNumber/n)*m_Font->m_CharHeight; - MinXOffset = m_Font->m_CharHeight; - } - } - - if( m_HighlightMaximize ) - { - // Draw title - if( _DrawPart&DRAW_BG ) - { - Gr->DrawRect(m_MinPosX, m_MinPosY, m_MinPosX+m_Font->m_CharHeight, m_MinPosY+m_Font->m_CharHeight, m_ColTitleUnactiveBg); - Gr->DrawRect(m_MinPosX+MinXOffset, m_MinPosY+MinYOffset, m_MinPosX+MinXOffset+m_TitleWidth+m_Font->m_CharHeight, m_MinPosY+MinYOffset+m_Font->m_CharHeight, m_ColTitleUnactiveBg); - } - if( _DrawPart&DRAW_CONTENT ) - { - if( m_ColTitleShadow!=0 ) - Gr->DrawText(m_TitleTextObj, m_MinPosX+MinXOffset+m_Font->m_CharHeight/2, m_MinPosY+1+MinYOffset, m_ColTitleShadow, 0); - Gr->DrawText(m_TitleTextObj, m_MinPosX+MinXOffset+m_Font->m_CharHeight/2, m_MinPosY+MinYOffset, m_ColTitleText, 0); - } - } - - if( !m_IsHelpBar ) - { - // Draw maximize button - int xm = m_MinPosX+2, wm=m_Font->m_CharHeight-6; - wm = (wm<6) ? 6 : wm; - if( _DrawPart&DRAW_BG ) - Gr->DrawRect(xm+1, m_MinPosY+4, xm+wm-1, m_MinPosY+3+wm, m_HighlightMaximize?m_ColHighBtn:m_ColBtn); - if( _DrawPart&DRAW_CONTENT ) - { - Gr->DrawLine(xm, m_MinPosY+3, xm+wm, m_MinPosY+3, m_ColLine); - Gr->DrawLine(xm+wm, m_MinPosY+3, xm+wm, m_MinPosY+3+wm, m_ColLine); - Gr->DrawLine(xm+wm, m_MinPosY+3+wm, xm, m_MinPosY+3+wm, m_ColLine); - Gr->DrawLine(xm, m_MinPosY+3+wm, xm, m_MinPosY+3, m_ColLine); - Gr->DrawLine(xm+wm+1, m_MinPosY+4, xm+wm+1, m_MinPosY+4+wm, m_ColLineShadow); - Gr->DrawLine(xm+wm+1, m_MinPosY+4+wm, xm, m_MinPosY+4+wm, m_ColLineShadow); - Gr->DrawLine(xm+wm/3-1, m_MinPosY+3+wm-wm/3, xm+wm/2, m_MinPosY+6, m_ColTitleText, true); - Gr->DrawLine(xm+wm-wm/3+1, m_MinPosY+3+wm-wm/3, xm+wm/2, m_MinPosY+6, m_ColTitleText, true); - } - } - else - { - // Draw help button - int xm = m_MinPosX+2, wm=m_Font->m_CharHeight-6; - wm = (wm<6) ? 6 : wm; - if( _DrawPart&DRAW_BG ) - Gr->DrawRect(xm+1, m_MinPosY+4, xm+wm-1, m_MinPosY+3+wm, m_HighlightMaximize?m_ColHighBtn:m_ColBtn); - if( _DrawPart&DRAW_CONTENT ) - { - Gr->DrawLine(xm, m_MinPosY+3, xm+wm, m_MinPosY+3, m_ColLine); - Gr->DrawLine(xm+wm, m_MinPosY+3, xm+wm, m_MinPosY+3+wm, m_ColLine); - Gr->DrawLine(xm+wm, m_MinPosY+3+wm, xm, m_MinPosY+3+wm, m_ColLine); - Gr->DrawLine(xm, m_MinPosY+3+wm, xm, m_MinPosY+3, m_ColLine); - Gr->DrawLine(xm+wm+1, m_MinPosY+4, xm+wm+1, m_MinPosY+4+wm, m_ColLineShadow); - Gr->DrawLine(xm+wm+1, m_MinPosY+4+wm, xm, m_MinPosY+4+wm, m_ColLineShadow); - Gr->DrawLine(xm+wm/2-wm/6, m_MinPosY+3+wm/4, xm+wm-wm/3, m_MinPosY+3+wm/4, m_ColTitleText); - Gr->DrawLine(xm+wm-wm/3, m_MinPosY+3+wm/4, xm+wm-wm/3, m_MinPosY+3+wm/2, m_ColTitleText); - Gr->DrawLine(xm+wm-wm/3, m_MinPosY+3+wm/2, xm+wm/2, m_MinPosY+3+wm/2, m_ColTitleText); - Gr->DrawLine(xm+wm/2, m_MinPosY+3+wm/2, xm+wm/2, m_MinPosY+3+wm-wm/4, m_ColTitleText); - Gr->DrawLine(xm+wm/2, m_MinPosY+3+wm-wm/4+1, xm+wm/2, m_MinPosY+3+wm-wm/4+2, m_ColTitleText); - } - } - } -} - -// --------------------------------------------------------------------------- - -bool CTwBar::MouseMotion(int _X, int _Y) -{ - assert(g_TwMgr->m_Graph && g_TwMgr->m_WndHeight>0 && g_TwMgr->m_WndWidth>0); - if( !m_UpToDate ) - Update(); - - bool Handled = false; - bool CustomArea = false; - if( !m_IsMinimized ) - { - bool InBar = (_X>=m_PosX && _X=m_PosY && _Ym_Bars.size(); ++ib ) - if( g_TwMgr->m_Bars[ib]!=NULL ) - { - g_TwMgr->m_Bars[ib]->m_DrawHandles = false; - g_TwMgr->m_Bars[ib]->m_HighlightTitle = false; - } - m_DrawHandles = InBar; - const int ContainedMargin = 32; - - if( !m_MouseDrag ) - { - Handled = InBar; - m_HighlightedLine = -1; - m_HighlightIncrBtn = false; - m_HighlightDecrBtn = false; - m_HighlightRotoBtn = false; - if( abs(m_MouseOriginX-_X)>6 || abs(m_MouseOriginY-_Y)>6 ) - m_HighlightClickBtn = false; - m_HighlightListBtn = false; - m_HighlightTitle = false; - m_HighlightScroll = false; - m_HighlightUpScroll = false; - m_HighlightDnScroll = false; - m_HighlightMinimize = false; - m_HighlightFont = false; - m_HighlightValWidth = false; - m_HighlightLabelsHeader = false; - m_HighlightValuesHeader = false; - //if( InBar && _X>m_PosX+m_Font->m_CharHeight+1 && _X=m_PosY+m_VarY0 && _Ym_PosX+2 && _X=m_PosY+m_VarY0 && _Ym_CharHeight+m_LineSep); - if( m_HighlightedLine>=(int)m_HierTags.size() ) - m_HighlightedLine = -1; - else if(m_HighlightedLine>=0) - m_HighlightedLineLastValid = m_HighlightedLine; - if( m_HighlightedLine<0 || m_HierTags[m_HighlightedLine].m_Var==NULL || m_HierTags[m_HighlightedLine].m_Var->IsGroup() ) - ANT_SET_CURSOR(Arrow); - else - { - if( !m_HierTags[m_HighlightedLine].m_Var->IsGroup() && static_cast(m_HierTags[m_HighlightedLine].m_Var)->m_NoSlider ) - { - if( static_cast(m_HierTags[m_HighlightedLine].m_Var)->m_ReadOnly && !m_IsHelpBar - && !(static_cast(m_HierTags[m_HighlightedLine].m_Var)->m_Type==TW_TYPE_BUTTON && static_cast(m_HierTags[m_HighlightedLine].m_Var)->m_Val.m_Button.m_Callback==NULL) ) - ANT_SET_CURSOR(No); //(Arrow); - else - { - ANT_SET_CURSOR(Arrow); - CustomArea = true; - } - - if( m_DrawListBtn ) - { - m_HighlightListBtn = true; - CustomArea = false; - } - if( m_DrawBoolBtn ) - { - m_HighlightBoolBtn = true; - CustomArea = false; - } - } - else if( m_DrawRotoBtn && ( _X>=m_PosX+m_VarX2-IncrBtnWidth(m_Font->m_CharHeight) || _X=m_PosX+m_VarX2-2*IncrBtnWidth(m_Font->m_CharHeight) ) // [+] button - { - m_HighlightIncrBtn = true; - ANT_SET_CURSOR(Arrow); - } - else if( m_DrawIncrDecrBtn && _X>=m_PosX+m_VarX2-3*IncrBtnWidth(m_Font->m_CharHeight) ) // [-] button - { - m_HighlightDecrBtn = true; - ANT_SET_CURSOR(Arrow); - } - else if( !m_HierTags[m_HighlightedLine].m_Var->IsGroup() && static_cast(m_HierTags[m_HighlightedLine].m_Var)->m_ReadOnly ) - { - if( !m_IsHelpBar ) - ANT_SET_CURSOR(No); - else - ANT_SET_CURSOR(Arrow); - } - else - //ANT_SET_CURSOR(Point); - ANT_SET_CURSOR(IBeam); - } - } - else if( InBar && m_Movable && !m_IsPopupList && _X>=m_PosX+2*m_Font->m_CharHeight && _Xm_CharHeight && _Ym_CharHeight ) - { // mouse over title - m_HighlightTitle = true; - ANT_SET_CURSOR(Move); - } - else if ( InBar && !m_IsPopupList && _X>=m_PosX+m_VarX1-5 && _Xm_PosY+m_Font->m_CharHeight && _Y=m_PosX+m_VarX0 && _Xm_PosY+m_Font->m_CharHeight && _Y=m_PosX+m_VarX1+5 && _Xm_PosY+m_Font->m_CharHeight && _Y=m_PosX && _Xm_CharHeight && _Y>=m_ScrollY0 && _Y=m_PosX+m_VarX2+2 && _X=m_ScrollY0 && _Y=m_PosX+m_VarX2+2 && _X=m_PosY+m_VarY0 && _Y=m_PosX+m_VarX2+2 && _X=m_ScrollY1 && _Y=m_PosX && _Xm_CharHeight && _Y>=m_PosY && _Ym_CharHeight ) - ANT_SET_CURSOR(TopLeft); - else if( InBar && !m_IsPopupList && _X>=m_PosX && _Xm_CharHeight && _Y>=m_PosY+m_Height-m_Font->m_CharHeight && _Y=m_PosX+m_Width-m_Font->m_CharHeight && _X=m_PosY && _Ym_CharHeight ) - ANT_SET_CURSOR(TopRight); - else if( InBar && m_Resizable && !m_IsPopupList && _X>=m_PosX+m_Width-m_Font->m_CharHeight && _X=m_PosY+m_Height-m_Font->m_CharHeight && _Ym_FontResizable && !m_IsPopupList && _X>=m_PosX+m_Font->m_CharHeight && _Xm_CharHeight && _Ym_CharHeight ) - { - m_HighlightFont = true; - ANT_SET_CURSOR(Arrow); - } - else if( InBar && m_Iconifiable && !m_IsPopupList && _X>=m_PosX+m_Width-2*m_Font->m_CharHeight && _Xm_CharHeight && _Ym_CharHeight ) - { - m_HighlightMinimize = true; - ANT_SET_CURSOR(Arrow); - } - else if( m_IsHelpBar && InBar && _X>=m_PosX+m_VarX0 && _Xm_CharHeight && _Y>m_PosY+m_Height-m_Font->m_CharHeight && _Y=0 && m_HighlightedLine<(int)m_HierTags.size() && m_HierTags[m_HighlightedLine].m_Var && !m_HierTags[m_HighlightedLine].m_Var->IsGroup() ) - { - /* - CTwVarAtom *Var = static_cast(m_HierTags[m_HighlightedLine].m_Var); - int Delta = _X-m_MouseOriginX; - if( Delta!=0 ) - { - if( !Var->m_NoSlider && !Var->m_ReadOnly ) - { - Var->Increment(Delta); - NotUpToDate(); - } - m_VarHasBeenIncr = true; - } - m_MouseOriginX = _X; - m_MouseOriginY = _Y; - if( !Var->m_NoSlider && !Var->m_ReadOnly ) - ANT_SET_CURSOR(Center); - //ANT_SET_CURSOR(WE); - else - ANT_SET_CURSOR(Arrow); - Handled = true; - */ - - // move rotoslider - if( !static_cast(m_HierTags[m_HighlightedLine].m_Var)->m_NoSlider ) - RotoOnMouseMove(_X, _Y); - - if( static_cast(m_HierTags[m_HighlightedLine].m_Var)->m_ReadOnly ) - ANT_SET_CURSOR(No); - else if( static_cast(m_HierTags[m_HighlightedLine].m_Var)->m_NoSlider ) - { - ANT_SET_CURSOR(Arrow); - CustomArea = true; - } - m_VarHasBeenIncr = true; - Handled = true; - m_DrawHandles = true; - } - else if( m_MouseDragTitle ) - { - int y = m_PosY; - m_PosX += _X-m_MouseOriginX; - m_PosY += _Y-m_MouseOriginY; - m_MouseOriginX = _X; - m_MouseOriginY = _Y; - int vpx, vpy, vpw, vph; - vpx = 0; - vpy = 0; - vpw = g_TwMgr->m_WndWidth; - vph = g_TwMgr->m_WndHeight; - if( m_Contained ) - { - if( m_PosX+m_Width>vpx+vpw ) - m_PosX = vpx+vpw-m_Width; - if( m_PosXvpy+vph ) - m_PosY = vpy+vph-m_Height; - if( m_PosYvpx+vpw ) - m_PosX = vpx+vpw-ContainedMargin; - if( m_PosX+m_Widthvpy+vph ) - m_PosY = vpy+vph-ContainedMargin; - if( m_PosY+m_Heightm_HelpBarNotUpToDate = true; - ANT_SET_CURSOR(WE); - Handled = true; - m_DrawHandles = true; - } - else if( m_MouseDragScroll ) - { - if( m_ScrollYH>0 ) - { - int dl = ((_Y-m_MouseOriginY)*m_NbHierLines)/m_ScrollYH; - if( m_FirstLine0+dl<0 ) - m_FirstLine = 0; - else if( m_FirstLine0+dl+m_NbDisplayedLines>m_NbHierLines ) - m_FirstLine = m_NbHierLines-m_NbDisplayedLines; - else - m_FirstLine = m_FirstLine0+dl; - NotUpToDate(); - } - #ifdef ANT_WINDOWS - ANT_SET_CURSOR(NS); - #else - ANT_SET_CURSOR(Arrow); - #endif - Handled = true; - m_DrawHandles = true; - } - else if( m_MouseDragResizeUL ) - { - int w = m_Width; - int h = m_Height; - m_PosX += _X-m_MouseOriginX; - m_PosY += _Y-m_MouseOriginY; - m_Width -= _X-m_MouseOriginX; - m_Height -= _Y-m_MouseOriginY; - m_MouseOriginX = _X; - m_MouseOriginY = _Y; - int vpx = 0, vpy = 0, vpw = g_TwMgr->m_WndWidth, vph = g_TwMgr->m_WndHeight; - if( !m_Contained ) - { - if( m_PosX+ContainedMargin>vpx+vpw ) - m_PosX = vpx+vpw-ContainedMargin; - if( m_PosX+m_Widthvpy+vph ) - m_PosY = vpy+vph-ContainedMargin; - if( m_PosY+m_Height 0) - m_ValuesWidth = int(m_ValuesWidthRatio * m_Width + 0.5); - ANT_SET_CURSOR(TopLeft); - NotUpToDate(); - if( m_IsHelpBar ) - { - g_TwMgr->m_HelpBarNotUpToDate = true; - g_TwMgr->m_HelpBarUpdateNow = true; - } - g_TwMgr->m_KeyPressedBuildText = true; - g_TwMgr->m_InfoBuildText = true; - Handled = true; - m_DrawHandles = true; - } - else if( m_MouseDragResizeUR ) - { - int h = m_Height; - m_PosY += _Y-m_MouseOriginY; - m_Width += _X-m_MouseOriginX; - m_Height -= _Y-m_MouseOriginY; - m_MouseOriginX = _X; - m_MouseOriginY = _Y; - int vpx = 0, vpy = 0, vpw = g_TwMgr->m_WndWidth, vph = g_TwMgr->m_WndHeight; - if( !m_Contained ) - { - if( m_PosX+ContainedMargin>vpx+vpw ) - m_PosX = vpx+vpw-ContainedMargin; - if( m_PosX+m_Widthvpy+vph ) - m_PosY = vpy+vph-ContainedMargin; - if( m_PosY+m_Heightvpx+vpw ) - m_Width = vpx+vpw-m_PosX; - if( m_PosY 0) - m_ValuesWidth = int(m_ValuesWidthRatio * m_Width + 0.5); - ANT_SET_CURSOR(TopRight); - NotUpToDate(); - if( m_IsHelpBar ) - { - g_TwMgr->m_HelpBarNotUpToDate = true; - g_TwMgr->m_HelpBarUpdateNow = true; - } - g_TwMgr->m_KeyPressedBuildText = true; - g_TwMgr->m_InfoBuildText = true; - Handled = true; - m_DrawHandles = true; - } - else if( m_MouseDragResizeLL ) - { - int w = m_Width; - m_PosX += _X-m_MouseOriginX; - m_Width -= _X-m_MouseOriginX; - m_Height += _Y-m_MouseOriginY; - m_MouseOriginX = _X; - m_MouseOriginY = _Y; - int vpx = 0, vpy = 0, vpw = g_TwMgr->m_WndWidth, vph = g_TwMgr->m_WndHeight; - if( !m_Contained ) - { - if( m_PosX+ContainedMargin>vpx+vpw ) - m_PosX = vpx+vpw-ContainedMargin; - if( m_PosX+m_Widthvpy+vph ) - m_PosY = vpy+vph-ContainedMargin; - if( m_PosY+m_Heightvpy+vph ) - m_Height = vpy+vph-m_PosY; - if( m_PosX 0) - m_ValuesWidth = int(m_ValuesWidthRatio * m_Width + 0.5); - ANT_SET_CURSOR(BottomLeft); - NotUpToDate(); - if( m_IsHelpBar ) - { - g_TwMgr->m_HelpBarNotUpToDate = true; - g_TwMgr->m_HelpBarUpdateNow = true; - } - g_TwMgr->m_KeyPressedBuildText = true; - g_TwMgr->m_InfoBuildText = true; - Handled = true; - m_DrawHandles = true; - } - else if( m_MouseDragResizeLR ) - { - m_Width += _X-m_MouseOriginX; - m_Height += _Y-m_MouseOriginY; - m_MouseOriginX = _X; - m_MouseOriginY = _Y; - int vpx = 0, vpy = 0, vpw = g_TwMgr->m_WndWidth, vph = g_TwMgr->m_WndHeight; - if( !m_Contained ) - { - if( m_PosX+ContainedMargin>vpx+vpw ) - m_PosX = vpx+vpw-ContainedMargin; - if( m_PosX+m_Widthvpy+vph ) - m_PosY = vpy+vph-ContainedMargin; - if( m_PosY+m_Heightvpx+vpw ) - m_Width = vpx+vpw-m_PosX; - if( m_PosY+m_Height>vpy+vph ) - m_Height = vpy+vph-m_PosY; - } - if (m_ValuesWidthRatio > 0) - m_ValuesWidth = int(m_ValuesWidthRatio * m_Width + 0.5); - ANT_SET_CURSOR(BottomRight); - NotUpToDate(); - if( m_IsHelpBar ) - { - g_TwMgr->m_HelpBarNotUpToDate = true; - g_TwMgr->m_HelpBarUpdateNow = true; - } - g_TwMgr->m_KeyPressedBuildText = true; - g_TwMgr->m_InfoBuildText = true; - Handled = true; - m_DrawHandles = true; - } - else if( m_EditInPlace.m_Active ) - { - EditInPlaceMouseMove(_X, _Y, true); - ANT_SET_CURSOR(IBeam); - Handled = true; - } - //else if( InBar ) - // ANT_SET_CURSOR(Arrow); - } - } - else // minimized - { - if( m_Iconifiable && _X>=m_MinPosX+2 && _Xm_CharHeight && _Y>m_MinPosY && _Ym_CharHeight-2 ) - { - m_HighlightMaximize = true; - if( !m_IsHelpBar ) - ANT_SET_CURSOR(Arrow); - else - #ifdef ANT_WINDOWS - ANT_SET_CURSOR(Help); - #else - ANT_SET_CURSOR(Arrow); - #endif - Handled = true; - } - else - m_HighlightMaximize = false; - } - - // Handled by a custom widget? - CTwMgr::CStructProxy *currentCustomActiveStructProxy = NULL; - if( g_TwMgr!=NULL && (!Handled || CustomArea) && !m_IsMinimized && m_CustomRecords.size()>0 ) - { - bool CustomHandled = false; - for( int s=0; s<2; ++s ) // 2 iterations: first for custom widget having focus, second for others if no focused widget. - for( CustomMap::iterator it=m_CustomRecords.begin(); it!=m_CustomRecords.end(); ++it ) - { - CTwMgr::CStructProxy *sProxy = it->first; - const CCustomRecord& r = it->second; - if( (s==1 || sProxy->m_CustomCaptureFocus) && !CustomHandled && sProxy!=NULL && sProxy->m_CustomMouseMotionCallback!=NULL && r.m_XMin=r.m_Y0 && r.m_YMax<=r.m_Y1 ) - { - if( sProxy->m_CustomCaptureFocus || (_X>=r.m_XMin && _X=r.m_YMin && _Ym_CustomMouseMotionCallback(_X-r.m_XMin, _Y-r.m_Y0, r.m_XMax-r.m_XMin, r.m_Y1-r.m_Y0, sProxy->m_StructExtData, sProxy->m_StructClientData, this, r.m_Var); - currentCustomActiveStructProxy = sProxy; - s = 2; // force s-loop exit - } - } - else if( sProxy!=NULL ) - { - sProxy->m_CustomCaptureFocus = false; // force free focus, just in case. - ANT_SET_CURSOR(Arrow); - } - } - if( CustomHandled ) - Handled = true; - } - // If needed, send a 'MouseLeave' message to previously active custom struct - if( g_TwMgr!=NULL && m_CustomActiveStructProxy!=NULL && m_CustomActiveStructProxy!=currentCustomActiveStructProxy ) - { - bool found = false; - for( list::iterator it=g_TwMgr->m_StructProxies.begin(); it!=g_TwMgr->m_StructProxies.end() && !found; ++it ) - found = (&(*it)==m_CustomActiveStructProxy); - if( found && m_CustomActiveStructProxy->m_CustomMouseLeaveCallback!=NULL ) - m_CustomActiveStructProxy->m_CustomMouseLeaveCallback(m_CustomActiveStructProxy->m_StructExtData, m_CustomActiveStructProxy->m_StructClientData, this); - } - m_CustomActiveStructProxy = currentCustomActiveStructProxy; - - return Handled; -} - -// --------------------------------------------------------------------------- - -#ifdef ANT_WINDOWS -# pragma optimize("", off) -// disable optimizations because the conversion of Enum from unsigned int to double is not always exact if optimized and GraphAPI=DirectX ! -#endif -static void ANT_CALL PopupCallback(void *_ClientData) -{ - CTwFPU fpu; // force fpu precision - - if( g_TwMgr!=NULL && g_TwMgr->m_PopupBar!=NULL ) - { - unsigned int Enum = *(unsigned int *)&_ClientData; - CTwVarAtom *Var = g_TwMgr->m_PopupBar->m_VarEnumLinkedToPopupList; - CTwBar *Bar = g_TwMgr->m_PopupBar->m_BarLinkedToPopupList; - if( Bar!=NULL && Var!=NULL && !Var->m_ReadOnly && IsEnumType(Var->m_Type) ) - { - Var->ValueFromDouble(Enum); - //Bar->UnHighlightLine(); - Bar->HaveFocus(true); - Bar->NotUpToDate(); - } - if( g_TwMgr->m_PopupBar!=NULL ) // check again because it might have been destroyed by an enum callback - TwDeleteBar(g_TwMgr->m_PopupBar); - g_TwMgr->m_PopupBar = NULL; - } -} -#ifdef ANT_WINDOWS -# pragma optimize("", on) -#endif - -// --------------------------------------------------------------------------- - -bool CTwBar::MouseButton(ETwMouseButtonID _Button, bool _Pressed, int _X, int _Y) -{ - assert(g_TwMgr->m_Graph && g_TwMgr->m_WndHeight>0 && g_TwMgr->m_WndWidth>0); - bool Handled = false; - if( !m_UpToDate ) - Update(); - bool EditInPlaceActive = false; - bool CustomArea = false; - - if( !m_IsMinimized ) - { - Handled = (_X>=m_PosX && _X=m_PosY && _Y=0 && m_HighlightedLine<(int)m_HierTags.size() && m_HierTags[m_HighlightedLine].m_Var ) - { - bool OnFocus = (m_HighlightedLine==(_Y-m_PosY-m_VarY0)/(m_Font->m_CharHeight+m_LineSep) && Handled); - if( m_HierTags[m_HighlightedLine].m_Var->IsGroup() ) - { - if( _Pressed && !g_TwMgr->m_IsRepeatingMousePressed && OnFocus ) - { - CTwVarGroup *Grp = static_cast(m_HierTags[m_HighlightedLine].m_Var); - Grp->m_Open = !Grp->m_Open; - NotUpToDate(); - ANT_SET_CURSOR(Arrow); - } - } - else if( _Pressed && m_HighlightIncrBtn ) - { - static_cast(m_HierTags[m_HighlightedLine].m_Var)->Increment(1); - if( g_TwMgr==NULL ) // Mgr might have been destroyed by the client inside a callback call - return 1; - NotUpToDate(); - } - else if( _Pressed && m_HighlightDecrBtn ) - { - static_cast(m_HierTags[m_HighlightedLine].m_Var)->Increment(-1); - if( g_TwMgr==NULL ) // Mgr might have been destroyed by the client inside a callback call - return 1; - NotUpToDate(); - } - else if( _Pressed && !m_MouseDrag ) - { - m_MouseDrag = true; - m_MouseDragVar = true; - m_MouseOriginX = _X; - m_MouseOriginY = _Y; - m_VarHasBeenIncr = false; - CTwVarAtom * Var = static_cast(m_HierTags[m_HighlightedLine].m_Var); - if( !Var->m_NoSlider && !Var->m_ReadOnly && m_HighlightRotoBtn ) - { - // begin rotoslider - if( _X>m_PosX+m_VarX1 && OnFocus ) - RotoOnLButtonDown(m_PosX+m_VarX2-(1*IncrBtnWidth(m_Font->m_CharHeight))/2, _Y); - else - RotoOnLButtonDown(_X, _Y); - m_MouseDrag = true; - m_MouseDragVar = true; - } - else if( (Var->m_Type==TW_TYPE_BOOL8 || Var->m_Type==TW_TYPE_BOOL16 || Var->m_Type==TW_TYPE_BOOL32 || Var->m_Type==TW_TYPE_BOOLCPP) && !Var->m_ReadOnly && OnFocus ) - { - Var->Increment(1); - //m_HighlightClickBtn = true; - m_VarHasBeenIncr = true; - m_MouseDragVar = false; - m_MouseDrag = false; - NotUpToDate(); - } - else if( Var->m_Type==TW_TYPE_BUTTON && !Var->m_ReadOnly ) - { - m_HighlightClickBtn = true; - m_MouseDragVar = false; - m_MouseDrag = false; - } - //else if( (Var->m_Type==TW_TYPE_ENUM8 || Var->m_Type==TW_TYPE_ENUM16 || Var->m_Type==TW_TYPE_ENUM32) && !Var->m_ReadOnly ) - else if( IsEnumType(Var->m_Type) && !Var->m_ReadOnly && !g_TwMgr->m_IsRepeatingMousePressed && OnFocus ) - { - m_MouseDragVar = false; - m_MouseDrag = false; - if( g_TwMgr->m_PopupBar!=NULL ) - { - TwDeleteBar(g_TwMgr->m_PopupBar); - g_TwMgr->m_PopupBar = NULL; - } - // popup list - CTwMgr::CEnum& e = g_TwMgr->m_Enums[Var->m_Type-TW_TYPE_ENUM_BASE]; - g_TwMgr->m_PopupBar = TwNewBar("~ Enum Popup ~"); - g_TwMgr->m_PopupBar->m_IsPopupList = true; - g_TwMgr->m_PopupBar->m_Color = m_Color; - g_TwMgr->m_PopupBar->m_DarkText = m_DarkText; - g_TwMgr->m_PopupBar->m_PosX = m_PosX + m_VarX1 - 2; - g_TwMgr->m_PopupBar->m_PosY = m_PosY + m_VarY0 + (m_HighlightedLine+1)*(m_Font->m_CharHeight+m_LineSep); - g_TwMgr->m_PopupBar->m_Width = m_Width - 2*m_Font->m_CharHeight; - g_TwMgr->m_PopupBar->m_LineSep = g_TwMgr->m_PopupBar->m_Sep; - int popHeight0 = (int)e.m_Entries.size()*(m_Font->m_CharHeight+m_Sep) + m_Font->m_CharHeight/2+2; - int popHeight = popHeight0; - if( g_TwMgr->m_PopupBar->m_PosY+popHeight+2 > g_TwMgr->m_WndHeight ) - popHeight = g_TwMgr->m_WndHeight-g_TwMgr->m_PopupBar->m_PosY-2; - if( popHeightm_WndHeight/2 ) - popHeight = min(popHeight0, g_TwMgr->m_WndHeight/2); - if( popHeight<3*(m_Font->m_CharHeight+m_Sep) ) - popHeight = 3*(m_Font->m_CharHeight+m_Sep); - g_TwMgr->m_PopupBar->m_Height = popHeight; - g_TwMgr->m_PopupBar->m_VarEnumLinkedToPopupList = Var; - g_TwMgr->m_PopupBar->m_BarLinkedToPopupList = this; - unsigned int CurrentEnumValue = (unsigned int)((int)Var->ValueToDouble()); - for( CTwMgr::CEnum::CEntries::iterator It=e.m_Entries.begin(); It!=e.m_Entries.end(); ++It ) - { - char ID[64]; - sprintf(ID, "%u", It->first); - //ultoa(It->first, ID, 10); - TwAddButton(g_TwMgr->m_PopupBar, ID, PopupCallback, *(void**)&(It->first), NULL); - CTwVar *Btn = g_TwMgr->m_PopupBar->Find(ID); - if( Btn!=NULL ) - { - Btn->m_Label = It->second.c_str(); - if( It->first==CurrentEnumValue ) - { - Btn->m_ColorPtr = &m_ColValTextNE; - Btn->m_BgColorPtr = &m_ColGrpBg; - } - } - } - g_TwMgr->m_HelpBarNotUpToDate = false; - } - else if( (Var->m_ReadOnly && (Var->m_Type==TW_TYPE_CDSTRING || Var->m_Type==TW_TYPE_CDSTDSTRING || Var->m_Type==TW_TYPE_STDSTRING || IsCSStringType(Var->m_Type)) && EditInPlaceAcceptVar(Var)) - || (!Var->m_ReadOnly && EditInPlaceAcceptVar(Var)) ) - { - int dw = 0; - //if( m_DrawIncrDecrBtn ) - // dw = 2*IncrBtnWidth(m_Font->m_CharHeight); - if( !m_EditInPlace.m_Active || m_EditInPlace.m_Var!=Var ) - { - EditInPlaceStart(Var, m_VarX1, m_VarY0+(m_HighlightedLine)*(m_Font->m_CharHeight+m_LineSep), m_VarX2-m_VarX1-dw-1); - if( EditInPlaceIsReadOnly() ) - EditInPlaceMouseMove(_X, _Y, false); - m_MouseDrag = false; - m_MouseDragVar = false; - } - else - { - EditInPlaceMouseMove(_X, _Y, false); - m_MouseDrag = true; - m_MouseDragVar = false; - } - EditInPlaceActive = m_EditInPlace.m_Active; - if( Var->m_ReadOnly ) - ANT_SET_CURSOR(No); - else - ANT_SET_CURSOR(IBeam); - } - else if( Var->m_ReadOnly ) - ANT_SET_CURSOR(No); - else - { - ANT_SET_CURSOR(Arrow); - CustomArea = true; - } - } - else if ( !_Pressed && m_MouseDragVar ) - { - m_MouseDrag = false; - m_MouseDragVar = false; - if( !Handled ) - m_DrawHandles = false; - Handled = true; - // end rotoslider - RotoOnLButtonUp(_X, _Y); - - /* Incr/decr on right or left click - if( !m_VarHasBeenIncr && !static_cast(m_HierTags[m_HighlightedLine].m_Var)->m_ReadOnly ) - { - if( _Button==TW_MOUSE_LEFT ) - static_cast(m_HierTags[m_HighlightedLine].m_Var)->Increment(-1); - else if( _Button==TW_MOUSE_RIGHT ) - static_cast(m_HierTags[m_HighlightedLine].m_Var)->Increment(1); - NotUpToDate(); - } - */ - - if( static_cast(m_HierTags[m_HighlightedLine].m_Var)->m_ReadOnly ) - ANT_SET_CURSOR(No); - else - { - ANT_SET_CURSOR(Arrow); - CustomArea = true; - } - } - else if( !_Pressed && m_HighlightClickBtn ) // a button variable is activated - { - m_HighlightClickBtn = false; - m_MouseDragVar = false; - m_MouseDrag = false; - Handled = true; - NotUpToDate(); - if( !m_HierTags[m_HighlightedLine].m_Var->IsGroup() ) - { - CTwVarAtom * Var = static_cast(m_HierTags[m_HighlightedLine].m_Var); - if( !Var->m_ReadOnly && Var->m_Type==TW_TYPE_BUTTON && Var->m_Val.m_Button.m_Callback!=NULL ) - { - Var->m_Val.m_Button.m_Callback(Var->m_ClientData); - if( g_TwMgr==NULL ) // Mgr might have been destroyed by the client inside a callback call - return 1; - } - } - } - else if( !_Pressed ) - { - m_MouseDragVar = false; - m_MouseDrag = false; - CustomArea = true; - } - } - else if( _Pressed && !m_MouseDrag && m_Movable && !m_IsPopupList - && ( (_Button==TW_MOUSE_LEFT && _X>=m_PosX+2*m_Font->m_CharHeight && _Xm_CharHeight && _Y>=m_PosY && _Ym_CharHeight) - || (_Button==TW_MOUSE_MIDDLE && _X>=m_PosX && _X=m_PosY && _Y=m_PosX+m_VarX1-3 && _Xm_PosY+m_Font->m_CharHeight && _Y=m_PosX+m_VarX2+2 && _X=m_ScrollY0 && _Y=m_PosX+m_VarX2+2 && _X=m_PosY+m_VarY0 && _Y0 ) - { - --m_FirstLine; - NotUpToDate(); - } - } - else if( _Pressed && _Button==TW_MOUSE_LEFT && _X>=m_PosX+m_VarX2+2 && _X=m_ScrollY1 && _Y=m_PosX && _Xm_CharHeight && _Y>=m_PosY && _Ym_CharHeight ) - { - m_MouseDrag = true; - m_MouseDragResizeUL = true; - m_MouseOriginX = _X; - m_MouseOriginY = _Y; - m_ValuesWidthRatio = (m_Width>0) ? (double)m_ValuesWidth/m_Width : 0; - ANT_SET_CURSOR(TopLeft); - } - else if( !_Pressed && m_MouseDragResizeUL ) - { - m_MouseDrag = false; - m_MouseDragResizeUL = false; - ANT_SET_CURSOR(Arrow); - } - else if( _Pressed && !m_MouseDrag && m_Resizable && !m_IsPopupList && _Button==TW_MOUSE_LEFT && _X>=m_PosX+m_Width-m_Font->m_CharHeight && _X=m_PosY && _Ym_CharHeight ) - { - m_MouseDrag = true; - m_MouseDragResizeUR = true; - m_MouseOriginX = _X; - m_MouseOriginY = _Y; - m_ValuesWidthRatio = (m_Width>0) ? (double)m_ValuesWidth/m_Width : 0; - ANT_SET_CURSOR(TopRight); - } - else if( !_Pressed && m_MouseDragResizeUR ) - { - m_MouseDrag = false; - m_MouseDragResizeUR = false; - ANT_SET_CURSOR(Arrow); - } - else if( _Pressed && !m_MouseDrag && m_Resizable && !m_IsPopupList && _Button==TW_MOUSE_LEFT && _X>=m_PosX && _Xm_CharHeight && _Y>=m_PosY+m_Height-m_Font->m_CharHeight && _Y0) ? (double)m_ValuesWidth/m_Width : 0; - ANT_SET_CURSOR(BottomLeft); - } - else if( !_Pressed && m_MouseDragResizeLL ) - { - m_MouseDrag = false; - m_MouseDragResizeLL = false; - ANT_SET_CURSOR(Arrow); - } - else if( _Pressed && !m_MouseDrag && m_Resizable && !m_IsPopupList && _Button==TW_MOUSE_LEFT && _X>=m_PosX+m_Width-m_Font->m_CharHeight && _X=m_PosY+m_Height-m_Font->m_CharHeight && _Y0) ? (double)m_ValuesWidth/m_Width : 0; - ANT_SET_CURSOR(BottomRight); - } - else if( !_Pressed && m_MouseDragResizeLR ) - { - m_MouseDrag = false; - m_MouseDragResizeLR = false; - ANT_SET_CURSOR(Arrow); - } - else if( _Pressed && !m_IsPopupList && _Button==TW_MOUSE_LEFT && m_HighlightLabelsHeader ) - { - int w = ComputeLabelsWidth(m_Font); - if( wm_CharHeight ) - w = m_Font->m_CharHeight; - m_ValuesWidth = m_VarX2 - m_VarX0 - w; - if( m_ValuesWidthm_CharHeight ) - m_ValuesWidth = m_Font->m_CharHeight; - if( m_ValuesWidth>m_VarX2 - m_VarX0 ) - m_ValuesWidth = max(m_VarX2 - m_VarX0 - m_Font->m_CharHeight, 0); - NotUpToDate(); - ANT_SET_CURSOR(Arrow); - } - else if( _Pressed && !m_IsPopupList && _Button==TW_MOUSE_LEFT && m_HighlightValuesHeader ) - { - int w = ComputeValuesWidth(m_Font); - if( w<2*m_Font->m_CharHeight ) - w = 2*m_Font->m_CharHeight; // enough to draw a button - m_ValuesWidth = w; - if( m_ValuesWidth>m_VarX2 - m_VarX0 ) - m_ValuesWidth = max(m_VarX2 - m_VarX0 - m_Font->m_CharHeight, 0); - NotUpToDate(); - ANT_SET_CURSOR(Arrow); - } - else if( _Pressed && g_TwMgr->m_FontResizable && !m_IsPopupList && _X>=m_PosX+m_Font->m_CharHeight && _Xm_CharHeight && _Y>m_PosY && _Ym_CharHeight ) - { - // change font - if( _Button==TW_MOUSE_LEFT ) - { - if( m_Font==g_DefaultSmallFont ) - g_TwMgr->SetFont(g_DefaultNormalFont, true); - else if( m_Font==g_DefaultNormalFont ) - g_TwMgr->SetFont(g_DefaultLargeFont, true); - else if( m_Font==g_DefaultLargeFont ) - g_TwMgr->SetFont(g_DefaultSmallFont, true); - else - g_TwMgr->SetFont(g_DefaultNormalFont, true); - } - else if( _Button==TW_MOUSE_RIGHT ) - { - if( m_Font==g_DefaultSmallFont ) - g_TwMgr->SetFont(g_DefaultLargeFont, true); - else if( m_Font==g_DefaultNormalFont ) - g_TwMgr->SetFont(g_DefaultSmallFont, true); - else if( m_Font==g_DefaultLargeFont ) - g_TwMgr->SetFont(g_DefaultNormalFont, true); - else - g_TwMgr->SetFont(g_DefaultNormalFont, true); - } - - ANT_SET_CURSOR(Arrow); - } - else if( _Pressed && m_Iconifiable && !m_IsPopupList && _Button==TW_MOUSE_LEFT && _X>=m_PosX+m_Width-2*m_Font->m_CharHeight && _Xm_CharHeight && _Y>m_PosY && _Ym_CharHeight ) - { - // minimize - g_TwMgr->Minimize(this); - ANT_SET_CURSOR(Arrow); - } - else if( m_IsHelpBar && _Pressed && !g_TwMgr->m_IsRepeatingMousePressed && _X>=m_PosX+m_VarX0 && _Xm_CharHeight && _Y>m_PosY+m_Height-m_Font->m_CharHeight && _Y& null &", browser, WebPage); - if( system(cmd) ) {} // avoiding warn_unused_result - browser = strtok(NULL, ","); // grab the next browser - } - #elif defined ANT_OSX - char cmd[256]; - snprintf(cmd, sizeof(cmd), "open \"%s\" 1>& null &", WebPage); - if( system(cmd) ) {} // avoiding warn_unused_result - #endif - ANT_SET_CURSOR(Hand); - */ - } - else - { - CustomArea = true; - } - } - else // minimized - { - if( _Pressed && m_HighlightMaximize ) - { - m_HighlightMaximize = false; - g_TwMgr->Maximize(this); - ANT_SET_CURSOR(Arrow); - Handled = true; - } - } - - if( g_TwMgr!=NULL ) // Mgr might have been destroyed by the client inside a callback call - if( _Pressed && !EditInPlaceActive && m_EditInPlace.m_Active ) - EditInPlaceEnd(true); - - // Handled by a custom widget? - if( g_TwMgr!=NULL && (!Handled || CustomArea) && !m_IsMinimized && m_CustomRecords.size()>0 ) - { - bool CustomHandled = false; - for( int s=0; s<2; ++s ) // 2 iterations: first for custom widget having focus, second for others if no focused widget. - for( CustomMap::iterator it=m_CustomRecords.begin(); it!=m_CustomRecords.end(); ++it ) - { - CTwMgr::CStructProxy *sProxy = it->first; - const CCustomRecord& r = it->second; - if( (s==1 || sProxy->m_CustomCaptureFocus) && !CustomHandled && sProxy!=NULL && sProxy->m_CustomMouseButtonCallback!=NULL && r.m_XMin=r.m_Y0 && r.m_YMax<=r.m_Y1 ) - { - if( sProxy->m_CustomCaptureFocus || (_X>=r.m_XMin && _X=r.m_YMin && _Ym_CustomCaptureFocus = _Pressed; - CustomHandled = sProxy->m_CustomMouseButtonCallback(_Button, _Pressed, _X-r.m_XMin, _Y-r.m_Y0, r.m_XMax-r.m_XMin, r.m_Y1-r.m_Y0, sProxy->m_StructExtData, sProxy->m_StructClientData, this, r.m_Var); - s = 2; // force s-loop exit - } - } - else if( sProxy!=NULL ) - { - sProxy->m_CustomCaptureFocus = false; // force free focus, just in case. - ANT_SET_CURSOR(Arrow); - } - } - if( CustomHandled ) - Handled = true; - } - - return Handled; -} - - -// --------------------------------------------------------------------------- - -bool CTwBar::MouseWheel(int _Pos, int _PrevPos, int _MouseX, int _MouseY) -{ - assert(g_TwMgr->m_Graph && g_TwMgr->m_WndHeight>0 && g_TwMgr->m_WndWidth>0); - if( !m_UpToDate ) - Update(); - - bool Handled = false; - if( !m_IsMinimized && _MouseX>=m_PosX && _MouseX=m_PosY && _MouseY_PrevPos && m_FirstLine>0 ) - { - --m_FirstLine; - NotUpToDate(); - } - else if( _Pos<_PrevPos && m_FirstLine' ' && _Key<256 ) // don't test SHIFT if _Key is a common key - Mask &= ~TW_KMOD_SHIFT; - - // don't test KMOD_NUM and KMOD_CAPS modifiers coming from SDL - Mask &= ~(0x1000); // 0x1000 is the KMOD_NUM value defined in SDL_keysym.h - Mask &= ~(0x2000); // 0x2000 is the KMOD_CAPS value defined in SDL_keysym.h - - // complete partial modifiers comming from SDL - if( _Modifiers & TW_KMOD_SHIFT ) - _Modifiers |= TW_KMOD_SHIFT; - if( _Modifiers & TW_KMOD_CTRL ) - _Modifiers |= TW_KMOD_CTRL; - if( _Modifiers & TW_KMOD_ALT ) - _Modifiers |= TW_KMOD_ALT; - if( _Modifiers & TW_KMOD_META ) - _Modifiers |= TW_KMOD_META; - - for(size_t i=0; iIsGroup() ) - { - Atom = static_cast(m_Vars[i])->FindShortcut(_Key, _Modifiers, _DoIncr); - if( Atom!=NULL ) - return Atom; - } - else - { - Atom = static_cast(m_Vars[i]); - if( Atom->m_KeyIncr[0]==_Key && (Atom->m_KeyIncr[1]&Mask)==(_Modifiers&Mask) ) - { - if( _DoIncr!=NULL ) - *_DoIncr = true; - return Atom; - } - else if( Atom->m_KeyDecr[0]==_Key && (Atom->m_KeyDecr[1]&Mask)==(_Modifiers&Mask) ) - { - if( _DoIncr!=NULL ) - *_DoIncr = false; - return Atom; - } - } - } - return NULL; -} - -bool CTwBar::KeyPressed(int _Key, int _Modifiers) -{ - assert(g_TwMgr->m_Graph && g_TwMgr->m_WndHeight>0 && g_TwMgr->m_WndWidth>0); - bool Handled = false; - if( !m_UpToDate ) - Update(); - - if( _Key>0 && _Key0 && _Key<32 ) - _Key += 'a'-1; - - // PAD translation (for SDL keysym) - if( _Key>=256 && _Key<=272 ) // 256=SDLK_KP0 ... 272=SDLK_KP_EQUALS - { - bool Num = ((_Modifiers&TW_KMOD_SHIFT) && !(_Modifiers&0x1000)) || (!(_Modifiers&TW_KMOD_SHIFT) && (_Modifiers&0x1000)); // 0x1000 is SDL's KMOD_NUM - _Modifiers &= ~TW_KMOD_SHIFT; // remove shift modifier - if( _Key==266 ) // SDLK_KP_PERIOD - _Key = Num ? '.' : TW_KEY_DELETE; - else if( _Key==267 ) // SDLK_KP_DIVIDE - _Key = '/'; - else if( _Key==268 ) // SDLK_KP_MULTIPLY - _Key = '*'; - else if( _Key==269 ) // SDLK_KP_MINUS - _Key = '-'; - else if( _Key==270 ) // SDLK_KP_PLUS - _Key = '+'; - else if( _Key==271 ) // SDLK_KP_ENTER - _Key = TW_KEY_RETURN; - else if( _Key==272 ) // SDLK_KP_EQUALS - _Key = '='; - else if( Num ) // num SDLK_KP0..9 - _Key += '0' - 256; - else if( _Key==256 ) // non-num SDLK_KP01 - _Key = TW_KEY_INSERT; - else if( _Key==257 ) // non-num SDLK_KP1 - _Key = TW_KEY_END; - else if( _Key==258 ) // non-num SDLK_KP2 - _Key = TW_KEY_DOWN; - else if( _Key==259 ) // non-num SDLK_KP3 - _Key = TW_KEY_PAGE_DOWN; - else if( _Key==260 ) // non-num SDLK_KP4 - _Key = TW_KEY_LEFT; - else if( _Key==262 ) // non-num SDLK_KP6 - _Key = TW_KEY_RIGHT; - else if( _Key==263 ) // non-num SDLK_KP7 - _Key = TW_KEY_HOME; - else if( _Key==264 ) // non-num SDLK_KP8 - _Key = TW_KEY_UP; - else if( _Key==265 ) // non-num SDLK_KP9 - _Key = TW_KEY_PAGE_UP; - } - */ - - /* - string Str; - TwGetKeyString(&Str, _Key, _Modifiers); - printf("key: %d 0x%04xd %s\n", _Key, _Modifiers, Str.c_str()); - */ - - if( m_EditInPlace.m_Active ) - { - Handled = EditInPlaceKeyPressed(_Key, _Modifiers); - } - else - { - bool BarActive = (m_DrawHandles || m_IsPopupList) && !m_IsMinimized; - bool DoIncr = true; - CTwVarAtom *Atom = m_VarRoot.FindShortcut(_Key, _Modifiers, &DoIncr); - if( Atom!=NULL && Atom->m_Visible ) - { - if( !Atom->m_ReadOnly ) - { - Atom->Increment( DoIncr ? +1 : -1 ); - if( g_TwMgr==NULL ) // Mgr might have been destroyed by the client inside a callback call - return 1; - m_HighlightClickBtnAuto = g_TwMgr->m_Timer.GetTime(); - } - NotUpToDate(); - Show(Atom); - Handled = true; - } - else if( BarActive && m_HighlightedLine>=0 && m_HighlightedLine<(int)m_HierTags.size() && m_HierTags[m_HighlightedLine].m_Var ) - { - if( _Key==TW_KEY_RIGHT ) - { - if( !m_HierTags[m_HighlightedLine].m_Var->IsGroup() ) - { - CTwVarAtom *Atom = static_cast(m_HierTags[m_HighlightedLine].m_Var); - bool Accept = !Atom->m_NoSlider || Atom->m_Type==TW_TYPE_BUTTON - || Atom->m_Type==TW_TYPE_BOOL8 || Atom->m_Type==TW_TYPE_BOOL16 || Atom->m_Type==TW_TYPE_BOOL32 || Atom->m_Type==TW_TYPE_BOOLCPP - || IsEnumType(Atom->m_Type); - if( !Atom->IsReadOnly() && !m_IsPopupList && Accept ) - { - Atom->Increment(+1); - if( g_TwMgr==NULL ) // Mgr might have been destroyed by the client inside a callback call - return 1; - m_HighlightClickBtnAuto = g_TwMgr->m_Timer.GetTime(); - NotUpToDate(); - } - } - else - { - CTwVarGroup *Grp = static_cast(m_HierTags[m_HighlightedLine].m_Var); - if( !Grp->m_Open ) - { - Grp->m_Open = true; - NotUpToDate(); - } - } - Handled = true; - } - else if( _Key==TW_KEY_LEFT ) - { - if( !m_HierTags[m_HighlightedLine].m_Var->IsGroup() ) - { - CTwVarAtom *Atom = static_cast(m_HierTags[m_HighlightedLine].m_Var); - bool Accept = !Atom->m_NoSlider || Atom->m_Type==TW_TYPE_BUTTON - || Atom->m_Type==TW_TYPE_BOOL8 || Atom->m_Type==TW_TYPE_BOOL16 || Atom->m_Type==TW_TYPE_BOOL32 || Atom->m_Type==TW_TYPE_BOOLCPP - || IsEnumType(Atom->m_Type); - if( !Atom->IsReadOnly() && Accept && !m_IsPopupList ) - { - Atom->Increment(-1); - if( g_TwMgr==NULL ) // Mgr might have been destroyed by the client inside a callback call - return 1; - m_HighlightClickBtnAuto = g_TwMgr->m_Timer.GetTime(); - NotUpToDate(); - } - } - else - { - CTwVarGroup *Grp = static_cast(m_HierTags[m_HighlightedLine].m_Var); - if( Grp->m_Open ) - { - Grp->m_Open = false; - NotUpToDate(); - } - } - Handled = true; - } - else if( _Key==TW_KEY_RETURN ) - { - if( !m_HierTags[m_HighlightedLine].m_Var->IsGroup() ) - { - CTwVarAtom *Atom = static_cast(m_HierTags[m_HighlightedLine].m_Var); - if( !Atom->IsReadOnly() ) - { - if( Atom->m_Type==TW_TYPE_BUTTON || Atom->m_Type==TW_TYPE_BOOLCPP - || Atom->m_Type==TW_TYPE_BOOL8 || Atom->m_Type==TW_TYPE_BOOL16 || Atom->m_Type==TW_TYPE_BOOL32 ) - { - bool isPopup = m_IsPopupList; - Atom->Increment(+1); - if( g_TwMgr==NULL // Mgr might have been destroyed by the client inside a callback call - || isPopup ) // A popup destroys itself - return 1; - m_HighlightClickBtnAuto = g_TwMgr->m_Timer.GetTime(); - NotUpToDate(); - } - else // if( IsEnumType(Atom->m_Type) ) - { - // simulate a mouse click - int y = m_PosY + m_VarY0 + m_HighlightedLine*(m_Font->m_CharHeight+m_LineSep) + m_Font->m_CharHeight/2; - int x = m_PosX + m_VarX1 + 2; - if( x>m_PosX+m_VarX2-2 ) - x = m_PosX + m_VarX2 - 2; - MouseMotion(x, y); - MouseButton(TW_MOUSE_LEFT, true, x, y); - } - } - } - else - { - CTwVarGroup *Grp = static_cast(m_HierTags[m_HighlightedLine].m_Var); - Grp->m_Open = !Grp->m_Open; - NotUpToDate(); - } - Handled = true; - } - else if( _Key==TW_KEY_UP ) - { - --m_HighlightedLine; - if( m_HighlightedLine<0 ) - { - m_HighlightedLine = 0; - if( m_FirstLine>0 ) - { - --m_FirstLine; - NotUpToDate(); - } - } - m_HighlightedLineLastValid = m_HighlightedLine; - Handled = true; - } - else if( _Key==TW_KEY_DOWN ) - { - ++m_HighlightedLine; - if( m_HighlightedLine>=(int)m_HierTags.size() ) - { - m_HighlightedLine = (int)m_HierTags.size() - 1; - if( m_FirstLinem_PopupBar = NULL; - if( LinkedBar!=NULL ) - LinkedBar->m_DrawHandles = true; - return true; // this bar has been destroyed - } - } - else if( BarActive ) - { - if( _Key==TW_KEY_UP || _Key==TW_KEY_DOWN || _Key==TW_KEY_LEFT || _Key==TW_KEY_RIGHT || _Key==TW_KEY_RETURN ) - { - if( m_HighlightedLineLastValid>=0 && m_HighlightedLineLastValid<(int)m_HierTags.size() ) - m_HighlightedLine = m_HighlightedLineLastValid; - else if( m_HierTags.size()>0 ) - { - if( _Key==TW_KEY_UP ) - m_HighlightedLine = (int)m_HierTags.size()-1; - else - m_HighlightedLine = 0; - } - Handled = true; - } - else if( _Key==TW_KEY_ESCAPE && m_IsPopupList ) - { - Handled = true; - CTwBar *LinkedBar = m_BarLinkedToPopupList; - TwDeleteBar(this); - g_TwMgr->m_PopupBar = NULL; - if( LinkedBar!=NULL ) - LinkedBar->m_DrawHandles = true; - return true; // this bar has been destroyed - } - } - } - } - return Handled; -} - -// --------------------------------------------------------------------------- - -bool CTwBar::KeyTest(int _Key, int _Modifiers) -{ - assert(g_TwMgr->m_Graph && g_TwMgr->m_WndHeight>0 && g_TwMgr->m_WndWidth>0); - bool Handled = false; - if( !m_UpToDate ) - Update(); - - if( _Key>0 && _Keym_Visible ) - Handled = true; - else if( BarActive && ( _Key==TW_KEY_RIGHT || _Key==TW_KEY_LEFT || _Key==TW_KEY_UP || _Key==TW_KEY_DOWN - || _Key==TW_KEY_RETURN || (_Key==TW_KEY_ESCAPE && m_IsPopupList) ) ) - Handled = true; - } - } - return Handled; -} - -// --------------------------------------------------------------------------- - -bool CTwBar::Show(CTwVar *_Var) -{ - if( _Var==NULL || !_Var->m_Visible ) - return false; - if( !m_UpToDate ) - Update(); - - if( OpenHier(&m_VarRoot, _Var) ) - { - if( !m_UpToDate ) - Update(); - int l = LineInHier(&m_VarRoot, _Var); - if( l>=0 ) - { - int NbLines = (m_VarY1-m_VarY0+1)/(m_Font->m_CharHeight+m_LineSep); - if( NbLines<= 0 ) - NbLines = 1; - if( l=m_FirstLine+NbLines ) - { - m_FirstLine = l-NbLines/2; - if( m_FirstLine<0 ) - m_FirstLine = 0; - NotUpToDate(); - Update(); - if( m_NbDisplayedLinesm_Vars.size(); ++i) - if( _Root->m_Vars[i]!=NULL ) - { - if( _Var==_Root->m_Vars[i] - || (_Root->m_Vars[i]->IsGroup() && OpenHier(static_cast(_Root->m_Vars[i]), _Var)) ) - { - _Root->m_Open = true; - NotUpToDate(); - return true; - } - } - return false; -} - -// --------------------------------------------------------------------------- - -int CTwBar::LineInHier(CTwVarGroup *_Root, CTwVar *_Var) -{ - assert( _Root!=NULL ); - int l = 0; - for(size_t i=0; i<_Root->m_Vars.size(); ++i) - if( _Root->m_Vars[i]!=NULL && _Root->m_Vars[i]->m_Visible ) - { - if( _Var==_Root->m_Vars[i] ) - return l; - else if( _Root->m_Vars[i]->IsGroup() && static_cast(_Root->m_Vars[i])->m_Open ) - { - ++l; - int ll = LineInHier(static_cast(_Root->m_Vars[i]), _Var); - if( ll>=0 ) - return l+ll; - else - l += -ll-2; - } - ++l; - } - return -l-1; -} - -// --------------------------------------------------------------------------- - -void DrawArc(int _X, int _Y, int _Radius, float _StartAngleDeg, float _EndAngleDeg, color32 _Color) // angles in degree -{ - ITwGraph *Gr = g_TwMgr->m_Graph; - if( Gr==NULL || !Gr->IsDrawing() || _Radius==0 || _StartAngleDeg==_EndAngleDeg ) - return; - - float startAngle = (float)M_PI*_StartAngleDeg/180; - float endAngle = (float)M_PI*_EndAngleDeg/180; - //float stepAngle = 8/(float)_Radius; // segment length = 8 pixels - float stepAngle = 4/(float)_Radius; // segment length = 4 pixels - if( stepAngle>(float)M_PI/4 ) - stepAngle = (float)M_PI/4; - bool fullCircle = fabsf(endAngle-startAngle)>=2.0f*(float)M_PI+fabsf(stepAngle); - int numSteps; - if( fullCircle ) - { - numSteps = int((2.0f*(float)M_PI)/stepAngle); - startAngle = 0; - endAngle = 2.0f*(float)M_PI; - } - else - numSteps = int(fabsf(endAngle-startAngle)/stepAngle); - if( startAngle>endAngle ) - stepAngle = -stepAngle; - - int x0 = int(_X + _Radius * cosf(startAngle) + 0.5f); - int y0 = int(_Y - _Radius * sinf(startAngle) + 0.5f); - int x1, y1; - float angle = startAngle+stepAngle; - - for( int i=0; iDrawLine(x0, y0, x1, y1, _Color, true); - x0 = x1; - y0 = y1; - } - - if( fullCircle ) - { - x1 = int(_X + _Radius * cosf(startAngle) + 0.5f); - y1 = int(_Y - _Radius * sinf(startAngle) + 0.5f); - } - else - { - x1 = int(_X + _Radius * cosf(endAngle) + 0.5f); - y1 = int(_Y - _Radius * sinf(endAngle) + 0.5f); - } - Gr->DrawLine(x0, y0, x1, y1, _Color, true); -} - -// --------------------------------------------------------------------------- - -CTwBar::CRotoSlider::CRotoSlider() -{ - m_Var = NULL; - m_Active = false; - m_ActiveMiddle = false; - m_Subdiv = 256; // will be recalculated in RotoOnLButtonDown -} - -void CTwBar::RotoDraw() -{ - ITwGraph *Gr = g_TwMgr->m_Graph; - if( Gr==NULL || !Gr->IsDrawing() ) - return; - - if( m_Roto.m_Active ) - { - DrawArc(m_Roto.m_Origin.x, m_Roto.m_Origin.y, 32, 0, 360, m_ColRoto); - DrawArc(m_Roto.m_Origin.x+1, m_Roto.m_Origin.y, 32, 0, 360, m_ColRoto); - DrawArc(m_Roto.m_Origin.x, m_Roto.m_Origin.y+1, 32, 0, 360, m_ColRoto); - - if( m_Roto.m_HasPrevious ) - { - double varMax = RotoGetMax(); - double varMin = RotoGetMin(); - double varStep = RotoGetStep(); - if( varMax-DOUBLE_MAX && fabs(varStep)>DOUBLE_EPS && m_Roto.m_Subdiv>0 ) - { - double dtMax = 360.0*(varMax-m_Roto.m_ValueAngle0)/((double)m_Roto.m_Subdiv*varStep);//+2; - double dtMin = 360.0*(varMin-m_Roto.m_ValueAngle0)/((double)m_Roto.m_Subdiv*varStep);//-2; - - if( dtMax>=0 && dtMax<360 && dtMin<=0 && dtMin>-360 && fabs(dtMax-dtMin)<=360 ) - { - int x1, y1, x2, y2; - double da = 2.0*M_PI/m_Roto.m_Subdiv; - - x1 = m_Roto.m_Origin.x + (int)(40*cos(-M_PI*(m_Roto.m_Angle0+dtMax)/180-da)); - y1 = m_Roto.m_Origin.y + (int)(40*sin(-M_PI*(m_Roto.m_Angle0+dtMax)/180-da)+0.5); - x2 = m_Roto.m_Origin.x + (int)(40*cos(-M_PI*(m_Roto.m_Angle0+dtMax-10)/180-da)); - y2 = m_Roto.m_Origin.y + (int)(40*sin(-M_PI*(m_Roto.m_Angle0+dtMax-10)/180-da)+0.5); - Gr->DrawLine(m_Roto.m_Origin.x, m_Roto.m_Origin.y, x1, y1, m_ColRotoBound, true); - Gr->DrawLine(m_Roto.m_Origin.x+1, m_Roto.m_Origin.y, x1+1, y1, m_ColRotoBound, true); - Gr->DrawLine(m_Roto.m_Origin.x, m_Roto.m_Origin.y+1, x1, y1+1, m_ColRotoBound, true); - Gr->DrawLine(x1, y1, x2, y2, m_ColRotoBound, true); - Gr->DrawLine(x1+1, y1, x2+1, y2, m_ColRotoBound, true); - Gr->DrawLine(x1, y1+1, x2, y2+1, m_ColRotoBound, true); - - x1 = m_Roto.m_Origin.x + (int)(40*cos(-M_PI*(m_Roto.m_Angle0+dtMin)/180+da)); - y1 = m_Roto.m_Origin.y + (int)(40*sin(-M_PI*(m_Roto.m_Angle0+dtMin)/180+da)+0.5); - x2 = m_Roto.m_Origin.x + (int)(40*cos(-M_PI*(m_Roto.m_Angle0+dtMin+10)/180+da)); - y2 = m_Roto.m_Origin.y + (int)(40*sin(-M_PI*(m_Roto.m_Angle0+dtMin+10)/180+da)+0.5); - Gr->DrawLine(m_Roto.m_Origin.x, m_Roto.m_Origin.y, x1, y1, m_ColRotoBound, true); - Gr->DrawLine(m_Roto.m_Origin.x+1, m_Roto.m_Origin.y, x1+1, y1, m_ColRotoBound, true); - Gr->DrawLine(m_Roto.m_Origin.x, m_Roto.m_Origin.y+1, x1, y1+1, m_ColRotoBound, true); - Gr->DrawLine(x1, y1, x2, y2, m_ColRotoBound, true); - Gr->DrawLine(x1+1, y1, x2+1, y2, m_ColRotoBound, true); - Gr->DrawLine(x1, y1+1, x2, y2+1, m_ColRotoBound, true); - } - } - } - - Gr->DrawLine(m_Roto.m_Origin.x+1, m_Roto.m_Origin.y, m_Roto.m_Current.x+1, m_Roto.m_Current.y, m_ColRotoVal, true); - Gr->DrawLine(m_Roto.m_Origin.x, m_Roto.m_Origin.y+1, m_Roto.m_Current.x, m_Roto.m_Current.y+1, m_ColRotoVal, true); - Gr->DrawLine(m_Roto.m_Origin.x, m_Roto.m_Origin.y, m_Roto.m_Current.x, m_Roto.m_Current.y, m_ColRotoVal, true); - - if( fabs(m_Roto.m_AngleDT)>=1 ) - { - DrawArc(m_Roto.m_Origin.x, m_Roto.m_Origin.y, 32, float(m_Roto.m_Angle0), float(m_Roto.m_Angle0+m_Roto.m_AngleDT-1), m_ColRotoVal); - DrawArc(m_Roto.m_Origin.x+1, m_Roto.m_Origin.y, 32, float(m_Roto.m_Angle0), float(m_Roto.m_Angle0+m_Roto.m_AngleDT-1), m_ColRotoVal); - DrawArc(m_Roto.m_Origin.x, m_Roto.m_Origin.y+1, 32, float(m_Roto.m_Angle0), float(m_Roto.m_Angle0+m_Roto.m_AngleDT-1), m_ColRotoVal); - } - } -} - -double CTwBar::RotoGetValue() const -{ - assert(m_Roto.m_Var!=NULL); - return m_Roto.m_Var->ValueToDouble(); -} - -void CTwBar::RotoSetValue(double _Val) -{ - assert(m_Roto.m_Var!=NULL); - if( _Val!=m_Roto.m_CurrentValue ) - { - m_Roto.m_CurrentValue = _Val; - m_Roto.m_Var->ValueFromDouble(_Val); - NotUpToDate(); - } -} - -double CTwBar::RotoGetMin() const -{ - assert(m_Roto.m_Var!=NULL); - double min = -DOUBLE_MAX; - m_Roto.m_Var->MinMaxStepToDouble(&min, NULL, NULL); - return min; -} - -double CTwBar::RotoGetMax() const -{ - assert(m_Roto.m_Var!=NULL); - double max = DOUBLE_MAX; - m_Roto.m_Var->MinMaxStepToDouble(NULL, &max, NULL); - return max; -} - -double CTwBar::RotoGetStep() const -{ - assert(m_Roto.m_Var!=NULL); - double step = 1; - m_Roto.m_Var->MinMaxStepToDouble(NULL, NULL, &step); - return step; -} - -double CTwBar::RotoGetSteppedValue() const -{ - double d = m_Roto.m_PreciseValue-m_Roto.m_Value0; - double n = int(d/RotoGetStep()); - return m_Roto.m_Value0 + RotoGetStep()*n; -} - -void CTwBar::RotoOnMouseMove(int _X, int _Y) -{ - CPoint p(_X, _Y); - if( m_Roto.m_Active ) - { - m_Roto.m_Current = p; - RotoSetValue(RotoGetSteppedValue()); - //DrawManip(); - - int ti = -1; - double t = 0; - float r = sqrtf(float( (m_Roto.m_Current.x-m_Roto.m_Origin.x)*(m_Roto.m_Current.x-m_Roto.m_Origin.x) - + (m_Roto.m_Current.y-m_Roto.m_Origin.y)*(m_Roto.m_Current.y-m_Roto.m_Origin.y))); - if( r>m_RotoMinRadius ) - { - t = - atan2(double(m_Roto.m_Current.y-m_Roto.m_Origin.y), double(m_Roto.m_Current.x-m_Roto.m_Origin.x)); - ti = (int((t/(2.0*M_PI)+1.0)*NB_ROTO_CURSORS+0.5)) % NB_ROTO_CURSORS; - if( m_Roto.m_HasPrevious ) - { - CPoint v0 = m_Roto.m_Previous-m_Roto.m_Origin; - CPoint v1 = m_Roto.m_Current-m_Roto.m_Origin; - double l0 = sqrt(double(v0.x*v0.x+v0.y*v0.y)); - double l1 = sqrt(double(v1.x*v1.x+v1.y*v1.y)); - double dt = acos(max(-1+1.0e-30,min(1-1.0e-30,double(v0.x*v1.x+v0.y*v1.y)/(l0*l1)))); - if( v0.x*v1.y-v0.y*v1.x>0 ) - dt = - dt; - double preciseInc = double(m_Roto.m_Subdiv) * dt/(2.0*M_PI) * RotoGetStep(); - if( preciseInc>RotoGetStep() || preciseInc<-RotoGetStep() ) - { - m_Roto.m_PreciseValue += preciseInc; - if( m_Roto.m_PreciseValue>RotoGetMax() ) - { - m_Roto.m_PreciseValue = RotoGetMax(); - m_Roto.m_Value0 = RotoGetMax(); - - double da = 360*(RotoGetMax()-m_Roto.m_ValueAngle0)/(double(m_Roto.m_Subdiv)*RotoGetStep()); - m_Roto.m_Angle0 = ((int((t/(2.0*M_PI)+1.0)*360.0+0.5)) % 360) - da; - m_Roto.m_AngleDT = da; - } - else if( m_Roto.m_PreciseValue=0 && ti=0 && m_HighlightedLine<(int)m_HierTags.size() && m_HierTags[m_HighlightedLine].m_Var && !m_HierTags[m_HighlightedLine].m_Var->IsGroup() ) - { - m_Roto.m_Var = static_cast(m_HierTags[m_HighlightedLine].m_Var); - int y = m_PosY + m_VarY0 + m_HighlightedLine*(m_Font->m_CharHeight+m_LineSep) + m_Font->m_CharHeight/2; - m_Roto.m_Origin = CPoint(p.x, y); //r.CenterPoint().y); - m_Roto.m_Current = p; - m_Roto.m_Active = true; - m_Roto.m_HasPrevious = false; - m_Roto.m_Angle0 = 0; - m_Roto.m_AngleDT = 0; - //SetCapture(); - - m_Roto.m_Value0 = RotoGetValue(); - m_Roto.m_CurrentValue = m_Roto.m_Value0; - m_Roto.m_ValueAngle0 = m_Roto.m_Value0; - m_Roto.m_PreciseValue = m_Roto.m_Value0; - //RotoSetValue(RotoGetSteppedValue()); Not here - //DrawManip(); - - m_Roto.m_Subdiv = m_RotoNbSubdiv; - // re-adjust m_Subdiv if needed: - double min=-DOUBLE_MAX, max=DOUBLE_MAX, step=1; - m_Roto.m_Var->MinMaxStepToDouble(&min, &max, &step); - if( fabs(step)>0 && min>-DOUBLE_MAX && maxm_Graph!=NULL ); - - m_Var = NULL; - m_Active = false; - m_EditTextObj = g_TwMgr->m_Graph->NewTextObj(); - m_EditSelTextObj = g_TwMgr->m_Graph->NewTextObj(); - - m_X = m_Y = m_Width = 0; -} - -CTwBar::CEditInPlace::~CEditInPlace() -{ - assert( g_TwMgr!=NULL && g_TwMgr->m_Graph!=NULL ); - - if( m_EditTextObj ) - g_TwMgr->m_Graph->DeleteTextObj(m_EditTextObj); - if( m_EditSelTextObj ) - g_TwMgr->m_Graph->DeleteTextObj(m_EditSelTextObj); -} - -bool CTwBar::EditInPlaceIsReadOnly() -{ - if( m_EditInPlace.m_Var==NULL ) - return true; - else if( m_EditInPlace.m_Var->m_ReadOnly ) - return true; - else if( m_EditInPlace.m_Var->m_Type==TW_TYPE_CDSTRING && ((m_EditInPlace.m_Var->m_Ptr==NULL && m_EditInPlace.m_Var->m_SetCallback==NULL) || (m_EditInPlace.m_Var->m_Ptr!=NULL && g_TwMgr->m_CopyCDStringToClient==NULL)) ) - return true; - else if( m_EditInPlace.m_Var->m_Type==TW_TYPE_CDSTDSTRING && m_EditInPlace.m_Var->m_SetCallback==NULL ) - return true; - else if( m_EditInPlace.m_Var->m_Type==TW_TYPE_STDSTRING && ((m_EditInPlace.m_Var->m_Ptr==NULL && m_EditInPlace.m_Var->m_SetCallback==NULL) || (m_EditInPlace.m_Var->m_Ptr!=NULL && g_TwMgr->m_CopyStdStringToClient==NULL)) ) - return true; - else - return false; -} - -void CTwBar::EditInPlaceDraw() -{ - if( !m_EditInPlace.m_Active || m_EditInPlace.m_Var==NULL || m_EditInPlace.m_Width<=0 ) - return; - - // adjust m_FirstChar to see the caret, and extract the visible sub-string - int i, StringLen = (int)m_EditInPlace.m_String.length(); - if( m_EditInPlace.m_FirstChar>m_EditInPlace.m_CaretPos ) - m_EditInPlace.m_FirstChar = m_EditInPlace.m_CaretPos; - int SubstrWidth = 0; - for( i=min(m_EditInPlace.m_CaretPos, StringLen-1); i>=0 && SubstrWidthm_CharWidth[u]; - } - int FirstChar = max(0, i); - if( SubstrWidth>=m_EditInPlace.m_Width ) - FirstChar += 2; - if( m_EditInPlace.m_FirstChar0 ) - --m_EditInPlace.m_FirstChar; - SubstrWidth = 0; - for( i=m_EditInPlace.m_FirstChar; im_CharWidth[u]; - } - int LastChar = i; - if( SubstrWidth>=m_EditInPlace.m_Width ) - --LastChar; - string Substr = m_EditInPlace.m_String.substr( m_EditInPlace.m_FirstChar, LastChar-m_EditInPlace.m_FirstChar ); - - // compute caret x pos - int CaretX = m_PosX + m_EditInPlace.m_X; - for( i=m_EditInPlace.m_FirstChar; im_CharWidth[u]; - } - - // draw edit text - color32 ColText = EditInPlaceIsReadOnly() ? m_ColValTextRO : m_ColEditText; - color32 ColBg = EditInPlaceIsReadOnly() ? m_ColValBg : m_ColEditBg; - g_TwMgr->m_Graph->BuildText(m_EditInPlace.m_EditTextObj, &Substr, NULL, NULL, 1, m_Font, 0, m_EditInPlace.m_Width); - g_TwMgr->m_Graph->DrawText(m_EditInPlace.m_EditTextObj, m_PosX+m_EditInPlace.m_X, m_PosY+m_EditInPlace.m_Y, ColText, ColBg); - - // draw selected text - string StrSelected = ""; - if( m_EditInPlace.m_CaretPos>m_EditInPlace.m_SelectionStart ) - { - int FirstSel = max(m_EditInPlace.m_SelectionStart, m_EditInPlace.m_FirstChar); - int LastSel = min(m_EditInPlace.m_CaretPos, LastChar); - StrSelected = m_EditInPlace.m_String.substr( FirstSel, LastSel-FirstSel ); - } - else - { - int FirstSel = max(m_EditInPlace.m_CaretPos, m_EditInPlace.m_FirstChar); - int LastSel = min(m_EditInPlace.m_SelectionStart, LastChar); - StrSelected = m_EditInPlace.m_String.substr( FirstSel, LastSel-FirstSel ); - } - int SelWidth = 0; - for( i=0; i<(int)StrSelected.length(); ++i ) - { - unsigned char u = StrSelected.c_str()[i]; - SelWidth += m_Font->m_CharWidth[u]; - } - if( SelWidth>0 && StrSelected.length()>0 ) - { - color32 ColSelBg = EditInPlaceIsReadOnly() ? m_ColValTextRO : m_ColEditSelBg; - g_TwMgr->m_Graph->BuildText(m_EditInPlace.m_EditSelTextObj, &StrSelected, NULL, NULL, 1, m_Font, 0, SelWidth); - if ( m_EditInPlace.m_CaretPos>m_EditInPlace.m_SelectionStart ) - g_TwMgr->m_Graph->DrawText(m_EditInPlace.m_EditSelTextObj, CaretX-SelWidth, m_PosY+m_EditInPlace.m_Y, m_ColEditSelText, ColSelBg); - else - g_TwMgr->m_Graph->DrawText(m_EditInPlace.m_EditSelTextObj, CaretX, m_PosY+m_EditInPlace.m_Y, m_ColEditSelText, ColSelBg); - } - - // draw caret - if( CaretX<=m_PosX+m_EditInPlace.m_X+m_EditInPlace.m_Width ) - g_TwMgr->m_Graph->DrawLine( CaretX, m_PosY+m_EditInPlace.m_Y+1, CaretX, m_PosY+m_EditInPlace.m_Y+m_Font->m_CharHeight, m_ColEditText ); -} - -bool CTwBar::EditInPlaceAcceptVar(const CTwVarAtom* _Var) -{ - if( _Var==NULL ) - return false; - if( _Var->m_Type>=TW_TYPE_CHAR && _Var->m_Type<=TW_TYPE_DOUBLE ) - return true; - if( _Var->m_Type==TW_TYPE_CDSTRING || _Var->m_Type==TW_TYPE_CDSTDSTRING || _Var->m_Type==TW_TYPE_STDSTRING ) - return true; - if( IsCSStringType(_Var->m_Type) ) - return true; - - return false; -} - -void CTwBar::EditInPlaceStart(CTwVarAtom* _Var, int _X, int _Y, int _Width) -{ - if( m_EditInPlace.m_Active ) - EditInPlaceEnd(true); - - m_EditInPlace.m_Active = true; - m_EditInPlace.m_Var = _Var; - m_EditInPlace.m_X = _X; - m_EditInPlace.m_Y = _Y; - m_EditInPlace.m_Width = _Width; - m_EditInPlace.m_Var->ValueToString(&m_EditInPlace.m_String); - if( m_EditInPlace.m_Var->m_Type==TW_TYPE_CHAR ) - m_EditInPlace.m_String = m_EditInPlace.m_String.substr(0, 1); - m_EditInPlace.m_CaretPos = (int)m_EditInPlace.m_String.length(); - if( EditInPlaceIsReadOnly() ) - m_EditInPlace.m_SelectionStart = m_EditInPlace.m_CaretPos; - else - m_EditInPlace.m_SelectionStart = 0; - m_EditInPlace.m_FirstChar = 0; -} - -void CTwBar::EditInPlaceEnd(bool _Commit) -{ - if( _Commit && m_EditInPlace.m_Active && m_EditInPlace.m_Var!=NULL ) - { - if( m_EditInPlace.m_Var->m_Type==TW_TYPE_CDSTRING || m_EditInPlace.m_Var->m_Type==TW_TYPE_CDSTDSTRING ) - { - if( m_EditInPlace.m_Var->m_SetCallback!=NULL ) - { - const char *String = m_EditInPlace.m_String.c_str(); - m_EditInPlace.m_Var->m_SetCallback(&String, m_EditInPlace.m_Var->m_ClientData); - } - else if( m_EditInPlace.m_Var->m_Type!=TW_TYPE_CDSTDSTRING ) - { - char **StringPtr = (char **)m_EditInPlace.m_Var->m_Ptr; - if( StringPtr!=NULL && g_TwMgr->m_CopyCDStringToClient!=NULL ) - g_TwMgr->m_CopyCDStringToClient(StringPtr, m_EditInPlace.m_String.c_str()); - } - } - else if( m_EditInPlace.m_Var->m_Type==TW_TYPE_STDSTRING ) - { - // this case should never happened: TW_TYPE_STDSTRING are converted to TW_TYPE_CDSTDSTRING by TwAddVar - if( m_EditInPlace.m_Var->m_SetCallback!=NULL ) - m_EditInPlace.m_Var->m_SetCallback(&(m_EditInPlace.m_String), m_EditInPlace.m_Var->m_ClientData); - else - { - string *StringPtr = (string *)m_EditInPlace.m_Var->m_Ptr; - if( StringPtr!=NULL && g_TwMgr->m_CopyStdStringToClient!=NULL ) - g_TwMgr->m_CopyStdStringToClient(*StringPtr, m_EditInPlace.m_String); - } - } - else if( IsCSStringType(m_EditInPlace.m_Var->m_Type) ) - { - int n = TW_CSSTRING_SIZE(m_EditInPlace.m_Var->m_Type); - if( n>0 ) - { - if( (int)m_EditInPlace.m_String.length()>n-1 ) - m_EditInPlace.m_String.resize(n-1); - if( m_EditInPlace.m_Var->m_SetCallback!=NULL ) - m_EditInPlace.m_Var->m_SetCallback(m_EditInPlace.m_String.c_str(), m_EditInPlace.m_Var->m_ClientData); - else if( m_EditInPlace.m_Var->m_Ptr!=NULL ) - { - if( n>1 ) - strncpy((char *)m_EditInPlace.m_Var->m_Ptr, m_EditInPlace.m_String.c_str(), n-1); - ((char *)m_EditInPlace.m_Var->m_Ptr)[n-1] = '\0'; - } - } - } - else - { - double Val = 0, Min = 0, Max = 0, Step = 0; - int n = 0; - if( m_EditInPlace.m_Var->m_Type==TW_TYPE_CHAR ) - { - unsigned char Char = 0; - n = sscanf(m_EditInPlace.m_String.c_str(), "%c", &Char); - Val = Char; - } - else - n = sscanf(m_EditInPlace.m_String.c_str(), "%lf", &Val); - if( n==1 ) - { - m_EditInPlace.m_Var->MinMaxStepToDouble(&Min, &Max, &Step); - if( ValMax ) - Val = Max; - m_EditInPlace.m_Var->ValueFromDouble(Val); - } - } - if( g_TwMgr!=NULL ) // Mgr might have been destroyed by the client inside a callback call - NotUpToDate(); - } - m_EditInPlace.m_Active = false; - m_EditInPlace.m_Var = NULL; -} - -bool CTwBar::EditInPlaceKeyPressed(int _Key, int _Modifiers) -{ - if( !m_EditInPlace.m_Active ) - return false; - bool Handled = true; // if EditInPlace is active, it catches all key events - bool DoCopy = false, DoPaste = false; - - switch( _Key ) - { - case TW_KEY_ESCAPE: - EditInPlaceEnd(false); - break; - case TW_KEY_RETURN: - EditInPlaceEnd(true); - break; - case TW_KEY_LEFT: - if( _Modifiers==TW_KMOD_SHIFT ) - m_EditInPlace.m_CaretPos = max(0, m_EditInPlace.m_CaretPos-1); - else - { - if( m_EditInPlace.m_SelectionStart!=m_EditInPlace.m_CaretPos ) - m_EditInPlace.m_CaretPos = min(m_EditInPlace.m_SelectionStart, m_EditInPlace.m_CaretPos); - else - m_EditInPlace.m_CaretPos = max(0, m_EditInPlace.m_CaretPos-1); - m_EditInPlace.m_SelectionStart = m_EditInPlace.m_CaretPos; - } - break; - case TW_KEY_RIGHT: - if( _Modifiers==TW_KMOD_SHIFT ) - m_EditInPlace.m_CaretPos = min((int)m_EditInPlace.m_String.length(), m_EditInPlace.m_CaretPos+1); - else - { - if( m_EditInPlace.m_SelectionStart!=m_EditInPlace.m_CaretPos ) - m_EditInPlace.m_CaretPos = max(m_EditInPlace.m_SelectionStart, m_EditInPlace.m_CaretPos); - else - m_EditInPlace.m_CaretPos = min((int)m_EditInPlace.m_String.length(), m_EditInPlace.m_CaretPos+1); - m_EditInPlace.m_SelectionStart = m_EditInPlace.m_CaretPos; - } - break; - case TW_KEY_BACKSPACE: - if( !EditInPlaceIsReadOnly() ) - { - if( m_EditInPlace.m_SelectionStart==m_EditInPlace.m_CaretPos ) - m_EditInPlace.m_SelectionStart = max(0, m_EditInPlace.m_CaretPos-1); - EditInPlaceEraseSelect(); - } - break; - case TW_KEY_DELETE: - if( !EditInPlaceIsReadOnly() ) - { - if( m_EditInPlace.m_SelectionStart==m_EditInPlace.m_CaretPos ) - m_EditInPlace.m_SelectionStart = min(m_EditInPlace.m_CaretPos+1, (int)m_EditInPlace.m_String.length()); - EditInPlaceEraseSelect(); - } - break; - case TW_KEY_HOME: - m_EditInPlace.m_CaretPos = 0; - if( _Modifiers!=TW_KMOD_SHIFT ) - m_EditInPlace.m_SelectionStart = m_EditInPlace.m_CaretPos; - break; - case TW_KEY_END: - m_EditInPlace.m_CaretPos = (int)m_EditInPlace.m_String.length(); - if( _Modifiers!=TW_KMOD_SHIFT ) - m_EditInPlace.m_SelectionStart = m_EditInPlace.m_CaretPos; - break; - case TW_KEY_INSERT: - if( _Modifiers==TW_KMOD_CTRL ) - DoCopy = true; - else if( _Modifiers==TW_KMOD_SHIFT ) - DoPaste = true; - break; - default: - if( _Modifiers==TW_KMOD_CTRL ) - { - if( _Key=='c' || _Key=='C' ) - DoCopy = true; - else if( _Key=='v' || _Key=='V' ) - DoPaste = true; - } - else if( _Key>=32 && _Key<=255 ) - { - if( !EditInPlaceIsReadOnly() && m_EditInPlace.m_CaretPos>=0 && m_EditInPlace.m_CaretPos<=(int)m_EditInPlace.m_String.length() ) - { - if( m_EditInPlace.m_SelectionStart!=m_EditInPlace.m_CaretPos ) - EditInPlaceEraseSelect(); - string Str(1, (char)_Key); - m_EditInPlace.m_String.insert(m_EditInPlace.m_CaretPos, Str); - ++m_EditInPlace.m_CaretPos; - m_EditInPlace.m_SelectionStart = m_EditInPlace.m_CaretPos; - } - } - } - - if( DoPaste && !EditInPlaceIsReadOnly() ) - { - if( m_EditInPlace.m_SelectionStart!=m_EditInPlace.m_CaretPos ) - EditInPlaceEraseSelect(); - string Str = ""; - if( EditInPlaceGetClipboard(&Str) && Str.length()>0 ) - { - m_EditInPlace.m_String.insert(m_EditInPlace.m_CaretPos, Str); - m_EditInPlace.m_CaretPos += (int)Str.length(); - m_EditInPlace.m_SelectionStart = m_EditInPlace.m_CaretPos; - } - } - if( DoCopy ) - { - string Str = ""; - if( m_EditInPlace.m_CaretPos>m_EditInPlace.m_SelectionStart ) - Str = m_EditInPlace.m_String.substr(m_EditInPlace.m_SelectionStart, m_EditInPlace.m_CaretPos-m_EditInPlace.m_SelectionStart); - else if( m_EditInPlace.m_CaretPosPosMin ) - m_EditInPlace.m_FirstChar = PosMin; - return true; - } - else - return false; -} - - -bool CTwBar::EditInPlaceMouseMove(int _X, int _Y, bool _Select) -{ - if ( !m_EditInPlace.m_Active || _Ym_PosY+m_EditInPlace.m_Y+m_Font->m_CharHeight ) - return false; - - int i, CaretX = m_PosX+m_EditInPlace.m_X; - for( i=m_EditInPlace.m_FirstChar; i<(int)m_EditInPlace.m_String.length() && CaretXm_CharWidth[u]; - if( _X < CaretX + CharWidth / 2 ) - break; - CaretX += CharWidth; - } - if( CaretX>=m_PosX+m_EditInPlace.m_X+m_EditInPlace.m_Width ) - i = max(0, i-1); - - m_EditInPlace.m_CaretPos = i; - if( !_Select ) - m_EditInPlace.m_SelectionStart = m_EditInPlace.m_CaretPos; - return true; -} - - -bool CTwBar::EditInPlaceGetClipboard(std::string *_OutString) -{ - assert( _OutString!=NULL ); - *_OutString = m_EditInPlace.m_Clipboard; // default implementation - -#if defined ANT_WINDOWS - - if( !IsClipboardFormatAvailable(CF_TEXT) ) - return false; - if( !OpenClipboard(NULL) ) - return false; - HGLOBAL TextHandle = GetClipboardData(CF_TEXT); - if( TextHandle!=NULL ) - { - const char *TextString = static_cast(GlobalLock(TextHandle)); - if( TextHandle!=NULL ) - { - *_OutString = TextString; - GlobalUnlock(TextHandle); - } - } - CloseClipboard(); - -#elif defined ANT_UNIX - - if( g_TwMgr->m_CurrentXDisplay!=NULL ) - { - int NbBytes = 0; - char *Buffer = XFetchBytes(g_TwMgr->m_CurrentXDisplay, &NbBytes); - if( Buffer!=NULL ) - { - if( NbBytes>0 ) - { - char *Text = new char[NbBytes+1]; - memcpy(Text, Buffer, NbBytes); - Text[NbBytes] = '\0'; - *_OutString = Text; - delete[] Text; - } - XFree(Buffer); - } - } - -#endif - - return true; -} - - -bool CTwBar::EditInPlaceSetClipboard(const std::string& _String) -{ - if( _String.length()<=0 ) - return false; // keep last clipboard - m_EditInPlace.m_Clipboard = _String; // default implementation - -#if defined ANT_WINDOWS - - if( !OpenClipboard(NULL) ) - return false; - EmptyClipboard(); - HGLOBAL TextHandle = GlobalAlloc(GMEM_MOVEABLE, _String.length()+1); - if( TextHandle==NULL ) - { - CloseClipboard(); - return false; - } - char *TextString = static_cast(GlobalLock(TextHandle)); - memcpy(TextString, _String.c_str(), _String.length()); - TextString[_String.length()] = '\0'; - GlobalUnlock(TextHandle); - SetClipboardData(CF_TEXT, TextHandle); - CloseClipboard(); - -#elif defined ANT_UNIX - - if( g_TwMgr->m_CurrentXDisplay!=NULL ) - { - XSetSelectionOwner(g_TwMgr->m_CurrentXDisplay, XA_PRIMARY, None, CurrentTime); - char *Text = new char[_String.length()+1]; - memcpy(Text, _String.c_str(), _String.length()); - Text[_String.length()] = '\0'; - XStoreBytes(g_TwMgr->m_CurrentXDisplay, Text, _String.length()); - delete[] Text; - } - -#endif - - return true; -} - - -// --------------------------------------------------------------------------- - - diff --git a/extern/AntTweakBar/src/TwBar.h b/extern/AntTweakBar/src/TwBar.h deleted file mode 100644 index 0e20f27c..00000000 --- a/extern/AntTweakBar/src/TwBar.h +++ /dev/null @@ -1,438 +0,0 @@ -// --------------------------------------------------------------------------- -// -// @file TwBar.h -// @brief Tweak bar and var classes. -// @author Philippe Decaudin -// @license This file is part of the AntTweakBar library. -// For conditions of distribution and use, see License.txt -// -// note: Private header -// -// --------------------------------------------------------------------------- - - -#if !defined ANT_TW_BAR_INCLUDED -#define ANT_TW_BAR_INCLUDED - -#include -#include "TwColors.h" - -#define ANT_TWEAK_BAR_DLL "AntTweakBar" - - -// --------------------------------------------------------------------------- - -bool IsCustomType(int _Type); - -struct CTwVar -{ - std::string m_Name; - std::string m_Label; - std::string m_Help; - bool m_IsRoot; - bool m_DontClip; - bool m_Visible; - signed short m_LeftMargin; - signed short m_TopMargin; - const color32 * m_ColorPtr; - const color32 * m_BgColorPtr; - - virtual bool IsGroup() const = 0; - virtual bool IsCustom() const { return false; } - virtual const CTwVar * Find(const char *_Name, struct CTwVarGroup **_Parent, int *_Index) const = 0; - virtual int HasAttrib(const char *_Attrib, bool *_HasValue) const; - virtual int SetAttrib(int _AttribID, const char *_Value, TwBar *_Bar, struct CTwVarGroup *_VarParent, int _VarIndex); - virtual ERetType GetAttrib(int _AttribID, TwBar *_Bar, struct CTwVarGroup *_VarParent, int _VarIndex, std::vector& outDouble, std::ostringstream& outString) const; - virtual void SetReadOnly(bool _ReadOnly) = 0; - virtual bool IsReadOnly() const = 0; - CTwVar(); - virtual ~CTwVar() {} - - static size_t GetDataSize(TwType _Type); -}; - - -struct CTwVarAtom : CTwVar -{ - ETwType m_Type; - void * m_Ptr; - TwSetVarCallback m_SetCallback; - TwGetVarCallback m_GetCallback; - void * m_ClientData; - bool m_ReadOnly; - bool m_NoSlider; - int m_KeyIncr[2]; // [0]=key_code [1]=modifiers - int m_KeyDecr[2]; // [0]=key_code [1]=modifiers - - template struct TVal - { - _T m_Min; - _T m_Max; - _T m_Step; - signed char m_Precision; - bool m_Hexa; - }; - union UVal - { - TVal m_Char; - TVal m_Int8; - TVal m_UInt8; - TVal m_Int16; - TValm_UInt16; - TVal m_Int32; - TVal m_UInt32; - TVal m_Float32; - TVal m_Float64; - struct CBoolVal - { - char * m_TrueString; - char * m_FalseString; - bool m_FreeTrueString; - bool m_FreeFalseString; - } m_Bool; - struct CEnumVal // empty -> enum entries are deduced from m_Type - { - //typedef std::map CEntries; - //CEntries * m_Entries; - } m_Enum; - struct CShortcutVal - { - int m_Incr[2]; - int m_Decr[2]; - } m_Shortcut; - struct CHelpStruct - { - int m_StructType; - } m_HelpStruct; - struct CButtonVal - { - TwButtonCallback m_Callback; - int m_Separator; - } m_Button; - struct CCustomVal - { - CTwMgr::CMemberProxy *m_MemberProxy; - } m_Custom; - }; - UVal m_Val; - - virtual bool IsGroup() const { return false; } - virtual bool IsCustom() const { return IsCustomType(m_Type); } - virtual void ValueToString(std::string *_Str) const; - virtual double ValueToDouble() const; - virtual void ValueFromDouble(double _Val); - virtual void MinMaxStepToDouble(double *_Min, double *_Max, double *_Step) const; - virtual const CTwVar * Find(const char *_Name, struct CTwVarGroup **_Parent, int *_Index) const; - virtual int HasAttrib(const char *_Attrib, bool *_HasValue) const; - virtual int SetAttrib(int _AttribID, const char *_Value, TwBar *_Bar, struct CTwVarGroup *_VarParent, int _VarIndex); - virtual ERetType GetAttrib(int _AttribID, TwBar *_Bar, struct CTwVarGroup *_VarParent, int _VarIndex, std::vector& outDouble, std::ostringstream& outString) const; - virtual void Increment(int _Step); - virtual void SetDefaults(); - virtual void SetReadOnly(bool _ReadOnly) { m_ReadOnly=_ReadOnly; if( m_Type!=TW_TYPE_BUTTON && m_SetCallback==NULL && m_Ptr==NULL ) m_ReadOnly=true; } - virtual bool IsReadOnly() const { if( m_Type!=TW_TYPE_BUTTON && m_SetCallback==NULL && m_Ptr==NULL ) return true; else return m_ReadOnly; } - //virtual int DefineEnum(const TwEnumVal *_EnumValues, unsigned int _NbValues); - CTwVarAtom(); - virtual ~CTwVarAtom(); -}; - - -struct CTwVarGroup : CTwVar -{ - std::vector m_Vars; - bool m_Open; - TwSummaryCallback m_SummaryCallback; - void * m_SummaryClientData; - void * m_StructValuePtr; - TwType m_StructType; - - virtual bool IsGroup() const { return true; } - virtual const CTwVar * Find(const char *_Name, CTwVarGroup **_Parent, int *_Index) const; - virtual int HasAttrib(const char *_Attrib, bool *_HasValue) const; - virtual int SetAttrib(int _AttribID, const char *_Value, TwBar *_Bar, struct CTwVarGroup *_VarParent, int _VarIndex); - virtual ERetType GetAttrib(int _AttribID, TwBar *_Bar, struct CTwVarGroup *_VarParent, int _VarIndex, std::vector& outDouble, std::ostringstream& outString) const; - virtual CTwVarAtom * FindShortcut(int _Key, int _Modifiers, bool *_DoIncr); - virtual void SetReadOnly(bool _ReadOnly) { for(size_t i=0; iSetReadOnly(_ReadOnly); } - virtual bool IsReadOnly() const { for(size_t i=0; iIsReadOnly()) return false; return true; } - CTwVarGroup() { m_Open=false; m_StructType=TW_TYPE_UNDEF; m_SummaryCallback=NULL; m_SummaryClientData=NULL; m_StructValuePtr=NULL; } - virtual ~CTwVarGroup(); -}; - -// --------------------------------------------------------------------------- - -struct CTwBar -{ - std::string m_Name; - std::string m_Label; - std::string m_Help; - bool m_Visible; - int m_PosX; - int m_PosY; - int m_Width; - int m_Height; - color32 m_Color; - bool m_DarkText; - const CTexFont * m_Font; - int m_ValuesWidth; - int m_Sep; - int m_LineSep; - int m_FirstLine; - float m_UpdatePeriod; - bool m_IsHelpBar; - int m_MinNumber; // accessed by TwDeleteBar - bool m_IsPopupList; - CTwVarAtom * m_VarEnumLinkedToPopupList; - CTwBar * m_BarLinkedToPopupList; - bool m_Resizable; - bool m_Movable; - bool m_Iconifiable; - bool m_Contained; - - CTwVarGroup m_VarRoot; - - enum EDrawPart { DRAW_BG=(1<<0), DRAW_CONTENT=(1<<1), DRAW_ALL=DRAW_BG|DRAW_CONTENT }; - void Draw(int _DrawPart=DRAW_ALL); - void NotUpToDate(); - const CTwVar * Find(const char *_Name, CTwVarGroup **_Parent=NULL, int *_Index=NULL) const; - CTwVar * Find(const char *_Name, CTwVarGroup **_Parent=NULL, int *_Index=NULL); - int HasAttrib(const char *_Attrib, bool *_HasValue) const; - int SetAttrib(int _AttribID, const char *_Value); - ERetType GetAttrib(int _AttribID, std::vector& outDouble, std::ostringstream& outString) const; - bool MouseMotion(int _X, int _Y); - bool MouseButton(ETwMouseButtonID _Button, bool _Pressed, int _X, int _Y); - bool MouseWheel(int _Pos, int _PrevPos, int _MouseX, int _MouseY); - bool KeyPressed(int _Key, int _Modifiers); - bool KeyTest(int _Key, int _Modifiers); - bool IsMinimized() const { return m_IsMinimized; } - bool IsDragging() const { return m_MouseDrag; } - bool Show(CTwVar *_Var); // display the line associated to _Var - bool OpenHier(CTwVarGroup *_Root, CTwVar *_Var); // open a hierarchy if it contains _Var - int LineInHier(CTwVarGroup *_Root, CTwVar *_Var); // returns the number of the line associated to _Var - void UnHighlightLine() { m_HighlightedLine = -1; NotUpToDate(); } // used by PopupCallback - void HaveFocus(bool _Focus) { m_DrawHandles = _Focus; } // used by PopupCallback - void StopEditInPlace() { if( m_EditInPlace.m_Active ) EditInPlaceEnd(false); } - CTwBar(const char *_Name); - ~CTwBar(); - - color32 m_ColBg, m_ColBg1, m_ColBg2; - color32 m_ColHighBg0; - color32 m_ColHighBg1; - color32 m_ColLabelText; - color32 m_ColStructText; - color32 m_ColValBg; - color32 m_ColValText; - color32 m_ColValTextRO; - color32 m_ColValTextNE; - color32 m_ColValMin; - color32 m_ColValMax; - color32 m_ColStructBg; - color32 m_ColTitleBg; - color32 m_ColTitleHighBg; - color32 m_ColTitleUnactiveBg; - color32 m_ColTitleText; - color32 m_ColTitleShadow; - color32 m_ColLine; - color32 m_ColLineShadow; - color32 m_ColUnderline; - color32 m_ColBtn; - color32 m_ColHighBtn; - color32 m_ColFold; - color32 m_ColHighFold; - color32 m_ColGrpBg; - color32 m_ColGrpText; - color32 m_ColHierBg; - color32 m_ColShortcutText; - color32 m_ColShortcutBg; - color32 m_ColInfoText; - color32 m_ColHelpBg; - color32 m_ColHelpText; - color32 m_ColRoto; - color32 m_ColRotoVal; - color32 m_ColRotoBound; - color32 m_ColEditBg; - color32 m_ColEditText; - color32 m_ColEditSelBg; - color32 m_ColEditSelText; - color32 m_ColSeparator; - color32 m_ColStaticText; - void UpdateColors(); - -protected: - int m_TitleWidth; - int m_VarX0; - int m_VarX1; - int m_VarX2; - int m_VarY0; - int m_VarY1; - int m_VarY2; - int m_ScrollYW; - int m_ScrollYH; - int m_ScrollY0; - int m_ScrollY1; - int m_NbHierLines; - int m_NbDisplayedLines; - bool m_UpToDate; - float m_LastUpdateTime; - void Update(); - - bool m_MouseDrag; - bool m_MouseDragVar; - bool m_MouseDragTitle; - bool m_MouseDragScroll; - bool m_MouseDragResizeUR; - bool m_MouseDragResizeUL; - bool m_MouseDragResizeLR; - bool m_MouseDragResizeLL; - bool m_MouseDragValWidth; - int m_MouseOriginX; - int m_MouseOriginY; - double m_ValuesWidthRatio; - bool m_VarHasBeenIncr; - int m_FirstLine0; - int m_HighlightedLine; - int m_HighlightedLinePrev; - int m_HighlightedLineLastValid; - bool m_HighlightIncrBtn; - bool m_HighlightDecrBtn; - bool m_HighlightRotoBtn; - bool m_HighlightListBtn; - bool m_HighlightBoolBtn; - bool m_HighlightClickBtn; - double m_HighlightClickBtnAuto; - bool m_HighlightTitle; - bool m_HighlightScroll; - bool m_HighlightUpScroll; - bool m_HighlightDnScroll; - bool m_HighlightMinimize; - bool m_HighlightFont; - bool m_HighlightValWidth; - bool m_HighlightLabelsHeader; - bool m_HighlightValuesHeader; - bool m_DrawHandles; - - bool m_IsMinimized; - int m_MinPosX; - int m_MinPosY; - bool m_HighlightMaximize; - bool m_DrawIncrDecrBtn; - bool m_DrawRotoBtn; - bool m_DrawClickBtn; - bool m_DrawListBtn; - bool m_DrawBoolBtn; - EButtonAlign m_ButtonAlign; - - struct CHierTag - { - CTwVar * m_Var; - int m_Level; - bool m_Closing; - }; - std::vector m_HierTags; - void BrowseHierarchy(int *_LineNum, int _CurrLevel, const CTwVar *_Var, int _First, int _Last); - void * m_TitleTextObj; - void * m_LabelsTextObj; - void * m_ValuesTextObj; - void * m_ShortcutTextObj; - int m_ShortcutLine; - void * m_HeadersTextObj; - void ListLabels(std::vector& _Labels, std::vector& _Colors, std::vector& _BgColors, bool *_HasBgColors, const CTexFont *_Font, int _AtomWidthMax, int _GroupWidthMax); - void ListValues(std::vector& _Values, std::vector& _Colors, std::vector& _BgColors, const CTexFont *_Font, int _WidthMax); - int ComputeLabelsWidth(const CTexFont *_Font); - int ComputeValuesWidth(const CTexFont *_Font); - void DrawHierHandle(); - - enum EValuesWidthFit { VALUES_WIDTH_FIT = -5555 }; - - // RotoSlider - struct CPoint - { - int x, y; - CPoint() {} - CPoint(int _X, int _Y):x(_X), y(_Y) {} - const CPoint operator+ (const CPoint& p) const { return CPoint(x+p.x, y+p.y); } - const CPoint operator- (const CPoint& p) const { return CPoint(x-p.x, y-p.y); } - }; - struct CRotoSlider - { - CRotoSlider(); - CTwVarAtom * m_Var; - double m_PreciseValue; - double m_CurrentValue; - double m_Value0; - double m_ValueAngle0; - bool m_Active; - bool m_ActiveMiddle; - CPoint m_Origin; - CPoint m_Current; - bool m_HasPrevious; - CPoint m_Previous; - double m_Angle0; - double m_AngleDT; - int m_Subdiv; - }; - CRotoSlider m_Roto; - int m_RotoMinRadius; - int m_RotoNbSubdiv; // number of steps for one turn - void RotoDraw(); - void RotoOnMouseMove(int _X, int _Y); - void RotoOnLButtonDown(int _X, int _Y); - void RotoOnLButtonUp(int _X, int _Y); - void RotoOnMButtonDown(int _X, int _Y); - void RotoOnMButtonUp(int _X, int _Y); - double RotoGetValue() const; - void RotoSetValue(double _Val); - double RotoGetMin() const; - double RotoGetMax() const; - double RotoGetStep() const; - double RotoGetSteppedValue() const; - - // Edit-in-place - struct CEditInPlace - { - CEditInPlace(); - ~CEditInPlace(); - CTwVarAtom * m_Var; - bool m_Active; - std::string m_String; - void * m_EditTextObj; - void * m_EditSelTextObj; - int m_CaretPos; - int m_SelectionStart; - int m_X, m_Y; - int m_Width; - int m_FirstChar; - std::string m_Clipboard; - }; - CEditInPlace m_EditInPlace; - void EditInPlaceDraw(); - bool EditInPlaceAcceptVar(const CTwVarAtom* _Var); - bool EditInPlaceIsReadOnly(); - void EditInPlaceStart(CTwVarAtom* _Var, int _X, int _Y, int _Width); - void EditInPlaceEnd(bool _Commit); - bool EditInPlaceKeyPressed(int _Key, int _Modifiers); - bool EditInPlaceEraseSelect(); - bool EditInPlaceMouseMove(int _X, int _Y, bool _Select); - bool EditInPlaceSetClipboard(const std::string& _String); - bool EditInPlaceGetClipboard(std::string *_OutString); - - struct CCustomRecord - { - int m_IndexMin; - int m_IndexMax; - int m_XMin, m_XMax; - int m_YMin, m_YMax; // Y visible range - int m_Y0, m_Y1; // Y widget range - CTwVarGroup * m_Var; - }; - typedef std::map CustomMap; - CustomMap m_CustomRecords; - CTwMgr::CStructProxy * m_CustomActiveStructProxy; - - friend struct CTwMgr; -}; - -void DrawArc(int _X, int _Y, int _Radius, float _StartAngleDeg, float _EndAngleDeg, color32 _Color); - -// --------------------------------------------------------------------------- - - -#endif // !defined ANT_TW_BAR_INCLUDED diff --git a/extern/AntTweakBar/src/TwColors.cpp b/extern/AntTweakBar/src/TwColors.cpp deleted file mode 100644 index bb3e8fb7..00000000 --- a/extern/AntTweakBar/src/TwColors.cpp +++ /dev/null @@ -1,153 +0,0 @@ -// --------------------------------------------------------------------------- -// -// @file TwColors.cpp -// @author Philippe Decaudin -// @license This file is part of the AntTweakBar library. -// For conditions of distribution and use, see License.txt -// -// --------------------------------------------------------------------------- - - -#include "TwPrecomp.h" -#include "TwColors.h" - - -void ColorRGBToHLSf(float _R, float _G, float _B, float *_Hue, float *_Light, float *_Saturation) -{ - // Compute HLS from RGB. The r,g,b triplet is between [0,1], - // hue is between [0,360], light and saturation are [0,1]. - - float rnorm, gnorm, bnorm, minval, maxval, msum, mdiff, r, g, b; - r = g = b = 0; - if(_R>0) r = _R; if(r>1) r = 1; - if(_G>0) g = _G; if(g>1) g = 1; - if(_B>0) b = _B; if(b>1) b = 1; - - minval = r; - if(gmaxval) maxval = g; - if(b>maxval) maxval = b; - - rnorm = gnorm = bnorm = 0; - mdiff = maxval - minval; - msum = maxval + minval; - float l = 0.5f * msum; - if(_Light) - *_Light = l; - if(maxval!=minval) - { - rnorm = (maxval - r)/mdiff; - gnorm = (maxval - g)/mdiff; - bnorm = (maxval - b)/mdiff; - } - else - { - if(_Saturation) - *_Saturation = 0; - if(_Hue) - *_Hue = 0; - return; - } - - if(_Saturation) - { - if(l<0.5f) - *_Saturation = mdiff/msum; - else - *_Saturation = mdiff/(2.0f - msum); - } - - if(_Hue) - { - if(r==maxval) - *_Hue = 60.0f * (6.0f + bnorm - gnorm); - else if(g==maxval) - *_Hue = 60.0f * (2.0f + rnorm - bnorm); - else - *_Hue = 60.0f * (4.0f + gnorm - rnorm); - - if(*_Hue>360.0f) - *_Hue -= 360.0f; - } -} - - -void ColorRGBToHLSi(int _R, int _G, int _B, int *_Hue, int *_Light, int *_Saturation) -{ - float h, l, s; - ColorRGBToHLSf((1.0f/255.0f)*float(_R), (1.0f/255.0f)*float(_G), (1.0f/255.0f)*float(_B), &h, &l, &s); - if(_Hue) *_Hue = (int)TClamp(h*(256.0f/360.0f), 0.0f, 255.0f); - if(_Light) *_Light = (int)TClamp(l*256.0f, 0.0f, 255.0f); - if(_Saturation) *_Saturation= (int)TClamp(s*256.0f, 0.0f, 255.0f); -} - - -void ColorHLSToRGBf(float _Hue, float _Light, float _Saturation, float *_R, float *_G, float *_B) -{ - // Compute RGB from HLS. The light and saturation are between [0,1] - // and hue is between [0,360]. The returned r,g,b triplet is between [0,1]. - - // a local auxiliary function - struct CLocal - { - static float HLSToRGB(float _Rn1, float _Rn2, float _Huei) - { - float hue = _Huei; - if(hue>360) hue = hue - 360; - if(hue<0) hue = hue + 360; - if(hue<60 ) return _Rn1 + (_Rn2-_Rn1)*hue/60; - if(hue<180) return _Rn2; - if(hue<240) return _Rn1 + (_Rn2-_Rn1)*(240-hue)/60; - return _Rn1; - } - }; - - float rh, rl, rs, rm1, rm2; - rh = rl = rs = 0; - if(_Hue>0) rh = _Hue; if(rh>360) rh = 360; - if(_Light>0) rl = _Light; if(rl>1) rl = 1; - if(_Saturation>0) rs = _Saturation; if(rs>1) rs = 1; - - if(rl<=0.5f) - rm2 = rl*(1.0f + rs); - else - rm2 = rl + rs - rl*rs; - rm1 = 2.0f*rl - rm2; - - if(!rs) - { - if(_R) *_R = rl; - if(_G) *_G = rl; - if(_B) *_B = rl; - } - else - { - if(_R) *_R = CLocal::HLSToRGB(rm1, rm2, rh+120); - if(_G) *_G = CLocal::HLSToRGB(rm1, rm2, rh); - if(_B) *_B = CLocal::HLSToRGB(rm1, rm2, rh-120); - } -} - - -void ColorHLSToRGBi(int _Hue, int _Light, int _Saturation, int *_R, int *_G, int *_B) -{ - float r, g, b; - ColorHLSToRGBf((360.0f/255.0f)*float(_Hue), (1.0f/255.0f)*float(_Light), (1.0f/255.0f)*float(_Saturation), &r, &g, &b); - if(_R) *_R = (int)TClamp(r*256.0f, 0.0f, 255.0f); - if(_G) *_G = (int)TClamp(g*256.0f, 0.0f, 255.0f); - if(_B) *_B = (int)TClamp(b*256.0f, 0.0f, 255.0f); -} - - -color32 ColorBlend(color32 _Color1, color32 _Color2, float _S) -{ - float a1, r1, g1, b1, a2, r2, g2, b2; - Color32ToARGBf(_Color1, &a1, &r1, &g1, &b1); - Color32ToARGBf(_Color2, &a2, &r2, &g2, &b2); - float t = 1.0f-_S; - return Color32FromARGBf(t*a1+_S*a2, t*r1+_S*r2, t*g1+_S*g2, t*b1+_S*b2); -} - - diff --git a/extern/AntTweakBar/src/TwColors.h b/extern/AntTweakBar/src/TwColors.h deleted file mode 100644 index 9efc1fdd..00000000 --- a/extern/AntTweakBar/src/TwColors.h +++ /dev/null @@ -1,80 +0,0 @@ -// --------------------------------------------------------------------------- -// -// @file TwColors.h -// @brief Color conversions -// @author Philippe Decaudin -// @license This file is part of the AntTweakBar library. -// For conditions of distribution and use, see License.txt -// -// note: Private header -// -// --------------------------------------------------------------------------- - - -#if !defined ANT_TW_COLORS_INCLUDED -#define ANT_TW_COLORS_INCLUDED - - -// --------------------------------------------------------------------------- - - -typedef unsigned int color32; - - -const color32 COLOR32_BLACK = 0xff000000; // Black -const color32 COLOR32_WHITE = 0xffffffff; // White -const color32 COLOR32_ZERO = 0x00000000; // Zero -const color32 COLOR32_RED = 0xffff0000; // Red -const color32 COLOR32_GREEN = 0xff00ff00; // Green -const color32 COLOR32_BLUE = 0xff0000ff; // Blue - - -template inline const _T& TClamp(const _T& _X, const _T& _Limit1, const _T& _Limit2) -{ - if( _Limit1<_Limit2 ) - return (_X<=_Limit1) ? _Limit1 : ( (_X>=_Limit2) ? _Limit2 : _X ); - else - return (_X<=_Limit2) ? _Limit2 : ( (_X>=_Limit1) ? _Limit1 : _X ); -} - -inline color32 Color32FromARGBi(int _A, int _R, int _G, int _B) -{ - return (((color32)TClamp(_A, 0, 255))<<24) | (((color32)TClamp(_R, 0, 255))<<16) | (((color32)TClamp(_G, 0, 255))<<8) | ((color32)TClamp(_B, 0, 255)); -} - -inline color32 Color32FromARGBf(float _A, float _R, float _G, float _B) -{ - return (((color32)TClamp(_A*256.0f, 0.0f, 255.0f))<<24) | (((color32)TClamp(_R*256.0f, 0.0f, 255.0f))<<16) | (((color32)TClamp(_G*256.0f, 0.0f, 255.0f))<<8) | ((color32)TClamp(_B*256.0f, 0.0f, 255.0f)); -} - -inline void Color32ToARGBi(color32 _Color, int *_A, int *_R, int *_G, int *_B) -{ - if(_A) *_A = (_Color>>24)&0xff; - if(_R) *_R = (_Color>>16)&0xff; - if(_G) *_G = (_Color>>8)&0xff; - if(_B) *_B = _Color&0xff; -} - -inline void Color32ToARGBf(color32 _Color, float *_A, float *_R, float *_G, float *_B) -{ - if(_A) *_A = (1.0f/255.0f)*float((_Color>>24)&0xff); - if(_R) *_R = (1.0f/255.0f)*float((_Color>>16)&0xff); - if(_G) *_G = (1.0f/255.0f)*float((_Color>>8)&0xff); - if(_B) *_B = (1.0f/255.0f)*float(_Color&0xff); -} - -void ColorRGBToHLSf(float _R, float _G, float _B, float *_Hue, float *_Light, float *_Saturation); - -void ColorRGBToHLSi(int _R, int _G, int _B, int *_Hue, int *_Light, int *_Saturation); - -void ColorHLSToRGBf(float _Hue, float _Light, float _Saturation, float *_R, float *_G, float *_B); - -void ColorHLSToRGBi(int _Hue, int _Light, int _Saturation, int *_R, int *_G, int *_B); - -color32 ColorBlend(color32 _Color1, color32 _Color2, float _S); - - -// --------------------------------------------------------------------------- - - -#endif // !defined ANT_TW_COLORS_INCLUDED diff --git a/extern/AntTweakBar/src/TwEventGLFW.c b/extern/AntTweakBar/src/TwEventGLFW.c deleted file mode 100644 index 28e667b8..00000000 --- a/extern/AntTweakBar/src/TwEventGLFW.c +++ /dev/null @@ -1,212 +0,0 @@ -// --------------------------------------------------------------------------- -// -// @file TwEventGLFW.c -// @brief Helper: -// translate and re-send mouse and keyboard events -// from GLFW event callbacks to AntTweakBar -// -// @author Philippe Decaudin -// @license This file is part of the AntTweakBar library. -// For conditions of distribution and use, see License.txt -// -// --------------------------------------------------------------------------- - -// #include -#include "MiniGLFW.h" // a subset of GLFW.h needed to compile TwEventGLFW.c -// note: AntTweakBar.dll does not need to link with GLFW, -// it just needs some definitions for its helper functions. - -#include - - -int TW_CALL TwEventMouseButtonGLFW(int glfwButton, int glfwAction) -{ - int handled = 0; - TwMouseAction action = (glfwAction==GLFW_PRESS) ? TW_MOUSE_PRESSED : TW_MOUSE_RELEASED; - - if( glfwButton==GLFW_MOUSE_BUTTON_LEFT ) - handled = TwMouseButton(action, TW_MOUSE_LEFT); - else if( glfwButton==GLFW_MOUSE_BUTTON_RIGHT ) - handled = TwMouseButton(action, TW_MOUSE_RIGHT); - else if( glfwButton==GLFW_MOUSE_BUTTON_MIDDLE ) - handled = TwMouseButton(action, TW_MOUSE_MIDDLE); - - return handled; -} - - -int g_KMod = 0; - - -int TW_CALL TwEventKeyGLFW(int glfwKey, int glfwAction) -{ - int handled = 0; - - // Register of modifiers state - if( glfwAction==GLFW_PRESS ) - { - switch( glfwKey ) - { - case GLFW_KEY_LSHIFT: - case GLFW_KEY_RSHIFT: - g_KMod |= TW_KMOD_SHIFT; - break; - case GLFW_KEY_LCTRL: - case GLFW_KEY_RCTRL: - g_KMod |= TW_KMOD_CTRL; - break; - case GLFW_KEY_LALT: - case GLFW_KEY_RALT: - g_KMod |= TW_KMOD_ALT; - break; - } - } - else - { - switch( glfwKey ) - { - case GLFW_KEY_LSHIFT: - case GLFW_KEY_RSHIFT: - g_KMod &= ~TW_KMOD_SHIFT; - break; - case GLFW_KEY_LCTRL: - case GLFW_KEY_RCTRL: - g_KMod &= ~TW_KMOD_CTRL; - break; - case GLFW_KEY_LALT: - case GLFW_KEY_RALT: - g_KMod &= ~TW_KMOD_ALT; - break; - } - } - - // Process key pressed - if( glfwAction==GLFW_PRESS ) - { - int mod = g_KMod; - int testkp = ((mod&TW_KMOD_CTRL) || (mod&TW_KMOD_ALT)) ? 1 : 0; - - if( (mod&TW_KMOD_CTRL) && glfwKey>0 && glfwKey=GLFW_KEY_SPECIAL ) - { - int k = 0; - - if( glfwKey>=GLFW_KEY_F1 && glfwKey<=GLFW_KEY_F15 ) - k = TW_KEY_F1 + (glfwKey-GLFW_KEY_F1); - else if( testkp && glfwKey>=GLFW_KEY_KP_0 && glfwKey<=GLFW_KEY_KP_9 ) - k = '0' + (glfwKey-GLFW_KEY_KP_0); - else - { - switch( glfwKey ) - { - case GLFW_KEY_ESC: - k = TW_KEY_ESCAPE; - break; - case GLFW_KEY_UP: - k = TW_KEY_UP; - break; - case GLFW_KEY_DOWN: - k = TW_KEY_DOWN; - break; - case GLFW_KEY_LEFT: - k = TW_KEY_LEFT; - break; - case GLFW_KEY_RIGHT: - k = TW_KEY_RIGHT; - break; - case GLFW_KEY_TAB: - k = TW_KEY_TAB; - break; - case GLFW_KEY_ENTER: - k = TW_KEY_RETURN; - break; - case GLFW_KEY_BACKSPACE: - k = TW_KEY_BACKSPACE; - break; - case GLFW_KEY_INSERT: - k = TW_KEY_INSERT; - break; - case GLFW_KEY_DEL: - k = TW_KEY_DELETE; - break; - case GLFW_KEY_PAGEUP: - k = TW_KEY_PAGE_UP; - break; - case GLFW_KEY_PAGEDOWN: - k = TW_KEY_PAGE_DOWN; - break; - case GLFW_KEY_HOME: - k = TW_KEY_HOME; - break; - case GLFW_KEY_END: - k = TW_KEY_END; - break; - case GLFW_KEY_KP_ENTER: - k = TW_KEY_RETURN; - break; - case GLFW_KEY_KP_DIVIDE: - if( testkp ) - k = '/'; - break; - case GLFW_KEY_KP_MULTIPLY: - if( testkp ) - k = '*'; - break; - case GLFW_KEY_KP_SUBTRACT: - if( testkp ) - k = '-'; - break; - case GLFW_KEY_KP_ADD: - if( testkp ) - k = '+'; - break; - case GLFW_KEY_KP_DECIMAL: - if( testkp ) - k = '.'; - break; - case GLFW_KEY_KP_EQUAL: - if( testkp ) - k = '='; - break; - } - } - - if( k>0 ) - handled = TwKeyPressed(k, mod); - } - } - - return handled; -} - - -int TW_CALL TwEventCharGLFW(int glfwChar, int glfwAction) -{ - if( glfwAction==GLFW_PRESS && (glfwChar & 0xff00)==0 ) - return TwKeyPressed(glfwChar, g_KMod); - - return 0; -} - -// functions with __cdecl calling convension -TW_API int TW_CDECL_CALL TwEventMouseButtonGLFWcdecl(int glfwButton, int glfwAction) -{ - return TwEventMouseButtonGLFW(glfwButton, glfwAction); -} -TW_API int TW_CDECL_CALL TwEventKeyGLFWcdecl(int glfwKey, int glfwAction) -{ - return TwEventKeyGLFW(glfwKey, glfwAction); -} -TW_API int TW_CDECL_CALL TwEventCharGLFWcdecl(int glfwChar, int glfwAction) -{ - return TwEventCharGLFW(glfwChar, glfwAction); -} -TW_API int TW_CDECL_CALL TwEventMousePosGLFWcdecl(int mouseX, int mouseY) -{ - return TwMouseMotion(mouseX, mouseY); -} -TW_API int TW_CDECL_CALL TwEventMouseWheelGLFWcdecl(int wheelPos) -{ - return TwMouseWheel(wheelPos); -} diff --git a/extern/AntTweakBar/src/TwEventGLUT.c b/extern/AntTweakBar/src/TwEventGLUT.c deleted file mode 100644 index ba03c9f5..00000000 --- a/extern/AntTweakBar/src/TwEventGLUT.c +++ /dev/null @@ -1,150 +0,0 @@ -// --------------------------------------------------------------------------- -// -// @file TwEventGLUT.c -// @brief Helper: -// translate and re-send mouse and keyboard events -// from GLUT event callbacks to AntTweakBar -// -// @author Philippe Decaudin -// @date 2006/05/10 -// @license This file is part of the AntTweakBar library. -// For conditions of distribution and use, see License.txt -// -// --------------------------------------------------------------------------- - - -#define GLUT_NO_LIB_PRAGMA // we do not want to force linkage with glut -#ifdef _MSC_VER -# pragma warning(disable: 4505) // glut generates 'unreferenced function' warnings -# pragma warning(disable: 4100) // unreferenced parameter -#endif // _MSC_VER - -// #include -#include "MiniGLUT.h" // a subset of glut.h needed to compile TwEventGLUT.c -// note: AntTweakBar.dll does not need to link with GLUT, -// it just needs some definitions for its helper functions. - -#include - - -int TW_GLUT_CALL TwEventMouseButtonGLUT(int glutButton, int glutState, int mouseX, int mouseY) -{ - TwMouseAction action = (glutState==GLUT_DOWN) ? TW_MOUSE_PRESSED : TW_MOUSE_RELEASED; - - TwMouseMotion(mouseX, mouseY); - switch( glutButton ) - { - case GLUT_LEFT_BUTTON: - return TwMouseButton(action, TW_MOUSE_LEFT); - case GLUT_RIGHT_BUTTON: - return TwMouseButton(action, TW_MOUSE_RIGHT); - case GLUT_MIDDLE_BUTTON: - return TwMouseButton(action, TW_MOUSE_MIDDLE); - default: - return 0; - } -} - -int TW_GLUT_CALL TwEventMouseMotionGLUT(int mouseX, int mouseY) -{ - return TwMouseMotion(mouseX, mouseY); -} - - -// GLUT does not send modifiers state to 'Key' and 'Special' callbacks, -// and we cannot call glutGetModifiers here because we do not want to link -// AntTweakBar with glut, so the following function is used to store -// a pointer to the glutGetModifiers function of the calling application. -// It must be called at initialisation of the application. - -int (TW_CALL *g_GLUTGetModifiers)(void) = NULL; - -int TW_CALL TwGLUTModifiersFunc(int (TW_CALL *glutGetModifiersFunc)(void)) -{ - g_GLUTGetModifiers = glutGetModifiersFunc; - return (g_GLUTGetModifiers==NULL) ? 0 : 1; -} - - -int TW_GLUT_CALL TwEventKeyboardGLUT(unsigned char glutKey, int mouseX, int mouseY) -{ - int kmod = 0; - - if( g_GLUTGetModifiers!=NULL ) - { - int glutMod = g_GLUTGetModifiers(); - - if( glutMod&GLUT_ACTIVE_SHIFT ) - kmod |= TW_KMOD_SHIFT; - if( glutMod&GLUT_ACTIVE_CTRL ) - kmod |= TW_KMOD_CTRL; - if( glutMod&GLUT_ACTIVE_ALT ) - kmod |= TW_KMOD_ALT; - } - - if( (kmod&TW_KMOD_CTRL) && (glutKey>0 && glutKey<27) ) // CTRL special case - glutKey += 'a'-1; - - return TwKeyPressed((int)glutKey, kmod); -} - - -int TW_GLUT_CALL TwEventSpecialGLUT(int glutKey, int mouseX, int mouseY) -{ - int k = 0, kmod = 0; - - if( g_GLUTGetModifiers!=NULL ) - { - int glutMod = g_GLUTGetModifiers(); - - if( glutMod&GLUT_ACTIVE_SHIFT ) - kmod |= TW_KMOD_SHIFT; - if( glutMod&GLUT_ACTIVE_CTRL ) - kmod |= TW_KMOD_CTRL; - if( glutMod&GLUT_ACTIVE_ALT ) - kmod |= TW_KMOD_ALT; - } - - if( glutKey>=GLUT_KEY_F1 && glutKey<=GLUT_KEY_F12 ) - k = TW_KEY_F1 + (glutKey-GLUT_KEY_F1); - else - { - switch( glutKey ) - { - case GLUT_KEY_LEFT: - k = TW_KEY_LEFT; - break; - case GLUT_KEY_UP: - k = TW_KEY_UP; - break; - case GLUT_KEY_RIGHT: - k = TW_KEY_RIGHT; - break; - case GLUT_KEY_DOWN: - k = TW_KEY_DOWN; - break; - case GLUT_KEY_PAGE_UP: - k = TW_KEY_PAGE_UP; - break; - case GLUT_KEY_PAGE_DOWN: - k = TW_KEY_PAGE_DOWN; - break; - case GLUT_KEY_HOME: - k = TW_KEY_HOME; - break; - case GLUT_KEY_END: - k = TW_KEY_END; - break; - case GLUT_KEY_INSERT: - k = TW_KEY_INSERT; - break; - } - } - - if( k>0 && k - -int TW_CALL TwEventSDL12(const void *sdlEvent); // implemented in TwEventSDL12.c -int TW_CALL TwEventSDL13(const void *sdlEvent); // implmeneted in TwEventSDL13.c -#ifdef __cplusplus - extern "C" { int TW_CALL TwSetLastError(const char *staticErrorMessage); } -#else - int TW_CALL TwSetLastError(const char *staticErrorMessage); -#endif // __cplusplus - - -// TwEventSDL returns zero if msg has not been handled or the SDL version -// is not supported, and a non-zero value if it has been handled by the -// AntTweakBar library. -int TW_CALL TwEventSDL(const void *sdlEvent, unsigned char majorVersion, unsigned char minorVersion) -{ - if (majorVersion < 1 || (majorVersion == 1 && minorVersion < 2)) - { - static const char *g_ErrBadSDLVersion = "Unsupported SDL version"; - TwSetLastError(g_ErrBadSDLVersion); - return 0; - } - else if (majorVersion == 1 && minorVersion == 2) - return TwEventSDL12(sdlEvent); - else // if( majorVersion==1 && minorVersion==3 ) - return TwEventSDL13(sdlEvent); // will probably not work for version > 1.3, but give it a chance -} diff --git a/extern/AntTweakBar/src/TwEventSDL12.c b/extern/AntTweakBar/src/TwEventSDL12.c deleted file mode 100644 index 613c4bab..00000000 --- a/extern/AntTweakBar/src/TwEventSDL12.c +++ /dev/null @@ -1,71 +0,0 @@ -// --------------------------------------------------------------------------- -// -// @file TwEventSDL12.c -// @brief Helper: -// translate and re-send mouse and keyboard events -// from SDL 1.2 event loop to AntTweakBar -// -// @author Philippe Decaudin -// @date 2006/05/10 -// @license This file is part of the AntTweakBar library. -// For conditions of distribution and use, see License.txt -// -// --------------------------------------------------------------------------- - - -#include "MiniSDL12.h" // a subset of SDL.h needed to compile TwEventSDL12.c -// note: AntTweakBar.dll does not need to link with SDL, -// it just needs some definitions for its helper functions. - -#include - - -// TwEventSDL12 returns zero if msg has not been handled, -// and a non-zero value if it has been handled by the AntTweakBar library. -int TW_CALL TwEventSDL12(const void *sdlEvent) -{ - int handled = 0; - const SDL_Event *event = (const SDL_Event *)sdlEvent; - - if( event==NULL ) - return 0; - - switch( event->type ) - { - case SDL_KEYDOWN: - if( event->key.keysym.unicode!=0 && (event->key.keysym.unicode & 0xFF00)==0 ) - { - if( (event->key.keysym.unicode & 0xFF)<32 && (event->key.keysym.unicode & 0xFF)!=event->key.keysym.sym ) - handled = TwKeyPressed((event->key.keysym.unicode & 0xFF)+'a'-1, event->key.keysym.mod); - else - handled = TwKeyPressed(event->key.keysym.unicode & 0xFF, event->key.keysym.mod); - } - else - handled = TwKeyPressed(event->key.keysym.sym, event->key.keysym.mod); - break; - case SDL_MOUSEMOTION: - handled = TwMouseMotion(event->motion.x, event->motion.y); - break; - case SDL_MOUSEBUTTONUP: - case SDL_MOUSEBUTTONDOWN: - if( event->type==SDL_MOUSEBUTTONDOWN && (event->button.button==4 || event->button.button==5) ) // mouse wheel - { - static int s_WheelPos = 0; - if( event->button.button==4 ) - ++s_WheelPos; - else - --s_WheelPos; - handled = TwMouseWheel(s_WheelPos); - } - else - handled = TwMouseButton((event->type==SDL_MOUSEBUTTONUP)?TW_MOUSE_RELEASED:TW_MOUSE_PRESSED, (TwMouseButtonID)event->button.button); - break; - case SDL_VIDEORESIZE: - // tell the new size to TweakBar - TwWindowSize(event->resize.w, event->resize.h); - // do not set 'handled', SDL_VIDEORESIZE may be also processed by the calling application - break; - } - - return handled; -} diff --git a/extern/AntTweakBar/src/TwEventSDL13.c b/extern/AntTweakBar/src/TwEventSDL13.c deleted file mode 100644 index 22ef8b5b..00000000 --- a/extern/AntTweakBar/src/TwEventSDL13.c +++ /dev/null @@ -1,129 +0,0 @@ -// --------------------------------------------------------------------------- -// -// @file TwEventSDL13.c -// @brief Helper: -// translate and re-send mouse and keyboard events -// from SDL 1.3 event loop to AntTweakBar -// -// @author Philippe Decaudin -// @license This file is part of the AntTweakBar library. -// For conditions of distribution and use, see License.txt -// -// --------------------------------------------------------------------------- - - -#include "MiniSDL13.h" // a subset of SDL.h needed to compile TwEventSDL.c -// note: AntTweakBar.dll does not need to link with SDL, -// it just needs some definitions for its helper functions. - -#include - - -// The way SDL handles keyboard events has changed between version 1.2 -// and 1.3. It is now more difficult to translate SDL keyboard events to -// AntTweakBar events. The following code is an attempt to do so, but -// it is rather complex and not always accurate (eg, CTRL+1 is not handled). -// If someone knows a better and more robust way to do the keyboard events -// translation, please let me know. - -// TwEventSDL returns zero if msg has not been handled, -// and a non-zero value if it has been handled by the AntTweakBar library. -int TW_CALL TwEventSDL13(const void *sdlEvent) -{ - int handled = 0; - static int s_KeyMod = 0; - const SDL_Event *event = (const SDL_Event *)sdlEvent; - - if( event==NULL ) - return 0; - - switch( event->type ) - { - case SDL_TEXTINPUT: - if( event->text.text[0]!=0 && event->text.text[1]==0 ) - { - if( s_KeyMod & TW_KMOD_CTRL && event->text.text[0]<32 ) - handled = TwKeyPressed(event->text.text[0]+'a'-1, s_KeyMod); - else - { - if (s_KeyMod & KMOD_RALT) - s_KeyMod &= ~KMOD_CTRL; - handled = TwKeyPressed(event->text.text[0], s_KeyMod); - } - } - s_KeyMod = 0; - break; - case SDL_KEYDOWN: - if( event->key.keysym.sym & SDLK_SCANCODE_MASK ) - { - int key = 0; - switch( event->key.keysym.sym ) - { - case SDLK_UP: - key = TW_KEY_UP; - break; - case SDLK_DOWN: - key = TW_KEY_DOWN; - break; - case SDLK_RIGHT: - key = TW_KEY_RIGHT; - break; - case SDLK_LEFT: - key = TW_KEY_LEFT; - break; - case SDLK_INSERT: - key = TW_KEY_INSERT; - break; - case SDLK_HOME: - key = TW_KEY_HOME; - break; - case SDLK_END: - key = TW_KEY_END; - break; - case SDLK_PAGEUP: - key = TW_KEY_PAGE_UP; - break; - case SDLK_PAGEDOWN: - key = TW_KEY_PAGE_DOWN; - break; - default: - if( event->key.keysym.sym>=SDLK_F1 && event->key.keysym.sym<=SDLK_F12 ) - key = event->key.keysym.sym + TW_KEY_F1 - SDLK_F1; - } - if( key!=0 ) - handled = TwKeyPressed(key, event->key.keysym.mod); - } - else if( event->key.keysym.mod & TW_KMOD_ALT ) - handled = TwKeyPressed(event->key.keysym.sym & 0xFF, event->key.keysym.mod); - else - s_KeyMod = event->key.keysym.mod; - break; - case SDL_KEYUP: - s_KeyMod = 0; - break; - case SDL_MOUSEMOTION: - handled = TwMouseMotion(event->motion.x, event->motion.y); - break; - case SDL_MOUSEBUTTONUP: - case SDL_MOUSEBUTTONDOWN: - if( event->type==SDL_MOUSEBUTTONDOWN && (event->button.button==4 || event->button.button==5) ) // mouse wheel - { - static int s_WheelPos = 0; - if( event->button.button==4 ) - ++s_WheelPos; - else - --s_WheelPos; - handled = TwMouseWheel(s_WheelPos); - } - else - handled = TwMouseButton((event->type==SDL_MOUSEBUTTONUP)?TW_MOUSE_RELEASED:TW_MOUSE_PRESSED, (TwMouseButtonID)event->button.button); - break; - case SDL_VIDEORESIZE: - // tell the new size to TweakBar - TwWindowSize(event->resize.w, event->resize.h); - // do not set 'handled', SDL_VIDEORESIZE may be also processed by the calling application - break; - } - - return handled; -} diff --git a/extern/AntTweakBar/src/TwEventSFML.cpp b/extern/AntTweakBar/src/TwEventSFML.cpp deleted file mode 100644 index 2d7668ff..00000000 --- a/extern/AntTweakBar/src/TwEventSFML.cpp +++ /dev/null @@ -1,173 +0,0 @@ -// --------------------------------------------------------------------------- -// -// @file TwEventSFML.cpp -// @brief Helper: -// translate and re-send mouse and keyboard events -// from SFML 1.6 event loop to AntTweakBar -// -// @author Philippe Decaudin -// @license This file is part of the AntTweakBar library. -// For conditions of distribution and use, see License.txt -// -// --------------------------------------------------------------------------- - - -#include "MiniSFML16.h" // a subset of SFML 1.6 headers needed to compile TwEventSFML.cpp -// note: AntTweakBar.dll does not need to link with SFML, -// it just needs some definitions for its helper functions. - -#include - - -// TwEventSFML returns zero if msg has not been handled, -// and a non-zero value if it has been handled by the AntTweakBar library. -int TW_CALL TwEventSFML(const void *sfmlEvent, unsigned char majorVersion, unsigned char minorVersion) -{ - // Assume version 1.6 (will possibly not work for version != 1.6, but give it a chance) - /* - if (majorVersion > 1 || (majorVersion == 1 && minorVersion > 6) - { - static const char *g_ErrBadSFMLVersion = "Unsupported SFML version"; - TwSetLastError(g_ErrBadSFMLVersion); - return 0; - } - */ - (void)majorVersion, (void)minorVersion; - - int handled = 0; - const sf::Event *event = (const sf::Event *)sfmlEvent; - TwMouseAction mouseAction; - int key = 0; - static int s_KMod = 0; - static bool s_PreventTextHandling = false; - static int s_WheelPos = 0; - - if (event == NULL) - return 0; - - switch (event->Type) - { - case sf::Event::KeyPressed: - s_PreventTextHandling = false; - s_KMod = 0; - if (event->Key.Shift) s_KMod |= TW_KMOD_SHIFT; - if (event->Key.Alt) s_KMod |= TW_KMOD_ALT; - if (event->Key.Control) s_KMod |= TW_KMOD_CTRL; - key = 0; - switch (event->Key.Code) - { - case sf::Key::Escape: - key = TW_KEY_ESCAPE; - break; - case sf::Key::Return: - key = TW_KEY_RETURN; - break; - case sf::Key::Tab: - key = TW_KEY_TAB; - break; - case sf::Key::Back: - key = TW_KEY_BACKSPACE; - break; - case sf::Key::PageUp: - key = TW_KEY_PAGE_UP; - break; - case sf::Key::PageDown: - key = TW_KEY_PAGE_DOWN; - break; - case sf::Key::Up: - key = TW_KEY_UP; - break; - case sf::Key::Down: - key = TW_KEY_DOWN; - break; - case sf::Key::Left: - key = TW_KEY_LEFT; - break; - case sf::Key::Right: - key = TW_KEY_RIGHT; - break; - case sf::Key::End: - key = TW_KEY_END; - break; - case sf::Key::Home: - key = TW_KEY_HOME; - break; - case sf::Key::Insert: - key = TW_KEY_INSERT; - break; - case sf::Key::Delete: - key = TW_KEY_DELETE; - break; - case sf::Key::Space: - key = TW_KEY_SPACE; - break; - default: - if (event->Key.Code >= sf::Key::F1 && event->Key.Code <= sf::Key::F15) - key = TW_KEY_F1 + event->Key.Code - sf::Key::F1; - else if (s_KMod & TW_KMOD_ALT) - { - if (event->Key.Code >= sf::Key::A && event->Key.Code <= sf::Key::Z) - { - if (s_KMod & TW_KMOD_SHIFT) - key = 'A' + event->Key.Code - sf::Key::A; - else - key = 'a' + event->Key.Code - sf::Key::A; - } - } - } - if (key != 0) - { - handled = TwKeyPressed(key, s_KMod); - s_PreventTextHandling = true; - } - break; - case sf::Event::KeyReleased: - s_PreventTextHandling = false; - s_KMod = 0; - break; - case sf::Event::TextEntered: - if (!s_PreventTextHandling && event->Text.Unicode != 0 && (event->Text.Unicode & 0xFF00) == 0) - { - if ((event->Text.Unicode & 0xFF) < 32) // CTRL+letter - handled = TwKeyPressed((event->Text.Unicode & 0xFF)+'a'-1, TW_KMOD_CTRL|s_KMod); - else - handled = TwKeyPressed(event->Text.Unicode & 0xFF, 0); - } - s_PreventTextHandling = false; - break; - case sf::Event::MouseMoved: - handled = TwMouseMotion(event->MouseMove.X, event->MouseMove.Y); - break; - case sf::Event::MouseButtonPressed: - case sf::Event::MouseButtonReleased: - mouseAction = (event->Type==sf::Event::MouseButtonPressed) ? TW_MOUSE_PRESSED : TW_MOUSE_RELEASED; - switch (event->MouseButton.Button) - { - case sf::Mouse::Left: - handled = TwMouseButton(mouseAction, TW_MOUSE_LEFT); - break; - case sf::Mouse::Middle: - handled = TwMouseButton(mouseAction, TW_MOUSE_MIDDLE); - break; - case sf::Mouse::Right: - handled = TwMouseButton(mouseAction, TW_MOUSE_RIGHT); - break; - default: - break; - } - break; - case sf::Event::MouseWheelMoved: - s_WheelPos += event->MouseWheel.Delta; - handled = TwMouseWheel(s_WheelPos); - break; - case sf::Event::Resized: - // tell the new size to TweakBar - TwWindowSize(event->Size.Width, event->Size.Height); - // do not set 'handled', sf::Event::Resized may be also processed by the client application - break; - default: - break; - } - - return handled; -} diff --git a/extern/AntTweakBar/src/TwEventWin.c b/extern/AntTweakBar/src/TwEventWin.c deleted file mode 100644 index 32070d4e..00000000 --- a/extern/AntTweakBar/src/TwEventWin.c +++ /dev/null @@ -1,256 +0,0 @@ -// --------------------------------------------------------------------------- -// -// @file TwEventWin.c -// @brief Helper: -// translate and re-send mouse and keyboard events -// from Windows message proc to AntTweakBar -// -// @author Philippe Decaudin -// @date 2006/05/10 -// @license This file is part of the AntTweakBar library. -// For conditions of distribution and use, see License.txt -// -// --------------------------------------------------------------------------- - -#include - -#define WIN32_LEAN_AND_MEAN // Exclude rarely-used stuff from Windows headers -#include - -// Mouse wheel support -#if !defined WM_MOUSEWHEEL -# define WM_MOUSEWHEEL 0x020A -#endif // WM_MOUSEWHEEL -#if !defined WHEEL_DELTA -#define WHEEL_DELTA 120 -#endif // WHEEL_DELTA - -#ifdef _WIN64 -#define PARAM_INT __int64 -#else -#define PARAM_INT int -#endif - -// TwEventWin returns zero if msg has not been handled, -// and a non-zero value if it has been handled by the AntTweakBar library. -int TW_CALL TwEventWin(void *wnd, unsigned int msg, unsigned PARAM_INT _W64 wParam, PARAM_INT _W64 lParam) -{ - int handled = 0; - static unsigned PARAM_INT s_PrevKeyDown = 0; - static PARAM_INT s_PrevKeyDownMod = 0; - static int s_PrevKeyDownHandled = 0; - - switch( msg ) - { - case WM_MOUSEMOVE: - // send signed! mouse coordinates - handled = TwMouseMotion((short)LOWORD(lParam), (short)HIWORD(lParam)); - break; - case WM_LBUTTONDOWN: - case WM_LBUTTONDBLCLK: - SetCapture(wnd); - handled = TwMouseButton(TW_MOUSE_PRESSED, TW_MOUSE_LEFT); - break; - case WM_LBUTTONUP: - ReleaseCapture(); - handled = TwMouseButton(TW_MOUSE_RELEASED, TW_MOUSE_LEFT); - break; - case WM_MBUTTONDOWN: - case WM_MBUTTONDBLCLK: - SetCapture(wnd); - handled = TwMouseButton(TW_MOUSE_PRESSED, TW_MOUSE_MIDDLE); - break; - case WM_MBUTTONUP: - ReleaseCapture(); - handled = TwMouseButton(TW_MOUSE_RELEASED, TW_MOUSE_MIDDLE); - break; - case WM_RBUTTONDOWN: - case WM_RBUTTONDBLCLK: - SetCapture(wnd); - handled = TwMouseButton(TW_MOUSE_PRESSED, TW_MOUSE_RIGHT); - break; - case WM_RBUTTONUP: - ReleaseCapture(); - handled = TwMouseButton(TW_MOUSE_RELEASED, TW_MOUSE_RIGHT); - break; - case WM_CHAR: - case WM_SYSCHAR: - { - int key = (int)(wParam&0xff); - int kmod = 0; - - if( GetAsyncKeyState(VK_SHIFT)<0 ) - kmod |= TW_KMOD_SHIFT; - if( GetAsyncKeyState(VK_CONTROL)<0 ) - { - kmod |= TW_KMOD_CTRL; - if( key>0 && key<27 ) - key += 'a'-1; - } - if( GetAsyncKeyState(VK_MENU)<0 ) - kmod |= TW_KMOD_ALT; - if( key>0 && key<256 ) - handled = TwKeyPressed(key, kmod); - } - break; - case WM_KEYDOWN: - case WM_SYSKEYDOWN: - { - int kmod = 0; - int testkp = 0; - int k = 0; - - if( GetAsyncKeyState(VK_SHIFT)<0 ) - kmod |= TW_KMOD_SHIFT; - if( GetAsyncKeyState(VK_CONTROL)<0 ) - { - kmod |= TW_KMOD_CTRL; - testkp = 1; - } - if( GetAsyncKeyState(VK_MENU)<0 ) - { - kmod |= TW_KMOD_ALT; - testkp = 1; - } - if( wParam>=VK_F1 && wParam<=VK_F15 ) - k = TW_KEY_F1 + ((int)wParam-VK_F1); - else if( testkp && wParam>=VK_NUMPAD0 && wParam<=VK_NUMPAD9 ) - k = '0' + ((int)wParam-VK_NUMPAD0); - else - { - switch( wParam ) - { - case VK_UP: - k = TW_KEY_UP; - break; - case VK_DOWN: - k = TW_KEY_DOWN; - break; - case VK_LEFT: - k = TW_KEY_LEFT; - break; - case VK_RIGHT: - k = TW_KEY_RIGHT; - break; - case VK_INSERT: - k = TW_KEY_INSERT; - break; - case VK_DELETE: - k = TW_KEY_DELETE; - break; - case VK_PRIOR: - k = TW_KEY_PAGE_UP; - break; - case VK_NEXT: - k = TW_KEY_PAGE_DOWN; - break; - case VK_HOME: - k = TW_KEY_HOME; - break; - case VK_END: - k = TW_KEY_END; - break; - case VK_DIVIDE: - if( testkp ) - k = '/'; - break; - case VK_MULTIPLY: - if( testkp ) - k = '*'; - break; - case VK_SUBTRACT: - if( testkp ) - k = '-'; - break; - case VK_ADD: - if( testkp ) - k = '+'; - break; - case VK_DECIMAL: - if( testkp ) - k = '.'; - break; - default: - if( (kmod&TW_KMOD_CTRL) && (kmod&TW_KMOD_ALT) ) - k = MapVirtualKey( (UINT)wParam, 2 ) & 0x0000FFFF; - } - } - if( k!=0 ) - handled = TwKeyPressed(k, kmod); - else - { - // if the key will be handled at next WM_CHAR report this event as handled - int key = (int)(wParam&0xff); - if( kmod&TW_KMOD_CTRL && key>0 && key<27 ) - key += 'a'-1; - if( key>0 && key<256 ) - handled = TwKeyTest(key, kmod); - } - s_PrevKeyDown = wParam; - s_PrevKeyDownMod = kmod; - s_PrevKeyDownHandled = handled; - } - break; - case WM_KEYUP: - case WM_SYSKEYUP: - { - int kmod = 0; - if( GetAsyncKeyState(VK_SHIFT)<0 ) - kmod |= TW_KMOD_SHIFT; - if( GetAsyncKeyState(VK_CONTROL)<0 ) - kmod |= TW_KMOD_CTRL; - if( GetAsyncKeyState(VK_MENU)<0 ) - kmod |= TW_KMOD_ALT; - // if the key has been handled at previous WM_KEYDOWN report this event as handled - if( s_PrevKeyDown==wParam && s_PrevKeyDownMod==kmod ) - handled = s_PrevKeyDownHandled; - else - { - // if the key would have been handled report this event as handled - int key = (int)(wParam&0xff); - if( kmod&TW_KMOD_CTRL && key>0 && key<27 ) - key += 'a'-1; - if( key>0 && key<256 ) - handled = TwKeyTest(key, kmod); - } - // reset previous keydown - s_PrevKeyDown = 0; - s_PrevKeyDownMod = 0; - s_PrevKeyDownHandled = 0; - } - break; - case WM_MOUSEWHEEL: - { - static int s_WheelPos = 0; - s_WheelPos += ((short)HIWORD(wParam))/WHEEL_DELTA; - handled = TwMouseWheel(s_WheelPos); - } - break; - case WM_SIZE: - // tell the new size to AntTweakBar - TwWindowSize(LOWORD(lParam), HIWORD(lParam)); - // do not set 'handled', WM_SIZE may be also processed by the calling application - break; - } - - if( handled ) - // Event has been handled by AntTweakBar, so we invalidate the window - // content to send a WM_PAINT which will redraw the tweak bar(s). - InvalidateRect(wnd, NULL, FALSE); - - return handled; -} - - -// For compatibility with AntTweakBar versions prior to 1.11 -#undef TwEventWin32 -#ifdef __cplusplus -extern "C" { -#endif // __cplusplus -TW_EXPORT_API int TW_CALL TwEventWin32(void *wnd, unsigned int msg, unsigned int _W64 wParam, int _W64 lParam) -{ - return TwEventWin(wnd, msg, wParam, lParam); -} -#ifdef __cplusplus -} -#endif // __cplusplus diff --git a/extern/AntTweakBar/src/TwEventX11.c b/extern/AntTweakBar/src/TwEventX11.c deleted file mode 100644 index 4bbbf9b8..00000000 --- a/extern/AntTweakBar/src/TwEventX11.c +++ /dev/null @@ -1,207 +0,0 @@ -// --------------------------------------------------------------------------- -// -// @file TwEventX11.c -// @brief Helper: -// translate and forward mouse and keyboard events -// from X11 to AntTweakBar -// -// @contrib Greg Popovitch -// @license This file is part of the AntTweakBar library. -// For conditions of distribution and use, see License.txt -// -// --------------------------------------------------------------------------- - -#include -#include -#include -#include - -static int s_KMod = 0; -const int buff_sz = 80; - -// ---------------------------------------------------------------------- -// ---------------------------------------------------------------------- -/* -static int _XKeyRelease(XEvent *event) -{ - KeySym keysym; - char buffer[buff_sz]; - - XLookupString((XKeyEvent *)event, buffer, buff_sz, &keysym, 0); - - switch (keysym) - { - case XK_Control_L: - case XK_Control_R: s_KMod &= ~TW_KMOD_CTRL; break; - - case XK_Shift_L: - case XK_Shift_R: s_KMod &= ~TW_KMOD_SHIFT; break; - - case XK_Alt_L: - case XK_Alt_R: s_KMod &= ~TW_KMOD_ALT; break; - } - return 0; -} -*/ - -// ---------------------------------------------------------------------- -// ---------------------------------------------------------------------- -static int _XKeyPress(XEvent *event) -{ - int modifiers = 0; // modifiers sent to AntTweakBar - int k = 0; // key sent to AntTweakBar - KeySym keysym; - char buffer[buff_sz]; - - int num_char = XLookupString((XKeyEvent *)event, buffer, buff_sz, &keysym, 0); - - if (event->xkey.state & ControlMask) - modifiers |= TW_KMOD_CTRL; - if (event->xkey.state & ShiftMask) - modifiers |= TW_KMOD_SHIFT; - if (event->xkey.state & Mod1Mask) - modifiers |= TW_KMOD_ALT; - - switch (keysym) - { - case XK_Control_L: - case XK_Control_R: s_KMod |= TW_KMOD_CTRL; break; - - case XK_Shift_L: - case XK_Shift_R: s_KMod |= TW_KMOD_SHIFT; break; - - case XK_Alt_L: - case XK_Alt_R: s_KMod |= TW_KMOD_ALT; break; - - case XK_Escape: k = TW_KEY_ESCAPE; break; - case XK_Help: k = TW_KEY_F1; break; - case XK_F1: k = TW_KEY_F1; break; - case XK_F2: k = TW_KEY_F2; break; - case XK_F3: k = TW_KEY_F3; break; - case XK_F4: k = TW_KEY_F4; break; - case XK_F5: k = TW_KEY_F5; break; - case XK_F6: k = TW_KEY_F6; break; - case XK_F7: k = TW_KEY_F7; break; - case XK_F8: k = TW_KEY_F8; break; - case XK_F9: k = TW_KEY_F9; break; - case XK_F10: k = TW_KEY_F10; break; - case XK_F11: k = TW_KEY_F11; break; - case XK_F12: k = TW_KEY_F12; break; - case XK_Up: k = TW_KEY_UP; break; - case XK_Down: k = TW_KEY_DOWN; break; - case XK_Right: k = TW_KEY_RIGHT; break; - case XK_Left: k = TW_KEY_LEFT; break; - case XK_Return: k = TW_KEY_RETURN; break; - case XK_Insert: k = TW_KEY_INSERT; break; - case XK_Delete: k = TW_KEY_DELETE; break; - case XK_BackSpace: k = TW_KEY_BACKSPACE; break; - case XK_Home: k = TW_KEY_HOME; break; - case XK_Tab: k = TW_KEY_TAB; break; - case XK_End: k = TW_KEY_END; break; - -#ifdef XK_Enter - case XK_Enter: k = TW_KEY_RETURN; break; -#endif - -#ifdef XK_KP_Home - case XK_KP_Home: k = TW_KEY_HOME; break; - case XK_KP_End: k = TW_KEY_END; break; - case XK_KP_Delete: k = TW_KEY_DELETE; break; -#endif - -#ifdef XK_KP_Up - case XK_KP_Up: k = TW_KEY_UP; break; - case XK_KP_Down: k = TW_KEY_DOWN; break; - case XK_KP_Right: k = TW_KEY_RIGHT; break; - case XK_KP_Left: k = TW_KEY_LEFT; break; -#endif - -#ifdef XK_KP_Page_Up - case XK_KP_Page_Up: k = TW_KEY_PAGE_UP; break; - case XK_KP_Page_Down: k = TW_KEY_PAGE_DOWN; break; -#endif - -#ifdef XK_KP_Tab - case XK_KP_Tab: k = TW_KEY_TAB; break; -#endif - - default: - if (0) - { - // should we do that, or rely on the buffer (see code below) - if (keysym > 12 && keysym < 127) - k = keysym; - } - break; - } - - if (k == 0 && num_char) - { - int i, handled = 0; - for (i=0; i 0) ? TwKeyPressed(k, modifiers) : 0; -} - -// ---------------------------------------------------------------------- -// ---------------------------------------------------------------------- -static int _XButtonEvent(XEvent *event) -{ - TwMouseAction action = (event->type == ButtonPress) ? TW_MOUSE_PRESSED : TW_MOUSE_RELEASED; - XButtonEvent *xbe = (XButtonEvent *)event; - return TwMouseButton(action, xbe->button); -} - -// ---------------------------------------------------------------------- -// ---------------------------------------------------------------------- -static int _XConfigureEvent(XEvent *event) -{ - XConfigureEvent *xce = (XConfigureEvent *)event; - TwWindowSize(xce->width, xce->height); - return 0; -} - -// ---------------------------------------------------------------------- -// ---------------------------------------------------------------------- -static int _XMotionEvent(XEvent *event) -{ - XMotionEvent *xme = (XMotionEvent *)event; - return TwMouseMotion(xme->x, xme->y); -} - -// ---------------------------------------------------------------------- -// ---------------------------------------------------------------------- -TW_API int TW_CDECL_CALL TwEventX11(void *xevent) -{ - XEvent *event = (XEvent *)xevent; - - switch (event->type) - { - case KeyPress: - return _XKeyPress(xevent); - - case KeyRelease: - return 0; // _XKeyRelease(xevent); - - case ButtonPress: - case ButtonRelease: - return _XButtonEvent(xevent); - - case MotionNotify: - return _XMotionEvent(xevent); - - case ConfigureNotify: - return _XConfigureEvent(xevent); - - default: - break; - } - return 0; -} - diff --git a/extern/AntTweakBar/src/TwFonts.cpp b/extern/AntTweakBar/src/TwFonts.cpp deleted file mode 100644 index ec82cf89..00000000 --- a/extern/AntTweakBar/src/TwFonts.cpp +++ /dev/null @@ -1,4898 +0,0 @@ -// --------------------------------------------------------------------------- -// -// @file TwFonts.cpp -// @author Philippe Decaudin -// @license This file is part of the AntTweakBar library. -// For conditions of distribution and use, see License.txt -// -// --------------------------------------------------------------------------- - - -#include "TwPrecomp.h" -#include "TwMgr.h" -#include "TwFonts.h" - -// Fedora patch: memset() -using std::memset; - -// --------------------------------------------------------------------------- - -CTexFont::CTexFont() -{ - for( int i=0; i<256; ++i ) - { - m_CharU0[i] = 0; - m_CharU1[i] = 0; - m_CharV0[i] = 0; - m_CharV1[i] = 0; - m_CharWidth[i] = 0; - } - m_TexWidth = 0; - m_TexHeight = 0; - m_TexBytes = NULL; - m_NbCharRead = 0; - m_CharHeight = 0; -} - -// --------------------------------------------------------------------------- - -CTexFont::~CTexFont() -{ - if( m_TexBytes ) - delete[] m_TexBytes; - m_TexBytes = NULL; - m_TexWidth = 0; - m_TexHeight = 0; - m_NbCharRead = 0; -} - -// --------------------------------------------------------------------------- - -static int NextPow2(int _n) -{ - int r = 1; - while( r<_n ) - r *= 2; - return r; -} - -// --------------------------------------------------------------------------- - -const char *g_ErrBadFontHeight = "Cannot determine font height while reading font bitmap (check first pixel column)"; - -CTexFont *TwGenerateFont(const unsigned char *_Bitmap, int _BmWidth, int _BmHeight, float _Scaling) -{ - // find height of the font - int x, y; - int h = 0, hh = 0; - int r, NbRow = 0; - for( y=0; y<_BmHeight; ++y ) - if( _Bitmap[y*_BmWidth]==0 ) - { - if( (hh<=0 && h<=0) || (h!=hh && h>0 && hh>0) ) - { - g_TwMgr->SetLastError(g_ErrBadFontHeight); - return NULL; - } - else if( h<=0 ) - h = hh; - else if( hh<=0 ) - break; - hh = 0; - ++NbRow; - } - else - ++hh; - - // find width and position of each character - int w = 0; - int x0[224], y0[224], x1[224], y1[224]; - int ch = 32; - int start; - for( r=0; rlmax ) - lmax = l; - } - // A little empty margin is added between chars to avoid artefact when antialiasing is on - const int MARGIN_X = 2; - const int MARGIN_Y = 2; - lmax += 16*MARGIN_X; - // - Second, build the texture - CTexFont *TexFont = new CTexFont; - TexFont->m_NbCharRead = ch-32; - TexFont->m_CharHeight = (int)(_Scaling*h+0.5f); - TexFont->m_TexWidth = NextPow2(lmax); - TexFont->m_TexHeight = NextPow2(14*(h+MARGIN_Y)); - TexFont->m_TexBytes = new unsigned char[TexFont->m_TexWidth*TexFont->m_TexHeight]; - memset(TexFont->m_TexBytes, 0, TexFont->m_TexWidth*TexFont->m_TexHeight); - int xx; - float du = 0.4f; - float dv = 0.4f; - assert( g_TwMgr!=NULL ); - if( g_TwMgr ) - { - if( g_TwMgr->m_GraphAPI==TW_OPENGL || g_TwMgr->m_GraphAPI==TW_OPENGL_CORE ) - { - du = 0; - dv = 0; - } - else // texel alignement for D3D - { - du = 0.5f; - dv = 0.5f; - } - } - float alpha; - for( r=0; r<14; ++r ) - for( xx=0, ch=r*16; ch<(r+1)*16; ++ch ) - if( y1[ch]-y0[ch]==h-1 ) - { - for( y=0; ym_TexBytes[(xx+x-x0[ch])+(r*(h+MARGIN_Y)+y)*TexFont->m_TexWidth] = (unsigned char)(alpha*256.0f); - } - TexFont->m_CharU0[ch+32] = (float(xx)+du)/float(TexFont->m_TexWidth); - xx += x1[ch]-x0[ch]+1; - TexFont->m_CharU1[ch+32] = (float(xx)+du)/float(TexFont->m_TexWidth); - TexFont->m_CharV0[ch+32] = (float(r*(h+MARGIN_Y))+dv)/float(TexFont->m_TexHeight); - TexFont->m_CharV1[ch+32] = (float(r*(h+MARGIN_Y)+h)+dv)/float(TexFont->m_TexHeight); - TexFont->m_CharWidth[ch+32] = (int)(_Scaling*(x1[ch]-x0[ch]+1)+0.5f); - xx += MARGIN_X; - } - - const unsigned char Undef = 127; // default character used as for undifined ones (having ascii codes from 0 to 31) - for( ch=0; ch<32; ++ch ) - { - TexFont->m_CharU0[ch] = TexFont->m_CharU0[Undef]; - TexFont->m_CharU1[ch] = TexFont->m_CharU1[Undef]; - TexFont->m_CharV0[ch] = TexFont->m_CharV0[Undef]; - TexFont->m_CharV1[ch] = TexFont->m_CharV1[Undef]; - TexFont->m_CharWidth[ch] = TexFont->m_CharWidth[Undef]/2; - } - - return TexFont; -} - -// --------------------------------------------------------------------------- - -CTexFont *g_DefaultSmallFont = NULL; -CTexFont *g_DefaultNormalFont = NULL; -CTexFont *g_DefaultLargeFont = NULL; -CTexFont *g_DefaultFixed1Font = NULL; - -// Small font -const int FONT0_BM_W = 211; -const int FONT0_BM_H = 84; -static const unsigned char s_Font0[] = -{ - 127,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,127,0,0, - 0,0,0,0,255,0,255,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,255,0,0,0,255,255,0,0,0,0,0,255,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,255,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,127, - 0,0,0,0,255,0,255,0,255,0,0,0,255,0,0,255,0,0,0,255,0,0,0,0,255,255,0,0, - 0,255,0,0,0,0,255,255,0,0,0,255,0,0,255,0,0,255,0,0,255,0,255,0,255,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,255,0,0,255,255,0,0,0,255,0,0,255,255, - 255,0,0,255,255,255,0,0,0,0,0,255,0,255,255,255,255,0,0,255,255,0,0,255, - 255,255,255,0,0,255,255,0,0,0,255,255,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,255,255,255,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,127,0,0,0,0,255,0,255,0,255,0,0,0,255,0,0,255,0,0,255,255,255,255, - 0,255,0,0,255,0,255,0,0,0,0,255,0,0,255,0,0,255,0,255,0,0,0,0,255,0,0,255, - 255,255,0,0,0,0,0,255,0,0,0,0,0,0,0,0,0,0,0,0,0,255,0,0,255,0,0,255,0,255, - 255,0,0,0,0,0,255,0,0,0,0,255,0,0,0,255,255,0,255,0,0,0,0,255,0,0,0,0,0, - 0,0,255,0,255,0,0,255,0,255,0,0,255,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,255,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,127, - 0,0,0,0,255,0,0,0,0,0,0,255,255,255,255,255,255,255,0,255,0,0,0,255,0,0, - 255,0,255,0,0,0,0,255,0,0,255,0,0,0,0,255,0,0,0,0,255,0,255,0,255,0,255, - 0,0,0,0,255,0,0,0,0,0,0,0,0,0,0,0,0,0,255,0,0,255,0,0,255,0,0,255,0,0,0, - 0,0,255,0,0,0,0,255,0,0,255,0,255,0,255,0,0,0,0,255,0,0,0,0,0,0,255,0,0, - 255,0,0,255,0,255,0,0,255,0,0,255,0,0,255,0,0,0,0,0,255,255,0,0,0,0,0,0, - 0,0,0,255,255,0,0,0,0,0,0,0,255,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 127,0,0,0,0,255,0,0,0,0,0,0,0,255,0,255,0,0,0,255,255,0,0,0,0,255,255,0, - 255,0,255,255,0,0,0,255,255,0,255,0,0,0,255,0,0,0,0,255,0,0,0,255,0,0,0, - 0,255,255,255,255,255,0,0,0,0,0,0,0,0,0,0,0,255,0,0,255,0,0,255,0,0,255, - 0,0,0,0,255,0,0,0,255,255,0,0,255,0,0,255,0,255,255,255,0,0,255,255,255, - 0,0,0,0,255,0,0,0,255,255,0,0,0,255,255,255,0,0,255,0,0,255,0,0,0,255,255, - 0,0,0,255,255,255,255,255,255,0,0,0,0,255,255,0,0,0,0,255,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,127,0,0,0,0,255,0,0,0,0,0,255,255,255,255,255, - 255,0,0,0,255,255,0,0,0,0,0,255,0,255,0,0,255,0,255,0,0,255,0,0,0,0,255, - 0,0,0,0,255,0,0,0,0,0,0,0,0,0,0,255,0,0,0,0,0,0,255,255,0,0,0,0,0,255,0, - 0,255,0,0,255,0,0,255,0,0,0,255,0,0,0,0,0,0,255,0,255,255,255,255,255,0, - 0,0,255,0,255,0,0,255,0,0,255,0,0,0,255,0,0,255,0,0,0,0,255,0,0,0,0,0,0, - 0,0,255,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,255,0,0,255,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,127,0,0,0,0,0,0,0,0,0,0,0,255,0,0,255,0,0,0,0, - 255,0,255,0,0,0,0,255,0,255,0,0,255,0,255,0,0,255,255,0,0,0,255,0,0,0,0, - 255,0,0,0,0,0,0,0,0,0,0,255,0,0,0,0,255,0,0,0,0,0,255,0,0,255,0,0,255,0, - 0,255,0,0,255,0,0,255,0,0,0,0,0,0,0,255,0,0,0,0,255,0,0,0,0,255,0,255,0, - 0,255,0,0,255,0,0,0,255,0,0,255,0,0,0,0,255,0,0,255,0,0,255,0,0,0,255,255, - 0,0,0,255,255,255,255,255,255,0,0,0,0,255,255,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,127,0,0,0,0,255,0,0,0,0,0,0,255,0,0,255,0,0,255, - 255,255,255,0,0,0,0,255,0,0,0,255,255,0,0,0,255,255,0,0,255,0,0,255,0,0, - 0,0,255,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,255,0,0,0,0,0,255,0,255,0,0,0,0,255, - 255,0,0,255,255,255,0,255,255,255,255,0,255,255,255,0,0,0,0,0,255,0,255, - 255,255,0,0,0,255,255,0,0,255,0,0,0,0,0,255,255,0,0,0,255,255,0,0,0,255, - 0,0,255,0,0,0,0,0,255,255,0,0,0,0,0,0,0,0,0,255,255,0,0,0,0,0,255,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,127,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,255,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,255,0,0,255,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,255,0,0,0,0,0,0,0,0,255,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,255,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,127,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,255,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,255,255,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,127,127,127,0,127,0,127,127,127, - 0,127,127,127,127,127,127,0,127,127,127,127,127,0,127,127,127,127,127,127, - 127,127,127,0,127,127,127,127,127,0,127,0,127,127,0,127,127,127,0,127,127, - 127,127,127,0,127,127,127,127,127,127,0,127,127,0,127,127,127,0,127,0,127, - 127,127,0,127,127,127,127,0,127,127,127,0,127,127,127,127,0,127,127,127, - 127,0,127,127,127,127,0,127,127,127,127,0,127,127,127,127,0,127,127,127, - 127,0,127,127,127,127,0,127,127,127,127,0,127,127,0,127,127,0,127,127,127, - 127,127,127,0,127,127,127,127,127,127,0,127,127,127,127,127,127,0,127,127, - 127,127,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,127,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,127,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,255,255,0,255,0,0,0,255,255,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,127,0,0,255,255,255,0,0,0,0,0, - 255,255,0,0,0,255,255,255,0,0,0,0,0,255,255,255,0,0,255,255,255,255,0,0, - 0,255,255,255,255,255,0,255,255,255,255,255,0,0,0,255,255,255,0,0,255,0, - 0,0,0,255,0,255,255,255,0,0,255,255,0,255,0,0,0,255,0,255,0,0,0,255,255, - 0,0,0,255,255,0,255,0,0,0,0,255,0,0,0,255,255,255,0,0,0,255,255,255,255, - 0,0,0,0,255,255,255,0,0,0,255,255,255,255,0,0,0,255,255,255,255,0,255,255, - 255,255,255,0,255,0,0,0,0,255,0,255,0,0,0,0,255,0,255,0,0,255,0,0,255,0, - 255,0,0,255,0,255,0,0,0,255,0,255,255,255,255,0,255,0,0,255,0,0,0,0,255, - 0,0,0,255,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,127,0,255,0, - 0,0,255,0,0,0,0,255,255,0,0,0,255,0,0,255,0,0,0,255,0,0,0,255,0,255,0,0, - 0,255,0,0,255,0,0,0,0,0,255,0,0,0,0,0,0,255,0,0,0,255,0,255,0,0,0,0,255, - 0,0,255,0,0,0,0,255,0,255,0,0,255,0,0,255,0,0,0,255,255,0,0,0,255,255,0, - 255,255,0,0,0,255,0,0,255,0,0,0,255,0,0,255,0,0,0,255,0,0,255,0,0,0,255, - 0,0,255,0,0,0,255,0,255,0,0,0,0,0,0,0,255,0,0,0,255,0,0,0,0,255,0,255,0, - 0,0,0,255,0,255,0,0,255,0,0,255,0,255,0,0,255,0,0,255,0,255,0,0,0,0,0,255, - 0,255,0,0,0,255,0,0,0,255,0,0,255,0,255,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,127,255,0,0,255,255,0,255,0,0,255,0,0,255,0,0,255,0,0,255, - 0,0,255,0,0,0,0,0,0,255,0,0,0,0,255,0,255,0,0,0,0,0,255,0,0,0,0,0,255,0, - 0,0,0,0,0,255,0,0,0,0,255,0,0,255,0,0,0,0,255,0,255,0,255,0,0,0,255,0,0, - 0,255,0,255,0,255,0,255,0,255,0,255,0,0,255,0,255,0,0,0,0,0,255,0,255,0, - 0,0,255,0,255,0,0,0,0,0,255,0,255,0,0,0,255,0,255,0,0,0,0,0,0,0,255,0,0, - 0,255,0,0,0,0,255,0,255,0,0,0,0,255,0,255,0,255,0,255,0,255,0,0,255,255, - 0,0,0,255,0,255,0,0,0,0,255,0,0,255,0,0,0,255,0,0,0,255,0,255,0,0,0,255, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,127,255,0,255,0,255,0,255, - 0,0,255,0,0,255,0,0,255,255,255,255,0,0,255,0,0,0,0,0,0,255,0,0,0,0,255, - 0,255,255,255,255,0,0,255,255,255,255,0,0,255,0,0,255,255,255,0,255,255, - 255,255,255,255,0,0,255,0,0,0,0,255,0,255,255,0,0,0,0,255,0,0,0,255,0,255, - 0,255,0,255,0,255,0,0,255,0,255,0,255,0,0,0,0,0,255,0,255,0,0,0,255,0,255, - 0,0,0,0,0,255,0,255,255,255,255,0,0,0,255,255,255,0,0,0,0,255,0,0,0,255, - 0,0,0,0,255,0,0,255,0,0,255,0,0,255,0,255,0,255,0,255,0,0,255,255,0,0,0, - 0,255,0,0,0,0,255,0,0,0,255,0,0,0,255,0,0,0,255,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,127,255,0,255,0,255,0,255,0,255,255,255, - 255,255,255,0,255,0,0,0,255,0,255,0,0,0,0,0,0,255,0,0,0,0,255,0,255,0,0, - 0,0,0,255,0,0,0,0,0,255,0,0,0,0,255,0,255,0,0,0,0,255,0,0,255,0,0,0,0,255, - 0,255,0,255,0,0,0,255,0,0,0,255,0,0,255,0,0,255,0,255,0,0,0,255,255,0,255, - 0,0,0,0,0,255,0,255,255,255,255,0,0,255,0,0,0,0,0,255,0,255,0,255,0,0,0, - 0,0,0,0,255,0,0,0,255,0,0,0,255,0,0,0,0,255,0,0,255,0,0,255,0,0,255,0,255, - 0,255,0,255,0,0,255,255,0,0,0,0,255,0,0,0,0,255,0,0,0,255,0,0,0,255,0,0, - 0,255,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,127,255, - 0,0,255,255,255,0,0,255,0,0,0,0,255,0,255,0,0,0,255,0,0,255,0,0,0,255,0, - 255,0,0,0,255,0,0,255,0,0,0,0,0,255,0,0,0,0,0,0,255,0,0,0,255,0,255,0,0, - 0,0,255,0,0,255,0,0,0,0,255,0,255,0,0,255,0,0,255,0,0,0,255,0,0,255,0,0, - 255,0,255,0,0,0,0,255,0,0,255,0,0,0,255,0,0,255,0,0,0,0,0,0,255,0,0,0,255, - 0,0,255,0,0,255,0,0,0,0,0,0,255,0,0,0,255,0,0,0,255,0,0,0,0,255,0,0,0,255, - 255,0,0,0,0,255,0,0,0,255,0,0,255,0,0,255,0,0,0,255,0,0,0,255,0,0,0,0,255, - 0,0,0,255,0,0,0,255,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,127,0,255,0,0,0,0,0,0,255,0,0,0,0,255,0,255,255,255,255,0,0,0,0,255, - 255,255,0,0,255,255,255,255,0,0,0,255,255,255,255,255,0,255,0,0,0,0,0,0, - 0,255,255,255,255,0,255,0,0,0,0,255,0,255,255,255,0,255,255,0,0,255,0,0, - 0,255,0,255,255,255,255,255,0,0,0,0,0,255,0,255,0,0,0,0,255,0,0,0,255,255, - 255,0,0,0,255,0,0,0,0,0,0,0,255,255,255,0,0,0,255,0,0,0,255,0,255,255,255, - 255,0,0,0,0,255,0,0,0,0,255,255,255,255,0,0,0,0,255,255,0,0,0,0,255,0,0, - 0,255,0,0,255,0,0,255,0,0,0,255,0,0,0,255,255,255,255,0,255,0,0,0,0,255, - 0,0,255,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,127,0, - 0,255,255,255,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,255,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,255,0,0,0, - 0,255,0,0,255,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 127,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,255,255,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,255,255, - 0,0,0,0,0,255,255,0,0,0,0,0,0,0,255,255,255,255,255,255,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,127,127,127,127,127,127,127,0,127,127,127,127,127,127, - 0,127,127,127,127,127,0,127,127,127,127,127,127,0,127,127,127,127,127,127, - 0,127,127,127,127,127,0,127,127,127,127,127,0,127,127,127,127,127,127,0, - 127,127,127,127,127,127,0,127,127,127,0,127,127,127,0,127,127,127,127,127, - 0,127,127,127,0,127,127,127,127,127,127,127,0,127,127,127,127,127,127,0, - 127,127,127,127,127,127,127,0,127,127,127,127,127,0,127,127,127,127,127, - 127,127,0,127,127,127,127,127,0,127,127,127,127,127,0,127,127,127,127,127, - 0,127,127,127,127,127,127,0,127,127,127,127,127,127,0,127,127,127,127,127, - 127,127,0,127,127,127,127,0,127,127,127,127,127,0,127,127,127,127,0,127, - 127,0,127,127,127,0,127,127,0,127,127,127,127,127,0,127,127,127,127,127, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,127,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,127,255,0,0,0,0,0,0,0,0,255,0,0,0,0,0,0,0,0,0, - 0,0,255,0,0,0,0,0,0,0,255,255,0,0,0,0,0,255,0,0,0,0,0,0,0,0,0,255,0,0,0, - 0,255,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,255,0,0,255,0,0,255,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,127,0,255,0,0,0,0,0,0,0,255,0,0, - 0,0,0,0,0,0,0,0,0,255,0,0,0,0,0,0,255,0,0,0,0,0,0,0,255,0,0,0,0,255,0,0, - 255,0,255,0,0,0,0,255,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,255,0,0,0,255,0,0,0,255,0,0,0,0,0,0,0,0,0,0,4,4, - 4,4,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,127,0,0,0,0,0,0, - 0,0,0,255,0,0,0,0,0,0,0,0,0,0,0,255,0,0,0,0,0,0,255,0,0,0,0,0,0,0,255,0, - 0,0,0,0,0,0,0,0,255,0,0,0,0,255,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,255,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,255,0,0,0,255,0,0,0,255,0,0,0,0,0,0, - 0,0,0,0,4,4,4,4,12,0,255,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 127,0,0,0,0,0,255,255,0,0,255,255,255,0,0,0,255,255,0,0,255,255,255,0,0, - 255,255,0,0,255,255,255,0,255,255,255,0,255,255,255,0,0,255,0,255,255,0, - 255,0,0,255,0,255,0,255,255,255,0,255,255,0,0,255,255,255,0,0,0,255,255, - 0,0,255,255,255,0,0,0,255,255,255,0,255,0,255,255,255,255,0,255,255,0,255, - 0,0,255,0,255,0,0,0,255,0,255,0,0,255,0,0,255,0,255,0,255,0,255,0,0,0,255, - 0,255,255,255,0,0,255,0,0,0,255,0,0,0,255,0,0,0,0,0,0,0,0,0,0,4,4,4,4,0, - 255,255,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,127,0,0,0,0,0,0,0, - 255,0,255,0,0,255,0,255,0,0,0,255,0,0,255,0,255,0,0,255,0,255,0,0,255,0, - 0,255,0,255,0,0,255,0,255,0,0,255,0,255,0,255,0,0,255,0,255,0,0,255,0,0, - 255,0,255,0,0,255,0,255,0,0,255,0,255,0,0,255,0,255,0,0,255,0,255,255,0, - 255,0,0,0,255,0,0,255,0,0,255,0,0,255,0,255,0,0,255,0,0,255,0,0,255,0,0, - 255,0,0,0,255,0,255,0,0,0,0,255,0,0,255,0,0,0,255,0,0,0,255,0,0,0,255,255, - 0,0,255,0,0,255,4,4,0,255,255,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,127,0,0,0,0,0,255,255,255,0,255,0,0,255,0,255,0,0,0,255,0,0,255,0, - 255,255,255,255,0,255,0,0,255,0,0,255,0,255,0,0,255,0,255,0,0,255,0,255, - 255,0,0,0,255,0,255,0,0,255,0,0,255,0,255,0,0,255,0,255,0,0,255,0,255,0, - 0,255,0,255,0,0,255,0,255,0,0,0,255,0,0,255,0,0,255,0,0,255,0,0,255,0,255, - 0,0,255,0,255,0,255,0,255,0,0,255,0,0,0,255,0,255,0,0,0,255,0,0,255,0,0, - 0,0,255,0,0,0,0,255,0,255,0,0,255,255,0,0,0,255,255,4,255,255,0,4,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,127,0,0,0,0,255,0,0,255,0,255,0, - 0,255,0,255,0,0,0,255,0,0,255,0,255,0,0,0,0,255,0,0,255,0,0,255,0,255,0, - 0,255,0,255,0,0,255,0,255,0,255,0,0,255,0,255,0,0,255,0,0,255,0,255,0,0, - 255,0,255,0,0,255,0,255,0,0,255,0,255,0,0,255,0,255,0,0,0,0,255,0,255,0, - 0,255,0,0,255,0,0,255,0,255,0,0,0,255,255,0,255,255,0,0,0,255,0,0,0,255, - 0,255,0,0,255,0,0,0,0,255,0,0,0,255,0,0,0,255,0,0,0,0,0,0,0,0,0,0,0,255, - 255,255,0,4,4,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,127,0,0,0,0, - 0,255,255,255,0,255,255,255,0,0,0,255,255,0,0,255,255,255,0,0,255,255,255, - 0,255,0,0,0,255,255,255,0,255,0,0,255,0,255,0,0,255,0,255,0,0,255,0,255, - 0,255,0,0,255,0,0,255,0,255,0,0,255,0,0,255,255,0,0,255,255,255,0,0,0,255, - 255,255,0,255,0,0,255,255,255,0,0,255,0,0,255,255,255,0,0,0,255,0,0,0,0, - 255,0,0,0,255,0,0,255,0,255,0,0,0,255,0,0,0,255,255,255,0,0,255,0,0,0,255, - 0,0,0,255,0,0,0,0,0,0,0,0,0,0,20,0,255,0,4,4,4,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,127,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,255,0,0,0,0,0,0,0,0,0,255,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,255,0,0,0,0,0,0,0,255,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,255,0,0,0,0,0,0,0,0,255, - 0,0,0,255,0,0,0,255,0,0,0,0,0,0,0,0,0,0,4,0,0,0,4,4,4,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,127,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,255,255,0,0,0,0,0,0,0,0,0,255,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,255,0,0,0,0,0,0,0,255,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,255,0,0,0,0,0,0, - 0,0,0,0,255,0,0,255,0,0,255,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,127,127,127,0,127,127,127,127,0, - 127,127,127,127,0,127,127,127,0,127,127,127,127,0,127,127,127,127,0,127, - 127,0,127,127,127,127,0,127,127,127,127,0,127,0,127,127,0,127,127,127,127, - 0,127,0,127,127,127,127,127,127,127,0,127,127,127,127,0,127,127,127,127, - 0,127,127,127,127,0,127,127,127,127,0,127,127,0,127,127,127,0,127,127,0, - 127,127,127,127,0,127,127,127,127,127,0,127,127,127,127,127,127,127,0,127, - 127,127,0,127,127,127,127,127,0,127,127,127,0,127,127,127,0,127,127,127, - 0,127,127,127,0,127,127,127,127,127,127,0,127,127,127,127,127,127,127,127, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,127,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,255,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,255,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,255,0,255,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,127,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,255,0,0,0,0,0,255,0,0,0,0, - 0,255,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,255,0,0, - 255,255,0,255,0,0,255,0,255,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,255,255, - 0,255,0,0,0,0,0,0,0,0,255,0,255,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,255,0,255,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,127, - 0,255,255,255,0,0,255,255,255,255,255,255,255,0,0,0,0,0,0,255,255,0,0,0, - 0,0,0,0,0,0,0,0,0,0,255,0,0,0,0,0,255,0,0,0,0,255,0,255,0,0,255,255,0,0, - 0,255,0,0,0,0,0,0,0,255,255,255,255,0,0,0,0,0,255,255,255,255,255,255,255, - 0,0,255,255,255,255,255,255,255,0,255,255,255,255,0,0,255,255,255,255,255, - 255,255,0,0,255,255,255,255,255,255,255,0,255,0,0,255,255,0,255,0,0,255, - 0,255,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,255,0,255,255,255,255,255,0,255, - 0,255,0,0,255,0,0,0,0,0,0,0,0,0,0,0,0,0,0,255,255,255,255,255,255,255,0, - 0,255,0,0,255,0,0,0,255,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,127, - 255,0,0,0,0,0,255,0,0,0,0,0,255,0,0,0,0,0,255,0,0,0,0,0,0,0,0,0,0,0,0,0, - 255,255,255,255,255,0,255,255,255,255,255,0,0,0,0,0,0,255,0,0,255,0,255, - 0,0,0,0,0,0,0,255,0,0,0,0,0,0,0,0,255,0,0,0,255,0,0,0,0,0,255,0,0,0,0,0, - 255,0,0,0,0,255,0,0,255,0,0,0,0,0,255,0,0,255,0,0,0,0,0,255,0,0,255,255, - 0,0,255,0,255,255,0,255,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 255,0,0,255,255,255,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,255,0,0,0,0,0,255, - 0,0,0,0,0,0,255,0,255,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,127, - 255,255,255,255,0,0,255,0,0,0,0,0,255,0,0,0,0,0,255,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,255,0,0,0,0,0,255,0,0,0,0,0,0,0,0,255,0,0,255,0,255,0,0,0,0,0, - 0,0,255,0,0,0,0,0,0,255,0,255,0,0,0,255,0,0,0,0,0,255,0,0,0,0,0,255,0,0, - 0,255,0,0,0,255,0,0,0,0,0,255,0,0,255,0,0,0,0,0,255,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,255,0,0,255,0,255,0, - 255,255,255,0,255,0,0,0,255,255,0,255,255,0,0,0,255,0,0,0,0,0,255,0,255, - 255,255,0,0,255,0,255,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,127, - 255,0,0,0,0,0,255,0,0,0,0,0,255,0,0,0,0,255,255,255,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,255,0,0,0,255,255,255,255,255,0,0,0,0,0,0,0,255,255,0,255,0,255, - 255,0,255,255,0,0,0,255,255,255,0,0,255,0,0,255,0,0,0,255,255,255,255,0, - 0,255,0,0,0,0,0,255,0,0,255,0,0,0,0,255,0,0,0,0,0,255,0,0,255,0,0,0,0,0, - 255,0,0,0,0,0,0,0,0,0,0,0,0,0,255,255,255,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,255,0,0,0,0,255,0,255,0,0,255,0,0,255,0,0,255,0, - 0,0,0,0,255,0,0,0,255,0,0,0,255,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,127,255,255,255,255,0,0,255,0,0,0,0,0,255,0,0,0,0,0,255,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,255,0,0,0,0,0,255,0,0,0,0,0,0,0,0,0,0,0,255,0,255, - 0,0,255,0,0,255,0,0,0,0,0,255,0,255,0,0,255,0,0,0,255,0,0,0,0,0,255,0,0, - 0,0,0,255,0,0,255,0,0,0,0,255,0,0,0,0,0,255,0,0,255,0,0,0,0,0,255,0,0,0, - 0,0,0,0,0,0,0,0,0,0,255,255,255,0,255,255,255,255,0,255,255,255,255,255, - 255,255,255,0,0,0,0,0,0,0,0,0,0,0,0,0,0,255,0,0,0,255,0,255,0,0,255,255, - 255,255,0,0,255,0,0,0,0,0,255,0,0,255,0,0,0,0,255,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,127,255,0,0,0,0,0,255,0,0,0,0,0,255,0,0,255, - 0,0,255,0,0,0,255,0,255,0,0,0,0,0,0,0,0,0,255,0,0,0,0,0,255,0,0,0,0,0,0, - 0,0,0,0,0,255,0,255,0,0,255,0,0,255,0,0,0,0,0,255,0,0,255,0,255,0,0,0,255, - 0,0,0,0,0,255,0,0,0,0,0,255,0,255,0,0,0,0,0,255,0,0,0,0,0,255,0,0,255,0, - 0,0,0,0,255,0,0,0,0,0,0,0,0,0,0,0,0,0,255,255,255,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,255,0,255,0,0,255,0,0,255,0,0,0,0,0, - 255,0,0,0,0,0,255,0,255,0,0,0,0,0,255,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,127,0,255,255,255,0,0,255,255,255,255,255,255,255,0,0,255, - 0,255,0,0,0,0,255,0,255,0,255,0,255,0,255,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,255,0,0,0,255,255,0,255,255,0,0,255,255,255,255,0,0,0,0,0,0,255, - 255,255,255,255,255,255,0,0,255,255,255,255,255,255,255,0,255,255,255,255, - 0,0,255,255,255,255,255,255,255,0,0,255,255,255,255,255,255,255,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,255,255,255,0,0,0,0,0,255,255,0,255,255,255,0,0,255,255,255,255,255, - 255,255,0,255,255,255,0,0,0,255,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,127,0,0,0,0,0,0,0,0,0,0,0,0,0,0,255,0,255,255,0,0,0,255,0,255, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,127,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,127,127,127,127,0,127,127,127,127,127,127,127,127,0,127,0,127,127, - 127,127,0,127,127,127,127,0,127,127,127,127,127,0,127,127,127,127,127,0, - 127,127,127,127,127,0,127,127,127,127,0,127,127,127,127,127,127,127,127, - 127,127,127,127,0,127,127,127,127,127,0,127,127,0,127,127,127,127,127,127, - 127,127,0,127,127,127,127,127,127,127,127,0,127,127,127,127,0,127,127,127, - 127,127,127,127,127,0,127,127,127,127,127,127,127,127,0,127,0,127,0,127, - 127,127,0,127,127,127,0,127,127,127,0,127,127,127,127,0,127,127,127,127, - 127,127,127,0,127,127,127,127,0,127,127,127,127,127,127,127,0,127,127,127, - 0,127,127,0,127,127,127,127,127,127,127,0,127,127,127,127,127,127,127,127, - 0,127,127,127,0,127,127,127,127,127,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,127,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,127,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,255,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,255,255,255,255,255,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,255,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,127,0,0,0,0,0,255,0,0,0,255,0,0,0,0,255,255,0,0,0,0,0,0,0,255,0, - 0,0,255,0,255,0,0,255,255,255,0,0,255,0,255,0,0,0,255,255,255,255,0,0,255, - 255,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,255,255,255,255,0,0,0,0,0,0,0, - 0,255,0,0,0,0,0,0,0,0,0,0,255,255,255,0,255,255,255,0,0,255,0,0,0,0,0,0, - 0,0,255,255,255,0,0,0,0,0,0,0,0,0,0,0,255,0,0,255,255,0,0,0,0,0,0,0,0,255, - 0,0,255,0,0,0,0,0,255,0,0,0,255,0,0,0,255,255,255,0,0,255,0,0,0,0,255,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,127,0,0,0,0,0,0,0,0,0,255,0,0,0,255,0,0,0,255,0,0,0,255,0, - 0,255,0,255,0,0,255,0,255,0,0,0,0,0,0,0,0,0,0,255,0,0,0,0,255,0,0,255,255, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,255,0,0,0,0,255,0,0,0,0,0,0,255,0,255, - 0,0,0,0,255,0,0,0,0,0,0,255,0,0,255,0,0,0,0,0,0,0,0,0,0,0,255,255,0,255, - 0,0,0,0,0,0,0,0,0,0,255,255,0,255,0,0,255,0,0,0,0,0,0,255,255,0,255,0,0, - 0,0,0,255,255,0,0,255,0,0,0,0,0,255,0,0,255,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 127,0,0,0,0,0,255,0,0,255,255,255,0,0,255,0,0,0,0,255,255,255,0,0,0,255, - 0,255,0,0,255,0,255,0,0,0,0,0,0,0,0,0,255,0,0,255,255,0,0,255,255,0,255, - 0,0,255,0,255,0,0,0,0,0,0,0,0,0,0,0,255,0,255,255,255,0,0,255,0,0,0,0,0, - 0,255,0,0,0,0,0,255,0,0,0,0,0,255,0,0,0,0,255,0,0,0,0,0,255,0,0,255,0,255, - 255,0,255,0,0,0,0,0,0,0,0,0,0,0,255,0,255,0,0,255,0,255,0,255,0,0,0,255, - 0,255,0,0,0,0,0,0,255,0,0,255,0,0,0,0,0,0,255,0,255,0,0,0,0,0,255,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,127,0,0,0,0,0,255,0,255,0,255,0,0,255,255,255,0,0,0,255,0,255, - 0,0,0,0,255,0,0,0,0,0,255,255,255,0,0,0,0,0,0,0,255,0,255,0,0,0,0,255,0, - 255,255,0,255,0,255,0,0,0,255,255,255,255,255,0,0,0,0,255,0,255,0,0,255, - 0,255,0,0,0,0,0,0,0,0,0,0,255,255,255,255,255,0,0,255,255,255,0,255,255, - 0,0,0,0,0,0,255,0,0,255,0,255,255,0,255,0,0,255,0,0,0,0,0,0,0,255,255,255, - 0,255,255,0,0,0,255,0,255,0,0,255,255,0,0,255,255,0,0,0,255,0,255,0,255, - 255,0,0,255,255,0,255,0,255,255,0,0,255,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,127,0,0,0,0,0, - 255,0,255,0,255,0,0,0,255,0,0,0,0,255,255,255,0,0,0,255,255,255,0,0,0,0, - 255,0,0,255,0,0,0,0,0,0,255,0,255,0,0,0,0,255,0,0,0,0,255,0,255,0,0,0,0, - 0,0,0,255,0,255,255,0,255,0,255,255,255,0,0,255,0,0,0,0,0,0,0,0,0,0,0,0, - 255,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,255,0,0,255,0,0,255,0,255,0,0,255,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,255,0,255,0,0,0,255,0,255,0,255,0,0,0,0,255, - 0,0,0,0,255,0,0,0,255,0,255,0,255,0,255,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,127,0,0,0,0, - 0,255,0,255,0,255,0,0,0,255,0,0,0,255,0,0,0,255,0,0,0,255,0,0,0,255,0,0, - 255,255,255,0,0,0,0,0,0,255,0,0,255,255,0,0,255,0,0,0,0,0,255,0,255,0,0, - 0,0,0,0,255,0,0,0,0,255,0,255,0,0,255,0,255,0,0,0,0,0,0,0,0,0,0,0,0,127, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,255,0,0,255,0,0,255,0,255,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,255,0,255,0,0,0,0,255,0,255,255,255,255,0,0,0,255, - 0,0,0,255,0,0,0,0,255,0,255,255,255,255,255,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,127,0,0, - 0,0,0,255,0,0,255,255,255,0,255,255,255,255,0,0,0,0,0,0,0,0,0,255,0,0,0, - 255,0,0,0,0,255,0,0,0,0,0,0,0,255,0,0,0,0,255,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,255,0,0,0,0,255,0,0,0,0,0,0,0,0,0,0,0,255,255,255,255,255, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,255,255,255,255,0,0,255,0,255,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,255,0,0,0,0,255,0,0,0,255,0,0,0,255,255, - 255,0,0,255,0,0,0,0,255,0,0,255,255,255,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,127,0,0,0,0,0,0,0, - 0,0,255,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,255,0,0,0,0,255,0,0,0,0,0, - 0,0,0,255,255,255,255,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,255, - 255,255,255,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,255,0,0,0,0,0,255,0,255,0,0,0,0,0,0,255,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,127,0,0,0,0,0,0,0,0,0,255,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,255, - 0,255,255,255,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,255,0,0,0,0,0,255,0,255,0,0,0,0,0,255,255,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,127,127,127,127,0,127,0,127,127,127,127,0,127,127,127, - 127,0,127,127,127,127,127,0,127,127,127,127,127,0,127,0,127,127,127,127, - 0,127,127,127,127,0,127,127,127,127,127,127,127,0,127,127,127,0,127,127, - 127,127,0,127,127,127,127,127,127,0,127,127,0,127,127,127,127,127,127,127, - 0,127,127,127,127,0,127,127,127,127,0,127,127,127,127,127,0,127,127,127, - 127,0,127,127,127,0,127,127,127,0,127,127,127,127,0,127,127,127,127,0,127, - 127,127,0,127,127,127,0,127,127,127,0,127,127,127,127,0,127,127,127,127, - 0,127,127,127,127,127,127,127,127,0,127,127,127,127,127,127,127,127,0,127, - 127,127,127,127,127,127,0,127,127,127,127,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,127,0,0,0,255,0, - 0,0,0,0,255,0,0,0,0,0,0,255,0,255,0,0,0,255,0,255,255,0,0,0,255,0,0,255, - 0,0,0,0,255,255,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,255,0,0,0,0,255, - 0,0,0,0,255,0,255,0,0,0,255,0,255,0,0,0,255,0,0,0,255,0,0,255,0,255,0,255, - 0,255,0,0,0,0,0,0,0,0,0,255,0,255,255,0,0,0,0,0,255,0,0,0,0,0,0,0,255,0, - 0,0,0,0,0,255,0,255,0,0,0,0,0,255,0,255,255,0,0,0,0,255,0,255,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,255,0,0,0,0,0,255,0,0,0,0,0,0,255,0,255, - 0,0,0,255,0,0,255,0,0,0,0,255,0,0,0,0,0,0,0,0,0,0,0,0,0,127,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,255,0,0,255, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,255,255,0,0,127,0,0,255,255, - 0,0,0,0,0,255,255,0,0,0,0,0,255,255,0,0,0,0,0,255,255,0,0,0,0,0,255,255, - 0,0,0,0,0,255,255,0,0,0,0,0,255,255,255,255,255,0,0,0,255,255,255,0,0,255, - 255,255,255,255,0,255,255,255,255,255,0,255,255,255,255,255,0,255,255,255, - 255,255,0,255,255,255,0,255,255,255,0,255,255,255,0,255,255,255,0,255,255, - 255,255,0,0,0,255,0,0,0,0,255,0,0,0,255,255,255,0,0,0,0,0,255,255,255,0, - 0,0,0,0,255,255,255,0,0,0,0,0,255,255,255,0,0,0,0,0,255,255,255,0,0,0,0, - 0,0,0,0,0,0,0,0,255,255,255,0,255,0,255,0,0,0,0,255,0,255,0,0,0,0,255,0, - 255,0,0,0,0,255,0,255,0,0,0,0,255,0,255,0,0,0,255,0,255,0,0,0,0,255,0,0, - 255,0,127,0,0,255,255,0,0,0,0,0,255,255,0,0,0,0,0,255,255,0,0,0,0,0,255, - 255,0,0,0,0,0,255,255,0,0,0,0,0,255,255,0,0,0,0,255,0,255,0,0,0,0,0,255, - 0,0,0,255,0,255,0,0,0,0,0,255,0,0,0,0,0,255,0,0,0,0,0,255,0,0,0,0,0,0,255, - 0,0,0,255,0,0,0,255,0,0,0,255,0,0,255,0,0,0,255,0,0,255,255,0,0,0,255,0, - 0,255,0,0,0,255,0,0,0,255,0,0,0,255,0,0,0,255,0,0,0,255,0,0,0,255,0,0,0, - 255,0,0,0,255,0,0,0,255,0,0,0,0,0,0,0,0,0,0,255,0,0,0,255,0,0,255,0,0,0, - 0,255,0,255,0,0,0,0,255,0,255,0,0,0,0,255,0,255,0,0,0,0,255,0,0,255,0,255, - 0,0,255,255,255,0,0,255,0,0,255,0,127,0,255,0,0,255,0,0,0,255,0,0,255,0, - 0,0,255,0,0,255,0,0,0,255,0,0,255,0,0,0,255,0,0,255,0,0,0,255,0,0,255,0, - 0,0,255,0,255,0,0,0,0,255,0,0,0,0,0,0,255,0,0,0,0,0,255,0,0,0,0,0,255,0, - 0,0,0,0,255,0,0,0,0,0,0,255,0,0,0,255,0,0,0,255,0,0,0,255,0,0,255,0,0,0, - 0,255,0,255,0,255,0,0,255,0,255,0,0,0,0,0,255,0,255,0,0,0,0,0,255,0,255, - 0,0,0,0,0,255,0,255,0,0,0,0,0,255,0,255,0,0,0,0,0,255,0,0,255,0,0,0,255, - 0,255,0,0,0,255,0,255,0,255,0,0,0,0,255,0,255,0,0,0,0,255,0,255,0,0,0,0, - 255,0,255,0,0,0,0,255,0,0,255,0,255,0,0,255,0,0,255,0,255,0,255,0,0,127, - 0,255,0,0,255,0,0,0,255,0,0,255,0,0,0,255,0,0,255,0,0,0,255,0,0,255,0,0, - 0,255,0,0,255,0,0,0,255,0,0,255,0,0,0,255,0,255,255,255,255,0,255,0,0,0, - 0,0,0,255,255,255,255,0,0,255,255,255,255,0,0,255,255,255,255,0,0,255,255, - 255,255,0,0,0,255,0,0,0,255,0,0,0,255,0,0,0,255,0,0,255,255,255,0,0,255, - 0,255,0,0,255,0,255,0,255,0,0,0,0,0,255,0,255,0,0,0,0,0,255,0,255,0,0,0, - 0,0,255,0,255,0,0,0,0,0,255,0,255,0,0,0,0,0,255,0,0,0,255,0,255,0,0,255, - 0,0,255,0,0,255,0,255,0,0,0,0,255,0,255,0,0,0,0,255,0,255,0,0,0,0,255,0, - 255,0,0,0,0,255,0,0,0,255,0,0,0,255,0,0,255,0,255,0,0,255,0,127,255,255, - 255,255,255,255,0,255,255,255,255,255,255,0,255,255,255,255,255,255,0,255, - 255,255,255,255,255,0,255,255,255,255,255,255,0,255,255,255,255,255,255, - 0,0,255,255,255,0,0,0,0,255,0,0,0,0,0,0,255,0,0,0,0,0,255,0,0,0,0,0,255, - 0,0,0,0,0,255,0,0,0,0,0,0,255,0,0,0,255,0,0,0,255,0,0,0,255,0,0,255,0,0, - 0,0,255,0,255,0,0,0,255,255,0,255,0,0,0,0,0,255,0,255,0,0,0,0,0,255,0,255, - 0,0,0,0,0,255,0,255,0,0,0,0,0,255,0,255,0,0,0,0,0,255,0,0,0,0,255,0,0,0, - 255,0,255,0,0,0,255,0,255,0,0,0,0,255,0,255,0,0,0,0,255,0,255,0,0,0,0,255, - 0,255,0,0,0,0,255,0,0,0,255,0,0,0,255,0,0,255,0,255,0,0,255,0,127,255,0, - 0,0,0,255,0,255,0,0,0,0,255,0,255,0,0,0,0,255,0,255,0,0,0,0,255,0,255,0, - 0,0,0,255,0,255,0,0,0,0,255,0,255,0,0,255,0,0,0,0,0,255,0,0,0,255,0,255, - 0,0,0,0,0,255,0,0,0,0,0,255,0,0,0,0,0,255,0,0,0,0,0,0,255,0,0,0,255,0,0, - 0,255,0,0,0,255,0,0,255,0,0,0,255,0,0,255,0,0,0,0,255,0,0,255,0,0,0,255, - 0,0,0,255,0,0,0,255,0,0,0,255,0,0,0,255,0,0,0,255,0,0,0,255,0,0,0,255,0, - 0,0,255,0,0,0,0,255,0,255,0,0,0,255,0,0,0,255,0,0,255,0,0,0,0,255,0,255, - 0,0,0,0,255,0,255,0,0,0,0,255,0,255,0,0,0,0,255,0,0,0,255,0,0,0,255,255, - 255,0,0,255,0,0,255,0,127,255,0,0,0,0,255,0,255,0,0,0,0,255,0,255,0,0,0, - 0,255,0,255,0,0,0,0,255,0,255,0,0,0,0,255,0,255,0,0,0,0,255,0,255,0,0,255, - 255,255,255,0,0,0,255,255,255,0,0,255,255,255,255,255,0,255,255,255,255, - 255,0,255,255,255,255,255,0,255,255,255,255,255,0,255,255,255,0,255,255, - 255,0,255,255,255,0,255,255,255,0,255,255,255,255,0,0,0,255,0,0,0,0,255, - 0,0,0,255,255,255,0,0,0,0,0,255,255,255,0,0,0,0,0,255,255,255,0,0,0,0,0, - 255,255,255,0,0,0,0,0,255,255,255,0,0,0,0,255,0,0,0,255,0,255,0,255,255, - 255,0,0,0,0,255,255,255,255,0,0,0,255,255,255,255,0,0,0,255,255,255,255, - 0,0,0,255,255,255,255,0,0,0,0,255,0,0,0,255,0,0,0,0,255,0,255,0,0,127,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,255,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,127,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,255,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,127,127,127,127, - 127,127,0,127,127,127,127,127,127,0,127,127,127,127,127,127,0,127,127,127, - 127,127,127,0,127,127,127,127,127,127,0,127,127,127,127,127,127,0,127,127, - 127,127,127,127,127,0,127,127,127,127,127,127,0,127,127,127,127,127,0,127, - 127,127,127,127,0,127,127,127,127,127,0,127,127,127,127,127,0,127,127,127, - 0,127,127,127,0,127,127,127,0,127,127,127,0,127,127,127,127,127,127,0,127, - 127,127,127,127,127,0,127,127,127,127,127,127,127,0,127,127,127,127,127, - 127,127,0,127,127,127,127,127,127,127,0,127,127,127,127,127,127,127,0,127, - 127,127,127,127,127,127,0,127,127,127,127,127,127,0,127,127,127,127,127, - 127,127,0,127,127,127,127,127,127,0,127,127,127,127,127,127,0,127,127,127, - 127,127,127,0,127,127,127,127,127,127,0,127,127,127,127,127,0,127,127,127, - 127,0,127,127,127,127,0,127,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,127,0,255,0,0,0,0,0,0,255,0,0,0,255,0,0,255,255,0,255,0, - 0,0,0,0,0,0,0,255,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,255,0,0,0,0,0,0,255,0,0, - 0,255,0,0,0,0,0,0,0,255,0,0,0,255,0,255,0,0,0,0,0,0,0,0,0,255,255,0,255, - 0,0,255,0,0,0,0,0,0,255,0,0,0,255,0,0,255,255,0,255,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,255,0,0,0,0,0,0,255,0,0,0,255,0,0,0,0,0,0,0,0,0,0,255, - 0,0,255,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,127,0,0,255, - 0,0,0,0,255,0,0,0,255,0,255,0,255,0,255,255,0,0,255,0,255,0,0,255,0,255, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,255,0,0,0,0,255,0,0,0,255,0,255,0,0,255,0, - 255,0,0,255,0,255,0,255,0,255,255,0,255,0,0,255,255,0,255,0,255,255,0,0, - 0,255,0,0,0,0,255,0,0,0,255,0,255,0,255,0,255,255,0,255,0,0,255,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,255,0,0,0,0,255,0,0,0,255,0,255,0,0,255,0,255,0, - 0,0,255,0,0,0,255,0,0,0,0,0,255,0,255,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,127,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,255,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,255,255,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,255,0,0,0,0,0,0,0,255,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,255,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,127,0,255,255,0,0,0,255,255,0,0,0,255,255,0,0,0,255,255,0,0,0,255, - 255,0,0,0,255,255,0,0,255,255,255,0,255,255,0,0,0,255,255,0,0,255,255,0, - 0,0,255,255,0,0,0,255,255,0,0,0,255,255,0,0,0,255,0,255,0,0,255,0,0,255, - 0,0,0,0,255,0,255,255,255,0,0,0,255,255,0,0,0,255,255,0,0,0,255,255,0,0, - 0,255,255,0,0,0,255,255,0,0,0,0,0,0,0,0,0,0,255,255,255,0,0,255,0,0,255, - 0,255,0,0,255,0,255,0,0,255,0,255,0,0,255,0,255,0,0,0,255,0,255,255,255, - 0,0,255,0,0,0,255,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,127,0,0,0,255,0,0,0, - 0,255,0,0,0,0,255,0,0,0,0,255,0,0,0,0,255,0,0,0,0,255,0,0,0,0,255,0,0,255, - 0,255,0,0,0,255,0,0,255,0,255,0,0,255,0,255,0,0,255,0,255,0,0,255,0,0,255, - 0,255,0,0,255,0,0,255,0,0,255,255,255,0,255,0,0,255,0,255,0,0,255,0,255, - 0,0,255,0,255,0,0,255,0,255,0,0,255,0,255,0,0,255,0,0,255,255,255,255,255, - 0,255,0,0,255,255,0,255,0,0,255,0,255,0,0,255,0,255,0,0,255,0,255,0,0,255, - 0,0,255,0,255,0,0,255,0,0,255,0,0,255,0,255,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,127,0,255,255,255,0,0,255,255,255,0,0,255,255,255,0,0,255,255,255, - 0,0,255,255,255,0,0,255,255,255,0,0,255,255,255,255,255,255,0,255,0,0,0, - 255,255,255,255,0,255,255,255,255,0,255,255,255,255,0,255,255,255,255,0, - 0,255,0,255,0,0,255,0,0,255,0,255,0,0,255,0,255,0,0,255,0,255,0,0,255,0, - 255,0,0,255,0,255,0,0,255,0,255,0,0,255,0,255,0,0,255,0,0,0,0,0,0,0,0,255, - 0,255,0,255,0,255,0,0,255,0,255,0,0,255,0,255,0,0,255,0,255,0,0,255,0,0, - 255,0,255,0,0,255,0,0,255,0,0,255,0,255,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,127,255,0,0,255,0,255,0,0,255,0,255,0,0,255,0,255,0,0,255,0,255,0,0, - 255,0,255,0,0,255,0,255,0,0,255,0,0,0,0,255,0,0,0,255,0,0,0,0,255,0,0,0, - 0,255,0,0,0,0,255,0,0,0,0,0,255,0,255,0,0,255,0,0,255,0,255,0,0,255,0,255, - 0,0,255,0,255,0,0,255,0,255,0,0,255,0,255,0,0,255,0,255,0,0,255,0,255,0, - 0,255,0,0,0,0,255,0,0,0,255,255,0,0,255,0,255,0,0,255,0,255,0,0,255,0,255, - 0,0,255,0,255,0,0,255,0,0,255,0,255,0,0,255,0,0,255,0,0,255,0,255,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,127,0,255,255,255,0,0,255,255,255,0,0,255, - 255,255,0,0,255,255,255,0,0,255,255,255,0,0,255,255,255,0,0,255,255,0,255, - 255,255,0,0,255,255,0,0,255,255,255,0,0,255,255,255,0,0,255,255,255,0,0, - 255,255,255,0,0,255,0,255,0,0,255,0,0,255,0,0,255,255,0,0,255,0,0,255,0, - 0,255,255,0,0,0,255,255,0,0,0,255,255,0,0,0,255,255,0,0,0,255,255,0,0,0, - 0,0,0,0,0,0,0,255,255,255,0,0,0,255,255,255,0,0,255,255,255,0,0,255,255, - 255,0,0,255,255,255,0,0,0,255,0,0,0,255,255,255,0,0,0,0,255,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,127,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,255,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,255,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,255,0,0,0,255,0,0,0,0,0,0,255,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,127,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,255,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,255,0,0,0,0,255,0,0,0,0,0,255,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,127,127,127,127,0,127,127,127,127,0,127,127, - 127,127,0,127,127,127,127,0,127,127,127,127,0,127,127,127,127,0,127,127, - 127,127,127,127,127,0,127,127,127,0,127,127,127,127,0,127,127,127,127,0, - 127,127,127,127,0,127,127,127,127,0,127,127,0,127,0,127,127,0,127,127,0, - 127,127,127,127,0,127,127,127,127,0,127,127,127,127,0,127,127,127,127,0, - 127,127,127,127,0,127,127,127,127,0,127,127,127,127,0,127,127,127,127,127, - 127,0,127,127,127,127,127,0,127,127,127,127,0,127,127,127,127,0,127,127, - 127,127,0,127,127,127,127,0,127,127,127,127,127,0,127,127,127,127,0,127, - 127,127,127,127,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 -}; - - -// Normal font -const int FONT1_BM_W = 253; -const int FONT1_BM_H = 106; -static const unsigned char s_Font1[] = -{ - 127,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,127,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,127,0,0,0,0,0,0,0,0,0,0,255,0,255,0,0,0,0,0,0,0,0,0,0,0,0,0,255, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,255,0,0,0,0,255,0,0,255, - 0,0,0,0,0,0,255,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,255, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,127,0,0,0,0,0,0,255,0,0,0,255,0,255,0,0,0,0, - 0,255,0,255,0,0,0,0,0,255,0,0,0,0,255,255,0,0,0,0,255,0,0,0,0,0,255,255, - 255,0,0,0,0,0,255,0,0,0,255,0,0,0,0,255,0,0,0,255,0,255,0,255,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,255,0,0,255,255,255,255,0,0,0,0,0, - 255,0,0,0,0,255,255,255,255,0,0,0,255,255,255,255,0,0,0,0,0,0,255,0,0,255, - 255,255,255,255,255,0,0,0,255,255,255,0,0,255,255,255,255,255,255,0,0,255, - 255,255,255,0,0,0,255,255,255,255,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,255,255,255,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,127,0,0,0,0,0,0,255,0,0,0,255,0,255,0,0,0,0,0,255,0,255,0,0,0,0,255,255, - 255,0,0,255,0,0,255,0,0,255,0,0,0,0,0,255,0,0,0,255,0,0,0,0,255,0,0,0,255, - 0,0,0,0,255,0,0,0,0,255,255,255,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,255,0,0,255,0,0,0,0,255,0,0,255,255,255,0,0,0,255,0,0,0,0,255,0, - 255,0,0,0,0,255,0,0,0,0,255,255,0,0,255,0,0,0,0,0,0,0,255,0,0,0,0,0,0,0, - 0,0,0,255,0,255,0,0,0,0,255,0,255,0,0,0,0,255,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,255,0,0,0,255,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,127,0,0,0,0,0,0,255,0,0,0,0,0,0,0,0,0,255,255,255,255,255,255, - 0,0,255,0,255,0,255,0,255,0,0,255,0,0,255,0,0,0,0,0,255,0,0,0,255,0,0,0, - 0,0,0,0,255,0,0,0,0,0,0,255,0,0,255,0,255,0,255,0,0,0,0,255,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,255,0,0,255,0,0,0,0,255,0,0,0,0,255,0,0,0,0,0,0, - 0,0,255,0,0,0,0,0,0,255,0,0,0,255,0,255,0,0,255,0,0,0,0,0,0,255,0,0,0,0, - 0,0,0,0,0,0,255,0,0,255,0,0,0,0,255,0,255,0,0,0,0,255,0,0,255,0,0,0,255, - 0,0,0,0,0,0,0,0,255,0,0,0,0,0,0,0,0,0,0,0,0,255,0,0,0,0,0,0,0,0,0,0,0,255, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,127,0,0,0,0,0,0,255,0,0,0,0,0,0,0,0,0,0,255,0,255, - 0,0,0,0,255,0,255,0,0,0,255,0,0,255,0,255,0,0,0,0,0,0,0,255,0,255,0,0,0, - 0,0,0,0,0,255,0,0,0,0,0,0,255,0,0,0,0,255,0,0,0,0,0,0,255,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,255,0,0,255,0,0,0,0,255,0,0,0,0,255,0,0,0,0,0,0,0, - 0,255,0,0,0,0,0,0,255,0,0,255,0,0,255,0,0,255,255,255,255,255,0,0,255,255, - 255,255,255,0,0,0,0,0,0,255,0,0,255,0,0,0,0,255,0,255,0,0,0,0,255,0,0,255, - 0,0,0,255,0,0,0,0,0,0,255,255,0,0,0,0,255,255,255,255,255,255,0,0,0,0,255, - 255,0,0,0,0,0,0,0,0,0,255,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,127,0,0,0,0,0,0,255,0,0, - 0,0,0,0,0,0,0,0,255,0,255,0,0,0,0,0,255,255,0,0,0,0,255,255,0,0,255,0,0, - 255,255,0,0,0,255,255,0,0,0,255,0,0,0,0,0,255,0,0,0,0,0,0,255,0,0,0,0,0, - 0,0,0,0,0,0,255,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,255,0,0,255,0,0,0,0, - 255,0,0,0,0,255,0,0,0,0,0,0,0,255,0,0,0,0,255,255,255,0,0,255,0,0,0,255, - 0,0,0,0,0,0,0,255,0,255,0,0,0,0,255,0,0,0,0,255,0,0,0,0,255,255,255,255, - 0,0,255,0,0,0,0,255,0,0,0,0,0,0,0,0,0,0,0,255,255,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,255,255,0,0,0,0,0,255,255,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,127,0,0, - 0,0,0,0,255,0,0,0,0,0,0,0,0,255,255,255,255,255,255,0,0,0,0,0,255,255,0, - 0,0,0,0,0,0,255,0,255,0,0,255,0,255,0,0,255,0,0,255,0,0,0,0,0,255,0,0,0, - 0,0,0,255,0,0,0,0,0,0,0,0,255,255,255,255,255,255,255,0,0,0,0,0,255,255, - 255,0,0,0,0,0,0,255,0,0,0,255,0,0,0,0,255,0,0,0,0,255,0,0,0,0,0,255,255, - 0,0,0,0,0,0,0,0,255,0,255,255,255,255,255,255,0,0,0,0,0,0,255,0,255,0,0, - 0,0,255,0,0,0,0,255,0,0,0,255,0,0,0,0,255,0,0,255,255,255,255,255,0,0,0, - 0,0,0,0,0,0,0,255,0,0,0,0,0,0,0,0,255,255,255,255,255,255,0,0,0,0,0,0,0, - 0,255,0,0,0,255,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,127,0,0,0,0,0,0,255,0,0,0,0, - 0,0,0,0,0,0,255,0,255,0,0,0,0,0,0,255,0,255,0,0,0,0,0,255,0,0,255,0,0,255, - 0,255,0,0,0,255,255,0,0,0,0,0,0,255,0,0,0,0,0,0,255,0,0,0,0,0,0,0,0,0,0, - 0,255,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,255,0,0,0,255,0,0,0,0,255,0,0,0, - 0,255,0,0,0,0,255,0,0,0,0,0,0,0,0,0,0,255,0,0,0,0,0,255,0,0,0,0,0,0,0,255, - 0,255,0,0,0,0,255,0,0,0,255,0,0,0,0,255,0,0,0,0,255,0,0,0,0,0,0,255,0,0, - 0,0,0,0,0,0,0,0,0,255,255,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,255,255,0, - 0,0,0,255,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,127,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,255,0,255,0,0,0,0,0,255,0,255,0,255,0,0,0,0,0,255,0,0,255,0,0,255,0,255, - 0,0,0,255,255,0,0,0,0,0,0,255,0,0,0,0,0,0,255,0,0,0,0,0,0,0,0,0,0,0,255, - 0,0,0,0,0,255,0,0,0,0,0,0,0,255,0,0,0,255,0,0,0,255,0,0,0,0,255,0,0,0,0, - 255,0,0,0,255,0,0,0,0,0,0,255,0,0,0,0,255,0,0,0,0,0,255,0,0,255,0,0,0,0, - 255,0,255,0,0,0,0,255,0,0,0,255,0,0,0,0,255,0,0,0,0,255,0,0,0,0,0,255,0, - 0,0,255,0,0,0,255,0,0,0,0,0,0,255,255,0,0,0,0,0,0,0,0,0,0,0,0,0,0,255,255, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,127,0,0,0,0,0,0,255,0,0,0,0,0, - 0,0,0,0,255,0,255,0,0,0,0,0,0,255,255,255,0,0,0,0,0,255,0,0,0,0,255,255, - 0,0,0,255,255,255,0,0,255,0,0,0,0,0,0,255,0,0,0,0,255,0,0,0,0,0,0,0,0,0, - 0,0,0,255,0,0,0,0,0,255,0,0,0,0,0,0,0,255,0,0,0,255,0,0,0,0,255,255,255, - 255,0,0,0,255,255,255,255,255,0,255,255,255,255,255,255,0,0,255,255,255, - 255,0,0,0,0,0,0,255,0,0,0,255,255,255,255,0,0,0,255,255,255,255,0,0,0,255, - 0,0,0,0,0,0,255,255,255,255,0,0,0,255,255,255,0,0,0,0,255,0,0,0,255,0,0, - 0,0,0,0,0,0,255,0,0,0,0,0,0,0,0,0,0,0,0,255,0,0,0,0,0,0,0,0,255,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,127,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,255,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,255,0,0, - 0,0,255,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,255,0,0,0,0,0,0,0,0,0,0,255, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,255,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,127,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,255,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,255,0,0,255,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,255,0,0,0,0,0, - 0,0,0,0,0,0,255,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,255,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,127,127,127,127,0, - 127,127,127,0,127,127,127,127,127,0,127,127,127,127,127,127,127,0,127,127, - 127,127,127,127,0,127,127,127,127,127,127,127,127,127,127,127,0,127,127, - 127,127,127,127,127,0,127,127,127,0,127,127,127,0,127,127,127,127,0,127, - 127,127,127,127,127,0,127,127,127,127,127,127,127,0,127,127,0,127,127,127, - 127,0,127,127,127,0,127,127,127,127,0,127,127,127,127,127,127,0,127,127, - 127,127,127,127,0,127,127,127,127,127,127,0,127,127,127,127,127,127,0,127, - 127,127,127,127,127,0,127,127,127,127,127,127,0,127,127,127,127,127,127, - 0,127,127,127,127,127,127,0,127,127,127,127,127,127,0,127,127,127,127,127, - 127,0,127,127,0,127,127,127,127,0,127,127,127,127,127,127,127,127,0,127, - 127,127,127,127,127,127,127,0,127,127,127,127,127,127,127,127,0,127,127, - 127,127,127,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,127,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,127,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,127,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,255,255,255,0,255,0,0,0,0,0,255,255,255,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,127,0,0,0,255, - 255,255,255,0,0,0,0,0,0,0,255,0,0,0,0,255,255,255,255,255,0,0,0,0,255,255, - 255,255,0,255,255,255,255,255,0,0,0,255,255,255,255,255,255,0,255,255,255, - 255,255,0,0,0,255,255,255,255,0,0,255,0,0,0,0,0,255,0,255,255,255,0,0,255, - 255,255,0,255,0,0,0,0,255,0,255,0,0,0,0,0,255,255,0,0,0,0,255,255,0,255, - 255,0,0,0,0,255,0,0,0,255,255,255,255,0,0,0,255,255,255,255,255,0,0,0,0, - 255,255,255,255,0,0,0,255,255,255,255,0,0,0,0,255,255,255,255,0,0,255,255, - 255,255,255,255,255,0,255,0,0,0,0,0,255,0,255,0,0,0,0,0,255,0,255,0,0,0, - 0,255,0,0,0,0,255,0,255,0,0,0,0,255,0,255,0,0,0,0,0,255,0,255,255,255,255, - 255,255,0,0,255,0,0,0,255,0,0,0,0,0,0,0,255,0,0,0,0,0,255,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,127,0,255,255,0,0,0,0,255,255,0,0, - 0,0,255,0,255,0,0,0,255,0,0,0,0,255,0,0,255,0,0,0,0,0,255,0,0,0,0,255,0, - 0,255,0,0,0,0,0,0,255,0,0,0,0,0,0,255,0,0,0,0,255,0,255,0,0,0,0,0,255,0, - 0,255,0,0,0,0,0,255,0,255,0,0,0,255,0,0,255,0,0,0,0,0,255,255,0,0,0,0,255, - 255,0,255,255,0,0,0,0,255,0,0,255,0,0,0,0,255,0,0,255,0,0,0,0,255,0,0,255, - 0,0,0,0,255,0,0,255,0,0,0,255,0,0,255,0,0,0,0,255,0,0,0,0,255,0,0,0,0,255, - 0,0,0,0,0,255,0,255,0,0,0,0,0,255,0,255,0,0,0,0,255,0,0,0,0,255,0,0,255, - 0,0,255,0,0,0,255,0,0,0,255,0,0,0,0,0,0,0,255,0,0,255,0,0,0,0,255,0,0,0, - 0,0,0,255,0,0,0,0,255,0,255,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,127,0,255,0,255,255,255,255,0,255,0,0,0,0,255,0,255,0,0,0,255,0,0, - 0,0,255,0,255,0,0,0,0,0,0,255,0,0,0,0,0,255,0,255,0,0,0,0,0,0,255,0,0,0, - 0,0,255,0,0,0,0,0,0,0,255,0,0,0,0,0,255,0,0,255,0,0,0,0,0,255,0,255,0,0, - 255,0,0,0,255,0,0,0,0,0,255,0,255,0,0,255,0,255,0,255,0,255,0,0,0,255,0, - 255,0,0,0,0,0,0,255,0,255,0,0,0,0,255,0,255,0,0,0,0,0,0,255,0,255,0,0,0, - 255,0,0,255,0,0,0,0,0,0,0,0,0,255,0,0,0,0,255,0,0,0,0,0,255,0,0,255,0,0, - 0,255,0,0,0,255,0,0,255,0,255,0,0,255,0,0,0,255,0,0,255,0,0,0,255,0,0,0, - 255,0,0,0,0,0,0,255,0,0,0,255,0,0,0,0,255,0,0,0,0,0,0,255,0,0,0,255,0,0, - 0,255,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,127,255,0,255,0,0, - 0,255,0,0,255,0,0,0,255,0,255,0,0,0,255,0,0,0,0,255,0,255,0,0,0,0,0,0,255, - 0,0,0,0,0,255,0,255,0,0,0,0,0,0,255,0,0,0,0,0,255,0,0,0,0,0,0,0,255,0,0, - 0,0,0,255,0,0,255,0,0,0,0,0,255,0,255,0,255,0,0,0,0,255,0,0,0,0,0,255,0, - 255,0,0,255,0,255,0,255,0,255,0,0,0,255,0,255,0,0,0,0,0,0,255,0,255,0,0, - 0,0,255,0,255,0,0,0,0,0,0,255,0,255,0,0,0,255,0,0,255,0,0,0,0,0,0,0,0,0, - 255,0,0,0,0,255,0,0,0,0,0,255,0,0,255,0,0,0,255,0,0,0,255,0,0,255,0,255, - 0,0,255,0,0,0,0,255,255,0,0,0,0,0,255,0,255,0,0,0,0,0,0,255,0,0,0,0,255, - 0,0,0,0,255,0,0,0,0,0,0,255,0,0,255,0,0,0,0,0,255,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,127,255,0,255,0,0,0,255,0,0,255,0,0,255,0,0,0,255, - 0,0,255,255,255,255,255,0,0,255,0,0,0,0,0,0,255,0,0,0,0,0,255,0,255,255, - 255,255,255,255,0,255,255,255,255,255,0,255,0,0,0,255,255,255,0,255,255, - 255,255,255,255,255,0,0,255,0,0,0,0,0,255,0,255,255,0,0,0,0,0,255,0,0,0, - 0,0,255,0,255,0,0,255,0,255,0,255,0,0,255,0,0,255,0,255,0,0,0,0,0,0,255, - 0,255,0,0,0,0,255,0,255,0,0,0,0,0,0,255,0,255,255,255,255,0,0,0,0,255,255, - 255,255,0,0,0,0,0,255,0,0,0,0,255,0,0,0,0,0,255,0,0,255,0,0,0,255,0,0,0, - 255,0,0,255,0,255,0,0,255,0,0,0,0,255,255,0,0,0,0,0,0,255,0,0,0,0,0,0,255, - 0,0,0,0,0,255,0,0,0,0,255,0,0,0,0,0,0,255,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,127,255,0,255,0,0,0,255,0,0,255,0,0,255, - 0,0,0,255,0,0,255,0,0,0,0,255,0,255,0,0,0,0,0,0,255,0,0,0,0,0,255,0,255, - 0,0,0,0,0,0,255,0,0,0,0,0,255,0,0,0,0,0,255,0,255,0,0,0,0,0,255,0,0,255, - 0,0,0,0,0,255,0,255,0,255,0,0,0,0,255,0,0,0,0,0,255,0,0,255,255,0,0,255, - 0,255,0,0,0,255,0,255,0,255,0,0,0,0,0,0,255,0,255,255,255,255,255,0,0,255, - 0,0,0,0,0,0,255,0,255,0,0,255,0,0,0,0,0,0,0,0,255,0,0,0,0,255,0,0,0,0,255, - 0,0,0,0,0,255,0,0,0,255,0,255,0,0,0,0,255,0,255,0,0,0,255,0,255,0,0,0,0, - 255,255,0,0,0,0,0,0,255,0,0,0,0,0,0,255,0,0,0,0,0,255,0,0,0,0,0,255,0,0, - 0,0,0,255,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,127,255,0,255,0,0,0,255,0,0,255,0,0,255,255,255,255,255,0,0,255,0,0,0, - 0,255,0,255,0,0,0,0,0,0,255,0,0,0,0,0,255,0,255,0,0,0,0,0,0,255,0,0,0,0, - 0,255,0,0,0,0,0,255,0,255,0,0,0,0,0,255,0,0,255,0,0,0,0,0,255,0,255,0,0, - 255,0,0,0,255,0,0,0,0,0,255,0,0,255,255,0,0,255,0,255,0,0,0,255,0,255,0, - 255,0,0,0,0,0,0,255,0,255,0,0,0,0,0,0,255,0,0,0,0,0,0,255,0,255,0,0,0,255, - 0,0,0,0,0,0,0,255,0,0,0,0,255,0,0,0,0,255,0,0,0,0,0,255,0,0,0,255,0,255, - 0,0,0,0,0,255,255,0,0,0,255,255,0,0,0,0,255,0,0,255,0,0,0,0,0,255,0,0,0, - 0,0,255,0,0,0,0,0,0,255,0,0,0,0,0,255,0,0,0,0,0,255,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,127,0,255,0,255,255,255,255, - 255,255,0,0,255,0,0,0,0,0,255,0,255,0,0,0,0,255,0,0,255,0,0,0,0,0,255,0, - 0,0,0,255,0,0,255,0,0,0,0,0,0,255,0,0,0,0,0,0,255,0,0,0,0,255,0,255,0,0, - 0,0,0,255,0,0,255,0,0,0,0,0,255,0,255,0,0,0,255,0,0,255,0,0,0,0,0,255,0, - 0,0,0,0,0,255,0,255,0,0,0,0,255,255,0,0,255,0,0,0,0,255,0,0,255,0,0,0,0, - 0,0,0,255,0,0,0,0,255,0,0,255,0,0,0,255,0,0,255,0,0,0,0,255,0,0,0,0,255, - 0,0,0,0,0,255,0,0,0,255,0,0,0,0,255,0,255,0,0,0,0,0,255,0,0,0,0,0,255,0, - 0,0,0,255,0,0,255,0,0,0,0,0,255,0,0,0,0,255,0,0,0,0,0,0,0,255,0,0,0,0,0, - 255,0,0,0,0,0,255,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,127,0,255,255,0,0,0,0,0,0,0,0,255,0,0,0,0,0,255,0,255,255,255, - 255,255,0,0,0,0,255,255,255,255,0,255,255,255,255,255,0,0,0,255,255,255, - 255,255,255,0,255,0,0,0,0,0,0,0,255,255,255,255,255,0,255,0,0,0,0,0,255, - 0,255,255,255,0,255,255,255,0,0,255,0,0,0,0,255,0,255,255,255,255,255,0, - 255,0,0,0,0,0,0,255,0,255,0,0,0,0,255,255,0,0,0,255,255,255,255,0,0,0,255, - 0,0,0,0,0,0,0,0,255,255,255,255,0,0,0,255,0,0,0,0,255,0,0,255,255,255,255, - 0,0,0,0,0,255,0,0,0,0,0,0,255,255,255,0,0,0,0,0,0,255,0,0,0,0,0,0,255,0, - 0,0,0,0,255,0,0,0,255,0,0,0,0,255,0,0,0,0,255,0,0,0,0,255,255,255,255,255, - 255,0,0,255,0,0,0,0,0,255,0,0,0,0,0,255,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,127,0,0,0,255,255,255,255,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,255,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,255,0,0,0,0,0,0,255,0,0,0,0,255,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,127,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,255,255,255,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,255,255,255,0,0,0,0,255,0,0, - 255,255,255,0,0,0,0,0,0,0,0,0,0,255,255,255,255,255,255,255,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,127,127,127,127,127,127,127,127,127,127,0,127,127,127, - 127,127,127,127,0,127,127,127,127,127,127,0,127,127,127,127,127,127,0,127, - 127,127,127,127,127,127,0,127,127,127,127,127,127,0,127,127,127,127,127, - 0,127,127,127,127,127,127,127,0,127,127,127,127,127,127,127,0,127,127,127, - 0,127,127,127,127,0,127,127,127,127,127,127,0,127,127,127,127,127,0,127, - 127,127,127,127,127,127,127,0,127,127,127,127,127,127,127,0,127,127,127, - 127,127,127,127,127,0,127,127,127,127,127,127,0,127,127,127,127,127,127, - 127,127,0,127,127,127,127,127,127,0,127,127,127,127,127,127,0,127,127,127, - 127,127,127,127,0,127,127,127,127,127,127,127,0,127,127,127,127,127,127, - 127,0,127,127,127,127,127,127,127,127,127,127,127,0,127,127,127,127,127, - 127,0,127,127,127,127,127,127,127,0,127,127,127,127,127,127,0,127,127,127, - 127,0,127,127,127,127,0,127,127,127,127,0,127,127,127,127,127,127,127,127, - 0,127,127,127,127,127,127,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,127,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,127,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,127,255, - 0,0,0,0,0,0,0,0,0,0,0,255,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,255,0,0,0,0, - 0,0,0,0,0,0,255,255,0,0,0,0,0,0,0,255,0,0,0,0,0,0,0,0,0,0,0,255,0,0,0,0, - 0,255,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,255,255,0,0,0,255, - 0,0,255,255,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,127,0,255,0,0,0,0,0,0,0,0,0,0,255,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,255,0,0,0,0,0,0,0,0,0,255,0,0,0,0,0,0,0,0,0,255,0,0,0, - 0,0,0,255,0,0,255,0,255,0,0,0,0,0,255,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,255,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,255,0,0,0,0,0,255,0,0,0,0,255,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 255,255,255,255,255,255,255,255,255,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,127, - 0,0,0,0,0,0,0,0,0,0,0,0,255,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,255,0,0,0, - 0,0,0,0,0,0,255,0,0,0,0,0,0,0,0,0,255,0,0,0,0,0,0,0,0,0,0,0,255,0,0,0,0, - 0,255,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,255,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,255,0,0,0,0,0,255, - 0,0,0,0,255,0,0,0,0,0,0,0,0,0,0,0,0,0,0,255,0,0,0,0,0,0,0,255,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,127,0,0,0,0,0,0,0,255,255,255,0,0,255,0,255,255, - 255,0,0,0,255,255,255,255,0,0,255,255,255,255,255,0,0,255,255,255,255,0, - 0,255,255,255,255,0,255,255,255,255,255,0,255,0,255,255,255,0,0,255,0,255, - 255,0,255,0,0,0,255,0,255,0,255,255,255,255,0,255,255,255,0,0,255,0,255, - 255,255,0,0,0,255,255,255,255,0,0,255,0,255,255,255,0,0,0,255,255,255,255, - 255,0,255,0,255,0,0,255,255,255,0,255,255,255,255,0,255,0,0,0,0,255,0,255, - 0,0,0,255,0,255,0,0,0,255,0,0,0,255,0,255,0,0,0,255,0,255,0,0,0,255,0,255, - 255,255,255,0,0,0,255,0,0,0,0,0,255,0,0,0,0,255,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,255,0,0,0,0,0,0,0,255,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,127,0,0,0,0, - 0,0,0,0,0,0,255,0,255,255,0,0,0,255,0,255,0,0,0,0,0,255,0,0,0,0,255,0,255, - 0,0,0,0,255,0,0,255,0,0,255,0,0,0,0,255,0,255,255,0,0,0,255,0,255,0,0,255, - 0,255,0,0,255,0,0,255,0,255,0,0,0,255,0,0,0,255,0,255,255,0,0,0,255,0,255, - 0,0,0,0,255,0,255,255,0,0,0,255,0,255,0,0,0,0,255,0,255,255,0,0,255,0,0, - 0,0,0,255,0,0,0,255,0,0,0,0,255,0,255,0,0,0,255,0,255,0,0,0,255,0,0,0,255, - 0,0,255,0,255,0,0,255,0,0,0,255,0,0,0,0,255,0,0,0,255,0,0,0,0,0,255,0,0, - 0,0,255,0,0,0,0,0,0,0,0,0,0,0,0,0,0,255,0,0,0,0,0,0,0,255,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,127,0,0,0,0,0,0,0,0,0,0,255,0,255,0,0,0,0,255,0,255, - 0,0,0,0,0,255,0,0,0,0,255,0,255,0,0,0,0,255,0,0,255,0,0,255,0,0,0,0,255, - 0,255,0,0,0,0,255,0,255,0,0,255,0,255,0,255,0,0,0,255,0,255,0,0,0,255,0, - 0,0,255,0,255,0,0,0,0,255,0,255,0,0,0,0,255,0,255,0,0,0,0,255,0,255,0,0, - 0,0,255,0,255,0,0,0,255,0,0,0,0,0,255,0,0,0,255,0,0,0,0,255,0,0,255,0,255, - 0,0,0,255,0,255,0,255,0,255,0,0,0,255,0,255,0,0,0,255,0,255,0,0,0,0,255, - 0,0,0,0,255,0,0,0,0,0,255,0,0,0,0,255,0,0,0,0,0,255,255,0,0,0,255,0,0,0, - 255,0,0,0,0,0,0,0,255,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,127,0,0,0,0,0,0, - 0,255,255,255,255,0,255,0,0,0,0,255,0,255,0,0,0,0,0,255,0,0,0,0,255,0,255, - 255,255,255,255,255,0,0,255,0,0,255,0,0,0,0,255,0,255,0,0,0,0,255,0,255, - 0,0,255,0,255,255,0,0,0,0,255,0,255,0,0,0,255,0,0,0,255,0,255,0,0,0,0,255, - 0,255,0,0,0,0,255,0,255,0,0,0,0,255,0,255,0,0,0,0,255,0,255,0,0,0,0,255, - 255,0,0,0,255,0,0,0,255,0,0,0,0,255,0,0,255,0,255,0,0,0,255,0,255,0,255, - 0,255,0,0,0,0,255,0,0,0,0,255,0,255,0,0,0,255,0,0,0,255,255,0,0,0,0,0,0, - 255,0,0,0,0,0,255,255,0,0,255,0,0,255,0,0,255,0,0,0,255,0,0,0,0,0,0,0,255, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,127,0,0,0,0,0,0,255,0,0,0,255,0,255,0, - 0,0,0,255,0,255,0,0,0,0,0,255,0,0,0,0,255,0,255,0,0,0,0,0,0,0,255,0,0,255, - 0,0,0,0,255,0,255,0,0,0,0,255,0,255,0,0,255,0,255,0,255,0,0,0,255,0,255, - 0,0,0,255,0,0,0,255,0,255,0,0,0,0,255,0,255,0,0,0,0,255,0,255,0,0,0,0,255, - 0,255,0,0,0,0,255,0,255,0,0,0,0,0,0,255,0,0,255,0,0,0,255,0,0,0,0,255,0, - 0,255,0,255,0,0,0,255,0,255,0,255,0,255,0,0,0,255,0,255,0,0,0,255,0,255, - 0,0,0,255,0,0,0,0,0,255,0,0,0,0,0,255,0,0,0,0,255,0,0,0,0,255,0,0,0,255, - 255,0,0,0,0,255,0,0,0,0,0,0,0,255,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,127, - 0,0,0,0,0,0,255,0,0,0,255,0,255,0,0,0,0,255,0,255,0,0,0,0,0,255,0,0,0,255, - 255,0,255,0,0,0,0,255,0,0,255,0,0,255,0,0,0,255,255,0,255,0,0,0,0,255,0, - 255,0,0,255,0,255,0,0,255,0,0,255,0,255,0,0,0,255,0,0,0,255,0,255,0,0,0, - 0,255,0,255,0,0,0,0,255,0,255,0,0,0,0,255,0,255,0,0,0,255,255,0,255,0,0, - 0,0,0,0,255,0,0,255,0,0,0,255,0,0,0,255,255,0,0,0,255,0,0,0,0,0,255,0,0, - 0,255,0,0,0,0,255,0,255,0,0,0,0,255,0,0,0,255,0,0,0,0,0,0,255,0,0,0,0,0, - 255,0,0,0,0,255,0,0,0,0,0,0,0,0,0,0,0,0,0,0,255,0,0,0,0,0,0,0,255,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,127,0,0,0,0,0,0,0,255,255,255,255,0,255,255, - 255,255,255,0,0,0,255,255,255,255,0,0,255,255,255,0,255,0,0,255,255,255, - 255,0,0,0,255,0,0,0,255,255,255,0,255,0,255,0,0,0,0,255,0,255,0,0,255,0, - 255,0,0,0,255,0,255,0,255,0,0,0,255,0,0,0,255,0,255,0,0,0,0,255,0,0,255, - 255,255,255,0,0,255,255,255,255,255,0,0,0,255,255,255,0,255,0,255,0,0,0, - 255,255,255,0,0,0,0,255,255,0,0,255,255,255,0,255,0,0,0,255,0,0,0,0,0,255, - 0,0,0,255,0,0,0,255,0,0,0,255,0,0,0,255,0,0,0,255,255,255,255,0,0,0,255, - 0,0,0,0,0,255,0,0,0,0,255,0,0,0,0,0,0,0,0,0,0,0,0,0,0,255,255,255,255,255, - 255,255,255,255,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,127,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,255,0,0,0,0,0,0,0,0,0,0,0,255,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,255,0,0,0,0,0,0,0,0,0,0,0,255,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,255,0,0,0,0,0,0,0,0,0,0,255,0,0,0,0,0,255,0,0,0,0,255,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,127, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,255,255,255,255,0,0,0,0,0,0,0,0,0,0,0,255,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,255,0,0,0,0,0,0,0, - 0,0,0,0,255,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,255,0,0,0,0,0,0,0,0,0,0,0,0,255,255,0,0,0, - 255,0,0,255,255,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,127,127,127,127,127,0,127,127,127,127,127,0, - 127,127,127,127,127,127,0,127,127,127,127,127,0,127,127,127,127,127,127, - 0,127,127,127,127,127,127,0,127,127,127,0,127,127,127,127,127,127,0,127, - 127,127,127,127,127,0,127,0,127,127,0,127,127,127,127,127,0,127,0,127,127, - 127,127,127,127,127,127,127,0,127,127,127,127,127,127,0,127,127,127,127, - 127,127,0,127,127,127,127,127,127,0,127,127,127,127,127,127,0,127,127,127, - 0,127,127,127,127,0,127,127,127,127,0,127,127,127,127,127,127,0,127,127, - 127,127,127,0,127,127,127,127,127,127,127,127,127,0,127,127,127,127,127, - 0,127,127,127,127,127,0,127,127,127,127,0,127,127,127,127,127,0,127,127, - 127,127,0,127,127,127,127,127,0,127,127,127,127,127,127,127,127,127,0,127, - 127,127,127,127,127,127,127,127,127,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,127, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,255,0,0,255,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,255,0,0,255,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,127,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,255,255,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,255,255,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,255,0,0,255,0,0,127,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,255,0,0,0,0,0,0,255,0, - 0,0,0,0,255,255,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,255,0,0,0,255,0,255,0,255, - 0,0,0,255,0,255,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,255, - 255,0,255,0,0,0,0,0,0,0,0,0,0,0,0,255,0,0,255,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,255,0,0,255,0,0,0,0,0,0,0,0,0,127,0,0,255, - 255,255,255,0,0,0,255,255,255,255,255,255,255,255,255,0,0,0,0,0,0,0,0,255, - 255,255,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,255,0,0,0,0,0,0,255,0,0,0,0, - 255,0,0,255,0,0,0,255,255,0,0,0,0,255,0,0,0,0,0,0,0,0,0,0,255,255,255,255, - 0,0,0,0,0,0,0,0,0,255,255,255,255,255,255,255,255,255,0,0,0,255,255,255, - 255,255,255,255,255,255,0,255,255,255,255,255,255,0,0,0,255,255,255,255, - 255,255,255,255,255,0,0,0,255,255,255,255,255,255,255,255,255,0,255,0,0, - 0,255,0,255,0,255,0,0,0,255,0,255,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,255,0,255,255,0,0,0,255,255,255,0,255,0,0,0,255,0,0,255,255, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,255,255,255,255,255,255,255,255, - 255,0,0,255,255,0,0,255,0,0,0,0,0,255,0,127,0,255,0,0,0,0,0,0,0,255,0,0, - 0,0,0,0,0,255,0,0,0,0,0,0,0,255,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,255, - 255,255,255,255,0,0,255,255,255,255,255,0,0,0,0,0,0,0,0,255,0,0,255,0,0, - 255,0,0,0,0,0,0,0,0,0,0,255,0,0,0,0,255,0,0,0,0,0,0,0,255,0,0,0,0,255,0, - 0,0,0,0,0,0,255,0,0,0,0,0,0,0,255,0,0,0,0,0,0,255,0,0,0,255,0,0,0,0,0,0, - 0,255,0,0,0,255,0,0,0,0,0,0,0,255,0,0,255,0,255,0,0,0,255,0,255,0,255,0, - 255,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 255,0,0,255,255,0,255,255,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,255,0,0,0,0,0,0,0,255,0,0,0,0,0,0,0,255,0,0,0,255,0,0,127,255,0,0,0,0, - 0,0,0,0,255,0,0,0,0,0,0,0,255,0,0,0,0,0,0,0,255,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,255,0,0,0,0,0,0,255,0,0,0,0,0,0,0,0,0,0,255,0,0,255,0, - 0,255,0,0,0,0,0,0,0,0,0,0,255,0,0,0,0,0,0,0,0,0,255,0,255,0,0,0,0,0,255, - 0,0,0,0,0,0,0,255,0,0,0,0,0,0,0,255,0,0,0,0,0,255,0,0,0,0,255,0,0,0,0,0, - 0,0,255,0,0,0,255,0,0,0,0,0,0,0,255,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,255,0,0,255, - 0,255,0,255,0,0,255,255,255,0,0,255,0,0,0,0,255,255,255,255,0,255,255,255, - 0,0,0,0,255,0,0,0,0,0,0,0,255,0,255,255,255,255,0,0,255,0,0,0,255,0,0,127, - 255,255,255,255,255,255,0,0,0,255,0,0,0,0,0,0,0,255,0,0,0,0,0,0,0,255,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,255,0,0,0,0,0,0,255,0,0,0,0,0,0, - 0,0,0,0,255,0,0,255,0,255,0,0,0,0,0,0,0,0,0,0,0,255,0,0,0,0,0,0,0,0,255, - 0,0,255,0,0,0,0,0,255,0,0,0,0,0,0,0,255,0,0,0,0,0,0,0,255,0,0,0,0,255,0, - 0,0,0,0,255,0,0,0,0,0,0,0,255,0,0,0,255,0,0,0,0,0,0,0,255,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,255,255,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,255,0,0,255,0,0,0,255,0,255,0,0,0,0,0,0,255,0,0,255,0,0, - 0,0,255,0,0,0,255,0,0,0,255,0,0,0,0,0,0,0,255,0,0,0,0,255,0,0,0,255,0,255, - 0,0,0,127,255,0,0,0,0,0,0,0,0,255,0,0,0,0,0,0,0,255,0,0,0,0,0,0,255,255, - 255,255,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,255,0,0,0,0,0,0,255,0,0,0, - 0,0,0,0,0,0,0,0,255,255,0,0,255,0,0,255,255,0,0,0,255,255,0,0,0,255,255, - 255,255,0,0,0,255,0,0,0,255,0,0,0,0,0,255,255,255,255,255,0,0,0,255,0,0, - 0,0,0,0,0,255,0,0,0,255,0,0,0,0,0,0,255,0,0,0,0,0,0,0,255,0,0,0,255,0,0, - 0,0,0,0,0,255,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,255,255,255,255,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,255,0, - 0,0,0,0,0,0,255,0,255,0,0,0,0,255,0,0,0,255,0,0,0,255,0,0,0,0,0,0,0,255, - 0,0,0,255,0,0,0,0,0,255,0,0,0,0,127,255,255,255,255,255,255,0,0,0,255,0, - 0,0,0,0,0,0,255,0,0,0,0,0,0,0,255,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,255,0,0,0,0,255,255,255,255,255,0,0,0,0,0,0,0,0,0,0,0,0,0,255,0,255, - 0,0,255,0,255,0,0,255,0,0,0,0,0,0,255,0,0,255,0,0,0,255,0,0,0,0,0,255,0, - 0,0,0,0,0,0,255,0,0,0,0,0,0,0,255,0,0,0,255,0,0,0,0,0,0,255,0,0,0,0,0,0, - 0,255,0,0,0,255,0,0,0,0,0,0,0,255,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,255, - 255,255,255,0,255,255,255,255,255,0,255,255,255,255,255,255,255,255,255, - 255,255,255,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,255,255,0,0,0,0,0,255, - 0,255,0,0,0,0,255,255,255,255,255,0,0,0,255,0,0,0,0,0,0,0,255,0,0,255,0, - 0,0,0,0,0,255,0,0,0,0,127,255,0,0,0,0,0,0,0,0,255,0,0,0,0,0,0,0,255,0,0, - 0,0,0,0,255,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,255,0,0,0,0,0,0, - 255,0,0,0,0,0,0,0,0,0,0,0,0,0,0,255,0,0,255,0,0,255,0,255,0,0,255,0,0,0, - 0,0,0,255,0,0,0,255,0,0,255,0,0,0,0,0,255,0,0,0,0,0,0,0,255,0,0,0,0,0,0, - 0,255,0,0,255,0,0,0,0,0,0,0,255,0,0,0,0,0,0,0,255,0,0,0,255,0,0,0,0,0,0, - 0,255,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,255,255,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,255,0,0,0,255, - 0,0,255,0,0,0,0,255,0,0,0,0,0,0,0,255,0,0,0,0,0,0,0,255,0,0,255,0,0,0,0, - 0,0,255,0,0,0,0,127,0,255,0,0,0,0,0,0,0,255,0,0,0,0,0,0,0,255,0,0,255,0, - 0,0,255,0,0,0,0,0,255,0,255,0,0,0,0,0,0,0,0,0,0,0,0,0,0,255,0,0,0,0,0,0, - 255,0,0,0,0,0,0,0,0,0,0,0,0,0,0,255,0,0,255,0,0,255,0,255,0,0,255,0,255, - 0,0,0,0,255,0,0,0,0,255,0,0,255,0,0,0,0,255,0,0,0,0,0,0,0,255,0,0,0,0,0, - 0,0,255,0,255,0,0,0,0,0,0,0,0,255,0,0,0,0,0,0,0,255,0,0,0,255,0,0,0,0,0, - 0,0,255,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,255,0,0,255,0, - 0,0,255,0,0,0,0,255,0,0,0,0,0,0,0,255,0,0,0,0,0,0,0,255,0,255,0,0,0,0,0, - 0,0,255,0,0,0,0,127,0,0,255,255,255,255,0,0,0,255,255,255,255,255,255,255, - 255,255,0,0,255,0,0,0,255,0,0,0,0,0,255,0,255,0,0,255,0,0,255,0,0,255,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,255,0,0,0,0,255,255,0, - 0,0,255,255,0,0,0,255,255,255,255,0,0,0,0,0,0,0,0,0,255,255,255,255,255, - 255,255,255,255,0,0,0,255,255,255,255,255,255,255,255,255,0,255,255,255, - 255,255,255,0,0,0,255,255,255,255,255,255,255,255,255,0,0,0,255,255,255, - 255,255,255,255,255,255,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,255, - 255,255,0,0,0,0,0,0,0,0,255,255,255,255,0,255,255,255,255,0,0,0,255,255, - 255,255,255,255,255,255,255,0,255,255,255,255,0,0,0,0,255,0,0,0,0,127,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,255,0,0,255,255,0,0,0,0,0,255,0,255, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,127,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,127,127,127,127,127,127,127,0,127,127,127,127,127,127,127, - 127,127,127,0,127,127,0,127,127,127,127,127,127,0,127,127,127,127,0,127, - 127,127,127,127,127,127,127,127,0,127,127,127,127,127,127,0,127,127,127, - 127,127,127,0,127,127,127,127,127,0,127,127,127,127,127,127,127,127,127, - 127,127,127,127,127,127,127,127,0,127,127,127,127,127,127,0,127,127,127, - 127,0,127,127,127,127,127,127,127,127,127,127,127,0,127,127,127,127,127, - 127,127,127,127,127,127,0,127,127,127,127,127,127,0,127,127,127,127,127, - 127,127,127,127,127,127,0,127,127,127,127,127,127,127,127,127,127,127,0, - 127,127,0,127,127,0,127,127,127,127,0,127,127,127,127,0,127,127,127,127, - 0,127,127,127,127,127,0,127,127,127,127,127,127,127,127,127,127,127,0,127, - 127,127,127,127,127,0,127,127,127,127,127,127,127,127,127,127,0,127,127, - 127,127,0,127,127,127,127,0,127,127,127,127,127,127,127,127,127,127,0,127, - 127,127,127,127,127,127,127,127,127,127,0,127,127,127,127,0,127,127,127, - 127,127,127,127,0,127,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,127,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,127,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,255,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,255,255,255,255,255,255,255,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,255,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,127,0,0,0,0,0,255,0,0,0, - 0,0,255,0,0,0,0,0,255,255,255,255,0,0,0,0,0,0,0,0,255,0,0,0,0,0,255,0,0, - 255,0,0,0,0,255,255,255,255,0,0,255,0,0,255,0,0,0,0,0,255,255,255,255,0, - 0,0,0,0,255,255,255,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,255, - 255,255,255,0,0,0,0,0,0,0,0,0,0,0,0,0,255,255,0,0,0,0,0,0,0,0,0,0,0,255, - 255,255,0,0,0,255,255,255,0,0,0,0,0,255,0,0,0,0,0,0,0,0,0,0,0,255,255,255, - 255,255,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,255,0,0,0,255,255,255,0,0,0,0,0,0, - 0,0,0,0,0,255,0,0,0,0,255,0,0,0,0,0,0,255,0,0,0,0,255,0,0,0,0,0,255,255, - 255,0,0,0,0,255,0,0,0,0,0,0,255,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,127,0,0,0,0,0,0,0,0,0,0,0,255,0,0,0,0,255,0,0,0,0,0,0,0,0,0,0, - 0,0,0,255,0,0,0,255,0,0,0,255,0,0,0,255,0,0,0,0,0,0,0,0,0,0,0,0,0,255,255, - 0,0,0,0,255,255,0,0,0,0,0,0,255,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,255,255,0,0,0,0,255,255,0,0,0,0,0,0,0,0,0,0,255,0,0,255,0,0,0,0,255, - 0,0,0,0,0,0,0,0,255,0,0,0,0,0,255,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,255,255, - 255,255,0,255,0,0,0,0,0,0,0,0,0,0,0,0,0,0,255,255,0,0,255,0,0,0,255,0,0, - 0,0,0,0,0,0,0,255,255,0,0,0,255,0,0,0,0,0,0,255,255,0,0,0,0,255,0,0,0,0, - 0,0,0,0,255,0,0,255,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,127,0,0,0,0,0,255,0,0,0,0,255,255,255,255,0,0,255,0,0,0,0, - 0,255,0,0,0,0,255,0,0,0,255,0,255,0,0,0,0,255,0,0,0,255,0,0,0,0,0,0,0,0, - 0,0,0,0,0,255,0,0,255,255,0,0,255,0,0,0,0,255,255,255,0,0,0,255,0,0,255, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,255,0,255,255,255,0,0,255,0,0,0,0,0,0,0,0, - 0,0,255,0,0,255,0,0,0,0,255,0,0,0,0,0,0,0,255,0,0,0,0,255,255,0,0,0,0,0, - 0,0,0,0,255,0,0,0,0,255,0,255,255,255,255,0,255,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,255,0,0,255,0,0,0,255,0,255,0,0,255,0,0,0,0,0,255,0,0,0,255,0,0,0, - 0,0,0,0,255,0,0,0,255,0,0,0,0,0,0,0,255,255,0,0,0,255,0,0,0,0,0,0,0,255, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,127,0,0,0,0,0,255,0,0, - 0,255,0,255,0,0,0,0,255,0,0,0,0,0,0,255,255,255,255,0,0,0,0,255,0,255,0, - 0,0,0,255,0,0,0,0,255,255,0,0,0,0,0,0,0,0,0,0,255,0,0,255,0,0,255,0,0,255, - 0,0,255,0,0,255,0,0,255,0,0,255,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,255,0,0,255, - 0,0,255,0,0,255,0,0,0,0,0,0,0,0,0,0,255,255,0,0,0,0,0,255,0,0,0,0,0,0,255, - 0,0,0,0,0,0,0,255,0,0,0,0,0,0,0,0,255,0,0,0,0,255,0,255,255,255,255,0,255, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,255,0,0,255,0,0,0,255,0,0,255,0,0,255,0,0, - 0,0,255,0,0,255,0,0,0,0,0,0,0,0,255,0,0,0,255,0,0,0,0,0,0,0,0,0,255,0,255, - 0,0,0,0,0,0,0,0,255,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,127, - 0,0,0,0,0,255,0,0,0,255,0,255,0,0,0,0,255,0,0,0,0,0,0,255,0,0,255,0,0,0, - 0,0,255,0,0,0,0,0,0,0,0,0,255,0,0,255,0,0,0,0,0,0,0,0,0,255,0,0,255,0,0, - 0,0,0,255,0,0,255,0,0,255,0,255,0,0,255,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 255,0,0,255,0,0,255,0,0,255,0,0,0,0,0,0,0,0,0,0,0,0,0,0,255,255,255,255, - 255,255,255,0,0,255,255,255,255,0,0,255,255,255,0,0,0,0,0,0,0,0,0,255,0, - 0,0,0,255,0,0,255,255,255,0,255,0,0,255,0,0,0,0,0,0,0,0,0,0,0,255,255,255, - 0,255,0,0,0,255,0,0,0,255,0,0,255,0,0,0,255,0,0,255,0,0,255,255,0,0,0,0, - 255,0,0,255,0,255,255,255,0,0,0,0,0,0,255,0,255,0,0,255,255,0,0,0,255,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,127,0,0,0,0,0,255,0,0, - 0,255,0,255,0,0,0,255,255,255,255,255,0,0,0,255,0,0,255,0,0,0,255,255,255, - 255,255,0,0,0,0,0,0,0,255,0,0,0,255,0,0,0,0,0,0,0,0,255,0,0,255,0,0,0,0, - 0,255,0,0,0,255,255,255,0,255,0,0,255,0,0,0,0,255,255,255,255,255,255,255, - 0,255,255,255,0,255,0,0,255,255,255,0,0,0,255,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,255,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,255,0,0,0,0,255, - 0,0,0,0,255,0,255,0,0,255,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,255,255,255,0, - 0,0,0,255,0,0,255,0,0,0,0,0,255,0,0,255,0,255,0,0,0,0,0,0,0,255,0,0,0,0, - 255,0,0,255,255,255,0,255,0,0,255,0,255,0,0,255,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,127,0,0,0,0,0,255,0,0,0,255,0,255,0,0,0,0, - 255,0,0,0,0,0,0,255,255,255,255,0,0,0,0,0,255,0,0,0,0,0,255,0,0,0,0,255, - 0,0,255,0,0,0,0,0,0,0,0,255,0,0,255,0,0,255,0,0,255,0,0,0,0,0,0,0,0,255, - 0,0,255,0,0,0,0,0,0,0,0,0,255,0,0,0,0,0,255,0,0,255,0,0,255,0,0,255,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,255,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,255,0,0,0,0,255,0,0,0,0,255,0,255,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,255,0,0,255,0,0,0,0,0,255,0,0,255,0,0,255,0,0,0,0,0, - 0,255,0,0,0,0,255,0,0,0,0,0,0,255,0,0,255,0,0,255,0,255,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,127,0,0,0,0,0,255,0,0,0,255,0,255, - 0,0,0,0,255,0,0,0,0,0,255,0,0,0,0,255,0,0,0,0,255,0,0,0,0,0,255,0,0,0,0, - 0,255,255,0,0,0,0,0,0,0,0,0,0,255,0,0,255,255,0,0,255,0,0,0,0,0,0,0,0,0, - 0,255,0,0,255,0,0,0,0,0,0,0,0,255,0,0,0,0,0,0,255,0,255,0,0,0,255,255,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,255,255,255,255,255,255,255,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,255,0,0,0,255,255,0,0,0,0,255,0,255,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,255,0,0,255,0,0,0,0,0,0,255,0,0,255, - 255,255,255,255,0,0,0,0,0,255,0,0,0,255,0,0,0,0,0,0,0,255,0,0,255,255,255, - 255,255,255,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,127, - 0,0,0,0,0,255,0,0,0,0,255,255,255,255,0,255,255,255,255,255,255,0,0,0,0, - 0,0,0,0,0,0,0,255,0,0,0,0,0,255,0,0,0,0,0,0,0,255,0,0,0,0,0,0,0,0,0,255, - 255,0,0,0,0,255,255,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,255,0,0, - 0,0,0,0,255,255,0,0,0,0,255,255,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,255,255,255,255,0,255,0,0,0, - 0,255,0,255,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,255,0,0,0,0,0,0,255,0,0,0,0,0,255,0,0,0,255,255,255,255,0,0,0,0,255, - 0,0,0,0,0,0,255,0,0,255,255,255,255,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,127,0,0,0,0,0,0,0,0,0,0,0,255,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,255,0,0,0,0,0,0,0,255,0,0,0,0,0,0,0,0,0,0,0,255,255, - 255,255,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,255,255,255,255,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,255,0,0,0,0,0,0,0,0,0,255,0,255,0,0,0, - 0,0,0,0,0,0,255,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,127,0,0,0,0,0,0,0,0,0,0,0,255, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,255,0,0,0,255,255,255, - 255,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,255,0,0,0,0,0,0,0, - 0,0,255,0,255,0,0,0,0,0,0,0,255,255,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,127, - 127,127,0,127,127,127,0,127,127,127,127,127,127,0,127,127,127,127,127,127, - 0,127,127,127,127,127,127,0,127,127,127,127,127,127,127,0,127,127,127,0, - 127,127,127,127,127,127,0,127,127,127,127,127,127,0,127,127,127,127,127, - 127,127,127,127,127,0,127,127,127,127,127,0,127,127,127,127,127,127,127, - 0,127,127,127,127,127,127,127,0,127,127,127,0,127,127,127,127,127,127,127, - 127,127,127,0,127,127,127,127,127,127,0,127,127,127,127,127,0,127,127,127, - 127,127,127,127,0,127,127,127,127,127,0,127,127,127,127,127,0,127,127,127, - 127,127,0,127,127,127,127,127,127,127,0,127,127,127,127,127,127,0,127,127, - 127,0,127,127,127,127,127,127,0,127,127,127,127,127,0,127,127,127,127,127, - 0,127,127,127,127,127,127,0,127,127,127,127,127,127,127,127,127,127,127, - 0,127,127,127,127,127,127,127,127,127,127,127,0,127,127,127,127,127,127, - 127,127,127,127,127,0,127,127,127,127,127,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,127,0,0,255,0,0,0,0,0,0,0,0,0,255,0,0,0,0,0,0,255,255, - 0,0,0,0,0,255,255,0,255,0,0,0,0,0,0,0,0,0,0,0,0,0,255,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,255,0,0,0,0,0,0,0,0,255,0,0,0,0,255,255,0, - 0,0,0,0,0,0,0,0,0,255,0,0,0,0,0,255,0,0,255,255,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,255,255,0,255,0,0,0,0,0,255,0,0,0,0,0,0,0,0,0,255,0,0,0,0,0,0,0,255, - 255,0,0,0,0,0,0,0,255,255,0,255,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,255,0,0,0,0,0,0,0,0,0,255,0,0,0,0,0,0,255,255,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,255,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,127,0,0,0,255,0,0,0,0,0,0,0,255,0,0,0,0,0,0,255,0,0,255,0,0,0, - 255,0,255,255,0,0,0,0,255,0,0,0,255,0,0,0,0,255,0,255,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,255,0,0,0,0,0,0,255,0,0,0,0,255,0,0,255,0, - 0,0,255,0,0,255,0,0,0,255,0,0,0,255,0,0,255,0,0,255,255,0,255,0,0,0,0,0, - 0,0,0,0,0,255,0,255,255,0,0,0,0,0,0,0,255,0,0,0,0,0,0,0,255,0,0,0,0,0,0, - 0,255,0,0,255,0,0,0,0,0,255,0,255,255,0,0,0,0,0,255,0,0,255,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,255,0,0,0,0,0,0,0,255,0,0,0,0,0,0,255, - 0,0,255,0,0,0,255,0,0,0,255,0,0,0,0,0,255,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,127,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,255,0,255,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,255,255,255,0,0,0,0,0,0,0,0,0,0,0,0,127,0,0,0,255,0,0,0,0,0,0,0,255,0, - 0,0,0,0,0,0,255,0,0,0,0,0,0,0,255,0,0,0,0,0,0,0,255,0,0,0,0,0,0,0,255,0, - 0,0,0,0,0,0,255,255,255,255,255,255,255,0,0,0,255,255,255,255,0,255,255, - 255,255,255,255,0,255,255,255,255,255,255,0,255,255,255,255,255,255,0,255, - 255,255,255,255,255,0,255,255,255,0,255,255,255,0,255,255,255,0,255,255, - 255,0,0,255,255,255,255,0,0,0,255,255,0,0,0,0,255,0,0,0,255,255,255,255, - 0,0,0,0,0,255,255,255,255,0,0,0,0,0,255,255,255,255,0,0,0,0,0,255,255,255, - 255,0,0,0,0,0,255,255,255,255,0,0,0,0,0,0,0,0,0,0,0,0,0,0,255,255,255,255, - 0,255,0,255,0,0,0,0,0,255,0,255,0,0,0,0,0,255,0,255,0,0,0,0,0,255,0,255, - 0,0,0,0,0,255,0,255,0,0,0,0,0,255,0,255,0,0,0,0,0,0,255,0,0,0,255,0,0,0, - 0,0,0,0,0,0,0,0,127,0,0,255,0,255,0,0,0,0,0,255,0,255,0,0,0,0,0,255,0,255, - 0,0,0,0,0,255,0,255,0,0,0,0,0,255,0,255,0,0,0,0,0,255,0,255,0,0,0,0,0,0, - 255,0,255,0,0,0,0,0,0,255,0,0,0,0,0,255,0,0,0,0,0,0,255,0,0,0,0,0,0,255, - 0,0,0,0,0,0,255,0,0,0,0,0,0,0,255,0,0,0,255,0,0,0,255,0,0,0,255,0,0,0,255, - 0,0,0,255,0,0,255,255,0,0,0,0,255,0,0,255,0,0,0,0,255,0,0,0,255,0,0,0,0, - 255,0,0,0,255,0,0,0,0,255,0,0,0,255,0,0,0,0,255,0,0,0,255,0,0,0,0,255,0, - 0,0,0,0,0,0,0,0,0,0,0,255,0,0,0,0,255,0,0,255,0,0,0,0,0,255,0,255,0,0,0, - 0,0,255,0,255,0,0,0,0,0,255,0,255,0,0,0,0,0,255,0,0,255,0,0,0,255,0,0,255, - 0,0,0,0,0,0,255,0,0,0,255,0,0,0,0,0,0,0,0,0,0,0,127,0,0,255,0,255,0,0,0, - 0,0,255,0,255,0,0,0,0,0,255,0,255,0,0,0,0,0,255,0,255,0,0,0,0,0,255,0,255, - 0,0,0,0,0,255,0,255,0,0,0,0,0,255,0,0,255,0,0,0,0,0,255,0,0,0,0,0,0,255, - 0,0,0,0,0,0,255,0,0,0,0,0,0,255,0,0,0,0,0,0,255,0,0,0,0,0,0,0,255,0,0,0, - 255,0,0,0,255,0,0,0,255,0,0,0,255,0,0,0,0,255,0,255,0,255,0,0,0,255,0,255, - 0,0,0,0,0,0,255,0,255,0,0,0,0,0,0,255,0,255,0,0,0,0,0,0,255,0,255,0,0,0, - 0,0,0,255,0,255,0,0,0,0,0,0,255,0,0,0,0,0,0,0,0,0,0,255,0,0,0,0,255,0,255, - 0,255,0,0,0,0,0,255,0,255,0,0,0,0,0,255,0,255,0,0,0,0,0,255,0,255,0,0,0, - 0,0,255,0,0,255,0,0,0,255,0,0,255,255,255,255,255,0,0,255,0,0,0,255,0,0, - 0,0,0,0,0,0,0,0,0,127,0,0,255,0,255,0,0,0,0,0,255,0,255,0,0,0,0,0,255,0, - 255,0,0,0,0,0,255,0,255,0,0,0,0,0,255,0,255,0,0,0,0,0,255,0,255,0,0,0,0, - 0,255,0,0,255,0,0,0,0,0,255,0,0,0,0,0,0,255,0,0,0,0,0,0,255,0,0,0,0,0,0, - 255,0,0,0,0,0,0,255,0,0,0,0,0,0,0,255,0,0,0,255,0,0,0,255,0,0,0,255,0,0, - 0,255,0,0,0,0,255,0,255,0,255,0,0,0,255,0,255,0,0,0,0,0,0,255,0,255,0,0, - 0,0,0,0,255,0,255,0,0,0,0,0,0,255,0,255,0,0,0,0,0,0,255,0,255,0,0,0,0,0, - 0,255,0,0,0,255,0,0,0,255,0,0,255,0,0,0,255,0,0,255,0,255,0,0,0,0,0,255, - 0,255,0,0,0,0,0,255,0,255,0,0,0,0,0,255,0,255,0,0,0,0,0,255,0,0,0,255,0, - 255,0,0,0,255,0,0,0,0,255,0,255,0,255,255,0,0,0,0,0,0,0,0,0,0,0,0,127,0, - 255,0,0,0,255,0,0,0,255,0,0,0,255,0,0,0,255,0,0,0,255,0,0,0,255,0,0,0,255, - 0,0,0,255,0,0,0,255,0,0,0,255,0,0,0,255,0,0,0,0,255,0,0,255,255,255,255, - 255,0,255,0,0,0,0,0,0,255,255,255,255,255,255,0,255,255,255,255,255,255, - 0,255,255,255,255,255,255,0,255,255,255,255,255,255,0,0,255,0,0,0,255,0, - 0,0,255,0,0,0,255,0,0,255,255,255,255,0,0,255,0,255,0,0,255,0,0,255,0,255, - 0,0,0,0,0,0,255,0,255,0,0,0,0,0,0,255,0,255,0,0,0,0,0,0,255,0,255,0,0,0, - 0,0,0,255,0,255,0,0,0,0,0,0,255,0,0,0,0,255,0,255,0,0,0,255,0,0,255,0,0, - 0,255,0,255,0,0,0,0,0,255,0,255,0,0,0,0,0,255,0,255,0,0,0,0,0,255,0,255, - 0,0,0,0,0,255,0,0,0,0,255,0,0,0,0,255,0,0,0,0,255,0,255,0,0,0,255,0,0,0, - 0,0,0,0,0,0,0,0,127,0,255,0,0,0,255,0,0,0,255,0,0,0,255,0,0,0,255,0,0,0, - 255,0,0,0,255,0,0,0,255,0,0,0,255,0,0,0,255,0,0,0,255,0,0,0,255,0,0,0,255, - 255,255,255,255,0,0,0,0,0,255,0,0,0,0,0,0,255,0,0,0,0,0,0,255,0,0,0,0,0, - 0,255,0,0,0,0,0,0,255,0,0,0,0,0,0,0,255,0,0,0,255,0,0,0,255,0,0,0,255,0, - 0,0,255,0,0,0,0,255,0,255,0,0,0,255,0,255,0,255,0,0,0,0,0,0,255,0,255,0, - 0,0,0,0,0,255,0,255,0,0,0,0,0,0,255,0,255,0,0,0,0,0,0,255,0,255,0,0,0,0, - 0,0,255,0,0,0,0,0,255,0,0,0,0,255,0,0,255,0,0,0,255,0,255,0,0,0,0,0,255, - 0,255,0,0,0,0,0,255,0,255,0,0,0,0,0,255,0,255,0,0,0,0,0,255,0,0,0,0,255, - 0,0,0,0,255,0,0,0,0,255,0,255,0,0,0,0,255,0,0,0,0,0,0,0,0,0,0,127,0,255, - 255,255,255,255,0,0,0,255,255,255,255,255,0,0,0,255,255,255,255,255,0,0, - 0,255,255,255,255,255,0,0,0,255,255,255,255,255,0,0,0,255,255,255,255,255, - 0,0,0,255,0,0,0,255,0,0,0,0,0,255,0,0,0,0,0,0,255,0,0,0,0,0,0,255,0,0,0, - 0,0,0,255,0,0,0,0,0,0,255,0,0,0,0,0,0,0,255,0,0,0,255,0,0,0,255,0,0,0,255, - 0,0,0,255,0,0,0,0,255,0,255,0,0,0,255,0,255,0,255,0,0,0,0,0,0,255,0,255, - 0,0,0,0,0,0,255,0,255,0,0,0,0,0,0,255,0,255,0,0,0,0,0,0,255,0,255,0,0,0, - 0,0,0,255,0,0,0,0,255,0,255,0,0,0,255,0,255,0,0,0,0,255,0,255,0,0,0,0,0, - 255,0,255,0,0,0,0,0,255,0,255,0,0,0,0,0,255,0,255,0,0,0,0,0,255,0,0,0,0, - 255,0,0,0,0,255,255,255,255,255,0,0,255,0,0,0,0,255,0,0,0,0,0,0,0,0,0,0, - 127,255,0,0,0,0,0,255,0,255,0,0,0,0,0,255,0,255,0,0,0,0,0,255,0,255,0,0, - 0,0,0,255,0,255,0,0,0,0,0,255,0,255,0,0,0,0,0,255,0,0,255,0,0,0,255,0,0, - 0,0,0,0,255,0,0,0,0,0,255,0,0,0,0,0,0,255,0,0,0,0,0,0,255,0,0,0,0,0,0,255, - 0,0,0,0,0,0,0,255,0,0,0,255,0,0,0,255,0,0,0,255,0,0,0,255,0,0,0,255,0,0, - 255,0,0,0,0,255,255,0,0,255,0,0,0,0,255,0,0,0,255,0,0,0,0,255,0,0,0,255, - 0,0,0,0,255,0,0,0,255,0,0,0,0,255,0,0,0,255,0,0,0,0,255,0,0,0,0,255,0,0, - 0,255,0,0,0,255,0,0,0,0,255,0,0,0,255,0,0,0,255,0,0,0,255,0,0,0,255,0,0, - 0,255,0,0,0,255,0,0,0,255,0,0,0,255,0,0,0,0,0,255,0,0,0,0,255,0,0,0,0,0, - 0,255,0,0,0,255,0,0,0,0,0,0,0,0,0,0,0,127,255,0,0,0,0,0,255,0,255,0,0,0, - 0,0,255,0,255,0,0,0,0,0,255,0,255,0,0,0,0,0,255,0,255,0,0,0,0,0,255,0,255, - 0,0,0,0,0,255,0,255,0,0,0,0,255,255,255,255,255,0,0,0,255,255,255,255,0, - 255,255,255,255,255,255,0,255,255,255,255,255,255,0,255,255,255,255,255, - 255,0,255,255,255,255,255,255,0,255,255,255,0,255,255,255,0,255,255,255, - 0,255,255,255,0,0,255,255,255,255,0,0,0,255,0,0,0,0,255,255,0,0,0,255,255, - 255,255,0,0,0,0,0,255,255,255,255,0,0,0,0,0,255,255,255,255,0,0,0,0,0,255, - 255,255,255,0,0,0,0,0,255,255,255,255,0,0,0,0,0,0,0,0,0,0,0,0,0,255,255, - 255,255,255,0,0,0,0,0,255,255,255,0,0,0,0,0,255,255,255,0,0,0,0,0,255,255, - 255,0,0,0,0,0,255,255,255,0,0,0,0,0,0,255,0,0,0,0,255,0,0,0,0,0,0,255,0, - 255,255,0,0,0,0,0,0,0,0,0,0,0,0,127,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,255,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,255,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,127,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,255,255,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,127,127,127,127,127,127, - 127,0,127,127,127,127,127,127,127,0,127,127,127,127,127,127,127,0,127,127, - 127,127,127,127,127,0,127,127,127,127,127,127,127,0,127,127,127,127,127, - 127,127,0,127,127,127,127,127,127,127,127,127,127,0,127,127,127,127,127, - 127,0,127,127,127,127,127,127,0,127,127,127,127,127,127,0,127,127,127,127, - 127,127,0,127,127,127,127,127,127,0,127,127,127,0,127,127,127,0,127,127, - 127,0,127,127,127,0,127,127,127,127,127,127,127,0,127,127,127,127,127,127, - 127,0,127,127,127,127,127,127,127,127,0,127,127,127,127,127,127,127,127, - 0,127,127,127,127,127,127,127,127,0,127,127,127,127,127,127,127,127,0,127, - 127,127,127,127,127,127,127,0,127,127,127,127,127,127,127,127,0,127,127, - 127,127,127,127,127,127,0,127,127,127,127,127,127,127,0,127,127,127,127, - 127,127,127,0,127,127,127,127,127,127,127,0,127,127,127,127,127,127,127, - 0,127,127,127,127,127,127,127,0,127,127,127,127,127,127,0,127,127,127,127, - 127,127,0,0,0,0,0,0,0,0,0,0,127,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,127,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,255,255,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,127,0,0,255,0,0,0,0,0,0,255,0,0, - 0,0,255,255,0,0,0,255,255,0,255,0,0,0,0,0,0,0,0,255,0,0,255,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,255,0,0,0,0,0,0,0,255,0,0,0,0,0,255,255,0,0, - 0,0,0,0,0,0,0,0,255,0,0,0,255,0,255,0,0,0,0,0,0,0,0,0,0,0,0,0,255,255,0, - 255,0,0,255,0,0,0,0,0,0,0,0,0,255,0,0,0,0,255,255,0,0,0,0,0,255,255,0,255, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,255,0,0,0,0,0,0,0, - 0,255,0,0,0,0,255,255,0,0,0,0,0,0,0,0,0,0,0,0,0,255,0,0,255,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,127,0,0,0,255,0,0,0,0,255,0,0,0,0,255, - 0,0,255,0,255,0,255,255,0,0,0,255,0,0,255,0,0,255,0,0,255,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,255,0,0,0,0,0,255,0,0,0,0,0,255,0,0,255,0,0, - 0,255,0,0,255,0,0,0,255,0,255,0,255,0,255,255,0,255,0,0,255,0,255,0,0,0, - 255,0,255,255,0,0,0,0,255,0,0,0,0,0,0,0,255,0,0,0,0,255,0,0,255,0,0,0,255, - 0,255,255,0,0,0,255,0,0,255,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 255,0,0,0,0,0,0,255,0,0,0,0,255,0,0,255,0,0,0,255,0,0,255,0,0,0,0,255,0, - 0,0,255,0,0,0,0,0,0,0,255,0,0,255,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,127,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,255,255,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,255,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,255,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,255,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 127,0,255,255,255,0,0,0,255,255,255,0,0,0,255,255,255,0,0,0,255,255,255, - 0,0,0,255,255,255,0,0,0,255,255,255,0,0,0,255,255,255,0,0,255,255,0,0,0, - 0,255,255,255,255,0,0,255,255,255,255,0,0,0,255,255,255,255,0,0,0,255,255, - 255,255,0,0,0,255,255,255,255,0,0,0,255,0,255,0,0,255,0,0,255,0,0,255,255, - 0,255,0,0,255,0,255,255,255,0,0,0,255,255,255,255,0,0,0,255,255,255,255, - 0,0,0,255,255,255,255,0,0,0,255,255,255,255,0,0,0,255,255,255,255,0,0,0, - 0,0,0,255,0,0,0,0,0,0,255,255,255,255,0,0,255,0,0,0,0,255,0,255,0,0,0,0, - 255,0,255,0,0,0,0,255,0,255,0,0,0,0,255,0,255,0,0,0,255,0,255,0,255,255, - 255,0,0,255,0,0,0,255,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,127,0,0,0,0,255,0,0,0,0,0, - 255,0,0,0,0,0,255,0,0,0,0,0,255,0,0,0,0,0,255,0,0,0,0,0,255,0,0,0,0,0,255, - 255,0,0,255,0,0,255,0,0,0,0,0,255,0,0,0,0,255,0,255,0,0,0,0,255,0,255,0, - 0,0,0,255,0,255,0,0,0,0,255,0,0,255,0,255,0,0,255,0,0,255,0,0,0,0,0,0,255, - 0,255,255,0,0,0,255,0,255,0,0,0,0,255,0,255,0,0,0,0,255,0,255,0,0,0,0,255, - 0,255,0,0,0,0,255,0,255,0,0,0,0,255,0,0,0,0,0,255,0,0,0,0,0,255,0,0,0,255, - 0,0,255,0,0,0,0,255,0,255,0,0,0,0,255,0,255,0,0,0,0,255,0,255,0,0,0,0,255, - 0,255,0,0,0,255,0,255,255,0,0,0,255,0,255,0,0,0,255,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,127,0,0,0,0,255,0,0,0,0,0,255,0,0,0,0,0,255,0,0,0,0,0,255,0,0,0,0,0, - 255,0,0,0,0,0,255,0,0,0,0,0,255,0,0,0,0,255,0,255,0,0,0,0,0,255,0,0,0,0, - 255,0,255,0,0,0,0,255,0,255,0,0,0,0,255,0,255,0,0,0,0,255,0,0,255,0,255, - 0,0,255,0,0,255,0,0,255,255,255,255,255,0,255,0,0,0,0,255,0,255,0,0,0,0, - 255,0,255,0,0,0,0,255,0,255,0,0,0,0,255,0,255,0,0,0,0,255,0,255,0,0,0,0, - 255,0,0,0,0,0,0,0,0,0,0,255,0,0,0,255,0,255,0,255,0,0,0,0,255,0,255,0,0, - 0,0,255,0,255,0,0,0,0,255,0,255,0,0,0,0,255,0,0,255,0,255,0,0,255,0,0,0, - 0,255,0,0,255,0,255,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,127,0,255,255,255,255,0,0, - 255,255,255,255,0,0,255,255,255,255,0,0,255,255,255,255,0,0,255,255,255, - 255,0,0,255,255,255,255,0,0,255,255,255,255,255,255,255,255,255,0,255,0, - 0,0,0,0,255,255,255,255,255,255,0,255,255,255,255,255,255,0,255,255,255, - 255,255,255,0,255,255,255,255,255,255,0,0,255,0,255,0,0,255,0,0,255,0,255, - 0,0,0,0,255,0,255,0,0,0,0,255,0,255,0,0,0,0,255,0,255,0,0,0,0,255,0,255, - 0,0,0,0,255,0,255,0,0,0,0,255,0,255,0,0,0,0,255,0,0,255,255,255,255,255, - 255,255,0,255,0,0,255,0,0,255,0,255,0,0,0,0,255,0,255,0,0,0,0,255,0,255, - 0,0,0,0,255,0,255,0,0,0,0,255,0,0,255,0,255,0,0,255,0,0,0,0,255,0,0,255, - 0,255,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,127,255,0,0,0,255,0,255,0,0,0,255,0,255, - 0,0,0,255,0,255,0,0,0,255,0,255,0,0,0,255,0,255,0,0,0,255,0,255,0,0,0,255, - 0,0,0,0,0,0,255,0,0,0,0,0,255,0,0,0,0,0,0,255,0,0,0,0,0,0,255,0,0,0,0,0, - 0,255,0,0,0,0,0,0,0,255,0,255,0,0,255,0,0,255,0,255,0,0,0,0,255,0,255,0, - 0,0,0,255,0,255,0,0,0,0,255,0,255,0,0,0,0,255,0,255,0,0,0,0,255,0,255,0, - 0,0,0,255,0,255,0,0,0,0,255,0,0,0,0,0,0,0,0,0,0,255,0,255,0,0,0,255,0,255, - 0,0,0,0,255,0,255,0,0,0,0,255,0,255,0,0,0,0,255,0,255,0,0,0,0,255,0,0,255, - 0,255,0,0,255,0,0,0,0,255,0,0,255,0,255,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,127,255, - 0,0,0,255,0,255,0,0,0,255,0,255,0,0,0,255,0,255,0,0,0,255,0,255,0,0,0,255, - 0,255,0,0,0,255,0,255,0,0,0,255,255,0,0,0,255,0,255,0,0,0,0,0,255,0,0,0, - 0,255,0,255,0,0,0,0,255,0,255,0,0,0,0,255,0,255,0,0,0,0,255,0,0,255,0,255, - 0,0,255,0,0,255,0,255,0,0,0,0,255,0,255,0,0,0,0,255,0,255,0,0,0,0,255,0, - 255,0,0,0,0,255,0,255,0,0,0,0,255,0,255,0,0,0,0,255,0,255,0,0,0,0,255,0, - 0,0,0,0,255,0,0,0,0,0,255,0,0,0,255,0,0,255,0,0,0,255,255,0,255,0,0,0,255, - 255,0,255,0,0,0,255,255,0,255,0,0,0,255,255,0,0,0,255,0,0,0,255,0,0,0,0, - 255,0,0,0,255,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,127,0,255,255,255,255,0,0,255, - 255,255,255,0,0,255,255,255,255,0,0,255,255,255,255,0,0,255,255,255,255, - 0,0,255,255,255,255,0,0,255,255,255,0,0,255,255,255,0,0,0,255,255,255,255, - 0,0,255,255,255,255,0,0,0,255,255,255,255,0,0,0,255,255,255,255,0,0,0,255, - 255,255,255,0,0,0,255,0,255,0,0,255,0,0,255,0,0,255,255,255,255,0,0,255, - 0,0,0,0,255,0,0,255,255,255,255,0,0,0,255,255,255,255,0,0,0,255,255,255, - 255,0,0,0,255,255,255,255,0,0,0,255,255,255,255,0,0,0,0,0,0,255,0,0,0,0, - 0,255,255,255,255,0,0,0,0,255,255,255,0,255,0,0,255,255,255,0,255,0,0,255, - 255,255,0,255,0,0,255,255,255,0,255,0,0,0,255,0,0,0,255,255,255,255,255, - 0,0,0,0,255,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,127,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 255,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,255,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,255,0,0, - 0,255,0,0,0,0,0,0,0,0,255,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,127,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,255,255,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,255,0,0,0,0,255,0,0,0,0,0,0,0,255,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,127, - 127,127,127,127,0,127,127,127,127,127,0,127,127,127,127,127,0,127,127,127, - 127,127,0,127,127,127,127,127,0,127,127,127,127,127,0,127,127,127,127,127, - 127,127,127,127,127,0,127,127,127,127,127,0,127,127,127,127,127,127,0,127, - 127,127,127,127,127,0,127,127,127,127,127,127,0,127,127,127,127,127,127, - 0,127,127,0,127,0,127,127,0,127,127,0,127,127,127,127,127,127,0,127,127, - 127,127,127,127,0,127,127,127,127,127,127,0,127,127,127,127,127,127,0,127, - 127,127,127,127,127,0,127,127,127,127,127,127,0,127,127,127,127,127,127, - 0,127,127,127,127,127,127,127,127,0,127,127,127,127,127,127,127,0,127,127, - 127,127,127,127,0,127,127,127,127,127,127,0,127,127,127,127,127,127,0,127, - 127,127,127,127,127,0,127,127,127,127,127,0,127,127,127,127,127,127,0,127, - 127,127,127,127,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 -}; - -// Normal font anti-aliased -const int FONT1AA_BM_W = 264; -const int FONT1AA_BM_H = 106; -static const unsigned char s_Font1AA[] = -{ - 127,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,4,4,0,0,0,0,0,0,0,0,0, - 0,0,0,4,4,0,0,0,0,0,0,0,0,127,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,4,4,0,0,0,0,0,0,0,0,0,0,0,0,4,4,0,0,0,0,0,0,0,0,127,0,0,0,0,0,0,0,0, - 59,241,97,206,166,0,0,0,0,0,0,0,0,0,0,0,0,0,168,34,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,89,251,89,0,0,89,255,125,89,255,125,0,0,0,0, - 7,199,34,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,138,166, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,4,4,0,0,0, - 0,0,0,0,0,0,0,0,0,4,4,0,0,0,0,0,0,0,0,127,0,0,0,0,0,138,225,21,59,238,42, - 206,125,0,0,0,0,7,199,34,89,166,0,0,0,0,168,34,0,0,0,175,255,255,166,0, - 0,7,202,89,0,0,0,0,59,245,255,251,89,0,0,0,59,238,34,0,12,232,89,0,0,89, - 247,34,0,59,245,206,199,124,255,125,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,7,202,89,0,12,235,255,247,34,0,0,0,0,12,232,89,0,0,12,235, - 255,255,251,89,0,7,206,255,255,255,125,0,0,0,0,138,251,89,0,0,59,245,255, - 255,255,251,89,0,0,89,255,255,166,0,89,255,255,255,255,255,201,0,0,59,245, - 255,255,125,0,0,12,235,255,247,34,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,89,255,255,255,247,34,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,4,4,0,0,0,0,0,0,0,0,0,0,0,0,4,4,0,0,0, - 0,0,0,0,0,127,0,0,0,0,0,138,225,21,59,238,34,175,125,0,0,0,0,59,192,0,172, - 89,0,0,59,245,255,255,251,89,89,247,34,12,228,34,0,138,166,0,0,0,0,12,235, - 125,0,175,225,21,0,0,59,238,34,0,138,201,0,0,0,0,175,166,0,0,0,89,255,201, - 0,0,0,0,0,0,7,202,89,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,59,215,21,0,175, - 166,0,138,201,0,0,7,206,255,251,89,0,0,59,192,0,0,138,247,34,59,192,0,0, - 89,251,89,0,0,59,245,251,89,0,0,59,241,89,0,0,0,0,0,89,247,34,0,0,0,0,0, - 0,0,7,206,166,0,7,206,125,0,89,247,34,7,206,166,0,138,225,21,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,12,232,89,0,0,0,0,0,0,0,0,0,0,0,175,166,0,0,0,0,0, - 0,0,89,125,0,0,175,201,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,4,4,0, - 0,0,0,0,0,0,0,0,0,0,0,4,4,0,0,0,0,0,0,0,0,127,0,0,0,0,0,138,225,21,12,206, - 21,175,125,0,0,89,255,255,255,255,255,255,166,59,241,89,168,34,138,125, - 89,225,21,7,202,89,12,228,34,0,0,0,0,12,232,89,0,138,201,0,0,0,12,206,21, - 7,202,89,0,0,0,0,59,215,21,59,245,206,199,124,255,125,0,0,0,0,7,202,89, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,138,166,0,12,232,89,0,59,238,34,0,0, - 0,59,241,89,0,0,0,0,0,0,59,241,89,0,0,0,0,59,241,89,0,12,232,132,241,89, - 0,0,59,241,89,0,0,0,0,7,206,125,0,0,0,0,0,0,0,0,89,247,34,0,12,232,89,0, - 12,232,89,59,241,89,0,59,241,89,0,138,247,34,0,0,138,247,34,0,0,0,0,0,12, - 235,247,34,0,0,0,0,0,0,0,0,0,0,0,0,0,138,255,166,0,0,0,0,0,0,0,0,0,138, - 225,21,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,4,4,0,0,0,0,0,0,0,0,0,0, - 0,0,4,4,0,0,0,0,0,0,0,0,127,0,0,0,0,0,138,225,21,0,0,0,0,0,0,0,0,0,172, - 89,59,192,0,0,59,238,34,168,34,0,0,89,247,34,12,228,34,138,166,0,0,0,0, - 0,0,138,251,159,247,34,0,0,0,0,0,0,59,238,34,0,0,0,0,7,202,89,0,0,7,199, - 34,0,0,0,0,0,0,7,202,89,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,7,202,89,0,59, - 241,89,0,59,241,89,0,0,0,59,241,89,0,0,0,0,0,0,89,247,34,0,0,0,0,138,201, - 0,7,206,125,59,241,89,0,0,59,245,255,255,251,89,0,12,235,255,255,255,125, - 0,0,0,0,7,206,166,0,0,0,175,251,89,138,201,0,59,241,89,0,12,235,125,0,138, - 247,34,0,0,138,247,34,0,0,0,59,245,247,34,0,0,0,0,7,206,255,255,255,255, - 255,255,125,0,0,0,0,138,255,201,0,0,0,0,0,0,89,251,89,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,4,4,0,0,0,0,0,0,0,0,0,0,0,0,4,4,0,0,0,0,0,0,0,0, - 127,0,0,0,0,0,138,201,0,0,0,0,0,0,0,0,0,12,206,21,138,125,0,0,7,206,255, - 247,34,0,0,0,175,255,255,166,59,215,21,175,255,255,125,0,0,138,171,206, - 166,0,175,201,0,0,0,0,89,201,0,0,0,0,0,0,175,125,0,0,0,0,0,0,0,0,12,235, - 255,255,255,255,255,255,125,0,0,0,0,138,255,255,251,89,0,0,0,0,0,59,215, - 21,0,59,241,89,0,59,241,89,0,0,0,59,241,89,0,0,0,0,0,12,235,166,0,0,0,138, - 255,255,125,0,175,201,0,59,241,89,0,0,0,0,0,0,175,247,34,59,241,89,0,89, - 247,34,0,0,0,89,247,34,0,0,0,89,255,255,255,125,0,12,235,166,0,59,245,125, - 0,0,0,0,0,0,0,0,0,0,0,175,225,21,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,89,251,89,0,0,7,206,225,21,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,4,4,0,0,0,0,0,0,0,0,0,0,0,0,4,4,0,0,0,0,0,0,0,0,127,0,0,0,0,0,89,201, - 0,0,0,0,0,0,0,12,235,255,255,255,255,255,225,21,0,0,0,175,255,251,89,0, - 0,0,0,0,175,125,89,225,21,59,238,34,89,225,21,12,235,166,175,166,0,0,0, - 0,89,201,0,0,0,0,0,0,175,125,0,0,0,0,0,0,0,0,0,0,0,7,202,89,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,138,166,0,0,59,241,89,0,59,241,89,0,0,0,59,241,89, - 0,0,0,0,12,235,166,0,0,0,0,0,0,59,241,97,206,255,255,255,255,255,125,0, - 0,0,0,0,59,241,89,59,238,34,0,12,235,125,0,0,12,235,125,0,0,0,12,232,89, - 0,59,245,125,0,89,255,255,232,241,89,0,0,0,0,0,0,0,0,0,0,0,0,59,245,247, - 34,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,138,255,201,0,0,0,0,7,206,125,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,4,4,0,0,0,0,0,0,0,0,0,0,0,0,4, - 4,0,0,0,0,0,0,0,0,127,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,138,125,12,206,21, - 0,0,0,0,0,168,34,175,166,0,0,0,0,59,215,21,138,201,0,12,228,34,138,225, - 21,0,12,235,251,89,0,0,0,0,59,215,21,0,0,0,0,12,232,89,0,0,0,0,0,0,0,0, - 0,0,0,7,202,89,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,7,202,89,0,0,12,232,89,0, - 59,238,34,0,0,0,59,241,89,0,0,0,12,235,166,0,0,0,0,0,0,0,12,235,125,0,0, - 0,59,241,89,0,0,0,0,0,0,59,241,89,12,232,89,0,12,232,89,0,0,138,225,21, - 0,0,0,59,238,34,0,7,206,166,0,0,0,0,89,225,21,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,12,235,247,34,0,0,7,206,255,255,255,255,255,255,125,0,0,138,255,166,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,4,4,0,0,0, - 0,0,0,0,0,0,0,0,0,4,4,0,0,0,0,0,0,0,0,127,0,0,0,0,0,138,225,21,0,0,0,0, - 0,0,0,0,172,89,89,166,0,0,0,89,166,0,168,42,206,125,0,0,0,7,202,89,0,89, - 225,21,59,238,34,89,251,89,0,0,175,255,201,0,0,0,0,7,202,89,0,0,0,0,59, - 215,21,0,0,0,0,0,0,0,0,0,0,0,7,202,89,0,0,0,0,138,247,34,0,0,0,0,0,7,206, - 201,0,12,228,34,0,0,0,175,166,0,138,201,0,0,0,0,59,241,89,0,0,12,235,166, - 0,0,0,0,89,166,0,0,89,251,89,0,0,0,59,241,89,0,0,59,192,0,0,175,225,21, - 0,175,201,0,138,225,21,0,12,235,125,0,0,0,0,12,235,166,0,59,241,89,0,0, - 0,7,206,166,0,0,138,247,34,0,0,59,245,125,0,0,0,0,0,0,0,12,232,89,0,0,0, - 0,0,0,0,0,0,0,0,175,166,0,0,0,0,0,0,0,0,7,206,166,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,4,4,0,0,0,0,0,0,0,0,0,0,0,0,4,4,0,0,0,0,0,0,0,0, - 127,0,0,0,0,0,138,225,21,0,0,0,0,0,0,0,12,206,21,138,125,0,0,0,12,235,255, - 255,255,166,0,0,0,0,138,201,0,0,0,175,255,255,125,0,0,138,255,255,255,125, - 12,235,247,0,0,0,0,138,201,0,0,0,0,175,166,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,7,206,166,0,0,0,0,0,0,7,206,201,0,89,201,0,0,0,0,12,235,255,247, - 34,0,0,7,206,255,255,255,225,21,89,255,255,255,255,255,166,59,245,255,255, - 251,89,0,0,0,0,59,241,89,0,0,12,235,255,255,225,21,0,0,12,235,255,251,89, - 0,0,175,225,21,0,0,0,0,0,59,245,255,255,125,0,0,89,255,255,166,0,0,0,138, - 247,34,0,0,138,225,21,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,7,206,166,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,4,4, - 0,0,0,0,0,0,0,0,0,0,0,0,4,4,0,0,0,0,0,0,0,0,127,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,168,34,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,12,232,89,0,0,59,238,34,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,59,241,89,0,0,0,0,0,0,0,0,0,0,175,125,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,7,206,125, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,4,4,0,0,0,0,0,0,0,0,0,0,0,0, - 4,4,0,0,0,0,0,0,0,0,127,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,168,34,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,89, - 255,125,89,255,125,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,89,201,0,0,0,0, - 0,0,0,0,0,0,12,228,34,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,12,228,34,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,0,0,0,0,0,0,0,0,0, - 127,127,127,127,0,127,127,0,127,127,127,127,127,0,127,127,127,127,127,127, - 127,127,0,127,127,127,127,127,127,0,127,127,127,127,127,127,127,127,127, - 127,127,127,0,127,127,127,127,127,127,127,127,0,127,127,0,127,127,127,127, - 0,127,127,127,127,0,127,127,127,127,127,127,127,0,127,127,127,127,127,127, - 127,127,0,127,127,127,0,127,127,127,127,0,127,127,127,0,127,127,127,127, - 0,127,127,127,127,127,127,127,0,127,127,127,127,127,127,0,127,127,127,127, - 127,127,0,127,127,127,127,127,127,0,127,127,127,127,127,127,127,0,127,127, - 127,127,127,127,0,127,127,127,127,127,127,0,127,127,127,127,127,127,127, - 0,127,127,127,127,127,127,0,127,127,127,127,127,127,0,127,127,127,127,0, - 127,127,127,127,127,0,127,127,127,127,127,127,127,127,0,127,127,127,127, - 127,127,127,127,127,0,127,127,127,127,127,127,127,127,0,127,127,127,127, - 127,127,127,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,127,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,127,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,127,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,12,235,255,255,125,138,166,0,0,0,89,255,255,247, - 34,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,127,0,0,0,89,255,255, - 255,255,166,0,0,0,0,0,12,235,225,21,0,0,59,245,255,255,255,251,89,0,0,0, - 59,245,255,255,251,89,59,245,255,255,255,247,34,0,0,59,245,255,255,255, - 255,127,81,245,255,255,255,255,127,0,0,59,245,255,255,255,166,0,59,241, - 89,0,0,0,59,241,89,89,255,255,255,125,7,206,255,251,89,59,241,89,0,0,89, - 255,166,59,241,89,0,0,0,0,59,245,225,21,0,0,7,206,251,89,59,245,247,34, - 0,0,59,241,89,0,0,138,255,255,255,166,0,0,59,245,255,255,255,225,21,0,0, - 0,138,255,255,255,166,0,0,59,245,255,255,255,251,89,0,0,0,59,245,255,255, - 201,89,255,255,255,255,255,255,255,125,59,241,89,0,0,0,59,241,97,206,166, - 0,0,0,0,175,201,175,201,0,0,7,206,201,0,0,0,175,171,206,225,21,0,0,59,245, - 166,245,125,0,0,0,89,251,89,89,255,255,255,255,255,127,0,228,34,0,0,59, - 215,21,0,0,0,0,12,228,34,0,0,0,59,245,201,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,127,0,0,175,225,21,0,0,0,175,225,21,0,0,0,89,232,241,89,0,0,59, - 241,89,0,0,138,225,21,0,89,255,125,0,0,59,192,59,241,89,0,0,175,251,89, - 0,59,241,89,0,0,0,0,59,241,89,0,0,0,0,0,89,255,125,0,0,7,199,34,59,241, - 89,0,0,0,59,241,89,0,59,241,89,0,0,0,59,241,89,59,241,89,0,59,241,89,0, - 59,241,89,0,0,0,0,59,245,255,125,0,0,89,255,251,89,59,245,255,201,0,0,59, - 241,89,0,138,251,89,0,12,235,166,0,59,241,89,0,7,206,225,21,0,138,251,89, - 0,12,235,166,0,59,241,89,0,0,138,247,34,0,12,235,125,0,7,176,21,0,0,59, - 241,89,0,0,0,59,241,89,0,0,0,59,241,89,138,225,21,0,0,12,235,125,89,225, - 21,0,59,245,247,34,0,12,232,89,12,235,166,0,7,206,166,0,89,247,34,0,7,206, - 125,0,0,0,0,0,7,206,166,12,228,34,0,0,7,202,89,0,0,0,0,12,228,34,0,0,12, - 235,133,206,166,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,127,0,138,201,0,138, - 255,255,255,125,138,166,0,0,7,206,166,175,166,0,0,59,241,89,0,0,89,247, - 34,7,206,166,0,0,0,0,0,59,241,89,0,0,0,175,225,21,59,241,89,0,0,0,0,59, - 241,89,0,0,0,0,7,206,166,0,0,0,0,0,0,59,241,89,0,0,0,59,241,89,0,59,241, - 89,0,0,0,59,241,89,59,241,89,59,241,89,0,0,59,241,89,0,0,0,0,59,241,159, - 225,21,0,175,166,241,89,59,241,132,241,89,0,59,241,89,12,235,166,0,0,0, - 89,247,34,59,241,89,0,0,89,247,34,12,235,166,0,0,0,89,247,34,59,241,89, - 0,0,59,241,89,0,59,238,34,0,0,0,0,0,0,59,241,89,0,0,0,59,241,89,0,0,0,59, - 241,89,59,241,89,0,0,89,225,21,59,241,89,0,89,206,202,89,0,59,238,34,0, - 89,251,89,138,225,21,0,0,175,201,0,138,225,21,0,0,0,0,0,175,225,21,12,228, - 34,0,0,0,138,166,0,0,0,0,12,228,34,0,7,206,166,0,12,235,125,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,127,7,202,89,89,225,21,7,206,125,12,206,21,0,59,238, - 34,89,247,34,0,59,241,89,0,0,175,201,0,59,241,89,0,0,0,0,0,59,241,89,0, - 0,0,59,241,89,59,241,89,0,0,0,0,59,241,89,0,0,0,0,59,241,89,0,0,0,0,0,0, - 59,241,89,0,0,0,59,241,89,0,59,241,89,0,0,0,59,241,89,59,241,102,232,89, - 0,0,0,59,241,89,0,0,0,0,59,241,102,232,89,59,215,81,241,89,59,241,89,138, - 225,21,59,241,89,59,241,89,0,0,0,59,241,89,59,241,89,0,7,206,201,0,59,241, - 89,0,0,0,59,241,89,59,241,89,0,0,175,201,0,0,12,235,166,0,0,0,0,0,0,59, - 241,89,0,0,0,59,241,89,0,0,0,59,241,89,7,206,166,0,0,175,166,0,7,206,125, - 0,175,125,175,166,0,138,201,0,0,0,175,255,251,89,0,0,0,59,245,166,241,89, - 0,0,0,0,0,89,247,34,0,12,228,34,0,0,0,89,201,0,0,0,0,12,228,34,12,235,201, - 0,0,0,59,245,166,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,127,59,215,21,175,125, - 0,7,206,125,7,199,34,0,138,201,0,12,235,125,0,59,245,255,255,255,247,34, - 0,59,241,89,0,0,0,0,0,59,241,89,0,0,0,59,241,89,59,245,255,255,255,255, - 127,59,245,255,255,255,255,127,59,241,89,0,0,0,0,0,0,59,245,255,255,255, - 255,255,251,89,0,59,241,89,0,0,0,59,241,89,59,245,255,247,34,0,0,0,59,241, - 89,0,0,0,0,59,241,89,138,201,175,166,59,241,89,59,241,89,12,235,125,59, - 241,89,59,241,89,0,0,0,12,235,125,59,245,255,255,255,201,0,0,59,241,89, - 0,0,0,12,235,125,59,245,255,255,255,125,0,0,0,0,59,245,255,255,125,0,0, - 0,59,241,89,0,0,0,59,241,89,0,0,0,59,241,89,0,138,225,21,59,241,89,0,0, - 175,201,7,202,89,89,201,0,175,166,0,0,0,12,235,166,0,0,0,0,0,138,255,166, - 0,0,0,0,0,59,245,125,0,0,12,228,34,0,0,0,12,228,34,0,0,0,12,228,34,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,127,59,215,21,175,125,0,7, - 206,125,7,199,34,7,206,125,0,0,175,201,0,59,241,89,0,0,89,247,34,59,241, - 89,0,0,0,0,0,59,241,89,0,0,0,59,241,89,59,241,89,0,0,0,0,59,241,89,0,0, - 0,0,59,241,89,0,59,245,255,251,89,59,241,89,0,0,0,59,241,89,0,59,241,89, - 0,0,0,59,241,89,59,241,89,175,225,21,0,0,59,241,89,0,0,0,0,59,241,89,12, - 235,247,34,59,241,89,59,241,89,0,89,247,94,241,89,59,241,89,0,0,0,59,241, - 89,59,241,89,0,0,0,0,0,59,241,89,0,0,0,59,241,89,59,241,89,12,235,166,0, - 0,0,0,0,0,0,138,251,89,0,0,59,241,89,0,0,0,59,241,89,0,0,0,59,241,89,0, - 12,232,89,138,225,21,0,0,89,225,81,215,21,12,228,47,232,89,0,0,0,175,255, - 251,89,0,0,0,0,59,241,89,0,0,0,0,7,206,201,0,0,0,12,228,34,0,0,0,0,175, - 125,0,0,0,12,228,34,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,127, - 12,228,34,89,201,0,7,206,125,59,215,21,59,245,255,255,255,255,247,34,59, - 241,89,0,0,59,241,89,7,206,166,0,0,0,0,0,59,241,89,0,0,0,138,225,21,59, - 241,89,0,0,0,0,59,241,89,0,0,0,0,7,206,166,0,0,0,59,241,89,59,241,89,0, - 0,0,59,241,89,0,59,241,89,0,0,0,59,241,89,59,241,89,7,206,201,0,0,59,241, - 89,0,0,0,0,59,241,89,0,175,166,0,59,241,89,59,241,89,0,7,206,200,241,89, - 12,235,166,0,0,0,89,247,34,59,241,89,0,0,0,0,0,12,235,166,0,0,0,89,247, - 34,59,241,89,0,59,245,125,0,0,0,0,0,0,12,232,89,0,0,59,241,89,0,0,0,12, - 232,89,0,0,0,59,238,34,0,0,175,171,206,166,0,0,0,12,232,159,201,0,7,202, - 132,215,21,0,0,89,247,34,175,225,21,0,0,0,59,241,89,0,0,0,0,138,225,21, - 0,0,0,12,228,34,0,0,0,0,89,201,0,0,0,12,228,34,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,127,0,138,201,7,206,255,251,226,255,255,166,0, - 138,201,0,0,0,12,235,125,59,241,89,0,0,138,247,34,0,89,255,125,0,0,59,192, - 59,241,89,0,0,138,251,89,0,59,241,89,0,0,0,0,59,241,89,0,0,0,0,0,89,255, - 125,0,0,59,241,89,59,241,89,0,0,0,59,241,89,0,59,241,89,0,0,0,89,247,34, - 59,241,89,0,12,235,166,0,59,241,89,0,0,0,0,59,241,89,0,0,0,0,59,241,89, - 59,241,89,0,0,59,245,251,89,0,138,251,89,0,59,245,166,0,59,241,89,0,0,0, - 0,0,0,138,251,89,0,59,245,166,0,59,241,89,0,0,138,251,89,0,89,166,0,0,89, - 247,34,0,0,59,241,89,0,0,0,0,138,225,21,0,7,206,166,0,0,0,89,255,251,89, - 0,0,0,7,206,255,125,0,0,138,255,201,0,0,12,235,125,0,12,235,166,0,0,0,59, - 241,89,0,0,0,89,251,89,0,0,0,0,12,228,34,0,0,0,0,12,228,34,0,0,12,228,34, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,127,0,7,206,225,21,0, - 0,0,0,0,0,7,206,125,0,0,0,0,175,201,59,245,255,255,255,247,34,0,0,0,59, - 245,255,255,251,89,59,245,255,255,255,225,21,0,0,59,245,255,255,255,255, - 127,81,241,89,0,0,0,0,0,0,59,245,255,255,255,201,0,59,241,89,0,0,0,59,241, - 89,89,255,255,255,138,235,255,255,125,0,59,241,89,0,0,89,255,201,59,245, - 255,255,255,255,166,59,241,89,0,0,0,0,59,241,89,59,241,89,0,0,0,175,251, - 89,0,0,138,255,255,255,166,0,0,59,241,89,0,0,0,0,0,0,0,138,255,255,255, - 166,0,0,59,241,89,0,0,0,175,251,89,12,235,255,255,251,89,0,0,0,59,241,89, - 0,0,0,0,0,59,245,255,251,89,0,0,0,0,12,235,201,0,0,0,0,0,138,251,89,0,0, - 89,255,125,0,7,206,225,21,0,0,89,255,125,0,0,59,241,89,0,0,0,175,255,255, - 255,255,255,127,0,228,34,0,0,0,0,0,175,125,0,0,12,228,34,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,127,0,0,0,89,255,255,255,255,125,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,59,241,89,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,12, - 228,34,0,0,0,0,0,89,201,0,0,12,228,34,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,127,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,138,255,255,125,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,12,235,255,255,125,0,0,0,12,228, - 124,255,255,247,34,0,0,0,0,0,0,0,0,0,245,255,255,255,255,255,255,0,0,0, - 0,0,0,0,0,0,0,127,127,127,127,127,127,127,127,127,127,127,0,127,127,127, - 127,127,127,127,0,127,127,127,127,127,127,127,0,127,127,127,127,127,127, - 127,0,127,127,127,127,127,127,127,127,0,127,127,127,127,127,127,0,127,127, - 127,127,127,127,0,127,127,127,127,127,127,127,127,0,127,127,127,127,127, - 127,127,127,0,127,127,127,127,0,127,127,127,127,0,127,127,127,127,127,127, - 127,0,127,127,127,127,127,127,0,127,127,127,127,127,127,127,127,127,0,127, - 127,127,127,127,127,127,127,0,127,127,127,127,127,127,127,127,0,127,127, - 127,127,127,127,127,0,127,127,127,127,127,127,127,127,0,127,127,127,127, - 127,127,127,127,0,127,127,127,127,127,127,0,127,127,127,127,127,127,127, - 0,127,127,127,127,127,127,127,127,0,127,127,127,127,127,127,127,0,127,127, - 127,127,127,127,127,127,127,127,127,0,127,127,127,127,127,127,127,0,127, - 127,127,127,127,127,127,0,127,127,127,127,127,127,0,127,127,127,127,0,127, - 127,127,127,0,127,127,127,127,127,0,127,127,127,127,127,127,127,0,127,127, - 127,127,127,127,0,0,0,0,0,0,0,0,0,0,127,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,127,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,4,4,4,4,4,4,4,4,4,4,4,4,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,127,0,89,255,125,0,0,0,0,0,0,0,0,0,0,59,241,89,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,59,241,89,0,0,0,0,0,0,0,0,89,255,255,166,0,0,0,0,0, - 0,0,59,241,89,0,0,0,0,0,0,0,0,0,0,0,59,241,89,0,0,0,0,59,241,89,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,175,255,201,0,12,228, - 34,0,0,89,255,247,34,0,0,0,0,0,0,0,0,0,0,0,0,0,4,4,4,4,4,4,4,4,4,116,116, - 4,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,127,0,0,59,241,89,0,0,0,0,0,0,0,0,0,59,241,89,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,59,241,89,0,0,0,0,0,0,0,12,235,125,0,0,0,0,0,0, - 0,0,0,59,241,89,0,0,0,0,59,241,89,0,89,251,89,59,241,89,0,0,0,0,59,241, - 89,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,59,241,89,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,89,225, - 21,0,0,12,228,34,0,0,0,0,138,201,0,0,0,0,0,0,0,0,0,0,0,0,0,4,4,4,4,4,4, - 4,4,28,244,252,52,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,127,0,0,0,0,0,0,0,0,0,0,0,0,0,0,59, - 241,89,0,0,0,0,0,0,0,0,0,0,0,0,0,0,59,241,89,0,0,0,0,0,0,0,59,241,89,0, - 0,0,0,0,0,0,0,0,59,241,89,0,0,0,0,0,0,0,0,0,0,0,59,241,89,0,0,0,0,59,241, - 89,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,59,241,89,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,138,166, - 0,0,0,12,228,34,0,0,0,0,89,225,21,0,0,0,0,0,0,0,0,0,0,0,0,4,4,4,4,4,4,4, - 4,180,252,164,4,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,127,0,0,0,0,0,0,0,7,206,255,255,255, - 125,0,59,241,194,255,251,89,0,0,7,206,255,255,201,0,12,235,255,255,251, - 89,0,12,235,255,251,89,7,206,255,255,247,34,0,12,235,255,255,251,89,59, - 241,194,255,255,125,0,59,241,89,89,255,251,89,59,241,89,0,138,251,89,59, - 241,89,59,241,159,255,255,125,89,255,255,166,0,59,241,194,255,255,125,0, - 0,0,12,235,255,247,34,0,59,241,194,255,255,125,0,0,12,235,255,255,251,89, - 59,241,159,255,201,0,138,255,255,247,34,206,255,255,255,166,59,241,89,0, - 59,241,97,206,166,0,0,12,235,125,175,201,0,7,206,166,0,7,206,133,206,225, - 21,0,89,255,255,166,0,0,12,235,125,138,255,255,255,255,166,0,0,138,166, - 0,0,0,12,228,34,0,0,0,0,89,225,21,0,0,0,0,0,0,0,0,0,0,0,0,4,4,4,4,4,4,4, - 76,252,244,20,4,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,127,0,0,0,0,0,0,0,0,0,0,0,89,247,34, - 59,245,166,0,138,225,21,7,206,201,0,0,0,7,206,166,0,59,241,89,7,206,125, - 0,89,225,21,59,241,89,0,0,7,206,166,0,59,241,89,59,245,166,0,89,247,34, - 59,241,89,0,59,241,89,59,241,89,138,225,21,0,59,241,89,59,245,201,0,89, - 255,201,0,89,247,34,59,245,166,0,89,247,34,0,7,206,166,0,138,225,21,59, - 245,166,0,138,247,34,7,206,166,0,59,241,89,59,245,201,0,0,59,238,34,0,130, - 34,59,241,89,0,0,59,241,89,0,59,241,89,89,247,34,0,89,247,34,138,225,21, - 12,235,225,21,12,232,89,7,206,166,12,235,125,89,247,34,0,89,247,34,0,0, - 0,89,247,34,0,0,138,166,0,0,0,12,228,34,0,0,0,0,89,225,21,0,0,7,206,247, - 34,0,0,89,201,0,0,4,4,68,12,4,4,4,220,252,108,4,4,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,127, - 0,0,0,0,0,0,0,0,0,0,0,59,241,89,59,241,89,0,59,241,89,59,241,89,0,0,0,59, - 241,89,0,59,241,89,59,238,34,0,59,238,34,59,241,89,0,0,59,241,89,0,59,241, - 89,59,241,89,0,59,241,89,59,241,89,0,59,241,89,59,241,159,201,0,0,0,59, - 241,89,59,241,89,0,59,241,89,0,59,241,89,59,241,89,0,59,241,89,0,59,241, - 89,0,59,241,89,59,241,89,0,59,241,89,59,241,89,0,59,241,89,59,241,89,0, - 0,59,241,89,0,0,0,59,241,89,0,0,59,241,89,0,59,241,89,12,235,125,0,175, - 166,0,59,238,34,89,171,202,89,89,225,21,0,59,241,226,201,0,12,235,125,0, - 175,166,0,0,0,12,235,125,0,0,59,238,34,0,0,0,12,228,34,0,0,0,0,7,206,125, - 0,7,202,89,12,235,166,0,175,125,0,0,4,60,244,172,4,4,132,252,212,4,4,4, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,127,0,0,0,0,0,0,0,0,89,255,255,255,251,89,59,241,89, - 0,59,241,89,59,238,34,0,0,0,59,238,34,0,59,241,89,59,245,255,255,255,251, - 0,59,241,89,0,0,59,238,34,0,59,241,89,59,241,89,0,59,241,89,59,241,89,0, - 59,241,89,59,245,255,225,21,0,0,59,241,89,59,241,89,0,59,241,89,0,59,241, - 89,59,241,89,0,59,241,89,0,59,238,34,0,12,232,89,59,241,89,0,12,232,89, - 59,238,34,0,59,241,89,59,241,89,0,0,0,175,255,255,201,0,59,241,89,0,0,59, - 241,89,0,59,241,89,0,175,201,12,232,89,0,7,206,125,172,89,138,166,138,201, - 0,0,0,138,247,34,0,0,175,201,12,232,89,0,0,7,206,166,0,0,175,225,21,0,0, - 0,0,12,228,34,0,0,0,0,0,0,175,225,34,206,21,0,0,175,255,166,0,0,0,4,52, - 244,252,140,36,244,252,60,4,4,4,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,127,0,0,0,0,0,0,0,59, - 241,89,0,59,241,89,59,241,89,0,59,238,34,59,241,89,0,0,0,59,241,89,0,59, - 241,89,59,238,34,0,0,0,0,59,241,89,0,0,59,241,89,0,59,241,89,59,241,89, - 0,59,241,89,59,241,89,0,59,241,89,59,241,97,206,201,0,0,59,241,89,59,241, - 89,0,59,241,89,0,59,241,89,59,241,89,0,59,241,89,0,59,241,89,0,59,241,89, - 59,241,89,0,59,241,89,59,241,89,0,59,241,89,59,241,89,0,0,0,0,0,59,245, - 125,59,241,89,0,0,59,241,89,0,59,241,89,0,59,238,124,225,21,0,0,175,176, - 206,21,59,215,187,125,0,0,59,245,255,201,0,0,89,247,124,225,21,0,0,138, - 225,21,0,0,0,59,241,89,0,0,0,12,228,34,0,0,0,0,12,235,125,0,0,0,0,0,0,0, - 0,0,0,0,0,4,4,76,252,252,220,252,164,4,4,4,4,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,127,0, - 0,0,0,0,0,0,89,247,34,0,89,251,89,59,241,89,0,175,201,0,7,206,201,0,0,0, - 7,206,166,0,138,251,89,7,206,166,0,7,199,34,59,241,89,0,0,7,206,166,0,138, - 251,89,59,241,89,0,59,241,89,59,241,89,0,59,241,89,59,241,89,12,235,166, - 0,59,241,89,59,241,89,0,59,241,89,0,59,241,89,59,241,89,0,59,241,89,0,7, - 206,166,0,138,225,21,59,241,89,0,138,225,21,7,206,166,0,89,251,89,59,241, - 89,0,0,89,125,0,12,232,89,12,232,89,0,12,12,235,125,0,175,251,89,0,7,206, - 255,125,0,0,0,89,255,201,0,7,206,247,34,0,7,206,166,59,245,125,0,7,206, - 255,125,0,0,59,241,89,0,0,0,0,0,138,166,0,0,0,12,228,34,0,0,0,0,89,225, - 21,0,0,0,0,0,0,0,0,0,0,0,0,4,4,4,100,252,252,244,28,4,4,4,4,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,127,0,0,0,0,0,0,0,0,175,255,255,232,241,89,59,245,255,255,247,34, - 0,0,12,235,255,255,201,0,59,245,255,200,241,89,0,12,235,255,251,89,0,59, - 241,89,0,0,0,12,235,255,200,241,89,59,241,89,0,59,241,89,59,241,89,0,59, - 241,89,59,241,89,0,59,245,201,59,241,89,59,241,89,0,59,241,89,0,59,241, - 89,59,241,89,0,59,241,89,0,0,12,235,255,247,34,0,59,245,166,255,247,34, - 0,0,59,245,255,166,241,89,59,241,89,0,0,59,245,255,255,166,0,0,138,255, - 255,125,0,89,255,255,166,241,89,0,0,138,247,34,0,0,0,59,245,125,0,0,138, - 225,21,7,206,225,21,0,138,251,0,0,138,247,34,0,0,175,255,255,255,255,166, - 0,0,138,166,0,0,0,12,228,34,0,0,0,0,89,225,21,0,0,0,0,0,0,0,0,0,0,0,0,4, - 4,4,4,132,252,108,4,4,4,4,4,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,127,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,138,225,21,0,0,0,0,0,0,0,0,0,0,0,89,247,34,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,59,241,89,0,0,0,0,0, - 0,0,0,59,241,89,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,12,232,89,0,0,0,0,0,0,0,0,0,0,0,138, - 201,0,0,0,12,228,34,0,0,0,0,138,201,0,0,0,0,0,0,0,0,0,0,0,0,0,4,4,4,4,4, - 116,4,4,4,4,4,4,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,127,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,166,255,255, - 247,34,0,0,0,0,0,0,0,0,0,0,0,255,255,125,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,59,241,89,0,0,0,0,0,0,0,0,59, - 241,89,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,138,225,21,0,0,0,0,0,0,0,0,0,0,0,7,206,255, - 201,0,12,228,34,0,0,89,255,251,89,0,0,0,0,0,0,0,0,0,0,0,0,0,4,4,4,4,4,4, - 4,4,4,4,4,4,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,127,127,127,127,127,127,0,127,127,127, - 127,127,127,0,127,127,127,127,127,127,0,127,127,127,127,127,0,127,127,127, - 127,127,127,0,127,127,127,127,127,127,0,127,127,127,127,0,127,127,127,127, - 127,127,0,127,127,127,127,127,127,0,127,127,0,127,127,127,0,127,127,127, - 127,127,127,0,127,127,0,127,127,127,127,127,127,127,127,127,127,0,127,127, - 127,127,127,127,127,0,127,127,127,127,127,127,0,127,127,127,127,127,127, - 0,127,127,127,127,127,127,0,127,127,127,127,0,127,127,127,127,127,0,127, - 127,127,127,0,127,127,127,127,127,127,0,127,127,127,127,127,127,0,127,127, - 127,127,127,127,127,127,127,0,127,127,127,127,127,0,127,127,127,127,127, - 127,0,127,127,127,127,127,0,127,127,127,127,127,127,0,127,127,127,0,127, - 127,127,127,127,127,127,0,127,127,127,127,127,127,127,127,0,127,127,127, - 127,127,127,127,127,127,127,127,127,127,127,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,127,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,89,247,34,138,201,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,12,235,125,59,238,34,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,127,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,89,255, - 225,21,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 12,235,251,89,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,59,238,34,138,201,0,0,0,0,0, - 0,0,0,0,127,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,7,199,34,0,0,0,0,0,7,199,34,0,0,0,0,138,255, - 201,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,251,89,0,0,138,255,251,97,206,201,0,0,138, - 251,102,235,201,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,89,255, - 201,12,228,34,0,0,0,0,0,0,0,0,0,0,0,0,7,206,166,12,232,89,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,175,166,12,235,127,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,127,0,0,175,255,255,255,225,21,59,245,255,255,255, - 255,255,125,0,0,0,0,0,0,0,7,206,255,247,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,7,199,34,0,0,0,0,0,7,199,34,0,0,0,138,225,21,175,166,0,0,175,255,255, - 166,0,0,7,202,89,0,0,0,0,0,0,0,0,0,0,59,245,255,255,201,0,0,0,0,0,0,0,0, - 59,245,255,255,255,255,255,255,255,255,125,0,59,245,255,255,255,255,255, - 125,0,0,89,255,255,255,255,255,225,21,59,245,255,255,255,255,255,125,0, - 0,0,59,245,255,255,255,255,255,125,7,206,166,0,0,175,171,206,166,89,247, - 34,0,175,201,59,241,89,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 12,228,34,175,255,125,0,0,89,255,255,255,125,175,251,89,89,255,125,0,7, - 206,255,125,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,59,245,255,255,255, - 255,255,125,0,0,7,206,255,125,59,245,125,0,0,0,89,251,89,0,0,0,0,0,0,0, - 127,7,206,225,21,0,0,0,0,59,115,0,0,0,0,59,115,0,0,0,0,0,0,0,175,201,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,59,245,255,255,255,255,125,0,59,245,255, - 255,255,255,125,0,0,0,0,0,0,0,89,247,34,12,228,34,0,138,166,0,0,0,0,0,0, - 0,0,0,0,12,235,125,0,7,176,21,0,0,0,0,0,0,138,251,89,0,0,138,201,0,0,0, - 0,0,0,59,115,0,0,0,0,59,115,0,0,0,0,0,0,7,206,166,0,59,115,0,0,0,0,59,115, - 0,0,0,59,115,0,0,0,0,59,115,0,89,201,0,12,232,89,89,201,7,202,89,12,232, - 89,138,201,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,7,199,34,0,172,132,196,199,163,125,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,59,115,0,0,0,0,59,115,0,0,0,0,0,0,0,89,247,34,0,7, - 206,125,0,0,0,0,0,0,0,0,127,89,247,34,0,0,0,0,0,59,115,0,0,0,0,59,115,0, - 0,0,0,0,0,7,206,125,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,7,199,34,0, - 0,0,0,0,7,199,34,0,0,0,0,0,0,0,0,0,89,225,21,7,202,89,12,228,34,0,0,0,0, - 0,0,0,0,0,0,59,238,34,0,0,0,0,0,0,0,130,34,59,241,89,0,0,0,138,201,0,0, - 0,0,0,0,59,115,0,0,0,0,59,115,0,0,0,0,0,0,175,225,21,0,59,115,0,0,0,0,59, - 115,0,0,0,59,115,0,0,0,0,59,115,0,12,228,34,59,192,0,12,228,34,138,166, - 59,215,21,175,125,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,7,199,34,0,172,89,175,166,138,125,0,138,255,255,247,34,12, - 146,0,0,0,0,89,255,255,255,125,12,235,255,255,125,0,0,0,59,115,0,0,0,0, - 59,115,0,138,255,255,255,255,127,0,175,201,0,138,225,21,0,0,0,0,0,0,0,0, - 127,245,255,255,255,255,255,125,0,59,115,0,0,0,0,59,115,0,0,0,0,0,0,12, - 232,89,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,7,199,34,0,0,0,0,0,7,199, - 34,0,0,0,0,0,0,0,0,0,89,247,34,12,228,34,138,166,0,0,0,0,0,0,0,0,0,0,0, - 12,235,166,0,0,0,0,0,0,175,225,21,138,225,21,0,0,0,138,201,0,0,0,0,0,0, - 59,115,0,0,0,0,59,115,0,0,0,0,0,89,247,34,0,0,59,115,0,0,0,0,59,115,0,0, - 0,59,115,0,0,0,0,59,115,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,138,255,166, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,7,199,34,0,172, - 89,0,0,138,125,59,238,34,0,130,34,7,206,201,0,0,59,241,89,0,12,235,255, - 125,0,59,241,89,0,0,59,115,0,0,0,0,59,115,0,0,0,0,89,247,34,0,59,245,166, - 241,89,0,0,0,0,0,0,0,0,0,127,138,225,21,0,0,0,0,0,59,115,0,0,0,0,59,115, - 0,0,0,0,0,89,255,255,255,247,34,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,7,199, - 34,0,0,0,0,0,7,199,34,0,0,0,0,0,0,0,0,0,0,175,255,255,166,59,215,21,175, - 255,255,125,0,89,255,255,201,0,0,0,59,245,255,255,125,0,12,235,166,0,0, - 138,225,21,0,0,0,138,255,255,255,255,247,34,0,59,115,0,0,0,0,59,115,0,0, - 0,0,59,245,125,0,0,0,59,115,0,0,0,0,59,115,0,0,0,59,115,0,0,0,0,59,115, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,59,245,255,251,102,0,255,255,255,255, - 255,0,245,255,255,255,255,255,255,255,255,255,255,127,21,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,59,241,89,0,0,0,0,0,138,247,34,138,201,0,0,0,175, - 201,0,0,0,175,166,0,0,59,115,0,0,0,0,59,115,0,0,0,12,235,125,0,0,0,138, - 255,166,0,0,0,0,0,0,0,0,0,0,127,245,255,255,255,255,225,21,0,59,115,0,0, - 0,0,59,115,0,0,0,0,0,0,89,225,21,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,7,199,34,0,0,0,59,245,255,255,255,255,125,0,0,0,0,0,0,0,0,0,0,0,0,175, - 125,89,225,21,59,238,47,232,89,7,206,125,0,0,0,0,0,138,251,89,12,235,166, - 0,0,138,225,21,0,0,0,138,201,0,0,0,0,0,0,59,115,0,0,0,0,59,115,0,0,0,7, - 206,201,0,0,0,0,59,115,0,0,0,0,59,115,0,0,0,59,115,0,0,0,0,59,115,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,59,245,255,251,89,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,175,255,255,201,0, - 0,0,138,247,34,175,201,0,0,0,138,255,255,255,255,255,166,0,0,59,115,0,0, - 0,0,59,115,0,0,7,206,166,0,0,0,0,59,241,89,0,0,0,0,0,0,0,0,0,0,127,89,251, - 89,0,0,0,0,0,59,115,0,0,0,0,59,115,0,0,0,0,0,0,138,201,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,7,199,34,0,0,0,0,0,7,199,34,0,0,0,0,0,0,0,0,0, - 0,0,0,0,59,215,21,138,201,0,12,228,47,228,34,0,175,166,0,0,0,0,0,12,232, - 89,0,0,175,225,21,59,241,89,0,0,0,138,201,0,0,0,0,0,0,59,115,0,0,0,0,59, - 115,0,0,0,138,225,21,0,0,0,0,59,115,0,0,0,0,59,115,0,0,0,59,115,0,0,0,0, - 59,115,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,138,255,166,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,59, - 245,125,7,206,201,0,0,138,201,0,0,0,175,201,0,0,0,0,0,0,0,59,115,0,0,0, - 0,59,115,0,0,138,225,21,0,0,0,0,59,241,89,0,0,0,0,0,0,0,0,0,0,127,7,206, - 247,34,0,0,0,0,59,115,0,0,0,0,59,115,0,59,245,125,0,0,175,166,0,0,0,59, - 245,125,175,225,29,206,166,0,89,247,34,7,206,166,0,0,0,7,199,34,0,0,0,0, - 0,7,199,34,0,0,0,0,0,0,0,0,0,0,0,0,7,202,89,0,89,225,21,59,238,47,232,89, - 7,206,125,0,89,166,0,0,89,247,34,0,0,0,130,34,0,138,255,125,0,0,138,201, - 0,0,0,0,0,0,59,115,0,0,0,0,59,115,0,0,89,251,89,0,0,0,0,0,59,115,0,0,0, - 0,59,115,0,0,0,59,115,0,0,0,0,59,115,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,89,125,0,12,232,89,12,146,0,0,0,59,241,89,0,12,235,247, - 34,0,0,89,125,0,0,59,115,0,0,0,0,59,115,0,59,241,89,0,0,0,0,0,59,241,89, - 0,0,0,0,0,0,0,0,0,0,127,0,0,175,255,255,255,225,21,59,245,255,255,255,255, - 255,125,0,138,225,21,0,12,235,125,0,0,0,138,225,34,235,125,7,206,166,0, - 89,247,34,7,206,166,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 138,201,0,0,0,175,255,255,125,0,89,255,255,201,0,0,12,235,255,255,251,89, - 0,0,0,0,0,0,0,0,89,255,255,255,255,255,255,255,255,255,125,0,59,245,255, - 255,255,255,255,125,0,0,175,255,255,255,255,255,247,34,59,245,255,255,255, - 255,255,125,0,0,0,59,245,255,255,255,255,255,125,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,59,245,255,255,166,0,0,0,0,0,0,0,89,255,255, - 255,125,59,245,255,255,201,0,0,0,59,245,255,255,255,255,255,125,0,175,255, - 255,255,255,127,0,0,59,241,89,0,0,0,0,0,0,0,0,0,0,127,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,175,166,0,255,255,201,0,0,0,0,175,166,59,238,34,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,127,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,12,228,34,0,0, - 0,0,0,0,0,12,228,34,138,166,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,127,127,127, - 127,127,127,127,0,127,127,127,127,127,127,127,127,0,127,127,0,127,127,127, - 127,127,127,0,127,127,127,127,127,0,127,127,127,127,127,127,127,127,127, - 0,127,127,127,127,127,127,127,0,127,127,127,127,127,127,127,0,127,127,127, - 127,127,0,127,127,127,127,127,127,127,127,127,127,127,127,127,127,127,127, - 127,127,0,127,127,127,127,127,127,127,0,127,127,127,0,127,127,127,127,127, - 127,127,127,127,127,127,127,127,0,127,127,127,127,127,127,127,127,127,0, - 127,127,127,127,127,127,127,0,127,127,127,127,127,127,127,127,127,0,127, - 127,127,127,127,127,127,127,127,0,127,127,0,127,127,0,127,127,127,127,0, - 127,127,127,127,127,0,127,127,127,127,127,0,127,127,127,127,127,0,127,127, - 127,127,127,127,127,127,127,127,127,0,127,127,127,127,127,127,127,0,127, - 127,127,127,127,127,127,127,127,127,0,127,127,127,127,127,0,127,127,127, - 127,0,127,127,127,127,127,127,127,127,127,127,127,127,0,127,127,127,127, - 127,127,127,127,127,0,127,127,127,127,127,0,127,127,127,127,127,127,127, - 0,0,0,0,0,0,0,0,127,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,127,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,245,255,255,255,255,255, - 251,127,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,127,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,12,228,34,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,89,255,125,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,127,0,0,0,0,0,138,225,21, - 0,0,0,138,125,0,0,0,0,59,245,255,255,125,0,0,0,0,0,0,0,0,138,225,21,0,0, - 175,166,0,12,228,34,0,0,59,245,255,255,247,34,0,89,225,29,206,166,0,0,0, - 0,0,89,255,255,255,255,125,0,0,0,7,206,255,255,247,34,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,89,255,255,255,255,125,0,0,0,0,0,0,0, - 0,0,0,0,0,138,255,255,166,0,0,0,0,7,202,89,0,0,0,0,0,12,235,255,125,0,0, - 175,255,255,225,21,0,0,0,12,235,125,0,0,0,0,0,0,0,0,0,0,0,138,255,255,255, - 255,125,0,0,0,0,0,0,0,0,0,0,0,0,0,0,12,228,34,0,0,89,255,255,225,21,0,0, - 0,0,0,0,0,0,0,0,0,138,166,0,0,0,89,225,21,0,0,0,0,0,138,166,0,0,0,89,225, - 21,0,0,0,12,235,255,255,166,0,0,7,206,125,0,0,0,0,0,0,89,247,34,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,127,0,0,0,0,0,138,225,21,0,0,0,138,125,0,0,0,12, - 235,125,0,59,115,0,0,0,0,0,0,0,0,7,206,125,0,59,215,21,0,12,228,34,0,12, - 235,125,0,0,168,34,0,0,0,0,0,0,0,0,0,0,175,225,21,0,0,0,175,225,21,0,0, - 0,0,0,138,166,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,175,225, - 21,0,0,0,175,225,21,0,0,0,0,0,0,0,0,0,59,238,34,7,206,125,0,0,0,7,202,89, - 0,0,0,0,7,199,34,59,238,34,0,0,0,7,202,89,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,89,255,255,255,125,175,125,0,0,0,0,0,0,0,0,0,0,0,0,0,138,255,247,34,0, - 59,241,89,0,175,201,0,0,0,0,0,0,0,0,0,7,206,255,166,0,0,12,232,89,0,0,0, - 0,7,206,255,166,0,0,12,232,89,0,0,0,0,0,0,0,59,215,21,0,89,201,0,0,0,0, - 0,0,0,89,247,34,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,127,0,0,0,0,0,0,0,0,0,7, - 206,255,255,251,89,0,59,241,89,0,0,0,138,201,0,0,0,138,201,0,0,89,225,21, - 175,125,0,0,12,228,34,0,12,235,125,0,0,0,0,0,0,0,0,0,0,0,0,0,138,166,0, - 89,255,255,247,34,89,201,0,0,89,255,255,255,166,0,0,0,0,168,34,7,151,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,138,166,7,206,255,255,225,21,89,201,0,0,0, - 0,0,0,0,0,0,89,166,0,0,138,166,0,0,0,7,202,89,0,0,0,0,0,0,0,59,238,34,0, - 7,206,255,125,0,0,0,0,0,0,0,0,0,59,238,34,0,0,175,166,0,175,255,255,255, - 125,175,125,0,138,247,34,0,0,0,0,0,0,0,0,0,0,12,228,34,0,89,201,0,0,89, - 225,0,81,115,0,134,89,0,0,0,0,0,138,166,0,0,138,166,0,0,0,0,0,0,0,138,166, - 0,0,138,166,0,0,0,0,0,0,59,245,247,34,0,12,232,89,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,127,0,0,0,0,0,89,201,0,7,206,201,138,125, - 138,125,0,59,241,89,0,0,0,0,175,255,255,255,225,21,0,0,7,206,166,215,21, - 0,0,12,228,34,0,0,138,255,255,251,89,0,0,0,0,0,0,0,0,0,12,206,21,59,241, - 89,0,134,89,0,172,89,59,238,34,0,138,166,0,0,7,206,201,12,235,125,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,12,206,21,7,202,89,12,235,125,0,172,89,0,0,0,0, - 0,0,0,0,59,238,34,7,206,125,12,235,255,255,255,255,255,255,125,0,0,0,12, - 235,125,0,0,0,0,7,206,125,0,0,0,0,0,0,0,0,59,238,34,0,0,175,166,0,175,255, - 255,255,125,175,125,0,138,247,34,0,0,0,0,0,0,0,0,0,0,12,228,34,0,89,201, - 0,0,89,225,0,29,206,166,59,245,125,0,0,0,0,138,166,0,12,228,34,0,175,225, - 21,0,0,0,138,166,0,12,228,42,206,255,255,166,0,0,0,0,12,228,34,138,166, - 0,89,247,34,0,0,0,0,59,238,34,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,127,0,0,0, - 0,0,138,201,0,59,241,89,138,125,0,0,59,245,255,255,255,125,0,0,138,166, - 0,89,201,0,0,0,0,89,255,125,0,0,0,0,0,0,0,7,206,125,0,138,251,89,0,0,0, - 0,0,0,0,0,89,166,0,138,201,0,0,0,0,0,89,166,59,215,21,0,175,166,0,59,245, - 125,89,251,89,0,0,12,235,255,255,255,255,255,255,125,138,255,255,251,89, - 127,166,0,7,202,89,12,232,89,0,89,166,0,0,0,0,0,0,0,0,0,138,255,255,166, - 0,0,0,0,7,202,89,0,0,0,0,0,59,241,89,0,0,0,0,0,7,206,125,0,0,0,0,0,0,0, - 0,59,238,34,0,0,175,166,0,89,255,255,255,125,175,125,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,12,228,34,0,59,241,89,0,175,201,0,0,0,175,201,7,206,201,0,0,0, - 138,166,0,175,166,0,138,200,215,21,0,0,0,138,166,0,175,166,7,151,0,89,247, - 34,0,0,0,59,238,47,228,34,59,219,209,34,0,0,0,89,255,125,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,127,0,0,0,0,0,138,225,21,59,238,34,138,125,0,0,0,59, - 241,89,0,0,0,0,138,166,0,89,201,0,0,59,245,255,255,255,255,125,0,0,0,0, - 0,59,238,34,0,7,206,125,0,0,0,0,0,0,0,0,89,166,0,138,201,0,0,0,0,0,89,166, - 0,175,255,255,223,166,0,12,235,125,59,241,89,0,0,0,0,0,0,0,0,0,175,125, - 0,0,0,0,0,138,125,0,7,206,255,255,125,0,0,59,157,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,7,202,89,0,0,0,0,7,206,255,255,255,166,7,206,255,255,201,0, - 0,0,0,0,0,0,0,0,59,238,34,0,0,175,166,0,0,89,255,255,125,175,125,0,0,0, - 0,0,0,0,0,0,0,0,0,0,89,255,255,251,89,0,89,255,255,225,21,0,0,0,175,225, - 29,206,166,0,0,0,138,166,59,215,21,59,215,81,215,21,0,0,0,138,166,59,215, - 21,0,0,0,89,225,21,59,245,255,255,125,138,166,7,202,97,199,34,0,0,89,251, - 89,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,127,0,0,0,0,0,138,225,21,59,241, - 89,138,125,0,0,0,89,247,34,0,0,0,0,175,255,255,255,225,21,0,0,0,12,232, - 89,0,0,0,12,228,34,0,12,235,225,21,59,215,21,0,0,0,0,0,0,0,0,12,206,21, - 59,241,89,0,134,89,0,172,89,0,0,0,0,0,0,0,0,7,206,201,12,235,125,0,0,0, - 0,0,0,0,0,175,125,0,0,0,0,0,12,206,21,7,202,89,7,206,125,0,172,89,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,7,202,89,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,59,238,34,0,0,175,166,0,0,0,0,175,125,175,125,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,7,206,166,59,245,125,0,0,0,0,0,0, - 175,125,12,228,34,59,215,21,0,0,0,0,0,175,125,0,0,0,12,232,89,0,0,0,0,0, - 59,238,34,175,125,7,199,34,0,0,175,201,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,127,0,0,0,0,0,138,225,21,7,206,201,138,125,138,125,7,202,89,0,0,0, - 0,138,201,0,0,0,138,166,0,0,0,12,232,89,0,0,0,12,228,34,0,0,0,175,255,255, - 166,0,0,0,0,0,0,0,0,0,0,138,166,0,89,255,255,247,34,89,201,0,0,0,0,0,0, - 0,0,0,0,0,168,34,7,151,0,0,0,0,0,0,0,0,175,125,0,0,0,0,0,0,138,166,7,202, - 89,0,89,247,124,201,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,12,235,255,255,255,255, - 255,255,125,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,59,245,125,0,7,206, - 166,0,0,0,0,175,125,175,125,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,59,115,0,134,89,0,0,0,0,0,0,59,215,21,59,245,255,255,255,225,21,0, - 0,0,59,215,21,0,0,59,238,34,0,0,0,0,0,0,175,125,7,206,255,255,255,251,89, - 0,138,247,34,0,59,157,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,127,0,0,0,0,0,138,225, - 21,0,7,206,255,255,251,89,138,255,255,255,255,255,166,0,0,0,0,0,0,0,0,0, - 0,12,232,89,0,0,0,12,228,34,0,0,0,0,0,59,241,89,0,0,0,0,0,0,0,0,0,0,175, - 225,21,0,0,0,175,225,21,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,175,225,21,0,0,0,175,225,21,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,59,238,198, - 255,251,194,166,0,0,0,0,175,125,175,125,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,7,206,125,0,0,0,0,89,225,21,0,0,0, - 7,206,125,0,0,12,235,255,255,255,166,0,0,0,89,225,21,0,0,0,12,228,34,0, - 0,0,175,255,255,255,166,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,127,0,0,0,0,0,0,0, - 0,0,0,0,138,125,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,12,228, - 34,0,7,176,21,0,89,247,34,0,0,0,0,0,0,0,0,0,0,0,89,255,255,255,255,125, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,89, - 255,255,255,255,125,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,59,238,34,0,0,0,0,0,0,0,0,175, - 125,175,125,0,0,0,0,0,0,0,0,59,215,21,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,127,0,0,0,0, - 0,0,0,0,0,0,0,138,125,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 12,228,34,0,7,206,255,255,251,89,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,59,238,34,0,0,0,0,0,0,0,0,175,125,175,125, - 0,0,0,0,0,0,59,245,251,89,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,127,127,127,0,127,127, - 127,0,127,127,127,127,127,127,0,127,127,127,127,127,127,0,127,127,127,127, - 127,127,127,0,127,127,127,127,127,127,127,0,127,127,127,0,127,127,127,127, - 127,127,127,0,127,127,127,127,127,127,0,127,127,127,127,127,127,127,127, - 127,127,127,0,127,127,127,127,127,127,0,127,127,127,127,127,127,127,0,127, - 127,127,127,127,127,127,127,0,127,127,127,127,0,127,127,127,127,127,127, - 127,127,127,127,127,0,127,127,127,127,127,127,127,0,127,127,127,127,127, - 0,127,127,127,127,127,127,127,127,127,0,127,127,127,127,127,127,0,127,127, - 127,127,127,127,0,127,127,127,127,127,0,127,127,127,127,127,127,127,0,127, - 127,127,127,127,127,127,0,127,127,127,127,0,127,127,127,127,127,127,0,127, - 127,127,127,0,127,127,127,127,127,127,0,127,127,127,127,127,127,127,0,127, - 127,127,127,127,127,127,127,127,127,127,127,0,127,127,127,127,127,127,127, - 127,127,127,127,127,0,127,127,127,127,127,127,127,127,127,127,127,127,0, - 127,127,127,127,127,127,127,127,0,0,0,0,0,0,0,0,0,0,0,0,0,0,127,0,0,89, - 255,125,0,0,0,0,0,0,12,235,201,0,0,0,0,12,235,251,89,0,0,0,0,175,255,125, - 89,201,0,0,0,0,0,0,0,0,0,0,0,59,245,247,34,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,89,255,125,0,0,0,0,0,0,138,251,89,0,0,0,12,235,251, - 89,0,0,0,0,0,0,0,0,7,206,225,21,0,0,0,89,255,125,0,89,255,225,21,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,12,235,247,34,172,89,0,0,0,0,7,206,225,21,0,0, - 0,0,0,0,0,89,255,125,0,0,0,0,0,0,89,255,225,21,0,0,0,0,12,235,247,34,172, - 89,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,89, - 255,125,0,0,0,0,0,0,0,7,206,225,21,0,0,0,0,89,255,225,21,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,89,255,125,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,127,0,0, - 0,89,247,34,0,0,0,0,0,175,166,0,0,0,0,7,206,125,59,241,89,0,0,89,201,12, - 235,247,34,0,0,7,206,166,59,241,89,0,0,12,228,34,59,215,21,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,59,238,34,0,0,0,0,89,247,34,0,0,0,7, - 206,125,59,241,89,0,7,206,166,59,238,34,0,0,175,166,0,0,59,241,89,0,89, - 247,34,138,201,59,238,34,138,201,0,0,0,0,0,0,0,0,0,0,0,175,125,89,255,201, - 0,0,0,0,0,0,0,175,201,0,0,0,0,0,0,12,232,89,0,0,0,0,0,0,59,238,34,138,225, - 21,0,0,0,175,125,89,255,201,0,0,0,0,59,238,34,138,201,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,89,247,34,0,0,0,0,0,0,138,201,0,0,0,0, - 0,59,238,34,138,225,21,0,0,0,59,238,34,138,201,0,0,0,0,12,232,89,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,127,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,12,228,34,59,215,21,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,12,235,255,255,125,0, - 0,0,0,127,0,0,12,235,225,21,0,0,0,0,12,235,225,21,0,0,0,0,12,235,225,21, - 0,0,0,0,12,235,225,21,0,0,0,0,12,235,225,21,0,0,0,0,12,235,225,21,0,0,0, - 0,0,175,255,255,255,255,255,255,255,166,0,0,138,255,255,255,251,89,59,245, - 255,255,255,255,127,81,245,255,255,255,255,225,21,59,245,255,255,255,255, - 127,81,245,255,255,255,255,127,111,255,255,255,125,89,255,255,255,125,89, - 255,255,255,125,89,255,255,255,125,7,206,255,255,255,255,125,0,0,59,245, - 247,34,0,0,59,241,89,0,0,0,138,255,255,255,166,0,0,0,0,138,255,255,255, - 166,0,0,0,0,0,138,255,255,255,166,0,0,0,0,138,255,255,255,166,0,0,0,0,138, - 255,255,255,166,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,138,255,255,255,210,235,166, - 59,241,89,0,0,0,59,241,89,59,241,89,0,0,0,59,241,89,59,241,89,0,0,0,59, - 241,89,59,241,89,0,0,0,59,241,132,245,125,0,0,0,89,251,89,12,232,89,0,0, - 0,0,7,206,166,0,89,251,89,0,0,0,127,0,0,89,232,241,89,0,0,0,0,89,232,241, - 89,0,0,0,0,89,232,241,89,0,0,0,0,89,232,241,89,0,0,0,0,89,232,241,89,0, - 0,0,0,89,232,241,89,0,0,0,0,12,232,89,89,225,21,0,0,0,0,0,175,247,34,0, - 0,59,192,59,241,89,0,0,0,0,59,241,89,0,0,0,0,0,59,241,89,0,0,0,0,59,241, - 89,0,0,0,0,0,59,241,89,0,0,59,241,89,0,0,59,241,89,0,0,59,241,89,0,7,206, - 166,0,0,59,245,201,0,59,245,255,201,0,0,59,241,89,0,0,138,251,89,0,12,235, - 166,0,0,138,251,89,0,12,235,166,0,0,0,138,251,89,0,12,235,166,0,0,138,251, - 89,0,12,235,166,0,0,138,251,89,0,12,235,166,0,0,0,138,166,0,0,0,12,228, - 34,0,0,175,247,34,0,0,175,225,21,59,241,89,0,0,0,59,241,89,59,241,89,0, - 0,0,59,241,89,59,241,89,0,0,0,59,241,89,59,241,89,0,0,0,59,241,89,89,247, - 34,0,7,206,125,0,12,232,89,0,0,0,0,59,241,89,0,12,232,89,0,0,0,127,0,7, - 206,166,175,166,0,0,0,7,206,166,175,166,0,0,0,7,206,166,175,166,0,0,0,7, - 206,166,175,166,0,0,0,7,206,166,175,166,0,0,0,0,175,166,175,166,0,0,0,0, - 138,225,21,89,225,21,0,0,0,0,59,241,89,0,0,0,0,0,59,241,89,0,0,0,0,59,241, - 89,0,0,0,0,0,59,241,89,0,0,0,0,59,241,89,0,0,0,0,0,59,241,89,0,0,59,241, - 89,0,0,59,241,89,0,0,59,241,89,0,7,206,166,0,0,0,59,245,125,59,241,132, - 241,89,0,59,241,89,0,12,235,166,0,0,0,89,247,34,12,235,166,0,0,0,89,247, - 34,0,12,235,166,0,0,0,89,247,34,12,235,166,0,0,0,89,247,34,12,235,166,0, - 0,0,89,247,34,0,0,12,235,125,0,12,235,125,0,0,59,241,89,0,0,138,176,235, - 166,59,241,89,0,0,0,59,241,89,59,241,89,0,0,0,59,241,89,59,241,89,0,0,0, - 59,241,89,59,241,89,0,0,0,59,241,89,0,175,201,0,138,225,21,0,12,235,255, - 255,255,225,21,59,238,34,0,138,225,21,0,0,0,127,0,59,238,34,89,247,34,0, - 0,59,238,34,89,247,34,0,0,59,238,34,89,247,34,0,0,59,238,34,89,247,34,0, - 0,59,238,34,89,247,34,0,0,59,241,89,89,225,21,0,0,7,206,125,0,89,225,21, - 0,0,0,0,138,225,21,0,0,0,0,0,59,241,89,0,0,0,0,59,241,89,0,0,0,0,0,59,241, - 89,0,0,0,0,59,241,89,0,0,0,0,0,59,241,89,0,0,59,241,89,0,0,59,241,89,0, - 0,59,241,89,0,7,206,166,0,0,0,7,206,166,59,241,89,138,225,21,59,241,89, - 0,59,241,89,0,0,0,59,241,89,59,241,89,0,0,0,59,241,89,0,59,241,89,0,0,0, - 59,241,89,59,241,89,0,0,0,59,241,89,59,241,89,0,0,0,59,241,89,0,0,0,12, - 235,138,235,125,0,0,0,138,225,21,0,59,215,21,175,201,59,241,89,0,0,0,59, - 241,89,59,241,89,0,0,0,59,241,89,59,241,89,0,0,0,59,241,89,59,241,89,0, - 0,0,59,241,89,0,59,245,166,241,89,0,0,12,232,89,0,0,175,225,59,238,47,235, - 225,21,0,0,0,0,127,0,138,201,0,12,235,125,0,0,138,201,0,12,235,125,0,0, - 138,201,0,12,235,125,0,0,138,201,0,12,235,125,0,0,138,201,0,12,235,125, - 0,0,138,225,21,12,235,125,0,0,89,247,34,0,89,255,255,255,255,251,89,138, - 225,21,0,0,0,0,0,59,245,255,255,255,255,127,59,245,255,255,255,255,166, - 0,59,245,255,255,255,255,127,59,245,255,255,255,255,127,0,59,241,89,0,0, - 59,241,89,0,0,59,241,89,0,0,59,241,89,7,206,255,255,255,166,0,0,175,201, - 59,241,89,12,235,125,59,241,89,0,59,241,89,0,0,0,12,235,125,59,241,89,0, - 0,0,12,235,125,0,59,241,89,0,0,0,12,235,125,59,241,89,0,0,0,12,235,125, - 59,241,89,0,0,0,12,235,125,0,0,0,0,12,235,125,0,0,0,0,138,225,21,7,199, - 34,0,138,225,81,241,89,0,0,0,59,241,89,59,241,89,0,0,0,59,241,89,59,241, - 89,0,0,0,59,241,89,59,241,89,0,0,0,59,241,89,0,0,138,255,166,0,0,0,12,232, - 89,0,0,89,247,59,238,34,0,59,245,125,0,0,0,127,7,206,125,0,0,175,201,0, - 7,206,125,0,0,175,201,0,7,206,125,0,0,175,201,0,7,206,125,0,0,175,201,0, - 7,206,125,0,0,175,201,0,7,206,125,0,0,175,201,0,7,206,255,255,255,255,225, - 21,0,0,0,0,138,225,21,0,0,0,0,0,59,241,89,0,0,0,0,59,241,89,0,0,0,0,0,59, - 241,89,0,0,0,0,59,241,89,0,0,0,0,0,59,241,89,0,0,59,241,89,0,0,59,241,89, - 0,0,59,241,89,0,7,206,166,0,0,0,7,206,166,59,241,89,0,89,247,94,241,89, - 0,59,241,89,0,0,0,59,241,89,59,241,89,0,0,0,59,241,89,0,59,241,89,0,0,0, - 59,241,89,59,241,89,0,0,0,59,241,89,59,241,89,0,0,0,59,241,89,0,0,0,12, - 235,138,235,125,0,0,0,138,225,21,175,125,0,0,175,201,59,241,89,0,0,0,59, - 241,89,59,241,89,0,0,0,59,241,89,59,241,89,0,0,0,59,241,89,59,241,89,0, - 0,0,59,241,89,0,0,59,241,89,0,0,0,12,232,89,0,7,206,201,59,238,34,0,0,138, - 201,0,0,0,127,59,245,255,255,255,255,247,34,59,245,255,255,255,255,247, - 34,59,245,255,255,255,255,247,34,59,245,255,255,255,255,247,34,59,245,255, - 255,255,255,247,34,59,245,255,255,255,255,247,34,59,241,89,0,0,89,225,21, - 0,0,0,0,59,241,89,0,0,0,0,0,59,241,89,0,0,0,0,59,241,89,0,0,0,0,0,59,241, - 89,0,0,0,0,59,241,89,0,0,0,0,0,59,241,89,0,0,59,241,89,0,0,59,241,89,0, - 0,59,241,89,0,7,206,166,0,0,0,59,241,89,59,241,89,0,7,206,200,241,89,0, - 12,235,166,0,0,0,89,247,34,12,235,166,0,0,0,89,247,34,0,12,235,166,0,0, - 0,89,247,34,12,235,166,0,0,0,89,247,34,12,235,166,0,0,0,89,247,34,0,0,12, - 235,125,0,12,235,125,0,0,59,241,159,166,0,0,12,235,166,12,232,89,0,0,0, - 59,238,34,12,232,89,0,0,0,59,238,34,12,232,89,0,0,0,59,238,34,12,232,89, - 0,0,0,59,238,34,0,0,59,241,89,0,0,0,12,235,255,255,255,201,0,59,238,34, - 0,0,138,201,0,0,0,127,138,201,0,0,0,12,235,125,138,201,0,0,0,12,235,125, - 138,201,0,0,0,12,235,125,138,201,0,0,0,12,235,125,138,201,0,0,0,12,235, - 125,138,201,0,0,0,12,235,125,175,201,0,0,0,89,225,21,0,0,0,0,0,175,247, - 34,0,0,59,192,59,241,89,0,0,0,0,59,241,89,0,0,0,0,0,59,241,89,0,0,0,0,59, - 241,89,0,0,0,0,0,59,241,89,0,0,59,241,89,0,0,59,241,89,0,0,59,241,89,0, - 7,206,166,0,0,59,245,201,0,59,241,89,0,0,59,245,251,89,0,0,138,251,89,0, - 59,245,166,0,0,138,251,89,0,59,245,166,0,0,0,138,251,89,0,59,245,166,0, - 0,138,251,89,0,59,245,166,0,0,138,251,89,0,59,245,166,0,0,0,138,166,0,0, - 0,12,228,34,0,0,175,247,34,0,7,206,225,21,0,138,225,21,0,7,206,166,0,0, - 138,225,21,0,7,206,166,0,0,138,225,21,0,7,206,166,0,0,138,225,21,0,7,206, - 166,0,0,0,59,241,89,0,0,0,12,232,89,0,0,0,0,59,238,34,0,12,235,125,0,0, - 0,127,206,125,0,0,0,0,175,206,206,125,0,0,0,0,175,206,206,125,0,0,0,0,175, - 206,206,125,0,0,0,0,175,206,206,125,0,0,0,0,175,206,206,125,0,0,0,0,175, - 232,245,125,0,0,0,89,255,255,255,255,255,166,0,0,138,255,255,255,251,89, - 59,245,255,255,255,255,127,81,245,255,255,255,255,225,21,59,245,255,255, - 255,255,127,81,245,255,255,255,255,127,111,255,255,255,125,89,255,255,255, - 125,89,255,255,255,125,89,255,255,255,125,7,206,255,255,255,255,125,0,0, - 59,241,89,0,0,0,175,251,89,0,0,0,138,255,255,255,166,0,0,0,0,138,255,255, - 255,166,0,0,0,0,0,138,255,255,255,166,0,0,0,0,138,255,255,255,166,0,0,0, - 0,138,255,255,255,166,0,0,0,0,0,0,0,0,0,0,0,0,0,7,202,194,255,255,255,201, - 0,0,0,0,59,245,255,251,89,0,0,0,0,59,245,255,251,89,0,0,0,0,59,245,255, - 251,89,0,0,0,0,59,245,255,251,89,0,0,0,0,59,241,89,0,0,0,12,232,89,0,0, - 0,0,59,238,47,235,255,166,0,0,0,0,127,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,12,228,34,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,138, - 166,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,127, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,12,235,255,166,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,127,127,127,127,127,127,127,0,127,127,127, - 127,127,127,127,0,127,127,127,127,127,127,127,0,127,127,127,127,127,127, - 127,0,127,127,127,127,127,127,127,0,127,127,127,127,127,127,127,0,127,127, - 127,127,127,127,127,127,127,127,127,0,127,127,127,127,127,127,127,0,127, - 127,127,127,127,127,0,127,127,127,127,127,127,127,0,127,127,127,127,127, - 127,0,127,127,127,127,127,127,0,127,127,127,127,0,127,127,127,127,0,127, - 127,127,127,0,127,127,127,127,0,127,127,127,127,127,127,127,127,0,127,127, - 127,127,127,127,127,127,127,0,127,127,127,127,127,127,127,127,0,127,127, - 127,127,127,127,127,127,127,0,127,127,127,127,127,127,127,127,0,127,127, - 127,127,127,127,127,127,0,127,127,127,127,127,127,127,127,127,0,127,127, - 127,127,127,127,127,127,127,0,127,127,127,127,127,127,127,127,0,127,127, - 127,127,127,127,127,127,0,127,127,127,127,127,127,127,127,0,127,127,127, - 127,127,127,127,127,0,127,127,127,127,127,127,127,127,0,127,127,127,127, - 127,127,127,0,127,127,127,127,127,127,0,127,127,127,127,127,127,127,0,0, - 0,127,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,127,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,12,235,255,201,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,127,0,7,206, - 225,21,0,0,0,0,0,12,235,201,0,0,0,138,255,201,0,0,0,59,245,225,29,202,89, - 0,0,0,0,0,0,0,0,138,166,7,202,89,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 7,206,225,21,0,0,0,0,0,12,235,201,0,0,0,89,255,225,21,0,0,0,0,0,0,0,0,175, - 247,34,0,12,235,255,255,166,0,0,0,0,0,0,0,0,0,0,0,0,59,245,225,29,202,89, - 0,0,138,251,89,0,0,0,0,0,7,206,225,21,0,0,0,89,255,225,21,0,0,59,245,225, - 29,202,89,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,7,206,225, - 21,0,0,0,0,0,89,255,125,0,0,0,89,255,225,21,0,0,0,0,0,0,0,0,0,0,0,0,138, - 251,89,0,59,238,34,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,127,0,0,0,175, - 166,0,0,0,0,7,206,166,0,0,0,89,225,21,175,201,0,7,202,89,138,255,166,0, - 0,89,247,34,175,166,0,0,138,166,7,202,89,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,7,206,166,0,0,0,0,0,175,166,0,0,0,89,247,34,138,201,0,0,89,247, - 34,175,201,0,0,138,201,0,175,200,215,34,235,247,47,232,0,138,255,225,111, - 225,21,0,0,172,89,138,255,166,0,0,0,0,89,225,21,0,0,0,0,175,201,0,0,0,0, - 89,247,34,138,201,0,0,172,89,138,255,166,0,0,59,238,34,138,201,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,175,166,0,0,0,0,59,241,89,0,0,0,89, - 247,34,138,201,0,0,0,59,238,34,138,201,0,0,0,89,247,34,0,0,59,238,34,0, - 0,0,0,0,138,225,29,206,166,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,127,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,12,235,255,201,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,7,206,225,21,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,12,235,166,0,0,0,0,0,0,0,0,89,166,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,59,238,34,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,127,7,206,255,255,255,125,0,7,206,255,255,255, - 125,0,7,206,255,255,255,125,0,7,206,255,255,255,125,0,7,206,255,255,255, - 125,0,12,235,255,255,251,89,0,12,235,255,255,251,89,59,245,255,166,0,0, - 59,245,255,255,201,0,12,235,255,251,89,0,0,12,235,255,251,89,0,0,12,235, - 255,251,89,0,0,12,235,255,251,89,0,59,238,34,59,238,34,59,238,34,59,238, - 34,0,59,241,89,175,225,21,0,59,241,194,255,255,125,0,0,12,235,255,247,34, - 0,0,12,235,255,247,34,0,0,0,12,235,255,247,34,0,0,12,235,255,247,34,0,0, - 12,235,255,247,34,0,0,0,0,0,12,235,166,0,0,0,0,7,206,255,255,225,21,0,59, - 241,89,0,59,241,89,59,241,89,0,59,241,89,59,241,89,0,59,241,89,0,59,241, - 89,0,59,241,97,206,166,0,0,12,235,125,59,238,163,255,255,201,7,206,166, - 0,0,12,235,125,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,127,0,0,0,0,89,247,34,0,0,0,0,89,247, - 34,0,0,0,0,89,247,34,0,0,0,0,89,247,34,0,0,0,0,89,247,34,0,0,0,0,138,225, - 21,0,0,0,0,89,255,225,21,0,138,201,59,245,125,0,0,0,7,206,125,0,89,225, - 21,7,206,125,0,89,225,21,7,206,125,0,89,225,21,7,206,125,0,89,225,21,59, - 238,34,59,238,34,59,238,34,59,238,34,0,0,0,0,12,235,125,0,59,245,166,0, - 89,247,34,7,206,166,0,138,225,21,7,206,166,0,138,225,21,0,7,206,166,0,138, - 225,21,7,206,166,0,138,225,21,7,206,166,0,138,225,21,0,0,0,0,0,0,0,0,0, - 0,12,232,89,0,138,251,89,0,59,241,89,0,59,241,89,59,241,89,0,59,241,89, - 59,241,89,0,59,241,89,0,59,241,89,0,59,241,89,89,247,34,0,89,247,34,59, - 245,166,0,7,206,166,89,247,34,0,89,247,34,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,127,0,0,0,0, - 59,241,89,0,0,0,0,59,241,89,0,0,0,0,59,241,89,0,0,0,0,59,241,89,0,0,0,0, - 59,241,89,0,0,0,0,59,238,34,0,0,0,0,12,232,89,0,0,59,238,127,225,21,0,0, - 0,59,238,34,0,59,238,34,59,238,34,0,59,238,34,59,238,34,0,59,238,34,59, - 238,34,0,59,238,34,59,238,34,59,238,34,59,238,34,59,238,34,0,138,255,255, - 255,255,201,0,59,241,89,0,59,241,89,59,241,89,0,59,241,89,59,241,89,0,59, - 241,89,0,59,241,89,0,59,241,89,59,241,89,0,59,241,89,59,241,89,0,59,241, - 89,0,12,235,255,255,255,255,255,255,166,138,201,0,59,157,175,201,0,59,241, - 89,0,59,241,89,59,241,89,0,59,241,89,59,241,89,0,59,241,89,0,59,241,89, - 0,59,241,89,12,235,125,0,175,166,0,59,238,34,0,0,138,225,34,235,125,0,175, - 166,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,127,0,89,255,255,255,251,89,0,89,255,255,255,251, - 89,0,89,255,255,255,251,89,0,89,255,255,255,251,89,0,89,255,255,255,251, - 89,0,138,255,255,255,247,34,0,175,255,255,255,255,255,255,255,255,251,127, - 201,0,0,0,0,59,245,255,255,255,251,89,59,245,255,255,255,251,89,59,245, - 255,255,255,251,89,59,245,255,255,255,251,89,59,238,34,59,238,34,59,238, - 34,59,238,34,138,247,34,0,0,138,201,0,59,241,89,0,59,241,89,59,238,34,0, - 12,232,89,59,238,34,0,12,232,89,0,59,238,34,0,12,232,89,59,238,34,0,12, - 232,89,59,238,34,0,12,232,89,0,0,0,0,0,0,0,0,0,0,175,201,7,176,21,138,201, - 0,59,241,89,0,59,241,89,59,241,89,0,59,241,89,59,241,89,0,59,241,89,0,59, - 241,89,0,59,241,89,0,175,201,12,232,89,0,59,238,34,0,0,138,225,21,175,201, - 12,232,89,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,127,59,241,89,0,59,241,89,59,241,89,0,59, - 241,89,59,241,89,0,59,241,89,59,241,89,0,59,241,89,59,241,89,0,59,241,89, - 138,247,34,0,59,238,34,138,225,21,0,12,232,89,0,0,0,0,138,201,0,0,0,0,59, - 238,34,0,0,0,0,59,238,34,0,0,0,0,59,238,34,0,0,0,0,59,238,34,0,0,0,0,59, - 238,34,59,238,34,59,238,34,59,238,34,175,201,0,0,0,138,166,0,59,241,89, - 0,59,241,89,59,241,89,0,59,241,89,59,241,89,0,59,241,89,0,59,241,89,0,59, - 241,89,59,241,89,0,59,241,89,59,241,89,0,59,241,89,0,0,0,0,12,235,166,0, - 0,0,138,201,134,89,0,175,166,0,59,241,89,0,59,241,89,59,241,89,0,59,241, - 89,59,241,89,0,59,241,89,0,59,241,89,0,59,241,89,0,89,247,124,225,21,0, - 59,238,34,0,0,138,201,0,89,247,124,225,21,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,127,89,247, - 34,0,89,251,89,89,247,34,0,89,251,89,89,247,34,0,89,251,89,89,247,34,0, - 89,251,89,89,247,34,0,89,251,89,175,201,0,0,175,247,34,175,201,0,0,59,245, - 225,21,0,7,199,94,245,125,0,0,0,7,206,166,0,7,199,34,7,206,166,0,7,199, - 34,7,206,166,0,7,199,34,7,206,166,0,7,199,34,59,238,34,59,238,34,59,238, - 34,59,238,34,138,247,34,0,12,232,89,0,59,241,89,0,59,241,89,7,206,166,0, - 138,225,21,7,206,166,0,138,225,21,0,7,206,166,0,138,225,21,7,206,166,0, - 138,225,21,7,206,166,0,138,225,21,0,0,0,0,12,235,166,0,0,0,59,245,166,0, - 59,241,89,0,12,235,125,0,175,251,89,12,235,125,0,175,251,89,12,235,125, - 0,175,251,89,0,12,235,125,0,175,251,89,0,7,206,255,125,0,0,59,238,34,0, - 12,235,125,0,7,206,255,125,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,127,0,175,255,255,232, - 241,89,0,175,255,255,232,241,89,0,175,255,255,232,241,89,0,175,255,255, - 232,241,89,0,175,255,255,232,241,89,12,235,255,255,166,238,34,12,235,255, - 255,225,21,89,255,255,251,89,0,89,255,255,255,201,0,12,235,255,251,89,0, - 0,12,235,255,251,89,0,0,12,235,255,251,89,0,0,12,235,255,251,89,0,59,238, - 34,59,238,34,59,238,34,59,238,34,0,138,255,255,255,125,0,0,59,241,89,0, - 59,241,89,0,12,235,255,247,34,0,0,12,235,255,247,34,0,0,0,12,235,255,247, - 34,0,0,12,235,255,247,34,0,0,12,235,255,247,34,0,0,0,0,0,0,0,0,0,0,0,7, - 206,255,255,225,21,0,0,0,89,255,255,166,241,89,0,89,255,255,166,241,89, - 0,89,255,255,166,241,89,0,0,89,255,255,166,241,89,0,0,138,247,34,0,0,59, - 245,166,255,255,166,0,0,0,138,247,34,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,127,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,59,215,34,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,138,125,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,12,232,89,0,0,0,59,238,34,0,0,0,0,0, - 12,232,89,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,127,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,12,235,255,125,21,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,138,225,21,0,0,0,59,238,34,0,0,0,0,0,138,225,21,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,127,127,127,127,127,127,0,127,127,127,127,127,127,0,127,127, - 127,127,127,127,0,127,127,127,127,127,127,0,127,127,127,127,127,127,0,127, - 127,127,127,127,127,0,127,127,127,127,127,127,127,127,127,127,0,127,127, - 127,127,127,0,127,127,127,127,127,127,0,127,127,127,127,127,127,0,127,127, - 127,127,127,127,0,127,127,127,127,127,127,0,127,127,0,127,127,0,127,127, - 0,127,127,0,127,127,127,127,127,127,127,0,127,127,127,127,127,127,0,127, - 127,127,127,127,127,0,127,127,127,127,127,127,127,0,127,127,127,127,127, - 127,0,127,127,127,127,127,127,0,127,127,127,127,127,127,127,0,127,127,127, - 127,127,127,127,127,0,127,127,127,127,127,127,127,0,127,127,127,127,127, - 127,0,127,127,127,127,127,127,0,127,127,127,127,127,127,127,0,127,127,127, - 127,127,127,0,127,127,127,127,127,127,0,127,127,127,127,127,127,0,127,127, - 127,127,127,127,127,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 -}; - - -// Large font anti-aliased -const int FONT2AA_BM_W = 276; -const int FONT2AA_BM_H = 120; -static const unsigned char s_Font2AA[] = -{ - 127,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,4, - 4,4,4,0,0,0,0,0,0,0,0,0,0,0,4,4,4,0,4,4,0,0,0,0,0,127,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,4,4,4,4,0,0,0,0,0,0,0,0, - 0,0,0,4,4,4,0,4,4,0,0,0,0,0,127,0,0,0,0,0,0,0,0,0,59,245,125,175,225,21, - 0,0,0,0,0,0,0,0,0,0,0,0,0,138,125,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,59,241,89,0,0,12,235,201,89,255,166,0,0,0,0,0,172,89,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,89,225,21,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,4,4,4,4,0, - 0,0,0,0,0,0,0,0,0,0,4,4,4,0,4,4,0,0,0,0,0,127,0,0,0,0,0,138,247,34,0,12, - 232,89,138,225,21,0,0,0,0,138,125,7,199,34,0,0,0,0,138,125,0,0,0,0,138, - 255,255,201,0,0,0,59,215,21,0,0,0,0,59,245,255,255,166,0,0,0,59,241,89, - 0,7,206,201,0,0,89,251,89,0,59,215,21,172,89,59,192,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,175,166,0,0,138,255,251,89,0,0,0,0,0, - 138,201,0,0,0,7,206,255,255,255,166,0,0,7,206,255,255,255,201,0,0,0,0,0, - 0,138,251,89,0,0,175,255,255,255,255,225,21,0,0,12,235,255,255,125,89,255, - 255,255,255,255,251,89,0,12,235,255,255,225,21,0,0,59,245,255,255,166,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,59,245,255,255,251,89,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,4, - 4,4,4,0,0,0,0,0,0,0,0,0,0,0,4,4,4,0,4,4,0,0,0,0,0,127,0,0,0,0,0,89,247, - 34,0,12,232,89,138,201,0,0,0,0,7,202,89,59,215,21,0,0,12,235,255,255,255, - 166,0,59,241,89,12,235,125,0,0,172,89,0,0,0,0,7,206,166,0,89,251,89,0,0, - 12,228,34,0,89,247,34,0,0,0,175,201,0,0,89,251,191,194,247,34,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,12,232,89,0,175,201,0,12,235, - 125,0,0,138,255,255,201,0,0,0,12,182,0,0,59,245,125,0,12,206,21,0,12,235, - 166,0,0,0,0,89,255,251,89,0,0,175,201,0,0,0,0,0,0,89,255,125,0,0,0,0,0, - 0,0,0,89,251,89,12,235,166,0,7,206,201,0,59,245,125,0,12,235,166,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,89,166,0,0,138,251,89,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,4,4,4,4,0, - 0,0,0,0,0,0,0,0,0,0,4,4,4,0,4,4,0,0,0,0,0,127,0,0,0,0,0,89,247,34,0,12, - 228,34,89,201,0,0,0,0,12,206,21,89,166,0,0,12,235,125,138,125,59,192,0, - 89,247,34,7,206,166,0,89,201,0,0,0,0,0,12,235,125,0,12,232,89,0,0,12,228, - 34,0,175,201,0,0,0,0,59,241,89,0,0,7,206,166,0,0,0,0,0,0,0,138,166,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,89,225,21,59,241,89,0,0,138,225,21,0, - 0,0,175,201,0,0,0,0,0,0,0,7,206,201,0,0,0,0,0,0,175,201,0,0,0,59,241,132, - 241,89,0,0,175,201,0,0,0,0,0,7,206,166,0,0,0,0,0,0,0,0,7,206,201,0,59,241, - 89,0,0,138,225,21,138,225,21,0,0,138,225,21,89,255,125,0,0,89,255,125,0, - 0,0,0,0,0,0,0,138,225,21,0,0,0,0,0,0,0,0,0,0,0,138,201,0,0,0,0,0,0,0,0, - 0,0,0,59,241,89,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,4,4,4,4,0,0,0,0,0, - 0,0,0,0,0,0,4,4,4,0,4,4,0,0,0,0,0,127,0,0,0,0,0,89,247,34,0,0,0,0,0,0,0, - 0,89,255,255,255,255,255,255,255,125,59,238,34,138,125,0,0,0,89,247,34, - 7,206,166,7,202,89,0,0,0,0,0,0,175,225,21,138,225,21,0,0,0,0,0,12,235,125, - 0,0,0,0,7,206,125,0,89,251,191,194,247,34,0,0,0,0,0,138,166,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,138,166,0,89,247,34,0,0,89,247,34,0,0,0,175,201, - 0,0,0,0,0,0,0,12,235,166,0,0,0,0,0,59,245,125,0,0,12,235,125,59,241,89, - 0,0,175,201,0,0,0,0,0,59,241,89,0,0,0,0,0,0,0,0,89,247,34,0,12,235,201, - 0,0,175,201,0,138,225,21,0,0,89,247,34,89,255,125,0,0,89,255,125,0,0,0, - 0,0,12,235,255,225,21,0,0,0,0,0,0,0,0,0,0,0,0,0,175,255,251,89,0,0,0,0, - 0,0,0,0,138,247,34,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,4,4,4,4,0,0,0, - 0,0,0,0,0,0,0,0,4,4,4,0,4,4,0,0,0,0,0,127,0,0,0,0,0,89,247,34,0,0,0,0,0, - 0,0,0,0,0,175,125,7,199,34,0,0,12,235,166,138,125,0,0,0,59,241,89,12,235, - 125,89,201,12,235,255,251,89,0,0,7,206,255,166,0,59,241,89,0,0,0,59,238, - 34,0,0,0,0,0,175,166,59,215,21,172,89,59,192,0,0,0,0,0,138,166,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,7,206,125,0,138,247,34,0,0,89,247,34,0,0,0, - 175,201,0,0,0,0,0,0,0,89,251,89,0,0,0,89,255,247,34,0,0,7,206,166,0,59, - 241,89,0,0,175,255,255,255,225,21,0,89,251,226,255,255,247,34,0,0,0,7,206, - 166,0,0,0,12,235,255,255,201,0,0,89,255,125,0,0,138,247,34,0,0,0,0,0,0, - 0,0,0,0,0,89,255,255,166,0,0,0,0,0,175,255,255,255,255,255,255,225,21,0, - 0,0,0,59,245,255,201,0,0,0,0,0,175,251,89,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,4,4,4,4,0,0,0,0,0,0,0,0,0,0,0,4,4,4,0,4,4,0,0,0,0,0,127,0,0,0, - 0,0,89,225,21,0,0,0,0,0,0,0,0,0,7,199,34,59,215,21,0,0,0,59,245,255,255, - 201,0,0,0,138,255,255,201,12,228,34,175,166,0,138,201,0,12,235,125,89,255, - 125,59,241,89,0,0,0,59,238,34,0,0,0,0,0,138,201,0,0,0,172,89,0,0,0,7,206, - 255,255,255,255,255,255,247,34,0,0,0,0,89,255,255,255,166,0,0,0,0,0,59, - 238,34,0,138,247,34,0,0,89,247,34,0,0,0,175,201,0,0,0,0,0,0,59,245,166, - 0,0,0,0,0,0,12,235,166,0,138,201,0,0,59,241,89,0,0,0,0,0,12,235,201,0,138, - 251,89,0,0,175,225,21,0,0,89,247,34,0,0,7,206,166,0,175,255,166,0,0,89, - 255,255,255,223,247,34,0,0,0,0,0,0,0,0,0,0,175,247,34,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,7,206,225,21,0,0,175,225,21,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,4,4,4,4,0,0,0,0,0,0,0,0,0,0,0,4,4,4,0,4,4,0,0,0, - 0,0,127,0,0,0,0,0,59,215,21,0,0,0,0,0,0,0,12,235,255,255,255,255,255,255, - 166,0,0,0,0,138,125,175,225,21,0,0,0,0,0,138,166,7,206,125,0,89,247,34, - 138,225,21,0,89,255,166,215,21,0,0,0,59,238,34,0,0,0,0,0,138,201,0,0,0, - 0,0,0,0,0,0,0,0,0,138,166,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,138,201,0, - 0,89,247,34,0,0,89,247,34,0,0,0,175,201,0,0,0,0,0,12,235,201,0,0,0,0,0, - 0,0,0,138,225,21,175,255,255,255,255,255,255,125,0,0,0,0,0,138,247,34,89, - 247,34,0,0,59,241,89,0,7,206,166,0,0,0,138,247,34,0,0,138,247,34,0,0,0, - 0,0,138,225,21,0,0,0,0,0,0,0,0,0,0,0,89,255,255,166,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,59,245,255,201,0,0,0,0,175,201,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,4,4,4,4,0,0,0,0,0,0,0,0,0,0,0,4,4,4,0,4,4,0,0,0,0,0, - 127,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,89,166,0,175,125,0,0,0,0,0,0,138, - 125,89,247,34,0,0,0,0,12,228,34,7,206,125,0,89,247,34,138,247,34,0,0,89, - 255,166,0,0,0,0,59,238,34,0,0,0,0,0,175,166,0,0,0,0,0,0,0,0,0,0,0,0,138, - 166,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,7,206,125,0,0,59,241,89,0,0,138,225, - 21,0,0,0,175,201,0,0,0,0,12,235,201,0,0,0,0,0,0,0,0,0,138,225,21,0,0,0, - 0,59,241,89,0,0,0,0,0,0,138,225,21,59,241,89,0,0,59,241,89,0,89,247,34, - 0,0,0,138,247,34,0,0,89,251,89,0,0,0,0,7,206,166,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,12,235,255,225,21,0,0,175,255,255,255,255,255,255,225,21,0,0,175, - 255,251,89,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 4,4,4,4,0,0,0,0,0,0,0,0,0,0,0,4,4,4,0,4,4,0,0,0,0,0,127,0,0,0,0,0,89,247, - 34,0,0,0,0,0,0,0,0,0,175,125,7,199,34,0,0,0,89,201,0,138,125,175,201,0, - 0,0,0,0,138,166,0,0,175,166,0,138,201,0,89,255,166,0,0,89,255,255,125,0, - 0,0,12,235,125,0,0,0,0,7,206,125,0,0,0,0,0,0,0,0,0,0,0,0,138,166,0,0,0, - 0,0,138,255,125,0,0,0,0,0,0,175,247,34,59,238,34,0,0,0,175,201,0,12,235, - 125,0,0,0,0,175,201,0,0,0,12,235,166,0,0,0,0,0,89,166,0,0,59,245,166,0, - 0,0,0,0,59,241,89,0,59,215,21,0,12,235,166,0,7,206,201,0,0,175,225,21,7, - 206,166,0,0,0,0,59,245,166,0,7,206,225,21,0,0,0,0,175,225,21,0,89,255,125, - 0,0,12,235,201,0,0,0,0,0,0,0,0,138,225,21,0,0,0,0,0,0,0,0,0,0,0,138,201, - 0,0,0,0,0,0,0,0,0,175,225,21,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 4,4,4,4,0,0,0,0,0,0,0,0,0,0,0,4,4,4,0,4,4,0,0,0,0,0,127,0,0,0,0,0,89,247, - 34,0,0,0,0,0,0,0,0,7,199,34,59,215,21,0,0,0,12,235,255,255,255,201,0,0, - 0,0,0,59,215,21,0,0,12,235,255,251,89,0,0,89,255,255,255,201,0,89,255,0, - 0,0,0,175,201,0,0,0,0,59,238,34,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,175, - 201,0,0,0,0,0,0,0,175,247,34,138,201,0,0,0,0,0,138,255,251,89,0,0,0,138, - 255,255,255,255,166,0,89,255,255,255,255,255,247,34,12,235,255,255,255, - 166,0,0,0,0,0,0,59,241,89,0,12,235,255,255,255,166,0,0,0,7,206,255,255, - 225,21,0,138,247,34,0,0,0,0,0,59,245,255,255,201,0,0,0,175,255,255,201, - 0,0,0,89,255,125,0,0,89,251,89,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,175,225,21,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,4,4,4,4,4,4,4,4,52,4,4,4,4,4,4,4,4,4,0,4,4,0,0,0,0,0,127,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,138,125,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,89,247,34,0,0,0,175,201,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,12,232,89,0,0,0,0,0,0,0,0,0,0,175,125, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,175,201,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,0,4,4,0,0,0,0,0,127,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,138,125,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,7,206,201,0,0,89,251,89,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,89,201,0,0,0,0,0,0,0,0,0,0,12,232,89, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,12,232,89,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,0,4,4,0,0,0,0,0,127,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,201,0,0,201,201,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,4,4, - 4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,0,0,0,0,0,0,127,127,127,0,127,127,127, - 127,0,127,127,127,127,127,0,127,127,127,127,127,127,127,127,127,0,127,127, - 127,127,127,127,127,0,127,127,127,127,127,127,127,127,127,127,127,127,127, - 0,127,127,127,127,127,127,127,127,0,127,127,0,127,127,127,127,0,127,127, - 127,127,0,127,127,127,127,127,127,127,0,127,127,127,127,127,127,127,127, - 127,0,127,127,127,0,127,127,127,127,0,127,127,127,0,127,127,127,127,0,127, - 127,127,127,127,127,127,127,0,127,127,127,127,127,127,0,127,127,127,127, - 127,127,127,0,127,127,127,127,127,127,127,0,127,127,127,127,127,127,127, - 0,127,127,127,127,127,127,127,0,127,127,127,127,127,127,127,0,127,127,127, - 127,127,127,0,127,127,127,127,127,127,127,0,127,127,127,127,127,127,127, - 0,127,127,127,0,127,127,127,127,127,0,127,127,127,127,127,127,127,127,127, - 0,127,127,127,127,127,127,127,127,0,127,127,127,127,127,127,127,127,127, - 0,127,127,127,127,127,127,127,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,4, - 4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,0,0,0,0,0,127,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,127,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,127,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,7,206,255,255, - 201,0,138,201,0,0,0,0,89,255,255,255,125,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,127,0,0,0,0,175,255,255,255,247,34,0,0,0,0,0,7,206,251,89,0,0,12,0, - 235,255,255,255,255,201,0,0,0,0,59,245,255,255,255,201,12,0,235,255,255, - 255,255,166,0,0,0,12,235,255,255,255,255,255,127,12,235,255,255,255,255, - 251,89,0,0,12,235,255,255,255,251,89,12,235,166,0,0,0,12,235,125,89,255, - 255,255,201,0,0,175,255,255,225,21,12,235,166,0,0,7,206,251,102,0,235,166, - 0,0,0,0,12,235,251,89,0,0,0,89,255,225,21,12,235,251,89,0,0,12,235,125, - 0,0,0,138,255,255,166,0,0,0,12,235,255,255,255,251,89,0,0,0,0,175,255,255, - 201,0,0,0,12,235,255,255,255,251,89,0,0,0,12,235,255,255,255,247,47,235, - 255,255,255,255,255,255,255,138,0,235,125,0,0,0,59,245,133,206,166,0,0, - 0,0,59,245,255,133,201,0,0,0,138,251,89,0,0,12,235,133,206,247,34,0,0,0, - 175,229,216,225,21,0,0,0,138,247,124,255,255,255,255,255,255,125,7,206, - 125,0,0,0,59,238,34,0,0,0,0,0,12,235,125,0,0,0,0,175,247,34,0,0,0,0,0,0, - 0,0,0,0,127,0,0,59,245,166,0,0,0,59,245,166,0,0,0,0,59,245,255,166,0,0, - 12,0,235,166,0,0,59,245,125,0,0,138,255,125,0,0,7,202,102,0,235,166,0,0, - 59,245,225,21,0,12,235,166,0,0,0,0,0,12,235,166,0,0,0,0,0,0,89,255,166, - 0,0,0,89,127,12,235,166,0,0,0,12,235,125,0,12,235,125,0,0,0,0,0,138,225, - 21,12,235,166,0,7,206,225,21,12,0,235,166,0,0,0,0,12,235,255,166,0,0,7, - 206,255,225,21,12,235,255,201,0,0,12,235,125,0,59,245,166,0,0,138,251,89, - 0,12,235,166,0,0,138,251,89,0,89,255,125,0,0,89,255,125,0,12,235,166,0, - 0,138,251,89,0,12,235,166,0,0,7,202,89,0,0,0,138,225,21,0,0,12,0,235,125, - 0,0,0,59,245,125,138,225,21,0,0,0,138,225,151,34,247,34,0,0,175,255,125, - 0,0,89,247,34,12,235,166,0,0,89,247,34,59,245,125,0,0,59,245,125,0,0,0, - 0,0,138,247,34,7,206,125,0,0,0,7,206,125,0,0,0,0,0,12,235,125,0,0,0,138, - 225,187,201,0,0,0,0,0,0,0,0,0,0,127,0,12,232,89,0,0,0,0,0,12,232,89,0,0, - 0,138,225,151,225,21,0,12,0,235,166,0,0,12,235,166,0,12,235,166,0,0,0,0, - 0,12,0,235,166,0,0,0,12,235,166,0,12,235,166,0,0,0,0,0,12,235,166,0,0,0, - 0,0,12,235,166,0,0,0,0,0,0,12,235,166,0,0,0,12,235,125,0,12,235,125,0,0, - 0,0,0,138,225,21,12,235,166,0,175,225,21,0,12,0,235,166,0,0,0,0,12,235, - 166,238,34,0,59,215,187,225,21,12,235,166,245,125,0,12,235,125,12,235,125, - 0,0,0,0,138,247,34,12,235,166,0,0,12,235,166,12,235,125,0,0,0,0,138,247, - 34,12,235,166,0,0,12,235,166,0,89,247,34,0,0,0,0,0,0,0,0,138,225,21,0,0, - 12,0,235,125,0,0,0,59,245,125,59,241,89,0,0,7,206,166,59,0,241,89,0,12, - 232,194,201,0,0,138,225,21,0,89,251,89,12,235,166,0,0,138,247,34,7,206, - 201,0,0,0,0,0,59,245,125,0,7,206,125,0,0,0,0,138,201,0,0,0,0,0,12,235,125, - 0,0,59,241,89,12,235,166,0,0,0,0,0,0,0,0,0,127,0,175,166,0,59,245,255,255, - 247,34,138,201,0,0,7,206,166,59,241,89,0,12,0,235,166,0,0,89,251,89,0,89, - 247,34,0,0,0,0,0,12,0,235,166,0,0,0,0,138,225,21,12,235,166,0,0,0,0,0,12, - 235,166,0,0,0,0,0,89,247,34,0,0,0,0,0,0,12,235,166,0,0,0,12,235,125,0,12, - 235,125,0,0,0,0,0,138,225,21,12,235,166,175,247,34,0,0,12,0,235,166,0,0, - 0,0,12,235,133,206,166,0,175,166,175,225,21,12,235,125,138,225,21,12,235, - 125,89,247,34,0,0,0,0,59,245,125,12,235,166,0,0,12,235,166,89,247,34,0, - 0,0,0,59,245,125,12,235,166,0,0,12,235,125,0,89,255,125,0,0,0,0,0,0,0,0, - 138,225,21,0,0,12,0,235,125,0,0,0,59,245,125,7,206,201,0,0,59,241,89,7, - 0,206,166,0,59,215,111,225,21,7,206,166,0,0,0,175,225,187,225,21,0,0,12, - 235,166,89,247,34,0,0,0,0,7,206,201,0,0,7,206,125,0,0,0,0,89,225,21,0,0, - 0,0,12,235,125,0,12,235,166,0,0,59,241,89,0,0,0,0,0,0,0,0,127,0,202,89, - 12,235,125,0,12,228,34,59,215,0,0,59,241,89,7,206,166,0,12,0,235,255,255, - 255,255,166,0,0,138,225,21,0,0,0,0,0,12,0,235,166,0,0,0,0,89,247,34,12, - 235,255,255,255,255,247,34,12,235,255,255,255,255,247,0,163,225,21,0,0, - 0,0,0,0,12,235,255,255,255,255,255,255,125,0,12,235,125,0,0,0,0,0,138,225, - 21,12,235,255,247,34,0,0,0,12,0,235,166,0,0,0,0,12,235,125,89,225,34,228, - 34,175,225,21,12,235,125,12,235,125,12,235,125,138,225,21,0,0,0,0,12,235, - 166,12,235,166,0,0,175,247,34,138,225,21,0,0,0,0,12,235,166,12,235,166, - 0,0,175,225,21,0,0,175,255,255,225,21,0,0,0,0,0,138,225,21,0,0,12,0,235, - 125,0,0,0,59,245,125,0,138,247,34,0,138,225,21,0,0,175,201,0,138,201,12, - 232,89,12,235,125,0,0,0,12,235,251,89,0,0,0,0,89,255,255,125,0,0,0,0,0, - 138,247,34,0,0,7,206,125,0,0,0,0,12,232,89,0,0,0,0,12,235,125,7,206,201, - 0,0,0,0,138,251,89,0,0,0,0,0,0,0,127,7,228,34,89,225,21,0,12,228,34,12, - 228,0,0,138,225,21,0,138,225,21,12,0,235,166,0,0,12,235,201,0,138,225,21, - 0,0,0,0,0,12,0,235,166,0,0,0,0,89,247,34,12,235,166,0,0,0,0,0,12,235,166, - 0,0,0,0,0,138,225,21,0,12,235,255,255,127,12,235,166,0,0,0,12,235,125,0, - 12,235,125,0,0,0,0,0,138,225,21,12,235,229,216,225,21,0,0,12,0,235,166, - 0,0,0,0,12,235,125,12,235,223,201,0,175,225,21,12,235,125,0,138,225,34, - 235,125,138,225,21,0,0,0,0,12,235,166,12,235,255,255,255,247,34,0,138,225, - 21,0,0,0,0,12,235,166,12,235,255,255,255,166,0,0,0,0,0,0,89,255,255,247, - 34,0,0,0,138,225,21,0,0,12,0,235,125,0,0,0,59,245,125,0,59,245,125,7,206, - 166,0,0,0,89,247,34,175,125,7,206,125,89,247,34,0,0,0,12,235,251,89,0,0, - 0,0,7,206,225,21,0,0,0,0,59,245,125,0,0,0,7,206,125,0,0,0,0,0,175,166,0, - 0,0,0,12,235,125,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,127,12,228,34,89,225, - 21,0,12,228,34,59,215,0,7,206,255,255,255,255,251,89,12,0,235,166,0,0,0, - 138,247,0,124,247,34,0,0,0,0,0,12,0,235,166,0,0,0,0,138,225,21,12,235,166, - 0,0,0,0,0,12,235,166,0,0,0,0,0,89,247,34,0,0,0,0,175,127,12,235,166,0,0, - 0,12,235,125,0,12,235,125,0,0,0,0,0,138,225,21,12,235,166,59,245,201,0, - 0,12,0,235,166,0,0,0,0,12,235,125,0,138,251,89,0,175,225,21,12,235,125, - 0,12,235,138,235,125,89,247,34,0,0,0,0,59,245,125,12,235,166,0,0,0,0,0, - 89,247,34,0,0,0,0,59,245,125,12,235,166,0,175,247,34,0,0,0,0,0,0,0,59,245, - 166,0,0,0,138,225,21,0,0,12,0,235,125,0,0,0,59,241,89,0,7,206,201,59,241, - 89,0,0,0,59,241,102,232,89,0,138,201,138,225,21,0,0,0,175,201,175,225,21, - 0,0,0,0,175,225,21,0,0,0,7,206,201,0,0,0,0,7,206,125,0,0,0,0,0,89,225,21, - 0,0,0,12,235,125,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,127,12,232,89,59,241, - 89,0,89,247,34,89,201,0,59,241,89,0,0,7,206,166,12,0,235,166,0,0,0,138, - 225,0,81,245,166,0,0,0,0,0,12,0,235,166,0,0,0,12,235,166,0,12,235,166,0, - 0,0,0,0,12,235,166,0,0,0,0,0,12,235,166,0,0,0,0,175,127,12,235,166,0,0, - 0,12,235,125,0,12,235,125,0,0,0,0,0,138,225,21,12,235,166,0,89,255,166, - 0,12,0,235,166,0,0,0,0,12,235,125,0,12,182,0,0,175,225,21,12,235,125,0, - 0,138,232,245,125,12,235,125,0,0,0,0,138,247,34,12,235,166,0,0,0,0,0,12, - 235,125,0,0,0,0,138,247,34,12,235,166,0,7,206,225,21,0,0,0,0,0,0,12,235, - 166,0,0,0,138,225,21,0,0,12,0,235,166,0,0,0,89,251,89,0,0,138,247,163,225, - 21,0,0,0,7,206,200,215,21,0,89,225,187,166,0,0,0,89,251,89,12,235,166,0, - 0,0,0,175,225,21,0,0,0,138,247,34,0,0,0,0,7,206,125,0,0,0,0,0,12,232,89, - 0,0,0,12,235,125,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,127,12,175,166,0,89, - 255,255,210,235,255,255,125,0,138,225,21,0,0,0,138,247,47,0,235,166,0,0, - 59,245,166,0,0,138,255,125,0,0,7,202,102,0,235,166,0,0,12,235,225,21,0, - 12,235,166,0,0,0,0,0,12,235,166,0,0,0,0,0,0,138,255,125,0,0,0,175,127,12, - 235,166,0,0,0,12,235,125,0,12,235,125,0,0,0,0,7,206,201,0,12,235,166,0, - 0,138,255,125,12,0,235,166,0,0,0,12,0,235,125,0,0,0,0,0,175,225,21,12,235, - 125,0,0,12,235,255,125,0,89,255,125,0,0,89,251,89,0,12,235,166,0,0,0,0, - 0,0,89,255,125,0,0,89,255,125,0,12,235,166,0,0,12,235,201,0,138,166,0,0, - 0,138,251,89,0,0,0,138,225,21,0,0,0,0,138,247,34,0,7,206,225,21,0,0,12, - 235,255,166,0,0,0,0,0,175,255,201,0,0,12,235,255,125,0,0,12,235,166,0,0, - 138,251,89,0,0,0,175,225,21,0,0,89,251,89,0,0,0,0,0,7,206,125,0,0,0,0,0, - 0,175,166,0,0,0,12,235,125,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,127,0,59,241, - 89,0,0,0,0,0,0,0,0,7,206,166,0,0,0,0,59,245,138,0,235,255,255,255,255,125, - 0,0,0,0,59,245,255,255,255,201,12,0,235,255,255,255,255,166,0,0,0,12,235, - 255,255,255,255,255,127,12,235,166,0,0,0,0,0,0,0,59,245,255,255,255,225, - 21,12,235,166,0,0,0,12,235,125,89,255,255,255,210,127,235,255,255,225,21, - 0,12,235,166,0,0,0,175,255,127,0,235,255,255,255,247,47,0,235,125,0,0,0, - 0,0,175,225,21,12,235,125,0,0,0,138,255,125,0,0,0,175,255,255,201,0,0,0, - 12,235,166,0,0,0,0,0,0,0,0,175,255,255,201,0,0,0,12,235,166,0,0,0,89,255, - 225,34,235,255,255,255,247,34,0,0,0,0,138,225,21,0,0,0,0,0,138,255,255, - 255,201,0,0,0,0,0,175,251,89,0,0,0,0,0,89,255,166,0,0,7,206,247,34,0,7, - 206,225,21,0,0,7,206,225,21,0,0,175,225,21,0,0,138,255,255,255,255,255, - 255,166,7,206,125,0,0,0,0,0,0,138,201,0,0,0,12,235,125,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,127,0,0,89,255,125,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,175,201,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,7,206,125,0,0,0,0,0,0,59,238,34,0,0,12,235,125,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,127,0,0,0,7,206,255,255,255,225,21,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,89,251,89,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,7,206,125,0,0,0,0,0,0,7,206,125,0,0,12,235,125,0,0,0, - 0,0,0,0,0,0,0,245,255,255,255,255,255,255,127,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,138, - 255,255,166,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,7,206,255,255,201,0,0,0,0,0,0,89,89,255,255, - 255,125,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,127,127,127,127,127,127,127, - 127,127,127,127,127,0,127,127,127,127,127,127,127,127,0,127,127,127,127, - 127,127,127,127,0,127,127,127,127,127,127,127,127,0,127,127,127,127,127, - 127,127,127,127,0,127,127,127,127,127,127,127,0,127,127,127,127,127,127, - 127,0,127,127,127,127,127,127,127,127,0,127,127,127,127,127,127,127,127, - 0,127,127,127,127,0,127,127,127,127,127,127,0,127,127,127,127,127,127,127, - 127,0,127,127,127,127,127,127,0,127,127,127,127,127,127,127,127,127,127, - 0,127,127,127,127,127,127,127,127,0,127,127,127,127,127,127,127,127,127, - 0,127,127,127,127,127,127,127,0,127,127,127,127,127,127,127,127,127,0,127, - 127,127,127,127,127,127,127,0,127,127,127,127,127,127,127,0,127,127,127, - 127,127,127,127,127,0,127,127,127,127,127,127,127,127,0,127,127,127,127, - 127,127,127,127,0,127,127,127,127,127,127,127,127,127,127,127,127,0,127, - 127,127,127,127,127,127,0,127,127,127,127,127,127,127,0,127,127,127,127, - 127,127,127,0,127,127,127,127,127,0,127,127,127,127,127,0,127,127,127,127, - 127,0,127,127,127,127,127,127,127,127,0,127,127,127,127,127,127,0,127,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,127,0,59,245,166,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,127,0,0,89,247,34,0,0,0,0,0,0,0,0,0,0,12,235, - 125,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,138,225,21,0,0,0,0,0,0,0,0,0,12,235, - 255,247,0,0,0,0,0,0,0,12,12,235,125,0,0,0,0,0,0,0,0,0,0,0,0,12,235,125, - 0,0,0,0,0,12,235,125,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,138,255,251,89,0,7,206,125,0,89,255,251,89, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,4,4,4,4,4,4,4,4,4,84,84,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,127,0,0,7,206, - 125,0,0,0,0,0,0,0,0,0,0,12,235,125,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,138, - 225,21,0,0,0,0,0,0,0,0,0,175,201,0,0,0,0,0,0,0,0,0,12,12,235,125,0,0,0, - 0,0,59,245,102,0,89,247,34,12,235,125,0,0,0,0,0,12,235,125,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,12,235,125,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 59,241,89,0,0,0,7,206,125,0,0,0,138,225,21,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 4,4,4,4,4,4,4,4,100,252,252,84,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,127,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,12, - 235,125,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,138,225,21,0,0,0,0,0,0,0,12,0, - 235,125,0,0,0,0,0,0,0,0,0,0,12,235,125,0,0,0,0,0,0,0,0,0,0,0,0,12,235,125, - 0,0,0,0,0,12,235,125,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,12,235, - 125,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,89,247,34,0,0,0,7,206,125,0,0,0,59,238, - 34,0,0,0,0,0,0,0,0,0,0,0,0,0,0,4,4,4,4,4,4,4,20,236,252,164,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,127,0, - 0,0,0,0,0,0,0,12,235,255,255,255,166,0,12,235,166,245,255,247,34,0,0,12, - 235,255,255,247,34,0,34,235,255,255,255,225,21,0,12,235,255,255,225,29, - 0,206,255,255,255,127,0,12,235,255,255,255,225,21,12,235,138,235,255,247, - 34,0,12,235,102,175,255,247,34,12,235,125,0,59,245,201,0,12,235,125,12, - 0,235,166,245,255,225,29,206,255,251,89,0,12,235,138,235,255,247,34,0,0, - 12,235,255,255,201,0,0,12,235,166,245,255,251,89,0,0,12,235,255,255,255, - 225,21,12,235,138,235,247,127,34,138,255,255,255,206,0,206,255,255,255, - 201,59,241,89,0,0,89,247,42,206,201,0,0,0,138,225,187,201,0,0,138,225,21, - 0,59,241,187,226,247,34,0,7,206,206,206,201,0,0,0,138,225,151,255,255,255, - 255,247,0,0,89,247,34,0,0,0,7,206,125,0,0,0,59,238,34,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,4,4,4,4,4,4,4,148,252,236,20,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,127,0,0,0,0,0,0,0,0,12,206, - 21,0,59,245,125,12,235,247,34,0,138,225,21,12,235,166,0,0,134,102,0,235, - 166,0,0,138,225,21,12,235,125,0,0,175,201,12,0,235,125,0,0,12,235,166,0, - 0,138,225,21,12,235,247,34,0,175,201,0,12,235,102,0,89,247,34,12,235,125, - 12,235,166,0,0,12,235,125,12,0,235,225,21,12,235,251,89,0,175,201,0,12, - 235,247,34,0,175,201,0,12,235,166,0,7,206,201,0,12,235,225,21,0,175,225, - 21,12,235,166,0,0,138,225,21,12,235,247,34,0,0,89,247,34,0,12,206,34,0, - 235,125,0,0,59,241,89,0,0,89,247,34,89,247,34,0,7,206,166,138,225,21,7, - 206,251,89,0,89,225,138,34,235,201,0,138,225,21,89,247,34,0,7,206,166,0, - 0,0,7,206,166,0,0,89,225,21,0,0,0,7,206,125,0,0,0,59,241,89,0,0,0,0,138, - 251,89,0,0,7,202,89,0,0,4,4,4,4,4,4,52,252,252,108,4,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,127,0,0,0,0, - 0,0,0,0,0,0,0,0,7,206,102,12,235,125,0,0,59,241,89,138,225,21,0,0,0,34, - 89,225,21,0,0,138,225,21,89,225,21,0,0,89,247,47,0,235,125,0,0,89,225,21, - 0,0,138,225,21,12,235,125,0,0,89,247,34,12,235,102,0,89,247,34,12,235,138, - 235,166,0,0,0,12,235,125,12,0,235,125,0,7,206,166,0,0,138,225,21,12,235, - 125,0,0,89,247,34,138,225,21,0,0,59,238,34,12,235,125,0,0,59,241,89,89, - 225,21,0,0,138,225,21,12,235,125,0,0,0,138,225,21,0,0,0,12,0,235,125,0, - 0,59,241,89,0,0,89,247,34,12,235,125,0,59,241,89,59,238,34,12,228,198,166, - 0,175,166,59,0,89,251,132,241,89,0,12,235,125,0,59,238,34,0,0,0,138,225, - 21,0,12,235,166,0,0,0,0,7,206,125,0,0,0,0,175,201,0,0,0,138,166,12,235, - 166,0,12,232,89,0,0,12,84,4,4,4,4,204,252,204,4,4,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,127,0,0,0,0,0,0, - 0,0,0,59,245,255,255,255,102,12,235,125,0,0,12,235,125,175,201,0,0,0,0, - 0,175,201,0,0,0,138,225,21,175,255,255,255,255,255,247,47,0,235,125,0,0, - 175,201,0,0,0,138,225,21,12,235,125,0,0,89,247,34,12,235,102,0,89,247,34, - 12,235,255,225,21,0,0,0,12,235,125,12,0,235,125,0,7,206,166,0,0,138,225, - 21,12,235,125,0,0,89,247,34,175,201,0,0,0,12,232,89,12,235,125,0,0,12,235, - 125,175,201,0,0,0,138,225,21,12,235,125,0,0,0,59,245,255,247,34,0,12,0, - 235,125,0,0,59,241,89,0,0,89,247,34,0,175,201,0,138,201,0,12,235,125,89, - 201,89,225,29,206,125,12,0,0,175,255,166,0,0,0,175,201,0,138,201,0,0,0, - 89,251,89,0,138,247,34,0,0,0,0,0,7,206,125,0,0,0,0,0,89,255,125,7,202,89, - 0,89,251,89,89,201,0,0,0,172,252,84,4,4,100,252,252,60,4,4,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,127,0, - 0,0,0,0,0,0,0,89,255,166,0,7,206,102,12,235,125,0,0,12,235,125,175,201, - 0,0,0,0,0,175,201,0,0,0,138,225,21,175,201,0,0,0,0,0,12,0,235,125,0,0,175, - 201,0,0,0,138,225,21,12,235,125,0,0,89,247,34,12,235,102,0,89,247,34,12, - 235,138,235,201,0,0,0,12,235,125,12,0,235,125,0,7,206,166,0,0,138,225,21, - 12,235,125,0,0,89,247,34,175,201,0,0,0,12,232,89,12,235,125,0,0,12,235, - 125,175,201,0,0,0,138,225,21,12,235,125,0,0,0,0,0,138,255,255,201,12,0, - 235,125,0,0,59,241,89,0,0,89,247,34,0,89,247,42,206,125,0,0,175,166,175, - 125,12,232,102,232,89,0,0,0,175,255,201,0,0,0,89,247,47,235,125,0,0,12, - 235,166,0,0,0,12,235,125,0,0,0,0,7,206,125,0,0,0,0,138,201,0,0,12,232,89, - 0,0,59,245,225,21,0,0,0,196,252,244,60,20,236,252,156,4,4,4,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,127,0, - 0,0,0,0,0,0,0,175,201,0,0,7,206,102,12,235,125,0,0,59,241,89,138,225,21, - 0,0,0,34,89,225,21,0,0,138,225,21,138,247,34,0,0,0,0,12,0,235,125,0,0,138, - 225,21,0,0,138,225,21,12,235,125,0,0,89,247,34,12,235,102,0,89,247,34,12, - 235,125,59,245,125,0,0,12,235,125,12,0,235,125,0,7,206,166,0,0,138,225, - 21,12,235,125,0,0,89,247,34,138,225,21,0,0,89,247,34,12,235,125,0,0,59, - 241,89,138,225,21,0,0,138,225,21,12,235,125,0,0,0,0,0,0,0,89,247,47,0,235, - 125,0,0,59,241,89,0,0,89,247,34,0,12,235,166,238,34,0,0,138,210,228,34, - 0,175,166,215,21,0,0,89,251,159,251,89,0,0,12,235,191,247,34,0,0,175,225, - 21,0,0,0,0,138,225,21,0,0,0,7,206,125,0,0,0,12,232,89,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,20,220,252,236,180,252,244,28,4,4,4,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,127,0,0,0,0,0,0,0,0, - 138,225,21,0,138,255,102,12,235,125,0,7,206,201,0,12,235,166,0,0,134,132, - 0,245,125,0,59,245,225,21,12,235,201,0,0,12,206,34,0,235,125,0,0,59,245, - 125,0,12,235,225,21,12,235,125,0,0,89,247,34,12,235,102,0,89,247,34,12, - 235,125,0,138,251,89,0,12,235,125,12,0,235,125,0,7,206,166,0,0,138,225, - 21,12,235,125,0,0,89,247,34,12,235,166,0,7,206,201,0,12,235,125,0,7,206, - 201,0,59,245,125,0,12,235,225,21,12,235,125,0,0,0,138,125,0,0,138,225,29, - 0,206,166,0,0,7,206,166,0,59,245,247,34,0,0,175,255,201,0,0,0,59,245,225, - 21,0,89,255,201,0,0,12,235,166,0,175,225,21,0,0,138,255,166,0,0,89,251, - 89,0,0,0,0,0,89,247,34,0,0,0,7,206,125,0,0,0,59,238,34,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,4,36,236,252,252,252,108,4,4,4,4,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,127,0,0,0,0,0,0,0,0, - 7,206,255,255,171,206,102,12,232,226,255,255,225,21,0,0,12,235,255,255, - 247,34,0,89,255,255,247,163,225,21,0,7,206,255,255,247,34,12,0,235,125, - 0,0,0,89,255,255,247,163,225,21,12,235,125,0,0,89,247,34,12,235,102,0,89, - 247,34,12,235,125,0,0,175,251,34,0,235,125,12,0,235,125,0,7,206,166,0,0, - 138,225,21,12,235,125,0,0,89,247,34,0,12,235,255,255,201,0,0,12,235,255, - 255,255,225,21,0,0,89,255,255,247,163,225,21,12,235,125,0,0,0,89,255,255, - 255,247,34,0,0,89,255,255,127,0,59,245,255,225,111,247,34,0,0,59,245,125, - 0,0,0,12,235,166,0,0,59,245,125,7,0,206,225,21,0,12,235,201,0,0,59,241, - 89,0,0,175,255,255,255,255,247,0,0,89,247,34,0,0,0,7,206,125,0,0,0,59,238, - 34,0,0,0,0,0,0,0,0,0,0,0,0,0,0,4,4,60,252,252,204,4,4,4,4,4,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,127,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,138,201,0,0,0,0,0,0,0,0,0,0,0,0,0, - 89,247,34,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,12,235,125,0,0,0,0,0,0,0,0,0,0,138,225,21,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,138,225,21,0,0,0,0,0,0,0,0,0,0,89,247,34,0,0,0,7, - 206,125,0,0,0,59,238,34,0,0,0,0,0,0,0,0,0,0,0,0,0,0,4,4,4,76,252,60,4,4, - 4,4,4,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,127,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,7,199,34,0,12,232,89,0,0, - 0,0,0,0,0,0,0,0,0,0,0,138,225,21,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,12,235,125,0,0,0,0,0,0,0,0,0, - 0,138,225,21,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,7,206,166,0,0,0,0,0,0,0,0, - 0,0,0,12,235,125,0,0,0,7,206,125,0,0,0,138,225,21,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,76,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,127,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 12,235,255,247,34,0,0,0,0,0,0,0,0,0,0,0,0,0,255,251,89,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,12,235, - 125,0,0,0,0,0,0,0,0,0,0,138,225,21,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,89, - 247,34,0,0,0,0,0,0,0,0,0,0,0,0,89,255,251,89,0,7,206,125,0,89,255,247,34, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,127,127,127, - 127,127,127,127,0,127,127,127,127,127,127,0,127,127,127,127,127,127,127, - 0,127,127,127,127,127,127,0,127,127,127,127,127,127,127,0,127,127,127,127, - 127,127,127,0,127,127,127,127,0,127,127,127,127,127,127,127,0,127,127,127, - 127,127,127,127,0,127,127,0,127,127,127,0,127,127,127,127,127,127,127,0, - 127,127,127,0,127,127,127,127,127,127,127,127,127,127,127,0,127,127,127, - 127,127,127,127,0,127,127,127,127,127,127,127,0,127,127,127,127,127,127, - 127,0,127,127,127,127,127,127,127,0,127,127,127,127,127,0,127,127,127,127, - 127,127,0,127,127,127,127,0,127,127,127,127,127,127,127,0,127,127,127,127, - 127,127,0,127,127,127,127,127,127,127,127,127,127,0,127,127,127,127,127, - 127,0,127,127,127,127,127,127,0,127,127,127,127,127,0,127,127,127,127,127, - 127,127,0,127,127,127,0,127,127,127,127,127,127,0,127,127,127,127,127,127, - 127,127,127,127,0,127,127,127,127,127,127,127,127,127,127,127,127,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 127,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,7,206,125,0,175,166,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,206,125,0,175,166, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,127,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,59,245,225,21,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,7,206,255,125,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,7,206,255,125,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,175,166,0,138,201,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,175,166,0,138,201,0,7,206,166,12,235, - 125,0,0,0,0,0,0,127,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,175,125,0,0,0,0,0,175,125, - 0,0,0,0,0,175,171,206,125,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,89,255,125,0, - 31,206,130,255,166,175,247,34,0,0,89,255,125,175,247,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,59,245,247,34,138,166,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,59,241,132,238,34,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,59,241,132,238,34,0,0,0,0,0,0,0,0,0,0,0,0,0,127,0,0, - 59,245,255,255,255,125,0,12,235,255,255,255,255,255,225,21,0,0,0,0,0,0, - 0,0,175,255,255,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,175,125,0,0,0, - 0,0,175,125,0,0,0,0,89,225,21,59,238,34,0,0,138,255,255,201,0,0,0,59,215, - 21,0,0,0,0,0,0,0,0,0,12,235,255,255,255,247,34,0,0,0,0,0,0,0,12,235,255, - 255,255,255,255,255,255,255,251,89,0,12,235,255,255,255,255,255,225,21, - 0,89,255,255,255,255,255,255,125,0,12,235,255,255,255,255,255,225,21,0, - 0,12,235,255,255,255,255,255,225,21,7,206,201,0,50,206,56,255,201,12,235, - 125,0,0,138,225,29,206,166,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,7,202,89,89,255,225,21,0,89,255,255,255,225,81,245,201,0,138,251, - 89,0,0,138,255,166,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,12,235,255,255, - 255,255,255,225,21,0,0,0,138,255,166,7,206,225,21,0,0,0,138,247,34,0,0, - 0,0,127,0,89,255,125,0,0,0,0,0,12,146,0,0,0,0,0,144,21,0,0,0,0,0,0,0,89, - 247,34,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,175,125,0,0,0,0,0,175, - 125,0,0,0,0,0,0,0,0,0,0,0,59,241,89,12,235,125,0,0,172,89,0,0,0,0,0,0,0, - 0,0,12,235,166,0,0,7,202,89,0,0,0,0,0,0,89,255,201,0,0,12,235,125,0,0,0, - 0,0,0,12,146,0,0,0,0,0,144,21,0,0,0,0,0,0,138,247,34,0,12,146,0,0,0,0,0, - 144,21,0,0,12,146,0,0,0,0,0,144,21,0,89,225,21,71,157,22,191,225,21,175, - 201,0,7,206,125,59,238,34,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,175,125,0,59,196,199,47,206,184,89,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,12,146,0,0,0,0,0,144,21,0,0,0,0, - 0,0,0,59,245,125,0,0,59,245,125,0,0,0,0,0,127,12,235,166,0,0,0,0,0,0,12, - 146,0,0,0,0,0,144,21,0,0,0,0,0,0,0,175,201,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,12,235,255,255,255,255,127,34,235,255,255,255,255,225,21,0, - 0,0,0,0,0,0,0,89,247,34,7,206,166,0,89,201,0,0,0,0,0,0,0,0,0,0,89,247,34, - 0,0,0,0,0,0,0,0,59,115,12,235,166,0,0,0,12,235,125,0,0,0,0,0,0,12,146,0, - 0,0,0,0,144,21,0,0,0,0,0,59,245,125,0,0,12,146,0,0,0,0,0,144,21,0,0,12, - 146,0,0,0,0,0,144,21,0,7,202,89,117,104,0,29,202,89,59,215,21,59,215,21, - 138,201,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,175,125,0,59,192,89,223,125,172,89,0,138,255,255,255,201,12,182, - 0,0,0,0,0,175,255,255,125,0,89,255,255,247,34,0,0,12,146,0,0,0,0,0,144, - 21,0,138,255,255,255,255,247,34,138,247,34,7,206,201,0,0,0,0,0,0,127,89, - 251,89,0,0,0,0,0,0,12,146,0,0,0,0,0,144,21,0,0,0,0,0,0,7,206,166,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,175,125,0,0,0,0,0,175,125,0,0,0, - 0,0,0,0,0,0,0,0,89,247,34,7,206,166,7,202,89,0,0,0,0,0,0,0,0,0,0,89,255, - 125,0,0,0,0,0,0,0,89,255,125,89,247,34,0,0,0,12,235,125,0,0,0,0,0,0,12, - 146,0,0,0,0,0,144,21,0,0,0,0,7,206,201,0,0,0,12,146,0,0,0,0,0,144,21,0, - 0,12,146,0,0,0,0,0,144,21,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,59,245, - 255,201,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,175, - 125,0,59,192,12,228,34,172,89,89,247,34,0,12,206,29,206,201,0,0,7,206,166, - 0,7,206,255,225,21,0,89,247,34,0,12,146,0,0,0,0,0,144,21,0,0,0,0,7,206, - 166,0,12,235,166,89,247,34,0,0,0,0,0,0,127,245,255,255,255,255,255,201, - 0,0,12,146,0,0,0,0,0,144,21,0,0,0,0,0,59,245,255,255,255,127,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,175,125,0,0,0,0,0,175,125,0,0,0,0,0,0,0, - 0,0,0,0,59,241,89,12,235,125,89,201,12,235,255,251,89,0,89,255,255,225, - 21,0,175,255,255,225,21,0,0,0,89,251,89,0,138,225,21,0,0,0,12,235,255,255, - 255,255,225,21,0,12,146,0,0,0,0,0,144,21,0,0,0,0,138,247,34,0,0,0,12,146, - 0,0,0,0,0,144,21,0,0,12,146,0,0,0,0,0,144,21,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,12,235,255,255,255,166,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,175,125,0,59,192,0,0,0,172,89,138,225,21,0,0,0, - 0,7,206,225,21,138,225,21,0,0,89,251,89,0,0,12,235,125,0,12,146,0,0,0,0, - 0,144,21,0,0,0,0,138,225,21,0,0,89,255,255,125,0,0,0,0,0,0,0,127,138,225, - 21,0,0,0,0,0,0,12,146,0,0,0,0,0,144,21,0,0,0,0,0,0,59,241,89,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,175,125,0,0,12,235,255,255,255,255, - 225,21,0,0,0,0,0,0,0,0,0,138,255,255,201,12,228,34,175,166,0,138,201,7, - 206,125,7,206,166,0,0,0,89,255,255,247,34,59,241,89,0,0,138,225,21,0,0, - 0,12,235,125,0,0,0,0,0,0,12,146,0,0,0,0,0,144,21,0,0,0,59,245,125,0,0,0, - 0,12,146,0,0,0,0,0,144,21,0,0,12,146,0,0,0,0,0,144,21,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,59,245,255,255,255,207,235,255,255,255,255,255,255, - 207,235,255,255,255,255,255,255,255,255,255,255,255,225,21,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,59,245,255,247,34,0,0,0,0,175,166,175,201,0,0,0, - 59,245,255,255,255,255,255,125,0,12,146,0,0,0,0,0,144,21,0,0,0,89,251,89, - 0,0,0,7,206,225,21,0,0,0,0,0,0,0,127,245,255,255,255,255,255,125,0,0,12, - 146,0,0,0,0,0,144,21,0,0,0,0,0,0,59,241,89,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,175,125,0,0,0,0,0,175,125,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,138,166,7,206,125,0,89,247,94,241,89,0,138,201,0,0,0,0,0,59,245,166, - 0,89,251,89,0,89,247,34,0,0,0,12,235,125,0,0,0,0,0,0,12,146,0,0,0,0,0,144, - 21,0,0,7,206,201,0,0,0,0,0,12,146,0,0,0,0,0,144,21,0,0,12,146,0,0,0,0,0, - 144,21,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,12,235,255,255,255,166,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,138,255,255,201,0,7,206,225,21,175,201,0,0,0,59,241,89,0,0,0,0, - 0,0,12,146,0,0,0,0,0,144,21,0,0,12,235,166,0,0,0,0,0,175,225,21,0,0,0,0, - 0,0,0,127,89,255,125,0,0,0,0,0,0,12,146,0,0,0,0,0,144,21,0,0,0,0,0,0,89, - 247,34,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,175,125,0,0,0,0,0, - 175,125,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,12,228,34,7,206,125,0,89,247,94,241, - 89,0,138,201,0,0,0,0,0,12,235,166,0,0,89,255,125,12,235,166,0,0,0,12,235, - 125,0,0,0,0,0,0,12,146,0,0,0,0,0,144,21,0,0,138,247,34,0,0,0,0,0,12,146, - 0,0,0,0,0,144,21,0,0,12,146,0,0,0,0,0,144,21,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,59,245,255,201,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,89,247,42,206,201,0,0,89, - 225,21,0,0,89,255,125,0,0,0,0,0,0,12,146,0,0,0,0,0,144,21,0,0,175,225,21, - 0,0,0,0,0,175,225,21,0,0,0,0,0,0,0,127,0,175,251,89,0,0,0,0,0,12,146,0, - 0,0,0,0,144,21,0,59,245,166,0,0,138,225,21,0,0,0,59,245,166,138,251,89, - 7,206,201,0,12,235,125,0,59,241,89,0,0,0,175,125,0,0,0,0,0,175,125,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,138,166,0,0,175,166,0,138,201,7,206,125,7,206, - 166,138,166,0,0,0,138,251,89,0,0,0,59,115,0,89,255,201,0,0,12,235,125,0, - 0,0,0,0,0,12,146,0,0,0,0,0,144,21,0,89,251,89,0,0,0,0,0,0,12,146,0,0,0, - 0,0,144,21,0,0,12,146,0,0,0,0,0,144,21,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,138,125,0,0,138,225,34,182,0,0,0,7,206,166,0, - 7,206,255,247,34,0,0,175,125,0,12,146,0,0,0,0,0,144,21,0,89,251,89,0,0, - 0,0,0,0,175,225,21,0,0,0,0,0,0,0,127,0,0,138,255,255,255,255,125,0,12,235, - 255,255,255,255,255,225,21,0,138,247,34,0,7,206,166,0,0,0,0,89,247,34,175, - 201,0,7,206,201,0,12,235,125,0,59,241,89,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,59,215,21,0,0,12,235,255,251,89,0,89,255,255,225, - 21,12,235,255,255,255,247,34,0,0,0,0,0,0,0,0,12,235,255,255,255,255,255, - 255,255,255,251,89,0,12,235,255,255,255,255,255,225,21,0,138,255,255,255, - 255,255,255,166,0,12,235,255,255,255,255,255,225,21,0,0,12,235,255,255, - 255,255,255,225,21,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,89,255,255,255,247,34,0,0,0,0,0,0,0,175,255,255,125,0,138,255,255, - 255,125,0,0,12,235,255,255,255,255,255,225,21,0,175,255,255,255,255,247, - 0,0,0,175,225,21,0,0,0,0,0,0,0,127,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,175,166,0,255,255,201,0,0,0,0,0,175,166,12,232,89,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,127,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,12, - 228,34,0,0,0,0,0,0,0,0,12,232,89,59,215,21,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,127,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 127,127,127,127,127,127,127,127,0,127,127,127,127,127,127,127,127,0,127, - 127,127,0,127,127,127,127,127,127,0,127,127,127,127,127,127,0,127,127,127, - 127,127,127,127,127,127,127,127,0,127,127,127,127,127,0,127,127,127,127, - 127,127,127,0,127,127,127,127,127,127,127,0,127,127,127,127,127,127,127, - 127,127,127,127,127,127,127,127,127,127,127,0,127,127,127,127,127,127,127, - 0,127,127,127,127,0,127,127,127,127,127,127,127,127,127,127,127,127,127, - 0,127,127,127,127,127,127,127,127,127,127,0,127,127,127,127,127,127,127, - 127,0,127,127,127,127,127,127,127,127,127,127,0,127,127,127,127,127,127, - 127,127,0,127,127,127,0,127,127,0,127,127,127,127,127,0,127,127,127,127, - 127,0,127,127,127,127,127,0,127,127,127,127,127,127,127,0,127,127,127,127, - 127,127,127,127,127,127,127,127,0,127,127,127,127,127,127,0,127,127,127, - 127,127,127,127,127,127,127,127,0,127,127,127,127,127,0,127,127,127,127, - 0,127,127,127,127,127,127,127,127,127,127,127,127,127,0,127,127,127,127, - 127,127,127,127,127,0,127,127,127,127,127,0,127,127,127,127,127,127,127, - 127,0,0,0,0,0,127,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,127,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,245,255,255,255,255,255,255,225,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,12,235,225,21,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,127,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,7,206,125,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,89,247,34,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,127,0,0,0,0,0,89,247, - 34,0,0,0,0,59,192,0,0,0,0,0,7,206,255,255,225,21,0,0,0,0,0,0,0,0,138,247, - 34,0,0,89,251,89,0,7,206,125,0,0,7,206,255,255,255,166,0,89,251,89,138, - 247,34,0,0,0,0,7,206,255,255,255,247,34,0,0,0,0,175,255,255,251,89,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,7,206,255,255,255,247, - 34,0,0,0,0,0,0,0,0,0,0,0,0,89,255,255,247,34,0,0,0,0,0,0,0,0,0,0,0,0,12, - 235,255,247,34,0,0,7,206,255,251,89,0,0,7,206,125,0,0,0,0,0,0,0,0,0,0,0, - 0,89,255,255,255,255,225,21,0,0,0,0,0,0,0,0,0,0,0,0,0,0,7,202,89,0,0,0, - 59,245,255,247,34,0,0,0,0,0,0,0,0,0,0,0,89,201,0,0,0,0,175,166,0,0,0,0, - 0,0,89,201,0,0,0,0,175,166,0,0,0,0,0,59,245,255,201,0,0,0,59,241,89,0,0, - 0,0,0,59,245,125,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,127,0,0,0,0,0,89,247,34, - 0,0,0,0,59,192,0,0,0,0,0,175,201,0,0,144,21,0,0,0,0,0,0,0,0,7,206,166,0, - 7,206,166,0,0,7,206,125,0,7,206,201,0,0,89,166,0,0,0,0,0,0,0,0,0,0,89,255, - 125,0,0,0,59,245,166,0,0,0,0,0,0,12,206,21,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,89,255,125,0,0,0,59,245,166,0,0,0,0,0,0,0,0,0,0,59, - 241,89,0,138,201,0,0,0,0,0,138,166,0,0,0,0,0,168,34,7,206,166,0,0,172,89, - 0,175,166,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,89,255,255,255,166,89,225,21, - 0,0,0,0,0,0,0,0,0,0,0,0,0,89,255,251,89,0,0,12,235,125,0,138,225,21,0,0, - 0,0,0,0,0,0,7,206,255,201,0,0,0,89,225,21,0,0,0,0,7,206,255,201,0,0,0,89, - 225,21,0,0,0,0,12,206,21,12,235,125,0,0,175,166,0,0,0,0,0,0,59,245,125, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,127,0,0,0,0,0,0,0,0,0,0,0,175,255,255,255, - 166,0,0,12,235,125,0,0,0,0,89,225,21,0,0,12,232,89,0,89,247,34,89,247,34, - 0,0,7,206,125,0,12,235,125,0,0,0,0,0,0,0,0,0,0,0,0,0,89,225,21,0,0,0,0, - 0,7,206,125,0,0,7,206,255,255,247,34,0,0,0,85,89,0,85,89,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,89,225,21,0,0,0,0,0,7,206,125,0,0,0,0,0,0,0,0,0,89,201, - 0,0,12,228,34,0,0,0,0,138,166,0,0,0,0,0,0,0,7,206,125,0,0,7,206,255,166, - 0,0,0,0,0,0,0,0,0,12,235,125,0,0,89,247,34,175,255,255,255,166,89,225,21, - 0,89,255,125,0,0,0,0,0,0,0,0,0,0,7,202,89,0,0,89,225,21,0,12,232,89,59, - 115,0,59,115,0,0,0,0,0,89,201,0,0,7,206,125,0,0,0,0,0,0,0,89,201,0,0,7, - 206,125,0,0,0,0,0,0,0,0,12,232,89,0,59,238,34,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,127,0,0,0,0,0,89,225,21,0,0,138,247,94,192,12,182, - 0,0,12,235,125,0,0,0,0,0,175,255,255,255,255,166,0,0,7,206,171,206,166, - 0,0,0,7,206,125,0,7,206,251,89,0,0,0,0,0,0,0,0,0,0,0,7,202,89,0,59,245, - 255,255,201,0,12,228,34,12,235,166,0,12,228,34,0,0,138,251,89,138,247,34, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,7,202,89,0,138,255,255,255,125,0,12,228,34, - 0,0,0,0,0,0,0,0,59,241,89,0,138,201,0,0,0,0,0,138,166,0,0,0,0,0,0,0,175, - 201,0,0,0,0,0,0,175,201,0,0,0,0,0,0,0,0,12,235,125,0,0,89,247,34,175,255, - 255,255,166,89,225,21,0,89,255,125,0,0,0,0,0,0,0,0,0,0,7,202,89,0,0,138, - 225,21,0,12,235,125,12,235,166,59,245,166,0,0,0,0,89,201,0,0,89,225,21, - 0,0,0,0,0,0,0,89,201,0,0,89,225,21,0,0,0,0,0,0,12,235,255,125,0,0,175,125, - 0,0,0,0,0,0,0,12,235,125,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,127,0,0,0,0,0,89, - 225,21,0,12,235,125,59,192,0,0,0,0,12,235,125,0,0,0,0,0,59,215,21,59,238, - 34,0,0,0,89,255,247,34,0,0,0,7,206,125,0,0,7,206,255,255,247,34,0,0,0,0, - 0,0,0,0,59,192,0,12,235,166,0,7,176,21,0,175,125,59,238,34,0,12,228,34, - 0,138,247,34,138,247,34,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,59,192,0,0,138, - 201,0,89,247,34,0,175,125,0,0,0,0,0,0,0,0,0,89,255,255,225,21,0,7,206,255, - 255,255,255,255,255,247,34,0,12,235,125,0,0,0,7,176,21,0,175,201,0,0,0, - 0,0,0,0,0,12,235,125,0,0,89,247,34,89,255,255,255,166,89,225,21,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,7,202,89,0,0,89,225,21,0,12,232,89,0,12,235,166,12, - 235,166,0,0,0,89,201,0,7,206,125,0,12,235,166,0,0,0,0,89,201,0,7,206,125, - 89,255,255,255,125,0,0,0,0,7,206,125,89,225,21,0,138,225,21,0,0,0,138,255, - 125,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,127,0,0,0,0,0,89,247,34,0,59,241,89,59, - 192,0,0,0,12,235,255,255,255,225,21,0,0,138,166,0,7,202,89,0,0,0,7,206, - 166,0,0,0,0,0,0,0,0,7,206,125,0,12,235,201,0,0,0,0,0,0,0,0,89,166,0,89, - 247,34,0,0,0,0,0,89,166,12,232,89,0,138,247,34,89,247,34,59,238,34,0,0, - 12,235,255,255,255,255,255,255,247,34,89,255,255,255,166,89,166,0,0,138, - 201,0,138,225,21,0,89,166,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,138,166, - 0,0,0,0,7,206,255,255,255,247,34,0,59,245,255,247,34,0,0,0,0,0,0,0,0,12, - 235,125,0,0,89,247,34,0,89,255,255,166,89,225,21,0,0,0,0,0,0,0,0,0,0,0, - 0,0,89,255,255,255,166,0,12,235,125,0,138,225,21,0,0,12,235,125,12,235, - 125,0,0,89,201,0,89,201,0,7,206,223,166,0,0,0,0,89,201,0,89,201,0,89,125, - 0,138,225,21,12,182,0,7,206,133,206,125,0,89,232,215,21,0,7,206,247,34, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,127,0,0,0,0,0,89,247,34,0,59,241,89,59, - 192,0,0,0,0,12,235,125,0,0,0,0,0,59,215,21,59,238,34,0,59,245,255,255,255, - 255,225,21,0,0,0,0,0,59,241,89,0,0,138,225,21,0,0,0,0,0,0,0,89,166,0,89, - 247,34,0,0,0,0,0,89,166,0,138,255,255,176,228,34,0,138,247,34,138,247,34, - 0,0,0,0,0,0,0,0,59,238,34,0,0,0,0,0,89,166,0,0,138,255,255,225,21,0,0,89, - 166,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,138,166,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,12,235,125,0,0,89,247,34,0,0,0,138,166,89,225, - 21,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,59,245,255,247,34,0,0,12,235, - 166,12,235,166,0,0,0,0,0,12,232,89,0,175,166,138,166,0,0,0,0,0,0,12,232, - 89,0,0,0,0,138,201,0,0,89,255,255,201,89,225,21,89,225,81,215,21,0,138, - 247,34,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,127,0,0,0,0,0,89,247,34,0,12,235, - 125,59,192,0,0,0,0,59,241,89,0,0,0,0,0,175,255,255,255,255,166,0,0,0,7, - 206,166,0,0,0,0,7,206,125,0,12,235,201,0,7,206,166,0,0,0,0,0,0,0,0,59,192, - 0,12,235,166,0,7,176,21,0,175,125,0,0,0,0,0,0,0,0,0,138,251,89,138,247, - 34,0,0,0,0,0,0,0,59,238,34,0,0,0,0,0,59,192,0,0,138,201,59,245,166,0,0, - 175,125,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,138,166,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,12,235,125,0,0,89,247,34,0,0,0,138,166, - 89,225,21,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,12,235,166, - 59,245,166,0,0,0,0,0,0,138,201,0,138,201,0,138,166,0,0,0,0,0,0,138,201, - 0,0,0,0,89,247,34,0,0,0,0,0,7,206,125,59,238,34,59,215,21,0,175,225,21, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,127,0,0,0,0,0,89,247,34,0,0,175,225,81, - 192,12,182,0,7,206,125,0,0,0,0,0,89,225,21,0,0,12,232,89,0,0,7,206,166, - 0,0,0,0,7,206,125,0,0,59,245,255,255,166,0,0,0,0,0,0,0,0,0,7,202,89,0,59, - 245,255,255,166,0,12,228,34,0,0,0,0,0,0,0,0,0,0,85,89,0,85,89,0,0,0,0,0, - 0,0,59,238,34,0,0,0,0,0,7,202,89,0,138,201,0,59,245,225,34,228,34,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,7,206,255,255,255,255,255,255,247,34,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,12,235,201,0,0,175,247,34,0,0,0,138,166, - 89,225,21,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,59,115,0, - 59,115,0,0,0,0,0,0,12,232,89,0,175,255,255,255,255,201,0,0,0,0,12,232,89, - 0,0,0,138,201,0,0,0,0,0,0,0,89,201,0,89,255,255,255,255,247,34,138,251, - 89,0,7,176,21,0,0,0,0,0,0,0,0,0,0,0,0,0,127,0,0,0,0,0,138,247,34,0,0,0, - 175,255,255,255,166,0,89,255,255,255,255,255,247,34,0,0,0,0,0,0,0,0,0,0, - 7,206,166,0,0,0,0,7,206,125,0,0,0,0,0,138,255,166,0,0,0,0,0,0,0,0,0,89, - 225,21,0,0,0,0,0,7,206,125,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,59,238,34,0,0,0,0,0,0,89,225,21,0,0,0,0,0,7,206,125,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,12,235,191,255,255,166,238,34,0,0,0,138,166,89,225,21,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,175,201,0,0, - 0,0,0,138,166,0,0,0,0,0,175,201,0,0,0,89,255,255,255,255,125,0,0,0,12,232, - 89,0,0,0,0,59,215,21,0,0,138,255,255,255,225,21,0,0,0,0,0,0,0,0,0,0,0,0, - 0,127,0,0,0,0,0,0,0,0,0,0,0,0,59,192,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,7,206,125,0,0,0,0,0,0,175,201,0,0,0,0,0,0,0,0,0,0, - 89,255,125,0,0,0,59,245,166,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,89,255,125,0,0,0,59,245,166,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,12,235,125,0,0,0,0,0,0,0,0,138,166,89,225,21,0,0,0,0,0,0,0,0,0,175, - 125,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,127,0,0,0,0,0,0,0,0,0,0,0,0,59,192,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,7,206,125,0,7,199,34, - 0,12,235,125,0,0,0,0,0,0,0,0,0,0,0,7,206,255,255,255,247,34,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,7,206,255,255, - 255,247,34,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,12,235,125,0,0,0,0,0,0,0,0,138,166, - 89,225,21,0,0,0,0,0,0,0,0,7,202,89,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,127,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,7,206,125,0,7,206,255,255,255,166,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,12,235,125,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,12,235,255,201,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,127, - 127,127,0,127,127,127,127,0,127,127,127,127,127,127,127,0,127,127,127,127, - 127,127,127,0,127,127,127,127,127,127,127,0,127,127,127,127,127,127,127, - 127,0,127,127,127,0,127,127,127,127,127,127,127,0,127,127,127,127,127,127, - 0,127,127,127,127,127,127,127,127,127,127,127,127,0,127,127,127,127,127, - 127,0,127,127,127,127,127,127,127,127,0,127,127,127,127,127,127,127,127, - 0,127,127,127,127,0,127,127,127,127,127,127,127,127,127,127,127,127,0,127, - 127,127,127,127,127,127,0,127,127,127,127,127,127,0,127,127,127,127,127, - 127,127,127,127,0,127,127,127,127,127,127,127,0,127,127,127,127,127,0,127, - 127,127,127,127,127,0,127,127,127,127,127,127,127,0,127,127,127,127,127, - 127,127,0,127,127,127,127,127,0,127,127,127,127,127,127,0,127,127,127,127, - 127,0,127,127,127,127,127,127,0,127,127,127,127,127,127,127,0,127,127,127, - 127,127,127,127,127,127,127,127,127,127,0,127,127,127,127,127,127,127,127, - 127,127,127,127,127,0,127,127,127,127,127,127,127,127,127,127,127,127,127, - 0,127,127,127,127,127,127,127,0,0,0,0,0,0,0,0,0,0,0,0,0,127,0,0,0,138,225, - 21,0,0,0,0,0,12,235,125,0,0,0,0,19,172,255,190,11,0,0,0,0,138,255,201,7, - 202,89,0,0,0,0,0,0,0,0,0,0,7,206,255,125,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,59,138,225,21,0,0,0,0,0,0,59,245,201,0,0,0,19,172, - 255,190,11,0,0,0,0,0,0,0,0,0,7,206,225,21,0,0,0,59,245,201,19,172,255,190, - 11,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,12,235,251,89,89,201,0,0,0,0,0,175, - 201,0,0,0,0,0,0,0,0,7,206,225,21,0,0,0,0,0,19,172,255,190,11,0,0,0,0,0, - 175,255,166,12,228,34,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,89,255,125,0,0,0,0,0,0,0,12,175,247,34,0,0,0,19,172,255, - 190,11,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,175,247,34,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,127,0,0,0,7,206,125,0,0,0,0,0,138,201,0,0,0,0,0,136,190, - 45,196,145,0,0,0,59,215,21,175,255,166,0,0,0,175,225,29,206,166,0,0,7,202, - 89,7,202,89,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,209,125, - 0,0,0,0,0,0,138,225,21,0,0,0,136,190,45,196,145,0,0,0,175,225,29,206,166, - 0,0,12,235,125,0,0,12,138,225,21,136,190,45,196,145,159,251,89,138,247, - 34,0,0,0,0,0,0,0,0,0,0,0,175,125,59,245,247,34,0,0,0,0,0,12,232,89,0,0, - 0,0,0,0,0,175,166,0,0,0,0,0,0,12,136,190,45,196,145,0,0,0,0,138,166,12, - 235,255,125,0,0,0,0,7,206,166,12,235,125,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,12,232,89,0,0,0,0,0,0,138,201,0,0,0,0,0,136,190,45, - 196,145,34,0,0,0,89,251,89,138,247,34,0,0,0,0,0,138,201,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,127,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,7,202,89,7,202,89,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,89,255, - 255,125,0,0,0,0,127,0,0,7,206,251,89,0,0,0,0,7,206,251,89,0,0,0,0,7,206, - 251,89,0,0,0,0,0,7,206,251,89,0,0,0,0,7,206,251,89,0,0,0,0,12,235,255,125, - 0,0,0,0,0,89,255,255,255,255,255,255,255,255,125,0,0,0,59,245,255,255,255, - 201,12,235,255,255,255,255,255,125,12,235,255,255,255,255,255,125,12,235, - 255,255,255,255,255,125,12,235,255,255,255,255,255,125,89,255,255,255,201, - 89,255,255,255,201,89,255,255,255,201,89,255,255,255,201,0,175,255,255, - 255,255,201,0,0,0,12,235,251,89,0,0,12,235,125,0,0,0,138,255,255,166,0, - 0,0,0,0,0,138,255,255,166,0,0,0,0,0,0,138,255,255,166,0,0,0,0,0,0,138,255, - 255,166,0,0,0,0,0,0,138,255,255,166,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,138, - 255,255,201,89,251,89,12,235,125,0,0,0,59,245,125,12,235,125,0,0,0,59,245, - 125,12,235,125,0,0,0,59,245,125,12,235,125,0,0,0,59,245,125,7,206,225,21, - 0,0,0,138,247,0,235,166,0,0,0,0,0,0,138,225,21,7,206,166,0,0,0,127,0,0, - 59,245,255,166,0,0,0,0,59,245,255,166,0,0,0,0,59,245,255,166,0,0,0,0,0, - 59,245,255,166,0,0,0,0,59,245,255,166,0,0,0,0,59,245,255,166,0,0,0,0,0, - 175,201,7,206,166,0,0,0,0,0,0,0,138,255,125,0,0,7,202,102,235,166,0,0,0, - 0,0,12,235,166,0,0,0,0,0,12,235,166,0,0,0,0,0,12,235,166,0,0,0,0,0,0,12, - 235,125,0,0,12,235,125,0,0,12,235,125,0,0,12,235,125,0,0,175,201,0,0,7, - 206,251,89,0,12,235,255,201,0,0,12,235,125,0,59,245,166,0,0,138,251,89, - 0,0,59,245,166,0,0,138,251,89,0,0,59,245,166,0,0,138,251,89,0,0,59,245, - 166,0,0,138,251,89,0,0,59,245,166,0,0,138,251,89,0,0,0,0,0,0,0,0,0,0,0, - 0,59,245,166,0,0,89,255,166,0,12,235,125,0,0,0,59,245,125,12,235,125,0, - 0,0,59,245,125,12,235,125,0,0,0,59,245,125,12,235,125,0,0,0,59,245,125, - 0,59,245,125,0,0,59,245,125,12,235,166,0,0,0,0,0,12,235,125,0,0,175,201, - 0,0,0,127,0,0,138,225,151,225,21,0,0,0,138,225,151,225,21,0,0,0,138,225, - 151,225,21,0,0,0,0,138,225,151,225,21,0,0,0,138,225,151,225,21,0,0,0,138, - 225,151,225,21,0,0,0,59,241,89,7,206,166,0,0,0,0,0,0,12,235,166,0,0,0,0, - 0,12,235,166,0,0,0,0,0,12,235,166,0,0,0,0,0,12,235,166,0,0,0,0,0,12,235, - 166,0,0,0,0,0,0,12,235,125,0,0,12,235,125,0,0,12,235,125,0,0,12,235,125, - 0,0,175,201,0,0,0,0,175,225,21,12,235,166,245,125,0,12,235,125,12,235,125, - 0,0,0,0,138,247,34,12,235,125,0,0,0,0,138,247,34,12,235,125,0,0,0,0,138, - 247,34,12,235,125,0,0,0,0,138,247,34,12,235,125,0,0,0,0,138,247,34,0,138, - 225,21,0,0,0,175,201,0,12,235,125,0,0,7,202,159,247,34,12,235,125,0,0,0, - 59,245,125,12,235,125,0,0,0,59,245,125,12,235,125,0,0,0,59,245,125,12,235, - 125,0,0,0,59,245,125,0,0,138,247,34,7,206,201,0,12,235,255,255,255,251, - 89,0,12,235,125,0,12,235,125,0,0,0,127,0,7,206,166,59,241,89,0,0,7,206, - 166,59,241,89,0,0,7,206,166,59,241,89,0,0,0,7,206,166,59,241,89,0,0,7,206, - 166,59,241,89,0,0,7,206,166,59,241,89,0,0,0,138,225,21,7,206,166,0,0,0, - 0,0,0,89,247,34,0,0,0,0,0,12,235,166,0,0,0,0,0,12,235,166,0,0,0,0,0,12, - 235,166,0,0,0,0,0,12,235,166,0,0,0,0,0,0,12,235,125,0,0,12,235,125,0,0, - 12,235,125,0,0,12,235,125,0,0,175,201,0,0,0,0,59,241,89,12,235,125,138, - 225,21,12,235,125,89,247,34,0,0,0,0,59,245,125,89,247,34,0,0,0,0,59,245, - 125,89,247,34,0,0,0,0,59,245,125,89,247,34,0,0,0,0,59,245,125,89,247,34, - 0,0,0,0,59,245,125,0,0,175,225,21,0,175,225,21,0,89,247,34,0,0,138,166, - 12,235,125,12,235,125,0,0,0,59,245,125,12,235,125,0,0,0,59,245,125,12,235, - 125,0,0,0,59,245,125,12,235,125,0,0,0,59,245,125,0,0,12,235,166,89,247, - 34,0,12,235,166,0,0,138,251,89,12,235,133,206,255,125,0,0,0,0,127,0,59, - 241,89,7,206,166,0,0,59,241,89,7,206,166,0,0,59,241,89,7,206,166,0,0,0, - 59,241,89,7,206,166,0,0,59,241,89,7,206,166,0,0,59,241,89,7,206,166,0,0, - 12,235,125,0,7,206,255,255,255,255,247,34,0,138,225,21,0,0,0,0,0,12,235, - 255,255,255,255,247,34,12,235,255,255,255,255,247,34,12,235,255,255,255, - 255,247,34,12,235,255,255,255,255,247,34,0,12,235,125,0,0,12,235,125,0, - 0,12,235,125,0,0,12,235,125,0,206,255,255,255,247,34,0,12,235,125,12,235, - 125,12,235,125,12,235,125,138,225,21,0,0,0,0,12,235,166,138,225,21,0,0, - 0,0,12,235,166,138,225,21,0,0,0,0,12,235,166,138,225,21,0,0,0,0,12,235, - 166,138,225,21,0,0,0,0,12,235,166,0,0,0,175,225,187,225,21,0,0,138,225, - 21,0,59,215,21,7,206,166,12,235,125,0,0,0,59,245,125,12,235,125,0,0,0,59, - 245,125,12,235,125,0,0,0,59,245,125,12,235,125,0,0,0,59,245,125,0,0,0,89, - 255,255,125,0,0,12,235,166,0,0,12,235,166,12,235,125,0,7,206,201,0,0,0, - 127,0,138,225,21,0,138,225,21,0,138,225,21,0,138,225,21,0,138,225,21,0, - 138,225,21,0,0,138,225,21,0,138,225,21,0,138,225,21,0,138,225,21,0,138, - 225,21,0,138,225,21,0,89,255,255,255,255,255,166,0,0,0,0,0,0,138,225,21, - 0,0,0,0,0,12,235,166,0,0,0,0,0,12,235,166,0,0,0,0,0,12,235,166,0,0,0,0, - 0,12,235,166,0,0,0,0,0,0,12,235,125,0,0,12,235,125,0,0,12,235,125,0,0,12, - 235,125,0,0,175,201,0,0,0,0,12,235,125,12,235,125,0,138,225,34,235,125, - 138,225,21,0,0,0,0,12,235,166,138,225,21,0,0,0,0,12,235,166,138,225,21, - 0,0,0,0,12,235,166,138,225,21,0,0,0,0,12,235,166,138,225,21,0,0,0,0,12, - 235,166,0,0,0,0,175,225,21,0,0,0,138,225,21,7,202,89,0,7,206,166,12,235, - 125,0,0,0,59,245,125,12,235,125,0,0,0,59,245,125,12,235,125,0,0,0,59,245, - 125,12,235,125,0,0,0,59,245,125,0,0,0,7,206,225,21,0,0,12,235,166,0,0,12, - 235,166,12,235,125,0,0,59,241,89,0,0,127,7,206,255,255,255,255,251,89,7, - 206,255,255,255,255,251,89,7,206,255,255,255,255,251,89,0,7,206,255,255, - 255,255,251,89,7,206,255,255,255,255,251,89,7,206,255,255,255,255,251,89, - 7,206,166,0,0,7,206,166,0,0,0,0,0,0,89,247,34,0,0,0,0,0,12,235,166,0,0, - 0,0,0,12,235,166,0,0,0,0,0,12,235,166,0,0,0,0,0,12,235,166,0,0,0,0,0,0, - 12,235,125,0,0,12,235,125,0,0,12,235,125,0,0,12,235,125,0,0,175,201,0,0, - 0,0,59,241,89,12,235,125,0,12,235,138,235,125,89,247,34,0,0,0,0,59,245, - 125,89,247,34,0,0,0,0,59,245,125,89,247,34,0,0,0,0,59,245,125,89,247,34, - 0,0,0,0,59,245,125,89,247,34,0,0,0,0,59,245,125,0,0,0,175,225,187,225,21, - 0,0,138,247,34,175,125,0,0,12,235,125,12,235,125,0,0,0,59,241,89,12,235, - 125,0,0,0,59,241,89,12,235,125,0,0,0,59,241,89,12,235,125,0,0,0,59,241, - 89,0,0,0,0,175,225,21,0,0,12,235,166,0,0,175,247,34,12,235,125,0,0,12,235, - 125,0,0,127,59,241,89,0,0,7,206,166,59,241,89,0,0,7,206,166,59,241,89,0, - 0,7,206,166,0,59,241,89,0,0,7,206,166,59,241,89,0,0,7,206,166,59,241,89, - 0,0,7,206,166,59,241,89,0,0,7,206,166,0,0,0,0,0,0,59,245,166,0,0,0,0,0, - 12,235,166,0,0,0,0,0,12,235,166,0,0,0,0,0,12,235,166,0,0,0,0,0,12,235,166, - 0,0,0,0,0,0,12,235,125,0,0,12,235,125,0,0,12,235,125,0,0,12,235,125,0,0, - 175,201,0,0,0,0,175,225,21,12,235,125,0,0,138,232,245,125,12,235,125,0, - 0,0,0,138,247,34,12,235,125,0,0,0,0,138,247,34,12,235,125,0,0,0,0,138,247, - 34,12,235,125,0,0,0,0,138,247,34,12,235,125,0,0,0,0,138,247,34,0,0,175, - 225,21,0,175,225,21,0,59,245,191,201,0,0,0,89,225,21,12,235,166,0,0,0,89, - 251,89,12,235,166,0,0,0,89,251,89,12,235,166,0,0,0,89,251,89,12,235,166, - 0,0,0,89,251,89,0,0,0,0,175,225,21,0,0,12,235,255,255,255,247,34,0,12,235, - 125,0,0,59,241,89,0,0,127,138,225,21,0,0,0,138,247,163,225,21,0,0,0,138, - 247,163,225,21,0,0,0,138,247,34,138,225,21,0,0,0,138,247,163,225,21,0,0, - 0,138,247,163,225,21,0,0,0,138,247,198,225,21,0,0,7,206,166,0,0,0,0,0,0, - 0,138,255,125,0,0,7,202,102,235,166,0,0,0,0,0,12,235,166,0,0,0,0,0,12,235, - 166,0,0,0,0,0,12,235,166,0,0,0,0,0,0,12,235,125,0,0,12,235,125,0,0,12,235, - 125,0,0,12,235,125,0,0,175,201,0,0,7,206,251,89,0,12,235,125,0,0,12,235, - 255,125,0,89,255,125,0,0,89,251,89,0,0,89,255,125,0,0,89,251,89,0,0,89, - 255,125,0,0,89,251,89,0,0,89,255,125,0,0,89,251,89,0,0,89,255,125,0,0,89, - 251,89,0,0,138,225,21,0,0,0,175,201,0,0,138,251,89,0,0,89,251,89,0,0,138, - 247,34,0,7,206,225,21,0,138,247,34,0,7,206,225,21,0,138,247,34,0,7,206, - 225,21,0,138,247,34,0,7,206,225,21,0,0,0,0,175,225,21,0,0,12,235,166,0, - 0,0,0,0,12,235,125,0,0,175,225,21,0,0,127,206,166,0,0,0,0,59,245,255,166, - 0,0,0,0,59,245,255,166,0,0,0,0,59,245,133,206,166,0,0,0,0,59,245,255,166, - 0,0,0,0,59,245,255,166,0,0,0,0,59,245,255,125,0,0,0,7,206,255,255,255,255, - 255,125,0,0,0,59,245,255,255,255,201,12,235,255,255,255,255,255,125,12, - 235,255,255,255,255,255,125,12,235,255,255,255,255,255,125,12,235,255,255, - 255,255,255,125,89,255,255,255,201,89,255,255,255,201,89,255,255,255,201, - 89,255,255,255,201,0,175,255,255,255,255,225,21,0,0,12,235,125,0,0,0,138, - 255,125,0,0,0,175,255,255,201,0,0,0,0,0,0,175,255,255,201,0,0,0,0,0,0,175, - 255,255,201,0,0,0,0,0,0,175,255,255,201,0,0,0,0,0,0,175,255,255,201,0,0, - 0,0,0,0,0,0,0,0,0,0,0,7,202,97,206,255,255,201,0,0,0,0,0,138,255,255,255, - 201,0,0,0,0,138,255,255,255,201,0,0,0,0,138,255,255,255,201,0,0,0,0,138, - 255,255,255,201,0,0,0,0,0,0,175,225,21,0,0,12,235,166,0,0,0,0,0,12,235, - 133,206,255,225,21,0,0,0,127,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,138,166,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,138,166,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,127,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,175,166,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,127,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,7,206,255,225,21, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,127,127,127,127,127, - 127,127,0,127,127,127,127,127,127,127,0,127,127,127,127,127,127,127,127, - 0,127,127,127,127,127,127,127,0,127,127,127,127,127,127,127,0,127,127,127, - 127,127,127,127,0,127,127,127,127,127,127,127,127,127,127,127,127,127,0, - 127,127,127,127,127,127,127,127,0,127,127,127,127,127,127,0,127,127,127, - 127,127,127,127,0,127,127,127,127,127,127,127,0,127,127,127,127,127,127, - 127,0,127,127,127,127,0,127,127,127,127,0,127,127,127,127,0,127,127,127, - 127,0,127,127,127,127,127,127,127,127,127,0,127,127,127,127,127,127,127, - 127,0,127,127,127,127,127,127,127,127,127,0,127,127,127,127,127,127,127, - 127,127,0,127,127,127,127,127,127,127,127,127,0,127,127,127,127,127,127, - 127,127,127,0,127,127,127,127,127,127,127,127,127,0,127,127,127,127,127, - 127,127,127,127,0,127,127,127,127,127,127,127,127,127,0,127,127,127,127, - 127,127,127,127,0,127,127,127,127,127,127,127,127,0,127,127,127,127,127, - 127,127,127,0,127,127,127,127,127,127,127,127,0,127,127,127,127,127,127, - 127,127,0,127,127,127,127,127,127,127,0,127,127,127,127,127,127,127,127, - 0,0,127,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,127,0,7,206,225,21, - 0,0,0,0,0,12,235,225,21,0,0,89,255,225,21,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,7,206,255,247,34,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,7,206,247, - 34,0,0,0,0,0,0,0,138,251,89,0,0,59,245,247,34,0,0,0,0,0,0,0,0,0,175,247, - 34,0,0,175,0,255,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,7,206,225,21, - 0,0,0,0,0,0,0,138,255,125,0,0,0,12,235,251,89,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,138,251,89,0,0,0,0,0,0, - 7,206,225,21,0,0,0,7,206,251,89,0,0,0,0,0,0,0,0,0,0,0,0,0,59,245,166,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,127,0,0,59,241,89,0,0,0,0, - 0,89,247,34,0,0,7,206,138,235,125,0,0,89,255,225,21,175,125,0,0,0,0,0,0, - 0,0,0,138,201,0,138,201,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,12, - 235,125,0,0,0,0,0,0,12,235,125,0,0,0,175,171,206,166,0,0,0,0,0,0,0,0,0, - 7,206,166,0,59,245,255,166,238,0,0,0,0,0,0,0,0,0,0,0,0,7,206,255,125,59, - 215,21,0,0,59,241,89,0,0,0,0,0,0,7,206,166,0,0,0,0,138,201,175,201,0,0, - 0,12,235,251,89,89,201,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,7,206,166,0,0,0,0,0,0,89,247,34,0,0,0,0,89,225,151,201,0,0,0,0, - 0,0,0,0,0,0,0,0,0,175,201,0,12,235,125,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,127,0,0,0,138,201,0,0,0,0,7,206,125,0,0,0,138,201,0,89,225,21, - 12,228,34,138,255,201,0,0,0,138,247,34,175,225,21,0,138,201,0,138,201,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,89,225,21,0,0,0,0,0,89,225, - 21,0,0,89,247,34,59,241,89,0,59,241,89,89,247,34,0,0,89,225,21,175,127, - 215,21,206,247,42,206,0,138,255,247,42,206,125,0,0,138,166,12,235,251,89, - 0,0,0,0,138,201,0,0,0,0,0,0,89,225,21,0,0,0,59,241,89,12,235,125,0,0,175, - 125,59,245,247,34,0,0,12,235,125,89,251,89,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,59,238,34,0,0,0,0,0,175,166,0,0,0,0,12,232,89,7,206,125,0, - 0,12,235,166,59,245,125,0,0,0,59,238,34,0,12,235,125,0,0,0,0,0,0,89,247, - 34,138,225,21,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,127,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,7,206,255,247,34,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,175,251,89,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,7,199,34,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,12,235,125,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,127,12,235,255,255,255,166,0,12,235,255, - 255,255,166,0,12,235,255,255,255,166,0,12,235,255,255,255,166,0,0,12,235, - 255,255,255,166,0,12,235,255,255,255,166,0,12,235,255,255,255,166,0,175, - 255,255,125,0,0,12,235,255,255,125,0,0,12,235,255,255,225,21,0,0,12,235, - 255,255,225,21,0,12,235,255,255,225,21,0,12,235,255,255,225,21,0,12,235, - 125,12,235,125,12,235,125,12,235,125,0,12,235,125,89,251,89,0,12,235,138, - 235,255,247,34,0,0,12,235,255,255,201,0,0,0,12,235,255,255,201,0,0,0,12, - 235,255,255,201,0,0,0,12,235,255,255,201,0,0,0,12,235,255,255,201,0,0,0, - 0,0,0,175,247,34,0,0,0,12,235,255,255,255,166,0,59,241,89,0,0,89,247,34, - 59,241,89,0,0,89,247,34,59,241,89,0,0,89,247,34,59,241,89,0,0,89,247,42, - 206,201,0,0,0,138,232,245,166,245,255,251,89,7,206,201,0,0,0,138,225,21, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,127,12,206,21,0,59,245,125,12,206,21,0,59,245,125,12,206, - 21,0,59,245,125,12,206,21,0,59,245,125,0,12,206,21,0,59,245,125,12,206, - 21,0,59,245,125,12,206,21,0,12,235,255,125,0,7,206,166,12,235,166,0,0,172, - 102,0,235,125,0,0,175,201,0,12,235,125,0,0,175,201,12,235,125,0,0,175,201, - 12,235,125,0,0,175,201,0,12,235,125,12,235,125,12,235,125,12,235,125,0, - 0,0,0,0,175,201,0,12,235,247,34,0,175,201,0,12,235,166,0,7,206,201,0,12, - 235,166,0,7,206,201,0,12,235,166,0,7,206,201,0,12,235,166,0,7,206,201,0, - 12,235,166,0,7,206,201,0,0,0,0,0,175,247,34,0,0,12,235,166,0,12,235,201, - 0,59,241,89,0,0,89,247,34,59,241,89,0,0,89,247,34,59,241,89,0,0,89,247, - 34,59,241,89,0,0,89,247,34,89,247,34,0,7,206,176,235,225,21,0,175,225,21, - 89,247,34,0,7,206,166,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,127,0,0,0,0,7,206,166,0,0,0,0,7, - 206,166,0,0,0,0,7,206,166,0,0,0,0,7,206,166,0,0,0,0,0,7,206,166,0,0,0,0, - 7,206,166,0,0,0,0,0,175,201,0,0,0,89,225,138,225,21,0,0,0,0,89,225,21,0, - 0,89,247,34,89,225,21,0,0,89,247,124,225,21,0,0,89,247,124,225,21,0,0,89, - 247,34,12,235,125,12,235,125,12,235,125,12,235,125,0,89,255,255,255,255, - 247,34,12,235,125,0,0,89,247,34,138,225,21,0,0,59,238,34,138,225,21,0,0, - 59,238,34,138,225,21,0,0,59,238,34,138,225,21,0,0,59,238,34,138,225,21, - 0,0,59,238,34,0,0,0,0,0,0,0,0,0,138,225,21,0,172,132,238,34,59,241,89,0, - 0,89,247,34,59,241,89,0,0,89,247,34,59,241,89,0,0,89,247,34,59,241,89,0, - 0,89,247,34,12,235,125,0,59,238,47,235,125,0,0,59,241,89,12,235,125,0,59, - 238,34,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,127,0,59,245,255,255,255,166,0,59,245,255,255, - 255,166,0,59,245,255,255,255,166,0,59,245,255,255,255,166,0,0,59,245,255, - 255,255,166,0,59,245,255,255,255,166,0,89,255,255,255,255,255,255,255,255, - 255,247,175,201,0,0,0,0,0,175,255,255,255,255,255,247,34,175,255,255,255, - 255,255,247,198,255,255,255,255,255,247,198,255,255,255,255,255,247,34, - 12,235,125,12,235,125,12,235,125,12,235,125,89,251,89,0,0,59,241,89,12, - 235,125,0,0,89,247,34,175,201,0,0,0,12,232,89,175,201,0,0,0,12,232,89,175, - 201,0,0,0,12,232,89,175,201,0,0,0,12,232,89,175,201,0,0,0,12,232,89,7,206, - 255,255,255,255,255,255,251,226,201,0,89,166,12,232,89,59,241,89,0,0,89, - 247,34,59,241,89,0,0,89,247,34,59,241,89,0,0,89,247,34,59,241,89,0,0,89, - 247,34,0,175,201,0,138,201,12,235,125,0,0,12,235,125,0,175,201,0,138,201, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,127,89,255,166,0,7,206,166,89,255,166,0,7,206,166,89, - 255,166,0,7,206,166,89,255,166,0,7,206,166,0,89,255,166,0,7,206,166,89, - 255,166,0,7,206,166,138,255,125,0,0,175,201,0,0,0,0,0,175,201,0,0,0,0,0, - 175,201,0,0,0,0,0,0,175,201,0,0,0,0,0,175,201,0,0,0,0,0,175,201,0,0,0,0, - 0,0,12,235,125,12,235,125,12,235,125,12,235,125,175,201,0,0,0,59,241,89, - 12,235,125,0,0,89,247,34,175,201,0,0,0,12,232,89,175,201,0,0,0,12,232,89, - 175,201,0,0,0,12,232,89,175,201,0,0,0,12,232,89,175,201,0,0,0,12,232,89, - 0,0,0,0,0,0,0,0,0,175,201,7,176,21,12,232,89,59,241,89,0,0,89,247,34,59, - 241,89,0,0,89,247,34,59,241,89,0,0,89,247,34,59,241,89,0,0,89,247,34,0, - 89,247,47,235,125,12,235,125,0,0,12,235,125,0,89,247,47,235,125,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,127,175,201,0,0,7,206,166,175,201,0,0,7,206,166,175,201,0,0, - 7,206,166,175,201,0,0,7,206,166,0,175,201,0,0,7,206,166,175,201,0,0,7,206, - 166,175,201,0,0,0,138,225,21,0,0,0,0,138,225,21,0,0,0,0,138,247,34,0,0, - 0,0,0,138,247,34,0,0,0,0,138,247,34,0,0,0,0,138,247,34,0,0,0,0,0,12,235, - 125,12,235,125,12,235,125,12,235,125,175,201,0,0,0,89,247,34,12,235,125, - 0,0,89,247,34,138,225,21,0,0,89,247,34,138,225,21,0,0,89,247,34,138,225, - 21,0,0,89,247,34,138,225,21,0,0,89,247,34,138,225,21,0,0,89,247,34,0,0, - 0,0,175,247,34,0,0,138,225,151,125,0,89,247,34,59,241,89,0,0,89,247,34, - 59,241,89,0,0,89,247,34,59,241,89,0,0,89,247,34,59,241,89,0,0,89,247,34, - 0,12,235,191,247,34,12,235,125,0,0,59,241,89,0,12,235,191,247,34,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,127,138,225,21,0,138,255,166,138,225,21,0,138,255,166,138, - 225,21,0,138,255,166,138,225,21,0,138,255,166,0,138,225,21,0,138,255,166, - 138,225,21,0,138,255,166,89,247,34,0,89,255,255,166,0,0,12,206,12,235,166, - 0,0,127,102,0,235,201,0,0,12,206,21,12,235,201,0,0,12,206,34,235,201,0, - 0,12,206,34,235,201,0,0,12,206,21,12,235,125,12,235,125,12,235,125,12,235, - 125,89,255,125,0,7,206,166,0,12,235,125,0,0,89,247,34,12,235,166,0,7,206, - 201,0,12,235,166,0,7,206,201,0,12,235,166,0,7,206,201,0,12,235,166,0,7, - 206,201,0,12,235,166,0,7,206,201,0,0,0,0,0,175,247,34,0,0,12,235,201,0, - 7,206,201,0,7,206,166,0,59,245,247,34,7,206,166,0,59,245,247,34,7,206,166, - 0,59,245,247,34,7,206,166,0,59,245,247,34,0,0,138,255,166,0,12,235,125, - 0,7,206,201,0,0,0,138,255,166,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,127,7,206,255,255,171, - 206,166,7,206,255,255,171,206,166,7,206,255,255,171,206,166,7,206,255,255, - 171,206,166,0,7,206,255,255,171,206,166,7,206,255,255,171,206,166,0,89, - 255,255,201,0,0,175,255,255,247,34,0,12,235,255,255,166,0,0,7,206,255,255, - 247,34,0,0,7,206,255,255,247,34,0,7,206,255,255,247,34,0,7,206,255,255, - 247,34,0,12,235,125,12,235,125,12,235,125,12,235,125,0,89,255,255,255,201, - 0,0,12,235,125,0,0,89,247,34,0,12,235,255,255,201,0,0,0,12,235,255,255, - 201,0,0,0,12,235,255,255,201,0,0,0,12,235,255,255,201,0,0,0,12,235,255, - 255,201,0,0,0,0,0,0,0,0,0,0,0,7,206,255,255,255,201,0,0,0,59,245,255,225, - 111,247,34,0,59,245,255,225,111,247,34,0,59,245,255,225,111,247,34,0,59, - 245,255,225,111,247,34,0,0,59,241,89,0,12,235,255,255,255,225,21,0,0,0, - 59,241,89,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,127,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,175,125,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,138,125,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,138,225,21,0,12,235,125,0,0,0,0,0,0,0, - 138,225,21,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,127,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,7,202,89,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,7,206,166,0,0,12,235,125,0,0,0,0,0,0,7,206, - 166,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,127,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 12,235,255,166,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,89,247,34,0,0,12,235,125,0,0,0,0,0,0,89,247, - 34,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,127,127,127,127,127,127,0,127,127,127,127, - 127,127,0,127,127,127,127,127,127,0,127,127,127,127,127,127,127,0,127,127, - 127,127,127,127,0,127,127,127,127,127,127,0,127,127,127,127,127,127,127, - 127,127,127,127,0,127,127,127,127,127,127,0,127,127,127,127,127,127,127, - 0,127,127,127,127,127,127,0,127,127,127,127,127,127,0,127,127,127,127,127, - 127,127,0,127,127,0,127,127,0,127,127,0,127,127,0,127,127,127,127,127,127, - 127,0,127,127,127,127,127,127,127,0,127,127,127,127,127,127,127,0,127,127, - 127,127,127,127,127,0,127,127,127,127,127,127,127,0,127,127,127,127,127, - 127,127,0,127,127,127,127,127,127,127,0,127,127,127,127,127,127,127,127, - 0,127,127,127,127,127,127,127,0,127,127,127,127,127,127,127,0,127,127,127, - 127,127,127,127,0,127,127,127,127,127,127,127,0,127,127,127,127,127,127, - 127,0,127,127,127,127,127,127,0,127,127,127,127,127,127,0,127,127,127,127, - 127,127,127,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0 -}; - - -const int FONTFIXED1_BM_W = 257; -const int FONTFIXED1_BM_H = 112; - -static const unsigned char s_FontFixed1[] = { - 127,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 - ,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 - ,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 - ,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,127,0,0,0,0,0,0 - ,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 - ,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 - ,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 - ,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,127,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 - ,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 - ,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 - ,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,127,0,0,0,0,0,0,0,0,0,0,52,255,4,0,0,0,0,52,255,56,255,4,0,0, - 0,0,0,212,44,76,180,0,0,0,52,255,4,0,0,0,0,109,231,218,72,0,0,0,0,0,96,227, - 243,170,0,0,0,0,52,255,4,0,0,0,0,0,0,0,158,104,0,0,0,0,153,114,0,0,0,0,0,0,0, - 52,255,4,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,172,128,0,0,12,164,241,234,133,1,0,0,22,179,237,255,4,0,0,0,141,220 - ,246,236,164,22,0,0,94,216,242,243,194,56,0,0,0,0,0,186,255,4,0,0,52,255,244, - 244,244,91,0,0,1,120,223,244,225,62,0,0,244,244,244,244,249,242,0,0,62,200, - 245,242,181,35,0,0,46,196,244,232,139,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 - ,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,104,216,246,215,62,0,0,127,0,0 - ,0,0,0,0,0,0,0,0,52,255,4,0,0,0,0,52,255,56,255,4,0,0,0,0,13,239,2,131,124,0, - 0,110,232,255,238,202,62,0,29,254,51,99,231,0,0,0,0,0,241,53,0,34,0,0,0,0,52, - 255,4,0,0,0,0,0,0,45,225,4,0,0,0,0,30,237,15,0,0,0,0,99,95,52,255,11,127,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,38,242, - 19,0,0,155,188,12,29,221,103,0,0,21,101,90,255,4,0,0,0,127,46,1,15,165,192,0, - 0,34,24,0,5,127,233,0,0,0,0,98,197,255,4,0,0,52,255,4,0,0,0,0,0,121,219,45,0, - 22,27,0,0,0,0,0,0,170,151,0,14,242,119,4,12,160,207,0,3,224,136,5,18,188,114, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 - ,0,0,0,114,38,2,133,225,0,0,127,0,0,0,0,0,0,0,0,0,0,52,255,4,0,0,0,0,52,255, - 56,255,4,0,0,0,0,67,189,0,187,69,0,26,254,100,255,8,53,44,0,30,254,49,100,235 - ,0,1,0,0,0,206,47,0,0,0,0,0,0,52,255,4,0,0,0,0,0,0,155,133,0,0,0,0,0,0,186, - 110,0,0,0,0,3,103,195,255,177,75,0,0,0,0,52,255,4,0,0,0,0,0,0,0,0,0,0,0,0,0,0 - ,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,156,144,0,0,5,244,63,0,0,112,200,0,0,0,0,52, - 255,4,0,0,0,0,0,0,0,60,251,0,0,0,0,0,10,127,211,0,0,0,25,215,67,255,4,0,0,52, - 255,4,0,0,0,0,1,235,77,0,0,0,0,0,0,0,0,0,24,250,49,0,44,255,15,0,0,64,251,0, - 41,255,17,0,0,68,205,0,0,0,43,216,3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,47,147,0, - 0,0,0,0,0,0,0,0,0,197,97,11,0,0,0,0,0,0,0,0,69,248,0,0,127,0,0,0,0,0,0,0,0,0, - 0,52,255,4,0,0,0,0,0,0,0,0,0,0,0,63,240,247,248,240,254,241,0,42,255,69,255,4 - ,0,0,0,0,112,232,221,80,97,184,0,0,14,189,196,7,0,0,0,0,0,0,0,0,0,0,0,0,0,1, - 233,64,0,0,0,0,0,0,117,186,0,0,0,0,3,102,194,255,177,74,0,0,0,0,52,255,4,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,26,244,30,0,0,37,255,37 - ,175,0,66,244,0,0,0,0,52,255,4,0,0,0,0,0,0,0,126,195,0,0,0,48,241,255,190,16, - 0,0,0,176,90,52,255,4,0,0,52,255,228,236,162,16,0,33,255,106,220,237,172,21,0 - ,0,0,0,0,125,203,0,0,4,205,120,6,14,160,159,0,40,255,21,0,0,69,245,0,0,0,52, - 255,4,0,0,0,0,0,52,255,4,0,0,0,0,0,13,102,203,225,132,0,0,240,240,240,240,240 - ,240,0,0,84,180,237,152,52,0,0,0,0,0,11,204,150,0,0,127,0,0,0,0,0,0,0,0,0,0, - 52,255,4,0,0,0,0,0,0,0,0,0,0,0,0,0,190,66,54,202,0,0,2,196,220,255,106,32,0,0 - ,0,0,13,116,184,93,4,0,0,176,114,109,159,0,52,0,1,0,0,0,0,0,0,0,0,0,29,255,22 - ,0,0,0,0,0,0,72,236,0,0,0,0,99,96,52,255,11,128,0,0,240,240,243,255,240,240,0 - ,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,140,161,0,0,0,49,255, - 33,216,0,54,255,0,0,0,0,52,255,4,0,0,0,0,0,0,68,236,45,0,0,0,0,0,27,198,133,0 - ,0,87,189,0,52,255,4,0,0,19,40,0,29,197,168,0,49,255,146,9,15,182,176,0,0,0,0 - ,3,226,100,0,0,0,28,210,252,255,182,7,0,2,223,142,6,20,186,255,0,0,0,0,0,0,0, - 0,0,0,0,43,216,3,0,0,0,0,158,233,162,67,1,0,0,0,0,0,0,0,0,0,0,0,0,0,23,115, - 210,208,0,0,0,0,176,192,6,0,0,127,0,0,0,0,0,0,0,0,0,0,52,255,4,0,0,0,0,0,0,0, - 0,0,0,0,0,7,239,9,118,138,0,0,0,5,109,255,153,234,112,0,0,88,179,76,110,231, - 220,0,28,255,16,0,176,110,68,0,0,0,0,0,0,0,0,0,0,0,46,255,8,0,0,0,0,0,0,57, - 253,0,0,0,0,0,0,52,255,4,0,0,0,0,0,52,255,4,0,0,0,0,0,0,0,0,0,0,0,0,244,244, - 244,0,0,0,0,0,0,0,0,0,0,0,0,0,17,241,43,0,0,0,37,255,17,0,0,66,244,0,0,0,0,52 - ,255,4,0,0,0,0,0,73,233,60,0,0,0,0,0,0,0,69,238,0,16,227,40,0,52,255,4,0,0,0, - 0,0,0,69,246,0,38,255,20,0,0,69,247,0,0,0,0,79,242,11,0,0,5,214,122,7,16,162, - 175,0,0,46,193,239,210,125,241,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,202,215, - 114,23,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,67,162,236,0,0,0,34,255,31,0,0,0,127,0,0 - ,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,236,244,251,240,251,244,228,0,0, - 0,52,255,4,76,245,0,0,11,0,29,254,51,101,0,40,255,30,0,18,222,193,0,0,0,0,0,0 - ,0,0,0,0,0,29,255,23,0,0,0,0,0,0,72,237,0,0,0,0,0,0,0,0,0,0,0,0,0,0,52,255,4, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,124,178,0,0,0,0,5,245 - ,63,0,0,111,200,0,0,0,0,52,255,4,0,0,0,0,87,233,54,0,0,0,0,0,0,0,0,70,248,0, - 52,255,255,255,255,255,255,0,0,0,0,0,0,68,246,0,6,248,19,0,0,65,247,0,0,0,0, - 185,151,0,0,0,42,255,15,0,0,59,252,0,0,0,0,0,0,124,188,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,46,147,234,180,86,0,0,244,244,244,244,244,244,0,0,39,133,226, - 197,97,10,0,0,0,51,255,4,0,0,0,127,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,140,115,12,235,8,0,0,32,73,55,255,11,143,215,0,0,0,0,31,255,47,97,0,1 - ,211,174,16,6,148,252,0,0,0,0,0,0,0,0,0,0,0,1,233,65,0,0,0,0,0,0,116,187,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,52,255,4,0,0,0,0,52,255,4,0,0,0,0,0,0,0,0,0,0,0,0,0, - 44,220,3,0,0,0,0,9,234,58,0,0,0,0,0,155,186,12,28,220,103,0,0,0,8,58,255,11,8 - ,0,0,105,232,47,0,0,0,0,0,101,32,0,25,193,173,0,0,0,0,0,52,255,4,0,0,70,25,0, - 25,193,166,0,0,165,147,7,13,176,176,0,0,0,36,254,49,0,0,0,15,245,120,4,12,157 - ,210,0,0,37,12,0,68,239,74,0,0,0,44,220,3,0,0,0,0,0,52,255,4,0,0,0,0,0,0,0,8, - 92,192,0,0,0,0,0,0,0,0,0,0,235,142,41,0,0,0,0,0,0,4,24,0,0,0,0,127,0,0,0,0,0, - 0,0,0,0,0,49,244,3,0,0,0,0,0,0,0,0,0,0,0,0,222,33,87,169,0,0,0,23,186,245,255 - ,243,186,39,0,0,0,0,0,122,239,229,0,0,30,181,245,231,147,178,0,3,0,0,0,0,0,0, - 0,0,0,0,155,133,0,0,0,0,0,0,185,111,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 - ,62,241,1,0,0,0,0,0,0,0,0,0,0,0,0,0,52,255,4,0,0,0,0,108,195,0,0,0,0,0,0,13, - 165,241,235,134,1,0,0,0,255,255,255,255,255,0,0,255,250,244,244,244,244,0,0, - 143,226,244,238,163,17,0,0,0,0,0,52,255,4,0,0,134,236,245,236,155,13,0,0,16, - 167,238,242,175,22,0,0,0,139,203,0,0,0,0,0,68,203,246,243,185,39,0,0,104,235, - 244,212,88,0,0,0,0,52,255,4,0,0,0,0,0,62,241,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,6,0,0,0,0,0,0,0,0,49,244,3,0,0,0,127,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,52,255,4,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,45,225,4,0,0,0,0,29,237,16,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,120,157,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,4,223, - 75,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 - ,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,120,157,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,127,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 - ,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,52,255,4,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 - ,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,158,104,0,0,0,0,153,115,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,181,63,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,31,119,0 - ,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 - ,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,181,63,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 - ,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,127,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 - ,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 - ,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 - ,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,127,127,127,127,127,127,127,0,127,127,127,127,127,127,127,0 - ,127,127,127,127,127,127,127,0,127,127,127,127,127,127,127,0,127,127,127,127, - 127,127,127,0,127,127,127,127,127,127,127,0,127,127,127,127,127,127,127,0,127 - ,127,127,127,127,127,127,0,127,127,127,127,127,127,127,0,127,127,127,127,127, - 127,127,0,127,127,127,127,127,127,127,0,127,127,127,127,127,127,127,0,127,127 - ,127,127,127,127,127,0,127,127,127,127,127,127,127,0,127,127,127,127,127,127, - 127,0,127,127,127,127,127,127,127,0,127,127,127,127,127,127,127,0,127,127,127 - ,127,127,127,127,0,127,127,127,127,127,127,127,0,127,127,127,127,127,127,127, - 0,127,127,127,127,127,127,127,0,127,127,127,127,127,127,127,0,127,127,127,127 - ,127,127,127,0,127,127,127,127,127,127,127,0,127,127,127,127,127,127,127,0, - 127,127,127,127,127,127,127,0,127,127,127,127,127,127,127,0,127,127,127,127, - 127,127,127,0,127,127,127,127,127,127,127,0,127,127,127,127,127,127,127,0,127 - ,127,127,127,127,127,127,0,127,127,127,127,127,127,127,0,127,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 - ,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 - ,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 - ,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,127,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 - ,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 - ,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 - ,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 - ,0,0,0,0,0,127,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 - ,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 - ,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 - ,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,127,0,28,160 - ,229,236,163,14,0,0,0,20,252,200,0,0,0,52,255,244,243,238,177,32,0,0,0,96,213 - ,244,234,137,0,52,255,244,239,190,68,0,0,52,255,244,244,244,244,68,0,0,52,255 - ,244,244,244,244,0,0,0,104,217,244,222,100,0,52,255,4,0,0,52,255,0,0,244,246, - 255,244,244,0,0,0,0,137,244,246,255,4,0,52,255,4,0,0,137,216,0,0,52,255,4,0,0 - ,0,0,52,255,163,0,0,212,255,0,52,255,166,0,0,52,255,0,0,15,168,241,236,141,2, - 0,52,255,244,244,239,176,33,0,0,15,168,241,236,141,2,0,52,255,244,244,236,171 - ,30,0,0,47,189,243,241,204,73,0,0,244,244,246,255,244,244,0,52,255,4,0,0,52, - 255,0,125,203,0,0,0,24,254,0,236,75,0,0,0,0,152,0,44,247,51,0,0,71,241,0,220, - 112,0,0,0,161,179,0,0,244,244,244,244,249,254,0,0,0,52,255,244,125,0,0,35,244 - ,23,0,0,0,0,0,0,0,171,246,255,4,0,0,0,0,41,242,200,7,0,0,0,0,0,0,0,0,0,0,127, - 24,227,130,13,21,206,163,0,0,0,98,207,251,26,0,0,52,255,4,0,8,147,204,0,0,100 - ,224,51,0,22,89,0,52,255,4,7,81,238,66,0,52,255,4,0,0,0,0,0,0,52,255,4,0,0,0, - 0,0,106,221,46,0,29,89,0,52,255,4,0,0,52,255,0,0,0,52,255,4,0,0,0,0,0,0,0,52, - 255,4,0,52,255,4,0,133,218,26,0,0,52,255,4,0,0,0,0,52,255,202,4,36,219,255,0, - 52,255,242,30,0,52,255,0,0,160,175,10,24,213,112,0,52,255,4,0,20,166,204,0,0, - 160,175,10,24,213,112,0,52,255,4,0,17,166,201,0,8,232,119,7,3,56,63,0,0,0,0, - 52,255,4,0,0,52,255,4,0,0,52,255,0,48,253,19,0,0,94,226,0,197,107,0,0,0,0,184 - ,0,0,131,201,2,8,220,101,0,74,238,18,0,52,245,33,0,0,0,0,0,1,192,148,0,0,0,52 - ,255,4,0,0,0,0,168,135,0,0,0,0,0,0,0,0,52,255,4,0,0,0,16,218,106,178,159,0,0, - 0,0,0,0,0,0,0,0,127,157,170,0,0,0,88,243,0,0,0,179,121,200,105,0,0,52,255,4,0 - ,0,63,251,0,0,227,86,0,0,0,0,0,52,255,4,0,0,125,186,0,52,255,4,0,0,0,0,0,0,52 - ,255,4,0,0,0,0,1,229,84,0,0,0,0,0,52,255,4,0,0,52,255,0,0,0,52,255,4,0,0,0,0, - 0,0,0,52,255,4,0,52,255,4,130,220,27,0,0,0,52,255,4,0,0,0,0,52,255,141,66,115 - ,140,255,0,52,255,150,143,0,52,255,0,6,246,54,0,0,105,204,0,52,255,4,0,0,60, - 253,0,6,246,54,0,0,105,204,0,52,255,4,0,0,59,252,0,46,255,15,0,0,0,0,0,0,0,0, - 52,255,4,0,0,52,255,4,0,0,52,255,0,0,225,87,0,0,165,150,0,157,139,0,234,154,0 - ,215,0,0,7,216,102,132,187,0,0,0,176,146,0,194,127,0,0,0,0,0,0,101,223,12,0,0 - ,0,52,255,4,0,0,0,0,48,239,14,0,0,0,0,0,0,0,52,255,4,0,0,3,184,122,0,8,193, - 112,0,0,0,0,0,0,0,0,0,127,243,67,72,217,233,162,255,0,3,12,248,51,130,186,0,0 - ,52,255,4,0,12,158,197,0,31,255,22,0,0,0,0,0,52,255,4,0,0,69,240,0,52,255,4,0 - ,0,0,0,0,0,52,255,4,0,0,0,0,32,255,22,0,0,0,0,0,52,255,4,0,0,52,255,0,0,0,52, - 255,4,0,0,0,0,0,0,0,52,255,4,0,52,255,130,244,29,0,0,0,0,52,255,4,0,0,0,0,52, - 255,61,146,188,66,255,0,52,255,37,239,16,52,255,0,38,255,15,0,0,64,244,0,52, - 255,4,0,24,169,202,0,38,255,15,0,0,64,244,0,52,255,4,0,16,159,188,0,11,235, - 176,72,17,0,0,0,0,0,0,52,255,4,0,0,52,255,4,0,0,52,255,0,0,148,157,0,1,234,73 - ,0,118,170,31,225,207,0,246,0,0,0,62,237,237,32,0,0,0,31,241,124,221,8,0,0,0, - 0,0,25,238,68,0,0,0,0,52,255,4,0,0,0,0,0,184,118,0,0,0,0,0,0,0,52,255,4,0,0, - 44,101,0,0,0,14,121,0,0,0,0,0,0,0,0,0,127,255,32,242,102,5,147,255,0,4,86,235 - ,1,59,250,16,0,52,255,240,241,254,223,32,0,48,255,6,0,0,0,0,0,52,255,4,0,0,55 - ,255,0,52,255,240,240,240,240,22,0,0,52,255,240,240,240,202,0,48,255,6,0,138, - 241,248,0,52,255,240,240,240,243,255,0,0,0,52,255,4,0,0,0,0,0,0,0,52,255,4,0, - 52,255,220,235,100,0,0,0,0,52,255,4,0,0,0,0,52,255,6,209,182,52,255,0,52,255, - 4,169,120,52,255,0,49,255,5,0,0,54,255,0,52,255,240,240,231,169,31,0,49,255,5 - ,0,0,54,255,0,52,255,240,244,255,173,11,0,0,38,160,229,253,188,37,0,0,0,0,52, - 255,4,0,0,52,255,4,0,0,52,255,0,0,70,227,0,51,244,7,0,78,202,83,147,220,32, - 251,0,0,0,14,235,202,0,0,0,0,0,124,255,75,0,0,0,0,0,0,173,156,0,0,0,0,0,52, - 255,4,0,0,0,0,0,64,230,7,0,0,0,0,0,0,52,255,4,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 - ,0,0,127,255,54,255,13,0,62,255,0,4,167,167,0,4,240,92,0,52,255,4,0,18,164, - 181,0,31,255,22,0,0,0,0,0,52,255,4,0,0,69,240,0,52,255,4,0,0,0,0,0,0,52,255,4 - ,0,0,0,0,32,255,20,0,0,52,255,0,52,255,4,0,0,52,255,0,0,0,52,255,4,0,0,0,0,0, - 0,0,52,255,3,0,52,255,33,86,243,35,0,0,0,52,255,4,0,0,0,0,52,255,4,127,89,52, - 255,0,52,255,4,52,230,58,255,0,38,255,15,0,0,64,244,0,52,255,4,0,0,0,0,0,38, - 255,15,0,0,64,247,0,52,255,4,1,87,251,67,0,0,0,0,0,32,176,207,0,0,0,0,52,255, - 4,0,0,51,255,4,0,0,52,255,0,0,6,242,42,121,174,0,0,39,234,136,91,168,112,218, - 0,0,0,153,180,211,98,0,0,0,0,52,255,4,0,0,0,0,0,80,228,15,0,0,0,0,0,52,255,4, - 0,0,0,0,0,0,200,101,0,0,0,0,0,0,52,255,4,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 127,255,37,243,102,5,147,255,0,11,241,250,248,248,253,173,0,52,255,4,0,0,58, - 249,0,0,228,84,0,0,0,0,0,52,255,4,0,0,126,186,0,52,255,4,0,0,0,0,0,0,52,255,4 - ,0,0,0,0,1,230,78,0,0,52,255,0,52,255,4,0,0,52,255,0,0,0,52,255,4,0,0,0,0,0,0 - ,0,61,250,0,0,52,255,4,0,170,199,3,0,0,52,255,4,0,0,0,0,52,255,4,0,0,52,255,0 - ,52,255,4,0,192,149,255,0,6,247,54,0,0,104,204,0,52,255,4,0,0,0,0,0,6,247,54, - 0,0,104,209,0,52,255,4,0,0,151,207,0,0,0,0,0,0,61,253,0,0,0,0,52,255,4,0,0,40 - ,255,8,0,0,56,248,0,0,0,171,112,192,97,0,0,4,250,199,35,111,196,178,0,0,66, - 241,28,64,236,21,0,0,0,52,255,4,0,0,0,0,14,228,75,0,0,0,0,0,0,52,255,4,0,0,0, - 0,0,0,80,218,2,0,0,0,0,0,52,255,4,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,127,238 - ,80,75,219,234,164,248,0,77,249,16,0,0,87,245,0,52,255,4,0,9,145,216,0,0,102, - 222,50,0,22,89,0,52,255,4,7,82,239,67,0,52,255,4,0,0,0,0,0,0,52,255,4,0,0,0,0 - ,0,109,215,40,0,81,255,0,52,255,4,0,0,52,255,0,0,0,52,255,4,0,0,0,43,112,13,3 - ,145,201,0,0,52,255,4,0,20,233,126,0,0,52,255,11,8,8,8,0,52,255,4,0,0,52,255, - 0,52,255,4,0,75,246,255,0,0,163,173,9,23,212,114,0,52,255,4,0,0,0,0,0,0,162, - 173,9,23,212,123,0,52,255,4,0,0,25,246,0,14,123,29,0,18,163,202,0,0,0,0,52, - 255,4,0,0,5,232,107,3,9,151,190,0,0,0,93,195,248,21,0,0,0,216,233,0,54,254, - 139,0,10,221,108,0,0,168,163,0,0,0,52,255,4,0,0,0,0,151,163,0,0,0,0,0,0,0,52, - 255,4,0,0,0,0,0,0,1,214,84,0,0,0,0,0,52,255,4,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 - ,0,0,127,146,193,1,0,0,0,0,0,155,179,0,0,0,11,245,0,52,255,244,243,239,184,44 - ,0,0,0,99,214,244,237,140,0,52,255,244,240,191,69,0,0,52,255,244,244,244,244, - 99,0,0,52,255,4,0,0,0,0,0,0,109,219,243,223,116,0,52,255,4,0,0,52,255,0,0,244 - ,246,255,244,244,0,0,27,186,240,244,204,50,0,0,52,255,4,0,0,82,251,0,0,52,255 - ,255,255,255,255,0,52,255,4,0,0,52,255,0,52,255,4,0,1,213,255,0,0,16,171,241, - 237,143,3,0,52,255,4,0,0,0,0,0,0,16,170,241,254,187,6,0,52,255,4,0,0,0,138,0, - 9,171,229,246,240,177,33,0,0,0,0,52,255,4,0,0,0,51,197,244,241,177,28,0,0,0, - 18,252,198,0,0,0,0,176,179,0,5,247,99,0,144,199,2,0,0,27,243,0,0,0,52,255,4,0 - ,0,0,0,254,247,244,244,244,244,0,0,0,52,255,4,0,0,0,0,0,0,0,96,203,0,0,0,0,0, - 52,255,4,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,127,16,216,165,31,2,24,0,0,0,0,0 - ,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 - ,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,87,237,57,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 - ,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,52,255,4,0,0,0,0,0,0,0,5,226,68,0,0,0,0,52, - 255,4,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,127,0,19,144,222,242,159,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 - ,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 - ,0,0,0,0,0,0,0,0,0,0,0,0,0,0,58,12,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 - ,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,50,248,240,123,0,0,0,0,0,0,0,71,79,0,0,0,168, - 241,248,3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,127,0,0,0,0,0,0,0,0,0,0,0,0,0,0 - ,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 - ,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 - ,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 - ,0,0,0,244,244,244,244,244,244,99,0,0,127,127,127,127,127,127,127,0,127,127, - 127,127,127,127,127,0,127,127,127,127,127,127,127,0,127,127,127,127,127,127, - 127,0,127,127,127,127,127,127,127,0,127,127,127,127,127,127,127,0,127,127,127 - ,127,127,127,127,0,127,127,127,127,127,127,127,0,127,127,127,127,127,127,127, - 0,127,127,127,127,127,127,127,0,127,127,127,127,127,127,127,0,127,127,127,127 - ,127,127,127,0,127,127,127,127,127,127,127,0,127,127,127,127,127,127,127,0, - 127,127,127,127,127,127,127,0,127,127,127,127,127,127,127,0,127,127,127,127, - 127,127,127,0,127,127,127,127,127,127,127,0,127,127,127,127,127,127,127,0,127 - ,127,127,127,127,127,127,0,127,127,127,127,127,127,127,0,127,127,127,127,127, - 127,127,0,127,127,127,127,127,127,127,0,127,127,127,127,127,127,127,0,127,127 - ,127,127,127,127,127,0,127,127,127,127,127,127,127,0,127,127,127,127,127,127, - 127,0,127,127,127,127,127,127,127,0,127,127,127,127,127,127,127,0,127,127,127 - ,127,127,127,127,0,127,127,127,127,127,127,127,0,127,127,127,127,127,127,127, - 0,127,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 - ,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 - ,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 - ,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,127,0,9,124,20,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 - ,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 - ,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 - ,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,140,0,127,0,0,112,174,0,0,0,0,0,0,0,0,0,0,0,0 - ,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 - ,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 - ,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 - ,0,0,0,0,0,0,4,221,0,127,0,0,0,159,98,0,0,0,0,0,0,0,0,0,0,0,52,255,4,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,52,255,0,0,0,0,0,0,0,0,0,0,0,2,166,243,244,102,0, - 0,0,0,0,0,0,0,0,52,255,4,0,0,0,0,0,0,0,0,49,244,3,0,0,0,0,0,49,244,3,0,0,0,52 - ,255,4,0,0,0,0,11,244,246,255,4,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 - ,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 52,255,4,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,158,239,209,0,0,0,0,52,255,4,0,0,11 - ,244,233,119,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,68,162,0,127,0,0,0,0,0,0,0,0,0 - ,0,0,0,0,0,0,0,52,255,4,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,52,255,0,0,0,0,0, - 0,0,0,0,0,0,46,255,24,0,0,0,0,0,0,0,0,0,0,0,52,255,4,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,52,255,4,0,0,0,0,0,0,52,255,4,0,0,0,0,0,0,0,0,0,0,0,0,0,0 - ,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,52,255,4,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,37,255,46,0,0,0,0,0 - ,52,255,4,0,0,0,0,96,244,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,149,81,0,127,0,0,0 - ,0,0,0,0,0,0,103,213,244,239,180,36,0,52,255,122,232,241,159,9,0,0,12,151,233 - ,244,202,40,0,0,26,183,244,223,133,255,0,0,13,156,236,241,165,12,0,19,244,246 - ,255,244,244,102,0,0,25,182,244,221,127,255,0,52,255,111,233,235,80,0,0,0,0, - 244,246,255,4,0,0,0,45,244,246,255,4,0,0,0,52,255,4,0,122,210,0,0,0,52,255,4, - 0,0,0,255,173,246,137,195,245,114,0,52,255,111,233,235,80,0,0,0,29,182,242, - 237,157,11,0,52,255,121,231,241,161,10,0,0,26,183,244,222,130,255,0,0,52,255, - 78,217,244,175,0,0,0,109,226,245,229,114,0,19,244,246,255,244,244,152,0,52, - 255,4,0,52,255,4,0,51,242,9,0,0,73,228,0,226,63,0,0,0,0,140,0,13,219,93,0,0, - 173,156,0,40,250,19,0,0,50,245,0,0,209,244,244,246,255,0,0,0,0,0,51,255,4,0,0 - ,0,0,0,52,255,4,0,0,0,0,52,255,3,0,0,0,0,0,0,0,0,0,0,0,0,5,8,0,1,219,10,0,127 - ,0,0,0,0,0,0,0,0,0,93,52,2,9,162,204,0,52,255,163,9,19,198,144,0,0,174,188,24 - ,0,53,43,0,0,193,157,7,20,200,255,0,0,173,186,16,11,179,152,0,0,0,52,255,4,0, - 0,0,0,189,167,10,19,199,255,0,52,255,121,2,133,219,0,0,0,0,0,52,255,4,0,0,0,0 - ,0,52,255,4,0,0,0,52,255,4,133,204,19,0,0,0,52,255,4,0,0,0,255,51,99,255,55, - 96,227,0,52,255,121,2,133,219,0,0,0,198,158,8,19,198,149,0,52,255,163,9,19, - 198,145,0,0,192,158,8,20,198,255,0,0,52,255,169,20,2,52,0,0,31,255,62,0,20,57 - ,0,0,0,52,255,4,0,0,0,52,255,4,0,52,255,4,0,0,216,84,0,0,162,139,0,166,118,0, - 0,0,0,195,0,0,49,235,36,104,211,9,0,0,200,106,0,0,142,163,0,0,0,0,0,149,171,0 - ,0,0,0,0,54,255,2,0,0,0,0,0,52,255,4,0,0,0,0,50,255,5,0,0,0,0,0,0,0,0,0,0,0, - 95,232,100,0,55,175,0,0,127,0,0,0,0,0,0,0,0,0,0,0,0,0,61,252,0,52,255,33,0,0, - 81,233,0,22,255,41,0,0,0,0,0,25,255,32,0,0,82,255,0,21,255,49,0,0,70,236,0,0, - 0,52,255,4,0,0,0,24,255,35,0,0,82,255,0,52,255,18,0,56,254,1,0,0,0,0,52,255,4 - ,0,0,0,0,0,52,255,4,0,0,0,52,255,146,227,15,0,0,0,0,52,255,4,0,0,0,255,8,56, - 255,8,56,253,0,52,255,18,0,56,254,1,0,27,255,32,0,0,81,234,0,52,255,33,0,0,81 - ,232,0,25,255,32,0,0,81,255,0,0,52,255,41,0,0,0,0,0,26,252,96,11,0,0,0,0,0,52 - ,255,4,0,0,0,52,255,4,0,52,255,4,0,0,125,173,0,8,242,48,0,106,173,0,192,118,4 - ,246,0,0,0,106,212,234,40,0,0,0,103,199,0,3,230,67,0,0,0,0,90,216,13,0,0,0,0, - 1,121,226,0,0,0,0,0,0,52,255,4,0,0,0,0,22,252,74,0,0,0,0,115,225,233,149,42, - 25,0,15,54,177,0,136,94,0,0,127,0,0,0,0,0,0,0,0,0,78,197,237,240,243,255,0,52 - ,255,6,0,0,55,254,0,47,255,7,0,0,0,0,0,48,255,6,0,0,55,255,0,47,255,240,240, - 240,241,247,0,0,0,52,255,4,0,0,0,48,255,7,0,0,55,255,0,52,255,4,0,52,255,4,0, - 0,0,0,52,255,4,0,0,0,0,0,52,255,4,0,0,0,52,255,187,238,80,0,0,0,0,52,255,4,0, - 0,0,255,4,52,255,4,52,255,0,55,255,4,0,52,255,4,0,48,255,6,0,0,55,254,0,52, - 255,6,0,0,55,254,0,48,255,6,0,0,55,255,0,0,52,255,6,0,0,0,0,0,0,84,186,239, - 208,75,0,0,0,52,255,4,0,0,0,52,255,4,0,52,255,4,0,0,35,246,13,84,213,0,0,46, - 228,16,202,187,49,226,0,0,0,13,239,176,0,0,0,0,15,246,36,70,225,1,0,0,0,43, - 233,43,0,0,0,0,33,247,247,73,0,0,0,0,0,0,52,255,4,0,0,0,0,0,112,254,237,0,0,0 - ,139,14,17,117,219,229,0,0,1,219,8,211,18,0,0,127,0,0,0,0,0,0,0,0,24,251,86,5 - ,0,65,255,0,52,255,32,0,0,80,232,0,22,255,41,0,0,0,0,0,25,255,32,0,0,81,255,0 - ,22,255,21,0,0,0,0,0,0,0,52,255,4,0,0,0,25,255,34,0,0,81,255,0,52,255,4,0,52, - 255,4,0,0,0,0,52,255,4,0,0,0,0,0,52,255,4,0,0,0,52,255,8,84,237,29,0,0,0,51, - 255,5,0,0,0,255,4,52,255,4,52,255,0,56,255,4,0,52,255,4,0,27,255,32,0,0,81, - 234,0,52,255,32,0,0,80,233,0,26,255,32,0,0,81,255,0,0,52,255,4,0,0,0,0,0,0,0, - 0,4,126,237,0,0,0,51,255,4,0,0,0,48,255,8,0,66,255,4,0,0,0,199,94,173,122,0,0 - ,2,239,110,116,189,116,166,0,0,0,166,166,222,90,0,0,0,0,166,128,162,131,0,0,0 - ,13,216,90,0,0,0,0,0,0,3,137,210,0,0,0,0,0,0,52,255,4,0,0,0,0,14,244,89,0,0,0 - ,0,0,0,0,0,0,0,0,0,0,154,117,188,0,0,0,127,0,0,0,0,0,0,0,0,33,255,68,0,26,189 - ,255,0,52,255,160,8,17,195,143,0,0,177,185,23,0,50,42,0,0,194,158,7,19,198, - 255,0,0,176,162,17,0,32,76,0,0,0,52,255,4,0,0,0,0,191,164,10,17,195,255,0,52, - 255,4,0,52,255,4,0,0,0,0,52,255,4,0,0,0,0,0,52,255,4,0,0,0,52,255,4,0,156,194 - ,0,0,0,24,254,67,0,0,0,255,4,52,255,4,52,255,0,56,255,4,0,52,255,4,0,0,200, - 158,7,19,198,151,0,52,255,160,8,17,195,146,0,0,194,158,7,19,198,255,0,0,52, - 255,4,0,0,0,0,0,31,72,8,2,124,230,0,0,0,30,255,51,0,0,0,15,251,62,0,147,255,4 - ,0,0,0,108,195,246,32,0,0,0,182,228,42,120,228,106,0,0,103,217,11,55,238,39,0 - ,0,0,70,222,242,36,0,0,0,172,148,0,0,0,0,0,0,0,0,57,254,1,0,0,0,0,0,52,255,4, - 0,0,0,0,49,255,8,0,0,0,0,0,0,0,0,0,0,0,0,0,78,244,107,0,0,0,127,0,0,0,0,0,0,0 - ,0,0,114,231,243,204,108,255,0,52,255,120,232,240,159,9,0,0,14,153,234,244, - 206,41,0,0,28,184,244,223,132,255,0,0,14,155,234,244,218,111,0,0,0,52,255,4,0 - ,0,0,0,27,184,245,221,123,255,0,52,255,4,0,52,255,4,0,0,118,244,246,255,244, - 244,0,0,0,0,52,255,4,0,0,0,52,255,4,0,11,217,0,0,0,0,121,240,244,114,0,255,4, - 52,255,4,52,255,0,56,255,4,0,52,255,4,0,0,31,184,243,238,160,12,0,52,255,120, - 232,241,160,10,0,0,28,185,244,223,130,255,0,0,52,255,4,0,0,0,0,0,35,199,242, - 246,204,61,0,0,0,0,141,236,229,142,0,0,120,234,191,137,255,4,0,0,0,21,251,197 - ,0,0,0,0,122,224,0,45,255,46,0,48,241,50,0,0,118,210,0,0,0,2,227,198,0,0,0,0, - 255,246,244,244,244,0,0,0,0,0,52,255,4,0,0,0,0,0,52,255,4,0,0,0,0,52,255,4,0, - 0,0,0,0,0,0,0,0,0,0,0,0,10,245,27,0,0,0,127,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 - ,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,72,240,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,56,254,1,0,0,0,0,0 - ,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,52 - ,255,4,0,0,0,0,0,0,0,0,0,0,52,255,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 - ,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 199,105,0,0,0,0,0,0,0,0,0,0,0,0,0,0,50,255,5,0,0,0,0,0,52,255,4,0,0,0,0,53, - 255,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,6,0,0,0,0,127,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 - ,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,53,55,2,15,182,162,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,121,215,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 - ,0,0,0,52,255,4,0,0,0,0,0,0,0,0,0,0,52,255,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 - ,0,0,0,64,244,16,0,0,0,0,0,0,0,0,0,0,0,0,0,0,25,255,56,0,0,0,0,0,52,255,4,0,0 - ,0,0,106,232,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,127,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 - ,0,0,0,0,0,0,0,0,75,220,246,237,162,16,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 194,246,227,68,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,52,255,4,0,0,0,0,0,0,0,0,0,0,52,255,0,0,0,0,0,0,0,0,0 - ,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,203,237,92,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,133,229,206, - 0,0,0,0,52,255,4,0,0,11,240,221,96,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 127,127,127,127,127,127,127,0,127,127,127,127,127,127,127,0,127,127,127,127, - 127,127,127,0,127,127,127,127,127,127,127,0,127,127,127,127,127,127,127,0,127 - ,127,127,127,127,127,127,0,127,127,127,127,127,127,127,0,127,127,127,127,127, - 127,127,0,127,127,127,127,127,127,127,0,127,127,127,127,127,127,127,0,127,127 - ,127,127,127,127,127,0,127,127,127,127,127,127,127,0,127,127,127,127,127,127, - 127,0,127,127,127,127,127,127,127,0,127,127,127,127,127,127,127,0,127,127,127 - ,127,127,127,127,0,127,127,127,127,127,127,127,0,127,127,127,127,127,127,127, - 0,127,127,127,127,127,127,127,0,127,127,127,127,127,127,127,0,127,127,127,127 - ,127,127,127,0,127,127,127,127,127,127,127,0,127,127,127,127,127,127,127,0, - 127,127,127,127,127,127,127,0,127,127,127,127,127,127,127,0,127,127,127,127, - 127,127,127,0,127,127,127,127,127,127,127,0,127,127,127,127,127,127,127,0,127 - ,127,127,127,127,127,127,0,127,127,127,127,127,127,127,0,127,127,127,127,127, - 127,127,0,127,127,127,127,127,127,127,0,127,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 - ,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,187,58,108,143,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,102,10,58,54,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 - ,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 - ,0,0,0,0,0,0,0,0,0,0,0,0,0,0,127,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 - ,0,0,0,0,0,0,97,59,0,0,0,0,0,0,0,0,0,0,0,0,0,33,222,208,8,0,0,0,0,0,0,0,0,0,0 - ,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,60,194,183,6,0,0,0,0,0,0,0,0,0,0,0,0,0,0 - ,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 - ,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,48,240,52,240,3,0,0,127,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 - ,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,58,199,211,11,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 - ,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 - ,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,184,184,143,119,77,39,156,0, - 0,0,73,164,22,196,26,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,42, - 179,3,188,30,0,0,0,0,0,0,0,0,0,0,127,0,4,134,230,245,210,44,0,0,0,0,0,0,0,0,0 - ,0,0,0,0,0,0,0,0,0,0,0,0,57,219,243,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,52, - 255,4,0,0,0,0,0,52,255,4,0,0,0,0,4,195,31,94,137,0,0,109,231,221,73,0,0,0,0,0 - ,47,189,243,241,204,73,0,0,0,0,0,0,0,0,0,0,26,175,241,247,255,244,0,0,0,0,0,0 - ,0,0,0,0,244,244,244,244,249,254,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,111, - 129,0,0,0,0,0,0,52,255,4,0,0,0,0,111,178,0,111,129,0,0,52,255,4,52,255,4,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,156,224,40,191,0,0,0,196,0, - 196,159,147,211,0,0,0,0,125,231,62,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,143,189,126,0,0,0,171,161,0,0,1,208,134,0,127,0,137,197,27,0,51 - ,39,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,218,103,1,0,0,0,0,0,0,0,0,0,0,0 - ,0,0,0,0,0,0,0,0,52,255,4,0,0,0,0,0,52,255,4,0,0,0,0,0,0,0,0,0,0,0,254,51,101 - ,235,0,0,0,0,8,233,119,7,3,56,63,0,0,0,0,0,0,0,0,0,0,181,177,20,52,255,4,0,0, - 0,0,0,0,0,0,0,0,0,0,0,1,192,148,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,206, - 69,0,0,0,0,0,0,62,241,1,0,0,0,0,206,94,0,206,69,0,0,62,241,1,66,241,1,0,0,0,0 - ,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,174,39,188,126,0,0,0,196,0,196 - ,55,118,196,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 - ,0,0,15,125,8,0,0,0,29,241,39,0,85,240,17,0,127,8,244,57,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,31,249,5,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,118, - 244,246,255,244,244,72,0,118,244,246,255,244,244,72,0,0,0,0,0,0,0,0,0,254,50, - 100,234,1,57,97,0,46,255,15,0,0,0,0,0,0,0,0,0,31,0,0,0,10,252,51,0,52,255,4,0 - ,0,0,0,0,0,0,0,0,0,0,0,0,101,223,12,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,35, - 255,14,0,0,0,0,0,0,118,157,0,0,0,0,35,255,18,35,255,14,0,0,120,157,0,143,157, - 0,0,0,0,84,234,231,76,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 196,0,196,0,0,196,0,0,0,109,226,245,229,114,0,0,0,0,30,0,0,0,0,0,103,239,220, - 122,231,236,0,0,0,0,0,0,0,0,0,0,209,244,244,246,255,0,0,0,120,167,2,213,127,0 - ,0,127,240,255,241,240,236,18,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,74, - 210,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,52,255,4,0,0,0,0,0,52,255,4,0,0 - ,0,0,0,0,0,0,0,0,0,111,234,255,210,148,92,14,0,10,232,176,72,17,0,0,0,0,0,0, - 55,219,0,0,0,40,255,14,0,52,255,4,0,0,0,0,0,0,0,0,0,0,0,0,25,238,68,0,0,0,0,0 - ,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,52,255,4,0,0,0,0,0,0,178,63,0,0,0,0,52,255,4, - 52,255,4,0,0,181,63,0,225,63,0,0,0,0,234,255,255,232,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,31,255,62,0,20,57,0,0,0,0,218, - 54,0,0,0,5,243,62,113,255,57,106,0,0,0,0,0,0,0,0,0,0,0,0,0,149,171,0,0,0,6, - 214,135,237,14,0,0,127,51,255,4,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 22,240,247,250,240,150,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,52,255,4,0,0,0,0 - ,0,52,255,4,0,0,0,0,0,0,0,0,0,0,0,129,149,89,13,0,0,0,0,0,33,152,222,253,188, - 37,0,0,0,85,217,46,0,0,0,49,255,6,0,52,255,240,0,0,0,0,0,0,0,0,0,0,0,0,173, - 156,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 - ,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,234,255,255,232,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,26,252,96,11,0,0,0,0,0,0,46,217,85, - 0,0,39,255,11,62,255,6,54,0,0,0,0,0,0,0,0,0,0,0,0,90,216,13,0,0,0,0,68,255, - 121,0,0,0,127,240,255,240,240,50,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 156,126,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,52,255,4,0,0,0,0,0,52,255,4 - ,0,0,0,0,0,0,0,0,0,0,0,113,231,221,73,73,223,225,0,0,0,0,0,27,170,207,0,0,0, - 229,102,0,0,0,0,40,255,14,0,52,255,4,0,0,0,0,0,0,0,0,0,0,0,80,228,15,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 - ,0,0,0,0,0,0,0,0,0,0,84,235,233,79,0,0,244,244,244,244,244,244,244,0,244,244, - 244,244,244,244,244,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,84,186,239,208,75,0 - ,0,0,0,0,103,229,0,0,50,255,5,53,255,240,241,0,3,0,0,0,0,0,0,0,0,0,43,233,43, - 0,0,0,0,0,0,252,60,0,0,0,127,9,247,62,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 - ,0,0,0,0,200,85,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,52,255,4,0,0,0,116, - 240,243,255,240,240,71,0,0,0,0,0,0,0,0,0,254,51,102,235,229,51,101,0,0,0,0,0, - 0,61,253,0,0,0,29,206,115,0,0,0,10,252,51,0,52,255,4,0,0,0,0,0,0,0,0,0,0,14, - 228,75,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 - ,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,4,126,237,0,0,0,0,116,206,29,0,0 - ,39,255,11,60,255,8,0,0,0,0,0,0,0,0,0,0,0,13,216,90,0,0,0,0,0,0,0,252,60,0,0, - 0,127,0,146,201,26,0,50,39,0,0,0,0,0,0,0,0,0,0,0,52,255,4,0,0,0,0,0,1,243,45, - 0,0,0,0,52,255,4,52,255,4,0,44,220,3,44,220,3,44,0,3,0,52,255,4,0,0,0,0,0,52, - 255,4,0,0,0,0,0,0,0,0,0,0,0,254,47,99,235,230,47,97,0,15,135,41,5,30,171,202, - 0,0,0,0,12,180,0,0,0,0,181,177,19,52,255,4,0,0,0,0,0,0,0,0,0,0,151,163,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 - ,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,31,72,8,2,124,230,0,0,0,0,179,12,0,0,0,6,244,62, - 114,255,80,0,0,1,0,0,0,0,0,0,0,0,172,148,0,0,0,0,0,0,0,0,252,60,0,0,0,127,0,6 - ,140,231,245,213,44,0,0,0,0,0,0,0,0,0,0,0,62,241,1,0,0,0,0,0,33,253,7,0,0,0,0 - ,62,241,1,66,241,1,0,52,255,4,52,255,4,52,0,4,0,52,255,4,0,0,0,0,0,52,255,4,0 - ,0,0,0,0,0,0,0,0,0,0,116,239,229,79,79,231,233,0,9,166,229,252,240,177,33,0,0 - ,0,0,0,3,0,0,0,0,26,177,242,247,255,244,0,0,0,0,0,0,0,0,0,0,254,247,244,244, - 244,244,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 - ,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,35,199,242,246,204,61,0,0,0,0,2,0,0,0,0,0, - 105,240,221,111,222,244,0,1,0,0,0,0,0,0,0,0,255,246,244,244,244,0,0,0,0,0,252 - ,60,0,0,0,127,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,120,157,0,0,0,0,0,0,85,212, - 0,0,0,0,0,120,157,0,143,157,0,0,0,0,0,0,0,0,0,0,0,0,52,255,4,0,0,0,0,0,52,255 - ,4,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 - ,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 - ,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,127,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,181,63,0,0,0,0,30,11,195,131, - 0,0,0,0,0,181,63,0,225,63,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 - ,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 - ,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 - ,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 127,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,227,245,177,12,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 - ,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 - ,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 - ,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,127,127,127, - 127,127,127,127,0,127,127,127,127,127,127,127,0,127,127,127,127,127,127,127,0 - ,127,127,127,127,127,127,127,0,127,127,127,127,127,127,127,0,127,127,127,127, - 127,127,127,0,127,127,127,127,127,127,127,0,127,127,127,127,127,127,127,0,127 - ,127,127,127,127,127,127,0,127,127,127,127,127,127,127,0,127,127,127,127,127, - 127,127,0,127,127,127,127,127,127,127,0,127,127,127,127,127,127,127,0,127,127 - ,127,127,127,127,127,0,127,127,127,127,127,127,127,0,127,127,127,127,127,127, - 127,0,127,127,127,127,127,127,127,0,127,127,127,127,127,127,127,0,127,127,127 - ,127,127,127,127,0,127,127,127,127,127,127,127,0,127,127,127,127,127,127,127, - 0,127,127,127,127,127,127,127,0,127,127,127,127,127,127,127,0,127,127,127,127 - ,127,127,127,0,127,127,127,127,127,127,127,0,127,127,127,127,127,127,127,0, - 127,127,127,127,127,127,127,0,127,127,127,127,127,127,127,0,127,127,127,127, - 127,127,127,0,127,127,127,127,127,127,127,0,127,127,127,127,127,127,127,0,127 - ,127,127,127,127,127,127,0,127,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 - ,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 - ,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 - ,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,127,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 - ,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 - ,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,58,98,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 - ,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2, - 8,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,127,0,0,0,0,0,0,0 - ,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 - ,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,20,221,50,0 - ,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,103,185,255,4,0,0,0,0,106,186,255,4,0,0 - ,0,0,0,144,235,229,126,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,127,0,0,0,0,0,0, - 0,0,0,0,49,244,3,0,0,0,0,0,0,0,52,255,4,0,0,0,0,86,224,245,206,0,0,0,0,0,0,0, - 0,0,215,116,0,0,0,164,172,0,0,0,0,52,255,4,0,0,0,110,227,245,223,102,0,0,0,49 - ,244,53,244,3,0,0,0,0,0,0,0,0,0,0,0,0,122,237,237,102,0,0,0,0,0,0,0,0,0,0,0,0 - ,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,3,244,244,244,175,0,0,0,0,116,239,227,77,0,0,0 - ,0,0,0,0,0,0,0,0,0,116,235,233,108,0,0,0,0,165,239,235,132,0,0,0,0,0,173,88,0 - ,0,0,0,0,0,0,0,0,0,0,0,40,184,245,255,246,255,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 - ,0,0,0,101,185,255,4,0,0,0,0,77,219,247,201,45,0,0,0,0,0,0,0,0,0,0,52,255,4,0 - ,0,0,0,0,52,255,4,0,0,0,0,0,17,0,101,238,0,0,0,0,0,49,244,3,0,0,0,0,0,0,0,0,0 - ,0,0,127,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,52,255,4,0,0,0,11,245,105,1, - 43,0,0,0,0,0,0,0,0,0,62,241,25,0,61,236,23,0,0,0,0,52,255,4,0,0,33,255,60,0, - 26,51,0,0,0,0,0,0,0,0,0,0,0,53,181,236,230,161,31,0,0,0,33,1,102,238,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,53,181,236,230,161,31,0,0,0,0,0,0,0,0,0,0,30, - 254,51,99,236,0,0,0,0,0,0,0,0,0,0,0,0,42,3,96,248,0,0,0,0,15,2,107,236,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,5,226,255,255,255,56,255,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,52,255,4,0,0,0,14,244,93,2,142,209,0,0,0,0,0,0,0,0,0,0,52, - 255,4,0,0,0,0,0,52,255,4,0,0,0,0,0,0,222,242,72,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 - ,0,0,0,0,127,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,14,161,243,255,236,0,0,0,47, - 255,11,0,0,0,0,82,25,0,0,44,64,0,0,155,165,3,210,93,0,0,0,0,0,52,255,4,0,0,15 - ,230,104,0,0,0,0,0,0,0,0,0,0,0,0,0,67,255,255,253,224,140,233,0,0,3,160,237, - 243,255,3,0,0,0,0,31,0,0,31,0,0,0,0,0,0,0,0,0,67,255,255,251,251,255,233,0,0, - 0,0,0,0,0,0,0,0,30,254,50,100,234,0,0,0,0,0,52,255,4,0,0,0,0,0,0,113,173,0,0, - 0,0,0,244,239,67,0,0,0,0,0,0,0,0,0,0,52,255,4,0,52,255,4,0,45,255,255,255,255 - ,56,255,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,52,255,4,0,0,0,47,255,12,0,61 - ,253,0,0,30,0,0,30,0,0,0,0,52,255,4,0,0,0,0,0,52,255,4,0,0,0,0,0,0,0,108,224, - 0,0,0,0,0,44,255,3,0,0,0,0,0,0,0,0,0,0,0,127,0,0,0,0,0,0,0,0,0,0,52,255,4,0,0 - ,0,0,0,174,182,65,255,13,0,0,0,52,255,4,0,0,0,0,79,222,204,189,221,47,0,123, - 185,244,166,235,176,90,0,0,0,0,52,255,4,0,0,0,100,237,188,46,0,0,0,0,0,0,0,0, - 0,0,0,222,255,110,2,21,6,156,0,0,42,255,40,100,255,4,0,0,0,55,219,0,55,218,0, - 0,0,0,0,0,0,0,0,222,161,255,4,86,247,157,0,0,0,0,0,0,0,0,0,0,0,114,233,220,71 - ,0,0,0,0,0,52,255,4,0,0,0,0,0,65,191,12,0,0,0,0,0,0,107,224,0,0,0,0,0,0,0,0,0 - ,0,52,255,4,0,52,255,4,0,19,250,255,255,255,56,255,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,52,255,4,0,0,0,12,243,94,4,144,206,0,0,218,54,0,219,54,0,0,81, - 176,212,160,0,28,70,0,81,176,212,168,31,8,78,0,0,35,1,114,240,0,0,0,0,0,63, - 242,0,0,0,0,0,0,0,0,0,0,0,0,127,0,0,0,0,0,0,0,0,0,0,52,255,4,0,0,0,0,22,255, - 48,52,255,4,0,0,172,243,255,240,240,37,0,0,17,230,49,97,201,0,0,0,0,101,255, - 50,0,0,0,0,0,0,52,255,4,0,0,21,249,20,108,240,103,0,0,0,0,0,0,0,0,0,0,255,255 - ,14,0,0,0,67,0,0,5,182,234,147,248,3,0,0,85,219,47,85,212,43,0,186,244,244, - 244,244,245,252,0,255,71,255,244,232,84,67,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,240,240,243,255,240,240,0,0,0,56,182,13,0,0,0,0,0,42,1,116,239,0,0,0,0,0,0, - 0,0,0,0,52,255,4,0,52,255,4,0,0,105,248,255,255,56,255,0,0,0,44,220,3,0,0,0,0 - ,0,0,0,0,0,0,0,0,0,81,176,212,168,49,0,0,0,72,213,242,195,40,0,0,44,213,85,48 - ,220,85,0,0,2,56,132,204,195,104,0,0,0,12,86,169,231,170,0,0,180,240,219,87, - 42,91,0,0,15,210,132,0,0,0,0,0,0,0,0,0,0,0,0,127,0,0,0,0,0,0,0,0,0,0,52,255,4 - ,0,0,0,0,48,255,11,52,255,4,0,0,0,52,255,4,0,0,0,0,16,229,53,101,198,0,0,168, - 240,243,255,240,240,123,0,0,0,0,0,0,0,0,0,30,254,67,0,93,244,0,0,0,0,0,0,0,0, - 0,0,255,222,111,4,17,5,67,0,0,0,0,0,0,0,0,0,0,229,109,0,229,89,0,0,0,0,0,0,0, - 52,255,0,255,71,255,9,178,76,67,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,52, - 255,4,0,0,0,0,173,242,240,240,11,0,0,0,200,241,217,82,0,0,0,0,0,0,0,0,0,0,52, - 255,4,0,52,255,4,0,0,0,18,107,255,56,255,0,0,0,52,255,4,0,0,0,0,0,0,0,0,0,0,0 - ,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,89,229,0,109,229,0,150,216,167,92,18,0,0 - ,0,92,177,230,162,79,8,0,0,21,98,143,151,148,110,60,0,0,186,168,2,0,0,0,0,0,0 - ,0,0,0,0,0,0,127,0,0,0,0,0,0,0,0,0,0,52,255,4,0,0,0,0,21,255,43,52,255,4,0,0, - 0,52,255,4,0,0,0,0,76,223,204,189,222,49,0,0,0,52,255,4,0,0,0,0,0,0,52,255,4, - 0,0,0,117,241,119,83,210,0,0,0,0,0,0,0,0,0,0,224,153,197,240,202,13,157,0,0,3 - ,240,240,240,240,11,0,0,29,207,117,29,205,112,0,0,0,0,0,0,50,248,0,224,156, - 228,3,22,188,166,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,52,255,4,0,0,0,0,0,0 - ,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,52,255,11,0,62,255,4,0,0,0,0,52,255, - 56,255,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,228,240,240,240, - 172,0,0,113,205,29,118,207,29,0,49,4,0,0,146,255,4,0,130,71,5,87,225,232,129, - 0,21,53,7,0,2,174,255,0,40,255,20,0,0,0,0,0,0,0,0,0,0,0,0,0,127,0,0,0,0,0,0,0 - ,0,0,0,52,255,4,0,0,0,0,0,175,172,59,255,8,0,0,0,52,255,4,0,0,0,0,85,25,0,0, - 46,62,0,0,0,52,255,4,0,0,0,0,0,0,52,255,4,0,0,0,0,43,182,246,51,0,0,0,0,0,0,0 - ,0,0,0,68,240,97,7,14,129,232,0,0,0,0,0,0,0,0,0,0,0,12,180,0,12,180,0,0,0,0,0 - ,0,0,0,0,68,240,97,7,14,129,232,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 - ,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,52,255,99,3,157,255,18,0 - ,0,0,0,52,255,56,255,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,179,12,0,179,12,0,0,0,0,0,44,141,255,4,0,0,0,0,28,5,88,239,0,0,0, - 0,0,126,102,255,0,23,252,95,8,66,99,0,0,0,0,0,0,0,0,0,0,127,0,0,0,0,0,0,0,0,0 - ,0,52,255,4,0,0,0,0,0,13,156,235,255,231,0,0,244,246,255,244,244,244,0,0,0,0, - 0,0,0,0,0,0,0,52,255,4,0,0,0,0,0,0,52,255,4,0,0,0,0,0,0,127,213,0,0,0,0,0,0,0 - ,0,0,0,0,53,184,236,232,164,31,0,0,0,0,0,0,0,0,0,0,0,0,3,0,0,3,0,0,0,0,0,0,0, - 0,0,0,53,184,236,232,164,31,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,244,244,244, - 244,244,244,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,52,255,163,243, - 148,208,191,0,0,0,0,52,255,56,255,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 - ,0,0,0,0,0,0,0,0,0,0,0,0,2,0,0,2,0,0,0,0,0,0,136,53,255,4,0,0,0,0,0,9,168,67, - 0,0,0,0,84,94,52,255,0,0,101,231,249,202,68,0,0,0,0,0,0,0,0,0,0,127,0,0,0,0,0 - ,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,52,255,4,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 - ,0,0,0,0,0,0,0,0,0,52,255,4,0,0,1,72,10,3,120,233,0,0,0,0,0,0,0,0,0,0,0,0,0,0 - ,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 - ,0,0,0,0,0,0,0,52,255,4,0,0,0,0,0,0,0,0,52,255,56,255,0,0,0,0,0,0,0,0,0,0,0,0 - ,33,65,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,240,243, - 255,176,0,0,0,0,28,162,38,0,0,0,0,0,174,240,243,255,0,0,0,0,0,0,0,0,0,0,0,0,0 - ,0,0,0,0,127,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,52,255,4,0,0,0,0,0,0,0,0 - ,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,52,255,4,0,0,2,188,234,241,201,61,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 - ,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,52,255,4,0,0,0,0,0,0,0,0,23,116,25, - 116,0,0,0,0,0,0,0,0,0,0,0,0,2,214,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 - ,0,0,0,0,0,0,0,0,0,52,255,4,0,0,0,0,143,245,244,244,0,0,0,0,0,0,52,255,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,127,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 - ,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 - ,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,52,255,4,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,116,199,178,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 - ,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,127,127,127,127,127,127,127,0,127,127,127,127,127,127,127,0, - 127,127,127,127,127,127,127,0,127,127,127,127,127,127,127,0,127,127,127,127, - 127,127,127,0,127,127,127,127,127,127,127,0,127,127,127,127,127,127,127,0,127 - ,127,127,127,127,127,127,0,127,127,127,127,127,127,127,0,127,127,127,127,127, - 127,127,0,127,127,127,127,127,127,127,0,127,127,127,127,127,127,127,0,127,127 - ,127,127,127,127,127,0,127,127,127,127,127,127,127,0,127,127,127,127,127,127, - 127,0,127,127,127,127,127,127,127,0,127,127,127,127,127,127,127,0,127,127,127 - ,127,127,127,127,0,127,127,127,127,127,127,127,0,127,127,127,127,127,127,127, - 0,127,127,127,127,127,127,127,0,127,127,127,127,127,127,127,0,127,127,127,127 - ,127,127,127,0,127,127,127,127,127,127,127,0,127,127,127,127,127,127,127,0, - 127,127,127,127,127,127,127,0,127,127,127,127,127,127,127,0,127,127,127,127, - 127,127,127,0,127,127,127,127,127,127,127,0,127,127,127,127,127,127,127,0,127 - ,127,127,127,127,127,127,0,127,127,127,127,127,127,127,0,127,0,0,51,90,0,0,0, - 0,0,0,0,6,119,17,0,0,0,0,4,117,84,0,0,0,0,2,196,190,20,191,0,0,0,0,0,0,0,0,0, - 0,0,0,145,237,102,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,99,44,0,0,0,0,0,0 - ,0,48,95,0,0,0,0,0,41,128,38,0,0,0,0,0,0,0,0,0,0,0,0,0,97,35,0,0,0,0,0,0,0,57 - ,85,0,0,0,0,0,46,127,26,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,18,217,181,17 - ,203,0,0,0,0,74,213,6,0,0,0,0,0,0,27,229,40,0,0,0,0,29,222,209,8,0,0,0,2,195, - 200,27,193,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,101,212,8, - 0,0,0,0,0,0,29,234,61,0,0,0,0,42,226,218,16,0,0,0,0,0,0,0,0,0,0,0,0,0,143,135 - ,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,127,0,0,3,172,83,0,0,0,0,0,0,158,105,0 - ,0,0,0,0,154,91,157,84,0,0,0,34,144,63,189,101,0,0,0,48,240,52,240,3,0,0,0,32 - ,255,96,239,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,39,201,20,0,0,0,0,0,25, - 203,35,0,0,0,0,24,188,62,188,22,0,0,0,48,240,52,240,3,0,0,0,0,42,195,12,0,0,0 - ,0,0,29,198,25,0,0,0,0,22,184,66,185,14,0,0,0,48,240,52,240,3,0,0,0,0,0,0,0,0 - ,0,0,0,74,110,77,192,109,0,0,0,0,0,139,130,0,0,0,0,0,0,177,92,0,0,0,0,1,183, - 63,107,141,0,0,0,37,141,60,187,123,0,0,0,48,240,3,48,240,3,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,151,143,0,0,0,0,0,1,189,104,0,0,0,0,8,200,53,93,169,0,0 - ,0,48,240,3,48,240,3,0,0,0,42,192,5,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,127 - ,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,20,246,100,217,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 - ,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 - ,0,0,0,0,0,0,0,0,0,9,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,127,0,0,20,252,200, - 0,0,0,0,0,20,252,200,0,0,0,0,0,20,252,200,0,0,0,0,0,20,252,200,0,0,0,0,0,80, - 255,32,0,0,0,0,0,62,238,30,0,0,0,0,0,196,247,255,244,244,0,0,0,96,213,244,234 - ,137,0,52,255,244,244,244,244,68,0,52,255,244,244,244,244,68,0,52,255,244,244 - ,244,244,68,0,52,255,244,244,244,236,0,0,0,244,246,255,244,244,0,0,0,244,246, - 255,244,244,0,0,0,244,246,255,244,244,0,0,0,244,246,255,244,244,0,0,52,255, - 244,239,190,68,0,0,52,255,166,0,0,52,255,0,0,15,168,241,236,141,2,0,0,15,168, - 241,236,141,2,0,0,15,168,241,236,141,2,0,0,15,168,241,236,141,2,0,0,15,168, - 241,236,141,2,0,0,0,0,0,0,0,0,0,0,13,166,240,239,148,152,0,52,255,4,0,0,52, - 255,0,52,255,4,0,0,52,255,0,52,255,4,0,0,52,255,0,52,255,4,0,0,52,255,0,220, - 112,0,0,0,161,179,0,52,255,4,0,0,0,0,0,0,100,226,247,212,58,0,0,127,0,0,98, - 207,251,26,0,0,0,0,98,207,251,26,0,0,0,0,98,207,251,26,0,0,0,0,98,207,251,26, - 0,0,0,0,160,212,112,0,0,0,0,0,91,210,42,0,0,0,0,17,242,58,255,4,0,0,0,100,223 - ,50,0,22,89,0,52,255,4,0,0,0,0,0,52,255,4,0,0,0,0,0,52,255,4,0,0,0,0,0,52,255 - ,4,0,0,0,0,0,0,0,52,255,4,0,0,0,0,0,52,255,4,0,0,0,0,0,52,255,4,0,0,0,0,0,52, - 255,4,0,0,0,52,255,4,7,81,238,66,0,52,255,242,30,0,52,255,0,0,160,175,10,24, - 213,112,0,0,160,175,10,24,213,112,0,0,160,175,10,24,213,112,0,0,160,175,10,24 - ,213,112,0,0,160,175,10,24,213,112,0,0,0,0,0,0,0,0,0,0,158,169,7,42,243,176,0 - ,52,255,4,0,0,52,255,0,52,255,4,0,0,52,255,0,52,255,4,0,0,52,255,0,52,255,4,0 - ,0,52,255,0,74,238,18,0,52,245,33,0,52,255,4,0,0,0,0,0,20,251,87,1,120,216,0, - 0,127,0,0,179,121,200,105,0,0,0,0,179,121,200,105,0,0,0,0,179,121,200,105,0,0 - ,0,0,179,121,200,105,0,0,0,3,236,97,192,0,0,0,0,0,185,107,136,0,0,0,0,86,189, - 52,255,4,0,0,0,227,84,0,0,0,0,0,52,255,4,0,0,0,0,0,52,255,4,0,0,0,0,0,52,255, - 4,0,0,0,0,0,52,255,4,0,0,0,0,0,0,0,52,255,4,0,0,0,0,0,52,255,4,0,0,0,0,0,52, - 255,4,0,0,0,0,0,52,255,4,0,0,0,52,255,4,0,0,125,186,0,52,255,150,143,0,52,255 - ,0,6,246,54,0,0,105,204,0,6,246,54,0,0,105,204,0,6,246,54,0,0,105,204,0,6,246 - ,54,0,0,105,204,0,6,246,54,0,0,105,204,0,0,123,22,0,0,66,81,0,5,246,57,0,52, - 245,208,0,52,255,4,0,0,52,255,0,52,255,4,0,0,52,255,0,52,255,4,0,0,52,255,0, - 52,255,4,0,0,52,255,0,0,176,146,0,194,127,0,0,52,255,240,240,233,177,38,0,50, - 255,8,69,180,160,0,0,127,0,12,248,51,130,186,0,0,0,12,248,51,130,186,0,0,0,12 - ,248,51,130,186,0,0,0,12,248,51,130,186,0,0,0,64,222,16,250,19,0,0,0,25,230, - 26,227,2,0,0,0,159,125,52,255,4,0,0,31,255,21,0,0,0,0,0,52,255,4,0,0,0,0,0,52 - ,255,4,0,0,0,0,0,52,255,4,0,0,0,0,0,52,255,4,0,0,0,0,0,0,0,52,255,4,0,0,0,0,0 - ,52,255,4,0,0,0,0,0,52,255,4,0,0,0,0,0,52,255,4,0,0,0,52,255,4,0,0,69,240,0, - 52,255,37,239,16,52,255,0,38,255,15,0,0,64,244,0,38,255,15,0,0,64,244,0,38, - 255,15,0,0,64,244,0,38,255,15,0,0,64,244,0,38,255,15,0,0,64,244,0,0,130,214, - 25,73,235,64,0,38,255,20,12,210,108,246,0,52,255,4,0,0,52,255,0,52,255,4,0,0, - 52,255,0,52,255,4,0,0,52,255,0,52,255,4,0,0,52,255,0,0,31,241,124,221,8,0,0, - 52,255,4,0,18,164,208,0,52,255,30,251,36,0,0,0,127,0,86,235,1,59,250,16,0,0, - 86,235,1,59,250,16,0,0,86,235,1,59,250,16,0,0,86,235,1,59,250,16,0,0,144,164, - 0,213,96,0,0,0,117,182,0,230,68,0,0,1,231,61,52,255,240,240,0,48,255,6,0,0,0, - 0,0,52,255,240,240,240,240,22,0,52,255,240,240,240,240,22,0,52,255,240,240, - 240,240,22,0,52,255,240,240,240,187,0,0,0,0,52,255,4,0,0,0,0,0,52,255,4,0,0,0 - ,0,0,52,255,4,0,0,0,0,0,52,255,4,0,0,0,239,255,240,198,0,55,255,0,52,255,4, - 169,120,52,255,0,49,255,5,0,0,54,255,0,49,255,5,0,0,54,255,0,49,255,5,0,0,54, - 255,0,49,255,5,0,0,54,255,0,49,255,5,0,0,54,255,0,0,0,124,225,235,60,0,0,49, - 255,6,160,101,53,255,0,52,255,4,0,0,52,255,0,52,255,4,0,0,52,255,0,52,255,4,0 - ,0,52,255,0,52,255,4,0,0,52,255,0,0,0,124,255,75,0,0,0,52,255,4,0,0,59,253,0, - 52,255,26,245,109,2,0,0,127,0,167,167,0,4,240,92,0,0,167,167,0,4,240,92,0,0, - 167,167,0,4,240,92,0,0,167,167,0,4,240,92,0,0,223,105,0,154,176,0,0,0,210,130 - ,0,179,162,0,0,49,246,6,52,255,4,0,0,31,255,23,0,0,0,0,0,52,255,4,0,0,0,0,0, - 52,255,4,0,0,0,0,0,52,255,4,0,0,0,0,0,52,255,4,0,0,0,0,0,0,0,52,255,4,0,0,0,0 - ,0,52,255,4,0,0,0,0,0,52,255,4,0,0,0,0,0,52,255,4,0,0,0,52,255,4,0,0,69,240,0 - ,52,255,4,52,230,58,255,0,38,255,15,0,0,64,244,0,38,255,15,0,0,64,244,0,38, - 255,15,0,0,64,244,0,38,255,15,0,0,64,244,0,38,255,15,0,0,64,244,0,0,0,80,241, - 224,31,0,0,40,255,92,164,0,63,245,0,51,255,4,0,0,52,255,0,51,255,4,0,0,52,255 - ,0,51,255,4,0,0,52,255,0,51,255,4,0,0,52,255,0,0,0,52,255,4,0,0,0,52,255,4,0, - 17,161,208,0,52,255,4,47,187,209,46,0,127,7,241,250,248,248,253,173,0,7,241, - 250,248,248,253,173,0,7,241,250,248,248,253,173,0,7,241,250,248,248,253,173,0 - ,48,255,249,248,250,246,10,0,49,255,249,248,250,244,11,0,122,251,240,243,255, - 4,0,0,0,228,88,0,0,0,0,0,52,255,4,0,0,0,0,0,52,255,4,0,0,0,0,0,52,255,4,0,0,0 - ,0,0,52,255,4,0,0,0,0,0,0,0,52,255,4,0,0,0,0,0,52,255,4,0,0,0,0,0,52,255,4,0, - 0,0,0,0,52,255,4,0,0,0,52,255,4,0,0,126,186,0,52,255,4,0,192,149,255,0,6,247, - 54,0,0,104,204,0,6,247,54,0,0,104,204,0,6,247,54,0,0,104,204,0,6,247,54,0,0, - 104,204,0,6,247,54,0,0,104,204,0,0,87,233,51,113,224,34,0,10,253,203,12,0,100 - ,203,0,40,255,9,0,0,57,248,0,40,255,9,0,0,57,248,0,40,255,9,0,0,57,248,0,40, - 255,8,0,0,56,248,0,0,0,52,255,4,0,0,0,52,255,240,240,234,178,38,0,52,255,4,0, - 0,116,220,0,127,74,249,16,0,0,87,245,0,74,249,16,0,0,87,245,0,74,249,16,0,0, - 87,245,0,74,249,16,0,0,87,245,0,128,211,0,0,15,248,80,0,143,187,0,0,5,234,94, - 0,195,109,0,52,255,4,0,0,0,102,228,62,5,34,99,0,52,255,4,0,0,0,0,0,52,255,4,0 - ,0,0,0,0,52,255,4,0,0,0,0,0,52,255,4,0,0,0,0,0,0,0,52,255,4,0,0,0,0,0,52,255, - 4,0,0,0,0,8,58,255,11,8,0,0,0,0,52,255,4,0,0,0,52,255,4,7,82,239,67,0,52,255, - 4,0,75,246,255,0,0,163,173,9,23,212,114,0,0,163,173,9,23,212,114,0,0,163,173, - 9,23,212,114,0,0,163,173,9,23,212,114,0,0,163,173,9,23,212,114,0,0,166,49,0,0 - ,108,107,0,13,237,190,15,18,206,111,0,5,232,117,10,19,158,190,0,5,232,117,10, - 19,158,190,0,5,232,117,10,19,158,190,0,5,232,107,3,9,151,190,0,0,0,52,255,4,0 - ,0,0,52,255,4,0,0,0,0,0,52,255,34,8,2,118,240,0,127,155,179,0,0,0,11,245,0, - 155,179,0,0,0,11,245,0,155,179,0,0,0,11,245,0,155,179,0,0,0,11,245,0,208,126, - 0,0,0,176,160,0,232,94,0,0,0,144,188,0,251,31,0,52,255,244,244,0,0,0,99,214, - 255,240,135,0,52,255,244,244,244,244,99,0,52,255,244,244,244,244,99,0,52,255, - 244,244,244,244,99,0,52,255,244,244,244,244,22,0,0,244,246,255,244,244,0,0,0, - 244,246,255,244,244,0,0,0,255,255,255,255,255,0,0,0,244,246,255,244,244,0,0, - 52,255,244,240,191,69,0,0,52,255,4,0,1,213,255,0,0,16,171,241,237,143,3,0,0, - 16,171,241,237,143,3,0,0,16,171,241,237,143,3,0,0,16,171,241,237,143,3,0,0,16 - ,171,241,237,143,3,0,0,0,0,0,0,0,0,0,157,99,185,245,234,140,2,0,0,51,197,249, - 244,177,28,0,0,51,197,249,244,177,28,0,0,51,197,249,244,177,28,0,0,51,197,244 - ,241,177,28,0,0,0,52,255,4,0,0,0,52,255,4,0,0,0,0,0,52,255,116,240,246,211,74 - ,0,127,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,107,120,0,0,0,0,0,0,0,0,0,0 - ,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 - ,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,17,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,127,0,0,0,0,0,0 - ,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,13,69,194,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 - ,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 - ,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 - ,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,127,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 - ,0,0,0,0,0,233,241,107,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 - ,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 - ,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,127,127,127,127,127,127,127,0,127,127,127,127,127 - ,127,127,0,127,127,127,127,127,127,127,0,127,127,127,127,127,127,127,0,127, - 127,127,127,127,127,127,0,127,127,127,127,127,127,127,0,127,127,127,127,127, - 127,127,0,127,127,127,127,127,127,127,0,127,127,127,127,127,127,127,0,127,127 - ,127,127,127,127,127,0,127,127,127,127,127,127,127,0,127,127,127,127,127,127, - 127,0,127,127,127,127,127,127,127,0,127,127,127,127,127,127,127,0,127,127,127 - ,127,127,127,127,0,127,127,127,127,127,127,127,0,127,127,127,127,127,127,127, - 0,127,127,127,127,127,127,127,0,127,127,127,127,127,127,127,0,127,127,127,127 - ,127,127,127,0,127,127,127,127,127,127,127,0,127,127,127,127,127,127,127,0, - 127,127,127,127,127,127,127,0,127,127,127,127,127,127,127,0,127,127,127,127, - 127,127,127,0,127,127,127,127,127,127,127,0,127,127,127,127,127,127,127,0,127 - ,127,127,127,127,127,127,0,127,127,127,127,127,127,127,0,127,127,127,127,127, - 127,127,0,127,127,127,127,127,127,127,0,127,127,127,127,127,127,127,0,127,0,0 - ,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 - ,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 - ,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 - ,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,127,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,104,226,228,110,0,0 - ,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 - ,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 - ,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,127,0,8,195,125,0,0,0,0,0,0,0,0,98,212,15,0,0 - ,0,2,197,213,8,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,241,45,96,248,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,157,139,0,0,0,0,0,0,0,0,154,142,0,0,0,0,10, - 199,192,5,0,0,0,0,0,0,0,0,0,0,0,0,111,190,2,0,0,0,0,0,0,0,50,225,29,0,0,0,0, - 130,241,30,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,11,187,114,0 - ,0,0,0,0,0,0,1,161,149,1,0,0,0,24,211,193,6,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 - ,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,68,217,9,0,0,0,0,0,0,0,44,223,23,0,0,0,0 - ,88,244,31,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,64,91,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,127,0,0,18,213,67,0,0,0,0,0,0,46,220,30,0,0,0,0,115,148,123,138,0,0,0, - 14,196,237,203,189,27,0,0,0,240,3,49,244,3,0,0,0,105,226,228,110,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,155,105,0,0,0,0,0,0,121,140,0,0,0,0,0,158,74,90 - ,145,0,0,0,0,240,3,49,244,3,0,0,0,0,158,122,0,0,0,0,0,0,12,210,56,0,0,0,0,38, - 200,77,175,0,0,0,49,244,53,244,3,0,0,0,3,138,202,114,121,12,0,0,86,232,214, - 194,37,0,0,0,0,7,172,97,0,0,0,0,0,0,144,133,0,0,0,0,6,185,54,92,153,0,0,0,25, - 206,234,199,174,3,0,0,49,244,3,49,244,3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 - ,123,138,0,0,0,0,0,0,2,195,59,0,0,0,0,11,204,78,171,0,0,0,0,49,244,53,244,3,0 - ,0,0,0,0,51,205,26,0,0,52,255,4,0,0,0,0,0,0,49,244,53,244,3,0,0,127,0,0,0,32, - 105,0,0,0,0,0,0,91,46,0,0,0,0,2,113,7,1,111,7,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 - ,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,6,117,7,0,0,0,0,0,57,72,0,0,0,0,0 - ,74,38,0,93,20,0,0,0,0,0,0,0,0,0,0,51,110,93,212,36,0,0,0,0,0,0,0,0,0,0,0,0,0 - ,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,24,0,0,0,1,109,6,0,0,0,0,0,35,80,0,0,0,0,0,49,64,0, - 96,15,0,0,0,0,0,0,0,0,0,0,0,0,0,103,25,0,0,0,52,255,4,0,0,0,0,0,0,0,0,0,0,0,0 - ,0,127,0,103,213,244,239,180,36,0,0,103,213,244,240,180,36,0,0,103,213,244, - 239,180,36,0,0,103,213,244,239,180,36,0,0,103,213,244,239,180,36,0,0,103,213, - 244,239,180,36,0,0,132,239,226,131,234,236,0,0,12,151,233,244,202,40,0,0,13, - 156,236,241,165,12,0,0,13,156,236,241,165,12,0,0,13,156,236,241,165,12,0,0,13 - ,156,235,241,165,12,0,0,0,244,246,255,4,0,0,0,0,244,246,255,4,0,0,0,0,244,246 - ,255,4,0,0,0,148,244,255,4,0,0,0,0,25,178,243,251,214,9,0,52,255,111,233,235, - 80,0,0,0,29,182,242,237,157,11,0,0,29,182,242,237,157,11,0,0,29,182,242,237, - 157,11,0,0,29,182,242,237,157,11,0,0,29,182,242,237,157,11,0,0,0,0,49,244,3,0 - ,0,0,29,181,242,238,160,192,0,52,255,4,0,52,255,4,0,52,255,4,0,52,255,4,0,52, - 255,4,0,52,255,4,0,52,255,4,0,52,255,4,0,40,250,19,0,0,50,245,0,52,255,121, - 231,241,161,10,0,93,212,0,0,0,221,87,0,127,0,93,52,2,9,162,204,0,0,93,52,2,10 - ,165,204,0,0,93,52,2,9,162,204,0,0,93,52,2,9,162,204,0,0,93,52,2,9,162,204,0, - 0,93,52,2,9,159,204,0,0,48,4,120,255,57,104,0,0,174,188,24,0,53,43,0,0,173, - 187,16,11,178,153,0,0,173,187,16,11,178,153,0,0,173,186,16,11,179,152,0,0,173 - ,177,14,11,179,152,0,0,0,0,52,255,4,0,0,0,0,0,52,255,4,0,0,0,0,0,52,255,4,0,0 - ,0,0,0,252,4,0,0,0,0,192,167,11,4,181,123,0,52,255,121,2,133,219,0,0,0,198, - 158,8,19,198,149,0,0,198,158,8,19,198,149,0,0,198,158,8,19,198,149,0,0,198, - 158,8,19,198,149,0,0,198,158,8,19,198,149,0,0,0,0,0,0,0,0,0,0,198,161,9,24, - 239,165,0,52,255,4,0,52,255,4,0,52,255,4,0,52,255,4,0,52,255,4,0,52,255,4,0, - 52,255,4,0,52,255,4,0,0,200,106,0,0,142,163,0,52,255,163,9,19,198,145,0,11, - 244,36,0,48,244,10,0,127,0,0,0,0,0,61,252,0,0,0,0,0,0,62,252,0,0,0,0,0,0,61, - 252,0,0,0,0,0,0,61,252,0,0,0,0,0,0,61,252,0,0,0,0,0,0,57,252,0,0,0,0,55,255,6 - ,54,0,22,255,41,0,0,0,0,0,21,255,50,0,0,67,236,0,21,255,50,0,0,67,236,0,21, - 255,49,0,0,70,236,0,21,255,37,0,0,70,236,0,0,0,0,52,255,4,0,0,0,0,0,52,255,4, - 0,0,0,0,0,52,255,4,0,0,0,0,0,252,4,0,0,0,25,255,35,0,0,86,217,0,52,255,18,0, - 56,254,1,0,27,255,32,0,0,81,234,0,27,255,32,0,0,81,234,0,27,255,32,0,0,81,234 - ,0,27,255,32,0,0,81,234,0,27,255,32,0,0,81,234,0,0,240,240,240,240,240,240,0, - 27,255,31,2,168,165,235,0,52,255,4,0,52,255,4,0,52,255,4,0,52,255,4,0,52,255, - 4,0,52,255,4,0,52,255,4,0,52,255,4,0,0,103,199,0,3,230,67,0,52,255,33,0,0,81, - 232,0,0,162,117,0,130,165,0,0,127,0,78,197,237,240,243,255,0,0,71,189,224,224 - ,230,255,0,0,78,197,237,240,243,255,0,0,78,197,237,240,243,255,0,0,78,197,237 - ,240,243,255,0,0,78,197,237,240,243,255,0,0,125,231,244,255,240,241,0,50,255, - 7,0,0,0,0,0,47,255,225,224,224,227,239,0,47,255,225,224,224,227,239,0,47,255, - 240,240,240,241,247,0,47,255,240,240,240,241,247,0,0,0,0,52,255,4,0,0,0,0,0, - 52,255,4,0,0,0,0,0,52,255,4,0,0,0,0,0,252,4,0,0,0,48,255,7,0,0,56,254,0,52, - 255,4,0,52,255,4,0,48,255,6,0,0,55,254,0,48,255,6,0,0,55,254,0,48,255,6,0,0, - 55,254,0,48,255,6,0,0,55,254,0,48,255,6,0,0,55,254,0,0,0,0,0,0,0,0,0,48,255,7 - ,152,111,54,255,0,52,255,4,0,52,255,4,0,52,255,4,0,52,255,4,0,52,255,4,0,52, - 255,4,0,52,255,4,0,52,255,4,0,0,15,246,36,70,225,1,0,52,255,6,0,0,55,254,0,0, - 68,197,0,212,76,0,0,127,24,251,95,6,0,62,255,0,23,250,82,2,0,65,255,0,24,251, - 86,5,0,65,255,0,24,251,86,5,0,65,255,0,24,251,86,5,0,65,255,0,24,251,86,5,0, - 65,255,0,32,255,57,53,255,8,0,0,22,255,41,0,0,0,0,0,22,255,23,0,0,0,0,0,22, - 255,23,0,0,0,0,0,22,255,21,0,0,0,0,0,22,255,21,0,0,0,0,0,0,0,0,52,255,4,0,0,0 - ,0,0,52,255,4,0,0,0,0,0,52,255,4,0,0,0,0,0,252,4,0,0,0,25,255,34,0,0,83,238,0 - ,52,255,4,0,52,255,4,0,27,255,32,0,0,81,234,0,27,255,32,0,0,81,234,0,27,255, - 32,0,0,81,234,0,27,255,32,0,0,81,234,0,27,255,32,0,0,81,234,0,0,0,0,48,240,3, - 0,0,27,255,165,129,0,81,234,0,48,255,8,0,66,255,4,0,48,255,8,0,66,255,4,0,48, - 255,8,0,66,255,4,0,48,255,8,0,66,255,4,0,0,0,166,128,162,131,0,0,52,255,32,0, - 0,80,233,0,0,2,226,62,238,5,0,0,127,33,255,38,0,4,170,255,0,33,255,69,0,26, - 189,255,0,33,255,68,0,26,189,255,0,33,255,68,0,26,189,255,0,33,255,68,0,26, - 189,255,0,33,255,68,0,26,189,255,0,38,255,39,95,255,76,1,0,0,177,185,23,0,50, - 42,0,0,176,165,17,0,32,76,0,0,176,165,17,0,32,76,0,0,176,162,17,0,32,76,0,0, - 176,162,17,0,29,79,0,0,0,0,52,255,4,0,0,0,0,0,52,255,4,0,0,0,0,0,52,255,4,0,0 - ,0,0,0,252,4,0,0,0,0,194,163,8,21,202,156,0,52,255,4,0,52,255,4,0,0,200,158,7 - ,19,198,151,0,0,200,158,7,19,198,151,0,0,200,158,7,19,198,151,0,0,200,158,7, - 19,198,151,0,0,200,158,7,19,198,151,0,0,0,0,0,0,0,0,0,0,216,210,7,19,198,151, - 0,15,251,62,0,147,255,4,0,15,251,62,0,147,255,4,0,15,251,62,0,147,255,4,0,15, - 251,62,0,147,255,4,0,0,0,70,222,242,36,0,0,52,255,160,8,17,195,146,0,0,0,137, - 215,157,0,0,0,127,0,114,219,196,189,127,255,0,0,114,231,243,204,107,255,0,0, - 114,231,243,204,108,255,0,0,114,231,243,204,108,255,0,0,114,231,243,204,108, - 255,0,0,113,230,243,205,106,255,0,0,154,245,215,95,224,242,0,0,14,153,237,255 - ,207,42,0,0,14,155,234,244,218,111,0,0,14,155,234,244,218,111,0,0,14,155,234, - 244,218,111,0,0,14,153,233,244,220,120,0,0,118,244,246,255,244,244,0,0,108, - 224,230,255,224,224,0,0,108,224,230,255,224,224,0,22,244,244,255,244,244,34,0 - ,0,27,180,242,238,161,13,0,52,255,4,0,52,255,4,0,0,31,184,243,238,160,12,0,0, - 31,184,243,238,160,12,0,0,31,184,243,238,160,12,0,0,31,184,243,238,160,12,0,0 - ,31,184,243,238,160,12,0,0,0,0,0,0,0,0,0,95,164,178,242,238,160,12,0,0,120, - 234,191,137,255,4,0,0,120,234,191,137,255,4,0,0,120,234,191,137,255,4,0,0,120 - ,234,191,137,255,4,0,0,0,2,227,198,0,0,0,52,255,120,232,241,160,10,0,0,0,43, - 255,72,0,0,0,127,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,187,14,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 - ,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 - ,0,0,0,0,0,0,0,0,0,40,4,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 - ,0,0,0,0,0,0,0,0,0,0,0,0,0,0,199,105,0,0,0,52,255,4,0,0,0,0,0,0,0,18,232,4,0, - 0,0,127,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 - ,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,10,1,167,67,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 - ,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 - ,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,64,244,16,0,0,0,52,255,4,0,0,0,0,0,0,0,132,148,0,0,0,0,127, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 - ,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,64,242,213,19,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 - ,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 - ,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, - 0,0,0,0,0,203,237,92,0,0,0,0,52,255,4,0,0,0,0,0,11,243,209,25,0,0,0,0,0,127, - 127,127,127,127,127,127,0,127,127,127,127,127,127,127,0,127,127,127,127,127, - 127,127,0,127,127,127,127,127,127,127,0,127,127,127,127,127,127,127,0,127,127 - ,127,127,127,127,127,0,127,127,127,127,127,127,127,0,127,127,127,127,127,127, - 127,0,127,127,127,127,127,127,127,0,127,127,127,127,127,127,127,0,127,127,127 - ,127,127,127,127,0,127,127,127,127,127,127,127,0,127,127,127,127,127,127,127, - 0,127,127,127,127,127,127,127,0,127,127,127,127,127,127,127,0,127,127,127,127 - ,127,127,127,0,127,127,127,127,127,127,127,0,127,127,127,127,127,127,127,0, - 127,127,127,127,127,127,127,0,127,127,127,127,127,127,127,0,127,127,127,127, - 127,127,127,0,127,127,127,127,127,127,127,0,127,127,127,127,127,127,127,0,127 - ,127,127,127,127,127,127,0,127,127,127,127,127,127,127,0,127,127,127,127,127, - 127,127,0,127,127,127,127,127,127,127,0,127,127,127,127,127,127,127,0,127,127 - ,127,127,127,127,127,0,127,127,127,127,127,127,127,0,127,127,127,127,127,127, - 127,0,127,127,127,127,127,127,127,0 -}; - - -void TwGenerateDefaultFonts(float _Scaling) -{ - g_DefaultSmallFont = TwGenerateFont(s_Font0, FONT0_BM_W, FONT0_BM_H, _Scaling); - assert(g_DefaultSmallFont && g_DefaultSmallFont->m_NbCharRead==224); - g_DefaultNormalFont = TwGenerateFont(s_Font1AA, FONT1AA_BM_W, FONT1AA_BM_H, _Scaling); - assert(g_DefaultNormalFont && g_DefaultNormalFont->m_NbCharRead==224); - g_DefaultLargeFont = TwGenerateFont(s_Font2AA, FONT2AA_BM_W, FONT2AA_BM_H, _Scaling); - assert(g_DefaultLargeFont && g_DefaultLargeFont->m_NbCharRead==224); - g_DefaultFixed1Font = TwGenerateFont(s_FontFixed1, FONTFIXED1_BM_W, FONTFIXED1_BM_H, _Scaling); - assert(g_DefaultFixed1Font && g_DefaultFixed1Font->m_NbCharRead==224); -} - -// --------------------------------------------------------------------------- - -void TwDeleteDefaultFonts() -{ - delete g_DefaultSmallFont; - g_DefaultSmallFont = NULL; - delete g_DefaultNormalFont; - g_DefaultNormalFont = NULL; - delete g_DefaultLargeFont; - g_DefaultLargeFont = NULL; - delete g_DefaultFixed1Font; - g_DefaultFixed1Font = NULL; -} - -// --------------------------------------------------------------------------- diff --git a/extern/AntTweakBar/src/TwFonts.h b/extern/AntTweakBar/src/TwFonts.h deleted file mode 100644 index 7c4860ee..00000000 --- a/extern/AntTweakBar/src/TwFonts.h +++ /dev/null @@ -1,67 +0,0 @@ -// --------------------------------------------------------------------------- -// -// @file TwFonts.h -// @brief Bitmaps fonts -// @author Philippe Decaudin -// @license This file is part of the AntTweakBar library. -// For conditions of distribution and use, see License.txt -// -// note: Private header -// -// --------------------------------------------------------------------------- - - -#if !defined ANT_TW_FONTS_INCLUDED -#define ANT_TW_FONTS_INCLUDED - -//#include - -/* -A source bitmap includes 224 characters starting from ascii char 32 (i.e. space) -to ascii char 255 (extended ASCII Latin1/CP1252): - - !"#$%&'()*+,-./0123456789:;<=>? -@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_ -`abcdefghijklmnopqrstuvwxyz{|}~ -€‚ƒ„…†‡ˆ‰Š‹ŒŽ‘’“”•–—˜™š›œžŸ - ¡¢£¤¥¦§¨©ª«¬­®¯°±²³´µ¶·¸¹º»¼½¾¿ -ÀÁÂÃÄÅÆÇÈÉÊËÌÍÎÏÐÑÒÓÔÕÖרÙÚÛÜÝÞß -àáâãäåæçèéêëìíîïðñòóôõö÷øùúûüýþÿ - -First pixel column of a source bitmap is a delimiter with color=zero at the end of each line of characters. -Last pixel row of a line of characters is a delimiter with color=zero at the last pixel of each character. - -*/ - - -struct CTexFont -{ - unsigned char * m_TexBytes; - int m_TexWidth; // power of 2 - int m_TexHeight; // power of 2 - float m_CharU0[256]; - float m_CharV0[256]; - float m_CharU1[256]; - float m_CharV1[256]; - int m_CharWidth[256]; - int m_CharHeight; - int m_NbCharRead; - - CTexFont(); - ~CTexFont(); -}; - - -CTexFont *TwGenerateFont(const unsigned char *_Bitmap, int _BmWidth, int _BmHeight, float _Scaling=1.0f); - - -extern CTexFont *g_DefaultSmallFont; -extern CTexFont *g_DefaultNormalFont; -extern CTexFont *g_DefaultLargeFont; -extern CTexFont *g_DefaultFixed1Font; - -void TwGenerateDefaultFonts(float _Scaling=1.0f); -void TwDeleteDefaultFonts(); - - -#endif // !defined ANT_TW_FONTS_INCLUDED diff --git a/extern/AntTweakBar/src/TwGraph.h b/extern/AntTweakBar/src/TwGraph.h deleted file mode 100644 index 82c70ac1..00000000 --- a/extern/AntTweakBar/src/TwGraph.h +++ /dev/null @@ -1,58 +0,0 @@ -// --------------------------------------------------------------------------- -// -// @file TwGraph.h -// @brief ITwGraph pure interface -// @author Philippe Decaudin -// @license This file is part of the AntTweakBar library. -// For conditions of distribution and use, see License.txt -// -// note: Private header -// -// --------------------------------------------------------------------------- - - -#if !defined ANT_TW_GRAPH_INCLUDED -#define ANT_TW_GRAPH_INCLUDED - -#include "TwColors.h" -#include "TwFonts.h" - - -// --------------------------------------------------------------------------- - -#ifdef DrawText // DirectX redefines 'DrawText' !! -# undef DrawText -#endif // DrawText - -class ITwGraph -{ -public: - virtual int Init() = 0; - virtual int Shut() = 0; - virtual void BeginDraw(int _WndWidth, int _WndHeight) = 0; - virtual void EndDraw() = 0; - virtual bool IsDrawing() = 0; - virtual void Restore() = 0; - - virtual void DrawLine(int _X0, int _Y0, int _X1, int _Y1, color32 _Color0, color32 _Color1, bool _AntiAliased=false) = 0; - virtual void DrawLine(int _X0, int _Y0, int _X1, int _Y1, color32 _Color, bool _AntiAliased=false) = 0; - virtual void DrawRect(int _X0, int _Y0, int _X1, int _Y1, color32 _Color00, color32 _Color10, color32 _Color01, color32 _Color11) = 0; - virtual void DrawRect(int _X0, int _Y0, int _X1, int _Y1, color32 _Color) = 0; - enum Cull { CULL_NONE, CULL_CW, CULL_CCW }; - virtual void DrawTriangles(int _NumTriangles, int *_Vertices, color32 *_Colors, Cull _CullMode) = 0; - - virtual void * NewTextObj() = 0; - virtual void DeleteTextObj(void *_TextObj) = 0; - virtual void BuildText(void *_TextObj, const std::string *_TextLines, color32 *_LineColors, color32 *_LineBgColors, int _NbLines, const CTexFont *_Font, int _Sep, int _BgWidth) = 0; - virtual void DrawText(void *_TextObj, int _X, int _Y, color32 _Color, color32 _BgColor) = 0; - - virtual void ChangeViewport(int _X0, int _Y0, int _Width, int _Height, int _OffsetX, int _OffsetY) = 0; - virtual void RestoreViewport() = 0; - virtual void SetScissor(int _X0, int _Y0, int _Width, int _Height) = 0; - - virtual ~ITwGraph() {} // required by gcc -}; - -// --------------------------------------------------------------------------- - -#endif // ANT_TW_GRAPH_INCLUDED diff --git a/extern/AntTweakBar/src/TwMgr.cpp b/extern/AntTweakBar/src/TwMgr.cpp deleted file mode 100644 index fc6f34ba..00000000 --- a/extern/AntTweakBar/src/TwMgr.cpp +++ /dev/null @@ -1,6717 +0,0 @@ -// --------------------------------------------------------------------------- -// -// @file TwMgr.cpp -// @author Philippe Decaudin -// @license This file is part of the AntTweakBar library. -// For conditions of distribution and use, see License.txt -// -// --------------------------------------------------------------------------- - - -#include "TwPrecomp.h" -#include -#include "TwMgr.h" -#include "TwBar.h" -#include "TwFonts.h" -#include "TwOpenGL.h" -#include "TwOpenGLCore.h" -#ifdef ANT_WINDOWS -# include "resource.h" -# ifdef _DEBUG -# include -# endif // _DEBUG -#endif // ANT_WINDOWS - -#if !defined(ANT_WINDOWS) -# define _snprintf snprintf -#endif // defined(ANT_WINDOWS) - - -using namespace std; - -CTwMgr *g_TwMgr = NULL; // current TwMgr -bool g_BreakOnError = false; -TwErrorHandler g_ErrorHandler = NULL; -int g_TabLength = 4; -CTwBar * const TW_GLOBAL_BAR = (CTwBar *)(-1); -int g_InitWndWidth = -1; -int g_InitWndHeight = -1; -TwCopyCDStringToClient g_InitCopyCDStringToClient = NULL; -TwCopyStdStringToClient g_InitCopyStdStringToClient = NULL; -float g_FontScaling = 1.0f; - -// multi-windows -const int TW_MASTER_WINDOW_ID = 0; -typedef map CTwWndMap; -CTwWndMap g_Wnds; -CTwMgr *g_TwMasterMgr = NULL; - -// error messages -extern const char *g_ErrUnknownAttrib; -extern const char *g_ErrNoValue; -extern const char *g_ErrBadValue; -const char *g_ErrInit = "Already initialized"; -const char *g_ErrShut = "Already shutdown"; -const char *g_ErrNotInit = "Not initialized"; -const char *g_ErrUnknownAPI = "Unsupported graph API"; -const char *g_ErrBadDevice = "Invalid graph device"; -const char *g_ErrBadParam = "Invalid parameter"; -const char *g_ErrExist = "Exists already"; -const char *g_ErrNotFound = "Not found"; -const char *g_ErrNthToDo = "Nothing to do"; -const char *g_ErrBadSize = "Bad size"; -const char *g_ErrIsDrawing = "Asynchronous drawing detected"; -const char *g_ErrIsProcessing="Asynchronous processing detected"; -const char *g_ErrOffset = "Offset larger than StructSize"; -const char *g_ErrDelStruct = "Cannot delete a struct member"; -const char *g_ErrNoBackQuote= "Name cannot include back-quote"; -const char *g_ErrStdString = "Debug/Release std::string mismatch"; -const char *g_ErrCStrParam = "Value count for TW_PARAM_CSTRING must be 1"; -const char *g_ErrOutOfRange = "Index out of range"; -const char *g_ErrHasNoValue = "Has no value"; -const char *g_ErrBadType = "Incompatible type"; -const char *g_ErrDelHelp = "Cannot delete help bar"; -char g_ErrParse[512]; - -void ANT_CALL TwGlobalError(const char *_ErrorMessage); - -#if defined(ANT_UNIX) || defined(ANT_OSX) -#define _stricmp strcasecmp -#define _strdup strdup -#endif - -#ifdef ANT_WINDOWS - bool g_UseCurRsc = true; // use dll resources for rotoslider cursors -#endif - -// --------------------------------------------------------------------------- - -const float FLOAT_EPS = 1.0e-7f; -const float FLOAT_EPS_SQ = 1.0e-14f; -const float FLOAT_PI = 3.14159265358979323846f; -const double DOUBLE_EPS = 1.0e-14; -const double DOUBLE_EPS_SQ = 1.0e-28; -const double DOUBLE_PI = 3.14159265358979323846; - -inline double DegToRad(double degree) { return degree * (DOUBLE_PI/180.0); } -inline double RadToDeg(double radian) { return radian * (180.0/DOUBLE_PI); } - -// --------------------------------------------------------------------------- - -// a static global object to verify that Tweakbar module has been properly terminated (in debug mode only) -#ifdef _DEBUG -static struct CTwVerif -{ - ~CTwVerif() - { - if( g_TwMgr!=NULL ) - g_TwMgr->SetLastError("Tweak bar module has not been terminated properly: call TwTerminate()\n"); - } -} s_Verif; -#endif // _DEBUG - -// --------------------------------------------------------------------------- -// Color ext type -// --------------------------------------------------------------------------- - -void CColorExt::RGB2HLS() -{ - float fH = 0, fL = 0, fS = 0; - ColorRGBToHLSf((float)R/255.0f, (float)G/255.0f, (float)B/255.0f, &fH, &fL, &fS); - H = (int)fH; - if( H>=360 ) - H -= 360; - else if( H<0 ) - H += 360; - L = (int)(255.0f*fL + 0.5f); - if( L<0 ) - L = 0; - else if( L>255 ) - L = 255; - S = (int)(255.0f*fS + 0.5f); - if( S<0 ) - S = 0; - else if( S>255 ) - S = 255; -} - -void CColorExt::HLS2RGB() -{ - float fR = 0, fG = 0, fB = 0; - ColorHLSToRGBf((float)H, (float)L/255.0f, (float)S/255.0f, &fR, &fG, &fB); - R = (int)(255.0f*fR + 0.5f); - if( R<0 ) - R = 0; - else if( R>255 ) - R = 255; - G = (int)(255.0f*fG + 0.5f); - if( G<0 ) - G = 0; - else if( G>255 ) - G = 255; - B = (int)(255.0f*fB + 0.5f); - if( B<0 ) - B = 0; - else if( B>255 ) - B = 255; -} - -void ANT_CALL CColorExt::InitColor32CB(void *_ExtValue, void *_ClientData) -{ - CColorExt *ext = static_cast(_ExtValue); - if( ext ) - { - ext->m_IsColorF = false; - ext->R = 0; - ext->G = 0; - ext->B = 0; - ext->H = 0; - ext->L = 0; - ext->S = 0; - ext->A = 255; - ext->m_HLS = false; - ext->m_HasAlpha = false; - ext->m_CanHaveAlpha = true; - if( g_TwMgr && g_TwMgr->m_GraphAPI==TW_DIRECT3D9 ) // D3D10 now use OGL rgba order! - ext->m_OGL = false; - else - ext->m_OGL = true; - ext->m_PrevConvertedColor = Color32FromARGBi(ext->A, ext->R, ext->G, ext->B); - ext->m_StructProxy = (CTwMgr::CStructProxy *)_ClientData; - } -} - -void ANT_CALL CColorExt::InitColor3FCB(void *_ExtValue, void *_ClientData) -{ - InitColor32CB(_ExtValue, _ClientData); - CColorExt *ext = static_cast(_ExtValue); - if( ext ) - { - ext->m_IsColorF = true; - ext->m_HasAlpha = false; - ext->m_CanHaveAlpha = false; - } -} - -void ANT_CALL CColorExt::InitColor4FCB(void *_ExtValue, void *_ClientData) -{ - InitColor32CB(_ExtValue, _ClientData); - CColorExt *ext = static_cast(_ExtValue); - if( ext ) - { - ext->m_IsColorF = true; - ext->m_HasAlpha = true; - ext->m_CanHaveAlpha = true; - } -} - -void ANT_CALL CColorExt::CopyVarFromExtCB(void *_VarValue, const void *_ExtValue, unsigned int _ExtMemberIndex, void *_ClientData) -{ - unsigned int *var32 = static_cast(_VarValue); - float *varF = static_cast(_VarValue); - CColorExt *ext = (CColorExt *)(_ExtValue); - CTwMgr::CMemberProxy *mProxy = static_cast(_ClientData); - if( _VarValue && ext ) - { - if( ext->m_HasAlpha && mProxy && mProxy->m_StructProxy && mProxy->m_StructProxy->m_Type==g_TwMgr->m_TypeColor3F ) - ext->m_HasAlpha = false; - - // Synchronize HLS and RGB - if( _ExtMemberIndex>=0 && _ExtMemberIndex<=2 ) - ext->RGB2HLS(); - else if( _ExtMemberIndex>=3 && _ExtMemberIndex<=5 ) - ext->HLS2RGB(); - else if( mProxy && _ExtMemberIndex==7 && mProxy->m_VarParent ) - { - assert( mProxy->m_VarParent->m_Vars.size()==8 ); - if( mProxy->m_VarParent->m_Vars[0]->m_Visible != !ext->m_HLS - || mProxy->m_VarParent->m_Vars[1]->m_Visible != !ext->m_HLS - || mProxy->m_VarParent->m_Vars[2]->m_Visible != !ext->m_HLS - || mProxy->m_VarParent->m_Vars[3]->m_Visible != ext->m_HLS - || mProxy->m_VarParent->m_Vars[4]->m_Visible != ext->m_HLS - || mProxy->m_VarParent->m_Vars[5]->m_Visible != ext->m_HLS ) - { - mProxy->m_VarParent->m_Vars[0]->m_Visible = !ext->m_HLS; - mProxy->m_VarParent->m_Vars[1]->m_Visible = !ext->m_HLS; - mProxy->m_VarParent->m_Vars[2]->m_Visible = !ext->m_HLS; - mProxy->m_VarParent->m_Vars[3]->m_Visible = ext->m_HLS; - mProxy->m_VarParent->m_Vars[4]->m_Visible = ext->m_HLS; - mProxy->m_VarParent->m_Vars[5]->m_Visible = ext->m_HLS; - mProxy->m_Bar->NotUpToDate(); - } - if( mProxy->m_VarParent->m_Vars[6]->m_Visible != ext->m_HasAlpha ) - { - mProxy->m_VarParent->m_Vars[6]->m_Visible = ext->m_HasAlpha; - mProxy->m_Bar->NotUpToDate(); - } - if( static_cast(mProxy->m_VarParent->m_Vars[7])->m_ReadOnly ) - { - static_cast(mProxy->m_VarParent->m_Vars[7])->m_ReadOnly = false; - mProxy->m_Bar->NotUpToDate(); - } - } - // Convert to color32 - color32 col = Color32FromARGBi((ext->m_HasAlpha ? ext->A : 255), ext->R, ext->G, ext->B); - if( ext->m_OGL && !ext->m_IsColorF ) - col = (col&0xff00ff00) | (unsigned char)(col>>16) | (((unsigned char)(col))<<16); - if( ext->m_IsColorF ) - Color32ToARGBf(col, (ext->m_HasAlpha ? varF+3 : NULL), varF+0, varF+1, varF+2); - else - { - if( ext->m_HasAlpha ) - *var32 = col; - else - *var32 = ((*var32)&0xff000000) | (col&0x00ffffff); - } - ext->m_PrevConvertedColor = col; - } -} - -void ANT_CALL CColorExt::CopyVarToExtCB(const void *_VarValue, void *_ExtValue, unsigned int _ExtMemberIndex, void *_ClientData) -{ - const unsigned int *var32 = static_cast(_VarValue); - const float *varF = static_cast(_VarValue); - CColorExt *ext = static_cast(_ExtValue); - CTwMgr::CMemberProxy *mProxy = static_cast(_ClientData); - if( _VarValue && ext ) - { - if( ext->m_HasAlpha && mProxy && mProxy->m_StructProxy && mProxy->m_StructProxy->m_Type==g_TwMgr->m_TypeColor3F ) - ext->m_HasAlpha = false; - - if( mProxy && _ExtMemberIndex==7 && mProxy->m_VarParent ) - { - assert( mProxy->m_VarParent->m_Vars.size()==8 ); - if( mProxy->m_VarParent->m_Vars[0]->m_Visible != !ext->m_HLS - || mProxy->m_VarParent->m_Vars[1]->m_Visible != !ext->m_HLS - || mProxy->m_VarParent->m_Vars[2]->m_Visible != !ext->m_HLS - || mProxy->m_VarParent->m_Vars[3]->m_Visible != ext->m_HLS - || mProxy->m_VarParent->m_Vars[4]->m_Visible != ext->m_HLS - || mProxy->m_VarParent->m_Vars[5]->m_Visible != ext->m_HLS ) - { - mProxy->m_VarParent->m_Vars[0]->m_Visible = !ext->m_HLS; - mProxy->m_VarParent->m_Vars[1]->m_Visible = !ext->m_HLS; - mProxy->m_VarParent->m_Vars[2]->m_Visible = !ext->m_HLS; - mProxy->m_VarParent->m_Vars[3]->m_Visible = ext->m_HLS; - mProxy->m_VarParent->m_Vars[4]->m_Visible = ext->m_HLS; - mProxy->m_VarParent->m_Vars[5]->m_Visible = ext->m_HLS; - mProxy->m_Bar->NotUpToDate(); - } - if( mProxy->m_VarParent->m_Vars[6]->m_Visible != ext->m_HasAlpha ) - { - mProxy->m_VarParent->m_Vars[6]->m_Visible = ext->m_HasAlpha; - mProxy->m_Bar->NotUpToDate(); - } - if( static_cast(mProxy->m_VarParent->m_Vars[7])->m_ReadOnly ) - { - static_cast(mProxy->m_VarParent->m_Vars[7])->m_ReadOnly = false; - mProxy->m_Bar->NotUpToDate(); - } - } - color32 col; - if( ext->m_IsColorF ) - col = Color32FromARGBf((ext->m_HasAlpha ? varF[3] : 1), varF[0], varF[1], varF[2]); - else - col = *var32; - if( ext->m_OGL && !ext->m_IsColorF ) - col = (col&0xff00ff00) | (unsigned char)(col>>16) | (((unsigned char)(col))<<16); - Color32ToARGBi(col, (ext->m_HasAlpha ? &ext->A : NULL), &ext->R, &ext->G, &ext->B); - if( (col & 0x00ffffff)!=(ext->m_PrevConvertedColor & 0x00ffffff) ) - ext->RGB2HLS(); - ext->m_PrevConvertedColor = col; - } -} - -void ANT_CALL CColorExt::SummaryCB(char *_SummaryString, size_t /*_SummaryMaxLength*/, const void *_ExtValue, void * /*_ClientData*/) -{ - // copy var - CColorExt *ext = (CColorExt *)(_ExtValue); - if( ext && ext->m_StructProxy && ext->m_StructProxy->m_StructData ) - { - if( ext->m_StructProxy->m_StructGetCallback ) - ext->m_StructProxy->m_StructGetCallback(ext->m_StructProxy->m_StructData, ext->m_StructProxy->m_StructClientData); - //if( *(unsigned int *)(ext->m_StructProxy->m_StructData)!=ext->m_PrevConvertedColor ) - CopyVarToExtCB(ext->m_StructProxy->m_StructData, ext, 99, NULL); - } - - //unsigned int col = 0; - //CopyVar32FromExtCB(&col, _ExtValue, 99, _ClientData); - //_snprintf(_SummaryString, _SummaryMaxLength, "0x%.8X", col); - //(void) _SummaryMaxLength, _ExtValue, _ClientData; - _SummaryString[0] = ' '; // required to force background color for this value - _SummaryString[1] = '\0'; -} - -void CColorExt::CreateTypes() -{ - if( g_TwMgr==NULL ) - return; - TwStructMember ColorExtMembers[] = { { "Red", TW_TYPE_INT32, offsetof(CColorExt, R), "min=0 max=255" }, - { "Green", TW_TYPE_INT32, offsetof(CColorExt, G), "min=0 max=255" }, - { "Blue", TW_TYPE_INT32, offsetof(CColorExt, B), "min=0 max=255" }, - { "Hue", TW_TYPE_INT32, offsetof(CColorExt, H), "hide min=0 max=359" }, - { "Lightness", TW_TYPE_INT32, offsetof(CColorExt, L), "hide min=0 max=255" }, - { "Saturation", TW_TYPE_INT32, offsetof(CColorExt, S), "hide min=0 max=255" }, - { "Alpha", TW_TYPE_INT32, offsetof(CColorExt, A), "hide min=0 max=255" }, - { "Mode", TW_TYPE_BOOLCPP, offsetof(CColorExt, m_HLS), "true='HLS' false='RGB' readwrite" } }; - g_TwMgr->m_TypeColor32 = TwDefineStructExt("COLOR32", ColorExtMembers, 8, sizeof(unsigned int), sizeof(CColorExt), CColorExt::InitColor32CB, CColorExt::CopyVarFromExtCB, CColorExt::CopyVarToExtCB, CColorExt::SummaryCB, CTwMgr::CStruct::s_PassProxyAsClientData, "A 32-bit-encoded color."); - g_TwMgr->m_TypeColor3F = TwDefineStructExt("COLOR3F", ColorExtMembers, 8, 3*sizeof(float), sizeof(CColorExt), CColorExt::InitColor3FCB, CColorExt::CopyVarFromExtCB, CColorExt::CopyVarToExtCB, CColorExt::SummaryCB, CTwMgr::CStruct::s_PassProxyAsClientData, "A 3-floats-encoded RGB color."); - g_TwMgr->m_TypeColor4F = TwDefineStructExt("COLOR4F", ColorExtMembers, 8, 4*sizeof(float), sizeof(CColorExt), CColorExt::InitColor4FCB, CColorExt::CopyVarFromExtCB, CColorExt::CopyVarToExtCB, CColorExt::SummaryCB, CTwMgr::CStruct::s_PassProxyAsClientData, "A 4-floats-encoded RGBA color."); - // Do not name them "TW_COLOR*" because the name is displayed in the help bar. -} - -// --------------------------------------------------------------------------- -// Quaternion ext type -// --------------------------------------------------------------------------- - -void ANT_CALL CQuaternionExt::InitQuat4FCB(void *_ExtValue, void *_ClientData) -{ - CQuaternionExt *ext = static_cast(_ExtValue); - if( ext ) - { - ext->Qx = ext->Qy = ext->Qz = 0; - ext->Qs = 1; - ext->Vx = 1; - ext->Vy = ext->Vz = 0; - ext->Angle = 0; - ext->Dx = ext->Dy = ext->Dz = 0; - ext->m_AAMode = false; // Axis & angle mode hidden - ext->m_ShowVal = false; - ext->m_IsFloat = true; - ext->m_IsDir = false; - ext->m_Dir[0] = ext->m_Dir[1] = ext->m_Dir[2] = 0; - ext->m_DirColor = 0xffffff00; - int i, j; - for(i=0; i<3; ++i) - for(j=0; j<3; ++j) - ext->m_Permute[i][j] = (i==j) ? 1.0f : 0.0f; - ext->m_StructProxy = (CTwMgr::CStructProxy *)_ClientData; - ext->ConvertToAxisAngle(); - ext->m_Highlighted = false; - ext->m_Rotating = false; - if( ext->m_StructProxy!=NULL ) - { - ext->m_StructProxy->m_CustomDrawCallback = CQuaternionExt::DrawCB; - ext->m_StructProxy->m_CustomMouseButtonCallback = CQuaternionExt::MouseButtonCB; - ext->m_StructProxy->m_CustomMouseMotionCallback = CQuaternionExt::MouseMotionCB; - ext->m_StructProxy->m_CustomMouseLeaveCallback = CQuaternionExt::MouseLeaveCB; - } - } -} - -void ANT_CALL CQuaternionExt::InitQuat4DCB(void *_ExtValue, void *_ClientData) -{ - CQuaternionExt *ext = static_cast(_ExtValue); - if( ext ) - { - ext->Qx = ext->Qy = ext->Qz = 0; - ext->Qs = 1; - ext->Vx = 1; - ext->Vy = ext->Vz = 0; - ext->Angle = 0; - ext->Dx = ext->Dy = ext->Dz = 0; - ext->m_AAMode = false; // Axis & angle mode hidden - ext->m_ShowVal = false; - ext->m_IsFloat = false; - ext->m_IsDir = false; - ext->m_Dir[0] = ext->m_Dir[1] = ext->m_Dir[2] = 0; - ext->m_DirColor = 0xffffff00; - int i, j; - for(i=0; i<3; ++i) - for(j=0; j<3; ++j) - ext->m_Permute[i][j] = (i==j) ? 1.0f : 0.0f; - ext->m_StructProxy = (CTwMgr::CStructProxy *)_ClientData; - ext->ConvertToAxisAngle(); - ext->m_Highlighted = false; - ext->m_Rotating = false; - if( ext->m_StructProxy!=NULL ) - { - ext->m_StructProxy->m_CustomDrawCallback = CQuaternionExt::DrawCB; - ext->m_StructProxy->m_CustomMouseButtonCallback = CQuaternionExt::MouseButtonCB; - ext->m_StructProxy->m_CustomMouseMotionCallback = CQuaternionExt::MouseMotionCB; - ext->m_StructProxy->m_CustomMouseLeaveCallback = CQuaternionExt::MouseLeaveCB; - } - } -} - -void ANT_CALL CQuaternionExt::InitDir3FCB(void *_ExtValue, void *_ClientData) -{ - CQuaternionExt *ext = static_cast(_ExtValue); - if( ext ) - { - ext->Qx = ext->Qy = ext->Qz = 0; - ext->Qs = 1; - ext->Vx = 1; - ext->Vy = ext->Vz = 0; - ext->Angle = 0; - ext->Dx = 1; - ext->Dy = ext->Dz = 0; - ext->m_AAMode = false; // Axis & angle mode hidden - ext->m_ShowVal = true; - ext->m_IsFloat = true; - ext->m_IsDir = true; - ext->m_Dir[0] = ext->m_Dir[1] = ext->m_Dir[2] = 0; - ext->m_DirColor = 0xffffff00; - int i, j; - for(i=0; i<3; ++i) - for(j=0; j<3; ++j) - ext->m_Permute[i][j] = (i==j) ? 1.0f : 0.0f; - ext->m_StructProxy = (CTwMgr::CStructProxy *)_ClientData; - ext->ConvertToAxisAngle(); - ext->m_Highlighted = false; - ext->m_Rotating = false; - if( ext->m_StructProxy!=NULL ) - { - ext->m_StructProxy->m_CustomDrawCallback = CQuaternionExt::DrawCB; - ext->m_StructProxy->m_CustomMouseButtonCallback = CQuaternionExt::MouseButtonCB; - ext->m_StructProxy->m_CustomMouseMotionCallback = CQuaternionExt::MouseMotionCB; - ext->m_StructProxy->m_CustomMouseLeaveCallback = CQuaternionExt::MouseLeaveCB; - } - } -} - -void ANT_CALL CQuaternionExt::InitDir3DCB(void *_ExtValue, void *_ClientData) -{ - CQuaternionExt *ext = static_cast(_ExtValue); - if( ext ) - { - ext->Qx = ext->Qy = ext->Qz = 0; - ext->Qs = 1; - ext->Vx = 1; - ext->Vy = ext->Vz = 0; - ext->Angle = 0; - ext->Dx = 1; - ext->Dy = ext->Dz = 0; - ext->m_AAMode = false; // Axis & angle mode hidden - ext->m_ShowVal = true; - ext->m_IsFloat = false; - ext->m_IsDir = true; - ext->m_Dir[0] = ext->m_Dir[1] = ext->m_Dir[2] = 0; - ext->m_DirColor = 0xffffff00; - int i, j; - for(i=0; i<3; ++i) - for(j=0; j<3; ++j) - ext->m_Permute[i][j] = (i==j) ? 1.0f : 0.0f; - ext->m_StructProxy = (CTwMgr::CStructProxy *)_ClientData; - ext->ConvertToAxisAngle(); - ext->m_Highlighted = false; - ext->m_Rotating = false; - if( ext->m_StructProxy!=NULL ) - { - ext->m_StructProxy->m_CustomDrawCallback = CQuaternionExt::DrawCB; - ext->m_StructProxy->m_CustomMouseButtonCallback = CQuaternionExt::MouseButtonCB; - ext->m_StructProxy->m_CustomMouseMotionCallback = CQuaternionExt::MouseMotionCB; - ext->m_StructProxy->m_CustomMouseLeaveCallback = CQuaternionExt::MouseLeaveCB; - } - } -} - -void ANT_CALL CQuaternionExt::CopyVarFromExtCB(void *_VarValue, const void *_ExtValue, unsigned int _ExtMemberIndex, void *_ClientData) -{ - CQuaternionExt *ext = (CQuaternionExt *)(_ExtValue); - CTwMgr::CMemberProxy *mProxy = static_cast(_ClientData); - if( _VarValue && ext ) - { - // Synchronize Quat and AxisAngle - if( _ExtMemberIndex>=4 && _ExtMemberIndex<=7 ) - { - ext->ConvertToAxisAngle(); - // show/hide quat values - if( _ExtMemberIndex==4 && mProxy && mProxy->m_VarParent ) - { - assert( mProxy->m_VarParent->m_Vars.size()==16 ); - bool visible = ext->m_ShowVal; - if( ext->m_IsDir ) - { - if( mProxy->m_VarParent->m_Vars[13]->m_Visible != visible - || mProxy->m_VarParent->m_Vars[14]->m_Visible != visible - || mProxy->m_VarParent->m_Vars[15]->m_Visible != visible ) - { - mProxy->m_VarParent->m_Vars[13]->m_Visible = visible; - mProxy->m_VarParent->m_Vars[14]->m_Visible = visible; - mProxy->m_VarParent->m_Vars[15]->m_Visible = visible; - mProxy->m_Bar->NotUpToDate(); - } - } - else - { - if( mProxy->m_VarParent->m_Vars[4]->m_Visible != visible - || mProxy->m_VarParent->m_Vars[5]->m_Visible != visible - || mProxy->m_VarParent->m_Vars[6]->m_Visible != visible - || mProxy->m_VarParent->m_Vars[7]->m_Visible != visible ) - { - mProxy->m_VarParent->m_Vars[4]->m_Visible = visible; - mProxy->m_VarParent->m_Vars[5]->m_Visible = visible; - mProxy->m_VarParent->m_Vars[6]->m_Visible = visible; - mProxy->m_VarParent->m_Vars[7]->m_Visible = visible; - mProxy->m_Bar->NotUpToDate(); - } - } - } - } - else if( _ExtMemberIndex>=8 && _ExtMemberIndex<=11 ) - ext->ConvertFromAxisAngle(); - else if( mProxy && _ExtMemberIndex==12 && mProxy->m_VarParent && !ext->m_IsDir ) - { - assert( mProxy->m_VarParent->m_Vars.size()==16 ); - bool aa = ext->m_AAMode; - if( mProxy->m_VarParent->m_Vars[4]->m_Visible != !aa - || mProxy->m_VarParent->m_Vars[5]->m_Visible != !aa - || mProxy->m_VarParent->m_Vars[6]->m_Visible != !aa - || mProxy->m_VarParent->m_Vars[7]->m_Visible != !aa - || mProxy->m_VarParent->m_Vars[8 ]->m_Visible != aa - || mProxy->m_VarParent->m_Vars[9 ]->m_Visible != aa - || mProxy->m_VarParent->m_Vars[10]->m_Visible != aa - || mProxy->m_VarParent->m_Vars[11]->m_Visible != aa ) - { - mProxy->m_VarParent->m_Vars[4]->m_Visible = !aa; - mProxy->m_VarParent->m_Vars[5]->m_Visible = !aa; - mProxy->m_VarParent->m_Vars[6]->m_Visible = !aa; - mProxy->m_VarParent->m_Vars[7]->m_Visible = !aa; - mProxy->m_VarParent->m_Vars[8 ]->m_Visible = aa; - mProxy->m_VarParent->m_Vars[9 ]->m_Visible = aa; - mProxy->m_VarParent->m_Vars[10]->m_Visible = aa; - mProxy->m_VarParent->m_Vars[11]->m_Visible = aa; - mProxy->m_Bar->NotUpToDate(); - } - if( static_cast(mProxy->m_VarParent->m_Vars[12])->m_ReadOnly ) - { - static_cast(mProxy->m_VarParent->m_Vars[12])->m_ReadOnly = false; - mProxy->m_Bar->NotUpToDate(); - } - } - - if( ext->m_IsFloat ) - { - float *var = static_cast(_VarValue); - if( ext->m_IsDir ) - { - var[0] = (float)ext->Dx; - var[1] = (float)ext->Dy; - var[2] = (float)ext->Dz; - } - else // quat - { - var[0] = (float)ext->Qx; - var[1] = (float)ext->Qy; - var[2] = (float)ext->Qz; - var[3] = (float)ext->Qs; - } - } - else - { - double *var = static_cast(_VarValue); - if( ext->m_IsDir ) - { - var[0] = ext->Dx; - var[1] = ext->Dy; - var[2] = ext->Dz; - } - else // quat - { - var[0] = ext->Qx; - var[1] = ext->Qy; - var[2] = ext->Qz; - var[3] = ext->Qs; - } - } - } -} - -void ANT_CALL CQuaternionExt::CopyVarToExtCB(const void *_VarValue, void *_ExtValue, unsigned int _ExtMemberIndex, void *_ClientData) -{ - CQuaternionExt *ext = static_cast(_ExtValue); - CTwMgr::CMemberProxy *mProxy = static_cast(_ClientData); - (void)mProxy; - if( _VarValue && ext ) - { - if( mProxy && _ExtMemberIndex==12 && mProxy->m_VarParent && !ext->m_IsDir ) - { - assert( mProxy->m_VarParent->m_Vars.size()==16 ); - bool aa = ext->m_AAMode; - if( mProxy->m_VarParent->m_Vars[4]->m_Visible != !aa - || mProxy->m_VarParent->m_Vars[5]->m_Visible != !aa - || mProxy->m_VarParent->m_Vars[6]->m_Visible != !aa - || mProxy->m_VarParent->m_Vars[7]->m_Visible != !aa - || mProxy->m_VarParent->m_Vars[8 ]->m_Visible != aa - || mProxy->m_VarParent->m_Vars[9 ]->m_Visible != aa - || mProxy->m_VarParent->m_Vars[10]->m_Visible != aa - || mProxy->m_VarParent->m_Vars[11]->m_Visible != aa ) - { - mProxy->m_VarParent->m_Vars[4]->m_Visible = !aa; - mProxy->m_VarParent->m_Vars[5]->m_Visible = !aa; - mProxy->m_VarParent->m_Vars[6]->m_Visible = !aa; - mProxy->m_VarParent->m_Vars[7]->m_Visible = !aa; - mProxy->m_VarParent->m_Vars[8 ]->m_Visible = aa; - mProxy->m_VarParent->m_Vars[9 ]->m_Visible = aa; - mProxy->m_VarParent->m_Vars[10]->m_Visible = aa; - mProxy->m_VarParent->m_Vars[11]->m_Visible = aa; - mProxy->m_Bar->NotUpToDate(); - } - if( static_cast(mProxy->m_VarParent->m_Vars[12])->m_ReadOnly ) - { - static_cast(mProxy->m_VarParent->m_Vars[12])->m_ReadOnly = false; - mProxy->m_Bar->NotUpToDate(); - } - } - else if( mProxy && _ExtMemberIndex==4 && mProxy->m_VarParent ) - { - assert( mProxy->m_VarParent->m_Vars.size()==16 ); - bool visible = ext->m_ShowVal; - if( ext->m_IsDir ) - { - if( mProxy->m_VarParent->m_Vars[13]->m_Visible != visible - || mProxy->m_VarParent->m_Vars[14]->m_Visible != visible - || mProxy->m_VarParent->m_Vars[15]->m_Visible != visible ) - { - mProxy->m_VarParent->m_Vars[13]->m_Visible = visible; - mProxy->m_VarParent->m_Vars[14]->m_Visible = visible; - mProxy->m_VarParent->m_Vars[15]->m_Visible = visible; - mProxy->m_Bar->NotUpToDate(); - } - } - else - { - if( mProxy->m_VarParent->m_Vars[4]->m_Visible != visible - || mProxy->m_VarParent->m_Vars[5]->m_Visible != visible - || mProxy->m_VarParent->m_Vars[6]->m_Visible != visible - || mProxy->m_VarParent->m_Vars[7]->m_Visible != visible ) - { - mProxy->m_VarParent->m_Vars[4]->m_Visible = visible; - mProxy->m_VarParent->m_Vars[5]->m_Visible = visible; - mProxy->m_VarParent->m_Vars[6]->m_Visible = visible; - mProxy->m_VarParent->m_Vars[7]->m_Visible = visible; - mProxy->m_Bar->NotUpToDate(); - } - } - } - - if( ext->m_IsFloat ) - { - const float *var = static_cast(_VarValue); - if( ext->m_IsDir ) - { - ext->Dx = var[0]; - ext->Dy = var[1]; - ext->Dz = var[2]; - QuatFromDir(&ext->Qx, &ext->Qy, &ext->Qz, &ext->Qs, var[0], var[1], var[2]); - } - else - { - ext->Qx = var[0]; - ext->Qy = var[1]; - ext->Qz = var[2]; - ext->Qs = var[3]; - } - - } - else - { - const double *var = static_cast(_VarValue); - if( ext->m_IsDir ) - { - ext->Dx = var[0]; - ext->Dy = var[1]; - ext->Dz = var[2]; - QuatFromDir(&ext->Qx, &ext->Qy, &ext->Qz, &ext->Qs, var[0], var[1], var[2]); - } - else - { - ext->Qx = var[0]; - ext->Qy = var[1]; - ext->Qz = var[2]; - ext->Qs = var[3]; - } - } - ext->ConvertToAxisAngle(); - } -} - -void ANT_CALL CQuaternionExt::SummaryCB(char *_SummaryString, size_t _SummaryMaxLength, const void *_ExtValue, void * /*_ClientData*/) -{ - const CQuaternionExt *ext = static_cast(_ExtValue); - if( ext ) - { - if( ext->m_AAMode ) - _snprintf(_SummaryString, _SummaryMaxLength, "V={%.2f,%.2f,%.2f} A=%.0f%c", ext->Vx, ext->Vy, ext->Vz, ext->Angle, 176); - else if( ext->m_IsDir ) - { - //float d[] = {1, 0, 0}; - //ApplyQuat(d+0, d+1, d+2, 1, 0, 0, (float)ext->Qx, (float)ext->Qy, (float)ext->Qz, (float)ext->Qs); - _snprintf(_SummaryString, _SummaryMaxLength, "V={%.2f,%.2f,%.2f}", ext->Dx, ext->Dy, ext->Dz); - } - else - _snprintf(_SummaryString, _SummaryMaxLength, "Q={x:%.2f,y:%.2f,z:%.2f,s:%.2f}", ext->Qx, ext->Qy, ext->Qz, ext->Qs); - } - else - { - _SummaryString[0] = ' '; // required to force background color for this value - _SummaryString[1] = '\0'; - } -} - -TwType CQuaternionExt::s_CustomType = TW_TYPE_UNDEF; -vector CQuaternionExt::s_SphTri; -vector CQuaternionExt::s_SphCol; -vector CQuaternionExt::s_SphTriProj; -vector CQuaternionExt::s_SphColLight; -vector CQuaternionExt::s_ArrowTri[4]; -vector CQuaternionExt::s_ArrowNorm[4]; -vector CQuaternionExt::s_ArrowTriProj[4]; -vector CQuaternionExt::s_ArrowColLight[4]; - -void CQuaternionExt::CreateTypes() -{ - if( g_TwMgr==NULL ) - return; - s_CustomType = (TwType)(TW_TYPE_CUSTOM_BASE + (int)g_TwMgr->m_Customs.size()); - g_TwMgr->m_Customs.push_back(NULL); // increment custom type number - - for(int pass=0; pass<2; pass++) // pass 0: create quat types; pass 1: create dir types - { - const char *quatDefPass0 = "step=0.01 hide"; - const char *quatDefPass1 = "step=0.01 hide"; - const char *quatSDefPass0 = "step=0.01 min=-1 max=1 hide"; - const char *quatSDefPass1 = "step=0.01 min=-1 max=1 hide"; - const char *dirDefPass0 = "step=0.01 hide"; - const char *dirDefPass1 = "step=0.01"; - const char *quatDef = (pass==0) ? quatDefPass0 : quatDefPass1; - const char *quatSDef = (pass==0) ? quatSDefPass0 : quatSDefPass1; - const char *dirDef = (pass==0) ? dirDefPass0 : dirDefPass1; - - TwStructMember QuatExtMembers[] = { { "0", s_CustomType, 0, "" }, - { "1", s_CustomType, 0, "" }, - { "2", s_CustomType, 0, "" }, - { "3", s_CustomType, 0, "" }, - { "Quat X", TW_TYPE_DOUBLE, offsetof(CQuaternionExt, Qx), quatDef }, // copy of the source quaternion - { "Quat Y", TW_TYPE_DOUBLE, offsetof(CQuaternionExt, Qy), quatDef }, - { "Quat Z", TW_TYPE_DOUBLE, offsetof(CQuaternionExt, Qz), quatDef }, - { "Quat S", TW_TYPE_DOUBLE, offsetof(CQuaternionExt, Qs), quatSDef }, - { "Axis X", TW_TYPE_DOUBLE, offsetof(CQuaternionExt, Vx), "step=0.01 hide" }, // axis and angle conversion -> Mode hidden because it is not equivalent to a quat (would have required vector renormalization) - { "Axis Y", TW_TYPE_DOUBLE, offsetof(CQuaternionExt, Vy), "step=0.01 hide" }, - { "Axis Z", TW_TYPE_DOUBLE, offsetof(CQuaternionExt, Vz), "step=0.01 hide" }, - { "Angle (degree)", TW_TYPE_DOUBLE, offsetof(CQuaternionExt, Angle), "step=1 min=-360 max=360 hide" }, - { "Mode", TW_TYPE_BOOLCPP, offsetof(CQuaternionExt, m_AAMode), "true='Axis Angle' false='Quaternion' readwrite hide" }, - { "Dir X", TW_TYPE_DOUBLE, offsetof(CQuaternionExt, Dx), dirDef }, // copy of the source direction - { "Dir Y", TW_TYPE_DOUBLE, offsetof(CQuaternionExt, Dy), dirDef }, - { "Dir Z", TW_TYPE_DOUBLE, offsetof(CQuaternionExt, Dz), dirDef } }; - if( pass==0 ) - { - g_TwMgr->m_TypeQuat4F = TwDefineStructExt("QUAT4F", QuatExtMembers, sizeof(QuatExtMembers)/sizeof(QuatExtMembers[0]), 4*sizeof(float), sizeof(CQuaternionExt), CQuaternionExt::InitQuat4FCB, CQuaternionExt::CopyVarFromExtCB, CQuaternionExt::CopyVarToExtCB, CQuaternionExt::SummaryCB, CTwMgr::CStruct::s_PassProxyAsClientData, "A 4-floats-encoded quaternion"); - g_TwMgr->m_TypeQuat4D = TwDefineStructExt("QUAT4D", QuatExtMembers, sizeof(QuatExtMembers)/sizeof(QuatExtMembers[0]), 4*sizeof(double), sizeof(CQuaternionExt), CQuaternionExt::InitQuat4DCB, CQuaternionExt::CopyVarFromExtCB, CQuaternionExt::CopyVarToExtCB, CQuaternionExt::SummaryCB, CTwMgr::CStruct::s_PassProxyAsClientData, "A 4-doubles-encoded quaternion"); - } - else if( pass==1 ) - { - g_TwMgr->m_TypeDir3F = TwDefineStructExt("DIR4F", QuatExtMembers, sizeof(QuatExtMembers)/sizeof(QuatExtMembers[0]), 3*sizeof(float), sizeof(CQuaternionExt), CQuaternionExt::InitDir3FCB, CQuaternionExt::CopyVarFromExtCB, CQuaternionExt::CopyVarToExtCB, CQuaternionExt::SummaryCB, CTwMgr::CStruct::s_PassProxyAsClientData, "A 3-floats-encoded direction"); - g_TwMgr->m_TypeDir3D = TwDefineStructExt("DIR4D", QuatExtMembers, sizeof(QuatExtMembers)/sizeof(QuatExtMembers[0]), 3*sizeof(double), sizeof(CQuaternionExt), CQuaternionExt::InitDir3DCB, CQuaternionExt::CopyVarFromExtCB, CQuaternionExt::CopyVarToExtCB, CQuaternionExt::SummaryCB, CTwMgr::CStruct::s_PassProxyAsClientData, "A 3-doubles-encoded direction"); - } - } - - CreateSphere(); - CreateArrow(); -} - -void CQuaternionExt::ConvertToAxisAngle() -{ - if( fabs(Qs)>(1.0 + FLOAT_EPS) ) - { - //Vx = Vy = Vz = 0; // no, keep the previous value - Angle = 0; - } - else - { - double a; - if( Qs>=1.0f ) - a = 0; // and keep V - else if( Qs<=-1.0f ) - a = DOUBLE_PI; // and keep V - else if( fabs(Qx*Qx+Qy*Qy+Qz*Qz+Qs*Qs)FLOAT_PI ) - // Angle -= 2.0f*FLOAT_PI; - // else if( Angle<-FLOAT_PI ) - // Angle += 2.0f*FLOAT_PI; - Angle = RadToDeg(Angle); - - if( fabs(Angle)FLOAT_EPS_SQ ) - { - double f = 0.5*DegToRad(Angle); - Qs = cos(f); - //do not normalize - //if( fabs(n - 1.0)>FLOAT_EPS_SQ ) - // f = sin(f) * (1.0/sqrt(n)) ; - //else - // f = sin(f); - f = sin(f); - - Qx = Vx * f; - Qy = Vy * f; - Qz = Vz * f; - } - else - { - Qs = 1.0; - Qx = Qy = Qz = 0.0; - } -} - -void CQuaternionExt::CopyToVar() -{ - if( m_StructProxy!=NULL ) - { - if( m_StructProxy->m_StructSetCallback!=NULL ) - { - if( m_IsFloat ) - { - if( m_IsDir ) - { - float d[] = {1, 0, 0}; - ApplyQuat(d+0, d+1, d+2, 1, 0, 0, (float)Qx, (float)Qy, (float)Qz, (float)Qs); - float l = (float)sqrt(Dx*Dx + Dy*Dy + Dz*Dz); - d[0] *= l; d[1] *= l; d[2] *= l; - Dx = d[0]; Dy = d[1]; Dz = d[2]; // update also Dx,Dy,Dz - m_StructProxy->m_StructSetCallback(d, m_StructProxy->m_StructClientData); - } - else - { - float q[] = { (float)Qx, (float)Qy, (float)Qz, (float)Qs }; - m_StructProxy->m_StructSetCallback(q, m_StructProxy->m_StructClientData); - } - } - else - { - if( m_IsDir ) - { - float d[] = {1, 0, 0}; - ApplyQuat(d+0, d+1, d+2, 1, 0, 0, (float)Qx, (float)Qy, (float)Qz, (float)Qs); - double l = sqrt(Dx*Dx + Dy*Dy + Dz*Dz); - double dd[] = {l*d[0], l*d[1], l*d[2]}; - Dx = dd[0]; Dy = dd[1]; Dz = dd[2]; // update also Dx,Dy,Dz - m_StructProxy->m_StructSetCallback(dd, m_StructProxy->m_StructClientData); - } - else - { - double q[] = { Qx, Qy, Qz, Qs }; - m_StructProxy->m_StructSetCallback(q, m_StructProxy->m_StructClientData); - } - } - } - else if( m_StructProxy->m_StructData!=NULL ) - { - if( m_IsFloat ) - { - if( m_IsDir ) - { - float *d = static_cast(m_StructProxy->m_StructData); - ApplyQuat(d+0, d+1, d+2, 1, 0, 0, (float)Qx, (float)Qy, (float)Qz, (float)Qs); - float l = (float)sqrt(Dx*Dx + Dy*Dy + Dz*Dz); - d[0] *= l; d[1] *= l; d[2] *= l; - Dx = d[0]; Dy = d[1]; Dz = d[2]; // update also Dx,Dy,Dz - } - else - { - float *q = static_cast(m_StructProxy->m_StructData); - q[0] = (float)Qx; q[1] = (float)Qy; q[2] = (float)Qz; q[3] = (float)Qs; - } - } - else - { - if( m_IsDir ) - { - double *dd = static_cast(m_StructProxy->m_StructData); - float d[] = {1, 0, 0}; - ApplyQuat(d+0, d+1, d+2, 1, 0, 0, (float)Qx, (float)Qy, (float)Qz, (float)Qs); - double l = sqrt(Dx*Dx + Dy*Dy + Dz*Dz); - dd[0] = l*d[0]; dd[1] = l*d[1]; dd[2] = l*d[2]; - Dx = dd[0]; Dy = dd[1]; Dz = dd[2]; // update also Dx,Dy,Dz - } - else - { - double *q = static_cast(m_StructProxy->m_StructData); - q[0] = Qx; q[1] = Qy; q[2] = Qz; q[3] = Qs; - } - } - } - } -} - -void CQuaternionExt::CreateSphere() -{ - const int SUBDIV = 7; - s_SphTri.clear(); - s_SphCol.clear(); - - const float A[8*3] = { 1,0,0, 0,0,-1, -1,0,0, 0,0,1, 0,0,1, 1,0,0, 0,0,-1, -1,0,0 }; - const float B[8*3] = { 0,1,0, 0,1,0, 0,1,0, 0,1,0, 0,-1,0, 0,-1,0, 0,-1,0, 0,-1,0 }; - const float C[8*3] = { 0,0,1, 1,0,0, 0,0,-1, -1,0,0, 1,0,0, 0,0,-1, -1,0,0, 0,0,1 }; - //const color32 COL_A[8] = { 0xffff8080, 0xff000080, 0xff800000, 0xff8080ff, 0xff8080ff, 0xffff8080, 0xff000080, 0xff800000 }; - //const color32 COL_B[8] = { 0xff80ff80, 0xff80ff80, 0xff80ff80, 0xff80ff80, 0xff008000, 0xff008000, 0xff008000, 0xff008000 }; - //const color32 COL_C[8] = { 0xff8080ff, 0xffff8080, 0xff000080, 0xff800000, 0xffff8080, 0xff000080, 0xff800000, 0xff8080ff }; - const color32 COL_A[8] = { 0xffffffff, 0xffffff40, 0xff40ff40, 0xff40ffff, 0xffff40ff, 0xffff4040, 0xff404040, 0xff4040ff }; - const color32 COL_B[8] = { 0xffffffff, 0xffffff40, 0xff40ff40, 0xff40ffff, 0xffff40ff, 0xffff4040, 0xff404040, 0xff4040ff }; - const color32 COL_C[8] = { 0xffffffff, 0xffffff40, 0xff40ff40, 0xff40ffff, 0xffff40ff, 0xffff4040, 0xff404040, 0xff4040ff }; - - int i, j, k, l; - float xa, ya, za, xb, yb, zb, xc, yc, zc, x, y, z, norm, u[3], v[3]; - color32 col; - for( i=0; i<8; ++i ) - { - xa = A[3*i+0]; ya = A[3*i+1]; za = A[3*i+2]; - xb = B[3*i+0]; yb = B[3*i+1]; zb = B[3*i+2]; - xc = C[3*i+0]; yc = C[3*i+1]; zc = C[3*i+2]; - for( j=0; j<=SUBDIV; ++j ) - for( k=0; k<=2*(SUBDIV-j); ++k ) - { - if( k%2==0 ) - { - u[0] = ((float)j)/(SUBDIV+1); - v[0] = ((float)(k/2))/(SUBDIV+1); - u[1] = ((float)(j+1))/(SUBDIV+1); - v[1] = ((float)(k/2))/(SUBDIV+1); - u[2] = ((float)j)/(SUBDIV+1); - v[2] = ((float)(k/2+1))/(SUBDIV+1); - } - else - { - u[0] = ((float)j)/(SUBDIV+1); - v[0] = ((float)(k/2+1))/(SUBDIV+1); - u[1] = ((float)(j+1))/(SUBDIV+1); - v[1] = ((float)(k/2))/(SUBDIV+1); - u[2] = ((float)(j+1))/(SUBDIV+1); - v[2] = ((float)(k/2+1))/(SUBDIV+1); - } - - for( l=0; l<3; ++l ) - { - x = (1.0f-u[l]-v[l])*xa + u[l]*xb + v[l]*xc; - y = (1.0f-u[l]-v[l])*ya + u[l]*yb + v[l]*yc; - z = (1.0f-u[l]-v[l])*za + u[l]*zb + v[l]*zc; - norm = sqrtf(x*x+y*y+z*z); - x /= norm; y /= norm; z /= norm; - s_SphTri.push_back(x); s_SphTri.push_back(y); s_SphTri.push_back(z); - if( u[l]+v[l]>FLOAT_EPS ) - col = ColorBlend(COL_A[i], ColorBlend(COL_B[i], COL_C[i], v[l]/(u[l]+v[l])), u[l]+v[l]); - else - col = COL_A[i]; - //if( (j==0 && k==0) || (j==0 && k==2*SUBDIV) || (j==SUBDIV && k==0) ) - // col = 0xffff0000; - s_SphCol.push_back(col); - } - } - } - s_SphTriProj.clear(); - s_SphTriProj.resize(2*s_SphCol.size(), 0); - s_SphColLight.clear(); - s_SphColLight.resize(s_SphCol.size(), 0); -} - -void CQuaternionExt::CreateArrow() -{ - const int SUBDIV = 15; - const float CYL_RADIUS = 0.08f; - const float CONE_RADIUS = 0.16f; - const float CONE_LENGTH = 0.25f; - const float ARROW_BGN = -1.1f; - const float ARROW_END = 1.15f; - int i; - for(i=0; i<4; ++i) - { - s_ArrowTri[i].clear(); - s_ArrowNorm[i].clear(); - } - - float x0, x1, y0, y1, z0, z1, a0, a1, nx, nn; - for(i=0; iDOUBLE_EPS ) - { - double f = 0.5*angle; - out[3] = cos(f); - f = sin(f)/sqrt(n); - out[0] = axis[0]*f; - out[1] = axis[1]*f; - out[2] = axis[2]*f; - } - else - { - out[3] = 1.0; - out[0] = out[1] = out[2] = 0.0; - } -} - -static inline void Vec3Cross(double *out, const double *a, const double *b) -{ - out[0] = a[1]*b[2]-a[2]*b[1]; - out[1] = a[2]*b[0]-a[0]*b[2]; - out[2] = a[0]*b[1]-a[1]*b[0]; -} - -static inline double Vec3Dot(const double *a, const double *b) -{ - return a[0]*b[0] + a[1]*b[1] + a[2]*b[2]; -} - -static inline void Vec3RotY(float *x, float *y, float *z) -{ - (void)y; - float tmp = *x; - *x = - *z; - *z = tmp; -} - -static inline void Vec3RotZ(float *x, float *y, float *z) -{ - (void)z; - float tmp = *x; - *x = - *y; - *y = tmp; -} - -void CQuaternionExt::ApplyQuat(float *outX, float *outY, float *outZ, float x, float y, float z, float qx, float qy, float qz, float qs) -{ - float ps = - qx * x - qy * y - qz * z; - float px = qs * x + qy * z - qz * y; - float py = qs * y + qz * x - qx * z; - float pz = qs * z + qx * y - qy * x; - *outX = - ps * qx + px * qs - py * qz + pz * qy; - *outY = - ps * qy + py * qs - pz * qx + px * qz; - *outZ = - ps * qz + pz * qs - px * qy + py * qx; -} - -void CQuaternionExt::QuatFromDir(double *outQx, double *outQy, double *outQz, double *outQs, double dx, double dy, double dz) -{ - // compute a quaternion that rotates (1,0,0) to (dx,dy,dz) - - double dn = sqrt(dx*dx + dy*dy + dz*dz); - if( dnm_Graph==NULL ) - return; - assert( g_TwMgr->m_Graph->IsDrawing() ); - CQuaternionExt *ext = static_cast(_ExtValue); - assert( ext!=NULL ); - (void)_ClientData; (void)_Bar; - - // show/hide quat values - assert( varGrp->m_Vars.size()==16 ); - bool visible = ext->m_ShowVal; - if( ext->m_IsDir ) - { - if( varGrp->m_Vars[13]->m_Visible != visible - || varGrp->m_Vars[14]->m_Visible != visible - || varGrp->m_Vars[15]->m_Visible != visible ) - { - varGrp->m_Vars[13]->m_Visible = visible; - varGrp->m_Vars[14]->m_Visible = visible; - varGrp->m_Vars[15]->m_Visible = visible; - _Bar->NotUpToDate(); - } - } - else - { - if( varGrp->m_Vars[4]->m_Visible != visible - || varGrp->m_Vars[5]->m_Visible != visible - || varGrp->m_Vars[6]->m_Visible != visible - || varGrp->m_Vars[7]->m_Visible != visible ) - { - varGrp->m_Vars[4]->m_Visible = visible; - varGrp->m_Vars[5]->m_Visible = visible; - varGrp->m_Vars[6]->m_Visible = visible; - varGrp->m_Vars[7]->m_Visible = visible; - _Bar->NotUpToDate(); - } - } - - // force ext update - static_cast(varGrp->m_Vars[4])->ValueToDouble(); - - assert( s_SphTri.size()>0 ); - assert( s_SphTri.size()==3*s_SphCol.size() ); - assert( s_SphTriProj.size()==2*s_SphCol.size() ); - assert( s_SphColLight.size()==s_SphCol.size() ); - - if( QuatD(w, h)<=2 ) - return; - float x, y, z, nx, ny, nz, kx, ky, kz, qx, qy, qz, qs; - int i, j, k, l, m; - - // normalize quaternion - float qn = (float)sqrt(ext->Qs*ext->Qs+ext->Qx*ext->Qx+ext->Qy*ext->Qy+ext->Qz*ext->Qz); - if( qn>FLOAT_EPS ) - { - qx = (float)ext->Qx/qn; - qy = (float)ext->Qy/qn; - qz = (float)ext->Qz/qn; - qs = (float)ext->Qs/qn; - } - else - { - qx = qy = qz = 0; - qs = 1; - } - - double normDir = sqrt(ext->m_Dir[0]*ext->m_Dir[0] + ext->m_Dir[1]*ext->m_Dir[1] + ext->m_Dir[2]*ext->m_Dir[2]); - bool drawDir = ext->m_IsDir || (normDir>DOUBLE_EPS); - color32 alpha = ext->m_Highlighted ? 0xffffffff : 0xb0ffffff; - - // check if frame is right-handed - ext->Permute(&kx, &ky, &kz, 1, 0, 0); - double px[3] = { (double)kx, (double)ky, (double)kz }; - ext->Permute(&kx, &ky, &kz, 0, 1, 0); - double py[3] = { (double)kx, (double)ky, (double)kz }; - ext->Permute(&kx, &ky, &kz, 0, 0, 1); - double pz[3] = { (double)kx, (double)ky, (double)kz }; - double ez[3]; - Vec3Cross(ez, px, py); - bool frameRightHanded = (ez[0]*pz[0]+ez[1]*pz[1]+ez[2]*pz[2] >= 0); - ITwGraph::Cull cull = frameRightHanded ? ITwGraph::CULL_CW : ITwGraph::CULL_CCW; - - if( drawDir ) - { - float dir[] = {(float)ext->m_Dir[0], (float)ext->m_Dir[1], (float)ext->m_Dir[2]}; - if( normDirPermute(&x, &y, &z, kx, ky, kz); - j = (z>0) ? 3-k : k; - - assert( s_ArrowTriProj[j].size()==2*(s_ArrowTri[j].size()/3) && s_ArrowColLight[j].size()==s_ArrowTri[j].size()/3 && s_ArrowNorm[j].size()==s_ArrowTri[j].size() ); - const int ntri = (int)s_ArrowTri[j].size()/3; - const float *tri = &(s_ArrowTri[j][0]); - const float *norm = &(s_ArrowNorm[j][0]); - int *triProj = &(s_ArrowTriProj[j][0]); - color32 *colLight = &(s_ArrowColLight[j][0]); - for(i=0; i0 ) - x = 2.5f*x - 2.0f; - else - x += 0.2f; - y *= 1.5f; - z *= 1.5f; - ApplyQuat(&x, &y, &z, x, y, z, (float)rotDirQuat[0], (float)rotDirQuat[1], (float)rotDirQuat[2], (float)rotDirQuat[3]); - ApplyQuat(&x, &y, &z, x, y, z, qx, qy, qz, qs); - ext->Permute(&x, &y, &z, x, y, z); - ApplyQuat(&nx, &ny, &nz, nx, ny, nz, (float)rotDirQuat[0], (float)rotDirQuat[1], (float)rotDirQuat[2], (float)rotDirQuat[3]); - ApplyQuat(&nx, &ny, &nz, nx, ny, nz, qx, qy, qz, qs); - ext->Permute(&nx, &ny, &nz, nx, ny, nz); - triProj[2*i+0] = QuatPX(x, w, h); - triProj[2*i+1] = QuatPY(y, w, h); - color32 col = (ext->m_DirColor|0xff000000) & alpha; - colLight[i] = ColorBlend(0xff000000, col, fabsf(TClamp(nz, -1.0f, 1.0f))); - } - if( s_ArrowTri[j].size()>=9 ) // 1 tri = 9 floats - g_TwMgr->m_Graph->DrawTriangles((int)s_ArrowTri[j].size()/9, triProj, colLight, cull); - } - } - else - { - /* - int px0 = QuatPX(0, w, h)-1, py0 = QuatPY(0, w, h), r0 = (int)(0.5f*QuatD(w, h)-0.5f); - color32 col0 = 0x80000000; - DrawArc(px0-1, py0, r0, 0, 360, col0); - DrawArc(px0+1, py0, r0, 0, 360, col0); - DrawArc(px0, py0-1, r0, 0, 360, col0); - DrawArc(px0, py0+1, r0, 0, 360, col0); - */ - // draw arrows & sphere - const float SPH_RADIUS = 0.75f; - for(m=0; m<2; ++m) // m=0: back, m=1: front - { - for(l=0; l<3; ++l) // draw 3 arrows - { - kx = 1; ky = 0; kz = 0; - if( l==1 ) - Vec3RotZ(&kx, &ky, &kz); - else if( l==2 ) - Vec3RotY(&kx, &ky, &kz); - ApplyQuat(&kx, &ky, &kz, kx, ky, kz, qx, qy, qz, qs); - for(k=0; k<4; ++k) // 4 parts of the arrow - { - // draw order - ext->Permute(&x, &y, &z, kx, ky, kz); - j = (z>0) ? 3-k : k; - - bool cone = true; - if( (m==0 && z>0) || (m==1 && z<=0) ) - { - if( j==ARROW_CONE || j==ARROW_CONE_CAP ) // do not draw cone - continue; - else - cone = false; - } - assert( s_ArrowTriProj[j].size()==2*(s_ArrowTri[j].size()/3) && s_ArrowColLight[j].size()==s_ArrowTri[j].size()/3 && s_ArrowNorm[j].size()==s_ArrowTri[j].size() ); - const int ntri = (int)s_ArrowTri[j].size()/3; - const float *tri = &(s_ArrowTri[j][0]); - const float *norm = &(s_ArrowNorm[j][0]); - int *triProj = &(s_ArrowTriProj[j][0]); - color32 *colLight = &(s_ArrowColLight[j][0]); - for(i=0; i0 ) - x = -SPH_RADIUS; - nx = norm[3*i+0]; ny = norm[3*i+1]; nz = norm[3*i+2]; - if( l==1 ) - { - Vec3RotZ(&x, &y, &z); - Vec3RotZ(&nx, &ny, &nz); - } - else if( l==2 ) - { - Vec3RotY(&x, &y, &z); - Vec3RotY(&nx, &ny, &nz); - } - ApplyQuat(&x, &y, &z, x, y, z, qx, qy, qz, qs); - ext->Permute(&x, &y, &z, x, y, z); - ApplyQuat(&nx, &ny, &nz, nx, ny, nz, qx, qy, qz, qs); - ext->Permute(&nx, &ny, &nz, nx, ny, nz); - triProj[2*i+0] = QuatPX(x, w, h); - triProj[2*i+1] = QuatPY(y, w, h); - float fade = ( m==0 && z<0 ) ? TClamp(2.0f*z*z, 0.0f, 1.0f) : 0; - float alphaFade = 1.0f; - Color32ToARGBf(alpha, &alphaFade, NULL, NULL, NULL); - alphaFade *= (1.0f-fade); - color32 alphaFadeCol = Color32FromARGBf(alphaFade, 1, 1, 1); - color32 col = (l==0) ? 0xffff0000 : ( (l==1) ? 0xff00ff00 : 0xff0000ff ); - colLight[i] = ColorBlend(0xff000000, col, fabsf(TClamp(nz, -1.0f, 1.0f))) & alphaFadeCol; - } - if( s_ArrowTri[j].size()>=9 ) // 1 tri = 9 floats - g_TwMgr->m_Graph->DrawTriangles((int)s_ArrowTri[j].size()/9, triProj, colLight, cull); - } - } - - if( m==0 ) - { - const float *tri = &(s_SphTri[0]); - int *triProj = &(s_SphTriProj[0]); - const color32 *col = &(s_SphCol[0]); - color32 *colLight = &(s_SphColLight[0]); - const int ntri = (int)s_SphTri.size()/3; - for(i=0; iPermute(&x, &y, &z, x, y, z); - triProj[2*i+0] = QuatPX(x, w, h); - triProj[2*i+1] = QuatPY(y, w, h); - colLight[i] = ColorBlend(0xff000000, col[i], fabsf(TClamp(z/SPH_RADIUS, -1.0f, 1.0f))) & alpha; - } - g_TwMgr->m_Graph->DrawTriangles((int)s_SphTri.size()/9, triProj, colLight, cull); - } - } - - // draw x - g_TwMgr->m_Graph->DrawLine(w-12, h-36, w-12+5, h-36+5, 0xffc00000, true); - g_TwMgr->m_Graph->DrawLine(w-12+5, h-36, w-12, h-36+5, 0xffc00000, true); - // draw y - g_TwMgr->m_Graph->DrawLine(w-12, h-25, w-12+3, h-25+4, 0xff00c000, true); - g_TwMgr->m_Graph->DrawLine(w-12+5, h-25, w-12, h-25+7, 0xff00c000, true); - // draw z - g_TwMgr->m_Graph->DrawLine(w-12, h-12, w-12+5, h-12, 0xff0000c0, true); - g_TwMgr->m_Graph->DrawLine(w-12, h-12+5, w-12+5, h-12+5, 0xff0000c0, true); - g_TwMgr->m_Graph->DrawLine(w-12, h-12+5, w-12+5, h-12, 0xff0000c0, true); - } - - // draw borders - g_TwMgr->m_Graph->DrawLine(1, 0, w-1, 0, 0x40000000); - g_TwMgr->m_Graph->DrawLine(w-1, 0, w-1, h-1, 0x40000000); - g_TwMgr->m_Graph->DrawLine(w-1, h-1, 1, h-1, 0x40000000); - g_TwMgr->m_Graph->DrawLine(1, h-1, 1, 0, 0x40000000); -} - -bool CQuaternionExt::MouseMotionCB(int mouseX, int mouseY, int w, int h, void *structExtValue, void *clientData, TwBar *bar, CTwVarGroup *varGrp) -{ - CQuaternionExt *ext = static_cast(structExtValue); - if( ext==NULL ) - return false; - (void)clientData, (void)varGrp; - - if( mouseX>0 && mouseX0 && mouseYm_Highlighted = true; - - if( ext->m_Rotating ) - { - double x = QuatIX(mouseX, w, h); - double y = QuatIY(mouseY, w, h); - double z = 1; - double px, py, pz, ox, oy, oz; - ext->PermuteInv(&px, &py, &pz, x, y, z); - ext->PermuteInv(&ox, &oy, &oz, ext->m_OrigX, ext->m_OrigY, 1); - double n0 = sqrt(ox*ox + oy*oy + oz*oz); - double n1 = sqrt(px*px + py*py + pz*pz); - if( n0>DOUBLE_EPS && n1>DOUBLE_EPS ) - { - double v0[] = { ox/n0, oy/n0, oz/n0 }; - double v1[] = { px/n1, py/n1, pz/n1 }; - double axis[3]; - Vec3Cross(axis, v0, v1); - double sa = sqrt(Vec3Dot(axis, axis)); - double ca = Vec3Dot(v0, v1); - double angle = atan2(sa, ca); - if( x*x+y*y>1.0 ) - angle *= 1.0 + 0.2f*(sqrt(x*x+y*y)-1.0); - double qrot[4], qres[4], qorig[4]; - QuatFromAxisAngle(qrot, axis, angle); - double nqorig = sqrt(ext->m_OrigQuat[0]*ext->m_OrigQuat[0]+ext->m_OrigQuat[1]*ext->m_OrigQuat[1]+ext->m_OrigQuat[2]*ext->m_OrigQuat[2]+ext->m_OrigQuat[3]*ext->m_OrigQuat[3]); - if( fabs(nqorig)>DOUBLE_EPS_SQ ) - { - qorig[0] = ext->m_OrigQuat[0]/nqorig; - qorig[1] = ext->m_OrigQuat[1]/nqorig; - qorig[2] = ext->m_OrigQuat[2]/nqorig; - qorig[3] = ext->m_OrigQuat[3]/nqorig; - QuatMult(qres, qrot, qorig); - ext->Qx = qres[0]; - ext->Qy = qres[1]; - ext->Qz = qres[2]; - ext->Qs = qres[3]; - } - else - { - ext->Qx = qrot[0]; - ext->Qy = qrot[1]; - ext->Qz = qrot[2]; - ext->Qs = qrot[3]; - } - ext->CopyToVar(); - if( bar!=NULL ) - bar->NotUpToDate(); - - ext->m_PrevX = x; - ext->m_PrevY = y; - } - } - - return true; -} - -bool CQuaternionExt::MouseButtonCB(TwMouseButtonID button, bool pressed, int mouseX, int mouseY, int w, int h, void *structExtValue, void *clientData, TwBar *bar, CTwVarGroup *varGrp) -{ - CQuaternionExt *ext = static_cast(structExtValue); - if( ext==NULL ) - return false; - (void)clientData; (void)bar, (void)varGrp; - - if( button==TW_MOUSE_LEFT ) - { - if( pressed ) - { - ext->m_OrigQuat[0] = ext->Qx; - ext->m_OrigQuat[1] = ext->Qy; - ext->m_OrigQuat[2] = ext->Qz; - ext->m_OrigQuat[3] = ext->Qs; - ext->m_OrigX = QuatIX(mouseX, w, h); - ext->m_OrigY = QuatIY(mouseY, w, h); - ext->m_PrevX = ext->m_OrigX; - ext->m_PrevY = ext->m_OrigY; - ext->m_Rotating = true; - } - else - ext->m_Rotating = false; - } - - //printf("Click %x\n", structExtValue); - return true; -} - -void CQuaternionExt::MouseLeaveCB(void *structExtValue, void *clientData, TwBar *bar) -{ - CQuaternionExt *ext = static_cast(structExtValue); - if( ext==NULL ) - return; - (void)clientData; (void)bar; - - //printf("Leave %x\n", structExtValue); - ext->m_Highlighted = false; - ext->m_Rotating = false; -} - - -// --------------------------------------------------------------------------- -// Convertion between VC++ Debug/Release std::string -// (Needed because VC++ adds some extra info to std::string in Debug mode!) -// And resolve binary std::string incompatibility between VS2010 and other VS versions -// --------------------------------------------------------------------------- - -#ifdef _MSC_VER -// VS2010 store the string allocator pointer at the end -// VS2008 VS2012 and others store the string allocator pointer at the beginning -static void FixVS2010StdStringLibToClient(void *strPtr) -{ - char *ptr = (char *)strPtr; - const size_t SizeOfUndecoratedString = 16 + 2*sizeof(size_t) + sizeof(void *); // size of a VS std::string without extra debug iterator and info. - assert(SizeOfUndecoratedString <= sizeof(std::string)); - TwType LibStdStringBaseType = (TwType)(TW_TYPE_STDSTRING&0xffff0000); - void **allocAddress2008 = (void **)(ptr + sizeof(std::string) - SizeOfUndecoratedString); - void **allocAddress2010 = (void **)(ptr + sizeof(std::string) - sizeof(void *)); - if (LibStdStringBaseType == TW_TYPE_STDSTRING_VS2008 && g_TwMgr->m_ClientStdStringBaseType == TW_TYPE_STDSTRING_VS2010) - { - void *allocator = *allocAddress2008; - memmove(allocAddress2008, allocAddress2008 + 1, SizeOfUndecoratedString - sizeof(void *)); - *allocAddress2010 = allocator; - } - else if (LibStdStringBaseType == TW_TYPE_STDSTRING_VS2010 && g_TwMgr->m_ClientStdStringBaseType == TW_TYPE_STDSTRING_VS2008) - { - void *allocator = *allocAddress2010; - memmove(allocAddress2008 + 1, allocAddress2008, SizeOfUndecoratedString - sizeof(void *)); - *allocAddress2008 = allocator; - } -} - -static void FixVS2010StdStringClientToLib(void *strPtr) -{ - char *ptr = (char *)strPtr; - const size_t SizeOfUndecoratedString = 16 + 2*sizeof(size_t) + sizeof(void *); // size of a VS std::string without extra debug iterator and info. - assert(SizeOfUndecoratedString <= sizeof(std::string)); - TwType LibStdStringBaseType = (TwType)(TW_TYPE_STDSTRING&0xffff0000); - void **allocAddress2008 = (void **)(ptr + sizeof(std::string) - SizeOfUndecoratedString); - void **allocAddress2010 = (void **)(ptr + sizeof(std::string) - sizeof(void *)); - if (LibStdStringBaseType == TW_TYPE_STDSTRING_VS2008 && g_TwMgr->m_ClientStdStringBaseType == TW_TYPE_STDSTRING_VS2010) - { - void *allocator = *allocAddress2010; - memmove(allocAddress2008 + 1, allocAddress2008, SizeOfUndecoratedString - sizeof(void *)); - *allocAddress2008 = allocator; - } - else if (LibStdStringBaseType == TW_TYPE_STDSTRING_VS2010 && g_TwMgr->m_ClientStdStringBaseType == TW_TYPE_STDSTRING_VS2008) - { - void *allocator = *allocAddress2008; - memmove(allocAddress2008, allocAddress2008 + 1, SizeOfUndecoratedString - sizeof(void *)); - *allocAddress2010 = allocator; - } -} -#endif // _MSC_VER - -CTwMgr::CClientStdString::CClientStdString() -{ - memset(m_Data, 0, sizeof(m_Data)); -} - -void CTwMgr::CClientStdString::FromLib(const char *libStr) -{ - m_LibStr = libStr; // it is ok to have a local copy here - memcpy(m_Data + sizeof(void *), &m_LibStr, sizeof(std::string)); -#ifdef _MSC_VER - FixVS2010StdStringLibToClient(m_Data + sizeof(void *)); -#endif -} - -std::string& CTwMgr::CClientStdString::ToClient() -{ - assert( g_TwMgr!=NULL ); - if( g_TwMgr->m_ClientStdStringStructSize==sizeof(std::string)+sizeof(void *) ) - return *(std::string *)(m_Data); - else if( g_TwMgr->m_ClientStdStringStructSize+sizeof(void *)==sizeof(std::string) ) - return *(std::string *)(m_Data + 2*sizeof(void *)); - else - { - assert( g_TwMgr->m_ClientStdStringStructSize==sizeof(std::string) ); - return *(std::string *)(m_Data + sizeof(void *)); - } -} - - -CTwMgr::CLibStdString::CLibStdString() -{ - memset(m_Data, 0, sizeof(m_Data)); -} - -void CTwMgr::CLibStdString::FromClient(const std::string& clientStr) -{ - assert( g_TwMgr!=NULL ); - memcpy(m_Data + sizeof(void *), &clientStr, g_TwMgr->m_ClientStdStringStructSize); -#ifdef _MSC_VER - FixVS2010StdStringClientToLib(m_Data + sizeof(void *)); -#endif -} - -std::string& CTwMgr::CLibStdString::ToLib() -{ - assert( g_TwMgr!=NULL ); - if( g_TwMgr->m_ClientStdStringStructSize==sizeof(std::string)+sizeof(void *) ) - return *(std::string *)(m_Data + 2*sizeof(void *)); - else if( g_TwMgr->m_ClientStdStringStructSize+sizeof(void *)==sizeof(std::string) ) - return *(std::string *)(m_Data); - else - { - assert( g_TwMgr->m_ClientStdStringStructSize==sizeof(std::string) ); - return *(std::string *)(m_Data + sizeof(void *)); - } -} - - -// --------------------------------------------------------------------------- -// Management functions -// --------------------------------------------------------------------------- - - -static int TwCreateGraph(ETwGraphAPI _GraphAPI) -{ - assert( g_TwMgr!=NULL && g_TwMgr->m_Graph==NULL ); - - switch( _GraphAPI ) - { - case TW_OPENGL: - g_TwMgr->m_Graph = new CTwGraphOpenGL; - break; - case TW_OPENGL_CORE: - g_TwMgr->m_Graph = new CTwGraphOpenGLCore; - break; - } - - if( g_TwMgr->m_Graph==NULL ) - { - g_TwMgr->SetLastError(g_ErrUnknownAPI); - return 0; - } - else - return g_TwMgr->m_Graph->Init(); -} - -// --------------------------------------------------------------------------- - -static inline int TwFreeAsyncDrawing() -{ - if( g_TwMgr && g_TwMgr->m_Graph && g_TwMgr->m_Graph->IsDrawing() ) - { - const double SLEEP_MAX = 0.25; // wait at most 1/4 second - PerfTimer timer; - while( g_TwMgr->m_Graph->IsDrawing() && timer.GetTime()m_Graph->IsDrawing() ) - { - g_TwMgr->SetLastError(g_ErrIsDrawing); - return 0; - } - } - return 1; -} - -// --------------------------------------------------------------------------- - -/* -static inline int TwFreeAsyncProcessing() -{ - if( g_TwMgr && g_TwMgr->IsProcessing() ) - { - const double SLEEP_MAX = 0.25; // wait at most 1/4 second - PerfTimer timer; - while( g_TwMgr->IsProcessing() && timer.GetTime()IsProcessing() ) - { - g_TwMgr->SetLastError(g_ErrIsProcessing); - return 0; - } - } - return 1; -} - -static inline int TwBeginProcessing() -{ - if( !TwFreeAsyncProcessing() ) - return 0; - if( g_TwMgr ) - g_TwMgr->SetProcessing(true); -} - -static inline int TwEndProcessing() -{ - if( g_TwMgr ) - g_TwMgr->SetProcessing(false); -} -*/ - -// --------------------------------------------------------------------------- - -static int TwInitMgr() -{ - assert( g_TwMasterMgr!=NULL ); - assert( g_TwMgr!=NULL ); - - g_TwMgr->m_CurrentFont = g_DefaultNormalFont; - g_TwMgr->m_Graph = g_TwMasterMgr->m_Graph; - - g_TwMgr->m_KeyPressedTextObj = g_TwMgr->m_Graph->NewTextObj(); - g_TwMgr->m_InfoTextObj = g_TwMgr->m_Graph->NewTextObj(); - - g_TwMgr->m_HelpBar = TwNewBar("TW_HELP"); - if( g_TwMgr->m_HelpBar ) - { - g_TwMgr->m_HelpBar->m_Label = "~ Help & Shortcuts ~"; - g_TwMgr->m_HelpBar->m_PosX = 32; - g_TwMgr->m_HelpBar->m_PosY = 32; - g_TwMgr->m_HelpBar->m_Width = 400; - g_TwMgr->m_HelpBar->m_Height = 200; - g_TwMgr->m_HelpBar->m_ValuesWidth = 12*(g_TwMgr->m_HelpBar->m_Font->m_CharHeight/2); - g_TwMgr->m_HelpBar->m_Color = 0xa05f5f5f; //0xd75f5f5f; - g_TwMgr->m_HelpBar->m_DarkText = false; - g_TwMgr->m_HelpBar->m_IsHelpBar = true; - g_TwMgr->Minimize(g_TwMgr->m_HelpBar); - } - else - return 0; - - CColorExt::CreateTypes(); - CQuaternionExt::CreateTypes(); - - return 1; -} - - -int ANT_CALL TwInit(ETwGraphAPI _GraphAPI, void *_Device) -{ -#if defined(_DEBUG) && defined(ANT_WINDOWS) - _CrtSetDbgFlag(_CRTDBG_LEAK_CHECK_DF|_CrtSetDbgFlag(_CRTDBG_LEAK_CHECK_DF)); -#endif - - if( g_TwMasterMgr!=NULL ) - { - g_TwMasterMgr->SetLastError(g_ErrInit); - return 0; - } - assert( g_TwMgr==0 ); - assert( g_Wnds.empty() ); - - g_TwMasterMgr = new CTwMgr(_GraphAPI, _Device, TW_MASTER_WINDOW_ID); - g_Wnds[TW_MASTER_WINDOW_ID] = g_TwMasterMgr; - g_TwMgr = g_TwMasterMgr; - - TwGenerateDefaultFonts(g_FontScaling); - g_TwMgr->m_CurrentFont = g_DefaultNormalFont; - - int Res = TwCreateGraph(_GraphAPI); - if( Res ) - Res = TwInitMgr(); - - if( !Res ) - TwTerminate(); - - return Res; -} - -// --------------------------------------------------------------------------- - -int ANT_CALL TwSetLastError(const char *_StaticErrorMessage) -{ - if( g_TwMasterMgr!=0 ) - { - g_TwMasterMgr->SetLastError(_StaticErrorMessage); - return 1; - } - else - return 0; -} - -// --------------------------------------------------------------------------- - -int ANT_CALL TwTerminate() -{ - if( g_TwMgr==NULL ) - { - //TwGlobalError(g_ErrShut); -> not an error - return 0; // already shutdown - } - - // For multi-thread safety - if( !TwFreeAsyncDrawing() ) - return 0; - - CTwWndMap::iterator it; - for( it=g_Wnds.begin(); it!=g_Wnds.end(); it++ ) - { - g_TwMgr = it->second; - - g_TwMgr->m_Terminating = true; - TwDeleteAllBars(); - if( g_TwMgr->m_CursorsCreated ) - g_TwMgr->FreeCursors(); - - if( g_TwMgr->m_Graph ) - { - if( g_TwMgr->m_KeyPressedTextObj ) - { - g_TwMgr->m_Graph->DeleteTextObj(g_TwMgr->m_KeyPressedTextObj); - g_TwMgr->m_KeyPressedTextObj = NULL; - } - if( g_TwMgr->m_InfoTextObj ) - { - g_TwMgr->m_Graph->DeleteTextObj(g_TwMgr->m_InfoTextObj); - g_TwMgr->m_InfoTextObj = NULL; - } - if (g_TwMgr != g_TwMasterMgr) - g_TwMgr->m_Graph = NULL; - } - - if (g_TwMgr != g_TwMasterMgr) - { - delete g_TwMgr; - g_TwMgr = NULL; - } - } - - // delete g_TwMasterMgr - int Res = 1; - g_TwMgr = g_TwMasterMgr; - if( g_TwMasterMgr->m_Graph ) - { - Res = g_TwMasterMgr->m_Graph->Shut(); - delete g_TwMasterMgr->m_Graph; - g_TwMasterMgr->m_Graph = NULL; - } - TwDeleteDefaultFonts(); - delete g_TwMasterMgr; - g_TwMasterMgr = NULL; - g_TwMgr = NULL; - g_Wnds.clear(); - - return Res; -} - -// --------------------------------------------------------------------------- - -int ANT_CALL TwGetCurrentWindow() -{ - if( g_TwMgr==NULL ) - { - TwGlobalError(g_ErrNotInit); - return 0; // not initialized - } - - return g_TwMgr->m_WndID; -} - -int ANT_CALL TwSetCurrentWindow(int wndID) -{ - if( g_TwMgr==NULL ) - { - TwGlobalError(g_ErrNotInit); - return 0; // not initialized - } - - if (wndID != g_TwMgr->m_WndID) - { - CTwWndMap::iterator foundWnd = g_Wnds.find(wndID); - if (foundWnd == g_Wnds.end()) - { - // create a new CTwMgr - g_TwMgr = new CTwMgr(g_TwMasterMgr->m_GraphAPI, g_TwMasterMgr->m_Device, wndID); - g_Wnds[wndID] = g_TwMgr; - return TwInitMgr(); - } - else - { - g_TwMgr = foundWnd->second; - return 1; - } - } - else - return 1; -} - -int ANT_CALL TwWindowExists(int wndID) -{ - CTwWndMap::iterator foundWnd = g_Wnds.find(wndID); - if (foundWnd == g_Wnds.end()) - return 0; - else - return 1; -} - -// --------------------------------------------------------------------------- - -int ANT_CALL TwDraw() -{ - PERF( PerfTimer Timer; double DT; ) - //CTwFPU fpu; // fpu precision only forced in update (do not modif dx draw calls) - - if( g_TwMgr==NULL || g_TwMgr->m_Graph==NULL ) - { - TwGlobalError(g_ErrNotInit); - return 0; // not initialized - } - - assert(g_TwMgr->m_Bars.size()==g_TwMgr->m_Order.size()); - - // For multi-thread savety - if( !TwFreeAsyncDrawing() ) - return 0; - - // Create cursors - #if defined(ANT_WINDOWS) || defined(ANT_OSX) - if( !g_TwMgr->m_CursorsCreated ) - g_TwMgr->CreateCursors(); - #elif defined(ANT_UNIX) - if( !g_TwMgr->m_CurrentXDisplay ) - g_TwMgr->m_CurrentXDisplay = glXGetCurrentDisplay(); - if( !g_TwMgr->m_CurrentXWindow ) - g_TwMgr->m_CurrentXWindow = glXGetCurrentDrawable(); - if( g_TwMgr->m_CurrentXDisplay && !g_TwMgr->m_CursorsCreated ) - g_TwMgr->CreateCursors(); - #endif - - // Autorepeat TW_MOUSE_PRESSED - double CurrTime = g_TwMgr->m_Timer.GetTime(); - double RepeatDT = CurrTime - g_TwMgr->m_LastMousePressedTime; - double DrawDT = CurrTime - g_TwMgr->m_LastDrawTime; - if( RepeatDT>2.0*g_TwMgr->m_RepeatMousePressedDelay - || DrawDT>2.0*g_TwMgr->m_RepeatMousePressedDelay - || abs(g_TwMgr->m_LastMousePressedPosition[0]-g_TwMgr->m_LastMouseX)>4 - || abs(g_TwMgr->m_LastMousePressedPosition[1]-g_TwMgr->m_LastMouseY)>4 ) - { - g_TwMgr->m_CanRepeatMousePressed = false; - g_TwMgr->m_IsRepeatingMousePressed = false; - } - if( g_TwMgr->m_CanRepeatMousePressed ) - { - if( (!g_TwMgr->m_IsRepeatingMousePressed && RepeatDT>g_TwMgr->m_RepeatMousePressedDelay) - || (g_TwMgr->m_IsRepeatingMousePressed && RepeatDT>g_TwMgr->m_RepeatMousePressedPeriod) ) - { - g_TwMgr->m_IsRepeatingMousePressed = true; - g_TwMgr->m_LastMousePressedTime = g_TwMgr->m_Timer.GetTime(); - TwMouseMotion(g_TwMgr->m_LastMouseX,g_TwMgr->m_LastMouseY); - TwMouseButton(TW_MOUSE_PRESSED, g_TwMgr->m_LastMousePressedButtonID); - } - } - g_TwMgr->m_LastDrawTime = CurrTime; - - if( g_TwMgr->m_WndWidth<0 || g_TwMgr->m_WndHeight<0 ) - { - g_TwMgr->SetLastError(g_ErrBadSize); - return 0; - } - else if( g_TwMgr->m_WndWidth==0 || g_TwMgr->m_WndHeight==0 ) // probably iconified - return 1; // nothing to do - - // count number of bars to draw - size_t i, j; - int Nb = 0; - for( i=0; im_Bars.size(); ++i ) - if( g_TwMgr->m_Bars[i]!=NULL && g_TwMgr->m_Bars[i]->m_Visible ) - ++Nb; - - if( Nb>0 ) - { - PERF( Timer.Reset(); ) - g_TwMgr->m_Graph->BeginDraw(g_TwMgr->m_WndWidth, g_TwMgr->m_WndHeight); - PERF( DT = Timer.GetTime(); printf("\nBegin=%.4fms ", 1000.0*DT); ) - - PERF( Timer.Reset(); ) - vector TopBarsRects, ClippedBarRects; - for( i=0; im_Bars.size(); ++i ) - { - CTwBar *Bar = g_TwMgr->m_Bars[ g_TwMgr->m_Order[i] ]; - if( Bar->m_Visible ) - { - if( g_TwMgr->m_OverlapContent || Bar->IsMinimized() ) - Bar->Draw(); - else - { - // Clip overlapped transparent bars to make them more readable - const int Margin = 4; - CRect BarRect(Bar->m_PosX - Margin, Bar->m_PosY - Margin, Bar->m_Width + 2*Margin, Bar->m_Height + 2*Margin); - TopBarsRects.clear(); - for( j=i+1; jm_Bars.size(); ++j ) - { - CTwBar *TopBar = g_TwMgr->m_Bars[g_TwMgr->m_Order[j]]; - if( TopBar->m_Visible && !TopBar->IsMinimized() ) - TopBarsRects.push_back(CRect(TopBar->m_PosX, TopBar->m_PosY, TopBar->m_Width, TopBar->m_Height)); - } - ClippedBarRects.clear(); - BarRect.Subtract(TopBarsRects, ClippedBarRects); - - if( ClippedBarRects.size()==1 && ClippedBarRects[0]==BarRect ) - //g_TwMgr->m_Graph->DrawRect(Bar->m_PosX, Bar->m_PosY, Bar->m_PosX+Bar->m_Width-1, Bar->m_PosY+Bar->m_Height-1, 0x70ffffff); // Clipping test - Bar->Draw(); // unclipped - else - { - Bar->Draw(CTwBar::DRAW_BG); // draw background only - - // draw content for each clipped rectangle - for( j=0; j1 && ClippedBarRects[j].H>1) - { - g_TwMgr->m_Graph->SetScissor(ClippedBarRects[j].X+1, ClippedBarRects[j].Y, ClippedBarRects[j].W, ClippedBarRects[j].H-1); - //g_TwMgr->m_Graph->DrawRect(0, 0, 1000, 1000, 0x70ffffff); // Clipping test - Bar->Draw(CTwBar::DRAW_CONTENT); - } - g_TwMgr->m_Graph->SetScissor(0, 0, 0, 0); - } - } - } - } - PERF( DT = Timer.GetTime(); printf("Draw=%.4fms ", 1000.0*DT); ) - - PERF( Timer.Reset(); ) - g_TwMgr->m_Graph->EndDraw(); - PERF( DT = Timer.GetTime(); printf("End=%.4fms\n", 1000.0*DT); ) - } - - return 1; -} - -// --------------------------------------------------------------------------- - -int ANT_CALL TwWindowSize(int _Width, int _Height) -{ - g_InitWndWidth = _Width; - g_InitWndHeight = _Height; - - if( g_TwMgr==NULL || g_TwMgr->m_Graph==NULL ) - { - //TwGlobalError(g_ErrNotInit); -> not an error here - return 0; // not initialized - } - - if( _Width<0 || _Height<0 ) - { - g_TwMgr->SetLastError(g_ErrBadSize); - return 0; - } - - // For multi-thread savety - if( !TwFreeAsyncDrawing() ) - return 0; - - // Delete the extra text objects - if( g_TwMgr->m_KeyPressedTextObj ) - { - g_TwMgr->m_Graph->DeleteTextObj(g_TwMgr->m_KeyPressedTextObj); - g_TwMgr->m_KeyPressedTextObj = NULL; - } - if( g_TwMgr->m_InfoTextObj ) - { - g_TwMgr->m_Graph->DeleteTextObj(g_TwMgr->m_InfoTextObj); - g_TwMgr->m_InfoTextObj = NULL; - } - - g_TwMgr->m_WndWidth = _Width; - g_TwMgr->m_WndHeight = _Height; - g_TwMgr->m_Graph->Restore(); - - // Recreate extra text objects - if( g_TwMgr->m_WndWidth!=0 && g_TwMgr->m_WndHeight!=0 ) - { - if( g_TwMgr->m_KeyPressedTextObj==NULL ) - { - g_TwMgr->m_KeyPressedTextObj = g_TwMgr->m_Graph->NewTextObj(); - g_TwMgr->m_KeyPressedBuildText = true; - } - if( g_TwMgr->m_InfoTextObj==NULL ) - { - g_TwMgr->m_InfoTextObj = g_TwMgr->m_Graph->NewTextObj(); - g_TwMgr->m_InfoBuildText = true; - } - } - - for( std::vector::iterator it=g_TwMgr->m_Bars.begin(); it!=g_TwMgr->m_Bars.end(); ++it ) - (*it)->NotUpToDate(); - - return 1; -} - -// --------------------------------------------------------------------------- - -CTwMgr::CTwMgr(ETwGraphAPI _GraphAPI, void *_Device, int _WndID) -{ - m_GraphAPI = _GraphAPI; - m_Device = _Device; - m_WndID = _WndID; - m_LastError = NULL; - m_CurrentDbgFile = ""; - m_CurrentDbgLine = 0; - //m_Processing = false; - m_Graph = NULL; - m_WndWidth = g_InitWndWidth; - m_WndHeight = g_InitWndHeight; - m_CurrentFont = NULL; // set after by TwIntialize - m_NbMinimizedBars = 0; - m_HelpBar = NULL; - m_HelpBarNotUpToDate = true; - m_HelpBarUpdateNow = false; - m_LastHelpUpdateTime = 0; - m_LastMouseX = -1; - m_LastMouseY = -1; - m_LastMouseWheelPos = 0; - m_IconPos = 0; - m_IconAlign = 0; - m_IconMarginX = m_IconMarginY = 8; - m_FontResizable = true; - m_KeyPressedTextObj = NULL; - m_KeyPressedBuildText = false; - m_KeyPressedTime = 0; - m_InfoTextObj = NULL; - m_InfoBuildText = true; - m_BarInitColorHue = 155; - m_PopupBar = NULL; - m_TypeColor32 = TW_TYPE_UNDEF; - m_TypeColor3F = TW_TYPE_UNDEF; - m_TypeColor4F = TW_TYPE_UNDEF; - m_LastMousePressedTime = 0; - m_LastMousePressedButtonID = TW_MOUSE_MIDDLE; - m_LastMousePressedPosition[0] = -1000; - m_LastMousePressedPosition[1] = -1000; - m_RepeatMousePressedDelay = 0.5; - m_RepeatMousePressedPeriod = 0.1; - m_CanRepeatMousePressed = false; - m_IsRepeatingMousePressed = false; - m_LastDrawTime = 0; - m_UseOldColorScheme = false; - m_Contained = false; - m_ButtonAlign = BUTTON_ALIGN_RIGHT; - m_OverlapContent = false; - m_Terminating = false; - - m_CursorsCreated = false; - #if defined(ANT_UNIX) - m_CurrentXDisplay = NULL; - m_CurrentXWindow = 0; - #endif // defined(ANT_UNIX) - - m_CopyCDStringToClient = g_InitCopyCDStringToClient; - m_CopyStdStringToClient = g_InitCopyStdStringToClient; - m_ClientStdStringStructSize = 0; - m_ClientStdStringBaseType = (TwType)0; -} - -// --------------------------------------------------------------------------- - -CTwMgr::~CTwMgr() -{ -} - -// --------------------------------------------------------------------------- - -int CTwMgr::FindBar(const char *_Name) const -{ - if( _Name==NULL || strlen(_Name)<=0 ) - return -1; - int i; - for( i=0; i<(int)m_Bars.size(); ++i ) - if( m_Bars[i]!=NULL && strcmp(_Name, m_Bars[i]->m_Name.c_str())==0 ) - return i; - return -1; -} - - -// --------------------------------------------------------------------------- - -int CTwMgr::HasAttrib(const char *_Attrib, bool *_HasValue) const -{ - *_HasValue = true; - if( _stricmp(_Attrib, "help")==0 ) - return MGR_HELP; - else if( _stricmp(_Attrib, "fontsize")==0 ) - return MGR_FONT_SIZE; - else if( _stricmp(_Attrib, "fontstyle")==0 ) - return MGR_FONT_STYLE; - else if( _stricmp(_Attrib, "iconpos")==0 ) - return MGR_ICON_POS; - else if( _stricmp(_Attrib, "iconalign")==0 ) - return MGR_ICON_ALIGN; - else if( _stricmp(_Attrib, "iconmargin")==0 ) - return MGR_ICON_MARGIN; - else if( _stricmp(_Attrib, "fontresizable")==0 ) - return MGR_FONT_RESIZABLE; - else if( _stricmp(_Attrib, "colorscheme")==0 ) - return MGR_COLOR_SCHEME; - else if( _stricmp(_Attrib, "contained")==0 ) - return MGR_CONTAINED; - else if( _stricmp(_Attrib, "buttonalign")==0 ) - return MGR_BUTTON_ALIGN; - else if( _stricmp(_Attrib, "overlap")==0 ) - return MGR_OVERLAP; - - *_HasValue = false; - return 0; // not found -} - -int CTwMgr::SetAttrib(int _AttribID, const char *_Value) -{ - switch( _AttribID ) - { - case MGR_HELP: - if( _Value && strlen(_Value)>0 ) - { - m_Help = _Value; - m_HelpBarNotUpToDate = true; - return 1; - } - else - { - SetLastError(g_ErrNoValue); - return 0; - } - case MGR_FONT_SIZE: - if( _Value && strlen(_Value)>0 ) - { - int s; - int n = sscanf(_Value, "%d", &s); - if( n==1 && s>=1 && s<=3 ) - { - if( s==1 ) - SetFont(g_DefaultSmallFont, true); - else if( s==2 ) - SetFont(g_DefaultNormalFont, true); - else if( s==3 ) - SetFont(g_DefaultLargeFont, true); - return 1; - } - else - { - SetLastError(g_ErrBadValue); - return 0; - } - } - else - { - SetLastError(g_ErrNoValue); - return 0; - } - case MGR_FONT_STYLE: - if( _Value && strlen(_Value)>0 ) - { - if( _stricmp(_Value, "fixed")==0 ) - { - if( m_CurrentFont!=g_DefaultFixed1Font ) - { - SetFont(g_DefaultFixed1Font, true); - m_FontResizable = false; // for now fixed font is not resizable - } - return 1; - } - else if( _stricmp(_Value, "default")==0 ) - { - if( m_CurrentFont!=g_DefaultSmallFont && m_CurrentFont!=g_DefaultNormalFont && m_CurrentFont!=g_DefaultLargeFont ) - { - if( m_CurrentFont == g_DefaultFixed1Font ) - m_FontResizable = true; - SetFont(g_DefaultNormalFont, true); - } - return 1; - } - else - { - SetLastError(g_ErrBadValue); - return 0; - } - } - else - { - SetLastError(g_ErrNoValue); - return 0; - } - case MGR_ICON_POS: - if( _Value && strlen(_Value)>0 ) - { - if( _stricmp(_Value, "bl")==0 || _stricmp(_Value, "lb")==0 || _stricmp(_Value, "bottomleft")==0 || _stricmp(_Value, "leftbottom")==0 ) - { - m_IconPos = 0; - return 1; - } - else if( _stricmp(_Value, "br")==0 || _stricmp(_Value, "rb")==0 || _stricmp(_Value, "bottomright")==0 || _stricmp(_Value, "rightbottom")==0 ) - { - m_IconPos = 1; - return 1; - } - else if( _stricmp(_Value, "tl")==0 || _stricmp(_Value, "lt")==0 || _stricmp(_Value, "topleft")==0 || _stricmp(_Value, "lefttop")==0 ) - { - m_IconPos = 2; - return 1; - } - else if( _stricmp(_Value, "tr")==0 || _stricmp(_Value, "rt")==0 || _stricmp(_Value, "topright")==0 || _stricmp(_Value, "righttop")==0 ) - { - m_IconPos = 3; - return 1; - } - else - { - SetLastError(g_ErrBadValue); - return 0; - } - } - else - { - SetLastError(g_ErrNoValue); - return 0; - } - case MGR_ICON_ALIGN: - if( _Value && strlen(_Value)>0 ) - { - if( _stricmp(_Value, "vert")==0 || _stricmp(_Value, "vertical")==0 ) - { - m_IconAlign = 0; - return 1; - } - else if( _stricmp(_Value, "horiz")==0 || _stricmp(_Value, "horizontal")==0 ) - { - m_IconAlign = 1; - return 1; - } - else - { - SetLastError(g_ErrBadValue); - return 0; - } - } - else - { - SetLastError(g_ErrNoValue); - return 0; - } - case MGR_ICON_MARGIN: - if( _Value && strlen(_Value)>0 ) - { - int x, y; - int n = sscanf(_Value, "%d%d", &x, &y); - if( n==2 && x>=0 && y>=0 ) - { - m_IconMarginX = x; - m_IconMarginY = y; - return 1; - } - else - { - SetLastError(g_ErrBadValue); - return 0; - } - } - else - { - SetLastError(g_ErrNoValue); - return 0; - } - case MGR_FONT_RESIZABLE: - if( _Value && strlen(_Value)>0 ) - { - if( _stricmp(_Value, "1")==0 || _stricmp(_Value, "true")==0 ) - { - m_FontResizable = true; - return 1; - } - else if( _stricmp(_Value, "0")==0 || _stricmp(_Value, "false")==0 ) - { - m_FontResizable = false; - return 1; - } - else - { - g_TwMgr->SetLastError(g_ErrBadValue); - return 0; - } - } - else - { - g_TwMgr->SetLastError(g_ErrNoValue); - return 0; - } - case MGR_COLOR_SCHEME: - if( _Value && strlen(_Value)>0 ) - { - int s; - int n = sscanf(_Value, "%d", &s); - if( n==1 && s>=0 && s<=1 ) - { - if( s==0 ) - m_UseOldColorScheme = true; - else - m_UseOldColorScheme = false; - return 1; - } - else - { - SetLastError(g_ErrBadValue); - return 0; - } - } - else - { - g_TwMgr->SetLastError(g_ErrNoValue); - return 0; - } - case MGR_CONTAINED: - if( _Value && strlen(_Value)>0 ) - { - if( _stricmp(_Value, "1")==0 || _stricmp(_Value, "true")==0 ) - m_Contained = true; - else if( _stricmp(_Value, "0")==0 || _stricmp(_Value, "false")==0 ) - m_Contained = false; - else - { - g_TwMgr->SetLastError(g_ErrBadValue); - return 0; - } - vector::iterator barIt; - for( barIt=g_TwMgr->m_Bars.begin(); barIt!=g_TwMgr->m_Bars.end(); ++barIt ) - if( (*barIt)!=NULL ) - (*barIt)->m_Contained = m_Contained; - return 1; - } - else - { - g_TwMgr->SetLastError(g_ErrNoValue); - return 0; - } - case MGR_BUTTON_ALIGN: - if( _Value && strlen(_Value)>0 ) - { - if( _stricmp(_Value, "left")==0 ) - m_ButtonAlign = BUTTON_ALIGN_LEFT; - else if( _stricmp(_Value, "center")==0 ) - m_ButtonAlign = BUTTON_ALIGN_CENTER; - else if( _stricmp(_Value, "right")==0 ) - m_ButtonAlign = BUTTON_ALIGN_RIGHT; - else - { - g_TwMgr->SetLastError(g_ErrBadValue); - return 0; - } - vector::iterator barIt; - for( barIt=g_TwMgr->m_Bars.begin(); barIt!=g_TwMgr->m_Bars.end(); ++barIt ) - if( (*barIt)!=NULL ) - (*barIt)->m_ButtonAlign = m_ButtonAlign; - return 1; - } - else - { - g_TwMgr->SetLastError(g_ErrNoValue); - return 0; - } - case MGR_OVERLAP: - if( _Value && strlen(_Value)>0 ) - { - if( _stricmp(_Value, "1")==0 || _stricmp(_Value, "true")==0 ) - { - m_OverlapContent = true; - return 1; - } - else if( _stricmp(_Value, "0")==0 || _stricmp(_Value, "false")==0 ) - { - m_OverlapContent = false; - return 1; - } - else - { - g_TwMgr->SetLastError(g_ErrBadValue); - return 0; - } - } - else - { - g_TwMgr->SetLastError(g_ErrNoValue); - return 0; - } - default: - g_TwMgr->SetLastError(g_ErrUnknownAttrib); - return 0; - } -} - -ERetType CTwMgr::GetAttrib(int _AttribID, std::vector& outDoubles, std::ostringstream& outString) const -{ - outDoubles.clear(); - outString.clear(); - - switch( _AttribID ) - { - case MGR_HELP: - outString << m_Help; - return RET_STRING; - case MGR_FONT_SIZE: - if( m_CurrentFont==g_DefaultSmallFont ) - outDoubles.push_back(1); - else if( m_CurrentFont==g_DefaultNormalFont ) - outDoubles.push_back(2); - else if( m_CurrentFont==g_DefaultLargeFont ) - outDoubles.push_back(3); - else - outDoubles.push_back(0); // should not happened - return RET_DOUBLE; - case MGR_FONT_STYLE: - if( m_CurrentFont==g_DefaultFixed1Font ) - outString << "fixed"; - else - outString << "default"; - return RET_STRING; - case MGR_ICON_POS: - if( m_IconPos==0 ) - outString << "bottomleft"; - else if( m_IconPos==1 ) - outString << "bottomright"; - else if( m_IconPos==2 ) - outString << "topleft"; - else if( m_IconPos==3 ) - outString << "topright"; - else - outString << "undefined"; // should not happened - return RET_STRING; - case MGR_ICON_ALIGN: - if( m_IconAlign==0 ) - outString << "vertical"; - else if( m_IconAlign==1 ) - outString << "horizontal"; - else - outString << "undefined"; // should not happened - return RET_STRING; - case MGR_ICON_MARGIN: - outDoubles.push_back(m_IconMarginX); - outDoubles.push_back(m_IconMarginY); - return RET_DOUBLE; - case MGR_FONT_RESIZABLE: - outDoubles.push_back(m_FontResizable); - return RET_DOUBLE; - case MGR_COLOR_SCHEME: - outDoubles.push_back(m_UseOldColorScheme ? 0 : 1); - return RET_DOUBLE; - case MGR_CONTAINED: - { - bool contained = m_Contained; - /* - if( contained ) - { - vector::iterator barIt; - for( barIt=g_TwMgr->m_Bars.begin(); barIt!=g_TwMgr->m_Bars.end(); ++barIt ) - if( (*barIt)!=NULL && !(*barIt)->m_Contained ) - { - contained = false; - break; - } - } - */ - outDoubles.push_back(contained); - return RET_DOUBLE; - } - case MGR_BUTTON_ALIGN: - if( m_ButtonAlign==BUTTON_ALIGN_LEFT ) - outString << "left"; - else if( m_ButtonAlign==BUTTON_ALIGN_CENTER ) - outString << "center"; - else - outString << "right"; - return RET_STRING; - case MGR_OVERLAP: - outDoubles.push_back(m_OverlapContent); - return RET_DOUBLE; - default: - g_TwMgr->SetLastError(g_ErrUnknownAttrib); - return RET_ERROR; - } -} - -// --------------------------------------------------------------------------- - -void CTwMgr::Minimize(TwBar *_Bar) -{ - assert(m_Graph!=NULL && _Bar!=NULL); - assert(m_Bars.size()==m_MinOccupied.size()); - if( _Bar->m_IsMinimized ) - return; - if( _Bar->m_Visible ) - { - size_t i = m_NbMinimizedBars; - m_NbMinimizedBars++; - for( i=0; im_MinNumber = (int)i; - } - else - _Bar->m_MinNumber = -1; - _Bar->m_IsMinimized = true; - _Bar->NotUpToDate(); -} - -// --------------------------------------------------------------------------- - -void CTwMgr::Maximize(TwBar *_Bar) -{ - assert(m_Graph!=NULL && _Bar!=NULL); - assert(m_Bars.size()==m_MinOccupied.size()); - if( !_Bar->m_IsMinimized ) - return; - if( _Bar->m_Visible ) - { - --m_NbMinimizedBars; - if( m_NbMinimizedBars<0 ) - m_NbMinimizedBars = 0; - if( _Bar->m_MinNumber>=0 && _Bar->m_MinNumber<(int)m_MinOccupied.size() ) - m_MinOccupied[_Bar->m_MinNumber] = false; - } - _Bar->m_IsMinimized = false; - _Bar->NotUpToDate(); - if( _Bar->m_IsHelpBar ) - m_HelpBarNotUpToDate = true; -} - -// --------------------------------------------------------------------------- - -void CTwMgr::Hide(TwBar *_Bar) -{ - assert(m_Graph!=NULL && _Bar!=NULL); - if( !_Bar->m_Visible ) - return; - if( _Bar->IsMinimized() ) - { - Maximize(_Bar); - _Bar->m_Visible = false; - Minimize(_Bar); - } - else - _Bar->m_Visible = false; - if( !_Bar->m_IsHelpBar ) - m_HelpBarNotUpToDate = true; -} - -// --------------------------------------------------------------------------- - -void CTwMgr::Unhide(TwBar *_Bar) -{ - assert(m_Graph!=NULL && _Bar!=NULL); - if( _Bar->m_Visible ) - return; - if( _Bar->IsMinimized() ) - { - Maximize(_Bar); - _Bar->m_Visible = true; - Minimize(_Bar); - } - else - _Bar->m_Visible = true; - _Bar->NotUpToDate(); - if( !_Bar->m_IsHelpBar ) - m_HelpBarNotUpToDate = true; -} - -// --------------------------------------------------------------------------- - -void CTwMgr::SetFont(const CTexFont *_Font, bool _ResizeBars) -{ - assert(m_Graph!=NULL); - assert(_Font!=NULL); - - m_CurrentFont = _Font; - - for( int i=0; i<(int)m_Bars.size(); ++i ) - if( m_Bars[i]!=NULL ) - { - int fh = m_Bars[i]->m_Font->m_CharHeight; - m_Bars[i]->m_Font = _Font; - if( _ResizeBars ) - { - if( m_Bars[i]->m_Movable ) - { - m_Bars[i]->m_PosX += (3*(fh-_Font->m_CharHeight))/2; - m_Bars[i]->m_PosY += (fh-_Font->m_CharHeight)/2; - } - if( m_Bars[i]->m_Resizable ) - { - m_Bars[i]->m_Width = (m_Bars[i]->m_Width*_Font->m_CharHeight)/fh; - m_Bars[i]->m_Height = (m_Bars[i]->m_Height*_Font->m_CharHeight)/fh; - m_Bars[i]->m_ValuesWidth = (m_Bars[i]->m_ValuesWidth*_Font->m_CharHeight)/fh; - } - } - m_Bars[i]->NotUpToDate(); - } - - if( g_TwMgr->m_HelpBar!=NULL ) - g_TwMgr->m_HelpBar->Update(); - g_TwMgr->m_InfoBuildText = true; - g_TwMgr->m_KeyPressedBuildText = true; - m_HelpBarNotUpToDate = true; -} - -// --------------------------------------------------------------------------- - -void ANT_CALL TwGlobalError(const char *_ErrorMessage) // to be called when g_TwMasterMgr is not created -{ - if( g_ErrorHandler==NULL ) - { - fprintf(stderr, "ERROR(AntTweakBar) >> %s\n", _ErrorMessage); - #ifdef ANT_WINDOWS - OutputDebugString("ERROR(AntTweakBar) >> "); - OutputDebugString(_ErrorMessage); - OutputDebugString("\n"); - #endif // ANT_WINDOWS - } - else - g_ErrorHandler(_ErrorMessage); - - if( g_BreakOnError ) - abort(); -} - -// --------------------------------------------------------------------------- - -void CTwMgr::SetLastError(const char *_ErrorMessage) // _ErrorMessage must be a static string -{ - if (this != g_TwMasterMgr) - { - // route to master - g_TwMasterMgr->SetLastError(_ErrorMessage); - return; - } - - m_LastError = _ErrorMessage; - - if( g_ErrorHandler==NULL ) - { - if( m_CurrentDbgFile!=NULL && strlen(m_CurrentDbgFile)>0 && m_CurrentDbgLine>0 ) - fprintf(stderr, "%s(%d): ", m_CurrentDbgFile, m_CurrentDbgLine); - fprintf(stderr, "ERROR(AntTweakBar) >> %s\n", m_LastError); - #ifdef ANT_WINDOWS - if( m_CurrentDbgFile!=NULL && strlen(m_CurrentDbgFile)>0 && m_CurrentDbgLine>0 ) - { - OutputDebugString(m_CurrentDbgFile); - char sl[32]; - sprintf(sl, "(%d): ", m_CurrentDbgLine); - OutputDebugString(sl); - } - OutputDebugString("ERROR(AntTweakBar) >> "); - OutputDebugString(m_LastError); - OutputDebugString("\n"); - #endif // ANT_WINDOWS - } - else - g_ErrorHandler(_ErrorMessage); - - if( g_BreakOnError ) - abort(); -} - -// --------------------------------------------------------------------------- - -const char *CTwMgr::GetLastError() -{ - if (this != g_TwMasterMgr) - { - // route to master - return g_TwMasterMgr->GetLastError(); - } - - const char *Err = m_LastError; - m_LastError = NULL; - return Err; -} - -// --------------------------------------------------------------------------- - -const char *CTwMgr::CheckLastError() const -{ - return m_LastError; -} - -// --------------------------------------------------------------------------- - -void CTwMgr::SetCurrentDbgParams(const char *dbgFile, int dbgLine) -{ - m_CurrentDbgFile = dbgFile; - m_CurrentDbgLine = dbgLine; -} - -// --------------------------------------------------------------------------- - -int ANT_CALL __TwDbg(const char *dbgFile, int dbgLine) -{ - if( g_TwMgr!=NULL ) - g_TwMgr->SetCurrentDbgParams(dbgFile, dbgLine); - return 0; // always returns zero -} - -// --------------------------------------------------------------------------- - -void ANT_CALL TwHandleErrors(TwErrorHandler _ErrorHandler, int _BreakOnError) -{ - g_ErrorHandler = _ErrorHandler; - g_BreakOnError = (_BreakOnError) ? true : false; -} - -void ANT_CALL TwHandleErrors(TwErrorHandler _ErrorHandler) -{ - TwHandleErrors(_ErrorHandler, false); -} - -// --------------------------------------------------------------------------- - -const char *ANT_CALL TwGetLastError() -{ - if( g_TwMasterMgr==NULL ) - { - TwGlobalError(g_ErrNotInit); - return g_ErrNotInit; - } - else - return g_TwMasterMgr->GetLastError(); -} - -// --------------------------------------------------------------------------- - -TwBar *ANT_CALL TwNewBar(const char *_Name) -{ - if( g_TwMgr==NULL || g_TwMgr->m_Graph==NULL ) - { - TwGlobalError(g_ErrNotInit); - return NULL; // not initialized - } - - TwFreeAsyncDrawing(); // For multi-thread savety - - if( _Name==NULL || strlen(_Name)<=0 ) - { - g_TwMgr->SetLastError(g_ErrBadParam); - return NULL; - } - if( g_TwMgr->FindBar(_Name)>=0 ) - { - g_TwMgr->SetLastError(g_ErrExist); - return NULL; - } - - if( strstr(_Name, "`")!=NULL ) - { - g_TwMgr->SetLastError(g_ErrNoBackQuote); - return NULL; - } - - if( g_TwMgr->m_PopupBar!=NULL ) // delete popup bar if it exists - { - TwDeleteBar(g_TwMgr->m_PopupBar); - g_TwMgr->m_PopupBar = NULL; - } - - TwBar *Bar = new CTwBar(_Name); - g_TwMgr->m_Bars.push_back(Bar); - g_TwMgr->m_Order.push_back((int)g_TwMgr->m_Bars.size()-1); - g_TwMgr->m_MinOccupied.push_back(false); - g_TwMgr->m_HelpBarNotUpToDate = true; - - return Bar; -} - -// --------------------------------------------------------------------------- - -int ANT_CALL TwDeleteBar(TwBar *_Bar) -{ - if( g_TwMgr==NULL ) - { - TwGlobalError(g_ErrNotInit); - return 0; // not initialized - } - if( _Bar==NULL ) - { - g_TwMgr->SetLastError(g_ErrBadParam); - return 0; - } - if( _Bar==g_TwMgr->m_HelpBar ) - { - g_TwMgr->SetLastError(g_ErrDelHelp); - return 0; - } - - TwFreeAsyncDrawing(); // For multi-thread savety - - vector::iterator BarIt; - int i = 0; - for( BarIt=g_TwMgr->m_Bars.begin(); BarIt!=g_TwMgr->m_Bars.end(); ++BarIt, ++i ) - if( (*BarIt)==_Bar ) - break; - if( BarIt==g_TwMgr->m_Bars.end() ) - { - g_TwMgr->SetLastError(g_ErrNotFound); - return 0; - } - - if( g_TwMgr->m_PopupBar!=NULL && _Bar!=g_TwMgr->m_PopupBar ) // delete popup bar first if it exists - { - TwDeleteBar(g_TwMgr->m_PopupBar); - g_TwMgr->m_PopupBar = NULL; - } - - // force bar to un-minimize - g_TwMgr->Maximize(_Bar); - // find an empty MinOccupied - vector::iterator itm; - int j = 0; - for( itm=g_TwMgr->m_MinOccupied.begin(); itm!=g_TwMgr->m_MinOccupied.end(); ++itm, ++j) - if( (*itm)==false ) - break; - assert( itm!=g_TwMgr->m_MinOccupied.end() ); - // shift MinNumbers and erase the empty MinOccupied - for( size_t k=0; km_Bars.size(); ++k ) - if( g_TwMgr->m_Bars[k]!=NULL && g_TwMgr->m_Bars[k]->m_MinNumber>j ) - g_TwMgr->m_Bars[k]->m_MinNumber -= 1; - g_TwMgr->m_MinOccupied.erase(itm); - // erase _Bar order - vector::iterator BarOrderIt = g_TwMgr->m_Order.end(); - for(vector::iterator it=g_TwMgr->m_Order.begin(); it!=g_TwMgr->m_Order.end(); ++it ) - if( (*it)==i ) - BarOrderIt = it; - else if( (*it)>i ) - (*it) -= 1; - assert( BarOrderIt!=g_TwMgr->m_Order.end() ); - g_TwMgr->m_Order.erase(BarOrderIt); - - // erase & delete _Bar - g_TwMgr->m_Bars.erase(BarIt); - delete _Bar; - - g_TwMgr->m_HelpBarNotUpToDate = true; - return 1; -} - -// --------------------------------------------------------------------------- - -int ANT_CALL TwDeleteAllBars() -{ - if( g_TwMgr==NULL ) - { - TwGlobalError(g_ErrNotInit); - return 0; // not initialized - } - - TwFreeAsyncDrawing(); // For multi-thread savety - - int n = 0; - if( g_TwMgr->m_Terminating || g_TwMgr->m_HelpBar==NULL ) - { - for( size_t i=0; im_Bars.size(); ++i ) - if( g_TwMgr->m_Bars[i]!=NULL ) - { - ++n; - delete g_TwMgr->m_Bars[i]; - g_TwMgr->m_Bars[i] = NULL; - } - g_TwMgr->m_Bars.clear(); - g_TwMgr->m_Order.clear(); - g_TwMgr->m_MinOccupied.clear(); - g_TwMgr->m_HelpBarNotUpToDate = true; - } - else - { - vector bars = g_TwMgr->m_Bars; - for( size_t i = 0; i < bars.size(); ++i ) - if( bars[i]!=0 && bars[i]!=g_TwMgr->m_HelpBar) - { - ++n; - TwDeleteBar(bars[i]); - } - g_TwMgr->m_HelpBarNotUpToDate = true; - } - - if( n==0 ) - { - //g_TwMgr->SetLastError(g_ErrNthToDo); - return 0; - } - else - return 1; -} - -// --------------------------------------------------------------------------- - -int ANT_CALL TwSetTopBar(const TwBar *_Bar) -{ - if( g_TwMgr==NULL ) - { - TwGlobalError(g_ErrNotInit); - return 0; // not initialized - } - if( _Bar==NULL ) - { - g_TwMgr->SetLastError(g_ErrBadParam); - return 0; - } - - TwFreeAsyncDrawing(); // For multi-thread savety - - if( _Bar!=g_TwMgr->m_PopupBar && g_TwMgr->m_BarAlwaysOnBottom.length()>0 ) - { - if( strcmp(_Bar->m_Name.c_str(), g_TwMgr->m_BarAlwaysOnBottom.c_str())==0 ) - return TwSetBottomBar(_Bar); - } - - int i = -1, iOrder; - for( iOrder=0; iOrder<(int)g_TwMgr->m_Bars.size(); ++iOrder ) - { - i = g_TwMgr->m_Order[iOrder]; - assert( i>=0 && i<(int)g_TwMgr->m_Bars.size() ); - if( g_TwMgr->m_Bars[i]==_Bar ) - break; - } - if( i<0 || iOrder>=(int)g_TwMgr->m_Bars.size() ) // bar not found - { - g_TwMgr->SetLastError(g_ErrNotFound); - return 0; - } - - for( int j=iOrder; j<(int)g_TwMgr->m_Bars.size()-1; ++j ) - g_TwMgr->m_Order[j] = g_TwMgr->m_Order[j+1]; - g_TwMgr->m_Order[(int)g_TwMgr->m_Bars.size()-1] = i; - - if( _Bar!=g_TwMgr->m_PopupBar && g_TwMgr->m_BarAlwaysOnTop.length()>0 ) - { - int topIdx = g_TwMgr->FindBar(g_TwMgr->m_BarAlwaysOnTop.c_str()); - TwBar *top = (topIdx>=0 && topIdx<(int)g_TwMgr->m_Bars.size()) ? g_TwMgr->m_Bars[topIdx] : NULL; - if( top!=NULL && top!=_Bar ) - TwSetTopBar(top); - } - - if( g_TwMgr->m_PopupBar!=NULL && _Bar!=g_TwMgr->m_PopupBar ) - TwSetTopBar(g_TwMgr->m_PopupBar); - - return 1; -} - -// --------------------------------------------------------------------------- - -TwBar * ANT_CALL TwGetTopBar() -{ - if( g_TwMgr==NULL ) - { - TwGlobalError(g_ErrNotInit); - return NULL; // not initialized - } - - if( g_TwMgr->m_Bars.size()>0 && g_TwMgr->m_PopupBar==NULL ) - return g_TwMgr->m_Bars[g_TwMgr->m_Order[ g_TwMgr->m_Bars.size()-1 ]]; - else if( g_TwMgr->m_Bars.size()>1 && g_TwMgr->m_PopupBar!=NULL ) - return g_TwMgr->m_Bars[g_TwMgr->m_Order[ g_TwMgr->m_Bars.size()-2 ]]; - else - return NULL; -} - -// --------------------------------------------------------------------------- - -int ANT_CALL TwSetBottomBar(const TwBar *_Bar) -{ - if( g_TwMgr==NULL ) - { - TwGlobalError(g_ErrNotInit); - return 0; // not initialized - } - if( _Bar==NULL ) - { - g_TwMgr->SetLastError(g_ErrBadParam); - return 0; - } - - TwFreeAsyncDrawing(); // For multi-thread savety - - if( _Bar!=g_TwMgr->m_PopupBar && g_TwMgr->m_BarAlwaysOnTop.length()>0 ) - { - if( strcmp(_Bar->m_Name.c_str(), g_TwMgr->m_BarAlwaysOnTop.c_str())==0 ) - return TwSetTopBar(_Bar); - } - - int i = -1, iOrder; - for( iOrder=0; iOrder<(int)g_TwMgr->m_Bars.size(); ++iOrder ) - { - i = g_TwMgr->m_Order[iOrder]; - assert( i>=0 && i<(int)g_TwMgr->m_Bars.size() ); - if( g_TwMgr->m_Bars[i]==_Bar ) - break; - } - if( i<0 || iOrder>=(int)g_TwMgr->m_Bars.size() ) // bar not found - { - g_TwMgr->SetLastError(g_ErrNotFound); - return 0; - } - - if( iOrder>0 ) - for( int j=iOrder-1; j>=0; --j ) - g_TwMgr->m_Order[j+1] = g_TwMgr->m_Order[j]; - g_TwMgr->m_Order[0] = i; - - if( _Bar!=g_TwMgr->m_PopupBar && g_TwMgr->m_BarAlwaysOnBottom.length()>0 ) - { - int btmIdx = g_TwMgr->FindBar(g_TwMgr->m_BarAlwaysOnBottom.c_str()); - TwBar *btm = (btmIdx>=0 && btmIdx<(int)g_TwMgr->m_Bars.size()) ? g_TwMgr->m_Bars[btmIdx] : NULL; - if( btm!=NULL && btm!=_Bar ) - TwSetBottomBar(btm); - } - - return 1; -} - -// --------------------------------------------------------------------------- - -TwBar* ANT_CALL TwGetBottomBar() -{ - if( g_TwMgr==NULL ) - { - TwGlobalError(g_ErrNotInit); - return NULL; // not initialized - } - - if( g_TwMgr->m_Bars.size()>0 ) - return g_TwMgr->m_Bars[g_TwMgr->m_Order[0]]; - else - return NULL; -} - -// --------------------------------------------------------------------------- - -int ANT_CALL TwSetBarState(TwBar *_Bar, TwState _State) -{ - if( g_TwMgr==NULL ) - { - TwGlobalError(g_ErrNotInit); - return 0; // not initialized - } - if( _Bar==NULL ) - { - g_TwMgr->SetLastError(g_ErrBadParam); - return 0; - } - - TwFreeAsyncDrawing(); // For multi-thread savety - - switch( _State ) - { - case TW_STATE_SHOWN: - g_TwMgr->Unhide(_Bar); - return 1; - case TW_STATE_ICONIFIED: - //g_TwMgr->Unhide(_Bar); - g_TwMgr->Minimize(_Bar); - return 1; - case TW_STATE_HIDDEN: - //g_TwMgr->Maximize(_Bar); - g_TwMgr->Hide(_Bar); - return 1; - case TW_STATE_UNICONIFIED: - //g_TwMgr->Unhide(_Bar); - g_TwMgr->Maximize(_Bar); - return 1; - default: - g_TwMgr->SetLastError(g_ErrBadParam); - return 0; - } -} - -// --------------------------------------------------------------------------- - -/* -TwState ANT_CALL TwGetBarState(const TwBar *_Bar) -{ - if( g_TwMgr==NULL ) - { - TwGlobalError(g_ErrNotInit); - return TW_STATE_ERROR; // not initialized - } - if( _Bar==NULL ) - { - g_TwMgr->SetLastError(g_ErrBadParam); - return TW_STATE_ERROR; - } - - if( !_Bar->m_Visible ) - return TW_STATE_HIDDEN; - else if( _Bar->IsMinimized() ) - return TW_STATE_ICONIFIED; - else - return TW_STATE_SHOWN; -} -*/ - -// --------------------------------------------------------------------------- - -const char * ANT_CALL TwGetBarName(const TwBar *_Bar) -{ - if( g_TwMgr==NULL ) - { - TwGlobalError(g_ErrNotInit); - return NULL; // not initialized - } - if( _Bar==NULL ) - { - g_TwMgr->SetLastError(g_ErrBadParam); - return NULL; - } - vector::iterator BarIt; - int i = 0; - for( BarIt=g_TwMgr->m_Bars.begin(); BarIt!=g_TwMgr->m_Bars.end(); ++BarIt, ++i ) - if( (*BarIt)==_Bar ) - break; - if( BarIt==g_TwMgr->m_Bars.end() ) - { - g_TwMgr->SetLastError(g_ErrNotFound); - return NULL; - } - - return _Bar->m_Name.c_str(); -} - -// --------------------------------------------------------------------------- - -int ANT_CALL TwGetBarCount() -{ - if( g_TwMgr==NULL ) - { - TwGlobalError(g_ErrNotInit); - return 0; // not initialized - } - - return (int)g_TwMgr->m_Bars.size(); -} - - -// --------------------------------------------------------------------------- - -TwBar * ANT_CALL TwGetBarByIndex(int index) -{ - if( g_TwMgr==NULL ) - { - TwGlobalError(g_ErrNotInit); - return NULL; // not initialized - } - - if( index>=0 && index<(int)g_TwMgr->m_Bars.size() ) - return g_TwMgr->m_Bars[index]; - else - { - g_TwMgr->SetLastError(g_ErrOutOfRange); - return NULL; - } -} - -// --------------------------------------------------------------------------- - -TwBar * ANT_CALL TwGetBarByName(const char *name) -{ - if( g_TwMgr==NULL ) - { - TwGlobalError(g_ErrNotInit); - return NULL; // not initialized - } - - int idx = g_TwMgr->FindBar(name); - if ( idx>=0 && idx<(int)g_TwMgr->m_Bars.size() ) - return g_TwMgr->m_Bars[idx]; - else - return NULL; -} - -// --------------------------------------------------------------------------- - -int ANT_CALL TwRefreshBar(TwBar *bar) -{ - if( g_TwMgr==NULL ) - { - TwGlobalError(g_ErrNotInit); - return 0; // not initialized - } - if( bar==NULL ) - { - vector::iterator BarIt; - for( BarIt=g_TwMgr->m_Bars.begin(); BarIt!=g_TwMgr->m_Bars.end(); ++BarIt ) - if( *BarIt!=NULL ) - (*BarIt)->NotUpToDate(); - } - else - { - vector::iterator BarIt; - int i = 0; - for( BarIt=g_TwMgr->m_Bars.begin(); BarIt!=g_TwMgr->m_Bars.end(); ++BarIt, ++i ) - if( (*BarIt)==bar ) - break; - if( BarIt==g_TwMgr->m_Bars.end() ) - { - g_TwMgr->SetLastError(g_ErrNotFound); - return 0; - } - - bar->NotUpToDate(); - } - return 1; -} - -// --------------------------------------------------------------------------- - -int BarVarHasAttrib(CTwBar *_Bar, CTwVar *_Var, const char *_Attrib, bool *_HasValue); -int BarVarSetAttrib(CTwBar *_Bar, CTwVar *_Var, CTwVarGroup *_VarParent, int _VarIndex, int _AttribID, const char *_Value); -ERetType BarVarGetAttrib(CTwBar *_Bar, CTwVar *_Var, CTwVarGroup *_VarParent, int _VarIndex, int _AttribID, std::vector& outDouble, std::ostringstream& outString); - - -int ANT_CALL TwGetParam(TwBar *bar, const char *varName, const char *paramName, TwParamValueType paramValueType, unsigned int outValueMaxCount, void *outValues) -{ - CTwFPU fpu; // force fpu precision - - if( g_TwMgr==NULL ) - { - TwGlobalError(g_ErrNotInit); - return 0; // not initialized - } - if( paramName==NULL || strlen(paramName)<=0 ) - { - g_TwMgr->SetLastError(g_ErrBadParam); - return 0; - } - if( outValueMaxCount<=0 || outValues==NULL ) - { - g_TwMgr->SetLastError(g_ErrBadParam); - return 0; - } - - if( bar==NULL ) - bar = TW_GLOBAL_BAR; - else - { - vector::iterator barIt; - int i = 0; - for( barIt=g_TwMgr->m_Bars.begin(); barIt!=g_TwMgr->m_Bars.end(); ++barIt, ++i ) - if( (*barIt)==bar ) - break; - if( barIt==g_TwMgr->m_Bars.end() ) - { - g_TwMgr->SetLastError(g_ErrNotFound); - return 0; - } - } - CTwVarGroup *varParent = NULL; - int varIndex = -1; - CTwVar *var = NULL; - if( varName!=NULL && strlen(varName)>0 ) - { - var = bar->Find(varName, &varParent, &varIndex); - if( var==NULL ) - { - _snprintf(g_ErrParse, sizeof(g_ErrParse), "Unknown var '%s/%s'", - (bar==TW_GLOBAL_BAR) ? "GLOBAL" : bar->m_Name.c_str(), varName); - g_ErrParse[sizeof(g_ErrParse)-1] = '\0'; - g_TwMgr->SetLastError(g_ErrParse); - return 0; - } - } - - bool hasValue = false; - int paramID = BarVarHasAttrib(bar, var, paramName, &hasValue); - if( paramID>0 ) - { - std::ostringstream valStr; - std::vector valDbl; - const char *PrevLastErrorPtr = g_TwMgr->CheckLastError(); - - ERetType retType = BarVarGetAttrib(bar, var, varParent, varIndex, paramID, valDbl, valStr); - unsigned int i, valDblCount = (unsigned int)valDbl.size(); - if( valDblCount > outValueMaxCount ) - valDblCount = outValueMaxCount; - if( retType==RET_DOUBLE && valDblCount==0 ) - { - g_TwMgr->SetLastError(g_ErrHasNoValue); - retType = RET_ERROR; - } - - if( retType==RET_DOUBLE ) - { - switch( paramValueType ) - { - case TW_PARAM_INT32: - for( i=0; i(outValues))[i] = (int)valDbl[i]; - return valDblCount; - case TW_PARAM_FLOAT: - for( i=0; i(outValues))[i] = (float)valDbl[i]; - return valDblCount; - case TW_PARAM_DOUBLE: - for( i=0; i(outValues))[i] = valDbl[i]; - return valDblCount; - case TW_PARAM_CSTRING: - valStr.clear(); - for( i=0; i<(unsigned int)valDbl.size(); i++ ) // not valDblCount here - valStr << ((i>0) ? " " : "") << valDbl[i]; - strncpy(static_cast(outValues), valStr.str().c_str(), outValueMaxCount); - i = (unsigned int)valStr.str().size(); - if( i>outValueMaxCount-1 ) - i = outValueMaxCount-1; - (static_cast(outValues))[i] = '\0'; - return 1; // always returns 1 for CSTRING - default: - g_TwMgr->SetLastError(g_ErrBadParam); // Unknown param value type - retType = RET_ERROR; - } - } - else if( retType==RET_STRING ) - { - if( paramValueType == TW_PARAM_CSTRING ) - { - strncpy(static_cast(outValues), valStr.str().c_str(), outValueMaxCount); - i = (unsigned int)valStr.str().size(); - if( i>outValueMaxCount-1 ) - i = outValueMaxCount-1; - (static_cast(outValues))[i] = '\0'; - return 1; // always returns 1 for CSTRING - } - else - { - g_TwMgr->SetLastError(g_ErrBadType); // string cannot be converted to int or double - retType = RET_ERROR; - } - } - - if( retType==RET_ERROR ) - { - bool errMsg = (g_TwMgr->CheckLastError()!=NULL && strlen(g_TwMgr->CheckLastError())>0 && PrevLastErrorPtr!=g_TwMgr->CheckLastError()); - _snprintf(g_ErrParse, sizeof(g_ErrParse), "Unable to get param '%s%s%s %s' %s%s", - (bar==TW_GLOBAL_BAR) ? "GLOBAL" : bar->m_Name.c_str(), (var!=NULL) ? "/" : "", - (var!=NULL) ? varName : "", paramName, errMsg ? " : " : "", - errMsg ? g_TwMgr->CheckLastError() : ""); - g_ErrParse[sizeof(g_ErrParse)-1] = '\0'; - g_TwMgr->SetLastError(g_ErrParse); - } - return retType; - } - else - { - _snprintf(g_ErrParse, sizeof(g_ErrParse), "Unknown param '%s%s%s %s'", - (bar==TW_GLOBAL_BAR) ? "GLOBAL" : bar->m_Name.c_str(), - (var!=NULL) ? "/" : "", (var!=NULL) ? varName : "", paramName); - g_ErrParse[sizeof(g_ErrParse)-1] = '\0'; - g_TwMgr->SetLastError(g_ErrParse); - return 0; - } -} - - -int ANT_CALL TwSetParam(TwBar *bar, const char *varName, const char *paramName, TwParamValueType paramValueType, unsigned int inValueCount, const void *inValues) -{ - CTwFPU fpu; // force fpu precision - - if( g_TwMgr==NULL ) - { - TwGlobalError(g_ErrNotInit); - return 0; // not initialized - } - if( paramName==NULL || strlen(paramName)<=0 ) - { - g_TwMgr->SetLastError(g_ErrBadParam); - return 0; - } - if( inValueCount>0 && inValues==NULL ) - { - g_TwMgr->SetLastError(g_ErrBadParam); - return 0; - } - - TwFreeAsyncDrawing(); // For multi-thread savety - - if( bar==NULL ) - bar = TW_GLOBAL_BAR; - else - { - vector::iterator barIt; - int i = 0; - for( barIt=g_TwMgr->m_Bars.begin(); barIt!=g_TwMgr->m_Bars.end(); ++barIt, ++i ) - if( (*barIt)==bar ) - break; - if( barIt==g_TwMgr->m_Bars.end() ) - { - g_TwMgr->SetLastError(g_ErrNotFound); - return 0; - } - } - CTwVarGroup *varParent = NULL; - int varIndex = -1; - CTwVar *var = NULL; - if( varName!=NULL && strlen(varName)>0 ) - { - var = bar->Find(varName, &varParent, &varIndex); - if( var==NULL ) - { - _snprintf(g_ErrParse, sizeof(g_ErrParse), "Unknown var '%s/%s'", - (bar==TW_GLOBAL_BAR) ? "GLOBAL" : bar->m_Name.c_str(), varName); - g_ErrParse[sizeof(g_ErrParse)-1] = '\0'; - g_TwMgr->SetLastError(g_ErrParse); - return 0; - } - } - - bool hasValue = false; - int paramID = BarVarHasAttrib(bar, var, paramName, &hasValue); - if( paramID>0 ) - { - int ret = 0; - const char *PrevLastErrorPtr = g_TwMgr->CheckLastError(); - if( hasValue ) - { - std::ostringstream valuesStr; - unsigned int i; - switch( paramValueType ) - { - case TW_PARAM_INT32: - for( i=0; i(inValues))[i] << ((i(inValues))[i] << ((i(inValues))[i] << ((i(inValues))[i]; - for( const char *ch = str; *ch!=0; ch++ ) - if( *ch=='`' ) - valuesStr << "`'`'`"; - else - valuesStr << *ch; - valuesStr << "` "; - } - */ - if( inValueCount!=1 ) - { - g_TwMgr->SetLastError(g_ErrCStrParam); // count for CString param must be 1 - return 0; - } - else - valuesStr << static_cast(inValues); - break; - default: - g_TwMgr->SetLastError(g_ErrBadParam); // Unknown param value type - return 0; - } - ret = BarVarSetAttrib(bar, var, varParent, varIndex, paramID, valuesStr.str().c_str()); - } - else - ret = BarVarSetAttrib(bar, var, varParent, varIndex, paramID, NULL); - if( ret==0 ) - { - bool errMsg = (g_TwMgr->CheckLastError()!=NULL && strlen(g_TwMgr->CheckLastError())>0 && PrevLastErrorPtr!=g_TwMgr->CheckLastError()); - _snprintf(g_ErrParse, sizeof(g_ErrParse), "Unable to set param '%s%s%s %s' %s%s", - (bar==TW_GLOBAL_BAR) ? "GLOBAL" : bar->m_Name.c_str(), (var!=NULL) ? "/" : "", - (var!=NULL) ? varName : "", paramName, errMsg ? " : " : "", - errMsg ? g_TwMgr->CheckLastError() : ""); - g_ErrParse[sizeof(g_ErrParse)-1] = '\0'; - g_TwMgr->SetLastError(g_ErrParse); - } - return ret; - } - else - { - _snprintf(g_ErrParse, sizeof(g_ErrParse), "Unknown param '%s%s%s %s'", - (bar==TW_GLOBAL_BAR) ? "GLOBAL" : bar->m_Name.c_str(), - (var!=NULL) ? "/" : "", (var!=NULL) ? varName : "", paramName); - g_ErrParse[sizeof(g_ErrParse)-1] = '\0'; - g_TwMgr->SetLastError(g_ErrParse); - return 0; - } -} - -// --------------------------------------------------------------------------- - -static int s_PassProxy = 0; -void *CTwMgr::CStruct::s_PassProxyAsClientData = &s_PassProxy; // special tag - -CTwMgr::CStructProxy::CStructProxy() -{ - memset(this, 0, sizeof(*this)); -} - -CTwMgr::CStructProxy::~CStructProxy() -{ - if( m_StructData!=NULL && m_DeleteStructData ) - { - //if( m_StructExtData==NULL && g_TwMgr!=NULL && m_Type>=TW_TYPE_STRUCT_BASE && m_Typem_Structs.size() ) - // g_TwMgr->UninitVarData(m_Type, m_StructData, g_TwMgr->m_Structs[m_Type-TW_TYPE_STRUCT_BASE].m_Size); - delete[] (char*)m_StructData; - } - if( m_StructExtData!=NULL ) - { - //if( g_TwMgr!=NULL && m_Type>=TW_TYPE_STRUCT_BASE && m_Typem_Structs.size() ) - // g_TwMgr->UninitVarData(m_Type, m_StructExtData, g_TwMgr->m_Structs[m_Type-TW_TYPE_STRUCT_BASE].m_Size); - delete[] (char*)m_StructExtData; - } - memset(this, 0, sizeof(*this)); -} - -/* -void CTwMgr::InitVarData(TwType _Type, void *_Data, size_t _Size) -{ - if( _Data!=NULL ) - { - if( _Type>=TW_TYPE_STRUCT_BASE && _Type=TW_TYPE_STRUCT_BASE && _Type~string(); - memset(_Data, 0, _Size); - } - else - memset(_Data, 0, _Size); - } -} -*/ - -void CTwMgr::UnrollCDStdString(std::vector& _Records, TwType _Type, void *_Data) -{ - if( _Data!=NULL ) - { - if( _Type>=TW_TYPE_STRUCT_BASE && _Type& _Records) -{ - for( size_t i=0; i<_Records.size(); ++i ) - memcpy(_Records[i].m_DataPtr, _Records[i].m_PrevValue, m_ClientStdStringStructSize); -} - -CTwMgr::CMemberProxy::CMemberProxy() -{ - memset(this, 0, sizeof(*this)); -} - -CTwMgr::CMemberProxy::~CMemberProxy() -{ - memset(this, 0, sizeof(*this)); -} - -void ANT_CALL CTwMgr::CMemberProxy::SetCB(const void *_Value, void *_ClientData) -{ - if( _ClientData && _Value ) - { - const CMemberProxy *mProxy = static_cast(_ClientData); - if( g_TwMgr && mProxy ) - { - const CStructProxy *sProxy = mProxy->m_StructProxy; - if( sProxy && sProxy->m_StructData && sProxy->m_Type>=TW_TYPE_STRUCT_BASE && sProxy->m_Typem_Structs.size() ) - { - CTwMgr::CStruct& s = g_TwMgr->m_Structs[sProxy->m_Type-TW_TYPE_STRUCT_BASE]; - if( mProxy->m_MemberIndex>=0 && mProxy->m_MemberIndex<(int)s.m_Members.size() ) - { - CTwMgr::CStructMember& m = s.m_Members[mProxy->m_MemberIndex]; - if( m.m_Size>0 && m.m_Type!=TW_TYPE_BUTTON ) - { - if( s.m_IsExt ) - { - memcpy((char *)sProxy->m_StructExtData + m.m_Offset, _Value, m.m_Size); - if( s.m_CopyVarFromExtCallback && sProxy->m_StructExtData ) - s.m_CopyVarFromExtCallback(sProxy->m_StructData, sProxy->m_StructExtData, mProxy->m_MemberIndex, (s.m_ExtClientData==s.s_PassProxyAsClientData) ? _ClientData : s.m_ExtClientData); - } - else - memcpy((char *)sProxy->m_StructData + m.m_Offset, _Value, m.m_Size); - if( sProxy->m_StructSetCallback ) - { - g_TwMgr->m_CDStdStringRecords.resize(0); - g_TwMgr->UnrollCDStdString(g_TwMgr->m_CDStdStringRecords, sProxy->m_Type, sProxy->m_StructData); - sProxy->m_StructSetCallback(sProxy->m_StructData, sProxy->m_StructClientData); - g_TwMgr->RestoreCDStdString(g_TwMgr->m_CDStdStringRecords); - } - } - } - } - } - } -} - -void ANT_CALL CTwMgr::CMemberProxy::GetCB(void *_Value, void *_ClientData) -{ - if( _ClientData && _Value ) - { - const CMemberProxy *mProxy = static_cast(_ClientData); - if( g_TwMgr && mProxy ) - { - const CStructProxy *sProxy = mProxy->m_StructProxy; - if( sProxy && sProxy->m_StructData && sProxy->m_Type>=TW_TYPE_STRUCT_BASE && sProxy->m_Typem_Structs.size() ) - { - CTwMgr::CStruct& s = g_TwMgr->m_Structs[sProxy->m_Type-TW_TYPE_STRUCT_BASE]; - if( mProxy->m_MemberIndex>=0 && mProxy->m_MemberIndex<(int)s.m_Members.size() ) - { - CTwMgr::CStructMember& m = s.m_Members[mProxy->m_MemberIndex]; - if( m.m_Size>0 && m.m_Type!=TW_TYPE_BUTTON ) - { - if( sProxy->m_StructGetCallback ) - sProxy->m_StructGetCallback(sProxy->m_StructData, sProxy->m_StructClientData); - if( s.m_IsExt ) - { - if( s.m_CopyVarToExtCallback && sProxy->m_StructExtData ) - s.m_CopyVarToExtCallback(sProxy->m_StructData, sProxy->m_StructExtData, mProxy->m_MemberIndex, (s.m_ExtClientData==s.s_PassProxyAsClientData) ? _ClientData : s.m_ExtClientData); - memcpy(_Value, (char *)sProxy->m_StructExtData + m.m_Offset, m.m_Size); - } - else - memcpy(_Value, (char *)sProxy->m_StructData + m.m_Offset, m.m_Size); - } - } - } - } - } -} - -// --------------------------------------------------------------------------- - -void ANT_CALL CTwMgr::CCDStdString::SetCB(const void *_Value, void *_ClientData) -{ - if( _Value==NULL || _ClientData==NULL || g_TwMgr==NULL ) - return; - CTwMgr::CCDStdString *CDStdString = (CTwMgr::CCDStdString *)_ClientData; - const char *SrcStr = *(const char **)_Value; - if( SrcStr==NULL ) - { - static char s_EmptyString[] = ""; - SrcStr = s_EmptyString; - } - if( CDStdString->m_ClientSetCallback==NULL ) - { - if( g_TwMgr->m_CopyStdStringToClient && CDStdString->m_ClientStdStringPtr!=NULL ) - { - CTwMgr::CClientStdString clientSrcStr; // convert VC++ Release/Debug std::string - clientSrcStr.FromLib(SrcStr); - g_TwMgr->m_CopyStdStringToClient(*(CDStdString->m_ClientStdStringPtr), clientSrcStr.ToClient()); - } - } - else - { - if( CDStdString->m_ClientSetCallback==CMemberProxy::SetCB ) - CDStdString->m_ClientSetCallback(&SrcStr, CDStdString->m_ClientData); - else - { - CTwMgr::CClientStdString clientSrcStr; // convert VC++ Release/Debug std::string - clientSrcStr.FromLib(SrcStr); - std::string& ValStr = clientSrcStr.ToClient(); - CDStdString->m_ClientSetCallback(&ValStr, CDStdString->m_ClientData); - } - } -} - -void ANT_CALL CTwMgr::CCDStdString::GetCB(void *_Value, void *_ClientData) -{ - if( _Value==NULL || _ClientData==NULL || g_TwMgr==NULL ) - return; - CTwMgr::CCDStdString *CDStdString = (CTwMgr::CCDStdString *)_ClientData; - char **DstStrPtr = (char **)_Value; - if( CDStdString->m_ClientGetCallback==NULL ) - { - if( CDStdString->m_ClientStdStringPtr!=NULL ) - { - //*DstStrPtr = const_cast(CDStdString->m_ClientStdStringPtr->c_str()); - static CTwMgr::CLibStdString s_LibStr; // static because it will be used as a returned value - s_LibStr.FromClient(*CDStdString->m_ClientStdStringPtr); - *DstStrPtr = const_cast(s_LibStr.ToLib().c_str()); - } - else - { - static char s_EmptyString[] = ""; - *DstStrPtr = s_EmptyString; - } - } - else - { - // m_ClientGetCallback uses TwCopyStdStringToLibrary to copy string - // and TwCopyStdStringToLibrary does the VC++ Debug/Release std::string conversion. - CDStdString->m_ClientGetCallback(&(CDStdString->m_LocalString[0]), CDStdString->m_ClientData); - //*DstStrPtr = const_cast(CDStdString->m_LocalString.c_str()); - char **StrPtr = (char **)&(CDStdString->m_LocalString[0]); - *DstStrPtr = *StrPtr; - } -} - -// --------------------------------------------------------------------------- - -static int s_SeparatorTag = 0; - -// --------------------------------------------------------------------------- - -static int AddVar(TwBar *_Bar, const char *_Name, ETwType _Type, void *_VarPtr, bool _ReadOnly, TwSetVarCallback _SetCallback, TwGetVarCallback _GetCallback, TwButtonCallback _ButtonCallback, void *_ClientData, const char *_Def) -{ - CTwFPU fpu; // force fpu precision - - if( g_TwMgr==NULL ) - { - TwGlobalError(g_ErrNotInit); - return 0; // not initialized - } - - char unnamedVarName[64]; - if( _Name==NULL || strlen(_Name)==0 ) // create a name automatically - { - static unsigned int s_UnnamedVarCount = 0; - _snprintf(unnamedVarName, sizeof(unnamedVarName), "TW_UNNAMED_%04X", s_UnnamedVarCount); - _Name = unnamedVarName; - ++s_UnnamedVarCount; - } - - if( _Bar==NULL || _Name==NULL || strlen(_Name)==0 || (_VarPtr==NULL && _GetCallback==NULL && _Type!=TW_TYPE_BUTTON) ) - { - g_TwMgr->SetLastError(g_ErrBadParam); - return 0; - } - if( _Bar->Find(_Name)!=NULL ) - { - g_TwMgr->SetLastError(g_ErrExist); - return 0; - } - - if( strstr(_Name, "`")!=NULL ) - { - g_TwMgr->SetLastError(g_ErrNoBackQuote); - return 0; - } - - if( _VarPtr==NULL && _Type!=TW_TYPE_BUTTON && _GetCallback!=NULL && _SetCallback==NULL ) - _ReadOnly = true; // force readonly in this case - - // Convert color types - if( _Type==TW_TYPE_COLOR32 ) - _Type = g_TwMgr->m_TypeColor32; - else if( _Type==TW_TYPE_COLOR3F ) - _Type = g_TwMgr->m_TypeColor3F; - else if( _Type==TW_TYPE_COLOR4F ) - _Type = g_TwMgr->m_TypeColor4F; - - // Convert rotation types - if( _Type==TW_TYPE_QUAT4F ) - _Type = g_TwMgr->m_TypeQuat4F; - else if( _Type==TW_TYPE_QUAT4D ) - _Type = g_TwMgr->m_TypeQuat4D; - else if( _Type==TW_TYPE_DIR3F ) - _Type = g_TwMgr->m_TypeDir3F; - else if( _Type==TW_TYPE_DIR3D ) - _Type = g_TwMgr->m_TypeDir3D; - - // VC++ uses a different definition of std::string in Debug and Release modes. - // sizeof(std::string) is encoded in TW_TYPE_STDSTRING to overcome this issue. - // With VS2010 the binary representation of std::string has changed too. This is - // also detected here. - if( (_Type&0xffff0000)==(TW_TYPE_STDSTRING&0xffff0000) || (_Type&0xffff0000)==TW_TYPE_STDSTRING_VS2010 || (_Type&0xffff0000)==TW_TYPE_STDSTRING_VS2008 ) - { - if( g_TwMgr->m_ClientStdStringBaseType==0 ) - g_TwMgr->m_ClientStdStringBaseType = (TwType)(_Type&0xffff0000); - - size_t clientStdStringStructSize = (_Type&0xffff); - if( g_TwMgr->m_ClientStdStringStructSize==0 ) - g_TwMgr->m_ClientStdStringStructSize = clientStdStringStructSize; - int diff = abs((int)g_TwMgr->m_ClientStdStringStructSize - (int)sizeof(std::string)); - if( g_TwMgr->m_ClientStdStringStructSize!=clientStdStringStructSize || g_TwMgr->m_ClientStdStringStructSize==0 - || (diff!=0 && diff!=sizeof(void*))) - { - g_TwMgr->SetLastError(g_ErrStdString); - return 0; - } - - _Type = TW_TYPE_STDSTRING; // force type to be our TW_TYPE_STDSTRING - } - - if( _Type==TW_TYPE_STDSTRING ) - { - g_TwMgr->m_CDStdStrings.push_back(CTwMgr::CCDStdString()); - CTwMgr::CCDStdString& CDStdString = g_TwMgr->m_CDStdStrings.back(); - CDStdString.m_ClientStdStringPtr = (std::string *)_VarPtr; - CDStdString.m_ClientSetCallback = _SetCallback; - CDStdString.m_ClientGetCallback = _GetCallback; - CDStdString.m_ClientData = _ClientData; - //CDStdString.m_This = g_TwMgr->m_CDStdStrings.end(); - //--CDStdString.m_This; - TwGetVarCallback GetCB = CTwMgr::CCDStdString::GetCB; - TwSetVarCallback SetCB = CTwMgr::CCDStdString::SetCB; - if( _VarPtr==NULL && _SetCallback==NULL ) - SetCB = NULL; - if( _VarPtr==NULL && _GetCallback==NULL ) - GetCB = NULL; - return AddVar(_Bar, _Name, TW_TYPE_CDSTDSTRING, NULL, _ReadOnly, SetCB, GetCB, NULL, &CDStdString, _Def); - } - else if( (_Type>TW_TYPE_UNDEF && _Type=TW_TYPE_ENUM_BASE && _Typem_Enums.size()) - || (_Type>TW_TYPE_CSSTRING_BASE && _Type<=TW_TYPE_CSSTRING_MAX) - || _Type==TW_TYPE_CDSTDSTRING - || IsCustomType(_Type) ) // (_Type>=TW_TYPE_CUSTOM_BASE && _Typem_Customs.size()) ) - { - CTwVarAtom *Var = new CTwVarAtom; - Var->m_Name = _Name; - Var->m_Ptr = _VarPtr; - Var->m_Type = _Type; - Var->m_ColorPtr = &(_Bar->m_ColLabelText); - if( _VarPtr!=NULL ) - { - assert( _GetCallback==NULL && _SetCallback==NULL && _ButtonCallback==NULL ); - - Var->m_ReadOnly = _ReadOnly; - Var->m_GetCallback = NULL; - Var->m_SetCallback = NULL; - Var->m_ClientData = NULL; - } - else - { - assert( _GetCallback!=NULL || _Type==TW_TYPE_BUTTON ); - - Var->m_GetCallback = _GetCallback; - Var->m_SetCallback = _SetCallback; - Var->m_ClientData = _ClientData; - if( _Type==TW_TYPE_BUTTON ) - { - Var->m_Val.m_Button.m_Callback = _ButtonCallback; - if( _ButtonCallback==NULL && _ClientData==&s_SeparatorTag ) - { - Var->m_Val.m_Button.m_Separator = 1; - Var->m_Label = " "; - } - else if( _ButtonCallback==NULL ) - Var->m_ColorPtr = &(_Bar->m_ColStaticText); - } - if( _Type!=TW_TYPE_BUTTON ) - Var->m_ReadOnly = (_SetCallback==NULL || _ReadOnly); - else - Var->m_ReadOnly = (_ButtonCallback==NULL); - } - Var->SetDefaults(); - - if( IsCustomType(_Type) ) // _Type>=TW_TYPE_CUSTOM_BASE && _Typem_Customs.size() ) - { - if( Var->m_GetCallback==CTwMgr::CMemberProxy::GetCB && Var->m_SetCallback==CTwMgr::CMemberProxy::SetCB ) - Var->m_Val.m_Custom.m_MemberProxy = static_cast(Var->m_ClientData); - else - Var->m_Val.m_Custom.m_MemberProxy = NULL; - } - - _Bar->m_VarRoot.m_Vars.push_back(Var); - _Bar->NotUpToDate(); - g_TwMgr->m_HelpBarNotUpToDate = true; - - if( _Def!=NULL && strlen(_Def)>0 ) - { - string d = '`' + _Bar->m_Name + "`/`" + _Name + "` " + _Def; - return TwDefine(d.c_str()); - } - else - return 1; - } - else if(_Type>=TW_TYPE_STRUCT_BASE && _Typem_Structs.size()) - { - CTwMgr::CStruct& s = g_TwMgr->m_Structs[_Type-TW_TYPE_STRUCT_BASE]; - CTwMgr::CStructProxy *sProxy = NULL; - void *vPtr; - if( !s.m_IsExt ) - { - if( _VarPtr!=NULL ) - vPtr = _VarPtr; - else - { - assert( _GetCallback!=NULL || _SetCallback!=NULL ); - assert( s.m_Size>0 ); - vPtr = new char[s.m_Size]; - memset(vPtr, 0, s.m_Size); - // create a new StructProxy - g_TwMgr->m_StructProxies.push_back(CTwMgr::CStructProxy()); - sProxy = &(g_TwMgr->m_StructProxies.back()); - sProxy->m_Type = _Type; - sProxy->m_StructData = vPtr; - sProxy->m_DeleteStructData = true; - sProxy->m_StructSetCallback = _SetCallback; - sProxy->m_StructGetCallback = _GetCallback; - sProxy->m_StructClientData = _ClientData; - sProxy->m_CustomDrawCallback = NULL; - sProxy->m_CustomMouseButtonCallback = NULL; - sProxy->m_CustomMouseMotionCallback = NULL; - sProxy->m_CustomMouseLeaveCallback = NULL; - sProxy->m_CustomCaptureFocus = false; - sProxy->m_CustomIndexFirst = -1; - sProxy->m_CustomIndexLast = -1; - //g_TwMgr->InitVarData(sProxy->m_Type, sProxy->m_StructData, s.m_Size); - } - } - else // s.m_IsExt - { - assert( s.m_Size>0 && s.m_ClientStructSize>0 ); - vPtr = new char[s.m_Size]; // will be m_StructExtData - memset(vPtr, 0, s.m_Size); - // create a new StructProxy - g_TwMgr->m_StructProxies.push_back(CTwMgr::CStructProxy()); - sProxy = &(g_TwMgr->m_StructProxies.back()); - sProxy->m_Type = _Type; - sProxy->m_StructExtData = vPtr; - sProxy->m_StructSetCallback = _SetCallback; - sProxy->m_StructGetCallback = _GetCallback; - sProxy->m_StructClientData = _ClientData; - sProxy->m_CustomDrawCallback = NULL; - sProxy->m_CustomMouseButtonCallback = NULL; - sProxy->m_CustomMouseMotionCallback = NULL; - sProxy->m_CustomMouseLeaveCallback = NULL; - sProxy->m_CustomCaptureFocus = false; - sProxy->m_CustomIndexFirst = -1; - sProxy->m_CustomIndexLast = -1; - //g_TwMgr->InitVarData(sProxy->m_Type, sProxy->m_StructExtData, s.m_Size); - if( _VarPtr!=NULL ) - { - sProxy->m_StructData = _VarPtr; - sProxy->m_DeleteStructData = false; - } - else - { - sProxy->m_StructData = new char[s.m_ClientStructSize]; - memset(sProxy->m_StructData, 0, s.m_ClientStructSize); - sProxy->m_DeleteStructData = true; - //g_TwMgr->InitVarData(ClientStructType, sProxy->m_StructData, s.m_ClientStructSize); //ClientStructType is unknown - } - _VarPtr = NULL; // force use of TwAddVarCB for members - - // init m_StructExtdata - if( s.m_ExtClientData==CTwMgr::CStruct::s_PassProxyAsClientData ) - s.m_StructExtInitCallback(sProxy->m_StructExtData, sProxy); - else - s.m_StructExtInitCallback(sProxy->m_StructExtData, s.m_ExtClientData); - } - - for( int i=0; i<(int)s.m_Members.size(); ++i ) - { - CTwMgr::CStructMember& m = s.m_Members[i]; - string name = string(_Name) + '.' + m.m_Name; - const char *access = ""; - if( _ReadOnly ) - access = "readonly "; - string def = "label=`" + m.m_Name + "` group=`" + _Name + "` " + access; // + m.m_DefString; // member def must be done after group def - if( _VarPtr!=NULL ) - { - if( TwAddVarRW(_Bar, name.c_str(), m.m_Type, (char*)vPtr+m.m_Offset, def.c_str())==0 ) - return 0; - } - else - { - assert( sProxy!=NULL ); - // create a new MemberProxy - g_TwMgr->m_MemberProxies.push_back(CTwMgr::CMemberProxy()); - CTwMgr::CMemberProxy& mProxy = g_TwMgr->m_MemberProxies.back(); - mProxy.m_StructProxy = sProxy; - mProxy.m_MemberIndex = i; - assert( !(s.m_IsExt && (m.m_Type==TW_TYPE_STDSTRING || m.m_Type==TW_TYPE_CDSTDSTRING)) ); // forbidden because this case is not handled by UnrollCDStdString - if( TwAddVarCB(_Bar, name.c_str(), m.m_Type, CTwMgr::CMemberProxy::SetCB, CTwMgr::CMemberProxy::GetCB, &mProxy, def.c_str())==0 ) - return 0; - mProxy.m_Var = _Bar->Find(name.c_str(), &mProxy.m_VarParent, NULL); - mProxy.m_Bar = _Bar; - } - - if( sProxy!=NULL && IsCustomType(m.m_Type) ) // m.m_Type>=TW_TYPE_CUSTOM_BASE && m.m_Typem_Customs.size() ) - { - if( sProxy->m_CustomIndexFirst<0 ) - sProxy->m_CustomIndexFirst = sProxy->m_CustomIndexLast = i; - else - sProxy->m_CustomIndexLast = i; - } - } - char structInfo[64]; - sprintf(structInfo, "typeid=%d valptr=%p close ", _Type, vPtr); - string grpDef = '`' + _Bar->m_Name + "`/`" + _Name + "` " + structInfo; - if( _Def!=NULL && strlen(_Def)>0 ) - grpDef += _Def; - int ret = TwDefine(grpDef.c_str()); - for( int i=0; i<(int)s.m_Members.size(); ++i ) // members must be defined even if grpDef has error - { - CTwMgr::CStructMember& m = s.m_Members[i]; - if( m.m_DefString.length()>0 ) - { - string memberDef = '`' + _Bar->m_Name + "`/`" + _Name + '.' + m.m_Name + "` " + m.m_DefString; - if( !TwDefine(memberDef.c_str()) ) // all members must be defined even if memberDef has error - ret = 0; - } - } - return ret; - } - else - { - if( _Type==TW_TYPE_CSSTRING_BASE ) - g_TwMgr->SetLastError(g_ErrBadSize); // static string of size null - else - g_TwMgr->SetLastError(g_ErrNotFound); - return 0; - } -} - -// --------------------------------------------------------------------------- - -int ANT_CALL TwAddVarRW(TwBar *_Bar, const char *_Name, ETwType _Type, void *_Var, const char *_Def) -{ - return AddVar(_Bar, _Name, _Type, _Var, false, NULL, NULL, NULL, NULL, _Def); -} - -// --------------------------------------------------------------------------- - -int ANT_CALL TwAddVarRO(TwBar *_Bar, const char *_Name, ETwType _Type, const void *_Var, const char *_Def) -{ - return AddVar(_Bar, _Name, _Type, const_cast(_Var), true, NULL, NULL, NULL, NULL, _Def); -} - -// --------------------------------------------------------------------------- - -int ANT_CALL TwAddVarCB(TwBar *_Bar, const char *_Name, ETwType _Type, TwSetVarCallback _SetCallback, TwGetVarCallback _GetCallback, void *_ClientData, const char *_Def) -{ - return AddVar(_Bar, _Name, _Type, NULL, false, _SetCallback, _GetCallback, NULL, _ClientData, _Def); -} - -// --------------------------------------------------------------------------- - -int ANT_CALL TwAddButton(TwBar *_Bar, const char *_Name, TwButtonCallback _Callback, void *_ClientData, const char *_Def) -{ - return AddVar(_Bar, _Name, TW_TYPE_BUTTON, NULL, false, NULL, NULL, _Callback, _ClientData, _Def); -} - -// --------------------------------------------------------------------------- - -int ANT_CALL TwAddSeparator(TwBar *_Bar, const char *_Name, const char *_Def) -{ - return AddVar(_Bar, _Name, TW_TYPE_BUTTON, NULL, true, NULL, NULL, NULL, &s_SeparatorTag, _Def); -} - -// --------------------------------------------------------------------------- - -int ANT_CALL TwRemoveVar(TwBar *_Bar, const char *_Name) -{ - if( g_TwMgr==NULL ) - { - TwGlobalError(g_ErrNotInit); - return 0; // not initialized - } - if( _Bar==NULL || _Name==NULL || strlen(_Name)==0 ) - { - g_TwMgr->SetLastError(g_ErrBadParam); - return 0; - } - - if( g_TwMgr->m_PopupBar!=NULL && _Bar!=g_TwMgr->m_PopupBar ) // delete popup bar first if it exists - { - TwDeleteBar(g_TwMgr->m_PopupBar); - g_TwMgr->m_PopupBar = NULL; - } - - _Bar->StopEditInPlace(); // desactivate EditInPlace - - CTwVarGroup *Parent = NULL; - int Index = -1; - CTwVar *Var = _Bar->Find(_Name, &Parent, &Index); - if( Var!=NULL && Parent!=NULL && Index>=0 ) - { - if( Parent->m_StructValuePtr!=NULL ) - { - g_TwMgr->SetLastError(g_ErrDelStruct); - return 0; - } - - delete Var; - Parent->m_Vars.erase(Parent->m_Vars.begin()+Index); - if( Parent!=&(_Bar->m_VarRoot) && Parent->m_Vars.size()<=0 ) - TwRemoveVar(_Bar, Parent->m_Name.c_str()); - _Bar->NotUpToDate(); - if( _Bar!=g_TwMgr->m_HelpBar ) - g_TwMgr->m_HelpBarNotUpToDate = true; - return 1; - } - - g_TwMgr->SetLastError(g_ErrNotFound); - return 0; -} - -// --------------------------------------------------------------------------- - -int ANT_CALL TwRemoveAllVars(TwBar *_Bar) -{ - if( g_TwMgr==NULL ) - { - TwGlobalError(g_ErrNotInit); - return 0; // not initialized - } - if( _Bar==NULL ) - { - g_TwMgr->SetLastError(g_ErrBadParam); - return 0; - } - - if( g_TwMgr->m_PopupBar!=NULL && _Bar!=g_TwMgr->m_PopupBar && _Bar!=g_TwMgr->m_HelpBar ) // delete popup bar first if it exists - { - TwDeleteBar(g_TwMgr->m_PopupBar); - g_TwMgr->m_PopupBar = NULL; - } - - _Bar->StopEditInPlace(); // desactivate EditInPlace - - for( vector::iterator it=_Bar->m_VarRoot.m_Vars.begin(); it!=_Bar->m_VarRoot.m_Vars.end(); ++it ) - if( *it != NULL ) - { - delete *it; - *it = NULL; - } - _Bar->m_VarRoot.m_Vars.resize(0); - _Bar->NotUpToDate(); - g_TwMgr->m_HelpBarNotUpToDate = true; - return 1; -} - -// --------------------------------------------------------------------------- - -int ParseToken(string& _Token, const char *_Def, int& Line, int& Column, bool _KeepQuotes, bool _EndCR, char _Sep1='\0', char _Sep2='\0') -{ - const char *Cur = _Def; - _Token = ""; - // skip spaces - while( *Cur==' ' || *Cur=='\t' || *Cur=='\r' || *Cur=='\n' ) - { - if( *Cur=='\n' && _EndCR ) - return (int)(Cur-_Def); // a CR has been found - ++Cur; - if( *Cur=='\n' ) - { - ++Line; - Column = 1; - } - else if( *Cur=='\t' ) - Column += g_TabLength; - else if( *Cur!='\r' ) - ++Column; - } - // read token - int QuoteLine=0, QuoteColumn=0; - char Quote = 0; - bool AddChar; - bool LineJustIncremented = false; - while( (Quote==0 && (*Cur!='\0' && *Cur!=' ' && *Cur!='\t' && *Cur!='\r' && *Cur!='\n' && *Cur!=_Sep1 && *Cur!=_Sep2)) - || (Quote!=0 && (*Cur!='\0' /* && *Cur!='\r' && *Cur!='\n' */)) ) // allow multi-line strings - { - LineJustIncremented = false; - AddChar = true; - if( Quote==0 && (*Cur=='\'' || *Cur=='\"' || *Cur=='`') ) - { - Quote = *Cur; - QuoteLine = Line; - QuoteColumn = Column; - AddChar = _KeepQuotes; - } - else if ( Quote!=0 && *Cur==Quote ) - { - Quote = 0; - AddChar = _KeepQuotes; - } - - if( AddChar ) - _Token += *Cur; - ++Cur; - if( *Cur=='\t' ) - Column += g_TabLength; - else if( *Cur=='\n' ) - { - ++Line; - LineJustIncremented = true; - Column = 1; - } - else - ++Column; - } - - if( Quote!=0 ) - { - Line = QuoteLine; - Column = QuoteColumn; - return -(int)(Cur-_Def); // unclosed quote - } - else - { - if( *Cur=='\n' ) - { - if( !LineJustIncremented ) - ++Line; - Column = 1; - } - else if( *Cur=='\t' ) - Column += g_TabLength; - else if( *Cur!='\r' && *Cur!='\0' ) - ++Column; - return (int)(Cur-_Def); - } -} - -// --------------------------------------------------------------------------- - -int GetBarVarFromString(CTwBar **_Bar, CTwVar **_Var, CTwVarGroup **_VarParent, int *_VarIndex, const char *_Str) -{ - *_Bar = NULL; - *_Var = NULL; - *_VarParent = NULL; - *_VarIndex = -1; - vector Names; - string Token; - const char *Cur =_Str; - int l=1, c=1, p=1; - while( *Cur!='\0' && p>0 && Names.size()<=3 ) - { - p = ParseToken(Token, Cur, l, c, false, true, '/', '\\'); - if( p>0 && Token.size()>0 ) - { - Names.push_back(Token); - Cur += p + ((Cur[p]!='\0')?1:0); - } - } - if( p<=0 || (Names.size()!=1 && Names.size()!=2) ) - return 0; // parse error - int BarIdx = g_TwMgr->FindBar(Names[0].c_str()); - if( BarIdx<0 ) - { - if( Names.size()==1 && strcmp(Names[0].c_str(), "GLOBAL")==0 ) - { - *_Bar = TW_GLOBAL_BAR; - return +3; // 'GLOBAL' found - } - else - return -1; // bar not found - } - *_Bar = g_TwMgr->m_Bars[BarIdx]; - if( Names.size()==1 ) - return 1; // bar found, no var name parsed - *_Var = (*_Bar)->Find(Names[1].c_str(), _VarParent, _VarIndex); - if( *_Var==NULL ) - return -2; // var not found - return 2; // bar and var found -} - - -int BarVarHasAttrib(CTwBar *_Bar, CTwVar *_Var, const char *_Attrib, bool *_HasValue) -{ - assert(_Bar!=NULL && _HasValue!=NULL && _Attrib!=NULL && strlen(_Attrib)>0); - *_HasValue = false; - if( _Bar==TW_GLOBAL_BAR ) - { - assert( _Var==NULL ); - return g_TwMgr->HasAttrib(_Attrib, _HasValue); - } - else if( _Var==NULL ) - return _Bar->HasAttrib(_Attrib, _HasValue); - else - return _Var->HasAttrib(_Attrib, _HasValue); -} - - -int BarVarSetAttrib(CTwBar *_Bar, CTwVar *_Var, CTwVarGroup *_VarParent, int _VarIndex, int _AttribID, const char *_Value) -{ - assert(_Bar!=NULL && _AttribID>0); - - /* don't delete popupbar here: if any attrib is changed every frame by the app, popup will not work anymore. - if( g_TwMgr->m_PopupBar!=NULL && _Bar!=g_TwMgr->m_PopupBar && g_TwMgr->m_PopupBar->m_BarLinkedToPopupList==_Bar ) // delete popup bar first if it exists - { - TwDeleteBar(g_TwMgr->m_PopupBar); - g_TwMgr->m_PopupBar = NULL; - } - */ - - if( _Bar==TW_GLOBAL_BAR ) - { - assert( _Var==NULL ); - return g_TwMgr->SetAttrib(_AttribID, _Value); - } - else if( _Var==NULL ) - return _Bar->SetAttrib(_AttribID, _Value); - else - return _Var->SetAttrib(_AttribID, _Value, _Bar, _VarParent, _VarIndex); - // don't make _Bar not-up-to-date here, should be done in SetAttrib if needed to avoid too frequent refreshs -} - - -ERetType BarVarGetAttrib(CTwBar *_Bar, CTwVar *_Var, CTwVarGroup *_VarParent, int _VarIndex, int _AttribID, std::vector& outDoubles, std::ostringstream& outString) -{ - assert(_Bar!=NULL && _AttribID>0); - - if( _Bar==TW_GLOBAL_BAR ) - { - assert( _Var==NULL ); - return g_TwMgr->GetAttrib(_AttribID, outDoubles, outString); - } - else if( _Var==NULL ) - return _Bar->GetAttrib(_AttribID, outDoubles, outString); - else - return _Var->GetAttrib(_AttribID, _Bar, _VarParent, _VarIndex, outDoubles, outString); -} - -// --------------------------------------------------------------------------- - -static inline std::string ErrorPosition(bool _MultiLine, int _Line, int _Column) -{ - if( !_MultiLine ) - return ""; - else - { - char pos[32]; - //_snprintf(pos, sizeof(pos)-1, " line %d column %d", _Line, _Column); - _snprintf(pos, sizeof(pos)-1, " line %d", _Line); (void)_Column; - pos[sizeof(pos)-1] = '\0'; - return pos; - } -} - -// --------------------------------------------------------------------------- - -int ANT_CALL TwDefine(const char *_Def) -{ - CTwFPU fpu; // force fpu precision - - // hack to scale fonts artificially (for retina display for instance) - if( g_TwMgr==NULL && _Def!=NULL ) - { - size_t l = strlen(_Def); - const char *eq = strchr(_Def, '='); - if( eq!=NULL && eq!=_Def && l>0 && l<512 ) - { - char *a = new char[l+1]; - char *b = new char[l+1]; - if( sscanf(_Def, "%s%s", a, b)==2 && strcmp(a, "GLOBAL")==0 ) - { - if( strchr(b, '=') != NULL ) - *strchr(b, '=') = '\0'; - double scal = 1.0; - if( _stricmp(b, "fontscaling")==0 && sscanf(eq+1, "%lf", &scal)==1 && scal>0 ) - { - g_FontScaling = (float)scal; - delete[] a; - delete[] b; - return 1; - } - } - delete[] a; - delete[] b; - } - } - - if( g_TwMgr==NULL ) - { - TwGlobalError(g_ErrNotInit); - return 0; // not initialized - } - if( _Def==NULL ) - { - g_TwMgr->SetLastError(g_ErrBadParam); - return 0; - } - - bool MultiLine = false; - const char *Cur = _Def; - while( *Cur!='\0' ) - { - if( *Cur=='\n' ) - { - MultiLine = true; - break; - } - ++Cur; - } - - int Line = 1; - int Column = 1; - enum EState { PARSE_NAME, PARSE_ATTRIB }; - EState State = PARSE_NAME; - string Token; - string Value; - CTwBar *Bar = NULL; - CTwVar *Var = NULL; - CTwVarGroup *VarParent = NULL; - int VarIndex = -1; - int p; - - Cur = _Def; - while( *Cur!='\0' ) - { - const char *PrevCur = Cur; - p = ParseToken(Token, Cur, Line, Column, (State==PARSE_NAME), (State==PARSE_ATTRIB), (State==PARSE_ATTRIB)?'=':'\0'); - if( p<=0 || Token.size()<=0 ) - { - if( p>0 && Cur[p]=='\0' ) - { - Cur += p; - continue; - } - _snprintf(g_ErrParse, sizeof(g_ErrParse), "Parsing error in def string%s [%-16s...]", ErrorPosition(MultiLine, Line, Column).c_str(), (p<0)?(Cur-p):PrevCur); - g_ErrParse[sizeof(g_ErrParse)-1] = '\0'; - g_TwMgr->SetLastError(g_ErrParse); - return 0; - } - char CurSep = Cur[p]; - Cur += p + ((CurSep!='\0')?1:0); - - if( State==PARSE_NAME ) - { - int Err = GetBarVarFromString(&Bar, &Var, &VarParent, &VarIndex, Token.c_str()); - if( Err<=0 ) - { - if( Err==-1 ) - _snprintf(g_ErrParse, sizeof(g_ErrParse), "Parsing error in def string: Bar not found%s [%-16s...]", ErrorPosition(MultiLine, Line, Column).c_str(), Token.c_str()); - else if( Err==-2 ) - _snprintf(g_ErrParse, sizeof(g_ErrParse), "Parsing error in def string: Variable not found%s [%-16s...]", ErrorPosition(MultiLine, Line, Column).c_str(), Token.c_str()); - else - _snprintf(g_ErrParse, sizeof(g_ErrParse), "Parsing error in def string%s [%-16s...]", ErrorPosition(MultiLine, Line, Column).c_str(), Token.c_str()); - g_ErrParse[sizeof(g_ErrParse)-1] = '\0'; - g_TwMgr->SetLastError(g_ErrParse); - return 0; - } - State = PARSE_ATTRIB; - } - else // State==PARSE_ATTRIB - { - assert(State==PARSE_ATTRIB); - assert(Bar!=NULL); - - bool HasValue = false; - Value = ""; - int AttribID = BarVarHasAttrib(Bar, Var, Token.c_str(), &HasValue); - if( AttribID<=0 ) - { - _snprintf(g_ErrParse, sizeof(g_ErrParse), "Parsing error in def string: Unknown attribute%s [%-16s...]", ErrorPosition(MultiLine, Line, Column).c_str(), Token.c_str()); - g_ErrParse[sizeof(g_ErrParse)-1] = '\0'; - g_TwMgr->SetLastError(g_ErrParse); - return 0; - } - - // special case for backward compatibility - if( HasValue && ( _stricmp(Token.c_str(), "readonly")==0 || _stricmp(Token.c_str(), "hexa")==0 ) ) - { - if( CurSep==' ' || CurSep=='\t' ) - { - const char *ch = Cur; - while( *ch==' ' || *ch=='\t' ) // find next non-space character - ++ch; - if( *ch!='=' ) // if this is not '=' the param has no value - HasValue = false; - } - } - - if( HasValue ) - { - if( CurSep!='=' ) - { - string EqualStr; - p = ParseToken(EqualStr, Cur, Line, Column, true, true, '='); - CurSep = Cur[p]; - if( p<0 || EqualStr.size()>0 || CurSep!='=' ) - { - _snprintf(g_ErrParse, sizeof(g_ErrParse), "Parsing error in def string: '=' not found while reading attribute value%s [%-16s...]", ErrorPosition(MultiLine, Line, Column).c_str(), Token.c_str()); - g_ErrParse[sizeof(g_ErrParse)-1] = '\0'; - g_TwMgr->SetLastError(g_ErrParse); - return 0; - } - Cur += p + 1; - } - p = ParseToken(Value, Cur, Line, Column, false, true); - if( p<=0 ) - { - _snprintf(g_ErrParse, sizeof(g_ErrParse), "Parsing error in def string: can't read attribute value%s [%-16s...]", ErrorPosition(MultiLine, Line, Column).c_str(), Token.c_str()); - g_ErrParse[sizeof(g_ErrParse)-1] = '\0'; - g_TwMgr->SetLastError(g_ErrParse); - return 0; - } - CurSep = Cur[p]; - Cur += p + ((CurSep!='\0')?1:0); - } - const char *PrevLastErrorPtr = g_TwMgr->CheckLastError(); - if( BarVarSetAttrib(Bar, Var, VarParent, VarIndex, AttribID, HasValue?Value.c_str():NULL)==0 ) - { - if( g_TwMgr->CheckLastError()==NULL || strlen(g_TwMgr->CheckLastError())<=0 || g_TwMgr->CheckLastError()==PrevLastErrorPtr ) - _snprintf(g_ErrParse, sizeof(g_ErrParse), "Parsing error in def string: wrong attribute value%s [%-16s...]", ErrorPosition(MultiLine, Line, Column).c_str(), Token.c_str()); - else - _snprintf(g_ErrParse, sizeof(g_ErrParse), "%s%s [%-16s...]", g_TwMgr->CheckLastError(), ErrorPosition(MultiLine, Line, Column).c_str(), Token.c_str()); - g_ErrParse[sizeof(g_ErrParse)-1] = '\0'; - g_TwMgr->SetLastError(g_ErrParse); - return 0; - } - // sweep spaces to detect next attrib - while( *Cur==' ' || *Cur=='\t' || *Cur=='\r' ) - { - ++Cur; - if( *Cur=='\t' ) - Column += g_TabLength; - else if( *Cur!='\r' ) - ++Column; - } - if( *Cur=='\n' ) // new line detected - { - ++Line; - Column = 1; - State = PARSE_NAME; - } - } - } - - g_TwMgr->m_HelpBarNotUpToDate = true; - return 1; -} - -// --------------------------------------------------------------------------- - -TwType ANT_CALL TwDefineEnum(const char *_Name, const TwEnumVal *_EnumValues, unsigned int _NbValues) -{ - CTwFPU fpu; // force fpu precision - - if( g_TwMgr==NULL ) - { - TwGlobalError(g_ErrNotInit); - return TW_TYPE_UNDEF; // not initialized - } - if( _EnumValues==NULL && _NbValues!=0 ) - { - g_TwMgr->SetLastError(g_ErrBadParam); - return TW_TYPE_UNDEF; - } - - if( g_TwMgr->m_PopupBar!=NULL ) // delete popup bar first if it exists - { - TwDeleteBar(g_TwMgr->m_PopupBar); - g_TwMgr->m_PopupBar = NULL; - } - - size_t enumIndex = g_TwMgr->m_Enums.size(); - if( _Name!=NULL && strlen(_Name)>0 ) - for( size_t j=0; jm_Enums.size(); ++j ) - if( strcmp(_Name, g_TwMgr->m_Enums[j].m_Name.c_str())==0 ) - { - enumIndex = j; - break; - } - if( enumIndex==g_TwMgr->m_Enums.size() ) - g_TwMgr->m_Enums.push_back(CTwMgr::CEnum()); - assert( enumIndex>=0 && enumIndexm_Enums.size() ); - CTwMgr::CEnum& e = g_TwMgr->m_Enums[enumIndex]; - if( _Name!=NULL && strlen(_Name)>0 ) - e.m_Name = _Name; - else - e.m_Name = ""; - e.m_Entries.clear(); - for(unsigned int i=0; i<_NbValues; ++i) - { - CTwMgr::CEnum::CEntries::value_type Entry(_EnumValues[i].Value, (_EnumValues[i].Label!=NULL)?_EnumValues[i].Label:""); - pair Result = e.m_Entries.insert(Entry); - if( !Result.second ) - (Result.first)->second = Entry.second; - } - - return TwType( TW_TYPE_ENUM_BASE + enumIndex ); -} - -// --------------------------------------------------------------------------- - -TwType TW_CALL TwDefineEnumFromString(const char *_Name, const char *_EnumString) -{ - if (_EnumString == NULL) - return TwDefineEnum(_Name, NULL, 0); - - // split enumString - stringstream EnumStream(_EnumString); - string Label; - vector Labels; - while( getline(EnumStream, Label, ',') ) { - // trim Label - size_t Start = Label.find_first_not_of(" \n\r\t"); - size_t End = Label.find_last_not_of(" \n\r\t"); - if( Start==string::npos || End==string::npos ) - Label = ""; - else - Label = Label.substr(Start, (End-Start)+1); - // store Label - Labels.push_back(Label); - } - // create TwEnumVal array - vector Vals(Labels.size()); - for( int i=0; i<(int)Labels.size(); i++ ) - { - Vals[i].Value = i; - Vals[i].Label = Labels[i].c_str(); - } - - return TwDefineEnum(_Name, Vals.empty() ? NULL : &(Vals[0]), (unsigned int)Vals.size()); -} - -// --------------------------------------------------------------------------- - -void ANT_CALL CTwMgr::CStruct::DefaultSummary(char *_SummaryString, size_t _SummaryMaxLength, const void *_Value, void *_ClientData) -{ - const CTwVarGroup *varGroup = static_cast(_Value); // special case - if( _SummaryString && _SummaryMaxLength>0 ) - _SummaryString[0] = '\0'; - size_t structIndex = (size_t)(_ClientData); - if( g_TwMgr && _SummaryString && _SummaryMaxLength>2 - && varGroup && static_cast(varGroup)->IsGroup() - && structIndex>=0 && structIndex<=g_TwMgr->m_Structs.size() ) - { - // return g_TwMgr->m_Structs[structIndex].m_Name.c_str(); - CTwMgr::CStruct& s = g_TwMgr->m_Structs[structIndex]; - _SummaryString[0] = '{'; - _SummaryString[1] = '\0'; - bool separator = false; - for( size_t i=0; im_Name + '.' + s.m_Members[i].m_Name; - const CTwVar *var = varGroup->Find(varName.c_str(), NULL, NULL); - if( var ) - { - if( var->IsGroup() ) - { - const CTwVarGroup *grp = static_cast(var); - if( grp->m_SummaryCallback!=NULL ) - { - size_t l = strlen(_SummaryString); - if( separator ) - { - _SummaryString[l++] = ','; - _SummaryString[l++] = '\0'; - } - if( grp->m_SummaryCallback==CTwMgr::CStruct::DefaultSummary ) - grp->m_SummaryCallback(_SummaryString+l, _SummaryMaxLength-l, grp, grp->m_SummaryClientData); - else - grp->m_SummaryCallback(_SummaryString+l, _SummaryMaxLength-l, grp->m_StructValuePtr, grp->m_SummaryClientData); - separator = true; - } - } - else - { - size_t l = strlen(_SummaryString); - if( separator ) - { - _SummaryString[l++] = ','; - _SummaryString[l++] = '\0'; - } - string valString; - const CTwVarAtom *atom = static_cast(var); - atom->ValueToString(&valString); - if( atom->m_Type==TW_TYPE_BOOLCPP || atom->m_Type==TW_TYPE_BOOL8 || atom->m_Type==TW_TYPE_BOOL16 || atom->m_Type==TW_TYPE_BOOL32 ) - { - if (valString == "0") - valString = "-"; - else if (valString == "1") - valString = "\x7f"; // check sign - } - strncat(_SummaryString, valString.c_str(), _SummaryMaxLength-l); - separator = true; - } - if( strlen(_SummaryString)>_SummaryMaxLength-2 ) - break; - } - } - size_t l = strlen(_SummaryString); - if( l>_SummaryMaxLength-2 ) - { - _SummaryString[_SummaryMaxLength-2] = '.'; - _SummaryString[_SummaryMaxLength-1] = '.'; - _SummaryString[_SummaryMaxLength+0] = '\0'; - } - else - { - _SummaryString[l+0] = '}'; - _SummaryString[l+1] = '\0'; - } - } -} - -// --------------------------------------------------------------------------- - -TwType ANT_CALL TwDefineStruct(const char *_StructName, const TwStructMember *_StructMembers, unsigned int _NbMembers, size_t _StructSize, TwSummaryCallback _SummaryCallback, void *_SummaryClientData) -{ - CTwFPU fpu; // force fpu precision - - if( g_TwMgr==NULL ) - { - TwGlobalError(g_ErrNotInit); - return TW_TYPE_UNDEF; // not initialized - } - if( _StructMembers==NULL || _NbMembers==0 || _StructSize==0 ) - { - g_TwMgr->SetLastError(g_ErrBadParam); - return TW_TYPE_UNDEF; - } - - if( _StructName!=NULL && strlen(_StructName)>0 ) - for( size_t j=0; jm_Structs.size(); ++j ) - if( strcmp(_StructName, g_TwMgr->m_Structs[j].m_Name.c_str())==0 ) - { - g_TwMgr->SetLastError(g_ErrExist); - return TW_TYPE_UNDEF; - } - - size_t structIndex = g_TwMgr->m_Structs.size(); - CTwMgr::CStruct s; - s.m_Size = _StructSize; - if( _StructName!=NULL && strlen(_StructName)>0 ) - s.m_Name = _StructName; - else - s.m_Name = ""; - s.m_Members.resize(_NbMembers); - if( _SummaryCallback!=NULL ) - { - s.m_SummaryCallback = _SummaryCallback; - s.m_SummaryClientData = _SummaryClientData; - } - else - { - s.m_SummaryCallback = CTwMgr::CStruct::DefaultSummary; - s.m_SummaryClientData = (void *)(structIndex); - } - for( unsigned int i=0; i<_NbMembers; ++i ) - { - CTwMgr::CStructMember& m = s.m_Members[i]; - if( _StructMembers[i].Name!=NULL ) - m.m_Name = _StructMembers[i].Name; - else - { - char name[16]; - sprintf(name, "%u", i); - m.m_Name = name; - } - m.m_Type = _StructMembers[i].Type; - m.m_Size = 0; // to avoid endless recursivity in GetDataSize - m.m_Size = CTwVar::GetDataSize(m.m_Type); - if( _StructMembers[i].Offset<_StructSize ) - m.m_Offset = _StructMembers[i].Offset; - else - { - g_TwMgr->SetLastError(g_ErrOffset); - return TW_TYPE_UNDEF; - } - if( _StructMembers[i].DefString!=NULL && strlen(_StructMembers[i].DefString)>0 ) - m.m_DefString = _StructMembers[i].DefString; - else - m.m_DefString = ""; - } - - g_TwMgr->m_Structs.push_back(s); - assert( g_TwMgr->m_Structs.size()==structIndex+1 ); - return TwType( TW_TYPE_STRUCT_BASE + structIndex ); -} - -// --------------------------------------------------------------------------- - -TwType ANT_CALL TwDefineStructExt(const char *_StructName, const TwStructMember *_StructExtMembers, unsigned int _NbExtMembers, size_t _StructSize, size_t _StructExtSize, TwStructExtInitCallback _StructExtInitCallback, TwCopyVarFromExtCallback _CopyVarFromExtCallback, TwCopyVarToExtCallback _CopyVarToExtCallback, TwSummaryCallback _SummaryCallback, void *_ClientData, const char *_Help) -{ - CTwFPU fpu; // force fpu precision - - if( g_TwMgr==NULL ) - { - TwGlobalError(g_ErrNotInit); - return TW_TYPE_UNDEF; // not initialized - } - if( _StructSize==0 || _StructExtInitCallback==NULL || _CopyVarFromExtCallback==NULL || _CopyVarToExtCallback==NULL ) - { - g_TwMgr->SetLastError(g_ErrBadParam); - return TW_TYPE_UNDEF; - } - TwType type = TwDefineStruct(_StructName, _StructExtMembers, _NbExtMembers, _StructExtSize, _SummaryCallback, _ClientData); - if( type>=TW_TYPE_STRUCT_BASE && typem_Structs.size() ) - { - CTwMgr::CStruct& s = g_TwMgr->m_Structs[type-TW_TYPE_STRUCT_BASE]; - s.m_IsExt = true; - s.m_ClientStructSize = _StructSize; - s.m_StructExtInitCallback = _StructExtInitCallback; - s.m_CopyVarFromExtCallback = _CopyVarFromExtCallback; - s.m_CopyVarToExtCallback = _CopyVarToExtCallback; - s.m_ExtClientData = _ClientData; - if( _Help!=NULL ) - s.m_Help = _Help; - } - return type; -} - - -// --------------------------------------------------------------------------- - -bool TwGetKeyCode(int *_Code, int *_Modif, const char *_String) -{ - assert(_Code!=NULL && _Modif!=NULL); - bool Ok = true; - *_Modif = TW_KMOD_NONE; - *_Code = 0; - size_t Start = strlen(_String)-1; - if( Start<0 ) - return false; - while( Start>0 && _String[Start-1]!='+' ) - --Start; - while( _String[Start]==' ' || _String[Start]=='\t' ) - ++Start; - char *CodeStr = _strdup(_String+Start); - for( size_t i=strlen(CodeStr)-1; i>=0; ++i ) - if( CodeStr[i]==' ' || CodeStr[i]=='\t' ) - CodeStr[i] = '\0'; - else - break; - - /* - if( strstr(_String, "SHIFT")!=NULL || strstr(_String, "shift")!=NULL ) - *_Modif |= TW_KMOD_SHIFT; - if( strstr(_String, "CTRL")!=NULL || strstr(_String, "ctrl")!=NULL ) - *_Modif |= TW_KMOD_CTRL; - if( strstr(_String, "META")!=NULL || strstr(_String, "meta")!=NULL ) - *_Modif |= TW_KMOD_META; - - if( strstr(_String, "ALTGR")!=NULL || strstr(_String, "altgr")!=NULL ) - ((void)(0)); // *_Modif |= TW_KMOD_ALTGR; - else // ALT and ALTGR are exclusive - if( strstr(_String, "ALT")!=NULL || strstr(_String, "alt")!=NULL ) - *_Modif |= TW_KMOD_ALT; - */ - char *up = _strdup(_String); - // _strupr(up); - for( char *upch=up; *upch!='\0'; ++upch ) - *upch = (char)toupper(*upch); - if( strstr(up, "SHIFT")!=NULL ) - *_Modif |= TW_KMOD_SHIFT; - if( strstr(up, "CTRL")!=NULL ) - *_Modif |= TW_KMOD_CTRL; - if( strstr(up, "META")!=NULL ) - *_Modif |= TW_KMOD_META; - - if( strstr(up, "ALTGR")!=NULL ) - ((void)(0)); // *_Modif |= TW_KMOD_ALTGR; - else // ALT and ALTGR are exclusive - if( strstr(up, "ALT")!=NULL ) - *_Modif |= TW_KMOD_ALT; - free(up); - - if( strlen(CodeStr)==1 ) - *_Code = (unsigned char)(CodeStr[0]); - else if( _stricmp(CodeStr, "backspace")==0 || _stricmp(CodeStr, "bs")==0 ) - *_Code = TW_KEY_BACKSPACE; - else if( _stricmp(CodeStr, "tab")==0 ) - *_Code = TW_KEY_TAB; - else if( _stricmp(CodeStr, "clear")==0 || _stricmp(CodeStr, "clr")==0 ) - *_Code = TW_KEY_CLEAR; - else if( _stricmp(CodeStr, "return")==0 || _stricmp(CodeStr, "ret")==0 ) - *_Code = TW_KEY_RETURN; - else if( _stricmp(CodeStr, "pause")==0 ) - *_Code = TW_KEY_PAUSE; - else if( _stricmp(CodeStr, "escape")==0 || _stricmp(CodeStr, "esc")==0 ) - *_Code = TW_KEY_ESCAPE; - else if( _stricmp(CodeStr, "space")==0 ) - *_Code = TW_KEY_SPACE; - else if( _stricmp(CodeStr, "delete")==0 || _stricmp(CodeStr, "del")==0 ) - *_Code = TW_KEY_DELETE; - /* - else if( strlen(CodeStr)==4 && CodeStr[3]>='0' && CodeStr[3]<='9' && (strstr(CodeStr, "pad")==CodeStr || strstr(CodeStr, "PAD")==CodeStr) ) - *_Code = TW_KEY_PAD_0 + CodeStr[3]-'0'; - else if( _stricmp(CodeStr, "pad.")==0 ) - *_Code = TW_KEY_PAD_PERIOD; - else if( _stricmp(CodeStr, "pad/")==0 ) - *_Code = TW_KEY_PAD_DIVIDE; - else if( _stricmp(CodeStr, "pad*")==0 ) - *_Code = TW_KEY_PAD_MULTIPLY; - else if( _stricmp(CodeStr, "pad+")==0 ) - *_Code = TW_KEY_PAD_PLUS; - else if( _stricmp(CodeStr, "pad-")==0 ) - *_Code = TW_KEY_PAD_MINUS; - else if( _stricmp(CodeStr, "padenter")==0 ) - *_Code = TW_KEY_PAD_ENTER; - else if( _stricmp(CodeStr, "pad=")==0 ) - *_Code = TW_KEY_PAD_EQUALS; - */ - else if( _stricmp(CodeStr, "up")==0 ) - *_Code = TW_KEY_UP; - else if( _stricmp(CodeStr, "down")==0 ) - *_Code = TW_KEY_DOWN; - else if( _stricmp(CodeStr, "right")==0 ) - *_Code = TW_KEY_RIGHT; - else if( _stricmp(CodeStr, "left")==0 ) - *_Code = TW_KEY_LEFT; - else if( _stricmp(CodeStr, "insert")==0 || _stricmp(CodeStr, "ins")==0 ) - *_Code = TW_KEY_INSERT; - else if( _stricmp(CodeStr, "home")==0 ) - *_Code = TW_KEY_HOME; - else if( _stricmp(CodeStr, "end")==0 ) - *_Code = TW_KEY_END; - else if( _stricmp(CodeStr, "pgup")==0 ) - *_Code = TW_KEY_PAGE_UP; - else if( _stricmp(CodeStr, "pgdown")==0 ) - *_Code = TW_KEY_PAGE_DOWN; - else if( (strlen(CodeStr)==2 || strlen(CodeStr)==3) && (CodeStr[0]=='f' || CodeStr[0]=='F') ) - { - int n = 0; - if( sscanf(CodeStr+1, "%d", &n)==1 && n>0 && n<16 ) - *_Code = TW_KEY_F1 + n-1; - else - Ok = false; - } - - free(CodeStr); - return Ok; -} - -bool TwGetKeyString(std::string *_String, int _Code, int _Modif) -{ - assert(_String!=NULL); - bool Ok = true; - if( _Modif & TW_KMOD_SHIFT ) - *_String += "SHIFT+"; - if( _Modif & TW_KMOD_CTRL ) - *_String += "CTRL+"; - if ( _Modif & TW_KMOD_ALT ) - *_String += "ALT+"; - if ( _Modif & TW_KMOD_META ) - *_String += "META+"; - // if ( _Modif & TW_KMOD_ALTGR ) - // *_String += "ALTGR+"; - switch( _Code ) - { - case TW_KEY_BACKSPACE: - *_String += "BackSpace"; - break; - case TW_KEY_TAB: - *_String += "Tab"; - break; - case TW_KEY_CLEAR: - *_String += "Clear"; - break; - case TW_KEY_RETURN: - *_String += "Return"; - break; - case TW_KEY_PAUSE: - *_String += "Pause"; - break; - case TW_KEY_ESCAPE: - *_String += "Esc"; - break; - case TW_KEY_SPACE: - *_String += "Space"; - break; - case TW_KEY_DELETE: - *_String += "Delete"; - break; - /* - case TW_KEY_PAD_0: - *_String += "PAD0"; - break; - case TW_KEY_PAD_1: - *_String += "PAD1"; - break; - case TW_KEY_PAD_2: - *_String += "PAD2"; - break; - case TW_KEY_PAD_3: - *_String += "PAD3"; - break; - case TW_KEY_PAD_4: - *_String += "PAD4"; - break; - case TW_KEY_PAD_5: - *_String += "PAD5"; - break; - case TW_KEY_PAD_6: - *_String += "PAD6"; - break; - case TW_KEY_PAD_7: - *_String += "PAD7"; - break; - case TW_KEY_PAD_8: - *_String += "PAD8"; - break; - case TW_KEY_PAD_9: - *_String += "PAD9"; - break; - case TW_KEY_PAD_PERIOD: - *_String += "PAD."; - break; - case TW_KEY_PAD_DIVIDE: - *_String += "PAD/"; - break; - case TW_KEY_PAD_MULTIPLY: - *_String += "PAD*"; - break; - case TW_KEY_PAD_MINUS: - *_String += "PAD-"; - break; - case TW_KEY_PAD_PLUS: - *_String += "PAD+"; - break; - case TW_KEY_PAD_ENTER: - *_String += "PADEnter"; - break; - case TW_KEY_PAD_EQUALS: - *_String += "PAD="; - break; - */ - case TW_KEY_UP: - *_String += "Up"; - break; - case TW_KEY_DOWN: - *_String += "Down"; - break; - case TW_KEY_RIGHT: - *_String += "Right"; - break; - case TW_KEY_LEFT: - *_String += "Left"; - break; - case TW_KEY_INSERT: - *_String += "Insert"; - break; - case TW_KEY_HOME: - *_String += "Home"; - break; - case TW_KEY_END: - *_String += "End"; - break; - case TW_KEY_PAGE_UP: - *_String += "PgUp"; - break; - case TW_KEY_PAGE_DOWN: - *_String += "PgDown"; - break; - case TW_KEY_F1: - *_String += "F1"; - break; - case TW_KEY_F2: - *_String += "F2"; - break; - case TW_KEY_F3: - *_String += "F3"; - break; - case TW_KEY_F4: - *_String += "F4"; - break; - case TW_KEY_F5: - *_String += "F5"; - break; - case TW_KEY_F6: - *_String += "F6"; - break; - case TW_KEY_F7: - *_String += "F7"; - break; - case TW_KEY_F8: - *_String += "F8"; - break; - case TW_KEY_F9: - *_String += "F9"; - break; - case TW_KEY_F10: - *_String += "F10"; - break; - case TW_KEY_F11: - *_String += "F11"; - break; - case TW_KEY_F12: - *_String += "F12"; - break; - case TW_KEY_F13: - *_String += "F13"; - break; - case TW_KEY_F14: - *_String += "F14"; - break; - case TW_KEY_F15: - *_String += "F15"; - break; - default: - if( _Code>0 && _Code<256 ) - *_String += char(_Code); - else - { - *_String += "Unknown"; - Ok = false; - } - } - return Ok; -} - -// --------------------------------------------------------------------------- - -const int TW_MOUSE_NOMOTION = -1; -ETwMouseAction TW_MOUSE_MOTION = (ETwMouseAction)(-2); -ETwMouseAction TW_MOUSE_WHEEL = (ETwMouseAction)(-3); -ETwMouseButtonID TW_MOUSE_NA = (ETwMouseButtonID)(-1); - -static int TwMouseEvent(ETwMouseAction _EventType, TwMouseButtonID _Button, int _MouseX, int _MouseY, int _WheelPos) -{ - CTwFPU fpu; // force fpu precision - - if( g_TwMgr==NULL || g_TwMgr->m_Graph==NULL ) - { - // TwGlobalError(g_ErrNotInit); -> not an error here - return 0; // not initialized - } - if( g_TwMgr->m_WndHeight<=0 || g_TwMgr->m_WndWidth<=0 ) - { - //g_TwMgr->SetLastError(g_ErrBadWndSize); // not an error, windows not yet ready. - return 0; - } - - // For multi-thread safety - if( !TwFreeAsyncDrawing() ) - return 0; - - if( _MouseX==TW_MOUSE_NOMOTION ) - _MouseX = g_TwMgr->m_LastMouseX; - else - g_TwMgr->m_LastMouseX = _MouseX; - if( _MouseY==TW_MOUSE_NOMOTION ) - _MouseY = g_TwMgr->m_LastMouseY; - else - g_TwMgr->m_LastMouseY = _MouseY; - - // for autorepeat - if( (!g_TwMgr->m_IsRepeatingMousePressed || !g_TwMgr->m_CanRepeatMousePressed) && _EventType==TW_MOUSE_PRESSED ) - { - g_TwMgr->m_LastMousePressedTime = g_TwMgr->m_Timer.GetTime(); - g_TwMgr->m_LastMousePressedButtonID = _Button; - g_TwMgr->m_LastMousePressedPosition[0] = _MouseX; - g_TwMgr->m_LastMousePressedPosition[1] = _MouseY; - g_TwMgr->m_CanRepeatMousePressed = true; - g_TwMgr->m_IsRepeatingMousePressed = false; - } - else if( _EventType==TW_MOUSE_RELEASED || _EventType==TW_MOUSE_WHEEL ) - { - g_TwMgr->m_CanRepeatMousePressed = false; - g_TwMgr->m_IsRepeatingMousePressed = false; - } - - bool Handled = false; - bool wasPopup = (g_TwMgr->m_PopupBar!=NULL); - CTwBar *Bar = NULL; - int i; - - // search for a bar with mousedrag enabled - CTwBar *BarDragging = NULL; - for( i=((int)g_TwMgr->m_Bars.size())-1; i>=0; --i ) - { - Bar = g_TwMgr->m_Bars[g_TwMgr->m_Order[i]]; - if( Bar!=NULL && Bar->m_Visible && Bar->IsDragging() ) - { - BarDragging = Bar; - break; - } - } - - for( i=(int)g_TwMgr->m_Bars.size(); i>=0; --i ) - { - if( i==(int)g_TwMgr->m_Bars.size() ) // first try the bar with mousedrag enabled (this bar has the focus) - Bar = BarDragging; - else - { - Bar = g_TwMgr->m_Bars[g_TwMgr->m_Order[i]]; - if( Bar==BarDragging ) - continue; - } - if( Bar!=NULL && Bar->m_Visible ) - { - if( _EventType==TW_MOUSE_MOTION ) - Handled = Bar->MouseMotion(_MouseX, _MouseY); - else if( _EventType==TW_MOUSE_PRESSED || _EventType==TW_MOUSE_RELEASED ) - Handled = Bar->MouseButton(_Button, (_EventType==TW_MOUSE_PRESSED), _MouseX, _MouseY); - else if( _EventType==TW_MOUSE_WHEEL ) - { - if( abs(_WheelPos-g_TwMgr->m_LastMouseWheelPos)<4 ) // avoid crazy wheel positions - Handled = Bar->MouseWheel(_WheelPos, g_TwMgr->m_LastMouseWheelPos, _MouseX, _MouseY); - } - if( Handled ) - break; - } - } - - if( g_TwMgr==NULL ) // Mgr might have been destroyed by the client inside a callback call - return 1; - - /* - if( i>=0 && Bar!=NULL && Handled && (_EventType==TW_MOUSE_PRESSED || Bar->IsMinimized()) && i!=((int)g_TwMgr->m_Bars.size())-1 ) - { - int iOrder = g_TwMgr->m_Order[i]; - for( int j=i; j<(int)g_TwMgr->m_Bars.size()-1; ++j ) - g_TwMgr->m_Order[j] = g_TwMgr->m_Order[j+1]; - g_TwMgr->m_Order[(int)g_TwMgr->m_Bars.size()-1] = iOrder; - } - */ - if( _EventType==TW_MOUSE_PRESSED || (Bar!=NULL && Bar->IsMinimized() && Handled) ) - { - if( wasPopup && Bar!=g_TwMgr->m_PopupBar && g_TwMgr->m_PopupBar!=NULL ) // delete popup - { - TwDeleteBar(g_TwMgr->m_PopupBar); - g_TwMgr->m_PopupBar = NULL; - } - - if( i>=0 && Bar!=NULL && Handled && !wasPopup ) - TwSetTopBar(Bar); - } - - if( _EventType==TW_MOUSE_WHEEL ) - g_TwMgr->m_LastMouseWheelPos = _WheelPos; - - return Handled ? 1 : 0; -} - -int ANT_CALL TwMouseButton(ETwMouseAction _EventType, TwMouseButtonID _Button) -{ - return TwMouseEvent(_EventType, _Button, TW_MOUSE_NOMOTION, TW_MOUSE_NOMOTION, 0); -} - -int ANT_CALL TwMouseMotion(int _MouseX, int _MouseY) -{ - return TwMouseEvent(TW_MOUSE_MOTION, TW_MOUSE_NA, _MouseX, _MouseY, 0); -} - -int ANT_CALL TwMouseWheel(int _Pos) -{ - return TwMouseEvent(TW_MOUSE_WHEEL, TW_MOUSE_NA, TW_MOUSE_NOMOTION, TW_MOUSE_NOMOTION, _Pos); -} - -// --------------------------------------------------------------------------- - -static int TranslateKey(int _Key, int _Modifiers) -{ - // CTRL special cases - //if( (_Modifiers&TW_KMOD_CTRL) && !(_Modifiers&TW_KMOD_ALT || _Modifiers&TW_KMOD_META) && _Key>0 && _Key<32 ) - // _Key += 'a'-1; - if( (_Modifiers&TW_KMOD_CTRL) ) - { - if( _Key>='a' && _Key<='z' && ( ((_Modifiers&0x2000) && !(_Modifiers&TW_KMOD_SHIFT)) || (!(_Modifiers&0x2000) && (_Modifiers&TW_KMOD_SHIFT)) )) // 0x2000 is SDL's KMOD_CAPS - _Key += 'A'-'a'; - else if ( _Key>='A' && _Key<='Z' && ( ((_Modifiers&0x2000) && (_Modifiers&TW_KMOD_SHIFT)) || (!(_Modifiers&0x2000) && !(_Modifiers&TW_KMOD_SHIFT)) )) // 0x2000 is SDL's KMOD_CAPS - _Key += 'a'-'A'; - } - - // PAD translation (for SDL keysym) - if( _Key>=256 && _Key<=272 ) // 256=SDLK_KP0 ... 272=SDLK_KP_EQUALS - { - //bool Num = ((_Modifiers&TW_KMOD_SHIFT) && !(_Modifiers&0x1000)) || (!(_Modifiers&TW_KMOD_SHIFT) && (_Modifiers&0x1000)); // 0x1000 is SDL's KMOD_NUM - //_Modifiers &= ~TW_KMOD_SHIFT; // remove shift modifier - bool Num = (!(_Modifiers&TW_KMOD_SHIFT) && (_Modifiers&0x1000)); // 0x1000 is SDL's KMOD_NUM - if( _Key==266 ) // SDLK_KP_PERIOD - _Key = Num ? '.' : TW_KEY_DELETE; - else if( _Key==267 ) // SDLK_KP_DIVIDE - _Key = '/'; - else if( _Key==268 ) // SDLK_KP_MULTIPLY - _Key = '*'; - else if( _Key==269 ) // SDLK_KP_MINUS - _Key = '-'; - else if( _Key==270 ) // SDLK_KP_PLUS - _Key = '+'; - else if( _Key==271 ) // SDLK_KP_ENTER - _Key = TW_KEY_RETURN; - else if( _Key==272 ) // SDLK_KP_EQUALS - _Key = '='; - else if( Num ) // num SDLK_KP0..9 - _Key += '0' - 256; - else if( _Key==256 ) // non-num SDLK_KP01 - _Key = TW_KEY_INSERT; - else if( _Key==257 ) // non-num SDLK_KP1 - _Key = TW_KEY_END; - else if( _Key==258 ) // non-num SDLK_KP2 - _Key = TW_KEY_DOWN; - else if( _Key==259 ) // non-num SDLK_KP3 - _Key = TW_KEY_PAGE_DOWN; - else if( _Key==260 ) // non-num SDLK_KP4 - _Key = TW_KEY_LEFT; - else if( _Key==262 ) // non-num SDLK_KP6 - _Key = TW_KEY_RIGHT; - else if( _Key==263 ) // non-num SDLK_KP7 - _Key = TW_KEY_HOME; - else if( _Key==264 ) // non-num SDLK_KP8 - _Key = TW_KEY_UP; - else if( _Key==265 ) // non-num SDLK_KP9 - _Key = TW_KEY_PAGE_UP; - } - return _Key; -} - -// --------------------------------------------------------------------------- - -static int KeyPressed(int _Key, int _Modifiers, bool _TestOnly) -{ - CTwFPU fpu; // force fpu precision - - if( g_TwMgr==NULL || g_TwMgr->m_Graph==NULL ) - { - // TwGlobalError(g_ErrNotInit); -> not an error here - return 0; // not initialized - } - if( g_TwMgr->m_WndHeight<=0 || g_TwMgr->m_WndWidth<=0 ) - { - //g_TwMgr->SetLastError(g_ErrBadWndSize); // not an error, windows not yet ready. - return 0; - } - - // For multi-thread savety - if( !TwFreeAsyncDrawing() ) - return 0; - - /* - // Test for TwDeleteBar - if( _Key>='0' && _Key<='9' ) - { - int n = _Key-'0'; - if( (int)g_TwMgr->m_Bars.size()>n && g_TwMgr->m_Bars[n]!=NULL ) - { - printf("Delete %s\n", g_TwMgr->m_Bars[n]->m_Name.c_str()); - TwDeleteBar(g_TwMgr->m_Bars[n]); - } - else - printf("can't delete %d\n", n); - return 1; - } - */ - - //char s[256]; - //sprintf(s, "twkeypressed k=%d m=%x\n", _Key, _Modifiers); - //OutputDebugString(s); - - _Key = TranslateKey(_Key, _Modifiers); - if( _Key>' ' && _Key<256 ) // don't test SHIFT if _Key is a common key - _Modifiers &= ~TW_KMOD_SHIFT; - // complete partial modifiers comming from SDL - if( _Modifiers & TW_KMOD_SHIFT ) - _Modifiers |= TW_KMOD_SHIFT; - if( _Modifiers & TW_KMOD_CTRL ) - _Modifiers |= TW_KMOD_CTRL; - if( _Modifiers & TW_KMOD_ALT ) - _Modifiers |= TW_KMOD_ALT; - if( _Modifiers & TW_KMOD_META ) - _Modifiers |= TW_KMOD_META; - - bool Handled = false; - CTwBar *Bar = NULL; - CTwBar *PopupBar = g_TwMgr->m_PopupBar; - //int Order = 0; - int i; - if( _Key>0 && _Keym_LastMouseX; - int MouseY = g_TwMgr->m_LastMouseY; - for( i=((int)g_TwMgr->m_Bars.size())-1; i>=0 && !Handled; --i ) - { - Bar = g_TwMgr->m_Bars[g_TwMgr->m_Order[i]]; - if( Bar!=NULL && Bar->m_Visible && !Bar->IsMinimized() - && ( (MouseX>=Bar->m_PosX && MouseXm_PosX+Bar->m_Width && MouseY>=Bar->m_PosY && MouseYm_PosY+Bar->m_Height) - || Bar==PopupBar) ) - { - if (_TestOnly) - Handled = Bar->KeyTest(_Key, _Modifiers); - else - Handled = Bar->KeyPressed(_Key, _Modifiers); - } - } - - // If not handled, send it to non-iconified bars in the right order - for( i=((int)g_TwMgr->m_Bars.size())-1; i>=0 && !Handled; --i ) - { - Bar = g_TwMgr->m_Bars[g_TwMgr->m_Order[i]]; - /* - for( size_t j=0; jm_Bars.size(); ++j ) - if( g_TwMgr->m_Order[j]==i ) - { - Bar = g_TwMgr->m_Bars[j]; - break; - } - Order = i; - */ - - if( Bar!=NULL && Bar->m_Visible && !Bar->IsMinimized() ) - { - if( _TestOnly ) - Handled = Bar->KeyTest(_Key, _Modifiers); - else - Handled = Bar->KeyPressed(_Key, _Modifiers); - if( g_TwMgr==NULL ) // Mgr might have been destroyed by the client inside a callback call - return 1; - } - } - - // If not handled, send it to iconified bars in the right order - for( i=((int)g_TwMgr->m_Bars.size())-1; i>=0 && !Handled; --i ) - { - Bar = g_TwMgr->m_Bars[g_TwMgr->m_Order[i]]; - if( Bar!=NULL && Bar->m_Visible && Bar->IsMinimized() ) - { - if( _TestOnly ) - Handled = Bar->KeyTest(_Key, _Modifiers); - else - Handled = Bar->KeyPressed(_Key, _Modifiers); - } - } - - if( g_TwMgr->m_HelpBar!=NULL && g_TwMgr->m_Graph && !_TestOnly ) - { - string Str; - TwGetKeyString(&Str, _Key, _Modifiers); - char Msg[256]; - sprintf(Msg, "Key pressed: %s", Str.c_str()); - g_TwMgr->m_KeyPressedStr = Msg; - g_TwMgr->m_KeyPressedBuildText = true; - // OutputDebugString(Msg); - } - } - - if( Handled && Bar!=g_TwMgr->m_PopupBar && g_TwMgr->m_PopupBar!=NULL && g_TwMgr->m_PopupBar==PopupBar ) // delete popup - { - TwDeleteBar(g_TwMgr->m_PopupBar); - g_TwMgr->m_PopupBar = NULL; - } - - if( Handled && Bar!=NULL && Bar!=g_TwMgr->m_PopupBar && Bar!=PopupBar ) // popup bar may have been destroyed - TwSetTopBar(Bar); - - return Handled ? 1 : 0; -} - -int ANT_CALL TwKeyPressed(int _Key, int _Modifiers) -{ - return KeyPressed(_Key, _Modifiers, false); -} - -int ANT_CALL TwKeyTest(int _Key, int _Modifiers) -{ - return KeyPressed(_Key, _Modifiers, true); -} - -// --------------------------------------------------------------------------- - -struct StructCompare : public binary_function -{ - bool operator()(const TwType& _Left, const TwType& _Right) const - { - assert( g_TwMgr!=NULL ); - int i0 = _Left-TW_TYPE_STRUCT_BASE; - int i1 = _Right-TW_TYPE_STRUCT_BASE; - if( i0>=0 && i0<(int)g_TwMgr->m_Structs.size() && i1>=0 && i1<(int)g_TwMgr->m_Structs.size() ) - return g_TwMgr->m_Structs[i0].m_Name < g_TwMgr->m_Structs[i1].m_Name; - else - return false; - } -}; - -typedef set StructSet; - -static void InsertUsedStructs(StructSet& _Set, const CTwVarGroup *_Grp) -{ - assert( g_TwMgr!=NULL && _Grp!=NULL ); - - for( size_t i=0; i<_Grp->m_Vars.size(); ++i ) - if( _Grp->m_Vars[i]!=NULL && _Grp->m_Vars[i]->m_Visible && _Grp->m_Vars[i]->IsGroup() )// && _Grp->m_Vars[i]->m_Help.length()>0 ) - { - const CTwVarGroup *SubGrp = static_cast(_Grp->m_Vars[i]); - if( SubGrp->m_StructValuePtr!=NULL && SubGrp->m_StructType>=TW_TYPE_STRUCT_BASE && SubGrp->m_StructTypem_Structs.size() && g_TwMgr->m_Structs[SubGrp->m_StructType-TW_TYPE_STRUCT_BASE].m_Name.length()>0 ) - { - if( SubGrp->m_Help.length()>0 ) - _Set.insert(SubGrp->m_StructType); - else - { - int idx = SubGrp->m_StructType - TW_TYPE_STRUCT_BASE; - if( idx>=0 && idx<(int)g_TwMgr->m_Structs.size() && g_TwMgr->m_Structs[idx].m_Name.length()>0 ) - { - for( size_t j=0; jm_Structs[idx].m_Members.size(); ++j ) - if( g_TwMgr->m_Structs[idx].m_Members[j].m_Help.length()>0 ) - { - _Set.insert(SubGrp->m_StructType); - break; - } - } - } - } - InsertUsedStructs(_Set, SubGrp); - } -} - -static void SplitString(vector& _OutSplits, const char *_String, int _Width, const CTexFont *_Font) -{ - assert( _Font!=NULL && _String!=NULL ); - _OutSplits.resize(0); - int l = (int)strlen(_String); - if( l==0 ) - { - _String = " "; - l = 1; - } - - if( _String!=NULL && l>0 && _Width>0 ) - { - int w = 0; - int i = 0; - int First = 0; - int Last = 0; - bool PrevNotBlank = true; - unsigned char c; - bool Tab = false, CR = false; - string Split; - const string TabString(g_TabLength, ' '); - - while( im_CharWidth[(int)' ']; - Tab = true; - } - else if( c=='\n' ) - { - w += _Width+1; // force split - Last = i; - CR = true; - } - else - w += _Font->m_CharWidth[(int)c]; - if( w>_Width || i==l-1 ) - { - if( Last<=First || i==l-1 ) - Last = i; - if( Tab ) - { - Split.resize(0); - for(int k=0; km_HelpBar!=NULL); - assert( _String!=NULL ); - int n = 0; - const CTexFont *Font = g_TwMgr->m_HelpBar->m_Font; - assert(Font!=NULL); - string Decal; - for( int s=0; s<_Level; ++s ) - Decal += ' '; - int DecalWidth = (_Level+2)*Font->m_CharWidth[(int)' ']; - - if( _Width>DecalWidth ) - { - vector Split; - SplitString(Split, _String, _Width-DecalWidth, Font); - for( int i=0; i<(int)Split.size(); ++i ) - { - CTwVarAtom *Var = new CTwVarAtom; - Var->m_Name = Decal + Split[i]; - Var->m_Ptr = NULL; - if( _Type==TW_TYPE_HELP_HEADER ) - Var->m_ReadOnly = false; - else - Var->m_ReadOnly = true; - Var->m_NoSlider = true; - Var->m_DontClip = true; - Var->m_Type = _Type; - Var->m_LeftMargin = (signed short)((_Level+1)*Font->m_CharWidth[(int)' ']); - Var->m_TopMargin = (signed short)(-g_TwMgr->m_HelpBar->m_Sep); - //Var->m_TopMargin = 1; - Var->m_ColorPtr = &(g_TwMgr->m_HelpBar->m_ColHelpText); - Var->SetDefaults(); - _Grp->m_Vars.push_back(Var); - ++n; - } - } - return n; -} - -static int AppendHelp(CTwVarGroup *_Grp, const CTwVarGroup *_ToAppend, int _Level, int _Width) -{ - assert( _Grp!=NULL ); - assert( _ToAppend!=NULL ); - int n = 0; - string Decal; - for( int s=0; s<_Level; ++s ) - Decal += ' '; - - if( _ToAppend->m_Help.size()>0 ) - n += AppendHelpString(_Grp, _ToAppend->m_Help.c_str(), _Level, _Width, TW_TYPE_HELP_GRP); - - for( size_t i=0; i<_ToAppend->m_Vars.size(); ++i ) - if( _ToAppend->m_Vars[i]!=NULL && _ToAppend->m_Vars[i]->m_Visible ) - { - bool append = true; - if( !_ToAppend->m_Vars[i]->IsGroup() ) - { - const CTwVarAtom *a = static_cast(_ToAppend->m_Vars[i]); - if( a->m_Type==TW_TYPE_BUTTON && a->m_Val.m_Button.m_Callback==NULL ) - append = false; - else if( a->m_KeyIncr[0]==0 && a->m_KeyIncr[1]==0 && a->m_KeyDecr[0]==0 && a->m_KeyDecr[1]==0 && a->m_Help.length()<=0 ) - append = false; - } - else if( _ToAppend->m_Vars[i]->IsGroup() && static_cast(_ToAppend->m_Vars[i])->m_StructValuePtr!=NULL // that's a struct var - && _ToAppend->m_Vars[i]->m_Help.length()<=0 ) - append = false; - - if( append ) - { - CTwVarAtom *Var = new CTwVarAtom; - Var->m_Name = Decal; - if( _ToAppend->m_Vars[i]->m_Label.size()>0 ) - Var->m_Name += _ToAppend->m_Vars[i]->m_Label; - else - Var->m_Name += _ToAppend->m_Vars[i]->m_Name; - Var->m_Ptr = NULL; - if( _ToAppend->m_Vars[i]->IsGroup() && static_cast(_ToAppend->m_Vars[i])->m_StructValuePtr!=NULL ) - { // That's a struct var - Var->m_Type = TW_TYPE_HELP_STRUCT; - Var->m_Val.m_HelpStruct.m_StructType = static_cast(_ToAppend->m_Vars[i])->m_StructType; - Var->m_ReadOnly = true; - Var->m_NoSlider = true; - } - else if( !_ToAppend->m_Vars[i]->IsGroup() ) - { - Var->m_Type = TW_TYPE_SHORTCUT; - Var->m_Val.m_Shortcut.m_Incr[0] = static_cast(_ToAppend->m_Vars[i])->m_KeyIncr[0]; - Var->m_Val.m_Shortcut.m_Incr[1] = static_cast(_ToAppend->m_Vars[i])->m_KeyIncr[1]; - Var->m_Val.m_Shortcut.m_Decr[0] = static_cast(_ToAppend->m_Vars[i])->m_KeyDecr[0]; - Var->m_Val.m_Shortcut.m_Decr[1] = static_cast(_ToAppend->m_Vars[i])->m_KeyDecr[1]; - Var->m_ReadOnly = static_cast(_ToAppend->m_Vars[i])->m_ReadOnly; - Var->m_NoSlider = true; - } - else - { - Var->m_Type = TW_TYPE_HELP_GRP; - Var->m_DontClip = true; - Var->m_LeftMargin = (signed short)((_Level+2)*g_TwMgr->m_HelpBar->m_Font->m_CharWidth[(int)' ']); - //Var->m_TopMargin = (signed short)(g_TwMgr->m_HelpBar->m_Font->m_CharHeight/2-2+2*(_Level-1)); - Var->m_TopMargin = 2; - if( Var->m_TopMargin>g_TwMgr->m_HelpBar->m_Font->m_CharHeight-3 ) - Var->m_TopMargin = (signed short)(g_TwMgr->m_HelpBar->m_Font->m_CharHeight-3); - Var->m_ReadOnly = true; - } - Var->SetDefaults(); - _Grp->m_Vars.push_back(Var); - size_t VarIndex = _Grp->m_Vars.size()-1; - ++n; - if( _ToAppend->m_Vars[i]->IsGroup() && static_cast(_ToAppend->m_Vars[i])->m_StructValuePtr==NULL ) - { - int nAppended = AppendHelp(_Grp, static_cast(_ToAppend->m_Vars[i]), _Level+1, _Width); - if( _Grp->m_Vars.size()==VarIndex+1 ) - { - delete _Grp->m_Vars[VarIndex]; - _Grp->m_Vars.resize(VarIndex); - } - else - n += nAppended; - } - else if( _ToAppend->m_Vars[i]->m_Help.length()>0 ) - n += AppendHelpString(_Grp, _ToAppend->m_Vars[i]->m_Help.c_str(), _Level+1, _Width, TW_TYPE_HELP_ATOM); - } - } - return n; -} - - -static void CopyHierarchy(CTwVarGroup *dst, const CTwVarGroup *src) -{ - if( dst==NULL || src==NULL ) - return; - - dst->m_Name = src->m_Name; - dst->m_Open = src->m_Open; - dst->m_Visible = src->m_Visible; - dst->m_ColorPtr = src->m_ColorPtr; - dst->m_DontClip = src->m_DontClip; - dst->m_IsRoot = src->m_IsRoot; - dst->m_LeftMargin = src->m_LeftMargin; - dst->m_TopMargin = src->m_TopMargin; - - dst->m_Vars.resize(src->m_Vars.size()); - for(size_t i=0; im_Vars.size(); ++i) - if( src->m_Vars[i]!=NULL && src->m_Vars[i]->IsGroup() ) - { - CTwVarGroup *grp = new CTwVarGroup; - CopyHierarchy(grp, static_cast(src->m_Vars[i])); - dst->m_Vars[i] = grp; - } - else - dst->m_Vars[i] = NULL; -} - -// copy the 'open' flag from original hierarchy to current hierarchy -static void SynchroHierarchy(CTwVarGroup *cur, const CTwVarGroup *orig) -{ - if( cur==NULL || orig==NULL ) - return; - - if( strcmp(cur->m_Name.c_str(), orig->m_Name.c_str())==0 ) - cur->m_Open = orig->m_Open; - - size_t j = 0; - while( jm_Vars.size() && (orig->m_Vars[j]==NULL || !orig->m_Vars[j]->IsGroup()) ) - ++j; - - for(size_t i=0; im_Vars.size(); ++i) - if( cur->m_Vars[i]!=NULL && cur->m_Vars[i]->IsGroup() && jm_Vars.size() && orig->m_Vars[j]!=NULL && orig->m_Vars[j]->IsGroup() ) - { - CTwVarGroup *curGrp = static_cast(cur->m_Vars[i]); - const CTwVarGroup *origGrp = static_cast(orig->m_Vars[j]); - if( strcmp(curGrp->m_Name.c_str(), origGrp->m_Name.c_str())==0 ) - { - curGrp->m_Open = origGrp->m_Open; - - SynchroHierarchy(curGrp, origGrp); - - ++j; - while( jm_Vars.size() && (orig->m_Vars[j]==NULL || !orig->m_Vars[j]->IsGroup()) ) - ++j; - } - } -} - - -void CTwMgr::UpdateHelpBar() -{ - if( m_HelpBar==NULL || m_HelpBar->IsMinimized() ) - return; - if( !m_HelpBarUpdateNow && (float)m_Timer.GetTime()m_VarRoot); - - TwRemoveAllVars(m_HelpBar); - - if( m_HelpBar->m_UpToDate ) - m_HelpBar->Update(); - - if( m_Help.size()>0 ) - AppendHelpString(&(m_HelpBar->m_VarRoot), m_Help.c_str(), 0, m_HelpBar->m_VarX2-m_HelpBar->m_VarX0, TW_TYPE_HELP_ATOM); - if( m_HelpBar->m_Help.size()>0 ) - AppendHelpString(&(m_HelpBar->m_VarRoot), m_HelpBar->m_Help.c_str(), 0, m_HelpBar->m_VarX2-m_HelpBar->m_VarX0, TW_TYPE_HELP_ATOM); - AppendHelpString(&(m_HelpBar->m_VarRoot), "", 0, m_HelpBar->m_VarX2-m_HelpBar->m_VarX0, TW_TYPE_HELP_HEADER); - - for( size_t ib=0; ibm_IsHelpBar) && m_Bars[ib]!=m_PopupBar && m_Bars[ib]->m_Visible ) - { - // Create a group - CTwVarGroup *Grp = new CTwVarGroup; - Grp->m_SummaryCallback = NULL; - Grp->m_SummaryClientData = NULL; - Grp->m_StructValuePtr = NULL; - if( m_Bars[ib]->m_Label.size()<=0 ) - Grp->m_Name = m_Bars[ib]->m_Name; - else - Grp->m_Name = m_Bars[ib]->m_Label; - Grp->m_Open = true; - Grp->m_ColorPtr = &(m_HelpBar->m_ColGrpText); - m_HelpBar->m_VarRoot.m_Vars.push_back(Grp); - if( m_Bars[ib]->m_Help.size()>0 ) - AppendHelpString(Grp, m_Bars[ib]->m_Help.c_str(), 0, m_HelpBar->m_VarX2-m_HelpBar->m_VarX0, TW_TYPE_HELP_GRP); - - // Append variables (recursive) - AppendHelp(Grp, &(m_Bars[ib]->m_VarRoot), 1, m_HelpBar->m_VarX2-m_HelpBar->m_VarX0); - - // Append structures - StructSet UsedStructs; - InsertUsedStructs(UsedStructs, &(m_Bars[ib]->m_VarRoot)); - CTwVarGroup *StructGrp = NULL; - int MemberCount = 0; - for( StructSet::iterator it=UsedStructs.begin(); it!=UsedStructs.end(); ++it ) - { - int idx = (*it) - TW_TYPE_STRUCT_BASE; - if( idx>=0 && idx<(int)g_TwMgr->m_Structs.size() && g_TwMgr->m_Structs[idx].m_Name.length()>0 ) - { - if( StructGrp==NULL ) - { - StructGrp = new CTwVarGroup; - StructGrp->m_StructType = TW_TYPE_HELP_STRUCT; // a special line background color will be used - StructGrp->m_Name = "Structures"; - StructGrp->m_Open = false; - StructGrp->m_ColorPtr = &(m_HelpBar->m_ColStructText); - //Grp->m_Vars.push_back(StructGrp); - MemberCount = 0; - } - CTwVarAtom *Var = new CTwVarAtom; - Var->m_Ptr = NULL; - Var->m_Type = TW_TYPE_HELP_GRP; - Var->m_DontClip = true; - Var->m_LeftMargin = (signed short)(3*g_TwMgr->m_HelpBar->m_Font->m_CharWidth[(int)' ']); - Var->m_TopMargin = 2; - Var->m_ReadOnly = true; - Var->m_NoSlider = true; - Var->m_Name = '{'+g_TwMgr->m_Structs[idx].m_Name+'}'; - StructGrp->m_Vars.push_back(Var); - size_t structIndex = StructGrp->m_Vars.size()-1; - if( g_TwMgr->m_Structs[idx].m_Help.size()>0 ) - AppendHelpString(StructGrp, g_TwMgr->m_Structs[idx].m_Help.c_str(), 2, m_HelpBar->m_VarX2-m_HelpBar->m_VarX0-2*Var->m_LeftMargin, TW_TYPE_HELP_ATOM); - - // Append struct members - for( size_t im=0; imm_Structs[idx].m_Members.size(); ++im ) - { - if( g_TwMgr->m_Structs[idx].m_Members[im].m_Help.size()>0 ) - { - CTwVarAtom *Var = new CTwVarAtom; - Var->m_Ptr = NULL; - Var->m_Type = TW_TYPE_SHORTCUT; - Var->m_Val.m_Shortcut.m_Incr[0] = 0; - Var->m_Val.m_Shortcut.m_Incr[1] = 0; - Var->m_Val.m_Shortcut.m_Decr[0] = 0; - Var->m_Val.m_Shortcut.m_Decr[1] = 0; - Var->m_ReadOnly = false; - Var->m_NoSlider = true; - if( g_TwMgr->m_Structs[idx].m_Members[im].m_Label.length()>0 ) - Var->m_Name = " "+g_TwMgr->m_Structs[idx].m_Members[im].m_Label; - else - Var->m_Name = " "+g_TwMgr->m_Structs[idx].m_Members[im].m_Name; - StructGrp->m_Vars.push_back(Var); - //if( g_TwMgr->m_Structs[idx].m_Members[im].m_Help.size()>0 ) - AppendHelpString(StructGrp, g_TwMgr->m_Structs[idx].m_Members[im].m_Help.c_str(), 3, m_HelpBar->m_VarX2-m_HelpBar->m_VarX0-4*Var->m_LeftMargin, TW_TYPE_HELP_ATOM); - } - } - - if( StructGrp->m_Vars.size()==structIndex+1 ) // remove struct from help - { - delete StructGrp->m_Vars[structIndex]; - StructGrp->m_Vars.resize(structIndex); - } - else - ++MemberCount; - } - } - if( StructGrp!=NULL ) - { - if( MemberCount==1 ) - StructGrp->m_Name = "Structure"; - if( StructGrp->m_Vars.size()>0 ) - Grp->m_Vars.push_back(StructGrp); - else - { - delete StructGrp; - StructGrp = NULL; - } - } - } - - // Append RotoSlider - CTwVarGroup *RotoGrp = new CTwVarGroup; - RotoGrp->m_SummaryCallback = NULL; - RotoGrp->m_SummaryClientData = NULL; - RotoGrp->m_StructValuePtr = NULL; - RotoGrp->m_Name = "RotoSlider"; - RotoGrp->m_Open = false; - RotoGrp->m_ColorPtr = &(m_HelpBar->m_ColGrpText); - m_HelpBar->m_VarRoot.m_Vars.push_back(RotoGrp); - AppendHelpString(RotoGrp, "The RotoSlider allows rapid editing of numerical values.", 0, m_HelpBar->m_VarX2-m_HelpBar->m_VarX0, TW_TYPE_HELP_ATOM); - AppendHelpString(RotoGrp, "To modify a numerical value, click on its label or on its roto [.] button, then move the mouse outside of the grey circle while keeping the mouse button pressed, and turn around the circle to increase or decrease the numerical value.", 0, m_HelpBar->m_VarX2-m_HelpBar->m_VarX0, TW_TYPE_HELP_ATOM); - AppendHelpString(RotoGrp, "The two grey lines depict the min and max bounds.", 0, m_HelpBar->m_VarX2-m_HelpBar->m_VarX0, TW_TYPE_HELP_ATOM); - AppendHelpString(RotoGrp, "Moving the mouse far form the circle allows precise increase or decrease, while moving near the circle allows fast increase or decrease.", 0, m_HelpBar->m_VarX2-m_HelpBar->m_VarX0, TW_TYPE_HELP_ATOM); - - SynchroHierarchy(&m_HelpBar->m_VarRoot, &prevHierarchy); - - m_HelpBarNotUpToDate = false; -} - -// --------------------------------------------------------------------------- - -#if defined(ANT_WINDOWS) - -#include "res/TwXCursors.h" - -void CTwMgr::CreateCursors() -{ - if( m_CursorsCreated ) - return; - m_CursorArrow = ::LoadCursor(NULL ,MAKEINTRESOURCE(IDC_ARROW)); - m_CursorMove = ::LoadCursor(NULL ,MAKEINTRESOURCE(IDC_SIZEALL)); - m_CursorWE = ::LoadCursor(NULL ,MAKEINTRESOURCE(IDC_SIZEWE)); - m_CursorNS = ::LoadCursor(NULL ,MAKEINTRESOURCE(IDC_SIZENS)); - m_CursorTopRight = ::LoadCursor(NULL ,MAKEINTRESOURCE(IDC_SIZENESW)); - m_CursorTopLeft = ::LoadCursor(NULL ,MAKEINTRESOURCE(IDC_SIZENWSE)); - m_CursorBottomLeft = ::LoadCursor(NULL ,MAKEINTRESOURCE(IDC_SIZENESW)); - m_CursorBottomRight = ::LoadCursor(NULL ,MAKEINTRESOURCE(IDC_SIZENWSE)); - m_CursorHelp = ::LoadCursor(NULL ,MAKEINTRESOURCE(IDC_HELP)); - m_CursorCross = ::LoadCursor(NULL ,MAKEINTRESOURCE(IDC_CROSS)); - m_CursorUpArrow = ::LoadCursor(NULL ,MAKEINTRESOURCE(IDC_UPARROW)); - m_CursorNo = ::LoadCursor(NULL ,MAKEINTRESOURCE(IDC_NO)); - m_CursorIBeam = ::LoadCursor(NULL ,MAKEINTRESOURCE(IDC_IBEAM)); - #ifdef IDC_HAND - m_CursorHand = ::LoadCursor(NULL ,MAKEINTRESOURCE(IDC_HAND)); - #else - m_CursorHand = ::LoadCursor(NULL ,MAKEINTRESOURCE(IDC_UPARROW)); - #endif - int cur; - HMODULE hdll = GetModuleHandle(ANT_TWEAK_BAR_DLL); - if( hdll==NULL ) - g_UseCurRsc = false; // force the use of built-in cursors (not using resources) - if( g_UseCurRsc ) - m_CursorCenter = ::LoadCursor(hdll, MAKEINTRESOURCE(IDC_CURSOR1+0)); - else - m_CursorCenter = PixmapCursor(0); - if( m_CursorCenter==NULL ) - m_CursorCenter = ::LoadCursor(NULL ,MAKEINTRESOURCE(IDC_CROSS)); - if( g_UseCurRsc ) - m_CursorPoint = ::LoadCursor(hdll, MAKEINTRESOURCE(IDC_CURSOR1+1)); - else - m_CursorPoint = PixmapCursor(1); - if( m_CursorPoint==NULL ) - m_CursorPoint = ::LoadCursor(NULL ,MAKEINTRESOURCE(IDC_CROSS)); - - for( cur=0; cur>2) + y*8] |= (unsigned char)(g_CurPict[_CurIdx][x+y*32] << 2*(3-(x&3))+1); //turn whiteon - data[(x>>2) + y*8] |= (unsigned char)(g_CurMask[_CurIdx][x+y*32] << 2*(3-(x&3))); //turn the alpha all the way up - } - //printf("\n"); - } - NSImage *img = [[NSImage alloc] initWithSize: [imgr size]]; - [img addRepresentation: imgr]; - NSCursor *cur = [[NSCursor alloc] initWithImage: img hotSpot: NSMakePoint(g_CurHot[_CurIdx][0],g_CurHot[_CurIdx][1])]; - - [imgr autorelease]; - [img autorelease]; - if (cur) - return cur; - else - return [NSCursor arrowCursor]; -} - -void CTwMgr::CreateCursors() -{ - if (m_CursorsCreated) - return; - - m_CursorArrow = [[NSCursor arrowCursor] retain]; - m_CursorMove = [[NSCursor crosshairCursor] retain]; - m_CursorWE = [[NSCursor resizeLeftRightCursor] retain]; - m_CursorNS = [[NSCursor resizeUpDownCursor] retain]; - m_CursorTopRight = [[NSCursor arrowCursor] retain]; //osx not have one - m_CursorTopLeft = [[NSCursor arrowCursor] retain]; //osx not have one - m_CursorBottomRight = [[NSCursor arrowCursor] retain]; //osx not have one - m_CursorBottomLeft = [[NSCursor arrowCursor] retain]; //osx not have one - m_CursorHelp = [[NSCursor arrowCursor] retain]; //osx not have one - m_CursorHand = [[NSCursor pointingHandCursor] retain]; - m_CursorCross = [[NSCursor arrowCursor] retain]; - m_CursorUpArrow = [[NSCursor arrowCursor] retain]; - m_CursorNo = [[NSCursor arrowCursor] retain]; - m_CursorIBeam = [[NSCursor IBeamCursor] retain]; - for (int i=0;ierror_code, err->request_code); - // No exit! - return 0 ; -} - -static void IgnoreXErrors() -{ - if( g_TwMgr!=NULL && g_TwMgr->m_CurrentXDisplay==glXGetCurrentDisplay() ) - { - XFlush(g_TwMgr->m_CurrentXDisplay); - XSync(g_TwMgr->m_CurrentXDisplay, False); - } - s_PrevErrorHandler = XSetErrorHandler(InactiveErrorHandler); -} - -static void RestoreXErrors() -{ - if( g_TwMgr!=NULL && g_TwMgr->m_CurrentXDisplay==glXGetCurrentDisplay() ) - { - XFlush(g_TwMgr->m_CurrentXDisplay); - XSync(g_TwMgr->m_CurrentXDisplay, False); - } - XSetErrorHandler(s_PrevErrorHandler); -} - -CTwMgr::CCursor CTwMgr::PixmapCursor(int _CurIdx) -{ - if( !m_CurrentXDisplay || !m_CurrentXWindow ) - return XC_left_ptr; - - IgnoreXErrors(); - - XColor black, white, exact; - Colormap colmap = DefaultColormap(m_CurrentXDisplay, DefaultScreen(m_CurrentXDisplay)); - Status s1 = XAllocNamedColor(m_CurrentXDisplay, colmap, "black", &black, &exact); - Status s2 = XAllocNamedColor(m_CurrentXDisplay, colmap, "white", &white, &exact); - if( s1==0 || s2==0 ) - return XC_left_ptr; // cannot allocate colors! - int x, y; - unsigned int mask[32]; - unsigned int pict[32]; - for( y=0; y<32; ++y ) - { - mask[y] = pict[y] = 0; - for( x=0; x<32; ++x ) - { - mask[y] |= (((unsigned int)(g_CurMask[_CurIdx][x+y*32]))<m_CurrentXDisplay ) - { - Window wnd = glXGetCurrentDrawable(); - if( wnd!=g_TwMgr->m_CurrentXWindow ) - { - FreeCursors(); - g_TwMgr->m_CurrentXWindow = wnd; - CreateCursors(); - // now _Cursor is not a valid cursor ID. - } - else - { - IgnoreXErrors(); - XDefineCursor(m_CurrentXDisplay, m_CurrentXWindow, _Cursor); - RestoreXErrors(); - } - } - } -} - -#endif //defined(ANT_UNIX) - -// --------------------------------------------------------------------------- - -void ANT_CALL TwCopyCDStringToClientFunc(TwCopyCDStringToClient copyCDStringToClientFunc) -{ - g_InitCopyCDStringToClient = copyCDStringToClientFunc; - if( g_TwMgr!=NULL ) - g_TwMgr->m_CopyCDStringToClient = copyCDStringToClientFunc; -} - -void ANT_CALL TwCopyCDStringToLibrary(char **destinationLibraryStringPtr, const char *sourceClientString) -{ - if( g_TwMgr==NULL ) - { - if( destinationLibraryStringPtr!=NULL ) - *destinationLibraryStringPtr = const_cast(sourceClientString); - return; - } - - // static buffer to store sourceClientString copy associated to sourceClientString pointer - std::vector& Buf = g_TwMgr->m_CDStdStringCopyBuffers[(void *)sourceClientString]; - - size_t len = (sourceClientString!=NULL) ? strlen(sourceClientString) : 0; - if( Buf.size()m_CopyStdStringToClient = copyStdStringToClientFunc; -} - -void ANT_CALL TwCopyStdStringToLibrary(std::string& destLibraryString, const std::string& srcClientString) -{ - /* - // check if destLibraryString should be initialized - char *Mem = (char *)&destLibraryString; - bool Init = true; - for( int i=0; i& Buf = g_TwMgr->m_CDStdStringCopyBuffers[(void *)&srcClientString]; - - size_t len = strlen(SrcStr); - if( Buf.size()& _OutRects) const -{ - if( Empty() ) - return false; - if( _Rect.Empty() || _Rect.Y>=Y+H || _Rect.Y+_Rect.H<=Y || _Rect.X>=X+W || _Rect.X+_Rect.W<=X ) - { - _OutRects.push_back(*this); - return true; - } - - bool Ret = false; - int Y0 = Y; - int Y1 = Y+H-1; - if( _Rect.Y>Y ) - { - Y0 = _Rect.Y; - _OutRects.push_back(CRect(X, Y, W, Y0-Y+1)); - Ret = true; - } - if( _Rect.Y+_Rect.HX ) - { - X0 = _Rect.X; //-2; - _OutRects.push_back(CRect(X, Y0, X0-X+1, Y1-Y0+1)); - Ret = true; - } - if( _Rect.X+_Rect.W& _Rects, vector& _OutRects) const -{ - _OutRects.clear(); - size_t i, j, NbRects = _Rects.size(); - if( NbRects==0 ) - { - _OutRects.push_back(*this); - return true; - } - else - { - vector TmpRects; - Subtract(_Rects[0], _OutRects); - - for( i=1; i -#define ANT_CALL TW_CALL - -#include "TwColors.h" -#include "TwFonts.h" -#include "TwGraph.h" -#include "AntPerfTimer.h" - - -//#define BENCH // uncomment to activate benchmarks - -#ifdef BENCH -# define PERF(cmd) cmd -#else // BENCH -# define PERF(cmd) -#endif // BENCH - -const int NB_ROTO_CURSORS = 12; - - -// --------------------------------------------------------------------------- -// API unexposed by AntTweakBar.h -// --------------------------------------------------------------------------- - -// bar states -> use TwDefine instead -typedef enum ETwState -{ - TW_STATE_SHOWN = 1, - TW_STATE_ICONIFIED = 2, - TW_STATE_HIDDEN = 3, - TW_STATE_UNICONIFIED = 4, - TW_STATE_ERROR = 0 -} TwState; -/*ANT_TWEAK_BAR_API*/ int ANT_CALL TwSetBarState(TwBar *bar, TwState state); -/*ANT_TWEAK_BAR_API*/ //TwState ANT_CALL TwGetBarState(const TwBar *bar); -// var states -> use TwDefine instead: visible/iconified implemented only as string commands -//ANT_TWEAK_BAR_API int ANT_CALL TwSetVarState(TwBar *bar, const char *name, TwState state); -//ANT_TWEAK_BAR_API TwState ANT_CALL TwGetVarState(const TwBar *bar, const char *name); - -struct CTwVarGroup; -typedef void (ANT_CALL *TwStructExtInitCallback)(void *structExtValue, void *clientData); -typedef void (ANT_CALL *TwCopyVarFromExtCallback)(void *structValue, const void *structExtValue, unsigned int structExtMemberIndex, void *clientData); -typedef void (ANT_CALL *TwCopyVarToExtCallback)(const void *structValue, void *structExtValue, unsigned int structExtMemberIndex, void *clientData); -/*ANT_TWEAK_BAR_API*/ TwType ANT_CALL TwDefineStructExt(const char *name, const TwStructMember *structExtMembers, unsigned int nbExtMembers, size_t structSize, size_t structExtSize, TwStructExtInitCallback structExtInitCallback, TwCopyVarFromExtCallback copyVarFromExtCallback, TwCopyVarToExtCallback copyVarToExtCallback, TwSummaryCallback summaryCallback, void *clientData, const char *help); -typedef void (ANT_CALL *TwCustomDrawCallback)(int w, int h, void *structExtValue, void *clientData, TwBar *bar, CTwVarGroup *varGrp); -typedef bool (ANT_CALL *TwCustomMouseMotionCallback)(int mouseX, int mouseY, int w, int h, void *structExtValue, void *clientData, TwBar *bar, CTwVarGroup *varGrp); -typedef bool (ANT_CALL *TwCustomMouseButtonCallback)(TwMouseButtonID button, bool pressed, int mouseX, int mouseY, int w, int h, void *structExtValue, void *clientData, TwBar *bar, CTwVarGroup *varGrp); -typedef void (ANT_CALL *TwCustomMouseLeaveCallback)(void *structExtValue, void *clientData, TwBar *bar); - -enum ERetType -{ - RET_ERROR = 0, - RET_DOUBLE, - RET_STRING -}; - -enum EButtonAlign -{ - BUTTON_ALIGN_LEFT, - BUTTON_ALIGN_CENTER, - BUTTON_ALIGN_RIGHT -}; - -// --------------------------------------------------------------------------- -// AntTweakBar Manager -// --------------------------------------------------------------------------- - -struct CTwMgr -{ - ETwGraphAPI m_GraphAPI; - void * m_Device; - int m_WndID; - class ITwGraph * m_Graph; - int m_WndWidth; - int m_WndHeight; - const CTexFont * m_CurrentFont; - - std::vector m_Bars; - std::vector m_Order; - - std::vector m_MinOccupied; - void Minimize(TwBar *_Bar); - void Maximize(TwBar *_Bar); - void Hide(TwBar *_Bar); - void Unhide(TwBar *_Bar); - void SetFont(const CTexFont *_Font, bool _ResizeBars); - int m_LastMouseX; - int m_LastMouseY; - int m_LastMouseWheelPos; - int m_IconPos; // 0: bottom-left, 1:bottom-right, 2:top-left, 3:top-right - int m_IconAlign; // 0: vertical, 1: horizontal - int m_IconMarginX, m_IconMarginY; - bool m_FontResizable; - std::string m_BarAlwaysOnTop; - std::string m_BarAlwaysOnBottom; - bool m_UseOldColorScheme; - bool m_Contained; - EButtonAlign m_ButtonAlign; - bool m_OverlapContent; - bool m_Terminating; - - std::string m_Help; - TwBar * m_HelpBar; - float m_LastHelpUpdateTime; - void UpdateHelpBar(); - bool m_HelpBarNotUpToDate; - bool m_HelpBarUpdateNow; - void * m_KeyPressedTextObj; - bool m_KeyPressedBuildText; - std::string m_KeyPressedStr; - float m_KeyPressedTime; - void * m_InfoTextObj; - bool m_InfoBuildText; - int m_BarInitColorHue; - int FindBar(const char *_Name) const; - int HasAttrib(const char *_Attrib, bool *_HasValue) const; - int SetAttrib(int _AttribID, const char *_Value); - ERetType GetAttrib(int _AttribID, std::vector& outDouble, std::ostringstream& outString) const; - void SetLastError(const char *_StaticErrorMesssage); // _StaticErrorMesssage must be a static string - const char * GetLastError(); // returns a static string describing the error, and set LastError to NULL - const char * CheckLastError() const; // returns the LastError, but does not set it to NULL - void SetCurrentDbgParams(const char *file, int line); - TwBar * m_PopupBar; - //bool IsProcessing() const { return m_Processing); - //void SetProcessing(bool processing) { m_Processing = processing; } - - CTwMgr(ETwGraphAPI _GraphAPI, void *_Device, int _WndID); - ~CTwMgr(); - - struct CStructMember - { - std::string m_Name; - std::string m_Label; - TwType m_Type; - size_t m_Offset; - std::string m_DefString; - size_t m_Size; - std::string m_Help; - }; - struct CStruct - { - std::string m_Name; - std::vector m_Members; - size_t m_Size; - TwSummaryCallback m_SummaryCallback; - void * m_SummaryClientData; - std::string m_Help; - bool m_IsExt; - size_t m_ClientStructSize; - TwStructExtInitCallback m_StructExtInitCallback; - TwCopyVarFromExtCallback m_CopyVarFromExtCallback; - TwCopyVarToExtCallback m_CopyVarToExtCallback; - void * m_ExtClientData; - CStruct() : m_IsExt(false), m_StructExtInitCallback(NULL), m_CopyVarFromExtCallback(NULL), m_CopyVarToExtCallback(NULL), m_ExtClientData(NULL) {} - static void ANT_CALL DefaultSummary(char *_SummaryString, size_t _SummaryMaxLength, const void *_Value, void *_ClientData); - static void * s_PassProxyAsClientData; - }; - std::vector m_Structs; - - // followings are used for TwAddVarCB( ... StructType ... ) - struct CStructProxy - { - TwType m_Type; - void * m_StructData; - bool m_DeleteStructData; - void * m_StructExtData; - TwSetVarCallback m_StructSetCallback; - TwGetVarCallback m_StructGetCallback; - void * m_StructClientData; - TwCustomDrawCallback m_CustomDrawCallback; - TwCustomMouseMotionCallback m_CustomMouseMotionCallback; - TwCustomMouseButtonCallback m_CustomMouseButtonCallback; - TwCustomMouseLeaveCallback m_CustomMouseLeaveCallback; - bool m_CustomCaptureFocus; - int m_CustomIndexFirst; - int m_CustomIndexLast; - CStructProxy(); - ~CStructProxy(); - }; - struct CMemberProxy - { - CStructProxy * m_StructProxy; - int m_MemberIndex; - struct CTwVar * m_Var; - struct CTwVarGroup * m_VarParent; - CTwBar * m_Bar; - CMemberProxy(); - ~CMemberProxy(); - static void ANT_CALL SetCB(const void *_Value, void *_ClientData); - static void ANT_CALL GetCB(void *_Value, void *_ClientData); - }; - std::list m_StructProxies; // elements should not move - std::list m_MemberProxies; // elements should not move - //void InitVarData(TwType _Type, void *_Data, size_t _Size); - //void UninitVarData(TwType _Type, void *_Data, size_t _Size); - - struct CEnum - { - std::string m_Name; - typedef std::map CEntries; - CEntries m_Entries; - }; - std::vector m_Enums; - - TwType m_TypeColor32; - TwType m_TypeColor3F; - TwType m_TypeColor4F; - TwType m_TypeQuat4F; - TwType m_TypeQuat4D; - TwType m_TypeDir3F; - TwType m_TypeDir3D; - - std::vector m_CSStringBuffer; - struct CCDStdString - { - std::string * m_ClientStdStringPtr; - char m_LocalString[sizeof(std::string)+2*sizeof(void*)]; //+2*sizeof(void*) because of VC++ std::string extra info in Debug - TwSetVarCallback m_ClientSetCallback; - TwGetVarCallback m_ClientGetCallback; - void * m_ClientData; - static void ANT_CALL SetCB(const void *_Value, void *_ClientData); - static void ANT_CALL GetCB(void *_Value, void *_ClientData); - }; - std::list m_CDStdStrings; - struct CClientStdString // Convertion between VC++ Debug/Release std::string - { - CClientStdString(); - void FromLib(const char *libStr); - std::string& ToClient(); - private: - char m_Data[sizeof(std::string)+2*sizeof(void *)]; - std::string m_LibStr; - }; - struct CLibStdString // Convertion between VC++ Debug/Release std::string - { - CLibStdString(); - void FromClient(const std::string& clientStr); - std::string& ToLib(); - private: - char m_Data[sizeof(std::string)+2*sizeof(void *)]; - }; - struct CCDStdStringRecord - { - void * m_DataPtr; - char m_PrevValue[sizeof(std::string)+2*sizeof(void*)]; - CClientStdString m_ClientStdString; - }; - std::vector m_CDStdStringRecords; - void UnrollCDStdString(std::vector& _Records, TwType _Type, void *_Data); - void RestoreCDStdString(const std::vector& _Records); - std::map > m_CDStdStringCopyBuffers; - - struct CCustom // custom var type - { - virtual ~CCustom() = 0; - }; - std::vector m_Customs; - - PerfTimer m_Timer; - double m_LastMousePressedTime; - TwMouseButtonID m_LastMousePressedButtonID; - int m_LastMousePressedPosition[2]; - double m_RepeatMousePressedDelay; - double m_RepeatMousePressedPeriod; - bool m_CanRepeatMousePressed; - bool m_IsRepeatingMousePressed; - double m_LastDrawTime; - - #if defined(ANT_WINDOWS) - typedef HCURSOR CCursor; - CCursor PixmapCursor(int _CurIdx); - #elif defined(ANT_UNIX) - typedef Cursor CCursor; - CCursor PixmapCursor(int _CurIdx); - Display * m_CurrentXDisplay; - Window m_CurrentXWindow; - #elif defined(ANT_OSX) - typedef NSCursor * CCursor; - CCursor PixmapCursor(int _CurIdx); - #endif // defined(ANT_UNIX) - bool m_CursorsCreated; - void CreateCursors(); - void FreeCursors(); - void SetCursor(CCursor _Cursor); - CCursor m_CursorArrow; - CCursor m_CursorMove; - CCursor m_CursorWE; - CCursor m_CursorNS; - CCursor m_CursorTopLeft; - CCursor m_CursorTopRight; - CCursor m_CursorBottomLeft; - CCursor m_CursorBottomRight; - CCursor m_CursorHelp; - CCursor m_CursorHand; - CCursor m_CursorCross; - CCursor m_CursorUpArrow; - CCursor m_CursorNo; - CCursor m_CursorIBeam; - CCursor m_RotoCursors[NB_ROTO_CURSORS]; - CCursor m_CursorCenter; - CCursor m_CursorPoint; - - TwCopyCDStringToClient m_CopyCDStringToClient; - TwCopyStdStringToClient m_CopyStdStringToClient; - size_t m_ClientStdStringStructSize; - TwType m_ClientStdStringBaseType; - -protected: - int m_NbMinimizedBars; - const char * m_LastError; - const char * m_CurrentDbgFile; - int m_CurrentDbgLine; - //bool m_Processing; -}; - -extern CTwMgr *g_TwMgr; - - -// --------------------------------------------------------------------------- -// Extra functions and TwTypes -// --------------------------------------------------------------------------- - - -bool TwGetKeyCode(int *_Code, int *_Modif, const char *_String); -bool TwGetKeyString(std::string *_String, int _Code, int _Modif); - -const TwType TW_TYPE_SHORTCUT = TwType(0xfff1); -const TwType TW_TYPE_HELP_GRP = TwType(0xfff2); -const TwType TW_TYPE_HELP_ATOM = TwType(0xfff3); -const TwType TW_TYPE_HELP_HEADER = TwType(0xfff4); -const TwType TW_TYPE_HELP_STRUCT = TwType(0xfff5); -const TwType TW_TYPE_BUTTON = TwType(0xfff6); -const TwType TW_TYPE_CDSTDSTRING = TwType(0xfff7); -const TwType TW_TYPE_STRUCT_BASE = TwType(0x10000000); -const TwType TW_TYPE_ENUM_BASE = TwType(0x20000000); -const TwType TW_TYPE_CSSTRING_BASE = TW_TYPE_CSSTRING(0); // defined as 0x30000000 (see AntTweakBar.h) -const TwType TW_TYPE_CSSTRING_MAX = TW_TYPE_CSSTRING(0xfffffff); -#define TW_CSSTRING_SIZE(type) ((int)((type)&0xfffffff)) -const TwType TW_TYPE_CUSTOM_BASE = TwType(0x40000000); -const TwType TW_TYPE_STDSTRING_VS2008 = TwType(0x2fff0000); -const TwType TW_TYPE_STDSTRING_VS2010 = TwType(0x2ffe0000); - -extern "C" int ANT_CALL TwSetLastError(const char *_StaticErrorMessage); - -//const TwGraphAPI TW_OPENGL_CORE = (TwGraphAPI)5; // WIP (note: OpenGL Core Profil requires OpenGL 3.2 or later) - -// Clipping helper -struct CRect -{ - int X, Y, W, H; - CRect() : X(0), Y(0), W(0), H(0) {} - CRect(int _X, int _Y, int _W, int _H) : X(_X), Y(_Y), W(_W), H(_H) {} - bool operator==(const CRect& _Rect) { return (Empty() && _Rect.Empty()) || (X==_Rect.X && Y==_Rect.Y && W==_Rect.W && H==_Rect.H); } - bool Empty(int _Margin=0) const { return (W<=_Margin || H<=_Margin); } - bool Subtract(const CRect& _Rect, std::vector& _OutRects) const; - bool Subtract(const std::vector& _Rects, std::vector& _OutRects) const; -}; - - -// --------------------------------------------------------------------------- -// Global bar attribs -// --------------------------------------------------------------------------- - - -enum EMgrAttribs -{ - MGR_HELP = 1, - MGR_FONT_SIZE, - MGR_FONT_STYLE, - MGR_ICON_POS, - MGR_ICON_ALIGN, - MGR_ICON_MARGIN, - MGR_FONT_RESIZABLE, - MGR_COLOR_SCHEME, - MGR_CONTAINED, - MGR_BUTTON_ALIGN, - MGR_OVERLAP -}; - - -// --------------------------------------------------------------------------- -// Color struct ext -// --------------------------------------------------------------------------- - - -struct CColorExt -{ - int R, G, B; - int H, L, S; - int A; - bool m_HLS, m_HasAlpha, m_OGL; - bool m_CanHaveAlpha; - bool m_IsColorF; - unsigned int m_PrevConvertedColor; - CTwMgr::CStructProxy*m_StructProxy; - void RGB2HLS(); - void HLS2RGB(); - static void ANT_CALL InitColor32CB(void *_ExtValue, void *_ClientData); - static void ANT_CALL InitColor3FCB(void *_ExtValue, void *_ClientData); - static void ANT_CALL InitColor4FCB(void *_ExtValue, void *_ClientData); - static void ANT_CALL CopyVarFromExtCB(void *_VarValue, const void *_ExtValue, unsigned int _ExtMemberIndex, void *_ClientData); - static void ANT_CALL CopyVarToExtCB(const void *_VarValue, void *_ExtValue, unsigned int _ExtMemberIndex, void *_ClientData); - static void ANT_CALL SummaryCB(char *_SummaryString, size_t _SummaryMaxLength, const void *_ExtValue, void *_ClientData); - static void CreateTypes(); -}; - - -// --------------------------------------------------------------------------- -// Quaternion struct ext -// --------------------------------------------------------------------------- - - -struct CQuaternionExt -{ - double Qx, Qy, Qz, Qs; // Quat value - double Vx, Vy, Vz, Angle; // Not used - double Dx, Dy, Dz; // Dir value set when used as a direction - bool m_AAMode; // Axis & angle mode -> disabled - bool m_ShowVal; // Display values - bool m_IsFloat; // Quat/Dir uses floats - bool m_IsDir; // Mapped to a dir vector instead of a quat - double m_Dir[3]; // If not zero, display one direction vector - color32 m_DirColor; // Direction vector color - float m_Permute[3][3]; // Permute frame axis - CTwMgr::CStructProxy*m_StructProxy; - static void ANT_CALL InitQuat4FCB(void *_ExtValue, void *_ClientData); - static void ANT_CALL InitQuat4DCB(void *_ExtValue, void *_ClientData); - static void ANT_CALL InitDir3FCB(void *_ExtValue, void *_ClientData); - static void ANT_CALL InitDir3DCB(void *_ExtValue, void *_ClientData); - static void ANT_CALL CopyVarFromExtCB(void *_VarValue, const void *_ExtValue, unsigned int _ExtMemberIndex, void *_ClientData); - static void ANT_CALL CopyVarToExtCB(const void *_VarValue, void *_ExtValue, unsigned int _ExtMemberIndex, void *_ClientData); - static void ANT_CALL SummaryCB(char *_SummaryString, size_t _SummaryMaxLength, const void *_ExtValue, void *_ClientData); - static void ANT_CALL DrawCB(int _W, int _H, void *_ExtValue, void *_ClientData, TwBar *_Bar, CTwVarGroup *varGrp); - static bool ANT_CALL MouseMotionCB(int _MouseX, int _MouseY, int _W, int _H, void *_StructExtValue, void *_ClientData, TwBar *_Bar, CTwVarGroup *varGrp); - static bool ANT_CALL MouseButtonCB(TwMouseButtonID _Button, bool _Pressed, int _MouseX, int _MouseY, int _W, int _H, void *_StructExtValue, void *_ClientData, TwBar *_Bar, CTwVarGroup *varGrp); - static void ANT_CALL MouseLeaveCB(void *_StructExtValue, void *_ClientData, TwBar *_Bar); - static void CreateTypes(); - static TwType s_CustomType; - void ConvertToAxisAngle(); - void ConvertFromAxisAngle(); - void CopyToVar(); - static std::vector s_SphTri; - static std::vector s_SphCol; - static std::vector s_SphTriProj; - static std::vector s_SphColLight; - static std::vector s_ArrowTri[4]; - static std::vector s_ArrowTriProj[4]; - static std::vector s_ArrowNorm[4]; - static std::vector s_ArrowColLight[4]; - enum EArrowParts { ARROW_CONE, ARROW_CONE_CAP, ARROW_CYL, ARROW_CYL_CAP }; - static void CreateSphere(); - static void CreateArrow(); - static void ApplyQuat(float *outX, float *outY, float *outZ, float x, float y, float z, float qx, float qy, float qz, float qs); - static void QuatFromDir(double *outQx, double *outQy, double *outQz, double *outQs, double dx, double dy, double dz); - inline void Permute(float *outX, float *outY, float *outZ, float x, float y, float z); - inline void PermuteInv(float *outX, float *outY, float *outZ, float x, float y, float z); - inline void Permute(double *outX, double *outY, double *outZ, double x, double y, double z); - inline void PermuteInv(double *outX, double *outY, double *outZ, double x, double y, double z); - bool m_Highlighted; - bool m_Rotating; - double m_OrigQuat[4]; - float m_OrigX, m_OrigY; - double m_PrevX, m_PrevY; -}; - - -// --------------------------------------------------------------------------- -// CTwFPU objects set and restore the fpu precision if needed. -// (could be useful because DirectX changes it and AntTweakBar requires default double precision) -// --------------------------------------------------------------------------- - - -struct CTwFPU -{ - CTwFPU() - { - #ifdef ANT_WINDOWS - state0 = _controlfp(0, 0); - if( (state0&MCW_PC)==_PC_24 ) // we need at least _PC_53 - _controlfp(_PC_53, MCW_PC); - #else - state0 = 0; - #endif - } - ~CTwFPU() - { - #ifdef ANT_WINDOWS - if( (state0&MCW_PC)==_PC_24 ) - _controlfp(_PC_24, MCW_PC); - #else - state0 = 0; - #endif - } -private: - unsigned int state0; -}; - -// --------------------------------------------------------------------------- - - -#endif // !defined ANT_TW_MGR_INCLUDED diff --git a/extern/AntTweakBar/src/TwOpenGL.cpp b/extern/AntTweakBar/src/TwOpenGL.cpp deleted file mode 100644 index 832123f3..00000000 --- a/extern/AntTweakBar/src/TwOpenGL.cpp +++ /dev/null @@ -1,906 +0,0 @@ -// --------------------------------------------------------------------------- -// -// @file TwOpenGL.cpp -// @author Philippe Decaudin -// @license This file is part of the AntTweakBar library. -// For conditions of distribution and use, see License.txt -// -// --------------------------------------------------------------------------- - - -#include "TwPrecomp.h" -#include "LoadOGL.h" -#include "TwOpenGL.h" -#include "TwMgr.h" - -using namespace std; - -const char *g_ErrCantLoadOGL = "Cannot load OpenGL library dynamically"; -const char *g_ErrCantUnloadOGL = "Cannot unload OpenGL library"; - -GLuint g_SmallFontTexID = 0; -GLuint g_NormalFontTexID = 0; -GLuint g_LargeFontTexID = 0; - -// --------------------------------------------------------------------------- -// Extensions - -typedef void (APIENTRY * PFNGLBindBufferARB)(GLenum target, GLuint buffer); -typedef void (APIENTRY * PFNGLBindProgramARB)(GLenum target, GLuint program); -typedef GLuint (APIENTRY * PFNGLGetHandleARB)(GLenum pname); -typedef void (APIENTRY * PFNGLUseProgramObjectARB)(GLuint programObj); -typedef void (APIENTRY * PFNGLTexImage3D)(GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLenum format, GLenum type, const GLvoid *pixels); -typedef void (APIENTRY * PFNGLActiveTextureARB)(GLenum texture); -typedef void (APIENTRY * PFNGLClientActiveTextureARB)(GLenum texture); -typedef void (APIENTRY * PFNGLBlendEquation)(GLenum mode); -typedef void (APIENTRY * PFNGLBlendEquationSeparate)(GLenum srcMode, GLenum dstMode); -typedef void (APIENTRY * PFNGLBlendFuncSeparate)(GLenum srcRGB, GLenum dstRGB, GLenum srcAlpha, GLenum dstAlpha); -typedef void (APIENTRY * PFNGLBindVertexArray)(GLuint array); -typedef void (APIENTRY * PFNGLEnableVertexAttribArray) (GLuint index); -typedef void (APIENTRY * PFNGLDisableVertexAttribArray) (GLuint index); -typedef void (APIENTRY * PFNGLGetVertexAttribiv) (GLuint, GLenum, GLint*); -PFNGLBindBufferARB _glBindBufferARB = NULL; -PFNGLBindProgramARB _glBindProgramARB = NULL; -PFNGLGetHandleARB _glGetHandleARB = NULL; -PFNGLUseProgramObjectARB _glUseProgramObjectARB = NULL; -PFNGLTexImage3D _glTexImage3D = NULL; -PFNGLActiveTextureARB _glActiveTextureARB = NULL; -PFNGLClientActiveTextureARB _glClientActiveTextureARB = NULL; -PFNGLBlendEquation _glBlendEquation = NULL; -PFNGLBlendEquationSeparate _glBlendEquationSeparate = NULL; -PFNGLBlendFuncSeparate _glBlendFuncSeparate = NULL; -PFNGLBindVertexArray _glBindVertexArray = NULL; -PFNGLEnableVertexAttribArray _glEnableVertexAttribArray = NULL; -PFNGLDisableVertexAttribArray _glDisableVertexAttribArray = NULL; -PFNGLGetVertexAttribiv _glGetVertexAttribiv = NULL; -#ifndef GL_ARRAY_BUFFER_ARB -# define GL_ARRAY_BUFFER_ARB 0x8892 -#endif -#ifndef GL_ELEMENT_ARRAY_BUFFER_ARB -# define GL_ELEMENT_ARRAY_BUFFER_ARB 0x8893 -#endif -#ifndef GL_ARRAY_BUFFER_BINDING_ARB -# define GL_ARRAY_BUFFER_BINDING_ARB 0x8894 -#endif -#ifndef GL_ELEMENT_ARRAY_BUFFER_BINDING_ARB -# define GL_ELEMENT_ARRAY_BUFFER_BINDING_ARB 0x8895 -#endif -#ifndef GL_VERTEX_PROGRAM_ARB -# define GL_VERTEX_PROGRAM_ARB 0x8620 -#endif -#ifndef GL_FRAGMENT_PROGRAM_ARB -# define GL_FRAGMENT_PROGRAM_ARB 0x8804 -#endif -#ifndef GL_PROGRAM_OBJECT_ARB -# define GL_PROGRAM_OBJECT_ARB 0x8B40 -#endif -#ifndef GL_TEXTURE_3D -# define GL_TEXTURE_3D 0x806F -#endif -#ifndef GL_TEXTURE0_ARB -# define GL_TEXTURE0_ARB 0x84C0 -#endif -#ifndef GL_ACTIVE_TEXTURE_ARB -# define GL_ACTIVE_TEXTURE_ARB 0x84E0 -#endif -#ifndef GL_CLIENT_ACTIVE_TEXTURE_ARB -# define GL_CLIENT_ACTIVE_TEXTURE_ARB 0x84E1 -#endif -#ifndef GL_MAX_TEXTURE_UNITS_ARB -# define GL_MAX_TEXTURE_UNITS_ARB 0x84E2 -#endif -#ifndef GL_MAX_TEXTURE_COORDS -# define GL_MAX_TEXTURE_COORDS 0x8871 -#endif -#ifndef GL_TEXTURE_RECTANGLE_ARB -# define GL_TEXTURE_RECTANGLE_ARB 0x84F5 -#endif -#ifndef GL_FUNC_ADD -# define GL_FUNC_ADD 0x8006 -#endif -#ifndef GL_BLEND_EQUATION -# define GL_BLEND_EQUATION 0x8009 -#endif -#ifndef GL_BLEND_EQUATION_RGB -# define GL_BLEND_EQUATION_RGB GL_BLEND_EQUATION -#endif -#ifndef GL_BLEND_EQUATION_ALPHA -# define GL_BLEND_EQUATION_ALPHA 0x883D -#endif -#ifndef GL_BLEND_SRC_RGB -# define GL_BLEND_SRC_RGB 0x80C9 -#endif -#ifndef GL_BLEND_DST_RGB -# define GL_BLEND_DST_RGB 0x80C8 -#endif -#ifndef GL_BLEND_SRC_ALPHA -# define GL_BLEND_SRC_ALPHA 0x80CB -#endif -#ifndef GL_BLEND_DST_ALPHA -# define GL_BLEND_DST_ALPHA 0x80CA -#endif -#ifndef GL_VERTEX_ARRAY_BINDING -# define GL_VERTEX_ARRAY_BINDING 0x85B5 -#endif -#ifndef GL_MAX_VERTEX_ATTRIBS -# define GL_MAX_VERTEX_ATTRIBS 0x8869 -#endif -#ifndef GL_VERTEX_ATTRIB_ARRAY_ENABLED -# define GL_VERTEX_ATTRIB_ARRAY_ENABLED 0x8622 -#endif - -// --------------------------------------------------------------------------- - -#ifdef _DEBUG - static void CheckGLError(const char *file, int line, const char *func) - { - int err=0; - char msg[256]; - while( (err=_glGetError())!=0 ) - { - sprintf(msg, "%s(%d) : [%s] GL_ERROR=0x%x\n", file, line, func, err); - #ifdef ANT_WINDOWS - OutputDebugString(msg); - #endif - fprintf(stderr, msg); - } - } -# ifdef __FUNCTION__ -# define CHECK_GL_ERROR CheckGLError(__FILE__, __LINE__, __FUNCTION__) -# else -# define CHECK_GL_ERROR CheckGLError(__FILE__, __LINE__, "") -# endif -#else -# define CHECK_GL_ERROR ((void)(0)) -#endif - -// --------------------------------------------------------------------------- - -static GLuint BindFont(const CTexFont *_Font) -{ - GLuint TexID = 0; - _glGenTextures(1, &TexID); - _glBindTexture(GL_TEXTURE_2D, TexID); - _glPixelStorei(GL_UNPACK_SWAP_BYTES, GL_FALSE); - _glPixelStorei(GL_UNPACK_LSB_FIRST, GL_FALSE); - _glPixelStorei(GL_UNPACK_ROW_LENGTH, 0); - _glPixelStorei(GL_UNPACK_SKIP_ROWS, 0); - _glPixelStorei(GL_UNPACK_SKIP_PIXELS, 0); - _glPixelStorei(GL_UNPACK_ALIGNMENT, 1); - _glPixelTransferf(GL_ALPHA_SCALE, 1); - _glPixelTransferf(GL_ALPHA_BIAS, 0); - _glPixelTransferf(GL_RED_BIAS, 1); - _glPixelTransferf(GL_GREEN_BIAS, 1); - _glPixelTransferf(GL_BLUE_BIAS, 1); - _glTexImage2D(GL_TEXTURE_2D, 0, 4, _Font->m_TexWidth, _Font->m_TexHeight, 0, GL_ALPHA, GL_UNSIGNED_BYTE, _Font->m_TexBytes); - _glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP); - _glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP); - _glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER,GL_NEAREST); - _glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER,GL_NEAREST); - _glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE); - _glBindTexture(GL_TEXTURE_2D, 0); - _glPixelTransferf(GL_ALPHA_BIAS, 0); - _glPixelTransferf(GL_RED_BIAS, 0); - _glPixelTransferf(GL_GREEN_BIAS, 0); - _glPixelTransferf(GL_BLUE_BIAS, 0); - - return TexID; -} - -static void UnbindFont(GLuint _FontTexID) -{ - if( _FontTexID>0 ) - _glDeleteTextures(1, &_FontTexID); -} - -// --------------------------------------------------------------------------- - -int CTwGraphOpenGL::Init() -{ - m_Drawing = false; - m_FontTexID = 0; - m_FontTex = NULL; - m_MaxClipPlanes = -1; - - if( LoadOpenGL()==0 ) - { - g_TwMgr->SetLastError(g_ErrCantLoadOGL); - return 0; - } - - // Get extensions - _glBindBufferARB = reinterpret_cast(_glGetProcAddress("glBindBufferARB")); - _glBindProgramARB = reinterpret_cast(_glGetProcAddress("glBindProgramARB")); - _glGetHandleARB = reinterpret_cast(_glGetProcAddress("glGetHandleARB")); - _glUseProgramObjectARB = reinterpret_cast(_glGetProcAddress("glUseProgramObjectARB")); - _glTexImage3D = reinterpret_cast(_glGetProcAddress("glTexImage3D")); - _glActiveTextureARB = reinterpret_cast(_glGetProcAddress("glActiveTextureARB")); - _glClientActiveTextureARB = reinterpret_cast(_glGetProcAddress("glClientActiveTextureARB")); - _glBlendEquation = reinterpret_cast(_glGetProcAddress("glBlendEquation")); - _glBlendEquationSeparate = reinterpret_cast(_glGetProcAddress("glBlendEquationSeparate")); - _glBlendFuncSeparate = reinterpret_cast(_glGetProcAddress("glBlendFuncSeparate")); - _glBindVertexArray = reinterpret_cast(_glGetProcAddress("glBindVertexArray")); - _glEnableVertexAttribArray = reinterpret_cast(_glGetProcAddress("glEnableVertexAttribArray")); - _glDisableVertexAttribArray = reinterpret_cast(_glGetProcAddress("glDisableVertexAttribArray")); - _glGetVertexAttribiv = reinterpret_cast(_glGetProcAddress("glGetVertexAttribiv")); - - m_SupportTexRect = false; // updated in BeginDraw - - return 1; -} - -// --------------------------------------------------------------------------- - -int CTwGraphOpenGL::Shut() -{ - assert(m_Drawing==false); - - UnbindFont(m_FontTexID); - - int Res = 1; - if( UnloadOpenGL()==0 ) - { - g_TwMgr->SetLastError(g_ErrCantUnloadOGL); - Res = 0; - } - - return Res; -} - -// --------------------------------------------------------------------------- - -void CTwGraphOpenGL::BeginDraw(int _WndWidth, int _WndHeight) -{ - assert(m_Drawing==false && _WndWidth>0 && _WndHeight>0); - m_Drawing = true; - m_WndWidth = _WndWidth; - m_WndHeight = _WndHeight; - - CHECK_GL_ERROR; - -//#if !defined(ANT_OSX) - static bool s_SupportTexRectChecked = false; - if (!s_SupportTexRectChecked) - { - const char *ext = (const char *)_glGetString(GL_EXTENSIONS); - if( ext!=0 && strlen(ext)>0 ) - m_SupportTexRect = (strstr(ext, "GL_ARB_texture_rectangle")!=NULL); - s_SupportTexRectChecked = true; - } -//#endif - - _glPushAttrib(GL_ALL_ATTRIB_BITS); - _glPushClientAttrib(GL_CLIENT_ALL_ATTRIB_BITS); - - if( _glActiveTextureARB ) - { - _glGetIntegerv(GL_ACTIVE_TEXTURE_ARB, &m_PrevActiveTextureARB); - _glGetIntegerv(GL_CLIENT_ACTIVE_TEXTURE_ARB, &m_PrevClientActiveTextureARB); - GLint maxTexUnits = 1; - _glGetIntegerv(GL_MAX_TEXTURE_COORDS, &maxTexUnits); // was GL_MAX_TEXTURE_UNITS_ARB - if( maxTexUnits<1 ) - maxTexUnits = 1; - else if( maxTexUnits > MAX_TEXTURES ) - maxTexUnits = MAX_TEXTURES; - GLint i; - for( i=0; i0 && _WndHeight>0 ) - { - Vp[0] = 0; - Vp[1] = 0; - Vp[2] = _WndWidth; - Vp[3] = _WndHeight; - _glViewport(Vp[0], Vp[1], Vp[2], Vp[3]); - } - _glLoadIdentity(); - //_glOrtho(Vp[0], Vp[0]+Vp[2]-1, Vp[1]+Vp[3]-1, Vp[1], -1, 1); // Doesn't work - _glOrtho(Vp[0], Vp[0]+Vp[2], Vp[1]+Vp[3], Vp[1], -1, 1); - */ - if( _WndWidth>0 && _WndHeight>0 ) - { - Vp[0] = 0; - Vp[1] = 0; - Vp[2] = _WndWidth-1; - Vp[3] = _WndHeight-1; - _glViewport(Vp[0], Vp[1], Vp[2], Vp[3]); - } - _glLoadIdentity(); - _glOrtho(Vp[0], Vp[0]+Vp[2], Vp[1]+Vp[3], Vp[1], -1, 1); - _glGetIntegerv(GL_VIEWPORT, m_ViewportInit); - _glGetFloatv(GL_PROJECTION_MATRIX, m_ProjMatrixInit); - - _glGetFloatv(GL_LINE_WIDTH, &m_PrevLineWidth); - _glDisable(GL_POLYGON_STIPPLE); - _glLineWidth(1); - _glDisable(GL_LINE_SMOOTH); - _glDisable(GL_LINE_STIPPLE); - _glDisable(GL_CULL_FACE); - _glDisable(GL_DEPTH_TEST); - _glDisable(GL_LIGHTING); - _glEnable(GL_BLEND); - _glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); - _glGetTexEnviv(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, &m_PrevTexEnv); - _glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE); - _glGetIntegerv(GL_POLYGON_MODE, m_PrevPolygonMode); - _glPolygonMode(GL_FRONT_AND_BACK, GL_FILL); - _glDisable(GL_ALPHA_TEST); - //_glEnable(GL_ALPHA_TEST); - //_glAlphaFunc(GL_GREATER, 0); - _glDisable(GL_FOG); - _glDisable(GL_LOGIC_OP); - _glDisable(GL_SCISSOR_TEST); - if( m_MaxClipPlanes<0 ) - { - _glGetIntegerv(GL_MAX_CLIP_PLANES, &m_MaxClipPlanes); - if( m_MaxClipPlanes<0 || m_MaxClipPlanes>255 ) - m_MaxClipPlanes = 6; - } - for( GLint i=0; iMAX_VERTEX_ATTRIBS) - maxVertexAttribs=MAX_VERTEX_ATTRIBS; - - for(int i=0; i MAX_TEXTURES ) - maxTexUnits = MAX_TEXTURES; - GLint i; - for( i=0; iMAX_VERTEX_ATTRIBS) - maxVertexAttribs=MAX_VERTEX_ATTRIBS; - - for(int i=0; i_X1) - ++_X0; - if(_Y0<_Y1) - ++_Y1; - else if(_Y0>_Y1) - ++_Y0; - */ - //const GLfloat dx = +0.0f; - const GLfloat dx = +0.5f; - //GLfloat dy = -0.2f; - const GLfloat dy = -0.5f; - if( _AntiAliased ) - _glEnable(GL_LINE_SMOOTH); - else - _glDisable(GL_LINE_SMOOTH); - _glDisable(GL_TEXTURE_2D); - _glMatrixMode(GL_MODELVIEW); - _glLoadIdentity(); - _glBegin(GL_LINES); - _glColor4ub(GLubyte(_Color0>>16), GLubyte(_Color0>>8), GLubyte(_Color0), GLubyte(_Color0>>24)); - _glVertex2f((GLfloat)_X0+dx, (GLfloat)_Y0+dy); - _glColor4ub(GLubyte(_Color1>>16), GLubyte(_Color1>>8), GLubyte(_Color1), GLubyte(_Color1>>24)); - _glVertex2f((GLfloat)_X1+dx, (GLfloat)_Y1+dy); - //_glVertex2i(_X0, _Y0); - //_glVertex2i(_X1, _Y1); - _glEnd(); - _glDisable(GL_LINE_SMOOTH); -} - -// --------------------------------------------------------------------------- - -void CTwGraphOpenGL::DrawRect(int _X0, int _Y0, int _X1, int _Y1, color32 _Color00, color32 _Color10, color32 _Color01, color32 _Color11) -{ - assert(m_Drawing==true); - - /* - // border adjustment - if(_X0<_X1) - ++_X1; - else if(_X0>_X1) - ++_X0; - if(_Y0<_Y1) - ++_Y1; - else if(_Y0>_Y1) - ++_Y0; - */ - // border adjustment - if(_X0<_X1) - ++_X1; - else if(_X0>_X1) - ++_X0; - if(_Y0<_Y1) - --_Y0; - else if(_Y0>_Y1) - --_Y1; - const GLfloat dx = +0.0f; - const GLfloat dy = +0.0f; - - _glDisable(GL_TEXTURE_2D); - _glMatrixMode(GL_MODELVIEW); - _glLoadIdentity(); - //GLubyte r = GLubyte(_Color>>16); - //GLubyte g = GLubyte(_Color>>8); - //GLubyte b = GLubyte(_Color); - //GLubyte a = GLubyte(_Color>>24); - //_glColor4ub(GLubyte(_Color>>16), GLubyte(_Color>>8), GLubyte(_Color), GLubyte(_Color>>24)); - //_glColor4ub(r, g, b, a); - _glBegin(GL_QUADS); - _glColor4ub(GLubyte(_Color00>>16), GLubyte(_Color00>>8), GLubyte(_Color00), GLubyte(_Color00>>24)); - _glVertex2f((GLfloat)_X0+dx, (GLfloat)_Y0+dy); - _glColor4ub(GLubyte(_Color10>>16), GLubyte(_Color10>>8), GLubyte(_Color10), GLubyte(_Color10>>24)); - _glVertex2f((GLfloat)_X1+dx, (GLfloat)_Y0+dy); - _glColor4ub(GLubyte(_Color11>>16), GLubyte(_Color11>>8), GLubyte(_Color11), GLubyte(_Color11>>24)); - _glVertex2f((GLfloat)_X1+dx, (GLfloat)_Y1+dy); - _glColor4ub(GLubyte(_Color01>>16), GLubyte(_Color01>>8), GLubyte(_Color01), GLubyte(_Color01>>24)); - _glVertex2f((GLfloat)_X0+dx, (GLfloat)_Y1+dy); - _glEnd(); -} - -// --------------------------------------------------------------------------- - -void *CTwGraphOpenGL::NewTextObj() -{ - return new CTextObj; -} - -// --------------------------------------------------------------------------- - -void CTwGraphOpenGL::DeleteTextObj(void *_TextObj) -{ - assert(_TextObj!=NULL); - delete static_cast(_TextObj); -} - -// --------------------------------------------------------------------------- - -void CTwGraphOpenGL::BuildText(void *_TextObj, const std::string *_TextLines, color32 *_LineColors, color32 *_LineBgColors, int _NbLines, const CTexFont *_Font, int _Sep, int _BgWidth) -{ - assert(m_Drawing==true); - assert(_TextObj!=NULL); - assert(_Font!=NULL); - - if( _Font != m_FontTex ) - { - UnbindFont(m_FontTexID); - m_FontTexID = BindFont(_Font); - m_FontTex = _Font; - } - CTextObj *TextObj = static_cast(_TextObj); - TextObj->m_TextVerts.resize(0); - TextObj->m_TextUVs.resize(0); - TextObj->m_BgVerts.resize(0); - TextObj->m_Colors.resize(0); - TextObj->m_BgColors.resize(0); - - int x, x1, y, y1, i, Len; - unsigned char ch; - const unsigned char *Text; - color32 LineColor = COLOR32_RED; - for( int Line=0; Line<_NbLines; ++Line ) - { - x = 0; - y = Line * (_Font->m_CharHeight+_Sep); - y1 = y+_Font->m_CharHeight; - Len = (int)_TextLines[Line].length(); - Text = (const unsigned char *)(_TextLines[Line].c_str()); - if( _LineColors!=NULL ) - LineColor = (_LineColors[Line]&0xff00ff00) | GLubyte(_LineColors[Line]>>16) | (GLubyte(_LineColors[Line])<<16); - - for( i=0; im_CharWidth[ch]; - - TextObj->m_TextVerts.push_back(Vec2(x , y )); - TextObj->m_TextVerts.push_back(Vec2(x1, y )); - TextObj->m_TextVerts.push_back(Vec2(x , y1)); - TextObj->m_TextVerts.push_back(Vec2(x1, y )); - TextObj->m_TextVerts.push_back(Vec2(x1, y1)); - TextObj->m_TextVerts.push_back(Vec2(x , y1)); - - TextObj->m_TextUVs.push_back(Vec2(_Font->m_CharU0[ch], _Font->m_CharV0[ch])); - TextObj->m_TextUVs.push_back(Vec2(_Font->m_CharU1[ch], _Font->m_CharV0[ch])); - TextObj->m_TextUVs.push_back(Vec2(_Font->m_CharU0[ch], _Font->m_CharV1[ch])); - TextObj->m_TextUVs.push_back(Vec2(_Font->m_CharU1[ch], _Font->m_CharV0[ch])); - TextObj->m_TextUVs.push_back(Vec2(_Font->m_CharU1[ch], _Font->m_CharV1[ch])); - TextObj->m_TextUVs.push_back(Vec2(_Font->m_CharU0[ch], _Font->m_CharV1[ch])); - - if( _LineColors!=NULL ) - { - TextObj->m_Colors.push_back(LineColor); - TextObj->m_Colors.push_back(LineColor); - TextObj->m_Colors.push_back(LineColor); - TextObj->m_Colors.push_back(LineColor); - TextObj->m_Colors.push_back(LineColor); - TextObj->m_Colors.push_back(LineColor); - } - - x = x1; - } - if( _BgWidth>0 ) - { - TextObj->m_BgVerts.push_back(Vec2(-1 , y )); - TextObj->m_BgVerts.push_back(Vec2(_BgWidth+1, y )); - TextObj->m_BgVerts.push_back(Vec2(-1 , y1)); - TextObj->m_BgVerts.push_back(Vec2(_BgWidth+1, y )); - TextObj->m_BgVerts.push_back(Vec2(_BgWidth+1, y1)); - TextObj->m_BgVerts.push_back(Vec2(-1 , y1)); - - if( _LineBgColors!=NULL ) - { - color32 LineBgColor = (_LineBgColors[Line]&0xff00ff00) | GLubyte(_LineBgColors[Line]>>16) | (GLubyte(_LineBgColors[Line])<<16); - TextObj->m_BgColors.push_back(LineBgColor); - TextObj->m_BgColors.push_back(LineBgColor); - TextObj->m_BgColors.push_back(LineBgColor); - TextObj->m_BgColors.push_back(LineBgColor); - TextObj->m_BgColors.push_back(LineBgColor); - TextObj->m_BgColors.push_back(LineBgColor); - } - } - } -} - -// --------------------------------------------------------------------------- - -void CTwGraphOpenGL::DrawText(void *_TextObj, int _X, int _Y, color32 _Color, color32 _BgColor) -{ - assert(m_Drawing==true); - assert(_TextObj!=NULL); - CTextObj *TextObj = static_cast(_TextObj); - - if( TextObj->m_TextVerts.size()<4 && TextObj->m_BgVerts.size()<4 ) - return; // nothing to draw - - _glMatrixMode(GL_MODELVIEW); - _glLoadIdentity(); - _glTranslatef((GLfloat)_X, (GLfloat)_Y, 0); - _glEnableClientState(GL_VERTEX_ARRAY); - if( (_BgColor!=0 || TextObj->m_BgColors.size()==TextObj->m_BgVerts.size()) && TextObj->m_BgVerts.size()>=4 ) - { - _glDisable(GL_TEXTURE_2D); - _glVertexPointer(2, GL_FLOAT, 0, &(TextObj->m_BgVerts[0])); - if( TextObj->m_BgColors.size()==TextObj->m_BgVerts.size() && _BgColor==0 ) - { - _glEnableClientState(GL_COLOR_ARRAY); - _glColorPointer(4, GL_UNSIGNED_BYTE, 0, &(TextObj->m_BgColors[0])); - } - else - { - _glDisableClientState(GL_COLOR_ARRAY); - _glColor4ub(GLubyte(_BgColor>>16), GLubyte(_BgColor>>8), GLubyte(_BgColor), GLubyte(_BgColor>>24)); - } - _glDrawArrays(GL_TRIANGLES, 0, (int)TextObj->m_BgVerts.size()); - } - _glEnable(GL_TEXTURE_2D); - _glBindTexture(GL_TEXTURE_2D, m_FontTexID); - _glEnableClientState(GL_TEXTURE_COORD_ARRAY); - if( TextObj->m_TextVerts.size()>=4 ) - { - _glVertexPointer(2, GL_FLOAT, 0, &(TextObj->m_TextVerts[0])); - _glTexCoordPointer(2, GL_FLOAT, 0, &(TextObj->m_TextUVs[0])); - if( TextObj->m_Colors.size()==TextObj->m_TextVerts.size() && _Color==0 ) - { - _glEnableClientState(GL_COLOR_ARRAY); - _glColorPointer(4, GL_UNSIGNED_BYTE, 0, &(TextObj->m_Colors[0])); - } - else - { - _glDisableClientState(GL_COLOR_ARRAY); - _glColor4ub(GLubyte(_Color>>16), GLubyte(_Color>>8), GLubyte(_Color), GLubyte(_Color>>24)); - } - - _glDrawArrays(GL_TRIANGLES, 0, (int)TextObj->m_TextVerts.size()); - } - - _glDisableClientState(GL_VERTEX_ARRAY); - _glDisableClientState(GL_TEXTURE_COORD_ARRAY); - _glDisableClientState(GL_COLOR_ARRAY); -} - -// --------------------------------------------------------------------------- - -void CTwGraphOpenGL::ChangeViewport(int _X0, int _Y0, int _Width, int _Height, int _OffsetX, int _OffsetY) -{ - if( _Width>0 && _Height>0 ) - { - GLint vp[4]; - vp[0] = _X0; - vp[1] = _Y0; - vp[2] = _Width-1; - vp[3] = _Height-1; - _glViewport(vp[0], m_WndHeight-vp[1]-vp[3], vp[2], vp[3]); - - GLint matrixMode = 0; - _glGetIntegerv(GL_MATRIX_MODE, &matrixMode); - _glMatrixMode(GL_PROJECTION); - _glLoadIdentity(); - _glOrtho(_OffsetX, _OffsetX+vp[2], vp[3]-_OffsetY, -_OffsetY, -1, 1); - _glMatrixMode(matrixMode); - } -} - -// --------------------------------------------------------------------------- - -void CTwGraphOpenGL::RestoreViewport() -{ - _glViewport(m_ViewportInit[0], m_ViewportInit[1], m_ViewportInit[2], m_ViewportInit[3]); - - GLint matrixMode = 0; - _glGetIntegerv(GL_MATRIX_MODE, &matrixMode); - _glMatrixMode(GL_PROJECTION); - _glLoadMatrixf(m_ProjMatrixInit); - _glMatrixMode(matrixMode); -} - -// --------------------------------------------------------------------------- - -void CTwGraphOpenGL::SetScissor(int _X0, int _Y0, int _Width, int _Height) -{ - if( _Width>0 && _Height>0 ) - { - _glScissor(_X0-1, m_WndHeight-_Y0-_Height, _Width-1, _Height); - _glEnable(GL_SCISSOR_TEST); - } - else - _glDisable(GL_SCISSOR_TEST); -} - -// --------------------------------------------------------------------------- - -void CTwGraphOpenGL::DrawTriangles(int _NumTriangles, int *_Vertices, color32 *_Colors, Cull _CullMode) -{ - assert(m_Drawing==true); - - const GLfloat dx = +0.0f; - const GLfloat dy = +0.0f; - - GLint prevCullFaceMode, prevFrontFace; - _glGetIntegerv(GL_CULL_FACE_MODE, &prevCullFaceMode); - _glGetIntegerv(GL_FRONT_FACE, &prevFrontFace); - GLboolean prevCullEnable = _glIsEnabled(GL_CULL_FACE); - _glCullFace(GL_BACK); - _glEnable(GL_CULL_FACE); - if( _CullMode==CULL_CW ) - _glFrontFace(GL_CCW); - else if( _CullMode==CULL_CCW ) - _glFrontFace(GL_CW); - else - _glDisable(GL_CULL_FACE); - - _glDisable(GL_TEXTURE_2D); - _glMatrixMode(GL_MODELVIEW); - _glLoadIdentity(); - _glBegin(GL_TRIANGLES); - for(int i=0; i<3*_NumTriangles; ++i) - { - color32 col = _Colors[i]; - _glColor4ub(GLubyte(col>>16), GLubyte(col>>8), GLubyte(col), GLubyte(col>>24)); - _glVertex2f((GLfloat)_Vertices[2*i+0]+dx, (GLfloat)_Vertices[2*i+1]+dy); - } - _glEnd(); - - _glCullFace(prevCullFaceMode); - _glFrontFace(prevFrontFace); - if( prevCullEnable ) - _glEnable(GL_CULL_FACE); - else - _glDisable(GL_CULL_FACE); -} - -// --------------------------------------------------------------------------- diff --git a/extern/AntTweakBar/src/TwOpenGL.h b/extern/AntTweakBar/src/TwOpenGL.h deleted file mode 100644 index 40826494..00000000 --- a/extern/AntTweakBar/src/TwOpenGL.h +++ /dev/null @@ -1,98 +0,0 @@ -// --------------------------------------------------------------------------- -// -// @file TwOpenGL.h -// @brief OpenGL graph functions -// @author Philippe Decaudin -// @license This file is part of the AntTweakBar library. -// For conditions of distribution and use, see License.txt -// -// note: Private header -// -// --------------------------------------------------------------------------- - - -#if !defined ANT_TW_OPENGL_INCLUDED -#define ANT_TW_OPENGL_INCLUDED - -#include "TwGraph.h" - -// --------------------------------------------------------------------------- - -class CTwGraphOpenGL : public ITwGraph -{ -public: - virtual int Init(); - virtual int Shut(); - virtual void BeginDraw(int _WndWidth, int _WndHeight); - virtual void EndDraw(); - virtual bool IsDrawing(); - virtual void Restore(); - virtual void DrawLine(int _X0, int _Y0, int _X1, int _Y1, color32 _Color0, color32 _Color1, bool _AntiAliased=false); - virtual void DrawLine(int _X0, int _Y0, int _X1, int _Y1, color32 _Color, bool _AntiAliased=false) { DrawLine(_X0, _Y0, _X1, _Y1, _Color, _Color, _AntiAliased); } - virtual void DrawRect(int _X0, int _Y0, int _X1, int _Y1, color32 _Color00, color32 _Color10, color32 _Color01, color32 _Color11); - virtual void DrawRect(int _X0, int _Y0, int _X1, int _Y1, color32 _Color) { DrawRect(_X0, _Y0, _X1, _Y1, _Color, _Color, _Color, _Color); } - virtual void DrawTriangles(int _NumTriangles, int *_Vertices, color32 *_Colors, Cull _CullMode); - - virtual void * NewTextObj(); - virtual void DeleteTextObj(void *_TextObj); - virtual void BuildText(void *_TextObj, const std::string *_TextLines, color32 *_LineColors, color32 *_LineBgColors, int _NbLines, const CTexFont *_Font, int _Sep, int _BgWidth); - virtual void DrawText(void *_TextObj, int _X, int _Y, color32 _Color, color32 _BgColor); - - virtual void ChangeViewport(int _X0, int _Y0, int _Width, int _Height, int _OffsetX, int _OffsetY); - virtual void RestoreViewport(); - virtual void SetScissor(int _X0, int _Y0, int _Width, int _Height); - -protected: - bool m_Drawing; - GLuint m_FontTexID; - const CTexFont * m_FontTex; - GLfloat m_PrevLineWidth; - GLint m_PrevTexEnv; - GLint m_PrevPolygonMode[2]; - GLint m_MaxClipPlanes; - GLint m_PrevTexture; - GLint m_PrevArrayBufferARB; - GLint m_PrevElementArrayBufferARB; - GLboolean m_PrevVertexProgramARB; - GLboolean m_PrevFragmentProgramARB; - GLuint m_PrevProgramObjectARB; - GLboolean m_PrevTexture3D; - enum EMaxTextures { MAX_TEXTURES = 128 }; - GLboolean m_PrevActiveTexture1D[MAX_TEXTURES]; - GLboolean m_PrevActiveTexture2D[MAX_TEXTURES]; - GLboolean m_PrevActiveTexture3D[MAX_TEXTURES]; - GLboolean m_PrevClientTexCoordArray[MAX_TEXTURES]; - GLint m_PrevActiveTextureARB; - GLint m_PrevClientActiveTextureARB; - bool m_SupportTexRect; - GLboolean m_PrevTexRectARB; - GLint m_PrevBlendEquation; - GLint m_PrevBlendEquationRGB; - GLint m_PrevBlendEquationAlpha; - GLint m_PrevBlendSrcRGB; - GLint m_PrevBlendDstRGB; - GLint m_PrevBlendSrcAlpha; - GLint m_PrevBlendDstAlpha; - GLuint m_PrevVertexArray; - GLint m_ViewportInit[4]; - GLfloat m_ProjMatrixInit[16]; - enum EMaxVtxAttribs { MAX_VERTEX_ATTRIBS = 128 }; - GLint m_PrevEnabledVertexAttrib[MAX_VERTEX_ATTRIBS]; - int m_WndWidth; - int m_WndHeight; - - struct Vec2 { GLfloat x, y; Vec2(){} Vec2(GLfloat _X, GLfloat _Y):x(_X),y(_Y){} Vec2(int _X, int _Y):x(GLfloat(_X)),y(GLfloat(_Y)){} }; - struct CTextObj - { - std::vector m_TextVerts; - std::vector m_TextUVs; - std::vector m_BgVerts; - std::vectorm_Colors; - std::vectorm_BgColors; - }; -}; - -// --------------------------------------------------------------------------- - - -#endif // !defined ANT_TW_OPENGL_INCLUDED diff --git a/extern/AntTweakBar/src/TwOpenGLCore.cpp b/extern/AntTweakBar/src/TwOpenGLCore.cpp deleted file mode 100644 index dfee5888..00000000 --- a/extern/AntTweakBar/src/TwOpenGLCore.cpp +++ /dev/null @@ -1,933 +0,0 @@ -// --------------------------------------------------------------------------- -// -// @file TwOpenGLCore.cpp -// @author Philippe Decaudin -// @license This file is part of the AntTweakBar library. -// For conditions of distribution and use, see License.txt -// -// --------------------------------------------------------------------------- - -/* -#pragma warning GL3 //// used for development -#define GL3_PROTOTYPES 1 //// -#include //// -#define ANT_OGL_HEADER_INCLUDED //// -*/ - -#if defined ANT_OSX -# include -# define ANT_OGL_HEADER_INCLUDED -#endif -#include "TwPrecomp.h" -#include "LoadOGLCore.h" -#include "TwOpenGLCore.h" -#include "TwMgr.h" - -using namespace std; - -extern const char *g_ErrCantLoadOGL; -extern const char *g_ErrCantUnloadOGL; - -// --------------------------------------------------------------------------- - -#ifdef _DEBUG - static void CheckGLCoreError(const char *file, int line, const char *func) - { - int err=0; - char msg[256]; - while( (err=_glGetError())!=0 ) - { - sprintf(msg, "%s(%d) : [%s] GL_CORE_ERROR=0x%x\n", file, line, func, err); - #ifdef ANT_WINDOWS - OutputDebugString(msg); - #endif - fprintf(stderr, msg); - } - } -# ifdef __FUNCTION__ -# define CHECK_GL_ERROR CheckGLCoreError(__FILE__, __LINE__, __FUNCTION__) -# else -# define CHECK_GL_ERROR CheckGLCoreError(__FILE__, __LINE__, "") -# endif -#else -# define CHECK_GL_ERROR ((void)(0)) -#endif - -// --------------------------------------------------------------------------- - -static GLuint BindFont(const CTexFont *_Font) -{ - GLuint TexID = 0; - _glGenTextures(1, &TexID); - _glBindTexture(GL_TEXTURE_2D, TexID); - _glPixelStorei(GL_UNPACK_SWAP_BYTES, GL_FALSE); - _glPixelStorei(GL_UNPACK_LSB_FIRST, GL_FALSE); - _glPixelStorei(GL_UNPACK_ROW_LENGTH, 0); - _glPixelStorei(GL_UNPACK_SKIP_ROWS, 0); - _glPixelStorei(GL_UNPACK_SKIP_PIXELS, 0); - _glPixelStorei(GL_UNPACK_ALIGNMENT, 1); - _glTexImage2D(GL_TEXTURE_2D, 0, GL_RED, _Font->m_TexWidth, _Font->m_TexHeight, 0, GL_RED, GL_UNSIGNED_BYTE, _Font->m_TexBytes); - _glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE); - _glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE); - _glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER,GL_NEAREST); - _glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER,GL_NEAREST); - _glBindTexture(GL_TEXTURE_2D, 0); - - return TexID; -} - -static void UnbindFont(GLuint _FontTexID) -{ - if( _FontTexID>0 ) - _glDeleteTextures(1, &_FontTexID); -} - -// --------------------------------------------------------------------------- - -static GLuint CompileShader(GLuint shader) -{ - _glCompileShader(shader); CHECK_GL_ERROR; - - GLint status; - _glGetShaderiv(shader, GL_COMPILE_STATUS, &status); CHECK_GL_ERROR; - if (status == GL_FALSE) - { - GLint infoLogLength; - _glGetShaderiv(shader, GL_INFO_LOG_LENGTH, &infoLogLength); CHECK_GL_ERROR; - - GLchar strInfoLog[256]; - _glGetShaderInfoLog(shader, sizeof(strInfoLog), NULL, strInfoLog); CHECK_GL_ERROR; -#ifdef ANT_WINDOWS - OutputDebugString("Compile failure: "); - OutputDebugString(strInfoLog); - OutputDebugString("\n"); -#endif - fprintf(stderr, "Compile failure: %s\n", strInfoLog); - shader = 0; - } - - return shader; -} - -static GLuint LinkProgram(GLuint program) -{ - _glLinkProgram(program); CHECK_GL_ERROR; - - GLint status; - _glGetProgramiv(program, GL_LINK_STATUS, &status); CHECK_GL_ERROR; - if (status == GL_FALSE) - { - GLint infoLogLength; - _glGetProgramiv(program, GL_INFO_LOG_LENGTH, &infoLogLength); CHECK_GL_ERROR; - - GLchar strInfoLog[256]; - _glGetProgramInfoLog(program, sizeof(strInfoLog), NULL, strInfoLog); CHECK_GL_ERROR; -#ifdef ANT_WINDOWS - OutputDebugString("Linker failure: "); - OutputDebugString(strInfoLog); - OutputDebugString("\n"); -#endif - fprintf(stderr, "Linker failure: %s\n", strInfoLog); - program = 0; - } - - return program; -} - -// --------------------------------------------------------------------------- - -void CTwGraphOpenGLCore::ResizeTriBuffers(size_t _NewSize) -{ - m_TriBufferSize = _NewSize; - - _glBindVertexArray(m_TriVArray); - - _glBindBuffer(GL_ARRAY_BUFFER, m_TriVertices); - _glBufferData(GL_ARRAY_BUFFER, m_TriBufferSize*sizeof(Vec2), 0, GL_DYNAMIC_DRAW); - - _glBindBuffer(GL_ARRAY_BUFFER, m_TriUVs); - _glBufferData(GL_ARRAY_BUFFER, m_TriBufferSize*sizeof(Vec2), 0, GL_DYNAMIC_DRAW); - - _glBindBuffer(GL_ARRAY_BUFFER, m_TriColors); - _glBufferData(GL_ARRAY_BUFFER, m_TriBufferSize*sizeof(color32), 0, GL_DYNAMIC_DRAW); - - CHECK_GL_ERROR; -} - -// --------------------------------------------------------------------------- - -int CTwGraphOpenGLCore::Init() -{ - m_Drawing = false; - m_FontTexID = 0; - m_FontTex = NULL; - - if( LoadOpenGLCore()==0 ) - { - g_TwMgr->SetLastError(g_ErrCantLoadOGL); - return 0; - } - - // Create line/rect shaders - const GLchar *lineRectVS[] = { - "#version 150 core\n" - "in vec3 vertex;" - "in vec4 color;" - "out vec4 fcolor;" - "void main() { gl_Position = vec4(vertex, 1); fcolor = color; }" - }; - m_LineRectVS = _glCreateShader(GL_VERTEX_SHADER); - _glShaderSource(m_LineRectVS, 1, lineRectVS, NULL); - CompileShader(m_LineRectVS); - - const GLchar *lineRectFS[] = { - "#version 150 core\n" - "precision highp float;" - "in vec4 fcolor;" - "out vec4 outColor;" - "void main() { outColor = fcolor; }" - }; - m_LineRectFS = _glCreateShader(GL_FRAGMENT_SHADER); - _glShaderSource(m_LineRectFS, 1, lineRectFS, NULL); - CompileShader(m_LineRectFS); - - m_LineRectProgram = _glCreateProgram(); - _glAttachShader(m_LineRectProgram, m_LineRectVS); - _glAttachShader(m_LineRectProgram, m_LineRectFS); - _glBindAttribLocation(m_LineRectProgram, 0, "vertex"); - _glBindAttribLocation(m_LineRectProgram, 1, "color"); - LinkProgram(m_LineRectProgram); - - // Create line/rect vertex buffer - const GLfloat lineRectInitVertices[] = { 0,0,0, 0,0,0, 0,0,0, 0,0,0 }; - const color32 lineRectInitColors[] = { 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff }; - _glGenVertexArrays(1, &m_LineRectVArray); - _glBindVertexArray(m_LineRectVArray); - _glGenBuffers(1, &m_LineRectVertices); - _glBindBuffer(GL_ARRAY_BUFFER, m_LineRectVertices); - _glBufferData(GL_ARRAY_BUFFER, sizeof(lineRectInitVertices), lineRectInitVertices, GL_DYNAMIC_DRAW); - _glGenBuffers(1, &m_LineRectColors); - _glBindBuffer(GL_ARRAY_BUFFER, m_LineRectColors); - _glBufferData(GL_ARRAY_BUFFER, sizeof(lineRectInitColors), lineRectInitColors, GL_DYNAMIC_DRAW); - - // Create triangles shaders - const GLchar *triVS[] = { - "#version 150 core\n" - "uniform vec2 offset;" - "uniform vec2 wndSize;" - "in vec2 vertex;" - "in vec4 color;" - "out vec4 fcolor;" - "void main() { gl_Position = vec4(2.0*(vertex.x+offset.x-0.5)/wndSize.x - 1.0, 1.0 - 2.0*(vertex.y+offset.y-0.5)/wndSize.y, 0, 1); fcolor = color; }" - }; - m_TriVS = _glCreateShader(GL_VERTEX_SHADER); - _glShaderSource(m_TriVS, 1, triVS, NULL); - CompileShader(m_TriVS); - - const GLchar *triUniVS[] = { - "#version 150 core\n" - "uniform vec2 offset;" - "uniform vec2 wndSize;" - "uniform vec4 color;" - "in vec2 vertex;" - "out vec4 fcolor;" - "void main() { gl_Position = vec4(2.0*(vertex.x+offset.x-0.5)/wndSize.x - 1.0, 1.0 - 2.0*(vertex.y+offset.y-0.5)/wndSize.y, 0, 1); fcolor = color; }" - }; - m_TriUniVS = _glCreateShader(GL_VERTEX_SHADER); - _glShaderSource(m_TriUniVS, 1, triUniVS, NULL); - CompileShader(m_TriUniVS); - - m_TriFS = m_TriUniFS = m_LineRectFS; - - m_TriProgram = _glCreateProgram(); - _glAttachShader(m_TriProgram, m_TriVS); - _glAttachShader(m_TriProgram, m_TriFS); - _glBindAttribLocation(m_TriProgram, 0, "vertex"); - _glBindAttribLocation(m_TriProgram, 1, "color"); - LinkProgram(m_TriProgram); - m_TriLocationOffset = _glGetUniformLocation(m_TriProgram, "offset"); - m_TriLocationWndSize = _glGetUniformLocation(m_TriProgram, "wndSize"); - - m_TriUniProgram = _glCreateProgram(); - _glAttachShader(m_TriUniProgram, m_TriUniVS); - _glAttachShader(m_TriUniProgram, m_TriUniFS); - _glBindAttribLocation(m_TriUniProgram, 0, "vertex"); - _glBindAttribLocation(m_TriUniProgram, 1, "color"); - LinkProgram(m_TriUniProgram); - m_TriUniLocationOffset = _glGetUniformLocation(m_TriUniProgram, "offset"); - m_TriUniLocationWndSize = _glGetUniformLocation(m_TriUniProgram, "wndSize"); - m_TriUniLocationColor = _glGetUniformLocation(m_TriUniProgram, "color"); - - const GLchar *triTexFS[] = { - "#version 150 core\n" - "precision highp float;" - "uniform sampler2D tex;" - "in vec2 fuv;" - "in vec4 fcolor;" - "out vec4 outColor;" -// texture2D is deprecated and replaced by texture with GLSL 3.30 but it seems -// that on Mac Lion backward compatibility is not ensured. -#if defined(ANT_OSX) && (MAC_OS_X_VERSION_MAX_ALLOWED >= 1070) - "void main() { outColor.rgb = fcolor.bgr; outColor.a = fcolor.a * texture(tex, fuv).r; }" -#else - "void main() { outColor.rgb = fcolor.bgr; outColor.a = fcolor.a * texture2D(tex, fuv).r; }" -#endif - }; - m_TriTexFS = _glCreateShader(GL_FRAGMENT_SHADER); - _glShaderSource(m_TriTexFS, 1, triTexFS, NULL); - CompileShader(m_TriTexFS); - - const GLchar *triTexVS[] = { - "#version 150 core\n" - "uniform vec2 offset;" - "uniform vec2 wndSize;" - "in vec2 vertex;" - "in vec2 uv;" - "in vec4 color;" - "out vec2 fuv;" - "out vec4 fcolor;" - "void main() { gl_Position = vec4(2.0*(vertex.x+offset.x-0.5)/wndSize.x - 1.0, 1.0 - 2.0*(vertex.y+offset.y-0.5)/wndSize.y, 0, 1); fuv = uv; fcolor = color; }" - }; - m_TriTexVS = _glCreateShader(GL_VERTEX_SHADER); - _glShaderSource(m_TriTexVS, 1, triTexVS, NULL); - CompileShader(m_TriTexVS); - - const GLchar *triTexUniVS[] = { - "#version 150 core\n" - "uniform vec2 offset;" - "uniform vec2 wndSize;" - "uniform vec4 color;" - "in vec2 vertex;" - "in vec2 uv;" - "out vec4 fcolor;" - "out vec2 fuv;" - "void main() { gl_Position = vec4(2.0*(vertex.x+offset.x-0.5)/wndSize.x - 1.0, 1.0 - 2.0*(vertex.y+offset.y-0.5)/wndSize.y, 0, 1); fuv = uv; fcolor = color; }" - }; - m_TriTexUniVS = _glCreateShader(GL_VERTEX_SHADER); - _glShaderSource(m_TriTexUniVS, 1, triTexUniVS, NULL); - CompileShader(m_TriTexUniVS); - - m_TriTexUniFS = m_TriTexFS; - - m_TriTexProgram = _glCreateProgram(); - _glAttachShader(m_TriTexProgram, m_TriTexVS); - _glAttachShader(m_TriTexProgram, m_TriTexFS); - _glBindAttribLocation(m_TriTexProgram, 0, "vertex"); - _glBindAttribLocation(m_TriTexProgram, 1, "uv"); - _glBindAttribLocation(m_TriTexProgram, 2, "color"); - LinkProgram(m_TriTexProgram); - m_TriTexLocationOffset = _glGetUniformLocation(m_TriTexProgram, "offset"); - m_TriTexLocationWndSize = _glGetUniformLocation(m_TriTexProgram, "wndSize"); - m_TriTexLocationTexture = _glGetUniformLocation(m_TriTexProgram, "tex"); - - m_TriTexUniProgram = _glCreateProgram(); - _glAttachShader(m_TriTexUniProgram, m_TriTexUniVS); - _glAttachShader(m_TriTexUniProgram, m_TriTexUniFS); - _glBindAttribLocation(m_TriTexUniProgram, 0, "vertex"); - _glBindAttribLocation(m_TriTexUniProgram, 1, "uv"); - _glBindAttribLocation(m_TriTexUniProgram, 2, "color"); - LinkProgram(m_TriTexUniProgram); - m_TriTexUniLocationOffset = _glGetUniformLocation(m_TriTexUniProgram, "offset"); - m_TriTexUniLocationWndSize = _glGetUniformLocation(m_TriTexUniProgram, "wndSize"); - m_TriTexUniLocationColor = _glGetUniformLocation(m_TriTexUniProgram, "color"); - m_TriTexUniLocationTexture = _glGetUniformLocation(m_TriTexUniProgram, "tex"); - - // Create tri vertex buffer - _glGenVertexArrays(1, &m_TriVArray); - _glGenBuffers(1, &m_TriVertices); - _glGenBuffers(1, &m_TriUVs); - _glGenBuffers(1, &m_TriColors); - ResizeTriBuffers(16384); // set initial size - - CHECK_GL_ERROR; - return 1; -} - -// --------------------------------------------------------------------------- - -int CTwGraphOpenGLCore::Shut() -{ - assert(m_Drawing==false); - - UnbindFont(m_FontTexID); - - CHECK_GL_ERROR; - - _glDeleteProgram(m_LineRectProgram); m_LineRectProgram = 0; - _glDeleteShader(m_LineRectVS); m_LineRectVS = 0; - _glDeleteShader(m_LineRectFS); m_LineRectFS = 0; - - _glDeleteProgram(m_TriProgram); m_TriProgram = 0; - _glDeleteShader(m_TriVS); m_TriVS = 0; - - _glDeleteProgram(m_TriUniProgram); m_TriUniProgram = 0; - _glDeleteShader(m_TriUniVS); m_TriUniVS = 0; - - _glDeleteProgram(m_TriTexProgram); m_TriTexProgram = 0; - _glDeleteShader(m_TriTexVS); m_TriTexVS = 0; - _glDeleteShader(m_TriTexFS); m_TriTexFS = 0; - - _glDeleteProgram(m_TriTexUniProgram); m_TriTexUniProgram = 0; - _glDeleteShader(m_TriTexUniVS); m_TriTexUniVS = 0; - - _glDeleteBuffers(1, &m_LineRectVertices); m_LineRectVertices = 0; - _glDeleteBuffers(1, &m_LineRectColors); m_LineRectColors = 0; - _glDeleteVertexArrays(1, &m_LineRectVArray); m_LineRectVArray = 0; - - _glDeleteBuffers(1, &m_TriVertices); m_TriVertices = 0; - _glDeleteBuffers(1, &m_TriColors); m_TriColors = 0; - _glDeleteBuffers(1, &m_TriUVs); m_TriUVs = 0; - _glDeleteVertexArrays(1, &m_TriVArray); m_TriVArray = 0; - - CHECK_GL_ERROR; - - int Res = 1; - if( UnloadOpenGLCore()==0 ) - { - g_TwMgr->SetLastError(g_ErrCantUnloadOGL); - Res = 0; - } - - return Res; -} - -// --------------------------------------------------------------------------- - -void CTwGraphOpenGLCore::BeginDraw(int _WndWidth, int _WndHeight) -{ - CHECK_GL_ERROR; - assert(m_Drawing==false && _WndWidth>0 && _WndHeight>0); - m_Drawing = true; - m_WndWidth = _WndWidth; - m_WndHeight = _WndHeight; - m_OffsetX = 0; - m_OffsetY = 0; - - _glGetIntegerv(GL_VIEWPORT, m_PrevViewport); CHECK_GL_ERROR; - if( _WndWidth>0 && _WndHeight>0 ) - { - GLint Vp[4]; - Vp[0] = 0; - Vp[1] = 0; - Vp[2] = _WndWidth-1; - Vp[3] = _WndHeight-1; - _glViewport(Vp[0], Vp[1], Vp[2], Vp[3]); - } - - m_PrevVArray = 0; - _glGetIntegerv(GL_VERTEX_ARRAY_BINDING, (GLint*)&m_PrevVArray); CHECK_GL_ERROR; - _glBindVertexArray(0); CHECK_GL_ERROR; - - m_PrevLineWidth = 1; - _glGetFloatv(GL_LINE_WIDTH, &m_PrevLineWidth); CHECK_GL_ERROR; - _glLineWidth(1); CHECK_GL_ERROR; - - m_PrevLineSmooth = _glIsEnabled(GL_LINE_SMOOTH); - _glDisable(GL_LINE_SMOOTH); CHECK_GL_ERROR; - - m_PrevCullFace = _glIsEnabled(GL_CULL_FACE); - _glDisable(GL_CULL_FACE); CHECK_GL_ERROR; - - m_PrevDepthTest = _glIsEnabled(GL_DEPTH_TEST); - _glDisable(GL_DEPTH_TEST); CHECK_GL_ERROR; - - m_PrevBlend = _glIsEnabled(GL_BLEND); - _glEnable(GL_BLEND); CHECK_GL_ERROR; - - m_PrevScissorTest = _glIsEnabled(GL_SCISSOR_TEST); - _glDisable(GL_SCISSOR_TEST); CHECK_GL_ERROR; - - _glGetIntegerv(GL_SCISSOR_BOX, m_PrevScissorBox); CHECK_GL_ERROR; - - _glGetIntegerv(GL_BLEND_SRC, &m_PrevSrcBlend); CHECK_GL_ERROR; - _glGetIntegerv(GL_BLEND_DST, &m_PrevDstBlend); CHECK_GL_ERROR; - _glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); CHECK_GL_ERROR; - - m_PrevTexture = 0; - _glGetIntegerv(GL_TEXTURE_BINDING_2D, &m_PrevTexture); CHECK_GL_ERROR; - _glBindTexture(GL_TEXTURE_2D, 0); CHECK_GL_ERROR; - - m_PrevProgramObject = 0; - _glGetIntegerv(GL_CURRENT_PROGRAM, (GLint*)&m_PrevProgramObject); CHECK_GL_ERROR; - _glBindVertexArray(0); CHECK_GL_ERROR; - _glUseProgram(0); CHECK_GL_ERROR; - - m_PrevActiveTexture = 0; - _glGetIntegerv(GL_ACTIVE_TEXTURE, (GLint*)&m_PrevActiveTexture); CHECK_GL_ERROR; - _glActiveTexture(GL_TEXTURE0); - - CHECK_GL_ERROR; -} - -// --------------------------------------------------------------------------- - -void CTwGraphOpenGLCore::EndDraw() -{ - assert(m_Drawing==true); - m_Drawing = false; - - _glLineWidth(m_PrevLineWidth); CHECK_GL_ERROR; - - if( m_PrevLineSmooth ) - { - _glEnable(GL_LINE_SMOOTH); CHECK_GL_ERROR; - } - else - { - _glDisable(GL_LINE_SMOOTH); CHECK_GL_ERROR; - } - - if( m_PrevCullFace ) - { - _glEnable(GL_CULL_FACE); CHECK_GL_ERROR; - } - else - { - _glDisable(GL_CULL_FACE); CHECK_GL_ERROR; - } - - if( m_PrevDepthTest ) - { - _glEnable(GL_DEPTH_TEST); CHECK_GL_ERROR; - } - else - { - _glDisable(GL_DEPTH_TEST); CHECK_GL_ERROR; - } - - if( m_PrevBlend ) - { - _glEnable(GL_BLEND); CHECK_GL_ERROR; - } - else - { - _glDisable(GL_BLEND); CHECK_GL_ERROR; - } - - if( m_PrevScissorTest ) - { - _glEnable(GL_SCISSOR_TEST); CHECK_GL_ERROR; - } - else - { - _glDisable(GL_SCISSOR_TEST); CHECK_GL_ERROR; - } - - _glScissor(m_PrevScissorBox[0], m_PrevScissorBox[1], m_PrevScissorBox[2], m_PrevScissorBox[3]); CHECK_GL_ERROR; - - _glBlendFunc(m_PrevSrcBlend, m_PrevDstBlend); CHECK_GL_ERROR; - - _glBindTexture(GL_TEXTURE_2D, m_PrevTexture); CHECK_GL_ERROR; - - _glUseProgram(m_PrevProgramObject); CHECK_GL_ERROR; - - _glBindVertexArray(m_PrevVArray); CHECK_GL_ERROR; - - _glViewport(m_PrevViewport[0], m_PrevViewport[1], m_PrevViewport[2], m_PrevViewport[3]); CHECK_GL_ERROR; - - CHECK_GL_ERROR; -} - -// --------------------------------------------------------------------------- - -bool CTwGraphOpenGLCore::IsDrawing() -{ - return m_Drawing; -} - -// --------------------------------------------------------------------------- - -void CTwGraphOpenGLCore::Restore() -{ - UnbindFont(m_FontTexID); - m_FontTexID = 0; - m_FontTex = NULL; -} - -// --------------------------------------------------------------------------- - -static inline float ToNormScreenX(float x, int wndWidth) -{ - return 2.0f*((float)x-0.5f)/wndWidth - 1.0f; -} - -static inline float ToNormScreenY(float y, int wndHeight) -{ - return 1.0f - 2.0f*((float)y-0.5f)/wndHeight; -} - -// --------------------------------------------------------------------------- - -void CTwGraphOpenGLCore::DrawLine(int _X0, int _Y0, int _X1, int _Y1, color32 _Color0, color32 _Color1, bool _AntiAliased) -{ - CHECK_GL_ERROR; - assert(m_Drawing==true); - - //const GLfloat dx = +0.0f; - const GLfloat dx = 0; - //GLfloat dy = -0.2f; - const GLfloat dy = -0.5f; - if( _AntiAliased ) - _glEnable(GL_LINE_SMOOTH); - else - _glDisable(GL_LINE_SMOOTH); - - _glBindVertexArray(m_LineRectVArray); - - GLfloat x0 = ToNormScreenX(_X0+dx + m_OffsetX, m_WndWidth); - GLfloat y0 = ToNormScreenY(_Y0+dy + m_OffsetY, m_WndHeight); - GLfloat x1 = ToNormScreenX(_X1+dx + m_OffsetX, m_WndWidth); - GLfloat y1 = ToNormScreenY(_Y1+dy + m_OffsetY, m_WndHeight); - GLfloat vertices[] = { x0,y0,0, x1,y1,0 }; - _glBindBuffer(GL_ARRAY_BUFFER, m_LineRectVertices); - _glBufferSubData(GL_ARRAY_BUFFER, 0, sizeof(vertices), vertices); - _glVertexAttribPointer(0, 3, GL_FLOAT, GL_TRUE, 0, NULL); - _glEnableVertexAttribArray(0); - - color32 colors[] = { _Color0, _Color1 }; - _glBindBuffer(GL_ARRAY_BUFFER, m_LineRectColors); - _glBufferSubData(GL_ARRAY_BUFFER, 0, sizeof(colors), colors); - _glVertexAttribPointer(1, GL_BGRA, GL_UNSIGNED_BYTE, GL_TRUE, 0, NULL); - _glEnableVertexAttribArray(1); - - _glUseProgram(m_LineRectProgram); - _glDrawArrays(GL_LINES, 0, 2); - - if( _AntiAliased ) - _glDisable(GL_LINE_SMOOTH); - - CHECK_GL_ERROR; -} - -// --------------------------------------------------------------------------- - -void CTwGraphOpenGLCore::DrawRect(int _X0, int _Y0, int _X1, int _Y1, color32 _Color00, color32 _Color10, color32 _Color01, color32 _Color11) -{ - CHECK_GL_ERROR; - assert(m_Drawing==true); - - // border adjustment - if(_X0<_X1) - ++_X1; - else if(_X0>_X1) - ++_X0; - if(_Y0<_Y1) - --_Y0; - else if(_Y0>_Y1) - --_Y1; - - _glBindVertexArray(m_LineRectVArray); - - GLfloat x0 = ToNormScreenX((float)_X0 + m_OffsetX, m_WndWidth); - GLfloat y0 = ToNormScreenY((float)_Y0 + m_OffsetY, m_WndHeight); - GLfloat x1 = ToNormScreenX((float)_X1 + m_OffsetX, m_WndWidth); - GLfloat y1 = ToNormScreenY((float)_Y1 + m_OffsetY, m_WndHeight); - GLfloat vertices[] = { x0,y0,0, x1,y0,0, x0,y1,0, x1,y1,0 }; - _glBindBuffer(GL_ARRAY_BUFFER, m_LineRectVertices); - _glBufferSubData(GL_ARRAY_BUFFER, 0, sizeof(vertices), vertices); - _glVertexAttribPointer(0, 3, GL_FLOAT, GL_TRUE, 0, NULL); - _glEnableVertexAttribArray(0); - - GLuint colors[] = { _Color00, _Color10, _Color01, _Color11 }; - _glBindBuffer(GL_ARRAY_BUFFER, m_LineRectColors); - _glBufferSubData(GL_ARRAY_BUFFER, 0, sizeof(colors), colors); - _glVertexAttribPointer(1, GL_BGRA, GL_UNSIGNED_BYTE, GL_TRUE, 0, NULL); - _glEnableVertexAttribArray(1); - - _glUseProgram(m_LineRectProgram); - _glDrawArrays(GL_TRIANGLE_STRIP, 0, 4); - - CHECK_GL_ERROR; -} - -// --------------------------------------------------------------------------- - -void *CTwGraphOpenGLCore::NewTextObj() -{ - return new CTextObj; -} - -// --------------------------------------------------------------------------- - -void CTwGraphOpenGLCore::DeleteTextObj(void *_TextObj) -{ - assert(_TextObj!=NULL); - delete static_cast(_TextObj); -} - -// --------------------------------------------------------------------------- - -void CTwGraphOpenGLCore::BuildText(void *_TextObj, const std::string *_TextLines, color32 *_LineColors, color32 *_LineBgColors, int _NbLines, const CTexFont *_Font, int _Sep, int _BgWidth) -{ - assert(m_Drawing==true); - assert(_TextObj!=NULL); - assert(_Font!=NULL); - - if( _Font != m_FontTex ) - { - UnbindFont(m_FontTexID); - m_FontTexID = BindFont(_Font); - m_FontTex = _Font; - } - CTextObj *TextObj = static_cast(_TextObj); - TextObj->m_TextVerts.resize(0); - TextObj->m_TextUVs.resize(0); - TextObj->m_BgVerts.resize(0); - TextObj->m_Colors.resize(0); - TextObj->m_BgColors.resize(0); - - int x, x1, y, y1, i, Len; - unsigned char ch; - const unsigned char *Text; - color32 LineColor = COLOR32_RED; - for( int Line=0; Line<_NbLines; ++Line ) - { - x = 0; - y = Line * (_Font->m_CharHeight+_Sep); - y1 = y+_Font->m_CharHeight; - Len = (int)_TextLines[Line].length(); - Text = (const unsigned char *)(_TextLines[Line].c_str()); - if( _LineColors!=NULL ) - LineColor = (_LineColors[Line]&0xff00ff00) | GLubyte(_LineColors[Line]>>16) | (GLubyte(_LineColors[Line])<<16); - - for( i=0; im_CharWidth[ch]; - - TextObj->m_TextVerts.push_back(Vec2(x , y )); - TextObj->m_TextVerts.push_back(Vec2(x1, y )); - TextObj->m_TextVerts.push_back(Vec2(x , y1)); - TextObj->m_TextVerts.push_back(Vec2(x1, y )); - TextObj->m_TextVerts.push_back(Vec2(x1, y1)); - TextObj->m_TextVerts.push_back(Vec2(x , y1)); - - TextObj->m_TextUVs.push_back(Vec2(_Font->m_CharU0[ch], _Font->m_CharV0[ch])); - TextObj->m_TextUVs.push_back(Vec2(_Font->m_CharU1[ch], _Font->m_CharV0[ch])); - TextObj->m_TextUVs.push_back(Vec2(_Font->m_CharU0[ch], _Font->m_CharV1[ch])); - TextObj->m_TextUVs.push_back(Vec2(_Font->m_CharU1[ch], _Font->m_CharV0[ch])); - TextObj->m_TextUVs.push_back(Vec2(_Font->m_CharU1[ch], _Font->m_CharV1[ch])); - TextObj->m_TextUVs.push_back(Vec2(_Font->m_CharU0[ch], _Font->m_CharV1[ch])); - - if( _LineColors!=NULL ) - { - TextObj->m_Colors.push_back(LineColor); - TextObj->m_Colors.push_back(LineColor); - TextObj->m_Colors.push_back(LineColor); - TextObj->m_Colors.push_back(LineColor); - TextObj->m_Colors.push_back(LineColor); - TextObj->m_Colors.push_back(LineColor); - } - - x = x1; - } - if( _BgWidth>0 ) - { - TextObj->m_BgVerts.push_back(Vec2(-1 , y )); - TextObj->m_BgVerts.push_back(Vec2(_BgWidth+1, y )); - TextObj->m_BgVerts.push_back(Vec2(-1 , y1)); - TextObj->m_BgVerts.push_back(Vec2(_BgWidth+1, y )); - TextObj->m_BgVerts.push_back(Vec2(_BgWidth+1, y1)); - TextObj->m_BgVerts.push_back(Vec2(-1 , y1)); - - if( _LineBgColors!=NULL ) - { - color32 LineBgColor = (_LineBgColors[Line]&0xff00ff00) | GLubyte(_LineBgColors[Line]>>16) | (GLubyte(_LineBgColors[Line])<<16); - TextObj->m_BgColors.push_back(LineBgColor); - TextObj->m_BgColors.push_back(LineBgColor); - TextObj->m_BgColors.push_back(LineBgColor); - TextObj->m_BgColors.push_back(LineBgColor); - TextObj->m_BgColors.push_back(LineBgColor); - TextObj->m_BgColors.push_back(LineBgColor); - } - } - } -} - -// --------------------------------------------------------------------------- - -void CTwGraphOpenGLCore::DrawText(void *_TextObj, int _X, int _Y, color32 _Color, color32 _BgColor) -{ - CHECK_GL_ERROR; - assert(m_Drawing==true); - assert(_TextObj!=NULL); - CTextObj *TextObj = static_cast(_TextObj); - - if( TextObj->m_TextVerts.size()<4 && TextObj->m_BgVerts.size()<4 ) - return; // nothing to draw - - // draw character background triangles - if( (_BgColor!=0 || TextObj->m_BgColors.size()==TextObj->m_BgVerts.size()) && TextObj->m_BgVerts.size()>=4 ) - { - size_t numBgVerts = TextObj->m_BgVerts.size(); - if( numBgVerts > m_TriBufferSize ) - ResizeTriBuffers(numBgVerts + 2048); - - _glBindVertexArray(m_TriVArray); - - _glBindBuffer(GL_ARRAY_BUFFER, m_TriVertices); - _glBufferSubData(GL_ARRAY_BUFFER, 0, numBgVerts*sizeof(Vec2), &(TextObj->m_BgVerts[0])); - _glVertexAttribPointer(0, 2, GL_FLOAT, GL_TRUE, 0, NULL); - _glEnableVertexAttribArray(0); - _glDisableVertexAttribArray(1); - _glDisableVertexAttribArray(2); - - if( TextObj->m_BgColors.size()==TextObj->m_BgVerts.size() && _BgColor==0 ) - { - _glBindBuffer(GL_ARRAY_BUFFER, m_TriColors); - _glBufferSubData(GL_ARRAY_BUFFER, 0, numBgVerts*sizeof(color32), &(TextObj->m_BgColors[0])); - _glVertexAttribPointer(1, GL_BGRA, GL_UNSIGNED_BYTE, GL_TRUE, 0, NULL); - _glEnableVertexAttribArray(1); - - _glUseProgram(m_TriProgram); - _glUniform2f(m_TriLocationOffset, (float)_X, (float)_Y); - _glUniform2f(m_TriLocationWndSize, (float)m_WndWidth, (float)m_WndHeight); - } - else - { - _glUseProgram(m_TriUniProgram); - _glUniform4f(m_TriUniLocationColor, GLfloat((_BgColor>>16)&0xff)/256.0f, GLfloat((_BgColor>>8)&0xff)/256.0f, GLfloat(_BgColor&0xff)/256.0f, GLfloat((_BgColor>>24)&0xff)/256.0f); - _glUniform2f(m_TriUniLocationOffset, (float)_X, (float)_Y); - _glUniform2f(m_TriUniLocationWndSize, (float)m_WndWidth, (float)m_WndHeight); - } - - _glDrawArrays(GL_TRIANGLES, 0, (GLsizei)TextObj->m_BgVerts.size()); - } - - // draw character triangles - if( TextObj->m_TextVerts.size()>=4 ) - { - _glActiveTexture(GL_TEXTURE0); - _glBindTexture(GL_TEXTURE_2D, m_FontTexID); - size_t numTextVerts = TextObj->m_TextVerts.size(); - if( numTextVerts > m_TriBufferSize ) - ResizeTriBuffers(numTextVerts + 2048); - - _glBindVertexArray(m_TriVArray); - _glDisableVertexAttribArray(2); - - _glBindBuffer(GL_ARRAY_BUFFER, m_TriVertices); - _glBufferSubData(GL_ARRAY_BUFFER, 0, numTextVerts*sizeof(Vec2), &(TextObj->m_TextVerts[0])); - _glVertexAttribPointer(0, 2, GL_FLOAT, GL_TRUE, 0, NULL); - _glEnableVertexAttribArray(0); - - _glBindBuffer(GL_ARRAY_BUFFER, m_TriUVs); - _glBufferSubData(GL_ARRAY_BUFFER, 0, numTextVerts*sizeof(Vec2), &(TextObj->m_TextUVs[0])); - _glVertexAttribPointer(1, 2, GL_FLOAT, GL_FALSE, 0, NULL); - _glEnableVertexAttribArray(1); - - if( TextObj->m_Colors.size()==TextObj->m_TextVerts.size() && _Color==0 ) - { - _glBindBuffer(GL_ARRAY_BUFFER, m_TriColors); - _glBufferSubData(GL_ARRAY_BUFFER, 0, numTextVerts*sizeof(color32), &(TextObj->m_Colors[0])); - _glVertexAttribPointer(2, GL_BGRA, GL_UNSIGNED_BYTE, GL_TRUE, 0, NULL); - _glEnableVertexAttribArray(2); - - _glUseProgram(m_TriTexProgram); - _glUniform2f(m_TriTexLocationOffset, (float)_X, (float)_Y); - _glUniform2f(m_TriTexLocationWndSize, (float)m_WndWidth, (float)m_WndHeight); - _glUniform1i(m_TriTexLocationTexture, 0); - } - else - { - _glUseProgram(m_TriTexUniProgram); - _glUniform4f(m_TriTexUniLocationColor, GLfloat((_Color>>16)&0xff)/256.0f, GLfloat((_Color>>8)&0xff)/256.0f, GLfloat(_Color&0xff)/256.0f, GLfloat((_Color>>24)&0xff)/256.0f); - _glUniform2f(m_TriTexUniLocationOffset, (float)_X, (float)_Y); - _glUniform2f(m_TriTexUniLocationWndSize, (float)m_WndWidth, (float)m_WndHeight); - _glUniform1i(m_TriTexUniLocationTexture, 0); - } - - _glDrawArrays(GL_TRIANGLES, 0, (GLsizei)TextObj->m_TextVerts.size()); - } - - CHECK_GL_ERROR; -} - -// --------------------------------------------------------------------------- - -void CTwGraphOpenGLCore::ChangeViewport(int _X0, int _Y0, int _Width, int _Height, int _OffsetX, int _OffsetY) -{ - // glViewport impacts the NDC; use glScissor instead - m_OffsetX = _X0 + _OffsetX; - m_OffsetY = _Y0 + _OffsetY; - SetScissor(_X0, _Y0, _Width, _Height); -} - -// --------------------------------------------------------------------------- - -void CTwGraphOpenGLCore::RestoreViewport() -{ - m_OffsetX = m_OffsetY = 0; - SetScissor(0, 0, 0, 0); -} - -// --------------------------------------------------------------------------- - -void CTwGraphOpenGLCore::SetScissor(int _X0, int _Y0, int _Width, int _Height) -{ - if( _Width>0 && _Height>0 ) - { - _glScissor(_X0-1, m_WndHeight-_Y0-_Height, _Width-1, _Height); - _glEnable(GL_SCISSOR_TEST); - } - else - _glDisable(GL_SCISSOR_TEST); -} - -// --------------------------------------------------------------------------- - -void CTwGraphOpenGLCore::DrawTriangles(int _NumTriangles, int *_Vertices, color32 *_Colors, Cull _CullMode) -{ - assert(m_Drawing==true); - - const GLfloat dx = +0.0f; - const GLfloat dy = +0.0f; - - // Backup states - GLint prevCullFaceMode, prevFrontFace; - _glGetIntegerv(GL_CULL_FACE_MODE, &prevCullFaceMode); - _glGetIntegerv(GL_FRONT_FACE, &prevFrontFace); - GLboolean prevCullEnable = _glIsEnabled(GL_CULL_FACE); - _glCullFace(GL_BACK); - _glEnable(GL_CULL_FACE); - if( _CullMode==CULL_CW ) - _glFrontFace(GL_CCW); - else if( _CullMode==CULL_CCW ) - _glFrontFace(GL_CW); - else - _glDisable(GL_CULL_FACE); - - _glUseProgram(m_TriProgram); - _glBindVertexArray(m_TriVArray); - _glUniform2f(m_TriLocationOffset, (float)m_OffsetX+dx, (float)m_OffsetY+dy); - _glUniform2f(m_TriLocationWndSize, (float)m_WndWidth, (float)m_WndHeight); - _glDisableVertexAttribArray(2); - - size_t numVerts = 3*_NumTriangles; - if( numVerts > m_TriBufferSize ) - ResizeTriBuffers(numVerts + 2048); - - _glBindBuffer(GL_ARRAY_BUFFER, m_TriVertices); - _glBufferSubData(GL_ARRAY_BUFFER, 0, numVerts*2*sizeof(int), _Vertices); - _glVertexAttribPointer(0, 2, GL_INT, GL_FALSE, 0, NULL); - _glEnableVertexAttribArray(0); - - _glBindBuffer(GL_ARRAY_BUFFER, m_TriColors); - _glBufferSubData(GL_ARRAY_BUFFER, 0, numVerts*sizeof(color32), _Colors); - _glVertexAttribPointer(1, GL_BGRA, GL_UNSIGNED_BYTE, GL_TRUE, 0, NULL); - _glEnableVertexAttribArray(1); - - _glDrawArrays(GL_TRIANGLES, 0, (GLsizei)numVerts); - - // Reset states - _glCullFace(prevCullFaceMode); - _glFrontFace(prevFrontFace); - if( prevCullEnable ) - _glEnable(GL_CULL_FACE); - else - _glDisable(GL_CULL_FACE); - - CHECK_GL_ERROR; -} - -// --------------------------------------------------------------------------- diff --git a/extern/AntTweakBar/src/TwOpenGLCore.h b/extern/AntTweakBar/src/TwOpenGLCore.h deleted file mode 100644 index 19091436..00000000 --- a/extern/AntTweakBar/src/TwOpenGLCore.h +++ /dev/null @@ -1,121 +0,0 @@ -// --------------------------------------------------------------------------- -// -// @file TwOpenGLCore.h -// @brief OpenGL Core graph functions -// @author Philippe Decaudin -// @license This file is part of the AntTweakBar library. -// For conditions of distribution and use, see License.txt -// -// note: Private header -// -// --------------------------------------------------------------------------- - - -#if !defined ANT_TW_OPENGL_CORE_INCLUDED -#define ANT_TW_OPENGL_CORE_INCLUDED - -#include "TwGraph.h" - -// --------------------------------------------------------------------------- - -class CTwGraphOpenGLCore : public ITwGraph -{ -public: - virtual int Init(); - virtual int Shut(); - virtual void BeginDraw(int _WndWidth, int _WndHeight); - virtual void EndDraw(); - virtual bool IsDrawing(); - virtual void Restore(); - virtual void DrawLine(int _X0, int _Y0, int _X1, int _Y1, color32 _Color0, color32 _Color1, bool _AntiAliased=false); - virtual void DrawLine(int _X0, int _Y0, int _X1, int _Y1, color32 _Color, bool _AntiAliased=false) { DrawLine(_X0, _Y0, _X1, _Y1, _Color, _Color, _AntiAliased); } - virtual void DrawRect(int _X0, int _Y0, int _X1, int _Y1, color32 _Color00, color32 _Color10, color32 _Color01, color32 _Color11); - virtual void DrawRect(int _X0, int _Y0, int _X1, int _Y1, color32 _Color) { DrawRect(_X0, _Y0, _X1, _Y1, _Color, _Color, _Color, _Color); } - virtual void DrawTriangles(int _NumTriangles, int *_Vertices, color32 *_Colors, Cull _CullMode); - - virtual void * NewTextObj(); - virtual void DeleteTextObj(void *_TextObj); - virtual void BuildText(void *_TextObj, const std::string *_TextLines, color32 *_LineColors, color32 *_LineBgColors, int _NbLines, const CTexFont *_Font, int _Sep, int _BgWidth); - virtual void DrawText(void *_TextObj, int _X, int _Y, color32 _Color, color32 _BgColor); - - virtual void ChangeViewport(int _X0, int _Y0, int _Width, int _Height, int _OffsetX, int _OffsetY); - virtual void RestoreViewport(); - virtual void SetScissor(int _X0, int _Y0, int _Width, int _Height); - -protected: - bool m_Drawing; - GLuint m_FontTexID; - const CTexFont * m_FontTex; - - GLfloat m_PrevLineWidth; - GLint m_PrevActiveTexture; - GLint m_PrevTexture; - GLint m_PrevVArray; - GLboolean m_PrevLineSmooth; - GLboolean m_PrevCullFace; - GLboolean m_PrevDepthTest; - GLboolean m_PrevBlend; - GLint m_PrevSrcBlend; - GLint m_PrevDstBlend; - GLboolean m_PrevScissorTest; - GLint m_PrevScissorBox[4]; - GLint m_PrevViewport[4]; - GLuint m_PrevProgramObject; - - GLuint m_LineRectVS; - GLuint m_LineRectFS; - GLuint m_LineRectProgram; - GLuint m_LineRectVArray; - GLuint m_LineRectVertices; - GLuint m_LineRectColors; - GLuint m_TriVS; - GLuint m_TriFS; - GLuint m_TriProgram; - GLuint m_TriUniVS; - GLuint m_TriUniFS; - GLuint m_TriUniProgram; - GLuint m_TriTexVS; - GLuint m_TriTexFS; - GLuint m_TriTexProgram; - GLuint m_TriTexUniVS; - GLuint m_TriTexUniFS; - GLuint m_TriTexUniProgram; - GLuint m_TriVArray; - GLuint m_TriVertices; - GLuint m_TriUVs; - GLuint m_TriColors; - GLint m_TriLocationOffset; - GLint m_TriLocationWndSize; - GLint m_TriUniLocationOffset; - GLint m_TriUniLocationWndSize; - GLint m_TriUniLocationColor; - GLint m_TriTexLocationOffset; - GLint m_TriTexLocationWndSize; - GLint m_TriTexLocationTexture; - GLint m_TriTexUniLocationOffset; - GLint m_TriTexUniLocationWndSize; - GLint m_TriTexUniLocationColor; - GLint m_TriTexUniLocationTexture; - size_t m_TriBufferSize; - - int m_WndWidth; - int m_WndHeight; - int m_OffsetX; - int m_OffsetY; - - struct Vec2 { GLfloat x, y; Vec2(){} Vec2(GLfloat _X, GLfloat _Y):x(_X),y(_Y){} Vec2(int _X, int _Y):x(GLfloat(_X)),y(GLfloat(_Y)){} }; - struct CTextObj - { - std::vector m_TextVerts; - std::vector m_TextUVs; - std::vector m_BgVerts; - std::vectorm_Colors; - std::vectorm_BgColors; - }; - void ResizeTriBuffers(size_t _NewSize); -}; - -// --------------------------------------------------------------------------- - - -#endif // !defined ANT_TW_OPENGL_CORE_INCLUDED diff --git a/extern/AntTweakBar/src/TwPrecomp.cpp b/extern/AntTweakBar/src/TwPrecomp.cpp deleted file mode 100644 index 6c9502e2..00000000 --- a/extern/AntTweakBar/src/TwPrecomp.cpp +++ /dev/null @@ -1 +0,0 @@ -#include "TwPrecomp.h" diff --git a/extern/AntTweakBar/src/TwPrecomp.h b/extern/AntTweakBar/src/TwPrecomp.h deleted file mode 100644 index 528fd985..00000000 --- a/extern/AntTweakBar/src/TwPrecomp.h +++ /dev/null @@ -1,93 +0,0 @@ -// --------------------------------------------------------------------------- -// -// @file TwPrecomp.h -// @brief Precompiled header -// @author Philippe Decaudin -// @license This file is part of the AntTweakBar library. -// For conditions of distribution and use, see License.txt -// -// note: Private header -// -// --------------------------------------------------------------------------- - - -#if !defined ANT_TW_PRECOMP_INCLUDED -#define ANT_TW_PRECOMP_INCLUDED - - -#if defined _MSC_VER -# pragma warning(disable: 4514) // unreferenced inline function has been removed -# pragma warning(disable: 4710) // function not inlined -# pragma warning(disable: 4786) // template name truncated -# pragma warning(disable: 4530) // exceptions not handled -# define _CRT_SECURE_NO_DEPRECATE // visual 8 secure crt warning -#endif - -#include -#include -#include -#include -#include -#include -#include - -#if defined(_MSC_VER) && _MSC_VER<=1200 -# pragma warning(push, 3) -#endif -#include -#include -#include -#include -#include -#include -#if defined(_MSC_VER) && _MSC_VER<=1200 -# pragma warning(pop) -#endif - -#if defined(_UNIX) -# define ANT_UNIX -# include -# define GLX_GLXEXT_LEGACY -# include -# include -# include -# include -# undef _WIN32 -# undef WIN32 -# undef _WIN64 -# undef WIN64 -# undef _WINDOWS -# undef ANT_WINDOWS -# undef ANT_OSX -#elif defined(_MACOSX) -# define ANT_OSX -# include -# include -# include -# include -# undef _WIN32 -# undef WIN32 -# undef _WIN64 -# undef WIN64 -# undef _WINDOWS -# undef ANT_WINDOWS -# undef ANT_UNIX -#elif defined(_WINDOWS) || defined(WIN32) || defined(WIN64) || defined(_WIN32) || defined(_WIN64) -# define ANT_WINDOWS -# ifndef WIN32_LEAN_AND_MEAN -# define WIN32_LEAN_AND_MEAN // Exclude rarely-used stuff from Windows headers -# endif -# include -# include -#endif - -#if !defined(ANT_OGL_HEADER_INCLUDED) -# if defined(ANT_OSX) -# include -# else -# include // must be included after windows.h -# endif -# define ANT_OGL_HEADER_INCLUDED -#endif - -#endif // !defined ANT_TW_PRECOMP_INCLUDED diff --git a/extern/AntTweakBar/src/res/FontChars.txt b/extern/AntTweakBar/src/res/FontChars.txt deleted file mode 100644 index 17757bb2..00000000 --- a/extern/AntTweakBar/src/res/FontChars.txt +++ /dev/null @@ -1,232 +0,0 @@ - !"#$%&'()*+,-./0123456789:;<=>? -@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_ -`abcdefghijklmnopqrstuvwxyz{|}~√ -€Â‚ƒ„…†‡ˆ‰Š‹ŒÂŽÂ‘’“â€â€¢â€“—˜™š›œÂžŸ - ¡¢£¤¥¦§¨©ª«¬­®¯°±²³´µ¶·¸¹º»¼½¾¿ -ÀÃÂÃÄÅÆÇÈÉÊËÌÃÃŽÃÃÑÒÓÔÕÖרÙÚÛÜÃÞß -àáâãäåæçèéêëìíîïðñòóôõö÷øùúûüýþÿ - -032 -033 ! -034 " -035 # -036 $ -037 % -038 & -039 ' -040 ( -041 ) -042 * -043 + -044 , -045 - -046 . -047 / -048 0 -049 1 -050 2 -051 3 -052 4 -053 5 -054 6 -055 7 -056 8 -057 9 -058 : -059 ; -060 < -061 = -062 > -063 ? -064 @ -065 A -066 B -067 C -068 D -069 E -070 F -071 G -072 H -073 I -074 J -075 K -076 L -077 M -078 N -079 O -080 P -081 Q -082 R -083 S -084 T -085 U -086 V -087 W -088 X -089 Y -090 Z -091 [ -092 \ -093 ] -094 ^ -095 _ -096 ` -097 a -098 b -099 c -100 d -101 e -102 f -103 g -104 h -105 i -106 j -107 k -108 l -109 m -110 n -111 o -112 p -113 q -114 r -115 s -116 t -117 u -118 v -119 w -120 x -121 y -122 z -123 { -124 | -125 } -126 ~ -127 √ -128 € -129  -130 ‚ -131 Æ’ -132 „ -133 … -134 † -135 ‡ -136 ˆ -137 ‰ -138 Å  -139 ‹ -140 Å’ -141  -142 Ž -143  -144  -145 ‘ -146 ’ -147 “ -148 †-149 • -150 – -151 — -152 Ëœ -153 â„¢ -154 Å¡ -155 › -156 Å“ -157  -158 ž -159 Ÿ -160   -161 ¡ -162 ¢ -163 £ -164 ¤ -165 Â¥ -166 ¦ -167 § -168 ¨ -169 © -170 ª -171 « -172 ¬ -173 ­ -174 ® -175 ¯ -176 ° -177 ± -178 ² -179 ³ -180 ´ -181 µ -182 ¶ -183 · -184 ¸ -185 ¹ -186 º -187 » -188 ¼ -189 ½ -190 ¾ -191 ¿ -192 À -193 à -194  -195 à -196 Ä -197 Ã… -198 Æ -199 Ç -200 È -201 É -202 Ê -203 Ë -204 ÃŒ -205 à -206 ÃŽ -207 à -208 à -209 Ñ -210 Ã’ -211 Ó -212 Ô -213 Õ -214 Ö -215 × -216 Ø -217 Ù -218 Ú -219 Û -220 Ü -221 à -222 Þ -223 ß -224 à -225 á -226 â -227 ã -228 ä -229 Ã¥ -230 æ -231 ç -232 è -233 é -234 ê -235 ë -236 ì -237 í -238 î -239 ï -240 ð -241 ñ -242 ò -243 ó -244 ô -245 õ -246 ö -247 ÷ -248 ø -249 ù -250 ú -251 û -252 ü -253 ý -254 þ -255 ÿ diff --git a/extern/AntTweakBar/src/res/FontFixed1.pgm b/extern/AntTweakBar/src/res/FontFixed1.pgm deleted file mode 100644 index ef7a41aa..00000000 --- a/extern/AntTweakBar/src/res/FontFixed1.pgm +++ /dev/null @@ -1,28788 +0,0 @@ -P2 -# CREATOR: GIMP PNM Filter Version 1.1 -257 112 -255 -127 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -127 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -127 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -127 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -52 -255 -4 -0 -0 -0 -0 -52 -255 -56 -255 -4 -0 -0 -0 -0 -0 -212 -44 -76 -180 -0 -0 -0 -52 -255 -4 -0 -0 -0 -0 -109 -231 -218 -72 -0 -0 -0 -0 -0 -96 -227 -243 -170 -0 -0 -0 -0 -52 -255 -4 -0 -0 -0 -0 -0 -0 -0 -158 -104 -0 -0 -0 -0 -153 -114 -0 -0 -0 -0 -0 -0 -0 -52 -255 -4 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -172 -128 -0 -0 -12 -164 -241 -234 -133 -1 -0 -0 -22 -179 -237 -255 -4 -0 -0 -0 -141 -220 -246 -236 -164 -22 -0 -0 -94 -216 -242 -243 -194 -56 -0 -0 -0 -0 -0 -186 -255 -4 -0 -0 -52 -255 -244 -244 -244 -91 -0 -0 -1 -120 -223 -244 -225 -62 -0 -0 -244 -244 -244 -244 -249 -242 -0 -0 -62 -200 -245 -242 -181 -35 -0 -0 -46 -196 -244 -232 -139 -2 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -104 -216 -246 -215 -62 -0 -0 -127 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -52 -255 -4 -0 -0 -0 -0 -52 -255 -56 -255 -4 -0 -0 -0 -0 -13 -239 -2 -131 -124 -0 -0 -110 -232 -255 -238 -202 -62 -0 -29 -254 -51 -99 -231 -0 -0 -0 -0 -0 -241 -53 -0 -34 -0 -0 -0 -0 -52 -255 -4 -0 -0 -0 -0 -0 -0 -45 -225 -4 -0 -0 -0 -0 -30 -237 -15 -0 -0 -0 -0 -99 -95 -52 -255 -11 -127 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -38 -242 -19 -0 -0 -155 -188 -12 -29 -221 -103 -0 -0 -21 -101 -90 -255 -4 -0 -0 -0 -127 -46 -1 -15 -165 -192 -0 -0 -34 -24 -0 -5 -127 -233 -0 -0 -0 -0 -98 -197 -255 -4 -0 -0 -52 -255 -4 -0 -0 -0 -0 -0 -121 -219 -45 -0 -22 -27 -0 -0 -0 -0 -0 -0 -170 -151 -0 -14 -242 -119 -4 -12 -160 -207 -0 -3 -224 -136 -5 -18 -188 -114 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -114 -38 -2 -133 -225 -0 -0 -127 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -52 -255 -4 -0 -0 -0 -0 -52 -255 -56 -255 -4 -0 -0 -0 -0 -67 -189 -0 -187 -69 -0 -26 -254 -100 -255 -8 -53 -44 -0 -30 -254 -49 -100 -235 -0 -1 -0 -0 -0 -206 -47 -0 -0 -0 -0 -0 -0 -52 -255 -4 -0 -0 -0 -0 -0 -0 -155 -133 -0 -0 -0 -0 -0 -0 -186 -110 -0 -0 -0 -0 -3 -103 -195 -255 -177 -75 -0 -0 -0 -0 -52 -255 -4 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -156 -144 -0 -0 -5 -244 -63 -0 -0 -112 -200 -0 -0 -0 -0 -52 -255 -4 -0 -0 -0 -0 -0 -0 -0 -60 -251 -0 -0 -0 -0 -0 -10 -127 -211 -0 -0 -0 -25 -215 -67 -255 -4 -0 -0 -52 -255 -4 -0 -0 -0 -0 -1 -235 -77 -0 -0 -0 -0 -0 -0 -0 -0 -0 -24 -250 -49 -0 -44 -255 -15 -0 -0 -64 -251 -0 -41 -255 -17 -0 -0 -68 -205 -0 -0 -0 -43 -216 -3 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -47 -147 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -197 -97 -11 -0 -0 -0 -0 -0 -0 -0 -0 -69 -248 -0 -0 -127 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -52 -255 -4 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -63 -240 -247 -248 -240 -254 -241 -0 -42 -255 -69 -255 -4 -0 -0 -0 -0 -112 -232 -221 -80 -97 -184 -0 -0 -14 -189 -196 -7 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -1 -233 -64 -0 -0 -0 -0 -0 -0 -117 -186 -0 -0 -0 -0 -3 -102 -194 -255 -177 -74 -0 -0 -0 -0 -52 -255 -4 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -26 -244 -30 -0 -0 -37 -255 -37 -175 -0 -66 -244 -0 -0 -0 -0 -52 -255 -4 -0 -0 -0 -0 -0 -0 -0 -126 -195 -0 -0 -0 -48 -241 -255 -190 -16 -0 -0 -0 -176 -90 -52 -255 -4 -0 -0 -52 -255 -228 -236 -162 -16 -0 -33 -255 -106 -220 -237 -172 -21 -0 -0 -0 -0 -0 -125 -203 -0 -0 -4 -205 -120 -6 -14 -160 -159 -0 -40 -255 -21 -0 -0 -69 -245 -0 -0 -0 -52 -255 -4 -0 -0 -0 -0 -0 -52 -255 -4 -0 -0 -0 -0 -0 -13 -102 -203 -225 -132 -0 -0 -240 -240 -240 -240 -240 -240 -0 -0 -84 -180 -237 -152 -52 -0 -0 -0 -0 -0 -11 -204 -150 -0 -0 -127 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -52 -255 -4 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -190 -66 -54 -202 -0 -0 -2 -196 -220 -255 -106 -32 -0 -0 -0 -0 -13 -116 -184 -93 -4 -0 -0 -176 -114 -109 -159 -0 -52 -0 -1 -0 -0 -0 -0 -0 -0 -0 -0 -0 -29 -255 -22 -0 -0 -0 -0 -0 -0 -72 -236 -0 -0 -0 -0 -99 -96 -52 -255 -11 -128 -0 -0 -240 -240 -243 -255 -240 -240 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -140 -161 -0 -0 -0 -49 -255 -33 -216 -0 -54 -255 -0 -0 -0 -0 -52 -255 -4 -0 -0 -0 -0 -0 -0 -68 -236 -45 -0 -0 -0 -0 -0 -27 -198 -133 -0 -0 -87 -189 -0 -52 -255 -4 -0 -0 -19 -40 -0 -29 -197 -168 -0 -49 -255 -146 -9 -15 -182 -176 -0 -0 -0 -0 -3 -226 -100 -0 -0 -0 -28 -210 -252 -255 -182 -7 -0 -2 -223 -142 -6 -20 -186 -255 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -43 -216 -3 -0 -0 -0 -0 -158 -233 -162 -67 -1 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -23 -115 -210 -208 -0 -0 -0 -0 -176 -192 -6 -0 -0 -127 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -52 -255 -4 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -7 -239 -9 -118 -138 -0 -0 -0 -5 -109 -255 -153 -234 -112 -0 -0 -88 -179 -76 -110 -231 -220 -0 -28 -255 -16 -0 -176 -110 -68 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -46 -255 -8 -0 -0 -0 -0 -0 -0 -57 -253 -0 -0 -0 -0 -0 -0 -52 -255 -4 -0 -0 -0 -0 -0 -52 -255 -4 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -244 -244 -244 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -17 -241 -43 -0 -0 -0 -37 -255 -17 -0 -0 -66 -244 -0 -0 -0 -0 -52 -255 -4 -0 -0 -0 -0 -0 -73 -233 -60 -0 -0 -0 -0 -0 -0 -0 -69 -238 -0 -16 -227 -40 -0 -52 -255 -4 -0 -0 -0 -0 -0 -0 -69 -246 -0 -38 -255 -20 -0 -0 -69 -247 -0 -0 -0 -0 -79 -242 -11 -0 -0 -5 -214 -122 -7 -16 -162 -175 -0 -0 -46 -193 -239 -210 -125 -241 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -202 -215 -114 -23 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -2 -67 -162 -236 -0 -0 -0 -34 -255 -31 -0 -0 -0 -127 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -236 -244 -251 -240 -251 -244 -228 -0 -0 -0 -52 -255 -4 -76 -245 -0 -0 -11 -0 -29 -254 -51 -101 -0 -40 -255 -30 -0 -18 -222 -193 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -29 -255 -23 -0 -0 -0 -0 -0 -0 -72 -237 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -52 -255 -4 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -124 -178 -0 -0 -0 -0 -5 -245 -63 -0 -0 -111 -200 -0 -0 -0 -0 -52 -255 -4 -0 -0 -0 -0 -87 -233 -54 -0 -0 -0 -0 -0 -0 -0 -0 -70 -248 -0 -52 -255 -255 -255 -255 -255 -255 -0 -0 -0 -0 -0 -0 -68 -246 -0 -6 -248 -19 -0 -0 -65 -247 -0 -0 -0 -0 -185 -151 -0 -0 -0 -42 -255 -15 -0 -0 -59 -252 -0 -0 -0 -0 -0 -0 -124 -188 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -46 -147 -234 -180 -86 -0 -0 -244 -244 -244 -244 -244 -244 -0 -0 -39 -133 -226 -197 -97 -10 -0 -0 -0 -51 -255 -4 -0 -0 -0 -127 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -140 -115 -12 -235 -8 -0 -0 -32 -73 -55 -255 -11 -143 -215 -0 -0 -0 -0 -31 -255 -47 -97 -0 -1 -211 -174 -16 -6 -148 -252 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -1 -233 -65 -0 -0 -0 -0 -0 -0 -116 -187 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -52 -255 -4 -0 -0 -0 -0 -52 -255 -4 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -44 -220 -3 -0 -0 -0 -0 -9 -234 -58 -0 -0 -0 -0 -0 -155 -186 -12 -28 -220 -103 -0 -0 -0 -8 -58 -255 -11 -8 -0 -0 -105 -232 -47 -0 -0 -0 -0 -0 -101 -32 -0 -25 -193 -173 -0 -0 -0 -0 -0 -52 -255 -4 -0 -0 -70 -25 -0 -25 -193 -166 -0 -0 -165 -147 -7 -13 -176 -176 -0 -0 -0 -36 -254 -49 -0 -0 -0 -15 -245 -120 -4 -12 -157 -210 -0 -0 -37 -12 -0 -68 -239 -74 -0 -0 -0 -44 -220 -3 -0 -0 -0 -0 -0 -52 -255 -4 -0 -0 -0 -0 -0 -0 -0 -8 -92 -192 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -235 -142 -41 -0 -0 -0 -0 -0 -0 -4 -24 -0 -0 -0 -0 -127 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -49 -244 -3 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -222 -33 -87 -169 -0 -0 -0 -23 -186 -245 -255 -243 -186 -39 -0 -0 -0 -0 -0 -122 -239 -229 -0 -0 -30 -181 -245 -231 -147 -178 -0 -3 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -155 -133 -0 -0 -0 -0 -0 -0 -185 -111 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -62 -241 -1 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -52 -255 -4 -0 -0 -0 -0 -108 -195 -0 -0 -0 -0 -0 -0 -13 -165 -241 -235 -134 -1 -0 -0 -0 -255 -255 -255 -255 -255 -0 -0 -255 -250 -244 -244 -244 -244 -0 -0 -143 -226 -244 -238 -163 -17 -0 -0 -0 -0 -0 -52 -255 -4 -0 -0 -134 -236 -245 -236 -155 -13 -0 -0 -16 -167 -238 -242 -175 -22 -0 -0 -0 -139 -203 -0 -0 -0 -0 -0 -68 -203 -246 -243 -185 -39 -0 -0 -104 -235 -244 -212 -88 -0 -0 -0 -0 -52 -255 -4 -0 -0 -0 -0 -0 -62 -241 -1 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -6 -0 -0 -0 -0 -0 -0 -0 -0 -49 -244 -3 -0 -0 -0 -127 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -52 -255 -4 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -45 -225 -4 -0 -0 -0 -0 -29 -237 -16 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -120 -157 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -4 -223 -75 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -120 -157 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -127 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -52 -255 -4 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -158 -104 -0 -0 -0 -0 -153 -115 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -181 -63 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -31 -119 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -181 -63 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -127 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -127 -127 -127 -127 -127 -127 -127 -0 -127 -127 -127 -127 -127 -127 -127 -0 -127 -127 -127 -127 -127 -127 -127 -0 -127 -127 -127 -127 -127 -127 -127 -0 -127 -127 -127 -127 -127 -127 -127 -0 -127 -127 -127 -127 -127 -127 -127 -0 -127 -127 -127 -127 -127 -127 -127 -0 -127 -127 -127 -127 -127 -127 -127 -0 -127 -127 -127 -127 -127 -127 -127 -0 -127 -127 -127 -127 -127 -127 -127 -0 -127 -127 -127 -127 -127 -127 -127 -0 -127 -127 -127 -127 -127 -127 -127 -0 -127 -127 -127 -127 -127 -127 -127 -0 -127 -127 -127 -127 -127 -127 -127 -0 -127 -127 -127 -127 -127 -127 -127 -0 -127 -127 -127 -127 -127 -127 -127 -0 -127 -127 -127 -127 -127 -127 -127 -0 -127 -127 -127 -127 -127 -127 -127 -0 -127 -127 -127 -127 -127 -127 -127 -0 -127 -127 -127 -127 -127 -127 -127 -0 -127 -127 -127 -127 -127 -127 -127 -0 -127 -127 -127 -127 -127 -127 -127 -0 -127 -127 -127 -127 -127 -127 -127 -0 -127 -127 -127 -127 -127 -127 -127 -0 -127 -127 -127 -127 -127 -127 -127 -0 -127 -127 -127 -127 -127 -127 -127 -0 -127 -127 -127 -127 -127 -127 -127 -0 -127 -127 -127 -127 -127 -127 -127 -0 -127 -127 -127 -127 -127 -127 -127 -0 -127 -127 -127 -127 -127 -127 -127 -0 -127 -127 -127 -127 -127 -127 -127 -0 -127 -127 -127 -127 -127 -127 -127 -0 -127 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -127 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -127 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -127 -0 -28 -160 -229 -236 -163 -14 -0 -0 -0 -20 -252 -200 -0 -0 -0 -52 -255 -244 -243 -238 -177 -32 -0 -0 -0 -96 -213 -244 -234 -137 -0 -52 -255 -244 -239 -190 -68 -0 -0 -52 -255 -244 -244 -244 -244 -68 -0 -0 -52 -255 -244 -244 -244 -244 -0 -0 -0 -104 -217 -244 -222 -100 -0 -52 -255 -4 -0 -0 -52 -255 -0 -0 -244 -246 -255 -244 -244 -0 -0 -0 -0 -137 -244 -246 -255 -4 -0 -52 -255 -4 -0 -0 -137 -216 -0 -0 -52 -255 -4 -0 -0 -0 -0 -52 -255 -163 -0 -0 -212 -255 -0 -52 -255 -166 -0 -0 -52 -255 -0 -0 -15 -168 -241 -236 -141 -2 -0 -52 -255 -244 -244 -239 -176 -33 -0 -0 -15 -168 -241 -236 -141 -2 -0 -52 -255 -244 -244 -236 -171 -30 -0 -0 -47 -189 -243 -241 -204 -73 -0 -0 -244 -244 -246 -255 -244 -244 -0 -52 -255 -4 -0 -0 -52 -255 -0 -125 -203 -0 -0 -0 -24 -254 -0 -236 -75 -0 -0 -0 -0 -152 -0 -44 -247 -51 -0 -0 -71 -241 -0 -220 -112 -0 -0 -0 -161 -179 -0 -0 -244 -244 -244 -244 -249 -254 -0 -0 -0 -52 -255 -244 -125 -0 -0 -35 -244 -23 -0 -0 -0 -0 -0 -0 -0 -171 -246 -255 -4 -0 -0 -0 -0 -41 -242 -200 -7 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -127 -24 -227 -130 -13 -21 -206 -163 -0 -0 -0 -98 -207 -251 -26 -0 -0 -52 -255 -4 -0 -8 -147 -204 -0 -0 -100 -224 -51 -0 -22 -89 -0 -52 -255 -4 -7 -81 -238 -66 -0 -52 -255 -4 -0 -0 -0 -0 -0 -0 -52 -255 -4 -0 -0 -0 -0 -0 -106 -221 -46 -0 -29 -89 -0 -52 -255 -4 -0 -0 -52 -255 -0 -0 -0 -52 -255 -4 -0 -0 -0 -0 -0 -0 -0 -52 -255 -4 -0 -52 -255 -4 -0 -133 -218 -26 -0 -0 -52 -255 -4 -0 -0 -0 -0 -52 -255 -202 -4 -36 -219 -255 -0 -52 -255 -242 -30 -0 -52 -255 -0 -0 -160 -175 -10 -24 -213 -112 -0 -52 -255 -4 -0 -20 -166 -204 -0 -0 -160 -175 -10 -24 -213 -112 -0 -52 -255 -4 -0 -17 -166 -201 -0 -8 -232 -119 -7 -3 -56 -63 -0 -0 -0 -0 -52 -255 -4 -0 -0 -52 -255 -4 -0 -0 -52 -255 -0 -48 -253 -19 -0 -0 -94 -226 -0 -197 -107 -0 -0 -0 -0 -184 -0 -0 -131 -201 -2 -8 -220 -101 -0 -74 -238 -18 -0 -52 -245 -33 -0 -0 -0 -0 -0 -1 -192 -148 -0 -0 -0 -52 -255 -4 -0 -0 -0 -0 -168 -135 -0 -0 -0 -0 -0 -0 -0 -0 -52 -255 -4 -0 -0 -0 -16 -218 -106 -178 -159 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -127 -157 -170 -0 -0 -0 -88 -243 -0 -0 -0 -179 -121 -200 -105 -0 -0 -52 -255 -4 -0 -0 -63 -251 -0 -0 -227 -86 -0 -0 -0 -0 -0 -52 -255 -4 -0 -0 -125 -186 -0 -52 -255 -4 -0 -0 -0 -0 -0 -0 -52 -255 -4 -0 -0 -0 -0 -1 -229 -84 -0 -0 -0 -0 -0 -52 -255 -4 -0 -0 -52 -255 -0 -0 -0 -52 -255 -4 -0 -0 -0 -0 -0 -0 -0 -52 -255 -4 -0 -52 -255 -4 -130 -220 -27 -0 -0 -0 -52 -255 -4 -0 -0 -0 -0 -52 -255 -141 -66 -115 -140 -255 -0 -52 -255 -150 -143 -0 -52 -255 -0 -6 -246 -54 -0 -0 -105 -204 -0 -52 -255 -4 -0 -0 -60 -253 -0 -6 -246 -54 -0 -0 -105 -204 -0 -52 -255 -4 -0 -0 -59 -252 -0 -46 -255 -15 -0 -0 -0 -0 -0 -0 -0 -0 -52 -255 -4 -0 -0 -52 -255 -4 -0 -0 -52 -255 -0 -0 -225 -87 -0 -0 -165 -150 -0 -157 -139 -0 -234 -154 -0 -215 -0 -0 -7 -216 -102 -132 -187 -0 -0 -0 -176 -146 -0 -194 -127 -0 -0 -0 -0 -0 -0 -101 -223 -12 -0 -0 -0 -52 -255 -4 -0 -0 -0 -0 -48 -239 -14 -0 -0 -0 -0 -0 -0 -0 -52 -255 -4 -0 -0 -3 -184 -122 -0 -8 -193 -112 -0 -0 -0 -0 -0 -0 -0 -0 -0 -127 -243 -67 -72 -217 -233 -162 -255 -0 -3 -12 -248 -51 -130 -186 -0 -0 -52 -255 -4 -0 -12 -158 -197 -0 -31 -255 -22 -0 -0 -0 -0 -0 -52 -255 -4 -0 -0 -69 -240 -0 -52 -255 -4 -0 -0 -0 -0 -0 -0 -52 -255 -4 -0 -0 -0 -0 -32 -255 -22 -0 -0 -0 -0 -0 -52 -255 -4 -0 -0 -52 -255 -0 -0 -0 -52 -255 -4 -0 -0 -0 -0 -0 -0 -0 -52 -255 -4 -0 -52 -255 -130 -244 -29 -0 -0 -0 -0 -52 -255 -4 -0 -0 -0 -0 -52 -255 -61 -146 -188 -66 -255 -0 -52 -255 -37 -239 -16 -52 -255 -0 -38 -255 -15 -0 -0 -64 -244 -0 -52 -255 -4 -0 -24 -169 -202 -0 -38 -255 -15 -0 -0 -64 -244 -0 -52 -255 -4 -0 -16 -159 -188 -0 -11 -235 -176 -72 -17 -0 -0 -0 -0 -0 -0 -52 -255 -4 -0 -0 -52 -255 -4 -0 -0 -52 -255 -0 -0 -148 -157 -0 -1 -234 -73 -0 -118 -170 -31 -225 -207 -0 -246 -0 -0 -0 -62 -237 -237 -32 -0 -0 -0 -31 -241 -124 -221 -8 -0 -0 -0 -0 -0 -25 -238 -68 -0 -0 -0 -0 -52 -255 -4 -0 -0 -0 -0 -0 -184 -118 -0 -0 -0 -0 -0 -0 -0 -52 -255 -4 -0 -0 -44 -101 -0 -0 -0 -14 -121 -0 -0 -0 -0 -0 -0 -0 -0 -0 -127 -255 -32 -242 -102 -5 -147 -255 -0 -4 -86 -235 -1 -59 -250 -16 -0 -52 -255 -240 -241 -254 -223 -32 -0 -48 -255 -6 -0 -0 -0 -0 -0 -52 -255 -4 -0 -0 -55 -255 -0 -52 -255 -240 -240 -240 -240 -22 -0 -0 -52 -255 -240 -240 -240 -202 -0 -48 -255 -6 -0 -138 -241 -248 -0 -52 -255 -240 -240 -240 -243 -255 -0 -0 -0 -52 -255 -4 -0 -0 -0 -0 -0 -0 -0 -52 -255 -4 -0 -52 -255 -220 -235 -100 -0 -0 -0 -0 -52 -255 -4 -0 -0 -0 -0 -52 -255 -6 -209 -182 -52 -255 -0 -52 -255 -4 -169 -120 -52 -255 -0 -49 -255 -5 -0 -0 -54 -255 -0 -52 -255 -240 -240 -231 -169 -31 -0 -49 -255 -5 -0 -0 -54 -255 -0 -52 -255 -240 -244 -255 -173 -11 -0 -0 -38 -160 -229 -253 -188 -37 -0 -0 -0 -0 -52 -255 -4 -0 -0 -52 -255 -4 -0 -0 -52 -255 -0 -0 -70 -227 -0 -51 -244 -7 -0 -78 -202 -83 -147 -220 -32 -251 -0 -0 -0 -14 -235 -202 -0 -0 -0 -0 -0 -124 -255 -75 -0 -0 -0 -0 -0 -0 -173 -156 -0 -0 -0 -0 -0 -52 -255 -4 -0 -0 -0 -0 -0 -64 -230 -7 -0 -0 -0 -0 -0 -0 -52 -255 -4 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -127 -255 -54 -255 -13 -0 -62 -255 -0 -4 -167 -167 -0 -4 -240 -92 -0 -52 -255 -4 -0 -18 -164 -181 -0 -31 -255 -22 -0 -0 -0 -0 -0 -52 -255 -4 -0 -0 -69 -240 -0 -52 -255 -4 -0 -0 -0 -0 -0 -0 -52 -255 -4 -0 -0 -0 -0 -32 -255 -20 -0 -0 -52 -255 -0 -52 -255 -4 -0 -0 -52 -255 -0 -0 -0 -52 -255 -4 -0 -0 -0 -0 -0 -0 -0 -52 -255 -3 -0 -52 -255 -33 -86 -243 -35 -0 -0 -0 -52 -255 -4 -0 -0 -0 -0 -52 -255 -4 -127 -89 -52 -255 -0 -52 -255 -4 -52 -230 -58 -255 -0 -38 -255 -15 -0 -0 -64 -244 -0 -52 -255 -4 -0 -0 -0 -0 -0 -38 -255 -15 -0 -0 -64 -247 -0 -52 -255 -4 -1 -87 -251 -67 -0 -0 -0 -0 -0 -32 -176 -207 -0 -0 -0 -0 -52 -255 -4 -0 -0 -51 -255 -4 -0 -0 -52 -255 -0 -0 -6 -242 -42 -121 -174 -0 -0 -39 -234 -136 -91 -168 -112 -218 -0 -0 -0 -153 -180 -211 -98 -0 -0 -0 -0 -52 -255 -4 -0 -0 -0 -0 -0 -80 -228 -15 -0 -0 -0 -0 -0 -52 -255 -4 -0 -0 -0 -0 -0 -0 -200 -101 -0 -0 -0 -0 -0 -0 -52 -255 -4 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -127 -255 -37 -243 -102 -5 -147 -255 -0 -11 -241 -250 -248 -248 -253 -173 -0 -52 -255 -4 -0 -0 -58 -249 -0 -0 -228 -84 -0 -0 -0 -0 -0 -52 -255 -4 -0 -0 -126 -186 -0 -52 -255 -4 -0 -0 -0 -0 -0 -0 -52 -255 -4 -0 -0 -0 -0 -1 -230 -78 -0 -0 -52 -255 -0 -52 -255 -4 -0 -0 -52 -255 -0 -0 -0 -52 -255 -4 -0 -0 -0 -0 -0 -0 -0 -61 -250 -0 -0 -52 -255 -4 -0 -170 -199 -3 -0 -0 -52 -255 -4 -0 -0 -0 -0 -52 -255 -4 -0 -0 -52 -255 -0 -52 -255 -4 -0 -192 -149 -255 -0 -6 -247 -54 -0 -0 -104 -204 -0 -52 -255 -4 -0 -0 -0 -0 -0 -6 -247 -54 -0 -0 -104 -209 -0 -52 -255 -4 -0 -0 -151 -207 -0 -0 -0 -0 -0 -0 -61 -253 -0 -0 -0 -0 -52 -255 -4 -0 -0 -40 -255 -8 -0 -0 -56 -248 -0 -0 -0 -171 -112 -192 -97 -0 -0 -4 -250 -199 -35 -111 -196 -178 -0 -0 -66 -241 -28 -64 -236 -21 -0 -0 -0 -52 -255 -4 -0 -0 -0 -0 -14 -228 -75 -0 -0 -0 -0 -0 -0 -52 -255 -4 -0 -0 -0 -0 -0 -0 -80 -218 -2 -0 -0 -0 -0 -0 -52 -255 -4 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -127 -238 -80 -75 -219 -234 -164 -248 -0 -77 -249 -16 -0 -0 -87 -245 -0 -52 -255 -4 -0 -9 -145 -216 -0 -0 -102 -222 -50 -0 -22 -89 -0 -52 -255 -4 -7 -82 -239 -67 -0 -52 -255 -4 -0 -0 -0 -0 -0 -0 -52 -255 -4 -0 -0 -0 -0 -0 -109 -215 -40 -0 -81 -255 -0 -52 -255 -4 -0 -0 -52 -255 -0 -0 -0 -52 -255 -4 -0 -0 -0 -43 -112 -13 -3 -145 -201 -0 -0 -52 -255 -4 -0 -20 -233 -126 -0 -0 -52 -255 -11 -8 -8 -8 -0 -52 -255 -4 -0 -0 -52 -255 -0 -52 -255 -4 -0 -75 -246 -255 -0 -0 -163 -173 -9 -23 -212 -114 -0 -52 -255 -4 -0 -0 -0 -0 -0 -0 -162 -173 -9 -23 -212 -123 -0 -52 -255 -4 -0 -0 -25 -246 -0 -14 -123 -29 -0 -18 -163 -202 -0 -0 -0 -0 -52 -255 -4 -0 -0 -5 -232 -107 -3 -9 -151 -190 -0 -0 -0 -93 -195 -248 -21 -0 -0 -0 -216 -233 -0 -54 -254 -139 -0 -10 -221 -108 -0 -0 -168 -163 -0 -0 -0 -52 -255 -4 -0 -0 -0 -0 -151 -163 -0 -0 -0 -0 -0 -0 -0 -52 -255 -4 -0 -0 -0 -0 -0 -0 -1 -214 -84 -0 -0 -0 -0 -0 -52 -255 -4 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -127 -146 -193 -1 -0 -0 -0 -0 -0 -155 -179 -0 -0 -0 -11 -245 -0 -52 -255 -244 -243 -239 -184 -44 -0 -0 -0 -99 -214 -244 -237 -140 -0 -52 -255 -244 -240 -191 -69 -0 -0 -52 -255 -244 -244 -244 -244 -99 -0 -0 -52 -255 -4 -0 -0 -0 -0 -0 -0 -109 -219 -243 -223 -116 -0 -52 -255 -4 -0 -0 -52 -255 -0 -0 -244 -246 -255 -244 -244 -0 -0 -27 -186 -240 -244 -204 -50 -0 -0 -52 -255 -4 -0 -0 -82 -251 -0 -0 -52 -255 -255 -255 -255 -255 -0 -52 -255 -4 -0 -0 -52 -255 -0 -52 -255 -4 -0 -1 -213 -255 -0 -0 -16 -171 -241 -237 -143 -3 -0 -52 -255 -4 -0 -0 -0 -0 -0 -0 -16 -170 -241 -254 -187 -6 -0 -52 -255 -4 -0 -0 -0 -138 -0 -9 -171 -229 -246 -240 -177 -33 -0 -0 -0 -0 -52 -255 -4 -0 -0 -0 -51 -197 -244 -241 -177 -28 -0 -0 -0 -18 -252 -198 -0 -0 -0 -0 -176 -179 -0 -5 -247 -99 -0 -144 -199 -2 -0 -0 -27 -243 -0 -0 -0 -52 -255 -4 -0 -0 -0 -0 -254 -247 -244 -244 -244 -244 -0 -0 -0 -52 -255 -4 -0 -0 -0 -0 -0 -0 -0 -96 -203 -0 -0 -0 -0 -0 -52 -255 -4 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -127 -16 -216 -165 -31 -2 -24 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -87 -237 -57 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -52 -255 -4 -0 -0 -0 -0 -0 -0 -0 -5 -226 -68 -0 -0 -0 -0 -52 -255 -4 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -127 -0 -19 -144 -222 -242 -159 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -58 -12 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -50 -248 -240 -123 -0 -0 -0 -0 -0 -0 -0 -71 -79 -0 -0 -0 -168 -241 -248 -3 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -127 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -244 -244 -244 -244 -244 -244 -99 -0 -0 -127 -127 -127 -127 -127 -127 -127 -0 -127 -127 -127 -127 -127 -127 -127 -0 -127 -127 -127 -127 -127 -127 -127 -0 -127 -127 -127 -127 -127 -127 -127 -0 -127 -127 -127 -127 -127 -127 -127 -0 -127 -127 -127 -127 -127 -127 -127 -0 -127 -127 -127 -127 -127 -127 -127 -0 -127 -127 -127 -127 -127 -127 -127 -0 -127 -127 -127 -127 -127 -127 -127 -0 -127 -127 -127 -127 -127 -127 -127 -0 -127 -127 -127 -127 -127 -127 -127 -0 -127 -127 -127 -127 -127 -127 -127 -0 -127 -127 -127 -127 -127 -127 -127 -0 -127 -127 -127 -127 -127 -127 -127 -0 -127 -127 -127 -127 -127 -127 -127 -0 -127 -127 -127 -127 -127 -127 -127 -0 -127 -127 -127 -127 -127 -127 -127 -0 -127 -127 -127 -127 -127 -127 -127 -0 -127 -127 -127 -127 -127 -127 -127 -0 -127 -127 -127 -127 -127 -127 -127 -0 -127 -127 -127 -127 -127 -127 -127 -0 -127 -127 -127 -127 -127 -127 -127 -0 -127 -127 -127 -127 -127 -127 -127 -0 -127 -127 -127 -127 -127 -127 -127 -0 -127 -127 -127 -127 -127 -127 -127 -0 -127 -127 -127 -127 -127 -127 -127 -0 -127 -127 -127 -127 -127 -127 -127 -0 -127 -127 -127 -127 -127 -127 -127 -0 -127 -127 -127 -127 -127 -127 -127 -0 -127 -127 -127 -127 -127 -127 -127 -0 -127 -127 -127 -127 -127 -127 -127 -0 -127 -127 -127 -127 -127 -127 -127 -0 -127 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -127 -0 -9 -124 -20 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -140 -0 -127 -0 -0 -112 -174 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -4 -221 -0 -127 -0 -0 -0 -159 -98 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -52 -255 -4 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -52 -255 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -2 -166 -243 -244 -102 -0 -0 -0 -0 -0 -0 -0 -0 -0 -52 -255 -4 -0 -0 -0 -0 -0 -0 -0 -0 -49 -244 -3 -0 -0 -0 -0 -0 -49 -244 -3 -0 -0 -0 -52 -255 -4 -0 -0 -0 -0 -11 -244 -246 -255 -4 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -52 -255 -4 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -158 -239 -209 -0 -0 -0 -0 -52 -255 -4 -0 -0 -11 -244 -233 -119 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -68 -162 -0 -127 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -52 -255 -4 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -52 -255 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -46 -255 -24 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -52 -255 -4 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -52 -255 -4 -0 -0 -0 -0 -0 -0 -52 -255 -4 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -52 -255 -4 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -37 -255 -46 -0 -0 -0 -0 -0 -52 -255 -4 -0 -0 -0 -0 -96 -244 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -149 -81 -0 -127 -0 -0 -0 -0 -0 -0 -0 -0 -0 -103 -213 -244 -239 -180 -36 -0 -52 -255 -122 -232 -241 -159 -9 -0 -0 -12 -151 -233 -244 -202 -40 -0 -0 -26 -183 -244 -223 -133 -255 -0 -0 -13 -156 -236 -241 -165 -12 -0 -19 -244 -246 -255 -244 -244 -102 -0 -0 -25 -182 -244 -221 -127 -255 -0 -52 -255 -111 -233 -235 -80 -0 -0 -0 -0 -244 -246 -255 -4 -0 -0 -0 -45 -244 -246 -255 -4 -0 -0 -0 -52 -255 -4 -0 -122 -210 -0 -0 -0 -52 -255 -4 -0 -0 -0 -255 -173 -246 -137 -195 -245 -114 -0 -52 -255 -111 -233 -235 -80 -0 -0 -0 -29 -182 -242 -237 -157 -11 -0 -52 -255 -121 -231 -241 -161 -10 -0 -0 -26 -183 -244 -222 -130 -255 -0 -0 -52 -255 -78 -217 -244 -175 -0 -0 -0 -109 -226 -245 -229 -114 -0 -19 -244 -246 -255 -244 -244 -152 -0 -52 -255 -4 -0 -52 -255 -4 -0 -51 -242 -9 -0 -0 -73 -228 -0 -226 -63 -0 -0 -0 -0 -140 -0 -13 -219 -93 -0 -0 -173 -156 -0 -40 -250 -19 -0 -0 -50 -245 -0 -0 -209 -244 -244 -246 -255 -0 -0 -0 -0 -0 -51 -255 -4 -0 -0 -0 -0 -0 -52 -255 -4 -0 -0 -0 -0 -52 -255 -3 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -5 -8 -0 -1 -219 -10 -0 -127 -0 -0 -0 -0 -0 -0 -0 -0 -0 -93 -52 -2 -9 -162 -204 -0 -52 -255 -163 -9 -19 -198 -144 -0 -0 -174 -188 -24 -0 -53 -43 -0 -0 -193 -157 -7 -20 -200 -255 -0 -0 -173 -186 -16 -11 -179 -152 -0 -0 -0 -52 -255 -4 -0 -0 -0 -0 -189 -167 -10 -19 -199 -255 -0 -52 -255 -121 -2 -133 -219 -0 -0 -0 -0 -0 -52 -255 -4 -0 -0 -0 -0 -0 -52 -255 -4 -0 -0 -0 -52 -255 -4 -133 -204 -19 -0 -0 -0 -52 -255 -4 -0 -0 -0 -255 -51 -99 -255 -55 -96 -227 -0 -52 -255 -121 -2 -133 -219 -0 -0 -0 -198 -158 -8 -19 -198 -149 -0 -52 -255 -163 -9 -19 -198 -145 -0 -0 -192 -158 -8 -20 -198 -255 -0 -0 -52 -255 -169 -20 -2 -52 -0 -0 -31 -255 -62 -0 -20 -57 -0 -0 -0 -52 -255 -4 -0 -0 -0 -52 -255 -4 -0 -52 -255 -4 -0 -0 -216 -84 -0 -0 -162 -139 -0 -166 -118 -0 -0 -0 -0 -195 -0 -0 -49 -235 -36 -104 -211 -9 -0 -0 -200 -106 -0 -0 -142 -163 -0 -0 -0 -0 -0 -149 -171 -0 -0 -0 -0 -0 -54 -255 -2 -0 -0 -0 -0 -0 -52 -255 -4 -0 -0 -0 -0 -50 -255 -5 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -95 -232 -100 -0 -55 -175 -0 -0 -127 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -61 -252 -0 -52 -255 -33 -0 -0 -81 -233 -0 -22 -255 -41 -0 -0 -0 -0 -0 -25 -255 -32 -0 -0 -82 -255 -0 -21 -255 -49 -0 -0 -70 -236 -0 -0 -0 -52 -255 -4 -0 -0 -0 -24 -255 -35 -0 -0 -82 -255 -0 -52 -255 -18 -0 -56 -254 -1 -0 -0 -0 -0 -52 -255 -4 -0 -0 -0 -0 -0 -52 -255 -4 -0 -0 -0 -52 -255 -146 -227 -15 -0 -0 -0 -0 -52 -255 -4 -0 -0 -0 -255 -8 -56 -255 -8 -56 -253 -0 -52 -255 -18 -0 -56 -254 -1 -0 -27 -255 -32 -0 -0 -81 -234 -0 -52 -255 -33 -0 -0 -81 -232 -0 -25 -255 -32 -0 -0 -81 -255 -0 -0 -52 -255 -41 -0 -0 -0 -0 -0 -26 -252 -96 -11 -0 -0 -0 -0 -0 -52 -255 -4 -0 -0 -0 -52 -255 -4 -0 -52 -255 -4 -0 -0 -125 -173 -0 -8 -242 -48 -0 -106 -173 -0 -192 -118 -4 -246 -0 -0 -0 -106 -212 -234 -40 -0 -0 -0 -103 -199 -0 -3 -230 -67 -0 -0 -0 -0 -90 -216 -13 -0 -0 -0 -0 -1 -121 -226 -0 -0 -0 -0 -0 -0 -52 -255 -4 -0 -0 -0 -0 -22 -252 -74 -0 -0 -0 -0 -115 -225 -233 -149 -42 -25 -0 -15 -54 -177 -0 -136 -94 -0 -0 -127 -0 -0 -0 -0 -0 -0 -0 -0 -0 -78 -197 -237 -240 -243 -255 -0 -52 -255 -6 -0 -0 -55 -254 -0 -47 -255 -7 -0 -0 -0 -0 -0 -48 -255 -6 -0 -0 -55 -255 -0 -47 -255 -240 -240 -240 -241 -247 -0 -0 -0 -52 -255 -4 -0 -0 -0 -48 -255 -7 -0 -0 -55 -255 -0 -52 -255 -4 -0 -52 -255 -4 -0 -0 -0 -0 -52 -255 -4 -0 -0 -0 -0 -0 -52 -255 -4 -0 -0 -0 -52 -255 -187 -238 -80 -0 -0 -0 -0 -52 -255 -4 -0 -0 -0 -255 -4 -52 -255 -4 -52 -255 -0 -55 -255 -4 -0 -52 -255 -4 -0 -48 -255 -6 -0 -0 -55 -254 -0 -52 -255 -6 -0 -0 -55 -254 -0 -48 -255 -6 -0 -0 -55 -255 -0 -0 -52 -255 -6 -0 -0 -0 -0 -0 -0 -84 -186 -239 -208 -75 -0 -0 -0 -52 -255 -4 -0 -0 -0 -52 -255 -4 -0 -52 -255 -4 -0 -0 -35 -246 -13 -84 -213 -0 -0 -46 -228 -16 -202 -187 -49 -226 -0 -0 -0 -13 -239 -176 -0 -0 -0 -0 -15 -246 -36 -70 -225 -1 -0 -0 -0 -43 -233 -43 -0 -0 -0 -0 -33 -247 -247 -73 -0 -0 -0 -0 -0 -0 -52 -255 -4 -0 -0 -0 -0 -0 -112 -254 -237 -0 -0 -0 -139 -14 -17 -117 -219 -229 -0 -0 -1 -219 -8 -211 -18 -0 -0 -127 -0 -0 -0 -0 -0 -0 -0 -0 -24 -251 -86 -5 -0 -65 -255 -0 -52 -255 -32 -0 -0 -80 -232 -0 -22 -255 -41 -0 -0 -0 -0 -0 -25 -255 -32 -0 -0 -81 -255 -0 -22 -255 -21 -0 -0 -0 -0 -0 -0 -0 -52 -255 -4 -0 -0 -0 -25 -255 -34 -0 -0 -81 -255 -0 -52 -255 -4 -0 -52 -255 -4 -0 -0 -0 -0 -52 -255 -4 -0 -0 -0 -0 -0 -52 -255 -4 -0 -0 -0 -52 -255 -8 -84 -237 -29 -0 -0 -0 -51 -255 -5 -0 -0 -0 -255 -4 -52 -255 -4 -52 -255 -0 -56 -255 -4 -0 -52 -255 -4 -0 -27 -255 -32 -0 -0 -81 -234 -0 -52 -255 -32 -0 -0 -80 -233 -0 -26 -255 -32 -0 -0 -81 -255 -0 -0 -52 -255 -4 -0 -0 -0 -0 -0 -0 -0 -0 -4 -126 -237 -0 -0 -0 -51 -255 -4 -0 -0 -0 -48 -255 -8 -0 -66 -255 -4 -0 -0 -0 -199 -94 -173 -122 -0 -0 -2 -239 -110 -116 -189 -116 -166 -0 -0 -0 -166 -166 -222 -90 -0 -0 -0 -0 -166 -128 -162 -131 -0 -0 -0 -13 -216 -90 -0 -0 -0 -0 -0 -0 -3 -137 -210 -0 -0 -0 -0 -0 -0 -52 -255 -4 -0 -0 -0 -0 -14 -244 -89 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -154 -117 -188 -0 -0 -0 -127 -0 -0 -0 -0 -0 -0 -0 -0 -33 -255 -68 -0 -26 -189 -255 -0 -52 -255 -160 -8 -17 -195 -143 -0 -0 -177 -185 -23 -0 -50 -42 -0 -0 -194 -158 -7 -19 -198 -255 -0 -0 -176 -162 -17 -0 -32 -76 -0 -0 -0 -52 -255 -4 -0 -0 -0 -0 -191 -164 -10 -17 -195 -255 -0 -52 -255 -4 -0 -52 -255 -4 -0 -0 -0 -0 -52 -255 -4 -0 -0 -0 -0 -0 -52 -255 -4 -0 -0 -0 -52 -255 -4 -0 -156 -194 -0 -0 -0 -24 -254 -67 -0 -0 -0 -255 -4 -52 -255 -4 -52 -255 -0 -56 -255 -4 -0 -52 -255 -4 -0 -0 -200 -158 -7 -19 -198 -151 -0 -52 -255 -160 -8 -17 -195 -146 -0 -0 -194 -158 -7 -19 -198 -255 -0 -0 -52 -255 -4 -0 -0 -0 -0 -0 -31 -72 -8 -2 -124 -230 -0 -0 -0 -30 -255 -51 -0 -0 -0 -15 -251 -62 -0 -147 -255 -4 -0 -0 -0 -108 -195 -246 -32 -0 -0 -0 -182 -228 -42 -120 -228 -106 -0 -0 -103 -217 -11 -55 -238 -39 -0 -0 -0 -70 -222 -242 -36 -0 -0 -0 -172 -148 -0 -0 -0 -0 -0 -0 -0 -0 -57 -254 -1 -0 -0 -0 -0 -0 -52 -255 -4 -0 -0 -0 -0 -49 -255 -8 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -78 -244 -107 -0 -0 -0 -127 -0 -0 -0 -0 -0 -0 -0 -0 -0 -114 -231 -243 -204 -108 -255 -0 -52 -255 -120 -232 -240 -159 -9 -0 -0 -14 -153 -234 -244 -206 -41 -0 -0 -28 -184 -244 -223 -132 -255 -0 -0 -14 -155 -234 -244 -218 -111 -0 -0 -0 -52 -255 -4 -0 -0 -0 -0 -27 -184 -245 -221 -123 -255 -0 -52 -255 -4 -0 -52 -255 -4 -0 -0 -118 -244 -246 -255 -244 -244 -0 -0 -0 -0 -52 -255 -4 -0 -0 -0 -52 -255 -4 -0 -11 -217 -0 -0 -0 -0 -121 -240 -244 -114 -0 -255 -4 -52 -255 -4 -52 -255 -0 -56 -255 -4 -0 -52 -255 -4 -0 -0 -31 -184 -243 -238 -160 -12 -0 -52 -255 -120 -232 -241 -160 -10 -0 -0 -28 -185 -244 -223 -130 -255 -0 -0 -52 -255 -4 -0 -0 -0 -0 -0 -35 -199 -242 -246 -204 -61 -0 -0 -0 -0 -141 -236 -229 -142 -0 -0 -120 -234 -191 -137 -255 -4 -0 -0 -0 -21 -251 -197 -0 -0 -0 -0 -122 -224 -0 -45 -255 -46 -0 -48 -241 -50 -0 -0 -118 -210 -0 -0 -0 -2 -227 -198 -0 -0 -0 -0 -255 -246 -244 -244 -244 -0 -0 -0 -0 -0 -52 -255 -4 -0 -0 -0 -0 -0 -52 -255 -4 -0 -0 -0 -0 -52 -255 -4 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -10 -245 -27 -0 -0 -0 -127 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -72 -240 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -56 -254 -1 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -52 -255 -4 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -52 -255 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -199 -105 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -50 -255 -5 -0 -0 -0 -0 -0 -52 -255 -4 -0 -0 -0 -0 -53 -255 -2 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -6 -0 -0 -0 -0 -127 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -53 -55 -2 -15 -182 -162 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -121 -215 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -52 -255 -4 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -52 -255 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -64 -244 -16 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -25 -255 -56 -0 -0 -0 -0 -0 -52 -255 -4 -0 -0 -0 -0 -106 -232 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -127 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -75 -220 -246 -237 -162 -16 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -194 -246 -227 -68 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -52 -255 -4 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -52 -255 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -203 -237 -92 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -133 -229 -206 -0 -0 -0 -0 -52 -255 -4 -0 -0 -11 -240 -221 -96 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -127 -127 -127 -127 -127 -127 -127 -0 -127 -127 -127 -127 -127 -127 -127 -0 -127 -127 -127 -127 -127 -127 -127 -0 -127 -127 -127 -127 -127 -127 -127 -0 -127 -127 -127 -127 -127 -127 -127 -0 -127 -127 -127 -127 -127 -127 -127 -0 -127 -127 -127 -127 -127 -127 -127 -0 -127 -127 -127 -127 -127 -127 -127 -0 -127 -127 -127 -127 -127 -127 -127 -0 -127 -127 -127 -127 -127 -127 -127 -0 -127 -127 -127 -127 -127 -127 -127 -0 -127 -127 -127 -127 -127 -127 -127 -0 -127 -127 -127 -127 -127 -127 -127 -0 -127 -127 -127 -127 -127 -127 -127 -0 -127 -127 -127 -127 -127 -127 -127 -0 -127 -127 -127 -127 -127 -127 -127 -0 -127 -127 -127 -127 -127 -127 -127 -0 -127 -127 -127 -127 -127 -127 -127 -0 -127 -127 -127 -127 -127 -127 -127 -0 -127 -127 -127 -127 -127 -127 -127 -0 -127 -127 -127 -127 -127 -127 -127 -0 -127 -127 -127 -127 -127 -127 -127 -0 -127 -127 -127 -127 -127 -127 -127 -0 -127 -127 -127 -127 -127 -127 -127 -0 -127 -127 -127 -127 -127 -127 -127 -0 -127 -127 -127 -127 -127 -127 -127 -0 -127 -127 -127 -127 -127 -127 -127 -0 -127 -127 -127 -127 -127 -127 -127 -0 -127 -127 -127 -127 -127 -127 -127 -0 -127 -127 -127 -127 -127 -127 -127 -0 -127 -127 -127 -127 -127 -127 -127 -0 -127 -127 -127 -127 -127 -127 -127 -0 -127 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -2 -187 -58 -108 -143 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -102 -10 -58 -54 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -127 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -97 -59 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -33 -222 -208 -8 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -60 -194 -183 -6 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -48 -240 -52 -240 -3 -0 -0 -127 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -58 -199 -211 -11 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -184 -184 -143 -119 -77 -39 -156 -0 -0 -0 -73 -164 -22 -196 -26 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -42 -179 -3 -188 -30 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -127 -0 -4 -134 -230 -245 -210 -44 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -57 -219 -243 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -52 -255 -4 -0 -0 -0 -0 -0 -52 -255 -4 -0 -0 -0 -0 -4 -195 -31 -94 -137 -0 -0 -109 -231 -221 -73 -0 -0 -0 -0 -0 -47 -189 -243 -241 -204 -73 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -26 -175 -241 -247 -255 -244 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -244 -244 -244 -244 -249 -254 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -111 -129 -0 -0 -0 -0 -0 -0 -52 -255 -4 -0 -0 -0 -0 -111 -178 -0 -111 -129 -0 -0 -52 -255 -4 -52 -255 -4 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -156 -224 -40 -191 -0 -0 -0 -196 -0 -196 -159 -147 -211 -0 -0 -0 -0 -125 -231 -62 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -143 -189 -126 -0 -0 -0 -171 -161 -0 -0 -1 -208 -134 -0 -127 -0 -137 -197 -27 -0 -51 -39 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -218 -103 -1 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -52 -255 -4 -0 -0 -0 -0 -0 -52 -255 -4 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -254 -51 -101 -235 -0 -0 -0 -0 -8 -233 -119 -7 -3 -56 -63 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -181 -177 -20 -52 -255 -4 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -1 -192 -148 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -206 -69 -0 -0 -0 -0 -0 -0 -62 -241 -1 -0 -0 -0 -0 -206 -94 -0 -206 -69 -0 -0 -62 -241 -1 -66 -241 -1 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -174 -39 -188 -126 -0 -0 -0 -196 -0 -196 -55 -118 -196 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -15 -125 -8 -0 -0 -0 -29 -241 -39 -0 -85 -240 -17 -0 -127 -8 -244 -57 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -31 -249 -5 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -118 -244 -246 -255 -244 -244 -72 -0 -118 -244 -246 -255 -244 -244 -72 -0 -0 -0 -0 -0 -0 -0 -0 -0 -254 -50 -100 -234 -1 -57 -97 -0 -46 -255 -15 -0 -0 -0 -0 -0 -0 -0 -0 -0 -31 -0 -0 -0 -10 -252 -51 -0 -52 -255 -4 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -101 -223 -12 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -35 -255 -14 -0 -0 -0 -0 -0 -0 -118 -157 -0 -0 -0 -0 -35 -255 -18 -35 -255 -14 -0 -0 -120 -157 -0 -143 -157 -0 -0 -0 -0 -84 -234 -231 -76 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -196 -0 -196 -0 -0 -196 -0 -0 -0 -109 -226 -245 -229 -114 -0 -0 -0 -0 -30 -0 -0 -0 -0 -0 -103 -239 -220 -122 -231 -236 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -209 -244 -244 -246 -255 -0 -0 -0 -120 -167 -2 -213 -127 -0 -0 -127 -240 -255 -241 -240 -236 -18 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -74 -210 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -52 -255 -4 -0 -0 -0 -0 -0 -52 -255 -4 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -111 -234 -255 -210 -148 -92 -14 -0 -10 -232 -176 -72 -17 -0 -0 -0 -0 -0 -0 -55 -219 -0 -0 -0 -40 -255 -14 -0 -52 -255 -4 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -25 -238 -68 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -52 -255 -4 -0 -0 -0 -0 -0 -0 -178 -63 -0 -0 -0 -0 -52 -255 -4 -52 -255 -4 -0 -0 -181 -63 -0 -225 -63 -0 -0 -0 -0 -234 -255 -255 -232 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -31 -255 -62 -0 -20 -57 -0 -0 -0 -0 -218 -54 -0 -0 -0 -5 -243 -62 -113 -255 -57 -106 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -149 -171 -0 -0 -0 -6 -214 -135 -237 -14 -0 -0 -127 -51 -255 -4 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -22 -240 -247 -250 -240 -150 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -52 -255 -4 -0 -0 -0 -0 -0 -52 -255 -4 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -129 -149 -89 -13 -0 -0 -0 -0 -0 -33 -152 -222 -253 -188 -37 -0 -0 -0 -85 -217 -46 -0 -0 -0 -49 -255 -6 -0 -52 -255 -240 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -173 -156 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -234 -255 -255 -232 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -26 -252 -96 -11 -0 -0 -0 -0 -0 -0 -46 -217 -85 -0 -0 -39 -255 -11 -62 -255 -6 -54 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -90 -216 -13 -0 -0 -0 -0 -68 -255 -121 -0 -0 -0 -127 -240 -255 -240 -240 -50 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -156 -126 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -52 -255 -4 -0 -0 -0 -0 -0 -52 -255 -4 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -113 -231 -221 -73 -73 -223 -225 -0 -0 -0 -0 -0 -27 -170 -207 -0 -0 -0 -229 -102 -0 -0 -0 -0 -40 -255 -14 -0 -52 -255 -4 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -80 -228 -15 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -84 -235 -233 -79 -0 -0 -244 -244 -244 -244 -244 -244 -244 -0 -244 -244 -244 -244 -244 -244 -244 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -84 -186 -239 -208 -75 -0 -0 -0 -0 -0 -103 -229 -0 -0 -50 -255 -5 -53 -255 -240 -241 -0 -3 -0 -0 -0 -0 -0 -0 -0 -0 -0 -43 -233 -43 -0 -0 -0 -0 -0 -0 -252 -60 -0 -0 -0 -127 -9 -247 -62 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -200 -85 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -52 -255 -4 -0 -0 -0 -116 -240 -243 -255 -240 -240 -71 -0 -0 -0 -0 -0 -0 -0 -0 -0 -254 -51 -102 -235 -229 -51 -101 -0 -0 -0 -0 -0 -0 -61 -253 -0 -0 -0 -29 -206 -115 -0 -0 -0 -10 -252 -51 -0 -52 -255 -4 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -14 -228 -75 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -4 -126 -237 -0 -0 -0 -0 -116 -206 -29 -0 -0 -39 -255 -11 -60 -255 -8 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -13 -216 -90 -0 -0 -0 -0 -0 -0 -0 -252 -60 -0 -0 -0 -127 -0 -146 -201 -26 -0 -50 -39 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -52 -255 -4 -0 -0 -0 -0 -0 -1 -243 -45 -0 -0 -0 -0 -52 -255 -4 -52 -255 -4 -0 -44 -220 -3 -44 -220 -3 -44 -0 -3 -0 -52 -255 -4 -0 -0 -0 -0 -0 -52 -255 -4 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -254 -47 -99 -235 -230 -47 -97 -0 -15 -135 -41 -5 -30 -171 -202 -0 -0 -0 -0 -12 -180 -0 -0 -0 -0 -181 -177 -19 -52 -255 -4 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -151 -163 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -31 -72 -8 -2 -124 -230 -0 -0 -0 -0 -179 -12 -0 -0 -0 -6 -244 -62 -114 -255 -80 -0 -0 -1 -0 -0 -0 -0 -0 -0 -0 -0 -172 -148 -0 -0 -0 -0 -0 -0 -0 -0 -252 -60 -0 -0 -0 -127 -0 -6 -140 -231 -245 -213 -44 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -62 -241 -1 -0 -0 -0 -0 -0 -33 -253 -7 -0 -0 -0 -0 -62 -241 -1 -66 -241 -1 -0 -52 -255 -4 -52 -255 -4 -52 -0 -4 -0 -52 -255 -4 -0 -0 -0 -0 -0 -52 -255 -4 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -116 -239 -229 -79 -79 -231 -233 -0 -9 -166 -229 -252 -240 -177 -33 -0 -0 -0 -0 -0 -3 -0 -0 -0 -0 -26 -177 -242 -247 -255 -244 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -254 -247 -244 -244 -244 -244 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -35 -199 -242 -246 -204 -61 -0 -0 -0 -0 -2 -0 -0 -0 -0 -0 -105 -240 -221 -111 -222 -244 -0 -1 -0 -0 -0 -0 -0 -0 -0 -0 -255 -246 -244 -244 -244 -0 -0 -0 -0 -0 -252 -60 -0 -0 -0 -127 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -120 -157 -0 -0 -0 -0 -0 -0 -85 -212 -0 -0 -0 -0 -0 -120 -157 -0 -143 -157 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -52 -255 -4 -0 -0 -0 -0 -0 -52 -255 -4 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -127 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -181 -63 -0 -0 -0 -0 -30 -11 -195 -131 -0 -0 -0 -0 -0 -181 -63 -0 -225 -63 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -127 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -227 -245 -177 -12 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -127 -127 -127 -127 -127 -127 -127 -0 -127 -127 -127 -127 -127 -127 -127 -0 -127 -127 -127 -127 -127 -127 -127 -0 -127 -127 -127 -127 -127 -127 -127 -0 -127 -127 -127 -127 -127 -127 -127 -0 -127 -127 -127 -127 -127 -127 -127 -0 -127 -127 -127 -127 -127 -127 -127 -0 -127 -127 -127 -127 -127 -127 -127 -0 -127 -127 -127 -127 -127 -127 -127 -0 -127 -127 -127 -127 -127 -127 -127 -0 -127 -127 -127 -127 -127 -127 -127 -0 -127 -127 -127 -127 -127 -127 -127 -0 -127 -127 -127 -127 -127 -127 -127 -0 -127 -127 -127 -127 -127 -127 -127 -0 -127 -127 -127 -127 -127 -127 -127 -0 -127 -127 -127 -127 -127 -127 -127 -0 -127 -127 -127 -127 -127 -127 -127 -0 -127 -127 -127 -127 -127 -127 -127 -0 -127 -127 -127 -127 -127 -127 -127 -0 -127 -127 -127 -127 -127 -127 -127 -0 -127 -127 -127 -127 -127 -127 -127 -0 -127 -127 -127 -127 -127 -127 -127 -0 -127 -127 -127 -127 -127 -127 -127 -0 -127 -127 -127 -127 -127 -127 -127 -0 -127 -127 -127 -127 -127 -127 -127 -0 -127 -127 -127 -127 -127 -127 -127 -0 -127 -127 -127 -127 -127 -127 -127 -0 -127 -127 -127 -127 -127 -127 -127 -0 -127 -127 -127 -127 -127 -127 -127 -0 -127 -127 -127 -127 -127 -127 -127 -0 -127 -127 -127 -127 -127 -127 -127 -0 -127 -127 -127 -127 -127 -127 -127 -0 -127 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -127 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -58 -98 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -2 -8 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -127 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -20 -221 -50 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -103 -185 -255 -4 -0 -0 -0 -0 -106 -186 -255 -4 -0 -0 -0 -0 -0 -144 -235 -229 -126 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -127 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -49 -244 -3 -0 -0 -0 -0 -0 -0 -0 -52 -255 -4 -0 -0 -0 -0 -86 -224 -245 -206 -0 -0 -0 -0 -0 -0 -0 -0 -0 -215 -116 -0 -0 -0 -164 -172 -0 -0 -0 -0 -52 -255 -4 -0 -0 -0 -110 -227 -245 -223 -102 -0 -0 -0 -49 -244 -53 -244 -3 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -122 -237 -237 -102 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -3 -244 -244 -244 -175 -0 -0 -0 -0 -116 -239 -227 -77 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -116 -235 -233 -108 -0 -0 -0 -0 -165 -239 -235 -132 -0 -0 -0 -0 -0 -173 -88 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -40 -184 -245 -255 -246 -255 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -101 -185 -255 -4 -0 -0 -0 -0 -77 -219 -247 -201 -45 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -52 -255 -4 -0 -0 -0 -0 -0 -52 -255 -4 -0 -0 -0 -0 -0 -17 -0 -101 -238 -0 -0 -0 -0 -0 -49 -244 -3 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -127 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -52 -255 -4 -0 -0 -0 -11 -245 -105 -1 -43 -0 -0 -0 -0 -0 -0 -0 -0 -0 -62 -241 -25 -0 -61 -236 -23 -0 -0 -0 -0 -52 -255 -4 -0 -0 -33 -255 -60 -0 -26 -51 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -53 -181 -236 -230 -161 -31 -0 -0 -0 -33 -1 -102 -238 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -53 -181 -236 -230 -161 -31 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -30 -254 -51 -99 -236 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -42 -3 -96 -248 -0 -0 -0 -0 -15 -2 -107 -236 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -5 -226 -255 -255 -255 -56 -255 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -52 -255 -4 -0 -0 -0 -14 -244 -93 -2 -142 -209 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -52 -255 -4 -0 -0 -0 -0 -0 -52 -255 -4 -0 -0 -0 -0 -0 -0 -222 -242 -72 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -127 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -14 -161 -243 -255 -236 -0 -0 -0 -47 -255 -11 -0 -0 -0 -0 -82 -25 -0 -0 -44 -64 -0 -0 -155 -165 -3 -210 -93 -0 -0 -0 -0 -0 -52 -255 -4 -0 -0 -15 -230 -104 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -67 -255 -255 -253 -224 -140 -233 -0 -0 -3 -160 -237 -243 -255 -3 -0 -0 -0 -0 -31 -0 -0 -31 -0 -0 -0 -0 -0 -0 -0 -0 -0 -67 -255 -255 -251 -251 -255 -233 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -30 -254 -50 -100 -234 -0 -0 -0 -0 -0 -52 -255 -4 -0 -0 -0 -0 -0 -0 -113 -173 -0 -0 -0 -0 -0 -244 -239 -67 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -52 -255 -4 -0 -52 -255 -4 -0 -45 -255 -255 -255 -255 -56 -255 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -52 -255 -4 -0 -0 -0 -47 -255 -12 -0 -61 -253 -0 -0 -30 -0 -0 -30 -0 -0 -0 -0 -52 -255 -4 -0 -0 -0 -0 -0 -52 -255 -4 -0 -0 -0 -0 -0 -0 -0 -108 -224 -0 -0 -0 -0 -0 -44 -255 -3 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -127 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -52 -255 -4 -0 -0 -0 -0 -0 -174 -182 -65 -255 -13 -0 -0 -0 -52 -255 -4 -0 -0 -0 -0 -79 -222 -204 -189 -221 -47 -0 -123 -185 -244 -166 -235 -176 -90 -0 -0 -0 -0 -52 -255 -4 -0 -0 -0 -100 -237 -188 -46 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -222 -255 -110 -2 -21 -6 -156 -0 -0 -42 -255 -40 -100 -255 -4 -0 -0 -0 -55 -219 -0 -55 -218 -0 -0 -0 -0 -0 -0 -0 -0 -0 -222 -161 -255 -4 -86 -247 -157 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -114 -233 -220 -71 -0 -0 -0 -0 -0 -52 -255 -4 -0 -0 -0 -0 -0 -65 -191 -12 -0 -0 -0 -0 -0 -0 -107 -224 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -52 -255 -4 -0 -52 -255 -4 -0 -19 -250 -255 -255 -255 -56 -255 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -52 -255 -4 -0 -0 -0 -12 -243 -94 -4 -144 -206 -0 -0 -218 -54 -0 -219 -54 -0 -0 -81 -176 -212 -160 -0 -28 -70 -0 -81 -176 -212 -168 -31 -8 -78 -0 -0 -35 -1 -114 -240 -0 -0 -0 -0 -0 -63 -242 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -127 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -52 -255 -4 -0 -0 -0 -0 -22 -255 -48 -52 -255 -4 -0 -0 -172 -243 -255 -240 -240 -37 -0 -0 -17 -230 -49 -97 -201 -0 -0 -0 -0 -101 -255 -50 -0 -0 -0 -0 -0 -0 -52 -255 -4 -0 -0 -21 -249 -20 -108 -240 -103 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -255 -255 -14 -0 -0 -0 -67 -0 -0 -5 -182 -234 -147 -248 -3 -0 -0 -85 -219 -47 -85 -212 -43 -0 -186 -244 -244 -244 -244 -245 -252 -0 -255 -71 -255 -244 -232 -84 -67 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -240 -240 -243 -255 -240 -240 -0 -0 -0 -56 -182 -13 -0 -0 -0 -0 -0 -42 -1 -116 -239 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -52 -255 -4 -0 -52 -255 -4 -0 -0 -105 -248 -255 -255 -56 -255 -0 -0 -0 -44 -220 -3 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -81 -176 -212 -168 -49 -0 -0 -0 -72 -213 -242 -195 -40 -0 -0 -44 -213 -85 -48 -220 -85 -0 -0 -2 -56 -132 -204 -195 -104 -0 -0 -0 -12 -86 -169 -231 -170 -0 -0 -180 -240 -219 -87 -42 -91 -0 -0 -15 -210 -132 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -127 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -52 -255 -4 -0 -0 -0 -0 -48 -255 -11 -52 -255 -4 -0 -0 -0 -52 -255 -4 -0 -0 -0 -0 -16 -229 -53 -101 -198 -0 -0 -168 -240 -243 -255 -240 -240 -123 -0 -0 -0 -0 -0 -0 -0 -0 -0 -30 -254 -67 -0 -93 -244 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -255 -222 -111 -4 -17 -5 -67 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -229 -109 -0 -229 -89 -0 -0 -0 -0 -0 -0 -0 -52 -255 -0 -255 -71 -255 -9 -178 -76 -67 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -52 -255 -4 -0 -0 -0 -0 -173 -242 -240 -240 -11 -0 -0 -0 -200 -241 -217 -82 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -52 -255 -4 -0 -52 -255 -4 -0 -0 -0 -18 -107 -255 -56 -255 -0 -0 -0 -52 -255 -4 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -89 -229 -0 -109 -229 -0 -150 -216 -167 -92 -18 -0 -0 -0 -92 -177 -230 -162 -79 -8 -0 -0 -21 -98 -143 -151 -148 -110 -60 -0 -0 -186 -168 -2 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -127 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -52 -255 -4 -0 -0 -0 -0 -21 -255 -43 -52 -255 -4 -0 -0 -0 -52 -255 -4 -0 -0 -0 -0 -76 -223 -204 -189 -222 -49 -0 -0 -0 -52 -255 -4 -0 -0 -0 -0 -0 -0 -52 -255 -4 -0 -0 -0 -117 -241 -119 -83 -210 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -224 -153 -197 -240 -202 -13 -157 -0 -0 -3 -240 -240 -240 -240 -11 -0 -0 -29 -207 -117 -29 -205 -112 -0 -0 -0 -0 -0 -0 -50 -248 -0 -224 -156 -228 -3 -22 -188 -166 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -52 -255 -4 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -52 -255 -11 -0 -62 -255 -4 -0 -0 -0 -0 -52 -255 -56 -255 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -228 -240 -240 -240 -172 -0 -0 -113 -205 -29 -118 -207 -29 -0 -49 -4 -0 -0 -146 -255 -4 -0 -130 -71 -5 -87 -225 -232 -129 -0 -21 -53 -7 -0 -2 -174 -255 -0 -40 -255 -20 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -127 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -52 -255 -4 -0 -0 -0 -0 -0 -175 -172 -59 -255 -8 -0 -0 -0 -52 -255 -4 -0 -0 -0 -0 -85 -25 -0 -0 -46 -62 -0 -0 -0 -52 -255 -4 -0 -0 -0 -0 -0 -0 -52 -255 -4 -0 -0 -0 -0 -43 -182 -246 -51 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -68 -240 -97 -7 -14 -129 -232 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -12 -180 -0 -12 -180 -0 -0 -0 -0 -0 -0 -0 -0 -0 -68 -240 -97 -7 -14 -129 -232 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -52 -255 -99 -3 -157 -255 -18 -0 -0 -0 -0 -52 -255 -56 -255 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -179 -12 -0 -179 -12 -0 -0 -0 -0 -0 -44 -141 -255 -4 -0 -0 -0 -0 -28 -5 -88 -239 -0 -0 -0 -0 -0 -126 -102 -255 -0 -23 -252 -95 -8 -66 -99 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -127 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -52 -255 -4 -0 -0 -0 -0 -0 -13 -156 -235 -255 -231 -0 -0 -244 -246 -255 -244 -244 -244 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -52 -255 -4 -0 -0 -0 -0 -0 -0 -52 -255 -4 -0 -0 -0 -0 -0 -0 -127 -213 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -53 -184 -236 -232 -164 -31 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -3 -0 -0 -3 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -53 -184 -236 -232 -164 -31 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -244 -244 -244 -244 -244 -244 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -52 -255 -163 -243 -148 -208 -191 -0 -0 -0 -0 -52 -255 -56 -255 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -2 -0 -0 -2 -0 -0 -0 -0 -0 -0 -136 -53 -255 -4 -0 -0 -0 -0 -0 -9 -168 -67 -0 -0 -0 -0 -84 -94 -52 -255 -0 -0 -101 -231 -249 -202 -68 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -127 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -52 -255 -4 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -52 -255 -4 -0 -0 -1 -72 -10 -3 -120 -233 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -52 -255 -4 -0 -0 -0 -0 -0 -0 -0 -0 -52 -255 -56 -255 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -33 -65 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -240 -243 -255 -176 -0 -0 -0 -0 -28 -162 -38 -0 -0 -0 -0 -0 -174 -240 -243 -255 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -127 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -52 -255 -4 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -52 -255 -4 -0 -0 -2 -188 -234 -241 -201 -61 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -52 -255 -4 -0 -0 -0 -0 -0 -0 -0 -0 -23 -116 -25 -116 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -2 -214 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -52 -255 -4 -0 -0 -0 -0 -143 -245 -244 -244 -0 -0 -0 -0 -0 -0 -52 -255 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -127 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -52 -255 -4 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -116 -199 -178 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -127 -127 -127 -127 -127 -127 -127 -0 -127 -127 -127 -127 -127 -127 -127 -0 -127 -127 -127 -127 -127 -127 -127 -0 -127 -127 -127 -127 -127 -127 -127 -0 -127 -127 -127 -127 -127 -127 -127 -0 -127 -127 -127 -127 -127 -127 -127 -0 -127 -127 -127 -127 -127 -127 -127 -0 -127 -127 -127 -127 -127 -127 -127 -0 -127 -127 -127 -127 -127 -127 -127 -0 -127 -127 -127 -127 -127 -127 -127 -0 -127 -127 -127 -127 -127 -127 -127 -0 -127 -127 -127 -127 -127 -127 -127 -0 -127 -127 -127 -127 -127 -127 -127 -0 -127 -127 -127 -127 -127 -127 -127 -0 -127 -127 -127 -127 -127 -127 -127 -0 -127 -127 -127 -127 -127 -127 -127 -0 -127 -127 -127 -127 -127 -127 -127 -0 -127 -127 -127 -127 -127 -127 -127 -0 -127 -127 -127 -127 -127 -127 -127 -0 -127 -127 -127 -127 -127 -127 -127 -0 -127 -127 -127 -127 -127 -127 -127 -0 -127 -127 -127 -127 -127 -127 -127 -0 -127 -127 -127 -127 -127 -127 -127 -0 -127 -127 -127 -127 -127 -127 -127 -0 -127 -127 -127 -127 -127 -127 -127 -0 -127 -127 -127 -127 -127 -127 -127 -0 -127 -127 -127 -127 -127 -127 -127 -0 -127 -127 -127 -127 -127 -127 -127 -0 -127 -127 -127 -127 -127 -127 -127 -0 -127 -127 -127 -127 -127 -127 -127 -0 -127 -127 -127 -127 -127 -127 -127 -0 -127 -127 -127 -127 -127 -127 -127 -0 -127 -0 -0 -51 -90 -0 -0 -0 -0 -0 -0 -0 -6 -119 -17 -0 -0 -0 -0 -4 -117 -84 -0 -0 -0 -0 -2 -196 -190 -20 -191 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -145 -237 -102 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -99 -44 -0 -0 -0 -0 -0 -0 -0 -48 -95 -0 -0 -0 -0 -0 -41 -128 -38 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -97 -35 -0 -0 -0 -0 -0 -0 -0 -57 -85 -0 -0 -0 -0 -0 -46 -127 -26 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -18 -217 -181 -17 -203 -0 -0 -0 -0 -74 -213 -6 -0 -0 -0 -0 -0 -0 -27 -229 -40 -0 -0 -0 -0 -29 -222 -209 -8 -0 -0 -0 -2 -195 -200 -27 -193 -1 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -101 -212 -8 -0 -0 -0 -0 -0 -0 -29 -234 -61 -0 -0 -0 -0 -42 -226 -218 -16 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -143 -135 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -127 -0 -0 -3 -172 -83 -0 -0 -0 -0 -0 -0 -158 -105 -0 -0 -0 -0 -0 -154 -91 -157 -84 -0 -0 -0 -34 -144 -63 -189 -101 -0 -0 -0 -48 -240 -52 -240 -3 -0 -0 -0 -32 -255 -96 -239 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -39 -201 -20 -0 -0 -0 -0 -0 -25 -203 -35 -0 -0 -0 -0 -24 -188 -62 -188 -22 -0 -0 -0 -48 -240 -52 -240 -3 -0 -0 -0 -0 -42 -195 -12 -0 -0 -0 -0 -0 -29 -198 -25 -0 -0 -0 -0 -22 -184 -66 -185 -14 -0 -0 -0 -48 -240 -52 -240 -3 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -74 -110 -77 -192 -109 -0 -0 -0 -0 -0 -139 -130 -0 -0 -0 -0 -0 -0 -177 -92 -0 -0 -0 -0 -1 -183 -63 -107 -141 -0 -0 -0 -37 -141 -60 -187 -123 -0 -0 -0 -48 -240 -3 -48 -240 -3 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -151 -143 -0 -0 -0 -0 -0 -1 -189 -104 -0 -0 -0 -0 -8 -200 -53 -93 -169 -0 -0 -0 -48 -240 -3 -48 -240 -3 -0 -0 -0 -42 -192 -5 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -127 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -20 -246 -100 -217 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -9 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -127 -0 -0 -20 -252 -200 -0 -0 -0 -0 -0 -20 -252 -200 -0 -0 -0 -0 -0 -20 -252 -200 -0 -0 -0 -0 -0 -20 -252 -200 -0 -0 -0 -0 -0 -80 -255 -32 -0 -0 -0 -0 -0 -62 -238 -30 -0 -0 -0 -0 -0 -196 -247 -255 -244 -244 -0 -0 -0 -96 -213 -244 -234 -137 -0 -52 -255 -244 -244 -244 -244 -68 -0 -52 -255 -244 -244 -244 -244 -68 -0 -52 -255 -244 -244 -244 -244 -68 -0 -52 -255 -244 -244 -244 -236 -0 -0 -0 -244 -246 -255 -244 -244 -0 -0 -0 -244 -246 -255 -244 -244 -0 -0 -0 -244 -246 -255 -244 -244 -0 -0 -0 -244 -246 -255 -244 -244 -0 -0 -52 -255 -244 -239 -190 -68 -0 -0 -52 -255 -166 -0 -0 -52 -255 -0 -0 -15 -168 -241 -236 -141 -2 -0 -0 -15 -168 -241 -236 -141 -2 -0 -0 -15 -168 -241 -236 -141 -2 -0 -0 -15 -168 -241 -236 -141 -2 -0 -0 -15 -168 -241 -236 -141 -2 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -13 -166 -240 -239 -148 -152 -0 -52 -255 -4 -0 -0 -52 -255 -0 -52 -255 -4 -0 -0 -52 -255 -0 -52 -255 -4 -0 -0 -52 -255 -0 -52 -255 -4 -0 -0 -52 -255 -0 -220 -112 -0 -0 -0 -161 -179 -0 -52 -255 -4 -0 -0 -0 -0 -0 -0 -100 -226 -247 -212 -58 -0 -0 -127 -0 -0 -98 -207 -251 -26 -0 -0 -0 -0 -98 -207 -251 -26 -0 -0 -0 -0 -98 -207 -251 -26 -0 -0 -0 -0 -98 -207 -251 -26 -0 -0 -0 -0 -160 -212 -112 -0 -0 -0 -0 -0 -91 -210 -42 -0 -0 -0 -0 -17 -242 -58 -255 -4 -0 -0 -0 -100 -223 -50 -0 -22 -89 -0 -52 -255 -4 -0 -0 -0 -0 -0 -52 -255 -4 -0 -0 -0 -0 -0 -52 -255 -4 -0 -0 -0 -0 -0 -52 -255 -4 -0 -0 -0 -0 -0 -0 -0 -52 -255 -4 -0 -0 -0 -0 -0 -52 -255 -4 -0 -0 -0 -0 -0 -52 -255 -4 -0 -0 -0 -0 -0 -52 -255 -4 -0 -0 -0 -52 -255 -4 -7 -81 -238 -66 -0 -52 -255 -242 -30 -0 -52 -255 -0 -0 -160 -175 -10 -24 -213 -112 -0 -0 -160 -175 -10 -24 -213 -112 -0 -0 -160 -175 -10 -24 -213 -112 -0 -0 -160 -175 -10 -24 -213 -112 -0 -0 -160 -175 -10 -24 -213 -112 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -158 -169 -7 -42 -243 -176 -0 -52 -255 -4 -0 -0 -52 -255 -0 -52 -255 -4 -0 -0 -52 -255 -0 -52 -255 -4 -0 -0 -52 -255 -0 -52 -255 -4 -0 -0 -52 -255 -0 -74 -238 -18 -0 -52 -245 -33 -0 -52 -255 -4 -0 -0 -0 -0 -0 -20 -251 -87 -1 -120 -216 -0 -0 -127 -0 -0 -179 -121 -200 -105 -0 -0 -0 -0 -179 -121 -200 -105 -0 -0 -0 -0 -179 -121 -200 -105 -0 -0 -0 -0 -179 -121 -200 -105 -0 -0 -0 -3 -236 -97 -192 -0 -0 -0 -0 -0 -185 -107 -136 -0 -0 -0 -0 -86 -189 -52 -255 -4 -0 -0 -0 -227 -84 -0 -0 -0 -0 -0 -52 -255 -4 -0 -0 -0 -0 -0 -52 -255 -4 -0 -0 -0 -0 -0 -52 -255 -4 -0 -0 -0 -0 -0 -52 -255 -4 -0 -0 -0 -0 -0 -0 -0 -52 -255 -4 -0 -0 -0 -0 -0 -52 -255 -4 -0 -0 -0 -0 -0 -52 -255 -4 -0 -0 -0 -0 -0 -52 -255 -4 -0 -0 -0 -52 -255 -4 -0 -0 -125 -186 -0 -52 -255 -150 -143 -0 -52 -255 -0 -6 -246 -54 -0 -0 -105 -204 -0 -6 -246 -54 -0 -0 -105 -204 -0 -6 -246 -54 -0 -0 -105 -204 -0 -6 -246 -54 -0 -0 -105 -204 -0 -6 -246 -54 -0 -0 -105 -204 -0 -0 -123 -22 -0 -0 -66 -81 -0 -5 -246 -57 -0 -52 -245 -208 -0 -52 -255 -4 -0 -0 -52 -255 -0 -52 -255 -4 -0 -0 -52 -255 -0 -52 -255 -4 -0 -0 -52 -255 -0 -52 -255 -4 -0 -0 -52 -255 -0 -0 -176 -146 -0 -194 -127 -0 -0 -52 -255 -240 -240 -233 -177 -38 -0 -50 -255 -8 -69 -180 -160 -0 -0 -127 -0 -12 -248 -51 -130 -186 -0 -0 -0 -12 -248 -51 -130 -186 -0 -0 -0 -12 -248 -51 -130 -186 -0 -0 -0 -12 -248 -51 -130 -186 -0 -0 -0 -64 -222 -16 -250 -19 -0 -0 -0 -25 -230 -26 -227 -2 -0 -0 -0 -159 -125 -52 -255 -4 -0 -0 -31 -255 -21 -0 -0 -0 -0 -0 -52 -255 -4 -0 -0 -0 -0 -0 -52 -255 -4 -0 -0 -0 -0 -0 -52 -255 -4 -0 -0 -0 -0 -0 -52 -255 -4 -0 -0 -0 -0 -0 -0 -0 -52 -255 -4 -0 -0 -0 -0 -0 -52 -255 -4 -0 -0 -0 -0 -0 -52 -255 -4 -0 -0 -0 -0 -0 -52 -255 -4 -0 -0 -0 -52 -255 -4 -0 -0 -69 -240 -0 -52 -255 -37 -239 -16 -52 -255 -0 -38 -255 -15 -0 -0 -64 -244 -0 -38 -255 -15 -0 -0 -64 -244 -0 -38 -255 -15 -0 -0 -64 -244 -0 -38 -255 -15 -0 -0 -64 -244 -0 -38 -255 -15 -0 -0 -64 -244 -0 -0 -130 -214 -25 -73 -235 -64 -0 -38 -255 -20 -12 -210 -108 -246 -0 -52 -255 -4 -0 -0 -52 -255 -0 -52 -255 -4 -0 -0 -52 -255 -0 -52 -255 -4 -0 -0 -52 -255 -0 -52 -255 -4 -0 -0 -52 -255 -0 -0 -31 -241 -124 -221 -8 -0 -0 -52 -255 -4 -0 -18 -164 -208 -0 -52 -255 -30 -251 -36 -0 -0 -0 -127 -0 -86 -235 -1 -59 -250 -16 -0 -0 -86 -235 -1 -59 -250 -16 -0 -0 -86 -235 -1 -59 -250 -16 -0 -0 -86 -235 -1 -59 -250 -16 -0 -0 -144 -164 -0 -213 -96 -0 -0 -0 -117 -182 -0 -230 -68 -0 -0 -1 -231 -61 -52 -255 -240 -240 -0 -48 -255 -6 -0 -0 -0 -0 -0 -52 -255 -240 -240 -240 -240 -22 -0 -52 -255 -240 -240 -240 -240 -22 -0 -52 -255 -240 -240 -240 -240 -22 -0 -52 -255 -240 -240 -240 -187 -0 -0 -0 -0 -52 -255 -4 -0 -0 -0 -0 -0 -52 -255 -4 -0 -0 -0 -0 -0 -52 -255 -4 -0 -0 -0 -0 -0 -52 -255 -4 -0 -0 -0 -239 -255 -240 -198 -0 -55 -255 -0 -52 -255 -4 -169 -120 -52 -255 -0 -49 -255 -5 -0 -0 -54 -255 -0 -49 -255 -5 -0 -0 -54 -255 -0 -49 -255 -5 -0 -0 -54 -255 -0 -49 -255 -5 -0 -0 -54 -255 -0 -49 -255 -5 -0 -0 -54 -255 -0 -0 -0 -124 -225 -235 -60 -0 -0 -49 -255 -6 -160 -101 -53 -255 -0 -52 -255 -4 -0 -0 -52 -255 -0 -52 -255 -4 -0 -0 -52 -255 -0 -52 -255 -4 -0 -0 -52 -255 -0 -52 -255 -4 -0 -0 -52 -255 -0 -0 -0 -124 -255 -75 -0 -0 -0 -52 -255 -4 -0 -0 -59 -253 -0 -52 -255 -26 -245 -109 -2 -0 -0 -127 -0 -167 -167 -0 -4 -240 -92 -0 -0 -167 -167 -0 -4 -240 -92 -0 -0 -167 -167 -0 -4 -240 -92 -0 -0 -167 -167 -0 -4 -240 -92 -0 -0 -223 -105 -0 -154 -176 -0 -0 -0 -210 -130 -0 -179 -162 -0 -0 -49 -246 -6 -52 -255 -4 -0 -0 -31 -255 -23 -0 -0 -0 -0 -0 -52 -255 -4 -0 -0 -0 -0 -0 -52 -255 -4 -0 -0 -0 -0 -0 -52 -255 -4 -0 -0 -0 -0 -0 -52 -255 -4 -0 -0 -0 -0 -0 -0 -0 -52 -255 -4 -0 -0 -0 -0 -0 -52 -255 -4 -0 -0 -0 -0 -0 -52 -255 -4 -0 -0 -0 -0 -0 -52 -255 -4 -0 -0 -0 -52 -255 -4 -0 -0 -69 -240 -0 -52 -255 -4 -52 -230 -58 -255 -0 -38 -255 -15 -0 -0 -64 -244 -0 -38 -255 -15 -0 -0 -64 -244 -0 -38 -255 -15 -0 -0 -64 -244 -0 -38 -255 -15 -0 -0 -64 -244 -0 -38 -255 -15 -0 -0 -64 -244 -0 -0 -0 -80 -241 -224 -31 -0 -0 -40 -255 -92 -164 -0 -63 -245 -0 -51 -255 -4 -0 -0 -52 -255 -0 -51 -255 -4 -0 -0 -52 -255 -0 -51 -255 -4 -0 -0 -52 -255 -0 -51 -255 -4 -0 -0 -52 -255 -0 -0 -0 -52 -255 -4 -0 -0 -0 -52 -255 -4 -0 -17 -161 -208 -0 -52 -255 -4 -47 -187 -209 -46 -0 -127 -7 -241 -250 -248 -248 -253 -173 -0 -7 -241 -250 -248 -248 -253 -173 -0 -7 -241 -250 -248 -248 -253 -173 -0 -7 -241 -250 -248 -248 -253 -173 -0 -48 -255 -249 -248 -250 -246 -10 -0 -49 -255 -249 -248 -250 -244 -11 -0 -122 -251 -240 -243 -255 -4 -0 -0 -0 -228 -88 -0 -0 -0 -0 -0 -52 -255 -4 -0 -0 -0 -0 -0 -52 -255 -4 -0 -0 -0 -0 -0 -52 -255 -4 -0 -0 -0 -0 -0 -52 -255 -4 -0 -0 -0 -0 -0 -0 -0 -52 -255 -4 -0 -0 -0 -0 -0 -52 -255 -4 -0 -0 -0 -0 -0 -52 -255 -4 -0 -0 -0 -0 -0 -52 -255 -4 -0 -0 -0 -52 -255 -4 -0 -0 -126 -186 -0 -52 -255 -4 -0 -192 -149 -255 -0 -6 -247 -54 -0 -0 -104 -204 -0 -6 -247 -54 -0 -0 -104 -204 -0 -6 -247 -54 -0 -0 -104 -204 -0 -6 -247 -54 -0 -0 -104 -204 -0 -6 -247 -54 -0 -0 -104 -204 -0 -0 -87 -233 -51 -113 -224 -34 -0 -10 -253 -203 -12 -0 -100 -203 -0 -40 -255 -9 -0 -0 -57 -248 -0 -40 -255 -9 -0 -0 -57 -248 -0 -40 -255 -9 -0 -0 -57 -248 -0 -40 -255 -8 -0 -0 -56 -248 -0 -0 -0 -52 -255 -4 -0 -0 -0 -52 -255 -240 -240 -234 -178 -38 -0 -52 -255 -4 -0 -0 -116 -220 -0 -127 -74 -249 -16 -0 -0 -87 -245 -0 -74 -249 -16 -0 -0 -87 -245 -0 -74 -249 -16 -0 -0 -87 -245 -0 -74 -249 -16 -0 -0 -87 -245 -0 -128 -211 -0 -0 -15 -248 -80 -0 -143 -187 -0 -0 -5 -234 -94 -0 -195 -109 -0 -52 -255 -4 -0 -0 -0 -102 -228 -62 -5 -34 -99 -0 -52 -255 -4 -0 -0 -0 -0 -0 -52 -255 -4 -0 -0 -0 -0 -0 -52 -255 -4 -0 -0 -0 -0 -0 -52 -255 -4 -0 -0 -0 -0 -0 -0 -0 -52 -255 -4 -0 -0 -0 -0 -0 -52 -255 -4 -0 -0 -0 -0 -8 -58 -255 -11 -8 -0 -0 -0 -0 -52 -255 -4 -0 -0 -0 -52 -255 -4 -7 -82 -239 -67 -0 -52 -255 -4 -0 -75 -246 -255 -0 -0 -163 -173 -9 -23 -212 -114 -0 -0 -163 -173 -9 -23 -212 -114 -0 -0 -163 -173 -9 -23 -212 -114 -0 -0 -163 -173 -9 -23 -212 -114 -0 -0 -163 -173 -9 -23 -212 -114 -0 -0 -166 -49 -0 -0 -108 -107 -0 -13 -237 -190 -15 -18 -206 -111 -0 -5 -232 -117 -10 -19 -158 -190 -0 -5 -232 -117 -10 -19 -158 -190 -0 -5 -232 -117 -10 -19 -158 -190 -0 -5 -232 -107 -3 -9 -151 -190 -0 -0 -0 -52 -255 -4 -0 -0 -0 -52 -255 -4 -0 -0 -0 -0 -0 -52 -255 -34 -8 -2 -118 -240 -0 -127 -155 -179 -0 -0 -0 -11 -245 -0 -155 -179 -0 -0 -0 -11 -245 -0 -155 -179 -0 -0 -0 -11 -245 -0 -155 -179 -0 -0 -0 -11 -245 -0 -208 -126 -0 -0 -0 -176 -160 -0 -232 -94 -0 -0 -0 -144 -188 -0 -251 -31 -0 -52 -255 -244 -244 -0 -0 -0 -99 -214 -255 -240 -135 -0 -52 -255 -244 -244 -244 -244 -99 -0 -52 -255 -244 -244 -244 -244 -99 -0 -52 -255 -244 -244 -244 -244 -99 -0 -52 -255 -244 -244 -244 -244 -22 -0 -0 -244 -246 -255 -244 -244 -0 -0 -0 -244 -246 -255 -244 -244 -0 -0 -0 -255 -255 -255 -255 -255 -0 -0 -0 -244 -246 -255 -244 -244 -0 -0 -52 -255 -244 -240 -191 -69 -0 -0 -52 -255 -4 -0 -1 -213 -255 -0 -0 -16 -171 -241 -237 -143 -3 -0 -0 -16 -171 -241 -237 -143 -3 -0 -0 -16 -171 -241 -237 -143 -3 -0 -0 -16 -171 -241 -237 -143 -3 -0 -0 -16 -171 -241 -237 -143 -3 -0 -0 -0 -0 -0 -0 -0 -0 -0 -157 -99 -185 -245 -234 -140 -2 -0 -0 -51 -197 -249 -244 -177 -28 -0 -0 -51 -197 -249 -244 -177 -28 -0 -0 -51 -197 -249 -244 -177 -28 -0 -0 -51 -197 -244 -241 -177 -28 -0 -0 -0 -52 -255 -4 -0 -0 -0 -52 -255 -4 -0 -0 -0 -0 -0 -52 -255 -116 -240 -246 -211 -74 -0 -127 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -107 -120 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -17 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -127 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -13 -69 -194 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -127 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -233 -241 -107 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -127 -127 -127 -127 -127 -127 -127 -0 -127 -127 -127 -127 -127 -127 -127 -0 -127 -127 -127 -127 -127 -127 -127 -0 -127 -127 -127 -127 -127 -127 -127 -0 -127 -127 -127 -127 -127 -127 -127 -0 -127 -127 -127 -127 -127 -127 -127 -0 -127 -127 -127 -127 -127 -127 -127 -0 -127 -127 -127 -127 -127 -127 -127 -0 -127 -127 -127 -127 -127 -127 -127 -0 -127 -127 -127 -127 -127 -127 -127 -0 -127 -127 -127 -127 -127 -127 -127 -0 -127 -127 -127 -127 -127 -127 -127 -0 -127 -127 -127 -127 -127 -127 -127 -0 -127 -127 -127 -127 -127 -127 -127 -0 -127 -127 -127 -127 -127 -127 -127 -0 -127 -127 -127 -127 -127 -127 -127 -0 -127 -127 -127 -127 -127 -127 -127 -0 -127 -127 -127 -127 -127 -127 -127 -0 -127 -127 -127 -127 -127 -127 -127 -0 -127 -127 -127 -127 -127 -127 -127 -0 -127 -127 -127 -127 -127 -127 -127 -0 -127 -127 -127 -127 -127 -127 -127 -0 -127 -127 -127 -127 -127 -127 -127 -0 -127 -127 -127 -127 -127 -127 -127 -0 -127 -127 -127 -127 -127 -127 -127 -0 -127 -127 -127 -127 -127 -127 -127 -0 -127 -127 -127 -127 -127 -127 -127 -0 -127 -127 -127 -127 -127 -127 -127 -0 -127 -127 -127 -127 -127 -127 -127 -0 -127 -127 -127 -127 -127 -127 -127 -0 -127 -127 -127 -127 -127 -127 -127 -0 -127 -127 -127 -127 -127 -127 -127 -0 -127 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -127 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -104 -226 -228 -110 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -127 -0 -8 -195 -125 -0 -0 -0 -0 -0 -0 -0 -0 -98 -212 -15 -0 -0 -0 -2 -197 -213 -8 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -241 -45 -96 -248 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -2 -157 -139 -0 -0 -0 -0 -0 -0 -0 -0 -154 -142 -0 -0 -0 -0 -10 -199 -192 -5 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -111 -190 -2 -0 -0 -0 -0 -0 -0 -0 -50 -225 -29 -0 -0 -0 -0 -130 -241 -30 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -11 -187 -114 -0 -0 -0 -0 -0 -0 -0 -1 -161 -149 -1 -0 -0 -0 -24 -211 -193 -6 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -68 -217 -9 -0 -0 -0 -0 -0 -0 -0 -44 -223 -23 -0 -0 -0 -0 -88 -244 -31 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -64 -91 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -127 -0 -0 -18 -213 -67 -0 -0 -0 -0 -0 -0 -46 -220 -30 -0 -0 -0 -0 -115 -148 -123 -138 -0 -0 -0 -14 -196 -237 -203 -189 -27 -0 -0 -0 -240 -3 -49 -244 -3 -0 -0 -0 -105 -226 -228 -110 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -1 -155 -105 -0 -0 -0 -0 -0 -0 -121 -140 -0 -0 -0 -0 -0 -158 -74 -90 -145 -0 -0 -0 -0 -240 -3 -49 -244 -3 -0 -0 -0 -0 -158 -122 -0 -0 -0 -0 -0 -0 -12 -210 -56 -0 -0 -0 -0 -38 -200 -77 -175 -0 -0 -0 -49 -244 -53 -244 -3 -0 -0 -0 -3 -138 -202 -114 -121 -12 -0 -0 -86 -232 -214 -194 -37 -0 -0 -0 -0 -7 -172 -97 -0 -0 -0 -0 -0 -0 -144 -133 -0 -0 -0 -0 -6 -185 -54 -92 -153 -0 -0 -0 -25 -206 -234 -199 -174 -3 -0 -0 -49 -244 -3 -49 -244 -3 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -123 -138 -0 -0 -0 -0 -0 -0 -2 -195 -59 -0 -0 -0 -0 -11 -204 -78 -171 -0 -0 -0 -0 -49 -244 -53 -244 -3 -0 -0 -0 -0 -0 -51 -205 -26 -0 -0 -52 -255 -4 -0 -0 -0 -0 -0 -0 -49 -244 -53 -244 -3 -0 -0 -127 -0 -0 -0 -32 -105 -0 -0 -0 -0 -0 -0 -91 -46 -0 -0 -0 -0 -2 -113 -7 -1 -111 -7 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -6 -117 -7 -0 -0 -0 -0 -0 -57 -72 -0 -0 -0 -0 -0 -74 -38 -0 -93 -20 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -51 -110 -93 -212 -36 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -24 -0 -0 -0 -1 -109 -6 -0 -0 -0 -0 -0 -35 -80 -0 -0 -0 -0 -0 -49 -64 -0 -96 -15 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -103 -25 -0 -0 -0 -52 -255 -4 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -127 -0 -103 -213 -244 -239 -180 -36 -0 -0 -103 -213 -244 -240 -180 -36 -0 -0 -103 -213 -244 -239 -180 -36 -0 -0 -103 -213 -244 -239 -180 -36 -0 -0 -103 -213 -244 -239 -180 -36 -0 -0 -103 -213 -244 -239 -180 -36 -0 -0 -132 -239 -226 -131 -234 -236 -0 -0 -12 -151 -233 -244 -202 -40 -0 -0 -13 -156 -236 -241 -165 -12 -0 -0 -13 -156 -236 -241 -165 -12 -0 -0 -13 -156 -236 -241 -165 -12 -0 -0 -13 -156 -235 -241 -165 -12 -0 -0 -0 -244 -246 -255 -4 -0 -0 -0 -0 -244 -246 -255 -4 -0 -0 -0 -0 -244 -246 -255 -4 -0 -0 -0 -148 -244 -255 -4 -0 -0 -0 -0 -25 -178 -243 -251 -214 -9 -0 -52 -255 -111 -233 -235 -80 -0 -0 -0 -29 -182 -242 -237 -157 -11 -0 -0 -29 -182 -242 -237 -157 -11 -0 -0 -29 -182 -242 -237 -157 -11 -0 -0 -29 -182 -242 -237 -157 -11 -0 -0 -29 -182 -242 -237 -157 -11 -0 -0 -0 -0 -49 -244 -3 -0 -0 -0 -29 -181 -242 -238 -160 -192 -0 -52 -255 -4 -0 -52 -255 -4 -0 -52 -255 -4 -0 -52 -255 -4 -0 -52 -255 -4 -0 -52 -255 -4 -0 -52 -255 -4 -0 -52 -255 -4 -0 -40 -250 -19 -0 -0 -50 -245 -0 -52 -255 -121 -231 -241 -161 -10 -0 -93 -212 -0 -0 -0 -221 -87 -0 -127 -0 -93 -52 -2 -9 -162 -204 -0 -0 -93 -52 -2 -10 -165 -204 -0 -0 -93 -52 -2 -9 -162 -204 -0 -0 -93 -52 -2 -9 -162 -204 -0 -0 -93 -52 -2 -9 -162 -204 -0 -0 -93 -52 -2 -9 -159 -204 -0 -0 -48 -4 -120 -255 -57 -104 -0 -0 -174 -188 -24 -0 -53 -43 -0 -0 -173 -187 -16 -11 -178 -153 -0 -0 -173 -187 -16 -11 -178 -153 -0 -0 -173 -186 -16 -11 -179 -152 -0 -0 -173 -177 -14 -11 -179 -152 -0 -0 -0 -0 -52 -255 -4 -0 -0 -0 -0 -0 -52 -255 -4 -0 -0 -0 -0 -0 -52 -255 -4 -0 -0 -0 -0 -0 -252 -4 -0 -0 -0 -0 -192 -167 -11 -4 -181 -123 -0 -52 -255 -121 -2 -133 -219 -0 -0 -0 -198 -158 -8 -19 -198 -149 -0 -0 -198 -158 -8 -19 -198 -149 -0 -0 -198 -158 -8 -19 -198 -149 -0 -0 -198 -158 -8 -19 -198 -149 -0 -0 -198 -158 -8 -19 -198 -149 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -198 -161 -9 -24 -239 -165 -0 -52 -255 -4 -0 -52 -255 -4 -0 -52 -255 -4 -0 -52 -255 -4 -0 -52 -255 -4 -0 -52 -255 -4 -0 -52 -255 -4 -0 -52 -255 -4 -0 -0 -200 -106 -0 -0 -142 -163 -0 -52 -255 -163 -9 -19 -198 -145 -0 -11 -244 -36 -0 -48 -244 -10 -0 -127 -0 -0 -0 -0 -0 -61 -252 -0 -0 -0 -0 -0 -0 -62 -252 -0 -0 -0 -0 -0 -0 -61 -252 -0 -0 -0 -0 -0 -0 -61 -252 -0 -0 -0 -0 -0 -0 -61 -252 -0 -0 -0 -0 -0 -0 -57 -252 -0 -0 -0 -0 -55 -255 -6 -54 -0 -22 -255 -41 -0 -0 -0 -0 -0 -21 -255 -50 -0 -0 -67 -236 -0 -21 -255 -50 -0 -0 -67 -236 -0 -21 -255 -49 -0 -0 -70 -236 -0 -21 -255 -37 -0 -0 -70 -236 -0 -0 -0 -0 -52 -255 -4 -0 -0 -0 -0 -0 -52 -255 -4 -0 -0 -0 -0 -0 -52 -255 -4 -0 -0 -0 -0 -0 -252 -4 -0 -0 -0 -25 -255 -35 -0 -0 -86 -217 -0 -52 -255 -18 -0 -56 -254 -1 -0 -27 -255 -32 -0 -0 -81 -234 -0 -27 -255 -32 -0 -0 -81 -234 -0 -27 -255 -32 -0 -0 -81 -234 -0 -27 -255 -32 -0 -0 -81 -234 -0 -27 -255 -32 -0 -0 -81 -234 -0 -0 -240 -240 -240 -240 -240 -240 -0 -27 -255 -31 -2 -168 -165 -235 -0 -52 -255 -4 -0 -52 -255 -4 -0 -52 -255 -4 -0 -52 -255 -4 -0 -52 -255 -4 -0 -52 -255 -4 -0 -52 -255 -4 -0 -52 -255 -4 -0 -0 -103 -199 -0 -3 -230 -67 -0 -52 -255 -33 -0 -0 -81 -232 -0 -0 -162 -117 -0 -130 -165 -0 -0 -127 -0 -78 -197 -237 -240 -243 -255 -0 -0 -71 -189 -224 -224 -230 -255 -0 -0 -78 -197 -237 -240 -243 -255 -0 -0 -78 -197 -237 -240 -243 -255 -0 -0 -78 -197 -237 -240 -243 -255 -0 -0 -78 -197 -237 -240 -243 -255 -0 -0 -125 -231 -244 -255 -240 -241 -0 -50 -255 -7 -0 -0 -0 -0 -0 -47 -255 -225 -224 -224 -227 -239 -0 -47 -255 -225 -224 -224 -227 -239 -0 -47 -255 -240 -240 -240 -241 -247 -0 -47 -255 -240 -240 -240 -241 -247 -0 -0 -0 -0 -52 -255 -4 -0 -0 -0 -0 -0 -52 -255 -4 -0 -0 -0 -0 -0 -52 -255 -4 -0 -0 -0 -0 -0 -252 -4 -0 -0 -0 -48 -255 -7 -0 -0 -56 -254 -0 -52 -255 -4 -0 -52 -255 -4 -0 -48 -255 -6 -0 -0 -55 -254 -0 -48 -255 -6 -0 -0 -55 -254 -0 -48 -255 -6 -0 -0 -55 -254 -0 -48 -255 -6 -0 -0 -55 -254 -0 -48 -255 -6 -0 -0 -55 -254 -0 -0 -0 -0 -0 -0 -0 -0 -0 -48 -255 -7 -152 -111 -54 -255 -0 -52 -255 -4 -0 -52 -255 -4 -0 -52 -255 -4 -0 -52 -255 -4 -0 -52 -255 -4 -0 -52 -255 -4 -0 -52 -255 -4 -0 -52 -255 -4 -0 -0 -15 -246 -36 -70 -225 -1 -0 -52 -255 -6 -0 -0 -55 -254 -0 -0 -68 -197 -0 -212 -76 -0 -0 -127 -24 -251 -95 -6 -0 -62 -255 -0 -23 -250 -82 -2 -0 -65 -255 -0 -24 -251 -86 -5 -0 -65 -255 -0 -24 -251 -86 -5 -0 -65 -255 -0 -24 -251 -86 -5 -0 -65 -255 -0 -24 -251 -86 -5 -0 -65 -255 -0 -32 -255 -57 -53 -255 -8 -0 -0 -22 -255 -41 -0 -0 -0 -0 -0 -22 -255 -23 -0 -0 -0 -0 -0 -22 -255 -23 -0 -0 -0 -0 -0 -22 -255 -21 -0 -0 -0 -0 -0 -22 -255 -21 -0 -0 -0 -0 -0 -0 -0 -0 -52 -255 -4 -0 -0 -0 -0 -0 -52 -255 -4 -0 -0 -0 -0 -0 -52 -255 -4 -0 -0 -0 -0 -0 -252 -4 -0 -0 -0 -25 -255 -34 -0 -0 -83 -238 -0 -52 -255 -4 -0 -52 -255 -4 -0 -27 -255 -32 -0 -0 -81 -234 -0 -27 -255 -32 -0 -0 -81 -234 -0 -27 -255 -32 -0 -0 -81 -234 -0 -27 -255 -32 -0 -0 -81 -234 -0 -27 -255 -32 -0 -0 -81 -234 -0 -0 -0 -0 -48 -240 -3 -0 -0 -27 -255 -165 -129 -0 -81 -234 -0 -48 -255 -8 -0 -66 -255 -4 -0 -48 -255 -8 -0 -66 -255 -4 -0 -48 -255 -8 -0 -66 -255 -4 -0 -48 -255 -8 -0 -66 -255 -4 -0 -0 -0 -166 -128 -162 -131 -0 -0 -52 -255 -32 -0 -0 -80 -233 -0 -0 -2 -226 -62 -238 -5 -0 -0 -127 -33 -255 -38 -0 -4 -170 -255 -0 -33 -255 -69 -0 -26 -189 -255 -0 -33 -255 -68 -0 -26 -189 -255 -0 -33 -255 -68 -0 -26 -189 -255 -0 -33 -255 -68 -0 -26 -189 -255 -0 -33 -255 -68 -0 -26 -189 -255 -0 -38 -255 -39 -95 -255 -76 -1 -0 -0 -177 -185 -23 -0 -50 -42 -0 -0 -176 -165 -17 -0 -32 -76 -0 -0 -176 -165 -17 -0 -32 -76 -0 -0 -176 -162 -17 -0 -32 -76 -0 -0 -176 -162 -17 -0 -29 -79 -0 -0 -0 -0 -52 -255 -4 -0 -0 -0 -0 -0 -52 -255 -4 -0 -0 -0 -0 -0 -52 -255 -4 -0 -0 -0 -0 -0 -252 -4 -0 -0 -0 -0 -194 -163 -8 -21 -202 -156 -0 -52 -255 -4 -0 -52 -255 -4 -0 -0 -200 -158 -7 -19 -198 -151 -0 -0 -200 -158 -7 -19 -198 -151 -0 -0 -200 -158 -7 -19 -198 -151 -0 -0 -200 -158 -7 -19 -198 -151 -0 -0 -200 -158 -7 -19 -198 -151 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -216 -210 -7 -19 -198 -151 -0 -15 -251 -62 -0 -147 -255 -4 -0 -15 -251 -62 -0 -147 -255 -4 -0 -15 -251 -62 -0 -147 -255 -4 -0 -15 -251 -62 -0 -147 -255 -4 -0 -0 -0 -70 -222 -242 -36 -0 -0 -52 -255 -160 -8 -17 -195 -146 -0 -0 -0 -137 -215 -157 -0 -0 -0 -127 -0 -114 -219 -196 -189 -127 -255 -0 -0 -114 -231 -243 -204 -107 -255 -0 -0 -114 -231 -243 -204 -108 -255 -0 -0 -114 -231 -243 -204 -108 -255 -0 -0 -114 -231 -243 -204 -108 -255 -0 -0 -113 -230 -243 -205 -106 -255 -0 -0 -154 -245 -215 -95 -224 -242 -0 -0 -14 -153 -237 -255 -207 -42 -0 -0 -14 -155 -234 -244 -218 -111 -0 -0 -14 -155 -234 -244 -218 -111 -0 -0 -14 -155 -234 -244 -218 -111 -0 -0 -14 -153 -233 -244 -220 -120 -0 -0 -118 -244 -246 -255 -244 -244 -0 -0 -108 -224 -230 -255 -224 -224 -0 -0 -108 -224 -230 -255 -224 -224 -0 -22 -244 -244 -255 -244 -244 -34 -0 -0 -27 -180 -242 -238 -161 -13 -0 -52 -255 -4 -0 -52 -255 -4 -0 -0 -31 -184 -243 -238 -160 -12 -0 -0 -31 -184 -243 -238 -160 -12 -0 -0 -31 -184 -243 -238 -160 -12 -0 -0 -31 -184 -243 -238 -160 -12 -0 -0 -31 -184 -243 -238 -160 -12 -0 -0 -0 -0 -0 -0 -0 -0 -0 -95 -164 -178 -242 -238 -160 -12 -0 -0 -120 -234 -191 -137 -255 -4 -0 -0 -120 -234 -191 -137 -255 -4 -0 -0 -120 -234 -191 -137 -255 -4 -0 -0 -120 -234 -191 -137 -255 -4 -0 -0 -0 -2 -227 -198 -0 -0 -0 -52 -255 -120 -232 -241 -160 -10 -0 -0 -0 -43 -255 -72 -0 -0 -0 -127 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -187 -14 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -40 -4 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -199 -105 -0 -0 -0 -52 -255 -4 -0 -0 -0 -0 -0 -0 -0 -18 -232 -4 -0 -0 -0 -127 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -10 -1 -167 -67 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -64 -244 -16 -0 -0 -0 -52 -255 -4 -0 -0 -0 -0 -0 -0 -0 -132 -148 -0 -0 -0 -0 -127 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -64 -242 -213 -19 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -0 -203 -237 -92 -0 -0 -0 -0 -52 -255 -4 -0 -0 -0 -0 -0 -11 -243 -209 -25 -0 -0 -0 -0 -0 -127 -127 -127 -127 -127 -127 -127 -0 -127 -127 -127 -127 -127 -127 -127 -0 -127 -127 -127 -127 -127 -127 -127 -0 -127 -127 -127 -127 -127 -127 -127 -0 -127 -127 -127 -127 -127 -127 -127 -0 -127 -127 -127 -127 -127 -127 -127 -0 -127 -127 -127 -127 -127 -127 -127 -0 -127 -127 -127 -127 -127 -127 -127 -0 -127 -127 -127 -127 -127 -127 -127 -0 -127 -127 -127 -127 -127 -127 -127 -0 -127 -127 -127 -127 -127 -127 -127 -0 -127 -127 -127 -127 -127 -127 -127 -0 -127 -127 -127 -127 -127 -127 -127 -0 -127 -127 -127 -127 -127 -127 -127 -0 -127 -127 -127 -127 -127 -127 -127 -0 -127 -127 -127 -127 -127 -127 -127 -0 -127 -127 -127 -127 -127 -127 -127 -0 -127 -127 -127 -127 -127 -127 -127 -0 -127 -127 -127 -127 -127 -127 -127 -0 -127 -127 -127 -127 -127 -127 -127 -0 -127 -127 -127 -127 -127 -127 -127 -0 -127 -127 -127 -127 -127 -127 -127 -0 -127 -127 -127 -127 -127 -127 -127 -0 -127 -127 -127 -127 -127 -127 -127 -0 -127 -127 -127 -127 -127 -127 -127 -0 -127 -127 -127 -127 -127 -127 -127 -0 -127 -127 -127 -127 -127 -127 -127 -0 -127 -127 -127 -127 -127 -127 -127 -0 -127 -127 -127 -127 -127 -127 -127 -0 -127 -127 -127 -127 -127 -127 -127 -0 -127 -127 -127 -127 -127 -127 -127 -0 -127 -127 -127 -127 -127 -127 -127 -0 diff --git a/extern/AntTweakBar/src/res/FontLargeAA.pgm b/extern/AntTweakBar/src/res/FontLargeAA.pgm deleted file mode 100644 index 1b3600dd..00000000 --- a/extern/AntTweakBar/src/res/FontLargeAA.pgm +++ /dev/null @@ -1,1197 +0,0 @@ -P2 -# Created by Paint Shop Pro -276 120 -255 -127 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 4 -4 4 4 0 0 0 0 0 0 0 0 0 0 0 4 4 4 0 4 4 0 0 0 0 0 127 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 4 4 4 4 0 0 0 0 0 0 0 0 -0 0 0 4 4 4 0 4 4 0 0 0 0 0 127 0 0 0 0 0 0 0 0 0 59 245 125 175 225 21 -0 0 0 0 0 0 0 0 0 0 0 0 0 138 125 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 59 241 89 0 0 12 235 201 89 255 166 0 0 0 0 0 172 89 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 89 225 21 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 4 4 4 4 0 -0 0 0 0 0 0 0 0 0 0 4 4 4 0 4 4 0 0 0 0 0 127 0 0 0 0 0 138 247 34 0 12 -232 89 138 225 21 0 0 0 0 138 125 7 199 34 0 0 0 0 138 125 0 0 0 0 138 -255 255 201 0 0 0 59 215 21 0 0 0 0 59 245 255 255 166 0 0 0 59 241 89 -0 7 206 201 0 0 89 251 89 0 59 215 21 172 89 59 192 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 175 166 0 0 138 255 251 89 0 0 0 0 0 -138 201 0 0 0 7 206 255 255 255 166 0 0 7 206 255 255 255 201 0 0 0 0 0 -0 138 251 89 0 0 175 255 255 255 255 225 21 0 0 12 235 255 255 125 89 255 -255 255 255 255 251 89 0 12 235 255 255 225 21 0 0 59 245 255 255 166 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 59 245 255 255 251 89 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 4 -4 4 4 0 0 0 0 0 0 0 0 0 0 0 4 4 4 0 4 4 0 0 0 0 0 127 0 0 0 0 0 89 247 -34 0 12 232 89 138 201 0 0 0 0 7 202 89 59 215 21 0 0 12 235 255 255 255 -166 0 59 241 89 12 235 125 0 0 172 89 0 0 0 0 7 206 166 0 89 251 89 0 0 -12 228 34 0 89 247 34 0 0 0 175 201 0 0 89 251 191 194 247 34 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 12 232 89 0 175 201 0 12 235 -125 0 0 138 255 255 201 0 0 0 12 182 0 0 59 245 125 0 12 206 21 0 12 235 -166 0 0 0 0 89 255 251 89 0 0 175 201 0 0 0 0 0 0 89 255 125 0 0 0 0 0 -0 0 0 89 251 89 12 235 166 0 7 206 201 0 59 245 125 0 12 235 166 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 89 166 0 0 138 251 89 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 4 4 4 4 0 -0 0 0 0 0 0 0 0 0 0 4 4 4 0 4 4 0 0 0 0 0 127 0 0 0 0 0 89 247 34 0 12 -228 34 89 201 0 0 0 0 12 206 21 89 166 0 0 12 235 125 138 125 59 192 0 -89 247 34 7 206 166 0 89 201 0 0 0 0 0 12 235 125 0 12 232 89 0 0 12 228 -34 0 175 201 0 0 0 0 59 241 89 0 0 7 206 166 0 0 0 0 0 0 0 138 166 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 89 225 21 59 241 89 0 0 138 225 21 0 -0 0 175 201 0 0 0 0 0 0 0 7 206 201 0 0 0 0 0 0 175 201 0 0 0 59 241 132 -241 89 0 0 175 201 0 0 0 0 0 7 206 166 0 0 0 0 0 0 0 0 7 206 201 0 59 241 -89 0 0 138 225 21 138 225 21 0 0 138 225 21 89 255 125 0 0 89 255 125 0 -0 0 0 0 0 0 0 138 225 21 0 0 0 0 0 0 0 0 0 0 0 138 201 0 0 0 0 0 0 0 0 -0 0 0 59 241 89 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 4 4 4 4 0 0 0 0 0 -0 0 0 0 0 0 4 4 4 0 4 4 0 0 0 0 0 127 0 0 0 0 0 89 247 34 0 0 0 0 0 0 0 -0 89 255 255 255 255 255 255 255 125 59 238 34 138 125 0 0 0 89 247 34 -7 206 166 7 202 89 0 0 0 0 0 0 175 225 21 138 225 21 0 0 0 0 0 12 235 125 -0 0 0 0 7 206 125 0 89 251 191 194 247 34 0 0 0 0 0 138 166 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 138 166 0 89 247 34 0 0 89 247 34 0 0 0 175 201 -0 0 0 0 0 0 0 12 235 166 0 0 0 0 0 59 245 125 0 0 12 235 125 59 241 89 -0 0 175 201 0 0 0 0 0 59 241 89 0 0 0 0 0 0 0 0 89 247 34 0 12 235 201 -0 0 175 201 0 138 225 21 0 0 89 247 34 89 255 125 0 0 89 255 125 0 0 0 -0 0 12 235 255 225 21 0 0 0 0 0 0 0 0 0 0 0 0 0 175 255 251 89 0 0 0 0 -0 0 0 0 138 247 34 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 4 4 4 4 0 0 0 -0 0 0 0 0 0 0 0 4 4 4 0 4 4 0 0 0 0 0 127 0 0 0 0 0 89 247 34 0 0 0 0 0 -0 0 0 0 0 175 125 7 199 34 0 0 12 235 166 138 125 0 0 0 59 241 89 12 235 -125 89 201 12 235 255 251 89 0 0 7 206 255 166 0 59 241 89 0 0 0 59 238 -34 0 0 0 0 0 175 166 59 215 21 172 89 59 192 0 0 0 0 0 138 166 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 7 206 125 0 138 247 34 0 0 89 247 34 0 0 0 -175 201 0 0 0 0 0 0 0 89 251 89 0 0 0 89 255 247 34 0 0 7 206 166 0 59 -241 89 0 0 175 255 255 255 225 21 0 89 251 226 255 255 247 34 0 0 0 7 206 -166 0 0 0 12 235 255 255 201 0 0 89 255 125 0 0 138 247 34 0 0 0 0 0 0 -0 0 0 0 0 89 255 255 166 0 0 0 0 0 175 255 255 255 255 255 255 225 21 0 -0 0 0 59 245 255 201 0 0 0 0 0 175 251 89 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 4 4 4 4 0 0 0 0 0 0 0 0 0 0 0 4 4 4 0 4 4 0 0 0 0 0 127 0 0 0 -0 0 89 225 21 0 0 0 0 0 0 0 0 0 7 199 34 59 215 21 0 0 0 59 245 255 255 -201 0 0 0 138 255 255 201 12 228 34 175 166 0 138 201 0 12 235 125 89 255 -125 59 241 89 0 0 0 59 238 34 0 0 0 0 0 138 201 0 0 0 172 89 0 0 0 7 206 -255 255 255 255 255 255 247 34 0 0 0 0 89 255 255 255 166 0 0 0 0 0 59 -238 34 0 138 247 34 0 0 89 247 34 0 0 0 175 201 0 0 0 0 0 0 59 245 166 -0 0 0 0 0 0 12 235 166 0 138 201 0 0 59 241 89 0 0 0 0 0 12 235 201 0 138 -251 89 0 0 175 225 21 0 0 89 247 34 0 0 7 206 166 0 175 255 166 0 0 89 -255 255 255 223 247 34 0 0 0 0 0 0 0 0 0 0 175 247 34 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 7 206 225 21 0 0 175 225 21 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 4 4 4 4 0 0 0 0 0 0 0 0 0 0 0 4 4 4 0 4 4 0 0 0 -0 0 127 0 0 0 0 0 59 215 21 0 0 0 0 0 0 0 12 235 255 255 255 255 255 255 -166 0 0 0 0 138 125 175 225 21 0 0 0 0 0 138 166 7 206 125 0 89 247 34 -138 225 21 0 89 255 166 215 21 0 0 0 59 238 34 0 0 0 0 0 138 201 0 0 0 -0 0 0 0 0 0 0 0 0 138 166 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 138 201 0 -0 89 247 34 0 0 89 247 34 0 0 0 175 201 0 0 0 0 0 12 235 201 0 0 0 0 0 -0 0 0 138 225 21 175 255 255 255 255 255 255 125 0 0 0 0 0 138 247 34 89 -247 34 0 0 59 241 89 0 7 206 166 0 0 0 138 247 34 0 0 138 247 34 0 0 0 -0 0 138 225 21 0 0 0 0 0 0 0 0 0 0 0 89 255 255 166 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 59 245 255 201 0 0 0 0 175 201 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 4 4 4 4 0 0 0 0 0 0 0 0 0 0 0 4 4 4 0 4 4 0 0 0 0 0 -127 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 89 166 0 175 125 0 0 0 0 0 0 138 -125 89 247 34 0 0 0 0 12 228 34 7 206 125 0 89 247 34 138 247 34 0 0 89 -255 166 0 0 0 0 59 238 34 0 0 0 0 0 175 166 0 0 0 0 0 0 0 0 0 0 0 0 138 -166 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 7 206 125 0 0 59 241 89 0 0 138 225 -21 0 0 0 175 201 0 0 0 0 12 235 201 0 0 0 0 0 0 0 0 0 138 225 21 0 0 0 -0 59 241 89 0 0 0 0 0 0 138 225 21 59 241 89 0 0 59 241 89 0 89 247 34 -0 0 0 138 247 34 0 0 89 251 89 0 0 0 0 7 206 166 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 12 235 255 225 21 0 0 175 255 255 255 255 255 255 225 21 0 0 175 -255 251 89 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -4 4 4 4 0 0 0 0 0 0 0 0 0 0 0 4 4 4 0 4 4 0 0 0 0 0 127 0 0 0 0 0 89 247 -34 0 0 0 0 0 0 0 0 0 175 125 7 199 34 0 0 0 89 201 0 138 125 175 201 0 -0 0 0 0 138 166 0 0 175 166 0 138 201 0 89 255 166 0 0 89 255 255 125 0 -0 0 12 235 125 0 0 0 0 7 206 125 0 0 0 0 0 0 0 0 0 0 0 0 138 166 0 0 0 -0 0 138 255 125 0 0 0 0 0 0 175 247 34 59 238 34 0 0 0 175 201 0 12 235 -125 0 0 0 0 175 201 0 0 0 12 235 166 0 0 0 0 0 89 166 0 0 59 245 166 0 -0 0 0 0 59 241 89 0 59 215 21 0 12 235 166 0 7 206 201 0 0 175 225 21 7 -206 166 0 0 0 0 59 245 166 0 7 206 225 21 0 0 0 0 175 225 21 0 89 255 125 -0 0 12 235 201 0 0 0 0 0 0 0 0 138 225 21 0 0 0 0 0 0 0 0 0 0 0 138 201 -0 0 0 0 0 0 0 0 0 175 225 21 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -4 4 4 4 0 0 0 0 0 0 0 0 0 0 0 4 4 4 0 4 4 0 0 0 0 0 127 0 0 0 0 0 89 247 -34 0 0 0 0 0 0 0 0 7 199 34 59 215 21 0 0 0 12 235 255 255 255 201 0 0 -0 0 0 59 215 21 0 0 12 235 255 251 89 0 0 89 255 255 255 201 0 89 255 0 -0 0 0 175 201 0 0 0 0 59 238 34 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 175 -201 0 0 0 0 0 0 0 175 247 34 138 201 0 0 0 0 0 138 255 251 89 0 0 0 138 -255 255 255 255 166 0 89 255 255 255 255 255 247 34 12 235 255 255 255 -166 0 0 0 0 0 0 59 241 89 0 12 235 255 255 255 166 0 0 0 7 206 255 255 -225 21 0 138 247 34 0 0 0 0 0 59 245 255 255 201 0 0 0 175 255 255 201 -0 0 0 89 255 125 0 0 89 251 89 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 175 225 21 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 4 4 4 4 4 4 4 4 52 4 4 4 4 4 4 4 4 4 0 4 4 0 0 0 0 0 127 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 138 125 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 89 247 34 0 0 0 175 201 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 12 232 89 0 0 0 0 0 0 0 0 0 0 175 125 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 175 201 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 0 4 4 0 0 0 0 0 127 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 138 125 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 7 206 201 0 0 89 251 89 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 89 201 0 0 0 0 0 0 0 0 0 0 12 232 89 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 12 232 89 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 0 4 4 0 0 0 0 0 127 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 201 0 0 201 201 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 4 4 -4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 0 0 0 0 0 0 127 127 127 0 127 127 127 -127 0 127 127 127 127 127 0 127 127 127 127 127 127 127 127 127 0 127 127 -127 127 127 127 127 0 127 127 127 127 127 127 127 127 127 127 127 127 127 -0 127 127 127 127 127 127 127 127 0 127 127 0 127 127 127 127 0 127 127 -127 127 0 127 127 127 127 127 127 127 0 127 127 127 127 127 127 127 127 -127 0 127 127 127 0 127 127 127 127 0 127 127 127 0 127 127 127 127 0 127 -127 127 127 127 127 127 127 0 127 127 127 127 127 127 0 127 127 127 127 -127 127 127 0 127 127 127 127 127 127 127 0 127 127 127 127 127 127 127 -0 127 127 127 127 127 127 127 0 127 127 127 127 127 127 127 0 127 127 127 -127 127 127 0 127 127 127 127 127 127 127 0 127 127 127 127 127 127 127 -0 127 127 127 0 127 127 127 127 127 0 127 127 127 127 127 127 127 127 127 -0 127 127 127 127 127 127 127 127 0 127 127 127 127 127 127 127 127 127 -0 127 127 127 127 127 127 127 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 4 -4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 0 0 0 0 0 127 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 127 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 127 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 7 206 255 255 -201 0 138 201 0 0 0 0 89 255 255 255 125 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 127 0 0 0 0 175 255 255 255 247 34 0 0 0 0 0 7 206 251 89 0 0 12 0 -235 255 255 255 255 201 0 0 0 0 59 245 255 255 255 201 12 0 235 255 255 -255 255 166 0 0 0 12 235 255 255 255 255 255 127 12 235 255 255 255 255 -251 89 0 0 12 235 255 255 255 251 89 12 235 166 0 0 0 12 235 125 89 255 -255 255 201 0 0 175 255 255 225 21 12 235 166 0 0 7 206 251 102 0 235 166 -0 0 0 0 12 235 251 89 0 0 0 89 255 225 21 12 235 251 89 0 0 12 235 125 -0 0 0 138 255 255 166 0 0 0 12 235 255 255 255 251 89 0 0 0 0 175 255 255 -201 0 0 0 12 235 255 255 255 251 89 0 0 0 12 235 255 255 255 247 47 235 -255 255 255 255 255 255 255 138 0 235 125 0 0 0 59 245 133 206 166 0 0 -0 0 59 245 255 133 201 0 0 0 138 251 89 0 0 12 235 133 206 247 34 0 0 0 -175 229 216 225 21 0 0 0 138 247 124 255 255 255 255 255 255 125 7 206 -125 0 0 0 59 238 34 0 0 0 0 0 12 235 125 0 0 0 0 175 247 34 0 0 0 0 0 0 -0 0 0 0 127 0 0 59 245 166 0 0 0 59 245 166 0 0 0 0 59 245 255 166 0 0 -12 0 235 166 0 0 59 245 125 0 0 138 255 125 0 0 7 202 102 0 235 166 0 0 -59 245 225 21 0 12 235 166 0 0 0 0 0 12 235 166 0 0 0 0 0 0 89 255 166 -0 0 0 89 127 12 235 166 0 0 0 12 235 125 0 12 235 125 0 0 0 0 0 138 225 -21 12 235 166 0 7 206 225 21 12 0 235 166 0 0 0 0 12 235 255 166 0 0 7 -206 255 225 21 12 235 255 201 0 0 12 235 125 0 59 245 166 0 0 138 251 89 -0 12 235 166 0 0 138 251 89 0 89 255 125 0 0 89 255 125 0 12 235 166 0 -0 138 251 89 0 12 235 166 0 0 7 202 89 0 0 0 138 225 21 0 0 12 0 235 125 -0 0 0 59 245 125 138 225 21 0 0 0 138 225 151 34 247 34 0 0 175 255 125 -0 0 89 247 34 12 235 166 0 0 89 247 34 59 245 125 0 0 59 245 125 0 0 0 -0 0 138 247 34 7 206 125 0 0 0 7 206 125 0 0 0 0 0 12 235 125 0 0 0 138 -225 187 201 0 0 0 0 0 0 0 0 0 0 127 0 12 232 89 0 0 0 0 0 12 232 89 0 0 -0 138 225 151 225 21 0 12 0 235 166 0 0 12 235 166 0 12 235 166 0 0 0 0 -0 12 0 235 166 0 0 0 12 235 166 0 12 235 166 0 0 0 0 0 12 235 166 0 0 0 -0 0 12 235 166 0 0 0 0 0 0 12 235 166 0 0 0 12 235 125 0 12 235 125 0 0 -0 0 0 138 225 21 12 235 166 0 175 225 21 0 12 0 235 166 0 0 0 0 12 235 -166 238 34 0 59 215 187 225 21 12 235 166 245 125 0 12 235 125 12 235 125 -0 0 0 0 138 247 34 12 235 166 0 0 12 235 166 12 235 125 0 0 0 0 138 247 -34 12 235 166 0 0 12 235 166 0 89 247 34 0 0 0 0 0 0 0 0 138 225 21 0 0 -12 0 235 125 0 0 0 59 245 125 59 241 89 0 0 7 206 166 59 0 241 89 0 12 -232 194 201 0 0 138 225 21 0 89 251 89 12 235 166 0 0 138 247 34 7 206 -201 0 0 0 0 0 59 245 125 0 7 206 125 0 0 0 0 138 201 0 0 0 0 0 12 235 125 -0 0 59 241 89 12 235 166 0 0 0 0 0 0 0 0 0 127 0 175 166 0 59 245 255 255 -247 34 138 201 0 0 7 206 166 59 241 89 0 12 0 235 166 0 0 89 251 89 0 89 -247 34 0 0 0 0 0 12 0 235 166 0 0 0 0 138 225 21 12 235 166 0 0 0 0 0 12 -235 166 0 0 0 0 0 89 247 34 0 0 0 0 0 0 12 235 166 0 0 0 12 235 125 0 12 -235 125 0 0 0 0 0 138 225 21 12 235 166 175 247 34 0 0 12 0 235 166 0 0 -0 0 12 235 133 206 166 0 175 166 175 225 21 12 235 125 138 225 21 12 235 -125 89 247 34 0 0 0 0 59 245 125 12 235 166 0 0 12 235 166 89 247 34 0 -0 0 0 59 245 125 12 235 166 0 0 12 235 125 0 89 255 125 0 0 0 0 0 0 0 0 -138 225 21 0 0 12 0 235 125 0 0 0 59 245 125 7 206 201 0 0 59 241 89 7 -0 206 166 0 59 215 111 225 21 7 206 166 0 0 0 175 225 187 225 21 0 0 12 -235 166 89 247 34 0 0 0 0 7 206 201 0 0 7 206 125 0 0 0 0 89 225 21 0 0 -0 0 12 235 125 0 12 235 166 0 0 59 241 89 0 0 0 0 0 0 0 0 127 0 202 89 -12 235 125 0 12 228 34 59 215 0 0 59 241 89 7 206 166 0 12 0 235 255 255 -255 255 166 0 0 138 225 21 0 0 0 0 0 12 0 235 166 0 0 0 0 89 247 34 12 -235 255 255 255 255 247 34 12 235 255 255 255 255 247 0 163 225 21 0 0 -0 0 0 0 12 235 255 255 255 255 255 255 125 0 12 235 125 0 0 0 0 0 138 225 -21 12 235 255 247 34 0 0 0 12 0 235 166 0 0 0 0 12 235 125 89 225 34 228 -34 175 225 21 12 235 125 12 235 125 12 235 125 138 225 21 0 0 0 0 12 235 -166 12 235 166 0 0 175 247 34 138 225 21 0 0 0 0 12 235 166 12 235 166 -0 0 175 225 21 0 0 175 255 255 225 21 0 0 0 0 0 138 225 21 0 0 12 0 235 -125 0 0 0 59 245 125 0 138 247 34 0 138 225 21 0 0 175 201 0 138 201 12 -232 89 12 235 125 0 0 0 12 235 251 89 0 0 0 0 89 255 255 125 0 0 0 0 0 -138 247 34 0 0 7 206 125 0 0 0 0 12 232 89 0 0 0 0 12 235 125 7 206 201 -0 0 0 0 138 251 89 0 0 0 0 0 0 0 127 7 228 34 89 225 21 0 12 228 34 12 -228 0 0 138 225 21 0 138 225 21 12 0 235 166 0 0 12 235 201 0 138 225 21 -0 0 0 0 0 12 0 235 166 0 0 0 0 89 247 34 12 235 166 0 0 0 0 0 12 235 166 -0 0 0 0 0 138 225 21 0 12 235 255 255 127 12 235 166 0 0 0 12 235 125 0 -12 235 125 0 0 0 0 0 138 225 21 12 235 229 216 225 21 0 0 12 0 235 166 -0 0 0 0 12 235 125 12 235 223 201 0 175 225 21 12 235 125 0 138 225 34 -235 125 138 225 21 0 0 0 0 12 235 166 12 235 255 255 255 247 34 0 138 225 -21 0 0 0 0 12 235 166 12 235 255 255 255 166 0 0 0 0 0 0 89 255 255 247 -34 0 0 0 138 225 21 0 0 12 0 235 125 0 0 0 59 245 125 0 59 245 125 7 206 -166 0 0 0 89 247 34 175 125 7 206 125 89 247 34 0 0 0 12 235 251 89 0 0 -0 0 7 206 225 21 0 0 0 0 59 245 125 0 0 0 7 206 125 0 0 0 0 0 175 166 0 -0 0 0 12 235 125 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 127 12 228 34 89 225 -21 0 12 228 34 59 215 0 7 206 255 255 255 255 251 89 12 0 235 166 0 0 0 -138 247 0 124 247 34 0 0 0 0 0 12 0 235 166 0 0 0 0 138 225 21 12 235 166 -0 0 0 0 0 12 235 166 0 0 0 0 0 89 247 34 0 0 0 0 175 127 12 235 166 0 0 -0 12 235 125 0 12 235 125 0 0 0 0 0 138 225 21 12 235 166 59 245 201 0 -0 12 0 235 166 0 0 0 0 12 235 125 0 138 251 89 0 175 225 21 12 235 125 -0 12 235 138 235 125 89 247 34 0 0 0 0 59 245 125 12 235 166 0 0 0 0 0 -89 247 34 0 0 0 0 59 245 125 12 235 166 0 175 247 34 0 0 0 0 0 0 0 59 245 -166 0 0 0 138 225 21 0 0 12 0 235 125 0 0 0 59 241 89 0 7 206 201 59 241 -89 0 0 0 59 241 102 232 89 0 138 201 138 225 21 0 0 0 175 201 175 225 21 -0 0 0 0 175 225 21 0 0 0 7 206 201 0 0 0 0 7 206 125 0 0 0 0 0 89 225 21 -0 0 0 12 235 125 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 127 12 232 89 59 241 -89 0 89 247 34 89 201 0 59 241 89 0 0 7 206 166 12 0 235 166 0 0 0 138 -225 0 81 245 166 0 0 0 0 0 12 0 235 166 0 0 0 12 235 166 0 12 235 166 0 -0 0 0 0 12 235 166 0 0 0 0 0 12 235 166 0 0 0 0 175 127 12 235 166 0 0 -0 12 235 125 0 12 235 125 0 0 0 0 0 138 225 21 12 235 166 0 89 255 166 -0 12 0 235 166 0 0 0 0 12 235 125 0 12 182 0 0 175 225 21 12 235 125 0 -0 138 232 245 125 12 235 125 0 0 0 0 138 247 34 12 235 166 0 0 0 0 0 12 -235 125 0 0 0 0 138 247 34 12 235 166 0 7 206 225 21 0 0 0 0 0 0 12 235 -166 0 0 0 138 225 21 0 0 12 0 235 166 0 0 0 89 251 89 0 0 138 247 163 225 -21 0 0 0 7 206 200 215 21 0 89 225 187 166 0 0 0 89 251 89 12 235 166 0 -0 0 0 175 225 21 0 0 0 138 247 34 0 0 0 0 7 206 125 0 0 0 0 0 12 232 89 -0 0 0 12 235 125 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 127 12 175 166 0 89 -255 255 210 235 255 255 125 0 138 225 21 0 0 0 138 247 47 0 235 166 0 0 -59 245 166 0 0 138 255 125 0 0 7 202 102 0 235 166 0 0 12 235 225 21 0 -12 235 166 0 0 0 0 0 12 235 166 0 0 0 0 0 0 138 255 125 0 0 0 175 127 12 -235 166 0 0 0 12 235 125 0 12 235 125 0 0 0 0 7 206 201 0 12 235 166 0 -0 138 255 125 12 0 235 166 0 0 0 12 0 235 125 0 0 0 0 0 175 225 21 12 235 -125 0 0 12 235 255 125 0 89 255 125 0 0 89 251 89 0 12 235 166 0 0 0 0 -0 0 89 255 125 0 0 89 255 125 0 12 235 166 0 0 12 235 201 0 138 166 0 0 -0 138 251 89 0 0 0 138 225 21 0 0 0 0 138 247 34 0 7 206 225 21 0 0 12 -235 255 166 0 0 0 0 0 175 255 201 0 0 12 235 255 125 0 0 12 235 166 0 0 -138 251 89 0 0 0 175 225 21 0 0 89 251 89 0 0 0 0 0 7 206 125 0 0 0 0 0 -0 175 166 0 0 0 12 235 125 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 127 0 59 241 -89 0 0 0 0 0 0 0 0 7 206 166 0 0 0 0 59 245 138 0 235 255 255 255 255 125 -0 0 0 0 59 245 255 255 255 201 12 0 235 255 255 255 255 166 0 0 0 12 235 -255 255 255 255 255 127 12 235 166 0 0 0 0 0 0 0 59 245 255 255 255 225 -21 12 235 166 0 0 0 12 235 125 89 255 255 255 210 127 235 255 255 225 21 -0 12 235 166 0 0 0 175 255 127 0 235 255 255 255 247 47 0 235 125 0 0 0 -0 0 175 225 21 12 235 125 0 0 0 138 255 125 0 0 0 175 255 255 201 0 0 0 -12 235 166 0 0 0 0 0 0 0 0 175 255 255 201 0 0 0 12 235 166 0 0 0 89 255 -225 34 235 255 255 255 247 34 0 0 0 0 138 225 21 0 0 0 0 0 138 255 255 -255 201 0 0 0 0 0 175 251 89 0 0 0 0 0 89 255 166 0 0 7 206 247 34 0 7 -206 225 21 0 0 7 206 225 21 0 0 175 225 21 0 0 138 255 255 255 255 255 -255 166 7 206 125 0 0 0 0 0 0 138 201 0 0 0 12 235 125 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 127 0 0 89 255 125 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 175 201 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 7 206 125 0 0 0 0 0 0 59 238 34 0 0 12 235 125 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 127 0 0 0 7 206 255 255 255 225 21 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 89 251 89 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 7 206 125 0 0 0 0 0 0 7 206 125 0 0 12 235 125 0 0 0 -0 0 0 0 0 0 0 245 255 255 255 255 255 255 127 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 138 -255 255 166 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 7 206 255 255 201 0 0 0 0 0 0 89 89 255 255 -255 125 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 127 127 127 127 127 127 127 -127 127 127 127 127 0 127 127 127 127 127 127 127 127 0 127 127 127 127 -127 127 127 127 0 127 127 127 127 127 127 127 127 0 127 127 127 127 127 -127 127 127 127 0 127 127 127 127 127 127 127 0 127 127 127 127 127 127 -127 0 127 127 127 127 127 127 127 127 0 127 127 127 127 127 127 127 127 -0 127 127 127 127 0 127 127 127 127 127 127 0 127 127 127 127 127 127 127 -127 0 127 127 127 127 127 127 0 127 127 127 127 127 127 127 127 127 127 -0 127 127 127 127 127 127 127 127 0 127 127 127 127 127 127 127 127 127 -0 127 127 127 127 127 127 127 0 127 127 127 127 127 127 127 127 127 0 127 -127 127 127 127 127 127 127 0 127 127 127 127 127 127 127 0 127 127 127 -127 127 127 127 127 0 127 127 127 127 127 127 127 127 0 127 127 127 127 -127 127 127 127 0 127 127 127 127 127 127 127 127 127 127 127 127 0 127 -127 127 127 127 127 127 0 127 127 127 127 127 127 127 0 127 127 127 127 -127 127 127 0 127 127 127 127 127 0 127 127 127 127 127 0 127 127 127 127 -127 0 127 127 127 127 127 127 127 127 0 127 127 127 127 127 127 0 127 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 127 0 59 245 166 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 127 0 0 89 247 34 0 0 0 0 0 0 0 0 0 0 12 235 -125 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 138 225 21 0 0 0 0 0 0 0 0 0 12 235 -255 247 0 0 0 0 0 0 0 12 12 235 125 0 0 0 0 0 0 0 0 0 0 0 0 12 235 125 -0 0 0 0 0 12 235 125 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 138 255 251 89 0 7 206 125 0 89 255 251 89 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 4 4 4 4 4 4 4 4 4 84 84 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 127 0 0 7 206 -125 0 0 0 0 0 0 0 0 0 0 12 235 125 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 138 -225 21 0 0 0 0 0 0 0 0 0 175 201 0 0 0 0 0 0 0 0 0 12 12 235 125 0 0 0 -0 0 59 245 102 0 89 247 34 12 235 125 0 0 0 0 0 12 235 125 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 12 235 125 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -59 241 89 0 0 0 7 206 125 0 0 0 138 225 21 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -4 4 4 4 4 4 4 4 100 252 252 84 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 127 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 12 -235 125 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 138 225 21 0 0 0 0 0 0 0 12 0 -235 125 0 0 0 0 0 0 0 0 0 0 12 235 125 0 0 0 0 0 0 0 0 0 0 0 0 12 235 125 -0 0 0 0 0 12 235 125 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 12 235 -125 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 89 247 34 0 0 0 7 206 125 0 0 0 59 238 -34 0 0 0 0 0 0 0 0 0 0 0 0 0 0 4 4 4 4 4 4 4 20 236 252 164 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 127 0 -0 0 0 0 0 0 0 12 235 255 255 255 166 0 12 235 166 245 255 247 34 0 0 12 -235 255 255 247 34 0 34 235 255 255 255 225 21 0 12 235 255 255 225 29 -0 206 255 255 255 127 0 12 235 255 255 255 225 21 12 235 138 235 255 247 -34 0 12 235 102 175 255 247 34 12 235 125 0 59 245 201 0 12 235 125 12 -0 235 166 245 255 225 29 206 255 251 89 0 12 235 138 235 255 247 34 0 0 -12 235 255 255 201 0 0 12 235 166 245 255 251 89 0 0 12 235 255 255 255 -225 21 12 235 138 235 247 127 34 138 255 255 255 206 0 206 255 255 255 -201 59 241 89 0 0 89 247 42 206 201 0 0 0 138 225 187 201 0 0 138 225 21 -0 59 241 187 226 247 34 0 7 206 206 206 201 0 0 0 138 225 151 255 255 255 -255 247 0 0 89 247 34 0 0 0 7 206 125 0 0 0 59 238 34 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 4 4 4 4 4 4 4 148 252 236 20 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 127 0 0 0 0 0 0 0 0 12 206 -21 0 59 245 125 12 235 247 34 0 138 225 21 12 235 166 0 0 134 102 0 235 -166 0 0 138 225 21 12 235 125 0 0 175 201 12 0 235 125 0 0 12 235 166 0 -0 138 225 21 12 235 247 34 0 175 201 0 12 235 102 0 89 247 34 12 235 125 -12 235 166 0 0 12 235 125 12 0 235 225 21 12 235 251 89 0 175 201 0 12 -235 247 34 0 175 201 0 12 235 166 0 7 206 201 0 12 235 225 21 0 175 225 -21 12 235 166 0 0 138 225 21 12 235 247 34 0 0 89 247 34 0 12 206 34 0 -235 125 0 0 59 241 89 0 0 89 247 34 89 247 34 0 7 206 166 138 225 21 7 -206 251 89 0 89 225 138 34 235 201 0 138 225 21 89 247 34 0 7 206 166 0 -0 0 7 206 166 0 0 89 225 21 0 0 0 7 206 125 0 0 0 59 241 89 0 0 0 0 138 -251 89 0 0 7 202 89 0 0 4 4 4 4 4 4 52 252 252 108 4 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 127 0 0 0 0 -0 0 0 0 0 0 0 0 7 206 102 12 235 125 0 0 59 241 89 138 225 21 0 0 0 34 -89 225 21 0 0 138 225 21 89 225 21 0 0 89 247 47 0 235 125 0 0 89 225 21 -0 0 138 225 21 12 235 125 0 0 89 247 34 12 235 102 0 89 247 34 12 235 138 -235 166 0 0 0 12 235 125 12 0 235 125 0 7 206 166 0 0 138 225 21 12 235 -125 0 0 89 247 34 138 225 21 0 0 59 238 34 12 235 125 0 0 59 241 89 89 -225 21 0 0 138 225 21 12 235 125 0 0 0 138 225 21 0 0 0 12 0 235 125 0 -0 59 241 89 0 0 89 247 34 12 235 125 0 59 241 89 59 238 34 12 228 198 166 -0 175 166 59 0 89 251 132 241 89 0 12 235 125 0 59 238 34 0 0 0 138 225 -21 0 12 235 166 0 0 0 0 7 206 125 0 0 0 0 175 201 0 0 0 138 166 12 235 -166 0 12 232 89 0 0 12 84 4 4 4 4 204 252 204 4 4 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 127 0 0 0 0 0 0 -0 0 0 59 245 255 255 255 102 12 235 125 0 0 12 235 125 175 201 0 0 0 0 -0 175 201 0 0 0 138 225 21 175 255 255 255 255 255 247 47 0 235 125 0 0 -175 201 0 0 0 138 225 21 12 235 125 0 0 89 247 34 12 235 102 0 89 247 34 -12 235 255 225 21 0 0 0 12 235 125 12 0 235 125 0 7 206 166 0 0 138 225 -21 12 235 125 0 0 89 247 34 175 201 0 0 0 12 232 89 12 235 125 0 0 12 235 -125 175 201 0 0 0 138 225 21 12 235 125 0 0 0 59 245 255 247 34 0 12 0 -235 125 0 0 59 241 89 0 0 89 247 34 0 175 201 0 138 201 0 12 235 125 89 -201 89 225 29 206 125 12 0 0 175 255 166 0 0 0 175 201 0 138 201 0 0 0 -89 251 89 0 138 247 34 0 0 0 0 0 7 206 125 0 0 0 0 0 89 255 125 7 202 89 -0 89 251 89 89 201 0 0 0 172 252 84 4 4 100 252 252 60 4 4 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 127 0 -0 0 0 0 0 0 0 89 255 166 0 7 206 102 12 235 125 0 0 12 235 125 175 201 -0 0 0 0 0 175 201 0 0 0 138 225 21 175 201 0 0 0 0 0 12 0 235 125 0 0 175 -201 0 0 0 138 225 21 12 235 125 0 0 89 247 34 12 235 102 0 89 247 34 12 -235 138 235 201 0 0 0 12 235 125 12 0 235 125 0 7 206 166 0 0 138 225 21 -12 235 125 0 0 89 247 34 175 201 0 0 0 12 232 89 12 235 125 0 0 12 235 -125 175 201 0 0 0 138 225 21 12 235 125 0 0 0 0 0 138 255 255 201 12 0 -235 125 0 0 59 241 89 0 0 89 247 34 0 89 247 42 206 125 0 0 175 166 175 -125 12 232 102 232 89 0 0 0 175 255 201 0 0 0 89 247 47 235 125 0 0 12 -235 166 0 0 0 12 235 125 0 0 0 0 7 206 125 0 0 0 0 138 201 0 0 12 232 89 -0 0 59 245 225 21 0 0 0 196 252 244 60 20 236 252 156 4 4 4 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 127 0 -0 0 0 0 0 0 0 175 201 0 0 7 206 102 12 235 125 0 0 59 241 89 138 225 21 -0 0 0 34 89 225 21 0 0 138 225 21 138 247 34 0 0 0 0 12 0 235 125 0 0 138 -225 21 0 0 138 225 21 12 235 125 0 0 89 247 34 12 235 102 0 89 247 34 12 -235 125 59 245 125 0 0 12 235 125 12 0 235 125 0 7 206 166 0 0 138 225 -21 12 235 125 0 0 89 247 34 138 225 21 0 0 89 247 34 12 235 125 0 0 59 -241 89 138 225 21 0 0 138 225 21 12 235 125 0 0 0 0 0 0 0 89 247 47 0 235 -125 0 0 59 241 89 0 0 89 247 34 0 12 235 166 238 34 0 0 138 210 228 34 -0 175 166 215 21 0 0 89 251 159 251 89 0 0 12 235 191 247 34 0 0 175 225 -21 0 0 0 0 138 225 21 0 0 0 7 206 125 0 0 0 12 232 89 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 20 220 252 236 180 252 244 28 4 4 4 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 127 0 0 0 0 0 0 0 0 -138 225 21 0 138 255 102 12 235 125 0 7 206 201 0 12 235 166 0 0 134 132 -0 245 125 0 59 245 225 21 12 235 201 0 0 12 206 34 0 235 125 0 0 59 245 -125 0 12 235 225 21 12 235 125 0 0 89 247 34 12 235 102 0 89 247 34 12 -235 125 0 138 251 89 0 12 235 125 12 0 235 125 0 7 206 166 0 0 138 225 -21 12 235 125 0 0 89 247 34 12 235 166 0 7 206 201 0 12 235 125 0 7 206 -201 0 59 245 125 0 12 235 225 21 12 235 125 0 0 0 138 125 0 0 138 225 29 -0 206 166 0 0 7 206 166 0 59 245 247 34 0 0 175 255 201 0 0 0 59 245 225 -21 0 89 255 201 0 0 12 235 166 0 175 225 21 0 0 138 255 166 0 0 89 251 -89 0 0 0 0 0 89 247 34 0 0 0 7 206 125 0 0 0 59 238 34 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 4 36 236 252 252 252 108 4 4 4 4 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 127 0 0 0 0 0 0 0 0 -7 206 255 255 171 206 102 12 232 226 255 255 225 21 0 0 12 235 255 255 -247 34 0 89 255 255 247 163 225 21 0 7 206 255 255 247 34 12 0 235 125 -0 0 0 89 255 255 247 163 225 21 12 235 125 0 0 89 247 34 12 235 102 0 89 -247 34 12 235 125 0 0 175 251 34 0 235 125 12 0 235 125 0 7 206 166 0 0 -138 225 21 12 235 125 0 0 89 247 34 0 12 235 255 255 201 0 0 12 235 255 -255 255 225 21 0 0 89 255 255 247 163 225 21 12 235 125 0 0 0 89 255 255 -255 247 34 0 0 89 255 255 127 0 59 245 255 225 111 247 34 0 0 59 245 125 -0 0 0 12 235 166 0 0 59 245 125 7 0 206 225 21 0 12 235 201 0 0 59 241 -89 0 0 175 255 255 255 255 247 0 0 89 247 34 0 0 0 7 206 125 0 0 0 59 238 -34 0 0 0 0 0 0 0 0 0 0 0 0 0 0 4 4 60 252 252 204 4 4 4 4 4 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 127 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 138 201 0 0 0 0 0 0 0 0 0 0 0 0 0 -89 247 34 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 12 235 125 0 0 0 0 0 0 0 0 0 0 138 225 21 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 138 225 21 0 0 0 0 0 0 0 0 0 0 89 247 34 0 0 0 7 -206 125 0 0 0 59 238 34 0 0 0 0 0 0 0 0 0 0 0 0 0 0 4 4 4 76 252 60 4 4 -4 4 4 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 127 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 7 199 34 0 12 232 89 0 0 -0 0 0 0 0 0 0 0 0 0 0 138 225 21 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 12 235 125 0 0 0 0 0 0 0 0 0 -0 138 225 21 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 7 206 166 0 0 0 0 0 0 0 0 -0 0 0 12 235 125 0 0 0 7 206 125 0 0 0 138 225 21 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 76 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 127 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -12 235 255 247 34 0 0 0 0 0 0 0 0 0 0 0 0 0 255 251 89 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 12 235 -125 0 0 0 0 0 0 0 0 0 0 138 225 21 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 89 -247 34 0 0 0 0 0 0 0 0 0 0 0 0 89 255 251 89 0 7 206 125 0 89 255 247 34 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 127 127 127 -127 127 127 127 0 127 127 127 127 127 127 0 127 127 127 127 127 127 127 -0 127 127 127 127 127 127 0 127 127 127 127 127 127 127 0 127 127 127 127 -127 127 127 0 127 127 127 127 0 127 127 127 127 127 127 127 0 127 127 127 -127 127 127 127 0 127 127 0 127 127 127 0 127 127 127 127 127 127 127 0 -127 127 127 0 127 127 127 127 127 127 127 127 127 127 127 0 127 127 127 -127 127 127 127 0 127 127 127 127 127 127 127 0 127 127 127 127 127 127 -127 0 127 127 127 127 127 127 127 0 127 127 127 127 127 0 127 127 127 127 -127 127 0 127 127 127 127 0 127 127 127 127 127 127 127 0 127 127 127 127 -127 127 0 127 127 127 127 127 127 127 127 127 127 0 127 127 127 127 127 -127 0 127 127 127 127 127 127 0 127 127 127 127 127 0 127 127 127 127 127 -127 127 0 127 127 127 0 127 127 127 127 127 127 0 127 127 127 127 127 127 -127 127 127 127 0 127 127 127 127 127 127 127 127 127 127 127 127 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -127 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 7 206 125 0 175 166 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 206 125 0 175 166 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 127 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 59 245 225 21 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 7 206 255 125 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 7 206 255 125 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 175 166 0 138 201 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 175 166 0 138 201 0 7 206 166 12 235 -125 0 0 0 0 0 0 127 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 175 125 0 0 0 0 0 175 125 -0 0 0 0 0 175 171 206 125 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 89 255 125 0 -31 206 130 255 166 175 247 34 0 0 89 255 125 175 247 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 59 245 247 34 138 166 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 59 241 132 238 34 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 59 241 132 238 34 0 0 0 0 0 0 0 0 0 0 0 0 0 127 0 0 -59 245 255 255 255 125 0 12 235 255 255 255 255 255 225 21 0 0 0 0 0 0 -0 0 175 255 255 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 175 125 0 0 0 -0 0 175 125 0 0 0 0 89 225 21 59 238 34 0 0 138 255 255 201 0 0 0 59 215 -21 0 0 0 0 0 0 0 0 0 12 235 255 255 255 247 34 0 0 0 0 0 0 0 12 235 255 -255 255 255 255 255 255 255 251 89 0 12 235 255 255 255 255 255 225 21 -0 89 255 255 255 255 255 255 125 0 12 235 255 255 255 255 255 225 21 0 -0 12 235 255 255 255 255 255 225 21 7 206 201 0 50 206 56 255 201 12 235 -125 0 0 138 225 29 206 166 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 7 202 89 89 255 225 21 0 89 255 255 255 225 81 245 201 0 138 251 -89 0 0 138 255 166 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 12 235 255 255 -255 255 255 225 21 0 0 0 138 255 166 7 206 225 21 0 0 0 138 247 34 0 0 -0 0 127 0 89 255 125 0 0 0 0 0 12 146 0 0 0 0 0 144 21 0 0 0 0 0 0 0 89 -247 34 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 175 125 0 0 0 0 0 175 -125 0 0 0 0 0 0 0 0 0 0 0 59 241 89 12 235 125 0 0 172 89 0 0 0 0 0 0 0 -0 0 12 235 166 0 0 7 202 89 0 0 0 0 0 0 89 255 201 0 0 12 235 125 0 0 0 -0 0 0 12 146 0 0 0 0 0 144 21 0 0 0 0 0 0 138 247 34 0 12 146 0 0 0 0 0 -144 21 0 0 12 146 0 0 0 0 0 144 21 0 89 225 21 71 157 22 191 225 21 175 -201 0 7 206 125 59 238 34 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 175 125 0 59 196 199 47 206 184 89 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 12 146 0 0 0 0 0 144 21 0 0 0 0 -0 0 0 59 245 125 0 0 59 245 125 0 0 0 0 0 127 12 235 166 0 0 0 0 0 0 12 -146 0 0 0 0 0 144 21 0 0 0 0 0 0 0 175 201 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 12 235 255 255 255 255 127 34 235 255 255 255 255 225 21 0 -0 0 0 0 0 0 0 89 247 34 7 206 166 0 89 201 0 0 0 0 0 0 0 0 0 0 89 247 34 -0 0 0 0 0 0 0 0 59 115 12 235 166 0 0 0 12 235 125 0 0 0 0 0 0 12 146 0 -0 0 0 0 144 21 0 0 0 0 0 59 245 125 0 0 12 146 0 0 0 0 0 144 21 0 0 12 -146 0 0 0 0 0 144 21 0 7 202 89 117 104 0 29 202 89 59 215 21 59 215 21 -138 201 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 175 125 0 59 192 89 223 125 172 89 0 138 255 255 255 201 12 182 -0 0 0 0 0 175 255 255 125 0 89 255 255 247 34 0 0 12 146 0 0 0 0 0 144 -21 0 138 255 255 255 255 247 34 138 247 34 7 206 201 0 0 0 0 0 0 127 89 -251 89 0 0 0 0 0 0 12 146 0 0 0 0 0 144 21 0 0 0 0 0 0 7 206 166 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 175 125 0 0 0 0 0 175 125 0 0 0 -0 0 0 0 0 0 0 0 89 247 34 7 206 166 7 202 89 0 0 0 0 0 0 0 0 0 0 89 255 -125 0 0 0 0 0 0 0 89 255 125 89 247 34 0 0 0 12 235 125 0 0 0 0 0 0 12 -146 0 0 0 0 0 144 21 0 0 0 0 7 206 201 0 0 0 12 146 0 0 0 0 0 144 21 0 -0 12 146 0 0 0 0 0 144 21 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 59 245 -255 201 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 175 -125 0 59 192 12 228 34 172 89 89 247 34 0 12 206 29 206 201 0 0 7 206 166 -0 7 206 255 225 21 0 89 247 34 0 12 146 0 0 0 0 0 144 21 0 0 0 0 7 206 -166 0 12 235 166 89 247 34 0 0 0 0 0 0 127 245 255 255 255 255 255 201 -0 0 12 146 0 0 0 0 0 144 21 0 0 0 0 0 59 245 255 255 255 127 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 175 125 0 0 0 0 0 175 125 0 0 0 0 0 0 0 -0 0 0 0 59 241 89 12 235 125 89 201 12 235 255 251 89 0 89 255 255 225 -21 0 175 255 255 225 21 0 0 0 89 251 89 0 138 225 21 0 0 0 12 235 255 255 -255 255 225 21 0 12 146 0 0 0 0 0 144 21 0 0 0 0 138 247 34 0 0 0 12 146 -0 0 0 0 0 144 21 0 0 12 146 0 0 0 0 0 144 21 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 12 235 255 255 255 166 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 175 125 0 59 192 0 0 0 172 89 138 225 21 0 0 0 -0 7 206 225 21 138 225 21 0 0 89 251 89 0 0 12 235 125 0 12 146 0 0 0 0 -0 144 21 0 0 0 0 138 225 21 0 0 89 255 255 125 0 0 0 0 0 0 0 127 138 225 -21 0 0 0 0 0 0 12 146 0 0 0 0 0 144 21 0 0 0 0 0 0 59 241 89 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 175 125 0 0 12 235 255 255 255 255 -225 21 0 0 0 0 0 0 0 0 0 138 255 255 201 12 228 34 175 166 0 138 201 7 -206 125 7 206 166 0 0 0 89 255 255 247 34 59 241 89 0 0 138 225 21 0 0 -0 12 235 125 0 0 0 0 0 0 12 146 0 0 0 0 0 144 21 0 0 0 59 245 125 0 0 0 -0 12 146 0 0 0 0 0 144 21 0 0 12 146 0 0 0 0 0 144 21 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 59 245 255 255 255 207 235 255 255 255 255 255 255 -207 235 255 255 255 255 255 255 255 255 255 255 255 225 21 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 59 245 255 247 34 0 0 0 0 175 166 175 201 0 0 0 -59 245 255 255 255 255 255 125 0 12 146 0 0 0 0 0 144 21 0 0 0 89 251 89 -0 0 0 7 206 225 21 0 0 0 0 0 0 0 127 245 255 255 255 255 255 125 0 0 12 -146 0 0 0 0 0 144 21 0 0 0 0 0 0 59 241 89 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 175 125 0 0 0 0 0 175 125 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 138 166 7 206 125 0 89 247 94 241 89 0 138 201 0 0 0 0 0 59 245 166 -0 89 251 89 0 89 247 34 0 0 0 12 235 125 0 0 0 0 0 0 12 146 0 0 0 0 0 144 -21 0 0 7 206 201 0 0 0 0 0 12 146 0 0 0 0 0 144 21 0 0 12 146 0 0 0 0 0 -144 21 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 12 235 255 255 255 166 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 138 255 255 201 0 7 206 225 21 175 201 0 0 0 59 241 89 0 0 0 0 -0 0 12 146 0 0 0 0 0 144 21 0 0 12 235 166 0 0 0 0 0 175 225 21 0 0 0 0 -0 0 0 127 89 255 125 0 0 0 0 0 0 12 146 0 0 0 0 0 144 21 0 0 0 0 0 0 89 -247 34 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 175 125 0 0 0 0 0 -175 125 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 12 228 34 7 206 125 0 89 247 94 241 -89 0 138 201 0 0 0 0 0 12 235 166 0 0 89 255 125 12 235 166 0 0 0 12 235 -125 0 0 0 0 0 0 12 146 0 0 0 0 0 144 21 0 0 138 247 34 0 0 0 0 0 12 146 -0 0 0 0 0 144 21 0 0 12 146 0 0 0 0 0 144 21 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 59 245 255 201 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 89 247 42 206 201 0 0 89 -225 21 0 0 89 255 125 0 0 0 0 0 0 12 146 0 0 0 0 0 144 21 0 0 175 225 21 -0 0 0 0 0 175 225 21 0 0 0 0 0 0 0 127 0 175 251 89 0 0 0 0 0 12 146 0 -0 0 0 0 144 21 0 59 245 166 0 0 138 225 21 0 0 0 59 245 166 138 251 89 -7 206 201 0 12 235 125 0 59 241 89 0 0 0 175 125 0 0 0 0 0 175 125 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 138 166 0 0 175 166 0 138 201 7 206 125 7 206 -166 138 166 0 0 0 138 251 89 0 0 0 59 115 0 89 255 201 0 0 12 235 125 0 -0 0 0 0 0 12 146 0 0 0 0 0 144 21 0 89 251 89 0 0 0 0 0 0 12 146 0 0 0 -0 0 144 21 0 0 12 146 0 0 0 0 0 144 21 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 138 125 0 0 138 225 34 182 0 0 0 7 206 166 0 -7 206 255 247 34 0 0 175 125 0 12 146 0 0 0 0 0 144 21 0 89 251 89 0 0 -0 0 0 0 175 225 21 0 0 0 0 0 0 0 127 0 0 138 255 255 255 255 125 0 12 235 -255 255 255 255 255 225 21 0 138 247 34 0 7 206 166 0 0 0 0 89 247 34 175 -201 0 7 206 201 0 12 235 125 0 59 241 89 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 59 215 21 0 0 12 235 255 251 89 0 89 255 255 225 -21 12 235 255 255 255 247 34 0 0 0 0 0 0 0 0 12 235 255 255 255 255 255 -255 255 255 251 89 0 12 235 255 255 255 255 255 225 21 0 138 255 255 255 -255 255 255 166 0 12 235 255 255 255 255 255 225 21 0 0 12 235 255 255 -255 255 255 225 21 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 89 255 255 255 247 34 0 0 0 0 0 0 0 175 255 255 125 0 138 255 255 -255 125 0 0 12 235 255 255 255 255 255 225 21 0 175 255 255 255 255 247 -0 0 0 175 225 21 0 0 0 0 0 0 0 127 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 175 166 0 255 255 201 0 0 0 0 0 175 166 12 232 89 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 127 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 12 -228 34 0 0 0 0 0 0 0 0 12 232 89 59 215 21 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 127 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -127 127 127 127 127 127 127 127 0 127 127 127 127 127 127 127 127 0 127 -127 127 0 127 127 127 127 127 127 0 127 127 127 127 127 127 0 127 127 127 -127 127 127 127 127 127 127 127 0 127 127 127 127 127 0 127 127 127 127 -127 127 127 0 127 127 127 127 127 127 127 0 127 127 127 127 127 127 127 -127 127 127 127 127 127 127 127 127 127 127 0 127 127 127 127 127 127 127 -0 127 127 127 127 0 127 127 127 127 127 127 127 127 127 127 127 127 127 -0 127 127 127 127 127 127 127 127 127 127 0 127 127 127 127 127 127 127 -127 0 127 127 127 127 127 127 127 127 127 127 0 127 127 127 127 127 127 -127 127 0 127 127 127 0 127 127 0 127 127 127 127 127 0 127 127 127 127 -127 0 127 127 127 127 127 0 127 127 127 127 127 127 127 0 127 127 127 127 -127 127 127 127 127 127 127 127 0 127 127 127 127 127 127 0 127 127 127 -127 127 127 127 127 127 127 127 0 127 127 127 127 127 0 127 127 127 127 -0 127 127 127 127 127 127 127 127 127 127 127 127 127 0 127 127 127 127 -127 127 127 127 127 0 127 127 127 127 127 0 127 127 127 127 127 127 127 -127 0 0 0 0 0 127 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 127 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 245 255 255 255 255 255 255 225 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 12 235 225 21 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 127 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 7 206 125 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 89 247 34 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 127 0 0 0 0 0 89 247 -34 0 0 0 0 59 192 0 0 0 0 0 7 206 255 255 225 21 0 0 0 0 0 0 0 0 138 247 -34 0 0 89 251 89 0 7 206 125 0 0 7 206 255 255 255 166 0 89 251 89 138 -247 34 0 0 0 0 7 206 255 255 255 247 34 0 0 0 0 175 255 255 251 89 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 7 206 255 255 255 247 -34 0 0 0 0 0 0 0 0 0 0 0 0 89 255 255 247 34 0 0 0 0 0 0 0 0 0 0 0 0 12 -235 255 247 34 0 0 7 206 255 251 89 0 0 7 206 125 0 0 0 0 0 0 0 0 0 0 0 -0 89 255 255 255 255 225 21 0 0 0 0 0 0 0 0 0 0 0 0 0 0 7 202 89 0 0 0 -59 245 255 247 34 0 0 0 0 0 0 0 0 0 0 0 89 201 0 0 0 0 175 166 0 0 0 0 -0 0 89 201 0 0 0 0 175 166 0 0 0 0 0 59 245 255 201 0 0 0 59 241 89 0 0 -0 0 0 59 245 125 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 127 0 0 0 0 0 89 247 34 -0 0 0 0 59 192 0 0 0 0 0 175 201 0 0 144 21 0 0 0 0 0 0 0 0 7 206 166 0 -7 206 166 0 0 7 206 125 0 7 206 201 0 0 89 166 0 0 0 0 0 0 0 0 0 0 89 255 -125 0 0 0 59 245 166 0 0 0 0 0 0 12 206 21 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 89 255 125 0 0 0 59 245 166 0 0 0 0 0 0 0 0 0 0 59 -241 89 0 138 201 0 0 0 0 0 138 166 0 0 0 0 0 168 34 7 206 166 0 0 172 89 -0 175 166 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 89 255 255 255 166 89 225 21 -0 0 0 0 0 0 0 0 0 0 0 0 0 89 255 251 89 0 0 12 235 125 0 138 225 21 0 0 -0 0 0 0 0 0 7 206 255 201 0 0 0 89 225 21 0 0 0 0 7 206 255 201 0 0 0 89 -225 21 0 0 0 0 12 206 21 12 235 125 0 0 175 166 0 0 0 0 0 0 59 245 125 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 127 0 0 0 0 0 0 0 0 0 0 0 175 255 255 255 -166 0 0 12 235 125 0 0 0 0 89 225 21 0 0 12 232 89 0 89 247 34 89 247 34 -0 0 7 206 125 0 12 235 125 0 0 0 0 0 0 0 0 0 0 0 0 0 89 225 21 0 0 0 0 -0 7 206 125 0 0 7 206 255 255 247 34 0 0 0 85 89 0 85 89 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 89 225 21 0 0 0 0 0 7 206 125 0 0 0 0 0 0 0 0 0 89 201 -0 0 12 228 34 0 0 0 0 138 166 0 0 0 0 0 0 0 7 206 125 0 0 7 206 255 166 -0 0 0 0 0 0 0 0 0 12 235 125 0 0 89 247 34 175 255 255 255 166 89 225 21 -0 89 255 125 0 0 0 0 0 0 0 0 0 0 7 202 89 0 0 89 225 21 0 12 232 89 59 -115 0 59 115 0 0 0 0 0 89 201 0 0 7 206 125 0 0 0 0 0 0 0 89 201 0 0 7 -206 125 0 0 0 0 0 0 0 0 12 232 89 0 59 238 34 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 127 0 0 0 0 0 89 225 21 0 0 138 247 94 192 12 182 -0 0 12 235 125 0 0 0 0 0 175 255 255 255 255 166 0 0 7 206 171 206 166 -0 0 0 7 206 125 0 7 206 251 89 0 0 0 0 0 0 0 0 0 0 0 7 202 89 0 59 245 -255 255 201 0 12 228 34 12 235 166 0 12 228 34 0 0 138 251 89 138 247 34 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 7 202 89 0 138 255 255 255 125 0 12 228 34 -0 0 0 0 0 0 0 0 59 241 89 0 138 201 0 0 0 0 0 138 166 0 0 0 0 0 0 0 175 -201 0 0 0 0 0 0 175 201 0 0 0 0 0 0 0 0 12 235 125 0 0 89 247 34 175 255 -255 255 166 89 225 21 0 89 255 125 0 0 0 0 0 0 0 0 0 0 7 202 89 0 0 138 -225 21 0 12 235 125 12 235 166 59 245 166 0 0 0 0 89 201 0 0 89 225 21 -0 0 0 0 0 0 0 89 201 0 0 89 225 21 0 0 0 0 0 0 12 235 255 125 0 0 175 125 -0 0 0 0 0 0 0 12 235 125 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 127 0 0 0 0 0 89 -225 21 0 12 235 125 59 192 0 0 0 0 12 235 125 0 0 0 0 0 59 215 21 59 238 -34 0 0 0 89 255 247 34 0 0 0 7 206 125 0 0 7 206 255 255 247 34 0 0 0 0 -0 0 0 0 59 192 0 12 235 166 0 7 176 21 0 175 125 59 238 34 0 12 228 34 -0 138 247 34 138 247 34 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 59 192 0 0 138 -201 0 89 247 34 0 175 125 0 0 0 0 0 0 0 0 0 89 255 255 225 21 0 7 206 255 -255 255 255 255 255 247 34 0 12 235 125 0 0 0 7 176 21 0 175 201 0 0 0 -0 0 0 0 0 12 235 125 0 0 89 247 34 89 255 255 255 166 89 225 21 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 7 202 89 0 0 89 225 21 0 12 232 89 0 12 235 166 12 -235 166 0 0 0 89 201 0 7 206 125 0 12 235 166 0 0 0 0 89 201 0 7 206 125 -89 255 255 255 125 0 0 0 0 7 206 125 89 225 21 0 138 225 21 0 0 0 138 255 -125 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 127 0 0 0 0 0 89 247 34 0 59 241 89 59 -192 0 0 0 12 235 255 255 255 225 21 0 0 138 166 0 7 202 89 0 0 0 7 206 -166 0 0 0 0 0 0 0 0 7 206 125 0 12 235 201 0 0 0 0 0 0 0 0 89 166 0 89 -247 34 0 0 0 0 0 89 166 12 232 89 0 138 247 34 89 247 34 59 238 34 0 0 -12 235 255 255 255 255 255 255 247 34 89 255 255 255 166 89 166 0 0 138 -201 0 138 225 21 0 89 166 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 138 166 -0 0 0 0 7 206 255 255 255 247 34 0 59 245 255 247 34 0 0 0 0 0 0 0 0 12 -235 125 0 0 89 247 34 0 89 255 255 166 89 225 21 0 0 0 0 0 0 0 0 0 0 0 -0 0 89 255 255 255 166 0 12 235 125 0 138 225 21 0 0 12 235 125 12 235 -125 0 0 89 201 0 89 201 0 7 206 223 166 0 0 0 0 89 201 0 89 201 0 89 125 -0 138 225 21 12 182 0 7 206 133 206 125 0 89 232 215 21 0 7 206 247 34 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 127 0 0 0 0 0 89 247 34 0 59 241 89 59 -192 0 0 0 0 12 235 125 0 0 0 0 0 59 215 21 59 238 34 0 59 245 255 255 255 -255 225 21 0 0 0 0 0 59 241 89 0 0 138 225 21 0 0 0 0 0 0 0 89 166 0 89 -247 34 0 0 0 0 0 89 166 0 138 255 255 176 228 34 0 138 247 34 138 247 34 -0 0 0 0 0 0 0 0 59 238 34 0 0 0 0 0 89 166 0 0 138 255 255 225 21 0 0 89 -166 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 138 166 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 12 235 125 0 0 89 247 34 0 0 0 138 166 89 225 -21 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 59 245 255 247 34 0 0 12 235 -166 12 235 166 0 0 0 0 0 12 232 89 0 175 166 138 166 0 0 0 0 0 0 12 232 -89 0 0 0 0 138 201 0 0 89 255 255 201 89 225 21 89 225 81 215 21 0 138 -247 34 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 127 0 0 0 0 0 89 247 34 0 12 235 -125 59 192 0 0 0 0 59 241 89 0 0 0 0 0 175 255 255 255 255 166 0 0 0 7 -206 166 0 0 0 0 7 206 125 0 12 235 201 0 7 206 166 0 0 0 0 0 0 0 0 59 192 -0 12 235 166 0 7 176 21 0 175 125 0 0 0 0 0 0 0 0 0 138 251 89 138 247 -34 0 0 0 0 0 0 0 59 238 34 0 0 0 0 0 59 192 0 0 138 201 59 245 166 0 0 -175 125 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 138 166 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 12 235 125 0 0 89 247 34 0 0 0 138 166 -89 225 21 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 12 235 166 -59 245 166 0 0 0 0 0 0 138 201 0 138 201 0 138 166 0 0 0 0 0 0 138 201 -0 0 0 0 89 247 34 0 0 0 0 0 7 206 125 59 238 34 59 215 21 0 175 225 21 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 127 0 0 0 0 0 89 247 34 0 0 175 225 81 -192 12 182 0 7 206 125 0 0 0 0 0 89 225 21 0 0 12 232 89 0 0 7 206 166 -0 0 0 0 7 206 125 0 0 59 245 255 255 166 0 0 0 0 0 0 0 0 0 7 202 89 0 59 -245 255 255 166 0 12 228 34 0 0 0 0 0 0 0 0 0 0 85 89 0 85 89 0 0 0 0 0 -0 0 59 238 34 0 0 0 0 0 7 202 89 0 138 201 0 59 245 225 34 228 34 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 7 206 255 255 255 255 255 255 247 34 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 12 235 201 0 0 175 247 34 0 0 0 138 166 -89 225 21 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 59 115 0 -59 115 0 0 0 0 0 0 12 232 89 0 175 255 255 255 255 201 0 0 0 0 12 232 89 -0 0 0 138 201 0 0 0 0 0 0 0 89 201 0 89 255 255 255 255 247 34 138 251 -89 0 7 176 21 0 0 0 0 0 0 0 0 0 0 0 0 0 127 0 0 0 0 0 138 247 34 0 0 0 -175 255 255 255 166 0 89 255 255 255 255 255 247 34 0 0 0 0 0 0 0 0 0 0 -7 206 166 0 0 0 0 7 206 125 0 0 0 0 0 138 255 166 0 0 0 0 0 0 0 0 0 89 -225 21 0 0 0 0 0 7 206 125 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 59 238 34 0 0 0 0 0 0 89 225 21 0 0 0 0 0 7 206 125 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 12 235 191 255 255 166 238 34 0 0 0 138 166 89 225 21 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 175 201 0 0 -0 0 0 138 166 0 0 0 0 0 175 201 0 0 0 89 255 255 255 255 125 0 0 0 12 232 -89 0 0 0 0 59 215 21 0 0 138 255 255 255 225 21 0 0 0 0 0 0 0 0 0 0 0 0 -0 127 0 0 0 0 0 0 0 0 0 0 0 0 59 192 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 7 206 125 0 0 0 0 0 0 175 201 0 0 0 0 0 0 0 0 0 0 -89 255 125 0 0 0 59 245 166 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 89 255 125 0 0 0 59 245 166 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 12 235 125 0 0 0 0 0 0 0 0 138 166 89 225 21 0 0 0 0 0 0 0 0 0 175 -125 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 127 0 0 0 0 0 0 0 0 0 0 0 0 59 192 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 7 206 125 0 7 199 34 -0 12 235 125 0 0 0 0 0 0 0 0 0 0 0 7 206 255 255 255 247 34 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 7 206 255 255 -255 247 34 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 12 235 125 0 0 0 0 0 0 0 0 138 166 -89 225 21 0 0 0 0 0 0 0 0 7 202 89 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 127 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 7 206 125 0 7 206 255 255 255 166 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 12 235 125 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 12 235 255 201 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 127 -127 127 0 127 127 127 127 0 127 127 127 127 127 127 127 0 127 127 127 127 -127 127 127 0 127 127 127 127 127 127 127 0 127 127 127 127 127 127 127 -127 0 127 127 127 0 127 127 127 127 127 127 127 0 127 127 127 127 127 127 -0 127 127 127 127 127 127 127 127 127 127 127 127 0 127 127 127 127 127 -127 0 127 127 127 127 127 127 127 127 0 127 127 127 127 127 127 127 127 -0 127 127 127 127 0 127 127 127 127 127 127 127 127 127 127 127 127 0 127 -127 127 127 127 127 127 0 127 127 127 127 127 127 0 127 127 127 127 127 -127 127 127 127 0 127 127 127 127 127 127 127 0 127 127 127 127 127 0 127 -127 127 127 127 127 0 127 127 127 127 127 127 127 0 127 127 127 127 127 -127 127 0 127 127 127 127 127 0 127 127 127 127 127 127 0 127 127 127 127 -127 0 127 127 127 127 127 127 0 127 127 127 127 127 127 127 0 127 127 127 -127 127 127 127 127 127 127 127 127 127 0 127 127 127 127 127 127 127 127 -127 127 127 127 127 0 127 127 127 127 127 127 127 127 127 127 127 127 127 -0 127 127 127 127 127 127 127 0 0 0 0 0 0 0 0 0 0 0 0 0 127 0 0 0 138 225 -21 0 0 0 0 0 12 235 125 0 0 0 0 19 172 255 190 11 0 0 0 0 138 255 201 7 -202 89 0 0 0 0 0 0 0 0 0 0 7 206 255 125 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 59 138 225 21 0 0 0 0 0 0 59 245 201 0 0 0 19 172 -255 190 11 0 0 0 0 0 0 0 0 0 7 206 225 21 0 0 0 59 245 201 19 172 255 190 -11 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 12 235 251 89 89 201 0 0 0 0 0 175 -201 0 0 0 0 0 0 0 0 7 206 225 21 0 0 0 0 0 19 172 255 190 11 0 0 0 0 0 -175 255 166 12 228 34 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 89 255 125 0 0 0 0 0 0 0 12 175 247 34 0 0 0 19 172 255 -190 11 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 175 247 34 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 127 0 0 0 7 206 125 0 0 0 0 0 138 201 0 0 0 0 0 136 190 -45 196 145 0 0 0 59 215 21 175 255 166 0 0 0 175 225 29 206 166 0 0 7 202 -89 7 202 89 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 209 125 -0 0 0 0 0 0 138 225 21 0 0 0 136 190 45 196 145 0 0 0 175 225 29 206 166 -0 0 12 235 125 0 0 12 138 225 21 136 190 45 196 145 159 251 89 138 247 -34 0 0 0 0 0 0 0 0 0 0 0 175 125 59 245 247 34 0 0 0 0 0 12 232 89 0 0 -0 0 0 0 0 175 166 0 0 0 0 0 0 12 136 190 45 196 145 0 0 0 0 138 166 12 -235 255 125 0 0 0 0 7 206 166 12 235 125 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 12 232 89 0 0 0 0 0 0 138 201 0 0 0 0 0 136 190 45 -196 145 34 0 0 0 89 251 89 138 247 34 0 0 0 0 0 138 201 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 127 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 7 202 89 7 202 89 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 89 255 -255 125 0 0 0 0 127 0 0 7 206 251 89 0 0 0 0 7 206 251 89 0 0 0 0 7 206 -251 89 0 0 0 0 0 7 206 251 89 0 0 0 0 7 206 251 89 0 0 0 0 12 235 255 125 -0 0 0 0 0 89 255 255 255 255 255 255 255 255 125 0 0 0 59 245 255 255 255 -201 12 235 255 255 255 255 255 125 12 235 255 255 255 255 255 125 12 235 -255 255 255 255 255 125 12 235 255 255 255 255 255 125 89 255 255 255 201 -89 255 255 255 201 89 255 255 255 201 89 255 255 255 201 0 175 255 255 -255 255 201 0 0 0 12 235 251 89 0 0 12 235 125 0 0 0 138 255 255 166 0 -0 0 0 0 0 138 255 255 166 0 0 0 0 0 0 138 255 255 166 0 0 0 0 0 0 138 255 -255 166 0 0 0 0 0 0 138 255 255 166 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 138 -255 255 201 89 251 89 12 235 125 0 0 0 59 245 125 12 235 125 0 0 0 59 245 -125 12 235 125 0 0 0 59 245 125 12 235 125 0 0 0 59 245 125 7 206 225 21 -0 0 0 138 247 0 235 166 0 0 0 0 0 0 138 225 21 7 206 166 0 0 0 127 0 0 -59 245 255 166 0 0 0 0 59 245 255 166 0 0 0 0 59 245 255 166 0 0 0 0 0 -59 245 255 166 0 0 0 0 59 245 255 166 0 0 0 0 59 245 255 166 0 0 0 0 0 -175 201 7 206 166 0 0 0 0 0 0 0 138 255 125 0 0 7 202 102 235 166 0 0 0 -0 0 12 235 166 0 0 0 0 0 12 235 166 0 0 0 0 0 12 235 166 0 0 0 0 0 0 12 -235 125 0 0 12 235 125 0 0 12 235 125 0 0 12 235 125 0 0 175 201 0 0 7 -206 251 89 0 12 235 255 201 0 0 12 235 125 0 59 245 166 0 0 138 251 89 -0 0 59 245 166 0 0 138 251 89 0 0 59 245 166 0 0 138 251 89 0 0 59 245 -166 0 0 138 251 89 0 0 59 245 166 0 0 138 251 89 0 0 0 0 0 0 0 0 0 0 0 -0 59 245 166 0 0 89 255 166 0 12 235 125 0 0 0 59 245 125 12 235 125 0 -0 0 59 245 125 12 235 125 0 0 0 59 245 125 12 235 125 0 0 0 59 245 125 -0 59 245 125 0 0 59 245 125 12 235 166 0 0 0 0 0 12 235 125 0 0 175 201 -0 0 0 127 0 0 138 225 151 225 21 0 0 0 138 225 151 225 21 0 0 0 138 225 -151 225 21 0 0 0 0 138 225 151 225 21 0 0 0 138 225 151 225 21 0 0 0 138 -225 151 225 21 0 0 0 59 241 89 7 206 166 0 0 0 0 0 0 12 235 166 0 0 0 0 -0 12 235 166 0 0 0 0 0 12 235 166 0 0 0 0 0 12 235 166 0 0 0 0 0 12 235 -166 0 0 0 0 0 0 12 235 125 0 0 12 235 125 0 0 12 235 125 0 0 12 235 125 -0 0 175 201 0 0 0 0 175 225 21 12 235 166 245 125 0 12 235 125 12 235 125 -0 0 0 0 138 247 34 12 235 125 0 0 0 0 138 247 34 12 235 125 0 0 0 0 138 -247 34 12 235 125 0 0 0 0 138 247 34 12 235 125 0 0 0 0 138 247 34 0 138 -225 21 0 0 0 175 201 0 12 235 125 0 0 7 202 159 247 34 12 235 125 0 0 0 -59 245 125 12 235 125 0 0 0 59 245 125 12 235 125 0 0 0 59 245 125 12 235 -125 0 0 0 59 245 125 0 0 138 247 34 7 206 201 0 12 235 255 255 255 251 -89 0 12 235 125 0 12 235 125 0 0 0 127 0 7 206 166 59 241 89 0 0 7 206 -166 59 241 89 0 0 7 206 166 59 241 89 0 0 0 7 206 166 59 241 89 0 0 7 206 -166 59 241 89 0 0 7 206 166 59 241 89 0 0 0 138 225 21 7 206 166 0 0 0 -0 0 0 89 247 34 0 0 0 0 0 12 235 166 0 0 0 0 0 12 235 166 0 0 0 0 0 12 -235 166 0 0 0 0 0 12 235 166 0 0 0 0 0 0 12 235 125 0 0 12 235 125 0 0 -12 235 125 0 0 12 235 125 0 0 175 201 0 0 0 0 59 241 89 12 235 125 138 -225 21 12 235 125 89 247 34 0 0 0 0 59 245 125 89 247 34 0 0 0 0 59 245 -125 89 247 34 0 0 0 0 59 245 125 89 247 34 0 0 0 0 59 245 125 89 247 34 -0 0 0 0 59 245 125 0 0 175 225 21 0 175 225 21 0 89 247 34 0 0 138 166 -12 235 125 12 235 125 0 0 0 59 245 125 12 235 125 0 0 0 59 245 125 12 235 -125 0 0 0 59 245 125 12 235 125 0 0 0 59 245 125 0 0 12 235 166 89 247 -34 0 12 235 166 0 0 138 251 89 12 235 133 206 255 125 0 0 0 0 127 0 59 -241 89 7 206 166 0 0 59 241 89 7 206 166 0 0 59 241 89 7 206 166 0 0 0 -59 241 89 7 206 166 0 0 59 241 89 7 206 166 0 0 59 241 89 7 206 166 0 0 -12 235 125 0 7 206 255 255 255 255 247 34 0 138 225 21 0 0 0 0 0 12 235 -255 255 255 255 247 34 12 235 255 255 255 255 247 34 12 235 255 255 255 -255 247 34 12 235 255 255 255 255 247 34 0 12 235 125 0 0 12 235 125 0 -0 12 235 125 0 0 12 235 125 0 206 255 255 255 247 34 0 12 235 125 12 235 -125 12 235 125 12 235 125 138 225 21 0 0 0 0 12 235 166 138 225 21 0 0 -0 0 12 235 166 138 225 21 0 0 0 0 12 235 166 138 225 21 0 0 0 0 12 235 -166 138 225 21 0 0 0 0 12 235 166 0 0 0 175 225 187 225 21 0 0 138 225 -21 0 59 215 21 7 206 166 12 235 125 0 0 0 59 245 125 12 235 125 0 0 0 59 -245 125 12 235 125 0 0 0 59 245 125 12 235 125 0 0 0 59 245 125 0 0 0 89 -255 255 125 0 0 12 235 166 0 0 12 235 166 12 235 125 0 7 206 201 0 0 0 -127 0 138 225 21 0 138 225 21 0 138 225 21 0 138 225 21 0 138 225 21 0 -138 225 21 0 0 138 225 21 0 138 225 21 0 138 225 21 0 138 225 21 0 138 -225 21 0 138 225 21 0 89 255 255 255 255 255 166 0 0 0 0 0 0 138 225 21 -0 0 0 0 0 12 235 166 0 0 0 0 0 12 235 166 0 0 0 0 0 12 235 166 0 0 0 0 -0 12 235 166 0 0 0 0 0 0 12 235 125 0 0 12 235 125 0 0 12 235 125 0 0 12 -235 125 0 0 175 201 0 0 0 0 12 235 125 12 235 125 0 138 225 34 235 125 -138 225 21 0 0 0 0 12 235 166 138 225 21 0 0 0 0 12 235 166 138 225 21 -0 0 0 0 12 235 166 138 225 21 0 0 0 0 12 235 166 138 225 21 0 0 0 0 12 -235 166 0 0 0 0 175 225 21 0 0 0 138 225 21 7 202 89 0 7 206 166 12 235 -125 0 0 0 59 245 125 12 235 125 0 0 0 59 245 125 12 235 125 0 0 0 59 245 -125 12 235 125 0 0 0 59 245 125 0 0 0 7 206 225 21 0 0 12 235 166 0 0 12 -235 166 12 235 125 0 0 59 241 89 0 0 127 7 206 255 255 255 255 251 89 7 -206 255 255 255 255 251 89 7 206 255 255 255 255 251 89 0 7 206 255 255 -255 255 251 89 7 206 255 255 255 255 251 89 7 206 255 255 255 255 251 89 -7 206 166 0 0 7 206 166 0 0 0 0 0 0 89 247 34 0 0 0 0 0 12 235 166 0 0 -0 0 0 12 235 166 0 0 0 0 0 12 235 166 0 0 0 0 0 12 235 166 0 0 0 0 0 0 -12 235 125 0 0 12 235 125 0 0 12 235 125 0 0 12 235 125 0 0 175 201 0 0 -0 0 59 241 89 12 235 125 0 12 235 138 235 125 89 247 34 0 0 0 0 59 245 -125 89 247 34 0 0 0 0 59 245 125 89 247 34 0 0 0 0 59 245 125 89 247 34 -0 0 0 0 59 245 125 89 247 34 0 0 0 0 59 245 125 0 0 0 175 225 187 225 21 -0 0 138 247 34 175 125 0 0 12 235 125 12 235 125 0 0 0 59 241 89 12 235 -125 0 0 0 59 241 89 12 235 125 0 0 0 59 241 89 12 235 125 0 0 0 59 241 -89 0 0 0 0 175 225 21 0 0 12 235 166 0 0 175 247 34 12 235 125 0 0 12 235 -125 0 0 127 59 241 89 0 0 7 206 166 59 241 89 0 0 7 206 166 59 241 89 0 -0 7 206 166 0 59 241 89 0 0 7 206 166 59 241 89 0 0 7 206 166 59 241 89 -0 0 7 206 166 59 241 89 0 0 7 206 166 0 0 0 0 0 0 59 245 166 0 0 0 0 0 -12 235 166 0 0 0 0 0 12 235 166 0 0 0 0 0 12 235 166 0 0 0 0 0 12 235 166 -0 0 0 0 0 0 12 235 125 0 0 12 235 125 0 0 12 235 125 0 0 12 235 125 0 0 -175 201 0 0 0 0 175 225 21 12 235 125 0 0 138 232 245 125 12 235 125 0 -0 0 0 138 247 34 12 235 125 0 0 0 0 138 247 34 12 235 125 0 0 0 0 138 247 -34 12 235 125 0 0 0 0 138 247 34 12 235 125 0 0 0 0 138 247 34 0 0 175 -225 21 0 175 225 21 0 59 245 191 201 0 0 0 89 225 21 12 235 166 0 0 0 89 -251 89 12 235 166 0 0 0 89 251 89 12 235 166 0 0 0 89 251 89 12 235 166 -0 0 0 89 251 89 0 0 0 0 175 225 21 0 0 12 235 255 255 255 247 34 0 12 235 -125 0 0 59 241 89 0 0 127 138 225 21 0 0 0 138 247 163 225 21 0 0 0 138 -247 163 225 21 0 0 0 138 247 34 138 225 21 0 0 0 138 247 163 225 21 0 0 -0 138 247 163 225 21 0 0 0 138 247 198 225 21 0 0 7 206 166 0 0 0 0 0 0 -0 138 255 125 0 0 7 202 102 235 166 0 0 0 0 0 12 235 166 0 0 0 0 0 12 235 -166 0 0 0 0 0 12 235 166 0 0 0 0 0 0 12 235 125 0 0 12 235 125 0 0 12 235 -125 0 0 12 235 125 0 0 175 201 0 0 7 206 251 89 0 12 235 125 0 0 12 235 -255 125 0 89 255 125 0 0 89 251 89 0 0 89 255 125 0 0 89 251 89 0 0 89 -255 125 0 0 89 251 89 0 0 89 255 125 0 0 89 251 89 0 0 89 255 125 0 0 89 -251 89 0 0 138 225 21 0 0 0 175 201 0 0 138 251 89 0 0 89 251 89 0 0 138 -247 34 0 7 206 225 21 0 138 247 34 0 7 206 225 21 0 138 247 34 0 7 206 -225 21 0 138 247 34 0 7 206 225 21 0 0 0 0 175 225 21 0 0 12 235 166 0 -0 0 0 0 12 235 125 0 0 175 225 21 0 0 127 206 166 0 0 0 0 59 245 255 166 -0 0 0 0 59 245 255 166 0 0 0 0 59 245 133 206 166 0 0 0 0 59 245 255 166 -0 0 0 0 59 245 255 166 0 0 0 0 59 245 255 125 0 0 0 7 206 255 255 255 255 -255 125 0 0 0 59 245 255 255 255 201 12 235 255 255 255 255 255 125 12 -235 255 255 255 255 255 125 12 235 255 255 255 255 255 125 12 235 255 255 -255 255 255 125 89 255 255 255 201 89 255 255 255 201 89 255 255 255 201 -89 255 255 255 201 0 175 255 255 255 255 225 21 0 0 12 235 125 0 0 0 138 -255 125 0 0 0 175 255 255 201 0 0 0 0 0 0 175 255 255 201 0 0 0 0 0 0 175 -255 255 201 0 0 0 0 0 0 175 255 255 201 0 0 0 0 0 0 175 255 255 201 0 0 -0 0 0 0 0 0 0 0 0 0 0 7 202 97 206 255 255 201 0 0 0 0 0 138 255 255 255 -201 0 0 0 0 138 255 255 255 201 0 0 0 0 138 255 255 255 201 0 0 0 0 138 -255 255 255 201 0 0 0 0 0 0 175 225 21 0 0 12 235 166 0 0 0 0 0 12 235 -133 206 255 225 21 0 0 0 127 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 138 166 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 138 166 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 127 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 175 166 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 127 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 7 206 255 225 21 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 127 127 127 127 127 -127 127 0 127 127 127 127 127 127 127 0 127 127 127 127 127 127 127 127 -0 127 127 127 127 127 127 127 0 127 127 127 127 127 127 127 0 127 127 127 -127 127 127 127 0 127 127 127 127 127 127 127 127 127 127 127 127 127 0 -127 127 127 127 127 127 127 127 0 127 127 127 127 127 127 0 127 127 127 -127 127 127 127 0 127 127 127 127 127 127 127 0 127 127 127 127 127 127 -127 0 127 127 127 127 0 127 127 127 127 0 127 127 127 127 0 127 127 127 -127 0 127 127 127 127 127 127 127 127 127 0 127 127 127 127 127 127 127 -127 0 127 127 127 127 127 127 127 127 127 0 127 127 127 127 127 127 127 -127 127 0 127 127 127 127 127 127 127 127 127 0 127 127 127 127 127 127 -127 127 127 0 127 127 127 127 127 127 127 127 127 0 127 127 127 127 127 -127 127 127 127 0 127 127 127 127 127 127 127 127 127 0 127 127 127 127 -127 127 127 127 0 127 127 127 127 127 127 127 127 0 127 127 127 127 127 -127 127 127 0 127 127 127 127 127 127 127 127 0 127 127 127 127 127 127 -127 127 0 127 127 127 127 127 127 127 0 127 127 127 127 127 127 127 127 -0 0 127 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 127 0 7 206 225 21 -0 0 0 0 0 12 235 225 21 0 0 89 255 225 21 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 7 206 255 247 34 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 7 206 247 -34 0 0 0 0 0 0 0 138 251 89 0 0 59 245 247 34 0 0 0 0 0 0 0 0 0 175 247 -34 0 0 175 0 255 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 7 206 225 21 -0 0 0 0 0 0 0 138 255 125 0 0 0 12 235 251 89 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 138 251 89 0 0 0 0 0 0 -7 206 225 21 0 0 0 7 206 251 89 0 0 0 0 0 0 0 0 0 0 0 0 0 59 245 166 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 127 0 0 59 241 89 0 0 0 0 -0 89 247 34 0 0 7 206 138 235 125 0 0 89 255 225 21 175 125 0 0 0 0 0 0 -0 0 0 138 201 0 138 201 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 12 -235 125 0 0 0 0 0 0 12 235 125 0 0 0 175 171 206 166 0 0 0 0 0 0 0 0 0 -7 206 166 0 59 245 255 166 238 0 0 0 0 0 0 0 0 0 0 0 0 7 206 255 125 59 -215 21 0 0 59 241 89 0 0 0 0 0 0 7 206 166 0 0 0 0 138 201 175 201 0 0 -0 12 235 251 89 89 201 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 7 206 166 0 0 0 0 0 0 89 247 34 0 0 0 0 89 225 151 201 0 0 0 0 -0 0 0 0 0 0 0 0 0 175 201 0 12 235 125 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 127 0 0 0 138 201 0 0 0 0 7 206 125 0 0 0 138 201 0 89 225 21 -12 228 34 138 255 201 0 0 0 138 247 34 175 225 21 0 138 201 0 138 201 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 89 225 21 0 0 0 0 0 89 225 -21 0 0 89 247 34 59 241 89 0 59 241 89 89 247 34 0 0 89 225 21 175 127 -215 21 206 247 42 206 0 138 255 247 42 206 125 0 0 138 166 12 235 251 89 -0 0 0 0 138 201 0 0 0 0 0 0 89 225 21 0 0 0 59 241 89 12 235 125 0 0 175 -125 59 245 247 34 0 0 12 235 125 89 251 89 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 59 238 34 0 0 0 0 0 175 166 0 0 0 0 12 232 89 7 206 125 0 -0 12 235 166 59 245 125 0 0 0 59 238 34 0 12 235 125 0 0 0 0 0 0 89 247 -34 138 225 21 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 127 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 7 206 255 247 34 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 175 251 89 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 7 199 34 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 12 235 125 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 127 12 235 255 255 255 166 0 12 235 255 -255 255 166 0 12 235 255 255 255 166 0 12 235 255 255 255 166 0 0 12 235 -255 255 255 166 0 12 235 255 255 255 166 0 12 235 255 255 255 166 0 175 -255 255 125 0 0 12 235 255 255 125 0 0 12 235 255 255 225 21 0 0 12 235 -255 255 225 21 0 12 235 255 255 225 21 0 12 235 255 255 225 21 0 12 235 -125 12 235 125 12 235 125 12 235 125 0 12 235 125 89 251 89 0 12 235 138 -235 255 247 34 0 0 12 235 255 255 201 0 0 0 12 235 255 255 201 0 0 0 12 -235 255 255 201 0 0 0 12 235 255 255 201 0 0 0 12 235 255 255 201 0 0 0 -0 0 0 175 247 34 0 0 0 12 235 255 255 255 166 0 59 241 89 0 0 89 247 34 -59 241 89 0 0 89 247 34 59 241 89 0 0 89 247 34 59 241 89 0 0 89 247 42 -206 201 0 0 0 138 232 245 166 245 255 251 89 7 206 201 0 0 0 138 225 21 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 127 12 206 21 0 59 245 125 12 206 21 0 59 245 125 12 206 -21 0 59 245 125 12 206 21 0 59 245 125 0 12 206 21 0 59 245 125 12 206 -21 0 59 245 125 12 206 21 0 12 235 255 125 0 7 206 166 12 235 166 0 0 172 -102 0 235 125 0 0 175 201 0 12 235 125 0 0 175 201 12 235 125 0 0 175 201 -12 235 125 0 0 175 201 0 12 235 125 12 235 125 12 235 125 12 235 125 0 -0 0 0 0 175 201 0 12 235 247 34 0 175 201 0 12 235 166 0 7 206 201 0 12 -235 166 0 7 206 201 0 12 235 166 0 7 206 201 0 12 235 166 0 7 206 201 0 -12 235 166 0 7 206 201 0 0 0 0 0 175 247 34 0 0 12 235 166 0 12 235 201 -0 59 241 89 0 0 89 247 34 59 241 89 0 0 89 247 34 59 241 89 0 0 89 247 -34 59 241 89 0 0 89 247 34 89 247 34 0 7 206 176 235 225 21 0 175 225 21 -89 247 34 0 7 206 166 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 127 0 0 0 0 7 206 166 0 0 0 0 7 -206 166 0 0 0 0 7 206 166 0 0 0 0 7 206 166 0 0 0 0 0 7 206 166 0 0 0 0 -7 206 166 0 0 0 0 0 175 201 0 0 0 89 225 138 225 21 0 0 0 0 89 225 21 0 -0 89 247 34 89 225 21 0 0 89 247 124 225 21 0 0 89 247 124 225 21 0 0 89 -247 34 12 235 125 12 235 125 12 235 125 12 235 125 0 89 255 255 255 255 -247 34 12 235 125 0 0 89 247 34 138 225 21 0 0 59 238 34 138 225 21 0 0 -59 238 34 138 225 21 0 0 59 238 34 138 225 21 0 0 59 238 34 138 225 21 -0 0 59 238 34 0 0 0 0 0 0 0 0 0 138 225 21 0 172 132 238 34 59 241 89 0 -0 89 247 34 59 241 89 0 0 89 247 34 59 241 89 0 0 89 247 34 59 241 89 0 -0 89 247 34 12 235 125 0 59 238 47 235 125 0 0 59 241 89 12 235 125 0 59 -238 34 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 127 0 59 245 255 255 255 166 0 59 245 255 255 -255 166 0 59 245 255 255 255 166 0 59 245 255 255 255 166 0 0 59 245 255 -255 255 166 0 59 245 255 255 255 166 0 89 255 255 255 255 255 255 255 255 -255 247 175 201 0 0 0 0 0 175 255 255 255 255 255 247 34 175 255 255 255 -255 255 247 198 255 255 255 255 255 247 198 255 255 255 255 255 247 34 -12 235 125 12 235 125 12 235 125 12 235 125 89 251 89 0 0 59 241 89 12 -235 125 0 0 89 247 34 175 201 0 0 0 12 232 89 175 201 0 0 0 12 232 89 175 -201 0 0 0 12 232 89 175 201 0 0 0 12 232 89 175 201 0 0 0 12 232 89 7 206 -255 255 255 255 255 255 251 226 201 0 89 166 12 232 89 59 241 89 0 0 89 -247 34 59 241 89 0 0 89 247 34 59 241 89 0 0 89 247 34 59 241 89 0 0 89 -247 34 0 175 201 0 138 201 12 235 125 0 0 12 235 125 0 175 201 0 138 201 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 127 89 255 166 0 7 206 166 89 255 166 0 7 206 166 89 -255 166 0 7 206 166 89 255 166 0 7 206 166 0 89 255 166 0 7 206 166 89 -255 166 0 7 206 166 138 255 125 0 0 175 201 0 0 0 0 0 175 201 0 0 0 0 0 -175 201 0 0 0 0 0 0 175 201 0 0 0 0 0 175 201 0 0 0 0 0 175 201 0 0 0 0 -0 0 12 235 125 12 235 125 12 235 125 12 235 125 175 201 0 0 0 59 241 89 -12 235 125 0 0 89 247 34 175 201 0 0 0 12 232 89 175 201 0 0 0 12 232 89 -175 201 0 0 0 12 232 89 175 201 0 0 0 12 232 89 175 201 0 0 0 12 232 89 -0 0 0 0 0 0 0 0 0 175 201 7 176 21 12 232 89 59 241 89 0 0 89 247 34 59 -241 89 0 0 89 247 34 59 241 89 0 0 89 247 34 59 241 89 0 0 89 247 34 0 -89 247 47 235 125 12 235 125 0 0 12 235 125 0 89 247 47 235 125 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 127 175 201 0 0 7 206 166 175 201 0 0 7 206 166 175 201 0 0 -7 206 166 175 201 0 0 7 206 166 0 175 201 0 0 7 206 166 175 201 0 0 7 206 -166 175 201 0 0 0 138 225 21 0 0 0 0 138 225 21 0 0 0 0 138 247 34 0 0 -0 0 0 138 247 34 0 0 0 0 138 247 34 0 0 0 0 138 247 34 0 0 0 0 0 12 235 -125 12 235 125 12 235 125 12 235 125 175 201 0 0 0 89 247 34 12 235 125 -0 0 89 247 34 138 225 21 0 0 89 247 34 138 225 21 0 0 89 247 34 138 225 -21 0 0 89 247 34 138 225 21 0 0 89 247 34 138 225 21 0 0 89 247 34 0 0 -0 0 175 247 34 0 0 138 225 151 125 0 89 247 34 59 241 89 0 0 89 247 34 -59 241 89 0 0 89 247 34 59 241 89 0 0 89 247 34 59 241 89 0 0 89 247 34 -0 12 235 191 247 34 12 235 125 0 0 59 241 89 0 12 235 191 247 34 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 127 138 225 21 0 138 255 166 138 225 21 0 138 255 166 138 -225 21 0 138 255 166 138 225 21 0 138 255 166 0 138 225 21 0 138 255 166 -138 225 21 0 138 255 166 89 247 34 0 89 255 255 166 0 0 12 206 12 235 166 -0 0 127 102 0 235 201 0 0 12 206 21 12 235 201 0 0 12 206 34 235 201 0 -0 12 206 34 235 201 0 0 12 206 21 12 235 125 12 235 125 12 235 125 12 235 -125 89 255 125 0 7 206 166 0 12 235 125 0 0 89 247 34 12 235 166 0 7 206 -201 0 12 235 166 0 7 206 201 0 12 235 166 0 7 206 201 0 12 235 166 0 7 -206 201 0 12 235 166 0 7 206 201 0 0 0 0 0 175 247 34 0 0 12 235 201 0 -7 206 201 0 7 206 166 0 59 245 247 34 7 206 166 0 59 245 247 34 7 206 166 -0 59 245 247 34 7 206 166 0 59 245 247 34 0 0 138 255 166 0 12 235 125 -0 7 206 201 0 0 0 138 255 166 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 127 7 206 255 255 171 -206 166 7 206 255 255 171 206 166 7 206 255 255 171 206 166 7 206 255 255 -171 206 166 0 7 206 255 255 171 206 166 7 206 255 255 171 206 166 0 89 -255 255 201 0 0 175 255 255 247 34 0 12 235 255 255 166 0 0 7 206 255 255 -247 34 0 0 7 206 255 255 247 34 0 7 206 255 255 247 34 0 7 206 255 255 -247 34 0 12 235 125 12 235 125 12 235 125 12 235 125 0 89 255 255 255 201 -0 0 12 235 125 0 0 89 247 34 0 12 235 255 255 201 0 0 0 12 235 255 255 -201 0 0 0 12 235 255 255 201 0 0 0 12 235 255 255 201 0 0 0 12 235 255 -255 201 0 0 0 0 0 0 0 0 0 0 0 7 206 255 255 255 201 0 0 0 59 245 255 225 -111 247 34 0 59 245 255 225 111 247 34 0 59 245 255 225 111 247 34 0 59 -245 255 225 111 247 34 0 0 59 241 89 0 12 235 255 255 255 225 21 0 0 0 -59 241 89 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 127 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 175 125 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 138 125 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 138 225 21 0 12 235 125 0 0 0 0 0 0 0 -138 225 21 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 127 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 7 202 89 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 7 206 166 0 0 12 235 125 0 0 0 0 0 0 7 206 -166 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 127 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -12 235 255 166 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 89 247 34 0 0 12 235 125 0 0 0 0 0 0 89 247 -34 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 127 127 127 127 127 127 0 127 127 127 127 -127 127 0 127 127 127 127 127 127 0 127 127 127 127 127 127 127 0 127 127 -127 127 127 127 0 127 127 127 127 127 127 0 127 127 127 127 127 127 127 -127 127 127 127 0 127 127 127 127 127 127 0 127 127 127 127 127 127 127 -0 127 127 127 127 127 127 0 127 127 127 127 127 127 0 127 127 127 127 127 -127 127 0 127 127 0 127 127 0 127 127 0 127 127 0 127 127 127 127 127 127 -127 0 127 127 127 127 127 127 127 0 127 127 127 127 127 127 127 0 127 127 -127 127 127 127 127 0 127 127 127 127 127 127 127 0 127 127 127 127 127 -127 127 0 127 127 127 127 127 127 127 0 127 127 127 127 127 127 127 127 -0 127 127 127 127 127 127 127 0 127 127 127 127 127 127 127 0 127 127 127 -127 127 127 127 0 127 127 127 127 127 127 127 0 127 127 127 127 127 127 -127 0 127 127 127 127 127 127 0 127 127 127 127 127 127 0 127 127 127 127 -127 127 127 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 diff --git a/extern/AntTweakBar/src/res/FontNormal.pgm b/extern/AntTweakBar/src/res/FontNormal.pgm deleted file mode 100644 index f05e8313..00000000 --- a/extern/AntTweakBar/src/res/FontNormal.pgm +++ /dev/null @@ -1,895 +0,0 @@ -P2 -# Created by Paint Shop Pro -253 106 -255 -127 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 127 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 127 0 0 0 0 0 0 0 0 0 0 255 0 255 0 0 0 0 0 0 0 0 0 0 0 0 0 255 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 255 0 0 0 0 255 0 0 255 -0 0 0 0 0 0 255 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 255 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 127 0 0 0 0 0 0 255 0 0 0 255 0 255 0 0 0 0 -0 255 0 255 0 0 0 0 0 255 0 0 0 0 255 255 0 0 0 0 255 0 0 0 0 0 255 255 -255 0 0 0 0 0 255 0 0 0 255 0 0 0 0 255 0 0 0 255 0 255 0 255 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 255 0 0 255 255 255 255 0 0 0 0 0 -255 0 0 0 0 255 255 255 255 0 0 0 255 255 255 255 0 0 0 0 0 0 255 0 0 255 -255 255 255 255 255 0 0 0 255 255 255 0 0 255 255 255 255 255 255 0 0 255 -255 255 255 0 0 0 255 255 255 255 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 255 255 255 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 127 0 0 0 0 0 0 255 0 0 0 255 0 255 0 0 0 0 0 255 0 255 0 0 0 0 255 255 -255 0 0 255 0 0 255 0 0 255 0 0 0 0 0 255 0 0 0 255 0 0 0 0 255 0 0 0 255 -0 0 0 0 255 0 0 0 0 255 255 255 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 255 0 0 255 0 0 0 0 255 0 0 255 255 255 0 0 0 255 0 0 0 0 255 0 -255 0 0 0 0 255 0 0 0 0 255 255 0 0 255 0 0 0 0 0 0 0 255 0 0 0 0 0 0 0 -0 0 0 255 0 255 0 0 0 0 255 0 255 0 0 0 0 255 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 255 0 0 0 255 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 127 0 0 0 0 0 0 255 0 0 0 0 0 0 0 0 0 255 255 255 255 255 255 -0 0 255 0 255 0 255 0 255 0 0 255 0 0 255 0 0 0 0 0 255 0 0 0 255 0 0 0 -0 0 0 0 255 0 0 0 0 0 0 255 0 0 255 0 255 0 255 0 0 0 0 255 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 255 0 0 255 0 0 0 0 255 0 0 0 0 255 0 0 0 0 0 0 -0 0 255 0 0 0 0 0 0 255 0 0 0 255 0 255 0 0 255 0 0 0 0 0 0 255 0 0 0 0 -0 0 0 0 0 0 255 0 0 255 0 0 0 0 255 0 255 0 0 0 0 255 0 0 255 0 0 0 255 -0 0 0 0 0 0 0 0 255 0 0 0 0 0 0 0 0 0 0 0 0 255 0 0 0 0 0 0 0 0 0 0 0 255 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 127 0 0 0 0 0 0 255 0 0 0 0 0 0 0 0 0 0 255 0 255 -0 0 0 0 255 0 255 0 0 0 255 0 0 255 0 255 0 0 0 0 0 0 0 255 0 255 0 0 0 -0 0 0 0 0 255 0 0 0 0 0 0 255 0 0 0 0 255 0 0 0 0 0 0 255 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 255 0 0 255 0 0 0 0 255 0 0 0 0 255 0 0 0 0 0 0 0 -0 255 0 0 0 0 0 0 255 0 0 255 0 0 255 0 0 255 255 255 255 255 0 0 255 255 -255 255 255 0 0 0 0 0 0 255 0 0 255 0 0 0 0 255 0 255 0 0 0 0 255 0 0 255 -0 0 0 255 0 0 0 0 0 0 255 255 0 0 0 0 255 255 255 255 255 255 0 0 0 0 255 -255 0 0 0 0 0 0 0 0 0 255 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 127 0 0 0 0 0 0 255 0 0 -0 0 0 0 0 0 0 0 255 0 255 0 0 0 0 0 255 255 0 0 0 0 255 255 0 0 255 0 0 -255 255 0 0 0 255 255 0 0 0 255 0 0 0 0 0 255 0 0 0 0 0 0 255 0 0 0 0 0 -0 0 0 0 0 0 255 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 255 0 0 255 0 0 0 0 -255 0 0 0 0 255 0 0 0 0 0 0 0 255 0 0 0 0 255 255 255 0 0 255 0 0 0 255 -0 0 0 0 0 0 0 255 0 255 0 0 0 0 255 0 0 0 0 255 0 0 0 0 255 255 255 255 -0 0 255 0 0 0 0 255 0 0 0 0 0 0 0 0 0 0 0 255 255 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 255 255 0 0 0 0 0 255 255 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 127 0 0 -0 0 0 0 255 0 0 0 0 0 0 0 0 255 255 255 255 255 255 0 0 0 0 0 255 255 0 -0 0 0 0 0 0 255 0 255 0 0 255 0 255 0 0 255 0 0 255 0 0 0 0 0 255 0 0 0 -0 0 0 255 0 0 0 0 0 0 0 0 255 255 255 255 255 255 255 0 0 0 0 0 255 255 -255 0 0 0 0 0 0 255 0 0 0 255 0 0 0 0 255 0 0 0 0 255 0 0 0 0 0 255 255 -0 0 0 0 0 0 0 0 255 0 255 255 255 255 255 255 0 0 0 0 0 0 255 0 255 0 0 -0 0 255 0 0 0 0 255 0 0 0 255 0 0 0 0 255 0 0 255 255 255 255 255 0 0 0 -0 0 0 0 0 0 0 255 0 0 0 0 0 0 0 0 255 255 255 255 255 255 0 0 0 0 0 0 0 -0 255 0 0 0 255 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 127 0 0 0 0 0 0 255 0 0 0 0 -0 0 0 0 0 0 255 0 255 0 0 0 0 0 0 255 0 255 0 0 0 0 0 255 0 0 255 0 0 255 -0 255 0 0 0 255 255 0 0 0 0 0 0 255 0 0 0 0 0 0 255 0 0 0 0 0 0 0 0 0 0 -0 255 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 255 0 0 0 255 0 0 0 0 255 0 0 0 -0 255 0 0 0 0 255 0 0 0 0 0 0 0 0 0 0 255 0 0 0 0 0 255 0 0 0 0 0 0 0 255 -0 255 0 0 0 0 255 0 0 0 255 0 0 0 0 255 0 0 0 0 255 0 0 0 0 0 0 255 0 0 -0 0 0 0 0 0 0 0 0 255 255 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 255 255 0 -0 0 0 255 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 127 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 255 0 255 0 0 0 0 0 255 0 255 0 255 0 0 0 0 0 255 0 0 255 0 0 255 0 255 -0 0 0 255 255 0 0 0 0 0 0 255 0 0 0 0 0 0 255 0 0 0 0 0 0 0 0 0 0 0 255 -0 0 0 0 0 255 0 0 0 0 0 0 0 255 0 0 0 255 0 0 0 255 0 0 0 0 255 0 0 0 0 -255 0 0 0 255 0 0 0 0 0 0 255 0 0 0 0 255 0 0 0 0 0 255 0 0 255 0 0 0 0 -255 0 255 0 0 0 0 255 0 0 0 255 0 0 0 0 255 0 0 0 0 255 0 0 0 0 0 255 0 -0 0 255 0 0 0 255 0 0 0 0 0 0 255 255 0 0 0 0 0 0 0 0 0 0 0 0 0 0 255 255 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 127 0 0 0 0 0 0 255 0 0 0 0 0 -0 0 0 0 255 0 255 0 0 0 0 0 0 255 255 255 0 0 0 0 0 255 0 0 0 0 255 255 -0 0 0 255 255 255 0 0 255 0 0 0 0 0 0 255 0 0 0 0 255 0 0 0 0 0 0 0 0 0 -0 0 0 255 0 0 0 0 0 255 0 0 0 0 0 0 0 255 0 0 0 255 0 0 0 0 255 255 255 -255 0 0 0 255 255 255 255 255 0 255 255 255 255 255 255 0 0 255 255 255 -255 0 0 0 0 0 0 255 0 0 0 255 255 255 255 0 0 0 255 255 255 255 0 0 0 255 -0 0 0 0 0 0 255 255 255 255 0 0 0 255 255 255 0 0 0 0 255 0 0 0 255 0 0 -0 0 0 0 0 0 255 0 0 0 0 0 0 0 0 0 0 0 0 255 0 0 0 0 0 0 0 0 255 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 127 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 255 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 255 0 0 -0 0 255 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 255 0 0 0 0 0 0 0 0 0 0 255 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 255 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 127 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 255 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 255 0 0 255 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 255 0 0 0 0 0 -0 0 0 0 0 0 255 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 255 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 127 127 127 127 0 -127 127 127 0 127 127 127 127 127 0 127 127 127 127 127 127 127 0 127 127 -127 127 127 127 0 127 127 127 127 127 127 127 127 127 127 127 0 127 127 -127 127 127 127 127 0 127 127 127 0 127 127 127 0 127 127 127 127 0 127 -127 127 127 127 127 0 127 127 127 127 127 127 127 0 127 127 0 127 127 127 -127 0 127 127 127 0 127 127 127 127 0 127 127 127 127 127 127 0 127 127 -127 127 127 127 0 127 127 127 127 127 127 0 127 127 127 127 127 127 0 127 -127 127 127 127 127 0 127 127 127 127 127 127 0 127 127 127 127 127 127 -0 127 127 127 127 127 127 0 127 127 127 127 127 127 0 127 127 127 127 127 -127 0 127 127 0 127 127 127 127 0 127 127 127 127 127 127 127 127 0 127 -127 127 127 127 127 127 127 0 127 127 127 127 127 127 127 127 0 127 127 -127 127 127 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 127 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 127 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 127 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 255 255 255 0 255 0 0 0 0 0 255 255 255 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 127 0 0 0 255 -255 255 255 0 0 0 0 0 0 0 255 0 0 0 0 255 255 255 255 255 0 0 0 0 255 255 -255 255 0 255 255 255 255 255 0 0 0 255 255 255 255 255 255 0 255 255 255 -255 255 0 0 0 255 255 255 255 0 0 255 0 0 0 0 0 255 0 255 255 255 0 0 255 -255 255 0 255 0 0 0 0 255 0 255 0 0 0 0 0 255 255 0 0 0 0 255 255 0 255 -255 0 0 0 0 255 0 0 0 255 255 255 255 0 0 0 255 255 255 255 255 0 0 0 0 -255 255 255 255 0 0 0 255 255 255 255 0 0 0 0 255 255 255 255 0 0 255 255 -255 255 255 255 255 0 255 0 0 0 0 0 255 0 255 0 0 0 0 0 255 0 255 0 0 0 -0 255 0 0 0 0 255 0 255 0 0 0 0 255 0 255 0 0 0 0 0 255 0 255 255 255 255 -255 255 0 0 255 0 0 0 255 0 0 0 0 0 0 0 255 0 0 0 0 0 255 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 127 0 255 255 0 0 0 0 255 255 0 0 -0 0 255 0 255 0 0 0 255 0 0 0 0 255 0 0 255 0 0 0 0 0 255 0 0 0 0 255 0 -0 255 0 0 0 0 0 0 255 0 0 0 0 0 0 255 0 0 0 0 255 0 255 0 0 0 0 0 255 0 -0 255 0 0 0 0 0 255 0 255 0 0 0 255 0 0 255 0 0 0 0 0 255 255 0 0 0 0 255 -255 0 255 255 0 0 0 0 255 0 0 255 0 0 0 0 255 0 0 255 0 0 0 0 255 0 0 255 -0 0 0 0 255 0 0 255 0 0 0 255 0 0 255 0 0 0 0 255 0 0 0 0 255 0 0 0 0 255 -0 0 0 0 0 255 0 255 0 0 0 0 0 255 0 255 0 0 0 0 255 0 0 0 0 255 0 0 255 -0 0 255 0 0 0 255 0 0 0 255 0 0 0 0 0 0 0 255 0 0 255 0 0 0 0 255 0 0 0 -0 0 0 255 0 0 0 0 255 0 255 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 127 0 255 0 255 255 255 255 0 255 0 0 0 0 255 0 255 0 0 0 255 0 0 -0 0 255 0 255 0 0 0 0 0 0 255 0 0 0 0 0 255 0 255 0 0 0 0 0 0 255 0 0 0 -0 0 255 0 0 0 0 0 0 0 255 0 0 0 0 0 255 0 0 255 0 0 0 0 0 255 0 255 0 0 -255 0 0 0 255 0 0 0 0 0 255 0 255 0 0 255 0 255 0 255 0 255 0 0 0 255 0 -255 0 0 0 0 0 0 255 0 255 0 0 0 0 255 0 255 0 0 0 0 0 0 255 0 255 0 0 0 -255 0 0 255 0 0 0 0 0 0 0 0 0 255 0 0 0 0 255 0 0 0 0 0 255 0 0 255 0 0 -0 255 0 0 0 255 0 0 255 0 255 0 0 255 0 0 0 255 0 0 255 0 0 0 255 0 0 0 -255 0 0 0 0 0 0 255 0 0 0 255 0 0 0 0 255 0 0 0 0 0 0 255 0 0 0 255 0 0 -0 255 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 127 255 0 255 0 0 -0 255 0 0 255 0 0 0 255 0 255 0 0 0 255 0 0 0 0 255 0 255 0 0 0 0 0 0 255 -0 0 0 0 0 255 0 255 0 0 0 0 0 0 255 0 0 0 0 0 255 0 0 0 0 0 0 0 255 0 0 -0 0 0 255 0 0 255 0 0 0 0 0 255 0 255 0 255 0 0 0 0 255 0 0 0 0 0 255 0 -255 0 0 255 0 255 0 255 0 255 0 0 0 255 0 255 0 0 0 0 0 0 255 0 255 0 0 -0 0 255 0 255 0 0 0 0 0 0 255 0 255 0 0 0 255 0 0 255 0 0 0 0 0 0 0 0 0 -255 0 0 0 0 255 0 0 0 0 0 255 0 0 255 0 0 0 255 0 0 0 255 0 0 255 0 255 -0 0 255 0 0 0 0 255 255 0 0 0 0 0 255 0 255 0 0 0 0 0 0 255 0 0 0 0 255 -0 0 0 0 255 0 0 0 0 0 0 255 0 0 255 0 0 0 0 0 255 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 127 255 0 255 0 0 0 255 0 0 255 0 0 255 0 0 0 255 -0 0 255 255 255 255 255 0 0 255 0 0 0 0 0 0 255 0 0 0 0 0 255 0 255 255 -255 255 255 255 0 255 255 255 255 255 0 255 0 0 0 255 255 255 0 255 255 -255 255 255 255 255 0 0 255 0 0 0 0 0 255 0 255 255 0 0 0 0 0 255 0 0 0 -0 0 255 0 255 0 0 255 0 255 0 255 0 0 255 0 0 255 0 255 0 0 0 0 0 0 255 -0 255 0 0 0 0 255 0 255 0 0 0 0 0 0 255 0 255 255 255 255 0 0 0 0 255 255 -255 255 0 0 0 0 0 255 0 0 0 0 255 0 0 0 0 0 255 0 0 255 0 0 0 255 0 0 0 -255 0 0 255 0 255 0 0 255 0 0 0 0 255 255 0 0 0 0 0 0 255 0 0 0 0 0 0 255 -0 0 0 0 0 255 0 0 0 0 255 0 0 0 0 0 0 255 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 127 255 0 255 0 0 0 255 0 0 255 0 0 255 -0 0 0 255 0 0 255 0 0 0 0 255 0 255 0 0 0 0 0 0 255 0 0 0 0 0 255 0 255 -0 0 0 0 0 0 255 0 0 0 0 0 255 0 0 0 0 0 255 0 255 0 0 0 0 0 255 0 0 255 -0 0 0 0 0 255 0 255 0 255 0 0 0 0 255 0 0 0 0 0 255 0 0 255 255 0 0 255 -0 255 0 0 0 255 0 255 0 255 0 0 0 0 0 0 255 0 255 255 255 255 255 0 0 255 -0 0 0 0 0 0 255 0 255 0 0 255 0 0 0 0 0 0 0 0 255 0 0 0 0 255 0 0 0 0 255 -0 0 0 0 0 255 0 0 0 255 0 255 0 0 0 0 255 0 255 0 0 0 255 0 255 0 0 0 0 -255 255 0 0 0 0 0 0 255 0 0 0 0 0 0 255 0 0 0 0 0 255 0 0 0 0 0 255 0 0 -0 0 0 255 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 127 255 0 255 0 0 0 255 0 0 255 0 0 255 255 255 255 255 0 0 255 0 0 0 -0 255 0 255 0 0 0 0 0 0 255 0 0 0 0 0 255 0 255 0 0 0 0 0 0 255 0 0 0 0 -0 255 0 0 0 0 0 255 0 255 0 0 0 0 0 255 0 0 255 0 0 0 0 0 255 0 255 0 0 -255 0 0 0 255 0 0 0 0 0 255 0 0 255 255 0 0 255 0 255 0 0 0 255 0 255 0 -255 0 0 0 0 0 0 255 0 255 0 0 0 0 0 0 255 0 0 0 0 0 0 255 0 255 0 0 0 255 -0 0 0 0 0 0 0 255 0 0 0 0 255 0 0 0 0 255 0 0 0 0 0 255 0 0 0 255 0 255 -0 0 0 0 0 255 255 0 0 0 255 255 0 0 0 0 255 0 0 255 0 0 0 0 0 255 0 0 0 -0 0 255 0 0 0 0 0 0 255 0 0 0 0 0 255 0 0 0 0 0 255 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 127 0 255 0 255 255 255 255 -255 255 0 0 255 0 0 0 0 0 255 0 255 0 0 0 0 255 0 0 255 0 0 0 0 0 255 0 -0 0 0 255 0 0 255 0 0 0 0 0 0 255 0 0 0 0 0 0 255 0 0 0 0 255 0 255 0 0 -0 0 0 255 0 0 255 0 0 0 0 0 255 0 255 0 0 0 255 0 0 255 0 0 0 0 0 255 0 -0 0 0 0 0 255 0 255 0 0 0 0 255 255 0 0 255 0 0 0 0 255 0 0 255 0 0 0 0 -0 0 0 255 0 0 0 0 255 0 0 255 0 0 0 255 0 0 255 0 0 0 0 255 0 0 0 0 255 -0 0 0 0 0 255 0 0 0 255 0 0 0 0 255 0 255 0 0 0 0 0 255 0 0 0 0 0 255 0 -0 0 0 255 0 0 255 0 0 0 0 0 255 0 0 0 0 255 0 0 0 0 0 0 0 255 0 0 0 0 0 -255 0 0 0 0 0 255 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 127 0 255 255 0 0 0 0 0 0 0 0 255 0 0 0 0 0 255 0 255 255 255 -255 255 0 0 0 0 255 255 255 255 0 255 255 255 255 255 0 0 0 255 255 255 -255 255 255 0 255 0 0 0 0 0 0 0 255 255 255 255 255 0 255 0 0 0 0 0 255 -0 255 255 255 0 255 255 255 0 0 255 0 0 0 0 255 0 255 255 255 255 255 0 -255 0 0 0 0 0 0 255 0 255 0 0 0 0 255 255 0 0 0 255 255 255 255 0 0 0 255 -0 0 0 0 0 0 0 0 255 255 255 255 0 0 0 255 0 0 0 0 255 0 0 255 255 255 255 -0 0 0 0 0 255 0 0 0 0 0 0 255 255 255 0 0 0 0 0 0 255 0 0 0 0 0 0 255 0 -0 0 0 0 255 0 0 0 255 0 0 0 0 255 0 0 0 0 255 0 0 0 0 255 255 255 255 255 -255 0 0 255 0 0 0 0 0 255 0 0 0 0 0 255 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 127 0 0 0 255 255 255 255 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 255 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 255 0 0 0 0 0 0 255 0 0 0 0 255 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 127 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 255 255 255 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 255 255 255 0 0 0 0 255 0 0 -255 255 255 0 0 0 0 0 0 0 0 0 0 255 255 255 255 255 255 255 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 127 127 127 127 127 127 127 127 127 127 0 127 127 127 -127 127 127 127 0 127 127 127 127 127 127 0 127 127 127 127 127 127 0 127 -127 127 127 127 127 127 0 127 127 127 127 127 127 0 127 127 127 127 127 -0 127 127 127 127 127 127 127 0 127 127 127 127 127 127 127 0 127 127 127 -0 127 127 127 127 0 127 127 127 127 127 127 0 127 127 127 127 127 0 127 -127 127 127 127 127 127 127 0 127 127 127 127 127 127 127 0 127 127 127 -127 127 127 127 127 0 127 127 127 127 127 127 0 127 127 127 127 127 127 -127 127 0 127 127 127 127 127 127 0 127 127 127 127 127 127 0 127 127 127 -127 127 127 127 0 127 127 127 127 127 127 127 0 127 127 127 127 127 127 -127 0 127 127 127 127 127 127 127 127 127 127 127 0 127 127 127 127 127 -127 0 127 127 127 127 127 127 127 0 127 127 127 127 127 127 0 127 127 127 -127 0 127 127 127 127 0 127 127 127 127 0 127 127 127 127 127 127 127 127 -0 127 127 127 127 127 127 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 127 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 127 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 127 255 -0 0 0 0 0 0 0 0 0 0 0 255 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 255 0 0 0 0 -0 0 0 0 0 0 255 255 0 0 0 0 0 0 0 255 0 0 0 0 0 0 0 0 0 0 0 255 0 0 0 0 -0 255 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 255 255 0 0 0 255 -0 0 255 255 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 127 0 255 0 0 0 0 0 0 0 0 0 0 255 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 255 0 0 0 0 0 0 0 0 0 255 0 0 0 0 0 0 0 0 0 255 0 0 0 -0 0 0 255 0 0 255 0 255 0 0 0 0 0 255 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 255 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 255 0 0 0 0 0 255 0 0 0 0 255 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -255 255 255 255 255 255 255 255 255 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 127 -0 0 0 0 0 0 0 0 0 0 0 0 255 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 255 0 0 0 -0 0 0 0 0 0 255 0 0 0 0 0 0 0 0 0 255 0 0 0 0 0 0 0 0 0 0 0 255 0 0 0 0 -0 255 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 255 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 255 0 0 0 0 0 255 -0 0 0 0 255 0 0 0 0 0 0 0 0 0 0 0 0 0 0 255 0 0 0 0 0 0 0 255 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 127 0 0 0 0 0 0 0 255 255 255 0 0 255 0 255 255 -255 0 0 0 255 255 255 255 0 0 255 255 255 255 255 0 0 255 255 255 255 0 -0 255 255 255 255 0 255 255 255 255 255 0 255 0 255 255 255 0 0 255 0 255 -255 0 255 0 0 0 255 0 255 0 255 255 255 255 0 255 255 255 0 0 255 0 255 -255 255 0 0 0 255 255 255 255 0 0 255 0 255 255 255 0 0 0 255 255 255 255 -255 0 255 0 255 0 0 255 255 255 0 255 255 255 255 0 255 0 0 0 0 255 0 255 -0 0 0 255 0 255 0 0 0 255 0 0 0 255 0 255 0 0 0 255 0 255 0 0 0 255 0 255 -255 255 255 0 0 0 255 0 0 0 0 0 255 0 0 0 0 255 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 255 0 0 0 0 0 0 0 255 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 127 0 0 0 0 -0 0 0 0 0 0 255 0 255 255 0 0 0 255 0 255 0 0 0 0 0 255 0 0 0 0 255 0 255 -0 0 0 0 255 0 0 255 0 0 255 0 0 0 0 255 0 255 255 0 0 0 255 0 255 0 0 255 -0 255 0 0 255 0 0 255 0 255 0 0 0 255 0 0 0 255 0 255 255 0 0 0 255 0 255 -0 0 0 0 255 0 255 255 0 0 0 255 0 255 0 0 0 0 255 0 255 255 0 0 255 0 0 -0 0 0 255 0 0 0 255 0 0 0 0 255 0 255 0 0 0 255 0 255 0 0 0 255 0 0 0 255 -0 0 255 0 255 0 0 255 0 0 0 255 0 0 0 0 255 0 0 0 255 0 0 0 0 0 255 0 0 -0 0 255 0 0 0 0 0 0 0 0 0 0 0 0 0 0 255 0 0 0 0 0 0 0 255 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 127 0 0 0 0 0 0 0 0 0 0 255 0 255 0 0 0 0 255 0 255 -0 0 0 0 0 255 0 0 0 0 255 0 255 0 0 0 0 255 0 0 255 0 0 255 0 0 0 0 255 -0 255 0 0 0 0 255 0 255 0 0 255 0 255 0 255 0 0 0 255 0 255 0 0 0 255 0 -0 0 255 0 255 0 0 0 0 255 0 255 0 0 0 0 255 0 255 0 0 0 0 255 0 255 0 0 -0 0 255 0 255 0 0 0 255 0 0 0 0 0 255 0 0 0 255 0 0 0 0 255 0 0 255 0 255 -0 0 0 255 0 255 0 255 0 255 0 0 0 255 0 255 0 0 0 255 0 255 0 0 0 0 255 -0 0 0 0 255 0 0 0 0 0 255 0 0 0 0 255 0 0 0 0 0 255 255 0 0 0 255 0 0 0 -255 0 0 0 0 0 0 0 255 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 127 0 0 0 0 0 0 -0 255 255 255 255 0 255 0 0 0 0 255 0 255 0 0 0 0 0 255 0 0 0 0 255 0 255 -255 255 255 255 255 0 0 255 0 0 255 0 0 0 0 255 0 255 0 0 0 0 255 0 255 -0 0 255 0 255 255 0 0 0 0 255 0 255 0 0 0 255 0 0 0 255 0 255 0 0 0 0 255 -0 255 0 0 0 0 255 0 255 0 0 0 0 255 0 255 0 0 0 0 255 0 255 0 0 0 0 255 -255 0 0 0 255 0 0 0 255 0 0 0 0 255 0 0 255 0 255 0 0 0 255 0 255 0 255 -0 255 0 0 0 0 255 0 0 0 0 255 0 255 0 0 0 255 0 0 0 255 255 0 0 0 0 0 0 -255 0 0 0 0 0 255 255 0 0 255 0 0 255 0 0 255 0 0 0 255 0 0 0 0 0 0 0 255 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 127 0 0 0 0 0 0 255 0 0 0 255 0 255 0 -0 0 0 255 0 255 0 0 0 0 0 255 0 0 0 0 255 0 255 0 0 0 0 0 0 0 255 0 0 255 -0 0 0 0 255 0 255 0 0 0 0 255 0 255 0 0 255 0 255 0 255 0 0 0 255 0 255 -0 0 0 255 0 0 0 255 0 255 0 0 0 0 255 0 255 0 0 0 0 255 0 255 0 0 0 0 255 -0 255 0 0 0 0 255 0 255 0 0 0 0 0 0 255 0 0 255 0 0 0 255 0 0 0 0 255 0 -0 255 0 255 0 0 0 255 0 255 0 255 0 255 0 0 0 255 0 255 0 0 0 255 0 255 -0 0 0 255 0 0 0 0 0 255 0 0 0 0 0 255 0 0 0 0 255 0 0 0 0 255 0 0 0 255 -255 0 0 0 0 255 0 0 0 0 0 0 0 255 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 127 -0 0 0 0 0 0 255 0 0 0 255 0 255 0 0 0 0 255 0 255 0 0 0 0 0 255 0 0 0 255 -255 0 255 0 0 0 0 255 0 0 255 0 0 255 0 0 0 255 255 0 255 0 0 0 0 255 0 -255 0 0 255 0 255 0 0 255 0 0 255 0 255 0 0 0 255 0 0 0 255 0 255 0 0 0 -0 255 0 255 0 0 0 0 255 0 255 0 0 0 0 255 0 255 0 0 0 255 255 0 255 0 0 -0 0 0 0 255 0 0 255 0 0 0 255 0 0 0 255 255 0 0 0 255 0 0 0 0 0 255 0 0 -0 255 0 0 0 0 255 0 255 0 0 0 0 255 0 0 0 255 0 0 0 0 0 0 255 0 0 0 0 0 -255 0 0 0 0 255 0 0 0 0 0 0 0 0 0 0 0 0 0 0 255 0 0 0 0 0 0 0 255 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 127 0 0 0 0 0 0 0 255 255 255 255 0 255 255 -255 255 255 0 0 0 255 255 255 255 0 0 255 255 255 0 255 0 0 255 255 255 -255 0 0 0 255 0 0 0 255 255 255 0 255 0 255 0 0 0 0 255 0 255 0 0 255 0 -255 0 0 0 255 0 255 0 255 0 0 0 255 0 0 0 255 0 255 0 0 0 0 255 0 0 255 -255 255 255 0 0 255 255 255 255 255 0 0 0 255 255 255 0 255 0 255 0 0 0 -255 255 255 0 0 0 0 255 255 0 0 255 255 255 0 255 0 0 0 255 0 0 0 0 0 255 -0 0 0 255 0 0 0 255 0 0 0 255 0 0 0 255 0 0 0 255 255 255 255 0 0 0 255 -0 0 0 0 0 255 0 0 0 0 255 0 0 0 0 0 0 0 0 0 0 0 0 0 0 255 255 255 255 255 -255 255 255 255 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 127 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 255 0 0 0 0 0 0 0 0 0 0 0 255 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 255 0 0 0 0 0 0 0 0 0 0 0 255 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 255 0 0 0 0 0 0 0 0 0 0 255 0 0 0 0 0 255 0 0 0 0 255 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 127 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 255 255 255 255 0 0 0 0 0 0 0 0 0 0 0 255 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 255 0 0 0 0 0 0 0 -0 0 0 0 255 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 255 0 0 0 0 0 0 0 0 0 0 0 0 255 255 0 0 0 -255 0 0 255 255 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 127 127 127 127 127 0 127 127 127 127 127 0 -127 127 127 127 127 127 0 127 127 127 127 127 0 127 127 127 127 127 127 -0 127 127 127 127 127 127 0 127 127 127 0 127 127 127 127 127 127 0 127 -127 127 127 127 127 0 127 0 127 127 0 127 127 127 127 127 0 127 0 127 127 -127 127 127 127 127 127 127 0 127 127 127 127 127 127 0 127 127 127 127 -127 127 0 127 127 127 127 127 127 0 127 127 127 127 127 127 0 127 127 127 -0 127 127 127 127 0 127 127 127 127 0 127 127 127 127 127 127 0 127 127 -127 127 127 0 127 127 127 127 127 127 127 127 127 0 127 127 127 127 127 -0 127 127 127 127 127 0 127 127 127 127 0 127 127 127 127 127 0 127 127 -127 127 0 127 127 127 127 127 0 127 127 127 127 127 127 127 127 127 0 127 -127 127 127 127 127 127 127 127 127 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 127 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 255 0 0 255 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 255 0 0 255 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 127 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 255 255 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 255 255 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 255 0 0 255 0 0 127 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 255 0 0 0 0 0 0 255 0 -0 0 0 0 255 255 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 255 0 0 0 255 0 255 0 255 -0 0 0 255 0 255 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 255 -255 0 255 0 0 0 0 0 0 0 0 0 0 0 0 255 0 0 255 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 255 0 0 255 0 0 0 0 0 0 0 0 0 127 0 0 255 -255 255 255 0 0 0 255 255 255 255 255 255 255 255 255 0 0 0 0 0 0 0 0 255 -255 255 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 255 0 0 0 0 0 0 255 0 0 0 0 -255 0 0 255 0 0 0 255 255 0 0 0 0 255 0 0 0 0 0 0 0 0 0 0 255 255 255 255 -0 0 0 0 0 0 0 0 0 255 255 255 255 255 255 255 255 255 0 0 0 255 255 255 -255 255 255 255 255 255 0 255 255 255 255 255 255 0 0 0 255 255 255 255 -255 255 255 255 255 0 0 0 255 255 255 255 255 255 255 255 255 0 255 0 0 -0 255 0 255 0 255 0 0 0 255 0 255 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 255 0 255 255 0 0 0 255 255 255 0 255 0 0 0 255 0 0 255 255 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 255 255 255 255 255 255 255 255 -255 0 0 255 255 0 0 255 0 0 0 0 0 255 0 127 0 255 0 0 0 0 0 0 0 255 0 0 -0 0 0 0 0 255 0 0 0 0 0 0 0 255 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 255 -255 255 255 255 0 0 255 255 255 255 255 0 0 0 0 0 0 0 0 255 0 0 255 0 0 -255 0 0 0 0 0 0 0 0 0 0 255 0 0 0 0 255 0 0 0 0 0 0 0 255 0 0 0 0 255 0 -0 0 0 0 0 0 255 0 0 0 0 0 0 0 255 0 0 0 0 0 0 255 0 0 0 255 0 0 0 0 0 0 -0 255 0 0 0 255 0 0 0 0 0 0 0 255 0 0 255 0 255 0 0 0 255 0 255 0 255 0 -255 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -255 0 0 255 255 0 255 255 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 255 0 0 0 0 0 0 0 255 0 0 0 0 0 0 0 255 0 0 0 255 0 0 127 255 0 0 0 0 -0 0 0 0 255 0 0 0 0 0 0 0 255 0 0 0 0 0 0 0 255 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 255 0 0 0 0 0 0 255 0 0 0 0 0 0 0 0 0 0 255 0 0 255 0 -0 255 0 0 0 0 0 0 0 0 0 0 255 0 0 0 0 0 0 0 0 0 255 0 255 0 0 0 0 0 255 -0 0 0 0 0 0 0 255 0 0 0 0 0 0 0 255 0 0 0 0 0 255 0 0 0 0 255 0 0 0 0 0 -0 0 255 0 0 0 255 0 0 0 0 0 0 0 255 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 255 0 0 255 -0 255 0 255 0 0 255 255 255 0 0 255 0 0 0 0 255 255 255 255 0 255 255 255 -0 0 0 0 255 0 0 0 0 0 0 0 255 0 255 255 255 255 0 0 255 0 0 0 255 0 0 127 -255 255 255 255 255 255 0 0 0 255 0 0 0 0 0 0 0 255 0 0 0 0 0 0 0 255 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 255 0 0 0 0 0 0 255 0 0 0 0 0 0 -0 0 0 0 255 0 0 255 0 255 0 0 0 0 0 0 0 0 0 0 0 255 0 0 0 0 0 0 0 0 255 -0 0 255 0 0 0 0 0 255 0 0 0 0 0 0 0 255 0 0 0 0 0 0 0 255 0 0 0 0 255 0 -0 0 0 0 255 0 0 0 0 0 0 0 255 0 0 0 255 0 0 0 0 0 0 0 255 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 255 255 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 255 0 0 255 0 0 0 255 0 255 0 0 0 0 0 0 255 0 0 255 0 0 -0 0 255 0 0 0 255 0 0 0 255 0 0 0 0 0 0 0 255 0 0 0 0 255 0 0 0 255 0 255 -0 0 0 127 255 0 0 0 0 0 0 0 0 255 0 0 0 0 0 0 0 255 0 0 0 0 0 0 255 255 -255 255 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 255 0 0 0 0 0 0 255 0 0 0 -0 0 0 0 0 0 0 0 255 255 0 0 255 0 0 255 255 0 0 0 255 255 0 0 0 255 255 -255 255 0 0 0 255 0 0 0 255 0 0 0 0 0 255 255 255 255 255 0 0 0 255 0 0 -0 0 0 0 0 255 0 0 0 255 0 0 0 0 0 0 255 0 0 0 0 0 0 0 255 0 0 0 255 0 0 -0 0 0 0 0 255 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 255 255 255 255 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 255 0 -0 0 0 0 0 0 255 0 255 0 0 0 0 255 0 0 0 255 0 0 0 255 0 0 0 0 0 0 0 255 -0 0 0 255 0 0 0 0 0 255 0 0 0 0 127 255 255 255 255 255 255 0 0 0 255 0 -0 0 0 0 0 0 255 0 0 0 0 0 0 0 255 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 255 0 0 0 0 255 255 255 255 255 0 0 0 0 0 0 0 0 0 0 0 0 0 255 0 255 -0 0 255 0 255 0 0 255 0 0 0 0 0 0 255 0 0 255 0 0 0 255 0 0 0 0 0 255 0 -0 0 0 0 0 0 255 0 0 0 0 0 0 0 255 0 0 0 255 0 0 0 0 0 0 255 0 0 0 0 0 0 -0 255 0 0 0 255 0 0 0 0 0 0 0 255 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 255 -255 255 255 0 255 255 255 255 255 0 255 255 255 255 255 255 255 255 255 -255 255 255 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 255 255 0 0 0 0 0 255 -0 255 0 0 0 0 255 255 255 255 255 0 0 0 255 0 0 0 0 0 0 0 255 0 0 255 0 -0 0 0 0 0 255 0 0 0 0 127 255 0 0 0 0 0 0 0 0 255 0 0 0 0 0 0 0 255 0 0 -0 0 0 0 255 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 255 0 0 0 0 0 0 -255 0 0 0 0 0 0 0 0 0 0 0 0 0 0 255 0 0 255 0 0 255 0 255 0 0 255 0 0 0 -0 0 0 255 0 0 0 255 0 0 255 0 0 0 0 0 255 0 0 0 0 0 0 0 255 0 0 0 0 0 0 -0 255 0 0 255 0 0 0 0 0 0 0 255 0 0 0 0 0 0 0 255 0 0 0 255 0 0 0 0 0 0 -0 255 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 255 255 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 255 0 0 0 255 -0 0 255 0 0 0 0 255 0 0 0 0 0 0 0 255 0 0 0 0 0 0 0 255 0 0 255 0 0 0 0 -0 0 255 0 0 0 0 127 0 255 0 0 0 0 0 0 0 255 0 0 0 0 0 0 0 255 0 0 255 0 -0 0 255 0 0 0 0 0 255 0 255 0 0 0 0 0 0 0 0 0 0 0 0 0 0 255 0 0 0 0 0 0 -255 0 0 0 0 0 0 0 0 0 0 0 0 0 0 255 0 0 255 0 0 255 0 255 0 0 255 0 255 -0 0 0 0 255 0 0 0 0 255 0 0 255 0 0 0 0 255 0 0 0 0 0 0 0 255 0 0 0 0 0 -0 0 255 0 255 0 0 0 0 0 0 0 0 255 0 0 0 0 0 0 0 255 0 0 0 255 0 0 0 0 0 -0 0 255 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 255 0 0 255 0 -0 0 255 0 0 0 0 255 0 0 0 0 0 0 0 255 0 0 0 0 0 0 0 255 0 255 0 0 0 0 0 -0 0 255 0 0 0 0 127 0 0 255 255 255 255 0 0 0 255 255 255 255 255 255 255 -255 255 0 0 255 0 0 0 255 0 0 0 0 0 255 0 255 0 0 255 0 0 255 0 0 255 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 255 0 0 0 0 255 255 0 -0 0 255 255 0 0 0 255 255 255 255 0 0 0 0 0 0 0 0 0 255 255 255 255 255 -255 255 255 255 0 0 0 255 255 255 255 255 255 255 255 255 0 255 255 255 -255 255 255 0 0 0 255 255 255 255 255 255 255 255 255 0 0 0 255 255 255 -255 255 255 255 255 255 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 255 -255 255 0 0 0 0 0 0 0 0 255 255 255 255 0 255 255 255 255 0 0 0 255 255 -255 255 255 255 255 255 255 0 255 255 255 255 0 0 0 0 255 0 0 0 0 127 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 255 0 0 255 255 0 0 0 0 0 255 0 255 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 127 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 127 127 127 127 127 127 127 0 127 127 127 127 127 127 127 -127 127 127 0 127 127 0 127 127 127 127 127 127 0 127 127 127 127 0 127 -127 127 127 127 127 127 127 127 0 127 127 127 127 127 127 0 127 127 127 -127 127 127 0 127 127 127 127 127 0 127 127 127 127 127 127 127 127 127 -127 127 127 127 127 127 127 127 0 127 127 127 127 127 127 0 127 127 127 -127 0 127 127 127 127 127 127 127 127 127 127 127 0 127 127 127 127 127 -127 127 127 127 127 127 0 127 127 127 127 127 127 0 127 127 127 127 127 -127 127 127 127 127 127 0 127 127 127 127 127 127 127 127 127 127 127 0 -127 127 0 127 127 0 127 127 127 127 0 127 127 127 127 0 127 127 127 127 -0 127 127 127 127 127 0 127 127 127 127 127 127 127 127 127 127 127 0 127 -127 127 127 127 127 0 127 127 127 127 127 127 127 127 127 127 0 127 127 -127 127 0 127 127 127 127 0 127 127 127 127 127 127 127 127 127 127 0 127 -127 127 127 127 127 127 127 127 127 127 0 127 127 127 127 0 127 127 127 -127 127 127 127 0 127 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 127 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 127 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 255 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 255 255 255 255 255 255 255 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 255 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 127 0 0 0 0 0 255 0 0 0 -0 0 255 0 0 0 0 0 255 255 255 255 0 0 0 0 0 0 0 0 255 0 0 0 0 0 255 0 0 -255 0 0 0 0 255 255 255 255 0 0 255 0 0 255 0 0 0 0 0 255 255 255 255 0 -0 0 0 0 255 255 255 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 255 -255 255 255 0 0 0 0 0 0 0 0 0 0 0 0 0 255 255 0 0 0 0 0 0 0 0 0 0 0 255 -255 255 0 0 0 255 255 255 0 0 0 0 0 255 0 0 0 0 0 0 0 0 0 0 0 255 255 255 -255 255 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 255 0 0 0 255 255 255 0 0 0 0 0 0 -0 0 0 0 0 255 0 0 0 0 255 0 0 0 0 0 0 255 0 0 0 0 255 0 0 0 0 0 255 255 -255 0 0 0 0 255 0 0 0 0 0 0 255 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 127 0 0 0 0 0 0 0 0 0 0 0 255 0 0 0 0 255 0 0 0 0 0 0 0 0 0 0 -0 0 0 255 0 0 0 255 0 0 0 255 0 0 0 255 0 0 0 0 0 0 0 0 0 0 0 0 0 255 255 -0 0 0 0 255 255 0 0 0 0 0 0 255 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 255 255 0 0 0 0 255 255 0 0 0 0 0 0 0 0 0 0 255 0 0 255 0 0 0 0 255 -0 0 0 0 0 0 0 0 255 0 0 0 0 0 255 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 255 255 -255 255 0 255 0 0 0 0 0 0 0 0 0 0 0 0 0 0 255 255 0 0 255 0 0 0 255 0 0 -0 0 0 0 0 0 0 255 255 0 0 0 255 0 0 0 0 0 0 255 255 0 0 0 0 255 0 0 0 0 -0 0 0 0 255 0 0 255 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 127 0 0 0 0 0 255 0 0 0 0 255 255 255 255 0 0 255 0 0 0 0 -0 255 0 0 0 0 255 0 0 0 255 0 255 0 0 0 0 255 0 0 0 255 0 0 0 0 0 0 0 0 -0 0 0 0 0 255 0 0 255 255 0 0 255 0 0 0 0 255 255 255 0 0 0 255 0 0 255 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 255 0 255 255 255 0 0 255 0 0 0 0 0 0 0 0 -0 0 255 0 0 255 0 0 0 0 255 0 0 0 0 0 0 0 255 0 0 0 0 255 255 0 0 0 0 0 -0 0 0 0 255 0 0 0 0 255 0 255 255 255 255 0 255 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 255 0 0 255 0 0 0 255 0 255 0 0 255 0 0 0 0 0 255 0 0 0 255 0 0 0 -0 0 0 0 255 0 0 0 255 0 0 0 0 0 0 0 255 255 0 0 0 255 0 0 0 0 0 0 0 255 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 127 0 0 0 0 0 255 0 0 -0 255 0 255 0 0 0 0 255 0 0 0 0 0 0 255 255 255 255 0 0 0 0 255 0 255 0 -0 0 0 255 0 0 0 0 255 255 0 0 0 0 0 0 0 0 0 0 255 0 0 255 0 0 255 0 0 255 -0 0 255 0 0 255 0 0 255 0 0 255 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 255 0 0 255 -0 0 255 0 0 255 0 0 0 0 0 0 0 0 0 0 255 255 0 0 0 0 0 255 0 0 0 0 0 0 255 -0 0 0 0 0 0 0 255 0 0 0 0 0 0 0 0 255 0 0 0 0 255 0 255 255 255 255 0 255 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 255 0 0 255 0 0 0 255 0 0 255 0 0 255 0 0 -0 0 255 0 0 255 0 0 0 0 0 0 0 0 255 0 0 0 255 0 0 0 0 0 0 0 0 0 255 0 255 -0 0 0 0 0 0 0 0 255 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 127 -0 0 0 0 0 255 0 0 0 255 0 255 0 0 0 0 255 0 0 0 0 0 0 255 0 0 255 0 0 0 -0 0 255 0 0 0 0 0 0 0 0 0 255 0 0 255 0 0 0 0 0 0 0 0 0 255 0 0 255 0 0 -0 0 0 255 0 0 255 0 0 255 0 255 0 0 255 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -255 0 0 255 0 0 255 0 0 255 0 0 0 0 0 0 0 0 0 0 0 0 0 0 255 255 255 255 -255 255 255 0 0 255 255 255 255 0 0 255 255 255 0 0 0 0 0 0 0 0 0 255 0 -0 0 0 255 0 0 255 255 255 0 255 0 0 255 0 0 0 0 0 0 0 0 0 0 0 255 255 255 -0 255 0 0 0 255 0 0 0 255 0 0 255 0 0 0 255 0 0 255 0 0 255 255 0 0 0 0 -255 0 0 255 0 255 255 255 0 0 0 0 0 0 255 0 255 0 0 255 255 0 0 0 255 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 127 0 0 0 0 0 255 0 0 -0 255 0 255 0 0 0 255 255 255 255 255 0 0 0 255 0 0 255 0 0 0 255 255 255 -255 255 0 0 0 0 0 0 0 255 0 0 0 255 0 0 0 0 0 0 0 0 255 0 0 255 0 0 0 0 -0 255 0 0 0 255 255 255 0 255 0 0 255 0 0 0 0 255 255 255 255 255 255 255 -0 255 255 255 0 255 0 0 255 255 255 0 0 0 255 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 255 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 255 0 0 0 0 255 -0 0 0 0 255 0 255 0 0 255 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 255 255 255 0 -0 0 0 255 0 0 255 0 0 0 0 0 255 0 0 255 0 255 0 0 0 0 0 0 0 255 0 0 0 0 -255 0 0 255 255 255 0 255 0 0 255 0 255 0 0 255 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 127 0 0 0 0 0 255 0 0 0 255 0 255 0 0 0 0 -255 0 0 0 0 0 0 255 255 255 255 0 0 0 0 0 255 0 0 0 0 0 255 0 0 0 0 255 -0 0 255 0 0 0 0 0 0 0 0 255 0 0 255 0 0 255 0 0 255 0 0 0 0 0 0 0 0 255 -0 0 255 0 0 0 0 0 0 0 0 0 255 0 0 0 0 0 255 0 0 255 0 0 255 0 0 255 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 255 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 255 0 0 0 0 255 0 0 0 0 255 0 255 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 255 0 0 255 0 0 0 0 0 255 0 0 255 0 0 255 0 0 0 0 0 -0 255 0 0 0 0 255 0 0 0 0 0 0 255 0 0 255 0 0 255 0 255 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 127 0 0 0 0 0 255 0 0 0 255 0 255 -0 0 0 0 255 0 0 0 0 0 255 0 0 0 0 255 0 0 0 0 255 0 0 0 0 0 255 0 0 0 0 -0 255 255 0 0 0 0 0 0 0 0 0 0 255 0 0 255 255 0 0 255 0 0 0 0 0 0 0 0 0 -0 255 0 0 255 0 0 0 0 0 0 0 0 255 0 0 0 0 0 0 255 0 255 0 0 0 255 255 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 255 255 255 255 255 255 255 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 255 0 0 0 255 255 0 0 0 0 255 0 255 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 255 0 0 255 0 0 0 0 0 0 255 0 0 255 -255 255 255 255 0 0 0 0 0 255 0 0 0 255 0 0 0 0 0 0 0 255 0 0 255 255 255 -255 255 255 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 127 -0 0 0 0 0 255 0 0 0 0 255 255 255 255 0 255 255 255 255 255 255 0 0 0 0 -0 0 0 0 0 0 0 255 0 0 0 0 0 255 0 0 0 0 0 0 0 255 0 0 0 0 0 0 0 0 0 255 -255 0 0 0 0 255 255 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 255 0 0 -0 0 0 0 255 255 0 0 0 0 255 255 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 255 255 255 255 0 255 0 0 0 -0 255 0 255 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 255 0 0 0 0 0 0 255 0 0 0 0 0 255 0 0 0 255 255 255 255 0 0 0 0 255 -0 0 0 0 0 0 255 0 0 255 255 255 255 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 127 0 0 0 0 0 0 0 0 0 0 0 255 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 255 0 0 0 0 0 0 0 255 0 0 0 0 0 0 0 0 0 0 0 255 255 -255 255 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 255 255 255 255 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 255 0 0 0 0 0 0 0 0 0 255 0 255 0 0 0 -0 0 0 0 0 0 255 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 127 0 0 0 0 0 0 0 0 0 0 0 255 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 255 0 0 0 255 255 255 -255 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 255 0 0 0 0 0 0 0 -0 0 255 0 255 0 0 0 0 0 0 0 255 255 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 127 -127 127 0 127 127 127 0 127 127 127 127 127 127 0 127 127 127 127 127 127 -0 127 127 127 127 127 127 0 127 127 127 127 127 127 127 0 127 127 127 0 -127 127 127 127 127 127 0 127 127 127 127 127 127 0 127 127 127 127 127 -127 127 127 127 127 0 127 127 127 127 127 0 127 127 127 127 127 127 127 -0 127 127 127 127 127 127 127 0 127 127 127 0 127 127 127 127 127 127 127 -127 127 127 0 127 127 127 127 127 127 0 127 127 127 127 127 0 127 127 127 -127 127 127 127 0 127 127 127 127 127 0 127 127 127 127 127 0 127 127 127 -127 127 0 127 127 127 127 127 127 127 0 127 127 127 127 127 127 0 127 127 -127 0 127 127 127 127 127 127 0 127 127 127 127 127 0 127 127 127 127 127 -0 127 127 127 127 127 127 0 127 127 127 127 127 127 127 127 127 127 127 -0 127 127 127 127 127 127 127 127 127 127 127 0 127 127 127 127 127 127 -127 127 127 127 127 0 127 127 127 127 127 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 127 0 0 255 0 0 0 0 0 0 0 0 0 255 0 0 0 0 0 0 255 255 -0 0 0 0 0 255 255 0 255 0 0 0 0 0 0 0 0 0 0 0 0 0 255 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 255 0 0 0 0 0 0 0 0 255 0 0 0 0 255 255 0 -0 0 0 0 0 0 0 0 0 255 0 0 0 0 0 255 0 0 255 255 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 255 255 0 255 0 0 0 0 0 255 0 0 0 0 0 0 0 0 0 255 0 0 0 0 0 0 0 255 -255 0 0 0 0 0 0 0 255 255 0 255 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 255 0 0 0 0 0 0 0 0 0 255 0 0 0 0 0 0 255 255 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 255 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 127 0 0 0 255 0 0 0 0 0 0 0 255 0 0 0 0 0 0 255 0 0 255 0 0 0 -255 0 255 255 0 0 0 0 255 0 0 0 255 0 0 0 0 255 0 255 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 255 0 0 0 0 0 0 255 0 0 0 0 255 0 0 255 0 -0 0 255 0 0 255 0 0 0 255 0 0 0 255 0 0 255 0 0 255 255 0 255 0 0 0 0 0 -0 0 0 0 0 255 0 255 255 0 0 0 0 0 0 0 255 0 0 0 0 0 0 0 255 0 0 0 0 0 0 -0 255 0 0 255 0 0 0 0 0 255 0 255 255 0 0 0 0 0 255 0 0 255 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 255 0 0 0 0 0 0 0 255 0 0 0 0 0 0 255 -0 0 255 0 0 0 255 0 0 0 255 0 0 0 0 0 255 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 127 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 255 0 255 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 255 255 255 0 0 0 0 0 0 0 0 0 0 0 0 127 0 0 0 255 0 0 0 0 0 0 0 255 0 -0 0 0 0 0 0 255 0 0 0 0 0 0 0 255 0 0 0 0 0 0 0 255 0 0 0 0 0 0 0 255 0 -0 0 0 0 0 0 255 255 255 255 255 255 255 0 0 0 255 255 255 255 0 255 255 -255 255 255 255 0 255 255 255 255 255 255 0 255 255 255 255 255 255 0 255 -255 255 255 255 255 0 255 255 255 0 255 255 255 0 255 255 255 0 255 255 -255 0 0 255 255 255 255 0 0 0 255 255 0 0 0 0 255 0 0 0 255 255 255 255 -0 0 0 0 0 255 255 255 255 0 0 0 0 0 255 255 255 255 0 0 0 0 0 255 255 255 -255 0 0 0 0 0 255 255 255 255 0 0 0 0 0 0 0 0 0 0 0 0 0 0 255 255 255 255 -0 255 0 255 0 0 0 0 0 255 0 255 0 0 0 0 0 255 0 255 0 0 0 0 0 255 0 255 -0 0 0 0 0 255 0 255 0 0 0 0 0 255 0 255 0 0 0 0 0 0 255 0 0 0 255 0 0 0 -0 0 0 0 0 0 0 0 127 0 0 255 0 255 0 0 0 0 0 255 0 255 0 0 0 0 0 255 0 255 -0 0 0 0 0 255 0 255 0 0 0 0 0 255 0 255 0 0 0 0 0 255 0 255 0 0 0 0 0 0 -255 0 255 0 0 0 0 0 0 255 0 0 0 0 0 255 0 0 0 0 0 0 255 0 0 0 0 0 0 255 -0 0 0 0 0 0 255 0 0 0 0 0 0 0 255 0 0 0 255 0 0 0 255 0 0 0 255 0 0 0 255 -0 0 0 255 0 0 255 255 0 0 0 0 255 0 0 255 0 0 0 0 255 0 0 0 255 0 0 0 0 -255 0 0 0 255 0 0 0 0 255 0 0 0 255 0 0 0 0 255 0 0 0 255 0 0 0 0 255 0 -0 0 0 0 0 0 0 0 0 0 0 255 0 0 0 0 255 0 0 255 0 0 0 0 0 255 0 255 0 0 0 -0 0 255 0 255 0 0 0 0 0 255 0 255 0 0 0 0 0 255 0 0 255 0 0 0 255 0 0 255 -0 0 0 0 0 0 255 0 0 0 255 0 0 0 0 0 0 0 0 0 0 0 127 0 0 255 0 255 0 0 0 -0 0 255 0 255 0 0 0 0 0 255 0 255 0 0 0 0 0 255 0 255 0 0 0 0 0 255 0 255 -0 0 0 0 0 255 0 255 0 0 0 0 0 255 0 0 255 0 0 0 0 0 255 0 0 0 0 0 0 255 -0 0 0 0 0 0 255 0 0 0 0 0 0 255 0 0 0 0 0 0 255 0 0 0 0 0 0 0 255 0 0 0 -255 0 0 0 255 0 0 0 255 0 0 0 255 0 0 0 0 255 0 255 0 255 0 0 0 255 0 255 -0 0 0 0 0 0 255 0 255 0 0 0 0 0 0 255 0 255 0 0 0 0 0 0 255 0 255 0 0 0 -0 0 0 255 0 255 0 0 0 0 0 0 255 0 0 0 0 0 0 0 0 0 0 255 0 0 0 0 255 0 255 -0 255 0 0 0 0 0 255 0 255 0 0 0 0 0 255 0 255 0 0 0 0 0 255 0 255 0 0 0 -0 0 255 0 0 255 0 0 0 255 0 0 255 255 255 255 255 0 0 255 0 0 0 255 0 0 -0 0 0 0 0 0 0 0 0 127 0 0 255 0 255 0 0 0 0 0 255 0 255 0 0 0 0 0 255 0 -255 0 0 0 0 0 255 0 255 0 0 0 0 0 255 0 255 0 0 0 0 0 255 0 255 0 0 0 0 -0 255 0 0 255 0 0 0 0 0 255 0 0 0 0 0 0 255 0 0 0 0 0 0 255 0 0 0 0 0 0 -255 0 0 0 0 0 0 255 0 0 0 0 0 0 0 255 0 0 0 255 0 0 0 255 0 0 0 255 0 0 -0 255 0 0 0 0 255 0 255 0 255 0 0 0 255 0 255 0 0 0 0 0 0 255 0 255 0 0 -0 0 0 0 255 0 255 0 0 0 0 0 0 255 0 255 0 0 0 0 0 0 255 0 255 0 0 0 0 0 -0 255 0 0 0 255 0 0 0 255 0 0 255 0 0 0 255 0 0 255 0 255 0 0 0 0 0 255 -0 255 0 0 0 0 0 255 0 255 0 0 0 0 0 255 0 255 0 0 0 0 0 255 0 0 0 255 0 -255 0 0 0 255 0 0 0 0 255 0 255 0 255 255 0 0 0 0 0 0 0 0 0 0 0 0 127 0 -255 0 0 0 255 0 0 0 255 0 0 0 255 0 0 0 255 0 0 0 255 0 0 0 255 0 0 0 255 -0 0 0 255 0 0 0 255 0 0 0 255 0 0 0 255 0 0 0 0 255 0 0 255 255 255 255 -255 0 255 0 0 0 0 0 0 255 255 255 255 255 255 0 255 255 255 255 255 255 -0 255 255 255 255 255 255 0 255 255 255 255 255 255 0 0 255 0 0 0 255 0 -0 0 255 0 0 0 255 0 0 255 255 255 255 0 0 255 0 255 0 0 255 0 0 255 0 255 -0 0 0 0 0 0 255 0 255 0 0 0 0 0 0 255 0 255 0 0 0 0 0 0 255 0 255 0 0 0 -0 0 0 255 0 255 0 0 0 0 0 0 255 0 0 0 0 255 0 255 0 0 0 255 0 0 255 0 0 -0 255 0 255 0 0 0 0 0 255 0 255 0 0 0 0 0 255 0 255 0 0 0 0 0 255 0 255 -0 0 0 0 0 255 0 0 0 0 255 0 0 0 0 255 0 0 0 0 255 0 255 0 0 0 255 0 0 0 -0 0 0 0 0 0 0 0 127 0 255 0 0 0 255 0 0 0 255 0 0 0 255 0 0 0 255 0 0 0 -255 0 0 0 255 0 0 0 255 0 0 0 255 0 0 0 255 0 0 0 255 0 0 0 255 0 0 0 255 -255 255 255 255 0 0 0 0 0 255 0 0 0 0 0 0 255 0 0 0 0 0 0 255 0 0 0 0 0 -0 255 0 0 0 0 0 0 255 0 0 0 0 0 0 0 255 0 0 0 255 0 0 0 255 0 0 0 255 0 -0 0 255 0 0 0 0 255 0 255 0 0 0 255 0 255 0 255 0 0 0 0 0 0 255 0 255 0 -0 0 0 0 0 255 0 255 0 0 0 0 0 0 255 0 255 0 0 0 0 0 0 255 0 255 0 0 0 0 -0 0 255 0 0 0 0 0 255 0 0 0 0 255 0 0 255 0 0 0 255 0 255 0 0 0 0 0 255 -0 255 0 0 0 0 0 255 0 255 0 0 0 0 0 255 0 255 0 0 0 0 0 255 0 0 0 0 255 -0 0 0 0 255 0 0 0 0 255 0 255 0 0 0 0 255 0 0 0 0 0 0 0 0 0 0 127 0 255 -255 255 255 255 0 0 0 255 255 255 255 255 0 0 0 255 255 255 255 255 0 0 -0 255 255 255 255 255 0 0 0 255 255 255 255 255 0 0 0 255 255 255 255 255 -0 0 0 255 0 0 0 255 0 0 0 0 0 255 0 0 0 0 0 0 255 0 0 0 0 0 0 255 0 0 0 -0 0 0 255 0 0 0 0 0 0 255 0 0 0 0 0 0 0 255 0 0 0 255 0 0 0 255 0 0 0 255 -0 0 0 255 0 0 0 0 255 0 255 0 0 0 255 0 255 0 255 0 0 0 0 0 0 255 0 255 -0 0 0 0 0 0 255 0 255 0 0 0 0 0 0 255 0 255 0 0 0 0 0 0 255 0 255 0 0 0 -0 0 0 255 0 0 0 0 255 0 255 0 0 0 255 0 255 0 0 0 0 255 0 255 0 0 0 0 0 -255 0 255 0 0 0 0 0 255 0 255 0 0 0 0 0 255 0 255 0 0 0 0 0 255 0 0 0 0 -255 0 0 0 0 255 255 255 255 255 0 0 255 0 0 0 0 255 0 0 0 0 0 0 0 0 0 0 -127 255 0 0 0 0 0 255 0 255 0 0 0 0 0 255 0 255 0 0 0 0 0 255 0 255 0 0 -0 0 0 255 0 255 0 0 0 0 0 255 0 255 0 0 0 0 0 255 0 0 255 0 0 0 255 0 0 -0 0 0 0 255 0 0 0 0 0 255 0 0 0 0 0 0 255 0 0 0 0 0 0 255 0 0 0 0 0 0 255 -0 0 0 0 0 0 0 255 0 0 0 255 0 0 0 255 0 0 0 255 0 0 0 255 0 0 0 255 0 0 -255 0 0 0 0 255 255 0 0 255 0 0 0 0 255 0 0 0 255 0 0 0 0 255 0 0 0 255 -0 0 0 0 255 0 0 0 255 0 0 0 0 255 0 0 0 255 0 0 0 0 255 0 0 0 0 255 0 0 -0 255 0 0 0 255 0 0 0 0 255 0 0 0 255 0 0 0 255 0 0 0 255 0 0 0 255 0 0 -0 255 0 0 0 255 0 0 0 255 0 0 0 255 0 0 0 0 0 255 0 0 0 0 255 0 0 0 0 0 -0 255 0 0 0 255 0 0 0 0 0 0 0 0 0 0 0 127 255 0 0 0 0 0 255 0 255 0 0 0 -0 0 255 0 255 0 0 0 0 0 255 0 255 0 0 0 0 0 255 0 255 0 0 0 0 0 255 0 255 -0 0 0 0 0 255 0 255 0 0 0 0 255 255 255 255 255 0 0 0 255 255 255 255 0 -255 255 255 255 255 255 0 255 255 255 255 255 255 0 255 255 255 255 255 -255 0 255 255 255 255 255 255 0 255 255 255 0 255 255 255 0 255 255 255 -0 255 255 255 0 0 255 255 255 255 0 0 0 255 0 0 0 0 255 255 0 0 0 255 255 -255 255 0 0 0 0 0 255 255 255 255 0 0 0 0 0 255 255 255 255 0 0 0 0 0 255 -255 255 255 0 0 0 0 0 255 255 255 255 0 0 0 0 0 0 0 0 0 0 0 0 0 255 255 -255 255 255 0 0 0 0 0 255 255 255 0 0 0 0 0 255 255 255 0 0 0 0 0 255 255 -255 0 0 0 0 0 255 255 255 0 0 0 0 0 0 255 0 0 0 0 255 0 0 0 0 0 0 255 0 -255 255 0 0 0 0 0 0 0 0 0 0 0 0 127 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 255 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 255 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 127 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 255 255 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 127 127 127 127 127 127 -127 0 127 127 127 127 127 127 127 0 127 127 127 127 127 127 127 0 127 127 -127 127 127 127 127 0 127 127 127 127 127 127 127 0 127 127 127 127 127 -127 127 0 127 127 127 127 127 127 127 127 127 127 0 127 127 127 127 127 -127 0 127 127 127 127 127 127 0 127 127 127 127 127 127 0 127 127 127 127 -127 127 0 127 127 127 127 127 127 0 127 127 127 0 127 127 127 0 127 127 -127 0 127 127 127 0 127 127 127 127 127 127 127 0 127 127 127 127 127 127 -127 0 127 127 127 127 127 127 127 127 0 127 127 127 127 127 127 127 127 -0 127 127 127 127 127 127 127 127 0 127 127 127 127 127 127 127 127 0 127 -127 127 127 127 127 127 127 0 127 127 127 127 127 127 127 127 0 127 127 -127 127 127 127 127 127 0 127 127 127 127 127 127 127 0 127 127 127 127 -127 127 127 0 127 127 127 127 127 127 127 0 127 127 127 127 127 127 127 -0 127 127 127 127 127 127 127 0 127 127 127 127 127 127 0 127 127 127 127 -127 127 0 0 0 0 0 0 0 0 0 0 127 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 127 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 255 255 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 127 0 0 255 0 0 0 0 0 0 255 0 0 -0 0 255 255 0 0 0 255 255 0 255 0 0 0 0 0 0 0 0 255 0 0 255 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 255 0 0 0 0 0 0 0 255 0 0 0 0 0 255 255 0 0 -0 0 0 0 0 0 0 0 255 0 0 0 255 0 255 0 0 0 0 0 0 0 0 0 0 0 0 0 255 255 0 -255 0 0 255 0 0 0 0 0 0 0 0 0 255 0 0 0 0 255 255 0 0 0 0 0 255 255 0 255 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 255 0 0 0 0 0 0 0 -0 255 0 0 0 0 255 255 0 0 0 0 0 0 0 0 0 0 0 0 0 255 0 0 255 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 127 0 0 0 255 0 0 0 0 255 0 0 0 0 255 -0 0 255 0 255 0 255 255 0 0 0 255 0 0 255 0 0 255 0 0 255 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 255 0 0 0 0 0 255 0 0 0 0 0 255 0 0 255 0 0 -0 255 0 0 255 0 0 0 255 0 255 0 255 0 255 255 0 255 0 0 255 0 255 0 0 0 -255 0 255 255 0 0 0 0 255 0 0 0 0 0 0 0 255 0 0 0 0 255 0 0 255 0 0 0 255 -0 255 255 0 0 0 255 0 0 255 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -255 0 0 0 0 0 0 255 0 0 0 0 255 0 0 255 0 0 0 255 0 0 255 0 0 0 0 255 0 -0 0 255 0 0 0 0 0 0 0 255 0 0 255 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 127 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 255 255 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 255 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 255 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 255 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -127 0 255 255 255 0 0 0 255 255 255 0 0 0 255 255 255 0 0 0 255 255 255 -0 0 0 255 255 255 0 0 0 255 255 255 0 0 0 255 255 255 0 0 255 255 0 0 0 -0 255 255 255 255 0 0 255 255 255 255 0 0 0 255 255 255 255 0 0 0 255 255 -255 255 0 0 0 255 255 255 255 0 0 0 255 0 255 0 0 255 0 0 255 0 0 255 255 -0 255 0 0 255 0 255 255 255 0 0 0 255 255 255 255 0 0 0 255 255 255 255 -0 0 0 255 255 255 255 0 0 0 255 255 255 255 0 0 0 255 255 255 255 0 0 0 -0 0 0 255 0 0 0 0 0 0 255 255 255 255 0 0 255 0 0 0 0 255 0 255 0 0 0 0 -255 0 255 0 0 0 0 255 0 255 0 0 0 0 255 0 255 0 0 0 255 0 255 0 255 255 -255 0 0 255 0 0 0 255 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 127 0 0 0 0 255 0 0 0 0 0 -255 0 0 0 0 0 255 0 0 0 0 0 255 0 0 0 0 0 255 0 0 0 0 0 255 0 0 0 0 0 255 -255 0 0 255 0 0 255 0 0 0 0 0 255 0 0 0 0 255 0 255 0 0 0 0 255 0 255 0 -0 0 0 255 0 255 0 0 0 0 255 0 0 255 0 255 0 0 255 0 0 255 0 0 0 0 0 0 255 -0 255 255 0 0 0 255 0 255 0 0 0 0 255 0 255 0 0 0 0 255 0 255 0 0 0 0 255 -0 255 0 0 0 0 255 0 255 0 0 0 0 255 0 0 0 0 0 255 0 0 0 0 0 255 0 0 0 255 -0 0 255 0 0 0 0 255 0 255 0 0 0 0 255 0 255 0 0 0 0 255 0 255 0 0 0 0 255 -0 255 0 0 0 255 0 255 255 0 0 0 255 0 255 0 0 0 255 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 127 0 0 0 0 255 0 0 0 0 0 255 0 0 0 0 0 255 0 0 0 0 0 255 0 0 0 0 0 -255 0 0 0 0 0 255 0 0 0 0 0 255 0 0 0 0 255 0 255 0 0 0 0 0 255 0 0 0 0 -255 0 255 0 0 0 0 255 0 255 0 0 0 0 255 0 255 0 0 0 0 255 0 0 255 0 255 -0 0 255 0 0 255 0 0 255 255 255 255 255 0 255 0 0 0 0 255 0 255 0 0 0 0 -255 0 255 0 0 0 0 255 0 255 0 0 0 0 255 0 255 0 0 0 0 255 0 255 0 0 0 0 -255 0 0 0 0 0 0 0 0 0 0 255 0 0 0 255 0 255 0 255 0 0 0 0 255 0 255 0 0 -0 0 255 0 255 0 0 0 0 255 0 255 0 0 0 0 255 0 0 255 0 255 0 0 255 0 0 0 -0 255 0 0 255 0 255 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 127 0 255 255 255 255 0 0 -255 255 255 255 0 0 255 255 255 255 0 0 255 255 255 255 0 0 255 255 255 -255 0 0 255 255 255 255 0 0 255 255 255 255 255 255 255 255 255 0 255 0 -0 0 0 0 255 255 255 255 255 255 0 255 255 255 255 255 255 0 255 255 255 -255 255 255 0 255 255 255 255 255 255 0 0 255 0 255 0 0 255 0 0 255 0 255 -0 0 0 0 255 0 255 0 0 0 0 255 0 255 0 0 0 0 255 0 255 0 0 0 0 255 0 255 -0 0 0 0 255 0 255 0 0 0 0 255 0 255 0 0 0 0 255 0 0 255 255 255 255 255 -255 255 0 255 0 0 255 0 0 255 0 255 0 0 0 0 255 0 255 0 0 0 0 255 0 255 -0 0 0 0 255 0 255 0 0 0 0 255 0 0 255 0 255 0 0 255 0 0 0 0 255 0 0 255 -0 255 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 127 255 0 0 0 255 0 255 0 0 0 255 0 255 -0 0 0 255 0 255 0 0 0 255 0 255 0 0 0 255 0 255 0 0 0 255 0 255 0 0 0 255 -0 0 0 0 0 0 255 0 0 0 0 0 255 0 0 0 0 0 0 255 0 0 0 0 0 0 255 0 0 0 0 0 -0 255 0 0 0 0 0 0 0 255 0 255 0 0 255 0 0 255 0 255 0 0 0 0 255 0 255 0 -0 0 0 255 0 255 0 0 0 0 255 0 255 0 0 0 0 255 0 255 0 0 0 0 255 0 255 0 -0 0 0 255 0 255 0 0 0 0 255 0 0 0 0 0 0 0 0 0 0 255 0 255 0 0 0 255 0 255 -0 0 0 0 255 0 255 0 0 0 0 255 0 255 0 0 0 0 255 0 255 0 0 0 0 255 0 0 255 -0 255 0 0 255 0 0 0 0 255 0 0 255 0 255 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 127 255 -0 0 0 255 0 255 0 0 0 255 0 255 0 0 0 255 0 255 0 0 0 255 0 255 0 0 0 255 -0 255 0 0 0 255 0 255 0 0 0 255 255 0 0 0 255 0 255 0 0 0 0 0 255 0 0 0 -0 255 0 255 0 0 0 0 255 0 255 0 0 0 0 255 0 255 0 0 0 0 255 0 0 255 0 255 -0 0 255 0 0 255 0 255 0 0 0 0 255 0 255 0 0 0 0 255 0 255 0 0 0 0 255 0 -255 0 0 0 0 255 0 255 0 0 0 0 255 0 255 0 0 0 0 255 0 255 0 0 0 0 255 0 -0 0 0 0 255 0 0 0 0 0 255 0 0 0 255 0 0 255 0 0 0 255 255 0 255 0 0 0 255 -255 0 255 0 0 0 255 255 0 255 0 0 0 255 255 0 0 0 255 0 0 0 255 0 0 0 0 -255 0 0 0 255 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 127 0 255 255 255 255 0 0 255 -255 255 255 0 0 255 255 255 255 0 0 255 255 255 255 0 0 255 255 255 255 -0 0 255 255 255 255 0 0 255 255 255 0 0 255 255 255 0 0 0 255 255 255 255 -0 0 255 255 255 255 0 0 0 255 255 255 255 0 0 0 255 255 255 255 0 0 0 255 -255 255 255 0 0 0 255 0 255 0 0 255 0 0 255 0 0 255 255 255 255 0 0 255 -0 0 0 0 255 0 0 255 255 255 255 0 0 0 255 255 255 255 0 0 0 255 255 255 -255 0 0 0 255 255 255 255 0 0 0 255 255 255 255 0 0 0 0 0 0 255 0 0 0 0 -0 255 255 255 255 0 0 0 0 255 255 255 0 255 0 0 255 255 255 0 255 0 0 255 -255 255 0 255 0 0 255 255 255 0 255 0 0 0 255 0 0 0 255 255 255 255 255 -0 0 0 0 255 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 127 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -255 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 255 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 255 0 0 -0 255 0 0 0 0 0 0 0 0 255 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 127 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 255 255 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 255 0 0 0 0 255 0 0 0 0 0 0 0 255 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 127 -127 127 127 127 0 127 127 127 127 127 0 127 127 127 127 127 0 127 127 127 -127 127 0 127 127 127 127 127 0 127 127 127 127 127 0 127 127 127 127 127 -127 127 127 127 127 0 127 127 127 127 127 0 127 127 127 127 127 127 0 127 -127 127 127 127 127 0 127 127 127 127 127 127 0 127 127 127 127 127 127 -0 127 127 0 127 0 127 127 0 127 127 0 127 127 127 127 127 127 0 127 127 -127 127 127 127 0 127 127 127 127 127 127 0 127 127 127 127 127 127 0 127 -127 127 127 127 127 0 127 127 127 127 127 127 0 127 127 127 127 127 127 -0 127 127 127 127 127 127 127 127 0 127 127 127 127 127 127 127 0 127 127 -127 127 127 127 0 127 127 127 127 127 127 0 127 127 127 127 127 127 0 127 -127 127 127 127 127 0 127 127 127 127 127 0 127 127 127 127 127 127 0 127 -127 127 127 127 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 diff --git a/extern/AntTweakBar/src/res/FontNormalAA.pgm b/extern/AntTweakBar/src/res/FontNormalAA.pgm deleted file mode 100644 index bbf0a0f9..00000000 --- a/extern/AntTweakBar/src/res/FontNormalAA.pgm +++ /dev/null @@ -1,1012 +0,0 @@ -P2 -# Created by Paint Shop Pro -264 106 -255 -127 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 4 4 0 0 0 0 0 0 0 0 0 -0 0 0 4 4 0 0 0 0 0 0 0 0 127 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 4 4 0 0 0 0 0 0 0 0 0 0 0 0 4 4 0 0 0 0 0 0 0 0 127 0 0 0 0 0 0 0 0 -59 241 97 206 166 0 0 0 0 0 0 0 0 0 0 0 0 0 168 34 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 89 251 89 0 0 89 255 125 89 255 125 0 0 0 0 -7 199 34 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 138 166 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 4 4 0 0 0 -0 0 0 0 0 0 0 0 0 4 4 0 0 0 0 0 0 0 0 127 0 0 0 0 0 138 225 21 59 238 42 -206 125 0 0 0 0 7 199 34 89 166 0 0 0 0 168 34 0 0 0 175 255 255 166 0 -0 7 202 89 0 0 0 0 59 245 255 251 89 0 0 0 59 238 34 0 12 232 89 0 0 89 -247 34 0 59 245 206 199 124 255 125 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 7 202 89 0 12 235 255 247 34 0 0 0 0 12 232 89 0 0 12 235 -255 255 251 89 0 7 206 255 255 255 125 0 0 0 0 138 251 89 0 0 59 245 255 -255 255 251 89 0 0 89 255 255 166 0 89 255 255 255 255 255 201 0 0 59 245 -255 255 125 0 0 12 235 255 247 34 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 89 255 255 255 247 34 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 4 4 0 0 0 0 0 0 0 0 0 0 0 0 4 4 0 0 0 -0 0 0 0 0 127 0 0 0 0 0 138 225 21 59 238 34 175 125 0 0 0 0 59 192 0 172 -89 0 0 59 245 255 255 251 89 89 247 34 12 228 34 0 138 166 0 0 0 0 12 235 -125 0 175 225 21 0 0 59 238 34 0 138 201 0 0 0 0 175 166 0 0 0 89 255 201 -0 0 0 0 0 0 7 202 89 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 59 215 21 0 175 -166 0 138 201 0 0 7 206 255 251 89 0 0 59 192 0 0 138 247 34 59 192 0 0 -89 251 89 0 0 59 245 251 89 0 0 59 241 89 0 0 0 0 0 89 247 34 0 0 0 0 0 -0 0 7 206 166 0 7 206 125 0 89 247 34 7 206 166 0 138 225 21 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 12 232 89 0 0 0 0 0 0 0 0 0 0 0 175 166 0 0 0 0 0 -0 0 89 125 0 0 175 201 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 4 4 0 -0 0 0 0 0 0 0 0 0 0 0 4 4 0 0 0 0 0 0 0 0 127 0 0 0 0 0 138 225 21 12 206 -21 175 125 0 0 89 255 255 255 255 255 255 166 59 241 89 168 34 138 125 -89 225 21 7 202 89 12 228 34 0 0 0 0 12 232 89 0 138 201 0 0 0 12 206 21 -7 202 89 0 0 0 0 59 215 21 59 245 206 199 124 255 125 0 0 0 0 7 202 89 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 138 166 0 12 232 89 0 59 238 34 0 0 -0 59 241 89 0 0 0 0 0 0 59 241 89 0 0 0 0 59 241 89 0 12 232 132 241 89 -0 0 59 241 89 0 0 0 0 7 206 125 0 0 0 0 0 0 0 0 89 247 34 0 12 232 89 0 -12 232 89 59 241 89 0 59 241 89 0 138 247 34 0 0 138 247 34 0 0 0 0 0 12 -235 247 34 0 0 0 0 0 0 0 0 0 0 0 0 0 138 255 166 0 0 0 0 0 0 0 0 0 138 -225 21 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 4 4 0 0 0 0 0 0 0 0 0 0 -0 0 4 4 0 0 0 0 0 0 0 0 127 0 0 0 0 0 138 225 21 0 0 0 0 0 0 0 0 0 172 -89 59 192 0 0 59 238 34 168 34 0 0 89 247 34 12 228 34 138 166 0 0 0 0 -0 0 138 251 159 247 34 0 0 0 0 0 0 59 238 34 0 0 0 0 7 202 89 0 0 7 199 -34 0 0 0 0 0 0 7 202 89 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 7 202 89 0 59 -241 89 0 59 241 89 0 0 0 59 241 89 0 0 0 0 0 0 89 247 34 0 0 0 0 138 201 -0 7 206 125 59 241 89 0 0 59 245 255 255 251 89 0 12 235 255 255 255 125 -0 0 0 0 7 206 166 0 0 0 175 251 89 138 201 0 59 241 89 0 12 235 125 0 138 -247 34 0 0 138 247 34 0 0 0 59 245 247 34 0 0 0 0 7 206 255 255 255 255 -255 255 125 0 0 0 0 138 255 201 0 0 0 0 0 0 89 251 89 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 4 4 0 0 0 0 0 0 0 0 0 0 0 0 4 4 0 0 0 0 0 0 0 0 -127 0 0 0 0 0 138 201 0 0 0 0 0 0 0 0 0 12 206 21 138 125 0 0 7 206 255 -247 34 0 0 0 175 255 255 166 59 215 21 175 255 255 125 0 0 138 171 206 -166 0 175 201 0 0 0 0 89 201 0 0 0 0 0 0 175 125 0 0 0 0 0 0 0 0 12 235 -255 255 255 255 255 255 125 0 0 0 0 138 255 255 251 89 0 0 0 0 0 59 215 -21 0 59 241 89 0 59 241 89 0 0 0 59 241 89 0 0 0 0 0 12 235 166 0 0 0 138 -255 255 125 0 175 201 0 59 241 89 0 0 0 0 0 0 175 247 34 59 241 89 0 89 -247 34 0 0 0 89 247 34 0 0 0 89 255 255 255 125 0 12 235 166 0 59 245 125 -0 0 0 0 0 0 0 0 0 0 0 175 225 21 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 89 251 89 0 0 7 206 225 21 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 4 4 0 0 0 0 0 0 0 0 0 0 0 0 4 4 0 0 0 0 0 0 0 0 127 0 0 0 0 0 89 201 -0 0 0 0 0 0 0 12 235 255 255 255 255 255 225 21 0 0 0 175 255 251 89 0 -0 0 0 0 175 125 89 225 21 59 238 34 89 225 21 12 235 166 175 166 0 0 0 -0 89 201 0 0 0 0 0 0 175 125 0 0 0 0 0 0 0 0 0 0 0 7 202 89 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 138 166 0 0 59 241 89 0 59 241 89 0 0 0 59 241 89 -0 0 0 0 12 235 166 0 0 0 0 0 0 59 241 97 206 255 255 255 255 255 125 0 -0 0 0 0 59 241 89 59 238 34 0 12 235 125 0 0 12 235 125 0 0 0 12 232 89 -0 59 245 125 0 89 255 255 232 241 89 0 0 0 0 0 0 0 0 0 0 0 0 59 245 247 -34 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 138 255 201 0 0 0 0 7 206 125 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 4 4 0 0 0 0 0 0 0 0 0 0 0 0 4 -4 0 0 0 0 0 0 0 0 127 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 138 125 12 206 21 -0 0 0 0 0 168 34 175 166 0 0 0 0 59 215 21 138 201 0 12 228 34 138 225 -21 0 12 235 251 89 0 0 0 0 59 215 21 0 0 0 0 12 232 89 0 0 0 0 0 0 0 0 -0 0 0 7 202 89 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 7 202 89 0 0 12 232 89 0 -59 238 34 0 0 0 59 241 89 0 0 0 12 235 166 0 0 0 0 0 0 0 12 235 125 0 0 -0 59 241 89 0 0 0 0 0 0 59 241 89 12 232 89 0 12 232 89 0 0 138 225 21 -0 0 0 59 238 34 0 7 206 166 0 0 0 0 89 225 21 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 12 235 247 34 0 0 7 206 255 255 255 255 255 255 125 0 0 138 255 166 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 4 4 0 0 0 -0 0 0 0 0 0 0 0 0 4 4 0 0 0 0 0 0 0 0 127 0 0 0 0 0 138 225 21 0 0 0 0 -0 0 0 0 172 89 89 166 0 0 0 89 166 0 168 42 206 125 0 0 0 7 202 89 0 89 -225 21 59 238 34 89 251 89 0 0 175 255 201 0 0 0 0 7 202 89 0 0 0 0 59 -215 21 0 0 0 0 0 0 0 0 0 0 0 7 202 89 0 0 0 0 138 247 34 0 0 0 0 0 7 206 -201 0 12 228 34 0 0 0 175 166 0 138 201 0 0 0 0 59 241 89 0 0 12 235 166 -0 0 0 0 89 166 0 0 89 251 89 0 0 0 59 241 89 0 0 59 192 0 0 175 225 21 -0 175 201 0 138 225 21 0 12 235 125 0 0 0 0 12 235 166 0 59 241 89 0 0 -0 7 206 166 0 0 138 247 34 0 0 59 245 125 0 0 0 0 0 0 0 12 232 89 0 0 0 -0 0 0 0 0 0 0 0 175 166 0 0 0 0 0 0 0 0 7 206 166 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 4 4 0 0 0 0 0 0 0 0 0 0 0 0 4 4 0 0 0 0 0 0 0 0 -127 0 0 0 0 0 138 225 21 0 0 0 0 0 0 0 12 206 21 138 125 0 0 0 12 235 255 -255 255 166 0 0 0 0 138 201 0 0 0 175 255 255 125 0 0 138 255 255 255 125 -12 235 247 0 0 0 0 138 201 0 0 0 0 175 166 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 7 206 166 0 0 0 0 0 0 7 206 201 0 89 201 0 0 0 0 12 235 255 247 -34 0 0 7 206 255 255 255 225 21 89 255 255 255 255 255 166 59 245 255 255 -251 89 0 0 0 0 59 241 89 0 0 12 235 255 255 225 21 0 0 12 235 255 251 89 -0 0 175 225 21 0 0 0 0 0 59 245 255 255 125 0 0 89 255 255 166 0 0 0 138 -247 34 0 0 138 225 21 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 7 206 166 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 4 4 -0 0 0 0 0 0 0 0 0 0 0 0 4 4 0 0 0 0 0 0 0 0 127 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 168 34 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 12 232 89 0 0 59 238 34 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 59 241 89 0 0 0 0 0 0 0 0 0 0 175 125 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 7 206 125 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 4 4 0 0 0 0 0 0 0 0 0 0 0 0 -4 4 0 0 0 0 0 0 0 0 127 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 168 34 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 89 -255 125 89 255 125 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 89 201 0 0 0 0 -0 0 0 0 0 0 12 228 34 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 12 228 34 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 0 0 0 0 0 0 0 0 0 -127 127 127 127 0 127 127 0 127 127 127 127 127 0 127 127 127 127 127 127 -127 127 0 127 127 127 127 127 127 0 127 127 127 127 127 127 127 127 127 -127 127 127 0 127 127 127 127 127 127 127 127 0 127 127 0 127 127 127 127 -0 127 127 127 127 0 127 127 127 127 127 127 127 0 127 127 127 127 127 127 -127 127 0 127 127 127 0 127 127 127 127 0 127 127 127 0 127 127 127 127 -0 127 127 127 127 127 127 127 0 127 127 127 127 127 127 0 127 127 127 127 -127 127 0 127 127 127 127 127 127 0 127 127 127 127 127 127 127 0 127 127 -127 127 127 127 0 127 127 127 127 127 127 0 127 127 127 127 127 127 127 -0 127 127 127 127 127 127 0 127 127 127 127 127 127 0 127 127 127 127 0 -127 127 127 127 127 0 127 127 127 127 127 127 127 127 0 127 127 127 127 -127 127 127 127 127 0 127 127 127 127 127 127 127 127 0 127 127 127 127 -127 127 127 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 127 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 127 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 127 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 12 235 255 255 125 138 166 0 0 0 89 255 255 247 -34 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 127 0 0 0 89 255 255 -255 255 166 0 0 0 0 0 12 235 225 21 0 0 59 245 255 255 255 251 89 0 0 0 -59 245 255 255 251 89 59 245 255 255 255 247 34 0 0 59 245 255 255 255 -255 127 81 245 255 255 255 255 127 0 0 59 245 255 255 255 166 0 59 241 -89 0 0 0 59 241 89 89 255 255 255 125 7 206 255 251 89 59 241 89 0 0 89 -255 166 59 241 89 0 0 0 0 59 245 225 21 0 0 7 206 251 89 59 245 247 34 -0 0 59 241 89 0 0 138 255 255 255 166 0 0 59 245 255 255 255 225 21 0 0 -0 138 255 255 255 166 0 0 59 245 255 255 255 251 89 0 0 0 59 245 255 255 -201 89 255 255 255 255 255 255 255 125 59 241 89 0 0 0 59 241 97 206 166 -0 0 0 0 175 201 175 201 0 0 7 206 201 0 0 0 175 171 206 225 21 0 0 59 245 -166 245 125 0 0 0 89 251 89 89 255 255 255 255 255 127 0 228 34 0 0 59 -215 21 0 0 0 0 12 228 34 0 0 0 59 245 201 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 127 0 0 175 225 21 0 0 0 175 225 21 0 0 0 89 232 241 89 0 0 59 -241 89 0 0 138 225 21 0 89 255 125 0 0 59 192 59 241 89 0 0 175 251 89 -0 59 241 89 0 0 0 0 59 241 89 0 0 0 0 0 89 255 125 0 0 7 199 34 59 241 -89 0 0 0 59 241 89 0 59 241 89 0 0 0 59 241 89 59 241 89 0 59 241 89 0 -59 241 89 0 0 0 0 59 245 255 125 0 0 89 255 251 89 59 245 255 201 0 0 59 -241 89 0 138 251 89 0 12 235 166 0 59 241 89 0 7 206 225 21 0 138 251 89 -0 12 235 166 0 59 241 89 0 0 138 247 34 0 12 235 125 0 7 176 21 0 0 59 -241 89 0 0 0 59 241 89 0 0 0 59 241 89 138 225 21 0 0 12 235 125 89 225 -21 0 59 245 247 34 0 12 232 89 12 235 166 0 7 206 166 0 89 247 34 0 7 206 -125 0 0 0 0 0 7 206 166 12 228 34 0 0 7 202 89 0 0 0 0 12 228 34 0 0 12 -235 133 206 166 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 127 0 138 201 0 138 -255 255 255 125 138 166 0 0 7 206 166 175 166 0 0 59 241 89 0 0 89 247 -34 7 206 166 0 0 0 0 0 59 241 89 0 0 0 175 225 21 59 241 89 0 0 0 0 59 -241 89 0 0 0 0 7 206 166 0 0 0 0 0 0 59 241 89 0 0 0 59 241 89 0 59 241 -89 0 0 0 59 241 89 59 241 89 59 241 89 0 0 59 241 89 0 0 0 0 59 241 159 -225 21 0 175 166 241 89 59 241 132 241 89 0 59 241 89 12 235 166 0 0 0 -89 247 34 59 241 89 0 0 89 247 34 12 235 166 0 0 0 89 247 34 59 241 89 -0 0 59 241 89 0 59 238 34 0 0 0 0 0 0 59 241 89 0 0 0 59 241 89 0 0 0 59 -241 89 59 241 89 0 0 89 225 21 59 241 89 0 89 206 202 89 0 59 238 34 0 -89 251 89 138 225 21 0 0 175 201 0 138 225 21 0 0 0 0 0 175 225 21 12 228 -34 0 0 0 138 166 0 0 0 0 12 228 34 0 7 206 166 0 12 235 125 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 127 7 202 89 89 225 21 7 206 125 12 206 21 0 59 238 -34 89 247 34 0 59 241 89 0 0 175 201 0 59 241 89 0 0 0 0 0 59 241 89 0 -0 0 59 241 89 59 241 89 0 0 0 0 59 241 89 0 0 0 0 59 241 89 0 0 0 0 0 0 -59 241 89 0 0 0 59 241 89 0 59 241 89 0 0 0 59 241 89 59 241 102 232 89 -0 0 0 59 241 89 0 0 0 0 59 241 102 232 89 59 215 81 241 89 59 241 89 138 -225 21 59 241 89 59 241 89 0 0 0 59 241 89 59 241 89 0 7 206 201 0 59 241 -89 0 0 0 59 241 89 59 241 89 0 0 175 201 0 0 12 235 166 0 0 0 0 0 0 59 -241 89 0 0 0 59 241 89 0 0 0 59 241 89 7 206 166 0 0 175 166 0 7 206 125 -0 175 125 175 166 0 138 201 0 0 0 175 255 251 89 0 0 0 59 245 166 241 89 -0 0 0 0 0 89 247 34 0 12 228 34 0 0 0 89 201 0 0 0 0 12 228 34 12 235 201 -0 0 0 59 245 166 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 127 59 215 21 175 125 -0 7 206 125 7 199 34 0 138 201 0 12 235 125 0 59 245 255 255 255 247 34 -0 59 241 89 0 0 0 0 0 59 241 89 0 0 0 59 241 89 59 245 255 255 255 255 -127 59 245 255 255 255 255 127 59 241 89 0 0 0 0 0 0 59 245 255 255 255 -255 255 251 89 0 59 241 89 0 0 0 59 241 89 59 245 255 247 34 0 0 0 59 241 -89 0 0 0 0 59 241 89 138 201 175 166 59 241 89 59 241 89 12 235 125 59 -241 89 59 241 89 0 0 0 12 235 125 59 245 255 255 255 201 0 0 59 241 89 -0 0 0 12 235 125 59 245 255 255 255 125 0 0 0 0 59 245 255 255 125 0 0 -0 59 241 89 0 0 0 59 241 89 0 0 0 59 241 89 0 138 225 21 59 241 89 0 0 -175 201 7 202 89 89 201 0 175 166 0 0 0 12 235 166 0 0 0 0 0 138 255 166 -0 0 0 0 0 59 245 125 0 0 12 228 34 0 0 0 12 228 34 0 0 0 12 228 34 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 127 59 215 21 175 125 0 7 -206 125 7 199 34 7 206 125 0 0 175 201 0 59 241 89 0 0 89 247 34 59 241 -89 0 0 0 0 0 59 241 89 0 0 0 59 241 89 59 241 89 0 0 0 0 59 241 89 0 0 -0 0 59 241 89 0 59 245 255 251 89 59 241 89 0 0 0 59 241 89 0 59 241 89 -0 0 0 59 241 89 59 241 89 175 225 21 0 0 59 241 89 0 0 0 0 59 241 89 12 -235 247 34 59 241 89 59 241 89 0 89 247 94 241 89 59 241 89 0 0 0 59 241 -89 59 241 89 0 0 0 0 0 59 241 89 0 0 0 59 241 89 59 241 89 12 235 166 0 -0 0 0 0 0 0 138 251 89 0 0 59 241 89 0 0 0 59 241 89 0 0 0 59 241 89 0 -12 232 89 138 225 21 0 0 89 225 81 215 21 12 228 47 232 89 0 0 0 175 255 -251 89 0 0 0 0 59 241 89 0 0 0 0 7 206 201 0 0 0 12 228 34 0 0 0 0 175 -125 0 0 0 12 228 34 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 127 -12 228 34 89 201 0 7 206 125 59 215 21 59 245 255 255 255 255 247 34 59 -241 89 0 0 59 241 89 7 206 166 0 0 0 0 0 59 241 89 0 0 0 138 225 21 59 -241 89 0 0 0 0 59 241 89 0 0 0 0 7 206 166 0 0 0 59 241 89 59 241 89 0 -0 0 59 241 89 0 59 241 89 0 0 0 59 241 89 59 241 89 7 206 201 0 0 59 241 -89 0 0 0 0 59 241 89 0 175 166 0 59 241 89 59 241 89 0 7 206 200 241 89 -12 235 166 0 0 0 89 247 34 59 241 89 0 0 0 0 0 12 235 166 0 0 0 89 247 -34 59 241 89 0 59 245 125 0 0 0 0 0 0 12 232 89 0 0 59 241 89 0 0 0 12 -232 89 0 0 0 59 238 34 0 0 175 171 206 166 0 0 0 12 232 159 201 0 7 202 -132 215 21 0 0 89 247 34 175 225 21 0 0 0 59 241 89 0 0 0 0 138 225 21 -0 0 0 12 228 34 0 0 0 0 89 201 0 0 0 12 228 34 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 127 0 138 201 7 206 255 251 226 255 255 166 0 -138 201 0 0 0 12 235 125 59 241 89 0 0 138 247 34 0 89 255 125 0 0 59 192 -59 241 89 0 0 138 251 89 0 59 241 89 0 0 0 0 59 241 89 0 0 0 0 0 89 255 -125 0 0 59 241 89 59 241 89 0 0 0 59 241 89 0 59 241 89 0 0 0 89 247 34 -59 241 89 0 12 235 166 0 59 241 89 0 0 0 0 59 241 89 0 0 0 0 59 241 89 -59 241 89 0 0 59 245 251 89 0 138 251 89 0 59 245 166 0 59 241 89 0 0 0 -0 0 0 138 251 89 0 59 245 166 0 59 241 89 0 0 138 251 89 0 89 166 0 0 89 -247 34 0 0 59 241 89 0 0 0 0 138 225 21 0 7 206 166 0 0 0 89 255 251 89 -0 0 0 7 206 255 125 0 0 138 255 201 0 0 12 235 125 0 12 235 166 0 0 0 59 -241 89 0 0 0 89 251 89 0 0 0 0 12 228 34 0 0 0 0 12 228 34 0 0 12 228 34 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 127 0 7 206 225 21 0 -0 0 0 0 0 7 206 125 0 0 0 0 175 201 59 245 255 255 255 247 34 0 0 0 59 -245 255 255 251 89 59 245 255 255 255 225 21 0 0 59 245 255 255 255 255 -127 81 241 89 0 0 0 0 0 0 59 245 255 255 255 201 0 59 241 89 0 0 0 59 241 -89 89 255 255 255 138 235 255 255 125 0 59 241 89 0 0 89 255 201 59 245 -255 255 255 255 166 59 241 89 0 0 0 0 59 241 89 59 241 89 0 0 0 175 251 -89 0 0 138 255 255 255 166 0 0 59 241 89 0 0 0 0 0 0 0 138 255 255 255 -166 0 0 59 241 89 0 0 0 175 251 89 12 235 255 255 251 89 0 0 0 59 241 89 -0 0 0 0 0 59 245 255 251 89 0 0 0 0 12 235 201 0 0 0 0 0 138 251 89 0 0 -89 255 125 0 7 206 225 21 0 0 89 255 125 0 0 59 241 89 0 0 0 175 255 255 -255 255 255 127 0 228 34 0 0 0 0 0 175 125 0 0 12 228 34 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 127 0 0 0 89 255 255 255 255 125 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 59 241 89 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 12 -228 34 0 0 0 0 0 89 201 0 0 12 228 34 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 127 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 138 255 255 125 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 12 235 255 255 125 0 0 0 12 228 -124 255 255 247 34 0 0 0 0 0 0 0 0 0 245 255 255 255 255 255 255 0 0 0 -0 0 0 0 0 0 0 127 127 127 127 127 127 127 127 127 127 127 0 127 127 127 -127 127 127 127 0 127 127 127 127 127 127 127 0 127 127 127 127 127 127 -127 0 127 127 127 127 127 127 127 127 0 127 127 127 127 127 127 0 127 127 -127 127 127 127 0 127 127 127 127 127 127 127 127 0 127 127 127 127 127 -127 127 127 0 127 127 127 127 0 127 127 127 127 0 127 127 127 127 127 127 -127 0 127 127 127 127 127 127 0 127 127 127 127 127 127 127 127 127 0 127 -127 127 127 127 127 127 127 0 127 127 127 127 127 127 127 127 0 127 127 -127 127 127 127 127 0 127 127 127 127 127 127 127 127 0 127 127 127 127 -127 127 127 127 0 127 127 127 127 127 127 0 127 127 127 127 127 127 127 -0 127 127 127 127 127 127 127 127 0 127 127 127 127 127 127 127 0 127 127 -127 127 127 127 127 127 127 127 127 0 127 127 127 127 127 127 127 0 127 -127 127 127 127 127 127 0 127 127 127 127 127 127 0 127 127 127 127 0 127 -127 127 127 0 127 127 127 127 127 0 127 127 127 127 127 127 127 0 127 127 -127 127 127 127 0 0 0 0 0 0 0 0 0 0 127 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 127 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 4 4 4 4 4 4 4 4 4 4 4 4 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 127 0 89 255 125 0 0 0 0 0 0 0 0 0 0 59 241 89 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 59 241 89 0 0 0 0 0 0 0 0 89 255 255 166 0 0 0 0 0 -0 0 59 241 89 0 0 0 0 0 0 0 0 0 0 0 59 241 89 0 0 0 0 59 241 89 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 175 255 201 0 12 228 -34 0 0 89 255 247 34 0 0 0 0 0 0 0 0 0 0 0 0 0 4 4 4 4 4 4 4 4 4 116 116 -4 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 127 0 0 59 241 89 0 0 0 0 0 0 0 0 0 59 241 89 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 59 241 89 0 0 0 0 0 0 0 12 235 125 0 0 0 0 0 0 -0 0 0 59 241 89 0 0 0 0 59 241 89 0 89 251 89 59 241 89 0 0 0 0 59 241 -89 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 59 241 89 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 89 225 -21 0 0 12 228 34 0 0 0 0 138 201 0 0 0 0 0 0 0 0 0 0 0 0 0 4 4 4 4 4 4 -4 4 28 244 252 52 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 127 0 0 0 0 0 0 0 0 0 0 0 0 0 0 59 -241 89 0 0 0 0 0 0 0 0 0 0 0 0 0 0 59 241 89 0 0 0 0 0 0 0 59 241 89 0 -0 0 0 0 0 0 0 0 59 241 89 0 0 0 0 0 0 0 0 0 0 0 59 241 89 0 0 0 0 59 241 -89 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 59 241 89 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 138 166 -0 0 0 12 228 34 0 0 0 0 89 225 21 0 0 0 0 0 0 0 0 0 0 0 0 4 4 4 4 4 4 4 -4 180 252 164 4 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 127 0 0 0 0 0 0 0 7 206 255 255 255 -125 0 59 241 194 255 251 89 0 0 7 206 255 255 201 0 12 235 255 255 251 -89 0 12 235 255 251 89 7 206 255 255 247 34 0 12 235 255 255 251 89 59 -241 194 255 255 125 0 59 241 89 89 255 251 89 59 241 89 0 138 251 89 59 -241 89 59 241 159 255 255 125 89 255 255 166 0 59 241 194 255 255 125 0 -0 0 12 235 255 247 34 0 59 241 194 255 255 125 0 0 12 235 255 255 251 89 -59 241 159 255 201 0 138 255 255 247 34 206 255 255 255 166 59 241 89 0 -59 241 97 206 166 0 0 12 235 125 175 201 0 7 206 166 0 7 206 133 206 225 -21 0 89 255 255 166 0 0 12 235 125 138 255 255 255 255 166 0 0 138 166 -0 0 0 12 228 34 0 0 0 0 89 225 21 0 0 0 0 0 0 0 0 0 0 0 0 4 4 4 4 4 4 4 -76 252 244 20 4 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 127 0 0 0 0 0 0 0 0 0 0 0 89 247 34 -59 245 166 0 138 225 21 7 206 201 0 0 0 7 206 166 0 59 241 89 7 206 125 -0 89 225 21 59 241 89 0 0 7 206 166 0 59 241 89 59 245 166 0 89 247 34 -59 241 89 0 59 241 89 59 241 89 138 225 21 0 59 241 89 59 245 201 0 89 -255 201 0 89 247 34 59 245 166 0 89 247 34 0 7 206 166 0 138 225 21 59 -245 166 0 138 247 34 7 206 166 0 59 241 89 59 245 201 0 0 59 238 34 0 130 -34 59 241 89 0 0 59 241 89 0 59 241 89 89 247 34 0 89 247 34 138 225 21 -12 235 225 21 12 232 89 7 206 166 12 235 125 89 247 34 0 89 247 34 0 0 -0 89 247 34 0 0 138 166 0 0 0 12 228 34 0 0 0 0 89 225 21 0 0 7 206 247 -34 0 0 89 201 0 0 4 4 68 12 4 4 4 220 252 108 4 4 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 127 -0 0 0 0 0 0 0 0 0 0 0 59 241 89 59 241 89 0 59 241 89 59 241 89 0 0 0 59 -241 89 0 59 241 89 59 238 34 0 59 238 34 59 241 89 0 0 59 241 89 0 59 241 -89 59 241 89 0 59 241 89 59 241 89 0 59 241 89 59 241 159 201 0 0 0 59 -241 89 59 241 89 0 59 241 89 0 59 241 89 59 241 89 0 59 241 89 0 59 241 -89 0 59 241 89 59 241 89 0 59 241 89 59 241 89 0 59 241 89 59 241 89 0 -0 59 241 89 0 0 0 59 241 89 0 0 59 241 89 0 59 241 89 12 235 125 0 175 -166 0 59 238 34 89 171 202 89 89 225 21 0 59 241 226 201 0 12 235 125 0 -175 166 0 0 0 12 235 125 0 0 59 238 34 0 0 0 12 228 34 0 0 0 0 7 206 125 -0 7 202 89 12 235 166 0 175 125 0 0 4 60 244 172 4 4 132 252 212 4 4 4 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 127 0 0 0 0 0 0 0 0 89 255 255 255 251 89 59 241 89 -0 59 241 89 59 238 34 0 0 0 59 238 34 0 59 241 89 59 245 255 255 255 251 -0 59 241 89 0 0 59 238 34 0 59 241 89 59 241 89 0 59 241 89 59 241 89 0 -59 241 89 59 245 255 225 21 0 0 59 241 89 59 241 89 0 59 241 89 0 59 241 -89 59 241 89 0 59 241 89 0 59 238 34 0 12 232 89 59 241 89 0 12 232 89 -59 238 34 0 59 241 89 59 241 89 0 0 0 175 255 255 201 0 59 241 89 0 0 59 -241 89 0 59 241 89 0 175 201 12 232 89 0 7 206 125 172 89 138 166 138 201 -0 0 0 138 247 34 0 0 175 201 12 232 89 0 0 7 206 166 0 0 175 225 21 0 0 -0 0 12 228 34 0 0 0 0 0 0 175 225 34 206 21 0 0 175 255 166 0 0 0 4 52 -244 252 140 36 244 252 60 4 4 4 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 127 0 0 0 0 0 0 0 59 -241 89 0 59 241 89 59 241 89 0 59 238 34 59 241 89 0 0 0 59 241 89 0 59 -241 89 59 238 34 0 0 0 0 59 241 89 0 0 59 241 89 0 59 241 89 59 241 89 -0 59 241 89 59 241 89 0 59 241 89 59 241 97 206 201 0 0 59 241 89 59 241 -89 0 59 241 89 0 59 241 89 59 241 89 0 59 241 89 0 59 241 89 0 59 241 89 -59 241 89 0 59 241 89 59 241 89 0 59 241 89 59 241 89 0 0 0 0 0 59 245 -125 59 241 89 0 0 59 241 89 0 59 241 89 0 59 238 124 225 21 0 0 175 176 -206 21 59 215 187 125 0 0 59 245 255 201 0 0 89 247 124 225 21 0 0 138 -225 21 0 0 0 59 241 89 0 0 0 12 228 34 0 0 0 0 12 235 125 0 0 0 0 0 0 0 -0 0 0 0 0 4 4 76 252 252 220 252 164 4 4 4 4 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 127 0 -0 0 0 0 0 0 89 247 34 0 89 251 89 59 241 89 0 175 201 0 7 206 201 0 0 0 -7 206 166 0 138 251 89 7 206 166 0 7 199 34 59 241 89 0 0 7 206 166 0 138 -251 89 59 241 89 0 59 241 89 59 241 89 0 59 241 89 59 241 89 12 235 166 -0 59 241 89 59 241 89 0 59 241 89 0 59 241 89 59 241 89 0 59 241 89 0 7 -206 166 0 138 225 21 59 241 89 0 138 225 21 7 206 166 0 89 251 89 59 241 -89 0 0 89 125 0 12 232 89 12 232 89 0 12 12 235 125 0 175 251 89 0 7 206 -255 125 0 0 0 89 255 201 0 7 206 247 34 0 7 206 166 59 245 125 0 7 206 -255 125 0 0 59 241 89 0 0 0 0 0 138 166 0 0 0 12 228 34 0 0 0 0 89 225 -21 0 0 0 0 0 0 0 0 0 0 0 0 4 4 4 100 252 252 244 28 4 4 4 4 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 127 0 0 0 0 0 0 0 0 175 255 255 232 241 89 59 245 255 255 247 34 -0 0 12 235 255 255 201 0 59 245 255 200 241 89 0 12 235 255 251 89 0 59 -241 89 0 0 0 12 235 255 200 241 89 59 241 89 0 59 241 89 59 241 89 0 59 -241 89 59 241 89 0 59 245 201 59 241 89 59 241 89 0 59 241 89 0 59 241 -89 59 241 89 0 59 241 89 0 0 12 235 255 247 34 0 59 245 166 255 247 34 -0 0 59 245 255 166 241 89 59 241 89 0 0 59 245 255 255 166 0 0 138 255 -255 125 0 89 255 255 166 241 89 0 0 138 247 34 0 0 0 59 245 125 0 0 138 -225 21 7 206 225 21 0 138 251 0 0 138 247 34 0 0 175 255 255 255 255 166 -0 0 138 166 0 0 0 12 228 34 0 0 0 0 89 225 21 0 0 0 0 0 0 0 0 0 0 0 0 4 -4 4 4 132 252 108 4 4 4 4 4 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 127 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 138 225 21 0 0 0 0 0 0 0 0 0 0 0 89 247 34 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 59 241 89 0 0 0 0 0 -0 0 0 59 241 89 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 12 232 89 0 0 0 0 0 0 0 0 0 0 0 138 -201 0 0 0 12 228 34 0 0 0 0 138 201 0 0 0 0 0 0 0 0 0 0 0 0 0 4 4 4 4 4 -116 4 4 4 4 4 4 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 127 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 166 255 255 -247 34 0 0 0 0 0 0 0 0 0 0 0 255 255 125 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 59 241 89 0 0 0 0 0 0 0 0 59 -241 89 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 138 225 21 0 0 0 0 0 0 0 0 0 0 0 7 206 255 -201 0 12 228 34 0 0 89 255 251 89 0 0 0 0 0 0 0 0 0 0 0 0 0 4 4 4 4 4 4 -4 4 4 4 4 4 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 127 127 127 127 127 127 0 127 127 127 -127 127 127 0 127 127 127 127 127 127 0 127 127 127 127 127 0 127 127 127 -127 127 127 0 127 127 127 127 127 127 0 127 127 127 127 0 127 127 127 127 -127 127 0 127 127 127 127 127 127 0 127 127 0 127 127 127 0 127 127 127 -127 127 127 0 127 127 0 127 127 127 127 127 127 127 127 127 127 0 127 127 -127 127 127 127 127 0 127 127 127 127 127 127 0 127 127 127 127 127 127 -0 127 127 127 127 127 127 0 127 127 127 127 0 127 127 127 127 127 0 127 -127 127 127 0 127 127 127 127 127 127 0 127 127 127 127 127 127 0 127 127 -127 127 127 127 127 127 127 0 127 127 127 127 127 0 127 127 127 127 127 -127 0 127 127 127 127 127 0 127 127 127 127 127 127 0 127 127 127 0 127 -127 127 127 127 127 127 0 127 127 127 127 127 127 127 127 0 127 127 127 -127 127 127 127 127 127 127 127 127 127 127 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 127 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 89 247 34 138 201 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 12 235 125 59 238 34 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 127 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 89 255 -225 21 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -12 235 251 89 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 59 238 34 138 201 0 0 0 0 0 -0 0 0 0 127 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 7 199 34 0 0 0 0 0 7 199 34 0 0 0 0 138 255 -201 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 251 89 0 0 138 255 251 97 206 201 0 0 138 -251 102 235 201 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 89 255 -201 12 228 34 0 0 0 0 0 0 0 0 0 0 0 0 7 206 166 12 232 89 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 175 166 12 235 127 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 127 0 0 175 255 255 255 225 21 59 245 255 255 255 -255 255 125 0 0 0 0 0 0 0 7 206 255 247 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 7 199 34 0 0 0 0 0 7 199 34 0 0 0 138 225 21 175 166 0 0 175 255 255 -166 0 0 7 202 89 0 0 0 0 0 0 0 0 0 0 59 245 255 255 201 0 0 0 0 0 0 0 0 -59 245 255 255 255 255 255 255 255 255 125 0 59 245 255 255 255 255 255 -125 0 0 89 255 255 255 255 255 225 21 59 245 255 255 255 255 255 125 0 -0 0 59 245 255 255 255 255 255 125 7 206 166 0 0 175 171 206 166 89 247 -34 0 175 201 59 241 89 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -12 228 34 175 255 125 0 0 89 255 255 255 125 175 251 89 89 255 125 0 7 -206 255 125 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 59 245 255 255 255 -255 255 125 0 0 7 206 255 125 59 245 125 0 0 0 89 251 89 0 0 0 0 0 0 0 -127 7 206 225 21 0 0 0 0 59 115 0 0 0 0 59 115 0 0 0 0 0 0 0 175 201 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 59 245 255 255 255 255 125 0 59 245 255 -255 255 255 125 0 0 0 0 0 0 0 89 247 34 12 228 34 0 138 166 0 0 0 0 0 0 -0 0 0 0 12 235 125 0 7 176 21 0 0 0 0 0 0 138 251 89 0 0 138 201 0 0 0 -0 0 0 59 115 0 0 0 0 59 115 0 0 0 0 0 0 7 206 166 0 59 115 0 0 0 0 59 115 -0 0 0 59 115 0 0 0 0 59 115 0 89 201 0 12 232 89 89 201 7 202 89 12 232 -89 138 201 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 7 199 34 0 172 132 196 199 163 125 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 59 115 0 0 0 0 59 115 0 0 0 0 0 0 0 89 247 34 0 7 -206 125 0 0 0 0 0 0 0 0 127 89 247 34 0 0 0 0 0 59 115 0 0 0 0 59 115 0 -0 0 0 0 0 7 206 125 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 7 199 34 0 -0 0 0 0 7 199 34 0 0 0 0 0 0 0 0 0 89 225 21 7 202 89 12 228 34 0 0 0 0 -0 0 0 0 0 0 59 238 34 0 0 0 0 0 0 0 130 34 59 241 89 0 0 0 138 201 0 0 -0 0 0 0 59 115 0 0 0 0 59 115 0 0 0 0 0 0 175 225 21 0 59 115 0 0 0 0 59 -115 0 0 0 59 115 0 0 0 0 59 115 0 12 228 34 59 192 0 12 228 34 138 166 -59 215 21 175 125 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 7 199 34 0 172 89 175 166 138 125 0 138 255 255 247 34 12 -146 0 0 0 0 89 255 255 255 125 12 235 255 255 125 0 0 0 59 115 0 0 0 0 -59 115 0 138 255 255 255 255 127 0 175 201 0 138 225 21 0 0 0 0 0 0 0 0 -127 245 255 255 255 255 255 125 0 59 115 0 0 0 0 59 115 0 0 0 0 0 0 12 -232 89 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 7 199 34 0 0 0 0 0 7 199 -34 0 0 0 0 0 0 0 0 0 89 247 34 12 228 34 138 166 0 0 0 0 0 0 0 0 0 0 0 -12 235 166 0 0 0 0 0 0 175 225 21 138 225 21 0 0 0 138 201 0 0 0 0 0 0 -59 115 0 0 0 0 59 115 0 0 0 0 0 89 247 34 0 0 59 115 0 0 0 0 59 115 0 0 -0 59 115 0 0 0 0 59 115 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 138 255 166 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 7 199 34 0 172 -89 0 0 138 125 59 238 34 0 130 34 7 206 201 0 0 59 241 89 0 12 235 255 -125 0 59 241 89 0 0 59 115 0 0 0 0 59 115 0 0 0 0 89 247 34 0 59 245 166 -241 89 0 0 0 0 0 0 0 0 0 127 138 225 21 0 0 0 0 0 59 115 0 0 0 0 59 115 -0 0 0 0 0 89 255 255 255 247 34 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 7 199 -34 0 0 0 0 0 7 199 34 0 0 0 0 0 0 0 0 0 0 175 255 255 166 59 215 21 175 -255 255 125 0 89 255 255 201 0 0 0 59 245 255 255 125 0 12 235 166 0 0 -138 225 21 0 0 0 138 255 255 255 255 247 34 0 59 115 0 0 0 0 59 115 0 0 -0 0 59 245 125 0 0 0 59 115 0 0 0 0 59 115 0 0 0 59 115 0 0 0 0 59 115 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 59 245 255 251 102 0 255 255 255 255 -255 0 245 255 255 255 255 255 255 255 255 255 255 127 21 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 59 241 89 0 0 0 0 0 138 247 34 138 201 0 0 0 175 -201 0 0 0 175 166 0 0 59 115 0 0 0 0 59 115 0 0 0 12 235 125 0 0 0 138 -255 166 0 0 0 0 0 0 0 0 0 0 127 245 255 255 255 255 225 21 0 59 115 0 0 -0 0 59 115 0 0 0 0 0 0 89 225 21 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 7 199 34 0 0 0 59 245 255 255 255 255 125 0 0 0 0 0 0 0 0 0 0 0 0 175 -125 89 225 21 59 238 47 232 89 7 206 125 0 0 0 0 0 138 251 89 12 235 166 -0 0 138 225 21 0 0 0 138 201 0 0 0 0 0 0 59 115 0 0 0 0 59 115 0 0 0 7 -206 201 0 0 0 0 59 115 0 0 0 0 59 115 0 0 0 59 115 0 0 0 0 59 115 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 59 245 255 251 89 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 175 255 255 201 0 -0 0 138 247 34 175 201 0 0 0 138 255 255 255 255 255 166 0 0 59 115 0 0 -0 0 59 115 0 0 7 206 166 0 0 0 0 59 241 89 0 0 0 0 0 0 0 0 0 0 127 89 251 -89 0 0 0 0 0 59 115 0 0 0 0 59 115 0 0 0 0 0 0 138 201 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 7 199 34 0 0 0 0 0 7 199 34 0 0 0 0 0 0 0 0 0 -0 0 0 0 59 215 21 138 201 0 12 228 47 228 34 0 175 166 0 0 0 0 0 12 232 -89 0 0 175 225 21 59 241 89 0 0 0 138 201 0 0 0 0 0 0 59 115 0 0 0 0 59 -115 0 0 0 138 225 21 0 0 0 0 59 115 0 0 0 0 59 115 0 0 0 59 115 0 0 0 0 -59 115 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 138 255 166 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 59 -245 125 7 206 201 0 0 138 201 0 0 0 175 201 0 0 0 0 0 0 0 59 115 0 0 0 -0 59 115 0 0 138 225 21 0 0 0 0 59 241 89 0 0 0 0 0 0 0 0 0 0 127 7 206 -247 34 0 0 0 0 59 115 0 0 0 0 59 115 0 59 245 125 0 0 175 166 0 0 0 59 -245 125 175 225 29 206 166 0 89 247 34 7 206 166 0 0 0 7 199 34 0 0 0 0 -0 7 199 34 0 0 0 0 0 0 0 0 0 0 0 0 7 202 89 0 89 225 21 59 238 47 232 89 -7 206 125 0 89 166 0 0 89 247 34 0 0 0 130 34 0 138 255 125 0 0 138 201 -0 0 0 0 0 0 59 115 0 0 0 0 59 115 0 0 89 251 89 0 0 0 0 0 59 115 0 0 0 -0 59 115 0 0 0 59 115 0 0 0 0 59 115 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 89 125 0 12 232 89 12 146 0 0 0 59 241 89 0 12 235 247 -34 0 0 89 125 0 0 59 115 0 0 0 0 59 115 0 59 241 89 0 0 0 0 0 59 241 89 -0 0 0 0 0 0 0 0 0 0 127 0 0 175 255 255 255 225 21 59 245 255 255 255 255 -255 125 0 138 225 21 0 12 235 125 0 0 0 138 225 34 235 125 7 206 166 0 -89 247 34 7 206 166 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -138 201 0 0 0 175 255 255 125 0 89 255 255 201 0 0 12 235 255 255 251 89 -0 0 0 0 0 0 0 0 89 255 255 255 255 255 255 255 255 255 125 0 59 245 255 -255 255 255 255 125 0 0 175 255 255 255 255 255 247 34 59 245 255 255 255 -255 255 125 0 0 0 59 245 255 255 255 255 255 125 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 59 245 255 255 166 0 0 0 0 0 0 0 89 255 255 -255 125 59 245 255 255 201 0 0 0 59 245 255 255 255 255 255 125 0 175 255 -255 255 255 127 0 0 59 241 89 0 0 0 0 0 0 0 0 0 0 127 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 175 166 0 255 255 201 0 0 0 0 175 166 59 238 34 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 127 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 12 228 34 0 0 -0 0 0 0 0 12 228 34 138 166 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 127 127 127 -127 127 127 127 0 127 127 127 127 127 127 127 127 0 127 127 0 127 127 127 -127 127 127 0 127 127 127 127 127 0 127 127 127 127 127 127 127 127 127 -0 127 127 127 127 127 127 127 0 127 127 127 127 127 127 127 0 127 127 127 -127 127 0 127 127 127 127 127 127 127 127 127 127 127 127 127 127 127 127 -127 127 0 127 127 127 127 127 127 127 0 127 127 127 0 127 127 127 127 127 -127 127 127 127 127 127 127 127 0 127 127 127 127 127 127 127 127 127 0 -127 127 127 127 127 127 127 0 127 127 127 127 127 127 127 127 127 0 127 -127 127 127 127 127 127 127 127 0 127 127 0 127 127 0 127 127 127 127 0 -127 127 127 127 127 0 127 127 127 127 127 0 127 127 127 127 127 0 127 127 -127 127 127 127 127 127 127 127 127 0 127 127 127 127 127 127 127 0 127 -127 127 127 127 127 127 127 127 127 0 127 127 127 127 127 0 127 127 127 -127 0 127 127 127 127 127 127 127 127 127 127 127 127 0 127 127 127 127 -127 127 127 127 127 0 127 127 127 127 127 0 127 127 127 127 127 127 127 -0 0 0 0 0 0 0 0 127 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 127 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 245 255 255 255 255 255 -251 127 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 127 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 12 228 34 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 89 255 125 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 127 0 0 0 0 0 138 225 21 -0 0 0 138 125 0 0 0 0 59 245 255 255 125 0 0 0 0 0 0 0 0 138 225 21 0 0 -175 166 0 12 228 34 0 0 59 245 255 255 247 34 0 89 225 29 206 166 0 0 0 -0 0 89 255 255 255 255 125 0 0 0 7 206 255 255 247 34 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 89 255 255 255 255 125 0 0 0 0 0 0 0 -0 0 0 0 0 138 255 255 166 0 0 0 0 7 202 89 0 0 0 0 0 12 235 255 125 0 0 -175 255 255 225 21 0 0 0 12 235 125 0 0 0 0 0 0 0 0 0 0 0 138 255 255 255 -255 125 0 0 0 0 0 0 0 0 0 0 0 0 0 0 12 228 34 0 0 89 255 255 225 21 0 0 -0 0 0 0 0 0 0 0 0 138 166 0 0 0 89 225 21 0 0 0 0 0 138 166 0 0 0 89 225 -21 0 0 0 12 235 255 255 166 0 0 7 206 125 0 0 0 0 0 0 89 247 34 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 127 0 0 0 0 0 138 225 21 0 0 0 138 125 0 0 0 12 -235 125 0 59 115 0 0 0 0 0 0 0 0 7 206 125 0 59 215 21 0 12 228 34 0 12 -235 125 0 0 168 34 0 0 0 0 0 0 0 0 0 0 175 225 21 0 0 0 175 225 21 0 0 -0 0 0 138 166 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 175 225 -21 0 0 0 175 225 21 0 0 0 0 0 0 0 0 0 59 238 34 7 206 125 0 0 0 7 202 89 -0 0 0 0 7 199 34 59 238 34 0 0 0 7 202 89 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 89 255 255 255 125 175 125 0 0 0 0 0 0 0 0 0 0 0 0 0 138 255 247 34 0 -59 241 89 0 175 201 0 0 0 0 0 0 0 0 0 7 206 255 166 0 0 12 232 89 0 0 0 -0 7 206 255 166 0 0 12 232 89 0 0 0 0 0 0 0 59 215 21 0 89 201 0 0 0 0 -0 0 0 89 247 34 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 127 0 0 0 0 0 0 0 0 0 7 -206 255 255 251 89 0 59 241 89 0 0 0 138 201 0 0 0 138 201 0 0 89 225 21 -175 125 0 0 12 228 34 0 12 235 125 0 0 0 0 0 0 0 0 0 0 0 0 0 138 166 0 -89 255 255 247 34 89 201 0 0 89 255 255 255 166 0 0 0 0 168 34 7 151 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 138 166 7 206 255 255 225 21 89 201 0 0 0 -0 0 0 0 0 0 89 166 0 0 138 166 0 0 0 7 202 89 0 0 0 0 0 0 0 59 238 34 0 -7 206 255 125 0 0 0 0 0 0 0 0 0 59 238 34 0 0 175 166 0 175 255 255 255 -125 175 125 0 138 247 34 0 0 0 0 0 0 0 0 0 0 12 228 34 0 89 201 0 0 89 -225 0 81 115 0 134 89 0 0 0 0 0 138 166 0 0 138 166 0 0 0 0 0 0 0 138 166 -0 0 138 166 0 0 0 0 0 0 59 245 247 34 0 12 232 89 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 127 0 0 0 0 0 89 201 0 7 206 201 138 125 -138 125 0 59 241 89 0 0 0 0 175 255 255 255 225 21 0 0 7 206 166 215 21 -0 0 12 228 34 0 0 138 255 255 251 89 0 0 0 0 0 0 0 0 0 12 206 21 59 241 -89 0 134 89 0 172 89 59 238 34 0 138 166 0 0 7 206 201 12 235 125 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 12 206 21 7 202 89 12 235 125 0 172 89 0 0 0 0 -0 0 0 0 59 238 34 7 206 125 12 235 255 255 255 255 255 255 125 0 0 0 12 -235 125 0 0 0 0 7 206 125 0 0 0 0 0 0 0 0 59 238 34 0 0 175 166 0 175 255 -255 255 125 175 125 0 138 247 34 0 0 0 0 0 0 0 0 0 0 12 228 34 0 89 201 -0 0 89 225 0 29 206 166 59 245 125 0 0 0 0 138 166 0 12 228 34 0 175 225 -21 0 0 0 138 166 0 12 228 42 206 255 255 166 0 0 0 0 12 228 34 138 166 -0 89 247 34 0 0 0 0 59 238 34 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 127 0 0 0 -0 0 138 201 0 59 241 89 138 125 0 0 59 245 255 255 255 125 0 0 138 166 -0 89 201 0 0 0 0 89 255 125 0 0 0 0 0 0 0 7 206 125 0 138 251 89 0 0 0 -0 0 0 0 0 89 166 0 138 201 0 0 0 0 0 89 166 59 215 21 0 175 166 0 59 245 -125 89 251 89 0 0 12 235 255 255 255 255 255 255 125 138 255 255 251 89 -127 166 0 7 202 89 12 232 89 0 89 166 0 0 0 0 0 0 0 0 0 138 255 255 166 -0 0 0 0 7 202 89 0 0 0 0 0 59 241 89 0 0 0 0 0 7 206 125 0 0 0 0 0 0 0 -0 59 238 34 0 0 175 166 0 89 255 255 255 125 175 125 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 12 228 34 0 59 241 89 0 175 201 0 0 0 175 201 7 206 201 0 0 0 -138 166 0 175 166 0 138 200 215 21 0 0 0 138 166 0 175 166 7 151 0 89 247 -34 0 0 0 59 238 47 228 34 59 219 209 34 0 0 0 89 255 125 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 127 0 0 0 0 0 138 225 21 59 238 34 138 125 0 0 0 59 -241 89 0 0 0 0 138 166 0 89 201 0 0 59 245 255 255 255 255 125 0 0 0 0 -0 59 238 34 0 7 206 125 0 0 0 0 0 0 0 0 89 166 0 138 201 0 0 0 0 0 89 166 -0 175 255 255 223 166 0 12 235 125 59 241 89 0 0 0 0 0 0 0 0 0 175 125 -0 0 0 0 0 138 125 0 7 206 255 255 125 0 0 59 157 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 7 202 89 0 0 0 0 7 206 255 255 255 166 7 206 255 255 201 0 -0 0 0 0 0 0 0 0 59 238 34 0 0 175 166 0 0 89 255 255 125 175 125 0 0 0 -0 0 0 0 0 0 0 0 0 0 89 255 255 251 89 0 89 255 255 225 21 0 0 0 175 225 -29 206 166 0 0 0 138 166 59 215 21 59 215 81 215 21 0 0 0 138 166 59 215 -21 0 0 0 89 225 21 59 245 255 255 125 138 166 7 202 97 199 34 0 0 89 251 -89 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 127 0 0 0 0 0 138 225 21 59 241 -89 138 125 0 0 0 89 247 34 0 0 0 0 175 255 255 255 225 21 0 0 0 12 232 -89 0 0 0 12 228 34 0 12 235 225 21 59 215 21 0 0 0 0 0 0 0 0 12 206 21 -59 241 89 0 134 89 0 172 89 0 0 0 0 0 0 0 0 7 206 201 12 235 125 0 0 0 -0 0 0 0 0 175 125 0 0 0 0 0 12 206 21 7 202 89 7 206 125 0 172 89 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 7 202 89 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 59 238 34 0 0 175 166 0 0 0 0 175 125 175 125 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 7 206 166 59 245 125 0 0 0 0 0 0 -175 125 12 228 34 59 215 21 0 0 0 0 0 175 125 0 0 0 12 232 89 0 0 0 0 0 -59 238 34 175 125 7 199 34 0 0 175 201 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 127 0 0 0 0 0 138 225 21 7 206 201 138 125 138 125 7 202 89 0 0 0 -0 138 201 0 0 0 138 166 0 0 0 12 232 89 0 0 0 12 228 34 0 0 0 175 255 255 -166 0 0 0 0 0 0 0 0 0 0 138 166 0 89 255 255 247 34 89 201 0 0 0 0 0 0 -0 0 0 0 0 168 34 7 151 0 0 0 0 0 0 0 0 175 125 0 0 0 0 0 0 138 166 7 202 -89 0 89 247 124 201 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 12 235 255 255 255 255 -255 255 125 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 59 245 125 0 7 206 -166 0 0 0 0 175 125 175 125 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 59 115 0 134 89 0 0 0 0 0 0 59 215 21 59 245 255 255 255 225 21 0 -0 0 59 215 21 0 0 59 238 34 0 0 0 0 0 0 175 125 7 206 255 255 255 251 89 -0 138 247 34 0 59 157 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 127 0 0 0 0 0 138 225 -21 0 7 206 255 255 251 89 138 255 255 255 255 255 166 0 0 0 0 0 0 0 0 0 -0 12 232 89 0 0 0 12 228 34 0 0 0 0 0 59 241 89 0 0 0 0 0 0 0 0 0 0 175 -225 21 0 0 0 175 225 21 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 175 225 21 0 0 0 175 225 21 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 59 238 198 -255 251 194 166 0 0 0 0 175 125 175 125 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 7 206 125 0 0 0 0 89 225 21 0 0 0 -7 206 125 0 0 12 235 255 255 255 166 0 0 0 89 225 21 0 0 0 12 228 34 0 -0 0 175 255 255 255 166 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 127 0 0 0 0 0 0 0 -0 0 0 0 138 125 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 12 228 -34 0 7 176 21 0 89 247 34 0 0 0 0 0 0 0 0 0 0 0 89 255 255 255 255 125 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 89 -255 255 255 255 125 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 59 238 34 0 0 0 0 0 0 0 0 175 -125 175 125 0 0 0 0 0 0 0 0 59 215 21 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 127 0 0 0 0 -0 0 0 0 0 0 0 138 125 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -12 228 34 0 7 206 255 255 251 89 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 59 238 34 0 0 0 0 0 0 0 0 175 125 175 125 -0 0 0 0 0 0 59 245 251 89 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 127 127 127 0 127 127 -127 0 127 127 127 127 127 127 0 127 127 127 127 127 127 0 127 127 127 127 -127 127 127 0 127 127 127 127 127 127 127 0 127 127 127 0 127 127 127 127 -127 127 127 0 127 127 127 127 127 127 0 127 127 127 127 127 127 127 127 -127 127 127 0 127 127 127 127 127 127 0 127 127 127 127 127 127 127 0 127 -127 127 127 127 127 127 127 0 127 127 127 127 0 127 127 127 127 127 127 -127 127 127 127 127 0 127 127 127 127 127 127 127 0 127 127 127 127 127 -0 127 127 127 127 127 127 127 127 127 0 127 127 127 127 127 127 0 127 127 -127 127 127 127 0 127 127 127 127 127 0 127 127 127 127 127 127 127 0 127 -127 127 127 127 127 127 0 127 127 127 127 0 127 127 127 127 127 127 0 127 -127 127 127 0 127 127 127 127 127 127 0 127 127 127 127 127 127 127 0 127 -127 127 127 127 127 127 127 127 127 127 127 0 127 127 127 127 127 127 127 -127 127 127 127 127 0 127 127 127 127 127 127 127 127 127 127 127 127 0 -127 127 127 127 127 127 127 127 0 0 0 0 0 0 0 0 0 0 0 0 0 0 127 0 0 89 -255 125 0 0 0 0 0 0 12 235 201 0 0 0 0 12 235 251 89 0 0 0 0 175 255 125 -89 201 0 0 0 0 0 0 0 0 0 0 0 59 245 247 34 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 89 255 125 0 0 0 0 0 0 138 251 89 0 0 0 12 235 251 -89 0 0 0 0 0 0 0 0 7 206 225 21 0 0 0 89 255 125 0 89 255 225 21 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 12 235 247 34 172 89 0 0 0 0 7 206 225 21 0 0 -0 0 0 0 0 89 255 125 0 0 0 0 0 0 89 255 225 21 0 0 0 0 12 235 247 34 172 -89 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 89 -255 125 0 0 0 0 0 0 0 7 206 225 21 0 0 0 0 89 255 225 21 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 89 255 125 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 127 0 0 -0 89 247 34 0 0 0 0 0 175 166 0 0 0 0 7 206 125 59 241 89 0 0 89 201 12 -235 247 34 0 0 7 206 166 59 241 89 0 0 12 228 34 59 215 21 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 59 238 34 0 0 0 0 89 247 34 0 0 0 7 -206 125 59 241 89 0 7 206 166 59 238 34 0 0 175 166 0 0 59 241 89 0 89 -247 34 138 201 59 238 34 138 201 0 0 0 0 0 0 0 0 0 0 0 175 125 89 255 201 -0 0 0 0 0 0 0 175 201 0 0 0 0 0 0 12 232 89 0 0 0 0 0 0 59 238 34 138 225 -21 0 0 0 175 125 89 255 201 0 0 0 0 59 238 34 138 201 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 89 247 34 0 0 0 0 0 0 138 201 0 0 0 0 -0 59 238 34 138 225 21 0 0 0 59 238 34 138 201 0 0 0 0 12 232 89 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 127 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 12 228 34 59 215 21 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 12 235 255 255 125 0 -0 0 0 127 0 0 12 235 225 21 0 0 0 0 12 235 225 21 0 0 0 0 12 235 225 21 -0 0 0 0 12 235 225 21 0 0 0 0 12 235 225 21 0 0 0 0 12 235 225 21 0 0 0 -0 0 175 255 255 255 255 255 255 255 166 0 0 138 255 255 255 251 89 59 245 -255 255 255 255 127 81 245 255 255 255 255 225 21 59 245 255 255 255 255 -127 81 245 255 255 255 255 127 111 255 255 255 125 89 255 255 255 125 89 -255 255 255 125 89 255 255 255 125 7 206 255 255 255 255 125 0 0 59 245 -247 34 0 0 59 241 89 0 0 0 138 255 255 255 166 0 0 0 0 138 255 255 255 -166 0 0 0 0 0 138 255 255 255 166 0 0 0 0 138 255 255 255 166 0 0 0 0 138 -255 255 255 166 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 138 255 255 255 210 235 166 -59 241 89 0 0 0 59 241 89 59 241 89 0 0 0 59 241 89 59 241 89 0 0 0 59 -241 89 59 241 89 0 0 0 59 241 132 245 125 0 0 0 89 251 89 12 232 89 0 0 -0 0 7 206 166 0 89 251 89 0 0 0 127 0 0 89 232 241 89 0 0 0 0 89 232 241 -89 0 0 0 0 89 232 241 89 0 0 0 0 89 232 241 89 0 0 0 0 89 232 241 89 0 -0 0 0 89 232 241 89 0 0 0 0 12 232 89 89 225 21 0 0 0 0 0 175 247 34 0 -0 59 192 59 241 89 0 0 0 0 59 241 89 0 0 0 0 0 59 241 89 0 0 0 0 59 241 -89 0 0 0 0 0 59 241 89 0 0 59 241 89 0 0 59 241 89 0 0 59 241 89 0 7 206 -166 0 0 59 245 201 0 59 245 255 201 0 0 59 241 89 0 0 138 251 89 0 12 235 -166 0 0 138 251 89 0 12 235 166 0 0 0 138 251 89 0 12 235 166 0 0 138 251 -89 0 12 235 166 0 0 138 251 89 0 12 235 166 0 0 0 138 166 0 0 0 12 228 -34 0 0 175 247 34 0 0 175 225 21 59 241 89 0 0 0 59 241 89 59 241 89 0 -0 0 59 241 89 59 241 89 0 0 0 59 241 89 59 241 89 0 0 0 59 241 89 89 247 -34 0 7 206 125 0 12 232 89 0 0 0 0 59 241 89 0 12 232 89 0 0 0 127 0 7 -206 166 175 166 0 0 0 7 206 166 175 166 0 0 0 7 206 166 175 166 0 0 0 7 -206 166 175 166 0 0 0 7 206 166 175 166 0 0 0 0 175 166 175 166 0 0 0 0 -138 225 21 89 225 21 0 0 0 0 59 241 89 0 0 0 0 0 59 241 89 0 0 0 0 59 241 -89 0 0 0 0 0 59 241 89 0 0 0 0 59 241 89 0 0 0 0 0 59 241 89 0 0 59 241 -89 0 0 59 241 89 0 0 59 241 89 0 7 206 166 0 0 0 59 245 125 59 241 132 -241 89 0 59 241 89 0 12 235 166 0 0 0 89 247 34 12 235 166 0 0 0 89 247 -34 0 12 235 166 0 0 0 89 247 34 12 235 166 0 0 0 89 247 34 12 235 166 0 -0 0 89 247 34 0 0 12 235 125 0 12 235 125 0 0 59 241 89 0 0 138 176 235 -166 59 241 89 0 0 0 59 241 89 59 241 89 0 0 0 59 241 89 59 241 89 0 0 0 -59 241 89 59 241 89 0 0 0 59 241 89 0 175 201 0 138 225 21 0 12 235 255 -255 255 225 21 59 238 34 0 138 225 21 0 0 0 127 0 59 238 34 89 247 34 0 -0 59 238 34 89 247 34 0 0 59 238 34 89 247 34 0 0 59 238 34 89 247 34 0 -0 59 238 34 89 247 34 0 0 59 241 89 89 225 21 0 0 7 206 125 0 89 225 21 -0 0 0 0 138 225 21 0 0 0 0 0 59 241 89 0 0 0 0 59 241 89 0 0 0 0 0 59 241 -89 0 0 0 0 59 241 89 0 0 0 0 0 59 241 89 0 0 59 241 89 0 0 59 241 89 0 -0 59 241 89 0 7 206 166 0 0 0 7 206 166 59 241 89 138 225 21 59 241 89 -0 59 241 89 0 0 0 59 241 89 59 241 89 0 0 0 59 241 89 0 59 241 89 0 0 0 -59 241 89 59 241 89 0 0 0 59 241 89 59 241 89 0 0 0 59 241 89 0 0 0 12 -235 138 235 125 0 0 0 138 225 21 0 59 215 21 175 201 59 241 89 0 0 0 59 -241 89 59 241 89 0 0 0 59 241 89 59 241 89 0 0 0 59 241 89 59 241 89 0 -0 0 59 241 89 0 59 245 166 241 89 0 0 12 232 89 0 0 175 225 59 238 47 235 -225 21 0 0 0 0 127 0 138 201 0 12 235 125 0 0 138 201 0 12 235 125 0 0 -138 201 0 12 235 125 0 0 138 201 0 12 235 125 0 0 138 201 0 12 235 125 -0 0 138 225 21 12 235 125 0 0 89 247 34 0 89 255 255 255 255 251 89 138 -225 21 0 0 0 0 0 59 245 255 255 255 255 127 59 245 255 255 255 255 166 -0 59 245 255 255 255 255 127 59 245 255 255 255 255 127 0 59 241 89 0 0 -59 241 89 0 0 59 241 89 0 0 59 241 89 7 206 255 255 255 166 0 0 175 201 -59 241 89 12 235 125 59 241 89 0 59 241 89 0 0 0 12 235 125 59 241 89 0 -0 0 12 235 125 0 59 241 89 0 0 0 12 235 125 59 241 89 0 0 0 12 235 125 -59 241 89 0 0 0 12 235 125 0 0 0 0 12 235 125 0 0 0 0 138 225 21 7 199 -34 0 138 225 81 241 89 0 0 0 59 241 89 59 241 89 0 0 0 59 241 89 59 241 -89 0 0 0 59 241 89 59 241 89 0 0 0 59 241 89 0 0 138 255 166 0 0 0 12 232 -89 0 0 89 247 59 238 34 0 59 245 125 0 0 0 127 7 206 125 0 0 175 201 0 -7 206 125 0 0 175 201 0 7 206 125 0 0 175 201 0 7 206 125 0 0 175 201 0 -7 206 125 0 0 175 201 0 7 206 125 0 0 175 201 0 7 206 255 255 255 255 225 -21 0 0 0 0 138 225 21 0 0 0 0 0 59 241 89 0 0 0 0 59 241 89 0 0 0 0 0 59 -241 89 0 0 0 0 59 241 89 0 0 0 0 0 59 241 89 0 0 59 241 89 0 0 59 241 89 -0 0 59 241 89 0 7 206 166 0 0 0 7 206 166 59 241 89 0 89 247 94 241 89 -0 59 241 89 0 0 0 59 241 89 59 241 89 0 0 0 59 241 89 0 59 241 89 0 0 0 -59 241 89 59 241 89 0 0 0 59 241 89 59 241 89 0 0 0 59 241 89 0 0 0 12 -235 138 235 125 0 0 0 138 225 21 175 125 0 0 175 201 59 241 89 0 0 0 59 -241 89 59 241 89 0 0 0 59 241 89 59 241 89 0 0 0 59 241 89 59 241 89 0 -0 0 59 241 89 0 0 59 241 89 0 0 0 12 232 89 0 7 206 201 59 238 34 0 0 138 -201 0 0 0 127 59 245 255 255 255 255 247 34 59 245 255 255 255 255 247 -34 59 245 255 255 255 255 247 34 59 245 255 255 255 255 247 34 59 245 255 -255 255 255 247 34 59 245 255 255 255 255 247 34 59 241 89 0 0 89 225 21 -0 0 0 0 59 241 89 0 0 0 0 0 59 241 89 0 0 0 0 59 241 89 0 0 0 0 0 59 241 -89 0 0 0 0 59 241 89 0 0 0 0 0 59 241 89 0 0 59 241 89 0 0 59 241 89 0 -0 59 241 89 0 7 206 166 0 0 0 59 241 89 59 241 89 0 7 206 200 241 89 0 -12 235 166 0 0 0 89 247 34 12 235 166 0 0 0 89 247 34 0 12 235 166 0 0 -0 89 247 34 12 235 166 0 0 0 89 247 34 12 235 166 0 0 0 89 247 34 0 0 12 -235 125 0 12 235 125 0 0 59 241 159 166 0 0 12 235 166 12 232 89 0 0 0 -59 238 34 12 232 89 0 0 0 59 238 34 12 232 89 0 0 0 59 238 34 12 232 89 -0 0 0 59 238 34 0 0 59 241 89 0 0 0 12 235 255 255 255 201 0 59 238 34 -0 0 138 201 0 0 0 127 138 201 0 0 0 12 235 125 138 201 0 0 0 12 235 125 -138 201 0 0 0 12 235 125 138 201 0 0 0 12 235 125 138 201 0 0 0 12 235 -125 138 201 0 0 0 12 235 125 175 201 0 0 0 89 225 21 0 0 0 0 0 175 247 -34 0 0 59 192 59 241 89 0 0 0 0 59 241 89 0 0 0 0 0 59 241 89 0 0 0 0 59 -241 89 0 0 0 0 0 59 241 89 0 0 59 241 89 0 0 59 241 89 0 0 59 241 89 0 -7 206 166 0 0 59 245 201 0 59 241 89 0 0 59 245 251 89 0 0 138 251 89 0 -59 245 166 0 0 138 251 89 0 59 245 166 0 0 0 138 251 89 0 59 245 166 0 -0 138 251 89 0 59 245 166 0 0 138 251 89 0 59 245 166 0 0 0 138 166 0 0 -0 12 228 34 0 0 175 247 34 0 7 206 225 21 0 138 225 21 0 7 206 166 0 0 -138 225 21 0 7 206 166 0 0 138 225 21 0 7 206 166 0 0 138 225 21 0 7 206 -166 0 0 0 59 241 89 0 0 0 12 232 89 0 0 0 0 59 238 34 0 12 235 125 0 0 -0 127 206 125 0 0 0 0 175 206 206 125 0 0 0 0 175 206 206 125 0 0 0 0 175 -206 206 125 0 0 0 0 175 206 206 125 0 0 0 0 175 206 206 125 0 0 0 0 175 -232 245 125 0 0 0 89 255 255 255 255 255 166 0 0 138 255 255 255 251 89 -59 245 255 255 255 255 127 81 245 255 255 255 255 225 21 59 245 255 255 -255 255 127 81 245 255 255 255 255 127 111 255 255 255 125 89 255 255 255 -125 89 255 255 255 125 89 255 255 255 125 7 206 255 255 255 255 125 0 0 -59 241 89 0 0 0 175 251 89 0 0 0 138 255 255 255 166 0 0 0 0 138 255 255 -255 166 0 0 0 0 0 138 255 255 255 166 0 0 0 0 138 255 255 255 166 0 0 0 -0 138 255 255 255 166 0 0 0 0 0 0 0 0 0 0 0 0 0 7 202 194 255 255 255 201 -0 0 0 0 59 245 255 251 89 0 0 0 0 59 245 255 251 89 0 0 0 0 59 245 255 -251 89 0 0 0 0 59 245 255 251 89 0 0 0 0 59 241 89 0 0 0 12 232 89 0 0 -0 0 59 238 47 235 255 166 0 0 0 0 127 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 12 228 34 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 138 -166 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 127 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 12 235 255 166 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 127 127 127 127 127 127 127 0 127 127 127 -127 127 127 127 0 127 127 127 127 127 127 127 0 127 127 127 127 127 127 -127 0 127 127 127 127 127 127 127 0 127 127 127 127 127 127 127 0 127 127 -127 127 127 127 127 127 127 127 127 0 127 127 127 127 127 127 127 0 127 -127 127 127 127 127 0 127 127 127 127 127 127 127 0 127 127 127 127 127 -127 0 127 127 127 127 127 127 0 127 127 127 127 0 127 127 127 127 0 127 -127 127 127 0 127 127 127 127 0 127 127 127 127 127 127 127 127 0 127 127 -127 127 127 127 127 127 127 0 127 127 127 127 127 127 127 127 0 127 127 -127 127 127 127 127 127 127 0 127 127 127 127 127 127 127 127 0 127 127 -127 127 127 127 127 127 0 127 127 127 127 127 127 127 127 127 0 127 127 -127 127 127 127 127 127 127 0 127 127 127 127 127 127 127 127 0 127 127 -127 127 127 127 127 127 0 127 127 127 127 127 127 127 127 0 127 127 127 -127 127 127 127 127 0 127 127 127 127 127 127 127 127 0 127 127 127 127 -127 127 127 0 127 127 127 127 127 127 0 127 127 127 127 127 127 127 0 0 -0 127 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 127 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 12 235 255 201 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 127 0 7 206 -225 21 0 0 0 0 0 12 235 201 0 0 0 138 255 201 0 0 0 59 245 225 29 202 89 -0 0 0 0 0 0 0 0 138 166 7 202 89 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -7 206 225 21 0 0 0 0 0 12 235 201 0 0 0 89 255 225 21 0 0 0 0 0 0 0 0 175 -247 34 0 12 235 255 255 166 0 0 0 0 0 0 0 0 0 0 0 0 59 245 225 29 202 89 -0 0 138 251 89 0 0 0 0 0 7 206 225 21 0 0 0 89 255 225 21 0 0 59 245 225 -29 202 89 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 7 206 225 -21 0 0 0 0 0 89 255 125 0 0 0 89 255 225 21 0 0 0 0 0 0 0 0 0 0 0 0 138 -251 89 0 59 238 34 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 127 0 0 0 175 -166 0 0 0 0 7 206 166 0 0 0 89 225 21 175 201 0 7 202 89 138 255 166 0 -0 89 247 34 175 166 0 0 138 166 7 202 89 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 7 206 166 0 0 0 0 0 175 166 0 0 0 89 247 34 138 201 0 0 89 247 -34 175 201 0 0 138 201 0 175 200 215 34 235 247 47 232 0 138 255 225 111 -225 21 0 0 172 89 138 255 166 0 0 0 0 89 225 21 0 0 0 0 175 201 0 0 0 0 -89 247 34 138 201 0 0 172 89 138 255 166 0 0 59 238 34 138 201 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 175 166 0 0 0 0 59 241 89 0 0 0 89 -247 34 138 201 0 0 0 59 238 34 138 201 0 0 0 89 247 34 0 0 59 238 34 0 -0 0 0 0 138 225 29 206 166 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 127 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 12 235 255 201 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 7 206 225 21 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 12 235 166 0 0 0 0 0 0 0 0 89 166 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 59 238 34 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 127 7 206 255 255 255 125 0 7 206 255 255 255 -125 0 7 206 255 255 255 125 0 7 206 255 255 255 125 0 7 206 255 255 255 -125 0 12 235 255 255 251 89 0 12 235 255 255 251 89 59 245 255 166 0 0 -59 245 255 255 201 0 12 235 255 251 89 0 0 12 235 255 251 89 0 0 12 235 -255 251 89 0 0 12 235 255 251 89 0 59 238 34 59 238 34 59 238 34 59 238 -34 0 59 241 89 175 225 21 0 59 241 194 255 255 125 0 0 12 235 255 247 34 -0 0 12 235 255 247 34 0 0 0 12 235 255 247 34 0 0 12 235 255 247 34 0 0 -12 235 255 247 34 0 0 0 0 0 12 235 166 0 0 0 0 7 206 255 255 225 21 0 59 -241 89 0 59 241 89 59 241 89 0 59 241 89 59 241 89 0 59 241 89 0 59 241 -89 0 59 241 97 206 166 0 0 12 235 125 59 238 163 255 255 201 7 206 166 -0 0 12 235 125 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 127 0 0 0 0 89 247 34 0 0 0 0 89 247 -34 0 0 0 0 89 247 34 0 0 0 0 89 247 34 0 0 0 0 89 247 34 0 0 0 0 138 225 -21 0 0 0 0 89 255 225 21 0 138 201 59 245 125 0 0 0 7 206 125 0 89 225 -21 7 206 125 0 89 225 21 7 206 125 0 89 225 21 7 206 125 0 89 225 21 59 -238 34 59 238 34 59 238 34 59 238 34 0 0 0 0 12 235 125 0 59 245 166 0 -89 247 34 7 206 166 0 138 225 21 7 206 166 0 138 225 21 0 7 206 166 0 138 -225 21 7 206 166 0 138 225 21 7 206 166 0 138 225 21 0 0 0 0 0 0 0 0 0 -0 12 232 89 0 138 251 89 0 59 241 89 0 59 241 89 59 241 89 0 59 241 89 -59 241 89 0 59 241 89 0 59 241 89 0 59 241 89 89 247 34 0 89 247 34 59 -245 166 0 7 206 166 89 247 34 0 89 247 34 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 127 0 0 0 0 -59 241 89 0 0 0 0 59 241 89 0 0 0 0 59 241 89 0 0 0 0 59 241 89 0 0 0 0 -59 241 89 0 0 0 0 59 238 34 0 0 0 0 12 232 89 0 0 59 238 127 225 21 0 0 -0 59 238 34 0 59 238 34 59 238 34 0 59 238 34 59 238 34 0 59 238 34 59 -238 34 0 59 238 34 59 238 34 59 238 34 59 238 34 59 238 34 0 138 255 255 -255 255 201 0 59 241 89 0 59 241 89 59 241 89 0 59 241 89 59 241 89 0 59 -241 89 0 59 241 89 0 59 241 89 59 241 89 0 59 241 89 59 241 89 0 59 241 -89 0 12 235 255 255 255 255 255 255 166 138 201 0 59 157 175 201 0 59 241 -89 0 59 241 89 59 241 89 0 59 241 89 59 241 89 0 59 241 89 0 59 241 89 -0 59 241 89 12 235 125 0 175 166 0 59 238 34 0 0 138 225 34 235 125 0 175 -166 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 127 0 89 255 255 255 251 89 0 89 255 255 255 251 -89 0 89 255 255 255 251 89 0 89 255 255 255 251 89 0 89 255 255 255 251 -89 0 138 255 255 255 247 34 0 175 255 255 255 255 255 255 255 255 251 127 -201 0 0 0 0 59 245 255 255 255 251 89 59 245 255 255 255 251 89 59 245 -255 255 255 251 89 59 245 255 255 255 251 89 59 238 34 59 238 34 59 238 -34 59 238 34 138 247 34 0 0 138 201 0 59 241 89 0 59 241 89 59 238 34 0 -12 232 89 59 238 34 0 12 232 89 0 59 238 34 0 12 232 89 59 238 34 0 12 -232 89 59 238 34 0 12 232 89 0 0 0 0 0 0 0 0 0 0 175 201 7 176 21 138 201 -0 59 241 89 0 59 241 89 59 241 89 0 59 241 89 59 241 89 0 59 241 89 0 59 -241 89 0 59 241 89 0 175 201 12 232 89 0 59 238 34 0 0 138 225 21 175 201 -12 232 89 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 127 59 241 89 0 59 241 89 59 241 89 0 59 -241 89 59 241 89 0 59 241 89 59 241 89 0 59 241 89 59 241 89 0 59 241 89 -138 247 34 0 59 238 34 138 225 21 0 12 232 89 0 0 0 0 138 201 0 0 0 0 59 -238 34 0 0 0 0 59 238 34 0 0 0 0 59 238 34 0 0 0 0 59 238 34 0 0 0 0 59 -238 34 59 238 34 59 238 34 59 238 34 175 201 0 0 0 138 166 0 59 241 89 -0 59 241 89 59 241 89 0 59 241 89 59 241 89 0 59 241 89 0 59 241 89 0 59 -241 89 59 241 89 0 59 241 89 59 241 89 0 59 241 89 0 0 0 0 12 235 166 0 -0 0 138 201 134 89 0 175 166 0 59 241 89 0 59 241 89 59 241 89 0 59 241 -89 59 241 89 0 59 241 89 0 59 241 89 0 59 241 89 0 89 247 124 225 21 0 -59 238 34 0 0 138 201 0 89 247 124 225 21 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 127 89 247 -34 0 89 251 89 89 247 34 0 89 251 89 89 247 34 0 89 251 89 89 247 34 0 -89 251 89 89 247 34 0 89 251 89 175 201 0 0 175 247 34 175 201 0 0 59 245 -225 21 0 7 199 94 245 125 0 0 0 7 206 166 0 7 199 34 7 206 166 0 7 199 -34 7 206 166 0 7 199 34 7 206 166 0 7 199 34 59 238 34 59 238 34 59 238 -34 59 238 34 138 247 34 0 12 232 89 0 59 241 89 0 59 241 89 7 206 166 0 -138 225 21 7 206 166 0 138 225 21 0 7 206 166 0 138 225 21 7 206 166 0 -138 225 21 7 206 166 0 138 225 21 0 0 0 0 12 235 166 0 0 0 59 245 166 0 -59 241 89 0 12 235 125 0 175 251 89 12 235 125 0 175 251 89 12 235 125 -0 175 251 89 0 12 235 125 0 175 251 89 0 7 206 255 125 0 0 59 238 34 0 -12 235 125 0 7 206 255 125 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 127 0 175 255 255 232 -241 89 0 175 255 255 232 241 89 0 175 255 255 232 241 89 0 175 255 255 -232 241 89 0 175 255 255 232 241 89 12 235 255 255 166 238 34 12 235 255 -255 225 21 89 255 255 251 89 0 89 255 255 255 201 0 12 235 255 251 89 0 -0 12 235 255 251 89 0 0 12 235 255 251 89 0 0 12 235 255 251 89 0 59 238 -34 59 238 34 59 238 34 59 238 34 0 138 255 255 255 125 0 0 59 241 89 0 -59 241 89 0 12 235 255 247 34 0 0 12 235 255 247 34 0 0 0 12 235 255 247 -34 0 0 12 235 255 247 34 0 0 12 235 255 247 34 0 0 0 0 0 0 0 0 0 0 0 7 -206 255 255 225 21 0 0 0 89 255 255 166 241 89 0 89 255 255 166 241 89 -0 89 255 255 166 241 89 0 0 89 255 255 166 241 89 0 0 138 247 34 0 0 59 -245 166 255 255 166 0 0 0 138 247 34 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 127 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 59 215 34 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 138 125 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 12 232 89 0 0 0 59 238 34 0 0 0 0 0 -12 232 89 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 127 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 12 235 255 125 21 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 138 225 21 0 0 0 59 238 34 0 0 0 0 0 138 225 21 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 127 127 127 127 127 127 0 127 127 127 127 127 127 0 127 127 -127 127 127 127 0 127 127 127 127 127 127 0 127 127 127 127 127 127 0 127 -127 127 127 127 127 0 127 127 127 127 127 127 127 127 127 127 0 127 127 -127 127 127 0 127 127 127 127 127 127 0 127 127 127 127 127 127 0 127 127 -127 127 127 127 0 127 127 127 127 127 127 0 127 127 0 127 127 0 127 127 -0 127 127 0 127 127 127 127 127 127 127 0 127 127 127 127 127 127 0 127 -127 127 127 127 127 0 127 127 127 127 127 127 127 0 127 127 127 127 127 -127 0 127 127 127 127 127 127 0 127 127 127 127 127 127 127 0 127 127 127 -127 127 127 127 127 0 127 127 127 127 127 127 127 0 127 127 127 127 127 -127 0 127 127 127 127 127 127 0 127 127 127 127 127 127 127 0 127 127 127 -127 127 127 0 127 127 127 127 127 127 0 127 127 127 127 127 127 0 127 127 -127 127 127 127 127 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 diff --git a/extern/AntTweakBar/src/res/FontSmall.pgm b/extern/AntTweakBar/src/res/FontSmall.pgm deleted file mode 100644 index 23b1f896..00000000 --- a/extern/AntTweakBar/src/res/FontSmall.pgm +++ /dev/null @@ -1,603 +0,0 @@ -P2 -# Created by Paint Shop Pro -211 84 -255 -127 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 127 0 0 -0 0 0 0 255 0 255 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 255 0 0 0 255 255 0 0 0 0 0 255 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 255 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 127 -0 0 0 0 255 0 255 0 255 0 0 0 255 0 0 255 0 0 0 255 0 0 0 0 255 255 0 0 -0 255 0 0 0 0 255 255 0 0 0 255 0 0 255 0 0 255 0 0 255 0 255 0 255 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 255 0 0 255 255 0 0 0 255 0 0 255 255 -255 0 0 255 255 255 0 0 0 0 0 255 0 255 255 255 255 0 0 255 255 0 0 255 -255 255 255 0 0 255 255 0 0 0 255 255 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 255 255 255 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 127 0 0 0 0 255 0 255 0 255 0 0 0 255 0 0 255 0 0 255 255 255 255 -0 255 0 0 255 0 255 0 0 0 0 255 0 0 255 0 0 255 0 255 0 0 0 0 255 0 0 255 -255 255 0 0 0 0 0 255 0 0 0 0 0 0 0 0 0 0 0 0 0 255 0 0 255 0 0 255 0 255 -255 0 0 0 0 0 255 0 0 0 0 255 0 0 0 255 255 0 255 0 0 0 0 255 0 0 0 0 0 -0 0 255 0 255 0 0 255 0 255 0 0 255 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 255 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 127 -0 0 0 0 255 0 0 0 0 0 0 255 255 255 255 255 255 255 0 255 0 0 0 255 0 0 -255 0 255 0 0 0 0 255 0 0 255 0 0 0 0 255 0 0 0 0 255 0 255 0 255 0 255 -0 0 0 0 255 0 0 0 0 0 0 0 0 0 0 0 0 0 255 0 0 255 0 0 255 0 0 255 0 0 0 -0 0 255 0 0 0 0 255 0 0 255 0 255 0 255 0 0 0 0 255 0 0 0 0 0 0 255 0 0 -255 0 0 255 0 255 0 0 255 0 0 255 0 0 255 0 0 0 0 0 255 255 0 0 0 0 0 0 -0 0 0 255 255 0 0 0 0 0 0 0 255 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -127 0 0 0 0 255 0 0 0 0 0 0 0 255 0 255 0 0 0 255 255 0 0 0 0 255 255 0 -255 0 255 255 0 0 0 255 255 0 255 0 0 0 255 0 0 0 0 255 0 0 0 255 0 0 0 -0 255 255 255 255 255 0 0 0 0 0 0 0 0 0 0 0 255 0 0 255 0 0 255 0 0 255 -0 0 0 0 255 0 0 0 255 255 0 0 255 0 0 255 0 255 255 255 0 0 255 255 255 -0 0 0 0 255 0 0 0 255 255 0 0 0 255 255 255 0 0 255 0 0 255 0 0 0 255 255 -0 0 0 255 255 255 255 255 255 0 0 0 0 255 255 0 0 0 0 255 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 127 0 0 0 0 255 0 0 0 0 0 255 255 255 255 255 -255 0 0 0 255 255 0 0 0 0 0 255 0 255 0 0 255 0 255 0 0 255 0 0 0 0 255 -0 0 0 0 255 0 0 0 0 0 0 0 0 0 0 255 0 0 0 0 0 0 255 255 0 0 0 0 0 255 0 -0 255 0 0 255 0 0 255 0 0 0 255 0 0 0 0 0 0 255 0 255 255 255 255 255 0 -0 0 255 0 255 0 0 255 0 0 255 0 0 0 255 0 0 255 0 0 0 0 255 0 0 0 0 0 0 -0 0 255 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 255 0 0 255 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 127 0 0 0 0 0 0 0 0 0 0 0 255 0 0 255 0 0 0 0 -255 0 255 0 0 0 0 255 0 255 0 0 255 0 255 0 0 255 255 0 0 0 255 0 0 0 0 -255 0 0 0 0 0 0 0 0 0 0 255 0 0 0 0 255 0 0 0 0 0 255 0 0 255 0 0 255 0 -0 255 0 0 255 0 0 255 0 0 0 0 0 0 0 255 0 0 0 0 255 0 0 0 0 255 0 255 0 -0 255 0 0 255 0 0 0 255 0 0 255 0 0 0 0 255 0 0 255 0 0 255 0 0 0 255 255 -0 0 0 255 255 255 255 255 255 0 0 0 0 255 255 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 127 0 0 0 0 255 0 0 0 0 0 0 255 0 0 255 0 0 255 -255 255 255 0 0 0 0 255 0 0 0 255 255 0 0 0 255 255 0 0 255 0 0 255 0 0 -0 0 255 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 255 0 0 0 0 0 255 0 255 0 0 0 0 255 -255 0 0 255 255 255 0 255 255 255 255 0 255 255 255 0 0 0 0 0 255 0 255 -255 255 0 0 0 255 255 0 0 255 0 0 0 0 0 255 255 0 0 0 255 255 0 0 0 255 -0 0 255 0 0 0 0 0 255 255 0 0 0 0 0 0 0 0 0 255 255 0 0 0 0 0 255 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 127 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 255 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 255 0 0 255 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 255 0 0 0 0 0 0 0 0 255 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 255 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 127 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 255 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 255 255 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 127 127 127 0 127 0 127 127 127 -0 127 127 127 127 127 127 0 127 127 127 127 127 0 127 127 127 127 127 127 -127 127 127 0 127 127 127 127 127 0 127 0 127 127 0 127 127 127 0 127 127 -127 127 127 0 127 127 127 127 127 127 0 127 127 0 127 127 127 0 127 0 127 -127 127 0 127 127 127 127 0 127 127 127 0 127 127 127 127 0 127 127 127 -127 0 127 127 127 127 0 127 127 127 127 0 127 127 127 127 0 127 127 127 -127 0 127 127 127 127 0 127 127 127 127 0 127 127 0 127 127 0 127 127 127 -127 127 127 0 127 127 127 127 127 127 0 127 127 127 127 127 127 0 127 127 -127 127 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 127 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 127 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 255 255 0 255 0 0 0 255 255 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 127 0 0 255 255 255 0 0 0 0 0 -255 255 0 0 0 255 255 255 0 0 0 0 0 255 255 255 0 0 255 255 255 255 0 0 -0 255 255 255 255 255 0 255 255 255 255 255 0 0 0 255 255 255 0 0 255 0 -0 0 0 255 0 255 255 255 0 0 255 255 0 255 0 0 0 255 0 255 0 0 0 255 255 -0 0 0 255 255 0 255 0 0 0 0 255 0 0 0 255 255 255 0 0 0 255 255 255 255 -0 0 0 0 255 255 255 0 0 0 255 255 255 255 0 0 0 255 255 255 255 0 255 255 -255 255 255 0 255 0 0 0 0 255 0 255 0 0 0 0 255 0 255 0 0 255 0 0 255 0 -255 0 0 255 0 255 0 0 0 255 0 255 255 255 255 0 255 0 0 255 0 0 0 0 255 -0 0 0 255 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 127 0 255 0 -0 0 255 0 0 0 0 255 255 0 0 0 255 0 0 255 0 0 0 255 0 0 0 255 0 255 0 0 -0 255 0 0 255 0 0 0 0 0 255 0 0 0 0 0 0 255 0 0 0 255 0 255 0 0 0 0 255 -0 0 255 0 0 0 0 255 0 255 0 0 255 0 0 255 0 0 0 255 255 0 0 0 255 255 0 -255 255 0 0 0 255 0 0 255 0 0 0 255 0 0 255 0 0 0 255 0 0 255 0 0 0 255 -0 0 255 0 0 0 255 0 255 0 0 0 0 0 0 0 255 0 0 0 255 0 0 0 0 255 0 255 0 -0 0 0 255 0 255 0 0 255 0 0 255 0 255 0 0 255 0 0 255 0 255 0 0 0 0 0 255 -0 255 0 0 0 255 0 0 0 255 0 0 255 0 255 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 127 255 0 0 255 255 0 255 0 0 255 0 0 255 0 0 255 0 0 255 -0 0 255 0 0 0 0 0 0 255 0 0 0 0 255 0 255 0 0 0 0 0 255 0 0 0 0 0 255 0 -0 0 0 0 0 255 0 0 0 0 255 0 0 255 0 0 0 0 255 0 255 0 255 0 0 0 255 0 0 -0 255 0 255 0 255 0 255 0 255 0 255 0 0 255 0 255 0 0 0 0 0 255 0 255 0 -0 0 255 0 255 0 0 0 0 0 255 0 255 0 0 0 255 0 255 0 0 0 0 0 0 0 255 0 0 -0 255 0 0 0 0 255 0 255 0 0 0 0 255 0 255 0 255 0 255 0 255 0 0 255 255 -0 0 0 255 0 255 0 0 0 0 255 0 0 255 0 0 0 255 0 0 0 255 0 255 0 0 0 255 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 127 255 0 255 0 255 0 255 -0 0 255 0 0 255 0 0 255 255 255 255 0 0 255 0 0 0 0 0 0 255 0 0 0 0 255 -0 255 255 255 255 0 0 255 255 255 255 0 0 255 0 0 255 255 255 0 255 255 -255 255 255 255 0 0 255 0 0 0 0 255 0 255 255 0 0 0 0 255 0 0 0 255 0 255 -0 255 0 255 0 255 0 0 255 0 255 0 255 0 0 0 0 0 255 0 255 0 0 0 255 0 255 -0 0 0 0 0 255 0 255 255 255 255 0 0 0 255 255 255 0 0 0 0 255 0 0 0 255 -0 0 0 0 255 0 0 255 0 0 255 0 0 255 0 255 0 255 0 255 0 0 255 255 0 0 0 -0 255 0 0 0 0 255 0 0 0 255 0 0 0 255 0 0 0 255 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 127 255 0 255 0 255 0 255 0 255 255 255 -255 255 255 0 255 0 0 0 255 0 255 0 0 0 0 0 0 255 0 0 0 0 255 0 255 0 0 -0 0 0 255 0 0 0 0 0 255 0 0 0 0 255 0 255 0 0 0 0 255 0 0 255 0 0 0 0 255 -0 255 0 255 0 0 0 255 0 0 0 255 0 0 255 0 0 255 0 255 0 0 0 255 255 0 255 -0 0 0 0 0 255 0 255 255 255 255 0 0 255 0 0 0 0 0 255 0 255 0 255 0 0 0 -0 0 0 0 255 0 0 0 255 0 0 0 255 0 0 0 0 255 0 0 255 0 0 255 0 0 255 0 255 -0 255 0 255 0 0 255 255 0 0 0 0 255 0 0 0 0 255 0 0 0 255 0 0 0 255 0 0 -0 255 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 127 255 -0 0 255 255 255 0 0 255 0 0 0 0 255 0 255 0 0 0 255 0 0 255 0 0 0 255 0 -255 0 0 0 255 0 0 255 0 0 0 0 0 255 0 0 0 0 0 0 255 0 0 0 255 0 255 0 0 -0 0 255 0 0 255 0 0 0 0 255 0 255 0 0 255 0 0 255 0 0 0 255 0 0 255 0 0 -255 0 255 0 0 0 0 255 0 0 255 0 0 0 255 0 0 255 0 0 0 0 0 0 255 0 0 0 255 -0 0 255 0 0 255 0 0 0 0 0 0 255 0 0 0 255 0 0 0 255 0 0 0 0 255 0 0 0 255 -255 0 0 0 0 255 0 0 0 255 0 0 255 0 0 255 0 0 0 255 0 0 0 255 0 0 0 0 255 -0 0 0 255 0 0 0 255 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 127 0 255 0 0 0 0 0 0 255 0 0 0 0 255 0 255 255 255 255 0 0 0 0 255 -255 255 0 0 255 255 255 255 0 0 0 255 255 255 255 255 0 255 0 0 0 0 0 0 -0 255 255 255 255 0 255 0 0 0 0 255 0 255 255 255 0 255 255 0 0 255 0 0 -0 255 0 255 255 255 255 255 0 0 0 0 0 255 0 255 0 0 0 0 255 0 0 0 255 255 -255 0 0 0 255 0 0 0 0 0 0 0 255 255 255 0 0 0 255 0 0 0 255 0 255 255 255 -255 0 0 0 0 255 0 0 0 0 255 255 255 255 0 0 0 0 255 255 0 0 0 0 255 0 0 -0 255 0 0 255 0 0 255 0 0 0 255 0 0 0 255 255 255 255 0 255 0 0 0 0 255 -0 0 255 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 127 0 -0 255 255 255 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 255 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 255 0 0 0 -0 255 0 0 255 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -127 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 255 255 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 255 255 -0 0 0 0 0 255 255 0 0 0 0 0 0 0 255 255 255 255 255 255 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 127 127 127 127 127 127 127 0 127 127 127 127 127 127 -0 127 127 127 127 127 0 127 127 127 127 127 127 0 127 127 127 127 127 127 -0 127 127 127 127 127 0 127 127 127 127 127 0 127 127 127 127 127 127 0 -127 127 127 127 127 127 0 127 127 127 0 127 127 127 0 127 127 127 127 127 -0 127 127 127 0 127 127 127 127 127 127 127 0 127 127 127 127 127 127 0 -127 127 127 127 127 127 127 0 127 127 127 127 127 0 127 127 127 127 127 -127 127 0 127 127 127 127 127 0 127 127 127 127 127 0 127 127 127 127 127 -0 127 127 127 127 127 127 0 127 127 127 127 127 127 0 127 127 127 127 127 -127 127 0 127 127 127 127 0 127 127 127 127 127 0 127 127 127 127 0 127 -127 0 127 127 127 0 127 127 0 127 127 127 127 127 0 127 127 127 127 127 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 127 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 127 255 0 0 0 0 0 0 0 0 255 0 0 0 0 0 0 0 0 0 -0 0 255 0 0 0 0 0 0 0 255 255 0 0 0 0 0 255 0 0 0 0 0 0 0 0 0 255 0 0 0 -0 255 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 255 0 0 255 0 0 255 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 127 0 255 0 0 0 0 0 0 0 255 0 0 -0 0 0 0 0 0 0 0 0 255 0 0 0 0 0 0 255 0 0 0 0 0 0 0 255 0 0 0 0 255 0 0 -255 0 255 0 0 0 0 255 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 255 0 0 0 255 0 0 0 255 0 0 0 0 0 0 0 0 0 0 4 4 -4 4 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 127 0 0 0 0 0 0 -0 0 0 255 0 0 0 0 0 0 0 0 0 0 0 255 0 0 0 0 0 0 255 0 0 0 0 0 0 0 255 0 -0 0 0 0 0 0 0 0 255 0 0 0 0 255 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 255 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 255 0 0 0 255 0 0 0 255 0 0 0 0 0 0 -0 0 0 0 4 4 4 4 12 0 255 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -127 0 0 0 0 0 255 255 0 0 255 255 255 0 0 0 255 255 0 0 255 255 255 0 0 -255 255 0 0 255 255 255 0 255 255 255 0 255 255 255 0 0 255 0 255 255 0 -255 0 0 255 0 255 0 255 255 255 0 255 255 0 0 255 255 255 0 0 0 255 255 -0 0 255 255 255 0 0 0 255 255 255 0 255 0 255 255 255 255 0 255 255 0 255 -0 0 255 0 255 0 0 0 255 0 255 0 0 255 0 0 255 0 255 0 255 0 255 0 0 0 255 -0 255 255 255 0 0 255 0 0 0 255 0 0 0 255 0 0 0 0 0 0 0 0 0 0 4 4 4 4 0 -255 255 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 127 0 0 0 0 0 0 0 -255 0 255 0 0 255 0 255 0 0 0 255 0 0 255 0 255 0 0 255 0 255 0 0 255 0 -0 255 0 255 0 0 255 0 255 0 0 255 0 255 0 255 0 0 255 0 255 0 0 255 0 0 -255 0 255 0 0 255 0 255 0 0 255 0 255 0 0 255 0 255 0 0 255 0 255 255 0 -255 0 0 0 255 0 0 255 0 0 255 0 0 255 0 255 0 0 255 0 0 255 0 0 255 0 0 -255 0 0 0 255 0 255 0 0 0 0 255 0 0 255 0 0 0 255 0 0 0 255 0 0 0 255 255 -0 0 255 0 0 255 4 4 0 255 255 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 127 0 0 0 0 0 255 255 255 0 255 0 0 255 0 255 0 0 0 255 0 0 255 0 -255 255 255 255 0 255 0 0 255 0 0 255 0 255 0 0 255 0 255 0 0 255 0 255 -255 0 0 0 255 0 255 0 0 255 0 0 255 0 255 0 0 255 0 255 0 0 255 0 255 0 -0 255 0 255 0 0 255 0 255 0 0 0 255 0 0 255 0 0 255 0 0 255 0 0 255 0 255 -0 0 255 0 255 0 255 0 255 0 0 255 0 0 0 255 0 255 0 0 0 255 0 0 255 0 0 -0 0 255 0 0 0 0 255 0 255 0 0 255 255 0 0 0 255 255 4 255 255 0 4 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 127 0 0 0 0 255 0 0 255 0 255 0 -0 255 0 255 0 0 0 255 0 0 255 0 255 0 0 0 0 255 0 0 255 0 0 255 0 255 0 -0 255 0 255 0 0 255 0 255 0 255 0 0 255 0 255 0 0 255 0 0 255 0 255 0 0 -255 0 255 0 0 255 0 255 0 0 255 0 255 0 0 255 0 255 0 0 0 0 255 0 255 0 -0 255 0 0 255 0 0 255 0 255 0 0 0 255 255 0 255 255 0 0 0 255 0 0 0 255 -0 255 0 0 255 0 0 0 0 255 0 0 0 255 0 0 0 255 0 0 0 0 0 0 0 0 0 0 0 255 -255 255 0 4 4 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 127 0 0 0 0 -0 255 255 255 0 255 255 255 0 0 0 255 255 0 0 255 255 255 0 0 255 255 255 -0 255 0 0 0 255 255 255 0 255 0 0 255 0 255 0 0 255 0 255 0 0 255 0 255 -0 255 0 0 255 0 0 255 0 255 0 0 255 0 0 255 255 0 0 255 255 255 0 0 0 255 -255 255 0 255 0 0 255 255 255 0 0 255 0 0 255 255 255 0 0 0 255 0 0 0 0 -255 0 0 0 255 0 0 255 0 255 0 0 0 255 0 0 0 255 255 255 0 0 255 0 0 0 255 -0 0 0 255 0 0 0 0 0 0 0 0 0 0 20 0 255 0 4 4 4 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 127 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 255 0 0 0 0 0 0 0 0 0 255 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 255 0 0 0 0 0 0 0 255 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 255 0 0 0 0 0 0 0 0 255 -0 0 0 255 0 0 0 255 0 0 0 0 0 0 0 0 0 0 4 0 0 0 4 4 4 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 127 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 255 255 0 0 0 0 0 0 0 0 0 255 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 255 0 0 0 0 0 0 0 255 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 255 0 0 0 0 0 0 -0 0 0 0 255 0 0 255 0 0 255 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 127 127 127 0 127 127 127 127 0 -127 127 127 127 0 127 127 127 0 127 127 127 127 0 127 127 127 127 0 127 -127 0 127 127 127 127 0 127 127 127 127 0 127 0 127 127 0 127 127 127 127 -0 127 0 127 127 127 127 127 127 127 0 127 127 127 127 0 127 127 127 127 -0 127 127 127 127 0 127 127 127 127 0 127 127 0 127 127 127 0 127 127 0 -127 127 127 127 0 127 127 127 127 127 0 127 127 127 127 127 127 127 0 127 -127 127 0 127 127 127 127 127 0 127 127 127 0 127 127 127 0 127 127 127 -0 127 127 127 0 127 127 127 127 127 127 0 127 127 127 127 127 127 127 127 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 127 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 255 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 255 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 255 0 255 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 127 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 255 0 0 0 0 0 255 0 0 0 0 -0 255 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 255 0 0 -255 255 0 255 0 0 255 0 255 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 255 255 -0 255 0 0 0 0 0 0 0 0 255 0 255 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 255 0 255 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 127 -0 255 255 255 0 0 255 255 255 255 255 255 255 0 0 0 0 0 0 255 255 0 0 0 -0 0 0 0 0 0 0 0 0 0 255 0 0 0 0 0 255 0 0 0 0 255 0 255 0 0 255 255 0 0 -0 255 0 0 0 0 0 0 0 255 255 255 255 0 0 0 0 0 255 255 255 255 255 255 255 -0 0 255 255 255 255 255 255 255 0 255 255 255 255 0 0 255 255 255 255 255 -255 255 0 0 255 255 255 255 255 255 255 0 255 0 0 255 255 0 255 0 0 255 -0 255 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 255 0 255 255 255 255 255 0 255 -0 255 0 0 255 0 0 0 0 0 0 0 0 0 0 0 0 0 0 255 255 255 255 255 255 255 0 -0 255 0 0 255 0 0 0 255 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 127 -255 0 0 0 0 0 255 0 0 0 0 0 255 0 0 0 0 0 255 0 0 0 0 0 0 0 0 0 0 0 0 0 -255 255 255 255 255 0 255 255 255 255 255 0 0 0 0 0 0 255 0 0 255 0 255 -0 0 0 0 0 0 0 255 0 0 0 0 0 0 0 0 255 0 0 0 255 0 0 0 0 0 255 0 0 0 0 0 -255 0 0 0 0 255 0 0 255 0 0 0 0 0 255 0 0 255 0 0 0 0 0 255 0 0 255 255 -0 0 255 0 255 255 0 255 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -255 0 0 255 255 255 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 255 0 0 0 0 0 255 -0 0 0 0 0 0 255 0 255 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 127 -255 255 255 255 0 0 255 0 0 0 0 0 255 0 0 0 0 0 255 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 255 0 0 0 0 0 255 0 0 0 0 0 0 0 0 255 0 0 255 0 255 0 0 0 0 0 -0 0 255 0 0 0 0 0 0 255 0 255 0 0 0 255 0 0 0 0 0 255 0 0 0 0 0 255 0 0 -0 255 0 0 0 255 0 0 0 0 0 255 0 0 255 0 0 0 0 0 255 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 255 0 0 255 0 255 0 -255 255 255 0 255 0 0 0 255 255 0 255 255 0 0 0 255 0 0 0 0 0 255 0 255 -255 255 0 0 255 0 255 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 127 -255 0 0 0 0 0 255 0 0 0 0 0 255 0 0 0 0 255 255 255 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 255 0 0 0 255 255 255 255 255 0 0 0 0 0 0 0 255 255 0 255 0 255 -255 0 255 255 0 0 0 255 255 255 0 0 255 0 0 255 0 0 0 255 255 255 255 0 -0 255 0 0 0 0 0 255 0 0 255 0 0 0 0 255 0 0 0 0 0 255 0 0 255 0 0 0 0 0 -255 0 0 0 0 0 0 0 0 0 0 0 0 0 255 255 255 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 255 0 0 0 0 255 0 255 0 0 255 0 0 255 0 0 255 0 -0 0 0 0 255 0 0 0 255 0 0 0 255 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 127 255 255 255 255 0 0 255 0 0 0 0 0 255 0 0 0 0 0 255 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 255 0 0 0 0 0 255 0 0 0 0 0 0 0 0 0 0 0 255 0 255 -0 0 255 0 0 255 0 0 0 0 0 255 0 255 0 0 255 0 0 0 255 0 0 0 0 0 255 0 0 -0 0 0 255 0 0 255 0 0 0 0 255 0 0 0 0 0 255 0 0 255 0 0 0 0 0 255 0 0 0 -0 0 0 0 0 0 0 0 0 0 255 255 255 0 255 255 255 255 0 255 255 255 255 255 -255 255 255 0 0 0 0 0 0 0 0 0 0 0 0 0 0 255 0 0 0 255 0 255 0 0 255 255 -255 255 0 0 255 0 0 0 0 0 255 0 0 255 0 0 0 0 255 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 127 255 0 0 0 0 0 255 0 0 0 0 0 255 0 0 255 -0 0 255 0 0 0 255 0 255 0 0 0 0 0 0 0 0 0 255 0 0 0 0 0 255 0 0 0 0 0 0 -0 0 0 0 0 255 0 255 0 0 255 0 0 255 0 0 0 0 0 255 0 0 255 0 255 0 0 0 255 -0 0 0 0 0 255 0 0 0 0 0 255 0 255 0 0 0 0 0 255 0 0 0 0 0 255 0 0 255 0 -0 0 0 0 255 0 0 0 0 0 0 0 0 0 0 0 0 0 255 255 255 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 255 0 255 0 0 255 0 0 255 0 0 0 0 0 -255 0 0 0 0 0 255 0 255 0 0 0 0 0 255 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 127 0 255 255 255 0 0 255 255 255 255 255 255 255 0 0 255 -0 255 0 0 0 0 255 0 255 0 255 0 255 0 255 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 255 0 0 0 255 255 0 255 255 0 0 255 255 255 255 0 0 0 0 0 0 255 -255 255 255 255 255 255 0 0 255 255 255 255 255 255 255 0 255 255 255 255 -0 0 255 255 255 255 255 255 255 0 0 255 255 255 255 255 255 255 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 255 255 255 0 0 0 0 0 255 255 0 255 255 255 0 0 255 255 255 255 255 -255 255 0 255 255 255 0 0 0 255 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 127 0 0 0 0 0 0 0 0 0 0 0 0 0 0 255 0 255 255 0 0 0 255 0 255 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 127 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 127 127 127 127 0 127 127 127 127 127 127 127 127 0 127 0 127 127 -127 127 0 127 127 127 127 0 127 127 127 127 127 0 127 127 127 127 127 0 -127 127 127 127 127 0 127 127 127 127 0 127 127 127 127 127 127 127 127 -127 127 127 127 0 127 127 127 127 127 0 127 127 0 127 127 127 127 127 127 -127 127 0 127 127 127 127 127 127 127 127 0 127 127 127 127 0 127 127 127 -127 127 127 127 127 0 127 127 127 127 127 127 127 127 0 127 0 127 0 127 -127 127 0 127 127 127 0 127 127 127 0 127 127 127 127 0 127 127 127 127 -127 127 127 0 127 127 127 127 0 127 127 127 127 127 127 127 0 127 127 127 -0 127 127 0 127 127 127 127 127 127 127 0 127 127 127 127 127 127 127 127 -0 127 127 127 0 127 127 127 127 127 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 127 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 127 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 255 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 255 255 255 255 255 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 255 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 127 0 0 0 0 0 255 0 0 0 255 0 0 0 0 255 255 0 0 0 0 0 0 0 255 0 -0 0 255 0 255 0 0 255 255 255 0 0 255 0 255 0 0 0 255 255 255 255 0 0 255 -255 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 255 255 255 255 0 0 0 0 0 0 0 -0 255 0 0 0 0 0 0 0 0 0 0 255 255 255 0 255 255 255 0 0 255 0 0 0 0 0 0 -0 0 255 255 255 0 0 0 0 0 0 0 0 0 0 0 255 0 0 255 255 0 0 0 0 0 0 0 0 255 -0 0 255 0 0 0 0 0 255 0 0 0 255 0 0 0 255 255 255 0 0 255 0 0 0 0 255 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 127 0 0 0 0 0 0 0 0 0 255 0 0 0 255 0 0 0 255 0 0 0 255 0 -0 255 0 255 0 0 255 0 255 0 0 0 0 0 0 0 0 0 0 255 0 0 0 0 255 0 0 255 255 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 255 0 0 0 0 255 0 0 0 0 0 0 255 0 255 -0 0 0 0 255 0 0 0 0 0 0 255 0 0 255 0 0 0 0 0 0 0 0 0 0 0 255 255 0 255 -0 0 0 0 0 0 0 0 0 0 255 255 0 255 0 0 255 0 0 0 0 0 0 255 255 0 255 0 0 -0 0 0 255 255 0 0 255 0 0 0 0 0 255 0 0 255 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -127 0 0 0 0 0 255 0 0 255 255 255 0 0 255 0 0 0 0 255 255 255 0 0 0 255 -0 255 0 0 255 0 255 0 0 0 0 0 0 0 0 0 255 0 0 255 255 0 0 255 255 0 255 -0 0 255 0 255 0 0 0 0 0 0 0 0 0 0 0 255 0 255 255 255 0 0 255 0 0 0 0 0 -0 255 0 0 0 0 0 255 0 0 0 0 0 255 0 0 0 0 255 0 0 0 0 0 255 0 0 255 0 255 -255 0 255 0 0 0 0 0 0 0 0 0 0 0 255 0 255 0 0 255 0 255 0 255 0 0 0 255 -0 255 0 0 0 0 0 0 255 0 0 255 0 0 0 0 0 0 255 0 255 0 0 0 0 0 255 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 127 0 0 0 0 0 255 0 255 0 255 0 0 255 255 255 0 0 0 255 0 255 -0 0 0 0 255 0 0 0 0 0 255 255 255 0 0 0 0 0 0 0 255 0 255 0 0 0 0 255 0 -255 255 0 255 0 255 0 0 0 255 255 255 255 255 0 0 0 0 255 0 255 0 0 255 -0 255 0 0 0 0 0 0 0 0 0 0 255 255 255 255 255 0 0 255 255 255 0 255 255 -0 0 0 0 0 0 255 0 0 255 0 255 255 0 255 0 0 255 0 0 0 0 0 0 0 255 255 255 -0 255 255 0 0 0 255 0 255 0 0 255 255 0 0 255 255 0 0 0 255 0 255 0 255 -255 0 0 255 255 0 255 0 255 255 0 0 255 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 127 0 0 0 0 0 -255 0 255 0 255 0 0 0 255 0 0 0 0 255 255 255 0 0 0 255 255 255 0 0 0 0 -255 0 0 255 0 0 0 0 0 0 255 0 255 0 0 0 0 255 0 0 0 0 255 0 255 0 0 0 0 -0 0 0 255 0 255 255 0 255 0 255 255 255 0 0 255 0 0 0 0 0 0 0 0 0 0 0 0 -255 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 255 0 0 255 0 0 255 0 255 0 0 255 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 255 0 255 0 0 0 255 0 255 0 255 0 0 0 0 255 -0 0 0 0 255 0 0 0 255 0 255 0 255 0 255 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 127 0 0 0 0 -0 255 0 255 0 255 0 0 0 255 0 0 0 255 0 0 0 255 0 0 0 255 0 0 0 255 0 0 -255 255 255 0 0 0 0 0 0 255 0 0 255 255 0 0 255 0 0 0 0 0 255 0 255 0 0 -0 0 0 0 255 0 0 0 0 255 0 255 0 0 255 0 255 0 0 0 0 0 0 0 0 0 0 0 0 127 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 255 0 0 255 0 0 255 0 255 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 255 0 255 0 0 0 0 255 0 255 255 255 255 0 0 0 255 -0 0 0 255 0 0 0 0 255 0 255 255 255 255 255 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 127 0 0 -0 0 0 255 0 0 255 255 255 0 255 255 255 255 0 0 0 0 0 0 0 0 0 255 0 0 0 -255 0 0 0 0 255 0 0 0 0 0 0 0 255 0 0 0 0 255 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 255 0 0 0 0 255 0 0 0 0 0 0 0 0 0 0 0 255 255 255 255 255 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 255 255 255 255 0 0 255 0 255 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 255 0 0 0 0 255 0 0 0 255 0 0 0 255 255 -255 0 0 255 0 0 0 0 255 0 0 255 255 255 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 127 0 0 0 0 0 0 0 -0 0 255 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 255 0 0 0 0 255 0 0 0 0 0 -0 0 0 255 255 255 255 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 255 -255 255 255 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 255 0 0 0 0 0 255 0 255 0 0 0 0 0 0 255 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 127 0 0 0 0 0 0 0 0 0 255 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 255 -0 255 255 255 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 255 0 0 0 0 0 255 0 255 0 0 0 0 0 255 255 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 127 127 127 127 0 127 0 127 127 127 127 0 127 127 127 -127 0 127 127 127 127 127 0 127 127 127 127 127 0 127 0 127 127 127 127 -0 127 127 127 127 0 127 127 127 127 127 127 127 0 127 127 127 0 127 127 -127 127 0 127 127 127 127 127 127 0 127 127 0 127 127 127 127 127 127 127 -0 127 127 127 127 0 127 127 127 127 0 127 127 127 127 127 0 127 127 127 -127 0 127 127 127 0 127 127 127 0 127 127 127 127 0 127 127 127 127 0 127 -127 127 0 127 127 127 0 127 127 127 0 127 127 127 127 0 127 127 127 127 -0 127 127 127 127 127 127 127 127 0 127 127 127 127 127 127 127 127 0 127 -127 127 127 127 127 127 0 127 127 127 127 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 127 0 0 0 255 0 -0 0 0 0 255 0 0 0 0 0 0 255 0 255 0 0 0 255 0 255 255 0 0 0 255 0 0 255 -0 0 0 0 255 255 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 255 0 0 0 0 255 -0 0 0 0 255 0 255 0 0 0 255 0 255 0 0 0 255 0 0 0 255 0 0 255 0 255 0 255 -0 255 0 0 0 0 0 0 0 0 0 255 0 255 255 0 0 0 0 0 255 0 0 0 0 0 0 0 255 0 -0 0 0 0 0 255 0 255 0 0 0 0 0 255 0 255 255 0 0 0 0 255 0 255 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 255 0 0 0 0 0 255 0 0 0 0 0 0 255 0 255 -0 0 0 255 0 0 255 0 0 0 0 255 0 0 0 0 0 0 0 0 0 0 0 0 0 127 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 255 0 0 255 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 255 255 0 0 127 0 0 255 255 -0 0 0 0 0 255 255 0 0 0 0 0 255 255 0 0 0 0 0 255 255 0 0 0 0 0 255 255 -0 0 0 0 0 255 255 0 0 0 0 0 255 255 255 255 255 0 0 0 255 255 255 0 0 255 -255 255 255 255 0 255 255 255 255 255 0 255 255 255 255 255 0 255 255 255 -255 255 0 255 255 255 0 255 255 255 0 255 255 255 0 255 255 255 0 255 255 -255 255 0 0 0 255 0 0 0 0 255 0 0 0 255 255 255 0 0 0 0 0 255 255 255 0 -0 0 0 0 255 255 255 0 0 0 0 0 255 255 255 0 0 0 0 0 255 255 255 0 0 0 0 -0 0 0 0 0 0 0 0 255 255 255 0 255 0 255 0 0 0 0 255 0 255 0 0 0 0 255 0 -255 0 0 0 0 255 0 255 0 0 0 0 255 0 255 0 0 0 255 0 255 0 0 0 0 255 0 0 -255 0 127 0 0 255 255 0 0 0 0 0 255 255 0 0 0 0 0 255 255 0 0 0 0 0 255 -255 0 0 0 0 0 255 255 0 0 0 0 0 255 255 0 0 0 0 255 0 255 0 0 0 0 0 255 -0 0 0 255 0 255 0 0 0 0 0 255 0 0 0 0 0 255 0 0 0 0 0 255 0 0 0 0 0 0 255 -0 0 0 255 0 0 0 255 0 0 0 255 0 0 255 0 0 0 255 0 0 255 255 0 0 0 255 0 -0 255 0 0 0 255 0 0 0 255 0 0 0 255 0 0 0 255 0 0 0 255 0 0 0 255 0 0 0 -255 0 0 0 255 0 0 0 255 0 0 0 0 0 0 0 0 0 0 255 0 0 0 255 0 0 255 0 0 0 -0 255 0 255 0 0 0 0 255 0 255 0 0 0 0 255 0 255 0 0 0 0 255 0 0 255 0 255 -0 0 255 255 255 0 0 255 0 0 255 0 127 0 255 0 0 255 0 0 0 255 0 0 255 0 -0 0 255 0 0 255 0 0 0 255 0 0 255 0 0 0 255 0 0 255 0 0 0 255 0 0 255 0 -0 0 255 0 255 0 0 0 0 255 0 0 0 0 0 0 255 0 0 0 0 0 255 0 0 0 0 0 255 0 -0 0 0 0 255 0 0 0 0 0 0 255 0 0 0 255 0 0 0 255 0 0 0 255 0 0 255 0 0 0 -0 255 0 255 0 255 0 0 255 0 255 0 0 0 0 0 255 0 255 0 0 0 0 0 255 0 255 -0 0 0 0 0 255 0 255 0 0 0 0 0 255 0 255 0 0 0 0 0 255 0 0 255 0 0 0 255 -0 255 0 0 0 255 0 255 0 255 0 0 0 0 255 0 255 0 0 0 0 255 0 255 0 0 0 0 -255 0 255 0 0 0 0 255 0 0 255 0 255 0 0 255 0 0 255 0 255 0 255 0 0 127 -0 255 0 0 255 0 0 0 255 0 0 255 0 0 0 255 0 0 255 0 0 0 255 0 0 255 0 0 -0 255 0 0 255 0 0 0 255 0 0 255 0 0 0 255 0 255 255 255 255 0 255 0 0 0 -0 0 0 255 255 255 255 0 0 255 255 255 255 0 0 255 255 255 255 0 0 255 255 -255 255 0 0 0 255 0 0 0 255 0 0 0 255 0 0 0 255 0 0 255 255 255 0 0 255 -0 255 0 0 255 0 255 0 255 0 0 0 0 0 255 0 255 0 0 0 0 0 255 0 255 0 0 0 -0 0 255 0 255 0 0 0 0 0 255 0 255 0 0 0 0 0 255 0 0 0 255 0 255 0 0 255 -0 0 255 0 0 255 0 255 0 0 0 0 255 0 255 0 0 0 0 255 0 255 0 0 0 0 255 0 -255 0 0 0 0 255 0 0 0 255 0 0 0 255 0 0 255 0 255 0 0 255 0 127 255 255 -255 255 255 255 0 255 255 255 255 255 255 0 255 255 255 255 255 255 0 255 -255 255 255 255 255 0 255 255 255 255 255 255 0 255 255 255 255 255 255 -0 0 255 255 255 0 0 0 0 255 0 0 0 0 0 0 255 0 0 0 0 0 255 0 0 0 0 0 255 -0 0 0 0 0 255 0 0 0 0 0 0 255 0 0 0 255 0 0 0 255 0 0 0 255 0 0 255 0 0 -0 0 255 0 255 0 0 0 255 255 0 255 0 0 0 0 0 255 0 255 0 0 0 0 0 255 0 255 -0 0 0 0 0 255 0 255 0 0 0 0 0 255 0 255 0 0 0 0 0 255 0 0 0 0 255 0 0 0 -255 0 255 0 0 0 255 0 255 0 0 0 0 255 0 255 0 0 0 0 255 0 255 0 0 0 0 255 -0 255 0 0 0 0 255 0 0 0 255 0 0 0 255 0 0 255 0 255 0 0 255 0 127 255 0 -0 0 0 255 0 255 0 0 0 0 255 0 255 0 0 0 0 255 0 255 0 0 0 0 255 0 255 0 -0 0 0 255 0 255 0 0 0 0 255 0 255 0 0 255 0 0 0 0 0 255 0 0 0 255 0 255 -0 0 0 0 0 255 0 0 0 0 0 255 0 0 0 0 0 255 0 0 0 0 0 0 255 0 0 0 255 0 0 -0 255 0 0 0 255 0 0 255 0 0 0 255 0 0 255 0 0 0 0 255 0 0 255 0 0 0 255 -0 0 0 255 0 0 0 255 0 0 0 255 0 0 0 255 0 0 0 255 0 0 0 255 0 0 0 255 0 -0 0 255 0 0 0 0 255 0 255 0 0 0 255 0 0 0 255 0 0 255 0 0 0 0 255 0 255 -0 0 0 0 255 0 255 0 0 0 0 255 0 255 0 0 0 0 255 0 0 0 255 0 0 0 255 255 -255 0 0 255 0 0 255 0 127 255 0 0 0 0 255 0 255 0 0 0 0 255 0 255 0 0 0 -0 255 0 255 0 0 0 0 255 0 255 0 0 0 0 255 0 255 0 0 0 0 255 0 255 0 0 255 -255 255 255 0 0 0 255 255 255 0 0 255 255 255 255 255 0 255 255 255 255 -255 0 255 255 255 255 255 0 255 255 255 255 255 0 255 255 255 0 255 255 -255 0 255 255 255 0 255 255 255 0 255 255 255 255 0 0 0 255 0 0 0 0 255 -0 0 0 255 255 255 0 0 0 0 0 255 255 255 0 0 0 0 0 255 255 255 0 0 0 0 0 -255 255 255 0 0 0 0 0 255 255 255 0 0 0 0 255 0 0 0 255 0 255 0 255 255 -255 0 0 0 0 255 255 255 255 0 0 0 255 255 255 255 0 0 0 255 255 255 255 -0 0 0 255 255 255 255 0 0 0 0 255 0 0 0 255 0 0 0 0 255 0 255 0 0 127 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 255 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 127 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 255 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 127 127 127 127 -127 127 0 127 127 127 127 127 127 0 127 127 127 127 127 127 0 127 127 127 -127 127 127 0 127 127 127 127 127 127 0 127 127 127 127 127 127 0 127 127 -127 127 127 127 127 0 127 127 127 127 127 127 0 127 127 127 127 127 0 127 -127 127 127 127 0 127 127 127 127 127 0 127 127 127 127 127 0 127 127 127 -0 127 127 127 0 127 127 127 0 127 127 127 0 127 127 127 127 127 127 0 127 -127 127 127 127 127 0 127 127 127 127 127 127 127 0 127 127 127 127 127 -127 127 0 127 127 127 127 127 127 127 0 127 127 127 127 127 127 127 0 127 -127 127 127 127 127 127 0 127 127 127 127 127 127 0 127 127 127 127 127 -127 127 0 127 127 127 127 127 127 0 127 127 127 127 127 127 0 127 127 127 -127 127 127 0 127 127 127 127 127 127 0 127 127 127 127 127 0 127 127 127 -127 0 127 127 127 127 0 127 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 127 0 255 0 0 0 0 0 0 255 0 0 0 255 0 0 255 255 0 255 0 -0 0 0 0 0 0 0 255 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 255 0 0 0 0 0 0 255 0 0 -0 255 0 0 0 0 0 0 0 255 0 0 0 255 0 255 0 0 0 0 0 0 0 0 0 255 255 0 255 -0 0 255 0 0 0 0 0 0 255 0 0 0 255 0 0 255 255 0 255 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 255 0 0 0 0 0 0 255 0 0 0 255 0 0 0 0 0 0 0 0 0 0 255 -0 0 255 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 127 0 0 255 -0 0 0 0 255 0 0 0 255 0 255 0 255 0 255 255 0 0 255 0 255 0 0 255 0 255 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 255 0 0 0 0 255 0 0 0 255 0 255 0 0 255 0 -255 0 0 255 0 255 0 255 0 255 255 0 255 0 0 255 255 0 255 0 255 255 0 0 -0 255 0 0 0 0 255 0 0 0 255 0 255 0 255 0 255 255 0 255 0 0 255 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 255 0 0 0 0 255 0 0 0 255 0 255 0 0 255 0 255 0 -0 0 255 0 0 0 255 0 0 0 0 0 255 0 255 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 127 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 255 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 255 255 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 255 0 0 0 0 0 0 0 255 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 255 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 127 0 255 255 0 0 0 255 255 0 0 0 255 255 0 0 0 255 255 0 0 0 255 -255 0 0 0 255 255 0 0 255 255 255 0 255 255 0 0 0 255 255 0 0 255 255 0 -0 0 255 255 0 0 0 255 255 0 0 0 255 255 0 0 0 255 0 255 0 0 255 0 0 255 -0 0 0 0 255 0 255 255 255 0 0 0 255 255 0 0 0 255 255 0 0 0 255 255 0 0 -0 255 255 0 0 0 255 255 0 0 0 0 0 0 0 0 0 0 255 255 255 0 0 255 0 0 255 -0 255 0 0 255 0 255 0 0 255 0 255 0 0 255 0 255 0 0 0 255 0 255 255 255 -0 0 255 0 0 0 255 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 127 0 0 0 255 0 0 0 -0 255 0 0 0 0 255 0 0 0 0 255 0 0 0 0 255 0 0 0 0 255 0 0 0 0 255 0 0 255 -0 255 0 0 0 255 0 0 255 0 255 0 0 255 0 255 0 0 255 0 255 0 0 255 0 0 255 -0 255 0 0 255 0 0 255 0 0 255 255 255 0 255 0 0 255 0 255 0 0 255 0 255 -0 0 255 0 255 0 0 255 0 255 0 0 255 0 255 0 0 255 0 0 255 255 255 255 255 -0 255 0 0 255 255 0 255 0 0 255 0 255 0 0 255 0 255 0 0 255 0 255 0 0 255 -0 0 255 0 255 0 0 255 0 0 255 0 0 255 0 255 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 127 0 255 255 255 0 0 255 255 255 0 0 255 255 255 0 0 255 255 255 -0 0 255 255 255 0 0 255 255 255 0 0 255 255 255 255 255 255 0 255 0 0 0 -255 255 255 255 0 255 255 255 255 0 255 255 255 255 0 255 255 255 255 0 -0 255 0 255 0 0 255 0 0 255 0 255 0 0 255 0 255 0 0 255 0 255 0 0 255 0 -255 0 0 255 0 255 0 0 255 0 255 0 0 255 0 255 0 0 255 0 0 0 0 0 0 0 0 255 -0 255 0 255 0 255 0 0 255 0 255 0 0 255 0 255 0 0 255 0 255 0 0 255 0 0 -255 0 255 0 0 255 0 0 255 0 0 255 0 255 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 127 255 0 0 255 0 255 0 0 255 0 255 0 0 255 0 255 0 0 255 0 255 0 0 -255 0 255 0 0 255 0 255 0 0 255 0 0 0 0 255 0 0 0 255 0 0 0 0 255 0 0 0 -0 255 0 0 0 0 255 0 0 0 0 0 255 0 255 0 0 255 0 0 255 0 255 0 0 255 0 255 -0 0 255 0 255 0 0 255 0 255 0 0 255 0 255 0 0 255 0 255 0 0 255 0 255 0 -0 255 0 0 0 0 255 0 0 0 255 255 0 0 255 0 255 0 0 255 0 255 0 0 255 0 255 -0 0 255 0 255 0 0 255 0 0 255 0 255 0 0 255 0 0 255 0 0 255 0 255 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 127 0 255 255 255 0 0 255 255 255 0 0 255 -255 255 0 0 255 255 255 0 0 255 255 255 0 0 255 255 255 0 0 255 255 0 255 -255 255 0 0 255 255 0 0 255 255 255 0 0 255 255 255 0 0 255 255 255 0 0 -255 255 255 0 0 255 0 255 0 0 255 0 0 255 0 0 255 255 0 0 255 0 0 255 0 -0 255 255 0 0 0 255 255 0 0 0 255 255 0 0 0 255 255 0 0 0 255 255 0 0 0 -0 0 0 0 0 0 0 255 255 255 0 0 0 255 255 255 0 0 255 255 255 0 0 255 255 -255 0 0 255 255 255 0 0 0 255 0 0 0 255 255 255 0 0 0 0 255 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 127 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 255 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 255 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 255 0 0 0 255 0 0 0 0 0 0 255 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 127 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 255 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 255 0 0 0 0 255 0 0 0 0 0 255 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 127 127 127 127 0 127 127 127 127 0 127 127 -127 127 0 127 127 127 127 0 127 127 127 127 0 127 127 127 127 0 127 127 -127 127 127 127 127 0 127 127 127 0 127 127 127 127 0 127 127 127 127 0 -127 127 127 127 0 127 127 127 127 0 127 127 0 127 0 127 127 0 127 127 0 -127 127 127 127 0 127 127 127 127 0 127 127 127 127 0 127 127 127 127 0 -127 127 127 127 0 127 127 127 127 0 127 127 127 127 0 127 127 127 127 127 -127 0 127 127 127 127 127 0 127 127 127 127 0 127 127 127 127 0 127 127 -127 127 0 127 127 127 127 0 127 127 127 127 127 0 127 127 127 127 0 127 -127 127 127 127 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 diff --git a/extern/AntTweakBar/src/res/TwXCursors.h b/extern/AntTweakBar/src/res/TwXCursors.h deleted file mode 100644 index aeee84d9..00000000 --- a/extern/AntTweakBar/src/res/TwXCursors.h +++ /dev/null @@ -1,908 +0,0 @@ -// --------------------------------------------------------------------------- -// -// @file TwXCursors.h -// @brief Bitmaps data for cursors -// @author Philippe Decaudin -// @license This file is part of the AntTweakBar library. -// For conditions of distribution and use, see License.txt -// -// note: Private header -// -// --------------------------------------------------------------------------- - - -static int g_CurHot[][2] = -{ - {16, 15}, // curs00 - {16, 15}, // curs01 - {16, 15}, // curs02 - {16, 15}, // curs03 - {16, 15}, // curs04 - {16, 15}, // curs05 - {16, 15}, // curs06 - {16, 15}, // curs07 - {16, 15}, // curs08 - {16, 15}, // curs09 - {16, 15}, // curs10 - {16, 15}, // curs11 - {16, 15}, // curs12 - {16, 15} // curs13 -}; - - -static bool g_CurPict[][32*32] = -{ - { // curs00 - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1, 0, - 0, 0, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1, - 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, - 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 1, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 - }, - { // curs01 - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, - 0, 0, 0, 1, 1, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1, 0, - 0, 0, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1, - 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, - 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1, 1, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, - 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 - }, - { // curs02 - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 1, 0, 1, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 1, 0, - 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, - 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 - }, - { // curs03 - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 0, 0, 0, 0, 1, - 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, - 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 1, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 - }, - { // curs04 - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, - 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1, 1, 1, - 0, 0, 0, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 0, - 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 1, 1, 1, - 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 - }, - { // curs05 - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, - 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1, - 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, - 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 1, 0, 0, 1, 1, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 1, 1, 0, - 0, 1, 0, 0, 0, 0, 0, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 0, 0, - 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 1, - 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 - }, - { // curs06 - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 1, 1, 1, 0, 0, 0, 1, 1, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, - 0, 0, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1, - 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 1, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 - }, - { // curs07 - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 0, 0, - 0, 0, 0, 0, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, - 1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 1, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, - 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, - 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, - 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 1, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 - }, - { // curs08 - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 1, 1, 0, 1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, - 0, 0, 1, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, - 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, - 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 - }, - { // curs09 - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, - 1, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, - 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, - 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 1, - 1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 - }, - { // curs10 - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 1, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, - 0, 0, 0, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 0, - 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, - 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 0, 0, 0, 1, 1, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 - }, - { // curs11 - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, - 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 0, 0, 0, 0, 0, 1, 0, 0, 1, 1, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1, - 0, 0, 0, 0, 1, 1, 1, 0, 0, 1, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, - 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, - 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 - }, - { // curs12 - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 1, 1, 1, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, - 0, 0, 1, 1, 1, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1, - 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, - 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 1, 1, 1, - 1, 1, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, - 0, 0, 0, 1, 0, 0, 0, 0, 0, 1, 1, 1, 0, 0, 0, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 1, - 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 - }, - { // curs13 - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 1, 1, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, - 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 1, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, - 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 - } -}; - - -static bool g_CurMask[][32*32] = -{ - { // mask00 - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, - 0, 0, 0, 1, 1, 1, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 0, 0, 0, 0, 1, 1, - 1, 1, 1, 0, 0, 0, 0, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 0, 0, 0, 0, 1, 1, 1, 1, 1, 0, 0, 0, 0, 1, 1, 1, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 1, 1, 1, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, - 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 - }, - { // mask01 - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 0, 0, 0, 0, 0, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 0, - 0, 0, 0, 1, 1, 1, 0, 0, 0, 0, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 0, 0, 0, 0, 1, 1, - 1, 1, 1, 0, 0, 0, 0, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, - 0, 0, 0, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 1, - 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 1, 1, 1, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 0, 0, 0, 0, 1, 1, 1, 1, 1, 0, 0, 0, 0, 1, 1, 1, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 0, 0, 0, 0, 1, 1, 1, 0, 0, 0, 0, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, - 1, 1, 0, 0, 0, 0, 0, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 - }, - { // mask02 - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, - 1, 1, 1, 1, 1, 1, 1, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, - 1, 1, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 0, 1, 1, 1, 0, 0, 0, - 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, - 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 0, 0, 0, 0, 0, 0, 1, 1, 1, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, - 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, - 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 0, 1, 1, 1, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 - }, - { // mask03 - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 0, - 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 0, 0, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 0, 0, 0, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 1, 1, 1, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 0, 0, 1, 1, 1, 0, 0, 0, 0, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, - 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 1, 1, 1, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 1, 1, 1, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, - 1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 - }, - { // mask04 - 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, - 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 0, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 0, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, - 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 - }, - { // mask05 - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 0, 0, 0, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, - 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, - 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 1, 1, 1, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 0, 0, 0, 1, 1, 1, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 0, - 0, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 0, 0, 1, 1, - 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 0, 0, 0, 0, 1, 1, 1, 1, 1, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 - }, - { // mask06 - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 1, - 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 1, 1, 1, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 1, 1, 1, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 1, 1, 1, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, - 1, 0, 0, 0, 0, 0, 0, 1, 1, 1, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, - 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 1, 1, 1, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 1, 1, 1, 0, 0, 0, 0, 1, 1, 1, 1, 0, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, - 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 - }, - { // mask07 - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 0, 0, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, - 0, 0, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 1, 1, - 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 0, 0, 1, 1, 1, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, - 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, - 1, 1, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 0, 0, - 0, 0, 0, 0, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, - 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 1, 1, 1, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 1, 1, 1, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 0, 0, 0, 0, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 0, 0, 0, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 - }, - { // mask08 - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 1, - 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 1, 1, 1, 0, - 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 0, 0, 1, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, - 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 0, 0, 0, 0, 0, 0, 1, - 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 0, 0, 1, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 1, 1, 1, 0, 1, 1, 1, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 1, 1, 1, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, - 1, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 - }, - { // mask09 - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, - 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 0, 0, 0, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, - 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, - 0, 0, 0, 0, 1, 1, 1, 0, 0, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 0, 0, 0, 0, - 0, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 0, 0, 0, 0, 0, 0, 1, 1, - 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 1, 1, 1, 1, 1, 1, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - }, - { // mask10 - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 1, 0, 0, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, - 1, 1, 0, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, - 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, - 0, 0, 0, 0, 1, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 1, - 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 1, 1, 1, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, - 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0 - }, - { // mask11 - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 1, - 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 0, 0, 0, 0, 1, 1, 1, 1, 1, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 0, 0, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 0, 0, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 1, 1, - 1, 1, 1, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 1, 1, 1, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 1, - 1, 1, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 - }, - { // mask12 - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, - 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, - 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 1, 1, 1, 0, 1, 1, 1, 1, 0, 0, 0, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, - 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, - 1, 0, 0, 0, 0, 0, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 1, 1, 1, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 0, 0, 0, 1, 1, 1, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 0, 0, 0, 0, 0, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, - 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 - }, - { // mask13 - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, - 1, 1, 1, 1, 0, 0, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 0, - 0, 0, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 0, 0, 0, 0, 1, 1, - 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 0, 0, 0, 0, 0, 0, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, - 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, - 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 0, 0, 1, 1, 1, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 - } -}; diff --git a/extern/AntTweakBar/src/res/cur00000.cur b/extern/AntTweakBar/src/res/cur00000.cur deleted file mode 100644 index 46c0fbcf..00000000 Binary files a/extern/AntTweakBar/src/res/cur00000.cur and /dev/null differ diff --git a/extern/AntTweakBar/src/res/cur00001.cur b/extern/AntTweakBar/src/res/cur00001.cur deleted file mode 100644 index 599d820e..00000000 Binary files a/extern/AntTweakBar/src/res/cur00001.cur and /dev/null differ diff --git a/extern/AntTweakBar/src/res/cur00002.cur b/extern/AntTweakBar/src/res/cur00002.cur deleted file mode 100644 index 4de903ba..00000000 Binary files a/extern/AntTweakBar/src/res/cur00002.cur and /dev/null differ diff --git a/extern/AntTweakBar/src/res/cur00003.cur b/extern/AntTweakBar/src/res/cur00003.cur deleted file mode 100644 index 772ce15e..00000000 Binary files a/extern/AntTweakBar/src/res/cur00003.cur and /dev/null differ diff --git a/extern/AntTweakBar/src/res/cur00004.cur b/extern/AntTweakBar/src/res/cur00004.cur deleted file mode 100644 index 1557076b..00000000 Binary files a/extern/AntTweakBar/src/res/cur00004.cur and /dev/null differ diff --git a/extern/AntTweakBar/src/res/cur00005.cur b/extern/AntTweakBar/src/res/cur00005.cur deleted file mode 100644 index 8e2142eb..00000000 Binary files a/extern/AntTweakBar/src/res/cur00005.cur and /dev/null differ diff --git a/extern/AntTweakBar/src/res/cur00006.cur b/extern/AntTweakBar/src/res/cur00006.cur deleted file mode 100644 index 02f5aad3..00000000 Binary files a/extern/AntTweakBar/src/res/cur00006.cur and /dev/null differ diff --git a/extern/AntTweakBar/src/res/cur00007.cur b/extern/AntTweakBar/src/res/cur00007.cur deleted file mode 100644 index 59d9b7d6..00000000 Binary files a/extern/AntTweakBar/src/res/cur00007.cur and /dev/null differ diff --git a/extern/AntTweakBar/src/res/cur00008.cur b/extern/AntTweakBar/src/res/cur00008.cur deleted file mode 100644 index 0785b19f..00000000 Binary files a/extern/AntTweakBar/src/res/cur00008.cur and /dev/null differ diff --git a/extern/AntTweakBar/src/res/cur00009.cur b/extern/AntTweakBar/src/res/cur00009.cur deleted file mode 100644 index 82aec7f4..00000000 Binary files a/extern/AntTweakBar/src/res/cur00009.cur and /dev/null differ diff --git a/extern/AntTweakBar/src/res/cur00010.cur b/extern/AntTweakBar/src/res/cur00010.cur deleted file mode 100644 index bb8b5f0a..00000000 Binary files a/extern/AntTweakBar/src/res/cur00010.cur and /dev/null differ diff --git a/extern/AntTweakBar/src/res/cur00011.cur b/extern/AntTweakBar/src/res/cur00011.cur deleted file mode 100644 index 7e030061..00000000 Binary files a/extern/AntTweakBar/src/res/cur00011.cur and /dev/null differ diff --git a/extern/AntTweakBar/src/res/cur00012.cur b/extern/AntTweakBar/src/res/cur00012.cur deleted file mode 100644 index 5a858c59..00000000 Binary files a/extern/AntTweakBar/src/res/cur00012.cur and /dev/null differ diff --git a/extern/AntTweakBar/src/res/cur00013.cur b/extern/AntTweakBar/src/res/cur00013.cur deleted file mode 100644 index 16356062..00000000 Binary files a/extern/AntTweakBar/src/res/cur00013.cur and /dev/null differ diff --git a/extern/AntTweakBar/src/res/curs00.pbm b/extern/AntTweakBar/src/res/curs00.pbm deleted file mode 100644 index 944a6c96..00000000 --- a/extern/AntTweakBar/src/res/curs00.pbm +++ /dev/null @@ -1,32 +0,0 @@ -P1 -# Created by Paint Shop Pro -32 32 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 1 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 1 0 1 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 1 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 1 0 -0 0 1 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 1 -0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 1 1 1 1 1 1 1 1 0 0 0 0 0 1 1 1 1 1 -1 1 1 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 1 0 1 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 1 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 diff --git a/extern/AntTweakBar/src/res/curs01.pbm b/extern/AntTweakBar/src/res/curs01.pbm deleted file mode 100644 index bc04c2b1..00000000 --- a/extern/AntTweakBar/src/res/curs01.pbm +++ /dev/null @@ -1,32 +0,0 @@ -P1 -# Created by Paint Shop Pro -32 32 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 1 1 1 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 0 0 0 0 0 1 1 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 -0 0 0 1 1 1 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 1 0 -0 0 1 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 1 0 0 0 0 0 1 -0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 -1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 1 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 1 1 1 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 1 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 -0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 0 0 -0 0 0 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 1 1 1 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 diff --git a/extern/AntTweakBar/src/res/curs02.pbm b/extern/AntTweakBar/src/res/curs02.pbm deleted file mode 100644 index 5c9037dd..00000000 --- a/extern/AntTweakBar/src/res/curs02.pbm +++ /dev/null @@ -1,32 +0,0 @@ -P1 -# Created by Paint Shop Pro -32 32 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 1 1 1 1 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -1 0 1 0 1 1 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 1 0 -0 0 0 0 0 0 1 1 1 1 1 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 1 0 0 0 0 -0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 -0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 1 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 1 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 -0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 1 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 1 0 0 0 0 0 0 0 1 1 1 1 1 1 1 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 1 0 1 0 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 1 1 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 diff --git a/extern/AntTweakBar/src/res/curs03.pbm b/extern/AntTweakBar/src/res/curs03.pbm deleted file mode 100644 index ca10fa1f..00000000 --- a/extern/AntTweakBar/src/res/curs03.pbm +++ /dev/null @@ -1,32 +0,0 @@ -P1 -# Created by Paint Shop Pro -32 32 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 1 0 0 0 0 1 -1 1 1 1 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 1 0 0 0 0 0 0 0 0 0 1 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 1 1 0 0 0 0 0 0 0 0 1 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 1 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 1 1 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 -0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 1 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 1 0 0 0 0 1 1 1 1 1 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 1 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 1 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 0 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 diff --git a/extern/AntTweakBar/src/res/curs04.pbm b/extern/AntTweakBar/src/res/curs04.pbm deleted file mode 100644 index 7d0f97ef..00000000 --- a/extern/AntTweakBar/src/res/curs04.pbm +++ /dev/null @@ -1,32 +0,0 @@ -P1 -# Created by Paint Shop Pro -32 32 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 1 1 1 1 1 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 1 1 1 -1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 1 1 1 -0 0 0 1 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 1 1 1 0 -0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 1 0 0 0 0 0 1 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 1 1 1 1 -1 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 1 1 1 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 1 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 1 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 1 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 1 1 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 diff --git a/extern/AntTweakBar/src/res/curs05.pbm b/extern/AntTweakBar/src/res/curs05.pbm deleted file mode 100644 index 678e5e21..00000000 --- a/extern/AntTweakBar/src/res/curs05.pbm +++ /dev/null @@ -1,32 +0,0 @@ -P1 -# Created by Paint Shop Pro -32 32 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 1 1 1 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -1 1 1 1 1 1 1 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 1 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 -0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 1 0 0 0 0 0 1 -0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 1 0 0 0 0 1 1 1 1 1 0 0 0 0 0 1 1 1 1 1 -0 0 0 0 1 0 0 0 0 0 0 1 0 0 1 1 1 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 1 1 1 0 -0 1 0 0 0 0 0 1 1 1 0 0 0 0 0 0 0 0 1 0 0 0 1 0 0 0 0 0 0 0 0 1 1 1 0 0 -0 0 1 1 0 0 0 0 0 0 0 0 0 0 0 1 1 1 0 0 0 0 0 0 0 0 0 0 0 1 1 0 0 0 0 1 -1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 0 0 0 0 0 0 0 1 1 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 diff --git a/extern/AntTweakBar/src/res/curs06.pbm b/extern/AntTweakBar/src/res/curs06.pbm deleted file mode 100644 index a28f5027..00000000 --- a/extern/AntTweakBar/src/res/curs06.pbm +++ /dev/null @@ -1,32 +0,0 @@ -P1 -# Created by Paint Shop Pro -32 32 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 1 1 1 1 1 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 1 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 1 1 1 1 0 0 0 0 0 0 1 0 0 0 0 0 0 0 -0 0 0 1 1 1 0 0 0 1 1 1 0 0 0 0 0 1 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 1 0 -0 0 1 1 1 0 0 0 0 0 0 0 1 0 0 0 0 1 1 1 1 1 1 1 0 0 0 0 0 1 0 0 0 0 0 1 -0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 1 1 1 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 1 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 1 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 1 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 1 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 diff --git a/extern/AntTweakBar/src/res/curs07.pbm b/extern/AntTweakBar/src/res/curs07.pbm deleted file mode 100644 index 3249ffe7..00000000 --- a/extern/AntTweakBar/src/res/curs07.pbm +++ /dev/null @@ -1,32 +0,0 @@ -P1 -# Created by Paint Shop Pro -32 32 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 1 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 1 1 1 1 1 0 0 -0 0 0 0 1 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 -1 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 1 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 1 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 1 1 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 -0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 1 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -1 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 -0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 -0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 1 1 1 1 1 0 0 0 0 0 1 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 1 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 1 1 0 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 diff --git a/extern/AntTweakBar/src/res/curs08.pbm b/extern/AntTweakBar/src/res/curs08.pbm deleted file mode 100644 index 8980cff0..00000000 --- a/extern/AntTweakBar/src/res/curs08.pbm +++ /dev/null @@ -1,32 +0,0 @@ -P1 -# Created by Paint Shop Pro -32 32 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 1 1 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 1 1 0 1 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 1 1 1 1 1 0 0 0 0 0 -0 0 1 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 -0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 1 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 -0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 1 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 1 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 1 0 0 0 1 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 1 1 1 1 1 1 1 0 0 0 0 0 0 0 1 0 0 1 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 1 1 0 1 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 1 0 0 0 0 0 0 0 0 0 1 1 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 -0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 diff --git a/extern/AntTweakBar/src/res/curs09.pbm b/extern/AntTweakBar/src/res/curs09.pbm deleted file mode 100644 index 773740b2..00000000 --- a/extern/AntTweakBar/src/res/curs09.pbm +++ /dev/null @@ -1,32 +0,0 @@ -P1 -# Created by Paint Shop Pro -32 32 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 -1 0 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 1 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 1 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 1 1 1 1 1 1 1 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 1 1 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 -0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 1 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 1 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 -0 0 1 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 1 -1 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 1 1 1 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 1 1 1 1 1 0 0 0 0 1 1 1 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 diff --git a/extern/AntTweakBar/src/res/curs10.pbm b/extern/AntTweakBar/src/res/curs10.pbm deleted file mode 100644 index 3535568a..00000000 --- a/extern/AntTweakBar/src/res/curs10.pbm +++ /dev/null @@ -1,32 +0,0 @@ -P1 -# Created by Paint Shop Pro -32 32 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 1 1 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 1 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 1 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 -0 0 0 1 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 1 0 -0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 1 -0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 1 1 1 1 1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 0 0 0 -1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 1 1 1 0 0 0 0 0 0 0 1 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 1 0 0 0 1 1 1 0 0 0 0 0 1 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 1 1 1 1 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 1 1 1 1 1 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 diff --git a/extern/AntTweakBar/src/res/curs11.pbm b/extern/AntTweakBar/src/res/curs11.pbm deleted file mode 100644 index c4f3c6ba..00000000 --- a/extern/AntTweakBar/src/res/curs11.pbm +++ /dev/null @@ -1,32 +0,0 @@ -P1 -# Created by Paint Shop Pro -32 32 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 0 0 0 0 0 0 0 1 1 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 0 0 0 0 1 1 0 0 0 0 0 0 0 0 -0 0 0 1 1 1 0 0 0 0 0 0 0 0 0 0 0 1 1 0 0 0 0 1 1 1 0 0 0 0 0 0 0 0 1 0 -0 0 1 0 0 0 0 0 0 0 0 1 1 1 0 0 0 0 0 1 0 0 1 1 1 0 0 0 0 1 0 0 0 0 0 1 -0 0 0 0 1 1 1 0 0 1 0 0 0 0 0 0 1 0 0 0 0 1 1 1 1 1 0 0 0 0 0 1 1 1 1 1 -0 0 0 0 1 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 0 0 0 -1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 1 0 0 0 0 0 1 1 1 1 1 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -1 1 1 1 1 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 diff --git a/extern/AntTweakBar/src/res/curs12.pbm b/extern/AntTweakBar/src/res/curs12.pbm deleted file mode 100644 index 577a7bdb..00000000 --- a/extern/AntTweakBar/src/res/curs12.pbm +++ /dev/null @@ -1,32 +0,0 @@ -P1 -# Created by Paint Shop Pro -32 32 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 1 1 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 1 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 1 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 1 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 1 1 1 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 -0 0 1 1 1 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 1 -0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 -0 0 0 1 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 1 1 1 1 -1 1 1 0 0 0 0 0 1 0 0 0 0 0 0 0 1 1 1 0 0 0 1 0 0 0 0 0 0 0 0 1 0 0 0 0 -0 0 0 1 0 0 0 0 0 1 1 1 0 0 0 1 1 1 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 1 -1 1 1 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 1 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 1 1 1 1 1 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 diff --git a/extern/AntTweakBar/src/res/curs13.pbm b/extern/AntTweakBar/src/res/curs13.pbm deleted file mode 100644 index 8d97a45a..00000000 --- a/extern/AntTweakBar/src/res/curs13.pbm +++ /dev/null @@ -1,32 +0,0 @@ -P1 -# Created by Paint Shop Pro -32 32 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 1 1 0 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 1 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -1 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 -0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 1 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 1 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 1 1 1 1 1 1 1 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 1 1 1 1 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 -0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 1 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 1 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 1 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 1 1 1 0 0 0 0 1 1 1 1 1 1 1 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 diff --git a/extern/AntTweakBar/src/res/mask00.pbm b/extern/AntTweakBar/src/res/mask00.pbm deleted file mode 100644 index 88183505..00000000 --- a/extern/AntTweakBar/src/res/mask00.pbm +++ /dev/null @@ -1,32 +0,0 @@ -P1 -# Created by Paint Shop Pro -32 32 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 1 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 1 1 1 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 1 1 1 1 1 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 1 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 1 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 1 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 -0 0 0 1 1 1 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 1 0 0 0 0 1 1 -1 1 1 0 0 0 0 1 1 1 0 0 0 0 0 0 0 0 0 0 0 0 1 1 1 1 1 1 1 1 1 1 1 1 1 1 -1 1 1 1 1 1 1 0 0 0 0 0 0 0 0 0 0 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 -1 1 1 1 0 0 0 0 0 0 0 0 0 0 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 0 -0 0 0 0 0 0 0 0 0 0 0 1 1 1 0 0 0 0 1 1 1 1 1 0 0 0 0 1 1 1 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 1 1 1 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 1 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 1 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 1 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 -1 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 1 1 1 1 1 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 1 1 1 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 1 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 diff --git a/extern/AntTweakBar/src/res/mask01.pbm b/extern/AntTweakBar/src/res/mask01.pbm deleted file mode 100644 index 98426218..00000000 --- a/extern/AntTweakBar/src/res/mask01.pbm +++ /dev/null @@ -1,32 +0,0 @@ -P1 -# Created by Paint Shop Pro -32 32 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 1 1 1 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 1 1 1 1 1 1 1 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 1 1 1 1 1 1 1 1 1 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 1 1 1 1 0 0 0 0 0 1 1 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 1 1 1 0 0 0 0 0 0 0 0 0 1 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -1 1 1 0 0 0 0 0 0 0 0 0 0 0 1 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 1 0 -0 0 0 1 1 1 0 0 0 0 1 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 1 0 0 0 0 1 1 -1 1 1 0 0 0 0 1 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 1 0 0 0 1 1 1 1 1 1 1 -0 0 0 1 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 1 0 0 0 1 1 1 1 1 1 1 0 0 0 1 -1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 1 0 0 0 1 1 1 1 1 1 1 0 0 0 1 1 1 0 0 -0 0 0 0 0 0 0 0 0 0 0 1 1 1 0 0 0 0 1 1 1 1 1 0 0 0 0 1 1 1 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 1 1 1 0 0 0 0 1 1 1 0 0 0 0 1 1 1 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 1 1 1 0 0 0 0 0 0 0 0 0 0 0 1 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 1 1 1 0 0 0 0 0 0 0 0 0 1 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 -1 1 0 0 0 0 0 1 1 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 1 1 1 -1 1 1 1 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 1 1 1 1 1 1 -1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 1 1 1 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 diff --git a/extern/AntTweakBar/src/res/mask02.pbm b/extern/AntTweakBar/src/res/mask02.pbm deleted file mode 100644 index c1a36f8d..00000000 --- a/extern/AntTweakBar/src/res/mask02.pbm +++ /dev/null @@ -1,32 +0,0 @@ -P1 -# Created by Paint Shop Pro -32 32 -0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 1 1 1 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 1 1 1 1 0 0 0 0 0 0 0 0 1 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 1 1 1 1 1 1 1 0 0 0 0 0 0 1 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 -1 1 1 1 1 1 1 0 0 1 1 1 1 1 1 1 1 1 0 0 0 0 0 0 0 0 0 0 0 0 1 1 1 1 1 1 -1 1 0 0 0 1 1 1 1 1 1 1 1 1 0 0 0 0 0 0 0 0 0 0 0 0 1 1 1 0 1 1 1 0 0 0 -0 1 1 1 1 1 1 1 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 1 1 1 0 0 0 0 0 0 0 -1 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 1 0 0 0 0 0 0 0 1 1 1 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 1 0 0 0 0 0 0 1 1 1 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 1 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 1 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 1 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 -1 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 1 1 1 1 1 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 1 1 1 1 1 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 1 1 1 1 1 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 1 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 1 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 1 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 1 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 -1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 1 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 1 1 1 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 1 0 1 1 1 0 0 0 0 1 1 1 1 1 1 1 -1 1 0 0 0 0 0 0 0 0 0 0 0 0 1 1 1 1 1 1 1 1 0 0 0 1 1 1 1 1 1 1 1 1 0 0 -0 0 0 0 0 0 0 0 0 0 0 1 1 1 1 1 1 1 1 0 0 1 1 1 1 1 1 1 1 1 0 0 0 0 0 0 -0 0 0 0 0 0 0 1 1 1 1 1 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 1 1 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 diff --git a/extern/AntTweakBar/src/res/mask03.pbm b/extern/AntTweakBar/src/res/mask03.pbm deleted file mode 100644 index 49cca3ab..00000000 --- a/extern/AntTweakBar/src/res/mask03.pbm +++ /dev/null @@ -1,32 +0,0 @@ -P1 -# Created by Paint Shop Pro -32 32 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 1 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 1 0 -0 0 1 1 1 1 1 1 1 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 1 1 1 1 0 0 1 1 -1 1 1 1 1 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 1 1 1 1 0 0 0 1 1 1 1 1 1 -1 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 1 1 1 1 0 0 0 0 0 0 1 1 1 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 1 1 1 1 1 0 0 0 0 0 1 1 1 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 1 1 1 0 0 1 1 1 0 0 0 0 1 1 1 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 1 0 0 0 0 1 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 1 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 1 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 1 1 1 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 -1 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 1 1 1 1 1 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 1 1 1 1 1 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 1 1 1 1 1 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 1 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 1 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 1 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 1 1 1 0 0 1 1 1 1 1 1 1 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 1 1 1 0 0 1 1 1 1 1 1 1 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 -1 1 0 1 1 1 1 1 1 1 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 1 1 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 1 1 1 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 1 1 1 1 1 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 1 1 1 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 1 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 diff --git a/extern/AntTweakBar/src/res/mask04.pbm b/extern/AntTweakBar/src/res/mask04.pbm deleted file mode 100644 index a3fbbad1..00000000 --- a/extern/AntTweakBar/src/res/mask04.pbm +++ /dev/null @@ -1,32 +0,0 @@ -P1 -# Created by Paint Shop Pro -32 32 -0 0 0 0 0 0 0 0 0 1 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 1 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 1 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 1 1 1 1 -1 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 1 1 1 1 1 1 1 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 1 1 1 1 1 1 1 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 1 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 1 1 0 0 1 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 1 1 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 -1 1 1 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 1 1 1 1 -1 1 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 1 1 1 1 1 1 1 1 -1 1 0 1 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 1 0 0 0 1 1 1 1 1 1 1 -1 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 1 0 0 0 0 0 0 1 1 1 1 1 1 1 1 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 1 1 1 1 1 1 1 0 0 0 1 -1 1 1 1 1 1 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 1 1 1 1 1 1 0 0 1 1 1 1 1 -1 1 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 1 1 1 1 1 1 0 1 1 1 1 1 1 1 1 1 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 1 0 1 1 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 1 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 1 1 1 1 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 1 1 1 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 1 1 1 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 -1 1 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 1 1 1 1 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 1 1 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 diff --git a/extern/AntTweakBar/src/res/mask05.pbm b/extern/AntTweakBar/src/res/mask05.pbm deleted file mode 100644 index 882b445f..00000000 --- a/extern/AntTweakBar/src/res/mask05.pbm +++ /dev/null @@ -1,32 +0,0 @@ -P1 -# Created by Paint Shop Pro -32 32 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 1 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 1 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 1 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 1 1 1 1 1 1 1 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 -1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 1 1 1 -1 1 1 1 0 0 0 1 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 1 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 -1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 1 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 1 1 -1 1 1 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 1 1 1 0 0 0 1 1 1 1 1 1 1 1 1 1 1 -1 1 1 1 0 0 0 1 1 1 0 0 0 0 0 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 -1 1 1 1 1 1 0 0 0 0 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 -1 1 1 0 0 0 1 1 1 1 1 1 1 0 0 0 0 0 1 1 1 1 1 0 0 0 0 0 1 1 1 1 1 1 1 0 -0 1 1 1 1 1 0 0 0 0 0 0 0 0 0 1 1 1 0 0 0 0 0 0 0 0 0 1 1 1 1 1 0 0 1 1 -1 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 1 1 1 0 0 0 0 1 1 1 1 1 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 1 1 1 0 0 0 0 0 0 0 1 1 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 diff --git a/extern/AntTweakBar/src/res/mask06.pbm b/extern/AntTweakBar/src/res/mask06.pbm deleted file mode 100644 index e2dabc1e..00000000 --- a/extern/AntTweakBar/src/res/mask06.pbm +++ /dev/null @@ -1,32 +0,0 @@ -P1 -# Created by Paint Shop Pro -32 32 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 1 1 1 1 1 1 1 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 1 1 1 1 1 1 1 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 -1 1 1 1 1 1 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 1 1 0 0 0 0 0 0 1 -1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 1 1 1 1 0 0 0 0 0 1 1 1 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 1 1 1 1 1 1 1 1 0 0 0 0 1 1 1 0 0 0 0 0 0 -0 0 0 1 1 1 0 1 1 1 1 1 1 1 1 1 1 1 1 0 1 1 1 1 1 1 1 1 1 0 0 0 0 0 1 1 -1 1 1 1 1 1 1 1 0 0 0 1 1 1 0 0 1 1 1 1 1 1 1 1 1 0 0 0 0 1 1 1 1 1 1 1 -1 0 0 0 0 0 0 1 1 1 0 0 1 1 1 1 1 1 1 1 1 0 0 0 0 1 1 1 1 1 1 1 0 0 0 0 -0 0 0 0 1 0 0 0 0 0 0 1 1 1 0 0 0 0 0 0 1 1 1 1 1 1 1 1 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 1 1 1 0 0 0 0 0 1 1 1 1 1 1 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 1 1 1 0 0 0 0 1 1 1 1 0 1 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 1 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 -1 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 1 1 1 1 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 1 1 1 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 1 1 1 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 1 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 1 1 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 1 1 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 diff --git a/extern/AntTweakBar/src/res/mask07.pbm b/extern/AntTweakBar/src/res/mask07.pbm deleted file mode 100644 index 8cfc669f..00000000 --- a/extern/AntTweakBar/src/res/mask07.pbm +++ /dev/null @@ -1,32 +0,0 @@ -P1 -# Created by Paint Shop Pro -32 32 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 1 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 1 1 1 1 -1 1 1 0 0 1 1 1 1 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 1 1 1 1 1 1 1 0 -0 0 1 1 1 1 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 1 1 1 1 1 1 1 0 0 0 1 1 -1 1 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 1 1 1 1 1 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 1 0 0 1 1 1 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 1 0 0 0 0 1 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 1 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 1 1 1 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 -1 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 1 1 1 1 1 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 1 1 1 1 1 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 1 1 1 1 1 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 1 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 1 1 1 0 0 0 0 0 0 0 1 1 1 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 -1 1 0 0 0 0 0 0 0 1 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 1 0 0 -0 0 0 0 1 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 1 1 1 1 1 1 1 0 0 0 -1 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 1 1 1 1 1 1 1 0 0 0 1 1 1 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 1 1 1 1 1 1 1 0 0 1 1 1 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 1 0 0 0 0 1 1 1 1 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 1 1 1 0 0 0 1 1 1 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 1 1 1 0 0 0 1 1 1 1 1 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 1 1 1 1 1 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 1 1 1 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 diff --git a/extern/AntTweakBar/src/res/mask08.pbm b/extern/AntTweakBar/src/res/mask08.pbm deleted file mode 100644 index 7bf4cca8..00000000 --- a/extern/AntTweakBar/src/res/mask08.pbm +++ /dev/null @@ -1,32 +0,0 @@ -P1 -# Created by Paint Shop Pro -32 32 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 1 1 1 1 1 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 1 1 1 1 1 1 1 -0 0 1 1 1 1 1 1 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 1 1 1 1 1 1 1 0 0 0 1 -1 1 1 1 1 1 1 0 0 0 0 0 0 0 0 0 0 0 0 1 1 1 1 1 1 1 1 1 0 0 0 0 1 1 1 0 -1 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 1 0 0 1 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 1 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 1 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 1 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 1 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 -1 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 1 1 1 1 1 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 1 1 1 1 1 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 1 1 1 1 1 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 1 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 1 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 1 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 1 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 1 0 0 0 0 0 0 1 -1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 1 0 0 0 0 0 0 0 1 1 1 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 1 0 0 0 0 0 0 0 1 1 1 0 0 1 0 0 -0 0 0 0 0 0 0 0 0 0 0 1 1 1 1 1 1 1 1 1 0 0 0 0 1 1 1 0 1 1 1 0 0 0 0 0 -0 0 0 0 0 0 0 1 1 1 1 1 1 1 1 1 0 0 0 1 1 1 1 1 1 1 1 0 0 0 0 0 0 0 0 0 -0 0 0 1 1 1 1 1 1 1 1 1 0 0 1 1 1 1 1 1 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 1 1 1 0 0 0 0 0 0 1 1 1 1 1 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 -1 0 0 0 0 0 0 0 0 1 1 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 1 0 0 0 -0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 diff --git a/extern/AntTweakBar/src/res/mask09.pbm b/extern/AntTweakBar/src/res/mask09.pbm deleted file mode 100644 index 81b71bd0..00000000 --- a/extern/AntTweakBar/src/res/mask09.pbm +++ /dev/null @@ -1,32 +0,0 @@ -P1 -# Created by Paint Shop Pro -32 32 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 1 1 1 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 -1 1 1 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 1 1 1 1 1 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 1 1 1 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 1 1 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 1 1 1 1 1 1 1 1 1 0 0 0 1 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -1 1 1 1 1 1 1 1 1 0 0 0 1 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 1 1 -1 1 1 1 1 0 0 0 1 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 1 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 1 1 1 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 -1 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 1 1 1 1 1 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 1 1 1 1 1 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 1 1 1 1 1 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 1 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 1 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 1 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 1 1 1 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 1 -0 0 0 0 1 1 1 0 0 1 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 1 0 0 0 0 -0 1 1 1 1 1 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 1 0 0 0 0 0 0 1 1 -1 1 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 1 1 1 1 1 1 1 0 0 0 1 1 1 1 1 1 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 1 1 1 1 1 1 1 0 0 1 1 1 1 1 1 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 1 1 1 1 1 1 1 1 1 0 0 0 1 1 1 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 1 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 1 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 1 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 diff --git a/extern/AntTweakBar/src/res/mask10.pbm b/extern/AntTweakBar/src/res/mask10.pbm deleted file mode 100644 index 2d416dc5..00000000 --- a/extern/AntTweakBar/src/res/mask10.pbm +++ /dev/null @@ -1,32 +0,0 @@ -P1 -# Created by Paint Shop Pro -32 32 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 1 1 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 1 1 1 1 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 1 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 1 1 1 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 1 1 1 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 1 1 1 1 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 1 0 0 1 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 1 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 -1 1 0 1 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 1 1 1 -1 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 1 1 1 1 1 1 1 0 0 0 1 1 1 1 1 1 1 1 -0 0 0 0 0 0 0 0 0 0 0 0 1 1 1 1 1 1 1 1 1 0 0 0 0 1 1 1 1 1 1 1 0 0 0 0 -0 0 0 0 1 0 0 0 1 1 1 1 1 1 1 1 1 0 0 0 0 1 1 1 1 1 1 1 1 0 0 0 0 0 0 1 -1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 1 1 1 1 1 1 1 1 0 0 0 1 1 1 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 1 0 1 1 1 1 1 1 1 1 1 1 1 1 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 1 1 1 1 1 1 1 1 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 1 1 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 1 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 -1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 1 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 1 1 1 1 1 1 1 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 1 1 1 1 1 1 1 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 1 1 1 1 1 1 1 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 1 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 1 1 1 0 0 0 0 0 0 0 diff --git a/extern/AntTweakBar/src/res/mask11.pbm b/extern/AntTweakBar/src/res/mask11.pbm deleted file mode 100644 index 2413b6a8..00000000 --- a/extern/AntTweakBar/src/res/mask11.pbm +++ /dev/null @@ -1,32 +0,0 @@ -P1 -# Created by Paint Shop Pro -32 32 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 0 0 0 0 0 0 0 1 -1 1 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 1 1 1 0 0 0 0 1 1 1 1 1 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 1 1 1 0 0 1 1 1 1 1 0 0 0 0 0 0 -0 0 0 1 1 1 0 0 0 0 0 0 0 0 0 1 1 1 1 1 0 0 1 1 1 1 1 1 1 0 0 0 0 0 1 1 -1 1 1 0 0 0 0 0 1 1 1 1 1 1 1 0 0 0 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 -1 1 1 1 1 1 1 1 1 1 1 0 0 0 0 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 -1 1 1 1 1 1 0 0 0 0 0 1 1 1 0 0 0 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 0 0 0 1 -1 1 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 1 1 1 1 1 0 0 0 0 0 0 0 0 0 1 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 1 1 1 0 0 0 1 1 1 1 1 1 1 1 1 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 -1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 1 1 1 -1 1 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 1 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 1 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 1 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 diff --git a/extern/AntTweakBar/src/res/mask12.pbm b/extern/AntTweakBar/src/res/mask12.pbm deleted file mode 100644 index dd4cd79f..00000000 --- a/extern/AntTweakBar/src/res/mask12.pbm +++ /dev/null @@ -1,32 +0,0 @@ -P1 -# Created by Paint Shop Pro -32 32 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 1 1 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 1 1 1 1 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 -1 1 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 1 1 -1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 1 1 1 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 1 1 1 1 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 1 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 1 1 1 0 1 1 1 1 0 0 0 1 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 -1 1 1 1 1 1 0 0 0 0 1 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 1 1 1 1 1 -1 0 0 0 0 0 1 1 1 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 1 1 1 1 1 1 1 0 0 0 1 -1 1 1 1 1 1 1 1 0 0 0 1 1 1 0 0 0 0 0 0 1 1 1 1 1 1 1 1 0 0 0 1 1 1 1 1 -1 1 1 1 0 0 0 1 1 1 0 0 0 1 1 1 1 1 1 1 1 1 1 0 0 0 0 1 1 1 1 1 1 1 1 1 -0 0 1 1 1 1 1 1 1 1 1 1 1 1 0 1 1 1 0 0 0 0 0 0 0 0 1 1 1 0 0 0 0 0 1 1 -1 1 1 1 1 1 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 1 0 0 0 0 0 0 1 1 1 1 1 -1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 1 0 0 0 0 0 0 0 1 1 1 1 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 1 1 1 1 1 1 1 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 1 1 1 1 1 1 1 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 1 1 1 1 1 1 1 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 diff --git a/extern/AntTweakBar/src/res/mask13.pbm b/extern/AntTweakBar/src/res/mask13.pbm deleted file mode 100644 index 60b97b94..00000000 --- a/extern/AntTweakBar/src/res/mask13.pbm +++ /dev/null @@ -1,32 +0,0 @@ -P1 -# Created by Paint Shop Pro -32 32 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 1 1 1 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 1 1 1 1 1 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 1 1 1 1 1 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 -1 1 1 1 0 0 1 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 1 1 0 -0 0 1 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 1 0 0 0 0 1 1 -1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 1 0 0 1 1 1 1 1 1 1 1 1 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 1 0 0 1 1 1 1 1 1 1 1 1 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 1 0 0 1 1 1 1 1 1 1 1 1 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 1 1 1 0 0 0 0 0 0 1 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 1 1 1 1 1 0 0 0 0 0 0 1 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 -1 1 1 0 0 0 0 0 0 0 1 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 1 1 1 1 1 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 1 1 1 1 1 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 1 1 1 1 1 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 1 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 1 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 1 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 1 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 1 -1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 1 0 0 1 1 1 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 1 1 1 1 1 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 1 1 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 1 1 1 1 0 0 0 1 1 1 1 1 1 1 1 1 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 1 1 1 1 1 1 0 0 1 1 1 1 1 1 1 1 1 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 1 1 1 0 0 0 1 1 1 1 1 1 1 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 diff --git a/extern/AntTweakBar/src/resource.h b/extern/AntTweakBar/src/resource.h deleted file mode 100644 index 1663771c..00000000 --- a/extern/AntTweakBar/src/resource.h +++ /dev/null @@ -1,29 +0,0 @@ -//{{NO_DEPENDENCIES}} -// Microsoft Visual C++ generated include file. -// Used by AntTweakBar.rc -// -#define IDC_CURSOR1 101 -#define IDC_CURSOR2 102 -#define IDC_CURSOR3 103 -#define IDC_CURSOR4 104 -#define IDC_CURSOR5 105 -#define IDC_CURSOR6 106 -#define IDC_CURSOR7 107 -#define IDC_CURSOR8 108 -#define IDC_CURSOR9 109 -#define IDC_CURSOR10 110 -#define IDC_CURSOR11 111 -#define IDC_CURSOR12 112 -#define IDC_CURSOR13 113 -#define IDC_CURSOR14 114 - -// Next default values for new objects -// -#ifdef APSTUDIO_INVOKED -#ifndef APSTUDIO_READONLY_SYMBOLS -#define _APS_NEXT_RESOURCE_VALUE 115 -#define _APS_NEXT_COMMAND_VALUE 40001 -#define _APS_NEXT_CONTROL_VALUE 1001 -#define _APS_NEXT_SYMED_VALUE 101 -#endif -#endif diff --git a/extern/Miniball/MiniBall.h b/extern/Miniball/MiniBall.h deleted file mode 100644 index cb76c534..00000000 --- a/extern/Miniball/MiniBall.h +++ /dev/null @@ -1,515 +0,0 @@ -// Copright (C) 1999-2013, Bernd Gaertner -// $Rev: 3581 $ -// -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. - -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. - -// You should have received a copy of the GNU General Public License -// along with this program. If not, see . -// -// Contact: -// -------- -// Bernd Gaertner -// Institute of Theoretical Computer Science -// ETH Zuerich -// CAB G31.1 -// CH-8092 Zuerich, Switzerland -// http://www.inf.ethz.ch/personal/gaertner - -#include -#include -#include -#include -#include - -namespace Miniball { - - // Global Functions - // ================ - template - inline NT mb_sqr (NT r) {return r*r;} - - // Functors - // ======== - - // functor to map a point iterator to the corresponding coordinate iterator; - // generic version for points whose coordinate containers have begin() - template < typename Pit_, typename Cit_ > - struct CoordAccessor { - typedef Pit_ Pit; - typedef Cit_ Cit; - inline Cit operator() (Pit it) const { return (*it).begin(); } - }; - - // partial specialization for points whose coordinate containers are arrays - template < typename Pit_, typename Cit_ > - struct CoordAccessor { - typedef Pit_ Pit; - typedef Cit_* Cit; - inline Cit operator() (Pit it) const { return *it; } - }; - - // Class Declaration - // ================= - - template - class Miniball { - private: - // types - // The iterator type to go through the input points - typedef typename CoordAccessor::Pit Pit; - // The iterator type to go through the coordinates of a single point. - typedef typename CoordAccessor::Cit Cit; - // The coordinate type - typedef typename std::iterator_traits::value_type NT; - // The iterator to go through the support points - typedef typename std::list::iterator Sit; - - // data members... - const int d; // dimension - Pit points_begin; - Pit points_end; - CoordAccessor coord_accessor; - double time; - const NT nt0; // NT(0) - - //...for the algorithms - std::list L; - Sit support_end; - int fsize; // number of forced points - int ssize; // number of support points - - // ...for the ball updates - NT* current_c; - NT current_sqr_r; - NT** c; - NT* sqr_r; - - // helper arrays - NT* q0; - NT* z; - NT* f; - NT** v; - NT** a; - - public: - // The iterator type to go through the support points - typedef typename std::list::const_iterator SupportPointIterator; - - // PRE: [begin, end) is a nonempty range - // POST: computes the smallest enclosing ball of the points in the range - // [begin, end); the functor a maps a point iterator to an iterator - // through the d coordinates of the point - Miniball (int d_, Pit begin, Pit end, CoordAccessor ca = CoordAccessor()); - - // POST: returns a pointer to the first element of an array that holds - // the d coordinates of the center of the computed ball - const NT* center () const; - - // POST: returns the squared radius of the computed ball - NT squared_radius () const; - - // POST: returns the number of support points of the computed ball; - // the support points form a minimal set with the same smallest - // enclosing ball as the input set; in particular, the support - // points are on the boundary of the computed ball, and their - // number is at most d+1 - int nr_support_points () const; - - // POST: returns an iterator to the first support point - SupportPointIterator support_points_begin () const; - - // POST: returns a past-the-end iterator for the range of support points - SupportPointIterator support_points_end () const; - - // POST: returns the maximum excess of any input point w.r.t. the computed - // ball, divided by the squared radius of the computed ball. The - // excess of a point is the difference between its squared distance - // from the center and the squared radius; Ideally, the return value - // is 0. subopt is set to the absolute value of the most negative - // coefficient in the affine combination of the support points that - // yields the center. Ideally, this is a convex combination, and there - // is no negative coefficient in which case subopt is set to 0. - NT relative_error (NT& subopt) const; - - // POST: return true if the relative error is at most tol, and the - // suboptimality is 0; the default tolerance is 10 times the - // coordinate type's machine epsilon - bool is_valid (NT tol = NT(10) * std::numeric_limits::epsilon()) const; - - // POST: returns the time in seconds taken by the constructor call for - // computing the smallest enclosing ball - double get_time() const; - - // POST: deletes dynamically allocated arrays - ~Miniball(); - - private: - void mtf_mb (Sit n); - void mtf_move_to_front (Sit j); - void pivot_mb (Pit n); - void pivot_move_to_front (Pit j); - NT excess (Pit pit) const; - void pop (); - bool push (Pit pit); - NT suboptimality () const; - void create_arrays(); - void delete_arrays(); - }; - - // Class Definition - // ================ - template - Miniball::Miniball (int d_, Pit begin, Pit end, - CoordAccessor ca) - : d (d_), - points_begin (begin), - points_end (end), - coord_accessor (ca), - time (clock()), - nt0 (NT(0)), - L(), - support_end (L.begin()), - fsize(0), - ssize(0), - current_c (NULL), - current_sqr_r (NT(-1)), - c (NULL), - sqr_r (NULL), - q0 (NULL), - z (NULL), - f (NULL), - v (NULL), - a (NULL) - { - assert (points_begin != points_end); - create_arrays(); - - // set initial center - for (int j=0; j - Miniball::~Miniball() - { - delete_arrays(); - } - - template - void Miniball::create_arrays() - { - c = new NT*[d+1]; - v = new NT*[d+1]; - a = new NT*[d+1]; - for (int i=0; i - void Miniball::delete_arrays() - { - delete[] f; - delete[] z; - delete[] q0; - delete[] sqr_r; - for (int i=0; i - const typename Miniball::NT* - Miniball::center () const - { - return current_c; - } - - template - typename Miniball::NT - Miniball::squared_radius () const - { - return current_sqr_r; - } - - template - int Miniball::nr_support_points () const - { - assert (ssize < d+2); - return ssize; - } - - template - typename Miniball::SupportPointIterator - Miniball::support_points_begin () const - { - return L.begin(); - } - - template - typename Miniball::SupportPointIterator - Miniball::support_points_end () const - { - return support_end; - } - - template - typename Miniball::NT - Miniball::relative_error (NT& subopt) const - { - NT e, max_e = nt0; - // compute maximum absolute excess of support points - for (SupportPointIterator it = support_points_begin(); - it != support_points_end(); ++it) { - e = excess (*it); - if (e < nt0) e = -e; - if (e > max_e) { - max_e = e; - } - } - // compute maximum excess of any point - for (Pit i = points_begin; i != points_end; ++i) - if ((e = excess (i)) > max_e) - max_e = e; - - subopt = suboptimality(); - assert (current_sqr_r > nt0 || max_e == nt0); - return (current_sqr_r == nt0 ? nt0 : max_e / current_sqr_r); - } - - template - bool Miniball::is_valid (NT tol) const - { - NT suboptimality; - return ( (relative_error (suboptimality) <= tol) && (suboptimality == 0) ); - } - - template - double Miniball::get_time() const - { - return time; - } - - template - void Miniball::mtf_mb (Sit n) - { - // Algorithm 1: mtf_mb (L_{n-1}, B), where L_{n-1} = [L.begin, n) - // B: the set of forced points, defining the current ball - // S: the superset of support points computed by the algorithm - // -------------------------------------------------------------- - // from B. Gaertner, Fast and Robust Smallest Enclosing Balls, ESA 1999, - // http://www.inf.ethz.ch/personal/gaertner/texts/own_work/esa99_final.pdf - - // PRE: B = S - assert (fsize == ssize); - - support_end = L.begin(); - if ((fsize) == d+1) return; - - // incremental construction - for (Sit i = L.begin(); i != n;) - { - // INV: (support_end - L.begin() == |S|-|B|) - assert (std::distance (L.begin(), support_end) == ssize - fsize); - - Sit j = i++; - if (excess(*j) > nt0) - if (push(*j)) { // B := B + p_i - mtf_mb (j); // mtf_mb (L_{i-1}, B + p_i) - pop(); // B := B - p_i - mtf_move_to_front(j); - } - } - // POST: the range [L.begin(), support_end) stores the set S\B - } - - template - void Miniball::mtf_move_to_front (Sit j) - { - if (support_end == j) - support_end++; - L.splice (L.begin(), L, j); - } - - template - void Miniball::pivot_mb (Pit n) - { - // Algorithm 2: pivot_mb (L_{n-1}), where L_{n-1} = [L.begin, n) - // -------------------------------------------------------------- - // from B. Gaertner, Fast and Robust Smallest Enclosing Balls, ESA 1999, - // http://www.inf.ethz.ch/personal/gaertner/texts/own_work/esa99_final.pdf - NT old_sqr_r; - const NT* c; - Pit pivot, k; - NT e, max_e, sqr_r; - Cit p; - do { - old_sqr_r = current_sqr_r; - sqr_r = current_sqr_r; - - pivot = points_begin; - max_e = nt0; - for (k = points_begin; k != n; ++k) { - p = coord_accessor(k); - e = -sqr_r; - c = current_c; - for (int j=0; j(*p++-*c++); - if (e > max_e) { - max_e = e; - pivot = k; - } - } - - if (max_e > nt0) { - // check if the pivot is already contained in the support set - if (std::find(L.begin(), support_end, pivot) == support_end) { - assert (fsize == 0); - if (push (pivot)) { - mtf_mb(support_end); - pop(); - pivot_move_to_front(pivot); - } - } - } - } while (old_sqr_r < current_sqr_r); - } - - template - void Miniball::pivot_move_to_front (Pit j) - { - L.push_front(j); - if (std::distance(L.begin(), support_end) == d+2) - support_end--; - } - - template - inline typename Miniball::NT - Miniball::excess (Pit pit) const - { - Cit p = coord_accessor(pit); - NT e = -current_sqr_r; - NT* c = current_c; - for (int k=0; k(*p++-*c++); - } - return e; - } - - template - void Miniball::pop () - { - --fsize; - } - - template - bool Miniball::push (Pit pit) - { - int i, j; - NT eps = mb_sqr(std::numeric_limits::epsilon()); - - Cit cit = coord_accessor(pit); - Cit p = cit; - - if (fsize==0) { - for (i=0; i(v[fsize][j]); - z[fsize]*=2; - - // reject push if z_fsize too small - if (z[fsize](*p++-c[fsize-1][i]); - f[fsize]=e/z[fsize]; - - for (i=0; i - typename Miniball::NT - Miniball::suboptimality () const - { - NT* l = new NT[d+1]; - NT min_l = nt0; - l[0] = NT(1); - for (int i=ssize-1; i>0; --i) { - l[i] = f[i]; - for (int k=ssize-1; k>i; --k) - l[i]-=a[k][i]*l[k]; - if (l[i] < min_l) min_l = l[i]; - l[0] -= l[i]; - } - if (l[0] < min_l) min_l = l[0]; - delete[] l; - if (min_l < nt0) - return -min_l; - return nt0; - } - -} // end Namespace Miniball diff --git a/extern/eigen/CMakeLists.txt b/extern/eigen/CMakeLists.txt index ed3e67fe..f3e69b84 100644 --- a/extern/eigen/CMakeLists.txt +++ b/extern/eigen/CMakeLists.txt @@ -1,6 +1,7 @@ -project(Eigen) +# cmake_minimum_require must be the first command of the file +cmake_minimum_required(VERSION 3.5.0) -cmake_minimum_required(VERSION 2.8.2) +project(Eigen3) # guard against in-source builds @@ -8,22 +9,21 @@ if(${CMAKE_SOURCE_DIR} STREQUAL ${CMAKE_BINARY_DIR}) message(FATAL_ERROR "In-source builds not allowed. Please make a new directory (called a build directory) and run CMake from there. You may need to remove CMakeCache.txt. ") endif() + +# Alias Eigen_*_DIR to Eigen3_*_DIR: + +set(Eigen_SOURCE_DIR ${Eigen3_SOURCE_DIR}) +set(Eigen_BINARY_DIR ${Eigen3_BINARY_DIR}) + # guard against bad build-type strings if (NOT CMAKE_BUILD_TYPE) set(CMAKE_BUILD_TYPE "Release") endif() -string(TOLOWER "${CMAKE_BUILD_TYPE}" cmake_build_type_tolower) -if( NOT cmake_build_type_tolower STREQUAL "debug" - AND NOT cmake_build_type_tolower STREQUAL "release" - AND NOT cmake_build_type_tolower STREQUAL "relwithdebinfo") - message(FATAL_ERROR "Unknown build type \"${CMAKE_BUILD_TYPE}\". Allowed values are Debug, Release, RelWithDebInfo (case-insensitive).") -endif() - ############################################################################# -# retrieve version infomation # +# retrieve version information # ############################################################################# # automatically parse the version number @@ -36,28 +36,61 @@ string(REGEX MATCH "define[ \t]+EIGEN_MINOR_VERSION[ \t]+([0-9]+)" _eigen_minor_ set(EIGEN_MINOR_VERSION "${CMAKE_MATCH_1}") set(EIGEN_VERSION_NUMBER ${EIGEN_WORLD_VERSION}.${EIGEN_MAJOR_VERSION}.${EIGEN_MINOR_VERSION}) -# if the mercurial program is absent, this will leave the EIGEN_HG_CHANGESET string empty, -# but won't stop CMake. -execute_process(COMMAND hg tip -R ${CMAKE_SOURCE_DIR} OUTPUT_VARIABLE EIGEN_HGTIP_OUTPUT) -execute_process(COMMAND hg branch -R ${CMAKE_SOURCE_DIR} OUTPUT_VARIABLE EIGEN_BRANCH_OUTPUT) +# if we are not in a git clone +if(IS_DIRECTORY ${CMAKE_SOURCE_DIR}/.git) + # if the git program is absent or this will leave the EIGEN_GIT_REVNUM string empty, + # but won't stop CMake. + execute_process(COMMAND git ls-remote --refs -q ${CMAKE_SOURCE_DIR} HEAD OUTPUT_VARIABLE EIGEN_GIT_OUTPUT) +endif() -# if this is the default (aka development) branch, extract the mercurial changeset number from the hg tip output... -if(EIGEN_BRANCH_OUTPUT MATCHES "default") -string(REGEX MATCH "^changeset: *[0-9]*:([0-9;a-f]+).*" EIGEN_HG_CHANGESET_MATCH "${EIGEN_HGTIP_OUTPUT}") -set(EIGEN_HG_CHANGESET "${CMAKE_MATCH_1}") -endif(EIGEN_BRANCH_OUTPUT MATCHES "default") +# extract the git rev number from the git output... +if(EIGEN_GIT_OUTPUT) +string(REGEX MATCH "^([0-9;a-f]+).*" EIGEN_GIT_CHANGESET_MATCH "${EIGEN_GIT_OUTPUT}") +set(EIGEN_GIT_REVNUM "${CMAKE_MATCH_1}") +endif() #...and show it next to the version number -if(EIGEN_HG_CHANGESET) - set(EIGEN_VERSION "${EIGEN_VERSION_NUMBER} (mercurial changeset ${EIGEN_HG_CHANGESET})") -else(EIGEN_HG_CHANGESET) +if(EIGEN_GIT_REVNUM) + set(EIGEN_VERSION "${EIGEN_VERSION_NUMBER} (git rev ${EIGEN_GIT_REVNUM})") +else() set(EIGEN_VERSION "${EIGEN_VERSION_NUMBER}") -endif(EIGEN_HG_CHANGESET) - +endif() include(CheckCXXCompilerFlag) +include(GNUInstallDirs) +include(CMakeDependentOption) set(CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/cmake) + +option(EIGEN_TEST_CXX11 "Enable testing with C++11 and C++11 features (e.g. Tensor module)." OFF) + + +macro(ei_add_cxx_compiler_flag FLAG) + string(REGEX REPLACE "-" "" SFLAG1 ${FLAG}) + string(REGEX REPLACE "\\+" "p" SFLAG ${SFLAG1}) + check_cxx_compiler_flag(${FLAG} COMPILER_SUPPORT_${SFLAG}) + if(COMPILER_SUPPORT_${SFLAG}) + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${FLAG}") + endif() +endmacro() + +check_cxx_compiler_flag("-std=c++11" EIGEN_COMPILER_SUPPORT_CPP11) + +if(EIGEN_TEST_CXX11) + set(CMAKE_CXX_STANDARD 11) + set(CMAKE_CXX_EXTENSIONS OFF) + if(EIGEN_COMPILER_SUPPORT_CPP11) + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11") + endif() +else() + #set(CMAKE_CXX_STANDARD 03) + #set(CMAKE_CXX_EXTENSIONS OFF) + ei_add_cxx_compiler_flag("-std=c++03") +endif() + +# Determine if we should build shared libraries on this platform. +get_cmake_property(EIGEN_BUILD_SHARED_LIBS TARGET_SUPPORTS_SHARED_LIBS) + ############################################################################# # find how to link to the standard libraries # ############################################################################# @@ -92,11 +125,13 @@ else() endif() option(EIGEN_BUILD_BTL "Build benchmark suite" OFF) -if(NOT WIN32) + +# Disable pkgconfig only for native Windows builds +if(NOT WIN32 OR NOT CMAKE_HOST_SYSTEM_NAME MATCHES Windows) option(EIGEN_BUILD_PKGCONFIG "Build pkg-config .pc file for Eigen" ON) -endif(NOT WIN32) +endif() -set(CMAKE_INCLUDE_CURRENT_DIR ON) +set(CMAKE_INCLUDE_CURRENT_DIR OFF) option(EIGEN_SPLIT_LARGE_TESTS "Split large tests into smaller executables" ON) @@ -107,33 +142,20 @@ endif() set(EIGEN_TEST_MAX_SIZE "320" CACHE STRING "Maximal matrix/vector size, default is 320") -macro(ei_add_cxx_compiler_flag FLAG) - string(REGEX REPLACE "-" "" SFLAG ${FLAG}) - check_cxx_compiler_flag(${FLAG} COMPILER_SUPPORT_${SFLAG}) - if(COMPILER_SUPPORT_${SFLAG}) - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${FLAG}") - endif() -endmacro(ei_add_cxx_compiler_flag) - if(NOT MSVC) # We assume that other compilers are partly compatible with GNUCC - - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fexceptions") - set(CMAKE_CXX_FLAGS_DEBUG "-g3") - set(CMAKE_CXX_FLAGS_RELEASE "-g0 -O2") - - # clang outputs some warnings for unknwon flags that are not caught by check_cxx_compiler_flag + + # clang outputs some warnings for unknown flags that are not caught by check_cxx_compiler_flag # adding -Werror turns such warnings into errors check_cxx_compiler_flag("-Werror" COMPILER_SUPPORT_WERROR) if(COMPILER_SUPPORT_WERROR) set(CMAKE_REQUIRED_FLAGS "-Werror") endif() - ei_add_cxx_compiler_flag("-pedantic") ei_add_cxx_compiler_flag("-Wall") ei_add_cxx_compiler_flag("-Wextra") #ei_add_cxx_compiler_flag("-Weverything") # clang - + ei_add_cxx_compiler_flag("-Wundef") ei_add_cxx_compiler_flag("-Wcast-align") ei_add_cxx_compiler_flag("-Wchar-subscripts") @@ -142,28 +164,42 @@ if(NOT MSVC) ei_add_cxx_compiler_flag("-Wpointer-arith") ei_add_cxx_compiler_flag("-Wwrite-strings") ei_add_cxx_compiler_flag("-Wformat-security") - + ei_add_cxx_compiler_flag("-Wshorten-64-to-32") + ei_add_cxx_compiler_flag("-Wlogical-op") + ei_add_cxx_compiler_flag("-Wenum-conversion") + ei_add_cxx_compiler_flag("-Wc++11-extensions") + ei_add_cxx_compiler_flag("-Wdouble-promotion") +# ei_add_cxx_compiler_flag("-Wconversion") + + ei_add_cxx_compiler_flag("-Wshadow") + ei_add_cxx_compiler_flag("-Wno-psabi") ei_add_cxx_compiler_flag("-Wno-variadic-macros") ei_add_cxx_compiler_flag("-Wno-long-long") - + ei_add_cxx_compiler_flag("-fno-check-new") ei_add_cxx_compiler_flag("-fno-common") ei_add_cxx_compiler_flag("-fstrict-aliasing") ei_add_cxx_compiler_flag("-wd981") # disable ICC's "operands are evaluated in unspecified order" remark - ei_add_cxx_compiler_flag("-wd2304") # disbale ICC's "warning #2304: non-explicit constructor with single argument may cause implicit type conversion" produced by -Wnon-virtual-dtor - + ei_add_cxx_compiler_flag("-wd2304") # disable ICC's "warning #2304: non-explicit constructor with single argument may cause implicit type conversion" produced by -Wnon-virtual-dtor + + # The -ansi flag must be added last, otherwise it is also used as a linker flag by check_cxx_compiler_flag making it fails # Moreover we should not set both -strict-ansi and -ansi check_cxx_compiler_flag("-strict-ansi" COMPILER_SUPPORT_STRICTANSI) ei_add_cxx_compiler_flag("-Qunused-arguments") # disable clang warning: argument unused during compilation: '-ansi' - + if(COMPILER_SUPPORT_STRICTANSI) set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -strict-ansi") else() ei_add_cxx_compiler_flag("-ansi") endif() - + + if(ANDROID_NDK) + ei_add_cxx_compiler_flag("-pie") + ei_add_cxx_compiler_flag("-fPIE") + endif() + set(CMAKE_REQUIRED_FLAGS "") option(EIGEN_TEST_SSE2 "Enable/Disable SSE2 in tests/examples" OFF) @@ -196,18 +232,95 @@ if(NOT MSVC) message(STATUS "Enabling SSE4.2 in tests/examples") endif() + option(EIGEN_TEST_AVX "Enable/Disable AVX in tests/examples" OFF) + if(EIGEN_TEST_AVX) + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -mavx") + message(STATUS "Enabling AVX in tests/examples") + endif() + + option(EIGEN_TEST_FMA "Enable/Disable FMA in tests/examples" OFF) + if(EIGEN_TEST_FMA AND NOT EIGEN_TEST_NEON) + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -mfma") + message(STATUS "Enabling FMA in tests/examples") + endif() + + option(EIGEN_TEST_AVX2 "Enable/Disable AVX2 in tests/examples" OFF) + if(EIGEN_TEST_AVX2) + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -mavx2 -mfma") + message(STATUS "Enabling AVX2 in tests/examples") + endif() + + option(EIGEN_TEST_AVX512 "Enable/Disable AVX512 in tests/examples" OFF) + if(EIGEN_TEST_AVX512) + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -mavx512f -mfma") + if (NOT "${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang") + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fabi-version=6") + endif() + message(STATUS "Enabling AVX512 in tests/examples") + endif() + + option(EIGEN_TEST_AVX512DQ "Enable/Disable AVX512DQ in tests/examples" OFF) + if(EIGEN_TEST_AVX512DQ) + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -mavx512dq") + if (NOT "${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang") + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fabi-version=6") + endif() + message(STATUS "Enabling AVX512DQ in tests/examples") + endif() + + option(EIGEN_TEST_F16C "Enable/Disable F16C in tests/examples" OFF) + if(EIGEN_TEST_F16C) + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -mf16c") + message(STATUS "Enabling F16C in tests/examples") + endif() + option(EIGEN_TEST_ALTIVEC "Enable/Disable AltiVec in tests/examples" OFF) if(EIGEN_TEST_ALTIVEC) set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -maltivec -mabi=altivec") message(STATUS "Enabling AltiVec in tests/examples") endif() + option(EIGEN_TEST_VSX "Enable/Disable VSX in tests/examples" OFF) + if(EIGEN_TEST_VSX) + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -m64 -mvsx") + message(STATUS "Enabling VSX in tests/examples") + endif() + + option(EIGEN_TEST_MSA "Enable/Disable MSA in tests/examples" OFF) + if(EIGEN_TEST_MSA) + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -mmsa") + message(STATUS "Enabling MSA in tests/examples") + endif() + option(EIGEN_TEST_NEON "Enable/Disable Neon in tests/examples" OFF) if(EIGEN_TEST_NEON) - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -mfpu=neon -mcpu=cortex-a8") + if(EIGEN_TEST_FMA) + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -mfpu=neon-vfpv4") + else() + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -mfpu=neon") + endif() + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -mfloat-abi=hard") + message(STATUS "Enabling NEON in tests/examples") + endif() + + option(EIGEN_TEST_NEON64 "Enable/Disable Neon in tests/examples" OFF) + if(EIGEN_TEST_NEON64) + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}") message(STATUS "Enabling NEON in tests/examples") endif() + option(EIGEN_TEST_Z13 "Enable/Disable S390X(zEC13) ZVECTOR in tests/examples" OFF) + if(EIGEN_TEST_Z13) + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -march=z13 -mzvector") + message(STATUS "Enabling S390X(zEC13) ZVECTOR in tests/examples") + endif() + + option(EIGEN_TEST_Z14 "Enable/Disable S390X(zEC14) ZVECTOR in tests/examples" OFF) + if(EIGEN_TEST_Z14) + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -march=z14 -mzvector") + message(STATUS "Enabling S390X(zEC13) ZVECTOR in tests/examples") + endif() + check_cxx_compiler_flag("-fopenmp" COMPILER_SUPPORT_OPENMP) if(COMPILER_SUPPORT_OPENMP) option(EIGEN_TEST_OPENMP "Enable/Disable OpenMP in tests/examples" OFF) @@ -217,7 +330,7 @@ if(NOT MSVC) endif() endif() -else(NOT MSVC) +else() # C4127 - conditional expression is constant # C4714 - marked as __forceinline not inlined (I failed to deactivate it selectively) @@ -225,7 +338,7 @@ else(NOT MSVC) # because we are oftentimes returning objects that have a destructor or may # throw exceptions - in particular in the unit tests we are throwing extra many # exceptions to cover indexing errors. - # C4505 - unreferenced local function has been removed (impossible to deactive selectively) + # C4505 - unreferenced local function has been removed (impossible to deactivate selectively) set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /EHsc /wd4127 /wd4505 /wd4714") # replace all /Wx by /W4 @@ -245,10 +358,23 @@ else(NOT MSVC) if(NOT CMAKE_CL_64) # arch is not supported on 64 bit systems, SSE is enabled automatically. set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /arch:SSE2") - endif(NOT CMAKE_CL_64) + endif() message(STATUS "Enabling SSE2 in tests/examples") - endif(EIGEN_TEST_SSE2) -endif(NOT MSVC) + endif() + + option(EIGEN_TEST_AVX "Enable/Disable AVX in tests/examples" OFF) + if(EIGEN_TEST_AVX) + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /arch:AVX") + message(STATUS "Enabling AVX in tests/examples") + endif() + + option(EIGEN_TEST_FMA "Enable/Disable FMA/AVX2 in tests/examples" OFF) + if(EIGEN_TEST_FMA AND NOT EIGEN_TEST_NEON) + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /arch:AVX2") + message(STATUS "Enabling FMA/AVX2 in tests/examples") + endif() + +endif() option(EIGEN_TEST_NO_EXPLICIT_VECTORIZATION "Disable explicit vectorization in tests/examples" OFF) option(EIGEN_TEST_X87 "Force using X87 instructions. Implies no vectorization." OFF) @@ -284,28 +410,45 @@ if(EIGEN_TEST_NO_EXPLICIT_ALIGNMENT) message(STATUS "Disabling alignment in tests/examples") endif() -option(EIGEN_TEST_C++0x "Enables all C++0x features." OFF) +option(EIGEN_TEST_NO_EXCEPTIONS "Disables C++ exceptions" OFF) +if(EIGEN_TEST_NO_EXCEPTIONS) + ei_add_cxx_compiler_flag("-fno-exceptions") + message(STATUS "Disabling exceptions in tests/examples") +endif() -include_directories(${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_BINARY_DIR}) +set(EIGEN_CUDA_COMPUTE_ARCH 30 CACHE STRING "The CUDA compute architecture level to target when compiling CUDA code") -# the user modifiable install path for header files -set(EIGEN_INCLUDE_INSTALL_DIR ${EIGEN_INCLUDE_INSTALL_DIR} CACHE PATH "The directory where we install the header files (optional)") +include_directories(${CMAKE_CURRENT_SOURCE_DIR}) -# set the internal install path for header files which depends on wether the user modifiable -# EIGEN_INCLUDE_INSTALL_DIR has been set by the user or not. +# Backward compatibility support for EIGEN_INCLUDE_INSTALL_DIR if(EIGEN_INCLUDE_INSTALL_DIR) - set(INCLUDE_INSTALL_DIR - ${EIGEN_INCLUDE_INSTALL_DIR} - CACHE INTERNAL - "The directory where we install the header files (internal)" - ) + message(WARNING "EIGEN_INCLUDE_INSTALL_DIR is deprecated. Use INCLUDE_INSTALL_DIR instead.") +endif() + +if(EIGEN_INCLUDE_INSTALL_DIR AND NOT INCLUDE_INSTALL_DIR) + set(INCLUDE_INSTALL_DIR ${EIGEN_INCLUDE_INSTALL_DIR} + CACHE PATH "The directory relative to CMAKE_INSTALL_PREFIX where Eigen header files are installed") else() set(INCLUDE_INSTALL_DIR - "include/eigen3" - CACHE INTERNAL - "The directory where we install the header files (internal)" - ) + "${CMAKE_INSTALL_INCLUDEDIR}/eigen3" + CACHE PATH "The directory relative to CMAKE_INSTALL_PREFIX where Eigen header files are installed" + ) endif() +set(CMAKEPACKAGE_INSTALL_DIR + "${CMAKE_INSTALL_DATADIR}/eigen3/cmake" + CACHE PATH "The directory relative to CMAKE_INSTALL_PREFIX where Eigen3Config.cmake is installed" + ) +set(PKGCONFIG_INSTALL_DIR + "${CMAKE_INSTALL_DATADIR}/pkgconfig" + CACHE PATH "The directory relative to CMAKE_INSTALL_PREFIX where eigen3.pc is installed" + ) + +foreach(var INCLUDE_INSTALL_DIR CMAKEPACKAGE_INSTALL_DIR PKGCONFIG_INSTALL_DIR) + # If an absolute path is specified, make it relative to "{CMAKE_INSTALL_PREFIX}". + if(IS_ABSOLUTE "${${var}}") + file(RELATIVE_PATH "${var}" "${CMAKE_INSTALL_PREFIX}" "${${var}}") + endif() +endforeach() # similar to set_target_properties but append the property instead of overwriting it macro(ei_add_target_property target prop value) @@ -314,9 +457,9 @@ macro(ei_add_target_property target prop value) # if the property wasn't previously set, ${previous} is now "previous-NOTFOUND" which cmake allows catching with plain if() if(NOT previous) set(previous "") - endif(NOT previous) + endif() set_target_properties(${target} PROPERTIES ${prop} "${previous} ${value}") -endmacro(ei_add_target_property) +endmacro() install(FILES signature_of_eigen3_matrix_library @@ -324,38 +467,32 @@ install(FILES ) if(EIGEN_BUILD_PKGCONFIG) - SET(path_separator ":") - STRING(REPLACE ${path_separator} ";" pkg_config_libdir_search "$ENV{PKG_CONFIG_LIBDIR}") - message(STATUS "searching for 'pkgconfig' directory in PKG_CONFIG_LIBDIR ( $ENV{PKG_CONFIG_LIBDIR} ), ${CMAKE_INSTALL_PREFIX}/share, and ${CMAKE_INSTALL_PREFIX}/lib") - FIND_PATH(pkg_config_libdir pkgconfig ${pkg_config_libdir_search} ${CMAKE_INSTALL_PREFIX}/share ${CMAKE_INSTALL_PREFIX}/lib ${pkg_config_libdir_search}) - if(pkg_config_libdir) - SET(pkg_config_install_dir ${pkg_config_libdir}) - message(STATUS "found ${pkg_config_libdir}/pkgconfig" ) - else(pkg_config_libdir) - SET(pkg_config_install_dir ${CMAKE_INSTALL_PREFIX}/share) - message(STATUS "pkgconfig not found; installing in ${pkg_config_install_dir}" ) - endif(pkg_config_libdir) - - configure_file(eigen3.pc.in eigen3.pc) + configure_file(eigen3.pc.in eigen3.pc @ONLY) install(FILES ${CMAKE_CURRENT_BINARY_DIR}/eigen3.pc - DESTINATION ${pkg_config_install_dir}/pkgconfig + DESTINATION ${PKGCONFIG_INSTALL_DIR} ) -endif(EIGEN_BUILD_PKGCONFIG) +endif() -add_subdirectory(Eigen) +install(DIRECTORY Eigen DESTINATION ${INCLUDE_INSTALL_DIR} COMPONENT Devel) -add_subdirectory(doc EXCLUDE_FROM_ALL) -include(EigenConfigureTesting) +option(EIGEN_BUILD_DOC "Enable creation of Eigen documentation" ON) +if(EIGEN_BUILD_DOC) + add_subdirectory(doc EXCLUDE_FROM_ALL) +endif() -# fixme, not sure this line is still needed: -enable_testing() # must be called from the root CMakeLists, see man page +option(BUILD_TESTING "Enable creation of Eigen tests." ON) +if(BUILD_TESTING) + include(EigenConfigureTesting) -if(EIGEN_LEAVE_TEST_IN_ALL_TARGET) - add_subdirectory(test) # can't do EXCLUDE_FROM_ALL here, breaks CTest -else() - add_subdirectory(test EXCLUDE_FROM_ALL) + if(EIGEN_LEAVE_TEST_IN_ALL_TARGET) + add_subdirectory(test) # can't do EXCLUDE_FROM_ALL here, breaks CTest + else() + add_subdirectory(test EXCLUDE_FROM_ALL) + endif() + + add_subdirectory(failtest) endif() if(EIGEN_LEAVE_TEST_IN_ALL_TARGET) @@ -366,6 +503,36 @@ else() add_subdirectory(lapack EXCLUDE_FROM_ALL) endif() +# add SYCL +option(EIGEN_TEST_SYCL "Add Sycl support." OFF) +option(EIGEN_SYCL_TRISYCL "Use the triSYCL Sycl implementation (ComputeCPP by default)." OFF) +if(EIGEN_TEST_SYCL) + set (CMAKE_MODULE_PATH "${CMAKE_ROOT}/Modules" "cmake/Modules/" "${CMAKE_MODULE_PATH}") + find_package(Threads REQUIRED) + if(EIGEN_SYCL_TRISYCL) + message(STATUS "Using triSYCL") + include(FindTriSYCL) + else() + message(STATUS "Using ComputeCPP SYCL") + include(FindComputeCpp) + set(COMPUTECPP_DRIVER_DEFAULT_VALUE OFF) + if (NOT MSVC) + set(COMPUTECPP_DRIVER_DEFAULT_VALUE ON) + endif() + option(COMPUTECPP_USE_COMPILER_DRIVER + "Use ComputeCpp driver instead of a 2 steps compilation" + ${COMPUTECPP_DRIVER_DEFAULT_VALUE} + ) + endif(EIGEN_SYCL_TRISYCL) + option(EIGEN_DONT_VECTORIZE_SYCL "Don't use vectorisation in the SYCL tests." OFF) + if(EIGEN_DONT_VECTORIZE_SYCL) + message(STATUS "Disabling SYCL vectorization in tests/examples") + # When disabling SYCL vectorization, also disable Eigen default vectorization + add_definitions(-DEIGEN_DONT_VECTORIZE=1) + add_definitions(-DEIGEN_DONT_VECTORIZE_SYCL=1) + endif() +endif() + add_subdirectory(unsupported) add_subdirectory(demos EXCLUDE_FROM_ALL) @@ -376,45 +543,111 @@ add_subdirectory(scripts EXCLUDE_FROM_ALL) # TODO: consider also replacing EIGEN_BUILD_BTL by a custom target "make btl"? if(EIGEN_BUILD_BTL) add_subdirectory(bench/btl EXCLUDE_FROM_ALL) -endif(EIGEN_BUILD_BTL) +endif() if(NOT WIN32) add_subdirectory(bench/spbench EXCLUDE_FROM_ALL) -endif(NOT WIN32) +endif() configure_file(scripts/cdashtesting.cmake.in cdashtesting.cmake @ONLY) -ei_testing_print_summary() +if(BUILD_TESTING) + ei_testing_print_summary() +endif() message(STATUS "") message(STATUS "Configured Eigen ${EIGEN_VERSION_NUMBER}") message(STATUS "") -option(EIGEN_FAILTEST "Enable failtests." OFF) -if(EIGEN_FAILTEST) - add_subdirectory(failtest) -endif() - string(TOLOWER "${CMAKE_GENERATOR}" cmake_generator_tolower) if(cmake_generator_tolower MATCHES "makefile") - message(STATUS "Some things you can do now:") - message(STATUS "--------------+--------------------------------------------------------------") - message(STATUS "Command | Description") - message(STATUS "--------------+--------------------------------------------------------------") - message(STATUS "make install | Install to ${CMAKE_INSTALL_PREFIX}. To change that:") - message(STATUS " | cmake . -DCMAKE_INSTALL_PREFIX=yourpath") - message(STATUS " | Eigen headers will then be installed to:") - message(STATUS " | ${CMAKE_INSTALL_PREFIX}/${INCLUDE_INSTALL_DIR}") - message(STATUS " | To install Eigen headers to a separate location, do:") - message(STATUS " | cmake . -DEIGEN_INCLUDE_INSTALL_DIR=yourpath") - message(STATUS "make doc | Generate the API documentation, requires Doxygen & LaTeX") - message(STATUS "make check | Build and run the unit-tests. Read this page:") - message(STATUS " | http://eigen.tuxfamily.org/index.php?title=Tests") - message(STATUS "make blas | Build BLAS library (not the same thing as Eigen)") - message(STATUS "--------------+--------------------------------------------------------------") + message(STATUS "Available targets (use: make TARGET):") else() - message(STATUS "To build/run the unit tests, read this page:") - message(STATUS " http://eigen.tuxfamily.org/index.php?title=Tests") + message(STATUS "Available targets (use: cmake --build . --target TARGET):") endif() - +message(STATUS "---------+--------------------------------------------------------------") +message(STATUS "Target | Description") +message(STATUS "---------+--------------------------------------------------------------") +message(STATUS "install | Install Eigen. Headers will be installed to:") +message(STATUS " | /") +message(STATUS " | Using the following values:") +message(STATUS " | CMAKE_INSTALL_PREFIX: ${CMAKE_INSTALL_PREFIX}") +message(STATUS " | INCLUDE_INSTALL_DIR: ${INCLUDE_INSTALL_DIR}") +message(STATUS " | Change the install location of Eigen headers using:") +message(STATUS " | cmake . -DCMAKE_INSTALL_PREFIX=yourprefix") +message(STATUS " | Or:") +message(STATUS " | cmake . -DINCLUDE_INSTALL_DIR=yourdir") +message(STATUS "doc | Generate the API documentation, requires Doxygen & LaTeX") +if(BUILD_TESTING) + message(STATUS "check | Build and run the unit-tests. Read this page:") + message(STATUS " | http://eigen.tuxfamily.org/index.php?title=Tests") +endif() +message(STATUS "blas | Build BLAS library (not the same thing as Eigen)") +message(STATUS "uninstall| Remove files installed by the install target") +message(STATUS "---------+--------------------------------------------------------------") message(STATUS "") + + +set ( EIGEN_VERSION_STRING ${EIGEN_VERSION_NUMBER} ) +set ( EIGEN_VERSION_MAJOR ${EIGEN_WORLD_VERSION} ) +set ( EIGEN_VERSION_MINOR ${EIGEN_MAJOR_VERSION} ) +set ( EIGEN_VERSION_PATCH ${EIGEN_MINOR_VERSION} ) +set ( EIGEN_DEFINITIONS "") +set ( EIGEN_INCLUDE_DIR "${CMAKE_INSTALL_PREFIX}/${INCLUDE_INSTALL_DIR}" ) +set ( EIGEN_ROOT_DIR ${CMAKE_INSTALL_PREFIX} ) + +include (CMakePackageConfigHelpers) + +# Imported target support +add_library (eigen INTERFACE) +add_library (Eigen3::Eigen ALIAS eigen) +target_compile_definitions (eigen INTERFACE ${EIGEN_DEFINITIONS}) +target_include_directories (eigen INTERFACE + $ + $ +) + +# Export as title case Eigen +set_target_properties (eigen PROPERTIES EXPORT_NAME Eigen) + +install (TARGETS eigen EXPORT Eigen3Targets) + +configure_package_config_file ( + ${CMAKE_CURRENT_SOURCE_DIR}/cmake/Eigen3Config.cmake.in + ${CMAKE_CURRENT_BINARY_DIR}/Eigen3Config.cmake + PATH_VARS EIGEN_INCLUDE_DIR EIGEN_ROOT_DIR + INSTALL_DESTINATION ${CMAKEPACKAGE_INSTALL_DIR} + NO_CHECK_REQUIRED_COMPONENTS_MACRO # Eigen does not provide components +) +# Remove CMAKE_SIZEOF_VOID_P from Eigen3ConfigVersion.cmake since Eigen does +# not depend on architecture specific settings or libraries. More +# specifically, an Eigen3Config.cmake generated from a 64 bit target can be +# used for 32 bit targets as well (and vice versa). +set (_Eigen3_CMAKE_SIZEOF_VOID_P ${CMAKE_SIZEOF_VOID_P}) +unset (CMAKE_SIZEOF_VOID_P) +write_basic_package_version_file (Eigen3ConfigVersion.cmake + VERSION ${EIGEN_VERSION_NUMBER} + COMPATIBILITY SameMajorVersion) +set (CMAKE_SIZEOF_VOID_P ${_Eigen3_CMAKE_SIZEOF_VOID_P}) + +# The Eigen target will be located in the Eigen3 namespace. Other CMake +# targets can refer to it using Eigen3::Eigen. +export (TARGETS eigen NAMESPACE Eigen3:: FILE Eigen3Targets.cmake) +# Export Eigen3 package to CMake registry such that it can be easily found by +# CMake even if it has not been installed to a standard directory. +export (PACKAGE Eigen3) + +install (EXPORT Eigen3Targets NAMESPACE Eigen3:: DESTINATION ${CMAKEPACKAGE_INSTALL_DIR}) + +install ( FILES ${CMAKE_CURRENT_SOURCE_DIR}/cmake/UseEigen3.cmake + ${CMAKE_CURRENT_BINARY_DIR}/Eigen3Config.cmake + ${CMAKE_CURRENT_BINARY_DIR}/Eigen3ConfigVersion.cmake + DESTINATION ${CMAKEPACKAGE_INSTALL_DIR} ) + +# Add uninstall target +add_custom_target ( uninstall + COMMAND ${CMAKE_COMMAND} -P ${CMAKE_CURRENT_SOURCE_DIR}/cmake/EigenUninstall.cmake) + +if (EIGEN_SPLIT_TESTSUITE) + ei_split_testsuite("${EIGEN_SPLIT_TESTSUITE}") +endif() diff --git a/extern/eigen/COPYING.APACHE b/extern/eigen/COPYING.APACHE new file mode 100644 index 00000000..61e948d2 --- /dev/null +++ b/extern/eigen/COPYING.APACHE @@ -0,0 +1,203 @@ +/* + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "[]" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright [yyyy] [name of copyright owner] + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ \ No newline at end of file diff --git a/extern/eigen/COPYING.BSD b/extern/eigen/COPYING.BSD index 11971ffe..8964ddfd 100644 --- a/extern/eigen/COPYING.BSD +++ b/extern/eigen/COPYING.BSD @@ -23,4 +23,4 @@ ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -*/ \ No newline at end of file +*/ diff --git a/extern/eigen/COPYING.MINPACK b/extern/eigen/COPYING.MINPACK index ae7984da..132cc3f3 100644 --- a/extern/eigen/COPYING.MINPACK +++ b/extern/eigen/COPYING.MINPACK @@ -49,4 +49,3 @@ SUCH LIABILITY IS ASSERTED ON THE BASIS OF CONTRACT, TORT (INCLUDING NEGLIGENCE OR STRICT LIABILITY), OR OTHERWISE, EVEN IF ANY OF SAID PARTIES HAS BEEN WARNED OF THE POSSIBILITY OF SUCH LOSS OR DAMAGES. - diff --git a/extern/eigen/Eigen/Array b/extern/eigen/Eigen/Array deleted file mode 100644 index 3d004fb6..00000000 --- a/extern/eigen/Eigen/Array +++ /dev/null @@ -1,11 +0,0 @@ -#ifndef EIGEN_ARRAY_MODULE_H -#define EIGEN_ARRAY_MODULE_H - -// include Core first to handle Eigen2 support macros -#include "Core" - -#ifndef EIGEN2_SUPPORT - #error The Eigen/Array header does no longer exist in Eigen3. All that functionality has moved to Eigen/Core. -#endif - -#endif // EIGEN_ARRAY_MODULE_H diff --git a/extern/eigen/Eigen/CMakeLists.txt b/extern/eigen/Eigen/CMakeLists.txt index a92dd6f6..9eb502b7 100644 --- a/extern/eigen/Eigen/CMakeLists.txt +++ b/extern/eigen/Eigen/CMakeLists.txt @@ -16,4 +16,4 @@ install(FILES DESTINATION ${INCLUDE_INSTALL_DIR}/Eigen COMPONENT Devel ) -add_subdirectory(src) +install(DIRECTORY src DESTINATION ${INCLUDE_INSTALL_DIR}/Eigen COMPONENT Devel FILES_MATCHING PATTERN "*.h") diff --git a/extern/eigen/Eigen/Cholesky b/extern/eigen/Eigen/Cholesky index f727f5d8..a318ceb7 100644 --- a/extern/eigen/Eigen/Cholesky +++ b/extern/eigen/Eigen/Cholesky @@ -1,7 +1,15 @@ +// This file is part of Eigen, a lightweight C++ template library +// for linear algebra. +// +// This Source Code Form is subject to the terms of the Mozilla +// Public License v. 2.0. If a copy of the MPL was not distributed +// with this file, You can obtain one at http://mozilla.org/MPL/2.0/. + #ifndef EIGEN_CHOLESKY_MODULE_H #define EIGEN_CHOLESKY_MODULE_H #include "Core" +#include "Jacobi" #include "src/Core/util/DisableStupidWarnings.h" @@ -10,23 +18,28 @@ * * * This module provides two variants of the Cholesky decomposition for selfadjoint (hermitian) matrices. - * Those decompositions are accessible via the following MatrixBase methods: - * - MatrixBase::llt(), + * Those decompositions are also accessible via the following methods: + * - MatrixBase::llt() * - MatrixBase::ldlt() + * - SelfAdjointView::llt() + * - SelfAdjointView::ldlt() * * \code * #include * \endcode */ -#include "src/misc/Solve.h" #include "src/Cholesky/LLT.h" #include "src/Cholesky/LDLT.h" #ifdef EIGEN_USE_LAPACKE -#include "src/Cholesky/LLT_MKL.h" +#ifdef EIGEN_USE_MKL +#include "mkl_lapacke.h" +#else +#include "src/misc/lapacke.h" +#endif +#include "src/Cholesky/LLT_LAPACKE.h" #endif #include "src/Core/util/ReenableStupidWarnings.h" #endif // EIGEN_CHOLESKY_MODULE_H -/* vim: set filetype=cpp et sw=2 ts=2 ai: */ diff --git a/extern/eigen/Eigen/CholmodSupport b/extern/eigen/Eigen/CholmodSupport index 745b884e..bed8924d 100644 --- a/extern/eigen/Eigen/CholmodSupport +++ b/extern/eigen/Eigen/CholmodSupport @@ -1,3 +1,10 @@ +// This file is part of Eigen, a lightweight C++ template library +// for linear algebra. +// +// This Source Code Form is subject to the terms of the Mozilla +// Public License v. 2.0. If a copy of the MPL was not distributed +// with this file, You can obtain one at http://mozilla.org/MPL/2.0/. + #ifndef EIGEN_CHOLMODSUPPORT_MODULE_H #define EIGEN_CHOLMODSUPPORT_MODULE_H @@ -12,7 +19,7 @@ extern "C" { /** \ingroup Support_modules * \defgroup CholmodSupport_Module CholmodSupport module * - * This module provides an interface to the Cholmod library which is part of the suitesparse package. + * This module provides an interface to the Cholmod library which is part of the suitesparse package. * It provides the two following main factorization classes: * - class CholmodSupernodalLLT: a supernodal LLT Cholesky factorization. * - class CholmodDecomposiiton: a general L(D)LT Cholesky factorization with automatic or explicit runtime selection of the underlying factorization method (supernodal or simplicial). @@ -33,12 +40,8 @@ extern "C" { * */ -#include "src/misc/Solve.h" -#include "src/misc/SparseSolve.h" - #include "src/CholmodSupport/CholmodSupport.h" - #include "src/Core/util/ReenableStupidWarnings.h" #endif // EIGEN_CHOLMODSUPPORT_MODULE_H diff --git a/extern/eigen/Eigen/Core b/extern/eigen/Eigen/Core index 509c529e..5921e15f 100644 --- a/extern/eigen/Eigen/Core +++ b/extern/eigen/Eigen/Core @@ -11,123 +11,55 @@ #ifndef EIGEN_CORE_H #define EIGEN_CORE_H -// first thing Eigen does: stop the compiler from committing suicide +// first thing Eigen does: stop the compiler from reporting useless warnings. #include "src/Core/util/DisableStupidWarnings.h" // then include this file where all our macros are defined. It's really important to do it first because -// it's where we do all the alignment settings (platform detection and honoring the user's will if he -// defined e.g. EIGEN_DONT_ALIGN) so it needs to be done before we do anything with vectorization. +// it's where we do all the compiler/OS/arch detections and define most defaults. #include "src/Core/util/Macros.h" +// This detects SSE/AVX/NEON/etc. and configure alignment settings +#include "src/Core/util/ConfigureVectorization.h" + +// We need cuda_runtime.h/hip_runtime.h to ensure that +// the EIGEN_USING_STD macro works properly on the device side +#if defined(EIGEN_CUDACC) + #include +#elif defined(EIGEN_HIPCC) + #include +#endif + + +#ifdef EIGEN_EXCEPTIONS + #include +#endif + // Disable the ipa-cp-clone optimization flag with MinGW 6.x or newer (enabled by default with -O3) // See http://eigen.tuxfamily.org/bz/show_bug.cgi?id=556 for details. -#if defined(__MINGW32__) && EIGEN_GNUC_AT_LEAST(4,6) +#if EIGEN_COMP_MINGW && EIGEN_GNUC_AT_LEAST(4,6) && EIGEN_GNUC_AT_MOST(5,5) #pragma GCC optimize ("-fno-ipa-cp-clone") #endif +// Prevent ICC from specializing std::complex operators that silently fail +// on device. This allows us to use our own device-compatible specializations +// instead. +#if defined(EIGEN_COMP_ICC) && defined(EIGEN_GPU_COMPILE_PHASE) \ + && !defined(_OVERRIDE_COMPLEX_SPECIALIZATION_) +#define _OVERRIDE_COMPLEX_SPECIALIZATION_ 1 +#endif #include // this include file manages BLAS and MKL related macros // and inclusion of their respective header files #include "src/Core/util/MKL_support.h" -// if alignment is disabled, then disable vectorization. Note: EIGEN_ALIGN is the proper check, it takes into -// account both the user's will (EIGEN_DONT_ALIGN) and our own platform checks -#if !EIGEN_ALIGN - #ifndef EIGEN_DONT_VECTORIZE - #define EIGEN_DONT_VECTORIZE - #endif -#endif -#ifdef _MSC_VER - #include // for _aligned_malloc -- need it regardless of whether vectorization is enabled - #if (_MSC_VER >= 1500) // 2008 or later - // Remember that usage of defined() in a #define is undefined by the standard. - // a user reported that in 64-bit mode, MSVC doesn't care to define _M_IX86_FP. - #if (defined(_M_IX86_FP) && (_M_IX86_FP >= 2)) || defined(_M_X64) - #define EIGEN_SSE2_ON_MSVC_2008_OR_LATER - #endif - #endif -#else - // Remember that usage of defined() in a #define is undefined by the standard - #if (defined __SSE2__) && ( (!defined __GNUC__) || (defined __INTEL_COMPILER) || EIGEN_GNUC_AT_LEAST(4,2) ) - #define EIGEN_SSE2_ON_NON_MSVC_BUT_NOT_OLD_GCC - #endif +#if defined(EIGEN_HAS_CUDA_FP16) || defined(EIGEN_HAS_HIP_FP16) + #define EIGEN_HAS_GPU_FP16 #endif -#ifndef EIGEN_DONT_VECTORIZE - - #if defined (EIGEN_SSE2_ON_NON_MSVC_BUT_NOT_OLD_GCC) || defined(EIGEN_SSE2_ON_MSVC_2008_OR_LATER) - - // Defines symbols for compile-time detection of which instructions are - // used. - // EIGEN_VECTORIZE_YY is defined if and only if the instruction set YY is used - #define EIGEN_VECTORIZE - #define EIGEN_VECTORIZE_SSE - #define EIGEN_VECTORIZE_SSE2 - - // Detect sse3/ssse3/sse4: - // gcc and icc defines __SSE3__, ... - // there is no way to know about this on msvc. You can define EIGEN_VECTORIZE_SSE* if you - // want to force the use of those instructions with msvc. - #ifdef __SSE3__ - #define EIGEN_VECTORIZE_SSE3 - #endif - #ifdef __SSSE3__ - #define EIGEN_VECTORIZE_SSSE3 - #endif - #ifdef __SSE4_1__ - #define EIGEN_VECTORIZE_SSE4_1 - #endif - #ifdef __SSE4_2__ - #define EIGEN_VECTORIZE_SSE4_2 - #endif - - // include files - - // This extern "C" works around a MINGW-w64 compilation issue - // https://sourceforge.net/tracker/index.php?func=detail&aid=3018394&group_id=202880&atid=983354 - // In essence, intrin.h is included by windows.h and also declares intrinsics (just as emmintrin.h etc. below do). - // However, intrin.h uses an extern "C" declaration, and g++ thus complains of duplicate declarations - // with conflicting linkage. The linkage for intrinsics doesn't matter, but at that stage the compiler doesn't know; - // so, to avoid compile errors when windows.h is included after Eigen/Core, ensure intrinsics are extern "C" here too. - // notice that since these are C headers, the extern "C" is theoretically needed anyways. - extern "C" { - // In theory we should only include immintrin.h and not the other *mmintrin.h header files directly. - // Doing so triggers some issues with ICC. However old gcc versions seems to not have this file, thus: - #if defined(__INTEL_COMPILER) && __INTEL_COMPILER >= 1110 - #include - #else - #include - #include - #ifdef EIGEN_VECTORIZE_SSE3 - #include - #endif - #ifdef EIGEN_VECTORIZE_SSSE3 - #include - #endif - #ifdef EIGEN_VECTORIZE_SSE4_1 - #include - #endif - #ifdef EIGEN_VECTORIZE_SSE4_2 - #include - #endif - #endif - } // end extern "C" - #elif defined __ALTIVEC__ - #define EIGEN_VECTORIZE - #define EIGEN_VECTORIZE_ALTIVEC - #include - // We need to #undef all these ugly tokens defined in - // => use __vector instead of vector - #undef bool - #undef vector - #undef pixel - #elif defined __ARM_NEON - #define EIGEN_VECTORIZE - #define EIGEN_VECTORIZE_NEON - #include - #endif +#if defined(EIGEN_HAS_CUDA_BF16) || defined(EIGEN_HAS_HIP_BF16) + #define EIGEN_HAS_GPU_BF16 #endif #if (defined _OPENMP) && (!defined EIGEN_DONT_PARALLELIZE) @@ -139,7 +71,7 @@ #endif // MSVC for windows mobile does not have the errno.h file -#if !(defined(_MSC_VER) && defined(_WIN32_WCE)) && !defined(__ARMCC_VERSION) +#if !(EIGEN_COMP_MSVC && EIGEN_OS_WINCE) && !EIGEN_COMP_ARM #define EIGEN_HAS_ERRNO #endif @@ -151,7 +83,10 @@ #include #include #include -#include +#include +#ifndef EIGEN_NO_IO + #include +#endif #include #include #include @@ -159,85 +94,60 @@ // for min/max: #include +#if EIGEN_HAS_CXX11 +#include +#endif + +// for std::is_nothrow_move_assignable +#ifdef EIGEN_INCLUDE_TYPE_TRAITS +#include +#endif + // for outputting debug info #ifdef EIGEN_DEBUG_ASSIGN #include #endif // required for __cpuid, needs to be included after cmath -#if defined(_MSC_VER) && (defined(_M_IX86)||defined(_M_X64)) && (!defined(_WIN32_WCE)) +#if EIGEN_COMP_MSVC && EIGEN_ARCH_i386_OR_x86_64 && !EIGEN_OS_WINCE #include #endif -#if defined(_CPPUNWIND) || defined(__EXCEPTIONS) - #define EIGEN_EXCEPTIONS -#endif - -#ifdef EIGEN_EXCEPTIONS - #include +#if defined(EIGEN_USE_SYCL) + #undef min + #undef max + #undef isnan + #undef isinf + #undef isfinite + #include + #include + #include + #include + #include + #ifndef EIGEN_SYCL_LOCAL_THREAD_DIM0 + #define EIGEN_SYCL_LOCAL_THREAD_DIM0 16 + #endif + #ifndef EIGEN_SYCL_LOCAL_THREAD_DIM1 + #define EIGEN_SYCL_LOCAL_THREAD_DIM1 16 + #endif #endif -/** \brief Namespace containing all symbols from the %Eigen library. */ -namespace Eigen { -inline static const char *SimdInstructionSetsInUse(void) { -#if defined(EIGEN_VECTORIZE_SSE4_2) - return "SSE, SSE2, SSE3, SSSE3, SSE4.1, SSE4.2"; -#elif defined(EIGEN_VECTORIZE_SSE4_1) - return "SSE, SSE2, SSE3, SSSE3, SSE4.1"; -#elif defined(EIGEN_VECTORIZE_SSSE3) - return "SSE, SSE2, SSE3, SSSE3"; -#elif defined(EIGEN_VECTORIZE_SSE3) - return "SSE, SSE2, SSE3"; -#elif defined(EIGEN_VECTORIZE_SSE2) - return "SSE, SSE2"; -#elif defined(EIGEN_VECTORIZE_ALTIVEC) - return "AltiVec"; -#elif defined(EIGEN_VECTORIZE_NEON) - return "ARM NEON"; -#else - return "None"; -#endif -} - -} // end namespace Eigen - -#define STAGE10_FULL_EIGEN2_API 10 -#define STAGE20_RESOLVE_API_CONFLICTS 20 -#define STAGE30_FULL_EIGEN3_API 30 -#define STAGE40_FULL_EIGEN3_STRICTNESS 40 -#define STAGE99_NO_EIGEN2_SUPPORT 99 - -#if defined EIGEN2_SUPPORT_STAGE40_FULL_EIGEN3_STRICTNESS - #define EIGEN2_SUPPORT - #define EIGEN2_SUPPORT_STAGE STAGE40_FULL_EIGEN3_STRICTNESS -#elif defined EIGEN2_SUPPORT_STAGE30_FULL_EIGEN3_API - #define EIGEN2_SUPPORT - #define EIGEN2_SUPPORT_STAGE STAGE30_FULL_EIGEN3_API -#elif defined EIGEN2_SUPPORT_STAGE20_RESOLVE_API_CONFLICTS - #define EIGEN2_SUPPORT - #define EIGEN2_SUPPORT_STAGE STAGE20_RESOLVE_API_CONFLICTS -#elif defined EIGEN2_SUPPORT_STAGE10_FULL_EIGEN2_API - #define EIGEN2_SUPPORT - #define EIGEN2_SUPPORT_STAGE STAGE10_FULL_EIGEN2_API -#elif defined EIGEN2_SUPPORT - // default to stage 3, that's what it's always meant - #define EIGEN2_SUPPORT_STAGE30_FULL_EIGEN3_API - #define EIGEN2_SUPPORT_STAGE STAGE30_FULL_EIGEN3_API -#else - #define EIGEN2_SUPPORT_STAGE STAGE99_NO_EIGEN2_SUPPORT +#if defined EIGEN2_SUPPORT_STAGE40_FULL_EIGEN3_STRICTNESS || defined EIGEN2_SUPPORT_STAGE30_FULL_EIGEN3_API || defined EIGEN2_SUPPORT_STAGE20_RESOLVE_API_CONFLICTS || defined EIGEN2_SUPPORT_STAGE10_FULL_EIGEN2_API || defined EIGEN2_SUPPORT +// This will generate an error message: +#error Eigen2-support is only available up to version 3.2. Please go to "http://eigen.tuxfamily.org/index.php?title=Eigen2" for further information #endif -#ifdef EIGEN2_SUPPORT -#undef minor -#endif +namespace Eigen { -// we use size_t frequently and we'll never remember to prepend it with std:: everytime just to +// we use size_t frequently and we'll never remember to prepend it with std:: every time just to // ensure QNX/QCC support using std::size_t; -// gcc 4.6.0 wants std:: for ptrdiff_t +// gcc 4.6.0 wants std:: for ptrdiff_t using std::ptrdiff_t; +} + /** \defgroup Core_Module Core module * This is the main module of Eigen providing dense matrix and vector support * (both fixed and dynamic size) with all the features corresponding to a BLAS library @@ -249,50 +159,142 @@ using std::ptrdiff_t; */ #include "src/Core/util/Constants.h" -#include "src/Core/util/ForwardDeclarations.h" #include "src/Core/util/Meta.h" +#include "src/Core/util/ForwardDeclarations.h" #include "src/Core/util/StaticAssert.h" #include "src/Core/util/XprHelper.h" #include "src/Core/util/Memory.h" +#include "src/Core/util/IntegralConstant.h" +#include "src/Core/util/SymbolicIndex.h" #include "src/Core/NumTraits.h" #include "src/Core/MathFunctions.h" #include "src/Core/GenericPacketMath.h" - -#if defined EIGEN_VECTORIZE_SSE +#include "src/Core/MathFunctionsImpl.h" +#include "src/Core/arch/Default/ConjHelper.h" +// Generic half float support +#include "src/Core/arch/Default/Half.h" +#include "src/Core/arch/Default/BFloat16.h" +#include "src/Core/arch/Default/TypeCasting.h" +#include "src/Core/arch/Default/GenericPacketMathFunctionsFwd.h" + +#if defined EIGEN_VECTORIZE_AVX512 #include "src/Core/arch/SSE/PacketMath.h" + #include "src/Core/arch/SSE/TypeCasting.h" + #include "src/Core/arch/SSE/Complex.h" + #include "src/Core/arch/AVX/PacketMath.h" + #include "src/Core/arch/AVX/TypeCasting.h" + #include "src/Core/arch/AVX/Complex.h" + #include "src/Core/arch/AVX512/PacketMath.h" + #include "src/Core/arch/AVX512/TypeCasting.h" + #include "src/Core/arch/AVX512/Complex.h" #include "src/Core/arch/SSE/MathFunctions.h" + #include "src/Core/arch/AVX/MathFunctions.h" + #include "src/Core/arch/AVX512/MathFunctions.h" +#elif defined EIGEN_VECTORIZE_AVX + // Use AVX for floats and doubles, SSE for integers + #include "src/Core/arch/SSE/PacketMath.h" + #include "src/Core/arch/SSE/TypeCasting.h" #include "src/Core/arch/SSE/Complex.h" -#elif defined EIGEN_VECTORIZE_ALTIVEC + #include "src/Core/arch/AVX/PacketMath.h" + #include "src/Core/arch/AVX/TypeCasting.h" + #include "src/Core/arch/AVX/Complex.h" + #include "src/Core/arch/SSE/MathFunctions.h" + #include "src/Core/arch/AVX/MathFunctions.h" +#elif defined EIGEN_VECTORIZE_SSE + #include "src/Core/arch/SSE/PacketMath.h" + #include "src/Core/arch/SSE/TypeCasting.h" + #include "src/Core/arch/SSE/MathFunctions.h" + #include "src/Core/arch/SSE/Complex.h" +#elif defined(EIGEN_VECTORIZE_ALTIVEC) || defined(EIGEN_VECTORIZE_VSX) #include "src/Core/arch/AltiVec/PacketMath.h" + #include "src/Core/arch/AltiVec/MathFunctions.h" #include "src/Core/arch/AltiVec/Complex.h" #elif defined EIGEN_VECTORIZE_NEON #include "src/Core/arch/NEON/PacketMath.h" + #include "src/Core/arch/NEON/TypeCasting.h" + #include "src/Core/arch/NEON/MathFunctions.h" #include "src/Core/arch/NEON/Complex.h" +#elif defined EIGEN_VECTORIZE_SVE + #include "src/Core/arch/SVE/PacketMath.h" + #include "src/Core/arch/SVE/TypeCasting.h" + #include "src/Core/arch/SVE/MathFunctions.h" +#elif defined EIGEN_VECTORIZE_ZVECTOR + #include "src/Core/arch/ZVector/PacketMath.h" + #include "src/Core/arch/ZVector/MathFunctions.h" + #include "src/Core/arch/ZVector/Complex.h" +#elif defined EIGEN_VECTORIZE_MSA + #include "src/Core/arch/MSA/PacketMath.h" + #include "src/Core/arch/MSA/MathFunctions.h" + #include "src/Core/arch/MSA/Complex.h" +#endif + +#if defined EIGEN_VECTORIZE_GPU + #include "src/Core/arch/GPU/PacketMath.h" + #include "src/Core/arch/GPU/MathFunctions.h" + #include "src/Core/arch/GPU/TypeCasting.h" +#endif + +#if defined(EIGEN_USE_SYCL) + #include "src/Core/arch/SYCL/SyclMemoryModel.h" + #include "src/Core/arch/SYCL/InteropHeaders.h" +#if !defined(EIGEN_DONT_VECTORIZE_SYCL) + #include "src/Core/arch/SYCL/PacketMath.h" + #include "src/Core/arch/SYCL/MathFunctions.h" + #include "src/Core/arch/SYCL/TypeCasting.h" +#endif #endif #include "src/Core/arch/Default/Settings.h" +// This file provides generic implementations valid for scalar as well +#include "src/Core/arch/Default/GenericPacketMathFunctions.h" + +#include "src/Core/functors/TernaryFunctors.h" +#include "src/Core/functors/BinaryFunctors.h" +#include "src/Core/functors/UnaryFunctors.h" +#include "src/Core/functors/NullaryFunctors.h" +#include "src/Core/functors/StlFunctors.h" +#include "src/Core/functors/AssignmentFunctors.h" + +// Specialized functors to enable the processing of complex numbers +// on CUDA devices +#ifdef EIGEN_CUDACC +#include "src/Core/arch/CUDA/Complex.h" +#endif -#include "src/Core/Functors.h" +#include "src/Core/util/IndexedViewHelper.h" +#include "src/Core/util/ReshapedHelper.h" +#include "src/Core/ArithmeticSequence.h" +#ifndef EIGEN_NO_IO + #include "src/Core/IO.h" +#endif #include "src/Core/DenseCoeffsBase.h" #include "src/Core/DenseBase.h" #include "src/Core/MatrixBase.h" #include "src/Core/EigenBase.h" +#include "src/Core/Product.h" +#include "src/Core/CoreEvaluators.h" +#include "src/Core/AssignEvaluator.h" + #ifndef EIGEN_PARSED_BY_DOXYGEN // work around Doxygen bug triggered by Assign.h r814874 // at least confirmed with Doxygen 1.5.5 and 1.5.6 #include "src/Core/Assign.h" #endif +#include "src/Core/ArrayBase.h" #include "src/Core/util/BlasUtil.h" #include "src/Core/DenseStorage.h" #include "src/Core/NestByValue.h" -#include "src/Core/ForceAlignedAccess.h" + +// #include "src/Core/ForceAlignedAccess.h" + #include "src/Core/ReturnByValue.h" #include "src/Core/NoAlias.h" #include "src/Core/PlainObjectBase.h" #include "src/Core/Matrix.h" #include "src/Core/Array.h" +#include "src/Core/CwiseTernaryOp.h" #include "src/Core/CwiseBinaryOp.h" #include "src/Core/CwiseUnaryOp.h" #include "src/Core/CwiseNullaryOp.h" @@ -300,32 +302,34 @@ using std::ptrdiff_t; #include "src/Core/SelfCwiseBinaryOp.h" #include "src/Core/Dot.h" #include "src/Core/StableNorm.h" -#include "src/Core/MapBase.h" #include "src/Core/Stride.h" +#include "src/Core/MapBase.h" #include "src/Core/Map.h" +#include "src/Core/Ref.h" #include "src/Core/Block.h" #include "src/Core/VectorBlock.h" -#include "src/Core/Ref.h" +#include "src/Core/IndexedView.h" +#include "src/Core/Reshaped.h" #include "src/Core/Transpose.h" #include "src/Core/DiagonalMatrix.h" #include "src/Core/Diagonal.h" #include "src/Core/DiagonalProduct.h" -#include "src/Core/PermutationMatrix.h" -#include "src/Core/Transpositions.h" #include "src/Core/Redux.h" #include "src/Core/Visitor.h" #include "src/Core/Fuzzy.h" -#include "src/Core/IO.h" #include "src/Core/Swap.h" #include "src/Core/CommaInitializer.h" -#include "src/Core/Flagged.h" -#include "src/Core/ProductBase.h" #include "src/Core/GeneralProduct.h" +#include "src/Core/Solve.h" +#include "src/Core/Inverse.h" +#include "src/Core/SolverBase.h" +#include "src/Core/PermutationMatrix.h" +#include "src/Core/Transpositions.h" #include "src/Core/TriangularMatrix.h" #include "src/Core/SelfAdjointView.h" #include "src/Core/products/GeneralBlockPanelKernel.h" #include "src/Core/products/Parallelizer.h" -#include "src/Core/products/CoeffBasedProduct.h" +#include "src/Core/ProductEvaluators.h" #include "src/Core/products/GeneralMatrixVector.h" #include "src/Core/products/GeneralMatrixMatrix.h" #include "src/Core/SolveTriangular.h" @@ -340,25 +344,33 @@ using std::ptrdiff_t; #include "src/Core/products/TriangularSolverVector.h" #include "src/Core/BandMatrix.h" #include "src/Core/CoreIterators.h" +#include "src/Core/ConditionEstimator.h" + +#if defined(EIGEN_VECTORIZE_ALTIVEC) || defined(EIGEN_VECTORIZE_VSX) + #include "src/Core/arch/AltiVec/MatrixProduct.h" +#elif defined EIGEN_VECTORIZE_NEON + #include "src/Core/arch/NEON/GeneralBlockPanelKernel.h" +#endif #include "src/Core/BooleanRedux.h" #include "src/Core/Select.h" #include "src/Core/VectorwiseOp.h" +#include "src/Core/PartialReduxEvaluator.h" #include "src/Core/Random.h" #include "src/Core/Replicate.h" #include "src/Core/Reverse.h" -#include "src/Core/ArrayBase.h" #include "src/Core/ArrayWrapper.h" +#include "src/Core/StlIterators.h" #ifdef EIGEN_USE_BLAS -#include "src/Core/products/GeneralMatrixMatrix_MKL.h" -#include "src/Core/products/GeneralMatrixVector_MKL.h" -#include "src/Core/products/GeneralMatrixMatrixTriangular_MKL.h" -#include "src/Core/products/SelfadjointMatrixMatrix_MKL.h" -#include "src/Core/products/SelfadjointMatrixVector_MKL.h" -#include "src/Core/products/TriangularMatrixMatrix_MKL.h" -#include "src/Core/products/TriangularMatrixVector_MKL.h" -#include "src/Core/products/TriangularSolverMatrix_MKL.h" +#include "src/Core/products/GeneralMatrixMatrix_BLAS.h" +#include "src/Core/products/GeneralMatrixVector_BLAS.h" +#include "src/Core/products/GeneralMatrixMatrixTriangular_BLAS.h" +#include "src/Core/products/SelfadjointMatrixMatrix_BLAS.h" +#include "src/Core/products/SelfadjointMatrixVector_BLAS.h" +#include "src/Core/products/TriangularMatrixMatrix_BLAS.h" +#include "src/Core/products/TriangularMatrixVector_BLAS.h" +#include "src/Core/products/TriangularSolverMatrix_BLAS.h" #endif // EIGEN_USE_BLAS #ifdef EIGEN_USE_MKL_VML @@ -369,8 +381,4 @@ using std::ptrdiff_t; #include "src/Core/util/ReenableStupidWarnings.h" -#ifdef EIGEN2_SUPPORT -#include "Eigen2Support" -#endif - #endif // EIGEN_CORE_H diff --git a/extern/eigen/Eigen/Eigen b/extern/eigen/Eigen/Eigen index 19b40ea4..654c8dc6 100644 --- a/extern/eigen/Eigen/Eigen +++ b/extern/eigen/Eigen/Eigen @@ -1,2 +1,2 @@ #include "Dense" -//#include "Sparse" +#include "Sparse" diff --git a/extern/eigen/Eigen/Eigen2Support b/extern/eigen/Eigen/Eigen2Support deleted file mode 100644 index 6aa009d2..00000000 --- a/extern/eigen/Eigen/Eigen2Support +++ /dev/null @@ -1,95 +0,0 @@ -// This file is part of Eigen, a lightweight C++ template library -// for linear algebra. -// -// Copyright (C) 2009 Gael Guennebaud -// -// This Source Code Form is subject to the terms of the Mozilla -// Public License v. 2.0. If a copy of the MPL was not distributed -// with this file, You can obtain one at http://mozilla.org/MPL/2.0/. - -#ifndef EIGEN2SUPPORT_H -#define EIGEN2SUPPORT_H - -#if (!defined(EIGEN2_SUPPORT)) || (!defined(EIGEN_CORE_H)) -#error Eigen2 support must be enabled by defining EIGEN2_SUPPORT before including any Eigen header -#endif - -#ifndef EIGEN_NO_EIGEN2_DEPRECATED_WARNING - -#if defined(__GNUC__) || defined(__INTEL_COMPILER) || defined(__clang__) -#warning "Eigen2 support is deprecated in Eigen 3.2.x and it will be removed in Eigen 3.3. (Define EIGEN_NO_EIGEN2_DEPRECATED_WARNING to disable this warning)" -#else -#pragma message ("Eigen2 support is deprecated in Eigen 3.2.x and it will be removed in Eigen 3.3. (Define EIGEN_NO_EIGEN2_DEPRECATED_WARNING to disable this warning)") -#endif - -#endif // EIGEN_NO_EIGEN2_DEPRECATED_WARNING - -#include "src/Core/util/DisableStupidWarnings.h" - -/** \ingroup Support_modules - * \defgroup Eigen2Support_Module Eigen2 support module - * - * \warning Eigen2 support is deprecated in Eigen 3.2.x and it will be removed in Eigen 3.3. - * - * This module provides a couple of deprecated functions improving the compatibility with Eigen2. - * - * To use it, define EIGEN2_SUPPORT before including any Eigen header - * \code - * #define EIGEN2_SUPPORT - * \endcode - * - */ - -#include "src/Eigen2Support/Macros.h" -#include "src/Eigen2Support/Memory.h" -#include "src/Eigen2Support/Meta.h" -#include "src/Eigen2Support/Lazy.h" -#include "src/Eigen2Support/Cwise.h" -#include "src/Eigen2Support/CwiseOperators.h" -#include "src/Eigen2Support/TriangularSolver.h" -#include "src/Eigen2Support/Block.h" -#include "src/Eigen2Support/VectorBlock.h" -#include "src/Eigen2Support/Minor.h" -#include "src/Eigen2Support/MathFunctions.h" - - -#include "src/Core/util/ReenableStupidWarnings.h" - -// Eigen2 used to include iostream -#include - -#define EIGEN_USING_MATRIX_TYPEDEFS_FOR_TYPE_AND_SIZE(TypeSuffix, SizeSuffix) \ -using Eigen::Matrix##SizeSuffix##TypeSuffix; \ -using Eigen::Vector##SizeSuffix##TypeSuffix; \ -using Eigen::RowVector##SizeSuffix##TypeSuffix; - -#define EIGEN_USING_MATRIX_TYPEDEFS_FOR_TYPE(TypeSuffix) \ -EIGEN_USING_MATRIX_TYPEDEFS_FOR_TYPE_AND_SIZE(TypeSuffix, 2) \ -EIGEN_USING_MATRIX_TYPEDEFS_FOR_TYPE_AND_SIZE(TypeSuffix, 3) \ -EIGEN_USING_MATRIX_TYPEDEFS_FOR_TYPE_AND_SIZE(TypeSuffix, 4) \ -EIGEN_USING_MATRIX_TYPEDEFS_FOR_TYPE_AND_SIZE(TypeSuffix, X) \ - -#define EIGEN_USING_MATRIX_TYPEDEFS \ -EIGEN_USING_MATRIX_TYPEDEFS_FOR_TYPE(i) \ -EIGEN_USING_MATRIX_TYPEDEFS_FOR_TYPE(f) \ -EIGEN_USING_MATRIX_TYPEDEFS_FOR_TYPE(d) \ -EIGEN_USING_MATRIX_TYPEDEFS_FOR_TYPE(cf) \ -EIGEN_USING_MATRIX_TYPEDEFS_FOR_TYPE(cd) - -#define USING_PART_OF_NAMESPACE_EIGEN \ -EIGEN_USING_MATRIX_TYPEDEFS \ -using Eigen::Matrix; \ -using Eigen::MatrixBase; \ -using Eigen::ei_random; \ -using Eigen::ei_real; \ -using Eigen::ei_imag; \ -using Eigen::ei_conj; \ -using Eigen::ei_abs; \ -using Eigen::ei_abs2; \ -using Eigen::ei_sqrt; \ -using Eigen::ei_exp; \ -using Eigen::ei_log; \ -using Eigen::ei_sin; \ -using Eigen::ei_cos; - -#endif // EIGEN2SUPPORT_H diff --git a/extern/eigen/Eigen/Eigenvalues b/extern/eigen/Eigen/Eigenvalues index 53c5a73a..5467a2e7 100644 --- a/extern/eigen/Eigen/Eigenvalues +++ b/extern/eigen/Eigen/Eigenvalues @@ -1,16 +1,23 @@ +// This file is part of Eigen, a lightweight C++ template library +// for linear algebra. +// +// This Source Code Form is subject to the terms of the Mozilla +// Public License v. 2.0. If a copy of the MPL was not distributed +// with this file, You can obtain one at http://mozilla.org/MPL/2.0/. + #ifndef EIGEN_EIGENVALUES_MODULE_H #define EIGEN_EIGENVALUES_MODULE_H #include "Core" -#include "src/Core/util/DisableStupidWarnings.h" - #include "Cholesky" #include "Jacobi" #include "Householder" #include "LU" #include "Geometry" +#include "src/Core/util/DisableStupidWarnings.h" + /** \defgroup Eigenvalues_Module Eigenvalues module * * @@ -25,6 +32,7 @@ * \endcode */ +#include "src/misc/RealSvd2x2.h" #include "src/Eigenvalues/Tridiagonalization.h" #include "src/Eigenvalues/RealSchur.h" #include "src/Eigenvalues/EigenSolver.h" @@ -37,12 +45,16 @@ #include "src/Eigenvalues/GeneralizedEigenSolver.h" #include "src/Eigenvalues/MatrixBaseEigenvalues.h" #ifdef EIGEN_USE_LAPACKE -#include "src/Eigenvalues/RealSchur_MKL.h" -#include "src/Eigenvalues/ComplexSchur_MKL.h" -#include "src/Eigenvalues/SelfAdjointEigenSolver_MKL.h" +#ifdef EIGEN_USE_MKL +#include "mkl_lapacke.h" +#else +#include "src/misc/lapacke.h" +#endif +#include "src/Eigenvalues/RealSchur_LAPACKE.h" +#include "src/Eigenvalues/ComplexSchur_LAPACKE.h" +#include "src/Eigenvalues/SelfAdjointEigenSolver_LAPACKE.h" #endif #include "src/Core/util/ReenableStupidWarnings.h" #endif // EIGEN_EIGENVALUES_MODULE_H -/* vim: set filetype=cpp et sw=2 ts=2 ai: */ diff --git a/extern/eigen/Eigen/Geometry b/extern/eigen/Eigen/Geometry index efd9d450..bc78110a 100644 --- a/extern/eigen/Eigen/Geometry +++ b/extern/eigen/Eigen/Geometry @@ -1,29 +1,32 @@ +// This file is part of Eigen, a lightweight C++ template library +// for linear algebra. +// +// This Source Code Form is subject to the terms of the Mozilla +// Public License v. 2.0. If a copy of the MPL was not distributed +// with this file, You can obtain one at http://mozilla.org/MPL/2.0/. + #ifndef EIGEN_GEOMETRY_MODULE_H #define EIGEN_GEOMETRY_MODULE_H #include "Core" -#include "src/Core/util/DisableStupidWarnings.h" - #include "SVD" #include "LU" #include -#ifndef M_PI -#define M_PI 3.14159265358979323846 -#endif +#include "src/Core/util/DisableStupidWarnings.h" /** \defgroup Geometry_Module Geometry module - * - * * * This module provides support for: * - fixed-size homogeneous transformations * - translation, scaling, 2D and 3D rotations - * - quaternions - * - \ref MatrixBase::cross() "cross product" - * - \ref MatrixBase::unitOrthogonal() "orthognal vector generation" - * - some linear components: parametrized-lines and hyperplanes + * - \link Quaternion quaternions \endlink + * - cross products (\ref MatrixBase::cross, \ref MatrixBase::cross3) + * - orthognal vector generation (\ref MatrixBase::unitOrthogonal) + * - some linear components: \link ParametrizedLine parametrized-lines \endlink and \link Hyperplane hyperplanes \endlink + * - \link AlignedBox axis aligned bounding boxes \endlink + * - \link umeyama least-square transformation fitting \endlink * * \code * #include @@ -33,31 +36,24 @@ #include "src/Geometry/OrthoMethods.h" #include "src/Geometry/EulerAngles.h" -#if EIGEN2_SUPPORT_STAGE > STAGE20_RESOLVE_API_CONFLICTS - #include "src/Geometry/Homogeneous.h" - #include "src/Geometry/RotationBase.h" - #include "src/Geometry/Rotation2D.h" - #include "src/Geometry/Quaternion.h" - #include "src/Geometry/AngleAxis.h" - #include "src/Geometry/Transform.h" - #include "src/Geometry/Translation.h" - #include "src/Geometry/Scaling.h" - #include "src/Geometry/Hyperplane.h" - #include "src/Geometry/ParametrizedLine.h" - #include "src/Geometry/AlignedBox.h" - #include "src/Geometry/Umeyama.h" - - #if defined EIGEN_VECTORIZE_SSE - #include "src/Geometry/arch/Geometry_SSE.h" - #endif -#endif - -#ifdef EIGEN2_SUPPORT -#include "src/Eigen2Support/Geometry/All.h" +#include "src/Geometry/Homogeneous.h" +#include "src/Geometry/RotationBase.h" +#include "src/Geometry/Rotation2D.h" +#include "src/Geometry/Quaternion.h" +#include "src/Geometry/AngleAxis.h" +#include "src/Geometry/Transform.h" +#include "src/Geometry/Translation.h" +#include "src/Geometry/Scaling.h" +#include "src/Geometry/Hyperplane.h" +#include "src/Geometry/ParametrizedLine.h" +#include "src/Geometry/AlignedBox.h" +#include "src/Geometry/Umeyama.h" + +// Use the SSE optimized version whenever possible. +#if (defined EIGEN_VECTORIZE_SSE) || (defined EIGEN_VECTORIZE_NEON) +#include "src/Geometry/arch/Geometry_SIMD.h" #endif #include "src/Core/util/ReenableStupidWarnings.h" #endif // EIGEN_GEOMETRY_MODULE_H -/* vim: set filetype=cpp et sw=2 ts=2 ai: */ - diff --git a/extern/eigen/Eigen/Householder b/extern/eigen/Eigen/Householder index 6e348db5..f2fa7996 100644 --- a/extern/eigen/Eigen/Householder +++ b/extern/eigen/Eigen/Householder @@ -1,3 +1,10 @@ +// This file is part of Eigen, a lightweight C++ template library +// for linear algebra. +// +// This Source Code Form is subject to the terms of the Mozilla +// Public License v. 2.0. If a copy of the MPL was not distributed +// with this file, You can obtain one at http://mozilla.org/MPL/2.0/. + #ifndef EIGEN_HOUSEHOLDER_MODULE_H #define EIGEN_HOUSEHOLDER_MODULE_H @@ -20,4 +27,3 @@ #include "src/Core/util/ReenableStupidWarnings.h" #endif // EIGEN_HOUSEHOLDER_MODULE_H -/* vim: set filetype=cpp et sw=2 ts=2 ai: */ diff --git a/extern/eigen/Eigen/IterativeLinearSolvers b/extern/eigen/Eigen/IterativeLinearSolvers index 0f4159dc..957d5750 100644 --- a/extern/eigen/Eigen/IterativeLinearSolvers +++ b/extern/eigen/Eigen/IterativeLinearSolvers @@ -1,3 +1,10 @@ +// This file is part of Eigen, a lightweight C++ template library +// for linear algebra. +// +// This Source Code Form is subject to the terms of the Mozilla +// Public License v. 2.0. If a copy of the MPL was not distributed +// with this file, You can obtain one at http://mozilla.org/MPL/2.0/. + #ifndef EIGEN_ITERATIVELINEARSOLVERS_MODULE_H #define EIGEN_ITERATIVELINEARSOLVERS_MODULE_H @@ -12,28 +19,29 @@ * This module currently provides iterative methods to solve problems of the form \c A \c x = \c b, where \c A is a squared matrix, usually very large and sparse. * Those solvers are accessible via the following classes: * - ConjugateGradient for selfadjoint (hermitian) matrices, + * - LeastSquaresConjugateGradient for rectangular least-square problems, * - BiCGSTAB for general square matrices. * * These iterative solvers are associated with some preconditioners: * - IdentityPreconditioner - not really useful - * - DiagonalPreconditioner - also called JAcobi preconditioner, work very well on diagonal dominant matrices. - * - IncompleteILUT - incomplete LU factorization with dual thresholding + * - DiagonalPreconditioner - also called Jacobi preconditioner, work very well on diagonal dominant matrices. + * - IncompleteLUT - incomplete LU factorization with dual thresholding * * Such problems can also be solved using the direct sparse decomposition modules: SparseCholesky, CholmodSupport, UmfPackSupport, SuperLUSupport. * - * \code - * #include - * \endcode + \code + #include + \endcode */ -#include "src/misc/Solve.h" -#include "src/misc/SparseSolve.h" - +#include "src/IterativeLinearSolvers/SolveWithGuess.h" #include "src/IterativeLinearSolvers/IterativeSolverBase.h" #include "src/IterativeLinearSolvers/BasicPreconditioners.h" #include "src/IterativeLinearSolvers/ConjugateGradient.h" +#include "src/IterativeLinearSolvers/LeastSquareConjugateGradient.h" #include "src/IterativeLinearSolvers/BiCGSTAB.h" #include "src/IterativeLinearSolvers/IncompleteLUT.h" +#include "src/IterativeLinearSolvers/IncompleteCholesky.h" #include "src/Core/util/ReenableStupidWarnings.h" diff --git a/extern/eigen/Eigen/Jacobi b/extern/eigen/Eigen/Jacobi index ba8a4dc3..43edc7a1 100644 --- a/extern/eigen/Eigen/Jacobi +++ b/extern/eigen/Eigen/Jacobi @@ -1,3 +1,10 @@ +// This file is part of Eigen, a lightweight C++ template library +// for linear algebra. +// +// This Source Code Form is subject to the terms of the Mozilla +// Public License v. 2.0. If a copy of the MPL was not distributed +// with this file, You can obtain one at http://mozilla.org/MPL/2.0/. + #ifndef EIGEN_JACOBI_MODULE_H #define EIGEN_JACOBI_MODULE_H @@ -22,5 +29,4 @@ #include "src/Core/util/ReenableStupidWarnings.h" #endif // EIGEN_JACOBI_MODULE_H -/* vim: set filetype=cpp et sw=2 ts=2 ai: */ diff --git a/extern/eigen/Eigen/KLUSupport b/extern/eigen/Eigen/KLUSupport new file mode 100644 index 00000000..b23d9053 --- /dev/null +++ b/extern/eigen/Eigen/KLUSupport @@ -0,0 +1,41 @@ +// This file is part of Eigen, a lightweight C++ template library +// for linear algebra. +// +// This Source Code Form is subject to the terms of the Mozilla +// Public License v. 2.0. If a copy of the MPL was not distributed +// with this file, You can obtain one at http://mozilla.org/MPL/2.0/. + +#ifndef EIGEN_KLUSUPPORT_MODULE_H +#define EIGEN_KLUSUPPORT_MODULE_H + +#include + +#include + +extern "C" { +#include +#include + } + +/** \ingroup Support_modules + * \defgroup KLUSupport_Module KLUSupport module + * + * This module provides an interface to the KLU library which is part of the suitesparse package. + * It provides the following factorization class: + * - class KLU: a sparse LU factorization, well-suited for circuit simulation. + * + * \code + * #include + * \endcode + * + * In order to use this module, the klu and btf headers must be accessible from the include paths, and your binary must be linked to the klu library and its dependencies. + * The dependencies depend on how umfpack has been compiled. + * For a cmake based project, you can use our FindKLU.cmake module to help you in this task. + * + */ + +#include "src/KLUSupport/KLUSupport.h" + +#include + +#endif // EIGEN_KLUSUPPORT_MODULE_H diff --git a/extern/eigen/Eigen/LU b/extern/eigen/Eigen/LU index db579550..1236ceb0 100644 --- a/extern/eigen/Eigen/LU +++ b/extern/eigen/Eigen/LU @@ -1,3 +1,10 @@ +// This file is part of Eigen, a lightweight C++ template library +// for linear algebra. +// +// This Source Code Form is subject to the terms of the Mozilla +// Public License v. 2.0. If a copy of the MPL was not distributed +// with this file, You can obtain one at http://mozilla.org/MPL/2.0/. + #ifndef EIGEN_LU_MODULE_H #define EIGEN_LU_MODULE_H @@ -16,26 +23,25 @@ * \endcode */ -#include "src/misc/Solve.h" #include "src/misc/Kernel.h" #include "src/misc/Image.h" #include "src/LU/FullPivLU.h" #include "src/LU/PartialPivLU.h" #ifdef EIGEN_USE_LAPACKE -#include "src/LU/PartialPivLU_MKL.h" +#ifdef EIGEN_USE_MKL +#include "mkl_lapacke.h" +#else +#include "src/misc/lapacke.h" #endif -#include "src/LU/Determinant.h" -#include "src/LU/Inverse.h" - -#if defined EIGEN_VECTORIZE_SSE - #include "src/LU/arch/Inverse_SSE.h" +#include "src/LU/PartialPivLU_LAPACKE.h" #endif +#include "src/LU/Determinant.h" +#include "src/LU/InverseImpl.h" -#ifdef EIGEN2_SUPPORT - #include "src/Eigen2Support/LU.h" +#if defined EIGEN_VECTORIZE_SSE || defined EIGEN_VECTORIZE_NEON + #include "src/LU/arch/InverseSize4.h" #endif #include "src/Core/util/ReenableStupidWarnings.h" #endif // EIGEN_LU_MODULE_H -/* vim: set filetype=cpp et sw=2 ts=2 ai: */ diff --git a/extern/eigen/Eigen/LeastSquares b/extern/eigen/Eigen/LeastSquares deleted file mode 100644 index 35137c25..00000000 --- a/extern/eigen/Eigen/LeastSquares +++ /dev/null @@ -1,32 +0,0 @@ -#ifndef EIGEN_REGRESSION_MODULE_H -#define EIGEN_REGRESSION_MODULE_H - -#ifndef EIGEN2_SUPPORT -#error LeastSquares is only available in Eigen2 support mode (define EIGEN2_SUPPORT) -#endif - -// exclude from normal eigen3-only documentation -#ifdef EIGEN2_SUPPORT - -#include "Core" - -#include "src/Core/util/DisableStupidWarnings.h" - -#include "Eigenvalues" -#include "Geometry" - -/** \defgroup LeastSquares_Module LeastSquares module - * This module provides linear regression and related features. - * - * \code - * #include - * \endcode - */ - -#include "src/Eigen2Support/LeastSquares.h" - -#include "src/Core/util/ReenableStupidWarnings.h" - -#endif // EIGEN2_SUPPORT - -#endif // EIGEN_REGRESSION_MODULE_H diff --git a/extern/eigen/Eigen/MetisSupport b/extern/eigen/Eigen/MetisSupport index 6a113f7a..85c41bf3 100644 --- a/extern/eigen/Eigen/MetisSupport +++ b/extern/eigen/Eigen/MetisSupport @@ -1,3 +1,10 @@ +// This file is part of Eigen, a lightweight C++ template library +// for linear algebra. +// +// This Source Code Form is subject to the terms of the Mozilla +// Public License v. 2.0. If a copy of the MPL was not distributed +// with this file, You can obtain one at http://mozilla.org/MPL/2.0/. + #ifndef EIGEN_METISSUPPORT_MODULE_H #define EIGEN_METISSUPPORT_MODULE_H diff --git a/extern/eigen/Eigen/OrderingMethods b/extern/eigen/Eigen/OrderingMethods index 7c0f1fff..29691a62 100644 --- a/extern/eigen/Eigen/OrderingMethods +++ b/extern/eigen/Eigen/OrderingMethods @@ -1,3 +1,10 @@ +// This file is part of Eigen, a lightweight C++ template library +// for linear algebra. +// +// This Source Code Form is subject to the terms of the Mozilla +// Public License v. 2.0. If a copy of the MPL was not distributed +// with this file, You can obtain one at http://mozilla.org/MPL/2.0/. + #ifndef EIGEN_ORDERINGMETHODS_MODULE_H #define EIGEN_ORDERINGMETHODS_MODULE_H @@ -56,10 +63,7 @@ * \endcode */ -#ifndef EIGEN_MPL2_ONLY #include "src/OrderingMethods/Amd.h" -#endif - #include "src/OrderingMethods/Ordering.h" #include "src/Core/util/ReenableStupidWarnings.h" diff --git a/extern/eigen/Eigen/PaStiXSupport b/extern/eigen/Eigen/PaStiXSupport index 7c616ee5..234619ac 100644 --- a/extern/eigen/Eigen/PaStiXSupport +++ b/extern/eigen/Eigen/PaStiXSupport @@ -1,3 +1,10 @@ +// This file is part of Eigen, a lightweight C++ template library +// for linear algebra. +// +// This Source Code Form is subject to the terms of the Mozilla +// Public License v. 2.0. If a copy of the MPL was not distributed +// with this file, You can obtain one at http://mozilla.org/MPL/2.0/. + #ifndef EIGEN_PASTIXSUPPORT_MODULE_H #define EIGEN_PASTIXSUPPORT_MODULE_H @@ -5,7 +12,6 @@ #include "src/Core/util/DisableStupidWarnings.h" -#include extern "C" { #include #include @@ -30,17 +36,14 @@ extern "C" { * \endcode * * In order to use this module, the PaSTiX headers must be accessible from the include paths, and your binary must be linked to the PaSTiX library and its dependencies. + * This wrapper resuires PaStiX version 5.x compiled without MPI support. * The dependencies depend on how PaSTiX has been compiled. * For a cmake based project, you can use our FindPaSTiX.cmake module to help you in this task. * */ -#include "src/misc/Solve.h" -#include "src/misc/SparseSolve.h" - #include "src/PaStiXSupport/PaStiXSupport.h" - #include "src/Core/util/ReenableStupidWarnings.h" #endif // EIGEN_PASTIXSUPPORT_MODULE_H diff --git a/extern/eigen/Eigen/PardisoSupport b/extern/eigen/Eigen/PardisoSupport index 99330ce7..340edf51 100644 --- a/extern/eigen/Eigen/PardisoSupport +++ b/extern/eigen/Eigen/PardisoSupport @@ -1,3 +1,10 @@ +// This file is part of Eigen, a lightweight C++ template library +// for linear algebra. +// +// This Source Code Form is subject to the terms of the Mozilla +// Public License v. 2.0. If a copy of the MPL was not distributed +// with this file, You can obtain one at http://mozilla.org/MPL/2.0/. + #ifndef EIGEN_PARDISOSUPPORT_MODULE_H #define EIGEN_PARDISOSUPPORT_MODULE_H @@ -7,8 +14,6 @@ #include -#include - /** \ingroup Support_modules * \defgroup PardisoSupport_Module PardisoSupport module * diff --git a/extern/eigen/Eigen/QR b/extern/eigen/Eigen/QR index ac5b0269..8465b62c 100644 --- a/extern/eigen/Eigen/QR +++ b/extern/eigen/Eigen/QR @@ -1,45 +1,50 @@ +// This file is part of Eigen, a lightweight C++ template library +// for linear algebra. +// +// This Source Code Form is subject to the terms of the Mozilla +// Public License v. 2.0. If a copy of the MPL was not distributed +// with this file, You can obtain one at http://mozilla.org/MPL/2.0/. + #ifndef EIGEN_QR_MODULE_H #define EIGEN_QR_MODULE_H #include "Core" -#include "src/Core/util/DisableStupidWarnings.h" - #include "Cholesky" #include "Jacobi" #include "Householder" +#include "src/Core/util/DisableStupidWarnings.h" + /** \defgroup QR_Module QR module * * * * This module provides various QR decompositions * This module also provides some MatrixBase methods, including: - * - MatrixBase::qr(), + * - MatrixBase::householderQr() + * - MatrixBase::colPivHouseholderQr() + * - MatrixBase::fullPivHouseholderQr() * * \code * #include * \endcode */ -#include "src/misc/Solve.h" #include "src/QR/HouseholderQR.h" #include "src/QR/FullPivHouseholderQR.h" #include "src/QR/ColPivHouseholderQR.h" +#include "src/QR/CompleteOrthogonalDecomposition.h" #ifdef EIGEN_USE_LAPACKE -#include "src/QR/HouseholderQR_MKL.h" -#include "src/QR/ColPivHouseholderQR_MKL.h" +#ifdef EIGEN_USE_MKL +#include "mkl_lapacke.h" +#else +#include "src/misc/lapacke.h" #endif - -#ifdef EIGEN2_SUPPORT -#include "src/Eigen2Support/QR.h" +#include "src/QR/HouseholderQR_LAPACKE.h" +#include "src/QR/ColPivHouseholderQR_LAPACKE.h" #endif #include "src/Core/util/ReenableStupidWarnings.h" -#ifdef EIGEN2_SUPPORT -#include "Eigenvalues" -#endif - #endif // EIGEN_QR_MODULE_H -/* vim: set filetype=cpp et sw=2 ts=2 ai: */ diff --git a/extern/eigen/Eigen/QtAlignedMalloc b/extern/eigen/Eigen/QtAlignedMalloc index 46f7d83b..6fe82374 100644 --- a/extern/eigen/Eigen/QtAlignedMalloc +++ b/extern/eigen/Eigen/QtAlignedMalloc @@ -1,3 +1,9 @@ +// This file is part of Eigen, a lightweight C++ template library +// for linear algebra. +// +// This Source Code Form is subject to the terms of the Mozilla +// Public License v. 2.0. If a copy of the MPL was not distributed +// with this file, You can obtain one at http://mozilla.org/MPL/2.0/. #ifndef EIGEN_QTMALLOC_MODULE_H #define EIGEN_QTMALLOC_MODULE_H @@ -8,7 +14,7 @@ #include "src/Core/util/DisableStupidWarnings.h" -void *qMalloc(size_t size) +void *qMalloc(std::size_t size) { return Eigen::internal::aligned_malloc(size); } @@ -18,10 +24,10 @@ void qFree(void *ptr) Eigen::internal::aligned_free(ptr); } -void *qRealloc(void *ptr, size_t size) +void *qRealloc(void *ptr, std::size_t size) { void* newPtr = Eigen::internal::aligned_malloc(size); - memcpy(newPtr, ptr, size); + std::memcpy(newPtr, ptr, size); Eigen::internal::aligned_free(ptr); return newPtr; } @@ -31,4 +37,3 @@ void *qRealloc(void *ptr, size_t size) #endif #endif // EIGEN_QTMALLOC_MODULE_H -/* vim: set filetype=cpp et sw=2 ts=2 ai: */ diff --git a/extern/eigen/Eigen/SPQRSupport b/extern/eigen/Eigen/SPQRSupport index 77016442..f70390c1 100644 --- a/extern/eigen/Eigen/SPQRSupport +++ b/extern/eigen/Eigen/SPQRSupport @@ -1,3 +1,10 @@ +// This file is part of Eigen, a lightweight C++ template library +// for linear algebra. +// +// This Source Code Form is subject to the terms of the Mozilla +// Public License v. 2.0. If a copy of the MPL was not distributed +// with this file, You can obtain one at http://mozilla.org/MPL/2.0/. + #ifndef EIGEN_SPQRSUPPORT_MODULE_H #define EIGEN_SPQRSUPPORT_MODULE_H @@ -10,7 +17,7 @@ /** \ingroup Support_modules * \defgroup SPQRSupport_Module SuiteSparseQR module * - * This module provides an interface to the SPQR library, which is part of the suitesparse package. + * This module provides an interface to the SPQR library, which is part of the suitesparse package. * * \code * #include @@ -21,8 +28,6 @@ * */ -#include "src/misc/Solve.h" -#include "src/misc/SparseSolve.h" #include "src/CholmodSupport/CholmodSupport.h" #include "src/SPQRSupport/SuiteSparseQRSupport.h" diff --git a/extern/eigen/Eigen/SVD b/extern/eigen/Eigen/SVD index fd310017..34517949 100644 --- a/extern/eigen/Eigen/SVD +++ b/extern/eigen/Eigen/SVD @@ -1,3 +1,10 @@ +// This file is part of Eigen, a lightweight C++ template library +// for linear algebra. +// +// This Source Code Form is subject to the terms of the Mozilla +// Public License v. 2.0. If a copy of the MPL was not distributed +// with this file, You can obtain one at http://mozilla.org/MPL/2.0/. + #ifndef EIGEN_SVD_MODULE_H #define EIGEN_SVD_MODULE_H @@ -12,26 +19,32 @@ * * * This module provides SVD decomposition for matrices (both real and complex). - * This decomposition is accessible via the following MatrixBase method: + * Two decomposition algorithms are provided: + * - JacobiSVD implementing two-sided Jacobi iterations is numerically very accurate, fast for small matrices, but very slow for larger ones. + * - BDCSVD implementing a recursive divide & conquer strategy on top of an upper-bidiagonalization which remains fast for large problems. + * These decompositions are accessible via the respective classes and following MatrixBase methods: * - MatrixBase::jacobiSvd() + * - MatrixBase::bdcSvd() * * \code * #include * \endcode */ -#include "src/misc/Solve.h" +#include "src/misc/RealSvd2x2.h" +#include "src/SVD/UpperBidiagonalization.h" +#include "src/SVD/SVDBase.h" #include "src/SVD/JacobiSVD.h" +#include "src/SVD/BDCSVD.h" #if defined(EIGEN_USE_LAPACKE) && !defined(EIGEN_USE_LAPACKE_STRICT) -#include "src/SVD/JacobiSVD_MKL.h" +#ifdef EIGEN_USE_MKL +#include "mkl_lapacke.h" +#else +#include "src/misc/lapacke.h" #endif -#include "src/SVD/UpperBidiagonalization.h" - -#ifdef EIGEN2_SUPPORT -#include "src/Eigen2Support/SVD.h" +#include "src/SVD/JacobiSVD_LAPACKE.h" #endif #include "src/Core/util/ReenableStupidWarnings.h" #endif // EIGEN_SVD_MODULE_H -/* vim: set filetype=cpp et sw=2 ts=2 ai: */ diff --git a/extern/eigen/Eigen/Sparse b/extern/eigen/Eigen/Sparse index 7cc9c091..a2ef7a66 100644 --- a/extern/eigen/Eigen/Sparse +++ b/extern/eigen/Eigen/Sparse @@ -1,3 +1,10 @@ +// This file is part of Eigen, a lightweight C++ template library +// for linear algebra. +// +// This Source Code Form is subject to the terms of the Mozilla +// Public License v. 2.0. If a copy of the MPL was not distributed +// with this file, You can obtain one at http://mozilla.org/MPL/2.0/. + #ifndef EIGEN_SPARSE_MODULE_H #define EIGEN_SPARSE_MODULE_H @@ -11,9 +18,9 @@ * - \ref SparseQR_Module * - \ref IterativeLinearSolvers_Module * - * \code - * #include - * \endcode + \code + #include + \endcode */ #include "SparseCore" diff --git a/extern/eigen/Eigen/SparseCholesky b/extern/eigen/Eigen/SparseCholesky index 9f5056aa..d2b1f127 100644 --- a/extern/eigen/Eigen/SparseCholesky +++ b/extern/eigen/Eigen/SparseCholesky @@ -30,18 +30,8 @@ * \endcode */ -#ifdef EIGEN_MPL2_ONLY -#error The SparseCholesky module has nothing to offer in MPL2 only mode -#endif - -#include "src/misc/Solve.h" -#include "src/misc/SparseSolve.h" #include "src/SparseCholesky/SimplicialCholesky.h" - -#ifndef EIGEN_MPL2_ONLY #include "src/SparseCholesky/SimplicialCholesky_impl.h" -#endif - #include "src/Core/util/ReenableStupidWarnings.h" #endif // EIGEN_SPARSECHOLESKY_MODULE_H diff --git a/extern/eigen/Eigen/SparseCore b/extern/eigen/Eigen/SparseCore index 24bcf015..76966c4c 100644 --- a/extern/eigen/Eigen/SparseCore +++ b/extern/eigen/Eigen/SparseCore @@ -1,3 +1,10 @@ +// This file is part of Eigen, a lightweight C++ template library +// for linear algebra. +// +// This Source Code Form is subject to the terms of the Mozilla +// Public License v. 2.0. If a copy of the MPL was not distributed +// with this file, You can obtain one at http://mozilla.org/MPL/2.0/. + #ifndef EIGEN_SPARSECORE_MODULE_H #define EIGEN_SPARSECORE_MODULE_H @@ -26,37 +33,35 @@ * This module depends on: Core. */ -namespace Eigen { - -/** The type used to identify a general sparse storage. */ -struct Sparse {}; - -} - #include "src/SparseCore/SparseUtil.h" #include "src/SparseCore/SparseMatrixBase.h" +#include "src/SparseCore/SparseAssign.h" #include "src/SparseCore/CompressedStorage.h" #include "src/SparseCore/AmbiVector.h" +#include "src/SparseCore/SparseCompressedBase.h" #include "src/SparseCore/SparseMatrix.h" +#include "src/SparseCore/SparseMap.h" #include "src/SparseCore/MappedSparseMatrix.h" #include "src/SparseCore/SparseVector.h" -#include "src/SparseCore/SparseBlock.h" -#include "src/SparseCore/SparseTranspose.h" +#include "src/SparseCore/SparseRef.h" #include "src/SparseCore/SparseCwiseUnaryOp.h" #include "src/SparseCore/SparseCwiseBinaryOp.h" +#include "src/SparseCore/SparseTranspose.h" +#include "src/SparseCore/SparseBlock.h" #include "src/SparseCore/SparseDot.h" -#include "src/SparseCore/SparsePermutation.h" #include "src/SparseCore/SparseRedux.h" -#include "src/SparseCore/SparseFuzzy.h" +#include "src/SparseCore/SparseView.h" +#include "src/SparseCore/SparseDiagonalProduct.h" #include "src/SparseCore/ConservativeSparseSparseProduct.h" #include "src/SparseCore/SparseSparseProductWithPruning.h" #include "src/SparseCore/SparseProduct.h" #include "src/SparseCore/SparseDenseProduct.h" -#include "src/SparseCore/SparseDiagonalProduct.h" -#include "src/SparseCore/SparseTriangularView.h" #include "src/SparseCore/SparseSelfAdjointView.h" +#include "src/SparseCore/SparseTriangularView.h" #include "src/SparseCore/TriangularSolver.h" -#include "src/SparseCore/SparseView.h" +#include "src/SparseCore/SparsePermutation.h" +#include "src/SparseCore/SparseFuzzy.h" +#include "src/SparseCore/SparseSolverBase.h" #include "src/Core/util/ReenableStupidWarnings.h" diff --git a/extern/eigen/Eigen/SparseLU b/extern/eigen/Eigen/SparseLU index 8527a49b..37c4a5c5 100644 --- a/extern/eigen/Eigen/SparseLU +++ b/extern/eigen/Eigen/SparseLU @@ -20,12 +20,11 @@ * Please, see the documentation of the SparseLU class for more details. */ -#include "src/misc/Solve.h" -#include "src/misc/SparseSolve.h" - // Ordering interface #include "OrderingMethods" +#include "src/Core/util/DisableStupidWarnings.h" + #include "src/SparseLU/SparseLU_gemm_kernel.h" #include "src/SparseLU/SparseLU_Structs.h" @@ -46,4 +45,6 @@ #include "src/SparseLU/SparseLU_Utils.h" #include "src/SparseLU/SparseLU.h" +#include "src/Core/util/ReenableStupidWarnings.h" + #endif // EIGEN_SPARSELU_MODULE_H diff --git a/extern/eigen/Eigen/SparseQR b/extern/eigen/Eigen/SparseQR index 4ee42065..f5fc5fa7 100644 --- a/extern/eigen/Eigen/SparseQR +++ b/extern/eigen/Eigen/SparseQR @@ -1,3 +1,10 @@ +// This file is part of Eigen, a lightweight C++ template library +// for linear algebra. +// +// This Source Code Form is subject to the terms of the Mozilla +// Public License v. 2.0. If a copy of the MPL was not distributed +// with this file, You can obtain one at http://mozilla.org/MPL/2.0/. + #ifndef EIGEN_SPARSEQR_MODULE_H #define EIGEN_SPARSEQR_MODULE_H @@ -21,10 +28,6 @@ * */ -#include "src/misc/Solve.h" -#include "src/misc/SparseSolve.h" - -#include "OrderingMethods" #include "src/SparseCore/SparseColEtree.h" #include "src/SparseQR/SparseQR.h" diff --git a/extern/eigen/Eigen/StdDeque b/extern/eigen/Eigen/StdDeque index f2723477..bc68397b 100644 --- a/extern/eigen/Eigen/StdDeque +++ b/extern/eigen/Eigen/StdDeque @@ -14,7 +14,7 @@ #include "Core" #include -#if (defined(_MSC_VER) && defined(_WIN64)) /* MSVC auto aligns in 64 bit builds */ +#if EIGEN_COMP_MSVC && EIGEN_OS_WIN64 && (EIGEN_MAX_STATIC_ALIGN_BYTES<=16) /* MSVC auto aligns up to 16 bytes in 64 bit builds */ #define EIGEN_DEFINE_STL_DEQUE_SPECIALIZATION(...) diff --git a/extern/eigen/Eigen/StdList b/extern/eigen/Eigen/StdList index 225c1e18..4c6262c0 100644 --- a/extern/eigen/Eigen/StdList +++ b/extern/eigen/Eigen/StdList @@ -13,7 +13,7 @@ #include "Core" #include -#if (defined(_MSC_VER) && defined(_WIN64)) /* MSVC auto aligns in 64 bit builds */ +#if EIGEN_COMP_MSVC && EIGEN_OS_WIN64 && (EIGEN_MAX_STATIC_ALIGN_BYTES<=16) /* MSVC auto aligns up to 16 bytes in 64 bit builds */ #define EIGEN_DEFINE_STL_LIST_SPECIALIZATION(...) diff --git a/extern/eigen/Eigen/StdVector b/extern/eigen/Eigen/StdVector index 6b22627f..0c4697ad 100644 --- a/extern/eigen/Eigen/StdVector +++ b/extern/eigen/Eigen/StdVector @@ -14,7 +14,7 @@ #include "Core" #include -#if (defined(_MSC_VER) && defined(_WIN64)) /* MSVC auto aligns in 64 bit builds */ +#if EIGEN_COMP_MSVC && EIGEN_OS_WIN64 && (EIGEN_MAX_STATIC_ALIGN_BYTES<=16) /* MSVC auto aligns up to 16 bytes in 64 bit builds */ #define EIGEN_DEFINE_STL_VECTOR_SPECIALIZATION(...) diff --git a/extern/eigen/Eigen/SuperLUSupport b/extern/eigen/Eigen/SuperLUSupport index 575e14fb..59312a82 100644 --- a/extern/eigen/Eigen/SuperLUSupport +++ b/extern/eigen/Eigen/SuperLUSupport @@ -1,3 +1,10 @@ +// This file is part of Eigen, a lightweight C++ template library +// for linear algebra. +// +// This Source Code Form is subject to the terms of the Mozilla +// Public License v. 2.0. If a copy of the MPL was not distributed +// with this file, You can obtain one at http://mozilla.org/MPL/2.0/. + #ifndef EIGEN_SUPERLUSUPPORT_MODULE_H #define EIGEN_SUPERLUSUPPORT_MODULE_H @@ -36,6 +43,8 @@ namespace Eigen { struct SluMatrix; } * - class SuperLU: a supernodal sequential LU factorization. * - class SuperILU: a supernodal sequential incomplete LU factorization (to be used as a preconditioner for iterative methods). * + * \warning This wrapper requires at least versions 4.0 of SuperLU. The 3.x versions are not supported. + * * \warning When including this module, you have to use SUPERLU_EMPTY instead of EMPTY which is no longer defined because it is too polluting. * * \code @@ -48,12 +57,8 @@ namespace Eigen { struct SluMatrix; } * */ -#include "src/misc/Solve.h" -#include "src/misc/SparseSolve.h" - #include "src/SuperLUSupport/SuperLUSupport.h" - #include "src/Core/util/ReenableStupidWarnings.h" #endif // EIGEN_SUPERLUSUPPORT_MODULE_H diff --git a/extern/eigen/Eigen/UmfPackSupport b/extern/eigen/Eigen/UmfPackSupport index 984f64a8..00eec808 100644 --- a/extern/eigen/Eigen/UmfPackSupport +++ b/extern/eigen/Eigen/UmfPackSupport @@ -1,3 +1,10 @@ +// This file is part of Eigen, a lightweight C++ template library +// for linear algebra. +// +// This Source Code Form is subject to the terms of the Mozilla +// Public License v. 2.0. If a copy of the MPL was not distributed +// with this file, You can obtain one at http://mozilla.org/MPL/2.0/. + #ifndef EIGEN_UMFPACKSUPPORT_MODULE_H #define EIGEN_UMFPACKSUPPORT_MODULE_H @@ -12,7 +19,7 @@ extern "C" { /** \ingroup Support_modules * \defgroup UmfPackSupport_Module UmfPackSupport module * - * This module provides an interface to the UmfPack library which is part of the suitesparse package. + * This module provides an interface to the UmfPack library which is part of the suitesparse package. * It provides the following factorization class: * - class UmfPackLU: a multifrontal sequential LU factorization. * @@ -26,9 +33,6 @@ extern "C" { * */ -#include "src/misc/Solve.h" -#include "src/misc/SparseSolve.h" - #include "src/UmfPackSupport/UmfPackSupport.h" #include "src/Core/util/ReenableStupidWarnings.h" diff --git a/extern/eigen/Eigen/src/CMakeLists.txt b/extern/eigen/Eigen/src/CMakeLists.txt deleted file mode 100644 index c326f374..00000000 --- a/extern/eigen/Eigen/src/CMakeLists.txt +++ /dev/null @@ -1,7 +0,0 @@ -file(GLOB Eigen_src_subdirectories "*") -escape_string_as_regex(ESCAPED_CMAKE_CURRENT_SOURCE_DIR "${CMAKE_CURRENT_SOURCE_DIR}") -foreach(f ${Eigen_src_subdirectories}) - if(NOT f MATCHES "\\.txt" AND NOT f MATCHES "${ESCAPED_CMAKE_CURRENT_SOURCE_DIR}/[.].+" ) - add_subdirectory(${f}) - endif() -endforeach() diff --git a/extern/eigen/Eigen/src/Cholesky/CMakeLists.txt b/extern/eigen/Eigen/src/Cholesky/CMakeLists.txt deleted file mode 100644 index d01488b4..00000000 --- a/extern/eigen/Eigen/src/Cholesky/CMakeLists.txt +++ /dev/null @@ -1,6 +0,0 @@ -FILE(GLOB Eigen_Cholesky_SRCS "*.h") - -INSTALL(FILES - ${Eigen_Cholesky_SRCS} - DESTINATION ${INCLUDE_INSTALL_DIR}/Eigen/src/Cholesky COMPONENT Devel - ) diff --git a/extern/eigen/Eigen/src/Cholesky/LDLT.h b/extern/eigen/Eigen/src/Cholesky/LDLT.h index abd30bd9..1013ca04 100644 --- a/extern/eigen/Eigen/src/Cholesky/LDLT.h +++ b/extern/eigen/Eigen/src/Cholesky/LDLT.h @@ -13,9 +13,18 @@ #ifndef EIGEN_LDLT_H #define EIGEN_LDLT_H -namespace Eigen { +namespace Eigen { namespace internal { + template struct traits > + : traits<_MatrixType> + { + typedef MatrixXpr XprKind; + typedef SolverStorage StorageKind; + typedef int StorageIndex; + enum { Flags = 0 }; + }; + template struct LDLT_Traits; // PositiveSemiDef means positive semi-definite and non-zero; same for NegativeSemiDef @@ -28,39 +37,40 @@ namespace internal { * * \brief Robust Cholesky decomposition of a matrix with pivoting * - * \param MatrixType the type of the matrix of which to compute the LDL^T Cholesky decomposition - * \param UpLo the triangular part that will be used for the decompositon: Lower (default) or Upper. + * \tparam _MatrixType the type of the matrix of which to compute the LDL^T Cholesky decomposition + * \tparam _UpLo the triangular part that will be used for the decompositon: Lower (default) or Upper. * The other triangular part won't be read. * * Perform a robust Cholesky decomposition of a positive semidefinite or negative semidefinite * matrix \f$ A \f$ such that \f$ A = P^TLDL^*P \f$, where P is a permutation matrix, L * is lower triangular with a unit diagonal and D is a diagonal matrix. * - * The decomposition uses pivoting to ensure stability, so that L will have + * The decomposition uses pivoting to ensure stability, so that D will have * zeros in the bottom right rank(A) - n submatrix. Avoiding the square root * on D also stabilizes the computation. * * Remember that Cholesky decompositions are not rank-revealing. Also, do not use a Cholesky * decomposition to determine whether a system of equations has a solution. * - * \sa MatrixBase::ldlt(), class LLT + * This class supports the \link InplaceDecomposition inplace decomposition \endlink mechanism. + * + * \sa MatrixBase::ldlt(), SelfAdjointView::ldlt(), class LLT */ template class LDLT + : public SolverBase > { public: typedef _MatrixType MatrixType; + typedef SolverBase Base; + friend class SolverBase; + + EIGEN_GENERIC_PUBLIC_INTERFACE(LDLT) enum { - RowsAtCompileTime = MatrixType::RowsAtCompileTime, - ColsAtCompileTime = MatrixType::ColsAtCompileTime, - Options = MatrixType::Options & ~RowMajorBit, // these are the options for the TmpMatrixType, we need a ColMajor matrix here! MaxRowsAtCompileTime = MatrixType::MaxRowsAtCompileTime, MaxColsAtCompileTime = MatrixType::MaxColsAtCompileTime, UpLo = _UpLo }; - typedef typename MatrixType::Scalar Scalar; - typedef typename NumTraits::Real RealScalar; - typedef typename MatrixType::Index Index; - typedef Matrix TmpMatrixType; + typedef Matrix TmpMatrixType; typedef Transpositions TranspositionType; typedef PermutationMatrix PermutationType; @@ -72,11 +82,11 @@ template class LDLT * The default constructor is useful in cases in which the user intends to * perform decompositions via LDLT::compute(const MatrixType&). */ - LDLT() - : m_matrix(), - m_transpositions(), + LDLT() + : m_matrix(), + m_transpositions(), m_sign(internal::ZeroSign), - m_isInitialized(false) + m_isInitialized(false) {} /** \brief Default Constructor with memory preallocation @@ -85,7 +95,7 @@ template class LDLT * according to the specified problem \a size. * \sa LDLT() */ - LDLT(Index size) + explicit LDLT(Index size) : m_matrix(size, size), m_transpositions(size), m_temporary(size), @@ -96,16 +106,35 @@ template class LDLT /** \brief Constructor with decomposition * * This calculates the decomposition for the input \a matrix. + * * \sa LDLT(Index size) */ - LDLT(const MatrixType& matrix) + template + explicit LDLT(const EigenBase& matrix) : m_matrix(matrix.rows(), matrix.cols()), m_transpositions(matrix.rows()), m_temporary(matrix.rows()), m_sign(internal::ZeroSign), m_isInitialized(false) { - compute(matrix); + compute(matrix.derived()); + } + + /** \brief Constructs a LDLT factorization from a given matrix + * + * This overloaded constructor is provided for \link InplaceDecomposition inplace decomposition \endlink when \c MatrixType is a Eigen::Ref. + * + * \sa LDLT(const EigenBase&) + */ + template + explicit LDLT(EigenBase& matrix) + : m_matrix(matrix.derived()), + m_transpositions(matrix.rows()), + m_temporary(matrix.rows()), + m_sign(internal::ZeroSign), + m_isInitialized(false) + { + compute(matrix.derived()); } /** Clear any existing decomposition @@ -151,13 +180,6 @@ template class LDLT eigen_assert(m_isInitialized && "LDLT is not initialized."); return m_sign == internal::PositiveSemiDef || m_sign == internal::ZeroSign; } - - #ifdef EIGEN2_SUPPORT - inline bool isPositiveDefinite() const - { - return isPositive(); - } - #endif /** \returns true if the matrix is negative (semidefinite) */ inline bool isNegative(void) const @@ -166,6 +188,7 @@ template class LDLT return m_sign == internal::NegativeSemiDef || m_sign == internal::ZeroSign; } + #ifdef EIGEN_PARSED_BY_DOXYGEN /** \returns a solution x of \f$ A x = b \f$ using the current decomposition of A. * * This function also supports in-place solves using the syntax x = decompositionObject.solve(x) . @@ -173,37 +196,33 @@ template class LDLT * \note_about_checking_solutions * * More precisely, this method solves \f$ A x = b \f$ using the decomposition \f$ A = P^T L D L^* P \f$ - * by solving the systems \f$ P^T y_1 = b \f$, \f$ L y_2 = y_1 \f$, \f$ D y_3 = y_2 \f$, + * by solving the systems \f$ P^T y_1 = b \f$, \f$ L y_2 = y_1 \f$, \f$ D y_3 = y_2 \f$, * \f$ L^* y_4 = y_3 \f$ and \f$ P x = y_4 \f$ in succession. If the matrix \f$ A \f$ is singular, then * \f$ D \f$ will also be singular (all the other matrices are invertible). In that case, the * least-square solution of \f$ D y_3 = y_2 \f$ is computed. This does not mean that this function - * computes the least-square solution of \f$ A x = b \f$ is \f$ A \f$ is singular. + * computes the least-square solution of \f$ A x = b \f$ if \f$ A \f$ is singular. * - * \sa MatrixBase::ldlt() + * \sa MatrixBase::ldlt(), SelfAdjointView::ldlt() */ template - inline const internal::solve_retval - solve(const MatrixBase& b) const - { - eigen_assert(m_isInitialized && "LDLT is not initialized."); - eigen_assert(m_matrix.rows()==b.rows() - && "LDLT::solve(): invalid number of rows of the right hand side matrix b"); - return internal::solve_retval(*this, b.derived()); - } - - #ifdef EIGEN2_SUPPORT - template - bool solve(const MatrixBase& b, ResultType *result) const - { - *result = this->solve(b); - return true; - } + inline const Solve + solve(const MatrixBase& b) const; #endif template bool solveInPlace(MatrixBase &bAndX) const; - LDLT& compute(const MatrixType& matrix); + template + LDLT& compute(const EigenBase& matrix); + + /** \returns an estimate of the reciprocal condition number of the matrix of + * which \c *this is the LDLT decomposition. + */ + RealScalar rcond() const + { + eigen_assert(m_isInitialized && "LDLT is not initialized."); + return internal::rcond_estimate_helper(m_l1_norm, *this); + } template LDLT& rankUpdate(const MatrixBase& w, const RealScalar& alpha=1); @@ -220,22 +239,37 @@ template class LDLT MatrixType reconstructedMatrix() const; - inline Index rows() const { return m_matrix.rows(); } - inline Index cols() const { return m_matrix.cols(); } + /** \returns the adjoint of \c *this, that is, a const reference to the decomposition itself as the underlying matrix is self-adjoint. + * + * This method is provided for compatibility with other matrix decompositions, thus enabling generic code such as: + * \code x = decomposition.adjoint().solve(b) \endcode + */ + const LDLT& adjoint() const { return *this; }; + + EIGEN_DEVICE_FUNC inline EIGEN_CONSTEXPR Index rows() const EIGEN_NOEXCEPT { return m_matrix.rows(); } + EIGEN_DEVICE_FUNC inline EIGEN_CONSTEXPR Index cols() const EIGEN_NOEXCEPT { return m_matrix.cols(); } /** \brief Reports whether previous computation was successful. * - * \returns \c Success if computation was succesful, - * \c NumericalIssue if the matrix.appears to be negative. + * \returns \c Success if computation was successful, + * \c NumericalIssue if the factorization failed because of a zero pivot. */ ComputationInfo info() const { eigen_assert(m_isInitialized && "LDLT is not initialized."); - return Success; + return m_info; } + #ifndef EIGEN_PARSED_BY_DOXYGEN + template + void _solve_impl(const RhsType &rhs, DstType &dst) const; + + template + void _solve_impl_transposed(const RhsType &rhs, DstType &dst) const; + #endif + protected: - + static void check_template_parameters() { EIGEN_STATIC_ASSERT_NON_INTEGER(Scalar); @@ -248,10 +282,12 @@ template class LDLT * is not stored), and the diagonal entries correspond to D. */ MatrixType m_matrix; + RealScalar m_l1_norm; TranspositionType m_transpositions; TmpMatrixType m_temporary; internal::SignMatrix m_sign; bool m_isInitialized; + ComputationInfo m_info; }; namespace internal { @@ -266,15 +302,18 @@ template<> struct ldlt_inplace using std::abs; typedef typename MatrixType::Scalar Scalar; typedef typename MatrixType::RealScalar RealScalar; - typedef typename MatrixType::Index Index; + typedef typename TranspositionType::StorageIndex IndexType; eigen_assert(mat.rows()==mat.cols()); const Index size = mat.rows(); + bool found_zero_pivot = false; + bool ret = true; if (size <= 1) { transpositions.setIdentity(); - if (numext::real(mat.coeff(0,0)) > 0) sign = PositiveSemiDef; - else if (numext::real(mat.coeff(0,0)) < 0) sign = NegativeSemiDef; + if(size==0) sign = ZeroSign; + else if (numext::real(mat.coeff(0,0)) > static_cast(0) ) sign = PositiveSemiDef; + else if (numext::real(mat.coeff(0,0)) < static_cast(0)) sign = NegativeSemiDef; else sign = ZeroSign; return true; } @@ -286,7 +325,7 @@ template<> struct ldlt_inplace mat.diagonal().tail(size-k).cwiseAbs().maxCoeff(&index_of_biggest_in_corner); index_of_biggest_in_corner += k; - transpositions.coeffRef(k) = index_of_biggest_in_corner; + transpositions.coeffRef(k) = IndexType(index_of_biggest_in_corner); if(k != index_of_biggest_in_corner) { // apply the transposition while taking care to consider only @@ -295,7 +334,7 @@ template<> struct ldlt_inplace mat.row(k).head(k).swap(mat.row(index_of_biggest_in_corner).head(k)); mat.col(k).tail(s).swap(mat.col(index_of_biggest_in_corner).tail(s)); std::swap(mat.coeffRef(k,k),mat.coeffRef(index_of_biggest_in_corner,index_of_biggest_in_corner)); - for(int i=k+1;i struct ldlt_inplace if(rs>0) A21.noalias() -= A20 * temp.head(k); } - + // In some previous versions of Eigen (e.g., 3.2.1), the scaling was omitted if the pivot - // was smaller than the cutoff value. However, soince LDLT is not rank-revealing - // we should only make sure we do not introduce INF or NaN values. - // LAPACK also uses 0 as the cutoff value. + // was smaller than the cutoff value. However, since LDLT is not rank-revealing + // we should only make sure that we do not introduce INF or NaN values. + // Remark that LAPACK also uses 0 as the cutoff value. RealScalar realAkk = numext::real(mat.coeffRef(k,k)); - if((rs>0) && (abs(realAkk) > RealScalar(0))) + bool pivot_is_valid = (abs(realAkk) > RealScalar(0)); + + if(k==0 && !pivot_is_valid) + { + // The entire diagonal is zero, there is nothing more to do + // except filling the transpositions, and checking whether the matrix is zero. + sign = ZeroSign; + for(Index j = 0; j0) && pivot_is_valid) A21 /= realAkk; + else if(rs>0) + ret = ret && (A21.array()==Scalar(0)).all(); + + if(found_zero_pivot && pivot_is_valid) ret = false; // factorization failed + else if(!pivot_is_valid) found_zero_pivot = true; if (sign == PositiveSemiDef) { - if (realAkk < 0) sign = Indefinite; + if (realAkk < static_cast(0)) sign = Indefinite; } else if (sign == NegativeSemiDef) { - if (realAkk > 0) sign = Indefinite; + if (realAkk > static_cast(0)) sign = Indefinite; } else if (sign == ZeroSign) { - if (realAkk > 0) sign = PositiveSemiDef; - else if (realAkk < 0) sign = NegativeSemiDef; + if (realAkk > static_cast(0)) sign = PositiveSemiDef; + else if (realAkk < static_cast(0)) sign = NegativeSemiDef; } } - return true; + return ret; } // Reference for the algorithm: Davis and Hager, "Multiple Rank @@ -356,7 +415,6 @@ template<> struct ldlt_inplace using numext::isfinite; typedef typename MatrixType::Scalar Scalar; typedef typename MatrixType::RealScalar RealScalar; - typedef typename MatrixType::Index Index; const Index size = mat.rows(); eigen_assert(mat.cols() == size && w.size()==size); @@ -420,16 +478,16 @@ template struct LDLT_Traits { typedef const TriangularView MatrixL; typedef const TriangularView MatrixU; - static inline MatrixL getL(const MatrixType& m) { return m; } - static inline MatrixU getU(const MatrixType& m) { return m.adjoint(); } + static inline MatrixL getL(const MatrixType& m) { return MatrixL(m); } + static inline MatrixU getU(const MatrixType& m) { return MatrixU(m.adjoint()); } }; template struct LDLT_Traits { typedef const TriangularView MatrixL; typedef const TriangularView MatrixU; - static inline MatrixL getL(const MatrixType& m) { return m.adjoint(); } - static inline MatrixU getU(const MatrixType& m) { return m; } + static inline MatrixL getL(const MatrixType& m) { return MatrixL(m.adjoint()); } + static inline MatrixU getU(const MatrixType& m) { return MatrixU(m); } }; } // end namespace internal @@ -437,21 +495,35 @@ template struct LDLT_Traits /** Compute / recompute the LDLT decomposition A = L D L^* = U^* D U of \a matrix */ template -LDLT& LDLT::compute(const MatrixType& a) +template +LDLT& LDLT::compute(const EigenBase& a) { check_template_parameters(); - + eigen_assert(a.rows()==a.cols()); const Index size = a.rows(); - m_matrix = a; + m_matrix = a.derived(); + + // Compute matrix L1 norm = max abs column sum. + m_l1_norm = RealScalar(0); + // TODO move this code to SelfAdjointView + for (Index col = 0; col < size; ++col) { + RealScalar abs_col_sum; + if (_UpLo == Lower) + abs_col_sum = m_matrix.col(col).tail(size - col).template lpNorm<1>() + m_matrix.row(col).head(col).template lpNorm<1>(); + else + abs_col_sum = m_matrix.col(col).head(col).template lpNorm<1>() + m_matrix.row(col).tail(size - col).template lpNorm<1>(); + if (abs_col_sum > m_l1_norm) + m_l1_norm = abs_col_sum; + } m_transpositions.resize(size); m_isInitialized = false; m_temporary.resize(size); m_sign = internal::ZeroSign; - internal::ldlt_inplace::unblocked(m_matrix, m_transpositions, m_temporary, m_sign); + m_info = internal::ldlt_inplace::unblocked(m_matrix, m_transpositions, m_temporary, m_sign) ? Success : NumericalIssue; m_isInitialized = true; return *this; @@ -466,18 +538,19 @@ template template LDLT& LDLT::rankUpdate(const MatrixBase& w, const typename LDLT::RealScalar& sigma) { + typedef typename TranspositionType::StorageIndex IndexType; const Index size = w.rows(); if (m_isInitialized) { eigen_assert(m_matrix.rows()==size); } else - { + { m_matrix.resize(size,size); m_matrix.setZero(); m_transpositions.resize(size); for (Index i = 0; i < size; i++) - m_transpositions.coeffRef(i) = i; + m_transpositions.coeffRef(i) = IndexType(i); m_temporary.resize(size); m_sign = sigma>=0 ? internal::PositiveSemiDef : internal::NegativeSemiDef; m_isInitialized = true; @@ -488,53 +561,55 @@ LDLT& LDLT::rankUpdate(const MatrixBase -struct solve_retval, Rhs> - : solve_retval_base, Rhs> +#ifndef EIGEN_PARSED_BY_DOXYGEN +template +template +void LDLT<_MatrixType,_UpLo>::_solve_impl(const RhsType &rhs, DstType &dst) const { - typedef LDLT<_MatrixType,_UpLo> LDLTType; - EIGEN_MAKE_SOLVE_HELPERS(LDLTType,Rhs) + _solve_impl_transposed(rhs, dst); +} - template void evalTo(Dest& dst) const +template +template +void LDLT<_MatrixType,_UpLo>::_solve_impl_transposed(const RhsType &rhs, DstType &dst) const +{ + // dst = P b + dst = m_transpositions * rhs; + + // dst = L^-1 (P b) + // dst = L^-*T (P b) + matrixL().template conjugateIf().solveInPlace(dst); + + // dst = D^-* (L^-1 P b) + // dst = D^-1 (L^-*T P b) + // more precisely, use pseudo-inverse of D (see bug 241) + using std::abs; + const typename Diagonal::RealReturnType vecD(vectorD()); + // In some previous versions, tolerance was set to the max of 1/highest (or rather numeric_limits::min()) + // and the maximal diagonal entry * epsilon as motivated by LAPACK's xGELSS: + // RealScalar tolerance = numext::maxi(vecD.array().abs().maxCoeff() * NumTraits::epsilon(),RealScalar(1) / NumTraits::highest()); + // However, LDLT is not rank revealing, and so adjusting the tolerance wrt to the highest + // diagonal element is not well justified and leads to numerical issues in some cases. + // Moreover, Lapack's xSYTRS routines use 0 for the tolerance. + // Using numeric_limits::min() gives us more robustness to denormals. + RealScalar tolerance = (std::numeric_limits::min)(); + for (Index i = 0; i < vecD.size(); ++i) { - eigen_assert(rhs().rows() == dec().matrixLDLT().rows()); - // dst = P b - dst = dec().transpositionsP() * rhs(); - - // dst = L^-1 (P b) - dec().matrixL().solveInPlace(dst); - - // dst = D^-1 (L^-1 P b) - // more precisely, use pseudo-inverse of D (see bug 241) - using std::abs; - using std::max; - typedef typename LDLTType::MatrixType MatrixType; - typedef typename LDLTType::RealScalar RealScalar; - const typename Diagonal::RealReturnType vectorD(dec().vectorD()); - // In some previous versions, tolerance was set to the max of 1/highest and the maximal diagonal entry * epsilon - // as motivated by LAPACK's xGELSS: - // RealScalar tolerance = (max)(vectorD.array().abs().maxCoeff() *NumTraits::epsilon(),RealScalar(1) / NumTraits::highest()); - // However, LDLT is not rank revealing, and so adjusting the tolerance wrt to the highest - // diagonal element is not well justified and to numerical issues in some cases. - // Moreover, Lapack's xSYTRS routines use 0 for the tolerance. - RealScalar tolerance = RealScalar(1) / NumTraits::highest(); - - for (Index i = 0; i < vectorD.size(); ++i) { - if(abs(vectorD(i)) > tolerance) - dst.row(i) /= vectorD(i); - else - dst.row(i).setZero(); - } + if(abs(vecD(i)) > tolerance) + dst.row(i) /= vecD(i); + else + dst.row(i).setZero(); + } - // dst = L^-T (D^-1 L^-1 P b) - dec().matrixU().solveInPlace(dst); + // dst = L^-* (D^-* L^-1 P b) + // dst = L^-T (D^-1 L^-*T P b) + matrixL().transpose().template conjugateIf().solveInPlace(dst); - // dst = P^-1 (L^-T D^-1 L^-1 P b) = A^-1 b - dst = dec().transpositionsP().transpose() * dst; - } -}; + // dst = P^T (L^-* D^-* L^-1 P b) = A^-1 b + // dst = P^-T (L^-T D^-1 L^-*T P b) = A^-1 b + dst = m_transpositions.transpose() * dst; } +#endif /** \internal use x = ldlt_object.solve(x); * @@ -588,6 +663,7 @@ MatrixType LDLT::reconstructedMatrix() const /** \cholesky_module * \returns the Cholesky decomposition with full pivoting without square root of \c *this + * \sa MatrixBase::ldlt() */ template inline const LDLT::PlainObject, UpLo> @@ -598,6 +674,7 @@ SelfAdjointView::ldlt() const /** \cholesky_module * \returns the Cholesky decomposition with full pivoting without square root of \c *this + * \sa SelfAdjointView::ldlt() */ template inline const LDLT::PlainObject> diff --git a/extern/eigen/Eigen/src/Cholesky/LLT.h b/extern/eigen/Eigen/src/Cholesky/LLT.h index 7c11a2dc..8c9b2b39 100644 --- a/extern/eigen/Eigen/src/Cholesky/LLT.h +++ b/extern/eigen/Eigen/src/Cholesky/LLT.h @@ -10,9 +10,19 @@ #ifndef EIGEN_LLT_H #define EIGEN_LLT_H -namespace Eigen { +namespace Eigen { namespace internal{ + +template struct traits > + : traits<_MatrixType> +{ + typedef MatrixXpr XprKind; + typedef SolverStorage StorageKind; + typedef int StorageIndex; + enum { Flags = 0 }; +}; + template struct LLT_Traits; } @@ -22,9 +32,9 @@ template struct LLT_Traits; * * \brief Standard Cholesky decomposition (LL^T) of a matrix and associated features * - * \param MatrixType the type of the matrix of which we are computing the LL^T Cholesky decomposition - * \param UpLo the triangular part that will be used for the decompositon: Lower (default) or Upper. - * The other triangular part won't be read. + * \tparam _MatrixType the type of the matrix of which we are computing the LL^T Cholesky decomposition + * \tparam _UpLo the triangular part that will be used for the decompositon: Lower (default) or Upper. + * The other triangular part won't be read. * * This class performs a LL^T Cholesky decomposition of a symmetric, positive definite * matrix A such that A = LL^* = U^*U, where L is lower triangular. @@ -40,26 +50,31 @@ template struct LLT_Traits; * * Example: \include LLT_example.cpp * Output: \verbinclude LLT_example.out - * - * \sa MatrixBase::llt(), class LDLT - */ - /* HEY THIS DOX IS DISABLED BECAUSE THERE's A BUG EITHER HERE OR IN LDLT ABOUT THAT (OR BOTH) - * Note that during the decomposition, only the upper triangular part of A is considered. Therefore, - * the strict lower part does not have to store correct values. + * + * \b Performance: for best performance, it is recommended to use a column-major storage format + * with the Lower triangular part (the default), or, equivalently, a row-major storage format + * with the Upper triangular part. Otherwise, you might get a 20% slowdown for the full factorization + * step, and rank-updates can be up to 3 times slower. + * + * This class supports the \link InplaceDecomposition inplace decomposition \endlink mechanism. + * + * Note that during the decomposition, only the lower (or upper, as defined by _UpLo) triangular part of A is considered. + * Therefore, the strict lower part does not have to store correct values. + * + * \sa MatrixBase::llt(), SelfAdjointView::llt(), class LDLT */ template class LLT + : public SolverBase > { public: typedef _MatrixType MatrixType; + typedef SolverBase Base; + friend class SolverBase; + + EIGEN_GENERIC_PUBLIC_INTERFACE(LLT) enum { - RowsAtCompileTime = MatrixType::RowsAtCompileTime, - ColsAtCompileTime = MatrixType::ColsAtCompileTime, - Options = MatrixType::Options, MaxColsAtCompileTime = MatrixType::MaxColsAtCompileTime }; - typedef typename MatrixType::Scalar Scalar; - typedef typename NumTraits::Real RealScalar; - typedef typename MatrixType::Index Index; enum { PacketSize = internal::packet_traits::size, @@ -83,14 +98,30 @@ template class LLT * according to the specified problem \a size. * \sa LLT() */ - LLT(Index size) : m_matrix(size, size), + explicit LLT(Index size) : m_matrix(size, size), m_isInitialized(false) {} - LLT(const MatrixType& matrix) + template + explicit LLT(const EigenBase& matrix) : m_matrix(matrix.rows(), matrix.cols()), m_isInitialized(false) { - compute(matrix); + compute(matrix.derived()); + } + + /** \brief Constructs a LLT factorization from a given matrix + * + * This overloaded constructor is provided for \link InplaceDecomposition inplace decomposition \endlink when + * \c MatrixType is a Eigen::Ref. + * + * \sa LLT(const EigenBase&) + */ + template + explicit LLT(EigenBase& matrix) + : m_matrix(matrix.derived()), + m_isInitialized(false) + { + compute(matrix.derived()); } /** \returns a view of the upper triangular matrix U */ @@ -107,6 +138,7 @@ template class LLT return Traits::getL(m_matrix); } + #ifdef EIGEN_PARSED_BY_DOXYGEN /** \returns the solution x of \f$ A x = b \f$ using the current decomposition of A. * * Since this LLT class assumes anyway that the matrix A is invertible, the solution @@ -115,33 +147,28 @@ template class LLT * Example: \include LLT_solve.cpp * Output: \verbinclude LLT_solve.out * - * \sa solveInPlace(), MatrixBase::llt() + * \sa solveInPlace(), MatrixBase::llt(), SelfAdjointView::llt() */ template - inline const internal::solve_retval - solve(const MatrixBase& b) const - { - eigen_assert(m_isInitialized && "LLT is not initialized."); - eigen_assert(m_matrix.rows()==b.rows() - && "LLT::solve(): invalid number of rows of the right hand side matrix b"); - return internal::solve_retval(*this, b.derived()); - } - - #ifdef EIGEN2_SUPPORT - template - bool solve(const MatrixBase& b, ResultType *result) const - { - *result = this->solve(b); - return true; - } - - bool isPositiveDefinite() const { return true; } + inline const Solve + solve(const MatrixBase& b) const; #endif template - void solveInPlace(MatrixBase &bAndX) const; + void solveInPlace(const MatrixBase &bAndX) const; - LLT& compute(const MatrixType& matrix); + template + LLT& compute(const EigenBase& matrix); + + /** \returns an estimate of the reciprocal condition number of the matrix of + * which \c *this is the Cholesky decomposition. + */ + RealScalar rcond() const + { + eigen_assert(m_isInitialized && "LLT is not initialized."); + eigen_assert(m_info == Success && "LLT failed because matrix appears to be negative"); + return internal::rcond_estimate_helper(m_l1_norm, *this); + } /** \returns the LLT decomposition matrix * @@ -158,8 +185,8 @@ template class LLT /** \brief Reports whether previous computation was successful. * - * \returns \c Success if computation was succesful, - * \c NumericalIssue if the matrix.appears to be negative. + * \returns \c Success if computation was successful, + * \c NumericalIssue if the matrix.appears not to be positive definite. */ ComputationInfo info() const { @@ -167,24 +194,40 @@ template class LLT return m_info; } - inline Index rows() const { return m_matrix.rows(); } - inline Index cols() const { return m_matrix.cols(); } + /** \returns the adjoint of \c *this, that is, a const reference to the decomposition itself as the underlying matrix is self-adjoint. + * + * This method is provided for compatibility with other matrix decompositions, thus enabling generic code such as: + * \code x = decomposition.adjoint().solve(b) \endcode + */ + const LLT& adjoint() const EIGEN_NOEXCEPT { return *this; }; + + inline EIGEN_CONSTEXPR Index rows() const EIGEN_NOEXCEPT { return m_matrix.rows(); } + inline EIGEN_CONSTEXPR Index cols() const EIGEN_NOEXCEPT { return m_matrix.cols(); } template - LLT rankUpdate(const VectorType& vec, const RealScalar& sigma = 1); + LLT & rankUpdate(const VectorType& vec, const RealScalar& sigma = 1); + + #ifndef EIGEN_PARSED_BY_DOXYGEN + template + void _solve_impl(const RhsType &rhs, DstType &dst) const; + + template + void _solve_impl_transposed(const RhsType &rhs, DstType &dst) const; + #endif protected: - + static void check_template_parameters() { EIGEN_STATIC_ASSERT_NON_INTEGER(Scalar); } - + /** \internal * Used to compute and store L * The strict upper part is not used and even not initialized. */ MatrixType m_matrix; + RealScalar m_l1_norm; bool m_isInitialized; ComputationInfo m_info; }; @@ -194,12 +237,11 @@ namespace internal { template struct llt_inplace; template -static typename MatrixType::Index llt_rank_update_lower(MatrixType& mat, const VectorType& vec, const typename MatrixType::RealScalar& sigma) +static Index llt_rank_update_lower(MatrixType& mat, const VectorType& vec, const typename MatrixType::RealScalar& sigma) { using std::sqrt; typedef typename MatrixType::Scalar Scalar; typedef typename MatrixType::RealScalar RealScalar; - typedef typename MatrixType::Index Index; typedef typename MatrixType::ColXpr ColXpr; typedef typename internal::remove_all::type ColXprCleaned; typedef typename ColXprCleaned::SegmentReturnType ColXprSegment; @@ -268,11 +310,10 @@ template struct llt_inplace { typedef typename NumTraits::Real RealScalar; template - static typename MatrixType::Index unblocked(MatrixType& mat) + static Index unblocked(MatrixType& mat) { using std::sqrt; - typedef typename MatrixType::Index Index; - + eigen_assert(mat.rows()==mat.cols()); const Index size = mat.rows(); for(Index k = 0; k < size; ++k) @@ -295,9 +336,8 @@ template struct llt_inplace } template - static typename MatrixType::Index blocked(MatrixType& m) + static Index blocked(MatrixType& m) { - typedef typename MatrixType::Index Index; eigen_assert(m.rows()==m.cols()); Index size = m.rows(); if(size<32) @@ -322,36 +362,36 @@ template struct llt_inplace Index ret; if((ret=unblocked(A11))>=0) return k+ret; if(rs>0) A11.adjoint().template triangularView().template solveInPlace(A21); - if(rs>0) A22.template selfadjointView().rankUpdate(A21,-1); // bottleneck + if(rs>0) A22.template selfadjointView().rankUpdate(A21,typename NumTraits::Literal(-1)); // bottleneck } return -1; } template - static typename MatrixType::Index rankUpdate(MatrixType& mat, const VectorType& vec, const RealScalar& sigma) + static Index rankUpdate(MatrixType& mat, const VectorType& vec, const RealScalar& sigma) { return Eigen::internal::llt_rank_update_lower(mat, vec, sigma); } }; - + template struct llt_inplace { typedef typename NumTraits::Real RealScalar; template - static EIGEN_STRONG_INLINE typename MatrixType::Index unblocked(MatrixType& mat) + static EIGEN_STRONG_INLINE Index unblocked(MatrixType& mat) { Transpose matt(mat); return llt_inplace::unblocked(matt); } template - static EIGEN_STRONG_INLINE typename MatrixType::Index blocked(MatrixType& mat) + static EIGEN_STRONG_INLINE Index blocked(MatrixType& mat) { Transpose matt(mat); return llt_inplace::blocked(matt); } template - static typename MatrixType::Index rankUpdate(MatrixType& mat, const VectorType& vec, const RealScalar& sigma) + static Index rankUpdate(MatrixType& mat, const VectorType& vec, const RealScalar& sigma) { Transpose matt(mat); return llt_inplace::rankUpdate(matt, vec.conjugate(), sigma); @@ -362,8 +402,8 @@ template struct LLT_Traits { typedef const TriangularView MatrixL; typedef const TriangularView MatrixU; - static inline MatrixL getL(const MatrixType& m) { return m; } - static inline MatrixU getU(const MatrixType& m) { return m.adjoint(); } + static inline MatrixL getL(const MatrixType& m) { return MatrixL(m); } + static inline MatrixU getU(const MatrixType& m) { return MatrixU(m.adjoint()); } static bool inplace_decomposition(MatrixType& m) { return llt_inplace::blocked(m)==-1; } }; @@ -372,8 +412,8 @@ template struct LLT_Traits { typedef const TriangularView MatrixL; typedef const TriangularView MatrixU; - static inline MatrixL getL(const MatrixType& m) { return m.adjoint(); } - static inline MatrixU getU(const MatrixType& m) { return m; } + static inline MatrixL getL(const MatrixType& m) { return MatrixL(m.adjoint()); } + static inline MatrixU getU(const MatrixType& m) { return MatrixU(m); } static bool inplace_decomposition(MatrixType& m) { return llt_inplace::blocked(m)==-1; } }; @@ -388,14 +428,29 @@ template struct LLT_Traits * Output: \verbinclude TutorialLinAlgComputeTwice.out */ template -LLT& LLT::compute(const MatrixType& a) +template +LLT& LLT::compute(const EigenBase& a) { check_template_parameters(); - + eigen_assert(a.rows()==a.cols()); const Index size = a.rows(); m_matrix.resize(size, size); - m_matrix = a; + if (!internal::is_same_dense(m_matrix, a.derived())) + m_matrix = a.derived(); + + // Compute matrix L1 norm = max abs column sum. + m_l1_norm = RealScalar(0); + // TODO move this code to SelfAdjointView + for (Index col = 0; col < size; ++col) { + RealScalar abs_col_sum; + if (_UpLo == Lower) + abs_col_sum = m_matrix.col(col).tail(size - col).template lpNorm<1>() + m_matrix.row(col).head(col).template lpNorm<1>(); + else + abs_col_sum = m_matrix.col(col).head(col).template lpNorm<1>() + m_matrix.row(col).tail(size - col).template lpNorm<1>(); + if (abs_col_sum > m_l1_norm) + m_l1_norm = abs_col_sum; + } m_isInitialized = true; bool ok = Traits::inplace_decomposition(m_matrix); @@ -411,7 +466,7 @@ LLT& LLT::compute(const MatrixType& a) */ template template -LLT<_MatrixType,_UpLo> LLT<_MatrixType,_UpLo>::rankUpdate(const VectorType& v, const RealScalar& sigma) +LLT<_MatrixType,_UpLo> & LLT<_MatrixType,_UpLo>::rankUpdate(const VectorType& v, const RealScalar& sigma) { EIGEN_STATIC_ASSERT_VECTOR_ONLY(VectorType); eigen_assert(v.size()==m_matrix.cols()); @@ -423,39 +478,42 @@ LLT<_MatrixType,_UpLo> LLT<_MatrixType,_UpLo>::rankUpdate(const VectorType& v, c return *this; } - -namespace internal { -template -struct solve_retval, Rhs> - : solve_retval_base, Rhs> + +#ifndef EIGEN_PARSED_BY_DOXYGEN +template +template +void LLT<_MatrixType,_UpLo>::_solve_impl(const RhsType &rhs, DstType &dst) const +{ + _solve_impl_transposed(rhs, dst); +} + +template +template +void LLT<_MatrixType,_UpLo>::_solve_impl_transposed(const RhsType &rhs, DstType &dst) const { - typedef LLT<_MatrixType,UpLo> LLTType; - EIGEN_MAKE_SOLVE_HELPERS(LLTType,Rhs) + dst = rhs; - template void evalTo(Dest& dst) const - { - dst = rhs(); - dec().solveInPlace(dst); - } -}; + matrixL().template conjugateIf().solveInPlace(dst); + matrixU().template conjugateIf().solveInPlace(dst); } +#endif /** \internal use x = llt_object.solve(x); - * + * * This is the \em in-place version of solve(). * * \param bAndX represents both the right-hand side matrix b and result x. * - * \returns true always! If you need to check for existence of solutions, use another decomposition like LU, QR, or SVD. + * This version avoids a copy when the right hand side matrix b is not needed anymore. * - * This version avoids a copy when the right hand side matrix b is not - * needed anymore. + * \warning The parameter is only marked 'const' to make the C++ compiler accept a temporary expression here. + * This function will const_cast it, so constness isn't honored here. * * \sa LLT::solve(), MatrixBase::llt() */ template template -void LLT::solveInPlace(MatrixBase &bAndX) const +void LLT::solveInPlace(const MatrixBase &bAndX) const { eigen_assert(m_isInitialized && "LLT is not initialized."); eigen_assert(m_matrix.rows()==bAndX.rows()); @@ -475,6 +533,7 @@ MatrixType LLT::reconstructedMatrix() const /** \cholesky_module * \returns the LLT decomposition of \c *this + * \sa SelfAdjointView::llt() */ template inline const LLT::PlainObject> @@ -485,6 +544,7 @@ MatrixBase::llt() const /** \cholesky_module * \returns the LLT decomposition of \c *this + * \sa SelfAdjointView::llt() */ template inline const LLT::PlainObject, UpLo> diff --git a/extern/eigen/Eigen/src/Cholesky/LLT_MKL.h b/extern/eigen/Eigen/src/Cholesky/LLT_LAPACKE.h similarity index 71% rename from extern/eigen/Eigen/src/Cholesky/LLT_MKL.h rename to extern/eigen/Eigen/src/Cholesky/LLT_LAPACKE.h index 66675d74..bc6489e6 100644 --- a/extern/eigen/Eigen/src/Cholesky/LLT_MKL.h +++ b/extern/eigen/Eigen/src/Cholesky/LLT_LAPACKE.h @@ -25,41 +25,38 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. ******************************************************************************** - * Content : Eigen bindings to Intel(R) MKL + * Content : Eigen bindings to LAPACKe * LLt decomposition based on LAPACKE_?potrf function. ******************************************************************************** */ -#ifndef EIGEN_LLT_MKL_H -#define EIGEN_LLT_MKL_H - -#include "Eigen/src/Core/util/MKL_support.h" -#include +#ifndef EIGEN_LLT_LAPACKE_H +#define EIGEN_LLT_LAPACKE_H namespace Eigen { namespace internal { -template struct mkl_llt; +template struct lapacke_llt; -#define EIGEN_MKL_LLT(EIGTYPE, MKLTYPE, MKLPREFIX) \ -template<> struct mkl_llt \ +#define EIGEN_LAPACKE_LLT(EIGTYPE, BLASTYPE, LAPACKE_PREFIX) \ +template<> struct lapacke_llt \ { \ template \ - static inline typename MatrixType::Index potrf(MatrixType& m, char uplo) \ + static inline Index potrf(MatrixType& m, char uplo) \ { \ lapack_int matrix_order; \ lapack_int size, lda, info, StorageOrder; \ EIGTYPE* a; \ eigen_assert(m.rows()==m.cols()); \ /* Set up parameters for ?potrf */ \ - size = m.rows(); \ + size = convert_index(m.rows()); \ StorageOrder = MatrixType::Flags&RowMajorBit?RowMajor:ColMajor; \ matrix_order = StorageOrder==RowMajor ? LAPACK_ROW_MAJOR : LAPACK_COL_MAJOR; \ a = &(m.coeffRef(0,0)); \ - lda = m.outerStride(); \ + lda = convert_index(m.outerStride()); \ \ - info = LAPACKE_##MKLPREFIX##potrf( matrix_order, uplo, size, (MKLTYPE*)a, lda ); \ + info = LAPACKE_##LAPACKE_PREFIX##potrf( matrix_order, uplo, size, (BLASTYPE*)a, lda ); \ info = (info==0) ? -1 : info>0 ? info-1 : size; \ return info; \ } \ @@ -67,36 +64,36 @@ template<> struct mkl_llt \ template<> struct llt_inplace \ { \ template \ - static typename MatrixType::Index blocked(MatrixType& m) \ + static Index blocked(MatrixType& m) \ { \ - return mkl_llt::potrf(m, 'L'); \ + return lapacke_llt::potrf(m, 'L'); \ } \ template \ - static typename MatrixType::Index rankUpdate(MatrixType& mat, const VectorType& vec, const typename MatrixType::RealScalar& sigma) \ + static Index rankUpdate(MatrixType& mat, const VectorType& vec, const typename MatrixType::RealScalar& sigma) \ { return Eigen::internal::llt_rank_update_lower(mat, vec, sigma); } \ }; \ template<> struct llt_inplace \ { \ template \ - static typename MatrixType::Index blocked(MatrixType& m) \ + static Index blocked(MatrixType& m) \ { \ - return mkl_llt::potrf(m, 'U'); \ + return lapacke_llt::potrf(m, 'U'); \ } \ template \ - static typename MatrixType::Index rankUpdate(MatrixType& mat, const VectorType& vec, const typename MatrixType::RealScalar& sigma) \ + static Index rankUpdate(MatrixType& mat, const VectorType& vec, const typename MatrixType::RealScalar& sigma) \ { \ Transpose matt(mat); \ return llt_inplace::rankUpdate(matt, vec.conjugate(), sigma); \ } \ }; -EIGEN_MKL_LLT(double, double, d) -EIGEN_MKL_LLT(float, float, s) -EIGEN_MKL_LLT(dcomplex, MKL_Complex16, z) -EIGEN_MKL_LLT(scomplex, MKL_Complex8, c) +EIGEN_LAPACKE_LLT(double, double, d) +EIGEN_LAPACKE_LLT(float, float, s) +EIGEN_LAPACKE_LLT(dcomplex, lapack_complex_double, z) +EIGEN_LAPACKE_LLT(scomplex, lapack_complex_float, c) } // end namespace internal } // end namespace Eigen -#endif // EIGEN_LLT_MKL_H +#endif // EIGEN_LLT_LAPACKE_H diff --git a/extern/eigen/Eigen/src/CholmodSupport/CMakeLists.txt b/extern/eigen/Eigen/src/CholmodSupport/CMakeLists.txt deleted file mode 100644 index 814dfa61..00000000 --- a/extern/eigen/Eigen/src/CholmodSupport/CMakeLists.txt +++ /dev/null @@ -1,6 +0,0 @@ -FILE(GLOB Eigen_CholmodSupport_SRCS "*.h") - -INSTALL(FILES - ${Eigen_CholmodSupport_SRCS} - DESTINATION ${INCLUDE_INSTALL_DIR}/Eigen/src/CholmodSupport COMPONENT Devel - ) diff --git a/extern/eigen/Eigen/src/CholmodSupport/CholmodSupport.h b/extern/eigen/Eigen/src/CholmodSupport/CholmodSupport.h index 99dbe171..adaf5285 100644 --- a/extern/eigen/Eigen/src/CholmodSupport/CholmodSupport.h +++ b/extern/eigen/Eigen/src/CholmodSupport/CholmodSupport.h @@ -10,50 +10,56 @@ #ifndef EIGEN_CHOLMODSUPPORT_H #define EIGEN_CHOLMODSUPPORT_H -namespace Eigen { +namespace Eigen { namespace internal { -template -void cholmod_configure_matrix(CholmodType& mat) -{ - if (internal::is_same::value) - { - mat.xtype = CHOLMOD_REAL; - mat.dtype = CHOLMOD_SINGLE; - } - else if (internal::is_same::value) - { +template struct cholmod_configure_matrix; + +template<> struct cholmod_configure_matrix { + template + static void run(CholmodType& mat) { mat.xtype = CHOLMOD_REAL; mat.dtype = CHOLMOD_DOUBLE; } - else if (internal::is_same >::value) - { - mat.xtype = CHOLMOD_COMPLEX; - mat.dtype = CHOLMOD_SINGLE; - } - else if (internal::is_same >::value) - { +}; + +template<> struct cholmod_configure_matrix > { + template + static void run(CholmodType& mat) { mat.xtype = CHOLMOD_COMPLEX; mat.dtype = CHOLMOD_DOUBLE; } - else - { - eigen_assert(false && "Scalar type not supported by CHOLMOD"); - } -} +}; + +// Other scalar types are not yet supported by Cholmod +// template<> struct cholmod_configure_matrix { +// template +// static void run(CholmodType& mat) { +// mat.xtype = CHOLMOD_REAL; +// mat.dtype = CHOLMOD_SINGLE; +// } +// }; +// +// template<> struct cholmod_configure_matrix > { +// template +// static void run(CholmodType& mat) { +// mat.xtype = CHOLMOD_COMPLEX; +// mat.dtype = CHOLMOD_SINGLE; +// } +// }; } // namespace internal /** Wraps the Eigen sparse matrix \a mat into a Cholmod sparse matrix object. * Note that the data are shared. */ -template -cholmod_sparse viewAsCholmod(SparseMatrix<_Scalar,_Options,_Index>& mat) +template +cholmod_sparse viewAsCholmod(Ref > mat) { cholmod_sparse res; res.nzmax = mat.nonZeros(); - res.nrow = mat.rows();; + res.nrow = mat.rows(); res.ncol = mat.cols(); res.p = mat.outerIndexPtr(); res.i = mat.innerIndexPtr(); @@ -73,12 +79,12 @@ cholmod_sparse viewAsCholmod(SparseMatrix<_Scalar,_Options,_Index>& mat) res.dtype = 0; res.stype = -1; - - if (internal::is_same<_Index,int>::value) + + if (internal::is_same<_StorageIndex,int>::value) { res.itype = CHOLMOD_INT; } - else if (internal::is_same<_Index,SuiteSparse_long>::value) + else if (internal::is_same<_StorageIndex,SuiteSparse_long>::value) { res.itype = CHOLMOD_LONG; } @@ -88,29 +94,39 @@ cholmod_sparse viewAsCholmod(SparseMatrix<_Scalar,_Options,_Index>& mat) } // setup res.xtype - internal::cholmod_configure_matrix<_Scalar>(res); - + internal::cholmod_configure_matrix<_Scalar>::run(res); + res.stype = 0; - + return res; } template const cholmod_sparse viewAsCholmod(const SparseMatrix<_Scalar,_Options,_Index>& mat) { - cholmod_sparse res = viewAsCholmod(mat.const_cast_derived()); + cholmod_sparse res = viewAsCholmod(Ref >(mat.const_cast_derived())); + return res; +} + +template +const cholmod_sparse viewAsCholmod(const SparseVector<_Scalar,_Options,_Index>& mat) +{ + cholmod_sparse res = viewAsCholmod(Ref >(mat.const_cast_derived())); return res; } /** Returns a view of the Eigen sparse matrix \a mat as Cholmod sparse matrix. * The data are not copied but shared. */ template -cholmod_sparse viewAsCholmod(const SparseSelfAdjointView, UpLo>& mat) +cholmod_sparse viewAsCholmod(const SparseSelfAdjointView, UpLo>& mat) { - cholmod_sparse res = viewAsCholmod(mat.matrix().const_cast_derived()); - + cholmod_sparse res = viewAsCholmod(Ref >(mat.matrix().const_cast_derived())); + if(UpLo==Upper) res.stype = 1; if(UpLo==Lower) res.stype = -1; + // swap stype for rowmajor matrices (only works for real matrices) + EIGEN_STATIC_ASSERT((_Options & RowMajorBit) == 0 || NumTraits<_Scalar>::IsComplex == 0, THIS_METHOD_IS_ONLY_FOR_COLUMN_MAJOR_MATRICES); + if(_Options & RowMajorBit) res.stype *=-1; return res; } @@ -131,21 +147,59 @@ cholmod_dense viewAsCholmod(MatrixBase& mat) res.x = (void*)(mat.derived().data()); res.z = 0; - internal::cholmod_configure_matrix(res); + internal::cholmod_configure_matrix::run(res); return res; } /** Returns a view of the Cholmod sparse matrix \a cm as an Eigen sparse matrix. * The data are not copied but shared. */ -template -MappedSparseMatrix viewAsEigen(cholmod_sparse& cm) +template +MappedSparseMatrix viewAsEigen(cholmod_sparse& cm) { - return MappedSparseMatrix - (cm.nrow, cm.ncol, static_cast(cm.p)[cm.ncol], - static_cast(cm.p), static_cast(cm.i),static_cast(cm.x) ); + return MappedSparseMatrix + (cm.nrow, cm.ncol, static_cast(cm.p)[cm.ncol], + static_cast(cm.p), static_cast(cm.i),static_cast(cm.x) ); } +namespace internal { + +// template specializations for int and long that call the correct cholmod method + +#define EIGEN_CHOLMOD_SPECIALIZE0(ret, name) \ + template inline ret cm_ ## name (cholmod_common &Common) { return cholmod_ ## name (&Common); } \ + template<> inline ret cm_ ## name (cholmod_common &Common) { return cholmod_l_ ## name (&Common); } + +#define EIGEN_CHOLMOD_SPECIALIZE1(ret, name, t1, a1) \ + template inline ret cm_ ## name (t1& a1, cholmod_common &Common) { return cholmod_ ## name (&a1, &Common); } \ + template<> inline ret cm_ ## name (t1& a1, cholmod_common &Common) { return cholmod_l_ ## name (&a1, &Common); } + +EIGEN_CHOLMOD_SPECIALIZE0(int, start) +EIGEN_CHOLMOD_SPECIALIZE0(int, finish) + +EIGEN_CHOLMOD_SPECIALIZE1(int, free_factor, cholmod_factor*, L) +EIGEN_CHOLMOD_SPECIALIZE1(int, free_dense, cholmod_dense*, X) +EIGEN_CHOLMOD_SPECIALIZE1(int, free_sparse, cholmod_sparse*, A) + +EIGEN_CHOLMOD_SPECIALIZE1(cholmod_factor*, analyze, cholmod_sparse, A) + +template inline cholmod_dense* cm_solve (int sys, cholmod_factor& L, cholmod_dense& B, cholmod_common &Common) { return cholmod_solve (sys, &L, &B, &Common); } +template<> inline cholmod_dense* cm_solve (int sys, cholmod_factor& L, cholmod_dense& B, cholmod_common &Common) { return cholmod_l_solve (sys, &L, &B, &Common); } + +template inline cholmod_sparse* cm_spsolve (int sys, cholmod_factor& L, cholmod_sparse& B, cholmod_common &Common) { return cholmod_spsolve (sys, &L, &B, &Common); } +template<> inline cholmod_sparse* cm_spsolve (int sys, cholmod_factor& L, cholmod_sparse& B, cholmod_common &Common) { return cholmod_l_spsolve (sys, &L, &B, &Common); } + +template +inline int cm_factorize_p (cholmod_sparse* A, double beta[2], _StorageIndex* fset, std::size_t fsize, cholmod_factor* L, cholmod_common &Common) { return cholmod_factorize_p (A, beta, fset, fsize, L, &Common); } +template<> +inline int cm_factorize_p (cholmod_sparse* A, double beta[2], SuiteSparse_long* fset, std::size_t fsize, cholmod_factor* L, cholmod_common &Common) { return cholmod_l_factorize_p (A, beta, fset, fsize, L, &Common); } + +#undef EIGEN_CHOLMOD_SPECIALIZE0 +#undef EIGEN_CHOLMOD_SPECIALIZE1 + +} // namespace internal + + enum CholmodMode { CholmodAuto, CholmodSimplicialLLt, CholmodSupernodalLLt, CholmodLDLt }; @@ -157,49 +211,56 @@ enum CholmodMode { * \sa class CholmodSupernodalLLT, class CholmodSimplicialLDLT, class CholmodSimplicialLLT */ template -class CholmodBase : internal::noncopyable +class CholmodBase : public SparseSolverBase { + protected: + typedef SparseSolverBase Base; + using Base::derived; + using Base::m_isInitialized; public: typedef _MatrixType MatrixType; enum { UpLo = _UpLo }; typedef typename MatrixType::Scalar Scalar; typedef typename MatrixType::RealScalar RealScalar; typedef MatrixType CholMatrixType; - typedef typename MatrixType::Index Index; + typedef typename MatrixType::StorageIndex StorageIndex; + enum { + ColsAtCompileTime = MatrixType::ColsAtCompileTime, + MaxColsAtCompileTime = MatrixType::MaxColsAtCompileTime + }; public: CholmodBase() - : m_cholmodFactor(0), m_info(Success), m_isInitialized(false) + : m_cholmodFactor(0), m_info(Success), m_factorizationIsOk(false), m_analysisIsOk(false) { - m_shiftOffset[0] = m_shiftOffset[1] = RealScalar(0.0); - cholmod_start(&m_cholmod); + EIGEN_STATIC_ASSERT((internal::is_same::value), CHOLMOD_SUPPORTS_DOUBLE_PRECISION_ONLY); + m_shiftOffset[0] = m_shiftOffset[1] = 0.0; + internal::cm_start(m_cholmod); } - CholmodBase(const MatrixType& matrix) - : m_cholmodFactor(0), m_info(Success), m_isInitialized(false) + explicit CholmodBase(const MatrixType& matrix) + : m_cholmodFactor(0), m_info(Success), m_factorizationIsOk(false), m_analysisIsOk(false) { - m_shiftOffset[0] = m_shiftOffset[1] = RealScalar(0.0); - cholmod_start(&m_cholmod); + EIGEN_STATIC_ASSERT((internal::is_same::value), CHOLMOD_SUPPORTS_DOUBLE_PRECISION_ONLY); + m_shiftOffset[0] = m_shiftOffset[1] = 0.0; + internal::cm_start(m_cholmod); compute(matrix); } ~CholmodBase() { if(m_cholmodFactor) - cholmod_free_factor(&m_cholmodFactor, &m_cholmod); - cholmod_finish(&m_cholmod); + internal::cm_free_factor(m_cholmodFactor, m_cholmod); + internal::cm_finish(m_cholmod); } - - inline Index cols() const { return m_cholmodFactor->n; } - inline Index rows() const { return m_cholmodFactor->n; } - - Derived& derived() { return *static_cast(this); } - const Derived& derived() const { return *static_cast(this); } - + + inline StorageIndex cols() const { return internal::convert_index(m_cholmodFactor->n); } + inline StorageIndex rows() const { return internal::convert_index(m_cholmodFactor->n); } + /** \brief Reports whether previous computation was successful. * - * \returns \c Success if computation was succesful, + * \returns \c Success if computation was successful, * \c NumericalIssue if the matrix.appears to be negative. */ ComputationInfo info() const @@ -215,57 +276,29 @@ class CholmodBase : internal::noncopyable factorize(matrix); return derived(); } - - /** \returns the solution x of \f$ A x = b \f$ using the current decomposition of A. - * - * \sa compute() - */ - template - inline const internal::solve_retval - solve(const MatrixBase& b) const - { - eigen_assert(m_isInitialized && "LLT is not initialized."); - eigen_assert(rows()==b.rows() - && "CholmodDecomposition::solve(): invalid number of rows of the right hand side matrix b"); - return internal::solve_retval(*this, b.derived()); - } - - /** \returns the solution x of \f$ A x = b \f$ using the current decomposition of A. - * - * \sa compute() - */ - template - inline const internal::sparse_solve_retval - solve(const SparseMatrixBase& b) const - { - eigen_assert(m_isInitialized && "LLT is not initialized."); - eigen_assert(rows()==b.rows() - && "CholmodDecomposition::solve(): invalid number of rows of the right hand side matrix b"); - return internal::sparse_solve_retval(*this, b.derived()); - } - + /** Performs a symbolic decomposition on the sparsity pattern of \a matrix. * * This function is particularly useful when solving for several problems having the same structure. - * + * * \sa factorize() */ void analyzePattern(const MatrixType& matrix) { if(m_cholmodFactor) { - cholmod_free_factor(&m_cholmodFactor, &m_cholmod); + internal::cm_free_factor(m_cholmodFactor, m_cholmod); m_cholmodFactor = 0; } cholmod_sparse A = viewAsCholmod(matrix.template selfadjointView()); - m_cholmodFactor = cholmod_analyze(&A, &m_cholmod); - + m_cholmodFactor = internal::cm_analyze(A, m_cholmod); + this->m_isInitialized = true; this->m_info = Success; m_analysisIsOk = true; m_factorizationIsOk = false; } - + /** Performs a numeric decomposition of \a matrix * * The given matrix must have the same sparsity pattern as the matrix on which the symbolic decomposition has been performed. @@ -276,43 +309,46 @@ class CholmodBase : internal::noncopyable { eigen_assert(m_analysisIsOk && "You must first call analyzePattern()"); cholmod_sparse A = viewAsCholmod(matrix.template selfadjointView()); - cholmod_factorize_p(&A, m_shiftOffset, 0, 0, m_cholmodFactor, &m_cholmod); - + internal::cm_factorize_p(&A, m_shiftOffset, 0, 0, m_cholmodFactor, m_cholmod); + // If the factorization failed, minor is the column at which it did. On success minor == n. this->m_info = (m_cholmodFactor->minor == m_cholmodFactor->n ? Success : NumericalIssue); m_factorizationIsOk = true; } - + /** Returns a reference to the Cholmod's configuration structure to get a full control over the performed operations. * See the Cholmod user guide for details. */ cholmod_common& cholmod() { return m_cholmod; } - + #ifndef EIGEN_PARSED_BY_DOXYGEN /** \internal */ template - void _solve(const MatrixBase &b, MatrixBase &dest) const + void _solve_impl(const MatrixBase &b, MatrixBase &dest) const { eigen_assert(m_factorizationIsOk && "The decomposition is not in a valid state for solving, you must first call either compute() or symbolic()/numeric()"); const Index size = m_cholmodFactor->n; EIGEN_UNUSED_VARIABLE(size); eigen_assert(size==b.rows()); - // note: cd stands for Cholmod Dense - Rhs& b_ref(b.const_cast_derived()); + // Cholmod needs column-major storage without inner-stride, which corresponds to the default behavior of Ref. + Ref > b_ref(b.derived()); + cholmod_dense b_cd = viewAsCholmod(b_ref); - cholmod_dense* x_cd = cholmod_solve(CHOLMOD_A, m_cholmodFactor, &b_cd, &m_cholmod); + cholmod_dense* x_cd = internal::cm_solve(CHOLMOD_A, *m_cholmodFactor, b_cd, m_cholmod); if(!x_cd) { this->m_info = NumericalIssue; + return; } // TODO optimize this copy by swapping when possible (be careful with alignment, etc.) + // NOTE Actually, the copy can be avoided by calling cholmod_solve2 instead of cholmod_solve dest = Matrix::Map(reinterpret_cast(x_cd->x),b.rows(),b.cols()); - cholmod_free_dense(&x_cd, &m_cholmod); + internal::cm_free_dense(x_cd, m_cholmod); } - + /** \internal */ - template - void _solve(const SparseMatrix &b, SparseMatrix &dest) const + template + void _solve_impl(const SparseMatrixBase &b, SparseMatrixBase &dest) const { eigen_assert(m_factorizationIsOk && "The decomposition is not in a valid state for solving, you must first call either compute() or symbolic()/numeric()"); const Index size = m_cholmodFactor->n; @@ -320,19 +356,22 @@ class CholmodBase : internal::noncopyable eigen_assert(size==b.rows()); // note: cs stands for Cholmod Sparse - cholmod_sparse b_cs = viewAsCholmod(b); - cholmod_sparse* x_cs = cholmod_spsolve(CHOLMOD_A, m_cholmodFactor, &b_cs, &m_cholmod); + Ref > b_ref(b.const_cast_derived()); + cholmod_sparse b_cs = viewAsCholmod(b_ref); + cholmod_sparse* x_cs = internal::cm_spsolve(CHOLMOD_A, *m_cholmodFactor, b_cs, m_cholmod); if(!x_cs) { this->m_info = NumericalIssue; + return; } // TODO optimize this copy by swapping when possible (be careful with alignment, etc.) - dest = viewAsEigen(*x_cs); - cholmod_free_sparse(&x_cs, &m_cholmod); + // NOTE cholmod_spsolve in fact just calls the dense solver for blocks of 4 columns at a time (similar to Eigen's sparse solver) + dest.derived() = viewAsEigen(*x_cs); + internal::cm_free_sparse(x_cs, m_cholmod); } #endif // EIGEN_PARSED_BY_DOXYGEN - - + + /** Sets the shift parameter that will be used to adjust the diagonal coefficients during the numerical factorization. * * During the numerical factorization, an offset term is added to the diagonal coefficients:\n @@ -344,20 +383,70 @@ class CholmodBase : internal::noncopyable */ Derived& setShift(const RealScalar& offset) { - m_shiftOffset[0] = offset; + m_shiftOffset[0] = double(offset); return derived(); } - + + /** \returns the determinant of the underlying matrix from the current factorization */ + Scalar determinant() const + { + using std::exp; + return exp(logDeterminant()); + } + + /** \returns the log determinant of the underlying matrix from the current factorization */ + Scalar logDeterminant() const + { + using std::log; + using numext::real; + eigen_assert(m_factorizationIsOk && "The decomposition is not in a valid state for solving, you must first call either compute() or symbolic()/numeric()"); + + RealScalar logDet = 0; + Scalar *x = static_cast(m_cholmodFactor->x); + if (m_cholmodFactor->is_super) + { + // Supernodal factorization stored as a packed list of dense column-major blocs, + // as described by the following structure: + + // super[k] == index of the first column of the j-th super node + StorageIndex *super = static_cast(m_cholmodFactor->super); + // pi[k] == offset to the description of row indices + StorageIndex *pi = static_cast(m_cholmodFactor->pi); + // px[k] == offset to the respective dense block + StorageIndex *px = static_cast(m_cholmodFactor->px); + + Index nb_super_nodes = m_cholmodFactor->nsuper; + for (Index k=0; k < nb_super_nodes; ++k) + { + StorageIndex ncols = super[k + 1] - super[k]; + StorageIndex nrows = pi[k + 1] - pi[k]; + + Map, 0, InnerStride<> > sk(x + px[k], ncols, InnerStride<>(nrows+1)); + logDet += sk.real().log().sum(); + } + } + else + { + // Simplicial factorization stored as standard CSC matrix. + StorageIndex *p = static_cast(m_cholmodFactor->p); + Index size = m_cholmodFactor->n; + for (Index k=0; kis_ll) + logDet *= 2.0; + return logDet; + }; + template void dumpMemory(Stream& /*s*/) {} - + protected: mutable cholmod_common m_cholmod; cholmod_factor* m_cholmodFactor; - RealScalar m_shiftOffset[2]; + double m_shiftOffset[2]; mutable ComputationInfo m_info; - bool m_isInitialized; int m_factorizationIsOk; int m_analysisIsOk; }; @@ -376,26 +465,30 @@ class CholmodBase : internal::noncopyable * \tparam _UpLo the triangular part that will be used for the computations. It can be Lower * or Upper. Default is Lower. * + * \implsparsesolverconcept + * * This class supports all kind of SparseMatrix<>: row or column major; upper, lower, or both; compressed or non compressed. * - * \sa \ref TutorialSparseDirectSolvers, class CholmodSupernodalLLT, class SimplicialLLT + * \warning Only double precision real and complex scalar types are supported by Cholmod. + * + * \sa \ref TutorialSparseSolverConcept, class CholmodSupernodalLLT, class SimplicialLLT */ template class CholmodSimplicialLLT : public CholmodBase<_MatrixType, _UpLo, CholmodSimplicialLLT<_MatrixType, _UpLo> > { typedef CholmodBase<_MatrixType, _UpLo, CholmodSimplicialLLT> Base; using Base::m_cholmod; - + public: - + typedef _MatrixType MatrixType; - + CholmodSimplicialLLT() : Base() { init(); } CholmodSimplicialLLT(const MatrixType& matrix) : Base() { init(); - Base::compute(matrix); + this->compute(matrix); } ~CholmodSimplicialLLT() {} @@ -423,26 +516,30 @@ class CholmodSimplicialLLT : public CholmodBase<_MatrixType, _UpLo, CholmodSimpl * \tparam _UpLo the triangular part that will be used for the computations. It can be Lower * or Upper. Default is Lower. * + * \implsparsesolverconcept + * * This class supports all kind of SparseMatrix<>: row or column major; upper, lower, or both; compressed or non compressed. * - * \sa \ref TutorialSparseDirectSolvers, class CholmodSupernodalLLT, class SimplicialLDLT + * \warning Only double precision real and complex scalar types are supported by Cholmod. + * + * \sa \ref TutorialSparseSolverConcept, class CholmodSupernodalLLT, class SimplicialLDLT */ template class CholmodSimplicialLDLT : public CholmodBase<_MatrixType, _UpLo, CholmodSimplicialLDLT<_MatrixType, _UpLo> > { typedef CholmodBase<_MatrixType, _UpLo, CholmodSimplicialLDLT> Base; using Base::m_cholmod; - + public: - + typedef _MatrixType MatrixType; - + CholmodSimplicialLDLT() : Base() { init(); } CholmodSimplicialLDLT(const MatrixType& matrix) : Base() { init(); - Base::compute(matrix); + this->compute(matrix); } ~CholmodSimplicialLDLT() {} @@ -468,26 +565,30 @@ class CholmodSimplicialLDLT : public CholmodBase<_MatrixType, _UpLo, CholmodSimp * \tparam _UpLo the triangular part that will be used for the computations. It can be Lower * or Upper. Default is Lower. * + * \implsparsesolverconcept + * * This class supports all kind of SparseMatrix<>: row or column major; upper, lower, or both; compressed or non compressed. * - * \sa \ref TutorialSparseDirectSolvers + * \warning Only double precision real and complex scalar types are supported by Cholmod. + * + * \sa \ref TutorialSparseSolverConcept */ template class CholmodSupernodalLLT : public CholmodBase<_MatrixType, _UpLo, CholmodSupernodalLLT<_MatrixType, _UpLo> > { typedef CholmodBase<_MatrixType, _UpLo, CholmodSupernodalLLT> Base; using Base::m_cholmod; - + public: - + typedef _MatrixType MatrixType; - + CholmodSupernodalLLT() : Base() { init(); } CholmodSupernodalLLT(const MatrixType& matrix) : Base() { init(); - Base::compute(matrix); + this->compute(matrix); } ~CholmodSupernodalLLT() {} @@ -515,30 +616,34 @@ class CholmodSupernodalLLT : public CholmodBase<_MatrixType, _UpLo, CholmodSuper * \tparam _UpLo the triangular part that will be used for the computations. It can be Lower * or Upper. Default is Lower. * + * \implsparsesolverconcept + * * This class supports all kind of SparseMatrix<>: row or column major; upper, lower, or both; compressed or non compressed. * - * \sa \ref TutorialSparseDirectSolvers + * \warning Only double precision real and complex scalar types are supported by Cholmod. + * + * \sa \ref TutorialSparseSolverConcept */ template class CholmodDecomposition : public CholmodBase<_MatrixType, _UpLo, CholmodDecomposition<_MatrixType, _UpLo> > { typedef CholmodBase<_MatrixType, _UpLo, CholmodDecomposition> Base; using Base::m_cholmod; - + public: - + typedef _MatrixType MatrixType; - + CholmodDecomposition() : Base() { init(); } CholmodDecomposition(const MatrixType& matrix) : Base() { init(); - Base::compute(matrix); + this->compute(matrix); } ~CholmodDecomposition() {} - + void setMode(CholmodMode mode) { switch(mode) @@ -572,36 +677,6 @@ class CholmodDecomposition : public CholmodBase<_MatrixType, _UpLo, CholmodDecom } }; -namespace internal { - -template -struct solve_retval, Rhs> - : solve_retval_base, Rhs> -{ - typedef CholmodBase<_MatrixType,_UpLo,Derived> Dec; - EIGEN_MAKE_SOLVE_HELPERS(Dec,Rhs) - - template void evalTo(Dest& dst) const - { - dec()._solve(rhs(),dst); - } -}; - -template -struct sparse_solve_retval, Rhs> - : sparse_solve_retval_base, Rhs> -{ - typedef CholmodBase<_MatrixType,_UpLo,Derived> Dec; - EIGEN_MAKE_SPARSE_SOLVE_HELPERS(Dec,Rhs) - - template void evalTo(Dest& dst) const - { - dec()._solve(rhs(),dst); - } -}; - -} // end namespace internal - } // end namespace Eigen #endif // EIGEN_CHOLMODSUPPORT_H diff --git a/extern/eigen/Eigen/src/Core/ArithmeticSequence.h b/extern/eigen/Eigen/src/Core/ArithmeticSequence.h new file mode 100644 index 00000000..b6200fac --- /dev/null +++ b/extern/eigen/Eigen/src/Core/ArithmeticSequence.h @@ -0,0 +1,413 @@ +// This file is part of Eigen, a lightweight C++ template library +// for linear algebra. +// +// Copyright (C) 2017 Gael Guennebaud +// +// This Source Code Form is subject to the terms of the Mozilla +// Public License v. 2.0. If a copy of the MPL was not distributed +// with this file, You can obtain one at http://mozilla.org/MPL/2.0/. + +#ifndef EIGEN_ARITHMETIC_SEQUENCE_H +#define EIGEN_ARITHMETIC_SEQUENCE_H + +namespace Eigen { + +namespace internal { + +#if (!EIGEN_HAS_CXX11) || !((!EIGEN_COMP_GNUC) || EIGEN_COMP_GNUC>=48) +template struct aseq_negate {}; + +template<> struct aseq_negate { + typedef Index type; +}; + +template struct aseq_negate > { + typedef FixedInt<-N> type; +}; + +// Compilation error in the following case: +template<> struct aseq_negate > {}; + +template::value, + bool SizeIsSymbolic =symbolic::is_symbolic::value> +struct aseq_reverse_first_type { + typedef Index type; +}; + +template +struct aseq_reverse_first_type { + typedef symbolic::AddExpr > >, + symbolic::ValueExpr > + > type; +}; + +template +struct aseq_reverse_first_type_aux { + typedef Index type; +}; + +template +struct aseq_reverse_first_type_aux::type> { + typedef FixedInt<(SizeType::value-1)*IncrType::value> type; +}; + +template +struct aseq_reverse_first_type { + typedef typename aseq_reverse_first_type_aux::type Aux; + typedef symbolic::AddExpr > type; +}; + +template +struct aseq_reverse_first_type { + typedef symbolic::AddExpr > >, + symbolic::ValueExpr >, + symbolic::ValueExpr<> > type; +}; +#endif + +// Helper to cleanup the type of the increment: +template struct cleanup_seq_incr { + typedef typename cleanup_index_type::type type; +}; + +} + +//-------------------------------------------------------------------------------- +// seq(first,last,incr) and seqN(first,size,incr) +//-------------------------------------------------------------------------------- + +template > +class ArithmeticSequence; + +template +ArithmeticSequence::type, + typename internal::cleanup_index_type::type, + typename internal::cleanup_seq_incr::type > +seqN(FirstType first, SizeType size, IncrType incr); + +/** \class ArithmeticSequence + * \ingroup Core_Module + * + * This class represents an arithmetic progression \f$ a_0, a_1, a_2, ..., a_{n-1}\f$ defined by + * its \em first value \f$ a_0 \f$, its \em size (aka length) \em n, and the \em increment (aka stride) + * that is equal to \f$ a_{i+1}-a_{i}\f$ for any \em i. + * + * It is internally used as the return type of the Eigen::seq and Eigen::seqN functions, and as the input arguments + * of DenseBase::operator()(const RowIndices&, const ColIndices&), and most of the time this is the + * only way it is used. + * + * \tparam FirstType type of the first element, usually an Index, + * but internally it can be a symbolic expression + * \tparam SizeType type representing the size of the sequence, usually an Index + * or a compile time integral constant. Internally, it can also be a symbolic expression + * \tparam IncrType type of the increment, can be a runtime Index, or a compile time integral constant (default is compile-time 1) + * + * \sa Eigen::seq, Eigen::seqN, DenseBase::operator()(const RowIndices&, const ColIndices&), class IndexedView + */ +template +class ArithmeticSequence +{ +public: + ArithmeticSequence(FirstType first, SizeType size) : m_first(first), m_size(size) {} + ArithmeticSequence(FirstType first, SizeType size, IncrType incr) : m_first(first), m_size(size), m_incr(incr) {} + + enum { + SizeAtCompileTime = internal::get_fixed_value::value, + IncrAtCompileTime = internal::get_fixed_value::value + }; + + /** \returns the size, i.e., number of elements, of the sequence */ + Index size() const { return m_size; } + + /** \returns the first element \f$ a_0 \f$ in the sequence */ + Index first() const { return m_first; } + + /** \returns the value \f$ a_i \f$ at index \a i in the sequence. */ + Index operator[](Index i) const { return m_first + i * m_incr; } + + const FirstType& firstObject() const { return m_first; } + const SizeType& sizeObject() const { return m_size; } + const IncrType& incrObject() const { return m_incr; } + +protected: + FirstType m_first; + SizeType m_size; + IncrType m_incr; + +public: + +#if EIGEN_HAS_CXX11 && ((!EIGEN_COMP_GNUC) || EIGEN_COMP_GNUC>=48) + auto reverse() const -> decltype(Eigen::seqN(m_first+(m_size+fix<-1>())*m_incr,m_size,-m_incr)) { + return seqN(m_first+(m_size+fix<-1>())*m_incr,m_size,-m_incr); + } +#else +protected: + typedef typename internal::aseq_negate::type ReverseIncrType; + typedef typename internal::aseq_reverse_first_type::type ReverseFirstType; +public: + ArithmeticSequence + reverse() const { + return seqN(m_first+(m_size+fix<-1>())*m_incr,m_size,-m_incr); + } +#endif +}; + +/** \returns an ArithmeticSequence starting at \a first, of length \a size, and increment \a incr + * + * \sa seqN(FirstType,SizeType), seq(FirstType,LastType,IncrType) */ +template +ArithmeticSequence::type,typename internal::cleanup_index_type::type,typename internal::cleanup_seq_incr::type > +seqN(FirstType first, SizeType size, IncrType incr) { + return ArithmeticSequence::type,typename internal::cleanup_index_type::type,typename internal::cleanup_seq_incr::type>(first,size,incr); +} + +/** \returns an ArithmeticSequence starting at \a first, of length \a size, and unit increment + * + * \sa seqN(FirstType,SizeType,IncrType), seq(FirstType,LastType) */ +template +ArithmeticSequence::type,typename internal::cleanup_index_type::type > +seqN(FirstType first, SizeType size) { + return ArithmeticSequence::type,typename internal::cleanup_index_type::type>(first,size); +} + +#ifdef EIGEN_PARSED_BY_DOXYGEN + +/** \returns an ArithmeticSequence starting at \a f, up (or down) to \a l, and with positive (or negative) increment \a incr + * + * It is essentially an alias to: + * \code + * seqN(f, (l-f+incr)/incr, incr); + * \endcode + * + * \sa seqN(FirstType,SizeType,IncrType), seq(FirstType,LastType) + */ +template +auto seq(FirstType f, LastType l, IncrType incr); + +/** \returns an ArithmeticSequence starting at \a f, up (or down) to \a l, and unit increment + * + * It is essentially an alias to: + * \code + * seqN(f,l-f+1); + * \endcode + * + * \sa seqN(FirstType,SizeType), seq(FirstType,LastType,IncrType) + */ +template +auto seq(FirstType f, LastType l); + +#else // EIGEN_PARSED_BY_DOXYGEN + +#if EIGEN_HAS_CXX11 +template +auto seq(FirstType f, LastType l) -> decltype(seqN(typename internal::cleanup_index_type::type(f), + ( typename internal::cleanup_index_type::type(l) + - typename internal::cleanup_index_type::type(f)+fix<1>()))) +{ + return seqN(typename internal::cleanup_index_type::type(f), + (typename internal::cleanup_index_type::type(l) + -typename internal::cleanup_index_type::type(f)+fix<1>())); +} + +template +auto seq(FirstType f, LastType l, IncrType incr) + -> decltype(seqN(typename internal::cleanup_index_type::type(f), + ( typename internal::cleanup_index_type::type(l) + - typename internal::cleanup_index_type::type(f)+typename internal::cleanup_seq_incr::type(incr) + ) / typename internal::cleanup_seq_incr::type(incr), + typename internal::cleanup_seq_incr::type(incr))) +{ + typedef typename internal::cleanup_seq_incr::type CleanedIncrType; + return seqN(typename internal::cleanup_index_type::type(f), + ( typename internal::cleanup_index_type::type(l) + -typename internal::cleanup_index_type::type(f)+CleanedIncrType(incr)) / CleanedIncrType(incr), + CleanedIncrType(incr)); +} + +#else // EIGEN_HAS_CXX11 + +template +typename internal::enable_if::value || symbolic::is_symbolic::value), + ArithmeticSequence::type,Index> >::type +seq(FirstType f, LastType l) +{ + return seqN(typename internal::cleanup_index_type::type(f), + Index((typename internal::cleanup_index_type::type(l)-typename internal::cleanup_index_type::type(f)+fix<1>()))); +} + +template +typename internal::enable_if::value, + ArithmeticSequence,symbolic::ValueExpr<> >, + symbolic::ValueExpr > > > >::type +seq(const symbolic::BaseExpr &f, LastType l) +{ + return seqN(f.derived(),(typename internal::cleanup_index_type::type(l)-f.derived()+fix<1>())); +} + +template +typename internal::enable_if::value, + ArithmeticSequence::type, + symbolic::AddExpr >, + symbolic::ValueExpr > > > >::type +seq(FirstType f, const symbolic::BaseExpr &l) +{ + return seqN(typename internal::cleanup_index_type::type(f),(l.derived()-typename internal::cleanup_index_type::type(f)+fix<1>())); +} + +template +ArithmeticSequence >,symbolic::ValueExpr > > > +seq(const symbolic::BaseExpr &f, const symbolic::BaseExpr &l) +{ + return seqN(f.derived(),(l.derived()-f.derived()+fix<1>())); +} + + +template +typename internal::enable_if::value || symbolic::is_symbolic::value), + ArithmeticSequence::type,Index,typename internal::cleanup_seq_incr::type> >::type +seq(FirstType f, LastType l, IncrType incr) +{ + typedef typename internal::cleanup_seq_incr::type CleanedIncrType; + return seqN(typename internal::cleanup_index_type::type(f), + Index((typename internal::cleanup_index_type::type(l)-typename internal::cleanup_index_type::type(f)+CleanedIncrType(incr))/CleanedIncrType(incr)), incr); +} + +template +typename internal::enable_if::value, + ArithmeticSequence, + symbolic::ValueExpr<> >, + symbolic::ValueExpr::type> >, + symbolic::ValueExpr::type> >, + typename internal::cleanup_seq_incr::type> >::type +seq(const symbolic::BaseExpr &f, LastType l, IncrType incr) +{ + typedef typename internal::cleanup_seq_incr::type CleanedIncrType; + return seqN(f.derived(),(typename internal::cleanup_index_type::type(l)-f.derived()+CleanedIncrType(incr))/CleanedIncrType(incr), incr); +} + +template +typename internal::enable_if::value, + ArithmeticSequence::type, + symbolic::QuotientExpr >, + symbolic::ValueExpr::type> >, + symbolic::ValueExpr::type> >, + typename internal::cleanup_seq_incr::type> >::type +seq(FirstType f, const symbolic::BaseExpr &l, IncrType incr) +{ + typedef typename internal::cleanup_seq_incr::type CleanedIncrType; + return seqN(typename internal::cleanup_index_type::type(f), + (l.derived()-typename internal::cleanup_index_type::type(f)+CleanedIncrType(incr))/CleanedIncrType(incr), incr); +} + +template +ArithmeticSequence >, + symbolic::ValueExpr::type> >, + symbolic::ValueExpr::type> >, + typename internal::cleanup_seq_incr::type> +seq(const symbolic::BaseExpr &f, const symbolic::BaseExpr &l, IncrType incr) +{ + typedef typename internal::cleanup_seq_incr::type CleanedIncrType; + return seqN(f.derived(),(l.derived()-f.derived()+CleanedIncrType(incr))/CleanedIncrType(incr), incr); +} +#endif // EIGEN_HAS_CXX11 + +#endif // EIGEN_PARSED_BY_DOXYGEN + + +#if EIGEN_HAS_CXX11 || defined(EIGEN_PARSED_BY_DOXYGEN) +/** \cpp11 + * \returns a symbolic ArithmeticSequence representing the last \a size elements with increment \a incr. + * + * It is a shortcut for: \code seqN(last-(size-fix<1>)*incr, size, incr) \endcode + * + * \sa lastN(SizeType), seqN(FirstType,SizeType), seq(FirstType,LastType,IncrType) */ +template +auto lastN(SizeType size, IncrType incr) +-> decltype(seqN(Eigen::last-(size-fix<1>())*incr, size, incr)) +{ + return seqN(Eigen::last-(size-fix<1>())*incr, size, incr); +} + +/** \cpp11 + * \returns a symbolic ArithmeticSequence representing the last \a size elements with a unit increment. + * + * It is a shortcut for: \code seq(last+fix<1>-size, last) \endcode + * + * \sa lastN(SizeType,IncrType, seqN(FirstType,SizeType), seq(FirstType,LastType) */ +template +auto lastN(SizeType size) +-> decltype(seqN(Eigen::last+fix<1>()-size, size)) +{ + return seqN(Eigen::last+fix<1>()-size, size); +} +#endif + +namespace internal { + +// Convert a symbolic span into a usable one (i.e., remove last/end "keywords") +template +struct make_size_type { + typedef typename internal::conditional::value, Index, T>::type type; +}; + +template +struct IndexedViewCompatibleType, XprSize> { + typedef ArithmeticSequence::type,IncrType> type; +}; + +template +ArithmeticSequence::type,IncrType> +makeIndexedViewCompatible(const ArithmeticSequence& ids, Index size,SpecializedType) { + return ArithmeticSequence::type,IncrType>( + eval_expr_given_size(ids.firstObject(),size),eval_expr_given_size(ids.sizeObject(),size),ids.incrObject()); +} + +template +struct get_compile_time_incr > { + enum { value = get_fixed_value::value }; +}; + +} // end namespace internal + +/** \namespace Eigen::indexing + * \ingroup Core_Module + * + * The sole purpose of this namespace is to be able to import all functions + * and symbols that are expected to be used within operator() for indexing + * and slicing. If you already imported the whole Eigen namespace: + * \code using namespace Eigen; \endcode + * then you are already all set. Otherwise, if you don't want/cannot import + * the whole Eigen namespace, the following line: + * \code using namespace Eigen::indexing; \endcode + * is equivalent to: + * \code + using Eigen::all; + using Eigen::seq; + using Eigen::seqN; + using Eigen::lastN; // c++11 only + using Eigen::last; + using Eigen::lastp1; + using Eigen::fix; + \endcode + */ +namespace indexing { + using Eigen::all; + using Eigen::seq; + using Eigen::seqN; + #if EIGEN_HAS_CXX11 + using Eigen::lastN; + #endif + using Eigen::last; + using Eigen::lastp1; + using Eigen::fix; +} + +} // end namespace Eigen + +#endif // EIGEN_ARITHMETIC_SEQUENCE_H diff --git a/extern/eigen/Eigen/src/Core/Array.h b/extern/eigen/Eigen/src/Core/Array.h index 0b9c38c8..20c789b1 100644 --- a/extern/eigen/Eigen/src/Core/Array.h +++ b/extern/eigen/Eigen/src/Core/Array.h @@ -12,7 +12,16 @@ namespace Eigen { -/** \class Array +namespace internal { +template +struct traits > : traits > +{ + typedef ArrayXpr XprKind; + typedef ArrayBase > XprBase; +}; +} + +/** \class Array * \ingroup Core_Module * * \brief General-purpose arrays with easy API for coefficient-wise operations @@ -24,20 +33,14 @@ namespace Eigen { * API for the %Matrix class provides easy access to linear-algebra * operations. * + * See documentation of class Matrix for detailed information on the template parameters + * storage layout. + * * This class can be extended with the help of the plugin mechanism described on the page - * \ref TopicCustomizingEigen by defining the preprocessor symbol \c EIGEN_ARRAY_PLUGIN. + * \ref TopicCustomizing_Plugins by defining the preprocessor symbol \c EIGEN_ARRAY_PLUGIN. * - * \sa \ref TutorialArrayClass, \ref TopicClassHierarchy + * \sa \blank \ref TutorialArrayClass, \ref TopicClassHierarchy */ -namespace internal { -template -struct traits > : traits > -{ - typedef ArrayXpr XprKind; - typedef ArrayBase > XprBase; -}; -} - template class Array : public PlainObjectBase > @@ -69,11 +72,27 @@ class Array * the usage of 'using'. This should be done only for operator=. */ template + EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Array& operator=(const EigenBase &other) { return Base::operator=(other); } + /** Set all the entries to \a value. + * \sa DenseBase::setConstant(), DenseBase::fill() + */ + /* This overload is needed because the usage of + * using Base::operator=; + * fails on MSVC. Since the code below is working with GCC and MSVC, we skipped + * the usage of 'using'. This should be done only for operator=. + */ + EIGEN_DEVICE_FUNC + EIGEN_STRONG_INLINE Array& operator=(const Scalar &value) + { + Base::setConstant(value); + return *this; + } + /** Copies the value of the expression \a other into \c *this with automatic resizing. * * *this might be resized to match the dimensions of \a other. If *this was a null matrix (not already initialized), @@ -84,7 +103,8 @@ class Array * remain row-vectors and vectors remain vectors. */ template - EIGEN_STRONG_INLINE Array& operator=(const ArrayBase& other) + EIGEN_DEVICE_FUNC + EIGEN_STRONG_INLINE Array& operator=(const DenseBase& other) { return Base::_set(other); } @@ -92,6 +112,7 @@ class Array /** This is a special case of the templated operator=. Its purpose is to * prevent a default operator= from hiding the templated operator=. */ + EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Array& operator=(const Array& other) { return Base::_set(other); @@ -107,6 +128,7 @@ class Array * * \sa resize(Index,Index) */ + EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Array() : Base() { Base::_check_template_params(); @@ -116,6 +138,7 @@ class Array #ifndef EIGEN_PARSED_BY_DOXYGEN // FIXME is it still needed ?? /** \internal */ + EIGEN_DEVICE_FUNC Array(internal::constructor_without_unaligned_array_assert) : Base(internal::constructor_without_unaligned_array_assert()) { @@ -124,56 +147,106 @@ class Array } #endif -#ifdef EIGEN_HAVE_RVALUE_REFERENCES - Array(Array&& other) +#if EIGEN_HAS_RVALUE_REFERENCES + EIGEN_DEVICE_FUNC + Array(Array&& other) EIGEN_NOEXCEPT_IF(std::is_nothrow_move_constructible::value) : Base(std::move(other)) { Base::_check_template_params(); - if (RowsAtCompileTime!=Dynamic && ColsAtCompileTime!=Dynamic) - Base::_set_noalias(other); } - Array& operator=(Array&& other) + EIGEN_DEVICE_FUNC + Array& operator=(Array&& other) EIGEN_NOEXCEPT_IF(std::is_nothrow_move_assignable::value) { - other.swap(*this); + Base::operator=(std::move(other)); return *this; } #endif - /** Constructs a vector or row-vector with given dimension. \only_for_vectors + #if EIGEN_HAS_CXX11 + /** \copydoc PlainObjectBase(const Scalar& a0, const Scalar& a1, const Scalar& a2, const Scalar& a3, const ArgTypes&... args) + * + * Example: \include Array_variadic_ctor_cxx11.cpp + * Output: \verbinclude Array_variadic_ctor_cxx11.out + * + * \sa Array(const std::initializer_list>&) + * \sa Array(const Scalar&), Array(const Scalar&,const Scalar&) + */ + template + EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE + Array(const Scalar& a0, const Scalar& a1, const Scalar& a2, const Scalar& a3, const ArgTypes&... args) + : Base(a0, a1, a2, a3, args...) {} + + /** \brief Constructs an array and initializes it from the coefficients given as initializer-lists grouped by row. \cpp11 * - * Note that this is only useful for dynamic-size vectors. For fixed-size vectors, - * it is redundant to pass the dimension here, so it makes more sense to use the default - * constructor Matrix() instead. + * In the general case, the constructor takes a list of rows, each row being represented as a list of coefficients: + * + * Example: \include Array_initializer_list_23_cxx11.cpp + * Output: \verbinclude Array_initializer_list_23_cxx11.out + * + * Each of the inner initializer lists must contain the exact same number of elements, otherwise an assertion is triggered. + * + * In the case of a compile-time column 1D array, implicit transposition from a single row is allowed. + * Therefore Array{{1,2,3,4,5}} is legal and the more verbose syntax + * Array{{1},{2},{3},{4},{5}} can be avoided: + * + * Example: \include Array_initializer_list_vector_cxx11.cpp + * Output: \verbinclude Array_initializer_list_vector_cxx11.out + * + * In the case of fixed-sized arrays, the initializer list sizes must exactly match the array sizes, + * and implicit transposition is allowed for compile-time 1D arrays only. + * + * \sa Array(const Scalar& a0, const Scalar& a1, const Scalar& a2, const Scalar& a3, const ArgTypes&... args) */ - EIGEN_STRONG_INLINE explicit Array(Index dim) - : Base(dim, RowsAtCompileTime == 1 ? 1 : dim, ColsAtCompileTime == 1 ? 1 : dim) + EIGEN_DEVICE_FUNC + EIGEN_STRONG_INLINE Array(const std::initializer_list>& list) : Base(list) {} + #endif // end EIGEN_HAS_CXX11 + + #ifndef EIGEN_PARSED_BY_DOXYGEN + template + EIGEN_DEVICE_FUNC + EIGEN_STRONG_INLINE explicit Array(const T& x) { Base::_check_template_params(); - EIGEN_STATIC_ASSERT_VECTOR_ONLY(Array) - eigen_assert(dim >= 0); - eigen_assert(SizeAtCompileTime == Dynamic || SizeAtCompileTime == dim); - EIGEN_INITIALIZE_COEFFS_IF_THAT_OPTION_IS_ENABLED + Base::template _init1(x); } - #ifndef EIGEN_PARSED_BY_DOXYGEN template + EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Array(const T0& val0, const T1& val1) { Base::_check_template_params(); this->template _init2(val0, val1); } + #else - /** constructs an uninitialized matrix with \a rows rows and \a cols columns. + /** \brief Constructs a fixed-sized array initialized with coefficients starting at \a data */ + EIGEN_DEVICE_FUNC explicit Array(const Scalar *data); + /** Constructs a vector or row-vector with given dimension. \only_for_vectors * - * This is useful for dynamic-size matrices. For fixed-size matrices, + * Note that this is only useful for dynamic-size vectors. For fixed-size vectors, + * it is redundant to pass the dimension here, so it makes more sense to use the default + * constructor Array() instead. + */ + EIGEN_DEVICE_FUNC + EIGEN_STRONG_INLINE explicit Array(Index dim); + /** constructs an initialized 1x1 Array with the given coefficient + * \sa const Scalar& a0, const Scalar& a1, const Scalar& a2, const Scalar& a3, const ArgTypes&... args */ + Array(const Scalar& value); + /** constructs an uninitialized array with \a rows rows and \a cols columns. + * + * This is useful for dynamic-size arrays. For fixed-size arrays, * it is redundant to pass these parameters, so one should use the default constructor - * Matrix() instead. */ + * Array() instead. */ Array(Index rows, Index cols); - /** constructs an initialized 2D vector with given coefficients */ + /** constructs an initialized 2D vector with given coefficients + * \sa Array(const Scalar& a0, const Scalar& a1, const Scalar& a2, const Scalar& a3, const ArgTypes&... args) */ Array(const Scalar& val0, const Scalar& val1); - #endif + #endif // end EIGEN_PARSED_BY_DOXYGEN - /** constructs an initialized 3D vector with given coefficients */ + /** constructs an initialized 3D vector with given coefficients + * \sa Array(const Scalar& a0, const Scalar& a1, const Scalar& a2, const Scalar& a3, const ArgTypes&... args) + */ + EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Array(const Scalar& val0, const Scalar& val1, const Scalar& val2) { Base::_check_template_params(); @@ -182,7 +255,10 @@ class Array m_storage.data()[1] = val1; m_storage.data()[2] = val2; } - /** constructs an initialized 4D vector with given coefficients */ + /** constructs an initialized 4D vector with given coefficients + * \sa Array(const Scalar& a0, const Scalar& a1, const Scalar& a2, const Scalar& a3, const ArgTypes&... args) + */ + EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Array(const Scalar& val0, const Scalar& val1, const Scalar& val2, const Scalar& val3) { Base::_check_template_params(); @@ -193,51 +269,29 @@ class Array m_storage.data()[3] = val3; } - explicit Array(const Scalar *data); - - /** Constructor copying the value of the expression \a other */ - template - EIGEN_STRONG_INLINE Array(const ArrayBase& other) - : Base(other.rows() * other.cols(), other.rows(), other.cols()) - { - Base::_check_template_params(); - Base::_set_noalias(other); - } /** Copy constructor */ + EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Array(const Array& other) - : Base(other.rows() * other.cols(), other.rows(), other.cols()) - { - Base::_check_template_params(); - Base::_set_noalias(other); - } - /** Copy constructor with in-place evaluation */ - template - EIGEN_STRONG_INLINE Array(const ReturnByValue& other) - { - Base::_check_template_params(); - Base::resize(other.rows(), other.cols()); - other.evalTo(*this); - } + : Base(other) + { } - /** \sa MatrixBase::operator=(const EigenBase&) */ - template - EIGEN_STRONG_INLINE Array(const EigenBase &other) - : Base(other.derived().rows() * other.derived().cols(), other.derived().rows(), other.derived().cols()) - { - Base::_check_template_params(); - Base::_resize_to_match(other); - *this = other; - } + private: + struct PrivateType {}; + public: - /** Override MatrixBase::swap() since for dynamic-sized matrices of same type it is enough to swap the - * data pointers. - */ + /** \sa MatrixBase::operator=(const EigenBase&) */ template - void swap(ArrayBase const & other) - { this->_swap(other.derived()); } - - inline Index innerStride() const { return 1; } - inline Index outerStride() const { return this->innerSize(); } + EIGEN_DEVICE_FUNC + EIGEN_STRONG_INLINE Array(const EigenBase &other, + typename internal::enable_if::value, + PrivateType>::type = PrivateType()) + : Base(other.derived()) + { } + + EIGEN_DEVICE_FUNC EIGEN_CONSTEXPR + inline Index innerStride() const EIGEN_NOEXCEPT{ return 1; } + EIGEN_DEVICE_FUNC EIGEN_CONSTEXPR + inline Index outerStride() const EIGEN_NOEXCEPT { return this->innerSize(); } #ifdef EIGEN_ARRAY_PLUGIN #include EIGEN_ARRAY_PLUGIN @@ -252,7 +306,7 @@ class Array /** \defgroup arraytypedefs Global array typedefs * \ingroup Core_Module * - * Eigen defines several typedef shortcuts for most common 1D and 2D array types. + * %Eigen defines several typedef shortcuts for most common 1D and 2D array types. * * The general patterns are the following: * @@ -265,6 +319,12 @@ class Array * There are also \c ArraySizeType which are self-explanatory. For example, \c Array4cf is * a fixed-size 1D array of 4 complex floats. * + * With \cpp11, template alias are also defined for common sizes. + * They follow the same pattern as above except that the scalar type suffix is replaced by a + * template parameter, i.e.: + * - `ArrayRowsCols` where `Rows` and `Cols` can be \c 2,\c 3,\c 4, or \c X for fixed or dynamic size. + * - `ArraySize` where `Size` can be \c 2,\c 3,\c 4 or \c X for fixed or dynamic size 1D arrays. + * * \sa class Array */ @@ -297,8 +357,42 @@ EIGEN_MAKE_ARRAY_TYPEDEFS_ALL_SIZES(std::complex, cd) #undef EIGEN_MAKE_ARRAY_TYPEDEFS_ALL_SIZES #undef EIGEN_MAKE_ARRAY_TYPEDEFS +#undef EIGEN_MAKE_ARRAY_FIXED_TYPEDEFS + +#if EIGEN_HAS_CXX11 + +#define EIGEN_MAKE_ARRAY_TYPEDEFS(Size, SizeSuffix) \ +/** \ingroup arraytypedefs */ \ +/** \brief \cpp11 */ \ +template \ +using Array##SizeSuffix##SizeSuffix = Array; \ +/** \ingroup arraytypedefs */ \ +/** \brief \cpp11 */ \ +template \ +using Array##SizeSuffix = Array; + +#define EIGEN_MAKE_ARRAY_FIXED_TYPEDEFS(Size) \ +/** \ingroup arraytypedefs */ \ +/** \brief \cpp11 */ \ +template \ +using Array##Size##X = Array; \ +/** \ingroup arraytypedefs */ \ +/** \brief \cpp11 */ \ +template \ +using Array##X##Size = Array; + +EIGEN_MAKE_ARRAY_TYPEDEFS(2, 2) +EIGEN_MAKE_ARRAY_TYPEDEFS(3, 3) +EIGEN_MAKE_ARRAY_TYPEDEFS(4, 4) +EIGEN_MAKE_ARRAY_TYPEDEFS(Dynamic, X) +EIGEN_MAKE_ARRAY_FIXED_TYPEDEFS(2) +EIGEN_MAKE_ARRAY_FIXED_TYPEDEFS(3) +EIGEN_MAKE_ARRAY_FIXED_TYPEDEFS(4) + +#undef EIGEN_MAKE_ARRAY_TYPEDEFS +#undef EIGEN_MAKE_ARRAY_FIXED_TYPEDEFS -#undef EIGEN_MAKE_ARRAY_TYPEDEFS_LARGE +#endif // EIGEN_HAS_CXX11 #define EIGEN_USING_ARRAY_TYPEDEFS_FOR_TYPE_AND_SIZE(TypeSuffix, SizeSuffix) \ using Eigen::Matrix##SizeSuffix##TypeSuffix; \ diff --git a/extern/eigen/Eigen/src/Core/ArrayBase.h b/extern/eigen/Eigen/src/Core/ArrayBase.h index 33ff5537..ea3dd1c3 100644 --- a/extern/eigen/Eigen/src/Core/ArrayBase.h +++ b/extern/eigen/Eigen/src/Core/ArrayBase.h @@ -32,7 +32,7 @@ template class MatrixWrapper; * \tparam Derived is the derived type, e.g., an array or an expression type. * * This class can be extended with the help of the plugin mechanism described on the page - * \ref TopicCustomizingEigen by defining the preprocessor symbol \c EIGEN_ARRAYBASE_PLUGIN. + * \ref TopicCustomizing_Plugins by defining the preprocessor symbol \c EIGEN_ARRAYBASE_PLUGIN. * * \sa class MatrixBase, \ref TopicClassHierarchy */ @@ -47,13 +47,11 @@ template class ArrayBase typedef ArrayBase Eigen_BaseClassForSpecializationOfGlobalMathFuncImpl; typedef typename internal::traits::StorageKind StorageKind; - typedef typename internal::traits::Index Index; typedef typename internal::traits::Scalar Scalar; typedef typename internal::packet_traits::type PacketScalar; typedef typename NumTraits::Real RealScalar; typedef DenseBase Base; - using Base::operator*; using Base::RowsAtCompileTime; using Base::ColsAtCompileTime; using Base::SizeAtCompileTime; @@ -62,8 +60,7 @@ template class ArrayBase using Base::MaxSizeAtCompileTime; using Base::IsVectorAtCompileTime; using Base::Flags; - using Base::CoeffReadCost; - + using Base::derived; using Base::const_cast_derived; using Base::rows; @@ -72,6 +69,7 @@ template class ArrayBase using Base::coeff; using Base::coeffRef; using Base::lazyAssign; + using Base::operator-; using Base::operator=; using Base::operator+=; using Base::operator-=; @@ -83,26 +81,14 @@ template class ArrayBase #endif // not EIGEN_PARSED_BY_DOXYGEN #ifndef EIGEN_PARSED_BY_DOXYGEN - /** \internal the plain matrix type corresponding to this expression. Note that is not necessarily - * exactly the return type of eval(): in the case of plain matrices, the return type of eval() is a const - * reference to a matrix, not a matrix! It is however guaranteed that the return type of eval() is either - * PlainObject or const PlainObject&. - */ - typedef Array::Scalar, - internal::traits::RowsAtCompileTime, - internal::traits::ColsAtCompileTime, - AutoAlign | (internal::traits::Flags&RowMajorBit ? RowMajor : ColMajor), - internal::traits::MaxRowsAtCompileTime, - internal::traits::MaxColsAtCompileTime - > PlainObject; - + typedef typename Base::PlainObject PlainObject; /** \internal Represents a matrix with all coefficients equal to one another*/ - typedef CwiseNullaryOp,Derived> ConstantReturnType; + typedef CwiseNullaryOp,PlainObject> ConstantReturnType; #endif // not EIGEN_PARSED_BY_DOXYGEN #define EIGEN_CURRENT_STORAGE_BASE_CLASS Eigen::ArrayBase -# include "../plugins/CommonCwiseUnaryOps.h" +#define EIGEN_DOC_UNARY_ADDONS(X,Y) # include "../plugins/MatrixCwiseUnaryOps.h" # include "../plugins/ArrayCwiseUnaryOps.h" # include "../plugins/CommonCwiseBinaryOps.h" @@ -112,45 +98,63 @@ template class ArrayBase # include EIGEN_ARRAYBASE_PLUGIN # endif #undef EIGEN_CURRENT_STORAGE_BASE_CLASS +#undef EIGEN_DOC_UNARY_ADDONS /** Special case of the template operator=, in order to prevent the compiler * from generating a default operator= (issue hit with g++ 4.1) */ + EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Derived& operator=(const ArrayBase& other) { - return internal::assign_selector::run(derived(), other.derived()); + internal::call_assignment(derived(), other.derived()); + return derived(); } - - Derived& operator+=(const Scalar& scalar) - { return *this = derived() + scalar; } - Derived& operator-=(const Scalar& scalar) - { return *this = derived() - scalar; } + + /** Set all the entries to \a value. + * \sa DenseBase::setConstant(), DenseBase::fill() */ + EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE + Derived& operator=(const Scalar &value) + { Base::setConstant(value); return derived(); } + + EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE + Derived& operator+=(const Scalar& scalar); + EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE + Derived& operator-=(const Scalar& scalar); template + EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Derived& operator+=(const ArrayBase& other); template + EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Derived& operator-=(const ArrayBase& other); template + EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Derived& operator*=(const ArrayBase& other); template + EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Derived& operator/=(const ArrayBase& other); public: + EIGEN_DEVICE_FUNC ArrayBase& array() { return *this; } + EIGEN_DEVICE_FUNC const ArrayBase& array() const { return *this; } /** \returns an \link Eigen::MatrixBase Matrix \endlink expression of this array * \sa MatrixBase::array() */ - MatrixWrapper matrix() { return derived(); } - const MatrixWrapper matrix() const { return derived(); } + EIGEN_DEVICE_FUNC + MatrixWrapper matrix() { return MatrixWrapper(derived()); } + EIGEN_DEVICE_FUNC + const MatrixWrapper matrix() const { return MatrixWrapper(derived()); } // template // inline void evalTo(Dest& dst) const { dst = matrix(); } protected: - ArrayBase() : Base() {} + EIGEN_DEFAULT_COPY_CONSTRUCTOR(ArrayBase) + EIGEN_DEFAULT_EMPTY_CONSTRUCTOR_AND_DESTRUCTOR(ArrayBase) private: explicit ArrayBase(Index); @@ -171,11 +175,10 @@ template class ArrayBase */ template template -EIGEN_STRONG_INLINE Derived & +EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Derived & ArrayBase::operator-=(const ArrayBase &other) { - SelfCwiseBinaryOp, Derived, OtherDerived> tmp(derived()); - tmp = other.derived(); + call_assignment(derived(), other.derived(), internal::sub_assign_op()); return derived(); } @@ -185,11 +188,10 @@ ArrayBase::operator-=(const ArrayBase &other) */ template template -EIGEN_STRONG_INLINE Derived & +EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Derived & ArrayBase::operator+=(const ArrayBase& other) { - SelfCwiseBinaryOp, Derived, OtherDerived> tmp(derived()); - tmp = other.derived(); + call_assignment(derived(), other.derived(), internal::add_assign_op()); return derived(); } @@ -199,11 +201,10 @@ ArrayBase::operator+=(const ArrayBase& other) */ template template -EIGEN_STRONG_INLINE Derived & +EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Derived & ArrayBase::operator*=(const ArrayBase& other) { - SelfCwiseBinaryOp, Derived, OtherDerived> tmp(derived()); - tmp = other.derived(); + call_assignment(derived(), other.derived(), internal::mul_assign_op()); return derived(); } @@ -213,11 +214,10 @@ ArrayBase::operator*=(const ArrayBase& other) */ template template -EIGEN_STRONG_INLINE Derived & +EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Derived & ArrayBase::operator/=(const ArrayBase& other) { - SelfCwiseBinaryOp, Derived, OtherDerived> tmp(derived()); - tmp = other.derived(); + call_assignment(derived(), other.derived(), internal::div_assign_op()); return derived(); } diff --git a/extern/eigen/Eigen/src/Core/ArrayWrapper.h b/extern/eigen/Eigen/src/Core/ArrayWrapper.h index b4641e2a..2e9555b5 100644 --- a/extern/eigen/Eigen/src/Core/ArrayWrapper.h +++ b/extern/eigen/Eigen/src/Core/ArrayWrapper.h @@ -10,7 +10,7 @@ #ifndef EIGEN_ARRAYWRAPPER_H #define EIGEN_ARRAYWRAPPER_H -namespace Eigen { +namespace Eigen { /** \class ArrayWrapper * \ingroup Core_Module @@ -32,7 +32,8 @@ struct traits > // Let's remove NestByRefBit enum { Flags0 = traits::type >::Flags, - Flags = Flags0 & ~NestByRefBit + LvalueBitFlag = is_lvalue::value ? LvalueBit : 0, + Flags = (Flags0 & ~(NestByRefBit | LvalueBit)) | LvalueBitFlag }; }; } @@ -44,6 +45,7 @@ class ArrayWrapper : public ArrayBase > typedef ArrayBase Base; EIGEN_DENSE_PUBLIC_INTERFACE(ArrayWrapper) EIGEN_INHERIT_ASSIGNMENT_OPERATORS(ArrayWrapper) + typedef typename internal::remove_all::type NestedExpression; typedef typename internal::conditional< internal::is_lvalue::value, @@ -51,87 +53,58 @@ class ArrayWrapper : public ArrayBase > const Scalar >::type ScalarWithConstIfNotLvalue; - typedef typename internal::nested::type NestedExpressionType; + typedef typename internal::ref_selector::non_const_type NestedExpressionType; - inline ArrayWrapper(ExpressionType& matrix) : m_expression(matrix) {} + using Base::coeffRef; - inline Index rows() const { return m_expression.rows(); } - inline Index cols() const { return m_expression.cols(); } - inline Index outerStride() const { return m_expression.outerStride(); } - inline Index innerStride() const { return m_expression.innerStride(); } + EIGEN_DEVICE_FUNC + explicit EIGEN_STRONG_INLINE ArrayWrapper(ExpressionType& matrix) : m_expression(matrix) {} - inline ScalarWithConstIfNotLvalue* data() { return m_expression.const_cast_derived().data(); } - inline const Scalar* data() const { return m_expression.data(); } - - inline CoeffReturnType coeff(Index rowId, Index colId) const - { - return m_expression.coeff(rowId, colId); - } + EIGEN_DEVICE_FUNC EIGEN_CONSTEXPR + inline Index rows() const EIGEN_NOEXCEPT { return m_expression.rows(); } + EIGEN_DEVICE_FUNC EIGEN_CONSTEXPR + inline Index cols() const EIGEN_NOEXCEPT { return m_expression.cols(); } + EIGEN_DEVICE_FUNC EIGEN_CONSTEXPR + inline Index outerStride() const EIGEN_NOEXCEPT { return m_expression.outerStride(); } + EIGEN_DEVICE_FUNC EIGEN_CONSTEXPR + inline Index innerStride() const EIGEN_NOEXCEPT { return m_expression.innerStride(); } - inline Scalar& coeffRef(Index rowId, Index colId) - { - return m_expression.const_cast_derived().coeffRef(rowId, colId); - } + EIGEN_DEVICE_FUNC + inline ScalarWithConstIfNotLvalue* data() { return m_expression.data(); } + EIGEN_DEVICE_FUNC + inline const Scalar* data() const { return m_expression.data(); } + EIGEN_DEVICE_FUNC inline const Scalar& coeffRef(Index rowId, Index colId) const { - return m_expression.const_cast_derived().coeffRef(rowId, colId); - } - - inline CoeffReturnType coeff(Index index) const - { - return m_expression.coeff(index); - } - - inline Scalar& coeffRef(Index index) - { - return m_expression.const_cast_derived().coeffRef(index); + return m_expression.coeffRef(rowId, colId); } + EIGEN_DEVICE_FUNC inline const Scalar& coeffRef(Index index) const { - return m_expression.const_cast_derived().coeffRef(index); - } - - template - inline const PacketScalar packet(Index rowId, Index colId) const - { - return m_expression.template packet(rowId, colId); - } - - template - inline void writePacket(Index rowId, Index colId, const PacketScalar& val) - { - m_expression.const_cast_derived().template writePacket(rowId, colId, val); - } - - template - inline const PacketScalar packet(Index index) const - { - return m_expression.template packet(index); - } - - template - inline void writePacket(Index index, const PacketScalar& val) - { - m_expression.const_cast_derived().template writePacket(index, val); + return m_expression.coeffRef(index); } template + EIGEN_DEVICE_FUNC inline void evalTo(Dest& dst) const { dst = m_expression; } - const typename internal::remove_all::type& - nestedExpression() const + EIGEN_DEVICE_FUNC + const typename internal::remove_all::type& + nestedExpression() const { return m_expression; } /** Forwards the resizing request to the nested expression * \sa DenseBase::resize(Index) */ - void resize(Index newSize) { m_expression.const_cast_derived().resize(newSize); } + EIGEN_DEVICE_FUNC + void resize(Index newSize) { m_expression.resize(newSize); } /** Forwards the resizing request to the nested expression * \sa DenseBase::resize(Index,Index)*/ - void resize(Index nbRows, Index nbCols) { m_expression.const_cast_derived().resize(nbRows,nbCols); } + EIGEN_DEVICE_FUNC + void resize(Index rows, Index cols) { m_expression.resize(rows,cols); } protected: NestedExpressionType m_expression; @@ -157,7 +130,8 @@ struct traits > // Let's remove NestByRefBit enum { Flags0 = traits::type >::Flags, - Flags = Flags0 & ~NestByRefBit + LvalueBitFlag = is_lvalue::value ? LvalueBit : 0, + Flags = (Flags0 & ~(NestByRefBit | LvalueBit)) | LvalueBitFlag }; }; } @@ -169,6 +143,7 @@ class MatrixWrapper : public MatrixBase > typedef MatrixBase > Base; EIGEN_DENSE_PUBLIC_INTERFACE(MatrixWrapper) EIGEN_INHERIT_ASSIGNMENT_OPERATORS(MatrixWrapper) + typedef typename internal::remove_all::type NestedExpression; typedef typename internal::conditional< internal::is_lvalue::value, @@ -176,84 +151,54 @@ class MatrixWrapper : public MatrixBase > const Scalar >::type ScalarWithConstIfNotLvalue; - typedef typename internal::nested::type NestedExpressionType; + typedef typename internal::ref_selector::non_const_type NestedExpressionType; - inline MatrixWrapper(ExpressionType& a_matrix) : m_expression(a_matrix) {} + using Base::coeffRef; - inline Index rows() const { return m_expression.rows(); } - inline Index cols() const { return m_expression.cols(); } - inline Index outerStride() const { return m_expression.outerStride(); } - inline Index innerStride() const { return m_expression.innerStride(); } + EIGEN_DEVICE_FUNC + explicit inline MatrixWrapper(ExpressionType& matrix) : m_expression(matrix) {} - inline ScalarWithConstIfNotLvalue* data() { return m_expression.const_cast_derived().data(); } - inline const Scalar* data() const { return m_expression.data(); } - - inline CoeffReturnType coeff(Index rowId, Index colId) const - { - return m_expression.coeff(rowId, colId); - } + EIGEN_DEVICE_FUNC EIGEN_CONSTEXPR + inline Index rows() const EIGEN_NOEXCEPT { return m_expression.rows(); } + EIGEN_DEVICE_FUNC EIGEN_CONSTEXPR + inline Index cols() const EIGEN_NOEXCEPT { return m_expression.cols(); } + EIGEN_DEVICE_FUNC EIGEN_CONSTEXPR + inline Index outerStride() const EIGEN_NOEXCEPT { return m_expression.outerStride(); } + EIGEN_DEVICE_FUNC EIGEN_CONSTEXPR + inline Index innerStride() const EIGEN_NOEXCEPT { return m_expression.innerStride(); } - inline Scalar& coeffRef(Index rowId, Index colId) - { - return m_expression.const_cast_derived().coeffRef(rowId, colId); - } + EIGEN_DEVICE_FUNC + inline ScalarWithConstIfNotLvalue* data() { return m_expression.data(); } + EIGEN_DEVICE_FUNC + inline const Scalar* data() const { return m_expression.data(); } + EIGEN_DEVICE_FUNC inline const Scalar& coeffRef(Index rowId, Index colId) const { return m_expression.derived().coeffRef(rowId, colId); } - inline CoeffReturnType coeff(Index index) const - { - return m_expression.coeff(index); - } - - inline Scalar& coeffRef(Index index) - { - return m_expression.const_cast_derived().coeffRef(index); - } - + EIGEN_DEVICE_FUNC inline const Scalar& coeffRef(Index index) const { - return m_expression.const_cast_derived().coeffRef(index); - } - - template - inline const PacketScalar packet(Index rowId, Index colId) const - { - return m_expression.template packet(rowId, colId); - } - - template - inline void writePacket(Index rowId, Index colId, const PacketScalar& val) - { - m_expression.const_cast_derived().template writePacket(rowId, colId, val); - } - - template - inline const PacketScalar packet(Index index) const - { - return m_expression.template packet(index); - } - - template - inline void writePacket(Index index, const PacketScalar& val) - { - m_expression.const_cast_derived().template writePacket(index, val); + return m_expression.coeffRef(index); } - const typename internal::remove_all::type& - nestedExpression() const + EIGEN_DEVICE_FUNC + const typename internal::remove_all::type& + nestedExpression() const { return m_expression; } /** Forwards the resizing request to the nested expression * \sa DenseBase::resize(Index) */ - void resize(Index newSize) { m_expression.const_cast_derived().resize(newSize); } + EIGEN_DEVICE_FUNC + void resize(Index newSize) { m_expression.resize(newSize); } /** Forwards the resizing request to the nested expression * \sa DenseBase::resize(Index,Index)*/ - void resize(Index nbRows, Index nbCols) { m_expression.const_cast_derived().resize(nbRows,nbCols); } + EIGEN_DEVICE_FUNC + void resize(Index rows, Index cols) { m_expression.resize(rows,cols); } protected: NestedExpressionType m_expression; diff --git a/extern/eigen/Eigen/src/Core/Assign.h b/extern/eigen/Eigen/src/Core/Assign.h index f4817317..655412ef 100644 --- a/extern/eigen/Eigen/src/Core/Assign.h +++ b/extern/eigen/Eigen/src/Core/Assign.h @@ -14,481 +14,9 @@ namespace Eigen { -namespace internal { - -/*************************************************************************** -* Part 1 : the logic deciding a strategy for traversal and unrolling * -***************************************************************************/ - -template -struct assign_traits -{ -public: - enum { - DstIsAligned = Derived::Flags & AlignedBit, - DstHasDirectAccess = Derived::Flags & DirectAccessBit, - SrcIsAligned = OtherDerived::Flags & AlignedBit, - JointAlignment = bool(DstIsAligned) && bool(SrcIsAligned) ? Aligned : Unaligned - }; - -private: - enum { - InnerSize = int(Derived::IsVectorAtCompileTime) ? int(Derived::SizeAtCompileTime) - : int(Derived::Flags)&RowMajorBit ? int(Derived::ColsAtCompileTime) - : int(Derived::RowsAtCompileTime), - InnerMaxSize = int(Derived::IsVectorAtCompileTime) ? int(Derived::MaxSizeAtCompileTime) - : int(Derived::Flags)&RowMajorBit ? int(Derived::MaxColsAtCompileTime) - : int(Derived::MaxRowsAtCompileTime), - MaxSizeAtCompileTime = Derived::SizeAtCompileTime, - PacketSize = packet_traits::size - }; - - enum { - StorageOrdersAgree = (int(Derived::IsRowMajor) == int(OtherDerived::IsRowMajor)), - MightVectorize = StorageOrdersAgree - && (int(Derived::Flags) & int(OtherDerived::Flags) & ActualPacketAccessBit), - MayInnerVectorize = MightVectorize && int(InnerSize)!=Dynamic && int(InnerSize)%int(PacketSize)==0 - && int(DstIsAligned) && int(SrcIsAligned), - MayLinearize = StorageOrdersAgree && (int(Derived::Flags) & int(OtherDerived::Flags) & LinearAccessBit), - MayLinearVectorize = MightVectorize && MayLinearize && DstHasDirectAccess - && (DstIsAligned || MaxSizeAtCompileTime == Dynamic), - /* If the destination isn't aligned, we have to do runtime checks and we don't unroll, - so it's only good for large enough sizes. */ - MaySliceVectorize = MightVectorize && DstHasDirectAccess - && (int(InnerMaxSize)==Dynamic || int(InnerMaxSize)>=3*PacketSize) - /* slice vectorization can be slow, so we only want it if the slices are big, which is - indicated by InnerMaxSize rather than InnerSize, think of the case of a dynamic block - in a fixed-size matrix */ - }; - -public: - enum { - Traversal = int(MayInnerVectorize) ? int(InnerVectorizedTraversal) - : int(MayLinearVectorize) ? int(LinearVectorizedTraversal) - : int(MaySliceVectorize) ? int(SliceVectorizedTraversal) - : int(MayLinearize) ? int(LinearTraversal) - : int(DefaultTraversal), - Vectorized = int(Traversal) == InnerVectorizedTraversal - || int(Traversal) == LinearVectorizedTraversal - || int(Traversal) == SliceVectorizedTraversal - }; - -private: - enum { - UnrollingLimit = EIGEN_UNROLLING_LIMIT * (Vectorized ? int(PacketSize) : 1), - MayUnrollCompletely = int(Derived::SizeAtCompileTime) != Dynamic - && int(OtherDerived::CoeffReadCost) != Dynamic - && int(Derived::SizeAtCompileTime) * int(OtherDerived::CoeffReadCost) <= int(UnrollingLimit), - MayUnrollInner = int(InnerSize) != Dynamic - && int(OtherDerived::CoeffReadCost) != Dynamic - && int(InnerSize) * int(OtherDerived::CoeffReadCost) <= int(UnrollingLimit) - }; - -public: - enum { - Unrolling = (int(Traversal) == int(InnerVectorizedTraversal) || int(Traversal) == int(DefaultTraversal)) - ? ( - int(MayUnrollCompletely) ? int(CompleteUnrolling) - : int(MayUnrollInner) ? int(InnerUnrolling) - : int(NoUnrolling) - ) - : int(Traversal) == int(LinearVectorizedTraversal) - ? ( bool(MayUnrollCompletely) && bool(DstIsAligned) ? int(CompleteUnrolling) : int(NoUnrolling) ) - : int(Traversal) == int(LinearTraversal) - ? ( bool(MayUnrollCompletely) ? int(CompleteUnrolling) : int(NoUnrolling) ) - : int(NoUnrolling) - }; - -#ifdef EIGEN_DEBUG_ASSIGN - static void debug() - { - EIGEN_DEBUG_VAR(DstIsAligned) - EIGEN_DEBUG_VAR(SrcIsAligned) - EIGEN_DEBUG_VAR(JointAlignment) - EIGEN_DEBUG_VAR(InnerSize) - EIGEN_DEBUG_VAR(InnerMaxSize) - EIGEN_DEBUG_VAR(PacketSize) - EIGEN_DEBUG_VAR(StorageOrdersAgree) - EIGEN_DEBUG_VAR(MightVectorize) - EIGEN_DEBUG_VAR(MayLinearize) - EIGEN_DEBUG_VAR(MayInnerVectorize) - EIGEN_DEBUG_VAR(MayLinearVectorize) - EIGEN_DEBUG_VAR(MaySliceVectorize) - EIGEN_DEBUG_VAR(Traversal) - EIGEN_DEBUG_VAR(UnrollingLimit) - EIGEN_DEBUG_VAR(MayUnrollCompletely) - EIGEN_DEBUG_VAR(MayUnrollInner) - EIGEN_DEBUG_VAR(Unrolling) - } -#endif -}; - -/*************************************************************************** -* Part 2 : meta-unrollers -***************************************************************************/ - -/************************ -*** Default traversal *** -************************/ - -template -struct assign_DefaultTraversal_CompleteUnrolling -{ - enum { - outer = Index / Derived1::InnerSizeAtCompileTime, - inner = Index % Derived1::InnerSizeAtCompileTime - }; - - static EIGEN_STRONG_INLINE void run(Derived1 &dst, const Derived2 &src) - { - dst.copyCoeffByOuterInner(outer, inner, src); - assign_DefaultTraversal_CompleteUnrolling::run(dst, src); - } -}; - -template -struct assign_DefaultTraversal_CompleteUnrolling -{ - static EIGEN_STRONG_INLINE void run(Derived1 &, const Derived2 &) {} -}; - -template -struct assign_DefaultTraversal_InnerUnrolling -{ - static EIGEN_STRONG_INLINE void run(Derived1 &dst, const Derived2 &src, typename Derived1::Index outer) - { - dst.copyCoeffByOuterInner(outer, Index, src); - assign_DefaultTraversal_InnerUnrolling::run(dst, src, outer); - } -}; - -template -struct assign_DefaultTraversal_InnerUnrolling -{ - static EIGEN_STRONG_INLINE void run(Derived1 &, const Derived2 &, typename Derived1::Index) {} -}; - -/*********************** -*** Linear traversal *** -***********************/ - -template -struct assign_LinearTraversal_CompleteUnrolling -{ - static EIGEN_STRONG_INLINE void run(Derived1 &dst, const Derived2 &src) - { - dst.copyCoeff(Index, src); - assign_LinearTraversal_CompleteUnrolling::run(dst, src); - } -}; - -template -struct assign_LinearTraversal_CompleteUnrolling -{ - static EIGEN_STRONG_INLINE void run(Derived1 &, const Derived2 &) {} -}; - -/************************** -*** Inner vectorization *** -**************************/ - -template -struct assign_innervec_CompleteUnrolling -{ - enum { - outer = Index / Derived1::InnerSizeAtCompileTime, - inner = Index % Derived1::InnerSizeAtCompileTime, - JointAlignment = assign_traits::JointAlignment - }; - - static EIGEN_STRONG_INLINE void run(Derived1 &dst, const Derived2 &src) - { - dst.template copyPacketByOuterInner(outer, inner, src); - assign_innervec_CompleteUnrolling::size, Stop>::run(dst, src); - } -}; - -template -struct assign_innervec_CompleteUnrolling -{ - static EIGEN_STRONG_INLINE void run(Derived1 &, const Derived2 &) {} -}; - -template -struct assign_innervec_InnerUnrolling -{ - static EIGEN_STRONG_INLINE void run(Derived1 &dst, const Derived2 &src, typename Derived1::Index outer) - { - dst.template copyPacketByOuterInner(outer, Index, src); - assign_innervec_InnerUnrolling::size, Stop>::run(dst, src, outer); - } -}; - -template -struct assign_innervec_InnerUnrolling -{ - static EIGEN_STRONG_INLINE void run(Derived1 &, const Derived2 &, typename Derived1::Index) {} -}; - -/*************************************************************************** -* Part 3 : implementation of all cases -***************************************************************************/ - -template::Traversal, - int Unrolling = assign_traits::Unrolling, - int Version = Specialized> -struct assign_impl; - -/************************ -*** Default traversal *** -************************/ - -template -struct assign_impl -{ - static inline void run(Derived1 &, const Derived2 &) { } -}; - -template -struct assign_impl -{ - typedef typename Derived1::Index Index; - static inline void run(Derived1 &dst, const Derived2 &src) - { - const Index innerSize = dst.innerSize(); - const Index outerSize = dst.outerSize(); - for(Index outer = 0; outer < outerSize; ++outer) - for(Index inner = 0; inner < innerSize; ++inner) - dst.copyCoeffByOuterInner(outer, inner, src); - } -}; - -template -struct assign_impl -{ - static EIGEN_STRONG_INLINE void run(Derived1 &dst, const Derived2 &src) - { - assign_DefaultTraversal_CompleteUnrolling - ::run(dst, src); - } -}; - -template -struct assign_impl -{ - typedef typename Derived1::Index Index; - static EIGEN_STRONG_INLINE void run(Derived1 &dst, const Derived2 &src) - { - const Index outerSize = dst.outerSize(); - for(Index outer = 0; outer < outerSize; ++outer) - assign_DefaultTraversal_InnerUnrolling - ::run(dst, src, outer); - } -}; - -/*********************** -*** Linear traversal *** -***********************/ - -template -struct assign_impl -{ - typedef typename Derived1::Index Index; - static inline void run(Derived1 &dst, const Derived2 &src) - { - const Index size = dst.size(); - for(Index i = 0; i < size; ++i) - dst.copyCoeff(i, src); - } -}; - -template -struct assign_impl -{ - static EIGEN_STRONG_INLINE void run(Derived1 &dst, const Derived2 &src) - { - assign_LinearTraversal_CompleteUnrolling - ::run(dst, src); - } -}; - -/************************** -*** Inner vectorization *** -**************************/ - -template -struct assign_impl -{ - typedef typename Derived1::Index Index; - static inline void run(Derived1 &dst, const Derived2 &src) - { - const Index innerSize = dst.innerSize(); - const Index outerSize = dst.outerSize(); - const Index packetSize = packet_traits::size; - for(Index outer = 0; outer < outerSize; ++outer) - for(Index inner = 0; inner < innerSize; inner+=packetSize) - dst.template copyPacketByOuterInner(outer, inner, src); - } -}; - -template -struct assign_impl -{ - static EIGEN_STRONG_INLINE void run(Derived1 &dst, const Derived2 &src) - { - assign_innervec_CompleteUnrolling - ::run(dst, src); - } -}; - -template -struct assign_impl -{ - typedef typename Derived1::Index Index; - static EIGEN_STRONG_INLINE void run(Derived1 &dst, const Derived2 &src) - { - const Index outerSize = dst.outerSize(); - for(Index outer = 0; outer < outerSize; ++outer) - assign_innervec_InnerUnrolling - ::run(dst, src, outer); - } -}; - -/*************************** -*** Linear vectorization *** -***************************/ - -template -struct unaligned_assign_impl -{ - template - static EIGEN_STRONG_INLINE void run(const Derived&, OtherDerived&, typename Derived::Index, typename Derived::Index) {} -}; - -template <> -struct unaligned_assign_impl -{ - // MSVC must not inline this functions. If it does, it fails to optimize the - // packet access path. -#ifdef _MSC_VER - template - static EIGEN_DONT_INLINE void run(const Derived& src, OtherDerived& dst, typename Derived::Index start, typename Derived::Index end) -#else - template - static EIGEN_STRONG_INLINE void run(const Derived& src, OtherDerived& dst, typename Derived::Index start, typename Derived::Index end) -#endif - { - for (typename Derived::Index index = start; index < end; ++index) - dst.copyCoeff(index, src); - } -}; - -template -struct assign_impl -{ - typedef typename Derived1::Index Index; - static EIGEN_STRONG_INLINE void run(Derived1 &dst, const Derived2 &src) - { - const Index size = dst.size(); - typedef packet_traits PacketTraits; - enum { - packetSize = PacketTraits::size, - dstAlignment = PacketTraits::AlignedOnScalar ? Aligned : int(assign_traits::DstIsAligned) , - srcAlignment = assign_traits::JointAlignment - }; - const Index alignedStart = assign_traits::DstIsAligned ? 0 - : internal::first_aligned(&dst.coeffRef(0), size); - const Index alignedEnd = alignedStart + ((size-alignedStart)/packetSize)*packetSize; - - unaligned_assign_impl::DstIsAligned!=0>::run(src,dst,0,alignedStart); - - for(Index index = alignedStart; index < alignedEnd; index += packetSize) - { - dst.template copyPacket(index, src); - } - - unaligned_assign_impl<>::run(src,dst,alignedEnd,size); - } -}; - -template -struct assign_impl -{ - typedef typename Derived1::Index Index; - static EIGEN_STRONG_INLINE void run(Derived1 &dst, const Derived2 &src) - { - enum { size = Derived1::SizeAtCompileTime, - packetSize = packet_traits::size, - alignedSize = (size/packetSize)*packetSize }; - - assign_innervec_CompleteUnrolling::run(dst, src); - assign_DefaultTraversal_CompleteUnrolling::run(dst, src); - } -}; - -/************************** -*** Slice vectorization *** -***************************/ - -template -struct assign_impl -{ - typedef typename Derived1::Index Index; - static inline void run(Derived1 &dst, const Derived2 &src) - { - typedef typename Derived1::Scalar Scalar; - typedef packet_traits PacketTraits; - enum { - packetSize = PacketTraits::size, - alignable = PacketTraits::AlignedOnScalar, - dstIsAligned = assign_traits::DstIsAligned, - dstAlignment = alignable ? Aligned : int(dstIsAligned), - srcAlignment = assign_traits::JointAlignment - }; - const Scalar *dst_ptr = &dst.coeffRef(0,0); - if((!bool(dstIsAligned)) && (size_t(dst_ptr) % sizeof(Scalar))>0) - { - // the pointer is not aligend-on scalar, so alignment is not possible - return assign_impl::run(dst, src); - } - const Index packetAlignedMask = packetSize - 1; - const Index innerSize = dst.innerSize(); - const Index outerSize = dst.outerSize(); - const Index alignedStep = alignable ? (packetSize - dst.outerStride() % packetSize) & packetAlignedMask : 0; - Index alignedStart = ((!alignable) || bool(dstIsAligned)) ? 0 : internal::first_aligned(dst_ptr, innerSize); - - for(Index outer = 0; outer < outerSize; ++outer) - { - const Index alignedEnd = alignedStart + ((innerSize-alignedStart) & ~packetAlignedMask); - // do the non-vectorizable part of the assignment - for(Index inner = 0; inner(outer, inner, src); - - // do the non-vectorizable part of the assignment - for(Index inner = alignedEnd; inner((alignedStart+alignedStep)%packetSize, innerSize); - } - } -}; - -} // end namespace internal - -/*************************************************************************** -* Part 4 : implementation of DenseBase methods -***************************************************************************/ - template template -EIGEN_STRONG_INLINE Derived& DenseBase +EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Derived& DenseBase ::lazyAssign(const DenseBase& other) { enum{ @@ -499,90 +27,62 @@ EIGEN_STRONG_INLINE Derived& DenseBase EIGEN_STATIC_ASSERT_SAME_MATRIX_SIZE(Derived,OtherDerived) EIGEN_STATIC_ASSERT(SameType,YOU_MIXED_DIFFERENT_NUMERIC_TYPES__YOU_NEED_TO_USE_THE_CAST_METHOD_OF_MATRIXBASE_TO_CAST_NUMERIC_TYPES_EXPLICITLY) -#ifdef EIGEN_DEBUG_ASSIGN - internal::assign_traits::debug(); -#endif eigen_assert(rows() == other.rows() && cols() == other.cols()); - internal::assign_impl::Traversal) - : int(InvalidTraversal)>::run(derived(),other.derived()); -#ifndef EIGEN_NO_DEBUG - checkTransposeAliasing(other.derived()); -#endif + internal::call_assignment_no_alias(derived(),other.derived()); + return derived(); } -namespace internal { - -template::Flags) & EvalBeforeAssigningBit) != 0, - bool NeedToTranspose = ((int(Derived::RowsAtCompileTime) == 1 && int(OtherDerived::ColsAtCompileTime) == 1) - | // FIXME | instead of || to please GCC 4.4.0 stupid warning "suggest parentheses around &&". - // revert to || as soon as not needed anymore. - (int(Derived::ColsAtCompileTime) == 1 && int(OtherDerived::RowsAtCompileTime) == 1)) - && int(Derived::SizeAtCompileTime) != 1> -struct assign_selector; - -template -struct assign_selector { - static EIGEN_STRONG_INLINE Derived& run(Derived& dst, const OtherDerived& other) { return dst.lazyAssign(other.derived()); } - template - static EIGEN_STRONG_INLINE Derived& evalTo(ActualDerived& dst, const ActualOtherDerived& other) { other.evalTo(dst); return dst; } -}; -template -struct assign_selector { - static EIGEN_STRONG_INLINE Derived& run(Derived& dst, const OtherDerived& other) { return dst.lazyAssign(other.eval()); } -}; -template -struct assign_selector { - static EIGEN_STRONG_INLINE Derived& run(Derived& dst, const OtherDerived& other) { return dst.lazyAssign(other.transpose()); } - template - static EIGEN_STRONG_INLINE Derived& evalTo(ActualDerived& dst, const ActualOtherDerived& other) { Transpose dstTrans(dst); other.evalTo(dstTrans); return dst; } -}; -template -struct assign_selector { - static EIGEN_STRONG_INLINE Derived& run(Derived& dst, const OtherDerived& other) { return dst.lazyAssign(other.transpose().eval()); } -}; - -} // end namespace internal - template template +EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Derived& DenseBase::operator=(const DenseBase& other) { - return internal::assign_selector::run(derived(), other.derived()); + internal::call_assignment(derived(), other.derived()); + return derived(); } template +EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Derived& DenseBase::operator=(const DenseBase& other) { - return internal::assign_selector::run(derived(), other.derived()); + internal::call_assignment(derived(), other.derived()); + return derived(); } template +EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Derived& MatrixBase::operator=(const MatrixBase& other) { - return internal::assign_selector::run(derived(), other.derived()); + internal::call_assignment(derived(), other.derived()); + return derived(); } template template +EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Derived& MatrixBase::operator=(const DenseBase& other) { - return internal::assign_selector::run(derived(), other.derived()); + internal::call_assignment(derived(), other.derived()); + return derived(); } template template +EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Derived& MatrixBase::operator=(const EigenBase& other) { - return internal::assign_selector::evalTo(derived(), other.derived()); + internal::call_assignment(derived(), other.derived()); + return derived(); } template template +EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Derived& MatrixBase::operator=(const ReturnByValue& other) { - return internal::assign_selector::evalTo(derived(), other.derived()); + other.derived().evalTo(derived()); + return derived(); } } // end namespace Eigen diff --git a/extern/eigen/Eigen/src/Core/AssignEvaluator.h b/extern/eigen/Eigen/src/Core/AssignEvaluator.h new file mode 100644 index 00000000..7d76f0c2 --- /dev/null +++ b/extern/eigen/Eigen/src/Core/AssignEvaluator.h @@ -0,0 +1,1010 @@ +// This file is part of Eigen, a lightweight C++ template library +// for linear algebra. +// +// Copyright (C) 2011 Benoit Jacob +// Copyright (C) 2011-2014 Gael Guennebaud +// Copyright (C) 2011-2012 Jitse Niesen +// +// This Source Code Form is subject to the terms of the Mozilla +// Public License v. 2.0. If a copy of the MPL was not distributed +// with this file, You can obtain one at http://mozilla.org/MPL/2.0/. + +#ifndef EIGEN_ASSIGN_EVALUATOR_H +#define EIGEN_ASSIGN_EVALUATOR_H + +namespace Eigen { + +// This implementation is based on Assign.h + +namespace internal { + +/*************************************************************************** +* Part 1 : the logic deciding a strategy for traversal and unrolling * +***************************************************************************/ + +// copy_using_evaluator_traits is based on assign_traits + +template +struct copy_using_evaluator_traits +{ + typedef typename DstEvaluator::XprType Dst; + typedef typename Dst::Scalar DstScalar; + + enum { + DstFlags = DstEvaluator::Flags, + SrcFlags = SrcEvaluator::Flags + }; + +public: + enum { + DstAlignment = DstEvaluator::Alignment, + SrcAlignment = SrcEvaluator::Alignment, + DstHasDirectAccess = (DstFlags & DirectAccessBit) == DirectAccessBit, + JointAlignment = EIGEN_PLAIN_ENUM_MIN(DstAlignment,SrcAlignment) + }; + +private: + enum { + InnerSize = int(Dst::IsVectorAtCompileTime) ? int(Dst::SizeAtCompileTime) + : int(DstFlags)&RowMajorBit ? int(Dst::ColsAtCompileTime) + : int(Dst::RowsAtCompileTime), + InnerMaxSize = int(Dst::IsVectorAtCompileTime) ? int(Dst::MaxSizeAtCompileTime) + : int(DstFlags)&RowMajorBit ? int(Dst::MaxColsAtCompileTime) + : int(Dst::MaxRowsAtCompileTime), + RestrictedInnerSize = EIGEN_SIZE_MIN_PREFER_FIXED(InnerSize,MaxPacketSize), + RestrictedLinearSize = EIGEN_SIZE_MIN_PREFER_FIXED(Dst::SizeAtCompileTime,MaxPacketSize), + OuterStride = int(outer_stride_at_compile_time::ret), + MaxSizeAtCompileTime = Dst::SizeAtCompileTime + }; + + // TODO distinguish between linear traversal and inner-traversals + typedef typename find_best_packet::type LinearPacketType; + typedef typename find_best_packet::type InnerPacketType; + + enum { + LinearPacketSize = unpacket_traits::size, + InnerPacketSize = unpacket_traits::size + }; + +public: + enum { + LinearRequiredAlignment = unpacket_traits::alignment, + InnerRequiredAlignment = unpacket_traits::alignment + }; + +private: + enum { + DstIsRowMajor = DstFlags&RowMajorBit, + SrcIsRowMajor = SrcFlags&RowMajorBit, + StorageOrdersAgree = (int(DstIsRowMajor) == int(SrcIsRowMajor)), + MightVectorize = bool(StorageOrdersAgree) + && (int(DstFlags) & int(SrcFlags) & ActualPacketAccessBit) + && bool(functor_traits::PacketAccess), + MayInnerVectorize = MightVectorize + && int(InnerSize)!=Dynamic && int(InnerSize)%int(InnerPacketSize)==0 + && int(OuterStride)!=Dynamic && int(OuterStride)%int(InnerPacketSize)==0 + && (EIGEN_UNALIGNED_VECTORIZE || int(JointAlignment)>=int(InnerRequiredAlignment)), + MayLinearize = bool(StorageOrdersAgree) && (int(DstFlags) & int(SrcFlags) & LinearAccessBit), + MayLinearVectorize = bool(MightVectorize) && bool(MayLinearize) && bool(DstHasDirectAccess) + && (EIGEN_UNALIGNED_VECTORIZE || (int(DstAlignment)>=int(LinearRequiredAlignment)) || MaxSizeAtCompileTime == Dynamic), + /* If the destination isn't aligned, we have to do runtime checks and we don't unroll, + so it's only good for large enough sizes. */ + MaySliceVectorize = bool(MightVectorize) && bool(DstHasDirectAccess) + && (int(InnerMaxSize)==Dynamic || int(InnerMaxSize)>=(EIGEN_UNALIGNED_VECTORIZE?InnerPacketSize:(3*InnerPacketSize))) + /* slice vectorization can be slow, so we only want it if the slices are big, which is + indicated by InnerMaxSize rather than InnerSize, think of the case of a dynamic block + in a fixed-size matrix + However, with EIGEN_UNALIGNED_VECTORIZE and unrolling, slice vectorization is still worth it */ + }; + +public: + enum { + Traversal = int(Dst::SizeAtCompileTime) == 0 ? int(AllAtOnceTraversal) // If compile-size is zero, traversing will fail at compile-time. + : (int(MayLinearVectorize) && (LinearPacketSize>InnerPacketSize)) ? int(LinearVectorizedTraversal) + : int(MayInnerVectorize) ? int(InnerVectorizedTraversal) + : int(MayLinearVectorize) ? int(LinearVectorizedTraversal) + : int(MaySliceVectorize) ? int(SliceVectorizedTraversal) + : int(MayLinearize) ? int(LinearTraversal) + : int(DefaultTraversal), + Vectorized = int(Traversal) == InnerVectorizedTraversal + || int(Traversal) == LinearVectorizedTraversal + || int(Traversal) == SliceVectorizedTraversal + }; + + typedef typename conditional::type PacketType; + +private: + enum { + ActualPacketSize = int(Traversal)==LinearVectorizedTraversal ? LinearPacketSize + : Vectorized ? InnerPacketSize + : 1, + UnrollingLimit = EIGEN_UNROLLING_LIMIT * ActualPacketSize, + MayUnrollCompletely = int(Dst::SizeAtCompileTime) != Dynamic + && int(Dst::SizeAtCompileTime) * (int(DstEvaluator::CoeffReadCost)+int(SrcEvaluator::CoeffReadCost)) <= int(UnrollingLimit), + MayUnrollInner = int(InnerSize) != Dynamic + && int(InnerSize) * (int(DstEvaluator::CoeffReadCost)+int(SrcEvaluator::CoeffReadCost)) <= int(UnrollingLimit) + }; + +public: + enum { + Unrolling = (int(Traversal) == int(InnerVectorizedTraversal) || int(Traversal) == int(DefaultTraversal)) + ? ( + int(MayUnrollCompletely) ? int(CompleteUnrolling) + : int(MayUnrollInner) ? int(InnerUnrolling) + : int(NoUnrolling) + ) + : int(Traversal) == int(LinearVectorizedTraversal) + ? ( bool(MayUnrollCompletely) && ( EIGEN_UNALIGNED_VECTORIZE || (int(DstAlignment)>=int(LinearRequiredAlignment))) + ? int(CompleteUnrolling) + : int(NoUnrolling) ) + : int(Traversal) == int(LinearTraversal) + ? ( bool(MayUnrollCompletely) ? int(CompleteUnrolling) + : int(NoUnrolling) ) +#if EIGEN_UNALIGNED_VECTORIZE + : int(Traversal) == int(SliceVectorizedTraversal) + ? ( bool(MayUnrollInner) ? int(InnerUnrolling) + : int(NoUnrolling) ) +#endif + : int(NoUnrolling) + }; + +#ifdef EIGEN_DEBUG_ASSIGN + static void debug() + { + std::cerr << "DstXpr: " << typeid(typename DstEvaluator::XprType).name() << std::endl; + std::cerr << "SrcXpr: " << typeid(typename SrcEvaluator::XprType).name() << std::endl; + std::cerr.setf(std::ios::hex, std::ios::basefield); + std::cerr << "DstFlags" << " = " << DstFlags << " (" << demangle_flags(DstFlags) << " )" << std::endl; + std::cerr << "SrcFlags" << " = " << SrcFlags << " (" << demangle_flags(SrcFlags) << " )" << std::endl; + std::cerr.unsetf(std::ios::hex); + EIGEN_DEBUG_VAR(DstAlignment) + EIGEN_DEBUG_VAR(SrcAlignment) + EIGEN_DEBUG_VAR(LinearRequiredAlignment) + EIGEN_DEBUG_VAR(InnerRequiredAlignment) + EIGEN_DEBUG_VAR(JointAlignment) + EIGEN_DEBUG_VAR(InnerSize) + EIGEN_DEBUG_VAR(InnerMaxSize) + EIGEN_DEBUG_VAR(LinearPacketSize) + EIGEN_DEBUG_VAR(InnerPacketSize) + EIGEN_DEBUG_VAR(ActualPacketSize) + EIGEN_DEBUG_VAR(StorageOrdersAgree) + EIGEN_DEBUG_VAR(MightVectorize) + EIGEN_DEBUG_VAR(MayLinearize) + EIGEN_DEBUG_VAR(MayInnerVectorize) + EIGEN_DEBUG_VAR(MayLinearVectorize) + EIGEN_DEBUG_VAR(MaySliceVectorize) + std::cerr << "Traversal" << " = " << Traversal << " (" << demangle_traversal(Traversal) << ")" << std::endl; + EIGEN_DEBUG_VAR(SrcEvaluator::CoeffReadCost) + EIGEN_DEBUG_VAR(DstEvaluator::CoeffReadCost) + EIGEN_DEBUG_VAR(Dst::SizeAtCompileTime) + EIGEN_DEBUG_VAR(UnrollingLimit) + EIGEN_DEBUG_VAR(MayUnrollCompletely) + EIGEN_DEBUG_VAR(MayUnrollInner) + std::cerr << "Unrolling" << " = " << Unrolling << " (" << demangle_unrolling(Unrolling) << ")" << std::endl; + std::cerr << std::endl; + } +#endif +}; + +/*************************************************************************** +* Part 2 : meta-unrollers +***************************************************************************/ + +/************************ +*** Default traversal *** +************************/ + +template +struct copy_using_evaluator_DefaultTraversal_CompleteUnrolling +{ + // FIXME: this is not very clean, perhaps this information should be provided by the kernel? + typedef typename Kernel::DstEvaluatorType DstEvaluatorType; + typedef typename DstEvaluatorType::XprType DstXprType; + + enum { + outer = Index / DstXprType::InnerSizeAtCompileTime, + inner = Index % DstXprType::InnerSizeAtCompileTime + }; + + EIGEN_DEVICE_FUNC static EIGEN_STRONG_INLINE void run(Kernel &kernel) + { + kernel.assignCoeffByOuterInner(outer, inner); + copy_using_evaluator_DefaultTraversal_CompleteUnrolling::run(kernel); + } +}; + +template +struct copy_using_evaluator_DefaultTraversal_CompleteUnrolling +{ + EIGEN_DEVICE_FUNC static EIGEN_STRONG_INLINE void run(Kernel&) { } +}; + +template +struct copy_using_evaluator_DefaultTraversal_InnerUnrolling +{ + EIGEN_DEVICE_FUNC static EIGEN_STRONG_INLINE void run(Kernel &kernel, Index outer) + { + kernel.assignCoeffByOuterInner(outer, Index_); + copy_using_evaluator_DefaultTraversal_InnerUnrolling::run(kernel, outer); + } +}; + +template +struct copy_using_evaluator_DefaultTraversal_InnerUnrolling +{ + EIGEN_DEVICE_FUNC static EIGEN_STRONG_INLINE void run(Kernel&, Index) { } +}; + +/*********************** +*** Linear traversal *** +***********************/ + +template +struct copy_using_evaluator_LinearTraversal_CompleteUnrolling +{ + EIGEN_DEVICE_FUNC static EIGEN_STRONG_INLINE void run(Kernel& kernel) + { + kernel.assignCoeff(Index); + copy_using_evaluator_LinearTraversal_CompleteUnrolling::run(kernel); + } +}; + +template +struct copy_using_evaluator_LinearTraversal_CompleteUnrolling +{ + EIGEN_DEVICE_FUNC static EIGEN_STRONG_INLINE void run(Kernel&) { } +}; + +/************************** +*** Inner vectorization *** +**************************/ + +template +struct copy_using_evaluator_innervec_CompleteUnrolling +{ + // FIXME: this is not very clean, perhaps this information should be provided by the kernel? + typedef typename Kernel::DstEvaluatorType DstEvaluatorType; + typedef typename DstEvaluatorType::XprType DstXprType; + typedef typename Kernel::PacketType PacketType; + + enum { + outer = Index / DstXprType::InnerSizeAtCompileTime, + inner = Index % DstXprType::InnerSizeAtCompileTime, + SrcAlignment = Kernel::AssignmentTraits::SrcAlignment, + DstAlignment = Kernel::AssignmentTraits::DstAlignment + }; + + EIGEN_DEVICE_FUNC static EIGEN_STRONG_INLINE void run(Kernel &kernel) + { + kernel.template assignPacketByOuterInner(outer, inner); + enum { NextIndex = Index + unpacket_traits::size }; + copy_using_evaluator_innervec_CompleteUnrolling::run(kernel); + } +}; + +template +struct copy_using_evaluator_innervec_CompleteUnrolling +{ + EIGEN_DEVICE_FUNC static EIGEN_STRONG_INLINE void run(Kernel&) { } +}; + +template +struct copy_using_evaluator_innervec_InnerUnrolling +{ + typedef typename Kernel::PacketType PacketType; + EIGEN_DEVICE_FUNC static EIGEN_STRONG_INLINE void run(Kernel &kernel, Index outer) + { + kernel.template assignPacketByOuterInner(outer, Index_); + enum { NextIndex = Index_ + unpacket_traits::size }; + copy_using_evaluator_innervec_InnerUnrolling::run(kernel, outer); + } +}; + +template +struct copy_using_evaluator_innervec_InnerUnrolling +{ + EIGEN_DEVICE_FUNC static EIGEN_STRONG_INLINE void run(Kernel &, Index) { } +}; + +/*************************************************************************** +* Part 3 : implementation of all cases +***************************************************************************/ + +// dense_assignment_loop is based on assign_impl + +template +struct dense_assignment_loop; + +/************************ +***** Special Cases ***** +************************/ + +// Zero-sized assignment is a no-op. +template +struct dense_assignment_loop +{ + EIGEN_DEVICE_FUNC static void EIGEN_STRONG_INLINE run(Kernel& /*kernel*/) + { + typedef typename Kernel::DstEvaluatorType::XprType DstXprType; + EIGEN_STATIC_ASSERT(int(DstXprType::SizeAtCompileTime) == 0, + EIGEN_INTERNAL_ERROR_PLEASE_FILE_A_BUG_REPORT) + } +}; + +/************************ +*** Default traversal *** +************************/ + +template +struct dense_assignment_loop +{ + EIGEN_DEVICE_FUNC static void EIGEN_STRONG_INLINE run(Kernel &kernel) + { + for(Index outer = 0; outer < kernel.outerSize(); ++outer) { + for(Index inner = 0; inner < kernel.innerSize(); ++inner) { + kernel.assignCoeffByOuterInner(outer, inner); + } + } + } +}; + +template +struct dense_assignment_loop +{ + EIGEN_DEVICE_FUNC static EIGEN_STRONG_INLINE void run(Kernel &kernel) + { + typedef typename Kernel::DstEvaluatorType::XprType DstXprType; + copy_using_evaluator_DefaultTraversal_CompleteUnrolling::run(kernel); + } +}; + +template +struct dense_assignment_loop +{ + EIGEN_DEVICE_FUNC static EIGEN_STRONG_INLINE void run(Kernel &kernel) + { + typedef typename Kernel::DstEvaluatorType::XprType DstXprType; + + const Index outerSize = kernel.outerSize(); + for(Index outer = 0; outer < outerSize; ++outer) + copy_using_evaluator_DefaultTraversal_InnerUnrolling::run(kernel, outer); + } +}; + +/*************************** +*** Linear vectorization *** +***************************/ + + +// The goal of unaligned_dense_assignment_loop is simply to factorize the handling +// of the non vectorizable beginning and ending parts + +template +struct unaligned_dense_assignment_loop +{ + // if IsAligned = true, then do nothing + template + EIGEN_DEVICE_FUNC static EIGEN_STRONG_INLINE void run(Kernel&, Index, Index) {} +}; + +template <> +struct unaligned_dense_assignment_loop +{ + // MSVC must not inline this functions. If it does, it fails to optimize the + // packet access path. + // FIXME check which version exhibits this issue +#if EIGEN_COMP_MSVC + template + static EIGEN_DONT_INLINE void run(Kernel &kernel, + Index start, + Index end) +#else + template + EIGEN_DEVICE_FUNC static EIGEN_STRONG_INLINE void run(Kernel &kernel, + Index start, + Index end) +#endif + { + for (Index index = start; index < end; ++index) + kernel.assignCoeff(index); + } +}; + +template +struct dense_assignment_loop +{ + EIGEN_DEVICE_FUNC static EIGEN_STRONG_INLINE void run(Kernel &kernel) + { + const Index size = kernel.size(); + typedef typename Kernel::Scalar Scalar; + typedef typename Kernel::PacketType PacketType; + enum { + requestedAlignment = Kernel::AssignmentTraits::LinearRequiredAlignment, + packetSize = unpacket_traits::size, + dstIsAligned = int(Kernel::AssignmentTraits::DstAlignment)>=int(requestedAlignment), + dstAlignment = packet_traits::AlignedOnScalar ? int(requestedAlignment) + : int(Kernel::AssignmentTraits::DstAlignment), + srcAlignment = Kernel::AssignmentTraits::JointAlignment + }; + const Index alignedStart = dstIsAligned ? 0 : internal::first_aligned(kernel.dstDataPtr(), size); + const Index alignedEnd = alignedStart + ((size-alignedStart)/packetSize)*packetSize; + + unaligned_dense_assignment_loop::run(kernel, 0, alignedStart); + + for(Index index = alignedStart; index < alignedEnd; index += packetSize) + kernel.template assignPacket(index); + + unaligned_dense_assignment_loop<>::run(kernel, alignedEnd, size); + } +}; + +template +struct dense_assignment_loop +{ + EIGEN_DEVICE_FUNC static EIGEN_STRONG_INLINE void run(Kernel &kernel) + { + typedef typename Kernel::DstEvaluatorType::XprType DstXprType; + typedef typename Kernel::PacketType PacketType; + + enum { size = DstXprType::SizeAtCompileTime, + packetSize =unpacket_traits::size, + alignedSize = (int(size)/packetSize)*packetSize }; + + copy_using_evaluator_innervec_CompleteUnrolling::run(kernel); + copy_using_evaluator_DefaultTraversal_CompleteUnrolling::run(kernel); + } +}; + +/************************** +*** Inner vectorization *** +**************************/ + +template +struct dense_assignment_loop +{ + typedef typename Kernel::PacketType PacketType; + enum { + SrcAlignment = Kernel::AssignmentTraits::SrcAlignment, + DstAlignment = Kernel::AssignmentTraits::DstAlignment + }; + EIGEN_DEVICE_FUNC static EIGEN_STRONG_INLINE void run(Kernel &kernel) + { + const Index innerSize = kernel.innerSize(); + const Index outerSize = kernel.outerSize(); + const Index packetSize = unpacket_traits::size; + for(Index outer = 0; outer < outerSize; ++outer) + for(Index inner = 0; inner < innerSize; inner+=packetSize) + kernel.template assignPacketByOuterInner(outer, inner); + } +}; + +template +struct dense_assignment_loop +{ + EIGEN_DEVICE_FUNC static EIGEN_STRONG_INLINE void run(Kernel &kernel) + { + typedef typename Kernel::DstEvaluatorType::XprType DstXprType; + copy_using_evaluator_innervec_CompleteUnrolling::run(kernel); + } +}; + +template +struct dense_assignment_loop +{ + EIGEN_DEVICE_FUNC static EIGEN_STRONG_INLINE void run(Kernel &kernel) + { + typedef typename Kernel::DstEvaluatorType::XprType DstXprType; + typedef typename Kernel::AssignmentTraits Traits; + const Index outerSize = kernel.outerSize(); + for(Index outer = 0; outer < outerSize; ++outer) + copy_using_evaluator_innervec_InnerUnrolling::run(kernel, outer); + } +}; + +/*********************** +*** Linear traversal *** +***********************/ + +template +struct dense_assignment_loop +{ + EIGEN_DEVICE_FUNC static EIGEN_STRONG_INLINE void run(Kernel &kernel) + { + const Index size = kernel.size(); + for(Index i = 0; i < size; ++i) + kernel.assignCoeff(i); + } +}; + +template +struct dense_assignment_loop +{ + EIGEN_DEVICE_FUNC static EIGEN_STRONG_INLINE void run(Kernel &kernel) + { + typedef typename Kernel::DstEvaluatorType::XprType DstXprType; + copy_using_evaluator_LinearTraversal_CompleteUnrolling::run(kernel); + } +}; + +/************************** +*** Slice vectorization *** +***************************/ + +template +struct dense_assignment_loop +{ + EIGEN_DEVICE_FUNC static EIGEN_STRONG_INLINE void run(Kernel &kernel) + { + typedef typename Kernel::Scalar Scalar; + typedef typename Kernel::PacketType PacketType; + enum { + packetSize = unpacket_traits::size, + requestedAlignment = int(Kernel::AssignmentTraits::InnerRequiredAlignment), + alignable = packet_traits::AlignedOnScalar || int(Kernel::AssignmentTraits::DstAlignment)>=sizeof(Scalar), + dstIsAligned = int(Kernel::AssignmentTraits::DstAlignment)>=int(requestedAlignment), + dstAlignment = alignable ? int(requestedAlignment) + : int(Kernel::AssignmentTraits::DstAlignment) + }; + const Scalar *dst_ptr = kernel.dstDataPtr(); + if((!bool(dstIsAligned)) && (UIntPtr(dst_ptr) % sizeof(Scalar))>0) + { + // the pointer is not aligned-on scalar, so alignment is not possible + return dense_assignment_loop::run(kernel); + } + const Index packetAlignedMask = packetSize - 1; + const Index innerSize = kernel.innerSize(); + const Index outerSize = kernel.outerSize(); + const Index alignedStep = alignable ? (packetSize - kernel.outerStride() % packetSize) & packetAlignedMask : 0; + Index alignedStart = ((!alignable) || bool(dstIsAligned)) ? 0 : internal::first_aligned(dst_ptr, innerSize); + + for(Index outer = 0; outer < outerSize; ++outer) + { + const Index alignedEnd = alignedStart + ((innerSize-alignedStart) & ~packetAlignedMask); + // do the non-vectorizable part of the assignment + for(Index inner = 0; inner(outer, inner); + + // do the non-vectorizable part of the assignment + for(Index inner = alignedEnd; inner +struct dense_assignment_loop +{ + EIGEN_DEVICE_FUNC static EIGEN_STRONG_INLINE void run(Kernel &kernel) + { + typedef typename Kernel::DstEvaluatorType::XprType DstXprType; + typedef typename Kernel::PacketType PacketType; + + enum { innerSize = DstXprType::InnerSizeAtCompileTime, + packetSize =unpacket_traits::size, + vectorizableSize = (int(innerSize) / int(packetSize)) * int(packetSize), + size = DstXprType::SizeAtCompileTime }; + + for(Index outer = 0; outer < kernel.outerSize(); ++outer) + { + copy_using_evaluator_innervec_InnerUnrolling::run(kernel, outer); + copy_using_evaluator_DefaultTraversal_InnerUnrolling::run(kernel, outer); + } + } +}; +#endif + + +/*************************************************************************** +* Part 4 : Generic dense assignment kernel +***************************************************************************/ + +// This class generalize the assignment of a coefficient (or packet) from one dense evaluator +// to another dense writable evaluator. +// It is parametrized by the two evaluators, and the actual assignment functor. +// This abstraction level permits to keep the evaluation loops as simple and as generic as possible. +// One can customize the assignment using this generic dense_assignment_kernel with different +// functors, or by completely overloading it, by-passing a functor. +template +class generic_dense_assignment_kernel +{ +protected: + typedef typename DstEvaluatorTypeT::XprType DstXprType; + typedef typename SrcEvaluatorTypeT::XprType SrcXprType; +public: + + typedef DstEvaluatorTypeT DstEvaluatorType; + typedef SrcEvaluatorTypeT SrcEvaluatorType; + typedef typename DstEvaluatorType::Scalar Scalar; + typedef copy_using_evaluator_traits AssignmentTraits; + typedef typename AssignmentTraits::PacketType PacketType; + + + EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE + generic_dense_assignment_kernel(DstEvaluatorType &dst, const SrcEvaluatorType &src, const Functor &func, DstXprType& dstExpr) + : m_dst(dst), m_src(src), m_functor(func), m_dstExpr(dstExpr) + { + #ifdef EIGEN_DEBUG_ASSIGN + AssignmentTraits::debug(); + #endif + } + + EIGEN_DEVICE_FUNC EIGEN_CONSTEXPR Index size() const EIGEN_NOEXCEPT { return m_dstExpr.size(); } + EIGEN_DEVICE_FUNC EIGEN_CONSTEXPR Index innerSize() const EIGEN_NOEXCEPT { return m_dstExpr.innerSize(); } + EIGEN_DEVICE_FUNC EIGEN_CONSTEXPR Index outerSize() const EIGEN_NOEXCEPT { return m_dstExpr.outerSize(); } + EIGEN_DEVICE_FUNC EIGEN_CONSTEXPR Index rows() const EIGEN_NOEXCEPT { return m_dstExpr.rows(); } + EIGEN_DEVICE_FUNC EIGEN_CONSTEXPR Index cols() const EIGEN_NOEXCEPT { return m_dstExpr.cols(); } + EIGEN_DEVICE_FUNC EIGEN_CONSTEXPR Index outerStride() const EIGEN_NOEXCEPT { return m_dstExpr.outerStride(); } + + EIGEN_DEVICE_FUNC DstEvaluatorType& dstEvaluator() EIGEN_NOEXCEPT { return m_dst; } + EIGEN_DEVICE_FUNC const SrcEvaluatorType& srcEvaluator() const EIGEN_NOEXCEPT { return m_src; } + + /// Assign src(row,col) to dst(row,col) through the assignment functor. + EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE void assignCoeff(Index row, Index col) + { + m_functor.assignCoeff(m_dst.coeffRef(row,col), m_src.coeff(row,col)); + } + + /// \sa assignCoeff(Index,Index) + EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE void assignCoeff(Index index) + { + m_functor.assignCoeff(m_dst.coeffRef(index), m_src.coeff(index)); + } + + /// \sa assignCoeff(Index,Index) + EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE void assignCoeffByOuterInner(Index outer, Index inner) + { + Index row = rowIndexByOuterInner(outer, inner); + Index col = colIndexByOuterInner(outer, inner); + assignCoeff(row, col); + } + + + template + EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE void assignPacket(Index row, Index col) + { + m_functor.template assignPacket(&m_dst.coeffRef(row,col), m_src.template packet(row,col)); + } + + template + EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE void assignPacket(Index index) + { + m_functor.template assignPacket(&m_dst.coeffRef(index), m_src.template packet(index)); + } + + template + EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE void assignPacketByOuterInner(Index outer, Index inner) + { + Index row = rowIndexByOuterInner(outer, inner); + Index col = colIndexByOuterInner(outer, inner); + assignPacket(row, col); + } + + EIGEN_DEVICE_FUNC static EIGEN_STRONG_INLINE Index rowIndexByOuterInner(Index outer, Index inner) + { + typedef typename DstEvaluatorType::ExpressionTraits Traits; + return int(Traits::RowsAtCompileTime) == 1 ? 0 + : int(Traits::ColsAtCompileTime) == 1 ? inner + : int(DstEvaluatorType::Flags)&RowMajorBit ? outer + : inner; + } + + EIGEN_DEVICE_FUNC static EIGEN_STRONG_INLINE Index colIndexByOuterInner(Index outer, Index inner) + { + typedef typename DstEvaluatorType::ExpressionTraits Traits; + return int(Traits::ColsAtCompileTime) == 1 ? 0 + : int(Traits::RowsAtCompileTime) == 1 ? inner + : int(DstEvaluatorType::Flags)&RowMajorBit ? inner + : outer; + } + + EIGEN_DEVICE_FUNC const Scalar* dstDataPtr() const + { + return m_dstExpr.data(); + } + +protected: + DstEvaluatorType& m_dst; + const SrcEvaluatorType& m_src; + const Functor &m_functor; + // TODO find a way to avoid the needs of the original expression + DstXprType& m_dstExpr; +}; + +// Special kernel used when computing small products whose operands have dynamic dimensions. It ensures that the +// PacketSize used is no larger than 4, thereby increasing the chance that vectorized instructions will be used +// when computing the product. + +template +class restricted_packet_dense_assignment_kernel : public generic_dense_assignment_kernel +{ +protected: + typedef generic_dense_assignment_kernel Base; + public: + typedef typename Base::Scalar Scalar; + typedef typename Base::DstXprType DstXprType; + typedef copy_using_evaluator_traits AssignmentTraits; + typedef typename AssignmentTraits::PacketType PacketType; + + EIGEN_DEVICE_FUNC restricted_packet_dense_assignment_kernel(DstEvaluatorTypeT &dst, const SrcEvaluatorTypeT &src, const Functor &func, DstXprType& dstExpr) + : Base(dst, src, func, dstExpr) + { + } + }; + +/*************************************************************************** +* Part 5 : Entry point for dense rectangular assignment +***************************************************************************/ + +template +EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE +void resize_if_allowed(DstXprType &dst, const SrcXprType& src, const Functor &/*func*/) +{ + EIGEN_ONLY_USED_FOR_DEBUG(dst); + EIGEN_ONLY_USED_FOR_DEBUG(src); + eigen_assert(dst.rows() == src.rows() && dst.cols() == src.cols()); +} + +template +EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE +void resize_if_allowed(DstXprType &dst, const SrcXprType& src, const internal::assign_op &/*func*/) +{ + Index dstRows = src.rows(); + Index dstCols = src.cols(); + if(((dst.rows()!=dstRows) || (dst.cols()!=dstCols))) + dst.resize(dstRows, dstCols); + eigen_assert(dst.rows() == dstRows && dst.cols() == dstCols); +} + +template +EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE void call_dense_assignment_loop(DstXprType& dst, const SrcXprType& src, const Functor &func) +{ + typedef evaluator DstEvaluatorType; + typedef evaluator SrcEvaluatorType; + + SrcEvaluatorType srcEvaluator(src); + + // NOTE To properly handle A = (A*A.transpose())/s with A rectangular, + // we need to resize the destination after the source evaluator has been created. + resize_if_allowed(dst, src, func); + + DstEvaluatorType dstEvaluator(dst); + + typedef generic_dense_assignment_kernel Kernel; + Kernel kernel(dstEvaluator, srcEvaluator, func, dst.const_cast_derived()); + + dense_assignment_loop::run(kernel); +} + +// Specialization for filling the destination with a constant value. +#ifndef EIGEN_GPU_COMPILE_PHASE +template +EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE void call_dense_assignment_loop(DstXprType& dst, const Eigen::CwiseNullaryOp, DstXprType>& src, const internal::assign_op& func) +{ + resize_if_allowed(dst, src, func); + std::fill_n(dst.data(), dst.size(), src.functor()()); +} +#endif + +template +EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE void call_dense_assignment_loop(DstXprType& dst, const SrcXprType& src) +{ + call_dense_assignment_loop(dst, src, internal::assign_op()); +} + +/*************************************************************************** +* Part 6 : Generic assignment +***************************************************************************/ + +// Based on the respective shapes of the destination and source, +// the class AssignmentKind determine the kind of assignment mechanism. +// AssignmentKind must define a Kind typedef. +template struct AssignmentKind; + +// Assignment kind defined in this file: +struct Dense2Dense {}; +struct EigenBase2EigenBase {}; + +template struct AssignmentKind { typedef EigenBase2EigenBase Kind; }; +template<> struct AssignmentKind { typedef Dense2Dense Kind; }; + +// This is the main assignment class +template< typename DstXprType, typename SrcXprType, typename Functor, + typename Kind = typename AssignmentKind< typename evaluator_traits::Shape , typename evaluator_traits::Shape >::Kind, + typename EnableIf = void> +struct Assignment; + + +// The only purpose of this call_assignment() function is to deal with noalias() / "assume-aliasing" and automatic transposition. +// Indeed, I (Gael) think that this concept of "assume-aliasing" was a mistake, and it makes thing quite complicated. +// So this intermediate function removes everything related to "assume-aliasing" such that Assignment +// does not has to bother about these annoying details. + +template +EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE +void call_assignment(Dst& dst, const Src& src) +{ + call_assignment(dst, src, internal::assign_op()); +} +template +EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE +void call_assignment(const Dst& dst, const Src& src) +{ + call_assignment(dst, src, internal::assign_op()); +} + +// Deal with "assume-aliasing" +template +EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE +void call_assignment(Dst& dst, const Src& src, const Func& func, typename enable_if< evaluator_assume_aliasing::value, void*>::type = 0) +{ + typename plain_matrix_type::type tmp(src); + call_assignment_no_alias(dst, tmp, func); +} + +template +EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE +void call_assignment(Dst& dst, const Src& src, const Func& func, typename enable_if::value, void*>::type = 0) +{ + call_assignment_no_alias(dst, src, func); +} + +// by-pass "assume-aliasing" +// When there is no aliasing, we require that 'dst' has been properly resized +template class StorageBase, typename Src, typename Func> +EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE +void call_assignment(NoAlias& dst, const Src& src, const Func& func) +{ + call_assignment_no_alias(dst.expression(), src, func); +} + + +template +EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE +void call_assignment_no_alias(Dst& dst, const Src& src, const Func& func) +{ + enum { + NeedToTranspose = ( (int(Dst::RowsAtCompileTime) == 1 && int(Src::ColsAtCompileTime) == 1) + || (int(Dst::ColsAtCompileTime) == 1 && int(Src::RowsAtCompileTime) == 1) + ) && int(Dst::SizeAtCompileTime) != 1 + }; + + typedef typename internal::conditional, Dst>::type ActualDstTypeCleaned; + typedef typename internal::conditional, Dst&>::type ActualDstType; + ActualDstType actualDst(dst); + + // TODO check whether this is the right place to perform these checks: + EIGEN_STATIC_ASSERT_LVALUE(Dst) + EIGEN_STATIC_ASSERT_SAME_MATRIX_SIZE(ActualDstTypeCleaned,Src) + EIGEN_CHECK_BINARY_COMPATIBILIY(Func,typename ActualDstTypeCleaned::Scalar,typename Src::Scalar); + + Assignment::run(actualDst, src, func); +} + +template +EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE +void call_restricted_packet_assignment_no_alias(Dst& dst, const Src& src, const Func& func) +{ + typedef evaluator DstEvaluatorType; + typedef evaluator SrcEvaluatorType; + typedef restricted_packet_dense_assignment_kernel Kernel; + + EIGEN_STATIC_ASSERT_LVALUE(Dst) + EIGEN_CHECK_BINARY_COMPATIBILIY(Func,typename Dst::Scalar,typename Src::Scalar); + + SrcEvaluatorType srcEvaluator(src); + resize_if_allowed(dst, src, func); + + DstEvaluatorType dstEvaluator(dst); + Kernel kernel(dstEvaluator, srcEvaluator, func, dst.const_cast_derived()); + + dense_assignment_loop::run(kernel); +} + +template +EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE +void call_assignment_no_alias(Dst& dst, const Src& src) +{ + call_assignment_no_alias(dst, src, internal::assign_op()); +} + +template +EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE +void call_assignment_no_alias_no_transpose(Dst& dst, const Src& src, const Func& func) +{ + // TODO check whether this is the right place to perform these checks: + EIGEN_STATIC_ASSERT_LVALUE(Dst) + EIGEN_STATIC_ASSERT_SAME_MATRIX_SIZE(Dst,Src) + EIGEN_CHECK_BINARY_COMPATIBILIY(Func,typename Dst::Scalar,typename Src::Scalar); + + Assignment::run(dst, src, func); +} +template +EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE +void call_assignment_no_alias_no_transpose(Dst& dst, const Src& src) +{ + call_assignment_no_alias_no_transpose(dst, src, internal::assign_op()); +} + +// forward declaration +template void check_for_aliasing(const Dst &dst, const Src &src); + +// Generic Dense to Dense assignment +// Note that the last template argument "Weak" is needed to make it possible to perform +// both partial specialization+SFINAE without ambiguous specialization +template< typename DstXprType, typename SrcXprType, typename Functor, typename Weak> +struct Assignment +{ + EIGEN_DEVICE_FUNC + static EIGEN_STRONG_INLINE void run(DstXprType &dst, const SrcXprType &src, const Functor &func) + { +#ifndef EIGEN_NO_DEBUG + internal::check_for_aliasing(dst, src); +#endif + + call_dense_assignment_loop(dst, src, func); + } +}; + +// Generic assignment through evalTo. +// TODO: not sure we have to keep that one, but it helps porting current code to new evaluator mechanism. +// Note that the last template argument "Weak" is needed to make it possible to perform +// both partial specialization+SFINAE without ambiguous specialization +template< typename DstXprType, typename SrcXprType, typename Functor, typename Weak> +struct Assignment +{ + EIGEN_DEVICE_FUNC + static EIGEN_STRONG_INLINE void run(DstXprType &dst, const SrcXprType &src, const internal::assign_op &/*func*/) + { + Index dstRows = src.rows(); + Index dstCols = src.cols(); + if((dst.rows()!=dstRows) || (dst.cols()!=dstCols)) + dst.resize(dstRows, dstCols); + + eigen_assert(dst.rows() == src.rows() && dst.cols() == src.cols()); + src.evalTo(dst); + } + + // NOTE The following two functions are templated to avoid their instantiation if not needed + // This is needed because some expressions supports evalTo only and/or have 'void' as scalar type. + template + EIGEN_DEVICE_FUNC + static EIGEN_STRONG_INLINE void run(DstXprType &dst, const SrcXprType &src, const internal::add_assign_op &/*func*/) + { + Index dstRows = src.rows(); + Index dstCols = src.cols(); + if((dst.rows()!=dstRows) || (dst.cols()!=dstCols)) + dst.resize(dstRows, dstCols); + + eigen_assert(dst.rows() == src.rows() && dst.cols() == src.cols()); + src.addTo(dst); + } + + template + EIGEN_DEVICE_FUNC + static EIGEN_STRONG_INLINE void run(DstXprType &dst, const SrcXprType &src, const internal::sub_assign_op &/*func*/) + { + Index dstRows = src.rows(); + Index dstCols = src.cols(); + if((dst.rows()!=dstRows) || (dst.cols()!=dstCols)) + dst.resize(dstRows, dstCols); + + eigen_assert(dst.rows() == src.rows() && dst.cols() == src.cols()); + src.subTo(dst); + } +}; + +} // namespace internal + +} // end namespace Eigen + +#endif // EIGEN_ASSIGN_EVALUATOR_H diff --git a/extern/eigen/Eigen/src/Core/Assign_MKL.h b/extern/eigen/Eigen/src/Core/Assign_MKL.h index 7772951b..c6140d18 100644 --- a/extern/eigen/Eigen/src/Core/Assign_MKL.h +++ b/extern/eigen/Eigen/src/Core/Assign_MKL.h @@ -1,6 +1,7 @@ /* Copyright (c) 2011, Intel Corporation. All rights reserved. - + Copyright (C) 2015 Gael Guennebaud + Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: @@ -37,17 +38,13 @@ namespace Eigen { namespace internal { -template struct vml_call -{ enum { IsSupported = 0 }; }; - -template +template class vml_assign_traits { private: enum { DstHasDirectAccess = Dst::Flags & DirectAccessBit, SrcHasDirectAccess = Src::Flags & DirectAccessBit, - StorageOrdersAgree = (int(Dst::IsRowMajor) == int(Src::IsRowMajor)), InnerSize = int(Dst::IsVectorAtCompileTime) ? int(Dst::SizeAtCompileTime) : int(Dst::Flags)&RowMajorBit ? int(Dst::ColsAtCompileTime) @@ -57,165 +54,122 @@ class vml_assign_traits : int(Dst::MaxRowsAtCompileTime), MaxSizeAtCompileTime = Dst::SizeAtCompileTime, - MightEnableVml = vml_call::IsSupported && StorageOrdersAgree && DstHasDirectAccess && SrcHasDirectAccess - && Src::InnerStrideAtCompileTime==1 && Dst::InnerStrideAtCompileTime==1, + MightEnableVml = StorageOrdersAgree && DstHasDirectAccess && SrcHasDirectAccess && Src::InnerStrideAtCompileTime==1 && Dst::InnerStrideAtCompileTime==1, MightLinearize = MightEnableVml && (int(Dst::Flags) & int(Src::Flags) & LinearAccessBit), VmlSize = MightLinearize ? MaxSizeAtCompileTime : InnerMaxSize, - LargeEnough = VmlSize==Dynamic || VmlSize>=EIGEN_MKL_VML_THRESHOLD, - MayEnableVml = MightEnableVml && LargeEnough, - MayLinearize = MayEnableVml && MightLinearize + LargeEnough = VmlSize==Dynamic || VmlSize>=EIGEN_MKL_VML_THRESHOLD }; public: enum { - Traversal = MayLinearize ? LinearVectorizedTraversal - : MayEnableVml ? InnerVectorizedTraversal - : DefaultTraversal + EnableVml = MightEnableVml && LargeEnough, + Traversal = MightLinearize ? LinearTraversal : DefaultTraversal }; }; -template::Traversal > -struct vml_assign_impl - : assign_impl,Traversal,Unrolling,BuiltIn> -{ -}; - -template -struct vml_assign_impl -{ - typedef typename Derived1::Scalar Scalar; - typedef typename Derived1::Index Index; - static inline void run(Derived1& dst, const CwiseUnaryOp& src) - { - // in case we want to (or have to) skip VML at runtime we can call: - // assign_impl,Traversal,Unrolling,BuiltIn>::run(dst,src); - const Index innerSize = dst.innerSize(); - const Index outerSize = dst.outerSize(); - for(Index outer = 0; outer < outerSize; ++outer) { - const Scalar *src_ptr = src.IsRowMajor ? &(src.nestedExpression().coeffRef(outer,0)) : - &(src.nestedExpression().coeffRef(0, outer)); - Scalar *dst_ptr = dst.IsRowMajor ? &(dst.coeffRef(outer,0)) : &(dst.coeffRef(0, outer)); - vml_call::run(src.functor(), innerSize, src_ptr, dst_ptr ); - } - } -}; - -template -struct vml_assign_impl -{ - static inline void run(Derived1& dst, const CwiseUnaryOp& src) - { - // in case we want to (or have to) skip VML at runtime we can call: - // assign_impl,Traversal,Unrolling,BuiltIn>::run(dst,src); - vml_call::run(src.functor(), dst.size(), src.nestedExpression().data(), dst.data() ); - } -}; - -// Macroses - -#define EIGEN_MKL_VML_SPECIALIZE_ASSIGN(TRAVERSAL,UNROLLING) \ - template \ - struct assign_impl, TRAVERSAL, UNROLLING, Specialized> { \ - static inline void run(Derived1 &dst, const Eigen::CwiseUnaryOp &src) { \ - vml_assign_impl::run(dst, src); \ - } \ - }; - -EIGEN_MKL_VML_SPECIALIZE_ASSIGN(DefaultTraversal,NoUnrolling) -EIGEN_MKL_VML_SPECIALIZE_ASSIGN(DefaultTraversal,CompleteUnrolling) -EIGEN_MKL_VML_SPECIALIZE_ASSIGN(DefaultTraversal,InnerUnrolling) -EIGEN_MKL_VML_SPECIALIZE_ASSIGN(LinearTraversal,NoUnrolling) -EIGEN_MKL_VML_SPECIALIZE_ASSIGN(LinearTraversal,CompleteUnrolling) -EIGEN_MKL_VML_SPECIALIZE_ASSIGN(InnerVectorizedTraversal,NoUnrolling) -EIGEN_MKL_VML_SPECIALIZE_ASSIGN(InnerVectorizedTraversal,CompleteUnrolling) -EIGEN_MKL_VML_SPECIALIZE_ASSIGN(InnerVectorizedTraversal,InnerUnrolling) -EIGEN_MKL_VML_SPECIALIZE_ASSIGN(LinearVectorizedTraversal,CompleteUnrolling) -EIGEN_MKL_VML_SPECIALIZE_ASSIGN(LinearVectorizedTraversal,NoUnrolling) -EIGEN_MKL_VML_SPECIALIZE_ASSIGN(SliceVectorizedTraversal,NoUnrolling) - - +#define EIGEN_PP_EXPAND(ARG) ARG #if !defined (EIGEN_FAST_MATH) || (EIGEN_FAST_MATH != 1) -#define EIGEN_MKL_VML_MODE VML_HA +#define EIGEN_VMLMODE_EXPAND_xLA , VML_HA #else -#define EIGEN_MKL_VML_MODE VML_LA +#define EIGEN_VMLMODE_EXPAND_xLA , VML_LA #endif -#define EIGEN_MKL_VML_DECLARE_UNARY_CALL(EIGENOP, VMLOP, EIGENTYPE, VMLTYPE) \ - template<> struct vml_call< scalar_##EIGENOP##_op > { \ - enum { IsSupported = 1 }; \ - static inline void run( const scalar_##EIGENOP##_op& /*func*/, \ - int size, const EIGENTYPE* src, EIGENTYPE* dst) { \ - VMLOP(size, (const VMLTYPE*)src, (VMLTYPE*)dst); \ - } \ +#define EIGEN_VMLMODE_EXPAND_x_ + +#define EIGEN_VMLMODE_PREFIX_xLA vm +#define EIGEN_VMLMODE_PREFIX_x_ v +#define EIGEN_VMLMODE_PREFIX(VMLMODE) EIGEN_CAT(EIGEN_VMLMODE_PREFIX_x,VMLMODE) + +#define EIGEN_MKL_VML_DECLARE_UNARY_CALL(EIGENOP, VMLOP, EIGENTYPE, VMLTYPE, VMLMODE) \ + template< typename DstXprType, typename SrcXprNested> \ + struct Assignment, SrcXprNested>, assign_op, \ + Dense2Dense, typename enable_if::EnableVml>::type> { \ + typedef CwiseUnaryOp, SrcXprNested> SrcXprType; \ + static void run(DstXprType &dst, const SrcXprType &src, const assign_op &func) { \ + resize_if_allowed(dst, src, func); \ + eigen_assert(dst.rows() == src.rows() && dst.cols() == src.cols()); \ + if(vml_assign_traits::Traversal==LinearTraversal) { \ + VMLOP(dst.size(), (const VMLTYPE*)src.nestedExpression().data(), \ + (VMLTYPE*)dst.data() EIGEN_PP_EXPAND(EIGEN_VMLMODE_EXPAND_x##VMLMODE) ); \ + } else { \ + const Index outerSize = dst.outerSize(); \ + for(Index outer = 0; outer < outerSize; ++outer) { \ + const EIGENTYPE *src_ptr = src.IsRowMajor ? &(src.nestedExpression().coeffRef(outer,0)) : \ + &(src.nestedExpression().coeffRef(0, outer)); \ + EIGENTYPE *dst_ptr = dst.IsRowMajor ? &(dst.coeffRef(outer,0)) : &(dst.coeffRef(0, outer)); \ + VMLOP( dst.innerSize(), (const VMLTYPE*)src_ptr, \ + (VMLTYPE*)dst_ptr EIGEN_PP_EXPAND(EIGEN_VMLMODE_EXPAND_x##VMLMODE)); \ + } \ + } \ + } \ + }; \ + + +#define EIGEN_MKL_VML_DECLARE_UNARY_CALLS_REAL(EIGENOP, VMLOP, VMLMODE) \ + EIGEN_MKL_VML_DECLARE_UNARY_CALL(EIGENOP, EIGEN_CAT(EIGEN_VMLMODE_PREFIX(VMLMODE),s##VMLOP), float, float, VMLMODE) \ + EIGEN_MKL_VML_DECLARE_UNARY_CALL(EIGENOP, EIGEN_CAT(EIGEN_VMLMODE_PREFIX(VMLMODE),d##VMLOP), double, double, VMLMODE) + +#define EIGEN_MKL_VML_DECLARE_UNARY_CALLS_CPLX(EIGENOP, VMLOP, VMLMODE) \ + EIGEN_MKL_VML_DECLARE_UNARY_CALL(EIGENOP, EIGEN_CAT(EIGEN_VMLMODE_PREFIX(VMLMODE),c##VMLOP), scomplex, MKL_Complex8, VMLMODE) \ + EIGEN_MKL_VML_DECLARE_UNARY_CALL(EIGENOP, EIGEN_CAT(EIGEN_VMLMODE_PREFIX(VMLMODE),z##VMLOP), dcomplex, MKL_Complex16, VMLMODE) + +#define EIGEN_MKL_VML_DECLARE_UNARY_CALLS(EIGENOP, VMLOP, VMLMODE) \ + EIGEN_MKL_VML_DECLARE_UNARY_CALLS_REAL(EIGENOP, VMLOP, VMLMODE) \ + EIGEN_MKL_VML_DECLARE_UNARY_CALLS_CPLX(EIGENOP, VMLOP, VMLMODE) + + +EIGEN_MKL_VML_DECLARE_UNARY_CALLS(sin, Sin, LA) +EIGEN_MKL_VML_DECLARE_UNARY_CALLS(asin, Asin, LA) +EIGEN_MKL_VML_DECLARE_UNARY_CALLS(sinh, Sinh, LA) +EIGEN_MKL_VML_DECLARE_UNARY_CALLS(cos, Cos, LA) +EIGEN_MKL_VML_DECLARE_UNARY_CALLS(acos, Acos, LA) +EIGEN_MKL_VML_DECLARE_UNARY_CALLS(cosh, Cosh, LA) +EIGEN_MKL_VML_DECLARE_UNARY_CALLS(tan, Tan, LA) +EIGEN_MKL_VML_DECLARE_UNARY_CALLS(atan, Atan, LA) +EIGEN_MKL_VML_DECLARE_UNARY_CALLS(tanh, Tanh, LA) +// EIGEN_MKL_VML_DECLARE_UNARY_CALLS(abs, Abs, _) +EIGEN_MKL_VML_DECLARE_UNARY_CALLS(exp, Exp, LA) +EIGEN_MKL_VML_DECLARE_UNARY_CALLS(log, Ln, LA) +EIGEN_MKL_VML_DECLARE_UNARY_CALLS(log10, Log10, LA) +EIGEN_MKL_VML_DECLARE_UNARY_CALLS(sqrt, Sqrt, _) + +EIGEN_MKL_VML_DECLARE_UNARY_CALLS_REAL(square, Sqr, _) +EIGEN_MKL_VML_DECLARE_UNARY_CALLS_CPLX(arg, Arg, _) +EIGEN_MKL_VML_DECLARE_UNARY_CALLS_REAL(round, Round, _) +EIGEN_MKL_VML_DECLARE_UNARY_CALLS_REAL(floor, Floor, _) +EIGEN_MKL_VML_DECLARE_UNARY_CALLS_REAL(ceil, Ceil, _) + +#define EIGEN_MKL_VML_DECLARE_POW_CALL(EIGENOP, VMLOP, EIGENTYPE, VMLTYPE, VMLMODE) \ + template< typename DstXprType, typename SrcXprNested, typename Plain> \ + struct Assignment, SrcXprNested, \ + const CwiseNullaryOp,Plain> >, assign_op, \ + Dense2Dense, typename enable_if::EnableVml>::type> { \ + typedef CwiseBinaryOp, SrcXprNested, \ + const CwiseNullaryOp,Plain> > SrcXprType; \ + static void run(DstXprType &dst, const SrcXprType &src, const assign_op &func) { \ + resize_if_allowed(dst, src, func); \ + eigen_assert(dst.rows() == src.rows() && dst.cols() == src.cols()); \ + VMLTYPE exponent = reinterpret_cast(src.rhs().functor().m_other); \ + if(vml_assign_traits::Traversal==LinearTraversal) \ + { \ + VMLOP( dst.size(), (const VMLTYPE*)src.lhs().data(), exponent, \ + (VMLTYPE*)dst.data() EIGEN_PP_EXPAND(EIGEN_VMLMODE_EXPAND_x##VMLMODE) ); \ + } else { \ + const Index outerSize = dst.outerSize(); \ + for(Index outer = 0; outer < outerSize; ++outer) { \ + const EIGENTYPE *src_ptr = src.IsRowMajor ? &(src.lhs().coeffRef(outer,0)) : \ + &(src.lhs().coeffRef(0, outer)); \ + EIGENTYPE *dst_ptr = dst.IsRowMajor ? &(dst.coeffRef(outer,0)) : &(dst.coeffRef(0, outer)); \ + VMLOP( dst.innerSize(), (const VMLTYPE*)src_ptr, exponent, \ + (VMLTYPE*)dst_ptr EIGEN_PP_EXPAND(EIGEN_VMLMODE_EXPAND_x##VMLMODE)); \ + } \ + } \ + } \ }; - -#define EIGEN_MKL_VML_DECLARE_UNARY_CALL_LA(EIGENOP, VMLOP, EIGENTYPE, VMLTYPE) \ - template<> struct vml_call< scalar_##EIGENOP##_op > { \ - enum { IsSupported = 1 }; \ - static inline void run( const scalar_##EIGENOP##_op& /*func*/, \ - int size, const EIGENTYPE* src, EIGENTYPE* dst) { \ - MKL_INT64 vmlMode = EIGEN_MKL_VML_MODE; \ - VMLOP(size, (const VMLTYPE*)src, (VMLTYPE*)dst, vmlMode); \ - } \ - }; - -#define EIGEN_MKL_VML_DECLARE_POW_CALL(EIGENOP, VMLOP, EIGENTYPE, VMLTYPE) \ - template<> struct vml_call< scalar_##EIGENOP##_op > { \ - enum { IsSupported = 1 }; \ - static inline void run( const scalar_##EIGENOP##_op& func, \ - int size, const EIGENTYPE* src, EIGENTYPE* dst) { \ - EIGENTYPE exponent = func.m_exponent; \ - MKL_INT64 vmlMode = EIGEN_MKL_VML_MODE; \ - VMLOP(&size, (const VMLTYPE*)src, (const VMLTYPE*)&exponent, \ - (VMLTYPE*)dst, &vmlMode); \ - } \ - }; - -#define EIGEN_MKL_VML_DECLARE_UNARY_CALLS_REAL(EIGENOP, VMLOP) \ - EIGEN_MKL_VML_DECLARE_UNARY_CALL(EIGENOP, vs##VMLOP, float, float) \ - EIGEN_MKL_VML_DECLARE_UNARY_CALL(EIGENOP, vd##VMLOP, double, double) - -#define EIGEN_MKL_VML_DECLARE_UNARY_CALLS_COMPLEX(EIGENOP, VMLOP) \ - EIGEN_MKL_VML_DECLARE_UNARY_CALL(EIGENOP, vc##VMLOP, scomplex, MKL_Complex8) \ - EIGEN_MKL_VML_DECLARE_UNARY_CALL(EIGENOP, vz##VMLOP, dcomplex, MKL_Complex16) - -#define EIGEN_MKL_VML_DECLARE_UNARY_CALLS(EIGENOP, VMLOP) \ - EIGEN_MKL_VML_DECLARE_UNARY_CALLS_REAL(EIGENOP, VMLOP) \ - EIGEN_MKL_VML_DECLARE_UNARY_CALLS_COMPLEX(EIGENOP, VMLOP) - - -#define EIGEN_MKL_VML_DECLARE_UNARY_CALLS_REAL_LA(EIGENOP, VMLOP) \ - EIGEN_MKL_VML_DECLARE_UNARY_CALL_LA(EIGENOP, vms##VMLOP, float, float) \ - EIGEN_MKL_VML_DECLARE_UNARY_CALL_LA(EIGENOP, vmd##VMLOP, double, double) - -#define EIGEN_MKL_VML_DECLARE_UNARY_CALLS_COMPLEX_LA(EIGENOP, VMLOP) \ - EIGEN_MKL_VML_DECLARE_UNARY_CALL_LA(EIGENOP, vmc##VMLOP, scomplex, MKL_Complex8) \ - EIGEN_MKL_VML_DECLARE_UNARY_CALL_LA(EIGENOP, vmz##VMLOP, dcomplex, MKL_Complex16) - -#define EIGEN_MKL_VML_DECLARE_UNARY_CALLS_LA(EIGENOP, VMLOP) \ - EIGEN_MKL_VML_DECLARE_UNARY_CALLS_REAL_LA(EIGENOP, VMLOP) \ - EIGEN_MKL_VML_DECLARE_UNARY_CALLS_COMPLEX_LA(EIGENOP, VMLOP) - - -EIGEN_MKL_VML_DECLARE_UNARY_CALLS_LA(sin, Sin) -EIGEN_MKL_VML_DECLARE_UNARY_CALLS_LA(asin, Asin) -EIGEN_MKL_VML_DECLARE_UNARY_CALLS_LA(cos, Cos) -EIGEN_MKL_VML_DECLARE_UNARY_CALLS_LA(acos, Acos) -EIGEN_MKL_VML_DECLARE_UNARY_CALLS_LA(tan, Tan) -//EIGEN_MKL_VML_DECLARE_UNARY_CALLS(abs, Abs) -EIGEN_MKL_VML_DECLARE_UNARY_CALLS_LA(exp, Exp) -EIGEN_MKL_VML_DECLARE_UNARY_CALLS_LA(log, Ln) -EIGEN_MKL_VML_DECLARE_UNARY_CALLS_LA(sqrt, Sqrt) - -EIGEN_MKL_VML_DECLARE_UNARY_CALLS_REAL(square, Sqr) - -// The vm*powx functions are not avaibale in the windows version of MKL. -#ifndef _WIN32 -EIGEN_MKL_VML_DECLARE_POW_CALL(pow, vmspowx_, float, float) -EIGEN_MKL_VML_DECLARE_POW_CALL(pow, vmdpowx_, double, double) -EIGEN_MKL_VML_DECLARE_POW_CALL(pow, vmcpowx_, scomplex, MKL_Complex8) -EIGEN_MKL_VML_DECLARE_POW_CALL(pow, vmzpowx_, dcomplex, MKL_Complex16) -#endif + +EIGEN_MKL_VML_DECLARE_POW_CALL(pow, vmsPowx, float, float, LA) +EIGEN_MKL_VML_DECLARE_POW_CALL(pow, vmdPowx, double, double, LA) +EIGEN_MKL_VML_DECLARE_POW_CALL(pow, vmcPowx, scomplex, MKL_Complex8, LA) +EIGEN_MKL_VML_DECLARE_POW_CALL(pow, vmzPowx, dcomplex, MKL_Complex16, LA) } // end namespace internal diff --git a/extern/eigen/Eigen/src/Core/BandMatrix.h b/extern/eigen/Eigen/src/Core/BandMatrix.h index ffd7fe8b..878c0240 100644 --- a/extern/eigen/Eigen/src/Core/BandMatrix.h +++ b/extern/eigen/Eigen/src/Core/BandMatrix.h @@ -10,7 +10,7 @@ #ifndef EIGEN_BANDMATRIX_H #define EIGEN_BANDMATRIX_H -namespace Eigen { +namespace Eigen { namespace internal { @@ -32,7 +32,7 @@ class BandMatrixBase : public EigenBase }; typedef typename internal::traits::Scalar Scalar; typedef Matrix DenseMatrixType; - typedef typename DenseMatrixType::Index Index; + typedef typename DenseMatrixType::StorageIndex StorageIndex; typedef typename internal::traits::CoefficientsType CoefficientsType; typedef EigenBase Base; @@ -45,7 +45,7 @@ class BandMatrixBase : public EigenBase }; public: - + using Base::derived; using Base::rows; using Base::cols; @@ -55,10 +55,10 @@ class BandMatrixBase : public EigenBase /** \returns the number of sub diagonals */ inline Index subs() const { return derived().subs(); } - + /** \returns an expression of the underlying coefficient matrix */ inline const CoefficientsType& coeffs() const { return derived().coeffs(); } - + /** \returns an expression of the underlying coefficient matrix */ inline CoefficientsType& coeffs() { return derived().coeffs(); } @@ -67,7 +67,7 @@ class BandMatrixBase : public EigenBase * \warning the internal storage must be column major. */ inline Block col(Index i) { - EIGEN_STATIC_ASSERT((Options&RowMajor)==0,THIS_METHOD_IS_ONLY_FOR_COLUMN_MAJOR_MATRICES); + EIGEN_STATIC_ASSERT((int(Options) & int(RowMajor)) == 0, THIS_METHOD_IS_ONLY_FOR_COLUMN_MAJOR_MATRICES); Index start = 0; Index len = coeffs().rows(); if (i<=supers()) @@ -90,7 +90,7 @@ class BandMatrixBase : public EigenBase template struct DiagonalIntReturnType { enum { - ReturnOpposite = (Options&SelfAdjoint) && (((Index)>0 && Supers==0) || ((Index)<0 && Subs==0)), + ReturnOpposite = (int(Options) & int(SelfAdjoint)) && (((Index) > 0 && Supers == 0) || ((Index) < 0 && Subs == 0)), Conjugate = ReturnOpposite && NumTraits::IsComplex, ActualIndex = ReturnOpposite ? -Index : Index, DiagonalSize = (RowsAtCompileTime==Dynamic || ColsAtCompileTime==Dynamic) @@ -130,7 +130,7 @@ class BandMatrixBase : public EigenBase eigen_assert((i<0 && -i<=subs()) || (i>=0 && i<=supers())); return Block(coeffs(), supers()-i, std::max(0,i), 1, diagonalLength(i)); } - + template inline void evalTo(Dest& dst) const { dst.resize(rows(),cols()); @@ -161,15 +161,15 @@ class BandMatrixBase : public EigenBase * * \brief Represents a rectangular matrix with a banded storage * - * \param _Scalar Numeric type, i.e. float, double, int - * \param Rows Number of rows, or \b Dynamic - * \param Cols Number of columns, or \b Dynamic - * \param Supers Number of super diagonal - * \param Subs Number of sub diagonal - * \param _Options A combination of either \b #RowMajor or \b #ColMajor, and of \b #SelfAdjoint - * The former controls \ref TopicStorageOrders "storage order", and defaults to - * column-major. The latter controls whether the matrix represents a selfadjoint - * matrix in which case either Supers of Subs have to be null. + * \tparam _Scalar Numeric type, i.e. float, double, int + * \tparam _Rows Number of rows, or \b Dynamic + * \tparam _Cols Number of columns, or \b Dynamic + * \tparam _Supers Number of super diagonal + * \tparam _Subs Number of sub diagonal + * \tparam _Options A combination of either \b #RowMajor or \b #ColMajor, and of \b #SelfAdjoint + * The former controls \ref TopicStorageOrders "storage order", and defaults to + * column-major. The latter controls whether the matrix represents a selfadjoint + * matrix in which case either Supers of Subs have to be null. * * \sa class TridiagonalMatrix */ @@ -179,7 +179,7 @@ struct traits > { typedef _Scalar Scalar; typedef Dense StorageKind; - typedef DenseIndex Index; + typedef Eigen::Index StorageIndex; enum { CoeffReadCost = NumTraits::ReadCost, RowsAtCompileTime = _Rows, @@ -192,7 +192,7 @@ struct traits > Options = _Options, DataRowsAtCompileTime = ((Supers!=Dynamic) && (Subs!=Dynamic)) ? 1 + Supers + Subs : Dynamic }; - typedef Matrix CoefficientsType; + typedef Matrix CoefficientsType; }; template @@ -201,26 +201,26 @@ class BandMatrix : public BandMatrixBase::Scalar Scalar; - typedef typename internal::traits::Index Index; + typedef typename internal::traits::StorageIndex StorageIndex; typedef typename internal::traits::CoefficientsType CoefficientsType; - inline BandMatrix(Index rows=Rows, Index cols=Cols, Index supers=Supers, Index subs=Subs) + explicit inline BandMatrix(Index rows=Rows, Index cols=Cols, Index supers=Supers, Index subs=Subs) : m_coeffs(1+supers+subs,cols), m_rows(rows), m_supers(supers), m_subs(subs) { } /** \returns the number of columns */ - inline Index rows() const { return m_rows.value(); } + inline EIGEN_CONSTEXPR Index rows() const { return m_rows.value(); } /** \returns the number of rows */ - inline Index cols() const { return m_coeffs.cols(); } + inline EIGEN_CONSTEXPR Index cols() const { return m_coeffs.cols(); } /** \returns the number of super diagonals */ - inline Index supers() const { return m_supers.value(); } + inline EIGEN_CONSTEXPR Index supers() const { return m_supers.value(); } /** \returns the number of sub diagonals */ - inline Index subs() const { return m_subs.value(); } + inline EIGEN_CONSTEXPR Index subs() const { return m_subs.value(); } inline const CoefficientsType& coeffs() const { return m_coeffs; } inline CoefficientsType& coeffs() { return m_coeffs; } @@ -241,7 +241,7 @@ struct traits::CoeffReadCost, RowsAtCompileTime = _Rows, @@ -264,9 +264,9 @@ class BandMatrixWrapper : public BandMatrixBase::Scalar Scalar; typedef typename internal::traits::CoefficientsType CoefficientsType; - typedef typename internal::traits::Index Index; + typedef typename internal::traits::StorageIndex StorageIndex; - inline BandMatrixWrapper(const CoefficientsType& coeffs, Index rows=_Rows, Index cols=_Cols, Index supers=_Supers, Index subs=_Subs) + explicit inline BandMatrixWrapper(const CoefficientsType& coeffs, Index rows=_Rows, Index cols=_Cols, Index supers=_Supers, Index subs=_Subs) : m_coeffs(coeffs), m_rows(rows), m_supers(supers), m_subs(subs) { @@ -275,16 +275,16 @@ class BandMatrixWrapper : public BandMatrixBase class TridiagonalMatrix : public BandMatrix { typedef BandMatrix Base; - typedef typename Base::Index Index; + typedef typename Base::StorageIndex StorageIndex; public: - TridiagonalMatrix(Index size = Size) : Base(size,size,Options&SelfAdjoint?0:1,1) {} + explicit TridiagonalMatrix(Index size = Size) : Base(size,size,Options&SelfAdjoint?0:1,1) {} inline typename Base::template DiagonalIntReturnType<1>::Type super() { return Base::template diagonal<1>(); } @@ -327,6 +327,25 @@ class TridiagonalMatrix : public BandMatrix +struct evaluator_traits > + : public evaluator_traits_base > +{ + typedef BandShape Shape; +}; + +template +struct evaluator_traits > + : public evaluator_traits_base > +{ + typedef BandShape Shape; +}; + +template<> struct AssignmentKind { typedef EigenBase2EigenBase Kind; }; + } // end namespace internal } // end namespace Eigen diff --git a/extern/eigen/Eigen/src/Core/Block.h b/extern/eigen/Eigen/src/Core/Block.h index 82789444..3206d663 100644 --- a/extern/eigen/Eigen/src/Core/Block.h +++ b/extern/eigen/Eigen/src/Core/Block.h @@ -11,39 +11,7 @@ #ifndef EIGEN_BLOCK_H #define EIGEN_BLOCK_H -namespace Eigen { - -/** \class Block - * \ingroup Core_Module - * - * \brief Expression of a fixed-size or dynamic-size block - * - * \param XprType the type of the expression in which we are taking a block - * \param BlockRows the number of rows of the block we are taking at compile time (optional) - * \param BlockCols the number of columns of the block we are taking at compile time (optional) - * - * This class represents an expression of either a fixed-size or dynamic-size block. It is the return - * type of DenseBase::block(Index,Index,Index,Index) and DenseBase::block(Index,Index) and - * most of the time this is the only way it is used. - * - * However, if you want to directly maniputate block expressions, - * for instance if you want to write a function returning such an expression, you - * will need to use this class. - * - * Here is an example illustrating the dynamic case: - * \include class_Block.cpp - * Output: \verbinclude class_Block.out - * - * \note Even though this expression has dynamic size, in the case where \a XprType - * has fixed size, this expression inherits a fixed maximal size which means that evaluating - * it does not cause a dynamic memory allocation. - * - * Here is an example illustrating the fixed-size case: - * \include class_FixedBlock.cpp - * Output: \verbinclude class_FixedBlock.out - * - * \sa DenseBase::block(Index,Index,Index,Index), DenseBase::block(Index,Index), class VectorBlock - */ +namespace Eigen { namespace internal { template @@ -52,7 +20,7 @@ struct traits > : traits::Scalar Scalar; typedef typename traits::StorageKind StorageKind; typedef typename traits::XprKind XprKind; - typedef typename nested::type XprTypeNested; + typedef typename ref_selector::type XprTypeNested; typedef typename remove_reference::type _XprTypeNested; enum{ MatrixRows = traits::RowsAtCompileTime, @@ -65,10 +33,10 @@ struct traits > : traits::MaxColsAtCompileTime), + XprTypeIsRowMajor = (int(traits::Flags)&RowMajorBit) != 0, - IsDense = is_same::value, - IsRowMajor = (IsDense&&MaxRowsAtCompileTime==1&&MaxColsAtCompileTime!=1) ? 1 - : (IsDense&&MaxColsAtCompileTime==1&&MaxRowsAtCompileTime!=1) ? 0 + IsRowMajor = (MaxRowsAtCompileTime==1&&MaxColsAtCompileTime!=1) ? 1 + : (MaxColsAtCompileTime==1&&MaxRowsAtCompileTime!=1) ? 0 : XprTypeIsRowMajor, HasSameStorageOrderAsXprType = (IsRowMajor == XprTypeIsRowMajor), InnerSize = IsRowMajor ? int(ColsAtCompileTime) : int(RowsAtCompileTime), @@ -78,28 +46,60 @@ struct traits > : traits::ret) : int(inner_stride_at_compile_time::ret), - MaskPacketAccessBit = (InnerSize == Dynamic || (InnerSize % packet_traits::size) == 0) - && (InnerStrideAtCompileTime == 1) - ? PacketAccessBit : 0, - MaskAlignedBit = (InnerPanel && (OuterStrideAtCompileTime!=Dynamic) && (((OuterStrideAtCompileTime * int(sizeof(Scalar))) % 16) == 0)) ? AlignedBit : 0, - FlagsLinearAccessBit = (RowsAtCompileTime == 1 || ColsAtCompileTime == 1 || (InnerPanel && (traits::Flags&LinearAccessBit))) ? LinearAccessBit : 0, + + // FIXME, this traits is rather specialized for dense object and it needs to be cleaned further FlagsLvalueBit = is_lvalue::value ? LvalueBit : 0, FlagsRowMajorBit = IsRowMajor ? RowMajorBit : 0, - Flags0 = traits::Flags & ( (HereditaryBits & ~RowMajorBit) | - DirectAccessBit | - MaskPacketAccessBit | - MaskAlignedBit), - Flags = Flags0 | FlagsLinearAccessBit | FlagsLvalueBit | FlagsRowMajorBit + Flags = (traits::Flags & (DirectAccessBit | (InnerPanel?CompressedAccessBit:0))) | FlagsLvalueBit | FlagsRowMajorBit, + // FIXME DirectAccessBit should not be handled by expressions + // + // Alignment is needed by MapBase's assertions + // We can sefely set it to false here. Internal alignment errors will be detected by an eigen_internal_assert in the respective evaluator + Alignment = 0 }; }; template::ret> class BlockImpl_dense; - + } // end namespace internal template class BlockImpl; +/** \class Block + * \ingroup Core_Module + * + * \brief Expression of a fixed-size or dynamic-size block + * + * \tparam XprType the type of the expression in which we are taking a block + * \tparam BlockRows the number of rows of the block we are taking at compile time (optional) + * \tparam BlockCols the number of columns of the block we are taking at compile time (optional) + * \tparam InnerPanel is true, if the block maps to a set of rows of a row major matrix or + * to set of columns of a column major matrix (optional). The parameter allows to determine + * at compile time whether aligned access is possible on the block expression. + * + * This class represents an expression of either a fixed-size or dynamic-size block. It is the return + * type of DenseBase::block(Index,Index,Index,Index) and DenseBase::block(Index,Index) and + * most of the time this is the only way it is used. + * + * However, if you want to directly maniputate block expressions, + * for instance if you want to write a function returning such an expression, you + * will need to use this class. + * + * Here is an example illustrating the dynamic case: + * \include class_Block.cpp + * Output: \verbinclude class_Block.out + * + * \note Even though this expression has dynamic size, in the case where \a XprType + * has fixed size, this expression inherits a fixed maximal size which means that evaluating + * it does not cause a dynamic memory allocation. + * + * Here is an example illustrating the fixed-size case: + * \include class_FixedBlock.cpp + * Output: \verbinclude class_FixedBlock.out + * + * \sa DenseBase::block(Index,Index,Index,Index), DenseBase::block(Index,Index), class VectorBlock + */ template class Block : public BlockImpl::StorageKind> { @@ -109,10 +109,13 @@ template class typedef Impl Base; EIGEN_GENERIC_PUBLIC_INTERFACE(Block) EIGEN_INHERIT_ASSIGNMENT_OPERATORS(Block) - + + typedef typename internal::remove_all::type NestedExpression; + /** Column or Row constructor */ - inline Block(XprType& xpr, Index i) : Impl(xpr,i) + EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE + Block(XprType& xpr, Index i) : Impl(xpr,i) { eigen_assert( (i>=0) && ( ((BlockRows==1) && (BlockCols==XprType::ColsAtCompileTime) && i class /** Fixed-size constructor */ - inline Block(XprType& xpr, Index a_startRow, Index a_startCol) - : Impl(xpr, a_startRow, a_startCol) + EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE + Block(XprType& xpr, Index startRow, Index startCol) + : Impl(xpr, startRow, startCol) { EIGEN_STATIC_ASSERT(RowsAtCompileTime!=Dynamic && ColsAtCompileTime!=Dynamic,THIS_METHOD_IS_ONLY_FOR_FIXED_SIZE) - eigen_assert(a_startRow >= 0 && BlockRows >= 1 && a_startRow + BlockRows <= xpr.rows() - && a_startCol >= 0 && BlockCols >= 1 && a_startCol + BlockCols <= xpr.cols()); + eigen_assert(startRow >= 0 && BlockRows >= 0 && startRow + BlockRows <= xpr.rows() + && startCol >= 0 && BlockCols >= 0 && startCol + BlockCols <= xpr.cols()); } /** Dynamic-size constructor */ - inline Block(XprType& xpr, - Index a_startRow, Index a_startCol, + EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE + Block(XprType& xpr, + Index startRow, Index startCol, Index blockRows, Index blockCols) - : Impl(xpr, a_startRow, a_startCol, blockRows, blockCols) + : Impl(xpr, startRow, startCol, blockRows, blockCols) { eigen_assert((RowsAtCompileTime==Dynamic || RowsAtCompileTime==blockRows) && (ColsAtCompileTime==Dynamic || ColsAtCompileTime==blockCols)); - eigen_assert(a_startRow >= 0 && blockRows >= 0 && a_startRow <= xpr.rows() - blockRows - && a_startCol >= 0 && blockCols >= 0 && a_startCol <= xpr.cols() - blockCols); + eigen_assert(startRow >= 0 && blockRows >= 0 && startRow <= xpr.rows() - blockRows + && startCol >= 0 && blockCols >= 0 && startCol <= xpr.cols() - blockCols); } }; - + // The generic default implementation for dense block simplu forward to the internal::BlockImpl_dense // that must be specialized for direct and non-direct access... template @@ -150,14 +155,15 @@ class BlockImpl : public internal::BlockImpl_dense { typedef internal::BlockImpl_dense Impl; - typedef typename XprType::Index Index; + typedef typename XprType::StorageIndex StorageIndex; public: typedef Impl Base; EIGEN_INHERIT_ASSIGNMENT_OPERATORS(BlockImpl) - inline BlockImpl(XprType& xpr, Index i) : Impl(xpr,i) {} - inline BlockImpl(XprType& xpr, Index a_startRow, Index a_startCol) : Impl(xpr, a_startRow, a_startCol) {} - inline BlockImpl(XprType& xpr, Index a_startRow, Index a_startCol, Index blockRows, Index blockCols) - : Impl(xpr, a_startRow, a_startCol, blockRows, blockCols) {} + EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE BlockImpl(XprType& xpr, Index i) : Impl(xpr,i) {} + EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE BlockImpl(XprType& xpr, Index startRow, Index startCol) : Impl(xpr, startRow, startCol) {} + EIGEN_DEVICE_FUNC + EIGEN_STRONG_INLINE BlockImpl(XprType& xpr, Index startRow, Index startCol, Index blockRows, Index blockCols) + : Impl(xpr, startRow, startCol, blockRows, blockCols) {} }; namespace internal { @@ -167,16 +173,18 @@ template >::type { typedef Block BlockType; + typedef typename internal::ref_selector::non_const_type XprTypeNested; public: typedef typename internal::dense_xpr_base::type Base; EIGEN_DENSE_PUBLIC_INTERFACE(BlockType) EIGEN_INHERIT_ASSIGNMENT_OPERATORS(BlockImpl_dense) - class InnerIterator; + // class InnerIterator; // FIXME apparently never used /** Column or Row constructor */ + EIGEN_DEVICE_FUNC inline BlockImpl_dense(XprType& xpr, Index i) : m_xpr(xpr), // It is a row if and only if BlockRows==1 and BlockCols==XprType::ColsAtCompileTime, @@ -191,75 +199,76 @@ template inline PacketScalar packet(Index rowId, Index colId) const { - return m_xpr.template packet - (rowId + m_startRow.value(), colId + m_startCol.value()); + return m_xpr.template packet(rowId + m_startRow.value(), colId + m_startCol.value()); } template inline void writePacket(Index rowId, Index colId, const PacketScalar& val) { - m_xpr.const_cast_derived().template writePacket - (rowId + m_startRow.value(), colId + m_startCol.value(), val); + m_xpr.template writePacket(rowId + m_startRow.value(), colId + m_startCol.value(), val); } template @@ -273,40 +282,46 @@ template inline void writePacket(Index index, const PacketScalar& val) { - m_xpr.const_cast_derived().template writePacket + m_xpr.template writePacket (m_startRow.value() + (RowsAtCompileTime == 1 ? 0 : index), m_startCol.value() + (RowsAtCompileTime == 1 ? index : 0), val); } #ifdef EIGEN_PARSED_BY_DOXYGEN /** \sa MapBase::data() */ - inline const Scalar* data() const; - inline Index innerStride() const; - inline Index outerStride() const; + EIGEN_DEVICE_FUNC inline const Scalar* data() const; + EIGEN_DEVICE_FUNC inline Index innerStride() const; + EIGEN_DEVICE_FUNC inline Index outerStride() const; #endif - const typename internal::remove_all::type& nestedExpression() const - { - return m_xpr; + EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE + const typename internal::remove_all::type& nestedExpression() const + { + return m_xpr; } - - Index startRow() const - { - return m_startRow.value(); + + EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE + XprType& nestedExpression() { return m_xpr; } + + EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE EIGEN_CONSTEXPR + StorageIndex startRow() const EIGEN_NOEXCEPT + { + return m_startRow.value(); } - - Index startCol() const - { - return m_startCol.value(); + + EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE EIGEN_CONSTEXPR + StorageIndex startCol() const EIGEN_NOEXCEPT + { + return m_startCol.value(); } protected: - const typename XprType::Nested m_xpr; - const internal::variable_if_dynamic m_startRow; - const internal::variable_if_dynamic m_startCol; - const internal::variable_if_dynamic m_blockRows; - const internal::variable_if_dynamic m_blockCols; + XprTypeNested m_xpr; + const internal::variable_if_dynamic m_startRow; + const internal::variable_if_dynamic m_startCol; + const internal::variable_if_dynamic m_blockRows; + const internal::variable_if_dynamic m_blockCols; }; /** \internal Internal implementation of dense Blocks in the direct access case.*/ @@ -315,6 +330,10 @@ class BlockImpl_dense : public MapBase > { typedef Block BlockType; + typedef typename internal::ref_selector::non_const_type XprTypeNested; + enum { + XprTypeIsRowMajor = (int(traits::Flags)&RowMajorBit) != 0 + }; public: typedef MapBase Base; @@ -323,43 +342,53 @@ class BlockImpl_dense /** Column or Row constructor */ - inline BlockImpl_dense(XprType& xpr, Index i) - : Base(internal::const_cast_ptr(&xpr.coeffRef( - (BlockRows==1) && (BlockCols==XprType::ColsAtCompileTime) ? i : 0, - (BlockRows==XprType::RowsAtCompileTime) && (BlockCols==1) ? i : 0)), + EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE + BlockImpl_dense(XprType& xpr, Index i) + : Base(xpr.data() + i * ( ((BlockRows==1) && (BlockCols==XprType::ColsAtCompileTime) && (!XprTypeIsRowMajor)) + || ((BlockRows==XprType::RowsAtCompileTime) && (BlockCols==1) && ( XprTypeIsRowMajor)) ? xpr.innerStride() : xpr.outerStride()), BlockRows==1 ? 1 : xpr.rows(), BlockCols==1 ? 1 : xpr.cols()), - m_xpr(xpr) + m_xpr(xpr), + m_startRow( (BlockRows==1) && (BlockCols==XprType::ColsAtCompileTime) ? i : 0), + m_startCol( (BlockRows==XprType::RowsAtCompileTime) && (BlockCols==1) ? i : 0) { init(); } /** Fixed-size constructor */ - inline BlockImpl_dense(XprType& xpr, Index startRow, Index startCol) - : Base(internal::const_cast_ptr(&xpr.coeffRef(startRow,startCol))), m_xpr(xpr) + EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE + BlockImpl_dense(XprType& xpr, Index startRow, Index startCol) + : Base(xpr.data()+xpr.innerStride()*(XprTypeIsRowMajor?startCol:startRow) + xpr.outerStride()*(XprTypeIsRowMajor?startRow:startCol)), + m_xpr(xpr), m_startRow(startRow), m_startCol(startCol) { init(); } /** Dynamic-size constructor */ - inline BlockImpl_dense(XprType& xpr, + EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE + BlockImpl_dense(XprType& xpr, Index startRow, Index startCol, Index blockRows, Index blockCols) - : Base(internal::const_cast_ptr(&xpr.coeffRef(startRow,startCol)), blockRows, blockCols), - m_xpr(xpr) + : Base(xpr.data()+xpr.innerStride()*(XprTypeIsRowMajor?startCol:startRow) + xpr.outerStride()*(XprTypeIsRowMajor?startRow:startCol), blockRows, blockCols), + m_xpr(xpr), m_startRow(startRow), m_startCol(startCol) { init(); } - const typename internal::remove_all::type& nestedExpression() const - { - return m_xpr; + EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE + const typename internal::remove_all::type& nestedExpression() const EIGEN_NOEXCEPT + { + return m_xpr; } - + + EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE + XprType& nestedExpression() { return m_xpr; } + /** \sa MapBase::innerStride() */ - inline Index innerStride() const + EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE EIGEN_CONSTEXPR + Index innerStride() const EIGEN_NOEXCEPT { return internal::traits::HasSameStorageOrderAsXprType ? m_xpr.innerStride() @@ -367,11 +396,20 @@ class BlockImpl_dense } /** \sa MapBase::outerStride() */ - inline Index outerStride() const + EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE EIGEN_CONSTEXPR + Index outerStride() const EIGEN_NOEXCEPT { - return m_outerStride; + return internal::traits::HasSameStorageOrderAsXprType + ? m_xpr.outerStride() + : m_xpr.innerStride(); } + EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE EIGEN_CONSTEXPR + StorageIndex startRow() const EIGEN_NOEXCEPT { return m_startRow.value(); } + + EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE EIGEN_CONSTEXPR + StorageIndex startCol() const EIGEN_NOEXCEPT { return m_startCol.value(); } + #ifndef __SUNPRO_CC // FIXME sunstudio is not friendly with the above friend... // META-FIXME there is no 'friend' keyword around here. Is this obsolete? @@ -380,7 +418,8 @@ class BlockImpl_dense #ifndef EIGEN_PARSED_BY_DOXYGEN /** \internal used by allowAligned() */ - inline BlockImpl_dense(XprType& xpr, const Scalar* data, Index blockRows, Index blockCols) + EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE + BlockImpl_dense(XprType& xpr, const Scalar* data, Index blockRows, Index blockCols) : Base(data, blockRows, blockCols), m_xpr(xpr) { init(); @@ -388,6 +427,7 @@ class BlockImpl_dense #endif protected: + EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE void init() { m_outerStride = internal::traits::HasSameStorageOrderAsXprType @@ -395,7 +435,9 @@ class BlockImpl_dense : m_xpr.innerStride(); } - typename XprType::Nested m_xpr; + XprTypeNested m_xpr; + const internal::variable_if_dynamic m_startRow; + const internal::variable_if_dynamic m_startCol; Index m_outerStride; }; diff --git a/extern/eigen/Eigen/src/Core/BooleanRedux.h b/extern/eigen/Eigen/src/Core/BooleanRedux.h index be9f48a8..852de8b9 100644 --- a/extern/eigen/Eigen/src/Core/BooleanRedux.h +++ b/extern/eigen/Eigen/src/Core/BooleanRedux.h @@ -14,56 +14,56 @@ namespace Eigen { namespace internal { -template +template struct all_unroller { enum { - col = (UnrollCount-1) / Derived::RowsAtCompileTime, - row = (UnrollCount-1) % Derived::RowsAtCompileTime + col = (UnrollCount-1) / Rows, + row = (UnrollCount-1) % Rows }; - static inline bool run(const Derived &mat) + EIGEN_DEVICE_FUNC static inline bool run(const Derived &mat) { - return all_unroller::run(mat) && mat.coeff(row, col); + return all_unroller::run(mat) && mat.coeff(row, col); } }; -template -struct all_unroller +template +struct all_unroller { - static inline bool run(const Derived &/*mat*/) { return true; } + EIGEN_DEVICE_FUNC static inline bool run(const Derived &/*mat*/) { return true; } }; -template -struct all_unroller +template +struct all_unroller { - static inline bool run(const Derived &) { return false; } + EIGEN_DEVICE_FUNC static inline bool run(const Derived &) { return false; } }; -template +template struct any_unroller { enum { - col = (UnrollCount-1) / Derived::RowsAtCompileTime, - row = (UnrollCount-1) % Derived::RowsAtCompileTime + col = (UnrollCount-1) / Rows, + row = (UnrollCount-1) % Rows }; - - static inline bool run(const Derived &mat) + + EIGEN_DEVICE_FUNC static inline bool run(const Derived &mat) { - return any_unroller::run(mat) || mat.coeff(row, col); + return any_unroller::run(mat) || mat.coeff(row, col); } }; -template -struct any_unroller +template +struct any_unroller { - static inline bool run(const Derived & /*mat*/) { return false; } + EIGEN_DEVICE_FUNC static inline bool run(const Derived & /*mat*/) { return false; } }; -template -struct any_unroller +template +struct any_unroller { - static inline bool run(const Derived &) { return false; } + EIGEN_DEVICE_FUNC static inline bool run(const Derived &) { return false; } }; } // end namespace internal @@ -76,21 +76,21 @@ struct any_unroller * \sa any(), Cwise::operator<() */ template -inline bool DenseBase::all() const +EIGEN_DEVICE_FUNC inline bool DenseBase::all() const { + typedef internal::evaluator Evaluator; enum { unroll = SizeAtCompileTime != Dynamic - && CoeffReadCost != Dynamic - && NumTraits::AddCost != Dynamic - && SizeAtCompileTime * (CoeffReadCost + NumTraits::AddCost) <= EIGEN_UNROLLING_LIMIT + && SizeAtCompileTime * (int(Evaluator::CoeffReadCost) + int(NumTraits::AddCost)) <= EIGEN_UNROLLING_LIMIT }; + Evaluator evaluator(derived()); if(unroll) - return internal::all_unroller::run(derived()); + return internal::all_unroller::RowsAtCompileTime>::run(evaluator); else { for(Index j = 0; j < cols(); ++j) for(Index i = 0; i < rows(); ++i) - if (!coeff(i, j)) return false; + if (!evaluator.coeff(i, j)) return false; return true; } } @@ -100,21 +100,21 @@ inline bool DenseBase::all() const * \sa all() */ template -inline bool DenseBase::any() const +EIGEN_DEVICE_FUNC inline bool DenseBase::any() const { + typedef internal::evaluator Evaluator; enum { unroll = SizeAtCompileTime != Dynamic - && CoeffReadCost != Dynamic - && NumTraits::AddCost != Dynamic - && SizeAtCompileTime * (CoeffReadCost + NumTraits::AddCost) <= EIGEN_UNROLLING_LIMIT + && SizeAtCompileTime * (int(Evaluator::CoeffReadCost) + int(NumTraits::AddCost)) <= EIGEN_UNROLLING_LIMIT }; + Evaluator evaluator(derived()); if(unroll) - return internal::any_unroller::run(derived()); + return internal::any_unroller::RowsAtCompileTime>::run(evaluator); else { for(Index j = 0; j < cols(); ++j) for(Index i = 0; i < rows(); ++i) - if (coeff(i, j)) return true; + if (evaluator.coeff(i, j)) return true; return false; } } @@ -124,7 +124,7 @@ inline bool DenseBase::any() const * \sa all(), any() */ template -inline typename DenseBase::Index DenseBase::count() const +EIGEN_DEVICE_FUNC inline Eigen::Index DenseBase::count() const { return derived().template cast().template cast().sum(); } @@ -136,7 +136,11 @@ inline typename DenseBase::Index DenseBase::count() const template inline bool DenseBase::hasNaN() const { +#if EIGEN_COMP_MSVC || (defined __FAST_MATH__) + return derived().array().isNaN().any(); +#else return !((derived().array()==derived().array()).all()); +#endif } /** \returns true if \c *this contains only finite numbers, i.e., no NaN and no +/-INF values. @@ -146,7 +150,11 @@ inline bool DenseBase::hasNaN() const template inline bool DenseBase::allFinite() const { +#if EIGEN_COMP_MSVC || (defined __FAST_MATH__) + return derived().array().isFinite().all(); +#else return !((derived()-derived()).hasNaN()); +#endif } } // end namespace Eigen diff --git a/extern/eigen/Eigen/src/Core/CMakeLists.txt b/extern/eigen/Eigen/src/Core/CMakeLists.txt deleted file mode 100644 index 2346fc2b..00000000 --- a/extern/eigen/Eigen/src/Core/CMakeLists.txt +++ /dev/null @@ -1,10 +0,0 @@ -FILE(GLOB Eigen_Core_SRCS "*.h") - -INSTALL(FILES - ${Eigen_Core_SRCS} - DESTINATION ${INCLUDE_INSTALL_DIR}/Eigen/src/Core COMPONENT Devel - ) - -ADD_SUBDIRECTORY(products) -ADD_SUBDIRECTORY(util) -ADD_SUBDIRECTORY(arch) diff --git a/extern/eigen/Eigen/src/Core/CommaInitializer.h b/extern/eigen/Eigen/src/Core/CommaInitializer.h index a036d8c3..c0e29c75 100644 --- a/extern/eigen/Eigen/src/Core/CommaInitializer.h +++ b/extern/eigen/Eigen/src/Core/CommaInitializer.h @@ -22,30 +22,36 @@ namespace Eigen { * the return type of MatrixBase::operator<<, and most of the time this is the only * way it is used. * - * \sa \ref MatrixBaseCommaInitRef "MatrixBase::operator<<", CommaInitializer::finished() + * \sa \blank \ref MatrixBaseCommaInitRef "MatrixBase::operator<<", CommaInitializer::finished() */ template struct CommaInitializer { typedef typename XprType::Scalar Scalar; - typedef typename XprType::Index Index; + EIGEN_DEVICE_FUNC inline CommaInitializer(XprType& xpr, const Scalar& s) : m_xpr(xpr), m_row(0), m_col(1), m_currentBlockRows(1) { + eigen_assert(m_xpr.rows() > 0 && m_xpr.cols() > 0 + && "Cannot comma-initialize a 0x0 matrix (operator<<)"); m_xpr.coeffRef(0,0) = s; } template + EIGEN_DEVICE_FUNC inline CommaInitializer(XprType& xpr, const DenseBase& other) : m_xpr(xpr), m_row(0), m_col(other.cols()), m_currentBlockRows(other.rows()) { + eigen_assert(m_xpr.rows() >= other.rows() && m_xpr.cols() >= other.cols() + && "Cannot comma-initialize a 0x0 matrix (operator<<)"); m_xpr.block(0, 0, other.rows(), other.cols()) = other; } /* Copy/Move constructor which transfers ownership. This is crucial in * absence of return value optimization to avoid assertions during destruction. */ // FIXME in C++11 mode this could be replaced by a proper RValue constructor + EIGEN_DEVICE_FUNC inline CommaInitializer(const CommaInitializer& o) : m_xpr(o.m_xpr), m_row(o.m_row), m_col(o.m_col), m_currentBlockRows(o.m_currentBlockRows) { // Mark original object as finished. In absence of R-value references we need to const_cast: @@ -55,6 +61,7 @@ struct CommaInitializer } /* inserts a scalar value in the target matrix */ + EIGEN_DEVICE_FUNC CommaInitializer& operator,(const Scalar& s) { if (m_col==m_xpr.cols()) @@ -74,11 +81,10 @@ struct CommaInitializer /* inserts a matrix expression in the target matrix */ template + EIGEN_DEVICE_FUNC CommaInitializer& operator,(const DenseBase& other) { - if(other.cols()==0 || other.rows()==0) - return *this; - if (m_col==m_xpr.cols()) + if (m_col==m_xpr.cols() && (other.cols()!=0 || other.rows()!=m_currentBlockRows)) { m_row+=m_currentBlockRows; m_col = 0; @@ -86,24 +92,22 @@ struct CommaInitializer eigen_assert(m_row+m_currentBlockRows<=m_xpr.rows() && "Too many rows passed to comma initializer (operator<<)"); } - eigen_assert(m_col - (m_row, m_col) = other; - else - m_xpr.block(m_row, m_col, other.rows(), other.cols()) = other; + m_xpr.template block + (m_row, m_col, other.rows(), other.cols()) = other; m_col += other.cols(); return *this; } + EIGEN_DEVICE_FUNC inline ~CommaInitializer() +#if defined VERIFY_RAISES_ASSERT && (!defined EIGEN_NO_ASSERTION_CHECKING) && defined EIGEN_EXCEPTIONS + EIGEN_EXCEPTION_SPEC(Eigen::eigen_assert_exception) +#endif { - eigen_assert((m_row+m_currentBlockRows) == m_xpr.rows() - && m_col == m_xpr.cols() - && "Too few coefficients passed to comma initializer (operator<<)"); + finished(); } /** \returns the built matrix once all its coefficients have been set. @@ -113,9 +117,15 @@ struct CommaInitializer * quaternion.fromRotationMatrix((Matrix3f() << axis0, axis1, axis2).finished()); * \endcode */ - inline XprType& finished() { return m_xpr; } + EIGEN_DEVICE_FUNC + inline XprType& finished() { + eigen_assert(((m_row+m_currentBlockRows) == m_xpr.rows() || m_xpr.cols() == 0) + && m_col == m_xpr.cols() + && "Too few coefficients passed to comma initializer (operator<<)"); + return m_xpr; + } - XprType& m_xpr; // target expression + XprType& m_xpr; // target expression Index m_row; // current row id Index m_col; // current col id Index m_currentBlockRows; // current block height @@ -135,7 +145,7 @@ struct CommaInitializer * \sa CommaInitializer::finished(), class CommaInitializer */ template -inline CommaInitializer DenseBase::operator<< (const Scalar& s) +EIGEN_DEVICE_FUNC inline CommaInitializer DenseBase::operator<< (const Scalar& s) { return CommaInitializer(*static_cast(this), s); } @@ -143,7 +153,7 @@ inline CommaInitializer DenseBase::operator<< (const Scalar& s /** \sa operator<<(const Scalar&) */ template template -inline CommaInitializer +EIGEN_DEVICE_FUNC inline CommaInitializer DenseBase::operator<<(const DenseBase& other) { return CommaInitializer(*static_cast(this), other); diff --git a/extern/eigen/Eigen/src/Core/ConditionEstimator.h b/extern/eigen/Eigen/src/Core/ConditionEstimator.h new file mode 100644 index 00000000..51a2e5f1 --- /dev/null +++ b/extern/eigen/Eigen/src/Core/ConditionEstimator.h @@ -0,0 +1,175 @@ +// This file is part of Eigen, a lightweight C++ template library +// for linear algebra. +// +// Copyright (C) 2016 Rasmus Munk Larsen (rmlarsen@google.com) +// +// This Source Code Form is subject to the terms of the Mozilla +// Public License v. 2.0. If a copy of the MPL was not distributed +// with this file, You can obtain one at http://mozilla.org/MPL/2.0/. + +#ifndef EIGEN_CONDITIONESTIMATOR_H +#define EIGEN_CONDITIONESTIMATOR_H + +namespace Eigen { + +namespace internal { + +template +struct rcond_compute_sign { + static inline Vector run(const Vector& v) { + const RealVector v_abs = v.cwiseAbs(); + return (v_abs.array() == static_cast(0)) + .select(Vector::Ones(v.size()), v.cwiseQuotient(v_abs)); + } +}; + +// Partial specialization to avoid elementwise division for real vectors. +template +struct rcond_compute_sign { + static inline Vector run(const Vector& v) { + return (v.array() < static_cast(0)) + .select(-Vector::Ones(v.size()), Vector::Ones(v.size())); + } +}; + +/** + * \returns an estimate of ||inv(matrix)||_1 given a decomposition of + * \a matrix that implements .solve() and .adjoint().solve() methods. + * + * This function implements Algorithms 4.1 and 5.1 from + * http://www.maths.manchester.ac.uk/~higham/narep/narep135.pdf + * which also forms the basis for the condition number estimators in + * LAPACK. Since at most 10 calls to the solve method of dec are + * performed, the total cost is O(dims^2), as opposed to O(dims^3) + * needed to compute the inverse matrix explicitly. + * + * The most common usage is in estimating the condition number + * ||matrix||_1 * ||inv(matrix)||_1. The first term ||matrix||_1 can be + * computed directly in O(n^2) operations. + * + * Supports the following decompositions: FullPivLU, PartialPivLU, LDLT, and + * LLT. + * + * \sa FullPivLU, PartialPivLU, LDLT, LLT. + */ +template +typename Decomposition::RealScalar rcond_invmatrix_L1_norm_estimate(const Decomposition& dec) +{ + typedef typename Decomposition::MatrixType MatrixType; + typedef typename Decomposition::Scalar Scalar; + typedef typename Decomposition::RealScalar RealScalar; + typedef typename internal::plain_col_type::type Vector; + typedef typename internal::plain_col_type::type RealVector; + const bool is_complex = (NumTraits::IsComplex != 0); + + eigen_assert(dec.rows() == dec.cols()); + const Index n = dec.rows(); + if (n == 0) + return 0; + + // Disable Index to float conversion warning +#ifdef __INTEL_COMPILER + #pragma warning push + #pragma warning ( disable : 2259 ) +#endif + Vector v = dec.solve(Vector::Ones(n) / Scalar(n)); +#ifdef __INTEL_COMPILER + #pragma warning pop +#endif + + // lower_bound is a lower bound on + // ||inv(matrix)||_1 = sup_v ||inv(matrix) v||_1 / ||v||_1 + // and is the objective maximized by the ("super-") gradient ascent + // algorithm below. + RealScalar lower_bound = v.template lpNorm<1>(); + if (n == 1) + return lower_bound; + + // Gradient ascent algorithm follows: We know that the optimum is achieved at + // one of the simplices v = e_i, so in each iteration we follow a + // super-gradient to move towards the optimal one. + RealScalar old_lower_bound = lower_bound; + Vector sign_vector(n); + Vector old_sign_vector; + Index v_max_abs_index = -1; + Index old_v_max_abs_index = v_max_abs_index; + for (int k = 0; k < 4; ++k) + { + sign_vector = internal::rcond_compute_sign::run(v); + if (k > 0 && !is_complex && sign_vector == old_sign_vector) { + // Break if the solution stagnated. + break; + } + // v_max_abs_index = argmax |real( inv(matrix)^T * sign_vector )| + v = dec.adjoint().solve(sign_vector); + v.real().cwiseAbs().maxCoeff(&v_max_abs_index); + if (v_max_abs_index == old_v_max_abs_index) { + // Break if the solution stagnated. + break; + } + // Move to the new simplex e_j, where j = v_max_abs_index. + v = dec.solve(Vector::Unit(n, v_max_abs_index)); // v = inv(matrix) * e_j. + lower_bound = v.template lpNorm<1>(); + if (lower_bound <= old_lower_bound) { + // Break if the gradient step did not increase the lower_bound. + break; + } + if (!is_complex) { + old_sign_vector = sign_vector; + } + old_v_max_abs_index = v_max_abs_index; + old_lower_bound = lower_bound; + } + // The following calculates an independent estimate of ||matrix||_1 by + // multiplying matrix by a vector with entries of slowly increasing + // magnitude and alternating sign: + // v_i = (-1)^{i} (1 + (i / (dim-1))), i = 0,...,dim-1. + // This improvement to Hager's algorithm above is due to Higham. It was + // added to make the algorithm more robust in certain corner cases where + // large elements in the matrix might otherwise escape detection due to + // exact cancellation (especially when op and op_adjoint correspond to a + // sequence of backsubstitutions and permutations), which could cause + // Hager's algorithm to vastly underestimate ||matrix||_1. + Scalar alternating_sign(RealScalar(1)); + for (Index i = 0; i < n; ++i) { + // The static_cast is needed when Scalar is a complex and RealScalar implements expression templates + v[i] = alternating_sign * static_cast(RealScalar(1) + (RealScalar(i) / (RealScalar(n - 1)))); + alternating_sign = -alternating_sign; + } + v = dec.solve(v); + const RealScalar alternate_lower_bound = (2 * v.template lpNorm<1>()) / (3 * RealScalar(n)); + return numext::maxi(lower_bound, alternate_lower_bound); +} + +/** \brief Reciprocal condition number estimator. + * + * Computing a decomposition of a dense matrix takes O(n^3) operations, while + * this method estimates the condition number quickly and reliably in O(n^2) + * operations. + * + * \returns an estimate of the reciprocal condition number + * (1 / (||matrix||_1 * ||inv(matrix)||_1)) of matrix, given ||matrix||_1 and + * its decomposition. Supports the following decompositions: FullPivLU, + * PartialPivLU, LDLT, and LLT. + * + * \sa FullPivLU, PartialPivLU, LDLT, LLT. + */ +template +typename Decomposition::RealScalar +rcond_estimate_helper(typename Decomposition::RealScalar matrix_norm, const Decomposition& dec) +{ + typedef typename Decomposition::RealScalar RealScalar; + eigen_assert(dec.rows() == dec.cols()); + if (dec.rows() == 0) return NumTraits::infinity(); + if (matrix_norm == RealScalar(0)) return RealScalar(0); + if (dec.rows() == 1) return RealScalar(1); + const RealScalar inverse_matrix_norm = rcond_invmatrix_L1_norm_estimate(dec); + return (inverse_matrix_norm == RealScalar(0) ? RealScalar(0) + : (RealScalar(1) / inverse_matrix_norm) / matrix_norm); +} + +} // namespace internal + +} // namespace Eigen + +#endif diff --git a/extern/eigen/Eigen/src/Core/CoreEvaluators.h b/extern/eigen/Eigen/src/Core/CoreEvaluators.h new file mode 100644 index 00000000..0ff8c8de --- /dev/null +++ b/extern/eigen/Eigen/src/Core/CoreEvaluators.h @@ -0,0 +1,1741 @@ +// This file is part of Eigen, a lightweight C++ template library +// for linear algebra. +// +// Copyright (C) 2011 Benoit Jacob +// Copyright (C) 2011-2014 Gael Guennebaud +// Copyright (C) 2011-2012 Jitse Niesen +// +// This Source Code Form is subject to the terms of the Mozilla +// Public License v. 2.0. If a copy of the MPL was not distributed +// with this file, You can obtain one at http://mozilla.org/MPL/2.0/. + + +#ifndef EIGEN_COREEVALUATORS_H +#define EIGEN_COREEVALUATORS_H + +namespace Eigen { + +namespace internal { + +// This class returns the evaluator kind from the expression storage kind. +// Default assumes index based accessors +template +struct storage_kind_to_evaluator_kind { + typedef IndexBased Kind; +}; + +// This class returns the evaluator shape from the expression storage kind. +// It can be Dense, Sparse, Triangular, Diagonal, SelfAdjoint, Band, etc. +template struct storage_kind_to_shape; + +template<> struct storage_kind_to_shape { typedef DenseShape Shape; }; +template<> struct storage_kind_to_shape { typedef SolverShape Shape; }; +template<> struct storage_kind_to_shape { typedef PermutationShape Shape; }; +template<> struct storage_kind_to_shape { typedef TranspositionsShape Shape; }; + +// Evaluators have to be specialized with respect to various criteria such as: +// - storage/structure/shape +// - scalar type +// - etc. +// Therefore, we need specialization of evaluator providing additional template arguments for each kind of evaluators. +// We currently distinguish the following kind of evaluators: +// - unary_evaluator for expressions taking only one arguments (CwiseUnaryOp, CwiseUnaryView, Transpose, MatrixWrapper, ArrayWrapper, Reverse, Replicate) +// - binary_evaluator for expression taking two arguments (CwiseBinaryOp) +// - ternary_evaluator for expression taking three arguments (CwiseTernaryOp) +// - product_evaluator for linear algebra products (Product); special case of binary_evaluator because it requires additional tags for dispatching. +// - mapbase_evaluator for Map, Block, Ref +// - block_evaluator for Block (special dispatching to a mapbase_evaluator or unary_evaluator) + +template< typename T, + typename Arg1Kind = typename evaluator_traits::Kind, + typename Arg2Kind = typename evaluator_traits::Kind, + typename Arg3Kind = typename evaluator_traits::Kind, + typename Arg1Scalar = typename traits::Scalar, + typename Arg2Scalar = typename traits::Scalar, + typename Arg3Scalar = typename traits::Scalar> struct ternary_evaluator; + +template< typename T, + typename LhsKind = typename evaluator_traits::Kind, + typename RhsKind = typename evaluator_traits::Kind, + typename LhsScalar = typename traits::Scalar, + typename RhsScalar = typename traits::Scalar> struct binary_evaluator; + +template< typename T, + typename Kind = typename evaluator_traits::Kind, + typename Scalar = typename T::Scalar> struct unary_evaluator; + +// evaluator_traits contains traits for evaluator + +template +struct evaluator_traits_base +{ + // by default, get evaluator kind and shape from storage + typedef typename storage_kind_to_evaluator_kind::StorageKind>::Kind Kind; + typedef typename storage_kind_to_shape::StorageKind>::Shape Shape; +}; + +// Default evaluator traits +template +struct evaluator_traits : public evaluator_traits_base +{ +}; + +template::Shape > +struct evaluator_assume_aliasing { + static const bool value = false; +}; + +// By default, we assume a unary expression: +template +struct evaluator : public unary_evaluator +{ + typedef unary_evaluator Base; + EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE + explicit evaluator(const T& xpr) : Base(xpr) {} +}; + + +// TODO: Think about const-correctness +template +struct evaluator + : evaluator +{ + EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE + explicit evaluator(const T& xpr) : evaluator(xpr) {} +}; + +// ---------- base class for all evaluators ---------- + +template +struct evaluator_base +{ + // TODO that's not very nice to have to propagate all these traits. They are currently only needed to handle outer,inner indices. + typedef traits ExpressionTraits; + + enum { + Alignment = 0 + }; + // noncopyable: + // Don't make this class inherit noncopyable as this kills EBO (Empty Base Optimization) + // and make complex evaluator much larger than then should do. + EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE evaluator_base() {} + EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE ~evaluator_base() {} +private: + EIGEN_DEVICE_FUNC evaluator_base(const evaluator_base&); + EIGEN_DEVICE_FUNC const evaluator_base& operator=(const evaluator_base&); +}; + +// -------------------- Matrix and Array -------------------- +// +// evaluator is a common base class for the +// Matrix and Array evaluators. +// Here we directly specialize evaluator. This is not really a unary expression, and it is, by definition, dense, +// so no need for more sophisticated dispatching. + +// this helper permits to completely eliminate m_outerStride if it is known at compiletime. +template class plainobjectbase_evaluator_data { +public: + EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE + plainobjectbase_evaluator_data(const Scalar* ptr, Index outerStride) : data(ptr) + { +#ifndef EIGEN_INTERNAL_DEBUGGING + EIGEN_UNUSED_VARIABLE(outerStride); +#endif + eigen_internal_assert(outerStride==OuterStride); + } + EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE EIGEN_CONSTEXPR + Index outerStride() const EIGEN_NOEXCEPT { return OuterStride; } + const Scalar *data; +}; + +template class plainobjectbase_evaluator_data { +public: + EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE + plainobjectbase_evaluator_data(const Scalar* ptr, Index outerStride) : data(ptr), m_outerStride(outerStride) {} + EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE + Index outerStride() const { return m_outerStride; } + const Scalar *data; +protected: + Index m_outerStride; +}; + +template +struct evaluator > + : evaluator_base +{ + typedef PlainObjectBase PlainObjectType; + typedef typename PlainObjectType::Scalar Scalar; + typedef typename PlainObjectType::CoeffReturnType CoeffReturnType; + + enum { + IsRowMajor = PlainObjectType::IsRowMajor, + IsVectorAtCompileTime = PlainObjectType::IsVectorAtCompileTime, + RowsAtCompileTime = PlainObjectType::RowsAtCompileTime, + ColsAtCompileTime = PlainObjectType::ColsAtCompileTime, + + CoeffReadCost = NumTraits::ReadCost, + Flags = traits::EvaluatorFlags, + Alignment = traits::Alignment + }; + enum { + // We do not need to know the outer stride for vectors + OuterStrideAtCompileTime = IsVectorAtCompileTime ? 0 + : int(IsRowMajor) ? ColsAtCompileTime + : RowsAtCompileTime + }; + + EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE + evaluator() + : m_d(0,OuterStrideAtCompileTime) + { + EIGEN_INTERNAL_CHECK_COST_VALUE(CoeffReadCost); + } + + EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE + explicit evaluator(const PlainObjectType& m) + : m_d(m.data(),IsVectorAtCompileTime ? 0 : m.outerStride()) + { + EIGEN_INTERNAL_CHECK_COST_VALUE(CoeffReadCost); + } + + EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE + CoeffReturnType coeff(Index row, Index col) const + { + if (IsRowMajor) + return m_d.data[row * m_d.outerStride() + col]; + else + return m_d.data[row + col * m_d.outerStride()]; + } + + EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE + CoeffReturnType coeff(Index index) const + { + return m_d.data[index]; + } + + EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE + Scalar& coeffRef(Index row, Index col) + { + if (IsRowMajor) + return const_cast(m_d.data)[row * m_d.outerStride() + col]; + else + return const_cast(m_d.data)[row + col * m_d.outerStride()]; + } + + EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE + Scalar& coeffRef(Index index) + { + return const_cast(m_d.data)[index]; + } + + template + EIGEN_STRONG_INLINE + PacketType packet(Index row, Index col) const + { + if (IsRowMajor) + return ploadt(m_d.data + row * m_d.outerStride() + col); + else + return ploadt(m_d.data + row + col * m_d.outerStride()); + } + + template + EIGEN_STRONG_INLINE + PacketType packet(Index index) const + { + return ploadt(m_d.data + index); + } + + template + EIGEN_STRONG_INLINE + void writePacket(Index row, Index col, const PacketType& x) + { + if (IsRowMajor) + return pstoret + (const_cast(m_d.data) + row * m_d.outerStride() + col, x); + else + return pstoret + (const_cast(m_d.data) + row + col * m_d.outerStride(), x); + } + + template + EIGEN_STRONG_INLINE + void writePacket(Index index, const PacketType& x) + { + return pstoret(const_cast(m_d.data) + index, x); + } + +protected: + + plainobjectbase_evaluator_data m_d; +}; + +template +struct evaluator > + : evaluator > > +{ + typedef Matrix XprType; + + EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE + evaluator() {} + + EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE + explicit evaluator(const XprType& m) + : evaluator >(m) + { } +}; + +template +struct evaluator > + : evaluator > > +{ + typedef Array XprType; + + EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE + evaluator() {} + + EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE + explicit evaluator(const XprType& m) + : evaluator >(m) + { } +}; + +// -------------------- Transpose -------------------- + +template +struct unary_evaluator, IndexBased> + : evaluator_base > +{ + typedef Transpose XprType; + + enum { + CoeffReadCost = evaluator::CoeffReadCost, + Flags = evaluator::Flags ^ RowMajorBit, + Alignment = evaluator::Alignment + }; + + EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE + explicit unary_evaluator(const XprType& t) : m_argImpl(t.nestedExpression()) {} + + typedef typename XprType::Scalar Scalar; + typedef typename XprType::CoeffReturnType CoeffReturnType; + + EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE + CoeffReturnType coeff(Index row, Index col) const + { + return m_argImpl.coeff(col, row); + } + + EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE + CoeffReturnType coeff(Index index) const + { + return m_argImpl.coeff(index); + } + + EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE + Scalar& coeffRef(Index row, Index col) + { + return m_argImpl.coeffRef(col, row); + } + + EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE + typename XprType::Scalar& coeffRef(Index index) + { + return m_argImpl.coeffRef(index); + } + + template + EIGEN_STRONG_INLINE + PacketType packet(Index row, Index col) const + { + return m_argImpl.template packet(col, row); + } + + template + EIGEN_STRONG_INLINE + PacketType packet(Index index) const + { + return m_argImpl.template packet(index); + } + + template + EIGEN_STRONG_INLINE + void writePacket(Index row, Index col, const PacketType& x) + { + m_argImpl.template writePacket(col, row, x); + } + + template + EIGEN_STRONG_INLINE + void writePacket(Index index, const PacketType& x) + { + m_argImpl.template writePacket(index, x); + } + +protected: + evaluator m_argImpl; +}; + +// -------------------- CwiseNullaryOp -------------------- +// Like Matrix and Array, this is not really a unary expression, so we directly specialize evaluator. +// Likewise, there is not need to more sophisticated dispatching here. + +template::value, + bool has_unary = has_unary_operator::value, + bool has_binary = has_binary_operator::value> +struct nullary_wrapper +{ + template + EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Scalar operator()(const NullaryOp& op, IndexType i, IndexType j) const { return op(i,j); } + template + EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Scalar operator()(const NullaryOp& op, IndexType i) const { return op(i); } + + template EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE T packetOp(const NullaryOp& op, IndexType i, IndexType j) const { return op.template packetOp(i,j); } + template EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE T packetOp(const NullaryOp& op, IndexType i) const { return op.template packetOp(i); } +}; + +template +struct nullary_wrapper +{ + template + EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Scalar operator()(const NullaryOp& op, IndexType=0, IndexType=0) const { return op(); } + template EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE T packetOp(const NullaryOp& op, IndexType=0, IndexType=0) const { return op.template packetOp(); } +}; + +template +struct nullary_wrapper +{ + template + EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Scalar operator()(const NullaryOp& op, IndexType i, IndexType j=0) const { return op(i,j); } + template EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE T packetOp(const NullaryOp& op, IndexType i, IndexType j=0) const { return op.template packetOp(i,j); } +}; + +// We need the following specialization for vector-only functors assigned to a runtime vector, +// for instance, using linspace and assigning a RowVectorXd to a MatrixXd or even a row of a MatrixXd. +// In this case, i==0 and j is used for the actual iteration. +template +struct nullary_wrapper +{ + template + EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Scalar operator()(const NullaryOp& op, IndexType i, IndexType j) const { + eigen_assert(i==0 || j==0); + return op(i+j); + } + template EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE T packetOp(const NullaryOp& op, IndexType i, IndexType j) const { + eigen_assert(i==0 || j==0); + return op.template packetOp(i+j); + } + + template + EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Scalar operator()(const NullaryOp& op, IndexType i) const { return op(i); } + template + EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE T packetOp(const NullaryOp& op, IndexType i) const { return op.template packetOp(i); } +}; + +template +struct nullary_wrapper {}; + +#if 0 && EIGEN_COMP_MSVC>0 +// Disable this ugly workaround. This is now handled in traits::match, +// but this piece of code might still become handly if some other weird compilation +// erros pop up again. + +// MSVC exhibits a weird compilation error when +// compiling: +// Eigen::MatrixXf A = MatrixXf::Random(3,3); +// Ref R = 2.f*A; +// and that has_*ary_operator> have not been instantiated yet. +// The "problem" is that evaluator<2.f*A> is instantiated by traits::match<2.f*A> +// and at that time has_*ary_operator returns true regardless of T. +// Then nullary_wrapper is badly instantiated as nullary_wrapper<.,.,true,true,true>. +// The trick is thus to defer the proper instantiation of nullary_wrapper when coeff(), +// and packet() are really instantiated as implemented below: + +// This is a simple wrapper around Index to enforce the re-instantiation of +// has_*ary_operator when needed. +template struct nullary_wrapper_workaround_msvc { + nullary_wrapper_workaround_msvc(const T&); + operator T()const; +}; + +template +struct nullary_wrapper +{ + template + EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Scalar operator()(const NullaryOp& op, IndexType i, IndexType j) const { + return nullary_wrapper >::value, + has_unary_operator >::value, + has_binary_operator >::value>().operator()(op,i,j); + } + template + EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Scalar operator()(const NullaryOp& op, IndexType i) const { + return nullary_wrapper >::value, + has_unary_operator >::value, + has_binary_operator >::value>().operator()(op,i); + } + + template + EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE T packetOp(const NullaryOp& op, IndexType i, IndexType j) const { + return nullary_wrapper >::value, + has_unary_operator >::value, + has_binary_operator >::value>().template packetOp(op,i,j); + } + template + EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE T packetOp(const NullaryOp& op, IndexType i) const { + return nullary_wrapper >::value, + has_unary_operator >::value, + has_binary_operator >::value>().template packetOp(op,i); + } +}; +#endif // MSVC workaround + +template +struct evaluator > + : evaluator_base > +{ + typedef CwiseNullaryOp XprType; + typedef typename internal::remove_all::type PlainObjectTypeCleaned; + + enum { + CoeffReadCost = internal::functor_traits::Cost, + + Flags = (evaluator::Flags + & ( HereditaryBits + | (functor_has_linear_access::ret ? LinearAccessBit : 0) + | (functor_traits::PacketAccess ? PacketAccessBit : 0))) + | (functor_traits::IsRepeatable ? 0 : EvalBeforeNestingBit), + Alignment = AlignedMax + }; + + EIGEN_DEVICE_FUNC explicit evaluator(const XprType& n) + : m_functor(n.functor()), m_wrapper() + { + EIGEN_INTERNAL_CHECK_COST_VALUE(CoeffReadCost); + } + + typedef typename XprType::CoeffReturnType CoeffReturnType; + + template + EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE + CoeffReturnType coeff(IndexType row, IndexType col) const + { + return m_wrapper(m_functor, row, col); + } + + template + EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE + CoeffReturnType coeff(IndexType index) const + { + return m_wrapper(m_functor,index); + } + + template + EIGEN_STRONG_INLINE + PacketType packet(IndexType row, IndexType col) const + { + return m_wrapper.template packetOp(m_functor, row, col); + } + + template + EIGEN_STRONG_INLINE + PacketType packet(IndexType index) const + { + return m_wrapper.template packetOp(m_functor, index); + } + +protected: + const NullaryOp m_functor; + const internal::nullary_wrapper m_wrapper; +}; + +// -------------------- CwiseUnaryOp -------------------- + +template +struct unary_evaluator, IndexBased > + : evaluator_base > +{ + typedef CwiseUnaryOp XprType; + + enum { + CoeffReadCost = int(evaluator::CoeffReadCost) + int(functor_traits::Cost), + + Flags = evaluator::Flags + & (HereditaryBits | LinearAccessBit | (functor_traits::PacketAccess ? PacketAccessBit : 0)), + Alignment = evaluator::Alignment + }; + + EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE + explicit unary_evaluator(const XprType& op) : m_d(op) + { + EIGEN_INTERNAL_CHECK_COST_VALUE(functor_traits::Cost); + EIGEN_INTERNAL_CHECK_COST_VALUE(CoeffReadCost); + } + + typedef typename XprType::CoeffReturnType CoeffReturnType; + + EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE + CoeffReturnType coeff(Index row, Index col) const + { + return m_d.func()(m_d.argImpl.coeff(row, col)); + } + + EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE + CoeffReturnType coeff(Index index) const + { + return m_d.func()(m_d.argImpl.coeff(index)); + } + + template + EIGEN_STRONG_INLINE + PacketType packet(Index row, Index col) const + { + return m_d.func().packetOp(m_d.argImpl.template packet(row, col)); + } + + template + EIGEN_STRONG_INLINE + PacketType packet(Index index) const + { + return m_d.func().packetOp(m_d.argImpl.template packet(index)); + } + +protected: + + // this helper permits to completely eliminate the functor if it is empty + struct Data + { + EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE + Data(const XprType& xpr) : op(xpr.functor()), argImpl(xpr.nestedExpression()) {} + EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE + const UnaryOp& func() const { return op; } + UnaryOp op; + evaluator argImpl; + }; + + Data m_d; +}; + +// -------------------- CwiseTernaryOp -------------------- + +// this is a ternary expression +template +struct evaluator > + : public ternary_evaluator > +{ + typedef CwiseTernaryOp XprType; + typedef ternary_evaluator > Base; + + EIGEN_DEVICE_FUNC explicit evaluator(const XprType& xpr) : Base(xpr) {} +}; + +template +struct ternary_evaluator, IndexBased, IndexBased> + : evaluator_base > +{ + typedef CwiseTernaryOp XprType; + + enum { + CoeffReadCost = int(evaluator::CoeffReadCost) + int(evaluator::CoeffReadCost) + int(evaluator::CoeffReadCost) + int(functor_traits::Cost), + + Arg1Flags = evaluator::Flags, + Arg2Flags = evaluator::Flags, + Arg3Flags = evaluator::Flags, + SameType = is_same::value && is_same::value, + StorageOrdersAgree = (int(Arg1Flags)&RowMajorBit)==(int(Arg2Flags)&RowMajorBit) && (int(Arg1Flags)&RowMajorBit)==(int(Arg3Flags)&RowMajorBit), + Flags0 = (int(Arg1Flags) | int(Arg2Flags) | int(Arg3Flags)) & ( + HereditaryBits + | (int(Arg1Flags) & int(Arg2Flags) & int(Arg3Flags) & + ( (StorageOrdersAgree ? LinearAccessBit : 0) + | (functor_traits::PacketAccess && StorageOrdersAgree && SameType ? PacketAccessBit : 0) + ) + ) + ), + Flags = (Flags0 & ~RowMajorBit) | (Arg1Flags & RowMajorBit), + Alignment = EIGEN_PLAIN_ENUM_MIN( + EIGEN_PLAIN_ENUM_MIN(evaluator::Alignment, evaluator::Alignment), + evaluator::Alignment) + }; + + EIGEN_DEVICE_FUNC explicit ternary_evaluator(const XprType& xpr) : m_d(xpr) + { + EIGEN_INTERNAL_CHECK_COST_VALUE(functor_traits::Cost); + EIGEN_INTERNAL_CHECK_COST_VALUE(CoeffReadCost); + } + + typedef typename XprType::CoeffReturnType CoeffReturnType; + + EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE + CoeffReturnType coeff(Index row, Index col) const + { + return m_d.func()(m_d.arg1Impl.coeff(row, col), m_d.arg2Impl.coeff(row, col), m_d.arg3Impl.coeff(row, col)); + } + + EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE + CoeffReturnType coeff(Index index) const + { + return m_d.func()(m_d.arg1Impl.coeff(index), m_d.arg2Impl.coeff(index), m_d.arg3Impl.coeff(index)); + } + + template + EIGEN_STRONG_INLINE + PacketType packet(Index row, Index col) const + { + return m_d.func().packetOp(m_d.arg1Impl.template packet(row, col), + m_d.arg2Impl.template packet(row, col), + m_d.arg3Impl.template packet(row, col)); + } + + template + EIGEN_STRONG_INLINE + PacketType packet(Index index) const + { + return m_d.func().packetOp(m_d.arg1Impl.template packet(index), + m_d.arg2Impl.template packet(index), + m_d.arg3Impl.template packet(index)); + } + +protected: + // this helper permits to completely eliminate the functor if it is empty + struct Data + { + EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE + Data(const XprType& xpr) : op(xpr.functor()), arg1Impl(xpr.arg1()), arg2Impl(xpr.arg2()), arg3Impl(xpr.arg3()) {} + EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE + const TernaryOp& func() const { return op; } + TernaryOp op; + evaluator arg1Impl; + evaluator arg2Impl; + evaluator arg3Impl; + }; + + Data m_d; +}; + +// -------------------- CwiseBinaryOp -------------------- + +// this is a binary expression +template +struct evaluator > + : public binary_evaluator > +{ + typedef CwiseBinaryOp XprType; + typedef binary_evaluator > Base; + + EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE + explicit evaluator(const XprType& xpr) : Base(xpr) {} +}; + +template +struct binary_evaluator, IndexBased, IndexBased> + : evaluator_base > +{ + typedef CwiseBinaryOp XprType; + + enum { + CoeffReadCost = int(evaluator::CoeffReadCost) + int(evaluator::CoeffReadCost) + int(functor_traits::Cost), + + LhsFlags = evaluator::Flags, + RhsFlags = evaluator::Flags, + SameType = is_same::value, + StorageOrdersAgree = (int(LhsFlags)&RowMajorBit)==(int(RhsFlags)&RowMajorBit), + Flags0 = (int(LhsFlags) | int(RhsFlags)) & ( + HereditaryBits + | (int(LhsFlags) & int(RhsFlags) & + ( (StorageOrdersAgree ? LinearAccessBit : 0) + | (functor_traits::PacketAccess && StorageOrdersAgree && SameType ? PacketAccessBit : 0) + ) + ) + ), + Flags = (Flags0 & ~RowMajorBit) | (LhsFlags & RowMajorBit), + Alignment = EIGEN_PLAIN_ENUM_MIN(evaluator::Alignment,evaluator::Alignment) + }; + + EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE + explicit binary_evaluator(const XprType& xpr) : m_d(xpr) + { + EIGEN_INTERNAL_CHECK_COST_VALUE(functor_traits::Cost); + EIGEN_INTERNAL_CHECK_COST_VALUE(CoeffReadCost); + } + + typedef typename XprType::CoeffReturnType CoeffReturnType; + + EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE + CoeffReturnType coeff(Index row, Index col) const + { + return m_d.func()(m_d.lhsImpl.coeff(row, col), m_d.rhsImpl.coeff(row, col)); + } + + EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE + CoeffReturnType coeff(Index index) const + { + return m_d.func()(m_d.lhsImpl.coeff(index), m_d.rhsImpl.coeff(index)); + } + + template + EIGEN_STRONG_INLINE + PacketType packet(Index row, Index col) const + { + return m_d.func().packetOp(m_d.lhsImpl.template packet(row, col), + m_d.rhsImpl.template packet(row, col)); + } + + template + EIGEN_STRONG_INLINE + PacketType packet(Index index) const + { + return m_d.func().packetOp(m_d.lhsImpl.template packet(index), + m_d.rhsImpl.template packet(index)); + } + +protected: + + // this helper permits to completely eliminate the functor if it is empty + struct Data + { + EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE + Data(const XprType& xpr) : op(xpr.functor()), lhsImpl(xpr.lhs()), rhsImpl(xpr.rhs()) {} + EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE + const BinaryOp& func() const { return op; } + BinaryOp op; + evaluator lhsImpl; + evaluator rhsImpl; + }; + + Data m_d; +}; + +// -------------------- CwiseUnaryView -------------------- + +template +struct unary_evaluator, IndexBased> + : evaluator_base > +{ + typedef CwiseUnaryView XprType; + + enum { + CoeffReadCost = int(evaluator::CoeffReadCost) + int(functor_traits::Cost), + + Flags = (evaluator::Flags & (HereditaryBits | LinearAccessBit | DirectAccessBit)), + + Alignment = 0 // FIXME it is not very clear why alignment is necessarily lost... + }; + + EIGEN_DEVICE_FUNC explicit unary_evaluator(const XprType& op) : m_d(op) + { + EIGEN_INTERNAL_CHECK_COST_VALUE(functor_traits::Cost); + EIGEN_INTERNAL_CHECK_COST_VALUE(CoeffReadCost); + } + + typedef typename XprType::Scalar Scalar; + typedef typename XprType::CoeffReturnType CoeffReturnType; + + EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE + CoeffReturnType coeff(Index row, Index col) const + { + return m_d.func()(m_d.argImpl.coeff(row, col)); + } + + EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE + CoeffReturnType coeff(Index index) const + { + return m_d.func()(m_d.argImpl.coeff(index)); + } + + EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE + Scalar& coeffRef(Index row, Index col) + { + return m_d.func()(m_d.argImpl.coeffRef(row, col)); + } + + EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE + Scalar& coeffRef(Index index) + { + return m_d.func()(m_d.argImpl.coeffRef(index)); + } + +protected: + + // this helper permits to completely eliminate the functor if it is empty + struct Data + { + EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE + Data(const XprType& xpr) : op(xpr.functor()), argImpl(xpr.nestedExpression()) {} + EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE + const UnaryOp& func() const { return op; } + UnaryOp op; + evaluator argImpl; + }; + + Data m_d; +}; + +// -------------------- Map -------------------- + +// FIXME perhaps the PlainObjectType could be provided by Derived::PlainObject ? +// but that might complicate template specialization +template +struct mapbase_evaluator; + +template +struct mapbase_evaluator : evaluator_base +{ + typedef Derived XprType; + typedef typename XprType::PointerType PointerType; + typedef typename XprType::Scalar Scalar; + typedef typename XprType::CoeffReturnType CoeffReturnType; + + enum { + IsRowMajor = XprType::RowsAtCompileTime, + ColsAtCompileTime = XprType::ColsAtCompileTime, + CoeffReadCost = NumTraits::ReadCost + }; + + EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE + explicit mapbase_evaluator(const XprType& map) + : m_data(const_cast(map.data())), + m_innerStride(map.innerStride()), + m_outerStride(map.outerStride()) + { + EIGEN_STATIC_ASSERT(EIGEN_IMPLIES(evaluator::Flags&PacketAccessBit, internal::inner_stride_at_compile_time::ret==1), + PACKET_ACCESS_REQUIRES_TO_HAVE_INNER_STRIDE_FIXED_TO_1); + EIGEN_INTERNAL_CHECK_COST_VALUE(CoeffReadCost); + } + + EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE + CoeffReturnType coeff(Index row, Index col) const + { + return m_data[col * colStride() + row * rowStride()]; + } + + EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE + CoeffReturnType coeff(Index index) const + { + return m_data[index * m_innerStride.value()]; + } + + EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE + Scalar& coeffRef(Index row, Index col) + { + return m_data[col * colStride() + row * rowStride()]; + } + + EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE + Scalar& coeffRef(Index index) + { + return m_data[index * m_innerStride.value()]; + } + + template + EIGEN_STRONG_INLINE + PacketType packet(Index row, Index col) const + { + PointerType ptr = m_data + row * rowStride() + col * colStride(); + return internal::ploadt(ptr); + } + + template + EIGEN_STRONG_INLINE + PacketType packet(Index index) const + { + return internal::ploadt(m_data + index * m_innerStride.value()); + } + + template + EIGEN_STRONG_INLINE + void writePacket(Index row, Index col, const PacketType& x) + { + PointerType ptr = m_data + row * rowStride() + col * colStride(); + return internal::pstoret(ptr, x); + } + + template + EIGEN_STRONG_INLINE + void writePacket(Index index, const PacketType& x) + { + internal::pstoret(m_data + index * m_innerStride.value(), x); + } +protected: + EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE EIGEN_CONSTEXPR + Index rowStride() const EIGEN_NOEXCEPT { + return XprType::IsRowMajor ? m_outerStride.value() : m_innerStride.value(); + } + EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE EIGEN_CONSTEXPR + Index colStride() const EIGEN_NOEXCEPT { + return XprType::IsRowMajor ? m_innerStride.value() : m_outerStride.value(); + } + + PointerType m_data; + const internal::variable_if_dynamic m_innerStride; + const internal::variable_if_dynamic m_outerStride; +}; + +template +struct evaluator > + : public mapbase_evaluator, PlainObjectType> +{ + typedef Map XprType; + typedef typename XprType::Scalar Scalar; + // TODO: should check for smaller packet types once we can handle multi-sized packet types + typedef typename packet_traits::type PacketScalar; + + enum { + InnerStrideAtCompileTime = StrideType::InnerStrideAtCompileTime == 0 + ? int(PlainObjectType::InnerStrideAtCompileTime) + : int(StrideType::InnerStrideAtCompileTime), + OuterStrideAtCompileTime = StrideType::OuterStrideAtCompileTime == 0 + ? int(PlainObjectType::OuterStrideAtCompileTime) + : int(StrideType::OuterStrideAtCompileTime), + HasNoInnerStride = InnerStrideAtCompileTime == 1, + HasNoOuterStride = StrideType::OuterStrideAtCompileTime == 0, + HasNoStride = HasNoInnerStride && HasNoOuterStride, + IsDynamicSize = PlainObjectType::SizeAtCompileTime==Dynamic, + + PacketAccessMask = bool(HasNoInnerStride) ? ~int(0) : ~int(PacketAccessBit), + LinearAccessMask = bool(HasNoStride) || bool(PlainObjectType::IsVectorAtCompileTime) ? ~int(0) : ~int(LinearAccessBit), + Flags = int( evaluator::Flags) & (LinearAccessMask&PacketAccessMask), + + Alignment = int(MapOptions)&int(AlignedMask) + }; + + EIGEN_DEVICE_FUNC explicit evaluator(const XprType& map) + : mapbase_evaluator(map) + { } +}; + +// -------------------- Ref -------------------- + +template +struct evaluator > + : public mapbase_evaluator, PlainObjectType> +{ + typedef Ref XprType; + + enum { + Flags = evaluator >::Flags, + Alignment = evaluator >::Alignment + }; + + EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE + explicit evaluator(const XprType& ref) + : mapbase_evaluator(ref) + { } +}; + +// -------------------- Block -------------------- + +template::ret> struct block_evaluator; + +template +struct evaluator > + : block_evaluator +{ + typedef Block XprType; + typedef typename XprType::Scalar Scalar; + // TODO: should check for smaller packet types once we can handle multi-sized packet types + typedef typename packet_traits::type PacketScalar; + + enum { + CoeffReadCost = evaluator::CoeffReadCost, + + RowsAtCompileTime = traits::RowsAtCompileTime, + ColsAtCompileTime = traits::ColsAtCompileTime, + MaxRowsAtCompileTime = traits::MaxRowsAtCompileTime, + MaxColsAtCompileTime = traits::MaxColsAtCompileTime, + + ArgTypeIsRowMajor = (int(evaluator::Flags)&RowMajorBit) != 0, + IsRowMajor = (MaxRowsAtCompileTime==1 && MaxColsAtCompileTime!=1) ? 1 + : (MaxColsAtCompileTime==1 && MaxRowsAtCompileTime!=1) ? 0 + : ArgTypeIsRowMajor, + HasSameStorageOrderAsArgType = (IsRowMajor == ArgTypeIsRowMajor), + InnerSize = IsRowMajor ? int(ColsAtCompileTime) : int(RowsAtCompileTime), + InnerStrideAtCompileTime = HasSameStorageOrderAsArgType + ? int(inner_stride_at_compile_time::ret) + : int(outer_stride_at_compile_time::ret), + OuterStrideAtCompileTime = HasSameStorageOrderAsArgType + ? int(outer_stride_at_compile_time::ret) + : int(inner_stride_at_compile_time::ret), + MaskPacketAccessBit = (InnerStrideAtCompileTime == 1 || HasSameStorageOrderAsArgType) ? PacketAccessBit : 0, + + FlagsLinearAccessBit = (RowsAtCompileTime == 1 || ColsAtCompileTime == 1 || (InnerPanel && (evaluator::Flags&LinearAccessBit))) ? LinearAccessBit : 0, + FlagsRowMajorBit = XprType::Flags&RowMajorBit, + Flags0 = evaluator::Flags & ( (HereditaryBits & ~RowMajorBit) | + DirectAccessBit | + MaskPacketAccessBit), + Flags = Flags0 | FlagsLinearAccessBit | FlagsRowMajorBit, + + PacketAlignment = unpacket_traits::alignment, + Alignment0 = (InnerPanel && (OuterStrideAtCompileTime!=Dynamic) + && (OuterStrideAtCompileTime!=0) + && (((OuterStrideAtCompileTime * int(sizeof(Scalar))) % int(PacketAlignment)) == 0)) ? int(PacketAlignment) : 0, + Alignment = EIGEN_PLAIN_ENUM_MIN(evaluator::Alignment, Alignment0) + }; + typedef block_evaluator block_evaluator_type; + EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE + explicit evaluator(const XprType& block) : block_evaluator_type(block) + { + EIGEN_INTERNAL_CHECK_COST_VALUE(CoeffReadCost); + } +}; + +// no direct-access => dispatch to a unary evaluator +template +struct block_evaluator + : unary_evaluator > +{ + typedef Block XprType; + + EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE + explicit block_evaluator(const XprType& block) + : unary_evaluator(block) + {} +}; + +template +struct unary_evaluator, IndexBased> + : evaluator_base > +{ + typedef Block XprType; + + EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE + explicit unary_evaluator(const XprType& block) + : m_argImpl(block.nestedExpression()), + m_startRow(block.startRow()), + m_startCol(block.startCol()), + m_linear_offset(ForwardLinearAccess?(ArgType::IsRowMajor ? block.startRow()*block.nestedExpression().cols() + block.startCol() : block.startCol()*block.nestedExpression().rows() + block.startRow()):0) + { } + + typedef typename XprType::Scalar Scalar; + typedef typename XprType::CoeffReturnType CoeffReturnType; + + enum { + RowsAtCompileTime = XprType::RowsAtCompileTime, + ForwardLinearAccess = (InnerPanel || int(XprType::IsRowMajor)==int(ArgType::IsRowMajor)) && bool(evaluator::Flags&LinearAccessBit) + }; + + EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE + CoeffReturnType coeff(Index row, Index col) const + { + return m_argImpl.coeff(m_startRow.value() + row, m_startCol.value() + col); + } + + EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE + CoeffReturnType coeff(Index index) const + { + return linear_coeff_impl(index, bool_constant()); + } + + EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE + Scalar& coeffRef(Index row, Index col) + { + return m_argImpl.coeffRef(m_startRow.value() + row, m_startCol.value() + col); + } + + EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE + Scalar& coeffRef(Index index) + { + return linear_coeffRef_impl(index, bool_constant()); + } + + template + EIGEN_STRONG_INLINE + PacketType packet(Index row, Index col) const + { + return m_argImpl.template packet(m_startRow.value() + row, m_startCol.value() + col); + } + + template + EIGEN_STRONG_INLINE + PacketType packet(Index index) const + { + if (ForwardLinearAccess) + return m_argImpl.template packet(m_linear_offset.value() + index); + else + return packet(RowsAtCompileTime == 1 ? 0 : index, + RowsAtCompileTime == 1 ? index : 0); + } + + template + EIGEN_STRONG_INLINE + void writePacket(Index row, Index col, const PacketType& x) + { + return m_argImpl.template writePacket(m_startRow.value() + row, m_startCol.value() + col, x); + } + + template + EIGEN_STRONG_INLINE + void writePacket(Index index, const PacketType& x) + { + if (ForwardLinearAccess) + return m_argImpl.template writePacket(m_linear_offset.value() + index, x); + else + return writePacket(RowsAtCompileTime == 1 ? 0 : index, + RowsAtCompileTime == 1 ? index : 0, + x); + } + +protected: + EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE + CoeffReturnType linear_coeff_impl(Index index, internal::true_type /* ForwardLinearAccess */) const + { + return m_argImpl.coeff(m_linear_offset.value() + index); + } + EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE + CoeffReturnType linear_coeff_impl(Index index, internal::false_type /* not ForwardLinearAccess */) const + { + return coeff(RowsAtCompileTime == 1 ? 0 : index, RowsAtCompileTime == 1 ? index : 0); + } + + EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE + Scalar& linear_coeffRef_impl(Index index, internal::true_type /* ForwardLinearAccess */) + { + return m_argImpl.coeffRef(m_linear_offset.value() + index); + } + EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE + Scalar& linear_coeffRef_impl(Index index, internal::false_type /* not ForwardLinearAccess */) + { + return coeffRef(RowsAtCompileTime == 1 ? 0 : index, RowsAtCompileTime == 1 ? index : 0); + } + + evaluator m_argImpl; + const variable_if_dynamic m_startRow; + const variable_if_dynamic m_startCol; + const variable_if_dynamic m_linear_offset; +}; + +// TODO: This evaluator does not actually use the child evaluator; +// all action is via the data() as returned by the Block expression. + +template +struct block_evaluator + : mapbase_evaluator, + typename Block::PlainObject> +{ + typedef Block XprType; + typedef typename XprType::Scalar Scalar; + + EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE + explicit block_evaluator(const XprType& block) + : mapbase_evaluator(block) + { + // TODO: for the 3.3 release, this should be turned to an internal assertion, but let's keep it as is for the beta lifetime + eigen_assert(((internal::UIntPtr(block.data()) % EIGEN_PLAIN_ENUM_MAX(1,evaluator::Alignment)) == 0) && "data is not aligned"); + } +}; + + +// -------------------- Select -------------------- +// NOTE shall we introduce a ternary_evaluator? + +// TODO enable vectorization for Select +template +struct evaluator > + : evaluator_base > +{ + typedef Select XprType; + enum { + CoeffReadCost = evaluator::CoeffReadCost + + EIGEN_PLAIN_ENUM_MAX(evaluator::CoeffReadCost, + evaluator::CoeffReadCost), + + Flags = (unsigned int)evaluator::Flags & evaluator::Flags & HereditaryBits, + + Alignment = EIGEN_PLAIN_ENUM_MIN(evaluator::Alignment, evaluator::Alignment) + }; + + EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE + explicit evaluator(const XprType& select) + : m_conditionImpl(select.conditionMatrix()), + m_thenImpl(select.thenMatrix()), + m_elseImpl(select.elseMatrix()) + { + EIGEN_INTERNAL_CHECK_COST_VALUE(CoeffReadCost); + } + + typedef typename XprType::CoeffReturnType CoeffReturnType; + + EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE + CoeffReturnType coeff(Index row, Index col) const + { + if (m_conditionImpl.coeff(row, col)) + return m_thenImpl.coeff(row, col); + else + return m_elseImpl.coeff(row, col); + } + + EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE + CoeffReturnType coeff(Index index) const + { + if (m_conditionImpl.coeff(index)) + return m_thenImpl.coeff(index); + else + return m_elseImpl.coeff(index); + } + +protected: + evaluator m_conditionImpl; + evaluator m_thenImpl; + evaluator m_elseImpl; +}; + + +// -------------------- Replicate -------------------- + +template +struct unary_evaluator > + : evaluator_base > +{ + typedef Replicate XprType; + typedef typename XprType::CoeffReturnType CoeffReturnType; + enum { + Factor = (RowFactor==Dynamic || ColFactor==Dynamic) ? Dynamic : RowFactor*ColFactor + }; + typedef typename internal::nested_eval::type ArgTypeNested; + typedef typename internal::remove_all::type ArgTypeNestedCleaned; + + enum { + CoeffReadCost = evaluator::CoeffReadCost, + LinearAccessMask = XprType::IsVectorAtCompileTime ? LinearAccessBit : 0, + Flags = (evaluator::Flags & (HereditaryBits|LinearAccessMask) & ~RowMajorBit) | (traits::Flags & RowMajorBit), + + Alignment = evaluator::Alignment + }; + + EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE + explicit unary_evaluator(const XprType& replicate) + : m_arg(replicate.nestedExpression()), + m_argImpl(m_arg), + m_rows(replicate.nestedExpression().rows()), + m_cols(replicate.nestedExpression().cols()) + {} + + EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE + CoeffReturnType coeff(Index row, Index col) const + { + // try to avoid using modulo; this is a pure optimization strategy + const Index actual_row = internal::traits::RowsAtCompileTime==1 ? 0 + : RowFactor==1 ? row + : row % m_rows.value(); + const Index actual_col = internal::traits::ColsAtCompileTime==1 ? 0 + : ColFactor==1 ? col + : col % m_cols.value(); + + return m_argImpl.coeff(actual_row, actual_col); + } + + EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE + CoeffReturnType coeff(Index index) const + { + // try to avoid using modulo; this is a pure optimization strategy + const Index actual_index = internal::traits::RowsAtCompileTime==1 + ? (ColFactor==1 ? index : index%m_cols.value()) + : (RowFactor==1 ? index : index%m_rows.value()); + + return m_argImpl.coeff(actual_index); + } + + template + EIGEN_STRONG_INLINE + PacketType packet(Index row, Index col) const + { + const Index actual_row = internal::traits::RowsAtCompileTime==1 ? 0 + : RowFactor==1 ? row + : row % m_rows.value(); + const Index actual_col = internal::traits::ColsAtCompileTime==1 ? 0 + : ColFactor==1 ? col + : col % m_cols.value(); + + return m_argImpl.template packet(actual_row, actual_col); + } + + template + EIGEN_STRONG_INLINE + PacketType packet(Index index) const + { + const Index actual_index = internal::traits::RowsAtCompileTime==1 + ? (ColFactor==1 ? index : index%m_cols.value()) + : (RowFactor==1 ? index : index%m_rows.value()); + + return m_argImpl.template packet(actual_index); + } + +protected: + const ArgTypeNested m_arg; + evaluator m_argImpl; + const variable_if_dynamic m_rows; + const variable_if_dynamic m_cols; +}; + +// -------------------- MatrixWrapper and ArrayWrapper -------------------- +// +// evaluator_wrapper_base is a common base class for the +// MatrixWrapper and ArrayWrapper evaluators. + +template +struct evaluator_wrapper_base + : evaluator_base +{ + typedef typename remove_all::type ArgType; + enum { + CoeffReadCost = evaluator::CoeffReadCost, + Flags = evaluator::Flags, + Alignment = evaluator::Alignment + }; + + EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE + explicit evaluator_wrapper_base(const ArgType& arg) : m_argImpl(arg) {} + + typedef typename ArgType::Scalar Scalar; + typedef typename ArgType::CoeffReturnType CoeffReturnType; + + EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE + CoeffReturnType coeff(Index row, Index col) const + { + return m_argImpl.coeff(row, col); + } + + EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE + CoeffReturnType coeff(Index index) const + { + return m_argImpl.coeff(index); + } + + EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE + Scalar& coeffRef(Index row, Index col) + { + return m_argImpl.coeffRef(row, col); + } + + EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE + Scalar& coeffRef(Index index) + { + return m_argImpl.coeffRef(index); + } + + template + EIGEN_STRONG_INLINE + PacketType packet(Index row, Index col) const + { + return m_argImpl.template packet(row, col); + } + + template + EIGEN_STRONG_INLINE + PacketType packet(Index index) const + { + return m_argImpl.template packet(index); + } + + template + EIGEN_STRONG_INLINE + void writePacket(Index row, Index col, const PacketType& x) + { + m_argImpl.template writePacket(row, col, x); + } + + template + EIGEN_STRONG_INLINE + void writePacket(Index index, const PacketType& x) + { + m_argImpl.template writePacket(index, x); + } + +protected: + evaluator m_argImpl; +}; + +template +struct unary_evaluator > + : evaluator_wrapper_base > +{ + typedef MatrixWrapper XprType; + + EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE + explicit unary_evaluator(const XprType& wrapper) + : evaluator_wrapper_base >(wrapper.nestedExpression()) + { } +}; + +template +struct unary_evaluator > + : evaluator_wrapper_base > +{ + typedef ArrayWrapper XprType; + + EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE + explicit unary_evaluator(const XprType& wrapper) + : evaluator_wrapper_base >(wrapper.nestedExpression()) + { } +}; + + +// -------------------- Reverse -------------------- + +// defined in Reverse.h: +template struct reverse_packet_cond; + +template +struct unary_evaluator > + : evaluator_base > +{ + typedef Reverse XprType; + typedef typename XprType::Scalar Scalar; + typedef typename XprType::CoeffReturnType CoeffReturnType; + + enum { + IsRowMajor = XprType::IsRowMajor, + IsColMajor = !IsRowMajor, + ReverseRow = (Direction == Vertical) || (Direction == BothDirections), + ReverseCol = (Direction == Horizontal) || (Direction == BothDirections), + ReversePacket = (Direction == BothDirections) + || ((Direction == Vertical) && IsColMajor) + || ((Direction == Horizontal) && IsRowMajor), + + CoeffReadCost = evaluator::CoeffReadCost, + + // let's enable LinearAccess only with vectorization because of the product overhead + // FIXME enable DirectAccess with negative strides? + Flags0 = evaluator::Flags, + LinearAccess = ( (Direction==BothDirections) && (int(Flags0)&PacketAccessBit) ) + || ((ReverseRow && XprType::ColsAtCompileTime==1) || (ReverseCol && XprType::RowsAtCompileTime==1)) + ? LinearAccessBit : 0, + + Flags = int(Flags0) & (HereditaryBits | PacketAccessBit | LinearAccess), + + Alignment = 0 // FIXME in some rare cases, Alignment could be preserved, like a Vector4f. + }; + + EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE + explicit unary_evaluator(const XprType& reverse) + : m_argImpl(reverse.nestedExpression()), + m_rows(ReverseRow ? reverse.nestedExpression().rows() : 1), + m_cols(ReverseCol ? reverse.nestedExpression().cols() : 1) + { } + + EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE + CoeffReturnType coeff(Index row, Index col) const + { + return m_argImpl.coeff(ReverseRow ? m_rows.value() - row - 1 : row, + ReverseCol ? m_cols.value() - col - 1 : col); + } + + EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE + CoeffReturnType coeff(Index index) const + { + return m_argImpl.coeff(m_rows.value() * m_cols.value() - index - 1); + } + + EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE + Scalar& coeffRef(Index row, Index col) + { + return m_argImpl.coeffRef(ReverseRow ? m_rows.value() - row - 1 : row, + ReverseCol ? m_cols.value() - col - 1 : col); + } + + EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE + Scalar& coeffRef(Index index) + { + return m_argImpl.coeffRef(m_rows.value() * m_cols.value() - index - 1); + } + + template + EIGEN_STRONG_INLINE + PacketType packet(Index row, Index col) const + { + enum { + PacketSize = unpacket_traits::size, + OffsetRow = ReverseRow && IsColMajor ? PacketSize : 1, + OffsetCol = ReverseCol && IsRowMajor ? PacketSize : 1 + }; + typedef internal::reverse_packet_cond reverse_packet; + return reverse_packet::run(m_argImpl.template packet( + ReverseRow ? m_rows.value() - row - OffsetRow : row, + ReverseCol ? m_cols.value() - col - OffsetCol : col)); + } + + template + EIGEN_STRONG_INLINE + PacketType packet(Index index) const + { + enum { PacketSize = unpacket_traits::size }; + return preverse(m_argImpl.template packet(m_rows.value() * m_cols.value() - index - PacketSize)); + } + + template + EIGEN_STRONG_INLINE + void writePacket(Index row, Index col, const PacketType& x) + { + // FIXME we could factorize some code with packet(i,j) + enum { + PacketSize = unpacket_traits::size, + OffsetRow = ReverseRow && IsColMajor ? PacketSize : 1, + OffsetCol = ReverseCol && IsRowMajor ? PacketSize : 1 + }; + typedef internal::reverse_packet_cond reverse_packet; + m_argImpl.template writePacket( + ReverseRow ? m_rows.value() - row - OffsetRow : row, + ReverseCol ? m_cols.value() - col - OffsetCol : col, + reverse_packet::run(x)); + } + + template + EIGEN_STRONG_INLINE + void writePacket(Index index, const PacketType& x) + { + enum { PacketSize = unpacket_traits::size }; + m_argImpl.template writePacket + (m_rows.value() * m_cols.value() - index - PacketSize, preverse(x)); + } + +protected: + evaluator m_argImpl; + + // If we do not reverse rows, then we do not need to know the number of rows; same for columns + // Nonetheless, in this case it is important to set to 1 such that the coeff(index) method works fine for vectors. + const variable_if_dynamic m_rows; + const variable_if_dynamic m_cols; +}; + + +// -------------------- Diagonal -------------------- + +template +struct evaluator > + : evaluator_base > +{ + typedef Diagonal XprType; + + enum { + CoeffReadCost = evaluator::CoeffReadCost, + + Flags = (unsigned int)(evaluator::Flags & (HereditaryBits | DirectAccessBit) & ~RowMajorBit) | LinearAccessBit, + + Alignment = 0 + }; + + EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE + explicit evaluator(const XprType& diagonal) + : m_argImpl(diagonal.nestedExpression()), + m_index(diagonal.index()) + { } + + typedef typename XprType::Scalar Scalar; + typedef typename XprType::CoeffReturnType CoeffReturnType; + + EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE + CoeffReturnType coeff(Index row, Index) const + { + return m_argImpl.coeff(row + rowOffset(), row + colOffset()); + } + + EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE + CoeffReturnType coeff(Index index) const + { + return m_argImpl.coeff(index + rowOffset(), index + colOffset()); + } + + EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE + Scalar& coeffRef(Index row, Index) + { + return m_argImpl.coeffRef(row + rowOffset(), row + colOffset()); + } + + EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE + Scalar& coeffRef(Index index) + { + return m_argImpl.coeffRef(index + rowOffset(), index + colOffset()); + } + +protected: + evaluator m_argImpl; + const internal::variable_if_dynamicindex m_index; + +private: + EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE EIGEN_CONSTEXPR + Index rowOffset() const { return m_index.value() > 0 ? 0 : -m_index.value(); } + EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE EIGEN_CONSTEXPR + Index colOffset() const { return m_index.value() > 0 ? m_index.value() : 0; } +}; + + +//---------------------------------------------------------------------- +// deprecated code +//---------------------------------------------------------------------- + +// -------------------- EvalToTemp -------------------- + +// expression class for evaluating nested expression to a temporary + +template class EvalToTemp; + +template +struct traits > + : public traits +{ }; + +template +class EvalToTemp + : public dense_xpr_base >::type +{ + public: + + typedef typename dense_xpr_base::type Base; + EIGEN_GENERIC_PUBLIC_INTERFACE(EvalToTemp) + + explicit EvalToTemp(const ArgType& arg) + : m_arg(arg) + { } + + const ArgType& arg() const + { + return m_arg; + } + + EIGEN_CONSTEXPR Index rows() const EIGEN_NOEXCEPT + { + return m_arg.rows(); + } + + EIGEN_CONSTEXPR Index cols() const EIGEN_NOEXCEPT + { + return m_arg.cols(); + } + + private: + const ArgType& m_arg; +}; + +template +struct evaluator > + : public evaluator +{ + typedef EvalToTemp XprType; + typedef typename ArgType::PlainObject PlainObject; + typedef evaluator Base; + + EIGEN_DEVICE_FUNC explicit evaluator(const XprType& xpr) + : m_result(xpr.arg()) + { + ::new (static_cast(this)) Base(m_result); + } + + // This constructor is used when nesting an EvalTo evaluator in another evaluator + EIGEN_DEVICE_FUNC evaluator(const ArgType& arg) + : m_result(arg) + { + ::new (static_cast(this)) Base(m_result); + } + +protected: + PlainObject m_result; +}; + +} // namespace internal + +} // end namespace Eigen + +#endif // EIGEN_COREEVALUATORS_H diff --git a/extern/eigen/Eigen/src/Core/CoreIterators.h b/extern/eigen/Eigen/src/Core/CoreIterators.h index 6da4683d..b9671968 100644 --- a/extern/eigen/Eigen/src/Core/CoreIterators.h +++ b/extern/eigen/Eigen/src/Core/CoreIterators.h @@ -1,7 +1,7 @@ // This file is part of Eigen, a lightweight C++ template library // for linear algebra. // -// Copyright (C) 2008-2010 Gael Guennebaud +// Copyright (C) 2008-2014 Gael Guennebaud // // This Source Code Form is subject to the terms of the Mozilla // Public License v. 2.0. If a copy of the MPL was not distributed @@ -15,47 +15,118 @@ namespace Eigen { /* This file contains the respective InnerIterator definition of the expressions defined in Eigen/Core */ -/** \ingroup SparseCore_Module - * \class InnerIterator - * \brief An InnerIterator allows to loop over the element of a sparse (or dense) matrix or expression - * - * todo +namespace internal { + +template +class inner_iterator_selector; + +} + +/** \class InnerIterator + * \brief An InnerIterator allows to loop over the element of any matrix expression. + * + * \warning To be used with care because an evaluator is constructed every time an InnerIterator iterator is constructed. + * + * TODO: add a usage example */ +template +class InnerIterator +{ +protected: + typedef internal::inner_iterator_selector::Kind> IteratorType; + typedef internal::evaluator EvaluatorType; + typedef typename internal::traits::Scalar Scalar; +public: + /** Construct an iterator over the \a outerId -th row or column of \a xpr */ + InnerIterator(const XprType &xpr, const Index &outerId) + : m_eval(xpr), m_iter(m_eval, outerId, xpr.innerSize()) + {} + + /// \returns the value of the current coefficient. + EIGEN_STRONG_INLINE Scalar value() const { return m_iter.value(); } + /** Increment the iterator \c *this to the next non-zero coefficient. + * Explicit zeros are not skipped over. To skip explicit zeros, see class SparseView + */ + EIGEN_STRONG_INLINE InnerIterator& operator++() { m_iter.operator++(); return *this; } + EIGEN_STRONG_INLINE InnerIterator& operator+=(Index i) { m_iter.operator+=(i); return *this; } + EIGEN_STRONG_INLINE InnerIterator operator+(Index i) + { InnerIterator result(*this); result+=i; return result; } + + + /// \returns the column or row index of the current coefficient. + EIGEN_STRONG_INLINE Index index() const { return m_iter.index(); } + /// \returns the row index of the current coefficient. + EIGEN_STRONG_INLINE Index row() const { return m_iter.row(); } + /// \returns the column index of the current coefficient. + EIGEN_STRONG_INLINE Index col() const { return m_iter.col(); } + /// \returns \c true if the iterator \c *this still references a valid coefficient. + EIGEN_STRONG_INLINE operator bool() const { return m_iter; } + +protected: + EvaluatorType m_eval; + IteratorType m_iter; +private: + // If you get here, then you're not using the right InnerIterator type, e.g.: + // SparseMatrix A; + // SparseMatrix::InnerIterator it(A,0); + template InnerIterator(const EigenBase&,Index outer); +}; + +namespace internal { + +// Generic inner iterator implementation for dense objects +template +class inner_iterator_selector +{ +protected: + typedef evaluator EvaluatorType; + typedef typename traits::Scalar Scalar; + enum { IsRowMajor = (XprType::Flags&RowMajorBit)==RowMajorBit }; + +public: + EIGEN_STRONG_INLINE inner_iterator_selector(const EvaluatorType &eval, const Index &outerId, const Index &innerSize) + : m_eval(eval), m_inner(0), m_outer(outerId), m_end(innerSize) + {} + + EIGEN_STRONG_INLINE Scalar value() const + { + return (IsRowMajor) ? m_eval.coeff(m_outer, m_inner) + : m_eval.coeff(m_inner, m_outer); + } + + EIGEN_STRONG_INLINE inner_iterator_selector& operator++() { m_inner++; return *this; } + + EIGEN_STRONG_INLINE Index index() const { return m_inner; } + inline Index row() const { return IsRowMajor ? m_outer : index(); } + inline Index col() const { return IsRowMajor ? index() : m_outer; } -// generic version for dense matrix and expressions -template class DenseBase::InnerIterator + EIGEN_STRONG_INLINE operator bool() const { return m_inner < m_end && m_inner>=0; } + +protected: + const EvaluatorType& m_eval; + Index m_inner; + const Index m_outer; + const Index m_end; +}; + +// For iterator-based evaluator, inner-iterator is already implemented as +// evaluator<>::InnerIterator +template +class inner_iterator_selector + : public evaluator::InnerIterator { - protected: - typedef typename Derived::Scalar Scalar; - typedef typename Derived::Index Index; - - enum { IsRowMajor = (Derived::Flags&RowMajorBit)==RowMajorBit }; - public: - EIGEN_STRONG_INLINE InnerIterator(const Derived& expr, Index outer) - : m_expression(expr), m_inner(0), m_outer(outer), m_end(expr.innerSize()) - {} - - EIGEN_STRONG_INLINE Scalar value() const - { - return (IsRowMajor) ? m_expression.coeff(m_outer, m_inner) - : m_expression.coeff(m_inner, m_outer); - } - - EIGEN_STRONG_INLINE InnerIterator& operator++() { m_inner++; return *this; } - - EIGEN_STRONG_INLINE Index index() const { return m_inner; } - inline Index row() const { return IsRowMajor ? m_outer : index(); } - inline Index col() const { return IsRowMajor ? index() : m_outer; } - - EIGEN_STRONG_INLINE operator bool() const { return m_inner < m_end && m_inner>=0; } - - protected: - const Derived& m_expression; - Index m_inner; - const Index m_outer; - const Index m_end; +protected: + typedef typename evaluator::InnerIterator Base; + typedef evaluator EvaluatorType; + +public: + EIGEN_STRONG_INLINE inner_iterator_selector(const EvaluatorType &eval, const Index &outerId, const Index &/*innerSize*/) + : Base(eval, outerId) + {} }; +} // end namespace internal + } // end namespace Eigen #endif // EIGEN_COREITERATORS_H diff --git a/extern/eigen/Eigen/src/Core/CwiseBinaryOp.h b/extern/eigen/Eigen/src/Core/CwiseBinaryOp.h index 519a866e..2202b1cc 100644 --- a/extern/eigen/Eigen/src/Core/CwiseBinaryOp.h +++ b/extern/eigen/Eigen/src/Core/CwiseBinaryOp.h @@ -1,7 +1,7 @@ // This file is part of Eigen, a lightweight C++ template library // for linear algebra. // -// Copyright (C) 2008-2009 Gael Guennebaud +// Copyright (C) 2008-2014 Gael Guennebaud // Copyright (C) 2006-2008 Benoit Jacob // // This Source Code Form is subject to the terms of the Mozilla @@ -13,26 +13,6 @@ namespace Eigen { -/** \class CwiseBinaryOp - * \ingroup Core_Module - * - * \brief Generic expression where a coefficient-wise binary operator is applied to two expressions - * - * \param BinaryOp template functor implementing the operator - * \param Lhs the type of the left-hand side - * \param Rhs the type of the right-hand side - * - * This class represents an expression where a coefficient-wise binary operator is applied to two expressions. - * It is the return type of binary operators, by which we mean only those binary operators where - * both the left-hand side and the right-hand side are Eigen expressions. - * For example, the return type of matrix1+matrix2 is a CwiseBinaryOp. - * - * Most of the time, this is the only way that it is used, so you typically don't have to name - * CwiseBinaryOp types explicitly. - * - * \sa MatrixBase::binaryExpr(const MatrixBase &,const CustomBinaryOp &) const, class CwiseUnaryOp, class CwiseNullaryOp - */ - namespace internal { template struct traits > @@ -52,78 +32,82 @@ struct traits > // we still want to handle the case when the result type is different. typedef typename result_of< BinaryOp( - typename Lhs::Scalar, - typename Rhs::Scalar + const typename Lhs::Scalar&, + const typename Rhs::Scalar& ) >::type Scalar; - typedef typename promote_storage_type::StorageKind, - typename traits::StorageKind>::ret StorageKind; - typedef typename promote_index_type::Index, - typename traits::Index>::type Index; + typedef typename cwise_promote_storage_type::StorageKind, + typename traits::StorageKind, + BinaryOp>::ret StorageKind; + typedef typename promote_index_type::StorageIndex, + typename traits::StorageIndex>::type StorageIndex; typedef typename Lhs::Nested LhsNested; typedef typename Rhs::Nested RhsNested; typedef typename remove_reference::type _LhsNested; typedef typename remove_reference::type _RhsNested; enum { - LhsCoeffReadCost = _LhsNested::CoeffReadCost, - RhsCoeffReadCost = _RhsNested::CoeffReadCost, - LhsFlags = _LhsNested::Flags, - RhsFlags = _RhsNested::Flags, - SameType = is_same::value, - StorageOrdersAgree = (int(Lhs::Flags)&RowMajorBit)==(int(Rhs::Flags)&RowMajorBit), - Flags0 = (int(LhsFlags) | int(RhsFlags)) & ( - HereditaryBits - | (int(LhsFlags) & int(RhsFlags) & - ( AlignedBit - | (StorageOrdersAgree ? LinearAccessBit : 0) - | (functor_traits::PacketAccess && StorageOrdersAgree && SameType ? PacketAccessBit : 0) - ) - ) - ), - Flags = (Flags0 & ~RowMajorBit) | (LhsFlags & RowMajorBit), - Cost0 = EIGEN_ADD_COST(LhsCoeffReadCost,RhsCoeffReadCost), - CoeffReadCost = EIGEN_ADD_COST(Cost0,functor_traits::Cost) + Flags = cwise_promote_storage_order::StorageKind,typename traits::StorageKind,_LhsNested::Flags & RowMajorBit,_RhsNested::Flags & RowMajorBit>::value }; }; } // end namespace internal -// we require Lhs and Rhs to have the same scalar type. Currently there is no example of a binary functor -// that would take two operands of different types. If there were such an example, then this check should be -// moved to the BinaryOp functors, on a per-case basis. This would however require a change in the BinaryOp functors, as -// currently they take only one typename Scalar template parameter. -// It is tempting to always allow mixing different types but remember that this is often impossible in the vectorized paths. -// So allowing mixing different types gives very unexpected errors when enabling vectorization, when the user tries to -// add together a float matrix and a double matrix. -#define EIGEN_CHECK_BINARY_COMPATIBILIY(BINOP,LHS,RHS) \ - EIGEN_STATIC_ASSERT((internal::functor_is_product_like::ret \ - ? int(internal::scalar_product_traits::Defined) \ - : int(internal::is_same::value)), \ - YOU_MIXED_DIFFERENT_NUMERIC_TYPES__YOU_NEED_TO_USE_THE_CAST_METHOD_OF_MATRIXBASE_TO_CAST_NUMERIC_TYPES_EXPLICITLY) - template class CwiseBinaryOpImpl; -template -class CwiseBinaryOp : internal::no_assignment_operator, +/** \class CwiseBinaryOp + * \ingroup Core_Module + * + * \brief Generic expression where a coefficient-wise binary operator is applied to two expressions + * + * \tparam BinaryOp template functor implementing the operator + * \tparam LhsType the type of the left-hand side + * \tparam RhsType the type of the right-hand side + * + * This class represents an expression where a coefficient-wise binary operator is applied to two expressions. + * It is the return type of binary operators, by which we mean only those binary operators where + * both the left-hand side and the right-hand side are Eigen expressions. + * For example, the return type of matrix1+matrix2 is a CwiseBinaryOp. + * + * Most of the time, this is the only way that it is used, so you typically don't have to name + * CwiseBinaryOp types explicitly. + * + * \sa MatrixBase::binaryExpr(const MatrixBase &,const CustomBinaryOp &) const, class CwiseUnaryOp, class CwiseNullaryOp + */ +template +class CwiseBinaryOp : public CwiseBinaryOpImpl< - BinaryOp, Lhs, Rhs, - typename internal::promote_storage_type::StorageKind, - typename internal::traits::StorageKind>::ret> + BinaryOp, LhsType, RhsType, + typename internal::cwise_promote_storage_type::StorageKind, + typename internal::traits::StorageKind, + BinaryOp>::ret>, + internal::no_assignment_operator { public: + typedef typename internal::remove_all::type Functor; + typedef typename internal::remove_all::type Lhs; + typedef typename internal::remove_all::type Rhs; + typedef typename CwiseBinaryOpImpl< - BinaryOp, Lhs, Rhs, - typename internal::promote_storage_type::StorageKind, - typename internal::traits::StorageKind>::ret>::Base Base; + BinaryOp, LhsType, RhsType, + typename internal::cwise_promote_storage_type::StorageKind, + typename internal::traits::StorageKind, + BinaryOp>::ret>::Base Base; EIGEN_GENERIC_PUBLIC_INTERFACE(CwiseBinaryOp) - typedef typename internal::nested::type LhsNested; - typedef typename internal::nested::type RhsNested; + typedef typename internal::ref_selector::type LhsNested; + typedef typename internal::ref_selector::type RhsNested; typedef typename internal::remove_reference::type _LhsNested; typedef typename internal::remove_reference::type _RhsNested; - EIGEN_STRONG_INLINE CwiseBinaryOp(const Lhs& aLhs, const Rhs& aRhs, const BinaryOp& func = BinaryOp()) +#if EIGEN_COMP_MSVC && EIGEN_HAS_CXX11 + //Required for Visual Studio or the Copy constructor will probably not get inlined! + EIGEN_STRONG_INLINE + CwiseBinaryOp(const CwiseBinaryOp&) = default; +#endif + + EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE + CwiseBinaryOp(const Lhs& aLhs, const Rhs& aRhs, const BinaryOp& func = BinaryOp()) : m_lhs(aLhs), m_rhs(aRhs), m_functor(func) { EIGEN_CHECK_BINARY_COMPATIBILIY(BinaryOp,typename Lhs::Scalar,typename Rhs::Scalar); @@ -132,26 +116,25 @@ class CwiseBinaryOp : internal::no_assignment_operator, eigen_assert(aLhs.rows() == aRhs.rows() && aLhs.cols() == aRhs.cols()); } - EIGEN_STRONG_INLINE Index rows() const { + EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE EIGEN_CONSTEXPR + Index rows() const EIGEN_NOEXCEPT { // return the fixed size type if available to enable compile time optimizations - if (internal::traits::type>::RowsAtCompileTime==Dynamic) - return m_rhs.rows(); - else - return m_lhs.rows(); + return internal::traits::type>::RowsAtCompileTime==Dynamic ? m_rhs.rows() : m_lhs.rows(); } - EIGEN_STRONG_INLINE Index cols() const { + EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE EIGEN_CONSTEXPR + Index cols() const EIGEN_NOEXCEPT { // return the fixed size type if available to enable compile time optimizations - if (internal::traits::type>::ColsAtCompileTime==Dynamic) - return m_rhs.cols(); - else - return m_lhs.cols(); + return internal::traits::type>::ColsAtCompileTime==Dynamic ? m_rhs.cols() : m_lhs.cols(); } /** \returns the left hand side nested expression */ + EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE const _LhsNested& lhs() const { return m_lhs; } /** \returns the right hand side nested expression */ + EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE const _RhsNested& rhs() const { return m_rhs; } /** \returns the functor representing the binary operation */ + EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE const BinaryOp& functor() const { return m_functor; } protected: @@ -160,41 +143,13 @@ class CwiseBinaryOp : internal::no_assignment_operator, const BinaryOp m_functor; }; -template -class CwiseBinaryOpImpl - : public internal::dense_xpr_base >::type +// Generic API dispatcher +template +class CwiseBinaryOpImpl + : public internal::generic_xpr_base >::type { - typedef CwiseBinaryOp Derived; - public: - - typedef typename internal::dense_xpr_base >::type Base; - EIGEN_DENSE_PUBLIC_INTERFACE( Derived ) - - EIGEN_STRONG_INLINE const Scalar coeff(Index rowId, Index colId) const - { - return derived().functor()(derived().lhs().coeff(rowId, colId), - derived().rhs().coeff(rowId, colId)); - } - - template - EIGEN_STRONG_INLINE PacketScalar packet(Index rowId, Index colId) const - { - return derived().functor().packetOp(derived().lhs().template packet(rowId, colId), - derived().rhs().template packet(rowId, colId)); - } - - EIGEN_STRONG_INLINE const Scalar coeff(Index index) const - { - return derived().functor()(derived().lhs().coeff(index), - derived().rhs().coeff(index)); - } - - template - EIGEN_STRONG_INLINE PacketScalar packet(Index index) const - { - return derived().functor().packetOp(derived().lhs().template packet(index), - derived().rhs().template packet(index)); - } +public: + typedef typename internal::generic_xpr_base >::type Base; }; /** replaces \c *this by \c *this - \a other. @@ -203,11 +158,10 @@ class CwiseBinaryOpImpl */ template template -EIGEN_STRONG_INLINE Derived & +EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Derived & MatrixBase::operator-=(const MatrixBase &other) { - SelfCwiseBinaryOp, Derived, OtherDerived> tmp(derived()); - tmp = other.derived(); + call_assignment(derived(), other.derived(), internal::sub_assign_op()); return derived(); } @@ -217,11 +171,10 @@ MatrixBase::operator-=(const MatrixBase &other) */ template template -EIGEN_STRONG_INLINE Derived & +EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Derived & MatrixBase::operator+=(const MatrixBase& other) { - SelfCwiseBinaryOp, Derived, OtherDerived> tmp(derived()); - tmp = other.derived(); + call_assignment(derived(), other.derived(), internal::add_assign_op()); return derived(); } diff --git a/extern/eigen/Eigen/src/Core/CwiseNullaryOp.h b/extern/eigen/Eigen/src/Core/CwiseNullaryOp.h index a93bab2d..289ec510 100644 --- a/extern/eigen/Eigen/src/Core/CwiseNullaryOp.h +++ b/extern/eigen/Eigen/src/Core/CwiseNullaryOp.h @@ -12,13 +12,24 @@ namespace Eigen { +namespace internal { +template +struct traits > : traits +{ + enum { + Flags = traits::Flags & RowMajorBit + }; +}; + +} // namespace internal + /** \class CwiseNullaryOp * \ingroup Core_Module * * \brief Generic expression of a matrix where all coefficients are defined by a functor * - * \param NullaryOp template functor implementing the operator - * \param PlainObjectType the underlying plain matrix/array type + * \tparam NullaryOp template functor implementing the operator + * \tparam PlainObjectType the underlying plain matrix/array type * * This class represents an expression of a generic nullary operator. * It is the return type of the Ones(), Zero(), Constant(), Identity() and Random() methods, @@ -27,68 +38,49 @@ namespace Eigen { * However, if you want to write a function returning such an expression, you * will need to use this class. * - * \sa class CwiseUnaryOp, class CwiseBinaryOp, DenseBase::NullaryExpr() + * The functor NullaryOp must expose one of the following method: + + + + +
\c operator()() if the procedural generation does not depend on the coefficient entries (e.g., random numbers)
\c operator()(Index i)if the procedural generation makes sense for vectors only and that it depends on the coefficient index \c i (e.g., linspace)
\c operator()(Index i,Index j)if the procedural generation depends on the matrix coordinates \c i, \c j (e.g., to generate a checkerboard with 0 and 1)
+ * It is also possible to expose the last two operators if the generation makes sense for matrices but can be optimized for vectors. + * + * See DenseBase::NullaryExpr(Index,const CustomNullaryOp&) for an example binding + * C++11 random number generators. + * + * A nullary expression can also be used to implement custom sophisticated matrix manipulations + * that cannot be covered by the existing set of natively supported matrix manipulations. + * See this \ref TopicCustomizing_NullaryExpr "page" for some examples and additional explanations + * on the behavior of CwiseNullaryOp. + * + * \sa class CwiseUnaryOp, class CwiseBinaryOp, DenseBase::NullaryExpr */ - -namespace internal { template -struct traits > : traits -{ - enum { - Flags = (traits::Flags - & ( HereditaryBits - | (functor_has_linear_access::ret ? LinearAccessBit : 0) - | (functor_traits::PacketAccess ? PacketAccessBit : 0))) - | (functor_traits::IsRepeatable ? 0 : EvalBeforeNestingBit), - CoeffReadCost = functor_traits::Cost - }; -}; -} - -template -class CwiseNullaryOp : internal::no_assignment_operator, - public internal::dense_xpr_base< CwiseNullaryOp >::type +class CwiseNullaryOp : public internal::dense_xpr_base< CwiseNullaryOp >::type, internal::no_assignment_operator { public: typedef typename internal::dense_xpr_base::type Base; EIGEN_DENSE_PUBLIC_INTERFACE(CwiseNullaryOp) - CwiseNullaryOp(Index nbRows, Index nbCols, const NullaryOp& func = NullaryOp()) - : m_rows(nbRows), m_cols(nbCols), m_functor(func) - { - eigen_assert(nbRows >= 0 - && (RowsAtCompileTime == Dynamic || RowsAtCompileTime == nbRows) - && nbCols >= 0 - && (ColsAtCompileTime == Dynamic || ColsAtCompileTime == nbCols)); - } - - EIGEN_STRONG_INLINE Index rows() const { return m_rows.value(); } - EIGEN_STRONG_INLINE Index cols() const { return m_cols.value(); } - - EIGEN_STRONG_INLINE const Scalar coeff(Index rowId, Index colId) const - { - return m_functor(rowId, colId); - } - - template - EIGEN_STRONG_INLINE PacketScalar packet(Index rowId, Index colId) const + EIGEN_DEVICE_FUNC + CwiseNullaryOp(Index rows, Index cols, const NullaryOp& func = NullaryOp()) + : m_rows(rows), m_cols(cols), m_functor(func) { - return m_functor.packetOp(rowId, colId); + eigen_assert(rows >= 0 + && (RowsAtCompileTime == Dynamic || RowsAtCompileTime == rows) + && cols >= 0 + && (ColsAtCompileTime == Dynamic || ColsAtCompileTime == cols)); } - EIGEN_STRONG_INLINE const Scalar coeff(Index index) const - { - return m_functor(index); - } - - template - EIGEN_STRONG_INLINE PacketScalar packet(Index index) const - { - return m_functor.packetOp(index); - } + EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE EIGEN_CONSTEXPR + Index rows() const { return m_rows.value(); } + EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE EIGEN_CONSTEXPR + Index cols() const { return m_cols.value(); } /** \returns the functor representing the nullary operation */ + EIGEN_DEVICE_FUNC const NullaryOp& functor() const { return m_functor; } protected: @@ -113,10 +105,15 @@ class CwiseNullaryOp : internal::no_assignment_operator, */ template template -EIGEN_STRONG_INLINE const CwiseNullaryOp +EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE +#ifndef EIGEN_PARSED_BY_DOXYGEN +const CwiseNullaryOp::PlainObject> +#else +const CwiseNullaryOp +#endif DenseBase::NullaryExpr(Index rows, Index cols, const CustomNullaryOp& func) { - return CwiseNullaryOp(rows, cols, func); + return CwiseNullaryOp(rows, cols, func); } /** \returns an expression of a matrix defined by a custom functor \a func @@ -132,16 +129,24 @@ DenseBase::NullaryExpr(Index rows, Index cols, const CustomNullaryOp& f * * The template parameter \a CustomNullaryOp is the type of the functor. * + * Here is an example with C++11 random generators: \include random_cpp11.cpp + * Output: \verbinclude random_cpp11.out + * * \sa class CwiseNullaryOp */ template template -EIGEN_STRONG_INLINE const CwiseNullaryOp +EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE +#ifndef EIGEN_PARSED_BY_DOXYGEN +const CwiseNullaryOp::PlainObject> +#else +const CwiseNullaryOp +#endif DenseBase::NullaryExpr(Index size, const CustomNullaryOp& func) { EIGEN_STATIC_ASSERT_VECTOR_ONLY(Derived) - if(RowsAtCompileTime == 1) return CwiseNullaryOp(1, size, func); - else return CwiseNullaryOp(size, 1, func); + if(RowsAtCompileTime == 1) return CwiseNullaryOp(1, size, func); + else return CwiseNullaryOp(size, 1, func); } /** \returns an expression of a matrix defined by a custom functor \a func @@ -155,19 +160,24 @@ DenseBase::NullaryExpr(Index size, const CustomNullaryOp& func) */ template template -EIGEN_STRONG_INLINE const CwiseNullaryOp +EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE +#ifndef EIGEN_PARSED_BY_DOXYGEN +const CwiseNullaryOp::PlainObject> +#else +const CwiseNullaryOp +#endif DenseBase::NullaryExpr(const CustomNullaryOp& func) { - return CwiseNullaryOp(RowsAtCompileTime, ColsAtCompileTime, func); + return CwiseNullaryOp(RowsAtCompileTime, ColsAtCompileTime, func); } /** \returns an expression of a constant matrix of value \a value * - * The parameters \a nbRows and \a nbCols are the number of rows and of columns of + * The parameters \a rows and \a cols are the number of rows and of columns of * the returned matrix. Must be compatible with this DenseBase type. * * This variant is meant to be used for dynamic-size matrix types. For fixed-size types, - * it is redundant to pass \a nbRows and \a nbCols as arguments, so Zero() should be used + * it is redundant to pass \a rows and \a cols as arguments, so Zero() should be used * instead. * * The template parameter \a CustomNullaryOp is the type of the functor. @@ -175,10 +185,10 @@ DenseBase::NullaryExpr(const CustomNullaryOp& func) * \sa class CwiseNullaryOp */ template -EIGEN_STRONG_INLINE const typename DenseBase::ConstantReturnType -DenseBase::Constant(Index nbRows, Index nbCols, const Scalar& value) +EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE const typename DenseBase::ConstantReturnType +DenseBase::Constant(Index rows, Index cols, const Scalar& value) { - return DenseBase::NullaryExpr(nbRows, nbCols, internal::scalar_constant_op(value)); + return DenseBase::NullaryExpr(rows, cols, internal::scalar_constant_op(value)); } /** \returns an expression of a constant matrix of value \a value @@ -197,7 +207,7 @@ DenseBase::Constant(Index nbRows, Index nbCols, const Scalar& value) * \sa class CwiseNullaryOp */ template -EIGEN_STRONG_INLINE const typename DenseBase::ConstantReturnType +EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE const typename DenseBase::ConstantReturnType DenseBase::Constant(Index size, const Scalar& value) { return DenseBase::NullaryExpr(size, internal::scalar_constant_op(value)); @@ -213,53 +223,45 @@ DenseBase::Constant(Index size, const Scalar& value) * \sa class CwiseNullaryOp */ template -EIGEN_STRONG_INLINE const typename DenseBase::ConstantReturnType +EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE const typename DenseBase::ConstantReturnType DenseBase::Constant(const Scalar& value) { EIGEN_STATIC_ASSERT_FIXED_SIZE(Derived) return DenseBase::NullaryExpr(RowsAtCompileTime, ColsAtCompileTime, internal::scalar_constant_op(value)); } -/** - * \brief Sets a linearly space vector. - * - * The function generates 'size' equally spaced values in the closed interval [low,high]. - * This particular version of LinSpaced() uses sequential access, i.e. vector access is - * assumed to be a(0), a(1), ..., a(size). This assumption allows for better vectorization - * and yields faster code than the random access version. - * - * When size is set to 1, a vector of length 1 containing 'high' is returned. +/** \deprecated because of accuracy loss. In Eigen 3.3, it is an alias for LinSpaced(Index,const Scalar&,const Scalar&) * * \only_for_vectors * - * Example: \include DenseBase_LinSpaced_seq.cpp - * Output: \verbinclude DenseBase_LinSpaced_seq.out + * Example: \include DenseBase_LinSpaced_seq_deprecated.cpp + * Output: \verbinclude DenseBase_LinSpaced_seq_deprecated.out * - * \sa setLinSpaced(Index,const Scalar&,const Scalar&), LinSpaced(Index,Scalar,Scalar), CwiseNullaryOp + * \sa LinSpaced(Index,const Scalar&, const Scalar&), setLinSpaced(Index,const Scalar&,const Scalar&) */ template -EIGEN_STRONG_INLINE const typename DenseBase::SequentialLinSpacedReturnType +EIGEN_DEPRECATED EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE const typename DenseBase::RandomAccessLinSpacedReturnType DenseBase::LinSpaced(Sequential_t, Index size, const Scalar& low, const Scalar& high) { EIGEN_STATIC_ASSERT_VECTOR_ONLY(Derived) - return DenseBase::NullaryExpr(size, internal::linspaced_op(low,high,size)); + return DenseBase::NullaryExpr(size, internal::linspaced_op(low,high,size)); } -/** - * \copydoc DenseBase::LinSpaced(Sequential_t, Index, const Scalar&, const Scalar&) - * Special version for fixed size types which does not require the size parameter. +/** \deprecated because of accuracy loss. In Eigen 3.3, it is an alias for LinSpaced(const Scalar&,const Scalar&) + * + * \sa LinSpaced(const Scalar&, const Scalar&) */ template -EIGEN_STRONG_INLINE const typename DenseBase::SequentialLinSpacedReturnType +EIGEN_DEPRECATED EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE const typename DenseBase::RandomAccessLinSpacedReturnType DenseBase::LinSpaced(Sequential_t, const Scalar& low, const Scalar& high) { EIGEN_STATIC_ASSERT_VECTOR_ONLY(Derived) EIGEN_STATIC_ASSERT_FIXED_SIZE(Derived) - return DenseBase::NullaryExpr(Derived::SizeAtCompileTime, internal::linspaced_op(low,high,Derived::SizeAtCompileTime)); + return DenseBase::NullaryExpr(Derived::SizeAtCompileTime, internal::linspaced_op(low,high,Derived::SizeAtCompileTime)); } /** - * \brief Sets a linearly space vector. + * \brief Sets a linearly spaced vector. * * The function generates 'size' equally spaced values in the closed interval [low,high]. * When size is set to 1, a vector of length 1 containing 'high' is returned. @@ -269,14 +271,24 @@ DenseBase::LinSpaced(Sequential_t, const Scalar& low, const Scalar& hig * Example: \include DenseBase_LinSpaced.cpp * Output: \verbinclude DenseBase_LinSpaced.out * - * \sa setLinSpaced(Index,const Scalar&,const Scalar&), LinSpaced(Sequential_t,Index,const Scalar&,const Scalar&,Index), CwiseNullaryOp + * For integer scalar types, an even spacing is possible if and only if the length of the range, + * i.e., \c high-low is a scalar multiple of \c size-1, or if \c size is a scalar multiple of the + * number of values \c high-low+1 (meaning each value can be repeated the same number of time). + * If one of these two considions is not satisfied, then \c high is lowered to the largest value + * satisfying one of this constraint. + * Here are some examples: + * + * Example: \include DenseBase_LinSpacedInt.cpp + * Output: \verbinclude DenseBase_LinSpacedInt.out + * + * \sa setLinSpaced(Index,const Scalar&,const Scalar&), CwiseNullaryOp */ template -EIGEN_STRONG_INLINE const typename DenseBase::RandomAccessLinSpacedReturnType +EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE const typename DenseBase::RandomAccessLinSpacedReturnType DenseBase::LinSpaced(Index size, const Scalar& low, const Scalar& high) { EIGEN_STATIC_ASSERT_VECTOR_ONLY(Derived) - return DenseBase::NullaryExpr(size, internal::linspaced_op(low,high,size)); + return DenseBase::NullaryExpr(size, internal::linspaced_op(low,high,size)); } /** @@ -284,22 +296,23 @@ DenseBase::LinSpaced(Index size, const Scalar& low, const Scalar& high) * Special version for fixed size types which does not require the size parameter. */ template -EIGEN_STRONG_INLINE const typename DenseBase::RandomAccessLinSpacedReturnType +EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE const typename DenseBase::RandomAccessLinSpacedReturnType DenseBase::LinSpaced(const Scalar& low, const Scalar& high) { EIGEN_STATIC_ASSERT_VECTOR_ONLY(Derived) EIGEN_STATIC_ASSERT_FIXED_SIZE(Derived) - return DenseBase::NullaryExpr(Derived::SizeAtCompileTime, internal::linspaced_op(low,high,Derived::SizeAtCompileTime)); + return DenseBase::NullaryExpr(Derived::SizeAtCompileTime, internal::linspaced_op(low,high,Derived::SizeAtCompileTime)); } /** \returns true if all coefficients in this matrix are approximately equal to \a val, to within precision \a prec */ template -bool DenseBase::isApproxToConstant +EIGEN_DEVICE_FUNC bool DenseBase::isApproxToConstant (const Scalar& val, const RealScalar& prec) const { + typename internal::nested_eval::type self(derived()); for(Index j = 0; j < cols(); ++j) for(Index i = 0; i < rows(); ++i) - if(!internal::isApprox(this->coeff(i, j), val, prec)) + if(!internal::isApprox(self.coeff(i, j), val, prec)) return false; return true; } @@ -308,7 +321,7 @@ bool DenseBase::isApproxToConstant * * \returns true if all coefficients in this matrix are approximately equal to \a value, to within precision \a prec */ template -bool DenseBase::isConstant +EIGEN_DEVICE_FUNC bool DenseBase::isConstant (const Scalar& val, const RealScalar& prec) const { return isApproxToConstant(val, prec); @@ -319,22 +332,22 @@ bool DenseBase::isConstant * \sa setConstant(), Constant(), class CwiseNullaryOp */ template -EIGEN_STRONG_INLINE void DenseBase::fill(const Scalar& val) +EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE void DenseBase::fill(const Scalar& val) { setConstant(val); } -/** Sets all coefficients in this expression to \a value. +/** Sets all coefficients in this expression to value \a val. * * \sa fill(), setConstant(Index,const Scalar&), setConstant(Index,Index,const Scalar&), setZero(), setOnes(), Constant(), class CwiseNullaryOp, setZero(), setOnes() */ template -EIGEN_STRONG_INLINE Derived& DenseBase::setConstant(const Scalar& val) +EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Derived& DenseBase::setConstant(const Scalar& val) { return derived() = Constant(rows(), cols(), val); } -/** Resizes to the given \a size, and sets all coefficients in this expression to the given \a value. +/** Resizes to the given \a size, and sets all coefficients in this expression to the given value \a val. * * \only_for_vectors * @@ -344,17 +357,17 @@ EIGEN_STRONG_INLINE Derived& DenseBase::setConstant(const Scalar& val) * \sa MatrixBase::setConstant(const Scalar&), setConstant(Index,Index,const Scalar&), class CwiseNullaryOp, MatrixBase::Constant(const Scalar&) */ template -EIGEN_STRONG_INLINE Derived& +EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Derived& PlainObjectBase::setConstant(Index size, const Scalar& val) { resize(size); return setConstant(val); } -/** Resizes to the given size, and sets all coefficients in this expression to the given \a value. +/** Resizes to the given size, and sets all coefficients in this expression to the given value \a val. * - * \param nbRows the new number of rows - * \param nbCols the new number of columns + * \param rows the new number of rows + * \param cols the new number of columns * \param val the value to which all coefficients are set * * Example: \include Matrix_setConstant_int_int.cpp @@ -363,15 +376,42 @@ PlainObjectBase::setConstant(Index size, const Scalar& val) * \sa MatrixBase::setConstant(const Scalar&), setConstant(Index,const Scalar&), class CwiseNullaryOp, MatrixBase::Constant(const Scalar&) */ template -EIGEN_STRONG_INLINE Derived& -PlainObjectBase::setConstant(Index nbRows, Index nbCols, const Scalar& val) +EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Derived& +PlainObjectBase::setConstant(Index rows, Index cols, const Scalar& val) { - resize(nbRows, nbCols); + resize(rows, cols); return setConstant(val); } +/** Resizes to the given size, changing only the number of columns, and sets all + * coefficients in this expression to the given value \a val. For the parameter + * of type NoChange_t, just pass the special value \c NoChange. + * + * \sa MatrixBase::setConstant(const Scalar&), setConstant(Index,const Scalar&), class CwiseNullaryOp, MatrixBase::Constant(const Scalar&) + */ +template +EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Derived& +PlainObjectBase::setConstant(NoChange_t, Index cols, const Scalar& val) +{ + return setConstant(rows(), cols, val); +} + +/** Resizes to the given size, changing only the number of rows, and sets all + * coefficients in this expression to the given value \a val. For the parameter + * of type NoChange_t, just pass the special value \c NoChange. + * + * \sa MatrixBase::setConstant(const Scalar&), setConstant(Index,const Scalar&), class CwiseNullaryOp, MatrixBase::Constant(const Scalar&) + */ +template +EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Derived& +PlainObjectBase::setConstant(Index rows, NoChange_t, const Scalar& val) +{ + return setConstant(rows, cols(), val); +} + + /** - * \brief Sets a linearly space vector. + * \brief Sets a linearly spaced vector. * * The function generates 'size' equally spaced values in the closed interval [low,high]. * When size is set to 1, a vector of length 1 containing 'high' is returned. @@ -381,27 +421,33 @@ PlainObjectBase::setConstant(Index nbRows, Index nbCols, const Scalar& * Example: \include DenseBase_setLinSpaced.cpp * Output: \verbinclude DenseBase_setLinSpaced.out * - * \sa CwiseNullaryOp + * For integer scalar types, do not miss the explanations on the definition + * of \link LinSpaced(Index,const Scalar&,const Scalar&) even spacing \endlink. + * + * \sa LinSpaced(Index,const Scalar&,const Scalar&), CwiseNullaryOp */ template -EIGEN_STRONG_INLINE Derived& DenseBase::setLinSpaced(Index newSize, const Scalar& low, const Scalar& high) +EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Derived& DenseBase::setLinSpaced(Index newSize, const Scalar& low, const Scalar& high) { EIGEN_STATIC_ASSERT_VECTOR_ONLY(Derived) - return derived() = Derived::NullaryExpr(newSize, internal::linspaced_op(low,high,newSize)); + return derived() = Derived::NullaryExpr(newSize, internal::linspaced_op(low,high,newSize)); } /** - * \brief Sets a linearly space vector. + * \brief Sets a linearly spaced vector. * - * The function fill *this with equally spaced values in the closed interval [low,high]. + * The function fills \c *this with equally spaced values in the closed interval [low,high]. * When size is set to 1, a vector of length 1 containing 'high' is returned. * * \only_for_vectors * - * \sa setLinSpaced(Index, const Scalar&, const Scalar&), CwiseNullaryOp + * For integer scalar types, do not miss the explanations on the definition + * of \link LinSpaced(Index,const Scalar&,const Scalar&) even spacing \endlink. + * + * \sa LinSpaced(Index,const Scalar&,const Scalar&), setLinSpaced(Index, const Scalar&, const Scalar&), CwiseNullaryOp */ template -EIGEN_STRONG_INLINE Derived& DenseBase::setLinSpaced(const Scalar& low, const Scalar& high) +EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Derived& DenseBase::setLinSpaced(const Scalar& low, const Scalar& high) { EIGEN_STATIC_ASSERT_VECTOR_ONLY(Derived) return setLinSpaced(size(), low, high); @@ -424,10 +470,10 @@ EIGEN_STRONG_INLINE Derived& DenseBase::setLinSpaced(const Scalar& low, * \sa Zero(), Zero(Index) */ template -EIGEN_STRONG_INLINE const typename DenseBase::ConstantReturnType -DenseBase::Zero(Index nbRows, Index nbCols) +EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE const typename DenseBase::ConstantReturnType +DenseBase::Zero(Index rows, Index cols) { - return Constant(nbRows, nbCols, Scalar(0)); + return Constant(rows, cols, Scalar(0)); } /** \returns an expression of a zero vector. @@ -447,7 +493,7 @@ DenseBase::Zero(Index nbRows, Index nbCols) * \sa Zero(), Zero(Index,Index) */ template -EIGEN_STRONG_INLINE const typename DenseBase::ConstantReturnType +EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE const typename DenseBase::ConstantReturnType DenseBase::Zero(Index size) { return Constant(size, Scalar(0)); @@ -464,7 +510,7 @@ DenseBase::Zero(Index size) * \sa Zero(Index), Zero(Index,Index) */ template -EIGEN_STRONG_INLINE const typename DenseBase::ConstantReturnType +EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE const typename DenseBase::ConstantReturnType DenseBase::Zero() { return Constant(Scalar(0)); @@ -479,11 +525,12 @@ DenseBase::Zero() * \sa class CwiseNullaryOp, Zero() */ template -bool DenseBase::isZero(const RealScalar& prec) const +EIGEN_DEVICE_FUNC bool DenseBase::isZero(const RealScalar& prec) const { + typename internal::nested_eval::type self(derived()); for(Index j = 0; j < cols(); ++j) for(Index i = 0; i < rows(); ++i) - if(!internal::isMuchSmallerThan(this->coeff(i, j), static_cast(1), prec)) + if(!internal::isMuchSmallerThan(self.coeff(i, j), static_cast(1), prec)) return false; return true; } @@ -496,7 +543,7 @@ bool DenseBase::isZero(const RealScalar& prec) const * \sa class CwiseNullaryOp, Zero() */ template -EIGEN_STRONG_INLINE Derived& DenseBase::setZero() +EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Derived& DenseBase::setZero() { return setConstant(Scalar(0)); } @@ -511,7 +558,7 @@ EIGEN_STRONG_INLINE Derived& DenseBase::setZero() * \sa DenseBase::setZero(), setZero(Index,Index), class CwiseNullaryOp, DenseBase::Zero() */ template -EIGEN_STRONG_INLINE Derived& +EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Derived& PlainObjectBase::setZero(Index newSize) { resize(newSize); @@ -520,8 +567,8 @@ PlainObjectBase::setZero(Index newSize) /** Resizes to the given size, and sets all coefficients in this expression to zero. * - * \param nbRows the new number of rows - * \param nbCols the new number of columns + * \param rows the new number of rows + * \param cols the new number of columns * * Example: \include Matrix_setZero_int_int.cpp * Output: \verbinclude Matrix_setZero_int_int.out @@ -529,18 +576,44 @@ PlainObjectBase::setZero(Index newSize) * \sa DenseBase::setZero(), setZero(Index), class CwiseNullaryOp, DenseBase::Zero() */ template -EIGEN_STRONG_INLINE Derived& -PlainObjectBase::setZero(Index nbRows, Index nbCols) +EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Derived& +PlainObjectBase::setZero(Index rows, Index cols) { - resize(nbRows, nbCols); + resize(rows, cols); return setConstant(Scalar(0)); } +/** Resizes to the given size, changing only the number of columns, and sets all + * coefficients in this expression to zero. For the parameter of type NoChange_t, + * just pass the special value \c NoChange. + * + * \sa DenseBase::setZero(), setZero(Index), setZero(Index, Index), setZero(Index, NoChange_t), class CwiseNullaryOp, DenseBase::Zero() + */ +template +EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Derived& +PlainObjectBase::setZero(NoChange_t, Index cols) +{ + return setZero(rows(), cols); +} + +/** Resizes to the given size, changing only the number of rows, and sets all + * coefficients in this expression to zero. For the parameter of type NoChange_t, + * just pass the special value \c NoChange. + * + * \sa DenseBase::setZero(), setZero(Index), setZero(Index, Index), setZero(NoChange_t, Index), class CwiseNullaryOp, DenseBase::Zero() + */ +template +EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Derived& +PlainObjectBase::setZero(Index rows, NoChange_t) +{ + return setZero(rows, cols()); +} + // ones: /** \returns an expression of a matrix where all coefficients equal one. * - * The parameters \a nbRows and \a nbCols are the number of rows and of columns of + * The parameters \a rows and \a cols are the number of rows and of columns of * the returned matrix. Must be compatible with this MatrixBase type. * * This variant is meant to be used for dynamic-size matrix types. For fixed-size types, @@ -553,10 +626,10 @@ PlainObjectBase::setZero(Index nbRows, Index nbCols) * \sa Ones(), Ones(Index), isOnes(), class Ones */ template -EIGEN_STRONG_INLINE const typename DenseBase::ConstantReturnType -DenseBase::Ones(Index nbRows, Index nbCols) +EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE const typename DenseBase::ConstantReturnType +DenseBase::Ones(Index rows, Index cols) { - return Constant(nbRows, nbCols, Scalar(1)); + return Constant(rows, cols, Scalar(1)); } /** \returns an expression of a vector where all coefficients equal one. @@ -576,7 +649,7 @@ DenseBase::Ones(Index nbRows, Index nbCols) * \sa Ones(), Ones(Index,Index), isOnes(), class Ones */ template -EIGEN_STRONG_INLINE const typename DenseBase::ConstantReturnType +EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE const typename DenseBase::ConstantReturnType DenseBase::Ones(Index newSize) { return Constant(newSize, Scalar(1)); @@ -593,7 +666,7 @@ DenseBase::Ones(Index newSize) * \sa Ones(Index), Ones(Index,Index), isOnes(), class Ones */ template -EIGEN_STRONG_INLINE const typename DenseBase::ConstantReturnType +EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE const typename DenseBase::ConstantReturnType DenseBase::Ones() { return Constant(Scalar(1)); @@ -608,7 +681,7 @@ DenseBase::Ones() * \sa class CwiseNullaryOp, Ones() */ template -bool DenseBase::isOnes +EIGEN_DEVICE_FUNC bool DenseBase::isOnes (const RealScalar& prec) const { return isApproxToConstant(Scalar(1), prec); @@ -622,7 +695,7 @@ bool DenseBase::isOnes * \sa class CwiseNullaryOp, Ones() */ template -EIGEN_STRONG_INLINE Derived& DenseBase::setOnes() +EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Derived& DenseBase::setOnes() { return setConstant(Scalar(1)); } @@ -637,7 +710,7 @@ EIGEN_STRONG_INLINE Derived& DenseBase::setOnes() * \sa MatrixBase::setOnes(), setOnes(Index,Index), class CwiseNullaryOp, MatrixBase::Ones() */ template -EIGEN_STRONG_INLINE Derived& +EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Derived& PlainObjectBase::setOnes(Index newSize) { resize(newSize); @@ -646,8 +719,8 @@ PlainObjectBase::setOnes(Index newSize) /** Resizes to the given size, and sets all coefficients in this expression to one. * - * \param nbRows the new number of rows - * \param nbCols the new number of columns + * \param rows the new number of rows + * \param cols the new number of columns * * Example: \include Matrix_setOnes_int_int.cpp * Output: \verbinclude Matrix_setOnes_int_int.out @@ -655,18 +728,44 @@ PlainObjectBase::setOnes(Index newSize) * \sa MatrixBase::setOnes(), setOnes(Index), class CwiseNullaryOp, MatrixBase::Ones() */ template -EIGEN_STRONG_INLINE Derived& -PlainObjectBase::setOnes(Index nbRows, Index nbCols) +EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Derived& +PlainObjectBase::setOnes(Index rows, Index cols) { - resize(nbRows, nbCols); + resize(rows, cols); return setConstant(Scalar(1)); } +/** Resizes to the given size, changing only the number of rows, and sets all + * coefficients in this expression to one. For the parameter of type NoChange_t, + * just pass the special value \c NoChange. + * + * \sa MatrixBase::setOnes(), setOnes(Index), setOnes(Index, Index), setOnes(NoChange_t, Index), class CwiseNullaryOp, MatrixBase::Ones() + */ +template +EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Derived& +PlainObjectBase::setOnes(Index rows, NoChange_t) +{ + return setOnes(rows, cols()); +} + +/** Resizes to the given size, changing only the number of columns, and sets all + * coefficients in this expression to one. For the parameter of type NoChange_t, + * just pass the special value \c NoChange. + * + * \sa MatrixBase::setOnes(), setOnes(Index), setOnes(Index, Index), setOnes(Index, NoChange_t) class CwiseNullaryOp, MatrixBase::Ones() + */ +template +EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Derived& +PlainObjectBase::setOnes(NoChange_t, Index cols) +{ + return setOnes(rows(), cols); +} + // Identity: /** \returns an expression of the identity matrix (not necessarily square). * - * The parameters \a nbRows and \a nbCols are the number of rows and of columns of + * The parameters \a rows and \a cols are the number of rows and of columns of * the returned matrix. Must be compatible with this MatrixBase type. * * This variant is meant to be used for dynamic-size matrix types. For fixed-size types, @@ -679,10 +778,10 @@ PlainObjectBase::setOnes(Index nbRows, Index nbCols) * \sa Identity(), setIdentity(), isIdentity() */ template -EIGEN_STRONG_INLINE const typename MatrixBase::IdentityReturnType -MatrixBase::Identity(Index nbRows, Index nbCols) +EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE const typename MatrixBase::IdentityReturnType +MatrixBase::Identity(Index rows, Index cols) { - return DenseBase::NullaryExpr(nbRows, nbCols, internal::scalar_identity_op()); + return DenseBase::NullaryExpr(rows, cols, internal::scalar_identity_op()); } /** \returns an expression of the identity matrix (not necessarily square). @@ -696,7 +795,7 @@ MatrixBase::Identity(Index nbRows, Index nbCols) * \sa Identity(Index,Index), setIdentity(), isIdentity() */ template -EIGEN_STRONG_INLINE const typename MatrixBase::IdentityReturnType +EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE const typename MatrixBase::IdentityReturnType MatrixBase::Identity() { EIGEN_STATIC_ASSERT_FIXED_SIZE(Derived) @@ -716,18 +815,19 @@ template bool MatrixBase::isIdentity (const RealScalar& prec) const { + typename internal::nested_eval::type self(derived()); for(Index j = 0; j < cols(); ++j) { for(Index i = 0; i < rows(); ++i) { if(i == j) { - if(!internal::isApprox(this->coeff(i, j), static_cast(1), prec)) + if(!internal::isApprox(self.coeff(i, j), static_cast(1), prec)) return false; } else { - if(!internal::isMuchSmallerThan(this->coeff(i, j), static_cast(1), prec)) + if(!internal::isMuchSmallerThan(self.coeff(i, j), static_cast(1), prec)) return false; } } @@ -740,6 +840,7 @@ namespace internal { template=16)> struct setIdentity_impl { + EIGEN_DEVICE_FUNC static EIGEN_STRONG_INLINE Derived& run(Derived& m) { return m = Derived::Identity(m.rows(), m.cols()); @@ -749,11 +850,11 @@ struct setIdentity_impl template struct setIdentity_impl { - typedef typename Derived::Index Index; + EIGEN_DEVICE_FUNC static EIGEN_STRONG_INLINE Derived& run(Derived& m) { m.setZero(); - const Index size = (std::min)(m.rows(), m.cols()); + const Index size = numext::mini(m.rows(), m.cols()); for(Index i = 0; i < size; ++i) m.coeffRef(i,i) = typename Derived::Scalar(1); return m; } @@ -769,15 +870,15 @@ struct setIdentity_impl * \sa class CwiseNullaryOp, Identity(), Identity(Index,Index), isIdentity() */ template -EIGEN_STRONG_INLINE Derived& MatrixBase::setIdentity() +EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Derived& MatrixBase::setIdentity() { return internal::setIdentity_impl::run(derived()); } /** \brief Resizes to the given size, and writes the identity expression (not necessarily square) into *this. * - * \param nbRows the new number of rows - * \param nbCols the new number of columns + * \param rows the new number of rows + * \param cols the new number of columns * * Example: \include Matrix_setIdentity_int_int.cpp * Output: \verbinclude Matrix_setIdentity_int_int.out @@ -785,9 +886,9 @@ EIGEN_STRONG_INLINE Derived& MatrixBase::setIdentity() * \sa MatrixBase::setIdentity(), class CwiseNullaryOp, MatrixBase::Identity() */ template -EIGEN_STRONG_INLINE Derived& MatrixBase::setIdentity(Index nbRows, Index nbCols) +EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Derived& MatrixBase::setIdentity(Index rows, Index cols) { - derived().resize(nbRows, nbCols); + derived().resize(rows, cols); return setIdentity(); } @@ -798,7 +899,7 @@ EIGEN_STRONG_INLINE Derived& MatrixBase::setIdentity(Index nbRows, Inde * \sa MatrixBase::Unit(Index), MatrixBase::UnitX(), MatrixBase::UnitY(), MatrixBase::UnitZ(), MatrixBase::UnitW() */ template -EIGEN_STRONG_INLINE const typename MatrixBase::BasisReturnType MatrixBase::Unit(Index newSize, Index i) +EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE const typename MatrixBase::BasisReturnType MatrixBase::Unit(Index newSize, Index i) { EIGEN_STATIC_ASSERT_VECTOR_ONLY(Derived) return BasisReturnType(SquareMatrixType::Identity(newSize,newSize), i); @@ -813,7 +914,7 @@ EIGEN_STRONG_INLINE const typename MatrixBase::BasisReturnType MatrixBa * \sa MatrixBase::Unit(Index,Index), MatrixBase::UnitX(), MatrixBase::UnitY(), MatrixBase::UnitZ(), MatrixBase::UnitW() */ template -EIGEN_STRONG_INLINE const typename MatrixBase::BasisReturnType MatrixBase::Unit(Index i) +EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE const typename MatrixBase::BasisReturnType MatrixBase::Unit(Index i) { EIGEN_STATIC_ASSERT_VECTOR_ONLY(Derived) return BasisReturnType(SquareMatrixType::Identity(),i); @@ -826,7 +927,7 @@ EIGEN_STRONG_INLINE const typename MatrixBase::BasisReturnType MatrixBa * \sa MatrixBase::Unit(Index,Index), MatrixBase::Unit(Index), MatrixBase::UnitY(), MatrixBase::UnitZ(), MatrixBase::UnitW() */ template -EIGEN_STRONG_INLINE const typename MatrixBase::BasisReturnType MatrixBase::UnitX() +EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE const typename MatrixBase::BasisReturnType MatrixBase::UnitX() { return Derived::Unit(0); } /** \returns an expression of the Y axis unit vector (0,1{,0}^*) @@ -836,7 +937,7 @@ EIGEN_STRONG_INLINE const typename MatrixBase::BasisReturnType MatrixBa * \sa MatrixBase::Unit(Index,Index), MatrixBase::Unit(Index), MatrixBase::UnitY(), MatrixBase::UnitZ(), MatrixBase::UnitW() */ template -EIGEN_STRONG_INLINE const typename MatrixBase::BasisReturnType MatrixBase::UnitY() +EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE const typename MatrixBase::BasisReturnType MatrixBase::UnitY() { return Derived::Unit(1); } /** \returns an expression of the Z axis unit vector (0,0,1{,0}^*) @@ -846,7 +947,7 @@ EIGEN_STRONG_INLINE const typename MatrixBase::BasisReturnType MatrixBa * \sa MatrixBase::Unit(Index,Index), MatrixBase::Unit(Index), MatrixBase::UnitY(), MatrixBase::UnitZ(), MatrixBase::UnitW() */ template -EIGEN_STRONG_INLINE const typename MatrixBase::BasisReturnType MatrixBase::UnitZ() +EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE const typename MatrixBase::BasisReturnType MatrixBase::UnitZ() { return Derived::Unit(2); } /** \returns an expression of the W axis unit vector (0,0,0,1) @@ -856,9 +957,45 @@ EIGEN_STRONG_INLINE const typename MatrixBase::BasisReturnType MatrixBa * \sa MatrixBase::Unit(Index,Index), MatrixBase::Unit(Index), MatrixBase::UnitY(), MatrixBase::UnitZ(), MatrixBase::UnitW() */ template -EIGEN_STRONG_INLINE const typename MatrixBase::BasisReturnType MatrixBase::UnitW() +EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE const typename MatrixBase::BasisReturnType MatrixBase::UnitW() { return Derived::Unit(3); } +/** \brief Set the coefficients of \c *this to the i-th unit (basis) vector + * + * \param i index of the unique coefficient to be set to 1 + * + * \only_for_vectors + * + * \sa MatrixBase::setIdentity(), class CwiseNullaryOp, MatrixBase::Unit(Index,Index) + */ +template +EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Derived& MatrixBase::setUnit(Index i) +{ + EIGEN_STATIC_ASSERT_VECTOR_ONLY(Derived); + eigen_assert(i +EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Derived& MatrixBase::setUnit(Index newSize, Index i) +{ + EIGEN_STATIC_ASSERT_VECTOR_ONLY(Derived); + eigen_assert(i +// Copyright (C) 2006-2008 Benoit Jacob +// Copyright (C) 2016 Eugene Brevdo +// +// This Source Code Form is subject to the terms of the Mozilla +// Public License v. 2.0. If a copy of the MPL was not distributed +// with this file, You can obtain one at http://mozilla.org/MPL/2.0/. + +#ifndef EIGEN_CWISE_TERNARY_OP_H +#define EIGEN_CWISE_TERNARY_OP_H + +namespace Eigen { + +namespace internal { +template +struct traits > { + // we must not inherit from traits since it has + // the potential to cause problems with MSVC + typedef typename remove_all::type Ancestor; + typedef typename traits::XprKind XprKind; + enum { + RowsAtCompileTime = traits::RowsAtCompileTime, + ColsAtCompileTime = traits::ColsAtCompileTime, + MaxRowsAtCompileTime = traits::MaxRowsAtCompileTime, + MaxColsAtCompileTime = traits::MaxColsAtCompileTime + }; + + // even though we require Arg1, Arg2, and Arg3 to have the same scalar type + // (see CwiseTernaryOp constructor), + // we still want to handle the case when the result type is different. + typedef typename result_of::type Scalar; + + typedef typename internal::traits::StorageKind StorageKind; + typedef typename internal::traits::StorageIndex StorageIndex; + + typedef typename Arg1::Nested Arg1Nested; + typedef typename Arg2::Nested Arg2Nested; + typedef typename Arg3::Nested Arg3Nested; + typedef typename remove_reference::type _Arg1Nested; + typedef typename remove_reference::type _Arg2Nested; + typedef typename remove_reference::type _Arg3Nested; + enum { Flags = _Arg1Nested::Flags & RowMajorBit }; +}; +} // end namespace internal + +template +class CwiseTernaryOpImpl; + +/** \class CwiseTernaryOp + * \ingroup Core_Module + * + * \brief Generic expression where a coefficient-wise ternary operator is + * applied to two expressions + * + * \tparam TernaryOp template functor implementing the operator + * \tparam Arg1Type the type of the first argument + * \tparam Arg2Type the type of the second argument + * \tparam Arg3Type the type of the third argument + * + * This class represents an expression where a coefficient-wise ternary + * operator is applied to three expressions. + * It is the return type of ternary operators, by which we mean only those + * ternary operators where + * all three arguments are Eigen expressions. + * For example, the return type of betainc(matrix1, matrix2, matrix3) is a + * CwiseTernaryOp. + * + * Most of the time, this is the only way that it is used, so you typically + * don't have to name + * CwiseTernaryOp types explicitly. + * + * \sa MatrixBase::ternaryExpr(const MatrixBase &, const + * MatrixBase &, const CustomTernaryOp &) const, class CwiseBinaryOp, + * class CwiseUnaryOp, class CwiseNullaryOp + */ +template +class CwiseTernaryOp : public CwiseTernaryOpImpl< + TernaryOp, Arg1Type, Arg2Type, Arg3Type, + typename internal::traits::StorageKind>, + internal::no_assignment_operator +{ + public: + typedef typename internal::remove_all::type Arg1; + typedef typename internal::remove_all::type Arg2; + typedef typename internal::remove_all::type Arg3; + + typedef typename CwiseTernaryOpImpl< + TernaryOp, Arg1Type, Arg2Type, Arg3Type, + typename internal::traits::StorageKind>::Base Base; + EIGEN_GENERIC_PUBLIC_INTERFACE(CwiseTernaryOp) + + typedef typename internal::ref_selector::type Arg1Nested; + typedef typename internal::ref_selector::type Arg2Nested; + typedef typename internal::ref_selector::type Arg3Nested; + typedef typename internal::remove_reference::type _Arg1Nested; + typedef typename internal::remove_reference::type _Arg2Nested; + typedef typename internal::remove_reference::type _Arg3Nested; + + EIGEN_DEVICE_FUNC + EIGEN_STRONG_INLINE CwiseTernaryOp(const Arg1& a1, const Arg2& a2, + const Arg3& a3, + const TernaryOp& func = TernaryOp()) + : m_arg1(a1), m_arg2(a2), m_arg3(a3), m_functor(func) { + // require the sizes to match + EIGEN_STATIC_ASSERT_SAME_MATRIX_SIZE(Arg1, Arg2) + EIGEN_STATIC_ASSERT_SAME_MATRIX_SIZE(Arg1, Arg3) + + // The index types should match + EIGEN_STATIC_ASSERT((internal::is_same< + typename internal::traits::StorageKind, + typename internal::traits::StorageKind>::value), + STORAGE_KIND_MUST_MATCH) + EIGEN_STATIC_ASSERT((internal::is_same< + typename internal::traits::StorageKind, + typename internal::traits::StorageKind>::value), + STORAGE_KIND_MUST_MATCH) + + eigen_assert(a1.rows() == a2.rows() && a1.cols() == a2.cols() && + a1.rows() == a3.rows() && a1.cols() == a3.cols()); + } + + EIGEN_DEVICE_FUNC + EIGEN_STRONG_INLINE Index rows() const { + // return the fixed size type if available to enable compile time + // optimizations + if (internal::traits::type>:: + RowsAtCompileTime == Dynamic && + internal::traits::type>:: + RowsAtCompileTime == Dynamic) + return m_arg3.rows(); + else if (internal::traits::type>:: + RowsAtCompileTime == Dynamic && + internal::traits::type>:: + RowsAtCompileTime == Dynamic) + return m_arg2.rows(); + else + return m_arg1.rows(); + } + EIGEN_DEVICE_FUNC + EIGEN_STRONG_INLINE Index cols() const { + // return the fixed size type if available to enable compile time + // optimizations + if (internal::traits::type>:: + ColsAtCompileTime == Dynamic && + internal::traits::type>:: + ColsAtCompileTime == Dynamic) + return m_arg3.cols(); + else if (internal::traits::type>:: + ColsAtCompileTime == Dynamic && + internal::traits::type>:: + ColsAtCompileTime == Dynamic) + return m_arg2.cols(); + else + return m_arg1.cols(); + } + + /** \returns the first argument nested expression */ + EIGEN_DEVICE_FUNC + const _Arg1Nested& arg1() const { return m_arg1; } + /** \returns the first argument nested expression */ + EIGEN_DEVICE_FUNC + const _Arg2Nested& arg2() const { return m_arg2; } + /** \returns the third argument nested expression */ + EIGEN_DEVICE_FUNC + const _Arg3Nested& arg3() const { return m_arg3; } + /** \returns the functor representing the ternary operation */ + EIGEN_DEVICE_FUNC + const TernaryOp& functor() const { return m_functor; } + + protected: + Arg1Nested m_arg1; + Arg2Nested m_arg2; + Arg3Nested m_arg3; + const TernaryOp m_functor; +}; + +// Generic API dispatcher +template +class CwiseTernaryOpImpl + : public internal::generic_xpr_base< + CwiseTernaryOp >::type { + public: + typedef typename internal::generic_xpr_base< + CwiseTernaryOp >::type Base; +}; + +} // end namespace Eigen + +#endif // EIGEN_CWISE_TERNARY_OP_H diff --git a/extern/eigen/Eigen/src/Core/CwiseUnaryOp.h b/extern/eigen/Eigen/src/Core/CwiseUnaryOp.h index f7ee60e9..e68c4f74 100644 --- a/extern/eigen/Eigen/src/Core/CwiseUnaryOp.h +++ b/extern/eigen/Eigen/src/Core/CwiseUnaryOp.h @@ -1,7 +1,7 @@ // This file is part of Eigen, a lightweight C++ template library // for linear algebra. // -// Copyright (C) 2008-2010 Gael Guennebaud +// Copyright (C) 2008-2014 Gael Guennebaud // Copyright (C) 2006-2008 Benoit Jacob // // This Source Code Form is subject to the terms of the Mozilla @@ -11,27 +11,7 @@ #ifndef EIGEN_CWISE_UNARY_OP_H #define EIGEN_CWISE_UNARY_OP_H -namespace Eigen { - -/** \class CwiseUnaryOp - * \ingroup Core_Module - * - * \brief Generic expression where a coefficient-wise unary operator is applied to an expression - * - * \param UnaryOp template functor implementing the operator - * \param XprType the type of the expression to which we are applying the unary operator - * - * This class represents an expression where a unary operator is applied to an expression. - * It is the return type of all operations taking exactly 1 input expression, regardless of the - * presence of other inputs such as scalars. For example, the operator* in the expression 3*matrix - * is considered unary, because only the right-hand side is an expression, and its - * return type is a specialization of CwiseUnaryOp. - * - * Most of the time, this is the only way that it is used, so you typically don't have to name - * CwiseUnaryOp types explicitly. - * - * \sa MatrixBase::unaryExpr(const CustomUnaryOp &) const, class CwiseBinaryOp, class CwiseNullaryOp - */ +namespace Eigen { namespace internal { template @@ -39,15 +19,12 @@ struct traits > : traits { typedef typename result_of< - UnaryOp(typename XprType::Scalar) + UnaryOp(const typename XprType::Scalar&) >::type Scalar; typedef typename XprType::Nested XprTypeNested; typedef typename remove_reference::type _XprTypeNested; enum { - Flags = _XprTypeNested::Flags & ( - HereditaryBits | LinearAccessBit | AlignedBit - | (functor_traits::PacketAccess ? PacketAccessBit : 0)), - CoeffReadCost = EIGEN_ADD_COST(_XprTypeNested::CoeffReadCost, functor_traits::Cost) + Flags = _XprTypeNested::Flags & RowMajorBit }; }; } @@ -55,70 +32,70 @@ struct traits > template class CwiseUnaryOpImpl; +/** \class CwiseUnaryOp + * \ingroup Core_Module + * + * \brief Generic expression where a coefficient-wise unary operator is applied to an expression + * + * \tparam UnaryOp template functor implementing the operator + * \tparam XprType the type of the expression to which we are applying the unary operator + * + * This class represents an expression where a unary operator is applied to an expression. + * It is the return type of all operations taking exactly 1 input expression, regardless of the + * presence of other inputs such as scalars. For example, the operator* in the expression 3*matrix + * is considered unary, because only the right-hand side is an expression, and its + * return type is a specialization of CwiseUnaryOp. + * + * Most of the time, this is the only way that it is used, so you typically don't have to name + * CwiseUnaryOp types explicitly. + * + * \sa MatrixBase::unaryExpr(const CustomUnaryOp &) const, class CwiseBinaryOp, class CwiseNullaryOp + */ template -class CwiseUnaryOp : internal::no_assignment_operator, - public CwiseUnaryOpImpl::StorageKind> +class CwiseUnaryOp : public CwiseUnaryOpImpl::StorageKind>, internal::no_assignment_operator { public: typedef typename CwiseUnaryOpImpl::StorageKind>::Base Base; EIGEN_GENERIC_PUBLIC_INTERFACE(CwiseUnaryOp) + typedef typename internal::ref_selector::type XprTypeNested; + typedef typename internal::remove_all::type NestedExpression; - inline CwiseUnaryOp(const XprType& xpr, const UnaryOp& func = UnaryOp()) + EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE + explicit CwiseUnaryOp(const XprType& xpr, const UnaryOp& func = UnaryOp()) : m_xpr(xpr), m_functor(func) {} - EIGEN_STRONG_INLINE Index rows() const { return m_xpr.rows(); } - EIGEN_STRONG_INLINE Index cols() const { return m_xpr.cols(); } + EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE EIGEN_CONSTEXPR + Index rows() const EIGEN_NOEXCEPT { return m_xpr.rows(); } + EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE EIGEN_CONSTEXPR + Index cols() const EIGEN_NOEXCEPT { return m_xpr.cols(); } /** \returns the functor representing the unary operation */ + EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE const UnaryOp& functor() const { return m_functor; } /** \returns the nested expression */ - const typename internal::remove_all::type& + EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE + const typename internal::remove_all::type& nestedExpression() const { return m_xpr; } /** \returns the nested expression */ - typename internal::remove_all::type& - nestedExpression() { return m_xpr.const_cast_derived(); } + EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE + typename internal::remove_all::type& + nestedExpression() { return m_xpr; } protected: - typename XprType::Nested m_xpr; + XprTypeNested m_xpr; const UnaryOp m_functor; }; -// This is the generic implementation for dense storage. -// It can be used for any expression types implementing the dense concept. -template -class CwiseUnaryOpImpl - : public internal::dense_xpr_base >::type +// Generic API dispatcher +template +class CwiseUnaryOpImpl + : public internal::generic_xpr_base >::type { - public: - - typedef CwiseUnaryOp Derived; - typedef typename internal::dense_xpr_base >::type Base; - EIGEN_DENSE_PUBLIC_INTERFACE(Derived) - - EIGEN_STRONG_INLINE const Scalar coeff(Index rowId, Index colId) const - { - return derived().functor()(derived().nestedExpression().coeff(rowId, colId)); - } - - template - EIGEN_STRONG_INLINE PacketScalar packet(Index rowId, Index colId) const - { - return derived().functor().packetOp(derived().nestedExpression().template packet(rowId, colId)); - } - - EIGEN_STRONG_INLINE const Scalar coeff(Index index) const - { - return derived().functor()(derived().nestedExpression().coeff(index)); - } - - template - EIGEN_STRONG_INLINE PacketScalar packet(Index index) const - { - return derived().functor().packetOp(derived().nestedExpression().template packet(index)); - } +public: + typedef typename internal::generic_xpr_base >::type Base; }; } // end namespace Eigen diff --git a/extern/eigen/Eigen/src/Core/CwiseUnaryView.h b/extern/eigen/Eigen/src/Core/CwiseUnaryView.h index b2638d32..a06d7621 100644 --- a/extern/eigen/Eigen/src/Core/CwiseUnaryView.h +++ b/extern/eigen/Eigen/src/Core/CwiseUnaryView.h @@ -12,33 +12,19 @@ namespace Eigen { -/** \class CwiseUnaryView - * \ingroup Core_Module - * - * \brief Generic lvalue expression of a coefficient-wise unary operator of a matrix or a vector - * - * \param ViewOp template functor implementing the view - * \param MatrixType the type of the matrix we are applying the unary operator - * - * This class represents a lvalue expression of a generic unary view operator of a matrix or a vector. - * It is the return type of real() and imag(), and most of the time this is the only way it is used. - * - * \sa MatrixBase::unaryViewExpr(const CustomUnaryOp &) const, class CwiseUnaryOp - */ - namespace internal { template struct traits > : traits { typedef typename result_of< - ViewOp(typename traits::Scalar) + ViewOp(const typename traits::Scalar&) >::type Scalar; typedef typename MatrixType::Nested MatrixTypeNested; typedef typename remove_all::type _MatrixTypeNested; enum { - Flags = (traits<_MatrixTypeNested>::Flags & (HereditaryBits | LvalueBit | LinearAccessBit | DirectAccessBit)), - CoeffReadCost = traits<_MatrixTypeNested>::CoeffReadCost + functor_traits::Cost, + FlagsLvalueBit = is_lvalue::value ? LvalueBit : 0, + Flags = traits<_MatrixTypeNested>::Flags & (RowMajorBit | FlagsLvalueBit | DirectAccessBit), // FIXME DirectAccessBit should not be handled by expressions MatrixTypeInnerStride = inner_stride_at_compile_time::ret, // need to cast the sizeof's from size_t to int explicitly, otherwise: // "error: no integral type can represent all of the enumerator values @@ -55,6 +41,19 @@ struct traits > template class CwiseUnaryViewImpl; +/** \class CwiseUnaryView + * \ingroup Core_Module + * + * \brief Generic lvalue expression of a coefficient-wise unary operator of a matrix or a vector + * + * \tparam ViewOp template functor implementing the view + * \tparam MatrixType the type of the matrix we are applying the unary operator + * + * This class represents a lvalue expression of a generic unary view operator of a matrix or a vector. + * It is the return type of real() and imag(), and most of the time this is the only way it is used. + * + * \sa MatrixBase::unaryViewExpr(const CustomUnaryOp &) const, class CwiseUnaryOp + */ template class CwiseUnaryView : public CwiseUnaryViewImpl::StorageKind> { @@ -62,32 +61,44 @@ class CwiseUnaryView : public CwiseUnaryViewImpl::StorageKind>::Base Base; EIGEN_GENERIC_PUBLIC_INTERFACE(CwiseUnaryView) + typedef typename internal::ref_selector::non_const_type MatrixTypeNested; + typedef typename internal::remove_all::type NestedExpression; - inline CwiseUnaryView(const MatrixType& mat, const ViewOp& func = ViewOp()) + explicit EIGEN_DEVICE_FUNC inline CwiseUnaryView(MatrixType& mat, const ViewOp& func = ViewOp()) : m_matrix(mat), m_functor(func) {} EIGEN_INHERIT_ASSIGNMENT_OPERATORS(CwiseUnaryView) - EIGEN_STRONG_INLINE Index rows() const { return m_matrix.rows(); } - EIGEN_STRONG_INLINE Index cols() const { return m_matrix.cols(); } + EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE EIGEN_CONSTEXPR + Index rows() const EIGEN_NOEXCEPT { return m_matrix.rows(); } + EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE EIGEN_CONSTEXPR + Index cols() const EIGEN_NOEXCEPT { return m_matrix.cols(); } /** \returns the functor representing unary operation */ - const ViewOp& functor() const { return m_functor; } + EIGEN_DEVICE_FUNC const ViewOp& functor() const { return m_functor; } /** \returns the nested expression */ - const typename internal::remove_all::type& + EIGEN_DEVICE_FUNC const typename internal::remove_all::type& nestedExpression() const { return m_matrix; } /** \returns the nested expression */ - typename internal::remove_all::type& - nestedExpression() { return m_matrix.const_cast_derived(); } + EIGEN_DEVICE_FUNC typename internal::remove_reference::type& + nestedExpression() { return m_matrix; } protected: - // FIXME changed from MatrixType::Nested because of a weird compilation error with sun CC - typename internal::nested::type m_matrix; + MatrixTypeNested m_matrix; ViewOp m_functor; }; +// Generic API dispatcher +template +class CwiseUnaryViewImpl + : public internal::generic_xpr_base >::type +{ +public: + typedef typename internal::generic_xpr_base >::type Base; +}; + template class CwiseUnaryViewImpl : public internal::dense_xpr_base< CwiseUnaryView >::type @@ -99,39 +110,21 @@ class CwiseUnaryViewImpl EIGEN_DENSE_PUBLIC_INTERFACE(Derived) EIGEN_INHERIT_ASSIGNMENT_OPERATORS(CwiseUnaryViewImpl) - - inline Scalar* data() { return &coeffRef(0); } - inline const Scalar* data() const { return &coeff(0); } - inline Index innerStride() const + EIGEN_DEVICE_FUNC inline Scalar* data() { return &(this->coeffRef(0)); } + EIGEN_DEVICE_FUNC inline const Scalar* data() const { return &(this->coeff(0)); } + + EIGEN_DEVICE_FUNC EIGEN_CONSTEXPR inline Index innerStride() const { return derived().nestedExpression().innerStride() * sizeof(typename internal::traits::Scalar) / sizeof(Scalar); } - inline Index outerStride() const + EIGEN_DEVICE_FUNC EIGEN_CONSTEXPR inline Index outerStride() const { return derived().nestedExpression().outerStride() * sizeof(typename internal::traits::Scalar) / sizeof(Scalar); } - - EIGEN_STRONG_INLINE CoeffReturnType coeff(Index row, Index col) const - { - return derived().functor()(derived().nestedExpression().coeff(row, col)); - } - - EIGEN_STRONG_INLINE CoeffReturnType coeff(Index index) const - { - return derived().functor()(derived().nestedExpression().coeff(index)); - } - - EIGEN_STRONG_INLINE Scalar& coeffRef(Index row, Index col) - { - return derived().functor()(const_cast_derived().nestedExpression().coeffRef(row, col)); - } - - EIGEN_STRONG_INLINE Scalar& coeffRef(Index index) - { - return derived().functor()(const_cast_derived().nestedExpression().coeffRef(index)); - } + protected: + EIGEN_DEFAULT_EMPTY_CONSTRUCTOR_AND_DESTRUCTOR(CwiseUnaryViewImpl) }; } // end namespace Eigen diff --git a/extern/eigen/Eigen/src/Core/DenseBase.h b/extern/eigen/Eigen/src/Core/DenseBase.h index 4b371b07..9b16db68 100644 --- a/extern/eigen/Eigen/src/Core/DenseBase.h +++ b/extern/eigen/Eigen/src/Core/DenseBase.h @@ -14,15 +14,15 @@ namespace Eigen { namespace internal { - + // The index type defined by EIGEN_DEFAULT_DENSE_INDEX_TYPE must be a signed type. // This dummy function simply aims at checking that at compile time. static inline void check_DenseIndex_is_signed() { - EIGEN_STATIC_ASSERT(NumTraits::IsSigned,THE_INDEX_TYPE_MUST_BE_A_SIGNED_TYPE); + EIGEN_STATIC_ASSERT(NumTraits::IsSigned,THE_INDEX_TYPE_MUST_BE_A_SIGNED_TYPE) } } // end namespace internal - + /** \class DenseBase * \ingroup Core_Module * @@ -34,37 +34,45 @@ static inline void check_DenseIndex_is_signed() { * \tparam Derived is the derived type, e.g., a matrix type or an expression. * * This class can be extended with the help of the plugin mechanism described on the page - * \ref TopicCustomizingEigen by defining the preprocessor symbol \c EIGEN_DENSEBASE_PLUGIN. + * \ref TopicCustomizing_Plugins by defining the preprocessor symbol \c EIGEN_DENSEBASE_PLUGIN. * - * \sa \ref TopicClassHierarchy + * \sa \blank \ref TopicClassHierarchy */ template class DenseBase #ifndef EIGEN_PARSED_BY_DOXYGEN - : public internal::special_scalar_op_base::Scalar, - typename NumTraits::Scalar>::Real, - DenseCoeffsBase > + : public DenseCoeffsBase::value> #else - : public DenseCoeffsBase + : public DenseCoeffsBase #endif // not EIGEN_PARSED_BY_DOXYGEN { public: - class InnerIterator; + /** Inner iterator type to iterate over the coefficients of a row or column. + * \sa class InnerIterator + */ + typedef Eigen::InnerIterator InnerIterator; typedef typename internal::traits::StorageKind StorageKind; - /** \brief The type of indices - * \details To change this, \c \#define the preprocessor symbol \c EIGEN_DEFAULT_DENSE_INDEX_TYPE. - * \sa \ref TopicPreprocessorDirectives. - */ - typedef typename internal::traits::Index Index; + /** + * \brief The type used to store indices + * \details This typedef is relevant for types that store multiple indices such as + * PermutationMatrix or Transpositions, otherwise it defaults to Eigen::Index + * \sa \blank \ref TopicPreprocessorDirectives, Eigen::Index, SparseMatrixBase. + */ + typedef typename internal::traits::StorageIndex StorageIndex; + /** The numeric type of the expression' coefficients, e.g. float, double, int or std::complex, etc. */ typedef typename internal::traits::Scalar Scalar; - typedef typename internal::packet_traits::type PacketScalar; + + /** The numeric type of the expression' coefficients, e.g. float, double, int or std::complex, etc. + * + * It is an alias for the Scalar type */ + typedef Scalar value_type; + typedef typename NumTraits::Real RealScalar; - typedef internal::special_scalar_op_base > Base; + typedef DenseCoeffsBase::value> Base; - using Base::operator*; using Base::derived; using Base::const_cast_derived; using Base::rows; @@ -74,16 +82,6 @@ template class DenseBase using Base::colIndexByOuterInner; using Base::coeff; using Base::coeffByOuterInner; - using Base::packet; - using Base::packetByOuterInner; - using Base::writePacket; - using Base::writePacketByOuterInner; - using Base::coeffRef; - using Base::coeffRefByOuterInner; - using Base::copyCoeff; - using Base::copyCoeffByOuterInner; - using Base::copyPacket; - using Base::copyPacketByOuterInner; using Base::operator(); using Base::operator[]; using Base::x; @@ -152,13 +150,18 @@ template class DenseBase * \sa SizeAtCompileTime, MaxRowsAtCompileTime, MaxColsAtCompileTime */ - IsVectorAtCompileTime = internal::traits::MaxRowsAtCompileTime == 1 - || internal::traits::MaxColsAtCompileTime == 1, + IsVectorAtCompileTime = internal::traits::RowsAtCompileTime == 1 + || internal::traits::ColsAtCompileTime == 1, /**< This is set to true if either the number of rows or the number of * columns is known at compile-time to be equal to 1. Indeed, in that case, * we are dealing with a column-vector (if there is only one column) or with * a row-vector (if there is only one row). */ + NumDimensions = int(MaxSizeAtCompileTime) == 1 ? 0 : bool(IsVectorAtCompileTime) ? 1 : 2, + /**< This value is equal to Tensor::NumDimensions, i.e. 0 for scalars, 1 for vectors, + * and 2 for matrices. + */ + Flags = internal::traits::Flags, /**< This stores expression \ref flags flags which may or may not be inherited by new expressions * constructed from this one. See the \ref flags "list of flags". @@ -169,19 +172,46 @@ template class DenseBase InnerSizeAtCompileTime = int(IsVectorAtCompileTime) ? int(SizeAtCompileTime) : int(IsRowMajor) ? int(ColsAtCompileTime) : int(RowsAtCompileTime), - CoeffReadCost = internal::traits::CoeffReadCost, - /**< This is a rough measure of how expensive it is to read one coefficient from - * this expression. - */ - InnerStrideAtCompileTime = internal::inner_stride_at_compile_time::ret, OuterStrideAtCompileTime = internal::outer_stride_at_compile_time::ret }; - enum { ThisConstantIsPrivateInPlainObjectBase }; + typedef typename internal::find_best_packet::type PacketScalar; + + enum { IsPlainObjectBase = 0 }; + + /** The plain matrix type corresponding to this expression. + * \sa PlainObject */ + typedef Matrix::Scalar, + internal::traits::RowsAtCompileTime, + internal::traits::ColsAtCompileTime, + AutoAlign | (internal::traits::Flags&RowMajorBit ? RowMajor : ColMajor), + internal::traits::MaxRowsAtCompileTime, + internal::traits::MaxColsAtCompileTime + > PlainMatrix; + + /** The plain array type corresponding to this expression. + * \sa PlainObject */ + typedef Array::Scalar, + internal::traits::RowsAtCompileTime, + internal::traits::ColsAtCompileTime, + AutoAlign | (internal::traits::Flags&RowMajorBit ? RowMajor : ColMajor), + internal::traits::MaxRowsAtCompileTime, + internal::traits::MaxColsAtCompileTime + > PlainArray; + + /** \brief The plain matrix or array type corresponding to this expression. + * + * This is not necessarily exactly the return type of eval(). In the case of plain matrices, + * the return type of eval() is a const reference to a matrix, not a matrix! It is however guaranteed + * that the return type of eval() is either PlainObject or const PlainObject&. + */ + typedef typename internal::conditional::XprKind,MatrixXpr >::value, + PlainMatrix, PlainArray>::type PlainObject; /** \returns the number of nonzero coefficients which is in practice the number * of stored coefficients. */ + EIGEN_DEVICE_FUNC EIGEN_CONSTEXPR inline Index nonZeros() const { return size(); } /** \returns the outer size. @@ -189,6 +219,7 @@ template class DenseBase * \note For a vector, this returns just 1. For a matrix (non-vector), this is the major dimension * with respect to the \ref TopicStorageOrders "storage order", i.e., the number of columns for a * column-major matrix, and the number of rows for a row-major matrix. */ + EIGEN_DEVICE_FUNC EIGEN_CONSTEXPR Index outerSize() const { return IsVectorAtCompileTime ? 1 @@ -198,8 +229,9 @@ template class DenseBase /** \returns the inner size. * * \note For a vector, this is just the size. For a matrix (non-vector), this is the minor dimension - * with respect to the \ref TopicStorageOrders "storage order", i.e., the number of rows for a + * with respect to the \ref TopicStorageOrders "storage order", i.e., the number of rows for a * column-major matrix, and the number of columns for a row-major matrix. */ + EIGEN_DEVICE_FUNC EIGEN_CONSTEXPR Index innerSize() const { return IsVectorAtCompileTime ? this->size() @@ -210,6 +242,7 @@ template class DenseBase * Matrix::resize() and Array::resize(). The present method only asserts that the new size equals the old size, and does * nothing else. */ + EIGEN_DEVICE_FUNC void resize(Index newSize) { EIGEN_ONLY_USED_FOR_DEBUG(newSize); @@ -220,22 +253,22 @@ template class DenseBase * Matrix::resize() and Array::resize(). The present method only asserts that the new size equals the old size, and does * nothing else. */ - void resize(Index nbRows, Index nbCols) + EIGEN_DEVICE_FUNC + void resize(Index rows, Index cols) { - EIGEN_ONLY_USED_FOR_DEBUG(nbRows); - EIGEN_ONLY_USED_FOR_DEBUG(nbCols); - eigen_assert(nbRows == this->rows() && nbCols == this->cols() + EIGEN_ONLY_USED_FOR_DEBUG(rows); + EIGEN_ONLY_USED_FOR_DEBUG(cols); + eigen_assert(rows == this->rows() && cols == this->cols() && "DenseBase::resize() does not actually allow to resize."); } #ifndef EIGEN_PARSED_BY_DOXYGEN - /** \internal Represents a matrix with all coefficients equal to one another*/ - typedef CwiseNullaryOp,Derived> ConstantReturnType; - /** \internal Represents a vector with linearly spaced coefficients that allows sequential access only. */ - typedef CwiseNullaryOp,Derived> SequentialLinSpacedReturnType; + typedef CwiseNullaryOp,PlainObject> ConstantReturnType; + /** \internal \deprecated Represents a vector with linearly spaced coefficients that allows sequential access only. */ + EIGEN_DEPRECATED typedef CwiseNullaryOp,PlainObject> SequentialLinSpacedReturnType; /** \internal Represents a vector with linearly spaced coefficients that allows random access. */ - typedef CwiseNullaryOp,Derived> RandomAccessLinSpacedReturnType; + typedef CwiseNullaryOp,PlainObject> RandomAccessLinSpacedReturnType; /** \internal the return type of MatrixBase::eigenvalues() */ typedef Matrix::Scalar>::Real, internal::traits::ColsAtCompileTime, 1> EigenvaluesReturnType; @@ -243,120 +276,134 @@ template class DenseBase /** Copies \a other into *this. \returns a reference to *this. */ template + EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Derived& operator=(const DenseBase& other); /** Special case of the template operator=, in order to prevent the compiler * from generating a default operator= (issue hit with g++ 4.1) */ + EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Derived& operator=(const DenseBase& other); template + EIGEN_DEVICE_FUNC Derived& operator=(const EigenBase &other); template + EIGEN_DEVICE_FUNC Derived& operator+=(const EigenBase &other); template + EIGEN_DEVICE_FUNC Derived& operator-=(const EigenBase &other); template + EIGEN_DEVICE_FUNC Derived& operator=(const ReturnByValue& func); - /** \internal Copies \a other into *this without evaluating other. \returns a reference to *this. */ + /** \internal + * Copies \a other into *this without evaluating other. \returns a reference to *this. */ template + /** \deprecated */ + EIGEN_DEPRECATED EIGEN_DEVICE_FUNC Derived& lazyAssign(const DenseBase& other); - /** \internal Evaluates \a other into *this. \returns a reference to *this. */ - template - Derived& lazyAssign(const ReturnByValue& other); - + EIGEN_DEVICE_FUNC CommaInitializer operator<< (const Scalar& s); template - const Flagged flagged() const; + /** \deprecated it now returns \c *this */ + EIGEN_DEPRECATED + const Derived& flagged() const + { return derived(); } template + EIGEN_DEVICE_FUNC CommaInitializer operator<< (const DenseBase& other); - Eigen::Transpose transpose(); - typedef typename internal::add_const >::type ConstTransposeReturnType; + typedef Transpose TransposeReturnType; + EIGEN_DEVICE_FUNC + TransposeReturnType transpose(); + typedef typename internal::add_const >::type ConstTransposeReturnType; + EIGEN_DEVICE_FUNC ConstTransposeReturnType transpose() const; + EIGEN_DEVICE_FUNC void transposeInPlace(); -#ifndef EIGEN_NO_DEBUG - protected: - template - void checkTransposeAliasing(const OtherDerived& other) const; - public: -#endif - - static const ConstantReturnType + EIGEN_DEVICE_FUNC static const ConstantReturnType Constant(Index rows, Index cols, const Scalar& value); - static const ConstantReturnType + EIGEN_DEVICE_FUNC static const ConstantReturnType Constant(Index size, const Scalar& value); - static const ConstantReturnType + EIGEN_DEVICE_FUNC static const ConstantReturnType Constant(const Scalar& value); - static const SequentialLinSpacedReturnType + EIGEN_DEPRECATED EIGEN_DEVICE_FUNC static const RandomAccessLinSpacedReturnType LinSpaced(Sequential_t, Index size, const Scalar& low, const Scalar& high); - static const RandomAccessLinSpacedReturnType - LinSpaced(Index size, const Scalar& low, const Scalar& high); - static const SequentialLinSpacedReturnType + EIGEN_DEPRECATED EIGEN_DEVICE_FUNC static const RandomAccessLinSpacedReturnType LinSpaced(Sequential_t, const Scalar& low, const Scalar& high); - static const RandomAccessLinSpacedReturnType + + EIGEN_DEVICE_FUNC static const RandomAccessLinSpacedReturnType + LinSpaced(Index size, const Scalar& low, const Scalar& high); + EIGEN_DEVICE_FUNC static const RandomAccessLinSpacedReturnType LinSpaced(const Scalar& low, const Scalar& high); - template - static const CwiseNullaryOp + template EIGEN_DEVICE_FUNC + static const CwiseNullaryOp NullaryExpr(Index rows, Index cols, const CustomNullaryOp& func); - template - static const CwiseNullaryOp + template EIGEN_DEVICE_FUNC + static const CwiseNullaryOp NullaryExpr(Index size, const CustomNullaryOp& func); - template - static const CwiseNullaryOp + template EIGEN_DEVICE_FUNC + static const CwiseNullaryOp NullaryExpr(const CustomNullaryOp& func); - static const ConstantReturnType Zero(Index rows, Index cols); - static const ConstantReturnType Zero(Index size); - static const ConstantReturnType Zero(); - static const ConstantReturnType Ones(Index rows, Index cols); - static const ConstantReturnType Ones(Index size); - static const ConstantReturnType Ones(); - - void fill(const Scalar& value); - Derived& setConstant(const Scalar& value); - Derived& setLinSpaced(Index size, const Scalar& low, const Scalar& high); - Derived& setLinSpaced(const Scalar& low, const Scalar& high); - Derived& setZero(); - Derived& setOnes(); - Derived& setRandom(); - - template + EIGEN_DEVICE_FUNC static const ConstantReturnType Zero(Index rows, Index cols); + EIGEN_DEVICE_FUNC static const ConstantReturnType Zero(Index size); + EIGEN_DEVICE_FUNC static const ConstantReturnType Zero(); + EIGEN_DEVICE_FUNC static const ConstantReturnType Ones(Index rows, Index cols); + EIGEN_DEVICE_FUNC static const ConstantReturnType Ones(Index size); + EIGEN_DEVICE_FUNC static const ConstantReturnType Ones(); + + EIGEN_DEVICE_FUNC void fill(const Scalar& value); + EIGEN_DEVICE_FUNC Derived& setConstant(const Scalar& value); + EIGEN_DEVICE_FUNC Derived& setLinSpaced(Index size, const Scalar& low, const Scalar& high); + EIGEN_DEVICE_FUNC Derived& setLinSpaced(const Scalar& low, const Scalar& high); + EIGEN_DEVICE_FUNC Derived& setZero(); + EIGEN_DEVICE_FUNC Derived& setOnes(); + EIGEN_DEVICE_FUNC Derived& setRandom(); + + template EIGEN_DEVICE_FUNC bool isApprox(const DenseBase& other, const RealScalar& prec = NumTraits::dummy_precision()) const; + EIGEN_DEVICE_FUNC bool isMuchSmallerThan(const RealScalar& other, const RealScalar& prec = NumTraits::dummy_precision()) const; - template + template EIGEN_DEVICE_FUNC bool isMuchSmallerThan(const DenseBase& other, const RealScalar& prec = NumTraits::dummy_precision()) const; - bool isApproxToConstant(const Scalar& value, const RealScalar& prec = NumTraits::dummy_precision()) const; - bool isConstant(const Scalar& value, const RealScalar& prec = NumTraits::dummy_precision()) const; - bool isZero(const RealScalar& prec = NumTraits::dummy_precision()) const; - bool isOnes(const RealScalar& prec = NumTraits::dummy_precision()) const; - + EIGEN_DEVICE_FUNC bool isApproxToConstant(const Scalar& value, const RealScalar& prec = NumTraits::dummy_precision()) const; + EIGEN_DEVICE_FUNC bool isConstant(const Scalar& value, const RealScalar& prec = NumTraits::dummy_precision()) const; + EIGEN_DEVICE_FUNC bool isZero(const RealScalar& prec = NumTraits::dummy_precision()) const; + EIGEN_DEVICE_FUNC bool isOnes(const RealScalar& prec = NumTraits::dummy_precision()) const; + inline bool hasNaN() const; inline bool allFinite() const; - inline Derived& operator*=(const Scalar& other); - inline Derived& operator/=(const Scalar& other); + EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE + Derived& operator*=(const Scalar& other); + EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE + Derived& operator/=(const Scalar& other); typedef typename internal::add_const_on_value_type::type>::type EvalReturnType; /** \returns the matrix or vector obtained by evaluating this expression. * * Notice that in the case of a plain matrix or vector (not an expression) this function just returns * a const reference, in order to avoid a useless copy. + * + * \warning Be careful with eval() and the auto C++ keyword, as detailed in this \link TopicPitfalls_auto_keyword page \endlink. */ + EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE EvalReturnType eval() const { // Even though MSVC does not honor strong inlining when the return type @@ -369,56 +416,113 @@ template class DenseBase * */ template - void swap(const DenseBase& other, - int = OtherDerived::ThisConstantIsPrivateInPlainObjectBase) + EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE + void swap(const DenseBase& other) { - SwapWrapper(derived()).lazyAssign(other.derived()); + EIGEN_STATIC_ASSERT(!OtherDerived::IsPlainObjectBase,THIS_EXPRESSION_IS_NOT_A_LVALUE__IT_IS_READ_ONLY); + eigen_assert(rows()==other.rows() && cols()==other.cols()); + call_assignment(derived(), other.const_cast_derived(), internal::swap_assign_op()); } /** swaps *this with the matrix or array \a other. * */ template + EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE void swap(PlainObjectBase& other) { - SwapWrapper(derived()).lazyAssign(other.derived()); + eigen_assert(rows()==other.rows() && cols()==other.cols()); + call_assignment(derived(), other.derived(), internal::swap_assign_op()); } + EIGEN_DEVICE_FUNC inline const NestByValue nestByValue() const; + EIGEN_DEVICE_FUNC inline const ForceAlignedAccess forceAlignedAccess() const; + EIGEN_DEVICE_FUNC inline ForceAlignedAccess forceAlignedAccess(); + template EIGEN_DEVICE_FUNC + inline const typename internal::conditional,Derived&>::type forceAlignedAccessIf() const; + template EIGEN_DEVICE_FUNC + inline typename internal::conditional,Derived&>::type forceAlignedAccessIf(); - inline const NestByValue nestByValue() const; - inline const ForceAlignedAccess forceAlignedAccess() const; - inline ForceAlignedAccess forceAlignedAccess(); - template inline const typename internal::conditional,Derived&>::type forceAlignedAccessIf() const; - template inline typename internal::conditional,Derived&>::type forceAlignedAccessIf(); + EIGEN_DEVICE_FUNC Scalar sum() const; + EIGEN_DEVICE_FUNC Scalar mean() const; + EIGEN_DEVICE_FUNC Scalar trace() const; - Scalar sum() const; - Scalar mean() const; - Scalar trace() const; + EIGEN_DEVICE_FUNC Scalar prod() const; - Scalar prod() const; + template + EIGEN_DEVICE_FUNC typename internal::traits::Scalar minCoeff() const; + template + EIGEN_DEVICE_FUNC typename internal::traits::Scalar maxCoeff() const; - typename internal::traits::Scalar minCoeff() const; - typename internal::traits::Scalar maxCoeff() const; - template + // By default, the fastest version with undefined NaN propagation semantics is + // used. + // TODO(rmlarsen): Replace with default template argument when we move to + // c++11 or beyond. + EIGEN_DEVICE_FUNC inline typename internal::traits::Scalar minCoeff() const { + return minCoeff(); + } + EIGEN_DEVICE_FUNC inline typename internal::traits::Scalar maxCoeff() const { + return maxCoeff(); + } + + template + EIGEN_DEVICE_FUNC typename internal::traits::Scalar minCoeff(IndexType* row, IndexType* col) const; - template + template + EIGEN_DEVICE_FUNC typename internal::traits::Scalar maxCoeff(IndexType* row, IndexType* col) const; - template + template + EIGEN_DEVICE_FUNC typename internal::traits::Scalar minCoeff(IndexType* index) const; - template + template + EIGEN_DEVICE_FUNC typename internal::traits::Scalar maxCoeff(IndexType* index) const; + // TODO(rmlarsen): Replace these methods with a default template argument. + template + EIGEN_DEVICE_FUNC inline + typename internal::traits::Scalar minCoeff(IndexType* row, IndexType* col) const { + return minCoeff(row, col); + } + template + EIGEN_DEVICE_FUNC inline + typename internal::traits::Scalar maxCoeff(IndexType* row, IndexType* col) const { + return maxCoeff(row, col); + } + template + EIGEN_DEVICE_FUNC inline + typename internal::traits::Scalar minCoeff(IndexType* index) const { + return minCoeff(index); + } + template + EIGEN_DEVICE_FUNC inline + typename internal::traits::Scalar maxCoeff(IndexType* index) const { + return maxCoeff(index); + } + template - typename internal::result_of::Scalar)>::type - redux(const BinaryOp& func) const; + EIGEN_DEVICE_FUNC + Scalar redux(const BinaryOp& func) const; template + EIGEN_DEVICE_FUNC void visit(Visitor& func) const; - inline const WithFormat format(const IOFormat& fmt) const; + /** \returns a WithFormat proxy object allowing to print a matrix the with given + * format \a fmt. + * + * See class IOFormat for some examples. + * + * \sa class IOFormat, class WithFormat + */ + inline const WithFormat format(const IOFormat& fmt) const + { + return WithFormat(derived(), fmt); + } /** \returns the unique coefficient of a 1x1 expression */ + EIGEN_DEVICE_FUNC CoeffReturnType value() const { EIGEN_STATIC_ASSERT_SIZE_1x1(Derived) @@ -426,82 +530,158 @@ template class DenseBase return derived().coeff(0,0); } - bool all(void) const; - bool any(void) const; - Index count() const; + EIGEN_DEVICE_FUNC bool all() const; + EIGEN_DEVICE_FUNC bool any() const; + EIGEN_DEVICE_FUNC Index count() const; typedef VectorwiseOp RowwiseReturnType; typedef const VectorwiseOp ConstRowwiseReturnType; typedef VectorwiseOp ColwiseReturnType; typedef const VectorwiseOp ConstColwiseReturnType; - ConstRowwiseReturnType rowwise() const; - RowwiseReturnType rowwise(); - ConstColwiseReturnType colwise() const; - ColwiseReturnType colwise(); + /** \returns a VectorwiseOp wrapper of *this for broadcasting and partial reductions + * + * Example: \include MatrixBase_rowwise.cpp + * Output: \verbinclude MatrixBase_rowwise.out + * + * \sa colwise(), class VectorwiseOp, \ref TutorialReductionsVisitorsBroadcasting + */ + //Code moved here due to a CUDA compiler bug + EIGEN_DEVICE_FUNC inline ConstRowwiseReturnType rowwise() const { + return ConstRowwiseReturnType(derived()); + } + EIGEN_DEVICE_FUNC RowwiseReturnType rowwise(); + + /** \returns a VectorwiseOp wrapper of *this broadcasting and partial reductions + * + * Example: \include MatrixBase_colwise.cpp + * Output: \verbinclude MatrixBase_colwise.out + * + * \sa rowwise(), class VectorwiseOp, \ref TutorialReductionsVisitorsBroadcasting + */ + EIGEN_DEVICE_FUNC inline ConstColwiseReturnType colwise() const { + return ConstColwiseReturnType(derived()); + } + EIGEN_DEVICE_FUNC ColwiseReturnType colwise(); - static const CwiseNullaryOp,Derived> Random(Index rows, Index cols); - static const CwiseNullaryOp,Derived> Random(Index size); - static const CwiseNullaryOp,Derived> Random(); + typedef CwiseNullaryOp,PlainObject> RandomReturnType; + static const RandomReturnType Random(Index rows, Index cols); + static const RandomReturnType Random(Index size); + static const RandomReturnType Random(); template - const Select + inline EIGEN_DEVICE_FUNC const Select select(const DenseBase& thenMatrix, const DenseBase& elseMatrix) const; template - inline const Select + inline EIGEN_DEVICE_FUNC const Select select(const DenseBase& thenMatrix, const typename ThenDerived::Scalar& elseScalar) const; template - inline const Select + inline EIGEN_DEVICE_FUNC const Select select(const typename ElseDerived::Scalar& thenScalar, const DenseBase& elseMatrix) const; template RealScalar lpNorm() const; template - inline const Replicate replicate() const; - - typedef Replicate ReplicateReturnType; - inline const ReplicateReturnType replicate(Index rowFacor,Index colFactor) const; + EIGEN_DEVICE_FUNC + const Replicate replicate() const; + /** + * \return an expression of the replication of \c *this + * + * Example: \include MatrixBase_replicate_int_int.cpp + * Output: \verbinclude MatrixBase_replicate_int_int.out + * + * \sa VectorwiseOp::replicate(), DenseBase::replicate(), class Replicate + */ + //Code moved here due to a CUDA compiler bug + EIGEN_DEVICE_FUNC + const Replicate replicate(Index rowFactor, Index colFactor) const + { + return Replicate(derived(), rowFactor, colFactor); + } typedef Reverse ReverseReturnType; typedef const Reverse ConstReverseReturnType; - ReverseReturnType reverse(); - ConstReverseReturnType reverse() const; - void reverseInPlace(); + EIGEN_DEVICE_FUNC ReverseReturnType reverse(); + /** This is the const version of reverse(). */ + //Code moved here due to a CUDA compiler bug + EIGEN_DEVICE_FUNC ConstReverseReturnType reverse() const + { + return ConstReverseReturnType(derived()); + } + EIGEN_DEVICE_FUNC void reverseInPlace(); + + #ifdef EIGEN_PARSED_BY_DOXYGEN + /** STL-like RandomAccessIterator + * iterator type as returned by the begin() and end() methods. + */ + typedef random_access_iterator_type iterator; + /** This is the const version of iterator (aka read-only) */ + typedef random_access_iterator_type const_iterator; + #else + typedef typename internal::conditional< (Flags&DirectAccessBit)==DirectAccessBit, + internal::pointer_based_stl_iterator, + internal::generic_randaccess_stl_iterator + >::type iterator_type; + + typedef typename internal::conditional< (Flags&DirectAccessBit)==DirectAccessBit, + internal::pointer_based_stl_iterator, + internal::generic_randaccess_stl_iterator + >::type const_iterator_type; + + // Stl-style iterators are supported only for vectors. + + typedef typename internal::conditional< IsVectorAtCompileTime, + iterator_type, + void + >::type iterator; + + typedef typename internal::conditional< IsVectorAtCompileTime, + const_iterator_type, + void + >::type const_iterator; + #endif + + inline iterator begin(); + inline const_iterator begin() const; + inline const_iterator cbegin() const; + inline iterator end(); + inline const_iterator end() const; + inline const_iterator cend() const; #define EIGEN_CURRENT_STORAGE_BASE_CLASS Eigen::DenseBase +#define EIGEN_DOC_BLOCK_ADDONS_NOT_INNER_PANEL +#define EIGEN_DOC_BLOCK_ADDONS_INNER_PANEL_IF(COND) +#define EIGEN_DOC_UNARY_ADDONS(X,Y) +# include "../plugins/CommonCwiseUnaryOps.h" # include "../plugins/BlockMethods.h" +# include "../plugins/IndexedViewMethods.h" +# include "../plugins/ReshapedMethods.h" # ifdef EIGEN_DENSEBASE_PLUGIN # include EIGEN_DENSEBASE_PLUGIN # endif #undef EIGEN_CURRENT_STORAGE_BASE_CLASS - -#ifdef EIGEN2_SUPPORT - - Block corner(CornerType type, Index cRows, Index cCols); - const Block corner(CornerType type, Index cRows, Index cCols) const; - template - Block corner(CornerType type); - template - const Block corner(CornerType type) const; - -#endif // EIGEN2_SUPPORT - +#undef EIGEN_DOC_BLOCK_ADDONS_NOT_INNER_PANEL +#undef EIGEN_DOC_BLOCK_ADDONS_INNER_PANEL_IF +#undef EIGEN_DOC_UNARY_ADDONS // disable the use of evalTo for dense objects with a nice compilation error - template inline void evalTo(Dest& ) const + template + EIGEN_DEVICE_FUNC + inline void evalTo(Dest& ) const { EIGEN_STATIC_ASSERT((internal::is_same::value),THE_EVAL_EVALTO_FUNCTION_SHOULD_NEVER_BE_CALLED_FOR_DENSE_OBJECTS); } protected: + EIGEN_DEFAULT_COPY_CONSTRUCTOR(DenseBase) /** Default constructor. Do nothing. */ - DenseBase() + EIGEN_DEVICE_FUNC DenseBase() { /* Just checks for self-consistency of the flags. - * Only do it when debugging Eigen, as this borders on paranoiac and could slow compilation down + * Only do it when debugging Eigen, as this borders on paranoia and could slow compilation down */ #ifdef EIGEN_INTERNAL_DEBUGGING EIGEN_STATIC_ASSERT((EIGEN_IMPLIES(MaxRowsAtCompileTime==1 && MaxColsAtCompileTime!=1, int(IsRowMajor)) @@ -511,9 +691,9 @@ template class DenseBase } private: - explicit DenseBase(int); - DenseBase(int,int); - template explicit DenseBase(const DenseBase&); + EIGEN_DEVICE_FUNC explicit DenseBase(int); + EIGEN_DEVICE_FUNC DenseBase(int,int); + template EIGEN_DEVICE_FUNC explicit DenseBase(const DenseBase&); }; } // end namespace Eigen diff --git a/extern/eigen/Eigen/src/Core/DenseCoeffsBase.h b/extern/eigen/Eigen/src/Core/DenseCoeffsBase.h index 3c890f21..37fcdb59 100644 --- a/extern/eigen/Eigen/src/Core/DenseCoeffsBase.h +++ b/extern/eigen/Eigen/src/Core/DenseCoeffsBase.h @@ -22,11 +22,12 @@ template struct add_const_on_value_type_if_arithmetic /** \brief Base class providing read-only coefficient access to matrices and arrays. * \ingroup Core_Module * \tparam Derived Type of the derived class - * \tparam #ReadOnlyAccessors Constant indicating read-only access + * + * \note #ReadOnlyAccessors Constant indicating read-only access * * This class defines the \c operator() \c const function and friends, which can be used to read specific * entries of a matrix or array. - * + * * \sa DenseCoeffsBase, DenseCoeffsBase, * \ref TopicClassHierarchy */ @@ -35,7 +36,6 @@ class DenseCoeffsBase : public EigenBase { public: typedef typename internal::traits::StorageKind StorageKind; - typedef typename internal::traits::Index Index; typedef typename internal::traits::Scalar Scalar; typedef typename internal::packet_traits::type PacketScalar; @@ -61,6 +61,7 @@ class DenseCoeffsBase : public EigenBase using Base::size; using Base::derived; + EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Index rowIndexByOuterInner(Index outer, Index inner) const { return int(Derived::RowsAtCompileTime) == 1 ? 0 @@ -69,6 +70,7 @@ class DenseCoeffsBase : public EigenBase : inner; } + EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Index colIndexByOuterInner(Index outer, Index inner) const { return int(Derived::ColsAtCompileTime) == 1 ? 0 @@ -91,13 +93,15 @@ class DenseCoeffsBase : public EigenBase * * \sa operator()(Index,Index) const, coeffRef(Index,Index), coeff(Index) const */ + EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE CoeffReturnType coeff(Index row, Index col) const { eigen_internal_assert(row >= 0 && row < rows() - && col >= 0 && col < cols()); - return derived().coeff(row, col); + && col >= 0 && col < cols()); + return internal::evaluator(derived()).coeff(row,col); } + EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE CoeffReturnType coeffByOuterInner(Index outer, Index inner) const { return coeff(rowIndexByOuterInner(outer, inner), @@ -108,11 +112,12 @@ class DenseCoeffsBase : public EigenBase * * \sa operator()(Index,Index), operator[](Index) */ + EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE CoeffReturnType operator()(Index row, Index col) const { eigen_assert(row >= 0 && row < rows() && col >= 0 && col < cols()); - return derived().coeff(row, col); + return coeff(row, col); } /** Short version: don't use this function, use @@ -130,11 +135,14 @@ class DenseCoeffsBase : public EigenBase * \sa operator[](Index) const, coeffRef(Index), coeff(Index,Index) const */ + EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE CoeffReturnType coeff(Index index) const { + EIGEN_STATIC_ASSERT(internal::evaluator::Flags & LinearAccessBit, + THIS_COEFFICIENT_ACCESSOR_TAKING_ONE_ACCESS_IS_ONLY_FOR_EXPRESSIONS_ALLOWING_LINEAR_ACCESS) eigen_internal_assert(index >= 0 && index < size()); - return derived().coeff(index); + return internal::evaluator(derived()).coeff(index); } @@ -146,15 +154,14 @@ class DenseCoeffsBase : public EigenBase * z() const, w() const */ + EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE CoeffReturnType operator[](Index index) const { - #ifndef EIGEN2_SUPPORT EIGEN_STATIC_ASSERT(Derived::IsVectorAtCompileTime, THE_BRACKET_OPERATOR_IS_ONLY_FOR_VECTORS__USE_THE_PARENTHESIS_OPERATOR_INSTEAD) - #endif eigen_assert(index >= 0 && index < size()); - return derived().coeff(index); + return coeff(index); } /** \returns the coefficient at given index. @@ -167,32 +174,49 @@ class DenseCoeffsBase : public EigenBase * z() const, w() const */ + EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE CoeffReturnType operator()(Index index) const { eigen_assert(index >= 0 && index < size()); - return derived().coeff(index); + return coeff(index); } /** equivalent to operator[](0). */ + EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE CoeffReturnType x() const { return (*this)[0]; } /** equivalent to operator[](1). */ + EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE CoeffReturnType - y() const { return (*this)[1]; } + y() const + { + EIGEN_STATIC_ASSERT(Derived::SizeAtCompileTime==-1 || Derived::SizeAtCompileTime>=2, OUT_OF_RANGE_ACCESS); + return (*this)[1]; + } /** equivalent to operator[](2). */ + EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE CoeffReturnType - z() const { return (*this)[2]; } + z() const + { + EIGEN_STATIC_ASSERT(Derived::SizeAtCompileTime==-1 || Derived::SizeAtCompileTime>=3, OUT_OF_RANGE_ACCESS); + return (*this)[2]; + } /** equivalent to operator[](3). */ + EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE CoeffReturnType - w() const { return (*this)[3]; } + w() const + { + EIGEN_STATIC_ASSERT(Derived::SizeAtCompileTime==-1 || Derived::SizeAtCompileTime>=4, OUT_OF_RANGE_ACCESS); + return (*this)[3]; + } /** \internal * \returns the packet of coefficients starting at the given row and column. It is your responsibility @@ -207,9 +231,9 @@ class DenseCoeffsBase : public EigenBase template EIGEN_STRONG_INLINE PacketReturnType packet(Index row, Index col) const { - eigen_internal_assert(row >= 0 && row < rows() - && col >= 0 && col < cols()); - return derived().template packet(row,col); + typedef typename internal::packet_traits::type DefaultPacketType; + eigen_internal_assert(row >= 0 && row < rows() && col >= 0 && col < cols()); + return internal::evaluator(derived()).template packet(row,col); } @@ -234,8 +258,11 @@ class DenseCoeffsBase : public EigenBase template EIGEN_STRONG_INLINE PacketReturnType packet(Index index) const { + EIGEN_STATIC_ASSERT(internal::evaluator::Flags & LinearAccessBit, + THIS_COEFFICIENT_ACCESSOR_TAKING_ONE_ACCESS_IS_ONLY_FOR_EXPRESSIONS_ALLOWING_LINEAR_ACCESS) + typedef typename internal::packet_traits::type DefaultPacketType; eigen_internal_assert(index >= 0 && index < size()); - return derived().template packet(index); + return internal::evaluator(derived()).template packet(index); } protected: @@ -262,12 +289,13 @@ class DenseCoeffsBase : public EigenBase /** \brief Base class providing read/write coefficient access to matrices and arrays. * \ingroup Core_Module * \tparam Derived Type of the derived class - * \tparam #WriteAccessors Constant indicating read/write access + * + * \note #WriteAccessors Constant indicating read/write access * * This class defines the non-const \c operator() function and friends, which can be used to write specific * entries of a matrix or array. This class inherits DenseCoeffsBase which * defines the const variant for reading specific entries. - * + * * \sa DenseCoeffsBase, \ref TopicClassHierarchy */ template @@ -278,7 +306,6 @@ class DenseCoeffsBase : public DenseCoeffsBase Base; typedef typename internal::traits::StorageKind StorageKind; - typedef typename internal::traits::Index Index; typedef typename internal::traits::Scalar Scalar; typedef typename internal::packet_traits::type PacketScalar; typedef typename NumTraits::Real RealScalar; @@ -311,13 +338,15 @@ class DenseCoeffsBase : public DenseCoeffsBase= 0 && row < rows() - && col >= 0 && col < cols()); - return derived().coeffRef(row, col); + && col >= 0 && col < cols()); + return internal::evaluator(derived()).coeffRef(row,col); } + EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Scalar& coeffRefByOuterInner(Index outer, Index inner) { @@ -330,12 +359,13 @@ class DenseCoeffsBase : public DenseCoeffsBase= 0 && row < rows() && col >= 0 && col < cols()); - return derived().coeffRef(row, col); + return coeffRef(row, col); } @@ -354,11 +384,14 @@ class DenseCoeffsBase : public DenseCoeffsBase::Flags & LinearAccessBit, + THIS_COEFFICIENT_ACCESSOR_TAKING_ONE_ACCESS_IS_ONLY_FOR_EXPRESSIONS_ALLOWING_LINEAR_ACCESS) eigen_internal_assert(index >= 0 && index < size()); - return derived().coeffRef(index); + return internal::evaluator(derived()).coeffRef(index); } /** \returns a reference to the coefficient at given index. @@ -368,15 +401,14 @@ class DenseCoeffsBase : public DenseCoeffsBase= 0 && index < size()); - return derived().coeffRef(index); + return coeffRef(index); } /** \returns a reference to the coefficient at given index. @@ -388,179 +420,62 @@ class DenseCoeffsBase : public DenseCoeffsBase= 0 && index < size()); - return derived().coeffRef(index); + return coeffRef(index); } /** equivalent to operator[](0). */ + EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Scalar& x() { return (*this)[0]; } /** equivalent to operator[](1). */ + EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Scalar& - y() { return (*this)[1]; } - - /** equivalent to operator[](2). */ - - EIGEN_STRONG_INLINE Scalar& - z() { return (*this)[2]; } - - /** equivalent to operator[](3). */ - - EIGEN_STRONG_INLINE Scalar& - w() { return (*this)[3]; } - - /** \internal - * Stores the given packet of coefficients, at the given row and column of this expression. It is your responsibility - * to ensure that a packet really starts there. This method is only available on expressions having the - * PacketAccessBit. - * - * The \a LoadMode parameter may have the value \a #Aligned or \a #Unaligned. Its effect is to select - * the appropriate vectorization instruction. Aligned access is faster, but is only possible for packets - * starting at an address which is a multiple of the packet size. - */ - - template - EIGEN_STRONG_INLINE void writePacket - (Index row, Index col, const typename internal::packet_traits::type& val) - { - eigen_internal_assert(row >= 0 && row < rows() - && col >= 0 && col < cols()); - derived().template writePacket(row,col,val); - } - - - /** \internal */ - template - EIGEN_STRONG_INLINE void writePacketByOuterInner - (Index outer, Index inner, const typename internal::packet_traits::type& val) - { - writePacket(rowIndexByOuterInner(outer, inner), - colIndexByOuterInner(outer, inner), - val); - } - - /** \internal - * Stores the given packet of coefficients, at the given index in this expression. It is your responsibility - * to ensure that a packet really starts there. This method is only available on expressions having the - * PacketAccessBit and the LinearAccessBit. - * - * The \a LoadMode parameter may have the value \a Aligned or \a Unaligned. Its effect is to select - * the appropriate vectorization instruction. Aligned access is faster, but is only possible for packets - * starting at an address which is a multiple of the packet size. - */ - template - EIGEN_STRONG_INLINE void writePacket - (Index index, const typename internal::packet_traits::type& val) + y() { - eigen_internal_assert(index >= 0 && index < size()); - derived().template writePacket(index,val); - } - -#ifndef EIGEN_PARSED_BY_DOXYGEN - - /** \internal Copies the coefficient at position (row,col) of other into *this. - * - * This method is overridden in SwapWrapper, allowing swap() assignments to share 99% of their code - * with usual assignments. - * - * Outside of this internal usage, this method has probably no usefulness. It is hidden in the public API dox. - */ - - template - EIGEN_STRONG_INLINE void copyCoeff(Index row, Index col, const DenseBase& other) - { - eigen_internal_assert(row >= 0 && row < rows() - && col >= 0 && col < cols()); - derived().coeffRef(row, col) = other.derived().coeff(row, col); - } - - /** \internal Copies the coefficient at the given index of other into *this. - * - * This method is overridden in SwapWrapper, allowing swap() assignments to share 99% of their code - * with usual assignments. - * - * Outside of this internal usage, this method has probably no usefulness. It is hidden in the public API dox. - */ - - template - EIGEN_STRONG_INLINE void copyCoeff(Index index, const DenseBase& other) - { - eigen_internal_assert(index >= 0 && index < size()); - derived().coeffRef(index) = other.derived().coeff(index); + EIGEN_STATIC_ASSERT(Derived::SizeAtCompileTime==-1 || Derived::SizeAtCompileTime>=2, OUT_OF_RANGE_ACCESS); + return (*this)[1]; } + /** equivalent to operator[](2). */ - template - EIGEN_STRONG_INLINE void copyCoeffByOuterInner(Index outer, Index inner, const DenseBase& other) + EIGEN_DEVICE_FUNC + EIGEN_STRONG_INLINE Scalar& + z() { - const Index row = rowIndexByOuterInner(outer,inner); - const Index col = colIndexByOuterInner(outer,inner); - // derived() is important here: copyCoeff() may be reimplemented in Derived! - derived().copyCoeff(row, col, other); + EIGEN_STATIC_ASSERT(Derived::SizeAtCompileTime==-1 || Derived::SizeAtCompileTime>=3, OUT_OF_RANGE_ACCESS); + return (*this)[2]; } - /** \internal Copies the packet at position (row,col) of other into *this. - * - * This method is overridden in SwapWrapper, allowing swap() assignments to share 99% of their code - * with usual assignments. - * - * Outside of this internal usage, this method has probably no usefulness. It is hidden in the public API dox. - */ - - template - EIGEN_STRONG_INLINE void copyPacket(Index row, Index col, const DenseBase& other) - { - eigen_internal_assert(row >= 0 && row < rows() - && col >= 0 && col < cols()); - derived().template writePacket(row, col, - other.derived().template packet(row, col)); - } - - /** \internal Copies the packet at the given index of other into *this. - * - * This method is overridden in SwapWrapper, allowing swap() assignments to share 99% of their code - * with usual assignments. - * - * Outside of this internal usage, this method has probably no usefulness. It is hidden in the public API dox. - */ - - template - EIGEN_STRONG_INLINE void copyPacket(Index index, const DenseBase& other) - { - eigen_internal_assert(index >= 0 && index < size()); - derived().template writePacket(index, - other.derived().template packet(index)); - } + /** equivalent to operator[](3). */ - /** \internal */ - template - EIGEN_STRONG_INLINE void copyPacketByOuterInner(Index outer, Index inner, const DenseBase& other) + EIGEN_DEVICE_FUNC + EIGEN_STRONG_INLINE Scalar& + w() { - const Index row = rowIndexByOuterInner(outer,inner); - const Index col = colIndexByOuterInner(outer,inner); - // derived() is important here: copyCoeff() may be reimplemented in Derived! - derived().template copyPacket< OtherDerived, StoreMode, LoadMode>(row, col, other); + EIGEN_STATIC_ASSERT(Derived::SizeAtCompileTime==-1 || Derived::SizeAtCompileTime>=4, OUT_OF_RANGE_ACCESS); + return (*this)[3]; } -#endif - }; /** \brief Base class providing direct read-only coefficient access to matrices and arrays. * \ingroup Core_Module * \tparam Derived Type of the derived class - * \tparam #DirectAccessors Constant indicating direct access + * + * \note #DirectAccessors Constant indicating direct access * * This class defines functions to work with strides which can be used to access entries directly. This class * inherits DenseCoeffsBase which defines functions to access entries read-only using * \c operator() . * - * \sa \ref TopicClassHierarchy + * \sa \blank \ref TopicClassHierarchy */ template class DenseCoeffsBase : public DenseCoeffsBase @@ -568,7 +483,6 @@ class DenseCoeffsBase : public DenseCoeffsBase Base; - typedef typename internal::traits::Index Index; typedef typename internal::traits::Scalar Scalar; typedef typename NumTraits::Real RealScalar; @@ -581,6 +495,7 @@ class DenseCoeffsBase : public DenseCoeffsBase : public DenseCoeffsBase : public DenseCoeffsBase : public DenseCoeffsBase : public DenseCoeffsBase which defines functions to access entries read/write using * \c operator(). * - * \sa \ref TopicClassHierarchy + * \sa \blank \ref TopicClassHierarchy */ template class DenseCoeffsBase @@ -639,7 +558,6 @@ class DenseCoeffsBase public: typedef DenseCoeffsBase Base; - typedef typename internal::traits::Index Index; typedef typename internal::traits::Scalar Scalar; typedef typename NumTraits::Real RealScalar; @@ -652,7 +570,8 @@ class DenseCoeffsBase * * \sa outerStride(), rowStride(), colStride() */ - inline Index innerStride() const + EIGEN_DEVICE_FUNC EIGEN_CONSTEXPR + inline Index innerStride() const EIGEN_NOEXCEPT { return derived().innerStride(); } @@ -662,13 +581,14 @@ class DenseCoeffsBase * * \sa innerStride(), rowStride(), colStride() */ - inline Index outerStride() const + EIGEN_DEVICE_FUNC EIGEN_CONSTEXPR + inline Index outerStride() const EIGEN_NOEXCEPT { return derived().outerStride(); } // FIXME shall we remove it ? - inline Index stride() const + EIGEN_CONSTEXPR inline Index stride() const EIGEN_NOEXCEPT { return Derived::IsVectorAtCompileTime ? innerStride() : outerStride(); } @@ -677,7 +597,8 @@ class DenseCoeffsBase * * \sa innerStride(), outerStride(), colStride() */ - inline Index rowStride() const + EIGEN_DEVICE_FUNC EIGEN_CONSTEXPR + inline Index rowStride() const EIGEN_NOEXCEPT { return Derived::IsRowMajor ? outerStride() : innerStride(); } @@ -686,7 +607,8 @@ class DenseCoeffsBase * * \sa innerStride(), outerStride(), rowStride() */ - inline Index colStride() const + EIGEN_DEVICE_FUNC EIGEN_CONSTEXPR + inline Index colStride() const EIGEN_NOEXCEPT { return Derived::IsRowMajor ? innerStride() : outerStride(); } @@ -694,33 +616,42 @@ class DenseCoeffsBase namespace internal { -template +template struct first_aligned_impl { - static inline typename Derived::Index run(const Derived&) + static EIGEN_CONSTEXPR inline Index run(const Derived&) EIGEN_NOEXCEPT { return 0; } }; -template -struct first_aligned_impl +template +struct first_aligned_impl { - static inline typename Derived::Index run(const Derived& m) + static inline Index run(const Derived& m) { - return internal::first_aligned(&m.const_cast_derived().coeffRef(0,0), m.size()); + return internal::first_aligned(m.data(), m.size()); } }; -/** \internal \returns the index of the first element of the array that is well aligned for vectorization. +/** \internal \returns the index of the first element of the array stored by \a m that is properly aligned with respect to \a Alignment for vectorization. + * + * \tparam Alignment requested alignment in Bytes. * * There is also the variant first_aligned(const Scalar*, Integer) defined in Memory.h. See it for more * documentation. */ +template +static inline Index first_aligned(const DenseBase& m) +{ + enum { ReturnZero = (int(evaluator::Alignment) >= Alignment) || !(Derived::Flags & DirectAccessBit) }; + return first_aligned_impl::run(m.derived()); +} + template -static inline typename Derived::Index first_aligned(const Derived& m) +static inline Index first_default_aligned(const DenseBase& m) { - return first_aligned_impl - - ::run(m); + typedef typename Derived::Scalar Scalar; + typedef typename packet_traits::type DefaultPacketType; + return internal::first_aligned::alignment),Derived>(m); } template::ret> diff --git a/extern/eigen/Eigen/src/Core/DenseStorage.h b/extern/eigen/Eigen/src/Core/DenseStorage.h index 568493cb..08ef6c53 100644 --- a/extern/eigen/Eigen/src/Core/DenseStorage.h +++ b/extern/eigen/Eigen/src/Core/DenseStorage.h @@ -3,7 +3,7 @@ // // Copyright (C) 2008 Gael Guennebaud // Copyright (C) 2006-2009 Benoit Jacob -// Copyright (C) 2010 Hauke Heibel +// Copyright (C) 2010-2013 Hauke Heibel // // This Source Code Form is subject to the terms of the Mozilla // Public License v. 2.0. If a copy of the MPL was not distributed @@ -13,9 +13,9 @@ #define EIGEN_MATRIXSTORAGE_H #ifdef EIGEN_DENSE_STORAGE_CTOR_PLUGIN - #define EIGEN_INTERNAL_DENSE_STORAGE_CTOR_PLUGIN EIGEN_DENSE_STORAGE_CTOR_PLUGIN; + #define EIGEN_INTERNAL_DENSE_STORAGE_CTOR_PLUGIN(X) X; EIGEN_DENSE_STORAGE_CTOR_PLUGIN; #else - #define EIGEN_INTERNAL_DENSE_STORAGE_CTOR_PLUGIN + #define EIGEN_INTERNAL_DENSE_STORAGE_CTOR_PLUGIN(X) #endif namespace Eigen { @@ -24,7 +24,9 @@ namespace internal { struct constructor_without_unaligned_array_assert {}; -template void check_static_allocation_size() +template +EIGEN_DEVICE_FUNC +void check_static_allocation_size() { // if EIGEN_STACK_ALLOCATION_LIMIT is defined to 0, then no limit #if EIGEN_STACK_ALLOCATION_LIMIT @@ -38,57 +40,117 @@ template void check_static_allocation_size() */ template + : compute_default_alignment::value > struct plain_array { T array[Size]; - plain_array() - { + EIGEN_DEVICE_FUNC + plain_array() + { check_static_allocation_size(); } - plain_array(constructor_without_unaligned_array_assert) - { + EIGEN_DEVICE_FUNC + plain_array(constructor_without_unaligned_array_assert) + { check_static_allocation_size(); } }; #if defined(EIGEN_DISABLE_UNALIGNED_ARRAY_ASSERT) #define EIGEN_MAKE_UNALIGNED_ARRAY_ASSERT(sizemask) -#elif EIGEN_GNUC_AT_LEAST(4,7) - // GCC 4.7 is too aggressive in its optimizations and remove the alignement test based on the fact the array is declared to be aligned. +#elif EIGEN_GNUC_AT_LEAST(4,7) + // GCC 4.7 is too aggressive in its optimizations and remove the alignment test based on the fact the array is declared to be aligned. // See this bug report: http://gcc.gnu.org/bugzilla/show_bug.cgi?id=53900 // Hiding the origin of the array pointer behind a function argument seems to do the trick even if the function is inlined: template EIGEN_ALWAYS_INLINE PtrType eigen_unaligned_array_assert_workaround_gcc47(PtrType array) { return array; } #define EIGEN_MAKE_UNALIGNED_ARRAY_ASSERT(sizemask) \ - eigen_assert((reinterpret_cast(eigen_unaligned_array_assert_workaround_gcc47(array)) & sizemask) == 0 \ + eigen_assert((internal::UIntPtr(eigen_unaligned_array_assert_workaround_gcc47(array)) & (sizemask)) == 0 \ && "this assertion is explained here: " \ "http://eigen.tuxfamily.org/dox-devel/group__TopicUnalignedArrayAssert.html" \ " **** READ THIS WEB PAGE !!! ****"); #else #define EIGEN_MAKE_UNALIGNED_ARRAY_ASSERT(sizemask) \ - eigen_assert((reinterpret_cast(array) & sizemask) == 0 \ + eigen_assert((internal::UIntPtr(array) & (sizemask)) == 0 \ && "this assertion is explained here: " \ "http://eigen.tuxfamily.org/dox-devel/group__TopicUnalignedArrayAssert.html" \ " **** READ THIS WEB PAGE !!! ****"); #endif +template +struct plain_array +{ + EIGEN_ALIGN_TO_BOUNDARY(8) T array[Size]; + + EIGEN_DEVICE_FUNC + plain_array() + { + EIGEN_MAKE_UNALIGNED_ARRAY_ASSERT(7); + check_static_allocation_size(); + } + + EIGEN_DEVICE_FUNC + plain_array(constructor_without_unaligned_array_assert) + { + check_static_allocation_size(); + } +}; + template struct plain_array { - EIGEN_USER_ALIGN16 T array[Size]; + EIGEN_ALIGN_TO_BOUNDARY(16) T array[Size]; + + EIGEN_DEVICE_FUNC + plain_array() + { + EIGEN_MAKE_UNALIGNED_ARRAY_ASSERT(15); + check_static_allocation_size(); + } + + EIGEN_DEVICE_FUNC + plain_array(constructor_without_unaligned_array_assert) + { + check_static_allocation_size(); + } +}; + +template +struct plain_array +{ + EIGEN_ALIGN_TO_BOUNDARY(32) T array[Size]; - plain_array() - { - EIGEN_MAKE_UNALIGNED_ARRAY_ASSERT(0xf); + EIGEN_DEVICE_FUNC + plain_array() + { + EIGEN_MAKE_UNALIGNED_ARRAY_ASSERT(31); check_static_allocation_size(); } - plain_array(constructor_without_unaligned_array_assert) - { + EIGEN_DEVICE_FUNC + plain_array(constructor_without_unaligned_array_assert) + { + check_static_allocation_size(); + } +}; + +template +struct plain_array +{ + EIGEN_ALIGN_TO_BOUNDARY(64) T array[Size]; + + EIGEN_DEVICE_FUNC + plain_array() + { + EIGEN_MAKE_UNALIGNED_ARRAY_ASSERT(63); + check_static_allocation_size(); + } + + EIGEN_DEVICE_FUNC + plain_array(constructor_without_unaligned_array_assert) + { check_static_allocation_size(); } }; @@ -96,9 +158,33 @@ struct plain_array template struct plain_array { - EIGEN_USER_ALIGN16 T array[1]; - plain_array() {} - plain_array(constructor_without_unaligned_array_assert) {} + T array[1]; + EIGEN_DEVICE_FUNC plain_array() {} + EIGEN_DEVICE_FUNC plain_array(constructor_without_unaligned_array_assert) {} +}; + +struct plain_array_helper { + template + EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE + static void copy(const plain_array& src, const Eigen::Index size, + plain_array& dst) { + smart_copy(src.array, src.array + size, dst.array); + } + + template + EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE + static void swap(plain_array& a, const Eigen::Index a_size, + plain_array& b, const Eigen::Index b_size) { + if (a_size < b_size) { + std::swap_ranges(b.array, b.array + a_size, a.array); + smart_move(b.array + a_size, b.array + b_size, a.array + a_size); + } else if (a_size > b_size) { + std::swap_ranges(a.array, a.array + b_size, b.array); + smart_move(a.array + b_size, a.array + a_size, b.array + b_size); + } else { + std::swap_ranges(a.array, a.array + a_size, b.array); + } + } }; } // end namespace internal @@ -122,41 +208,81 @@ template class DenseSt { internal::plain_array m_data; public: - DenseStorage() {} - DenseStorage(internal::constructor_without_unaligned_array_assert) + EIGEN_DEVICE_FUNC DenseStorage() { + EIGEN_INTERNAL_DENSE_STORAGE_CTOR_PLUGIN(Index size = Size) + } + EIGEN_DEVICE_FUNC + explicit DenseStorage(internal::constructor_without_unaligned_array_assert) : m_data(internal::constructor_without_unaligned_array_assert()) {} - DenseStorage(const DenseStorage& other) : m_data(other.m_data) {} +#if !EIGEN_HAS_CXX11 || defined(EIGEN_DENSE_STORAGE_CTOR_PLUGIN) + EIGEN_DEVICE_FUNC + DenseStorage(const DenseStorage& other) : m_data(other.m_data) { + EIGEN_INTERNAL_DENSE_STORAGE_CTOR_PLUGIN(Index size = Size) + } +#else + EIGEN_DEVICE_FUNC DenseStorage(const DenseStorage&) = default; +#endif +#if !EIGEN_HAS_CXX11 + EIGEN_DEVICE_FUNC DenseStorage& operator=(const DenseStorage& other) { if (this != &other) m_data = other.m_data; return *this; } - DenseStorage(DenseIndex,DenseIndex,DenseIndex) {} - void swap(DenseStorage& other) { std::swap(m_data,other.m_data); } - static DenseIndex rows(void) {return _Rows;} - static DenseIndex cols(void) {return _Cols;} - void conservativeResize(DenseIndex,DenseIndex,DenseIndex) {} - void resize(DenseIndex,DenseIndex,DenseIndex) {} - const T *data() const { return m_data.array; } - T *data() { return m_data.array; } +#else + EIGEN_DEVICE_FUNC DenseStorage& operator=(const DenseStorage&) = default; +#endif +#if EIGEN_HAS_RVALUE_REFERENCES +#if !EIGEN_HAS_CXX11 + EIGEN_DEVICE_FUNC DenseStorage(DenseStorage&& other) EIGEN_NOEXCEPT + : m_data(std::move(other.m_data)) + { + } + EIGEN_DEVICE_FUNC DenseStorage& operator=(DenseStorage&& other) EIGEN_NOEXCEPT + { + if (this != &other) + m_data = std::move(other.m_data); + return *this; + } +#else + EIGEN_DEVICE_FUNC DenseStorage(DenseStorage&&) = default; + EIGEN_DEVICE_FUNC DenseStorage& operator=(DenseStorage&&) = default; +#endif +#endif + EIGEN_DEVICE_FUNC DenseStorage(Index size, Index rows, Index cols) { + EIGEN_INTERNAL_DENSE_STORAGE_CTOR_PLUGIN({}) + eigen_internal_assert(size==rows*cols && rows==_Rows && cols==_Cols); + EIGEN_UNUSED_VARIABLE(size); + EIGEN_UNUSED_VARIABLE(rows); + EIGEN_UNUSED_VARIABLE(cols); + } + EIGEN_DEVICE_FUNC void swap(DenseStorage& other) { + numext::swap(m_data, other.m_data); + } + EIGEN_DEVICE_FUNC static EIGEN_CONSTEXPR Index rows(void) EIGEN_NOEXCEPT {return _Rows;} + EIGEN_DEVICE_FUNC static EIGEN_CONSTEXPR Index cols(void) EIGEN_NOEXCEPT {return _Cols;} + EIGEN_DEVICE_FUNC void conservativeResize(Index,Index,Index) {} + EIGEN_DEVICE_FUNC void resize(Index,Index,Index) {} + EIGEN_DEVICE_FUNC const T *data() const { return m_data.array; } + EIGEN_DEVICE_FUNC T *data() { return m_data.array; } }; // null matrix template class DenseStorage { public: - DenseStorage() {} - DenseStorage(internal::constructor_without_unaligned_array_assert) {} - DenseStorage(const DenseStorage&) {} - DenseStorage& operator=(const DenseStorage&) { return *this; } - DenseStorage(DenseIndex,DenseIndex,DenseIndex) {} - void swap(DenseStorage& ) {} - static DenseIndex rows(void) {return _Rows;} - static DenseIndex cols(void) {return _Cols;} - void conservativeResize(DenseIndex,DenseIndex,DenseIndex) {} - void resize(DenseIndex,DenseIndex,DenseIndex) {} - const T *data() const { return 0; } - T *data() { return 0; } + EIGEN_DEVICE_FUNC DenseStorage() {} + EIGEN_DEVICE_FUNC explicit DenseStorage(internal::constructor_without_unaligned_array_assert) {} + EIGEN_DEVICE_FUNC DenseStorage(const DenseStorage&) {} + EIGEN_DEVICE_FUNC DenseStorage& operator=(const DenseStorage&) { return *this; } + EIGEN_DEVICE_FUNC DenseStorage(Index,Index,Index) {} + EIGEN_DEVICE_FUNC void swap(DenseStorage& ) {} + EIGEN_DEVICE_FUNC static EIGEN_CONSTEXPR Index rows(void) EIGEN_NOEXCEPT {return _Rows;} + EIGEN_DEVICE_FUNC static EIGEN_CONSTEXPR Index cols(void) EIGEN_NOEXCEPT {return _Cols;} + EIGEN_DEVICE_FUNC void conservativeResize(Index,Index,Index) {} + EIGEN_DEVICE_FUNC void resize(Index,Index,Index) {} + EIGEN_DEVICE_FUNC const T *data() const { return 0; } + EIGEN_DEVICE_FUNC T *data() { return 0; } }; // more specializations for null matrices; these are necessary to resolve ambiguities @@ -173,260 +299,352 @@ template class DenseStorage class DenseStorage { internal::plain_array m_data; - DenseIndex m_rows; - DenseIndex m_cols; + Index m_rows; + Index m_cols; public: - DenseStorage() : m_rows(0), m_cols(0) {} - DenseStorage(internal::constructor_without_unaligned_array_assert) + EIGEN_DEVICE_FUNC DenseStorage() : m_rows(0), m_cols(0) {} + EIGEN_DEVICE_FUNC explicit DenseStorage(internal::constructor_without_unaligned_array_assert) : m_data(internal::constructor_without_unaligned_array_assert()), m_rows(0), m_cols(0) {} - DenseStorage(const DenseStorage& other) : m_data(other.m_data), m_rows(other.m_rows), m_cols(other.m_cols) {} - DenseStorage& operator=(const DenseStorage& other) + EIGEN_DEVICE_FUNC DenseStorage(const DenseStorage& other) + : m_data(internal::constructor_without_unaligned_array_assert()), m_rows(other.m_rows), m_cols(other.m_cols) + { + internal::plain_array_helper::copy(other.m_data, m_rows * m_cols, m_data); + } + EIGEN_DEVICE_FUNC DenseStorage& operator=(const DenseStorage& other) { if (this != &other) { - m_data = other.m_data; m_rows = other.m_rows; m_cols = other.m_cols; + internal::plain_array_helper::copy(other.m_data, m_rows * m_cols, m_data); } return *this; } - DenseStorage(DenseIndex, DenseIndex nbRows, DenseIndex nbCols) : m_rows(nbRows), m_cols(nbCols) {} - void swap(DenseStorage& other) - { std::swap(m_data,other.m_data); std::swap(m_rows,other.m_rows); std::swap(m_cols,other.m_cols); } - DenseIndex rows() const {return m_rows;} - DenseIndex cols() const {return m_cols;} - void conservativeResize(DenseIndex, DenseIndex nbRows, DenseIndex nbCols) { m_rows = nbRows; m_cols = nbCols; } - void resize(DenseIndex, DenseIndex nbRows, DenseIndex nbCols) { m_rows = nbRows; m_cols = nbCols; } - const T *data() const { return m_data.array; } - T *data() { return m_data.array; } + EIGEN_DEVICE_FUNC DenseStorage(Index, Index rows, Index cols) : m_rows(rows), m_cols(cols) {} + EIGEN_DEVICE_FUNC void swap(DenseStorage& other) + { + internal::plain_array_helper::swap(m_data, m_rows * m_cols, other.m_data, other.m_rows * other.m_cols); + numext::swap(m_rows,other.m_rows); + numext::swap(m_cols,other.m_cols); + } + EIGEN_DEVICE_FUNC Index rows() const {return m_rows;} + EIGEN_DEVICE_FUNC Index cols() const {return m_cols;} + EIGEN_DEVICE_FUNC void conservativeResize(Index, Index rows, Index cols) { m_rows = rows; m_cols = cols; } + EIGEN_DEVICE_FUNC void resize(Index, Index rows, Index cols) { m_rows = rows; m_cols = cols; } + EIGEN_DEVICE_FUNC const T *data() const { return m_data.array; } + EIGEN_DEVICE_FUNC T *data() { return m_data.array; } }; // dynamic-size matrix with fixed-size storage and fixed width template class DenseStorage { internal::plain_array m_data; - DenseIndex m_rows; + Index m_rows; public: - DenseStorage() : m_rows(0) {} - DenseStorage(internal::constructor_without_unaligned_array_assert) + EIGEN_DEVICE_FUNC DenseStorage() : m_rows(0) {} + EIGEN_DEVICE_FUNC explicit DenseStorage(internal::constructor_without_unaligned_array_assert) : m_data(internal::constructor_without_unaligned_array_assert()), m_rows(0) {} - DenseStorage(const DenseStorage& other) : m_data(other.m_data), m_rows(other.m_rows) {} - DenseStorage& operator=(const DenseStorage& other) + EIGEN_DEVICE_FUNC DenseStorage(const DenseStorage& other) + : m_data(internal::constructor_without_unaligned_array_assert()), m_rows(other.m_rows) + { + internal::plain_array_helper::copy(other.m_data, m_rows * _Cols, m_data); + } + + EIGEN_DEVICE_FUNC DenseStorage& operator=(const DenseStorage& other) { if (this != &other) { - m_data = other.m_data; m_rows = other.m_rows; + internal::plain_array_helper::copy(other.m_data, m_rows * _Cols, m_data); } return *this; } - DenseStorage(DenseIndex, DenseIndex nbRows, DenseIndex) : m_rows(nbRows) {} - void swap(DenseStorage& other) { std::swap(m_data,other.m_data); std::swap(m_rows,other.m_rows); } - DenseIndex rows(void) const {return m_rows;} - DenseIndex cols(void) const {return _Cols;} - void conservativeResize(DenseIndex, DenseIndex nbRows, DenseIndex) { m_rows = nbRows; } - void resize(DenseIndex, DenseIndex nbRows, DenseIndex) { m_rows = nbRows; } - const T *data() const { return m_data.array; } - T *data() { return m_data.array; } + EIGEN_DEVICE_FUNC DenseStorage(Index, Index rows, Index) : m_rows(rows) {} + EIGEN_DEVICE_FUNC void swap(DenseStorage& other) + { + internal::plain_array_helper::swap(m_data, m_rows * _Cols, other.m_data, other.m_rows * _Cols); + numext::swap(m_rows, other.m_rows); + } + EIGEN_DEVICE_FUNC Index rows(void) const EIGEN_NOEXCEPT {return m_rows;} + EIGEN_DEVICE_FUNC EIGEN_CONSTEXPR Index cols(void) const EIGEN_NOEXCEPT {return _Cols;} + EIGEN_DEVICE_FUNC void conservativeResize(Index, Index rows, Index) { m_rows = rows; } + EIGEN_DEVICE_FUNC void resize(Index, Index rows, Index) { m_rows = rows; } + EIGEN_DEVICE_FUNC const T *data() const { return m_data.array; } + EIGEN_DEVICE_FUNC T *data() { return m_data.array; } }; // dynamic-size matrix with fixed-size storage and fixed height template class DenseStorage { internal::plain_array m_data; - DenseIndex m_cols; + Index m_cols; public: - DenseStorage() : m_cols(0) {} - DenseStorage(internal::constructor_without_unaligned_array_assert) + EIGEN_DEVICE_FUNC DenseStorage() : m_cols(0) {} + EIGEN_DEVICE_FUNC explicit DenseStorage(internal::constructor_without_unaligned_array_assert) : m_data(internal::constructor_without_unaligned_array_assert()), m_cols(0) {} - DenseStorage(const DenseStorage& other) : m_data(other.m_data), m_cols(other.m_cols) {} - DenseStorage& operator=(const DenseStorage& other) + EIGEN_DEVICE_FUNC DenseStorage(const DenseStorage& other) + : m_data(internal::constructor_without_unaligned_array_assert()), m_cols(other.m_cols) + { + internal::plain_array_helper::copy(other.m_data, _Rows * m_cols, m_data); + } + EIGEN_DEVICE_FUNC DenseStorage& operator=(const DenseStorage& other) { if (this != &other) { - m_data = other.m_data; m_cols = other.m_cols; + internal::plain_array_helper::copy(other.m_data, _Rows * m_cols, m_data); } return *this; } - DenseStorage(DenseIndex, DenseIndex, DenseIndex nbCols) : m_cols(nbCols) {} - void swap(DenseStorage& other) { std::swap(m_data,other.m_data); std::swap(m_cols,other.m_cols); } - DenseIndex rows(void) const {return _Rows;} - DenseIndex cols(void) const {return m_cols;} - void conservativeResize(DenseIndex, DenseIndex, DenseIndex nbCols) { m_cols = nbCols; } - void resize(DenseIndex, DenseIndex, DenseIndex nbCols) { m_cols = nbCols; } - const T *data() const { return m_data.array; } - T *data() { return m_data.array; } + EIGEN_DEVICE_FUNC DenseStorage(Index, Index, Index cols) : m_cols(cols) {} + EIGEN_DEVICE_FUNC void swap(DenseStorage& other) { + internal::plain_array_helper::swap(m_data, _Rows * m_cols, other.m_data, _Rows * other.m_cols); + numext::swap(m_cols, other.m_cols); + } + EIGEN_DEVICE_FUNC EIGEN_CONSTEXPR Index rows(void) const EIGEN_NOEXCEPT {return _Rows;} + EIGEN_DEVICE_FUNC Index cols(void) const EIGEN_NOEXCEPT {return m_cols;} + EIGEN_DEVICE_FUNC void conservativeResize(Index, Index, Index cols) { m_cols = cols; } + EIGEN_DEVICE_FUNC void resize(Index, Index, Index cols) { m_cols = cols; } + EIGEN_DEVICE_FUNC const T *data() const { return m_data.array; } + EIGEN_DEVICE_FUNC T *data() { return m_data.array; } }; // purely dynamic matrix. template class DenseStorage { T *m_data; - DenseIndex m_rows; - DenseIndex m_cols; + Index m_rows; + Index m_cols; public: - DenseStorage() : m_data(0), m_rows(0), m_cols(0) {} - DenseStorage(internal::constructor_without_unaligned_array_assert) + EIGEN_DEVICE_FUNC DenseStorage() : m_data(0), m_rows(0), m_cols(0) {} + EIGEN_DEVICE_FUNC explicit DenseStorage(internal::constructor_without_unaligned_array_assert) : m_data(0), m_rows(0), m_cols(0) {} - DenseStorage(DenseIndex size, DenseIndex nbRows, DenseIndex nbCols) - : m_data(internal::conditional_aligned_new_auto(size)), m_rows(nbRows), m_cols(nbCols) - { EIGEN_INTERNAL_DENSE_STORAGE_CTOR_PLUGIN } -#ifdef EIGEN_HAVE_RVALUE_REFERENCES - DenseStorage(DenseStorage&& other) + EIGEN_DEVICE_FUNC DenseStorage(Index size, Index rows, Index cols) + : m_data(internal::conditional_aligned_new_auto(size)), m_rows(rows), m_cols(cols) + { + EIGEN_INTERNAL_DENSE_STORAGE_CTOR_PLUGIN({}) + eigen_internal_assert(size==rows*cols && rows>=0 && cols >=0); + } + EIGEN_DEVICE_FUNC DenseStorage(const DenseStorage& other) + : m_data(internal::conditional_aligned_new_auto(other.m_rows*other.m_cols)) + , m_rows(other.m_rows) + , m_cols(other.m_cols) + { + EIGEN_INTERNAL_DENSE_STORAGE_CTOR_PLUGIN(Index size = m_rows*m_cols) + internal::smart_copy(other.m_data, other.m_data+other.m_rows*other.m_cols, m_data); + } + EIGEN_DEVICE_FUNC DenseStorage& operator=(const DenseStorage& other) + { + if (this != &other) + { + DenseStorage tmp(other); + this->swap(tmp); + } + return *this; + } +#if EIGEN_HAS_RVALUE_REFERENCES + EIGEN_DEVICE_FUNC + DenseStorage(DenseStorage&& other) EIGEN_NOEXCEPT : m_data(std::move(other.m_data)) , m_rows(std::move(other.m_rows)) , m_cols(std::move(other.m_cols)) { other.m_data = nullptr; + other.m_rows = 0; + other.m_cols = 0; } - DenseStorage& operator=(DenseStorage&& other) + EIGEN_DEVICE_FUNC + DenseStorage& operator=(DenseStorage&& other) EIGEN_NOEXCEPT { - using std::swap; - swap(m_data, other.m_data); - swap(m_rows, other.m_rows); - swap(m_cols, other.m_cols); + numext::swap(m_data, other.m_data); + numext::swap(m_rows, other.m_rows); + numext::swap(m_cols, other.m_cols); return *this; } #endif - ~DenseStorage() { internal::conditional_aligned_delete_auto(m_data, m_rows*m_cols); } - void swap(DenseStorage& other) - { std::swap(m_data,other.m_data); std::swap(m_rows,other.m_rows); std::swap(m_cols,other.m_cols); } - DenseIndex rows(void) const {return m_rows;} - DenseIndex cols(void) const {return m_cols;} - void conservativeResize(DenseIndex size, DenseIndex nbRows, DenseIndex nbCols) + EIGEN_DEVICE_FUNC ~DenseStorage() { internal::conditional_aligned_delete_auto(m_data, m_rows*m_cols); } + EIGEN_DEVICE_FUNC void swap(DenseStorage& other) + { + numext::swap(m_data,other.m_data); + numext::swap(m_rows,other.m_rows); + numext::swap(m_cols,other.m_cols); + } + EIGEN_DEVICE_FUNC Index rows(void) const EIGEN_NOEXCEPT {return m_rows;} + EIGEN_DEVICE_FUNC Index cols(void) const EIGEN_NOEXCEPT {return m_cols;} + void conservativeResize(Index size, Index rows, Index cols) { m_data = internal::conditional_aligned_realloc_new_auto(m_data, size, m_rows*m_cols); - m_rows = nbRows; - m_cols = nbCols; + m_rows = rows; + m_cols = cols; } - void resize(DenseIndex size, DenseIndex nbRows, DenseIndex nbCols) + EIGEN_DEVICE_FUNC void resize(Index size, Index rows, Index cols) { if(size != m_rows*m_cols) { internal::conditional_aligned_delete_auto(m_data, m_rows*m_cols); - if (size) + if (size>0) // >0 and not simply !=0 to let the compiler knows that size cannot be negative m_data = internal::conditional_aligned_new_auto(size); else m_data = 0; - EIGEN_INTERNAL_DENSE_STORAGE_CTOR_PLUGIN + EIGEN_INTERNAL_DENSE_STORAGE_CTOR_PLUGIN({}) } - m_rows = nbRows; - m_cols = nbCols; - } - const T *data() const { return m_data; } - T *data() { return m_data; } - private: - DenseStorage(const DenseStorage&); - DenseStorage& operator=(const DenseStorage&); + m_rows = rows; + m_cols = cols; + } + EIGEN_DEVICE_FUNC const T *data() const { return m_data; } + EIGEN_DEVICE_FUNC T *data() { return m_data; } }; // matrix with dynamic width and fixed height (so that matrix has dynamic size). template class DenseStorage { T *m_data; - DenseIndex m_cols; + Index m_cols; public: - DenseStorage() : m_data(0), m_cols(0) {} - DenseStorage(internal::constructor_without_unaligned_array_assert) : m_data(0), m_cols(0) {} - DenseStorage(DenseIndex size, DenseIndex, DenseIndex nbCols) : m_data(internal::conditional_aligned_new_auto(size)), m_cols(nbCols) - { EIGEN_INTERNAL_DENSE_STORAGE_CTOR_PLUGIN } -#ifdef EIGEN_HAVE_RVALUE_REFERENCES - DenseStorage(DenseStorage&& other) + EIGEN_DEVICE_FUNC DenseStorage() : m_data(0), m_cols(0) {} + explicit DenseStorage(internal::constructor_without_unaligned_array_assert) : m_data(0), m_cols(0) {} + EIGEN_DEVICE_FUNC DenseStorage(Index size, Index rows, Index cols) : m_data(internal::conditional_aligned_new_auto(size)), m_cols(cols) + { + EIGEN_INTERNAL_DENSE_STORAGE_CTOR_PLUGIN({}) + eigen_internal_assert(size==rows*cols && rows==_Rows && cols >=0); + EIGEN_UNUSED_VARIABLE(rows); + } + EIGEN_DEVICE_FUNC DenseStorage(const DenseStorage& other) + : m_data(internal::conditional_aligned_new_auto(_Rows*other.m_cols)) + , m_cols(other.m_cols) + { + EIGEN_INTERNAL_DENSE_STORAGE_CTOR_PLUGIN(Index size = m_cols*_Rows) + internal::smart_copy(other.m_data, other.m_data+_Rows*m_cols, m_data); + } + EIGEN_DEVICE_FUNC DenseStorage& operator=(const DenseStorage& other) + { + if (this != &other) + { + DenseStorage tmp(other); + this->swap(tmp); + } + return *this; + } +#if EIGEN_HAS_RVALUE_REFERENCES + EIGEN_DEVICE_FUNC + DenseStorage(DenseStorage&& other) EIGEN_NOEXCEPT : m_data(std::move(other.m_data)) , m_cols(std::move(other.m_cols)) { other.m_data = nullptr; + other.m_cols = 0; } - DenseStorage& operator=(DenseStorage&& other) + EIGEN_DEVICE_FUNC + DenseStorage& operator=(DenseStorage&& other) EIGEN_NOEXCEPT { - using std::swap; - swap(m_data, other.m_data); - swap(m_cols, other.m_cols); + numext::swap(m_data, other.m_data); + numext::swap(m_cols, other.m_cols); return *this; } #endif - ~DenseStorage() { internal::conditional_aligned_delete_auto(m_data, _Rows*m_cols); } - void swap(DenseStorage& other) { std::swap(m_data,other.m_data); std::swap(m_cols,other.m_cols); } - static DenseIndex rows(void) {return _Rows;} - DenseIndex cols(void) const {return m_cols;} - void conservativeResize(DenseIndex size, DenseIndex, DenseIndex nbCols) + EIGEN_DEVICE_FUNC ~DenseStorage() { internal::conditional_aligned_delete_auto(m_data, _Rows*m_cols); } + EIGEN_DEVICE_FUNC void swap(DenseStorage& other) { + numext::swap(m_data,other.m_data); + numext::swap(m_cols,other.m_cols); + } + EIGEN_DEVICE_FUNC static EIGEN_CONSTEXPR Index rows(void) EIGEN_NOEXCEPT {return _Rows;} + EIGEN_DEVICE_FUNC Index cols(void) const EIGEN_NOEXCEPT {return m_cols;} + EIGEN_DEVICE_FUNC void conservativeResize(Index size, Index, Index cols) { m_data = internal::conditional_aligned_realloc_new_auto(m_data, size, _Rows*m_cols); - m_cols = nbCols; + m_cols = cols; } - EIGEN_STRONG_INLINE void resize(DenseIndex size, DenseIndex, DenseIndex nbCols) + EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE void resize(Index size, Index, Index cols) { if(size != _Rows*m_cols) { internal::conditional_aligned_delete_auto(m_data, _Rows*m_cols); - if (size) + if (size>0) // >0 and not simply !=0 to let the compiler knows that size cannot be negative m_data = internal::conditional_aligned_new_auto(size); else m_data = 0; - EIGEN_INTERNAL_DENSE_STORAGE_CTOR_PLUGIN + EIGEN_INTERNAL_DENSE_STORAGE_CTOR_PLUGIN({}) } - m_cols = nbCols; + m_cols = cols; } - const T *data() const { return m_data; } - T *data() { return m_data; } - private: - DenseStorage(const DenseStorage&); - DenseStorage& operator=(const DenseStorage&); + EIGEN_DEVICE_FUNC const T *data() const { return m_data; } + EIGEN_DEVICE_FUNC T *data() { return m_data; } }; // matrix with dynamic height and fixed width (so that matrix has dynamic size). template class DenseStorage { T *m_data; - DenseIndex m_rows; + Index m_rows; public: - DenseStorage() : m_data(0), m_rows(0) {} - DenseStorage(internal::constructor_without_unaligned_array_assert) : m_data(0), m_rows(0) {} - DenseStorage(DenseIndex size, DenseIndex nbRows, DenseIndex) : m_data(internal::conditional_aligned_new_auto(size)), m_rows(nbRows) - { EIGEN_INTERNAL_DENSE_STORAGE_CTOR_PLUGIN } -#ifdef EIGEN_HAVE_RVALUE_REFERENCES - DenseStorage(DenseStorage&& other) + EIGEN_DEVICE_FUNC DenseStorage() : m_data(0), m_rows(0) {} + explicit DenseStorage(internal::constructor_without_unaligned_array_assert) : m_data(0), m_rows(0) {} + EIGEN_DEVICE_FUNC DenseStorage(Index size, Index rows, Index cols) : m_data(internal::conditional_aligned_new_auto(size)), m_rows(rows) + { + EIGEN_INTERNAL_DENSE_STORAGE_CTOR_PLUGIN({}) + eigen_internal_assert(size==rows*cols && rows>=0 && cols == _Cols); + EIGEN_UNUSED_VARIABLE(cols); + } + EIGEN_DEVICE_FUNC DenseStorage(const DenseStorage& other) + : m_data(internal::conditional_aligned_new_auto(other.m_rows*_Cols)) + , m_rows(other.m_rows) + { + EIGEN_INTERNAL_DENSE_STORAGE_CTOR_PLUGIN(Index size = m_rows*_Cols) + internal::smart_copy(other.m_data, other.m_data+other.m_rows*_Cols, m_data); + } + EIGEN_DEVICE_FUNC DenseStorage& operator=(const DenseStorage& other) + { + if (this != &other) + { + DenseStorage tmp(other); + this->swap(tmp); + } + return *this; + } +#if EIGEN_HAS_RVALUE_REFERENCES + EIGEN_DEVICE_FUNC + DenseStorage(DenseStorage&& other) EIGEN_NOEXCEPT : m_data(std::move(other.m_data)) , m_rows(std::move(other.m_rows)) { other.m_data = nullptr; + other.m_rows = 0; } - DenseStorage& operator=(DenseStorage&& other) + EIGEN_DEVICE_FUNC + DenseStorage& operator=(DenseStorage&& other) EIGEN_NOEXCEPT { - using std::swap; - swap(m_data, other.m_data); - swap(m_rows, other.m_rows); + numext::swap(m_data, other.m_data); + numext::swap(m_rows, other.m_rows); return *this; } #endif - ~DenseStorage() { internal::conditional_aligned_delete_auto(m_data, _Cols*m_rows); } - void swap(DenseStorage& other) { std::swap(m_data,other.m_data); std::swap(m_rows,other.m_rows); } - DenseIndex rows(void) const {return m_rows;} - static DenseIndex cols(void) {return _Cols;} - void conservativeResize(DenseIndex size, DenseIndex nbRows, DenseIndex) + EIGEN_DEVICE_FUNC ~DenseStorage() { internal::conditional_aligned_delete_auto(m_data, _Cols*m_rows); } + EIGEN_DEVICE_FUNC void swap(DenseStorage& other) { + numext::swap(m_data,other.m_data); + numext::swap(m_rows,other.m_rows); + } + EIGEN_DEVICE_FUNC Index rows(void) const EIGEN_NOEXCEPT {return m_rows;} + EIGEN_DEVICE_FUNC static EIGEN_CONSTEXPR Index cols(void) {return _Cols;} + void conservativeResize(Index size, Index rows, Index) { m_data = internal::conditional_aligned_realloc_new_auto(m_data, size, m_rows*_Cols); - m_rows = nbRows; + m_rows = rows; } - EIGEN_STRONG_INLINE void resize(DenseIndex size, DenseIndex nbRows, DenseIndex) + EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE void resize(Index size, Index rows, Index) { if(size != m_rows*_Cols) { internal::conditional_aligned_delete_auto(m_data, _Cols*m_rows); - if (size) + if (size>0) // >0 and not simply !=0 to let the compiler knows that size cannot be negative m_data = internal::conditional_aligned_new_auto(size); else m_data = 0; - EIGEN_INTERNAL_DENSE_STORAGE_CTOR_PLUGIN + EIGEN_INTERNAL_DENSE_STORAGE_CTOR_PLUGIN({}) } - m_rows = nbRows; + m_rows = rows; } - const T *data() const { return m_data; } - T *data() { return m_data; } - private: - DenseStorage(const DenseStorage&); - DenseStorage& operator=(const DenseStorage&); + EIGEN_DEVICE_FUNC const T *data() const { return m_data; } + EIGEN_DEVICE_FUNC T *data() { return m_data; } }; } // end namespace Eigen diff --git a/extern/eigen/Eigen/src/Core/Diagonal.h b/extern/eigen/Eigen/src/Core/Diagonal.h index 68cf6d4b..3112d2c1 100644 --- a/extern/eigen/Eigen/src/Core/Diagonal.h +++ b/extern/eigen/Eigen/src/Core/Diagonal.h @@ -11,7 +11,7 @@ #ifndef EIGEN_DIAGONAL_H #define EIGEN_DIAGONAL_H -namespace Eigen { +namespace Eigen { /** \class Diagonal * \ingroup Core_Module @@ -21,7 +21,7 @@ namespace Eigen { * \param MatrixType the type of the object in which we are taking a sub/main/super diagonal * \param DiagIndex the index of the sub/super diagonal. The default is 0 and it means the main diagonal. * A positive value means a superdiagonal, a negative value means a subdiagonal. - * You can also use Dynamic so the index can be set at runtime. + * You can also use DynamicIndex so the index can be set at runtime. * * The matrix is not required to be square. * @@ -37,7 +37,7 @@ template struct traits > : traits { - typedef typename nested::type MatrixTypeNested; + typedef typename ref_selector::type MatrixTypeNested; typedef typename remove_reference::type _MatrixTypeNested; typedef typename MatrixType::StorageKind StorageKind; enum { @@ -52,8 +52,7 @@ struct traits > MatrixType::MaxColsAtCompileTime - EIGEN_PLAIN_ENUM_MAX( DiagIndex, 0))), MaxColsAtCompileTime = 1, MaskLvalueBit = is_lvalue::value ? LvalueBit : 0, - Flags = (unsigned int)_MatrixTypeNested::Flags & (HereditaryBits | LinearAccessBit | MaskLvalueBit | DirectAccessBit) & ~RowMajorBit, - CoeffReadCost = _MatrixTypeNested::CoeffReadCost, + Flags = (unsigned int)_MatrixTypeNested::Flags & (RowMajorBit | MaskLvalueBit | DirectAccessBit) & ~RowMajorBit, // FIXME DirectAccessBit should not be handled by expressions MatrixTypeOuterStride = outer_stride_at_compile_time::ret, InnerStrideAtCompileTime = MatrixTypeOuterStride == Dynamic ? Dynamic : MatrixTypeOuterStride+1, OuterStrideAtCompileTime = 0 @@ -70,24 +69,31 @@ template class Diagonal typedef typename internal::dense_xpr_base::type Base; EIGEN_DENSE_PUBLIC_INTERFACE(Diagonal) - inline Diagonal(MatrixType& matrix, Index a_index = DiagIndex) : m_matrix(matrix), m_index(a_index) {} + EIGEN_DEVICE_FUNC + explicit inline Diagonal(MatrixType& matrix, Index a_index = DiagIndex) : m_matrix(matrix), m_index(a_index) + { + eigen_assert( a_index <= m_matrix.cols() && -a_index <= m_matrix.rows() ); + } EIGEN_INHERIT_ASSIGNMENT_OPERATORS(Diagonal) + EIGEN_DEVICE_FUNC inline Index rows() const - { return m_index.value()<0 ? (std::min)(m_matrix.cols(),m_matrix.rows()+m_index.value()) : (std::min)(m_matrix.rows(),m_matrix.cols()-m_index.value()); } + { + return m_index.value()<0 ? numext::mini(m_matrix.cols(),m_matrix.rows()+m_index.value()) + : numext::mini(m_matrix.rows(),m_matrix.cols()-m_index.value()); + } - inline Index cols() const { return 1; } + EIGEN_DEVICE_FUNC EIGEN_CONSTEXPR + inline Index cols() const EIGEN_NOEXCEPT { return 1; } - inline Index innerStride() const - { + EIGEN_DEVICE_FUNC EIGEN_CONSTEXPR + inline Index innerStride() const EIGEN_NOEXCEPT { return m_matrix.outerStride() + 1; } - inline Index outerStride() const - { - return 0; - } + EIGEN_DEVICE_FUNC EIGEN_CONSTEXPR + inline Index outerStride() const EIGEN_NOEXCEPT { return 0; } typedef typename internal::conditional< internal::is_lvalue::value, @@ -95,62 +101,75 @@ template class Diagonal const Scalar >::type ScalarWithConstIfNotLvalue; - inline ScalarWithConstIfNotLvalue* data() { return &(m_matrix.const_cast_derived().coeffRef(rowOffset(), colOffset())); } - inline const Scalar* data() const { return &(m_matrix.const_cast_derived().coeffRef(rowOffset(), colOffset())); } + EIGEN_DEVICE_FUNC + inline ScalarWithConstIfNotLvalue* data() { return &(m_matrix.coeffRef(rowOffset(), colOffset())); } + EIGEN_DEVICE_FUNC + inline const Scalar* data() const { return &(m_matrix.coeffRef(rowOffset(), colOffset())); } + EIGEN_DEVICE_FUNC inline Scalar& coeffRef(Index row, Index) { EIGEN_STATIC_ASSERT_LVALUE(MatrixType) - return m_matrix.const_cast_derived().coeffRef(row+rowOffset(), row+colOffset()); + return m_matrix.coeffRef(row+rowOffset(), row+colOffset()); } + EIGEN_DEVICE_FUNC inline const Scalar& coeffRef(Index row, Index) const { - return m_matrix.const_cast_derived().coeffRef(row+rowOffset(), row+colOffset()); + return m_matrix.coeffRef(row+rowOffset(), row+colOffset()); } + EIGEN_DEVICE_FUNC inline CoeffReturnType coeff(Index row, Index) const { return m_matrix.coeff(row+rowOffset(), row+colOffset()); } + EIGEN_DEVICE_FUNC inline Scalar& coeffRef(Index idx) { EIGEN_STATIC_ASSERT_LVALUE(MatrixType) - return m_matrix.const_cast_derived().coeffRef(idx+rowOffset(), idx+colOffset()); + return m_matrix.coeffRef(idx+rowOffset(), idx+colOffset()); } + EIGEN_DEVICE_FUNC inline const Scalar& coeffRef(Index idx) const { - return m_matrix.const_cast_derived().coeffRef(idx+rowOffset(), idx+colOffset()); + return m_matrix.coeffRef(idx+rowOffset(), idx+colOffset()); } + EIGEN_DEVICE_FUNC inline CoeffReturnType coeff(Index idx) const { return m_matrix.coeff(idx+rowOffset(), idx+colOffset()); } - const typename internal::remove_all::type& - nestedExpression() const + EIGEN_DEVICE_FUNC + inline const typename internal::remove_all::type& + nestedExpression() const { return m_matrix; } - int index() const + EIGEN_DEVICE_FUNC + inline Index index() const { return m_index.value(); } protected: - typename MatrixType::Nested m_matrix; + typename internal::ref_selector::non_const_type m_matrix; const internal::variable_if_dynamicindex m_index; private: // some compilers may fail to optimize std::max etc in case of compile-time constants... - EIGEN_STRONG_INLINE Index absDiagIndex() const { return m_index.value()>0 ? m_index.value() : -m_index.value(); } - EIGEN_STRONG_INLINE Index rowOffset() const { return m_index.value()>0 ? 0 : -m_index.value(); } - EIGEN_STRONG_INLINE Index colOffset() const { return m_index.value()>0 ? m_index.value() : 0; } - // triger a compile time error is someone try to call packet + EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE EIGEN_CONSTEXPR + Index absDiagIndex() const EIGEN_NOEXCEPT { return m_index.value()>0 ? m_index.value() : -m_index.value(); } + EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE EIGEN_CONSTEXPR + Index rowOffset() const EIGEN_NOEXCEPT { return m_index.value()>0 ? 0 : -m_index.value(); } + EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE EIGEN_CONSTEXPR + Index colOffset() const EIGEN_NOEXCEPT { return m_index.value()>0 ? m_index.value() : 0; } + // trigger a compile-time error if someone try to call packet template typename MatrixType::PacketReturnType packet(Index) const; template typename MatrixType::PacketReturnType packet(Index,Index) const; }; @@ -164,15 +183,15 @@ template class Diagonal * * \sa class Diagonal */ template -inline typename MatrixBase::DiagonalReturnType +EIGEN_DEVICE_FUNC inline typename MatrixBase::DiagonalReturnType MatrixBase::diagonal() { - return derived(); + return DiagonalReturnType(derived()); } /** This is the const version of diagonal(). */ template -inline typename MatrixBase::ConstDiagonalReturnType +EIGEN_DEVICE_FUNC inline typename MatrixBase::ConstDiagonalReturnType MatrixBase::diagonal() const { return ConstDiagonalReturnType(derived()); @@ -190,7 +209,7 @@ MatrixBase::diagonal() const * * \sa MatrixBase::diagonal(), class Diagonal */ template -inline typename MatrixBase::DiagonalDynamicIndexReturnType +EIGEN_DEVICE_FUNC inline typename MatrixBase::DiagonalDynamicIndexReturnType MatrixBase::diagonal(Index index) { return DiagonalDynamicIndexReturnType(derived(), index); @@ -198,7 +217,7 @@ MatrixBase::diagonal(Index index) /** This is the const version of diagonal(Index). */ template -inline typename MatrixBase::ConstDiagonalDynamicIndexReturnType +EIGEN_DEVICE_FUNC inline typename MatrixBase::ConstDiagonalDynamicIndexReturnType MatrixBase::diagonal(Index index) const { return ConstDiagonalDynamicIndexReturnType(derived(), index); @@ -216,20 +235,22 @@ MatrixBase::diagonal(Index index) const * * \sa MatrixBase::diagonal(), class Diagonal */ template -template -inline typename MatrixBase::template DiagonalIndexReturnType::Type +template +EIGEN_DEVICE_FUNC +inline typename MatrixBase::template DiagonalIndexReturnType::Type MatrixBase::diagonal() { - return derived(); + return typename DiagonalIndexReturnType::Type(derived()); } /** This is the const version of diagonal(). */ template -template -inline typename MatrixBase::template ConstDiagonalIndexReturnType::Type +template +EIGEN_DEVICE_FUNC +inline typename MatrixBase::template ConstDiagonalIndexReturnType::Type MatrixBase::diagonal() const { - return derived(); + return typename ConstDiagonalIndexReturnType::Type(derived()); } } // end namespace Eigen diff --git a/extern/eigen/Eigen/src/Core/DiagonalMatrix.h b/extern/eigen/Eigen/src/Core/DiagonalMatrix.h index e6c220f4..542685c6 100644 --- a/extern/eigen/Eigen/src/Core/DiagonalMatrix.h +++ b/extern/eigen/Eigen/src/Core/DiagonalMatrix.h @@ -22,7 +22,7 @@ class DiagonalBase : public EigenBase typedef typename DiagonalVectorType::Scalar Scalar; typedef typename DiagonalVectorType::RealScalar RealScalar; typedef typename internal::traits::StorageKind StorageKind; - typedef typename internal::traits::Index Index; + typedef typename internal::traits::StorageIndex StorageIndex; enum { RowsAtCompileTime = DiagonalVectorType::SizeAtCompileTime, @@ -30,79 +30,85 @@ class DiagonalBase : public EigenBase MaxRowsAtCompileTime = DiagonalVectorType::MaxSizeAtCompileTime, MaxColsAtCompileTime = DiagonalVectorType::MaxSizeAtCompileTime, IsVectorAtCompileTime = 0, - Flags = 0 + Flags = NoPreferredStorageOrderBit }; typedef Matrix DenseMatrixType; typedef DenseMatrixType DenseType; typedef DiagonalMatrix PlainObject; + EIGEN_DEVICE_FUNC inline const Derived& derived() const { return *static_cast(this); } + EIGEN_DEVICE_FUNC inline Derived& derived() { return *static_cast(this); } + EIGEN_DEVICE_FUNC DenseMatrixType toDenseMatrix() const { return derived(); } - template - void evalTo(MatrixBase &other) const; - template - void addTo(MatrixBase &other) const - { other.diagonal() += diagonal(); } - template - void subTo(MatrixBase &other) const - { other.diagonal() -= diagonal(); } + EIGEN_DEVICE_FUNC inline const DiagonalVectorType& diagonal() const { return derived().diagonal(); } + EIGEN_DEVICE_FUNC inline DiagonalVectorType& diagonal() { return derived().diagonal(); } + EIGEN_DEVICE_FUNC inline Index rows() const { return diagonal().size(); } + EIGEN_DEVICE_FUNC inline Index cols() const { return diagonal().size(); } - /** \returns the diagonal matrix product of \c *this by the matrix \a matrix. - */ template - const DiagonalProduct + EIGEN_DEVICE_FUNC + const Product operator*(const MatrixBase &matrix) const { - return DiagonalProduct(matrix.derived(), derived()); + return Product(derived(),matrix.derived()); } - inline const DiagonalWrapper, const DiagonalVectorType> > + typedef DiagonalWrapper, const DiagonalVectorType> > InverseReturnType; + EIGEN_DEVICE_FUNC + inline const InverseReturnType inverse() const { - return diagonal().cwiseInverse(); + return InverseReturnType(diagonal().cwiseInverse()); } - inline const DiagonalWrapper, const DiagonalVectorType> > + EIGEN_DEVICE_FUNC + inline const DiagonalWrapper operator*(const Scalar& scalar) const { - return diagonal() * scalar; + return DiagonalWrapper(diagonal() * scalar); } - friend inline const DiagonalWrapper, const DiagonalVectorType> > + EIGEN_DEVICE_FUNC + friend inline const DiagonalWrapper operator*(const Scalar& scalar, const DiagonalBase& other) { - return other.diagonal() * scalar; + return DiagonalWrapper(scalar * other.diagonal()); } - - #ifdef EIGEN2_SUPPORT + template - bool isApprox(const DiagonalBase& other, typename NumTraits::Real precision = NumTraits::dummy_precision()) const + EIGEN_DEVICE_FUNC + #ifdef EIGEN_PARSED_BY_DOXYGEN + inline unspecified_expression_type + #else + inline const DiagonalWrapper + #endif + operator+(const DiagonalBase& other) const { - return diagonal().isApprox(other.diagonal(), precision); + return (diagonal() + other.diagonal()).asDiagonal(); } + template - bool isApprox(const MatrixBase& other, typename NumTraits::Real precision = NumTraits::dummy_precision()) const + EIGEN_DEVICE_FUNC + #ifdef EIGEN_PARSED_BY_DOXYGEN + inline unspecified_expression_type + #else + inline const DiagonalWrapper + #endif + operator-(const DiagonalBase& other) const { - return toDenseMatrix().isApprox(other, precision); + return (diagonal() - other.diagonal()).asDiagonal(); } - #endif }; -template -template -void DiagonalBase::evalTo(MatrixBase &other) const -{ - other.setZero(); - other.diagonal() = diagonal(); -} #endif /** \class DiagonalMatrix @@ -124,10 +130,9 @@ struct traits > : traits > { typedef Matrix<_Scalar,SizeAtCompileTime,1,0,MaxSizeAtCompileTime,1> DiagonalVectorType; - typedef Dense StorageKind; - typedef DenseIndex Index; + typedef DiagonalShape StorageKind; enum { - Flags = LvalueBit + Flags = LvalueBit | NoPreferredStorageOrderBit }; }; } @@ -141,7 +146,7 @@ class DiagonalMatrix typedef const DiagonalMatrix& Nested; typedef _Scalar Scalar; typedef typename internal::traits::StorageKind StorageKind; - typedef typename internal::traits::Index Index; + typedef typename internal::traits::StorageIndex StorageIndex; #endif protected: @@ -151,24 +156,55 @@ class DiagonalMatrix public: /** const version of diagonal(). */ + EIGEN_DEVICE_FUNC inline const DiagonalVectorType& diagonal() const { return m_diagonal; } /** \returns a reference to the stored vector of diagonal coefficients. */ + EIGEN_DEVICE_FUNC inline DiagonalVectorType& diagonal() { return m_diagonal; } /** Default constructor without initialization */ + EIGEN_DEVICE_FUNC inline DiagonalMatrix() {} /** Constructs a diagonal matrix with given dimension */ - inline DiagonalMatrix(Index dim) : m_diagonal(dim) {} + EIGEN_DEVICE_FUNC + explicit inline DiagonalMatrix(Index dim) : m_diagonal(dim) {} /** 2D constructor. */ + EIGEN_DEVICE_FUNC inline DiagonalMatrix(const Scalar& x, const Scalar& y) : m_diagonal(x,y) {} /** 3D constructor. */ + EIGEN_DEVICE_FUNC inline DiagonalMatrix(const Scalar& x, const Scalar& y, const Scalar& z) : m_diagonal(x,y,z) {} + #if EIGEN_HAS_CXX11 + /** \brief Construct a diagonal matrix with fixed size from an arbitrary number of coefficients. \cpp11 + * + * There exists C++98 anologue constructors for fixed-size diagonal matrices having 2 or 3 coefficients. + * + * \warning To construct a diagonal matrix of fixed size, the number of values passed to this + * constructor must match the fixed dimension of \c *this. + * + * \sa DiagonalMatrix(const Scalar&, const Scalar&) + * \sa DiagonalMatrix(const Scalar&, const Scalar&, const Scalar&) + */ + template + EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE + DiagonalMatrix(const Scalar& a0, const Scalar& a1, const Scalar& a2, const ArgTypes&... args) + : m_diagonal(a0, a1, a2, args...) {} + + /** \brief Constructs a DiagonalMatrix and initializes it by elements given by an initializer list of initializer + * lists \cpp11 + */ + EIGEN_DEVICE_FUNC + explicit EIGEN_STRONG_INLINE DiagonalMatrix(const std::initializer_list>& list) + : m_diagonal(list) {} + #endif // EIGEN_HAS_CXX11 + /** Copy constructor. */ template + EIGEN_DEVICE_FUNC inline DiagonalMatrix(const DiagonalBase& other) : m_diagonal(other.diagonal()) {} #ifndef EIGEN_PARSED_BY_DOXYGEN @@ -178,11 +214,13 @@ class DiagonalMatrix /** generic constructor from expression of the diagonal coefficients */ template + EIGEN_DEVICE_FUNC explicit inline DiagonalMatrix(const MatrixBase& other) : m_diagonal(other) {} /** Copy operator. */ template + EIGEN_DEVICE_FUNC DiagonalMatrix& operator=(const DiagonalBase& other) { m_diagonal = other.diagonal(); @@ -193,6 +231,7 @@ class DiagonalMatrix /** This is a special case of the templated operator=. Its purpose is to * prevent a default operator= from hiding the templated operator=. */ + EIGEN_DEVICE_FUNC DiagonalMatrix& operator=(const DiagonalMatrix& other) { m_diagonal = other.diagonal(); @@ -201,14 +240,19 @@ class DiagonalMatrix #endif /** Resizes to given size. */ + EIGEN_DEVICE_FUNC inline void resize(Index size) { m_diagonal.resize(size); } /** Sets all coefficients to zero. */ + EIGEN_DEVICE_FUNC inline void setZero() { m_diagonal.setZero(); } /** Resizes and sets all coefficients to zero. */ + EIGEN_DEVICE_FUNC inline void setZero(Index size) { m_diagonal.setZero(size); } /** Sets this matrix to be the identity matrix of the current size. */ + EIGEN_DEVICE_FUNC inline void setIdentity() { m_diagonal.setOnes(); } /** Sets this matrix to be the identity matrix of the given size. */ + EIGEN_DEVICE_FUNC inline void setIdentity(Index size) { m_diagonal.setOnes(size); } }; @@ -232,14 +276,15 @@ struct traits > { typedef _DiagonalVectorType DiagonalVectorType; typedef typename DiagonalVectorType::Scalar Scalar; - typedef typename DiagonalVectorType::Index Index; - typedef typename DiagonalVectorType::StorageKind StorageKind; + typedef typename DiagonalVectorType::StorageIndex StorageIndex; + typedef DiagonalShape StorageKind; + typedef typename traits::XprKind XprKind; enum { RowsAtCompileTime = DiagonalVectorType::SizeAtCompileTime, ColsAtCompileTime = DiagonalVectorType::SizeAtCompileTime, - MaxRowsAtCompileTime = DiagonalVectorType::SizeAtCompileTime, - MaxColsAtCompileTime = DiagonalVectorType::SizeAtCompileTime, - Flags = traits::Flags & LvalueBit + MaxRowsAtCompileTime = DiagonalVectorType::MaxSizeAtCompileTime, + MaxColsAtCompileTime = DiagonalVectorType::MaxSizeAtCompileTime, + Flags = (traits::Flags & LvalueBit) | NoPreferredStorageOrderBit }; }; } @@ -255,9 +300,11 @@ class DiagonalWrapper #endif /** Constructor from expression of diagonal coefficients to wrap. */ - inline DiagonalWrapper(DiagonalVectorType& a_diagonal) : m_diagonal(a_diagonal) {} + EIGEN_DEVICE_FUNC + explicit inline DiagonalWrapper(DiagonalVectorType& a_diagonal) : m_diagonal(a_diagonal) {} /** \returns a const reference to the wrapped expression of diagonal coefficients. */ + EIGEN_DEVICE_FUNC const DiagonalVectorType& diagonal() const { return m_diagonal; } protected: @@ -274,10 +321,10 @@ class DiagonalWrapper * \sa class DiagonalWrapper, class DiagonalMatrix, diagonal(), isDiagonal() **/ template -inline const DiagonalWrapper +EIGEN_DEVICE_FUNC inline const DiagonalWrapper MatrixBase::asDiagonal() const { - return derived(); + return DiagonalWrapper(derived()); } /** \returns true if *this is approximately equal to a diagonal matrix, @@ -291,12 +338,11 @@ MatrixBase::asDiagonal() const template bool MatrixBase::isDiagonal(const RealScalar& prec) const { - using std::abs; if(cols() != rows()) return false; RealScalar maxAbsOnDiagonal = static_cast(-1); for(Index j = 0; j < cols(); ++j) { - RealScalar absOnDiagonal = abs(coeff(j,j)); + RealScalar absOnDiagonal = numext::abs(coeff(j,j)); if(absOnDiagonal > maxAbsOnDiagonal) maxAbsOnDiagonal = absOnDiagonal; } for(Index j = 0; j < cols(); ++j) @@ -308,6 +354,38 @@ bool MatrixBase::isDiagonal(const RealScalar& prec) const return true; } +namespace internal { + +template<> struct storage_kind_to_shape { typedef DiagonalShape Shape; }; + +struct Diagonal2Dense {}; + +template<> struct AssignmentKind { typedef Diagonal2Dense Kind; }; + +// Diagonal matrix to Dense assignment +template< typename DstXprType, typename SrcXprType, typename Functor> +struct Assignment +{ + static void run(DstXprType &dst, const SrcXprType &src, const internal::assign_op &/*func*/) + { + Index dstRows = src.rows(); + Index dstCols = src.cols(); + if((dst.rows()!=dstRows) || (dst.cols()!=dstCols)) + dst.resize(dstRows, dstCols); + + dst.setZero(); + dst.diagonal() = src.diagonal(); + } + + static void run(DstXprType &dst, const SrcXprType &src, const internal::add_assign_op &/*func*/) + { dst.diagonal() += src.diagonal(); } + + static void run(DstXprType &dst, const SrcXprType &src, const internal::sub_assign_op &/*func*/) + { dst.diagonal() -= src.diagonal(); } +}; + +} // namespace internal + } // end namespace Eigen #endif // EIGEN_DIAGONALMATRIX_H diff --git a/extern/eigen/Eigen/src/Core/DiagonalProduct.h b/extern/eigen/Eigen/src/Core/DiagonalProduct.h index cc6b536e..7911d1cd 100644 --- a/extern/eigen/Eigen/src/Core/DiagonalProduct.h +++ b/extern/eigen/Eigen/src/Core/DiagonalProduct.h @@ -13,117 +13,14 @@ namespace Eigen { -namespace internal { -template -struct traits > - : traits -{ - typedef typename scalar_product_traits::ReturnType Scalar; - enum { - RowsAtCompileTime = MatrixType::RowsAtCompileTime, - ColsAtCompileTime = MatrixType::ColsAtCompileTime, - MaxRowsAtCompileTime = MatrixType::MaxRowsAtCompileTime, - MaxColsAtCompileTime = MatrixType::MaxColsAtCompileTime, - - _StorageOrder = MatrixType::Flags & RowMajorBit ? RowMajor : ColMajor, - _ScalarAccessOnDiag = !((int(_StorageOrder) == ColMajor && int(ProductOrder) == OnTheLeft) - ||(int(_StorageOrder) == RowMajor && int(ProductOrder) == OnTheRight)), - _SameTypes = is_same::value, - // FIXME currently we need same types, but in the future the next rule should be the one - //_Vectorizable = bool(int(MatrixType::Flags)&PacketAccessBit) && ((!_PacketOnDiag) || (_SameTypes && bool(int(DiagonalType::DiagonalVectorType::Flags)&PacketAccessBit))), - _Vectorizable = bool(int(MatrixType::Flags)&PacketAccessBit) && _SameTypes && (_ScalarAccessOnDiag || (bool(int(DiagonalType::DiagonalVectorType::Flags)&PacketAccessBit))), - _LinearAccessMask = (RowsAtCompileTime==1 || ColsAtCompileTime==1) ? LinearAccessBit : 0, - - Flags = ((HereditaryBits|_LinearAccessMask|AlignedBit) & (unsigned int)(MatrixType::Flags)) | (_Vectorizable ? PacketAccessBit : 0),//(int(MatrixType::Flags)&int(DiagonalType::DiagonalVectorType::Flags)&AlignedBit), - Cost0 = EIGEN_ADD_COST(NumTraits::MulCost, MatrixType::CoeffReadCost), - CoeffReadCost = EIGEN_ADD_COST(Cost0,DiagonalType::DiagonalVectorType::CoeffReadCost) - }; -}; -} - -template -class DiagonalProduct : internal::no_assignment_operator, - public MatrixBase > -{ - public: - - typedef MatrixBase Base; - EIGEN_DENSE_PUBLIC_INTERFACE(DiagonalProduct) - - inline DiagonalProduct(const MatrixType& matrix, const DiagonalType& diagonal) - : m_matrix(matrix), m_diagonal(diagonal) - { - eigen_assert(diagonal.diagonal().size() == (ProductOrder == OnTheLeft ? matrix.rows() : matrix.cols())); - } - - EIGEN_STRONG_INLINE Index rows() const { return m_matrix.rows(); } - EIGEN_STRONG_INLINE Index cols() const { return m_matrix.cols(); } - - EIGEN_STRONG_INLINE const Scalar coeff(Index row, Index col) const - { - return m_diagonal.diagonal().coeff(ProductOrder == OnTheLeft ? row : col) * m_matrix.coeff(row, col); - } - - EIGEN_STRONG_INLINE const Scalar coeff(Index idx) const - { - enum { - StorageOrder = int(MatrixType::Flags) & RowMajorBit ? RowMajor : ColMajor - }; - return coeff(int(StorageOrder)==ColMajor?idx:0,int(StorageOrder)==ColMajor?0:idx); - } - - template - EIGEN_STRONG_INLINE PacketScalar packet(Index row, Index col) const - { - enum { - StorageOrder = Flags & RowMajorBit ? RowMajor : ColMajor - }; - const Index indexInDiagonalVector = ProductOrder == OnTheLeft ? row : col; - return packet_impl(row,col,indexInDiagonalVector,typename internal::conditional< - ((int(StorageOrder) == RowMajor && int(ProductOrder) == OnTheLeft) - ||(int(StorageOrder) == ColMajor && int(ProductOrder) == OnTheRight)), internal::true_type, internal::false_type>::type()); - } - - template - EIGEN_STRONG_INLINE PacketScalar packet(Index idx) const - { - enum { - StorageOrder = int(MatrixType::Flags) & RowMajorBit ? RowMajor : ColMajor - }; - return packet(int(StorageOrder)==ColMajor?idx:0,int(StorageOrder)==ColMajor?0:idx); - } - - protected: - template - EIGEN_STRONG_INLINE PacketScalar packet_impl(Index row, Index col, Index id, internal::true_type) const - { - return internal::pmul(m_matrix.template packet(row, col), - internal::pset1(m_diagonal.diagonal().coeff(id))); - } - - template - EIGEN_STRONG_INLINE PacketScalar packet_impl(Index row, Index col, Index id, internal::false_type) const - { - enum { - InnerSize = (MatrixType::Flags & RowMajorBit) ? MatrixType::ColsAtCompileTime : MatrixType::RowsAtCompileTime, - DiagonalVectorPacketLoadMode = (LoadMode == Aligned && (((InnerSize%16) == 0) || (int(DiagonalType::DiagonalVectorType::Flags)&AlignedBit)==AlignedBit) ? Aligned : Unaligned) - }; - return internal::pmul(m_matrix.template packet(row, col), - m_diagonal.diagonal().template packet(id)); - } - - typename MatrixType::Nested m_matrix; - typename DiagonalType::Nested m_diagonal; -}; - /** \returns the diagonal matrix product of \c *this by the diagonal matrix \a diagonal. */ template template -inline const DiagonalProduct +EIGEN_DEVICE_FUNC inline const Product MatrixBase::operator*(const DiagonalBase &a_diagonal) const { - return DiagonalProduct(derived(), a_diagonal.derived()); + return Product(derived(),a_diagonal.derived()); } } // end namespace Eigen diff --git a/extern/eigen/Eigen/src/Core/Dot.h b/extern/eigen/Eigen/src/Core/Dot.h index 9d7651f1..5c3441b9 100644 --- a/extern/eigen/Eigen/src/Core/Dot.h +++ b/extern/eigen/Eigen/src/Core/Dot.h @@ -28,26 +28,33 @@ template struct dot_nocheck { - typedef typename scalar_product_traits::Scalar,typename traits::Scalar>::ReturnType ResScalar; - static inline ResScalar run(const MatrixBase& a, const MatrixBase& b) + typedef scalar_conj_product_op::Scalar,typename traits::Scalar> conj_prod; + typedef typename conj_prod::result_type ResScalar; + EIGEN_DEVICE_FUNC + EIGEN_STRONG_INLINE + static ResScalar run(const MatrixBase& a, const MatrixBase& b) { - return a.template binaryExpr::Scalar,typename traits::Scalar> >(b).sum(); + return a.template binaryExpr(b).sum(); } }; template struct dot_nocheck { - typedef typename scalar_product_traits::Scalar,typename traits::Scalar>::ReturnType ResScalar; - static inline ResScalar run(const MatrixBase& a, const MatrixBase& b) + typedef scalar_conj_product_op::Scalar,typename traits::Scalar> conj_prod; + typedef typename conj_prod::result_type ResScalar; + EIGEN_DEVICE_FUNC + EIGEN_STRONG_INLINE + static ResScalar run(const MatrixBase& a, const MatrixBase& b) { - return a.transpose().template binaryExpr::Scalar,typename traits::Scalar> >(b).sum(); + return a.transpose().template binaryExpr(b).sum(); } }; } // end namespace internal -/** \returns the dot product of *this with other. +/** \fn MatrixBase::dot + * \returns the dot product of *this with other. * * \only_for_vectors * @@ -59,58 +66,34 @@ struct dot_nocheck */ template template -typename internal::scalar_product_traits::Scalar,typename internal::traits::Scalar>::ReturnType +EIGEN_DEVICE_FUNC +EIGEN_STRONG_INLINE +typename ScalarBinaryOpTraits::Scalar,typename internal::traits::Scalar>::ReturnType MatrixBase::dot(const MatrixBase& other) const { EIGEN_STATIC_ASSERT_VECTOR_ONLY(Derived) EIGEN_STATIC_ASSERT_VECTOR_ONLY(OtherDerived) EIGEN_STATIC_ASSERT_SAME_VECTOR_SIZE(Derived,OtherDerived) +#if !(defined(EIGEN_NO_STATIC_ASSERT) && defined(EIGEN_NO_DEBUG)) typedef internal::scalar_conj_product_op func; EIGEN_CHECK_BINARY_COMPATIBILIY(func,Scalar,typename OtherDerived::Scalar); - +#endif + eigen_assert(size() == other.size()); return internal::dot_nocheck::run(*this, other); } -#ifdef EIGEN2_SUPPORT -/** \returns the dot product of *this with other, with the Eigen2 convention that the dot product is linear in the first variable - * (conjugating the second variable). Of course this only makes a difference in the complex case. - * - * This method is only available in EIGEN2_SUPPORT mode. - * - * \only_for_vectors - * - * \sa dot() - */ -template -template -typename internal::traits::Scalar -MatrixBase::eigen2_dot(const MatrixBase& other) const -{ - EIGEN_STATIC_ASSERT_VECTOR_ONLY(Derived) - EIGEN_STATIC_ASSERT_VECTOR_ONLY(OtherDerived) - EIGEN_STATIC_ASSERT_SAME_VECTOR_SIZE(Derived,OtherDerived) - EIGEN_STATIC_ASSERT((internal::is_same::value), - YOU_MIXED_DIFFERENT_NUMERIC_TYPES__YOU_NEED_TO_USE_THE_CAST_METHOD_OF_MATRIXBASE_TO_CAST_NUMERIC_TYPES_EXPLICITLY) - - eigen_assert(size() == other.size()); - - return internal::dot_nocheck::run(other,*this); -} -#endif - - //---------- implementation of L2 norm and related functions ---------- -/** \returns, for vectors, the squared \em l2 norm of \c *this, and for matrices the Frobenius norm. +/** \returns, for vectors, the squared \em l2 norm of \c *this, and for matrices the squared Frobenius norm. * In both cases, it consists in the sum of the square of all the matrix entries. * For vectors, this is also equals to the dot product of \c *this with itself. * - * \sa dot(), norm() + * \sa dot(), norm(), lpNorm() */ template -EIGEN_STRONG_INLINE typename NumTraits::Scalar>::Real MatrixBase::squaredNorm() const +EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE typename NumTraits::Scalar>::Real MatrixBase::squaredNorm() const { return numext::real((*this).cwiseAbs2().sum()); } @@ -119,41 +102,98 @@ EIGEN_STRONG_INLINE typename NumTraits::Scala * In both cases, it consists in the square root of the sum of the square of all the matrix entries. * For vectors, this is also equals to the square root of the dot product of \c *this with itself. * - * \sa dot(), squaredNorm() + * \sa lpNorm(), dot(), squaredNorm() */ template -inline typename NumTraits::Scalar>::Real MatrixBase::norm() const +EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE typename NumTraits::Scalar>::Real MatrixBase::norm() const { - using std::sqrt; - return sqrt(squaredNorm()); + return numext::sqrt(squaredNorm()); } -/** \returns an expression of the quotient of *this by its own norm. +/** \returns an expression of the quotient of \c *this by its own norm. + * + * \warning If the input vector is too small (i.e., this->norm()==0), + * then this function returns a copy of the input. * * \only_for_vectors * * \sa norm(), normalize() */ template -inline const typename MatrixBase::PlainObject +EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE const typename MatrixBase::PlainObject MatrixBase::normalized() const { - typedef typename internal::nested::type Nested; - typedef typename internal::remove_reference::type _Nested; + typedef typename internal::nested_eval::type _Nested; _Nested n(derived()); - return n / n.norm(); + RealScalar z = n.squaredNorm(); + // NOTE: after extensive benchmarking, this conditional does not impact performance, at least on recent x86 CPU + if(z>RealScalar(0)) + return n / numext::sqrt(z); + else + return n; } /** Normalizes the vector, i.e. divides it by its own norm. * * \only_for_vectors * + * \warning If the input vector is too small (i.e., this->norm()==0), then \c *this is left unchanged. + * * \sa norm(), normalized() */ template -inline void MatrixBase::normalize() +EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE void MatrixBase::normalize() { - *this /= norm(); + RealScalar z = squaredNorm(); + // NOTE: after extensive benchmarking, this conditional does not impact performance, at least on recent x86 CPU + if(z>RealScalar(0)) + derived() /= numext::sqrt(z); +} + +/** \returns an expression of the quotient of \c *this by its own norm while avoiding underflow and overflow. + * + * \only_for_vectors + * + * This method is analogue to the normalized() method, but it reduces the risk of + * underflow and overflow when computing the norm. + * + * \warning If the input vector is too small (i.e., this->norm()==0), + * then this function returns a copy of the input. + * + * \sa stableNorm(), stableNormalize(), normalized() + */ +template +EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE const typename MatrixBase::PlainObject +MatrixBase::stableNormalized() const +{ + typedef typename internal::nested_eval::type _Nested; + _Nested n(derived()); + RealScalar w = n.cwiseAbs().maxCoeff(); + RealScalar z = (n/w).squaredNorm(); + if(z>RealScalar(0)) + return n / (numext::sqrt(z)*w); + else + return n; +} + +/** Normalizes the vector while avoid underflow and overflow + * + * \only_for_vectors + * + * This method is analogue to the normalize() method, but it reduces the risk of + * underflow and overflow when computing the norm. + * + * \warning If the input vector is too small (i.e., this->norm()==0), then \c *this is left unchanged. + * + * \sa stableNorm(), stableNormalized(), normalize() + */ +template +EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE void MatrixBase::stableNormalize() +{ + RealScalar w = cwiseAbs().maxCoeff(); + RealScalar z = (derived()/w).squaredNorm(); + if(z>RealScalar(0)) + derived() /= numext::sqrt(z)*w; } //---------- implementation of other norms ---------- @@ -164,9 +204,10 @@ template struct lpNorm_selector { typedef typename NumTraits::Scalar>::Real RealScalar; + EIGEN_DEVICE_FUNC static inline RealScalar run(const MatrixBase& m) { - using std::pow; + EIGEN_USING_STD(pow) return pow(m.cwiseAbs().array().pow(p).sum(), RealScalar(1)/p); } }; @@ -174,6 +215,7 @@ struct lpNorm_selector template struct lpNorm_selector { + EIGEN_DEVICE_FUNC static inline typename NumTraits::Scalar>::Real run(const MatrixBase& m) { return m.cwiseAbs().sum(); @@ -183,6 +225,7 @@ struct lpNorm_selector template struct lpNorm_selector { + EIGEN_DEVICE_FUNC static inline typename NumTraits::Scalar>::Real run(const MatrixBase& m) { return m.norm(); @@ -192,23 +235,35 @@ struct lpNorm_selector template struct lpNorm_selector { - static inline typename NumTraits::Scalar>::Real run(const MatrixBase& m) + typedef typename NumTraits::Scalar>::Real RealScalar; + EIGEN_DEVICE_FUNC + static inline RealScalar run(const MatrixBase& m) { + if(Derived::SizeAtCompileTime==0 || (Derived::SizeAtCompileTime==Dynamic && m.size()==0)) + return RealScalar(0); return m.cwiseAbs().maxCoeff(); } }; } // end namespace internal -/** \returns the \f$ \ell^p \f$ norm of *this, that is, returns the p-th root of the sum of the p-th powers of the absolute values - * of the coefficients of *this. If \a p is the special value \a Eigen::Infinity, this function returns the \f$ \ell^\infty \f$ - * norm, that is the maximum of the absolute values of the coefficients of *this. +/** \returns the \b coefficient-wise \f$ \ell^p \f$ norm of \c *this, that is, returns the p-th root of the sum of the p-th powers of the absolute values + * of the coefficients of \c *this. If \a p is the special value \a Eigen::Infinity, this function returns the \f$ \ell^\infty \f$ + * norm, that is the maximum of the absolute values of the coefficients of \c *this. + * + * In all cases, if \c *this is empty, then the value 0 is returned. + * + * \note For matrices, this function does not compute the operator-norm. That is, if \c *this is a matrix, then its coefficients are interpreted as a 1D vector. Nonetheless, you can easily compute the 1-norm and \f$\infty\f$-norm matrix operator norms using \link TutorialReductionsVisitorsBroadcastingReductionsNorm partial reductions \endlink. * * \sa norm() */ template template -inline typename NumTraits::Scalar>::Real +#ifndef EIGEN_PARSED_BY_DOXYGEN +EIGEN_DEVICE_FUNC inline typename NumTraits::Scalar>::Real +#else +EIGEN_DEVICE_FUNC MatrixBase::RealScalar +#endif MatrixBase::lpNorm() const { return internal::lpNorm_selector::run(*this); @@ -227,8 +282,8 @@ template bool MatrixBase::isOrthogonal (const MatrixBase& other, const RealScalar& prec) const { - typename internal::nested::type nested(derived()); - typename internal::nested::type otherNested(other.derived()); + typename internal::nested_eval::type nested(derived()); + typename internal::nested_eval::type otherNested(other.derived()); return numext::abs2(nested.dot(otherNested)) <= prec * prec * nested.squaredNorm() * otherNested.squaredNorm(); } @@ -246,13 +301,13 @@ bool MatrixBase::isOrthogonal template bool MatrixBase::isUnitary(const RealScalar& prec) const { - typename Derived::Nested nested(derived()); + typename internal::nested_eval::type self(derived()); for(Index i = 0; i < cols(); ++i) { - if(!internal::isApprox(nested.col(i).squaredNorm(), static_cast(1), prec)) + if(!internal::isApprox(self.col(i).squaredNorm(), static_cast(1), prec)) return false; for(Index j = 0; j < i; ++j) - if(!internal::isMuchSmallerThan(nested.col(i).dot(nested.col(j)), static_cast(1), prec)) + if(!internal::isMuchSmallerThan(self.col(i).dot(self.col(j)), static_cast(1), prec)) return false; } return true; diff --git a/extern/eigen/Eigen/src/Core/EigenBase.h b/extern/eigen/Eigen/src/Core/EigenBase.h index fadb4585..6b3c7d37 100644 --- a/extern/eigen/Eigen/src/Core/EigenBase.h +++ b/extern/eigen/Eigen/src/Core/EigenBase.h @@ -13,7 +13,10 @@ namespace Eigen { -/** Common base class for all classes T such that MatrixBase has an operator=(T) and a constructor MatrixBase(T). +/** \class EigenBase + * \ingroup Core_Module + * + * Common base class for all classes T such that MatrixBase has an operator=(T) and a constructor MatrixBase(T). * * In other words, an EigenBase object is an object that can be copied into a MatrixBase. * @@ -21,39 +24,58 @@ namespace Eigen { * * Notice that this class is trivial, it is only used to disambiguate overloaded functions. * - * \sa \ref TopicClassHierarchy + * \sa \blank \ref TopicClassHierarchy */ template struct EigenBase { // typedef typename internal::plain_matrix_type::type PlainObject; + /** \brief The interface type of indices + * \details To change this, \c \#define the preprocessor symbol \c EIGEN_DEFAULT_DENSE_INDEX_TYPE. + * \sa StorageIndex, \ref TopicPreprocessorDirectives. + * DEPRECATED: Since Eigen 3.3, its usage is deprecated. Use Eigen::Index instead. + * Deprecation is not marked with a doxygen comment because there are too many existing usages to add the deprecation attribute. + */ + typedef Eigen::Index Index; + + // FIXME is it needed? typedef typename internal::traits::StorageKind StorageKind; - typedef typename internal::traits::Index Index; /** \returns a reference to the derived object */ + EIGEN_DEVICE_FUNC Derived& derived() { return *static_cast(this); } /** \returns a const reference to the derived object */ + EIGEN_DEVICE_FUNC const Derived& derived() const { return *static_cast(this); } + EIGEN_DEVICE_FUNC inline Derived& const_cast_derived() const { return *static_cast(const_cast(this)); } + EIGEN_DEVICE_FUNC inline const Derived& const_derived() const { return *static_cast(this); } /** \returns the number of rows. \sa cols(), RowsAtCompileTime */ - inline Index rows() const { return derived().rows(); } + EIGEN_DEVICE_FUNC EIGEN_CONSTEXPR + inline Index rows() const EIGEN_NOEXCEPT { return derived().rows(); } /** \returns the number of columns. \sa rows(), ColsAtCompileTime*/ - inline Index cols() const { return derived().cols(); } + EIGEN_DEVICE_FUNC EIGEN_CONSTEXPR + inline Index cols() const EIGEN_NOEXCEPT { return derived().cols(); } /** \returns the number of coefficients, which is rows()*cols(). * \sa rows(), cols(), SizeAtCompileTime. */ - inline Index size() const { return rows() * cols(); } + EIGEN_DEVICE_FUNC EIGEN_CONSTEXPR + inline Index size() const EIGEN_NOEXCEPT { return rows() * cols(); } /** \internal Don't use it, but do the equivalent: \code dst = *this; \endcode */ - template inline void evalTo(Dest& dst) const + template + EIGEN_DEVICE_FUNC + inline void evalTo(Dest& dst) const { derived().evalTo(dst); } /** \internal Don't use it, but do the equivalent: \code dst += *this; \endcode */ - template inline void addTo(Dest& dst) const + template + EIGEN_DEVICE_FUNC + inline void addTo(Dest& dst) const { // This is the default implementation, // derived class can reimplement it in a more optimized way. @@ -63,7 +85,9 @@ template struct EigenBase } /** \internal Don't use it, but do the equivalent: \code dst -= *this; \endcode */ - template inline void subTo(Dest& dst) const + template + EIGEN_DEVICE_FUNC + inline void subTo(Dest& dst) const { // This is the default implementation, // derived class can reimplement it in a more optimized way. @@ -73,7 +97,8 @@ template struct EigenBase } /** \internal Don't use it, but do the equivalent: \code dst.applyOnTheRight(*this); \endcode */ - template inline void applyThisOnTheRight(Dest& dst) const + template + EIGEN_DEVICE_FUNC inline void applyThisOnTheRight(Dest& dst) const { // This is the default implementation, // derived class can reimplement it in a more optimized way. @@ -81,7 +106,8 @@ template struct EigenBase } /** \internal Don't use it, but do the equivalent: \code dst.applyOnTheLeft(*this); \endcode */ - template inline void applyThisOnTheLeft(Dest& dst) const + template + EIGEN_DEVICE_FUNC inline void applyThisOnTheLeft(Dest& dst) const { // This is the default implementation, // derived class can reimplement it in a more optimized way. @@ -104,25 +130,28 @@ template struct EigenBase */ template template +EIGEN_DEVICE_FUNC Derived& DenseBase::operator=(const EigenBase &other) { - other.derived().evalTo(derived()); + call_assignment(derived(), other.derived()); return derived(); } template template +EIGEN_DEVICE_FUNC Derived& DenseBase::operator+=(const EigenBase &other) { - other.derived().addTo(derived()); + call_assignment(derived(), other.derived(), internal::add_assign_op()); return derived(); } template template +EIGEN_DEVICE_FUNC Derived& DenseBase::operator-=(const EigenBase &other) { - other.derived().subTo(derived()); + call_assignment(derived(), other.derived(), internal::sub_assign_op()); return derived(); } diff --git a/extern/eigen/Eigen/src/Core/Flagged.h b/extern/eigen/Eigen/src/Core/Flagged.h deleted file mode 100644 index 1f2955fc..00000000 --- a/extern/eigen/Eigen/src/Core/Flagged.h +++ /dev/null @@ -1,140 +0,0 @@ -// This file is part of Eigen, a lightweight C++ template library -// for linear algebra. -// -// Copyright (C) 2008 Benoit Jacob -// -// This Source Code Form is subject to the terms of the Mozilla -// Public License v. 2.0. If a copy of the MPL was not distributed -// with this file, You can obtain one at http://mozilla.org/MPL/2.0/. - -#ifndef EIGEN_FLAGGED_H -#define EIGEN_FLAGGED_H - -namespace Eigen { - -/** \class Flagged - * \ingroup Core_Module - * - * \brief Expression with modified flags - * - * \param ExpressionType the type of the object of which we are modifying the flags - * \param Added the flags added to the expression - * \param Removed the flags removed from the expression (has priority over Added). - * - * This class represents an expression whose flags have been modified. - * It is the return type of MatrixBase::flagged() - * and most of the time this is the only way it is used. - * - * \sa MatrixBase::flagged() - */ - -namespace internal { -template -struct traits > : traits -{ - enum { Flags = (ExpressionType::Flags | Added) & ~Removed }; -}; -} - -template class Flagged - : public MatrixBase > -{ - public: - - typedef MatrixBase Base; - - EIGEN_DENSE_PUBLIC_INTERFACE(Flagged) - typedef typename internal::conditional::ret, - ExpressionType, const ExpressionType&>::type ExpressionTypeNested; - typedef typename ExpressionType::InnerIterator InnerIterator; - - inline Flagged(const ExpressionType& matrix) : m_matrix(matrix) {} - - inline Index rows() const { return m_matrix.rows(); } - inline Index cols() const { return m_matrix.cols(); } - inline Index outerStride() const { return m_matrix.outerStride(); } - inline Index innerStride() const { return m_matrix.innerStride(); } - - inline CoeffReturnType coeff(Index row, Index col) const - { - return m_matrix.coeff(row, col); - } - - inline CoeffReturnType coeff(Index index) const - { - return m_matrix.coeff(index); - } - - inline const Scalar& coeffRef(Index row, Index col) const - { - return m_matrix.const_cast_derived().coeffRef(row, col); - } - - inline const Scalar& coeffRef(Index index) const - { - return m_matrix.const_cast_derived().coeffRef(index); - } - - inline Scalar& coeffRef(Index row, Index col) - { - return m_matrix.const_cast_derived().coeffRef(row, col); - } - - inline Scalar& coeffRef(Index index) - { - return m_matrix.const_cast_derived().coeffRef(index); - } - - template - inline const PacketScalar packet(Index row, Index col) const - { - return m_matrix.template packet(row, col); - } - - template - inline void writePacket(Index row, Index col, const PacketScalar& x) - { - m_matrix.const_cast_derived().template writePacket(row, col, x); - } - - template - inline const PacketScalar packet(Index index) const - { - return m_matrix.template packet(index); - } - - template - inline void writePacket(Index index, const PacketScalar& x) - { - m_matrix.const_cast_derived().template writePacket(index, x); - } - - const ExpressionType& _expression() const { return m_matrix; } - - template - typename ExpressionType::PlainObject solveTriangular(const MatrixBase& other) const; - - template - void solveTriangularInPlace(const MatrixBase& other) const; - - protected: - ExpressionTypeNested m_matrix; -}; - -/** \returns an expression of *this with added and removed flags - * - * This is mostly for internal use. - * - * \sa class Flagged - */ -template -template -inline const Flagged -DenseBase::flagged() const -{ - return derived(); -} - -} // end namespace Eigen - -#endif // EIGEN_FLAGGED_H diff --git a/extern/eigen/Eigen/src/Core/ForceAlignedAccess.h b/extern/eigen/Eigen/src/Core/ForceAlignedAccess.h index 807c7a29..817a43af 100644 --- a/extern/eigen/Eigen/src/Core/ForceAlignedAccess.h +++ b/extern/eigen/Eigen/src/Core/ForceAlignedAccess.h @@ -39,29 +39,33 @@ template class ForceAlignedAccess typedef typename internal::dense_xpr_base::type Base; EIGEN_DENSE_PUBLIC_INTERFACE(ForceAlignedAccess) - inline ForceAlignedAccess(const ExpressionType& matrix) : m_expression(matrix) {} - - inline Index rows() const { return m_expression.rows(); } - inline Index cols() const { return m_expression.cols(); } - inline Index outerStride() const { return m_expression.outerStride(); } - inline Index innerStride() const { return m_expression.innerStride(); } - - inline const CoeffReturnType coeff(Index row, Index col) const + EIGEN_DEVICE_FUNC explicit inline ForceAlignedAccess(const ExpressionType& matrix) : m_expression(matrix) {} + + EIGEN_DEVICE_FUNC EIGEN_CONSTEXPR + inline Index rows() const EIGEN_NOEXCEPT { return m_expression.rows(); } + EIGEN_DEVICE_FUNC EIGEN_CONSTEXPR + inline Index cols() const EIGEN_NOEXCEPT { return m_expression.cols(); } + EIGEN_DEVICE_FUNC EIGEN_CONSTEXPR + inline Index outerStride() const EIGEN_NOEXCEPT { return m_expression.outerStride(); } + EIGEN_DEVICE_FUNC EIGEN_CONSTEXPR + inline Index innerStride() const EIGEN_NOEXCEPT { return m_expression.innerStride(); } + + EIGEN_DEVICE_FUNC inline const CoeffReturnType coeff(Index row, Index col) const { return m_expression.coeff(row, col); } - inline Scalar& coeffRef(Index row, Index col) + EIGEN_DEVICE_FUNC inline Scalar& coeffRef(Index row, Index col) { return m_expression.const_cast_derived().coeffRef(row, col); } - inline const CoeffReturnType coeff(Index index) const + EIGEN_DEVICE_FUNC inline const CoeffReturnType coeff(Index index) const { return m_expression.coeff(index); } - inline Scalar& coeffRef(Index index) + EIGEN_DEVICE_FUNC inline Scalar& coeffRef(Index index) { return m_expression.const_cast_derived().coeffRef(index); } @@ -90,7 +94,7 @@ template class ForceAlignedAccess m_expression.const_cast_derived().template writePacket(index, x); } - operator const ExpressionType&() const { return m_expression; } + EIGEN_DEVICE_FUNC operator const ExpressionType&() const { return m_expression; } protected: const ExpressionType& m_expression; @@ -127,7 +131,7 @@ template inline typename internal::add_const_on_value_type,Derived&>::type>::type MatrixBase::forceAlignedAccessIf() const { - return derived(); + return derived(); // FIXME This should not work but apparently is never used } /** \returns an expression of *this with forced aligned access if \a Enable is true. @@ -138,7 +142,7 @@ template inline typename internal::conditional,Derived&>::type MatrixBase::forceAlignedAccessIf() { - return derived(); + return derived(); // FIXME This should not work but apparently is never used } } // end namespace Eigen diff --git a/extern/eigen/Eigen/src/Core/Functors.h b/extern/eigen/Eigen/src/Core/Functors.h deleted file mode 100644 index 5f14c658..00000000 --- a/extern/eigen/Eigen/src/Core/Functors.h +++ /dev/null @@ -1,1026 +0,0 @@ -// This file is part of Eigen, a lightweight C++ template library -// for linear algebra. -// -// Copyright (C) 2008-2010 Gael Guennebaud -// -// This Source Code Form is subject to the terms of the Mozilla -// Public License v. 2.0. If a copy of the MPL was not distributed -// with this file, You can obtain one at http://mozilla.org/MPL/2.0/. - -#ifndef EIGEN_FUNCTORS_H -#define EIGEN_FUNCTORS_H - -namespace Eigen { - -namespace internal { - -// associative functors: - -/** \internal - * \brief Template functor to compute the sum of two scalars - * - * \sa class CwiseBinaryOp, MatrixBase::operator+, class VectorwiseOp, MatrixBase::sum() - */ -template struct scalar_sum_op { - EIGEN_EMPTY_STRUCT_CTOR(scalar_sum_op) - EIGEN_STRONG_INLINE const Scalar operator() (const Scalar& a, const Scalar& b) const { return a + b; } - template - EIGEN_STRONG_INLINE const Packet packetOp(const Packet& a, const Packet& b) const - { return internal::padd(a,b); } - template - EIGEN_STRONG_INLINE const Scalar predux(const Packet& a) const - { return internal::predux(a); } -}; -template -struct functor_traits > { - enum { - Cost = NumTraits::AddCost, - PacketAccess = packet_traits::HasAdd - }; -}; - -/** \internal - * \brief Template functor to compute the product of two scalars - * - * \sa class CwiseBinaryOp, Cwise::operator*(), class VectorwiseOp, MatrixBase::redux() - */ -template struct scalar_product_op { - enum { - // TODO vectorize mixed product - Vectorizable = is_same::value && packet_traits::HasMul && packet_traits::HasMul - }; - typedef typename scalar_product_traits::ReturnType result_type; - EIGEN_EMPTY_STRUCT_CTOR(scalar_product_op) - EIGEN_STRONG_INLINE const result_type operator() (const LhsScalar& a, const RhsScalar& b) const { return a * b; } - template - EIGEN_STRONG_INLINE const Packet packetOp(const Packet& a, const Packet& b) const - { return internal::pmul(a,b); } - template - EIGEN_STRONG_INLINE const result_type predux(const Packet& a) const - { return internal::predux_mul(a); } -}; -template -struct functor_traits > { - enum { - Cost = (NumTraits::MulCost + NumTraits::MulCost)/2, // rough estimate! - PacketAccess = scalar_product_op::Vectorizable - }; -}; - -/** \internal - * \brief Template functor to compute the conjugate product of two scalars - * - * This is a short cut for conj(x) * y which is needed for optimization purpose; in Eigen2 support mode, this becomes x * conj(y) - */ -template struct scalar_conj_product_op { - - enum { - Conj = NumTraits::IsComplex - }; - - typedef typename scalar_product_traits::ReturnType result_type; - - EIGEN_EMPTY_STRUCT_CTOR(scalar_conj_product_op) - EIGEN_STRONG_INLINE const result_type operator() (const LhsScalar& a, const RhsScalar& b) const - { return conj_helper().pmul(a,b); } - - template - EIGEN_STRONG_INLINE const Packet packetOp(const Packet& a, const Packet& b) const - { return conj_helper().pmul(a,b); } -}; -template -struct functor_traits > { - enum { - Cost = NumTraits::MulCost, - PacketAccess = internal::is_same::value && packet_traits::HasMul - }; -}; - -/** \internal - * \brief Template functor to compute the min of two scalars - * - * \sa class CwiseBinaryOp, MatrixBase::cwiseMin, class VectorwiseOp, MatrixBase::minCoeff() - */ -template struct scalar_min_op { - EIGEN_EMPTY_STRUCT_CTOR(scalar_min_op) - EIGEN_STRONG_INLINE const Scalar operator() (const Scalar& a, const Scalar& b) const { using std::min; return (min)(a, b); } - template - EIGEN_STRONG_INLINE const Packet packetOp(const Packet& a, const Packet& b) const - { return internal::pmin(a,b); } - template - EIGEN_STRONG_INLINE const Scalar predux(const Packet& a) const - { return internal::predux_min(a); } -}; -template -struct functor_traits > { - enum { - Cost = NumTraits::AddCost, - PacketAccess = packet_traits::HasMin - }; -}; - -/** \internal - * \brief Template functor to compute the max of two scalars - * - * \sa class CwiseBinaryOp, MatrixBase::cwiseMax, class VectorwiseOp, MatrixBase::maxCoeff() - */ -template struct scalar_max_op { - EIGEN_EMPTY_STRUCT_CTOR(scalar_max_op) - EIGEN_STRONG_INLINE const Scalar operator() (const Scalar& a, const Scalar& b) const { using std::max; return (max)(a, b); } - template - EIGEN_STRONG_INLINE const Packet packetOp(const Packet& a, const Packet& b) const - { return internal::pmax(a,b); } - template - EIGEN_STRONG_INLINE const Scalar predux(const Packet& a) const - { return internal::predux_max(a); } -}; -template -struct functor_traits > { - enum { - Cost = NumTraits::AddCost, - PacketAccess = packet_traits::HasMax - }; -}; - -/** \internal - * \brief Template functor to compute the hypot of two scalars - * - * \sa MatrixBase::stableNorm(), class Redux - */ -template struct scalar_hypot_op { - EIGEN_EMPTY_STRUCT_CTOR(scalar_hypot_op) -// typedef typename NumTraits::Real result_type; - EIGEN_STRONG_INLINE const Scalar operator() (const Scalar& _x, const Scalar& _y) const - { - using std::max; - using std::min; - using std::sqrt; - Scalar p = (max)(_x, _y); - Scalar q = (min)(_x, _y); - Scalar qp = q/p; - return p * sqrt(Scalar(1) + qp*qp); - } -}; -template -struct functor_traits > { - enum { Cost = 5 * NumTraits::MulCost, PacketAccess=0 }; -}; - -/** \internal - * \brief Template functor to compute the pow of two scalars - */ -template struct scalar_binary_pow_op { - EIGEN_EMPTY_STRUCT_CTOR(scalar_binary_pow_op) - inline Scalar operator() (const Scalar& a, const OtherScalar& b) const { return numext::pow(a, b); } -}; -template -struct functor_traits > { - enum { Cost = 5 * NumTraits::MulCost, PacketAccess = false }; -}; - -// other binary functors: - -/** \internal - * \brief Template functor to compute the difference of two scalars - * - * \sa class CwiseBinaryOp, MatrixBase::operator- - */ -template struct scalar_difference_op { - EIGEN_EMPTY_STRUCT_CTOR(scalar_difference_op) - EIGEN_STRONG_INLINE const Scalar operator() (const Scalar& a, const Scalar& b) const { return a - b; } - template - EIGEN_STRONG_INLINE const Packet packetOp(const Packet& a, const Packet& b) const - { return internal::psub(a,b); } -}; -template -struct functor_traits > { - enum { - Cost = NumTraits::AddCost, - PacketAccess = packet_traits::HasSub - }; -}; - -/** \internal - * \brief Template functor to compute the quotient of two scalars - * - * \sa class CwiseBinaryOp, Cwise::operator/() - */ -template struct scalar_quotient_op { - enum { - // TODO vectorize mixed product - Vectorizable = is_same::value && packet_traits::HasDiv && packet_traits::HasDiv - }; - typedef typename scalar_product_traits::ReturnType result_type; - EIGEN_EMPTY_STRUCT_CTOR(scalar_quotient_op) - EIGEN_STRONG_INLINE const result_type operator() (const LhsScalar& a, const RhsScalar& b) const { return a / b; } - template - EIGEN_STRONG_INLINE const Packet packetOp(const Packet& a, const Packet& b) const - { return internal::pdiv(a,b); } -}; -template -struct functor_traits > { - enum { - Cost = (NumTraits::MulCost + NumTraits::MulCost), // rough estimate! - PacketAccess = scalar_quotient_op::Vectorizable - }; -}; - - - -/** \internal - * \brief Template functor to compute the and of two booleans - * - * \sa class CwiseBinaryOp, ArrayBase::operator&& - */ -struct scalar_boolean_and_op { - EIGEN_EMPTY_STRUCT_CTOR(scalar_boolean_and_op) - EIGEN_STRONG_INLINE bool operator() (const bool& a, const bool& b) const { return a && b; } -}; -template<> struct functor_traits { - enum { - Cost = NumTraits::AddCost, - PacketAccess = false - }; -}; - -/** \internal - * \brief Template functor to compute the or of two booleans - * - * \sa class CwiseBinaryOp, ArrayBase::operator|| - */ -struct scalar_boolean_or_op { - EIGEN_EMPTY_STRUCT_CTOR(scalar_boolean_or_op) - EIGEN_STRONG_INLINE bool operator() (const bool& a, const bool& b) const { return a || b; } -}; -template<> struct functor_traits { - enum { - Cost = NumTraits::AddCost, - PacketAccess = false - }; -}; - -/** \internal - * \brief Template functors for comparison of two scalars - * \todo Implement packet-comparisons - */ -template struct scalar_cmp_op; - -template -struct functor_traits > { - enum { - Cost = NumTraits::AddCost, - PacketAccess = false - }; -}; - -template -struct result_of(Scalar,Scalar)> { - typedef bool type; -}; - - -template struct scalar_cmp_op { - EIGEN_EMPTY_STRUCT_CTOR(scalar_cmp_op) - EIGEN_STRONG_INLINE bool operator()(const Scalar& a, const Scalar& b) const {return a==b;} -}; -template struct scalar_cmp_op { - EIGEN_EMPTY_STRUCT_CTOR(scalar_cmp_op) - EIGEN_STRONG_INLINE bool operator()(const Scalar& a, const Scalar& b) const {return a struct scalar_cmp_op { - EIGEN_EMPTY_STRUCT_CTOR(scalar_cmp_op) - EIGEN_STRONG_INLINE bool operator()(const Scalar& a, const Scalar& b) const {return a<=b;} -}; -template struct scalar_cmp_op { - EIGEN_EMPTY_STRUCT_CTOR(scalar_cmp_op) - EIGEN_STRONG_INLINE bool operator()(const Scalar& a, const Scalar& b) const {return !(a<=b || b<=a);} -}; -template struct scalar_cmp_op { - EIGEN_EMPTY_STRUCT_CTOR(scalar_cmp_op) - EIGEN_STRONG_INLINE bool operator()(const Scalar& a, const Scalar& b) const {return a!=b;} -}; - -// unary functors: - -/** \internal - * \brief Template functor to compute the opposite of a scalar - * - * \sa class CwiseUnaryOp, MatrixBase::operator- - */ -template struct scalar_opposite_op { - EIGEN_EMPTY_STRUCT_CTOR(scalar_opposite_op) - EIGEN_STRONG_INLINE const Scalar operator() (const Scalar& a) const { return -a; } - template - EIGEN_STRONG_INLINE const Packet packetOp(const Packet& a) const - { return internal::pnegate(a); } -}; -template -struct functor_traits > -{ enum { - Cost = NumTraits::AddCost, - PacketAccess = packet_traits::HasNegate }; -}; - -/** \internal - * \brief Template functor to compute the absolute value of a scalar - * - * \sa class CwiseUnaryOp, Cwise::abs - */ -template struct scalar_abs_op { - EIGEN_EMPTY_STRUCT_CTOR(scalar_abs_op) - typedef typename NumTraits::Real result_type; - EIGEN_STRONG_INLINE const result_type operator() (const Scalar& a) const { using std::abs; return abs(a); } - template - EIGEN_STRONG_INLINE const Packet packetOp(const Packet& a) const - { return internal::pabs(a); } -}; -template -struct functor_traits > -{ - enum { - Cost = NumTraits::AddCost, - PacketAccess = packet_traits::HasAbs - }; -}; - -/** \internal - * \brief Template functor to compute the squared absolute value of a scalar - * - * \sa class CwiseUnaryOp, Cwise::abs2 - */ -template struct scalar_abs2_op { - EIGEN_EMPTY_STRUCT_CTOR(scalar_abs2_op) - typedef typename NumTraits::Real result_type; - EIGEN_STRONG_INLINE const result_type operator() (const Scalar& a) const { return numext::abs2(a); } - template - EIGEN_STRONG_INLINE const Packet packetOp(const Packet& a) const - { return internal::pmul(a,a); } -}; -template -struct functor_traits > -{ enum { Cost = NumTraits::MulCost, PacketAccess = packet_traits::HasAbs2 }; }; - -/** \internal - * \brief Template functor to compute the conjugate of a complex value - * - * \sa class CwiseUnaryOp, MatrixBase::conjugate() - */ -template struct scalar_conjugate_op { - EIGEN_EMPTY_STRUCT_CTOR(scalar_conjugate_op) - EIGEN_STRONG_INLINE const Scalar operator() (const Scalar& a) const { using numext::conj; return conj(a); } - template - EIGEN_STRONG_INLINE const Packet packetOp(const Packet& a) const { return internal::pconj(a); } -}; -template -struct functor_traits > -{ - enum { - Cost = NumTraits::IsComplex ? NumTraits::AddCost : 0, - PacketAccess = packet_traits::HasConj - }; -}; - -/** \internal - * \brief Template functor to cast a scalar to another type - * - * \sa class CwiseUnaryOp, MatrixBase::cast() - */ -template -struct scalar_cast_op { - EIGEN_EMPTY_STRUCT_CTOR(scalar_cast_op) - typedef NewType result_type; - EIGEN_STRONG_INLINE const NewType operator() (const Scalar& a) const { return cast(a); } -}; -template -struct functor_traits > -{ enum { Cost = is_same::value ? 0 : NumTraits::AddCost, PacketAccess = false }; }; - -/** \internal - * \brief Template functor to extract the real part of a complex - * - * \sa class CwiseUnaryOp, MatrixBase::real() - */ -template -struct scalar_real_op { - EIGEN_EMPTY_STRUCT_CTOR(scalar_real_op) - typedef typename NumTraits::Real result_type; - EIGEN_STRONG_INLINE result_type operator() (const Scalar& a) const { return numext::real(a); } -}; -template -struct functor_traits > -{ enum { Cost = 0, PacketAccess = false }; }; - -/** \internal - * \brief Template functor to extract the imaginary part of a complex - * - * \sa class CwiseUnaryOp, MatrixBase::imag() - */ -template -struct scalar_imag_op { - EIGEN_EMPTY_STRUCT_CTOR(scalar_imag_op) - typedef typename NumTraits::Real result_type; - EIGEN_STRONG_INLINE result_type operator() (const Scalar& a) const { return numext::imag(a); } -}; -template -struct functor_traits > -{ enum { Cost = 0, PacketAccess = false }; }; - -/** \internal - * \brief Template functor to extract the real part of a complex as a reference - * - * \sa class CwiseUnaryOp, MatrixBase::real() - */ -template -struct scalar_real_ref_op { - EIGEN_EMPTY_STRUCT_CTOR(scalar_real_ref_op) - typedef typename NumTraits::Real result_type; - EIGEN_STRONG_INLINE result_type& operator() (const Scalar& a) const { return numext::real_ref(*const_cast(&a)); } -}; -template -struct functor_traits > -{ enum { Cost = 0, PacketAccess = false }; }; - -/** \internal - * \brief Template functor to extract the imaginary part of a complex as a reference - * - * \sa class CwiseUnaryOp, MatrixBase::imag() - */ -template -struct scalar_imag_ref_op { - EIGEN_EMPTY_STRUCT_CTOR(scalar_imag_ref_op) - typedef typename NumTraits::Real result_type; - EIGEN_STRONG_INLINE result_type& operator() (const Scalar& a) const { return numext::imag_ref(*const_cast(&a)); } -}; -template -struct functor_traits > -{ enum { Cost = 0, PacketAccess = false }; }; - -/** \internal - * - * \brief Template functor to compute the exponential of a scalar - * - * \sa class CwiseUnaryOp, Cwise::exp() - */ -template struct scalar_exp_op { - EIGEN_EMPTY_STRUCT_CTOR(scalar_exp_op) - inline const Scalar operator() (const Scalar& a) const { using std::exp; return exp(a); } - typedef typename packet_traits::type Packet; - inline Packet packetOp(const Packet& a) const { return internal::pexp(a); } -}; -template -struct functor_traits > -{ enum { Cost = 5 * NumTraits::MulCost, PacketAccess = packet_traits::HasExp }; }; - -/** \internal - * - * \brief Template functor to compute the logarithm of a scalar - * - * \sa class CwiseUnaryOp, Cwise::log() - */ -template struct scalar_log_op { - EIGEN_EMPTY_STRUCT_CTOR(scalar_log_op) - inline const Scalar operator() (const Scalar& a) const { using std::log; return log(a); } - typedef typename packet_traits::type Packet; - inline Packet packetOp(const Packet& a) const { return internal::plog(a); } -}; -template -struct functor_traits > -{ enum { Cost = 5 * NumTraits::MulCost, PacketAccess = packet_traits::HasLog }; }; - -/** \internal - * \brief Template functor to multiply a scalar by a fixed other one - * - * \sa class CwiseUnaryOp, MatrixBase::operator*, MatrixBase::operator/ - */ -/* NOTE why doing the pset1() in packetOp *is* an optimization ? - * indeed it seems better to declare m_other as a Packet and do the pset1() once - * in the constructor. However, in practice: - * - GCC does not like m_other as a Packet and generate a load every time it needs it - * - on the other hand GCC is able to moves the pset1() outside the loop :) - * - simpler code ;) - * (ICC and gcc 4.4 seems to perform well in both cases, the issue is visible with y = a*x + b*y) - */ -template -struct scalar_multiple_op { - typedef typename packet_traits::type Packet; - // FIXME default copy constructors seems bugged with std::complex<> - EIGEN_STRONG_INLINE scalar_multiple_op(const scalar_multiple_op& other) : m_other(other.m_other) { } - EIGEN_STRONG_INLINE scalar_multiple_op(const Scalar& other) : m_other(other) { } - EIGEN_STRONG_INLINE Scalar operator() (const Scalar& a) const { return a * m_other; } - EIGEN_STRONG_INLINE const Packet packetOp(const Packet& a) const - { return internal::pmul(a, pset1(m_other)); } - typename add_const_on_value_type::Nested>::type m_other; -}; -template -struct functor_traits > -{ enum { Cost = NumTraits::MulCost, PacketAccess = packet_traits::HasMul }; }; - -template -struct scalar_multiple2_op { - typedef typename scalar_product_traits::ReturnType result_type; - EIGEN_STRONG_INLINE scalar_multiple2_op(const scalar_multiple2_op& other) : m_other(other.m_other) { } - EIGEN_STRONG_INLINE scalar_multiple2_op(const Scalar2& other) : m_other(other) { } - EIGEN_STRONG_INLINE result_type operator() (const Scalar1& a) const { return a * m_other; } - typename add_const_on_value_type::Nested>::type m_other; -}; -template -struct functor_traits > -{ enum { Cost = NumTraits::MulCost, PacketAccess = false }; }; - -/** \internal - * \brief Template functor to divide a scalar by a fixed other one - * - * This functor is used to implement the quotient of a matrix by - * a scalar where the scalar type is not necessarily a floating point type. - * - * \sa class CwiseUnaryOp, MatrixBase::operator/ - */ -template -struct scalar_quotient1_op { - typedef typename packet_traits::type Packet; - // FIXME default copy constructors seems bugged with std::complex<> - EIGEN_STRONG_INLINE scalar_quotient1_op(const scalar_quotient1_op& other) : m_other(other.m_other) { } - EIGEN_STRONG_INLINE scalar_quotient1_op(const Scalar& other) : m_other(other) {} - EIGEN_STRONG_INLINE Scalar operator() (const Scalar& a) const { return a / m_other; } - EIGEN_STRONG_INLINE const Packet packetOp(const Packet& a) const - { return internal::pdiv(a, pset1(m_other)); } - typename add_const_on_value_type::Nested>::type m_other; -}; -template -struct functor_traits > -{ enum { Cost = 2 * NumTraits::MulCost, PacketAccess = packet_traits::HasDiv }; }; - -// nullary functors - -template -struct scalar_constant_op { - typedef typename packet_traits::type Packet; - EIGEN_STRONG_INLINE scalar_constant_op(const scalar_constant_op& other) : m_other(other.m_other) { } - EIGEN_STRONG_INLINE scalar_constant_op(const Scalar& other) : m_other(other) { } - template - EIGEN_STRONG_INLINE const Scalar operator() (Index, Index = 0) const { return m_other; } - template - EIGEN_STRONG_INLINE const Packet packetOp(Index, Index = 0) const { return internal::pset1(m_other); } - const Scalar m_other; -}; -template -struct functor_traits > -// FIXME replace this packet test by a safe one -{ enum { Cost = 1, PacketAccess = packet_traits::Vectorizable, IsRepeatable = true }; }; - -template struct scalar_identity_op { - EIGEN_EMPTY_STRUCT_CTOR(scalar_identity_op) - template - EIGEN_STRONG_INLINE const Scalar operator() (Index row, Index col) const { return row==col ? Scalar(1) : Scalar(0); } -}; -template -struct functor_traits > -{ enum { Cost = NumTraits::AddCost, PacketAccess = false, IsRepeatable = true }; }; - -template struct linspaced_op_impl; - -// linear access for packet ops: -// 1) initialization -// base = [low, ..., low] + ([step, ..., step] * [-size, ..., 0]) -// 2) each step (where size is 1 for coeff access or PacketSize for packet access) -// base += [size*step, ..., size*step] -// -// TODO: Perhaps it's better to initialize lazily (so not in the constructor but in packetOp) -// in order to avoid the padd() in operator() ? -template -struct linspaced_op_impl -{ - typedef typename packet_traits::type Packet; - - linspaced_op_impl(const Scalar& low, const Scalar& step) : - m_low(low), m_step(step), - m_packetStep(pset1(packet_traits::size*step)), - m_base(padd(pset1(low), pmul(pset1(step),plset(-packet_traits::size)))) {} - - template - EIGEN_STRONG_INLINE const Scalar operator() (Index i) const - { - m_base = padd(m_base, pset1(m_step)); - return m_low+Scalar(i)*m_step; - } - - template - EIGEN_STRONG_INLINE const Packet packetOp(Index) const { return m_base = padd(m_base,m_packetStep); } - - const Scalar m_low; - const Scalar m_step; - const Packet m_packetStep; - mutable Packet m_base; -}; - -// random access for packet ops: -// 1) each step -// [low, ..., low] + ( [step, ..., step] * ( [i, ..., i] + [0, ..., size] ) ) -template -struct linspaced_op_impl -{ - typedef typename packet_traits::type Packet; - - linspaced_op_impl(const Scalar& low, const Scalar& step) : - m_low(low), m_step(step), - m_lowPacket(pset1(m_low)), m_stepPacket(pset1(m_step)), m_interPacket(plset(0)) {} - - template - EIGEN_STRONG_INLINE const Scalar operator() (Index i) const { return m_low+i*m_step; } - - template - EIGEN_STRONG_INLINE const Packet packetOp(Index i) const - { return internal::padd(m_lowPacket, pmul(m_stepPacket, padd(pset1(Scalar(i)),m_interPacket))); } - - const Scalar m_low; - const Scalar m_step; - const Packet m_lowPacket; - const Packet m_stepPacket; - const Packet m_interPacket; -}; - -// ----- Linspace functor ---------------------------------------------------------------- - -// Forward declaration (we default to random access which does not really give -// us a speed gain when using packet access but it allows to use the functor in -// nested expressions). -template struct linspaced_op; -template struct functor_traits< linspaced_op > -{ enum { Cost = 1, PacketAccess = packet_traits::HasSetLinear, IsRepeatable = true }; }; -template struct linspaced_op -{ - typedef typename packet_traits::type Packet; - linspaced_op(const Scalar& low, const Scalar& high, DenseIndex num_steps) : impl((num_steps==1 ? high : low), (num_steps==1 ? Scalar() : (high-low)/Scalar(num_steps-1))) {} - - template - EIGEN_STRONG_INLINE const Scalar operator() (Index i) const { return impl(i); } - - // We need this function when assigning e.g. a RowVectorXd to a MatrixXd since - // there row==0 and col is used for the actual iteration. - template - EIGEN_STRONG_INLINE const Scalar operator() (Index row, Index col) const - { - eigen_assert(col==0 || row==0); - return impl(col + row); - } - - template - EIGEN_STRONG_INLINE const Packet packetOp(Index i) const { return impl.packetOp(i); } - - // We need this function when assigning e.g. a RowVectorXd to a MatrixXd since - // there row==0 and col is used for the actual iteration. - template - EIGEN_STRONG_INLINE const Packet packetOp(Index row, Index col) const - { - eigen_assert(col==0 || row==0); - return impl.packetOp(col + row); - } - - // This proxy object handles the actual required temporaries, the different - // implementations (random vs. sequential access) as well as the - // correct piping to size 2/4 packet operations. - const linspaced_op_impl impl; -}; - -// all functors allow linear access, except scalar_identity_op. So we fix here a quick meta -// to indicate whether a functor allows linear access, just always answering 'yes' except for -// scalar_identity_op. -// FIXME move this to functor_traits adding a functor_default -template struct functor_has_linear_access { enum { ret = 1 }; }; -template struct functor_has_linear_access > { enum { ret = 0 }; }; - -// In Eigen, any binary op (Product, CwiseBinaryOp) require the Lhs and Rhs to have the same scalar type, except for multiplication -// where the mixing of different types is handled by scalar_product_traits -// In particular, real * complex is allowed. -// FIXME move this to functor_traits adding a functor_default -template struct functor_is_product_like { enum { ret = 0 }; }; -template struct functor_is_product_like > { enum { ret = 1 }; }; -template struct functor_is_product_like > { enum { ret = 1 }; }; -template struct functor_is_product_like > { enum { ret = 1 }; }; - - -/** \internal - * \brief Template functor to add a scalar to a fixed other one - * \sa class CwiseUnaryOp, Array::operator+ - */ -/* If you wonder why doing the pset1() in packetOp() is an optimization check scalar_multiple_op */ -template -struct scalar_add_op { - typedef typename packet_traits::type Packet; - // FIXME default copy constructors seems bugged with std::complex<> - inline scalar_add_op(const scalar_add_op& other) : m_other(other.m_other) { } - inline scalar_add_op(const Scalar& other) : m_other(other) { } - inline Scalar operator() (const Scalar& a) const { return a + m_other; } - inline const Packet packetOp(const Packet& a) const - { return internal::padd(a, pset1(m_other)); } - const Scalar m_other; -}; -template -struct functor_traits > -{ enum { Cost = NumTraits::AddCost, PacketAccess = packet_traits::HasAdd }; }; - -/** \internal - * \brief Template functor to compute the square root of a scalar - * \sa class CwiseUnaryOp, Cwise::sqrt() - */ -template struct scalar_sqrt_op { - EIGEN_EMPTY_STRUCT_CTOR(scalar_sqrt_op) - inline const Scalar operator() (const Scalar& a) const { using std::sqrt; return sqrt(a); } - typedef typename packet_traits::type Packet; - inline Packet packetOp(const Packet& a) const { return internal::psqrt(a); } -}; -template -struct functor_traits > -{ enum { - Cost = 5 * NumTraits::MulCost, - PacketAccess = packet_traits::HasSqrt - }; -}; - -/** \internal - * \brief Template functor to compute the cosine of a scalar - * \sa class CwiseUnaryOp, ArrayBase::cos() - */ -template struct scalar_cos_op { - EIGEN_EMPTY_STRUCT_CTOR(scalar_cos_op) - inline Scalar operator() (const Scalar& a) const { using std::cos; return cos(a); } - typedef typename packet_traits::type Packet; - inline Packet packetOp(const Packet& a) const { return internal::pcos(a); } -}; -template -struct functor_traits > -{ - enum { - Cost = 5 * NumTraits::MulCost, - PacketAccess = packet_traits::HasCos - }; -}; - -/** \internal - * \brief Template functor to compute the sine of a scalar - * \sa class CwiseUnaryOp, ArrayBase::sin() - */ -template struct scalar_sin_op { - EIGEN_EMPTY_STRUCT_CTOR(scalar_sin_op) - inline const Scalar operator() (const Scalar& a) const { using std::sin; return sin(a); } - typedef typename packet_traits::type Packet; - inline Packet packetOp(const Packet& a) const { return internal::psin(a); } -}; -template -struct functor_traits > -{ - enum { - Cost = 5 * NumTraits::MulCost, - PacketAccess = packet_traits::HasSin - }; -}; - - -/** \internal - * \brief Template functor to compute the tan of a scalar - * \sa class CwiseUnaryOp, ArrayBase::tan() - */ -template struct scalar_tan_op { - EIGEN_EMPTY_STRUCT_CTOR(scalar_tan_op) - inline const Scalar operator() (const Scalar& a) const { using std::tan; return tan(a); } - typedef typename packet_traits::type Packet; - inline Packet packetOp(const Packet& a) const { return internal::ptan(a); } -}; -template -struct functor_traits > -{ - enum { - Cost = 5 * NumTraits::MulCost, - PacketAccess = packet_traits::HasTan - }; -}; - -/** \internal - * \brief Template functor to compute the arc cosine of a scalar - * \sa class CwiseUnaryOp, ArrayBase::acos() - */ -template struct scalar_acos_op { - EIGEN_EMPTY_STRUCT_CTOR(scalar_acos_op) - inline const Scalar operator() (const Scalar& a) const { using std::acos; return acos(a); } - typedef typename packet_traits::type Packet; - inline Packet packetOp(const Packet& a) const { return internal::pacos(a); } -}; -template -struct functor_traits > -{ - enum { - Cost = 5 * NumTraits::MulCost, - PacketAccess = packet_traits::HasACos - }; -}; - -/** \internal - * \brief Template functor to compute the arc sine of a scalar - * \sa class CwiseUnaryOp, ArrayBase::asin() - */ -template struct scalar_asin_op { - EIGEN_EMPTY_STRUCT_CTOR(scalar_asin_op) - inline const Scalar operator() (const Scalar& a) const { using std::asin; return asin(a); } - typedef typename packet_traits::type Packet; - inline Packet packetOp(const Packet& a) const { return internal::pasin(a); } -}; -template -struct functor_traits > -{ - enum { - Cost = 5 * NumTraits::MulCost, - PacketAccess = packet_traits::HasASin - }; -}; - -/** \internal - * \brief Template functor to raise a scalar to a power - * \sa class CwiseUnaryOp, Cwise::pow - */ -template -struct scalar_pow_op { - // FIXME default copy constructors seems bugged with std::complex<> - inline scalar_pow_op(const scalar_pow_op& other) : m_exponent(other.m_exponent) { } - inline scalar_pow_op(const Scalar& exponent) : m_exponent(exponent) {} - inline Scalar operator() (const Scalar& a) const { return numext::pow(a, m_exponent); } - const Scalar m_exponent; -}; -template -struct functor_traits > -{ enum { Cost = 5 * NumTraits::MulCost, PacketAccess = false }; }; - -/** \internal - * \brief Template functor to compute the quotient between a scalar and array entries. - * \sa class CwiseUnaryOp, Cwise::inverse() - */ -template -struct scalar_inverse_mult_op { - scalar_inverse_mult_op(const Scalar& other) : m_other(other) {} - inline Scalar operator() (const Scalar& a) const { return m_other / a; } - template - inline const Packet packetOp(const Packet& a) const - { return internal::pdiv(pset1(m_other),a); } - Scalar m_other; -}; - -/** \internal - * \brief Template functor to compute the inverse of a scalar - * \sa class CwiseUnaryOp, Cwise::inverse() - */ -template -struct scalar_inverse_op { - EIGEN_EMPTY_STRUCT_CTOR(scalar_inverse_op) - inline Scalar operator() (const Scalar& a) const { return Scalar(1)/a; } - template - inline const Packet packetOp(const Packet& a) const - { return internal::pdiv(pset1(Scalar(1)),a); } -}; -template -struct functor_traits > -{ enum { Cost = NumTraits::MulCost, PacketAccess = packet_traits::HasDiv }; }; - -/** \internal - * \brief Template functor to compute the square of a scalar - * \sa class CwiseUnaryOp, Cwise::square() - */ -template -struct scalar_square_op { - EIGEN_EMPTY_STRUCT_CTOR(scalar_square_op) - inline Scalar operator() (const Scalar& a) const { return a*a; } - template - inline const Packet packetOp(const Packet& a) const - { return internal::pmul(a,a); } -}; -template -struct functor_traits > -{ enum { Cost = NumTraits::MulCost, PacketAccess = packet_traits::HasMul }; }; - -/** \internal - * \brief Template functor to compute the cube of a scalar - * \sa class CwiseUnaryOp, Cwise::cube() - */ -template -struct scalar_cube_op { - EIGEN_EMPTY_STRUCT_CTOR(scalar_cube_op) - inline Scalar operator() (const Scalar& a) const { return a*a*a; } - template - inline const Packet packetOp(const Packet& a) const - { return internal::pmul(a,pmul(a,a)); } -}; -template -struct functor_traits > -{ enum { Cost = 2*NumTraits::MulCost, PacketAccess = packet_traits::HasMul }; }; - -// default functor traits for STL functors: - -template -struct functor_traits > -{ enum { Cost = NumTraits::MulCost, PacketAccess = false }; }; - -template -struct functor_traits > -{ enum { Cost = NumTraits::MulCost, PacketAccess = false }; }; - -template -struct functor_traits > -{ enum { Cost = NumTraits::AddCost, PacketAccess = false }; }; - -template -struct functor_traits > -{ enum { Cost = NumTraits::AddCost, PacketAccess = false }; }; - -template -struct functor_traits > -{ enum { Cost = NumTraits::AddCost, PacketAccess = false }; }; - -template -struct functor_traits > -{ enum { Cost = 1, PacketAccess = false }; }; - -template -struct functor_traits > -{ enum { Cost = 1, PacketAccess = false }; }; - -template -struct functor_traits > -{ enum { Cost = 1, PacketAccess = false }; }; - -template -struct functor_traits > -{ enum { Cost = 1, PacketAccess = false }; }; - -template -struct functor_traits > -{ enum { Cost = 1, PacketAccess = false }; }; - -template -struct functor_traits > -{ enum { Cost = 1, PacketAccess = false }; }; - -template -struct functor_traits > -{ enum { Cost = 1, PacketAccess = false }; }; - -template -struct functor_traits > -{ enum { Cost = 1, PacketAccess = false }; }; - -template -struct functor_traits > -{ enum { Cost = 1, PacketAccess = false }; }; - -template -struct functor_traits > -{ enum { Cost = functor_traits::Cost, PacketAccess = false }; }; - -template -struct functor_traits > -{ enum { Cost = functor_traits::Cost, PacketAccess = false }; }; - -template -struct functor_traits > -{ enum { Cost = 1 + functor_traits::Cost, PacketAccess = false }; }; - -template -struct functor_traits > -{ enum { Cost = 1 + functor_traits::Cost, PacketAccess = false }; }; - -#ifdef EIGEN_STDEXT_SUPPORT - -template -struct functor_traits > -{ enum { Cost = 0, PacketAccess = false }; }; - -template -struct functor_traits > -{ enum { Cost = 0, PacketAccess = false }; }; - -template -struct functor_traits > > -{ enum { Cost = 0, PacketAccess = false }; }; - -template -struct functor_traits > > -{ enum { Cost = 0, PacketAccess = false }; }; - -template -struct functor_traits > -{ enum { Cost = functor_traits::Cost + functor_traits::Cost, PacketAccess = false }; }; - -template -struct functor_traits > -{ enum { Cost = functor_traits::Cost + functor_traits::Cost + functor_traits::Cost, PacketAccess = false }; }; - -#endif // EIGEN_STDEXT_SUPPORT - -// allow to add new functors and specializations of functor_traits from outside Eigen. -// this macro is really needed because functor_traits must be specialized after it is declared but before it is used... -#ifdef EIGEN_FUNCTORS_PLUGIN -#include EIGEN_FUNCTORS_PLUGIN -#endif - -} // end namespace internal - -} // end namespace Eigen - -#endif // EIGEN_FUNCTORS_H diff --git a/extern/eigen/Eigen/src/Core/Fuzzy.h b/extern/eigen/Eigen/src/Core/Fuzzy.h index fe63bd29..43aa49b2 100644 --- a/extern/eigen/Eigen/src/Core/Fuzzy.h +++ b/extern/eigen/Eigen/src/Core/Fuzzy.h @@ -19,18 +19,19 @@ namespace internal template::IsInteger> struct isApprox_selector { + EIGEN_DEVICE_FUNC static bool run(const Derived& x, const OtherDerived& y, const typename Derived::RealScalar& prec) { - using std::min; - typename internal::nested::type nested(x); - typename internal::nested::type otherNested(y); - return (nested - otherNested).cwiseAbs2().sum() <= prec * prec * (min)(nested.cwiseAbs2().sum(), otherNested.cwiseAbs2().sum()); + typename internal::nested_eval::type nested(x); + typename internal::nested_eval::type otherNested(y); + return (nested - otherNested).cwiseAbs2().sum() <= prec * prec * numext::mini(nested.cwiseAbs2().sum(), otherNested.cwiseAbs2().sum()); } }; template struct isApprox_selector { + EIGEN_DEVICE_FUNC static bool run(const Derived& x, const OtherDerived& y, const typename Derived::RealScalar&) { return x.matrix() == y.matrix(); @@ -40,6 +41,7 @@ struct isApprox_selector template::IsInteger> struct isMuchSmallerThan_object_selector { + EIGEN_DEVICE_FUNC static bool run(const Derived& x, const OtherDerived& y, const typename Derived::RealScalar& prec) { return x.cwiseAbs2().sum() <= numext::abs2(prec) * y.cwiseAbs2().sum(); @@ -49,6 +51,7 @@ struct isMuchSmallerThan_object_selector template struct isMuchSmallerThan_object_selector { + EIGEN_DEVICE_FUNC static bool run(const Derived& x, const OtherDerived&, const typename Derived::RealScalar&) { return x.matrix() == Derived::Zero(x.rows(), x.cols()).matrix(); @@ -58,6 +61,7 @@ struct isMuchSmallerThan_object_selector template::IsInteger> struct isMuchSmallerThan_scalar_selector { + EIGEN_DEVICE_FUNC static bool run(const Derived& x, const typename Derived::RealScalar& y, const typename Derived::RealScalar& prec) { return x.cwiseAbs2().sum() <= numext::abs2(prec * y); @@ -67,6 +71,7 @@ struct isMuchSmallerThan_scalar_selector template struct isMuchSmallerThan_scalar_selector { + EIGEN_DEVICE_FUNC static bool run(const Derived& x, const typename Derived::RealScalar&, const typename Derived::RealScalar&) { return x.matrix() == Derived::Zero(x.rows(), x.cols()).matrix(); @@ -95,7 +100,7 @@ struct isMuchSmallerThan_scalar_selector */ template template -bool DenseBase::isApprox( +EIGEN_DEVICE_FUNC bool DenseBase::isApprox( const DenseBase& other, const RealScalar& prec ) const @@ -117,7 +122,7 @@ bool DenseBase::isApprox( * \sa isApprox(), isMuchSmallerThan(const DenseBase&, RealScalar) const */ template -bool DenseBase::isMuchSmallerThan( +EIGEN_DEVICE_FUNC bool DenseBase::isMuchSmallerThan( const typename NumTraits::Real& other, const RealScalar& prec ) const @@ -137,7 +142,7 @@ bool DenseBase::isMuchSmallerThan( */ template template -bool DenseBase::isMuchSmallerThan( +EIGEN_DEVICE_FUNC bool DenseBase::isMuchSmallerThan( const DenseBase& other, const RealScalar& prec ) const diff --git a/extern/eigen/Eigen/src/Core/GeneralProduct.h b/extern/eigen/Eigen/src/Core/GeneralProduct.h index 0eae5299..6906aa75 100644 --- a/extern/eigen/Eigen/src/Core/GeneralProduct.h +++ b/extern/eigen/Eigen/src/Core/GeneralProduct.h @@ -11,46 +11,40 @@ #ifndef EIGEN_GENERAL_PRODUCT_H #define EIGEN_GENERAL_PRODUCT_H -namespace Eigen { - -/** \class GeneralProduct - * \ingroup Core_Module - * - * \brief Expression of the product of two general matrices or vectors - * - * \param LhsNested the type used to store the left-hand side - * \param RhsNested the type used to store the right-hand side - * \param ProductMode the type of the product - * - * This class represents an expression of the product of two general matrices. - * We call a general matrix, a dense matrix with full storage. For instance, - * This excludes triangular, selfadjoint, and sparse matrices. - * It is the return type of the operator* between general matrices. Its template - * arguments are determined automatically by ProductReturnType. Therefore, - * GeneralProduct should never be used direclty. To determine the result type of a - * function which involves a matrix product, use ProductReturnType::Type. - * - * \sa ProductReturnType, MatrixBase::operator*(const MatrixBase&) - */ -template::value> -class GeneralProduct; +namespace Eigen { enum { Large = 2, Small = 3 }; +// Define the threshold value to fallback from the generic matrix-matrix product +// implementation (heavy) to the lightweight coeff-based product one. +// See generic_product_impl +// in products/GeneralMatrixMatrix.h for more details. +// TODO This threshold should also be used in the compile-time selector below. +#ifndef EIGEN_GEMM_TO_COEFFBASED_THRESHOLD +// This default value has been obtained on a Haswell architecture. +#define EIGEN_GEMM_TO_COEFFBASED_THRESHOLD 20 +#endif + namespace internal { template struct product_type_selector; template struct product_size_category { - enum { is_large = MaxSize == Dynamic || - Size >= EIGEN_CACHEFRIENDLY_PRODUCT_THRESHOLD, - value = is_large ? Large - : Size == 1 ? 1 - : Small + enum { + #ifndef EIGEN_GPU_COMPILE_PHASE + is_large = MaxSize == Dynamic || + Size >= EIGEN_CACHEFRIENDLY_PRODUCT_THRESHOLD || + (Size==Dynamic && MaxSize>=EIGEN_CACHEFRIENDLY_PRODUCT_THRESHOLD), + #else + is_large = 0, + #endif + value = is_large ? Large + : Size == 1 ? 1 + : Small }; }; @@ -59,15 +53,14 @@ template struct product_type typedef typename remove_all::type _Lhs; typedef typename remove_all::type _Rhs; enum { - MaxRows = _Lhs::MaxRowsAtCompileTime, - Rows = _Lhs::RowsAtCompileTime, - MaxCols = _Rhs::MaxColsAtCompileTime, - Cols = _Rhs::ColsAtCompileTime, - MaxDepth = EIGEN_SIZE_MIN_PREFER_FIXED(_Lhs::MaxColsAtCompileTime, - _Rhs::MaxRowsAtCompileTime), - Depth = EIGEN_SIZE_MIN_PREFER_FIXED(_Lhs::ColsAtCompileTime, - _Rhs::RowsAtCompileTime), - LargeThreshold = EIGEN_CACHEFRIENDLY_PRODUCT_THRESHOLD + MaxRows = traits<_Lhs>::MaxRowsAtCompileTime, + Rows = traits<_Lhs>::RowsAtCompileTime, + MaxCols = traits<_Rhs>::MaxColsAtCompileTime, + Cols = traits<_Rhs>::ColsAtCompileTime, + MaxDepth = EIGEN_SIZE_MIN_PREFER_FIXED(traits<_Lhs>::MaxColsAtCompileTime, + traits<_Rhs>::MaxRowsAtCompileTime), + Depth = EIGEN_SIZE_MIN_PREFER_FIXED(traits<_Lhs>::ColsAtCompileTime, + traits<_Rhs>::RowsAtCompileTime) }; // the splitting into different lines of code here, introducing the _select enums and the typedef below, @@ -82,7 +75,8 @@ template struct product_type public: enum { - value = selector::ret + value = selector::ret, + ret = selector::ret }; #ifdef EIGEN_DEBUG_PRODUCT static void debug() @@ -98,12 +92,13 @@ template struct product_type #endif }; - /* The following allows to select the kind of product at compile time * based on the three dimensions of the product. * This is a compile time mapping from {1,Small,Large}^3 -> {product types} */ // FIXME I'm not sure the current mapping is the ideal one. template struct product_type_selector { enum { ret = OuterProduct }; }; +template struct product_type_selector { enum { ret = LazyCoeffBasedProductMode }; }; +template struct product_type_selector<1, N, 1> { enum { ret = LazyCoeffBasedProductMode }; }; template struct product_type_selector<1, 1, Depth> { enum { ret = InnerProduct }; }; template<> struct product_type_selector<1, 1, 1> { enum { ret = InnerProduct }; }; template<> struct product_type_selector { enum { ret = CoeffBasedProductMode }; }; @@ -122,60 +117,12 @@ template<> struct product_type_selector { enum template<> struct product_type_selector { enum { ret = GemmProduct }; }; template<> struct product_type_selector { enum { ret = GemmProduct }; }; template<> struct product_type_selector { enum { ret = GemmProduct }; }; -template<> struct product_type_selector { enum { ret = GemmProduct }; }; -template<> struct product_type_selector { enum { ret = GemmProduct }; }; +template<> struct product_type_selector { enum { ret = CoeffBasedProductMode }; }; +template<> struct product_type_selector { enum { ret = CoeffBasedProductMode }; }; template<> struct product_type_selector { enum { ret = GemmProduct }; }; } // end namespace internal -/** \class ProductReturnType - * \ingroup Core_Module - * - * \brief Helper class to get the correct and optimized returned type of operator* - * - * \param Lhs the type of the left-hand side - * \param Rhs the type of the right-hand side - * \param ProductMode the type of the product (determined automatically by internal::product_mode) - * - * This class defines the typename Type representing the optimized product expression - * between two matrix expressions. In practice, using ProductReturnType::Type - * is the recommended way to define the result type of a function returning an expression - * which involve a matrix product. The class Product should never be - * used directly. - * - * \sa class Product, MatrixBase::operator*(const MatrixBase&) - */ -template -struct ProductReturnType -{ - // TODO use the nested type to reduce instanciations ???? -// typedef typename internal::nested::type LhsNested; -// typedef typename internal::nested::type RhsNested; - - typedef GeneralProduct Type; -}; - -template -struct ProductReturnType -{ - typedef typename internal::nested::type >::type LhsNested; - typedef typename internal::nested::type >::type RhsNested; - typedef CoeffBasedProduct Type; -}; - -template -struct ProductReturnType -{ - typedef typename internal::nested::type >::type LhsNested; - typedef typename internal::nested::type >::type RhsNested; - typedef CoeffBasedProduct Type; -}; - -// this is a workaround for sun CC -template -struct LazyProductReturnType : public ProductReturnType -{}; - /*********************************************************************** * Implementation of Inner Vector Vector Product ***********************************************************************/ @@ -187,119 +134,10 @@ struct LazyProductReturnType : public ProductReturnType with: operator=(Scalar x); -namespace internal { - -template -struct traits > - : traits::ReturnType,1,1> > -{}; - -} - -template -class GeneralProduct - : internal::no_assignment_operator, - public Matrix::ReturnType,1,1> -{ - typedef Matrix::ReturnType,1,1> Base; - public: - GeneralProduct(const Lhs& lhs, const Rhs& rhs) - { - EIGEN_STATIC_ASSERT((internal::is_same::value), - YOU_MIXED_DIFFERENT_NUMERIC_TYPES__YOU_NEED_TO_USE_THE_CAST_METHOD_OF_MATRIXBASE_TO_CAST_NUMERIC_TYPES_EXPLICITLY) - - Base::coeffRef(0,0) = (lhs.transpose().cwiseProduct(rhs)).sum(); - } - - /** Convertion to scalar */ - operator const typename Base::Scalar() const { - return Base::coeff(0,0); - } -}; - /*********************************************************************** * Implementation of Outer Vector Vector Product ***********************************************************************/ -namespace internal { - -// Column major -template -EIGEN_DONT_INLINE void outer_product_selector_run(const ProductType& prod, Dest& dest, const Func& func, const false_type&) -{ - typedef typename Dest::Index Index; - // FIXME make sure lhs is sequentially stored - // FIXME not very good if rhs is real and lhs complex while alpha is real too - const Index cols = dest.cols(); - for (Index j=0; j -EIGEN_DONT_INLINE void outer_product_selector_run(const ProductType& prod, Dest& dest, const Func& func, const true_type&) { - typedef typename Dest::Index Index; - // FIXME make sure rhs is sequentially stored - // FIXME not very good if lhs is real and rhs complex while alpha is real too - const Index rows = dest.rows(); - for (Index i=0; i -struct traits > - : traits, Lhs, Rhs> > -{}; - -} - -template -class GeneralProduct - : public ProductBase, Lhs, Rhs> -{ - template struct is_row_major : internal::conditional<(int(T::Flags)&RowMajorBit), internal::true_type, internal::false_type>::type {}; - - public: - EIGEN_PRODUCT_PUBLIC_INTERFACE(GeneralProduct) - - GeneralProduct(const Lhs& lhs, const Rhs& rhs) : Base(lhs,rhs) - { - EIGEN_STATIC_ASSERT((internal::is_same::value), - YOU_MIXED_DIFFERENT_NUMERIC_TYPES__YOU_NEED_TO_USE_THE_CAST_METHOD_OF_MATRIXBASE_TO_CAST_NUMERIC_TYPES_EXPLICITLY) - } - - struct set { template void operator()(const Dst& dst, const Src& src) const { dst.const_cast_derived() = src; } }; - struct add { template void operator()(const Dst& dst, const Src& src) const { dst.const_cast_derived() += src; } }; - struct sub { template void operator()(const Dst& dst, const Src& src) const { dst.const_cast_derived() -= src; } }; - struct adds { - Scalar m_scale; - adds(const Scalar& s) : m_scale(s) {} - template void operator()(const Dst& dst, const Src& src) const { - dst.const_cast_derived() += m_scale * src; - } - }; - - template - inline void evalTo(Dest& dest) const { - internal::outer_product_selector_run(*this, dest, set(), is_row_major()); - } - - template - inline void addTo(Dest& dest) const { - internal::outer_product_selector_run(*this, dest, add(), is_row_major()); - } - - template - inline void subTo(Dest& dest) const { - internal::outer_product_selector_run(*this, dest, sub(), is_row_major()); - } - - template void scaleAndAddTo(Dest& dest, const Scalar& alpha) const - { - internal::outer_product_selector_run(*this, dest, adds(alpha), is_row_major()); - } -}; - /*********************************************************************** * Implementation of General Matrix Vector Product ***********************************************************************/ @@ -313,197 +151,183 @@ class GeneralProduct */ namespace internal { -template -struct traits > - : traits, Lhs, Rhs> > -{}; - template -struct gemv_selector; +struct gemv_dense_selector; } // end namespace internal -template -class GeneralProduct - : public ProductBase, Lhs, Rhs> -{ - public: - EIGEN_PRODUCT_PUBLIC_INTERFACE(GeneralProduct) - - typedef typename Lhs::Scalar LhsScalar; - typedef typename Rhs::Scalar RhsScalar; - - GeneralProduct(const Lhs& a_lhs, const Rhs& a_rhs) : Base(a_lhs,a_rhs) - { -// EIGEN_STATIC_ASSERT((internal::is_same::value), -// YOU_MIXED_DIFFERENT_NUMERIC_TYPES__YOU_NEED_TO_USE_THE_CAST_METHOD_OF_MATRIXBASE_TO_CAST_NUMERIC_TYPES_EXPLICITLY) - } - - enum { Side = Lhs::IsVectorAtCompileTime ? OnTheLeft : OnTheRight }; - typedef typename internal::conditional::type MatrixType; - - template void scaleAndAddTo(Dest& dst, const Scalar& alpha) const - { - eigen_assert(m_lhs.rows() == dst.rows() && m_rhs.cols() == dst.cols()); - internal::gemv_selector::HasUsableDirectAccess)>::run(*this, dst, alpha); - } -}; - namespace internal { -// The vector is on the left => transposition -template -struct gemv_selector -{ - template - static void run(const ProductType& prod, Dest& dest, const typename ProductType::Scalar& alpha) - { - Transpose destT(dest); - enum { OtherStorageOrder = StorageOrder == RowMajor ? ColMajor : RowMajor }; - gemv_selector - ::run(GeneralProduct,Transpose, GemvProduct> - (prod.rhs().transpose(), prod.lhs().transpose()), destT, alpha); - } -}; - template struct gemv_static_vector_if; template struct gemv_static_vector_if { - EIGEN_STRONG_INLINE Scalar* data() { eigen_internal_assert(false && "should never be called"); return 0; } + EIGEN_STRONG_INLINE EIGEN_DEVICE_FUNC Scalar* data() { eigen_internal_assert(false && "should never be called"); return 0; } }; template struct gemv_static_vector_if { - EIGEN_STRONG_INLINE Scalar* data() { return 0; } + EIGEN_STRONG_INLINE EIGEN_DEVICE_FUNC Scalar* data() { return 0; } }; template struct gemv_static_vector_if { - #if EIGEN_ALIGN_STATICALLY - internal::plain_array m_data; - EIGEN_STRONG_INLINE Scalar* data() { return m_data.array; } - #else - // Some architectures cannot align on the stack, - // => let's manually enforce alignment by allocating more data and return the address of the first aligned element. enum { ForceAlignment = internal::packet_traits::Vectorizable, PacketSize = internal::packet_traits::size }; - internal::plain_array m_data; + #if EIGEN_MAX_STATIC_ALIGN_BYTES!=0 + internal::plain_array m_data; + EIGEN_STRONG_INLINE Scalar* data() { return m_data.array; } + #else + // Some architectures cannot align on the stack, + // => let's manually enforce alignment by allocating more data and return the address of the first aligned element. + internal::plain_array m_data; EIGEN_STRONG_INLINE Scalar* data() { return ForceAlignment - ? reinterpret_cast((reinterpret_cast(m_data.array) & ~(size_t(15))) + 16) + ? reinterpret_cast((internal::UIntPtr(m_data.array) & ~(std::size_t(EIGEN_MAX_ALIGN_BYTES-1))) + EIGEN_MAX_ALIGN_BYTES) : m_data.array; } #endif }; -template<> struct gemv_selector +// The vector is on the left => transposition +template +struct gemv_dense_selector { - template - static inline void run(const ProductType& prod, Dest& dest, const typename ProductType::Scalar& alpha) + template + static void run(const Lhs &lhs, const Rhs &rhs, Dest& dest, const typename Dest::Scalar& alpha) { - typedef typename ProductType::Index Index; - typedef typename ProductType::LhsScalar LhsScalar; - typedef typename ProductType::RhsScalar RhsScalar; - typedef typename ProductType::Scalar ResScalar; - typedef typename ProductType::RealScalar RealScalar; - typedef typename ProductType::ActualLhsType ActualLhsType; - typedef typename ProductType::ActualRhsType ActualRhsType; - typedef typename ProductType::LhsBlasTraits LhsBlasTraits; - typedef typename ProductType::RhsBlasTraits RhsBlasTraits; - typedef Map, Aligned> MappedDest; - - ActualLhsType actualLhs = LhsBlasTraits::extract(prod.lhs()); - ActualRhsType actualRhs = RhsBlasTraits::extract(prod.rhs()); - - ResScalar actualAlpha = alpha * LhsBlasTraits::extractScalarFactor(prod.lhs()) - * RhsBlasTraits::extractScalarFactor(prod.rhs()); + Transpose destT(dest); + enum { OtherStorageOrder = StorageOrder == RowMajor ? ColMajor : RowMajor }; + gemv_dense_selector + ::run(rhs.transpose(), lhs.transpose(), destT, alpha); + } +}; + +template<> struct gemv_dense_selector +{ + template + static inline void run(const Lhs &lhs, const Rhs &rhs, Dest& dest, const typename Dest::Scalar& alpha) + { + typedef typename Lhs::Scalar LhsScalar; + typedef typename Rhs::Scalar RhsScalar; + typedef typename Dest::Scalar ResScalar; + typedef typename Dest::RealScalar RealScalar; + + typedef internal::blas_traits LhsBlasTraits; + typedef typename LhsBlasTraits::DirectLinearAccessType ActualLhsType; + typedef internal::blas_traits RhsBlasTraits; + typedef typename RhsBlasTraits::DirectLinearAccessType ActualRhsType; + + typedef Map, EIGEN_PLAIN_ENUM_MIN(AlignedMax,internal::packet_traits::size)> MappedDest; + + ActualLhsType actualLhs = LhsBlasTraits::extract(lhs); + ActualRhsType actualRhs = RhsBlasTraits::extract(rhs); + + ResScalar actualAlpha = combine_scalar_factors(alpha, lhs, rhs); + + // make sure Dest is a compile-time vector type (bug 1166) + typedef typename conditional::type ActualDest; enum { // FIXME find a way to allow an inner stride on the result if packet_traits::size==1 // on, the other hand it is good for the cache to pack the vector anyways... - EvalToDestAtCompileTime = Dest::InnerStrideAtCompileTime==1, + EvalToDestAtCompileTime = (ActualDest::InnerStrideAtCompileTime==1), ComplexByReal = (NumTraits::IsComplex) && (!NumTraits::IsComplex), - MightCannotUseDest = (Dest::InnerStrideAtCompileTime!=1) || ComplexByReal + MightCannotUseDest = ((!EvalToDestAtCompileTime) || ComplexByReal) && (ActualDest::MaxSizeAtCompileTime!=0) }; - gemv_static_vector_if static_dest; - - bool alphaIsCompatible = (!ComplexByReal) || (numext::imag(actualAlpha)==RealScalar(0)); - bool evalToDest = EvalToDestAtCompileTime && alphaIsCompatible; - + typedef const_blas_data_mapper LhsMapper; + typedef const_blas_data_mapper RhsMapper; RhsScalar compatibleAlpha = get_factor::run(actualAlpha); - ei_declare_aligned_stack_constructed_variable(ResScalar,actualDestPtr,dest.size(), - evalToDest ? dest.data() : static_dest.data()); - - if(!evalToDest) + if(!MightCannotUseDest) { - #ifdef EIGEN_DENSE_STORAGE_CTOR_PLUGIN - int size = dest.size(); - EIGEN_DENSE_STORAGE_CTOR_PLUGIN - #endif - if(!alphaIsCompatible) + // shortcut if we are sure to be able to use dest directly, + // this ease the compiler to generate cleaner and more optimzized code for most common cases + general_matrix_vector_product + ::run( + actualLhs.rows(), actualLhs.cols(), + LhsMapper(actualLhs.data(), actualLhs.outerStride()), + RhsMapper(actualRhs.data(), actualRhs.innerStride()), + dest.data(), 1, + compatibleAlpha); + } + else + { + gemv_static_vector_if static_dest; + + const bool alphaIsCompatible = (!ComplexByReal) || (numext::imag(actualAlpha)==RealScalar(0)); + const bool evalToDest = EvalToDestAtCompileTime && alphaIsCompatible; + + ei_declare_aligned_stack_constructed_variable(ResScalar,actualDestPtr,dest.size(), + evalToDest ? dest.data() : static_dest.data()); + + if(!evalToDest) { - MappedDest(actualDestPtr, dest.size()).setZero(); - compatibleAlpha = RhsScalar(1); + #ifdef EIGEN_DENSE_STORAGE_CTOR_PLUGIN + Index size = dest.size(); + EIGEN_DENSE_STORAGE_CTOR_PLUGIN + #endif + if(!alphaIsCompatible) + { + MappedDest(actualDestPtr, dest.size()).setZero(); + compatibleAlpha = RhsScalar(1); + } + else + MappedDest(actualDestPtr, dest.size()) = dest; } - else - MappedDest(actualDestPtr, dest.size()) = dest; - } - general_matrix_vector_product - ::run( - actualLhs.rows(), actualLhs.cols(), - actualLhs.data(), actualLhs.outerStride(), - actualRhs.data(), actualRhs.innerStride(), - actualDestPtr, 1, - compatibleAlpha); + general_matrix_vector_product + ::run( + actualLhs.rows(), actualLhs.cols(), + LhsMapper(actualLhs.data(), actualLhs.outerStride()), + RhsMapper(actualRhs.data(), actualRhs.innerStride()), + actualDestPtr, 1, + compatibleAlpha); - if (!evalToDest) - { - if(!alphaIsCompatible) - dest += actualAlpha * MappedDest(actualDestPtr, dest.size()); - else - dest = MappedDest(actualDestPtr, dest.size()); + if (!evalToDest) + { + if(!alphaIsCompatible) + dest.matrix() += actualAlpha * MappedDest(actualDestPtr, dest.size()); + else + dest = MappedDest(actualDestPtr, dest.size()); + } } } }; -template<> struct gemv_selector +template<> struct gemv_dense_selector { - template - static void run(const ProductType& prod, Dest& dest, const typename ProductType::Scalar& alpha) + template + static void run(const Lhs &lhs, const Rhs &rhs, Dest& dest, const typename Dest::Scalar& alpha) { - typedef typename ProductType::LhsScalar LhsScalar; - typedef typename ProductType::RhsScalar RhsScalar; - typedef typename ProductType::Scalar ResScalar; - typedef typename ProductType::Index Index; - typedef typename ProductType::ActualLhsType ActualLhsType; - typedef typename ProductType::ActualRhsType ActualRhsType; - typedef typename ProductType::_ActualRhsType _ActualRhsType; - typedef typename ProductType::LhsBlasTraits LhsBlasTraits; - typedef typename ProductType::RhsBlasTraits RhsBlasTraits; - - typename add_const::type actualLhs = LhsBlasTraits::extract(prod.lhs()); - typename add_const::type actualRhs = RhsBlasTraits::extract(prod.rhs()); - - ResScalar actualAlpha = alpha * LhsBlasTraits::extractScalarFactor(prod.lhs()) - * RhsBlasTraits::extractScalarFactor(prod.rhs()); + typedef typename Lhs::Scalar LhsScalar; + typedef typename Rhs::Scalar RhsScalar; + typedef typename Dest::Scalar ResScalar; + + typedef internal::blas_traits LhsBlasTraits; + typedef typename LhsBlasTraits::DirectLinearAccessType ActualLhsType; + typedef internal::blas_traits RhsBlasTraits; + typedef typename RhsBlasTraits::DirectLinearAccessType ActualRhsType; + typedef typename internal::remove_all::type ActualRhsTypeCleaned; + + typename add_const::type actualLhs = LhsBlasTraits::extract(lhs); + typename add_const::type actualRhs = RhsBlasTraits::extract(rhs); + + ResScalar actualAlpha = combine_scalar_factors(alpha, lhs, rhs); enum { // FIXME find a way to allow an inner stride on the result if packet_traits::size==1 // on, the other hand it is good for the cache to pack the vector anyways... - DirectlyUseRhs = _ActualRhsType::InnerStrideAtCompileTime==1 + DirectlyUseRhs = ActualRhsTypeCleaned::InnerStrideAtCompileTime==1 || ActualRhsTypeCleaned::MaxSizeAtCompileTime==0 }; - gemv_static_vector_if static_rhs; + gemv_static_vector_if static_rhs; ei_declare_aligned_stack_constructed_variable(RhsScalar,actualRhsPtr,actualRhs.size(), DirectlyUseRhs ? const_cast(actualRhs.data()) : static_rhs.data()); @@ -511,45 +335,48 @@ template<> struct gemv_selector if(!DirectlyUseRhs) { #ifdef EIGEN_DENSE_STORAGE_CTOR_PLUGIN - int size = actualRhs.size(); + Index size = actualRhs.size(); EIGEN_DENSE_STORAGE_CTOR_PLUGIN #endif - Map(actualRhsPtr, actualRhs.size()) = actualRhs; + Map(actualRhsPtr, actualRhs.size()) = actualRhs; } + typedef const_blas_data_mapper LhsMapper; + typedef const_blas_data_mapper RhsMapper; general_matrix_vector_product - ::run( + ::run( actualLhs.rows(), actualLhs.cols(), - actualLhs.data(), actualLhs.outerStride(), - actualRhsPtr, 1, - dest.data(), dest.innerStride(), + LhsMapper(actualLhs.data(), actualLhs.outerStride()), + RhsMapper(actualRhsPtr, 1), + dest.data(), dest.col(0).innerStride(), //NOTE if dest is not a vector at compile-time, then dest.innerStride() might be wrong. (bug 1166) actualAlpha); } }; -template<> struct gemv_selector +template<> struct gemv_dense_selector { - template - static void run(const ProductType& prod, Dest& dest, const typename ProductType::Scalar& alpha) + template + static void run(const Lhs &lhs, const Rhs &rhs, Dest& dest, const typename Dest::Scalar& alpha) { - typedef typename Dest::Index Index; - // TODO makes sure dest is sequentially stored in memory, otherwise use a temp - const Index size = prod.rhs().rows(); + EIGEN_STATIC_ASSERT((!nested_eval::Evaluate),EIGEN_INTERNAL_COMPILATION_ERROR_OR_YOU_MADE_A_PROGRAMMING_MISTAKE); + // TODO if rhs is large enough it might be beneficial to make sure that dest is sequentially stored in memory, otherwise use a temp + typename nested_eval::type actual_rhs(rhs); + const Index size = rhs.rows(); for(Index k=0; k struct gemv_selector +template<> struct gemv_dense_selector { - template - static void run(const ProductType& prod, Dest& dest, const typename ProductType::Scalar& alpha) + template + static void run(const Lhs &lhs, const Rhs &rhs, Dest& dest, const typename Dest::Scalar& alpha) { - typedef typename Dest::Index Index; - // TODO makes sure rhs is sequentially stored in memory, otherwise use a temp - const Index rows = prod.rows(); + EIGEN_STATIC_ASSERT((!nested_eval::Evaluate),EIGEN_INTERNAL_COMPILATION_ERROR_OR_YOU_MADE_A_PROGRAMMING_MISTAKE); + typename nested_eval::type actual_rhs(rhs); + const Index rows = dest.rows(); for(Index i=0; i struct gemv_selector */ template template -inline const typename ProductReturnType::Type +EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE +const Product MatrixBase::operator*(const MatrixBase &other) const { // A note regarding the function declaration: In MSVC, this function will sometimes @@ -592,7 +420,8 @@ MatrixBase::operator*(const MatrixBase &other) const #ifdef EIGEN_DEBUG_PRODUCT internal::product_type::debug(); #endif - return typename ProductReturnType::Type(derived(), other.derived()); + + return Product(derived(), other.derived()); } /** \returns an expression of the matrix product of \c *this and \a other without implicit evaluation. @@ -608,7 +437,8 @@ MatrixBase::operator*(const MatrixBase &other) const */ template template -const typename LazyProductReturnType::Type +EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE +const Product MatrixBase::lazyProduct(const MatrixBase &other) const { enum { @@ -627,7 +457,7 @@ MatrixBase::lazyProduct(const MatrixBase &other) const INVALID_MATRIX_PRODUCT__IF_YOU_WANTED_A_COEFF_WISE_PRODUCT_YOU_MUST_USE_THE_EXPLICIT_FUNCTION) EIGEN_STATIC_ASSERT(ProductIsValid || SameSizes, INVALID_MATRIX_PRODUCT) - return typename LazyProductReturnType::Type(derived(), other.derived()); + return Product(derived(), other.derived()); } } // end namespace Eigen diff --git a/extern/eigen/Eigen/src/Core/GenericPacketMath.h b/extern/eigen/Eigen/src/Core/GenericPacketMath.h index 5f783ebe..cf677a19 100644 --- a/extern/eigen/Eigen/src/Core/GenericPacketMath.h +++ b/extern/eigen/Eigen/src/Core/GenericPacketMath.h @@ -42,21 +42,34 @@ namespace internal { struct default_packet_traits { enum { - HasAdd = 1, - HasSub = 1, - HasMul = 1, - HasNegate = 1, - HasAbs = 1, - HasAbs2 = 1, - HasMin = 1, - HasMax = 1, - HasConj = 1, + HasHalfPacket = 0, + + HasAdd = 1, + HasSub = 1, + HasShift = 1, + HasMul = 1, + HasNegate = 1, + HasAbs = 1, + HasArg = 0, + HasAbs2 = 1, + HasAbsDiff = 0, + HasMin = 1, + HasMax = 1, + HasConj = 1, HasSetLinear = 1, + HasBlend = 0, + // This flag is used to indicate whether packet comparison is supported. + // pcmp_eq, pcmp_lt and pcmp_le should be defined for it to be true. + HasCmp = 0, HasDiv = 0, HasSqrt = 0, + HasRsqrt = 0, HasExp = 0, + HasExpm1 = 0, HasLog = 0, + HasLog1p = 0, + HasLog10 = 0, HasPow = 0, HasSin = 0, @@ -64,17 +77,41 @@ struct default_packet_traits HasTan = 0, HasASin = 0, HasACos = 0, - HasATan = 0 + HasATan = 0, + HasSinh = 0, + HasCosh = 0, + HasTanh = 0, + HasLGamma = 0, + HasDiGamma = 0, + HasZeta = 0, + HasPolygamma = 0, + HasErf = 0, + HasErfc = 0, + HasNdtri = 0, + HasBessel = 0, + HasIGamma = 0, + HasIGammaDerA = 0, + HasGammaSampleDerAlpha = 0, + HasIGammac = 0, + HasBetaInc = 0, + + HasRound = 0, + HasRint = 0, + HasFloor = 0, + HasCeil = 0, + HasSign = 0 }; }; template struct packet_traits : default_packet_traits { typedef T type; + typedef T half; enum { Vectorizable = 0, size = 1, - AlignedOnScalar = 0 + AlignedOnScalar = 0, + HasHalfPacket = 0 }; enum { HasAdd = 0, @@ -90,140 +127,620 @@ template struct packet_traits : default_packet_traits }; }; +template struct packet_traits : packet_traits { }; + +template struct unpacket_traits +{ + typedef T type; + typedef T half; + enum + { + size = 1, + alignment = 1, + vectorizable = false, + masked_load_available=false, + masked_store_available=false + }; +}; + +template struct unpacket_traits : unpacket_traits { }; + +template struct type_casting_traits { + enum { + VectorizedCast = 0, + SrcCoeffRatio = 1, + TgtCoeffRatio = 1 + }; +}; + +/** \internal Wrapper to ensure that multiple packet types can map to the same + same underlying vector type. */ +template +struct eigen_packet_wrapper +{ + EIGEN_ALWAYS_INLINE operator T&() { return m_val; } + EIGEN_ALWAYS_INLINE operator const T&() const { return m_val; } + EIGEN_ALWAYS_INLINE eigen_packet_wrapper() {} + EIGEN_ALWAYS_INLINE eigen_packet_wrapper(const T &v) : m_val(v) {} + EIGEN_ALWAYS_INLINE eigen_packet_wrapper& operator=(const T &v) { + m_val = v; + return *this; + } + + T m_val; +}; + + +/** \internal A convenience utility for determining if the type is a scalar. + * This is used to enable some generic packet implementations. + */ +template +struct is_scalar { + typedef typename unpacket_traits::type Scalar; + enum { + value = internal::is_same::value + }; +}; + +/** \internal \returns static_cast(a) (coeff-wise) */ +template +EIGEN_DEVICE_FUNC inline TgtPacket +pcast(const SrcPacket& a) { + return static_cast(a); +} +template +EIGEN_DEVICE_FUNC inline TgtPacket +pcast(const SrcPacket& a, const SrcPacket& /*b*/) { + return static_cast(a); +} +template +EIGEN_DEVICE_FUNC inline TgtPacket +pcast(const SrcPacket& a, const SrcPacket& /*b*/, const SrcPacket& /*c*/, const SrcPacket& /*d*/) { + return static_cast(a); +} +template +EIGEN_DEVICE_FUNC inline TgtPacket +pcast(const SrcPacket& a, const SrcPacket& /*b*/, const SrcPacket& /*c*/, const SrcPacket& /*d*/, + const SrcPacket& /*e*/, const SrcPacket& /*f*/, const SrcPacket& /*g*/, const SrcPacket& /*h*/) { + return static_cast(a); +} + +/** \internal \returns reinterpret_cast(a) */ +template +EIGEN_DEVICE_FUNC inline Target +preinterpret(const Packet& a); /* { return reinterpret_cast(a); } */ + /** \internal \returns a + b (coeff-wise) */ -template inline Packet -padd(const Packet& a, - const Packet& b) { return a+b; } +template EIGEN_DEVICE_FUNC inline Packet +padd(const Packet& a, const Packet& b) { return a+b; } +// Avoid compiler warning for boolean algebra. +template<> EIGEN_DEVICE_FUNC inline bool +padd(const bool& a, const bool& b) { return a || b; } /** \internal \returns a - b (coeff-wise) */ -template inline Packet -psub(const Packet& a, - const Packet& b) { return a-b; } +template EIGEN_DEVICE_FUNC inline Packet +psub(const Packet& a, const Packet& b) { return a-b; } /** \internal \returns -a (coeff-wise) */ -template inline Packet +template EIGEN_DEVICE_FUNC inline Packet pnegate(const Packet& a) { return -a; } +template<> EIGEN_DEVICE_FUNC inline bool +pnegate(const bool& a) { return !a; } + /** \internal \returns conj(a) (coeff-wise) */ -template inline Packet +template EIGEN_DEVICE_FUNC inline Packet pconj(const Packet& a) { return numext::conj(a); } /** \internal \returns a * b (coeff-wise) */ -template inline Packet -pmul(const Packet& a, - const Packet& b) { return a*b; } +template EIGEN_DEVICE_FUNC inline Packet +pmul(const Packet& a, const Packet& b) { return a*b; } +// Avoid compiler warning for boolean algebra. +template<> EIGEN_DEVICE_FUNC inline bool +pmul(const bool& a, const bool& b) { return a && b; } /** \internal \returns a / b (coeff-wise) */ -template inline Packet -pdiv(const Packet& a, - const Packet& b) { return a/b; } +template EIGEN_DEVICE_FUNC inline Packet +pdiv(const Packet& a, const Packet& b) { return a/b; } + +// In the generic case, memset to all one bits. +template +struct ptrue_impl { + static EIGEN_DEVICE_FUNC inline Packet run(const Packet& /*a*/){ + Packet b; + memset(static_cast(&b), 0xff, sizeof(Packet)); + return b; + } +}; -/** \internal \returns the min of \a a and \a b (coeff-wise) */ -template inline Packet -pmin(const Packet& a, - const Packet& b) { using std::min; return (min)(a, b); } +// For non-trivial scalars, set to Scalar(1) (i.e. a non-zero value). +// Although this is technically not a valid bitmask, the scalar path for pselect +// uses a comparison to zero, so this should still work in most cases. We don't +// have another option, since the scalar type requires initialization. +template +struct ptrue_impl::value && NumTraits::RequireInitialization>::type > { + static EIGEN_DEVICE_FUNC inline T run(const T& /*a*/){ + return T(1); + } +}; -/** \internal \returns the max of \a a and \a b (coeff-wise) */ -template inline Packet -pmax(const Packet& a, - const Packet& b) { using std::max; return (max)(a, b); } +/** \internal \returns one bits. */ +template EIGEN_DEVICE_FUNC inline Packet +ptrue(const Packet& a) { + return ptrue_impl::run(a); +} -/** \internal \returns the absolute value of \a a */ -template inline Packet -pabs(const Packet& a) { using std::abs; return abs(a); } +// In the general case, memset to zero. +template +struct pzero_impl { + static EIGEN_DEVICE_FUNC inline Packet run(const Packet& /*a*/) { + Packet b; + memset(static_cast(&b), 0x00, sizeof(Packet)); + return b; + } +}; + +// For scalars, explicitly set to Scalar(0), since the underlying representation +// for zero may not consist of all-zero bits. +template +struct pzero_impl::value>::type> { + static EIGEN_DEVICE_FUNC inline T run(const T& /*a*/) { + return T(0); + } +}; + +/** \internal \returns packet of zeros */ +template EIGEN_DEVICE_FUNC inline Packet +pzero(const Packet& a) { + return pzero_impl::run(a); +} + +/** \internal \returns a <= b as a bit mask */ +template EIGEN_DEVICE_FUNC inline Packet +pcmp_le(const Packet& a, const Packet& b) { return a<=b ? ptrue(a) : pzero(a); } + +/** \internal \returns a < b as a bit mask */ +template EIGEN_DEVICE_FUNC inline Packet +pcmp_lt(const Packet& a, const Packet& b) { return a EIGEN_DEVICE_FUNC inline Packet +pcmp_eq(const Packet& a, const Packet& b) { return a==b ? ptrue(a) : pzero(a); } + +/** \internal \returns a < b or a==NaN or b==NaN as a bit mask */ +template EIGEN_DEVICE_FUNC inline Packet +pcmp_lt_or_nan(const Packet& a, const Packet& b) { return a>=b ? pzero(a) : ptrue(a); } + +template +struct bit_and { + EIGEN_DEVICE_FUNC EIGEN_CONSTEXPR EIGEN_ALWAYS_INLINE T operator()(const T& a, const T& b) const { + return a & b; + } +}; + +template +struct bit_or { + EIGEN_DEVICE_FUNC EIGEN_CONSTEXPR EIGEN_ALWAYS_INLINE T operator()(const T& a, const T& b) const { + return a | b; + } +}; + +template +struct bit_xor { + EIGEN_DEVICE_FUNC EIGEN_CONSTEXPR EIGEN_ALWAYS_INLINE T operator()(const T& a, const T& b) const { + return a ^ b; + } +}; + +template +struct bit_not { + EIGEN_DEVICE_FUNC EIGEN_CONSTEXPR EIGEN_ALWAYS_INLINE T operator()(const T& a) const { + return ~a; + } +}; + +// Use operators &, |, ^, ~. +template +struct operator_bitwise_helper { + EIGEN_DEVICE_FUNC static inline T bitwise_and(const T& a, const T& b) { return bit_and()(a, b); } + EIGEN_DEVICE_FUNC static inline T bitwise_or(const T& a, const T& b) { return bit_or()(a, b); } + EIGEN_DEVICE_FUNC static inline T bitwise_xor(const T& a, const T& b) { return bit_xor()(a, b); } + EIGEN_DEVICE_FUNC static inline T bitwise_not(const T& a) { return bit_not()(a); } +}; + +// Apply binary operations byte-by-byte +template +struct bytewise_bitwise_helper { + EIGEN_DEVICE_FUNC static inline T bitwise_and(const T& a, const T& b) { + return binary(a, b, bit_and()); + } + EIGEN_DEVICE_FUNC static inline T bitwise_or(const T& a, const T& b) { + return binary(a, b, bit_or()); + } + EIGEN_DEVICE_FUNC static inline T bitwise_xor(const T& a, const T& b) { + return binary(a, b, bit_xor()); + } + EIGEN_DEVICE_FUNC static inline T bitwise_not(const T& a) { + return unary(a,bit_not()); + } + + private: + template + EIGEN_DEVICE_FUNC static inline T unary(const T& a, Op op) { + const unsigned char* a_ptr = reinterpret_cast(&a); + T c; + unsigned char* c_ptr = reinterpret_cast(&c); + for (size_t i = 0; i < sizeof(T); ++i) { + *c_ptr++ = op(*a_ptr++); + } + return c; + } + + template + EIGEN_DEVICE_FUNC static inline T binary(const T& a, const T& b, Op op) { + const unsigned char* a_ptr = reinterpret_cast(&a); + const unsigned char* b_ptr = reinterpret_cast(&b); + T c; + unsigned char* c_ptr = reinterpret_cast(&c); + for (size_t i = 0; i < sizeof(T); ++i) { + *c_ptr++ = op(*a_ptr++, *b_ptr++); + } + return c; + } +}; + +// In the general case, use byte-by-byte manipulation. +template +struct bitwise_helper : public bytewise_bitwise_helper {}; + +// For integers or non-trivial scalars, use binary operators. +template +struct bitwise_helper::value && (NumTraits::IsInteger || NumTraits::RequireInitialization)>::type + > : public operator_bitwise_helper {}; /** \internal \returns the bitwise and of \a a and \a b */ -template inline Packet -pand(const Packet& a, const Packet& b) { return a & b; } +template EIGEN_DEVICE_FUNC inline Packet +pand(const Packet& a, const Packet& b) { + return bitwise_helper::bitwise_and(a, b); +} /** \internal \returns the bitwise or of \a a and \a b */ -template inline Packet -por(const Packet& a, const Packet& b) { return a | b; } +template EIGEN_DEVICE_FUNC inline Packet +por(const Packet& a, const Packet& b) { + return bitwise_helper::bitwise_or(a, b); +} /** \internal \returns the bitwise xor of \a a and \a b */ -template inline Packet -pxor(const Packet& a, const Packet& b) { return a ^ b; } +template EIGEN_DEVICE_FUNC inline Packet +pxor(const Packet& a, const Packet& b) { + return bitwise_helper::bitwise_xor(a, b); +} + +/** \internal \returns the bitwise not of \a a */ +template EIGEN_DEVICE_FUNC inline Packet +pnot(const Packet& a) { + return bitwise_helper::bitwise_not(a); +} + +/** \internal \returns the bitwise and of \a a and not \a b */ +template EIGEN_DEVICE_FUNC inline Packet +pandnot(const Packet& a, const Packet& b) { return pand(a, pnot(b)); } + +// In the general case, use bitwise select. +template +struct pselect_impl { + static EIGEN_DEVICE_FUNC inline Packet run(const Packet& mask, const Packet& a, const Packet& b) { + return por(pand(a,mask),pandnot(b,mask)); + } +}; + +// For scalars, use ternary select. +template +struct pselect_impl::value>::type > { + static EIGEN_DEVICE_FUNC inline Packet run(const Packet& mask, const Packet& a, const Packet& b) { + return numext::equal_strict(mask, Packet(0)) ? b : a; + } +}; + +/** \internal \returns \a or \b for each field in packet according to \mask */ +template EIGEN_DEVICE_FUNC inline Packet +pselect(const Packet& mask, const Packet& a, const Packet& b) { + return pselect_impl::run(mask, a, b); +} + +template<> EIGEN_DEVICE_FUNC inline bool pselect( + const bool& cond, const bool& a, const bool& b) { + return cond ? a : b; +} + +/** \internal \returns the min or of \a a and \a b (coeff-wise) + If either \a a or \a b are NaN, the result is implementation defined. */ +template +struct pminmax_impl { + template + static EIGEN_DEVICE_FUNC inline Packet run(const Packet& a, const Packet& b, Op op) { + return op(a,b); + } +}; + +/** \internal \returns the min or max of \a a and \a b (coeff-wise) + If either \a a or \a b are NaN, NaN is returned. */ +template<> +struct pminmax_impl { + template + static EIGEN_DEVICE_FUNC inline Packet run(const Packet& a, const Packet& b, Op op) { + Packet not_nan_mask_a = pcmp_eq(a, a); + Packet not_nan_mask_b = pcmp_eq(b, b); + return pselect(not_nan_mask_a, + pselect(not_nan_mask_b, op(a, b), b), + a); + } +}; -/** \internal \returns the bitwise andnot of \a a and \a b */ -template inline Packet -pandnot(const Packet& a, const Packet& b) { return a & (!b); } +/** \internal \returns the min or max of \a a and \a b (coeff-wise) + If both \a a and \a b are NaN, NaN is returned. + Equivalent to std::fmin(a, b). */ +template<> +struct pminmax_impl { + template + static EIGEN_DEVICE_FUNC inline Packet run(const Packet& a, const Packet& b, Op op) { + Packet not_nan_mask_a = pcmp_eq(a, a); + Packet not_nan_mask_b = pcmp_eq(b, b); + return pselect(not_nan_mask_a, + pselect(not_nan_mask_b, op(a, b), a), + b); + } +}; + + +#ifndef SYCL_DEVICE_ONLY +#define EIGEN_BINARY_OP_NAN_PROPAGATION(Type, Func) Func +#else +#define EIGEN_BINARY_OP_NAN_PROPAGATION(Type, Func) \ +[](const Type& a, const Type& b) { \ + return Func(a, b);} +#endif + +/** \internal \returns the min of \a a and \a b (coeff-wise). + If \a a or \b b is NaN, the return value is implementation defined. */ +template EIGEN_DEVICE_FUNC inline Packet +pmin(const Packet& a, const Packet& b) { return numext::mini(a,b); } + +/** \internal \returns the min of \a a and \a b (coeff-wise). + NaNPropagation determines the NaN propagation semantics. */ +template +EIGEN_DEVICE_FUNC inline Packet pmin(const Packet& a, const Packet& b) { + return pminmax_impl::run(a, b, EIGEN_BINARY_OP_NAN_PROPAGATION(Packet, (pmin))); +} + +/** \internal \returns the max of \a a and \a b (coeff-wise) + If \a a or \b b is NaN, the return value is implementation defined. */ +template EIGEN_DEVICE_FUNC inline Packet +pmax(const Packet& a, const Packet& b) { return numext::maxi(a, b); } + +/** \internal \returns the max of \a a and \a b (coeff-wise). + NaNPropagation determines the NaN propagation semantics. */ +template +EIGEN_DEVICE_FUNC inline Packet pmax(const Packet& a, const Packet& b) { + return pminmax_impl::run(a, b, EIGEN_BINARY_OP_NAN_PROPAGATION(Packet,(pmax))); +} + +/** \internal \returns the absolute value of \a a */ +template EIGEN_DEVICE_FUNC inline Packet +pabs(const Packet& a) { return numext::abs(a); } +template<> EIGEN_DEVICE_FUNC inline unsigned int +pabs(const unsigned int& a) { return a; } +template<> EIGEN_DEVICE_FUNC inline unsigned long +pabs(const unsigned long& a) { return a; } +template<> EIGEN_DEVICE_FUNC inline unsigned long long +pabs(const unsigned long long& a) { return a; } + +/** \internal \returns the addsub value of \a a,b */ +template EIGEN_DEVICE_FUNC inline Packet +paddsub(const Packet& a, const Packet& b) { + return pselect(peven_mask(a), padd(a, b), psub(a, b)); + } + +/** \internal \returns the phase angle of \a a */ +template EIGEN_DEVICE_FUNC inline Packet +parg(const Packet& a) { using numext::arg; return arg(a); } + + +/** \internal \returns \a a logically shifted by N bits to the right */ +template EIGEN_DEVICE_FUNC inline int +parithmetic_shift_right(const int& a) { return a >> N; } +template EIGEN_DEVICE_FUNC inline long int +parithmetic_shift_right(const long int& a) { return a >> N; } + +/** \internal \returns \a a arithmetically shifted by N bits to the right */ +template EIGEN_DEVICE_FUNC inline int +plogical_shift_right(const int& a) { return static_cast(static_cast(a) >> N); } +template EIGEN_DEVICE_FUNC inline long int +plogical_shift_right(const long int& a) { return static_cast(static_cast(a) >> N); } + +/** \internal \returns \a a shifted by N bits to the left */ +template EIGEN_DEVICE_FUNC inline int +plogical_shift_left(const int& a) { return a << N; } +template EIGEN_DEVICE_FUNC inline long int +plogical_shift_left(const long int& a) { return a << N; } + +/** \internal \returns the significant and exponent of the underlying floating point numbers + * See https://en.cppreference.com/w/cpp/numeric/math/frexp + */ +template +EIGEN_DEVICE_FUNC inline Packet pfrexp(const Packet& a, Packet& exponent) { + int exp; + EIGEN_USING_STD(frexp); + Packet result = static_cast(frexp(a, &exp)); + exponent = static_cast(exp); + return result; +} + +/** \internal \returns a * 2^((int)exponent) + * See https://en.cppreference.com/w/cpp/numeric/math/ldexp + */ +template EIGEN_DEVICE_FUNC inline Packet +pldexp(const Packet &a, const Packet &exponent) { + EIGEN_USING_STD(ldexp) + return static_cast(ldexp(a, static_cast(exponent))); +} + +/** \internal \returns the min of \a a and \a b (coeff-wise) */ +template EIGEN_DEVICE_FUNC inline Packet +pabsdiff(const Packet& a, const Packet& b) { return pselect(pcmp_lt(a, b), psub(b, a), psub(a, b)); } /** \internal \returns a packet version of \a *from, from must be 16 bytes aligned */ -template inline Packet +template EIGEN_DEVICE_FUNC inline Packet pload(const typename unpacket_traits::type* from) { return *from; } /** \internal \returns a packet version of \a *from, (un-aligned load) */ -template inline Packet +template EIGEN_DEVICE_FUNC inline Packet ploadu(const typename unpacket_traits::type* from) { return *from; } -/** \internal \returns a packet with elements of \a *from duplicated. - * For instance, for a packet of 8 elements, 4 scalar will be read from \a *from and - * duplicated to form: {from[0],from[0],from[1],from[1],,from[2],from[2],,from[3],from[3]} - * Currently, this function is only used for scalar * complex products. +/** \internal \returns a packet version of \a *from, (un-aligned masked load) + * There is no generic implementation. We only have implementations for specialized + * cases. Generic case should not be called. */ -template inline Packet -ploaddup(const typename unpacket_traits::type* from) { return *from; } +template EIGEN_DEVICE_FUNC inline +typename enable_if::masked_load_available, Packet>::type +ploadu(const typename unpacket_traits::type* from, typename unpacket_traits::mask_t umask); /** \internal \returns a packet with constant coefficients \a a, e.g.: (a,a,a,a) */ -template inline Packet +template EIGEN_DEVICE_FUNC inline Packet pset1(const typename unpacket_traits::type& a) { return a; } -/** \internal \brief Returns a packet with coefficients (a,a+1,...,a+packet_size-1). */ -template inline typename packet_traits::type -plset(const Scalar& a) { return a; } +/** \internal \returns a packet with constant coefficients set from bits */ +template EIGEN_DEVICE_FUNC inline Packet +pset1frombits(BitsType a); -/** \internal copy the packet \a from to \a *to, \a to must be 16 bytes aligned */ -template inline void pstore(Scalar* to, const Packet& from) -{ (*to) = from; } +/** \internal \returns a packet with constant coefficients \a a[0], e.g.: (a[0],a[0],a[0],a[0]) */ +template EIGEN_DEVICE_FUNC inline Packet +pload1(const typename unpacket_traits::type *a) { return pset1(*a); } -/** \internal copy the packet \a from to \a *to, (un-aligned store) */ -template inline void pstoreu(Scalar* to, const Packet& from) -{ (*to) = from; } +/** \internal \returns a packet with elements of \a *from duplicated. + * For instance, for a packet of 8 elements, 4 scalars will be read from \a *from and + * duplicated to form: {from[0],from[0],from[1],from[1],from[2],from[2],from[3],from[3]} + * Currently, this function is only used for scalar * complex products. + */ +template EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Packet +ploaddup(const typename unpacket_traits::type* from) { return *from; } -/** \internal tries to do cache prefetching of \a addr */ -template inline void prefetch(const Scalar* addr) +/** \internal \returns a packet with elements of \a *from quadrupled. + * For instance, for a packet of 8 elements, 2 scalars will be read from \a *from and + * replicated to form: {from[0],from[0],from[0],from[0],from[1],from[1],from[1],from[1]} + * Currently, this function is only used in matrix products. + * For packet-size smaller or equal to 4, this function is equivalent to pload1 + */ +template EIGEN_DEVICE_FUNC inline Packet +ploadquad(const typename unpacket_traits::type* from) +{ return pload1(from); } + +/** \internal equivalent to + * \code + * a0 = pload1(a+0); + * a1 = pload1(a+1); + * a2 = pload1(a+2); + * a3 = pload1(a+3); + * \endcode + * \sa pset1, pload1, ploaddup, pbroadcast2 + */ +template EIGEN_DEVICE_FUNC +inline void pbroadcast4(const typename unpacket_traits::type *a, + Packet& a0, Packet& a1, Packet& a2, Packet& a3) { -#if !defined(_MSC_VER) -__builtin_prefetch(addr); -#endif + a0 = pload1(a+0); + a1 = pload1(a+1); + a2 = pload1(a+2); + a3 = pload1(a+3); } -/** \internal \returns the first element of a packet */ -template inline typename unpacket_traits::type pfirst(const Packet& a) -{ return a; } +/** \internal equivalent to + * \code + * a0 = pload1(a+0); + * a1 = pload1(a+1); + * \endcode + * \sa pset1, pload1, ploaddup, pbroadcast4 + */ +template EIGEN_DEVICE_FUNC +inline void pbroadcast2(const typename unpacket_traits::type *a, + Packet& a0, Packet& a1) +{ + a0 = pload1(a+0); + a1 = pload1(a+1); +} -/** \internal \returns a packet where the element i contains the sum of the packet of \a vec[i] */ -template inline Packet -preduxp(const Packet* vecs) { return vecs[0]; } +/** \internal \brief Returns a packet with coefficients (a,a+1,...,a+packet_size-1). */ +template EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Packet +plset(const typename unpacket_traits::type& a) { return a; } + +/** \internal \returns a packet with constant coefficients \a a, e.g.: (x, 0, x, 0), + where x is the value of all 1-bits. */ +template EIGEN_DEVICE_FUNC inline Packet +peven_mask(const Packet& /*a*/) { + typedef typename unpacket_traits::type Scalar; + const size_t n = unpacket_traits::size; + EIGEN_ALIGN_TO_BOUNDARY(sizeof(Packet)) Scalar elements[n]; + for(size_t i = 0; i < n; ++i) { + memset(elements+i, ((i & 1) == 0 ? 0xff : 0), sizeof(Scalar)); + } + return ploadu(elements); +} -/** \internal \returns the sum of the elements of \a a*/ -template inline typename unpacket_traits::type predux(const Packet& a) -{ return a; } -/** \internal \returns the product of the elements of \a a*/ -template inline typename unpacket_traits::type predux_mul(const Packet& a) -{ return a; } +/** \internal copy the packet \a from to \a *to, \a to must be 16 bytes aligned */ +template EIGEN_DEVICE_FUNC inline void pstore(Scalar* to, const Packet& from) +{ (*to) = from; } -/** \internal \returns the min of the elements of \a a*/ -template inline typename unpacket_traits::type predux_min(const Packet& a) -{ return a; } +/** \internal copy the packet \a from to \a *to, (un-aligned store) */ +template EIGEN_DEVICE_FUNC inline void pstoreu(Scalar* to, const Packet& from) +{ (*to) = from; } -/** \internal \returns the max of the elements of \a a*/ -template inline typename unpacket_traits::type predux_max(const Packet& a) -{ return a; } +/** \internal copy the packet \a from to \a *to, (un-aligned store with a mask) + * There is no generic implementation. We only have implementations for specialized + * cases. Generic case should not be called. + */ +template +EIGEN_DEVICE_FUNC inline +typename enable_if::masked_store_available, void>::type +pstoreu(Scalar* to, const Packet& from, typename unpacket_traits::mask_t umask); + + template EIGEN_DEVICE_FUNC inline Packet pgather(const Scalar* from, Index /*stride*/) + { return ploadu(from); } + + template EIGEN_DEVICE_FUNC inline void pscatter(Scalar* to, const Packet& from, Index /*stride*/) + { pstore(to, from); } + +/** \internal tries to do cache prefetching of \a addr */ +template EIGEN_DEVICE_FUNC inline void prefetch(const Scalar* addr) +{ +#if defined(EIGEN_HIP_DEVICE_COMPILE) + // do nothing +#elif defined(EIGEN_CUDA_ARCH) +#if defined(__LP64__) || EIGEN_OS_WIN64 + // 64-bit pointer operand constraint for inlined asm + asm(" prefetch.L1 [ %1 ];" : "=l"(addr) : "l"(addr)); +#else + // 32-bit pointer operand constraint for inlined asm + asm(" prefetch.L1 [ %1 ];" : "=r"(addr) : "r"(addr)); +#endif +#elif (!EIGEN_COMP_MSVC) && (EIGEN_COMP_GNUC || EIGEN_COMP_CLANG || EIGEN_COMP_ICC) + __builtin_prefetch(addr); +#endif +} /** \internal \returns the reversed elements of \a a*/ -template inline Packet preverse(const Packet& a) +template EIGEN_DEVICE_FUNC inline Packet preverse(const Packet& a) { return a; } - /** \internal \returns \a a with real and imaginary part flipped (for complex type only) */ -template inline Packet pcplxflip(const Packet& a) +template EIGEN_DEVICE_FUNC inline Packet pcplxflip(const Packet& a) { - // FIXME: uncomment the following in case we drop the internal imag and real functions. -// using std::imag; -// using std::real; - return Packet(imag(a),real(a)); + return Packet(numext::imag(a),numext::real(a)); } /************************** @@ -232,41 +749,201 @@ template inline Packet pcplxflip(const Packet& a) /** \internal \returns the sine of \a a (coeff-wise) */ template EIGEN_DECLARE_FUNCTION_ALLOWING_MULTIPLE_DEFINITIONS -Packet psin(const Packet& a) { using std::sin; return sin(a); } +Packet psin(const Packet& a) { EIGEN_USING_STD(sin); return sin(a); } /** \internal \returns the cosine of \a a (coeff-wise) */ template EIGEN_DECLARE_FUNCTION_ALLOWING_MULTIPLE_DEFINITIONS -Packet pcos(const Packet& a) { using std::cos; return cos(a); } +Packet pcos(const Packet& a) { EIGEN_USING_STD(cos); return cos(a); } /** \internal \returns the tan of \a a (coeff-wise) */ template EIGEN_DECLARE_FUNCTION_ALLOWING_MULTIPLE_DEFINITIONS -Packet ptan(const Packet& a) { using std::tan; return tan(a); } +Packet ptan(const Packet& a) { EIGEN_USING_STD(tan); return tan(a); } /** \internal \returns the arc sine of \a a (coeff-wise) */ template EIGEN_DECLARE_FUNCTION_ALLOWING_MULTIPLE_DEFINITIONS -Packet pasin(const Packet& a) { using std::asin; return asin(a); } +Packet pasin(const Packet& a) { EIGEN_USING_STD(asin); return asin(a); } /** \internal \returns the arc cosine of \a a (coeff-wise) */ template EIGEN_DECLARE_FUNCTION_ALLOWING_MULTIPLE_DEFINITIONS -Packet pacos(const Packet& a) { using std::acos; return acos(a); } +Packet pacos(const Packet& a) { EIGEN_USING_STD(acos); return acos(a); } + +/** \internal \returns the arc tangent of \a a (coeff-wise) */ +template EIGEN_DECLARE_FUNCTION_ALLOWING_MULTIPLE_DEFINITIONS +Packet patan(const Packet& a) { EIGEN_USING_STD(atan); return atan(a); } + +/** \internal \returns the hyperbolic sine of \a a (coeff-wise) */ +template EIGEN_DECLARE_FUNCTION_ALLOWING_MULTIPLE_DEFINITIONS +Packet psinh(const Packet& a) { EIGEN_USING_STD(sinh); return sinh(a); } + +/** \internal \returns the hyperbolic cosine of \a a (coeff-wise) */ +template EIGEN_DECLARE_FUNCTION_ALLOWING_MULTIPLE_DEFINITIONS +Packet pcosh(const Packet& a) { EIGEN_USING_STD(cosh); return cosh(a); } + +/** \internal \returns the hyperbolic tan of \a a (coeff-wise) */ +template EIGEN_DECLARE_FUNCTION_ALLOWING_MULTIPLE_DEFINITIONS +Packet ptanh(const Packet& a) { EIGEN_USING_STD(tanh); return tanh(a); } /** \internal \returns the exp of \a a (coeff-wise) */ template EIGEN_DECLARE_FUNCTION_ALLOWING_MULTIPLE_DEFINITIONS -Packet pexp(const Packet& a) { using std::exp; return exp(a); } +Packet pexp(const Packet& a) { EIGEN_USING_STD(exp); return exp(a); } + +/** \internal \returns the expm1 of \a a (coeff-wise) */ +template EIGEN_DECLARE_FUNCTION_ALLOWING_MULTIPLE_DEFINITIONS +Packet pexpm1(const Packet& a) { return numext::expm1(a); } /** \internal \returns the log of \a a (coeff-wise) */ template EIGEN_DECLARE_FUNCTION_ALLOWING_MULTIPLE_DEFINITIONS -Packet plog(const Packet& a) { using std::log; return log(a); } +Packet plog(const Packet& a) { EIGEN_USING_STD(log); return log(a); } + +/** \internal \returns the log1p of \a a (coeff-wise) */ +template EIGEN_DECLARE_FUNCTION_ALLOWING_MULTIPLE_DEFINITIONS +Packet plog1p(const Packet& a) { return numext::log1p(a); } + +/** \internal \returns the log10 of \a a (coeff-wise) */ +template EIGEN_DECLARE_FUNCTION_ALLOWING_MULTIPLE_DEFINITIONS +Packet plog10(const Packet& a) { EIGEN_USING_STD(log10); return log10(a); } + +/** \internal \returns the log10 of \a a (coeff-wise) */ +template EIGEN_DECLARE_FUNCTION_ALLOWING_MULTIPLE_DEFINITIONS +Packet plog2(const Packet& a) { + typedef typename internal::unpacket_traits::type Scalar; + return pmul(pset1(Scalar(EIGEN_LOG2E)), plog(a)); +} /** \internal \returns the square-root of \a a (coeff-wise) */ template EIGEN_DECLARE_FUNCTION_ALLOWING_MULTIPLE_DEFINITIONS -Packet psqrt(const Packet& a) { using std::sqrt; return sqrt(a); } +Packet psqrt(const Packet& a) { return numext::sqrt(a); } + +/** \internal \returns the reciprocal square-root of \a a (coeff-wise) */ +template EIGEN_DECLARE_FUNCTION_ALLOWING_MULTIPLE_DEFINITIONS +Packet prsqrt(const Packet& a) { + typedef typename internal::unpacket_traits::type Scalar; + return pdiv(pset1(Scalar(1)), psqrt(a)); +} + +/** \internal \returns the rounded value of \a a (coeff-wise) */ +template EIGEN_DECLARE_FUNCTION_ALLOWING_MULTIPLE_DEFINITIONS +Packet pround(const Packet& a) { using numext::round; return round(a); } + +/** \internal \returns the floor of \a a (coeff-wise) */ +template EIGEN_DECLARE_FUNCTION_ALLOWING_MULTIPLE_DEFINITIONS +Packet pfloor(const Packet& a) { using numext::floor; return floor(a); } + +/** \internal \returns the rounded value of \a a (coeff-wise) with current + * rounding mode */ +template EIGEN_DECLARE_FUNCTION_ALLOWING_MULTIPLE_DEFINITIONS +Packet print(const Packet& a) { using numext::rint; return rint(a); } + +/** \internal \returns the ceil of \a a (coeff-wise) */ +template EIGEN_DECLARE_FUNCTION_ALLOWING_MULTIPLE_DEFINITIONS +Packet pceil(const Packet& a) { using numext::ceil; return ceil(a); } + +/** \internal \returns the first element of a packet */ +template +EIGEN_DEVICE_FUNC inline typename unpacket_traits::type +pfirst(const Packet& a) +{ return a; } + +/** \internal \returns the sum of the elements of upper and lower half of \a a if \a a is larger than 4. + * For a packet {a0, a1, a2, a3, a4, a5, a6, a7}, it returns a half packet {a0+a4, a1+a5, a2+a6, a3+a7} + * For packet-size smaller or equal to 4, this boils down to a noop. + */ +template +EIGEN_DEVICE_FUNC inline typename conditional<(unpacket_traits::size%8)==0,typename unpacket_traits::half,Packet>::type +predux_half_dowto4(const Packet& a) +{ return a; } + +// Slow generic implementation of Packet reduction. +template +EIGEN_DEVICE_FUNC inline typename unpacket_traits::type +predux_helper(const Packet& a, Op op) { + typedef typename unpacket_traits::type Scalar; + const size_t n = unpacket_traits::size; + EIGEN_ALIGN_TO_BOUNDARY(sizeof(Packet)) Scalar elements[n]; + pstoreu(elements, a); + for(size_t k = n / 2; k > 0; k /= 2) { + for(size_t i = 0; i < k; ++i) { + elements[i] = op(elements[i], elements[i + k]); + } + } + return elements[0]; +} + +/** \internal \returns the sum of the elements of \a a*/ +template +EIGEN_DEVICE_FUNC inline typename unpacket_traits::type +predux(const Packet& a) +{ + return a; +} + +/** \internal \returns the product of the elements of \a a */ +template +EIGEN_DEVICE_FUNC inline typename unpacket_traits::type predux_mul( + const Packet& a) { + typedef typename unpacket_traits::type Scalar; + return predux_helper(a, EIGEN_BINARY_OP_NAN_PROPAGATION(Scalar, (pmul))); +} + +/** \internal \returns the min of the elements of \a a */ +template +EIGEN_DEVICE_FUNC inline typename unpacket_traits::type predux_min( + const Packet &a) { + typedef typename unpacket_traits::type Scalar; + return predux_helper(a, EIGEN_BINARY_OP_NAN_PROPAGATION(Scalar, (pmin))); +} + +template +EIGEN_DEVICE_FUNC inline typename unpacket_traits::type predux_min( + const Packet& a) { + typedef typename unpacket_traits::type Scalar; + return predux_helper(a, EIGEN_BINARY_OP_NAN_PROPAGATION(Scalar, (pmin))); +} + +/** \internal \returns the min of the elements of \a a */ +template +EIGEN_DEVICE_FUNC inline typename unpacket_traits::type predux_max( + const Packet &a) { + typedef typename unpacket_traits::type Scalar; + return predux_helper(a, EIGEN_BINARY_OP_NAN_PROPAGATION(Scalar, (pmax))); +} + +template +EIGEN_DEVICE_FUNC inline typename unpacket_traits::type predux_max( + const Packet& a) { + typedef typename unpacket_traits::type Scalar; + return predux_helper(a, EIGEN_BINARY_OP_NAN_PROPAGATION(Scalar, (pmax))); +} + +#undef EIGEN_BINARY_OP_NAN_PROPAGATION + +/** \internal \returns true if all coeffs of \a a means "true" + * It is supposed to be called on values returned by pcmp_*. + */ +// not needed yet +// template EIGEN_DEVICE_FUNC inline bool predux_all(const Packet& a) +// { return bool(a); } + +/** \internal \returns true if any coeffs of \a a means "true" + * It is supposed to be called on values returned by pcmp_*. + */ +template EIGEN_DEVICE_FUNC inline bool predux_any(const Packet& a) +{ + // Dirty but generic implementation where "true" is assumed to be non 0 and all the sames. + // It is expected that "true" is either: + // - Scalar(1) + // - bits full of ones (NaN for floats), + // - or first bit equals to 1 (1 for ints, smallest denormal for floats). + // For all these cases, taking the sum is just fine, and this boils down to a no-op for scalars. + typedef typename unpacket_traits::type Scalar; + return numext::not_equal_strict(predux(a), Scalar(0)); +} /*************************************************************************** * The following functions might not have to be overwritten for vectorized types ***************************************************************************/ -/** \internal copy a packet with constant coeficient \a a (e.g., [a,a,a,a]) to \a *to. \a to must be 16 bytes aligned */ +/** \internal copy a packet with constant coefficient \a a (e.g., [a,a,a,a]) to \a *to. \a to must be 16 bytes aligned */ // NOTE: this function must really be templated on the packet type (think about different packet types for the same scalar type) template inline void pstore1(typename unpacket_traits::type* to, const typename unpacket_traits::type& a) @@ -275,76 +952,89 @@ inline void pstore1(typename unpacket_traits::type* to, const typename u } /** \internal \returns a * b + c (coeff-wise) */ -template inline Packet +template EIGEN_DEVICE_FUNC inline Packet pmadd(const Packet& a, const Packet& b, const Packet& c) { return padd(pmul(a, b),c); } /** \internal \returns a packet version of \a *from. - * If LoadMode equals #Aligned, \a from must be 16 bytes aligned */ -template -inline Packet ploadt(const typename unpacket_traits::type* from) + * The pointer \a from must be aligned on a \a Alignment bytes boundary. */ +template +EIGEN_DEVICE_FUNC EIGEN_ALWAYS_INLINE Packet ploadt(const typename unpacket_traits::type* from) { - if(LoadMode == Aligned) + if(Alignment >= unpacket_traits::alignment) return pload(from); else return ploadu(from); } /** \internal copy the packet \a from to \a *to. - * If StoreMode equals #Aligned, \a to must be 16 bytes aligned */ -template -inline void pstoret(Scalar* to, const Packet& from) + * The pointer \a from must be aligned on a \a Alignment bytes boundary. */ +template +EIGEN_DEVICE_FUNC EIGEN_ALWAYS_INLINE void pstoret(Scalar* to, const Packet& from) { - if(LoadMode == Aligned) + if(Alignment >= unpacket_traits::alignment) pstore(to, from); else pstoreu(to, from); } -/** \internal default implementation of palign() allowing partial specialization */ -template -struct palign_impl -{ - // by default data are aligned, so there is nothing to be done :) - static inline void run(PacketType&, const PacketType&) {} -}; - -/** \internal update \a first using the concatenation of the packet_size minus \a Offset last elements - * of \a first and \a Offset first elements of \a second. - * - * This function is currently only used to optimize matrix-vector products on unligned matrices. - * It takes 2 packets that represent a contiguous memory array, and returns a packet starting - * at the position \a Offset. For instance, for packets of 4 elements, we have: - * Input: - * - first = {f0,f1,f2,f3} - * - second = {s0,s1,s2,s3} - * Output: - * - if Offset==0 then {f0,f1,f2,f3} - * - if Offset==1 then {f1,f2,f3,s0} - * - if Offset==2 then {f2,f3,s0,s1} - * - if Offset==3 then {f3,s0,s1,s3} +/** \internal \returns a packet version of \a *from. + * Unlike ploadt, ploadt_ro takes advantage of the read-only memory path on the + * hardware if available to speedup the loading of data that won't be modified + * by the current computation. */ -template -inline void palign(PacketType& first, const PacketType& second) +template +EIGEN_DEVICE_FUNC EIGEN_ALWAYS_INLINE Packet ploadt_ro(const typename unpacket_traits::type* from) { - palign_impl::run(first,second); + return ploadt(from); } /*************************************************************************** * Fast complex products (GCC generates a function call which is very slow) ***************************************************************************/ +// Eigen+CUDA does not support complexes. +#if !defined(EIGEN_GPUCC) + template<> inline std::complex pmul(const std::complex& a, const std::complex& b) -{ return std::complex(real(a)*real(b) - imag(a)*imag(b), imag(a)*real(b) + real(a)*imag(b)); } +{ return std::complex(a.real()*b.real() - a.imag()*b.imag(), a.imag()*b.real() + a.real()*b.imag()); } template<> inline std::complex pmul(const std::complex& a, const std::complex& b) -{ return std::complex(real(a)*real(b) - imag(a)*imag(b), imag(a)*real(b) + real(a)*imag(b)); } +{ return std::complex(a.real()*b.real() - a.imag()*b.imag(), a.imag()*b.real() + a.real()*b.imag()); } + +#endif + + +/*************************************************************************** + * PacketBlock, that is a collection of N packets where the number of words + * in the packet is a multiple of N. +***************************************************************************/ +template ::size> struct PacketBlock { + Packet packet[N]; +}; + +template EIGEN_DEVICE_FUNC inline void +ptranspose(PacketBlock& /*kernel*/) { + // Nothing to do in the scalar case, i.e. a 1x1 matrix. +} + +/*************************************************************************** + * Selector, i.e. vector of N boolean values used to select (i.e. blend) + * words from 2 packets. +***************************************************************************/ +template struct Selector { + bool select[N]; +}; + +template EIGEN_DEVICE_FUNC inline Packet +pblend(const Selector::size>& ifPacket, const Packet& thenPacket, const Packet& elsePacket) { + return ifPacket.select[0] ? thenPacket : elsePacket; +} } // end namespace internal } // end namespace Eigen #endif // EIGEN_GENERIC_PACKET_MATH_H - diff --git a/extern/eigen/Eigen/src/Core/GlobalFunctions.h b/extern/eigen/Eigen/src/Core/GlobalFunctions.h index 2acf9772..629af94b 100644 --- a/extern/eigen/Eigen/src/Core/GlobalFunctions.h +++ b/extern/eigen/Eigen/src/Core/GlobalFunctions.h @@ -1,7 +1,7 @@ // This file is part of Eigen, a lightweight C++ template library // for linear algebra. // -// Copyright (C) 2010-2012 Gael Guennebaud +// Copyright (C) 2010-2016 Gael Guennebaud // Copyright (C) 2010 Benoit Jacob // // This Source Code Form is subject to the terms of the Mozilla @@ -11,13 +11,30 @@ #ifndef EIGEN_GLOBAL_FUNCTIONS_H #define EIGEN_GLOBAL_FUNCTIONS_H -#define EIGEN_ARRAY_DECLARE_GLOBAL_UNARY(NAME,FUNCTOR) \ +#ifdef EIGEN_PARSED_BY_DOXYGEN + +#define EIGEN_ARRAY_DECLARE_GLOBAL_UNARY(NAME,FUNCTOR,DOC_OP,DOC_DETAILS) \ + /** \returns an expression of the coefficient-wise DOC_OP of \a x + + DOC_DETAILS + + \sa Math functions, class CwiseUnaryOp + */ \ + template \ + inline const Eigen::CwiseUnaryOp, const Derived> \ + NAME(const Eigen::ArrayBase& x); + +#else + +#define EIGEN_ARRAY_DECLARE_GLOBAL_UNARY(NAME,FUNCTOR,DOC_OP,DOC_DETAILS) \ template \ inline const Eigen::CwiseUnaryOp, const Derived> \ - NAME(const Eigen::ArrayBase& x) { \ - return x.derived(); \ + (NAME)(const Eigen::ArrayBase& x) { \ + return Eigen::CwiseUnaryOp, const Derived>(x.derived()); \ } +#endif // EIGEN_PARSED_BY_DOXYGEN + #define EIGEN_ARRAY_DECLARE_GLOBAL_EIGEN_UNARY(NAME,FUNCTOR) \ \ template \ @@ -30,54 +47,139 @@ { \ static inline typename NAME##_retval >::type run(const Eigen::ArrayBase& x) \ { \ - return x.derived(); \ + return typename NAME##_retval >::type(x.derived()); \ } \ }; - namespace Eigen { - EIGEN_ARRAY_DECLARE_GLOBAL_UNARY(real,scalar_real_op) - EIGEN_ARRAY_DECLARE_GLOBAL_UNARY(imag,scalar_imag_op) - EIGEN_ARRAY_DECLARE_GLOBAL_UNARY(conj,scalar_conjugate_op) - EIGEN_ARRAY_DECLARE_GLOBAL_UNARY(sin,scalar_sin_op) - EIGEN_ARRAY_DECLARE_GLOBAL_UNARY(cos,scalar_cos_op) - EIGEN_ARRAY_DECLARE_GLOBAL_UNARY(asin,scalar_asin_op) - EIGEN_ARRAY_DECLARE_GLOBAL_UNARY(acos,scalar_acos_op) - EIGEN_ARRAY_DECLARE_GLOBAL_UNARY(tan,scalar_tan_op) - EIGEN_ARRAY_DECLARE_GLOBAL_UNARY(exp,scalar_exp_op) - EIGEN_ARRAY_DECLARE_GLOBAL_UNARY(log,scalar_log_op) - EIGEN_ARRAY_DECLARE_GLOBAL_UNARY(abs,scalar_abs_op) - EIGEN_ARRAY_DECLARE_GLOBAL_UNARY(sqrt,scalar_sqrt_op) - - template - inline const Eigen::CwiseUnaryOp, const Derived> - pow(const Eigen::ArrayBase& x, const typename Derived::Scalar& exponent) { - return x.derived().pow(exponent); + EIGEN_ARRAY_DECLARE_GLOBAL_UNARY(real,scalar_real_op,real part,\sa ArrayBase::real) + EIGEN_ARRAY_DECLARE_GLOBAL_UNARY(imag,scalar_imag_op,imaginary part,\sa ArrayBase::imag) + EIGEN_ARRAY_DECLARE_GLOBAL_UNARY(conj,scalar_conjugate_op,complex conjugate,\sa ArrayBase::conjugate) + EIGEN_ARRAY_DECLARE_GLOBAL_UNARY(inverse,scalar_inverse_op,inverse,\sa ArrayBase::inverse) + EIGEN_ARRAY_DECLARE_GLOBAL_UNARY(sin,scalar_sin_op,sine,\sa ArrayBase::sin) + EIGEN_ARRAY_DECLARE_GLOBAL_UNARY(cos,scalar_cos_op,cosine,\sa ArrayBase::cos) + EIGEN_ARRAY_DECLARE_GLOBAL_UNARY(tan,scalar_tan_op,tangent,\sa ArrayBase::tan) + EIGEN_ARRAY_DECLARE_GLOBAL_UNARY(atan,scalar_atan_op,arc-tangent,\sa ArrayBase::atan) + EIGEN_ARRAY_DECLARE_GLOBAL_UNARY(asin,scalar_asin_op,arc-sine,\sa ArrayBase::asin) + EIGEN_ARRAY_DECLARE_GLOBAL_UNARY(acos,scalar_acos_op,arc-consine,\sa ArrayBase::acos) + EIGEN_ARRAY_DECLARE_GLOBAL_UNARY(sinh,scalar_sinh_op,hyperbolic sine,\sa ArrayBase::sinh) + EIGEN_ARRAY_DECLARE_GLOBAL_UNARY(cosh,scalar_cosh_op,hyperbolic cosine,\sa ArrayBase::cosh) + EIGEN_ARRAY_DECLARE_GLOBAL_UNARY(tanh,scalar_tanh_op,hyperbolic tangent,\sa ArrayBase::tanh) +#if EIGEN_HAS_CXX11_MATH + EIGEN_ARRAY_DECLARE_GLOBAL_UNARY(asinh,scalar_asinh_op,inverse hyperbolic sine,\sa ArrayBase::asinh) + EIGEN_ARRAY_DECLARE_GLOBAL_UNARY(acosh,scalar_acosh_op,inverse hyperbolic cosine,\sa ArrayBase::acosh) + EIGEN_ARRAY_DECLARE_GLOBAL_UNARY(atanh,scalar_atanh_op,inverse hyperbolic tangent,\sa ArrayBase::atanh) +#endif + EIGEN_ARRAY_DECLARE_GLOBAL_UNARY(logistic,scalar_logistic_op,logistic function,\sa ArrayBase::logistic) + EIGEN_ARRAY_DECLARE_GLOBAL_UNARY(lgamma,scalar_lgamma_op,natural logarithm of the gamma function,\sa ArrayBase::lgamma) + EIGEN_ARRAY_DECLARE_GLOBAL_UNARY(digamma,scalar_digamma_op,derivative of lgamma,\sa ArrayBase::digamma) + EIGEN_ARRAY_DECLARE_GLOBAL_UNARY(erf,scalar_erf_op,error function,\sa ArrayBase::erf) + EIGEN_ARRAY_DECLARE_GLOBAL_UNARY(erfc,scalar_erfc_op,complement error function,\sa ArrayBase::erfc) + EIGEN_ARRAY_DECLARE_GLOBAL_UNARY(ndtri,scalar_ndtri_op,inverse normal distribution function,\sa ArrayBase::ndtri) + EIGEN_ARRAY_DECLARE_GLOBAL_UNARY(exp,scalar_exp_op,exponential,\sa ArrayBase::exp) + EIGEN_ARRAY_DECLARE_GLOBAL_UNARY(expm1,scalar_expm1_op,exponential of a value minus 1,\sa ArrayBase::expm1) + EIGEN_ARRAY_DECLARE_GLOBAL_UNARY(log,scalar_log_op,natural logarithm,\sa Eigen::log10 DOXCOMMA ArrayBase::log) + EIGEN_ARRAY_DECLARE_GLOBAL_UNARY(log1p,scalar_log1p_op,natural logarithm of 1 plus the value,\sa ArrayBase::log1p) + EIGEN_ARRAY_DECLARE_GLOBAL_UNARY(log10,scalar_log10_op,base 10 logarithm,\sa Eigen::log DOXCOMMA ArrayBase::log10) + EIGEN_ARRAY_DECLARE_GLOBAL_UNARY(log2,scalar_log2_op,base 2 logarithm,\sa Eigen::log DOXCOMMA ArrayBase::log2) + EIGEN_ARRAY_DECLARE_GLOBAL_UNARY(abs,scalar_abs_op,absolute value,\sa ArrayBase::abs DOXCOMMA MatrixBase::cwiseAbs) + EIGEN_ARRAY_DECLARE_GLOBAL_UNARY(abs2,scalar_abs2_op,squared absolute value,\sa ArrayBase::abs2 DOXCOMMA MatrixBase::cwiseAbs2) + EIGEN_ARRAY_DECLARE_GLOBAL_UNARY(arg,scalar_arg_op,complex argument,\sa ArrayBase::arg DOXCOMMA MatrixBase::cwiseArg) + EIGEN_ARRAY_DECLARE_GLOBAL_UNARY(sqrt,scalar_sqrt_op,square root,\sa ArrayBase::sqrt DOXCOMMA MatrixBase::cwiseSqrt) + EIGEN_ARRAY_DECLARE_GLOBAL_UNARY(rsqrt,scalar_rsqrt_op,reciprocal square root,\sa ArrayBase::rsqrt) + EIGEN_ARRAY_DECLARE_GLOBAL_UNARY(square,scalar_square_op,square (power 2),\sa Eigen::abs2 DOXCOMMA Eigen::pow DOXCOMMA ArrayBase::square) + EIGEN_ARRAY_DECLARE_GLOBAL_UNARY(cube,scalar_cube_op,cube (power 3),\sa Eigen::pow DOXCOMMA ArrayBase::cube) + EIGEN_ARRAY_DECLARE_GLOBAL_UNARY(rint,scalar_rint_op,nearest integer,\sa Eigen::floor DOXCOMMA Eigen::ceil DOXCOMMA ArrayBase::round) + EIGEN_ARRAY_DECLARE_GLOBAL_UNARY(round,scalar_round_op,nearest integer,\sa Eigen::floor DOXCOMMA Eigen::ceil DOXCOMMA ArrayBase::round) + EIGEN_ARRAY_DECLARE_GLOBAL_UNARY(floor,scalar_floor_op,nearest integer not greater than the giben value,\sa Eigen::ceil DOXCOMMA ArrayBase::floor) + EIGEN_ARRAY_DECLARE_GLOBAL_UNARY(ceil,scalar_ceil_op,nearest integer not less than the giben value,\sa Eigen::floor DOXCOMMA ArrayBase::ceil) + EIGEN_ARRAY_DECLARE_GLOBAL_UNARY(isnan,scalar_isnan_op,not-a-number test,\sa Eigen::isinf DOXCOMMA Eigen::isfinite DOXCOMMA ArrayBase::isnan) + EIGEN_ARRAY_DECLARE_GLOBAL_UNARY(isinf,scalar_isinf_op,infinite value test,\sa Eigen::isnan DOXCOMMA Eigen::isfinite DOXCOMMA ArrayBase::isinf) + EIGEN_ARRAY_DECLARE_GLOBAL_UNARY(isfinite,scalar_isfinite_op,finite value test,\sa Eigen::isinf DOXCOMMA Eigen::isnan DOXCOMMA ArrayBase::isfinite) + EIGEN_ARRAY_DECLARE_GLOBAL_UNARY(sign,scalar_sign_op,sign (or 0),\sa ArrayBase::sign) + + /** \returns an expression of the coefficient-wise power of \a x to the given constant \a exponent. + * + * \tparam ScalarExponent is the scalar type of \a exponent. It must be compatible with the scalar type of the given expression (\c Derived::Scalar). + * + * \sa ArrayBase::pow() + * + * \relates ArrayBase + */ +#ifdef EIGEN_PARSED_BY_DOXYGEN + template + inline const CwiseBinaryOp,Derived,Constant > + pow(const Eigen::ArrayBase& x, const ScalarExponent& exponent); +#else + template + EIGEN_DEVICE_FUNC inline + EIGEN_MSVC10_WORKAROUND_BINARYOP_RETURN_TYPE( + const EIGEN_EXPR_BINARYOP_SCALAR_RETURN_TYPE(Derived,typename internal::promote_scalar_arg::type,pow)) + pow(const Eigen::ArrayBase& x, const ScalarExponent& exponent) + { + typedef typename internal::promote_scalar_arg::type PromotedExponent; + return EIGEN_EXPR_BINARYOP_SCALAR_RETURN_TYPE(Derived,PromotedExponent,pow)(x.derived(), + typename internal::plain_constant_type::type(x.derived().rows(), x.derived().cols(), internal::scalar_constant_op(exponent))); } +#endif - template - inline const Eigen::CwiseBinaryOp, const Derived, const Derived> - pow(const Eigen::ArrayBase& x, const Eigen::ArrayBase& exponents) + /** \returns an expression of the coefficient-wise power of \a x to the given array of \a exponents. + * + * This function computes the coefficient-wise power. + * + * Example: \include Cwise_array_power_array.cpp + * Output: \verbinclude Cwise_array_power_array.out + * + * \sa ArrayBase::pow() + * + * \relates ArrayBase + */ + template + inline const Eigen::CwiseBinaryOp, const Derived, const ExponentDerived> + pow(const Eigen::ArrayBase& x, const Eigen::ArrayBase& exponents) { - return Eigen::CwiseBinaryOp, const Derived, const Derived>( + return Eigen::CwiseBinaryOp, const Derived, const ExponentDerived>( x.derived(), exponents.derived() ); } - - /** - * \brief Component-wise division of a scalar by array elements. - **/ - template - inline const Eigen::CwiseUnaryOp, const Derived> - operator/(const typename Derived::Scalar& s, const Eigen::ArrayBase& a) - { - return Eigen::CwiseUnaryOp, const Derived>( - a.derived(), - Eigen::internal::scalar_inverse_mult_op(s) - ); + + /** \returns an expression of the coefficient-wise power of the scalar \a x to the given array of \a exponents. + * + * This function computes the coefficient-wise power between a scalar and an array of exponents. + * + * \tparam Scalar is the scalar type of \a x. It must be compatible with the scalar type of the given array expression (\c Derived::Scalar). + * + * Example: \include Cwise_scalar_power_array.cpp + * Output: \verbinclude Cwise_scalar_power_array.out + * + * \sa ArrayBase::pow() + * + * \relates ArrayBase + */ +#ifdef EIGEN_PARSED_BY_DOXYGEN + template + inline const CwiseBinaryOp,Constant,Derived> + pow(const Scalar& x,const Eigen::ArrayBase& x); +#else + template + EIGEN_DEVICE_FUNC inline + EIGEN_MSVC10_WORKAROUND_BINARYOP_RETURN_TYPE( + const EIGEN_SCALAR_BINARYOP_EXPR_RETURN_TYPE(typename internal::promote_scalar_arg::type,Derived,pow)) + pow(const Scalar& x, const Eigen::ArrayBase& exponents) { + typedef typename internal::promote_scalar_arg::type PromotedScalar; + return EIGEN_SCALAR_BINARYOP_EXPR_RETURN_TYPE(PromotedScalar,Derived,pow)( + typename internal::plain_constant_type::type(exponents.derived().rows(), exponents.derived().cols(), internal::scalar_constant_op(x)), exponents.derived()); } +#endif + namespace internal { diff --git a/extern/eigen/Eigen/src/Core/IO.h b/extern/eigen/Eigen/src/Core/IO.h index 8d4bc59e..e81c3152 100644 --- a/extern/eigen/Eigen/src/Core/IO.h +++ b/extern/eigen/Eigen/src/Core/IO.h @@ -41,6 +41,7 @@ std::ostream & print_matrix(std::ostream & s, const Derived& _m, const IOFormat& * - \b rowSuffix string printed at the end of each row * - \b matPrefix string printed at the beginning of the matrix * - \b matSuffix string printed at the end of the matrix + * - \b fill character printed to fill the empty space in aligned columns * * Example: \include IOFormat.cpp * Output: \verbinclude IOFormat.out @@ -49,14 +50,18 @@ std::ostream & print_matrix(std::ostream & s, const Derived& _m, const IOFormat& */ struct IOFormat { - /** Default contructor, see class IOFormat for the meaning of the parameters */ + /** Default constructor, see class IOFormat for the meaning of the parameters */ IOFormat(int _precision = StreamPrecision, int _flags = 0, const std::string& _coeffSeparator = " ", const std::string& _rowSeparator = "\n", const std::string& _rowPrefix="", const std::string& _rowSuffix="", - const std::string& _matPrefix="", const std::string& _matSuffix="") + const std::string& _matPrefix="", const std::string& _matSuffix="", const char _fill=' ') : matPrefix(_matPrefix), matSuffix(_matSuffix), rowPrefix(_rowPrefix), rowSuffix(_rowSuffix), rowSeparator(_rowSeparator), - rowSpacer(""), coeffSeparator(_coeffSeparator), precision(_precision), flags(_flags) + rowSpacer(""), coeffSeparator(_coeffSeparator), fill(_fill), precision(_precision), flags(_flags) { + // TODO check if rowPrefix, rowSuffix or rowSeparator contains a newline + // don't add rowSpacer if columns are not to be aligned + if((flags & DontAlignCols)) + return; int i = int(matSuffix.length())-1; while (i>=0 && matSuffix[i]!='\n') { @@ -67,6 +72,7 @@ struct IOFormat std::string matPrefix, matSuffix; std::string rowPrefix, rowSuffix, rowSeparator, rowSpacer; std::string coeffSeparator; + char fill; int precision; int flags; }; @@ -76,7 +82,7 @@ struct IOFormat * * \brief Pseudo expression providing matrix output with given format * - * \param ExpressionType the type of the object on which IO stream operations are performed + * \tparam ExpressionType the type of the object on which IO stream operations are performed * * This class represents an expression with stream operators controlled by a given IOFormat. * It is the return type of DenseBase::format() @@ -101,57 +107,32 @@ class WithFormat } protected: - const typename ExpressionType::Nested m_matrix; + typename ExpressionType::Nested m_matrix; IOFormat m_format; }; -/** \returns a WithFormat proxy object allowing to print a matrix the with given - * format \a fmt. - * - * See class IOFormat for some examples. - * - * \sa class IOFormat, class WithFormat - */ -template -inline const WithFormat -DenseBase::format(const IOFormat& fmt) const -{ - return WithFormat(derived(), fmt); -} - namespace internal { -template -struct significant_decimals_default_impl -{ - typedef typename NumTraits::Real RealScalar; - static inline int run() - { - using std::ceil; - using std::log; - return cast(ceil(-log(NumTraits::epsilon())/log(RealScalar(10)))); - } -}; - +// NOTE: This helper is kept for backward compatibility with previous code specializing +// this internal::significant_decimals_impl structure. In the future we should directly +// call digits10() which has been introduced in July 2016 in 3.3. template -struct significant_decimals_default_impl +struct significant_decimals_impl { static inline int run() { - return 0; + return NumTraits::digits10(); } }; -template -struct significant_decimals_impl - : significant_decimals_default_impl::IsInteger> -{}; - /** \internal * print the matrix \a _m to the output stream \a s using the output format \a fmt */ template std::ostream & print_matrix(std::ostream & s, const Derived& _m, const IOFormat& fmt) { + using internal::is_same; + using internal::conditional; + if(_m.size() == 0) { s << fmt.matPrefix << fmt.matSuffix; @@ -160,7 +141,22 @@ std::ostream & print_matrix(std::ostream & s, const Derived& _m, const IOFormat& typename Derived::Nested m = _m; typedef typename Derived::Scalar Scalar; - typedef typename Derived::Index Index; + typedef typename + conditional< + is_same::value || + is_same::value || + is_same::value || + is_same::value, + int, + typename conditional< + is_same >::value || + is_same >::value || + is_same >::value || + is_same >::value, + std::complex, + const Scalar& + >::type + >::type PrintType; Index width = 0; @@ -197,23 +193,31 @@ std::ostream & print_matrix(std::ostream & s, const Derived& _m, const IOFormat& { std::stringstream sstr; sstr.copyfmt(s); - sstr << m.coeff(i,j); + sstr << static_cast(m.coeff(i,j)); width = std::max(width, Index(sstr.str().length())); } } + std::streamsize old_width = s.width(); + char old_fill_character = s.fill(); s << fmt.matPrefix; for(Index i = 0; i < m.rows(); ++i) { if (i) s << fmt.rowSpacer; s << fmt.rowPrefix; - if(width) s.width(width); - s << m.coeff(i, 0); + if(width) { + s.fill(fmt.fill); + s.width(width); + } + s << static_cast(m.coeff(i, 0)); for(Index j = 1; j < m.cols(); ++j) { s << fmt.coeffSeparator; - if (width) s.width(width); - s << m.coeff(i, j); + if(width) { + s.fill(fmt.fill); + s.width(width); + } + s << static_cast(m.coeff(i, j)); } s << fmt.rowSuffix; if( i < m.rows() - 1) @@ -221,6 +225,10 @@ std::ostream & print_matrix(std::ostream & s, const Derived& _m, const IOFormat& } s << fmt.matSuffix; if(explicit_precision) s.precision(old_precision); + if(width) { + s.fill(old_fill_character); + s.width(old_width); + } return s; } diff --git a/extern/eigen/Eigen/src/Core/IndexedView.h b/extern/eigen/Eigen/src/Core/IndexedView.h new file mode 100644 index 00000000..08476251 --- /dev/null +++ b/extern/eigen/Eigen/src/Core/IndexedView.h @@ -0,0 +1,237 @@ +// This file is part of Eigen, a lightweight C++ template library +// for linear algebra. +// +// Copyright (C) 2017 Gael Guennebaud +// +// This Source Code Form is subject to the terms of the Mozilla +// Public License v. 2.0. If a copy of the MPL was not distributed +// with this file, You can obtain one at http://mozilla.org/MPL/2.0/. + +#ifndef EIGEN_INDEXED_VIEW_H +#define EIGEN_INDEXED_VIEW_H + +namespace Eigen { + +namespace internal { + +template +struct traits > + : traits +{ + enum { + RowsAtCompileTime = int(array_size::value), + ColsAtCompileTime = int(array_size::value), + MaxRowsAtCompileTime = RowsAtCompileTime != Dynamic ? int(RowsAtCompileTime) : Dynamic, + MaxColsAtCompileTime = ColsAtCompileTime != Dynamic ? int(ColsAtCompileTime) : Dynamic, + + XprTypeIsRowMajor = (int(traits::Flags)&RowMajorBit) != 0, + IsRowMajor = (MaxRowsAtCompileTime==1&&MaxColsAtCompileTime!=1) ? 1 + : (MaxColsAtCompileTime==1&&MaxRowsAtCompileTime!=1) ? 0 + : XprTypeIsRowMajor, + + RowIncr = int(get_compile_time_incr::value), + ColIncr = int(get_compile_time_incr::value), + InnerIncr = IsRowMajor ? ColIncr : RowIncr, + OuterIncr = IsRowMajor ? RowIncr : ColIncr, + + HasSameStorageOrderAsXprType = (IsRowMajor == XprTypeIsRowMajor), + XprInnerStride = HasSameStorageOrderAsXprType ? int(inner_stride_at_compile_time::ret) : int(outer_stride_at_compile_time::ret), + XprOuterstride = HasSameStorageOrderAsXprType ? int(outer_stride_at_compile_time::ret) : int(inner_stride_at_compile_time::ret), + + InnerSize = XprTypeIsRowMajor ? ColsAtCompileTime : RowsAtCompileTime, + IsBlockAlike = InnerIncr==1 && OuterIncr==1, + IsInnerPannel = HasSameStorageOrderAsXprType && is_same,typename conditional::type>::value, + + InnerStrideAtCompileTime = InnerIncr<0 || InnerIncr==DynamicIndex || XprInnerStride==Dynamic ? Dynamic : XprInnerStride * InnerIncr, + OuterStrideAtCompileTime = OuterIncr<0 || OuterIncr==DynamicIndex || XprOuterstride==Dynamic ? Dynamic : XprOuterstride * OuterIncr, + + ReturnAsScalar = is_same::value && is_same::value, + ReturnAsBlock = (!ReturnAsScalar) && IsBlockAlike, + ReturnAsIndexedView = (!ReturnAsScalar) && (!ReturnAsBlock), + + // FIXME we deal with compile-time strides if and only if we have DirectAccessBit flag, + // but this is too strict regarding negative strides... + DirectAccessMask = (int(InnerIncr)!=UndefinedIncr && int(OuterIncr)!=UndefinedIncr && InnerIncr>=0 && OuterIncr>=0) ? DirectAccessBit : 0, + FlagsRowMajorBit = IsRowMajor ? RowMajorBit : 0, + FlagsLvalueBit = is_lvalue::value ? LvalueBit : 0, + FlagsLinearAccessBit = (RowsAtCompileTime == 1 || ColsAtCompileTime == 1) ? LinearAccessBit : 0, + Flags = (traits::Flags & (HereditaryBits | DirectAccessMask )) | FlagsLvalueBit | FlagsRowMajorBit | FlagsLinearAccessBit + }; + + typedef Block BlockType; +}; + +} + +template +class IndexedViewImpl; + + +/** \class IndexedView + * \ingroup Core_Module + * + * \brief Expression of a non-sequential sub-matrix defined by arbitrary sequences of row and column indices + * + * \tparam XprType the type of the expression in which we are taking the intersections of sub-rows and sub-columns + * \tparam RowIndices the type of the object defining the sequence of row indices + * \tparam ColIndices the type of the object defining the sequence of column indices + * + * This class represents an expression of a sub-matrix (or sub-vector) defined as the intersection + * of sub-sets of rows and columns, that are themself defined by generic sequences of row indices \f$ \{r_0,r_1,..r_{m-1}\} \f$ + * and column indices \f$ \{c_0,c_1,..c_{n-1} \}\f$. Let \f$ A \f$ be the nested matrix, then the resulting matrix \f$ B \f$ has \c m + * rows and \c n columns, and its entries are given by: \f$ B(i,j) = A(r_i,c_j) \f$. + * + * The \c RowIndices and \c ColIndices types must be compatible with the following API: + * \code + * operator[](Index) const; + * Index size() const; + * \endcode + * + * Typical supported types thus include: + * - std::vector + * - std::valarray + * - std::array + * - Plain C arrays: int[N] + * - Eigen::ArrayXi + * - decltype(ArrayXi::LinSpaced(...)) + * - Any view/expressions of the previous types + * - Eigen::ArithmeticSequence + * - Eigen::internal::AllRange (helper for Eigen::all) + * - Eigen::internal::SingleRange (helper for single index) + * - etc. + * + * In typical usages of %Eigen, this class should never be used directly. It is the return type of + * DenseBase::operator()(const RowIndices&, const ColIndices&). + * + * \sa class Block + */ +template +class IndexedView : public IndexedViewImpl::StorageKind> +{ +public: + typedef typename IndexedViewImpl::StorageKind>::Base Base; + EIGEN_GENERIC_PUBLIC_INTERFACE(IndexedView) + EIGEN_INHERIT_ASSIGNMENT_OPERATORS(IndexedView) + + typedef typename internal::ref_selector::non_const_type MatrixTypeNested; + typedef typename internal::remove_all::type NestedExpression; + + template + IndexedView(XprType& xpr, const T0& rowIndices, const T1& colIndices) + : m_xpr(xpr), m_rowIndices(rowIndices), m_colIndices(colIndices) + {} + + /** \returns number of rows */ + Index rows() const { return internal::size(m_rowIndices); } + + /** \returns number of columns */ + Index cols() const { return internal::size(m_colIndices); } + + /** \returns the nested expression */ + const typename internal::remove_all::type& + nestedExpression() const { return m_xpr; } + + /** \returns the nested expression */ + typename internal::remove_reference::type& + nestedExpression() { return m_xpr; } + + /** \returns a const reference to the object storing/generating the row indices */ + const RowIndices& rowIndices() const { return m_rowIndices; } + + /** \returns a const reference to the object storing/generating the column indices */ + const ColIndices& colIndices() const { return m_colIndices; } + +protected: + MatrixTypeNested m_xpr; + RowIndices m_rowIndices; + ColIndices m_colIndices; +}; + + +// Generic API dispatcher +template +class IndexedViewImpl + : public internal::generic_xpr_base >::type +{ +public: + typedef typename internal::generic_xpr_base >::type Base; +}; + +namespace internal { + + +template +struct unary_evaluator, IndexBased> + : evaluator_base > +{ + typedef IndexedView XprType; + + enum { + CoeffReadCost = evaluator::CoeffReadCost /* TODO + cost of row/col index */, + + FlagsLinearAccessBit = (traits::RowsAtCompileTime == 1 || traits::ColsAtCompileTime == 1) ? LinearAccessBit : 0, + + FlagsRowMajorBit = traits::FlagsRowMajorBit, + + Flags = (evaluator::Flags & (HereditaryBits & ~RowMajorBit /*| LinearAccessBit | DirectAccessBit*/)) | FlagsLinearAccessBit | FlagsRowMajorBit, + + Alignment = 0 + }; + + EIGEN_DEVICE_FUNC explicit unary_evaluator(const XprType& xpr) : m_argImpl(xpr.nestedExpression()), m_xpr(xpr) + { + EIGEN_INTERNAL_CHECK_COST_VALUE(CoeffReadCost); + } + + typedef typename XprType::Scalar Scalar; + typedef typename XprType::CoeffReturnType CoeffReturnType; + + EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE + CoeffReturnType coeff(Index row, Index col) const + { + return m_argImpl.coeff(m_xpr.rowIndices()[row], m_xpr.colIndices()[col]); + } + + EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE + Scalar& coeffRef(Index row, Index col) + { + return m_argImpl.coeffRef(m_xpr.rowIndices()[row], m_xpr.colIndices()[col]); + } + + EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE + Scalar& coeffRef(Index index) + { + EIGEN_STATIC_ASSERT_LVALUE(XprType) + Index row = XprType::RowsAtCompileTime == 1 ? 0 : index; + Index col = XprType::RowsAtCompileTime == 1 ? index : 0; + return m_argImpl.coeffRef( m_xpr.rowIndices()[row], m_xpr.colIndices()[col]); + } + + EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE + const Scalar& coeffRef(Index index) const + { + Index row = XprType::RowsAtCompileTime == 1 ? 0 : index; + Index col = XprType::RowsAtCompileTime == 1 ? index : 0; + return m_argImpl.coeffRef( m_xpr.rowIndices()[row], m_xpr.colIndices()[col]); + } + + EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE + const CoeffReturnType coeff(Index index) const + { + Index row = XprType::RowsAtCompileTime == 1 ? 0 : index; + Index col = XprType::RowsAtCompileTime == 1 ? index : 0; + return m_argImpl.coeff( m_xpr.rowIndices()[row], m_xpr.colIndices()[col]); + } + +protected: + + evaluator m_argImpl; + const XprType& m_xpr; + +}; + +} // end namespace internal + +} // end namespace Eigen + +#endif // EIGEN_INDEXED_VIEW_H diff --git a/extern/eigen/Eigen/src/Core/Inverse.h b/extern/eigen/Eigen/src/Core/Inverse.h new file mode 100644 index 00000000..c514438c --- /dev/null +++ b/extern/eigen/Eigen/src/Core/Inverse.h @@ -0,0 +1,117 @@ +// This file is part of Eigen, a lightweight C++ template library +// for linear algebra. +// +// Copyright (C) 2014-2019 Gael Guennebaud +// +// This Source Code Form is subject to the terms of the Mozilla +// Public License v. 2.0. If a copy of the MPL was not distributed +// with this file, You can obtain one at http://mozilla.org/MPL/2.0/. + +#ifndef EIGEN_INVERSE_H +#define EIGEN_INVERSE_H + +namespace Eigen { + +template class InverseImpl; + +namespace internal { + +template +struct traits > + : traits +{ + typedef typename XprType::PlainObject PlainObject; + typedef traits BaseTraits; + enum { + Flags = BaseTraits::Flags & RowMajorBit + }; +}; + +} // end namespace internal + +/** \class Inverse + * + * \brief Expression of the inverse of another expression + * + * \tparam XprType the type of the expression we are taking the inverse + * + * This class represents an abstract expression of A.inverse() + * and most of the time this is the only way it is used. + * + */ +template +class Inverse : public InverseImpl::StorageKind> +{ +public: + typedef typename XprType::StorageIndex StorageIndex; + typedef typename XprType::Scalar Scalar; + typedef typename internal::ref_selector::type XprTypeNested; + typedef typename internal::remove_all::type XprTypeNestedCleaned; + typedef typename internal::ref_selector::type Nested; + typedef typename internal::remove_all::type NestedExpression; + + explicit EIGEN_DEVICE_FUNC Inverse(const XprType &xpr) + : m_xpr(xpr) + {} + + EIGEN_DEVICE_FUNC EIGEN_CONSTEXPR Index rows() const EIGEN_NOEXCEPT { return m_xpr.cols(); } + EIGEN_DEVICE_FUNC EIGEN_CONSTEXPR Index cols() const EIGEN_NOEXCEPT { return m_xpr.rows(); } + + EIGEN_DEVICE_FUNC const XprTypeNestedCleaned& nestedExpression() const { return m_xpr; } + +protected: + XprTypeNested m_xpr; +}; + +// Generic API dispatcher +template +class InverseImpl + : public internal::generic_xpr_base >::type +{ +public: + typedef typename internal::generic_xpr_base >::type Base; + typedef typename XprType::Scalar Scalar; +private: + + Scalar coeff(Index row, Index col) const; + Scalar coeff(Index i) const; +}; + +namespace internal { + +/** \internal + * \brief Default evaluator for Inverse expression. + * + * This default evaluator for Inverse expression simply evaluate the inverse into a temporary + * by a call to internal::call_assignment_no_alias. + * Therefore, inverse implementers only have to specialize Assignment, ...> for + * there own nested expression. + * + * \sa class Inverse + */ +template +struct unary_evaluator > + : public evaluator::PlainObject> +{ + typedef Inverse InverseType; + typedef typename InverseType::PlainObject PlainObject; + typedef evaluator Base; + + enum { Flags = Base::Flags | EvalBeforeNestingBit }; + + unary_evaluator(const InverseType& inv_xpr) + : m_result(inv_xpr.rows(), inv_xpr.cols()) + { + ::new (static_cast(this)) Base(m_result); + internal::call_assignment_no_alias(m_result, inv_xpr); + } + +protected: + PlainObject m_result; +}; + +} // end namespace internal + +} // end namespace Eigen + +#endif // EIGEN_INVERSE_H diff --git a/extern/eigen/Eigen/src/Core/Map.h b/extern/eigen/Eigen/src/Core/Map.h index f804c89d..218cc157 100644 --- a/extern/eigen/Eigen/src/Core/Map.h +++ b/extern/eigen/Eigen/src/Core/Map.h @@ -11,7 +11,35 @@ #ifndef EIGEN_MAP_H #define EIGEN_MAP_H -namespace Eigen { +namespace Eigen { + +namespace internal { +template +struct traits > + : public traits +{ + typedef traits TraitsBase; + enum { + PlainObjectTypeInnerSize = ((traits::Flags&RowMajorBit)==RowMajorBit) + ? PlainObjectType::ColsAtCompileTime + : PlainObjectType::RowsAtCompileTime, + + InnerStrideAtCompileTime = StrideType::InnerStrideAtCompileTime == 0 + ? int(PlainObjectType::InnerStrideAtCompileTime) + : int(StrideType::InnerStrideAtCompileTime), + OuterStrideAtCompileTime = StrideType::OuterStrideAtCompileTime == 0 + ? (InnerStrideAtCompileTime==Dynamic || PlainObjectTypeInnerSize==Dynamic + ? Dynamic + : int(InnerStrideAtCompileTime) * int(PlainObjectTypeInnerSize)) + : int(StrideType::OuterStrideAtCompileTime), + Alignment = int(MapOptions)&int(AlignedMask), + Flags0 = TraitsBase::Flags & (~NestByRefBit), + Flags = is_lvalue::value ? int(Flags0) : (int(Flags0) & ~LvalueBit) + }; +private: + enum { Options }; // Expressions don't have Options +}; +} /** \class Map * \ingroup Core_Module @@ -19,7 +47,7 @@ namespace Eigen { * \brief A matrix or vector expression mapping an existing array of data. * * \tparam PlainObjectType the equivalent matrix type of the mapped data - * \tparam MapOptions specifies whether the pointer is \c #Aligned, or \c #Unaligned. + * \tparam MapOptions specifies the pointer alignment in bytes. It can be: \c #Aligned128, \c #Aligned64, \c #Aligned32, \c #Aligned16, \c #Aligned8 or \c #Unaligned. * The default is \c #Unaligned. * \tparam StrideType optionally specifies strides. By default, Map assumes the memory layout * of an ordinary, contiguous array. This can be overridden by specifying strides. @@ -63,44 +91,6 @@ namespace Eigen { * * \sa PlainObjectBase::Map(), \ref TopicStorageOrders */ - -namespace internal { -template -struct traits > - : public traits -{ - typedef traits TraitsBase; - typedef typename PlainObjectType::Index Index; - typedef typename PlainObjectType::Scalar Scalar; - enum { - InnerStrideAtCompileTime = StrideType::InnerStrideAtCompileTime == 0 - ? int(PlainObjectType::InnerStrideAtCompileTime) - : int(StrideType::InnerStrideAtCompileTime), - OuterStrideAtCompileTime = StrideType::OuterStrideAtCompileTime == 0 - ? int(PlainObjectType::OuterStrideAtCompileTime) - : int(StrideType::OuterStrideAtCompileTime), - HasNoInnerStride = InnerStrideAtCompileTime == 1, - HasNoOuterStride = StrideType::OuterStrideAtCompileTime == 0, - HasNoStride = HasNoInnerStride && HasNoOuterStride, - IsAligned = bool(EIGEN_ALIGN) && ((int(MapOptions)&Aligned)==Aligned), - IsDynamicSize = PlainObjectType::SizeAtCompileTime==Dynamic, - KeepsPacketAccess = bool(HasNoInnerStride) - && ( bool(IsDynamicSize) - || HasNoOuterStride - || ( OuterStrideAtCompileTime!=Dynamic - && ((static_cast(sizeof(Scalar))*OuterStrideAtCompileTime)%16)==0 ) ), - Flags0 = TraitsBase::Flags & (~NestByRefBit), - Flags1 = IsAligned ? (int(Flags0) | AlignedBit) : (int(Flags0) & ~AlignedBit), - Flags2 = (bool(HasNoStride) || bool(PlainObjectType::IsVectorAtCompileTime)) - ? int(Flags1) : int(Flags1 & ~LinearAccessBit), - Flags3 = is_lvalue::value ? int(Flags2) : (int(Flags2) & ~LvalueBit), - Flags = KeepsPacketAccess ? int(Flags3) : (int(Flags3) & ~PacketAccessBit) - }; -private: - enum { Options }; // Expressions don't have Options -}; -} - template class Map : public MapBase > { @@ -110,34 +100,34 @@ template class Ma EIGEN_DENSE_PUBLIC_INTERFACE(Map) typedef typename Base::PointerType PointerType; -#if EIGEN2_SUPPORT_STAGE <= STAGE30_FULL_EIGEN3_API - typedef const Scalar* PointerArgType; - inline PointerType cast_to_pointer_type(PointerArgType ptr) { return const_cast(ptr); } -#else typedef PointerType PointerArgType; + EIGEN_DEVICE_FUNC inline PointerType cast_to_pointer_type(PointerArgType ptr) { return ptr; } -#endif + EIGEN_DEVICE_FUNC EIGEN_CONSTEXPR inline Index innerStride() const { return StrideType::InnerStrideAtCompileTime != 0 ? m_stride.inner() : 1; } + EIGEN_DEVICE_FUNC EIGEN_CONSTEXPR inline Index outerStride() const { return StrideType::OuterStrideAtCompileTime != 0 ? m_stride.outer() - : IsVectorAtCompileTime ? this->size() - : int(Flags)&RowMajorBit ? this->cols() - : this->rows(); + : internal::traits::OuterStrideAtCompileTime != Dynamic ? Index(internal::traits::OuterStrideAtCompileTime) + : IsVectorAtCompileTime ? (this->size() * innerStride()) + : int(Flags)&RowMajorBit ? (this->cols() * innerStride()) + : (this->rows() * innerStride()); } /** Constructor in the fixed-size case. * * \param dataPtr pointer to the array to map - * \param a_stride optional Stride object, passing the strides. + * \param stride optional Stride object, passing the strides. */ - inline Map(PointerArgType dataPtr, const StrideType& a_stride = StrideType()) - : Base(cast_to_pointer_type(dataPtr)), m_stride(a_stride) + EIGEN_DEVICE_FUNC + explicit inline Map(PointerArgType dataPtr, const StrideType& stride = StrideType()) + : Base(cast_to_pointer_type(dataPtr)), m_stride(stride) { PlainObjectType::Base::_check_template_params(); } @@ -145,11 +135,12 @@ template class Ma /** Constructor in the dynamic-size vector case. * * \param dataPtr pointer to the array to map - * \param a_size the size of the vector expression - * \param a_stride optional Stride object, passing the strides. + * \param size the size of the vector expression + * \param stride optional Stride object, passing the strides. */ - inline Map(PointerArgType dataPtr, Index a_size, const StrideType& a_stride = StrideType()) - : Base(cast_to_pointer_type(dataPtr), a_size), m_stride(a_stride) + EIGEN_DEVICE_FUNC + inline Map(PointerArgType dataPtr, Index size, const StrideType& stride = StrideType()) + : Base(cast_to_pointer_type(dataPtr), size), m_stride(stride) { PlainObjectType::Base::_check_template_params(); } @@ -157,12 +148,13 @@ template class Ma /** Constructor in the dynamic-size matrix case. * * \param dataPtr pointer to the array to map - * \param nbRows the number of rows of the matrix expression - * \param nbCols the number of columns of the matrix expression - * \param a_stride optional Stride object, passing the strides. + * \param rows the number of rows of the matrix expression + * \param cols the number of columns of the matrix expression + * \param stride optional Stride object, passing the strides. */ - inline Map(PointerArgType dataPtr, Index nbRows, Index nbCols, const StrideType& a_stride = StrideType()) - : Base(cast_to_pointer_type(dataPtr), nbRows, nbCols), m_stride(a_stride) + EIGEN_DEVICE_FUNC + inline Map(PointerArgType dataPtr, Index rows, Index cols, const StrideType& stride = StrideType()) + : Base(cast_to_pointer_type(dataPtr), rows, cols), m_stride(stride) { PlainObjectType::Base::_check_template_params(); } @@ -173,19 +165,6 @@ template class Ma StrideType m_stride; }; -template -inline Array<_Scalar, _Rows, _Cols, _Options, _MaxRows, _MaxCols> - ::Array(const Scalar *data) -{ - this->_set_noalias(Eigen::Map(data)); -} - -template -inline Matrix<_Scalar, _Rows, _Cols, _Options, _MaxRows, _MaxCols> - ::Matrix(const Scalar *data) -{ - this->_set_noalias(Eigen::Map(data)); -} } // end namespace Eigen diff --git a/extern/eigen/Eigen/src/Core/MapBase.h b/extern/eigen/Eigen/src/Core/MapBase.h index a9828f7f..d856447f 100644 --- a/extern/eigen/Eigen/src/Core/MapBase.h +++ b/extern/eigen/Eigen/src/Core/MapBase.h @@ -12,15 +12,25 @@ #define EIGEN_MAPBASE_H #define EIGEN_STATIC_ASSERT_INDEX_BASED_ACCESS(Derived) \ - EIGEN_STATIC_ASSERT((int(internal::traits::Flags) & LinearAccessBit) || Derived::IsVectorAtCompileTime, \ + EIGEN_STATIC_ASSERT((int(internal::evaluator::Flags) & LinearAccessBit) || Derived::IsVectorAtCompileTime, \ YOU_ARE_TRYING_TO_USE_AN_INDEX_BASED_ACCESSOR_ON_AN_EXPRESSION_THAT_DOES_NOT_SUPPORT_THAT) -namespace Eigen { +namespace Eigen { -/** \class MapBase - * \ingroup Core_Module +/** \ingroup Core_Module * - * \brief Base class for Map and Block expression with direct access + * \brief Base class for dense Map and Block expression with direct access + * + * This base class provides the const low-level accessors (e.g. coeff, coeffRef) of dense + * Map and Block objects with direct access. + * Typical users do not have to directly deal with this class. + * + * This class can be extended by through the macro plugin \c EIGEN_MAPBASE_PLUGIN. + * See \link TopicCustomizing_Plugins customizing Eigen \endlink for details. + * + * The \c Derived class has to provide the following two methods describing the memory layout: + * \code Index innerStride() const; \endcode + * \code Index outerStride() const; \endcode * * \sa class Map, class Block */ @@ -33,11 +43,11 @@ template class MapBase enum { RowsAtCompileTime = internal::traits::RowsAtCompileTime, ColsAtCompileTime = internal::traits::ColsAtCompileTime, + InnerStrideAtCompileTime = internal::traits::InnerStrideAtCompileTime, SizeAtCompileTime = Base::SizeAtCompileTime }; typedef typename internal::traits::StorageKind StorageKind; - typedef typename internal::traits::Index Index; typedef typename internal::traits::Scalar Scalar; typedef typename internal::packet_traits::type PacketScalar; typedef typename NumTraits::Real RealScalar; @@ -76,8 +86,12 @@ template class MapBase typedef typename Base::CoeffReturnType CoeffReturnType; - inline Index rows() const { return m_rows.value(); } - inline Index cols() const { return m_cols.value(); } + /** \copydoc DenseBase::rows() */ + EIGEN_DEVICE_FUNC EIGEN_CONSTEXPR + inline Index rows() const EIGEN_NOEXCEPT { return m_rows.value(); } + /** \copydoc DenseBase::cols() */ + EIGEN_DEVICE_FUNC EIGEN_CONSTEXPR + inline Index cols() const EIGEN_NOEXCEPT { return m_cols.value(); } /** Returns a pointer to the first coefficient of the matrix or vector. * @@ -85,30 +99,39 @@ template class MapBase * * \sa innerStride(), outerStride() */ - inline const Scalar* data() const { return m_data; } + EIGEN_DEVICE_FUNC inline const Scalar* data() const { return m_data; } + /** \copydoc PlainObjectBase::coeff(Index,Index) const */ + EIGEN_DEVICE_FUNC inline const Scalar& coeff(Index rowId, Index colId) const { return m_data[colId * colStride() + rowId * rowStride()]; } + /** \copydoc PlainObjectBase::coeff(Index) const */ + EIGEN_DEVICE_FUNC inline const Scalar& coeff(Index index) const { EIGEN_STATIC_ASSERT_INDEX_BASED_ACCESS(Derived) return m_data[index * innerStride()]; } + /** \copydoc PlainObjectBase::coeffRef(Index,Index) const */ + EIGEN_DEVICE_FUNC inline const Scalar& coeffRef(Index rowId, Index colId) const { return this->m_data[colId * colStride() + rowId * rowStride()]; } + /** \copydoc PlainObjectBase::coeffRef(Index) const */ + EIGEN_DEVICE_FUNC inline const Scalar& coeffRef(Index index) const { EIGEN_STATIC_ASSERT_INDEX_BASED_ACCESS(Derived) return this->m_data[index * innerStride()]; } + /** \internal */ template inline PacketScalar packet(Index rowId, Index colId) const { @@ -116,6 +139,7 @@ template class MapBase (m_data + (colId * colStride() + rowId * rowStride())); } + /** \internal */ template inline PacketScalar packet(Index index) const { @@ -123,12 +147,16 @@ template class MapBase return internal::ploadt(m_data + index * innerStride()); } + /** \internal Constructor for fixed size matrices or vectors */ + EIGEN_DEVICE_FUNC explicit inline MapBase(PointerType dataPtr) : m_data(dataPtr), m_rows(RowsAtCompileTime), m_cols(ColsAtCompileTime) { EIGEN_STATIC_ASSERT_FIXED_SIZE(Derived) - checkSanity(); + checkSanity(); } + /** \internal Constructor for dynamically sized vectors */ + EIGEN_DEVICE_FUNC inline MapBase(PointerType dataPtr, Index vecSize) : m_data(dataPtr), m_rows(RowsAtCompileTime == Dynamic ? vecSize : Index(RowsAtCompileTime)), @@ -137,34 +165,61 @@ template class MapBase EIGEN_STATIC_ASSERT_VECTOR_ONLY(Derived) eigen_assert(vecSize >= 0); eigen_assert(dataPtr == 0 || SizeAtCompileTime == Dynamic || SizeAtCompileTime == vecSize); - checkSanity(); + checkSanity(); } - inline MapBase(PointerType dataPtr, Index nbRows, Index nbCols) - : m_data(dataPtr), m_rows(nbRows), m_cols(nbCols) + /** \internal Constructor for dynamically sized matrices */ + EIGEN_DEVICE_FUNC + inline MapBase(PointerType dataPtr, Index rows, Index cols) + : m_data(dataPtr), m_rows(rows), m_cols(cols) { eigen_assert( (dataPtr == 0) - || ( nbRows >= 0 && (RowsAtCompileTime == Dynamic || RowsAtCompileTime == nbRows) - && nbCols >= 0 && (ColsAtCompileTime == Dynamic || ColsAtCompileTime == nbCols))); - checkSanity(); + || ( rows >= 0 && (RowsAtCompileTime == Dynamic || RowsAtCompileTime == rows) + && cols >= 0 && (ColsAtCompileTime == Dynamic || ColsAtCompileTime == cols))); + checkSanity(); } + #ifdef EIGEN_MAPBASE_PLUGIN + #include EIGEN_MAPBASE_PLUGIN + #endif + protected: + EIGEN_DEFAULT_COPY_CONSTRUCTOR(MapBase) + EIGEN_DEFAULT_EMPTY_CONSTRUCTOR_AND_DESTRUCTOR(MapBase) - void checkSanity() const + template + EIGEN_DEVICE_FUNC + void checkSanity(typename internal::enable_if<(internal::traits::Alignment>0),void*>::type = 0) const { - EIGEN_STATIC_ASSERT(EIGEN_IMPLIES(internal::traits::Flags&PacketAccessBit, - internal::inner_stride_at_compile_time::ret==1), - PACKET_ACCESS_REQUIRES_TO_HAVE_INNER_STRIDE_FIXED_TO_1); - eigen_assert(EIGEN_IMPLIES(internal::traits::Flags&AlignedBit, (size_t(m_data) % 16) == 0) - && "input pointer is not aligned on a 16 byte boundary"); +#if EIGEN_MAX_ALIGN_BYTES>0 + // innerStride() is not set yet when this function is called, so we optimistically assume the lowest plausible value: + const Index minInnerStride = InnerStrideAtCompileTime == Dynamic ? 1 : Index(InnerStrideAtCompileTime); + EIGEN_ONLY_USED_FOR_DEBUG(minInnerStride); + eigen_assert(( ((internal::UIntPtr(m_data) % internal::traits::Alignment) == 0) + || (cols() * rows() * minInnerStride * sizeof(Scalar)) < internal::traits::Alignment ) && "data is not aligned"); +#endif } + template + EIGEN_DEVICE_FUNC + void checkSanity(typename internal::enable_if::Alignment==0,void*>::type = 0) const + {} + PointerType m_data; const internal::variable_if_dynamic m_rows; const internal::variable_if_dynamic m_cols; }; +/** \ingroup Core_Module + * + * \brief Base class for non-const dense Map and Block expression with direct access + * + * This base class provides the non-const low-level accessors (e.g. coeff and coeffRef) of + * dense Map and Block objects with direct access. + * It inherits MapBase which defines the const variant for reading specific entries. + * + * \sa class Map, class Block + */ template class MapBase : public MapBase { @@ -175,7 +230,7 @@ template class MapBase typedef typename Base::Scalar Scalar; typedef typename Base::PacketScalar PacketScalar; - typedef typename Base::Index Index; + typedef typename Base::StorageIndex StorageIndex; typedef typename Base::PointerType PointerType; using Base::derived; @@ -196,14 +251,18 @@ template class MapBase const Scalar >::type ScalarWithConstIfNotLvalue; + EIGEN_DEVICE_FUNC inline const Scalar* data() const { return this->m_data; } + EIGEN_DEVICE_FUNC inline ScalarWithConstIfNotLvalue* data() { return this->m_data; } // no const-cast here so non-const-correct code will give a compile error + EIGEN_DEVICE_FUNC inline ScalarWithConstIfNotLvalue& coeffRef(Index row, Index col) { return this->m_data[col * colStride() + row * rowStride()]; } + EIGEN_DEVICE_FUNC inline ScalarWithConstIfNotLvalue& coeffRef(Index index) { EIGEN_STATIC_ASSERT_INDEX_BASED_ACCESS(Derived) @@ -225,10 +284,11 @@ template class MapBase (this->m_data + index * innerStride(), val); } - explicit inline MapBase(PointerType dataPtr) : Base(dataPtr) {} - inline MapBase(PointerType dataPtr, Index vecSize) : Base(dataPtr, vecSize) {} - inline MapBase(PointerType dataPtr, Index nbRows, Index nbCols) : Base(dataPtr, nbRows, nbCols) {} + EIGEN_DEVICE_FUNC explicit inline MapBase(PointerType dataPtr) : Base(dataPtr) {} + EIGEN_DEVICE_FUNC inline MapBase(PointerType dataPtr, Index vecSize) : Base(dataPtr, vecSize) {} + EIGEN_DEVICE_FUNC inline MapBase(PointerType dataPtr, Index rows, Index cols) : Base(dataPtr, rows, cols) {} + EIGEN_DEVICE_FUNC Derived& operator=(const MapBase& other) { ReadOnlyMapBase::Base::operator=(other); @@ -238,6 +298,9 @@ template class MapBase // In theory we could simply refer to Base:Base::operator=, but MSVC does not like Base::Base, // see bugs 821 and 920. using ReadOnlyMapBase::Base::operator=; + protected: + EIGEN_DEFAULT_COPY_CONSTRUCTOR(MapBase) + EIGEN_DEFAULT_EMPTY_CONSTRUCTOR_AND_DESTRUCTOR(MapBase) }; #undef EIGEN_STATIC_ASSERT_INDEX_BASED_ACCESS diff --git a/extern/eigen/Eigen/src/Core/MathFunctions.h b/extern/eigen/Eigen/src/Core/MathFunctions.h index adf2f9c5..61b78f4f 100644 --- a/extern/eigen/Eigen/src/Core/MathFunctions.h +++ b/extern/eigen/Eigen/src/Core/MathFunctions.h @@ -2,6 +2,7 @@ // for linear algebra. // // Copyright (C) 2006-2010 Benoit Jacob +// Copyright (c) 2021, NVIDIA CORPORATION. All rights reserved. // // This Source Code Form is subject to the terms of the Mozilla // Public License v. 2.0. If a copy of the MPL was not distributed @@ -10,11 +11,26 @@ #ifndef EIGEN_MATHFUNCTIONS_H #define EIGEN_MATHFUNCTIONS_H +// TODO this should better be moved to NumTraits +// Source: WolframAlpha +#define EIGEN_PI 3.141592653589793238462643383279502884197169399375105820974944592307816406L +#define EIGEN_LOG2E 1.442695040888963407359924681001892137426645954152985934135449406931109219L +#define EIGEN_LN2 0.693147180559945309417232121458176568075500134360255254120680009493393621L + namespace Eigen { +// On WINCE, std::abs is defined for int only, so let's defined our own overloads: +// This issue has been confirmed with MSVC 2008 only, but the issue might exist for more recent versions too. +#if EIGEN_OS_WINCE && EIGEN_COMP_MSVC && EIGEN_COMP_MSVC<=1500 +long abs(long x) { return (labs(x)); } +double abs(double x) { return (fabs(x)); } +float abs(float x) { return (fabsf(x)); } +long double abs(long double x) { return (fabsl(x)); } +#endif + namespace internal { -/** \internal \struct global_math_functions_filtering_base +/** \internal \class global_math_functions_filtering_base * * What it does: * Defines a typedef 'type' as follows: @@ -62,6 +78,7 @@ template::IsComplex> struct real_default_impl { typedef typename NumTraits::Real RealScalar; + EIGEN_DEVICE_FUNC static inline RealScalar run(const Scalar& x) { return x; @@ -72,6 +89,7 @@ template struct real_default_impl { typedef typename NumTraits::Real RealScalar; + EIGEN_DEVICE_FUNC static inline RealScalar run(const Scalar& x) { using std::real; @@ -81,13 +99,25 @@ struct real_default_impl template struct real_impl : real_default_impl {}; +#if defined(EIGEN_GPU_COMPILE_PHASE) +template +struct real_impl > +{ + typedef T RealScalar; + EIGEN_DEVICE_FUNC + static inline T run(const std::complex& x) + { + return x.real(); + } +}; +#endif + template struct real_retval { typedef typename NumTraits::Real type; }; - /**************************************************************************** * Implementation of imag * ****************************************************************************/ @@ -96,6 +126,7 @@ template::IsComplex> struct imag_default_impl { typedef typename NumTraits::Real RealScalar; + EIGEN_DEVICE_FUNC static inline RealScalar run(const Scalar&) { return RealScalar(0); @@ -106,6 +137,7 @@ template struct imag_default_impl { typedef typename NumTraits::Real RealScalar; + EIGEN_DEVICE_FUNC static inline RealScalar run(const Scalar& x) { using std::imag; @@ -115,6 +147,19 @@ struct imag_default_impl template struct imag_impl : imag_default_impl {}; +#if defined(EIGEN_GPU_COMPILE_PHASE) +template +struct imag_impl > +{ + typedef T RealScalar; + EIGEN_DEVICE_FUNC + static inline T run(const std::complex& x) + { + return x.imag(); + } +}; +#endif + template struct imag_retval { @@ -129,10 +174,12 @@ template struct real_ref_impl { typedef typename NumTraits::Real RealScalar; + EIGEN_DEVICE_FUNC static inline RealScalar& run(Scalar& x) { return reinterpret_cast(&x)[0]; } + EIGEN_DEVICE_FUNC static inline const RealScalar& run(const Scalar& x) { return reinterpret_cast(&x)[0]; @@ -153,10 +200,12 @@ template struct imag_ref_default_impl { typedef typename NumTraits::Real RealScalar; + EIGEN_DEVICE_FUNC static inline RealScalar& run(Scalar& x) { return reinterpret_cast(&x)[1]; } + EIGEN_DEVICE_FUNC static inline const RealScalar& run(const Scalar& x) { return reinterpret_cast(&x)[1]; @@ -166,10 +215,12 @@ struct imag_ref_default_impl template struct imag_ref_default_impl { + EIGEN_DEVICE_FUNC EIGEN_CONSTEXPR static inline Scalar run(Scalar&) { return Scalar(0); } + EIGEN_DEVICE_FUNC EIGEN_CONSTEXPR static inline const Scalar run(const Scalar&) { return Scalar(0); @@ -190,8 +241,9 @@ struct imag_ref_retval ****************************************************************************/ template::IsComplex> -struct conj_impl +struct conj_default_impl { + EIGEN_DEVICE_FUNC static inline Scalar run(const Scalar& x) { return x; @@ -199,8 +251,9 @@ struct conj_impl }; template -struct conj_impl +struct conj_default_impl { + EIGEN_DEVICE_FUNC static inline Scalar run(const Scalar& x) { using std::conj; @@ -208,6 +261,9 @@ struct conj_impl } }; +template::IsComplex> +struct conj_impl : conj_default_impl {}; + template struct conj_retval { @@ -218,22 +274,36 @@ struct conj_retval * Implementation of abs2 * ****************************************************************************/ -template -struct abs2_impl +template +struct abs2_impl_default { typedef typename NumTraits::Real RealScalar; + EIGEN_DEVICE_FUNC static inline RealScalar run(const Scalar& x) { return x*x; } }; -template -struct abs2_impl > +template +struct abs2_impl_default // IsComplex +{ + typedef typename NumTraits::Real RealScalar; + EIGEN_DEVICE_FUNC + static inline RealScalar run(const Scalar& x) + { + return x.real()*x.real() + x.imag()*x.imag(); + } +}; + +template +struct abs2_impl { - static inline RealScalar run(const std::complex& x) + typedef typename NumTraits::Real RealScalar; + EIGEN_DEVICE_FUNC + static inline RealScalar run(const Scalar& x) { - return real(x)*real(x) + imag(x)*imag(x); + return abs2_impl_default::IsComplex>::run(x); } }; @@ -243,27 +313,91 @@ struct abs2_retval typedef typename NumTraits::Real type; }; +/**************************************************************************** +* Implementation of sqrt/rsqrt * +****************************************************************************/ + +template +struct sqrt_impl +{ + EIGEN_DEVICE_FUNC + static EIGEN_ALWAYS_INLINE Scalar run(const Scalar& x) + { + EIGEN_USING_STD(sqrt); + return sqrt(x); + } +}; + +// Complex sqrt defined in MathFunctionsImpl.h. +template EIGEN_DEVICE_FUNC std::complex complex_sqrt(const std::complex& a_x); + +// Custom implementation is faster than `std::sqrt`, works on +// GPU, and correctly handles special cases (unlike MSVC). +template +struct sqrt_impl > +{ + EIGEN_DEVICE_FUNC + static EIGEN_ALWAYS_INLINE std::complex run(const std::complex& x) + { + return complex_sqrt(x); + } +}; + +template +struct sqrt_retval +{ + typedef Scalar type; +}; + +// Default implementation relies on numext::sqrt, at bottom of file. +template +struct rsqrt_impl; + +// Complex rsqrt defined in MathFunctionsImpl.h. +template EIGEN_DEVICE_FUNC std::complex complex_rsqrt(const std::complex& a_x); + +template +struct rsqrt_impl > +{ + EIGEN_DEVICE_FUNC + static EIGEN_ALWAYS_INLINE std::complex run(const std::complex& x) + { + return complex_rsqrt(x); + } +}; + +template +struct rsqrt_retval +{ + typedef Scalar type; +}; + /**************************************************************************** * Implementation of norm1 * ****************************************************************************/ template -struct norm1_default_impl +struct norm1_default_impl; + +template +struct norm1_default_impl { typedef typename NumTraits::Real RealScalar; + EIGEN_DEVICE_FUNC static inline RealScalar run(const Scalar& x) { - using std::abs; - return abs(real(x)) + abs(imag(x)); + EIGEN_USING_STD(abs); + return abs(x.real()) + abs(x.imag()); } }; template struct norm1_default_impl { + EIGEN_DEVICE_FUNC static inline Scalar run(const Scalar& x) { - using std::abs; + EIGEN_USING_STD(abs); return abs(x); } }; @@ -281,25 +415,7 @@ struct norm1_retval * Implementation of hypot * ****************************************************************************/ -template -struct hypot_impl -{ - typedef typename NumTraits::Real RealScalar; - static inline RealScalar run(const Scalar& x, const Scalar& y) - { - using std::max; - using std::min; - using std::abs; - using std::sqrt; - RealScalar _x = abs(x); - RealScalar _y = abs(y); - RealScalar p = (max)(_x, _y); - if(p==RealScalar(0)) return RealScalar(0); - RealScalar q = (min)(_x, _y); - RealScalar qp = q/p; - return p * sqrt(RealScalar(1) + qp*qp); - } -}; +template struct hypot_impl; template struct hypot_retval @@ -311,60 +427,339 @@ struct hypot_retval * Implementation of cast * ****************************************************************************/ -template +template struct cast_impl { + EIGEN_DEVICE_FUNC static inline NewType run(const OldType& x) { return static_cast(x); } }; +// Casting from S -> Complex leads to an implicit conversion from S to T, +// generating warnings on clang. Here we explicitly cast the real component. +template +struct cast_impl::IsComplex && NumTraits::IsComplex + >::type> +{ + EIGEN_DEVICE_FUNC + static inline NewType run(const OldType& x) + { + typedef typename NumTraits::Real NewReal; + return static_cast(static_cast(x)); + } +}; + // here, for once, we're plainly returning NewType: we don't want cast to do weird things. template +EIGEN_DEVICE_FUNC inline NewType cast(const OldType& x) { return cast_impl::run(x); } /**************************************************************************** -* Implementation of atanh2 * +* Implementation of round * +****************************************************************************/ + +template +struct round_impl +{ + EIGEN_DEVICE_FUNC + static inline Scalar run(const Scalar& x) + { + EIGEN_STATIC_ASSERT((!NumTraits::IsComplex), NUMERIC_TYPE_MUST_BE_REAL) +#if EIGEN_HAS_CXX11_MATH + EIGEN_USING_STD(round); +#endif + return Scalar(round(x)); + } +}; + +#if !EIGEN_HAS_CXX11_MATH +#if EIGEN_HAS_C99_MATH +// Use ::roundf for float. +template<> +struct round_impl { + EIGEN_DEVICE_FUNC + static inline float run(const float& x) + { + return ::roundf(x); + } +}; +#else +template +struct round_using_floor_ceil_impl +{ + EIGEN_DEVICE_FUNC + static inline Scalar run(const Scalar& x) + { + EIGEN_STATIC_ASSERT((!NumTraits::IsComplex), NUMERIC_TYPE_MUST_BE_REAL) + // Without C99 round/roundf, resort to floor/ceil. + EIGEN_USING_STD(floor); + EIGEN_USING_STD(ceil); + // If not enough precision to resolve a decimal at all, return the input. + // Otherwise, adding 0.5 can trigger an increment by 1. + const Scalar limit = Scalar(1ull << (NumTraits::digits() - 1)); + if (x >= limit || x <= -limit) { + return x; + } + return (x > Scalar(0)) ? Scalar(floor(x + Scalar(0.5))) : Scalar(ceil(x - Scalar(0.5))); + } +}; + +template<> +struct round_impl : round_using_floor_ceil_impl {}; + +template<> +struct round_impl : round_using_floor_ceil_impl {}; +#endif // EIGEN_HAS_C99_MATH +#endif // !EIGEN_HAS_CXX11_MATH + +template +struct round_retval +{ + typedef Scalar type; +}; + +/**************************************************************************** +* Implementation of rint * +****************************************************************************/ + +template +struct rint_impl { + EIGEN_DEVICE_FUNC + static inline Scalar run(const Scalar& x) + { + EIGEN_STATIC_ASSERT((!NumTraits::IsComplex), NUMERIC_TYPE_MUST_BE_REAL) +#if EIGEN_HAS_CXX11_MATH + EIGEN_USING_STD(rint); +#endif + return rint(x); + } +}; + +#if !EIGEN_HAS_CXX11_MATH +template<> +struct rint_impl { + EIGEN_DEVICE_FUNC + static inline double run(const double& x) + { + return ::rint(x); + } +}; +template<> +struct rint_impl { + EIGEN_DEVICE_FUNC + static inline float run(const float& x) + { + return ::rintf(x); + } +}; +#endif + +template +struct rint_retval +{ + typedef Scalar type; +}; + +/**************************************************************************** +* Implementation of arg * ****************************************************************************/ -template -struct atanh2_default_impl +// Visual Studio 2017 has a bug where arg(float) returns 0 for negative inputs. +// This seems to be fixed in VS 2019. +#if EIGEN_HAS_CXX11_MATH && (!EIGEN_COMP_MSVC || EIGEN_COMP_MSVC >= 1920) +// std::arg is only defined for types of std::complex, or integer types or float/double/long double +template::IsComplex || is_integral::value + || is_same::value || is_same::value + || is_same::value > +struct arg_default_impl; + +template +struct arg_default_impl { + typedef typename NumTraits::Real RealScalar; + EIGEN_DEVICE_FUNC + static inline RealScalar run(const Scalar& x) + { + #if defined(EIGEN_HIP_DEVICE_COMPILE) + // HIP does not seem to have a native device side implementation for the math routine "arg" + using std::arg; + #else + EIGEN_USING_STD(arg); + #endif + return static_cast(arg(x)); + } +}; + +// Must be non-complex floating-point type (e.g. half/bfloat16). +template +struct arg_default_impl { + typedef typename NumTraits::Real RealScalar; + EIGEN_DEVICE_FUNC + static inline RealScalar run(const Scalar& x) + { + return (x < Scalar(0)) ? RealScalar(EIGEN_PI) : RealScalar(0); + } +}; +#else +template::IsComplex> +struct arg_default_impl { - typedef Scalar retval; typedef typename NumTraits::Real RealScalar; - static inline Scalar run(const Scalar& x, const Scalar& y) + EIGEN_DEVICE_FUNC + static inline RealScalar run(const Scalar& x) + { + return (x < RealScalar(0)) ? RealScalar(EIGEN_PI) : RealScalar(0); + } +}; + +template +struct arg_default_impl +{ + typedef typename NumTraits::Real RealScalar; + EIGEN_DEVICE_FUNC + static inline RealScalar run(const Scalar& x) { - using std::abs; - using std::log; - using std::sqrt; - Scalar z = x / y; - if (y == Scalar(0) || abs(z) > sqrt(NumTraits::epsilon())) - return RealScalar(0.5) * log((y + x) / (y - x)); - else - return z + z*z*z / RealScalar(3); + EIGEN_USING_STD(arg); + return arg(x); } }; +#endif +template struct arg_impl : arg_default_impl {}; template -struct atanh2_default_impl +struct arg_retval { - static inline Scalar run(const Scalar&, const Scalar&) + typedef typename NumTraits::Real type; +}; + +/**************************************************************************** +* Implementation of expm1 * +****************************************************************************/ + +// This implementation is based on GSL Math's expm1. +namespace std_fallback { + // fallback expm1 implementation in case there is no expm1(Scalar) function in namespace of Scalar, + // or that there is no suitable std::expm1 function available. Implementation + // attributed to Kahan. See: http://www.plunk.org/~hatch/rightway.php. + template + EIGEN_DEVICE_FUNC inline Scalar expm1(const Scalar& x) { + EIGEN_STATIC_ASSERT_NON_INTEGER(Scalar) + typedef typename NumTraits::Real RealScalar; + + EIGEN_USING_STD(exp); + Scalar u = exp(x); + if (numext::equal_strict(u, Scalar(1))) { + return x; + } + Scalar um1 = u - RealScalar(1); + if (numext::equal_strict(um1, Scalar(-1))) { + return RealScalar(-1); + } + + EIGEN_USING_STD(log); + Scalar logu = log(u); + return numext::equal_strict(u, logu) ? u : (u - RealScalar(1)) * x / logu; + } +} + +template +struct expm1_impl { + EIGEN_DEVICE_FUNC static inline Scalar run(const Scalar& x) { EIGEN_STATIC_ASSERT_NON_INTEGER(Scalar) - return Scalar(0); + #if EIGEN_HAS_CXX11_MATH + using std::expm1; + #else + using std_fallback::expm1; + #endif + return expm1(x); + } +}; + +template +struct expm1_retval +{ + typedef Scalar type; +}; + +/**************************************************************************** +* Implementation of log * +****************************************************************************/ + +// Complex log defined in MathFunctionsImpl.h. +template EIGEN_DEVICE_FUNC std::complex complex_log(const std::complex& z); + +template +struct log_impl { + EIGEN_DEVICE_FUNC static inline Scalar run(const Scalar& x) + { + EIGEN_USING_STD(log); + return static_cast(log(x)); + } +}; + +template +struct log_impl > { + EIGEN_DEVICE_FUNC static inline std::complex run(const std::complex& z) + { + return complex_log(z); } }; +/**************************************************************************** +* Implementation of log1p * +****************************************************************************/ + +namespace std_fallback { + // fallback log1p implementation in case there is no log1p(Scalar) function in namespace of Scalar, + // or that there is no suitable std::log1p function available + template + EIGEN_DEVICE_FUNC inline Scalar log1p(const Scalar& x) { + EIGEN_STATIC_ASSERT_NON_INTEGER(Scalar) + typedef typename NumTraits::Real RealScalar; + EIGEN_USING_STD(log); + Scalar x1p = RealScalar(1) + x; + Scalar log_1p = log_impl::run(x1p); + const bool is_small = numext::equal_strict(x1p, Scalar(1)); + const bool is_inf = numext::equal_strict(x1p, log_1p); + return (is_small || is_inf) ? x : x * (log_1p / (x1p - RealScalar(1))); + } +} + template -struct atanh2_impl : atanh2_default_impl::IsInteger> {}; +struct log1p_impl { + EIGEN_DEVICE_FUNC static inline Scalar run(const Scalar& x) + { + EIGEN_STATIC_ASSERT_NON_INTEGER(Scalar) + #if EIGEN_HAS_CXX11_MATH + using std::log1p; + #else + using std_fallback::log1p; + #endif + return log1p(x); + } +}; + +// Specialization for complex types that are not supported by std::log1p. +template +struct log1p_impl > { + EIGEN_DEVICE_FUNC static inline std::complex run( + const std::complex& x) { + EIGEN_STATIC_ASSERT_NON_INTEGER(RealScalar) + return std_fallback::log1p(x); + } +}; template -struct atanh2_retval +struct log1p_retval { typedef Scalar type; }; @@ -373,24 +768,26 @@ struct atanh2_retval * Implementation of pow * ****************************************************************************/ -template -struct pow_default_impl +template::IsInteger&&NumTraits::IsInteger> +struct pow_impl { - typedef Scalar retval; - static inline Scalar run(const Scalar& x, const Scalar& y) + //typedef Scalar retval; + typedef typename ScalarBinaryOpTraits >::ReturnType result_type; + static EIGEN_DEVICE_FUNC inline result_type run(const ScalarX& x, const ScalarY& y) { - using std::pow; + EIGEN_USING_STD(pow); return pow(x, y); } }; -template -struct pow_default_impl +template +struct pow_impl { - static inline Scalar run(Scalar x, Scalar y) + typedef ScalarX result_type; + static EIGEN_DEVICE_FUNC inline ScalarX run(ScalarX x, ScalarY y) { - Scalar res(1); - eigen_assert(!NumTraits::IsSigned || y >= 0); + ScalarX res(1); + eigen_assert(!NumTraits::IsSigned || y >= 0); if(y & 1) res *= x; y >>= 1; while(y) @@ -403,15 +800,6 @@ struct pow_default_impl } }; -template -struct pow_impl : pow_default_impl::IsInteger> {}; - -template -struct pow_retval -{ - typedef Scalar type; -}; - /**************************************************************************** * Implementation of random * ****************************************************************************/ @@ -447,48 +835,48 @@ struct random_default_impl }; enum { - floor_log2_terminate, - floor_log2_move_up, - floor_log2_move_down, - floor_log2_bogus + meta_floor_log2_terminate, + meta_floor_log2_move_up, + meta_floor_log2_move_down, + meta_floor_log2_bogus }; -template struct floor_log2_selector +template struct meta_floor_log2_selector { enum { middle = (lower + upper) / 2, - value = (upper <= lower + 1) ? int(floor_log2_terminate) - : (n < (1 << middle)) ? int(floor_log2_move_down) - : (n==0) ? int(floor_log2_bogus) - : int(floor_log2_move_up) + value = (upper <= lower + 1) ? int(meta_floor_log2_terminate) + : (n < (1 << middle)) ? int(meta_floor_log2_move_down) + : (n==0) ? int(meta_floor_log2_bogus) + : int(meta_floor_log2_move_up) }; }; template::value> -struct floor_log2 {}; + int selector = meta_floor_log2_selector::value> +struct meta_floor_log2 {}; template -struct floor_log2 +struct meta_floor_log2 { - enum { value = floor_log2::middle>::value }; + enum { value = meta_floor_log2::middle>::value }; }; template -struct floor_log2 +struct meta_floor_log2 { - enum { value = floor_log2::middle, upper>::value }; + enum { value = meta_floor_log2::middle, upper>::value }; }; template -struct floor_log2 +struct meta_floor_log2 { enum { value = (n >= ((unsigned int)(1) << (lower+1))) ? lower+1 : lower }; }; template -struct floor_log2 +struct meta_floor_log2 { // no value, error at compile time }; @@ -496,11 +884,31 @@ struct floor_log2 template struct random_default_impl { - typedef typename NumTraits::NonInteger NonInteger; - static inline Scalar run(const Scalar& x, const Scalar& y) { - return x + Scalar((NonInteger(y)-x+1) * std::rand() / (RAND_MAX + NonInteger(1))); + if (y <= x) + return x; + // ScalarU is the unsigned counterpart of Scalar, possibly Scalar itself. + typedef typename make_unsigned::type ScalarU; + // ScalarX is the widest of ScalarU and unsigned int. + // We'll deal only with ScalarX and unsigned int below thus avoiding signed + // types and arithmetic and signed overflows (which are undefined behavior). + typedef typename conditional<(ScalarU(-1) > unsigned(-1)), ScalarU, unsigned>::type ScalarX; + // The following difference doesn't overflow, provided our integer types are two's + // complement and have the same number of padding bits in signed and unsigned variants. + // This is the case in most modern implementations of C++. + ScalarX range = ScalarX(y) - ScalarX(x); + ScalarX offset = 0; + ScalarX divisor = 1; + ScalarX multiplier = 1; + const unsigned rand_max = RAND_MAX; + if (range <= rand_max) divisor = (rand_max + 1) / (range + 1); + else multiplier = 1 + range / (rand_max + 1); + // Rejection sampling. + do { + offset = (unsigned(std::rand()) * multiplier) / divisor; + } while (offset > range); + return Scalar(ScalarX(x) + offset); } static inline Scalar run() @@ -508,7 +916,7 @@ struct random_default_impl #ifdef EIGEN_MAKING_DOCS return run(Scalar(NumTraits::IsSigned ? -10 : 0), Scalar(10)); #else - enum { rand_bits = floor_log2<(unsigned int)(RAND_MAX)+1>::value, + enum { rand_bits = meta_floor_log2<(unsigned int)(RAND_MAX)+1>::value, scalar_bits = sizeof(Scalar) * CHAR_BIT, shift = EIGEN_PLAIN_ENUM_MAX(0, int(rand_bits) - int(scalar_bits)), offset = NumTraits::IsSigned ? (1 << (EIGEN_PLAIN_ENUM_MIN(rand_bits,scalar_bits)-1)) : 0 @@ -523,8 +931,8 @@ struct random_default_impl { static inline Scalar run(const Scalar& x, const Scalar& y) { - return Scalar(random(real(x), real(y)), - random(imag(x), imag(y))); + return Scalar(random(x.real(), y.real()), + random(x.imag(), y.imag())); } static inline Scalar run() { @@ -545,97 +953,919 @@ inline EIGEN_MATHFUNC_RETVAL(random, Scalar) random() return EIGEN_MATHFUNC_IMPL(random, Scalar)::run(); } -} // end namespace internal +// Implementation of is* functions -/**************************************************************************** -* Generic math function * -****************************************************************************/ +// std::is* do not work with fast-math and gcc, std::is* are available on MSVC 2013 and newer, as well as in clang. +#if (EIGEN_HAS_CXX11_MATH && !(EIGEN_COMP_GNUC_STRICT && __FINITE_MATH_ONLY__)) || (EIGEN_COMP_MSVC>=1800) || (EIGEN_COMP_CLANG) +#define EIGEN_USE_STD_FPCLASSIFY 1 +#else +#define EIGEN_USE_STD_FPCLASSIFY 0 +#endif -namespace numext { +template +EIGEN_DEVICE_FUNC +typename internal::enable_if::value,bool>::type +isnan_impl(const T&) { return false; } -template -inline EIGEN_MATHFUNC_RETVAL(real, Scalar) real(const Scalar& x) -{ - return EIGEN_MATHFUNC_IMPL(real, Scalar)::run(x); -} +template +EIGEN_DEVICE_FUNC +typename internal::enable_if::value,bool>::type +isinf_impl(const T&) { return false; } -template -inline typename internal::add_const_on_value_type< EIGEN_MATHFUNC_RETVAL(real_ref, Scalar) >::type real_ref(const Scalar& x) -{ - return internal::real_ref_impl::run(x); +template +EIGEN_DEVICE_FUNC +typename internal::enable_if::value,bool>::type +isfinite_impl(const T&) { return true; } + +template +EIGEN_DEVICE_FUNC +typename internal::enable_if<(!internal::is_integral::value)&&(!NumTraits::IsComplex),bool>::type +isfinite_impl(const T& x) +{ + #if defined(EIGEN_GPU_COMPILE_PHASE) + return (::isfinite)(x); + #elif EIGEN_USE_STD_FPCLASSIFY + using std::isfinite; + return isfinite EIGEN_NOT_A_MACRO (x); + #else + return x<=NumTraits::highest() && x>=NumTraits::lowest(); + #endif } -template -inline EIGEN_MATHFUNC_RETVAL(real_ref, Scalar) real_ref(Scalar& x) -{ - return EIGEN_MATHFUNC_IMPL(real_ref, Scalar)::run(x); +template +EIGEN_DEVICE_FUNC +typename internal::enable_if<(!internal::is_integral::value)&&(!NumTraits::IsComplex),bool>::type +isinf_impl(const T& x) +{ + #if defined(EIGEN_GPU_COMPILE_PHASE) + return (::isinf)(x); + #elif EIGEN_USE_STD_FPCLASSIFY + using std::isinf; + return isinf EIGEN_NOT_A_MACRO (x); + #else + return x>NumTraits::highest() || x::lowest(); + #endif } -template -inline EIGEN_MATHFUNC_RETVAL(imag, Scalar) imag(const Scalar& x) -{ - return EIGEN_MATHFUNC_IMPL(imag, Scalar)::run(x); +template +EIGEN_DEVICE_FUNC +typename internal::enable_if<(!internal::is_integral::value)&&(!NumTraits::IsComplex),bool>::type +isnan_impl(const T& x) +{ + #if defined(EIGEN_GPU_COMPILE_PHASE) + return (::isnan)(x); + #elif EIGEN_USE_STD_FPCLASSIFY + using std::isnan; + return isnan EIGEN_NOT_A_MACRO (x); + #else + return x != x; + #endif +} + +#if (!EIGEN_USE_STD_FPCLASSIFY) + +#if EIGEN_COMP_MSVC + +template EIGEN_DEVICE_FUNC bool isinf_msvc_helper(T x) +{ + return _fpclass(x)==_FPCLASS_NINF || _fpclass(x)==_FPCLASS_PINF; +} + +//MSVC defines a _isnan builtin function, but for double only +EIGEN_DEVICE_FUNC inline bool isnan_impl(const long double& x) { return _isnan(x)!=0; } +EIGEN_DEVICE_FUNC inline bool isnan_impl(const double& x) { return _isnan(x)!=0; } +EIGEN_DEVICE_FUNC inline bool isnan_impl(const float& x) { return _isnan(x)!=0; } + +EIGEN_DEVICE_FUNC inline bool isinf_impl(const long double& x) { return isinf_msvc_helper(x); } +EIGEN_DEVICE_FUNC inline bool isinf_impl(const double& x) { return isinf_msvc_helper(x); } +EIGEN_DEVICE_FUNC inline bool isinf_impl(const float& x) { return isinf_msvc_helper(x); } + +#elif (defined __FINITE_MATH_ONLY__ && __FINITE_MATH_ONLY__ && EIGEN_COMP_GNUC) + +#if EIGEN_GNUC_AT_LEAST(5,0) + #define EIGEN_TMP_NOOPT_ATTRIB EIGEN_DEVICE_FUNC inline __attribute__((optimize("no-finite-math-only"))) +#else + // NOTE the inline qualifier and noinline attribute are both needed: the former is to avoid linking issue (duplicate symbol), + // while the second prevent too aggressive optimizations in fast-math mode: + #define EIGEN_TMP_NOOPT_ATTRIB EIGEN_DEVICE_FUNC inline __attribute__((noinline,optimize("no-finite-math-only"))) +#endif + +template<> EIGEN_TMP_NOOPT_ATTRIB bool isnan_impl(const long double& x) { return __builtin_isnan(x); } +template<> EIGEN_TMP_NOOPT_ATTRIB bool isnan_impl(const double& x) { return __builtin_isnan(x); } +template<> EIGEN_TMP_NOOPT_ATTRIB bool isnan_impl(const float& x) { return __builtin_isnan(x); } +template<> EIGEN_TMP_NOOPT_ATTRIB bool isinf_impl(const double& x) { return __builtin_isinf(x); } +template<> EIGEN_TMP_NOOPT_ATTRIB bool isinf_impl(const float& x) { return __builtin_isinf(x); } +template<> EIGEN_TMP_NOOPT_ATTRIB bool isinf_impl(const long double& x) { return __builtin_isinf(x); } + +#undef EIGEN_TMP_NOOPT_ATTRIB + +#endif + +#endif + +// The following overload are defined at the end of this file +template EIGEN_DEVICE_FUNC bool isfinite_impl(const std::complex& x); +template EIGEN_DEVICE_FUNC bool isnan_impl(const std::complex& x); +template EIGEN_DEVICE_FUNC bool isinf_impl(const std::complex& x); + +template T generic_fast_tanh_float(const T& a_x); +} // end namespace internal + +/**************************************************************************** +* Generic math functions * +****************************************************************************/ + +namespace numext { + +#if (!defined(EIGEN_GPUCC) || defined(EIGEN_CONSTEXPR_ARE_DEVICE_FUNC)) +template +EIGEN_DEVICE_FUNC +EIGEN_ALWAYS_INLINE T mini(const T& x, const T& y) +{ + EIGEN_USING_STD(min) + return min EIGEN_NOT_A_MACRO (x,y); +} + +template +EIGEN_DEVICE_FUNC +EIGEN_ALWAYS_INLINE T maxi(const T& x, const T& y) +{ + EIGEN_USING_STD(max) + return max EIGEN_NOT_A_MACRO (x,y); +} +#else +template +EIGEN_DEVICE_FUNC +EIGEN_ALWAYS_INLINE T mini(const T& x, const T& y) +{ + return y < x ? y : x; +} +template<> +EIGEN_DEVICE_FUNC +EIGEN_ALWAYS_INLINE float mini(const float& x, const float& y) +{ + return fminf(x, y); +} +template<> +EIGEN_DEVICE_FUNC +EIGEN_ALWAYS_INLINE double mini(const double& x, const double& y) +{ + return fmin(x, y); +} +template<> +EIGEN_DEVICE_FUNC +EIGEN_ALWAYS_INLINE long double mini(const long double& x, const long double& y) +{ +#if defined(EIGEN_HIPCC) + // no "fminl" on HIP yet + return (x < y) ? x : y; +#else + return fminl(x, y); +#endif +} + +template +EIGEN_DEVICE_FUNC +EIGEN_ALWAYS_INLINE T maxi(const T& x, const T& y) +{ + return x < y ? y : x; +} +template<> +EIGEN_DEVICE_FUNC +EIGEN_ALWAYS_INLINE float maxi(const float& x, const float& y) +{ + return fmaxf(x, y); +} +template<> +EIGEN_DEVICE_FUNC +EIGEN_ALWAYS_INLINE double maxi(const double& x, const double& y) +{ + return fmax(x, y); +} +template<> +EIGEN_DEVICE_FUNC +EIGEN_ALWAYS_INLINE long double maxi(const long double& x, const long double& y) +{ +#if defined(EIGEN_HIPCC) + // no "fmaxl" on HIP yet + return (x > y) ? x : y; +#else + return fmaxl(x, y); +#endif +} +#endif + +#if defined(SYCL_DEVICE_ONLY) + + +#define SYCL_SPECIALIZE_SIGNED_INTEGER_TYPES_BINARY(NAME, FUNC) \ + SYCL_SPECIALIZE_BINARY_FUNC(NAME, FUNC, cl::sycl::cl_char) \ + SYCL_SPECIALIZE_BINARY_FUNC(NAME, FUNC, cl::sycl::cl_short) \ + SYCL_SPECIALIZE_BINARY_FUNC(NAME, FUNC, cl::sycl::cl_int) \ + SYCL_SPECIALIZE_BINARY_FUNC(NAME, FUNC, cl::sycl::cl_long) +#define SYCL_SPECIALIZE_SIGNED_INTEGER_TYPES_UNARY(NAME, FUNC) \ + SYCL_SPECIALIZE_UNARY_FUNC(NAME, FUNC, cl::sycl::cl_char) \ + SYCL_SPECIALIZE_UNARY_FUNC(NAME, FUNC, cl::sycl::cl_short) \ + SYCL_SPECIALIZE_UNARY_FUNC(NAME, FUNC, cl::sycl::cl_int) \ + SYCL_SPECIALIZE_UNARY_FUNC(NAME, FUNC, cl::sycl::cl_long) +#define SYCL_SPECIALIZE_UNSIGNED_INTEGER_TYPES_BINARY(NAME, FUNC) \ + SYCL_SPECIALIZE_BINARY_FUNC(NAME, FUNC, cl::sycl::cl_uchar) \ + SYCL_SPECIALIZE_BINARY_FUNC(NAME, FUNC, cl::sycl::cl_ushort) \ + SYCL_SPECIALIZE_BINARY_FUNC(NAME, FUNC, cl::sycl::cl_uint) \ + SYCL_SPECIALIZE_BINARY_FUNC(NAME, FUNC, cl::sycl::cl_ulong) +#define SYCL_SPECIALIZE_UNSIGNED_INTEGER_TYPES_UNARY(NAME, FUNC) \ + SYCL_SPECIALIZE_UNARY_FUNC(NAME, FUNC, cl::sycl::cl_uchar) \ + SYCL_SPECIALIZE_UNARY_FUNC(NAME, FUNC, cl::sycl::cl_ushort) \ + SYCL_SPECIALIZE_UNARY_FUNC(NAME, FUNC, cl::sycl::cl_uint) \ + SYCL_SPECIALIZE_UNARY_FUNC(NAME, FUNC, cl::sycl::cl_ulong) +#define SYCL_SPECIALIZE_INTEGER_TYPES_BINARY(NAME, FUNC) \ + SYCL_SPECIALIZE_SIGNED_INTEGER_TYPES_BINARY(NAME, FUNC) \ + SYCL_SPECIALIZE_UNSIGNED_INTEGER_TYPES_BINARY(NAME, FUNC) +#define SYCL_SPECIALIZE_INTEGER_TYPES_UNARY(NAME, FUNC) \ + SYCL_SPECIALIZE_SIGNED_INTEGER_TYPES_UNARY(NAME, FUNC) \ + SYCL_SPECIALIZE_UNSIGNED_INTEGER_TYPES_UNARY(NAME, FUNC) +#define SYCL_SPECIALIZE_FLOATING_TYPES_BINARY(NAME, FUNC) \ + SYCL_SPECIALIZE_BINARY_FUNC(NAME, FUNC, cl::sycl::cl_float) \ + SYCL_SPECIALIZE_BINARY_FUNC(NAME, FUNC,cl::sycl::cl_double) +#define SYCL_SPECIALIZE_FLOATING_TYPES_UNARY(NAME, FUNC) \ + SYCL_SPECIALIZE_UNARY_FUNC(NAME, FUNC, cl::sycl::cl_float) \ + SYCL_SPECIALIZE_UNARY_FUNC(NAME, FUNC,cl::sycl::cl_double) +#define SYCL_SPECIALIZE_FLOATING_TYPES_UNARY_FUNC_RET_TYPE(NAME, FUNC, RET_TYPE) \ + SYCL_SPECIALIZE_GEN_UNARY_FUNC(NAME, FUNC, RET_TYPE, cl::sycl::cl_float) \ + SYCL_SPECIALIZE_GEN_UNARY_FUNC(NAME, FUNC, RET_TYPE, cl::sycl::cl_double) + +#define SYCL_SPECIALIZE_GEN_UNARY_FUNC(NAME, FUNC, RET_TYPE, ARG_TYPE) \ +template<> \ + EIGEN_DEVICE_FUNC \ + EIGEN_ALWAYS_INLINE RET_TYPE NAME(const ARG_TYPE& x) { \ + return cl::sycl::FUNC(x); \ + } + +#define SYCL_SPECIALIZE_UNARY_FUNC(NAME, FUNC, TYPE) \ + SYCL_SPECIALIZE_GEN_UNARY_FUNC(NAME, FUNC, TYPE, TYPE) + +#define SYCL_SPECIALIZE_GEN1_BINARY_FUNC(NAME, FUNC, RET_TYPE, ARG_TYPE1, ARG_TYPE2) \ + template<> \ + EIGEN_DEVICE_FUNC \ + EIGEN_ALWAYS_INLINE RET_TYPE NAME(const ARG_TYPE1& x, const ARG_TYPE2& y) { \ + return cl::sycl::FUNC(x, y); \ + } + +#define SYCL_SPECIALIZE_GEN2_BINARY_FUNC(NAME, FUNC, RET_TYPE, ARG_TYPE) \ + SYCL_SPECIALIZE_GEN1_BINARY_FUNC(NAME, FUNC, RET_TYPE, ARG_TYPE, ARG_TYPE) + +#define SYCL_SPECIALIZE_BINARY_FUNC(NAME, FUNC, TYPE) \ + SYCL_SPECIALIZE_GEN2_BINARY_FUNC(NAME, FUNC, TYPE, TYPE) + +SYCL_SPECIALIZE_INTEGER_TYPES_BINARY(mini, min) +SYCL_SPECIALIZE_FLOATING_TYPES_BINARY(mini, fmin) +SYCL_SPECIALIZE_INTEGER_TYPES_BINARY(maxi, max) +SYCL_SPECIALIZE_FLOATING_TYPES_BINARY(maxi, fmax) + +#endif + + +template +EIGEN_DEVICE_FUNC +inline EIGEN_MATHFUNC_RETVAL(real, Scalar) real(const Scalar& x) +{ + return EIGEN_MATHFUNC_IMPL(real, Scalar)::run(x); +} + +template +EIGEN_DEVICE_FUNC +inline typename internal::add_const_on_value_type< EIGEN_MATHFUNC_RETVAL(real_ref, Scalar) >::type real_ref(const Scalar& x) +{ + return internal::real_ref_impl::run(x); +} + +template +EIGEN_DEVICE_FUNC +inline EIGEN_MATHFUNC_RETVAL(real_ref, Scalar) real_ref(Scalar& x) +{ + return EIGEN_MATHFUNC_IMPL(real_ref, Scalar)::run(x); +} + +template +EIGEN_DEVICE_FUNC +inline EIGEN_MATHFUNC_RETVAL(imag, Scalar) imag(const Scalar& x) +{ + return EIGEN_MATHFUNC_IMPL(imag, Scalar)::run(x); +} + +template +EIGEN_DEVICE_FUNC +inline EIGEN_MATHFUNC_RETVAL(arg, Scalar) arg(const Scalar& x) +{ + return EIGEN_MATHFUNC_IMPL(arg, Scalar)::run(x); } template +EIGEN_DEVICE_FUNC inline typename internal::add_const_on_value_type< EIGEN_MATHFUNC_RETVAL(imag_ref, Scalar) >::type imag_ref(const Scalar& x) { return internal::imag_ref_impl::run(x); } template +EIGEN_DEVICE_FUNC inline EIGEN_MATHFUNC_RETVAL(imag_ref, Scalar) imag_ref(Scalar& x) { return EIGEN_MATHFUNC_IMPL(imag_ref, Scalar)::run(x); } template +EIGEN_DEVICE_FUNC inline EIGEN_MATHFUNC_RETVAL(conj, Scalar) conj(const Scalar& x) { return EIGEN_MATHFUNC_IMPL(conj, Scalar)::run(x); } template +EIGEN_DEVICE_FUNC inline EIGEN_MATHFUNC_RETVAL(abs2, Scalar) abs2(const Scalar& x) { return EIGEN_MATHFUNC_IMPL(abs2, Scalar)::run(x); } +EIGEN_DEVICE_FUNC +inline bool abs2(bool x) { return x; } + +template +EIGEN_DEVICE_FUNC +EIGEN_ALWAYS_INLINE T absdiff(const T& x, const T& y) +{ + return x > y ? x - y : y - x; +} +template<> +EIGEN_DEVICE_FUNC +EIGEN_ALWAYS_INLINE float absdiff(const float& x, const float& y) +{ + return fabsf(x - y); +} +template<> +EIGEN_DEVICE_FUNC +EIGEN_ALWAYS_INLINE double absdiff(const double& x, const double& y) +{ + return fabs(x - y); +} + +#if !defined(EIGEN_GPUCC) +// HIP and CUDA do not support long double. +template<> +EIGEN_DEVICE_FUNC +EIGEN_ALWAYS_INLINE long double absdiff(const long double& x, const long double& y) { + return fabsl(x - y); +} +#endif + template +EIGEN_DEVICE_FUNC inline EIGEN_MATHFUNC_RETVAL(norm1, Scalar) norm1(const Scalar& x) { return EIGEN_MATHFUNC_IMPL(norm1, Scalar)::run(x); } template +EIGEN_DEVICE_FUNC inline EIGEN_MATHFUNC_RETVAL(hypot, Scalar) hypot(const Scalar& x, const Scalar& y) { return EIGEN_MATHFUNC_IMPL(hypot, Scalar)::run(x, y); } +#if defined(SYCL_DEVICE_ONLY) + SYCL_SPECIALIZE_FLOATING_TYPES_BINARY(hypot, hypot) +#endif + +template +EIGEN_DEVICE_FUNC +inline EIGEN_MATHFUNC_RETVAL(log1p, Scalar) log1p(const Scalar& x) +{ + return EIGEN_MATHFUNC_IMPL(log1p, Scalar)::run(x); +} + +#if defined(SYCL_DEVICE_ONLY) +SYCL_SPECIALIZE_FLOATING_TYPES_UNARY(log1p, log1p) +#endif + +#if defined(EIGEN_GPUCC) +template<> EIGEN_DEVICE_FUNC EIGEN_ALWAYS_INLINE +float log1p(const float &x) { return ::log1pf(x); } + +template<> EIGEN_DEVICE_FUNC EIGEN_ALWAYS_INLINE +double log1p(const double &x) { return ::log1p(x); } +#endif + +template +EIGEN_DEVICE_FUNC +inline typename internal::pow_impl::result_type pow(const ScalarX& x, const ScalarY& y) +{ + return internal::pow_impl::run(x, y); +} + +#if defined(SYCL_DEVICE_ONLY) +SYCL_SPECIALIZE_FLOATING_TYPES_BINARY(pow, pow) +#endif + +template EIGEN_DEVICE_FUNC bool (isnan) (const T &x) { return internal::isnan_impl(x); } +template EIGEN_DEVICE_FUNC bool (isinf) (const T &x) { return internal::isinf_impl(x); } +template EIGEN_DEVICE_FUNC bool (isfinite)(const T &x) { return internal::isfinite_impl(x); } + +#if defined(SYCL_DEVICE_ONLY) +SYCL_SPECIALIZE_FLOATING_TYPES_UNARY_FUNC_RET_TYPE(isnan, isnan, bool) +SYCL_SPECIALIZE_FLOATING_TYPES_UNARY_FUNC_RET_TYPE(isinf, isinf, bool) +SYCL_SPECIALIZE_FLOATING_TYPES_UNARY_FUNC_RET_TYPE(isfinite, isfinite, bool) +#endif + +template +EIGEN_DEVICE_FUNC +inline EIGEN_MATHFUNC_RETVAL(rint, Scalar) rint(const Scalar& x) +{ + return EIGEN_MATHFUNC_IMPL(rint, Scalar)::run(x); +} + template -inline EIGEN_MATHFUNC_RETVAL(atanh2, Scalar) atanh2(const Scalar& x, const Scalar& y) +EIGEN_DEVICE_FUNC +inline EIGEN_MATHFUNC_RETVAL(round, Scalar) round(const Scalar& x) +{ + return EIGEN_MATHFUNC_IMPL(round, Scalar)::run(x); +} + +#if defined(SYCL_DEVICE_ONLY) +SYCL_SPECIALIZE_FLOATING_TYPES_UNARY(round, round) +#endif + +template +EIGEN_DEVICE_FUNC +T (floor)(const T& x) +{ + EIGEN_USING_STD(floor) + return floor(x); +} + +#if defined(SYCL_DEVICE_ONLY) +SYCL_SPECIALIZE_FLOATING_TYPES_UNARY(floor, floor) +#endif + +#if defined(EIGEN_GPUCC) +template<> EIGEN_DEVICE_FUNC EIGEN_ALWAYS_INLINE +float floor(const float &x) { return ::floorf(x); } + +template<> EIGEN_DEVICE_FUNC EIGEN_ALWAYS_INLINE +double floor(const double &x) { return ::floor(x); } +#endif + +template +EIGEN_DEVICE_FUNC +T (ceil)(const T& x) { - return EIGEN_MATHFUNC_IMPL(atanh2, Scalar)::run(x, y); + EIGEN_USING_STD(ceil); + return ceil(x); } +#if defined(SYCL_DEVICE_ONLY) +SYCL_SPECIALIZE_FLOATING_TYPES_UNARY(ceil, ceil) +#endif + +#if defined(EIGEN_GPUCC) +template<> EIGEN_DEVICE_FUNC EIGEN_ALWAYS_INLINE +float ceil(const float &x) { return ::ceilf(x); } + +template<> EIGEN_DEVICE_FUNC EIGEN_ALWAYS_INLINE +double ceil(const double &x) { return ::ceil(x); } +#endif + + +/** Log base 2 for 32 bits positive integers. + * Conveniently returns 0 for x==0. */ +inline int log2(int x) +{ + eigen_assert(x>=0); + unsigned int v(x); + static const int table[32] = { 0, 9, 1, 10, 13, 21, 2, 29, 11, 14, 16, 18, 22, 25, 3, 30, 8, 12, 20, 28, 15, 17, 24, 7, 19, 27, 23, 6, 26, 5, 4, 31 }; + v |= v >> 1; + v |= v >> 2; + v |= v >> 4; + v |= v >> 8; + v |= v >> 16; + return table[(v * 0x07C4ACDDU) >> 27]; +} + +/** \returns the square root of \a x. + * + * It is essentially equivalent to + * \code using std::sqrt; return sqrt(x); \endcode + * but slightly faster for float/double and some compilers (e.g., gcc), thanks to + * specializations when SSE is enabled. + * + * It's usage is justified in performance critical functions, like norm/normalize. + */ template -inline EIGEN_MATHFUNC_RETVAL(pow, Scalar) pow(const Scalar& x, const Scalar& y) +EIGEN_DEVICE_FUNC +EIGEN_ALWAYS_INLINE EIGEN_MATHFUNC_RETVAL(sqrt, Scalar) sqrt(const Scalar& x) { - return EIGEN_MATHFUNC_IMPL(pow, Scalar)::run(x, y); + return EIGEN_MATHFUNC_IMPL(sqrt, Scalar)::run(x); +} + +// Boolean specialization, avoids implicit float to bool conversion (-Wimplicit-conversion-floating-point-to-bool). +template<> +EIGEN_DEFINE_FUNCTION_ALLOWING_MULTIPLE_DEFINITIONS EIGEN_DEVICE_FUNC +bool sqrt(const bool &x) { return x; } + +#if defined(SYCL_DEVICE_ONLY) +SYCL_SPECIALIZE_FLOATING_TYPES_UNARY(sqrt, sqrt) +#endif + +/** \returns the reciprocal square root of \a x. **/ +template +EIGEN_DEVICE_FUNC EIGEN_ALWAYS_INLINE +T rsqrt(const T& x) +{ + return internal::rsqrt_impl::run(x); +} + +template +EIGEN_DEVICE_FUNC EIGEN_ALWAYS_INLINE +T log(const T &x) { + return internal::log_impl::run(x); +} + +#if defined(SYCL_DEVICE_ONLY) +SYCL_SPECIALIZE_FLOATING_TYPES_UNARY(log, log) +#endif + + +#if defined(EIGEN_GPUCC) +template<> EIGEN_DEVICE_FUNC EIGEN_ALWAYS_INLINE +float log(const float &x) { return ::logf(x); } + +template<> EIGEN_DEVICE_FUNC EIGEN_ALWAYS_INLINE +double log(const double &x) { return ::log(x); } +#endif + +template +EIGEN_DEVICE_FUNC EIGEN_ALWAYS_INLINE +typename internal::enable_if::IsSigned || NumTraits::IsComplex,typename NumTraits::Real>::type +abs(const T &x) { + EIGEN_USING_STD(abs); + return abs(x); +} + +template +EIGEN_DEVICE_FUNC EIGEN_ALWAYS_INLINE +typename internal::enable_if::IsSigned || NumTraits::IsComplex),typename NumTraits::Real>::type +abs(const T &x) { + return x; +} + +#if defined(SYCL_DEVICE_ONLY) +SYCL_SPECIALIZE_INTEGER_TYPES_UNARY(abs, abs) +SYCL_SPECIALIZE_FLOATING_TYPES_UNARY(abs, fabs) +#endif + +#if defined(EIGEN_GPUCC) +template<> EIGEN_DEVICE_FUNC EIGEN_ALWAYS_INLINE +float abs(const float &x) { return ::fabsf(x); } + +template<> EIGEN_DEVICE_FUNC EIGEN_ALWAYS_INLINE +double abs(const double &x) { return ::fabs(x); } + +template <> EIGEN_DEVICE_FUNC EIGEN_ALWAYS_INLINE +float abs(const std::complex& x) { + return ::hypotf(x.real(), x.imag()); } -// std::isfinite is non standard, so let's define our own version, -// even though it is not very efficient. -template bool (isfinite)(const T& x) +template <> EIGEN_DEVICE_FUNC EIGEN_ALWAYS_INLINE +double abs(const std::complex& x) { + return ::hypot(x.real(), x.imag()); +} +#endif + +template +EIGEN_DEVICE_FUNC EIGEN_ALWAYS_INLINE +T exp(const T &x) { + EIGEN_USING_STD(exp); + return exp(x); +} + +#if defined(SYCL_DEVICE_ONLY) +SYCL_SPECIALIZE_FLOATING_TYPES_UNARY(exp, exp) +#endif + +#if defined(EIGEN_GPUCC) +template<> EIGEN_DEVICE_FUNC EIGEN_ALWAYS_INLINE +float exp(const float &x) { return ::expf(x); } + +template<> EIGEN_DEVICE_FUNC EIGEN_ALWAYS_INLINE +double exp(const double &x) { return ::exp(x); } + +template<> EIGEN_DEVICE_FUNC EIGEN_ALWAYS_INLINE +std::complex exp(const std::complex& x) { + float com = ::expf(x.real()); + float res_real = com * ::cosf(x.imag()); + float res_imag = com * ::sinf(x.imag()); + return std::complex(res_real, res_imag); +} + +template<> EIGEN_DEVICE_FUNC EIGEN_ALWAYS_INLINE +std::complex exp(const std::complex& x) { + double com = ::exp(x.real()); + double res_real = com * ::cos(x.imag()); + double res_imag = com * ::sin(x.imag()); + return std::complex(res_real, res_imag); +} +#endif + +template +EIGEN_DEVICE_FUNC +inline EIGEN_MATHFUNC_RETVAL(expm1, Scalar) expm1(const Scalar& x) { - return x::highest() && x>NumTraits::lowest(); + return EIGEN_MATHFUNC_IMPL(expm1, Scalar)::run(x); +} + +#if defined(SYCL_DEVICE_ONLY) +SYCL_SPECIALIZE_FLOATING_TYPES_UNARY(expm1, expm1) +#endif + +#if defined(EIGEN_GPUCC) +template<> EIGEN_DEVICE_FUNC EIGEN_ALWAYS_INLINE +float expm1(const float &x) { return ::expm1f(x); } + +template<> EIGEN_DEVICE_FUNC EIGEN_ALWAYS_INLINE +double expm1(const double &x) { return ::expm1(x); } +#endif + +template +EIGEN_DEVICE_FUNC EIGEN_ALWAYS_INLINE +T cos(const T &x) { + EIGEN_USING_STD(cos); + return cos(x); +} + +#if defined(SYCL_DEVICE_ONLY) +SYCL_SPECIALIZE_FLOATING_TYPES_UNARY(cos,cos) +#endif + +#if defined(EIGEN_GPUCC) +template<> EIGEN_DEVICE_FUNC EIGEN_ALWAYS_INLINE +float cos(const float &x) { return ::cosf(x); } + +template<> EIGEN_DEVICE_FUNC EIGEN_ALWAYS_INLINE +double cos(const double &x) { return ::cos(x); } +#endif + +template +EIGEN_DEVICE_FUNC EIGEN_ALWAYS_INLINE +T sin(const T &x) { + EIGEN_USING_STD(sin); + return sin(x); +} + +#if defined(SYCL_DEVICE_ONLY) +SYCL_SPECIALIZE_FLOATING_TYPES_UNARY(sin, sin) +#endif + +#if defined(EIGEN_GPUCC) +template<> EIGEN_DEVICE_FUNC EIGEN_ALWAYS_INLINE +float sin(const float &x) { return ::sinf(x); } + +template<> EIGEN_DEVICE_FUNC EIGEN_ALWAYS_INLINE +double sin(const double &x) { return ::sin(x); } +#endif + +template +EIGEN_DEVICE_FUNC EIGEN_ALWAYS_INLINE +T tan(const T &x) { + EIGEN_USING_STD(tan); + return tan(x); +} + +#if defined(SYCL_DEVICE_ONLY) +SYCL_SPECIALIZE_FLOATING_TYPES_UNARY(tan, tan) +#endif + +#if defined(EIGEN_GPUCC) +template<> EIGEN_DEVICE_FUNC EIGEN_ALWAYS_INLINE +float tan(const float &x) { return ::tanf(x); } + +template<> EIGEN_DEVICE_FUNC EIGEN_ALWAYS_INLINE +double tan(const double &x) { return ::tan(x); } +#endif + +template +EIGEN_DEVICE_FUNC EIGEN_ALWAYS_INLINE +T acos(const T &x) { + EIGEN_USING_STD(acos); + return acos(x); +} + +#if EIGEN_HAS_CXX11_MATH +template +EIGEN_DEVICE_FUNC EIGEN_ALWAYS_INLINE +T acosh(const T &x) { + EIGEN_USING_STD(acosh); + return static_cast(acosh(x)); +} +#endif + +#if defined(SYCL_DEVICE_ONLY) +SYCL_SPECIALIZE_FLOATING_TYPES_UNARY(acos, acos) +SYCL_SPECIALIZE_FLOATING_TYPES_UNARY(acosh, acosh) +#endif + +#if defined(EIGEN_GPUCC) +template<> EIGEN_DEVICE_FUNC EIGEN_ALWAYS_INLINE +float acos(const float &x) { return ::acosf(x); } + +template<> EIGEN_DEVICE_FUNC EIGEN_ALWAYS_INLINE +double acos(const double &x) { return ::acos(x); } +#endif + +template +EIGEN_DEVICE_FUNC EIGEN_ALWAYS_INLINE +T asin(const T &x) { + EIGEN_USING_STD(asin); + return asin(x); +} + +#if EIGEN_HAS_CXX11_MATH +template +EIGEN_DEVICE_FUNC EIGEN_ALWAYS_INLINE +T asinh(const T &x) { + EIGEN_USING_STD(asinh); + return static_cast(asinh(x)); +} +#endif + +#if defined(SYCL_DEVICE_ONLY) +SYCL_SPECIALIZE_FLOATING_TYPES_UNARY(asin, asin) +SYCL_SPECIALIZE_FLOATING_TYPES_UNARY(asinh, asinh) +#endif + +#if defined(EIGEN_GPUCC) +template<> EIGEN_DEVICE_FUNC EIGEN_ALWAYS_INLINE +float asin(const float &x) { return ::asinf(x); } + +template<> EIGEN_DEVICE_FUNC EIGEN_ALWAYS_INLINE +double asin(const double &x) { return ::asin(x); } +#endif + +template +EIGEN_DEVICE_FUNC EIGEN_ALWAYS_INLINE +T atan(const T &x) { + EIGEN_USING_STD(atan); + return static_cast(atan(x)); +} + +#if EIGEN_HAS_CXX11_MATH +template +EIGEN_DEVICE_FUNC EIGEN_ALWAYS_INLINE +T atanh(const T &x) { + EIGEN_USING_STD(atanh); + return static_cast(atanh(x)); +} +#endif + +#if defined(SYCL_DEVICE_ONLY) +SYCL_SPECIALIZE_FLOATING_TYPES_UNARY(atan, atan) +SYCL_SPECIALIZE_FLOATING_TYPES_UNARY(atanh, atanh) +#endif + +#if defined(EIGEN_GPUCC) +template<> EIGEN_DEVICE_FUNC EIGEN_ALWAYS_INLINE +float atan(const float &x) { return ::atanf(x); } + +template<> EIGEN_DEVICE_FUNC EIGEN_ALWAYS_INLINE +double atan(const double &x) { return ::atan(x); } +#endif + + +template +EIGEN_DEVICE_FUNC EIGEN_ALWAYS_INLINE +T cosh(const T &x) { + EIGEN_USING_STD(cosh); + return static_cast(cosh(x)); +} + +#if defined(SYCL_DEVICE_ONLY) +SYCL_SPECIALIZE_FLOATING_TYPES_UNARY(cosh, cosh) +#endif + +#if defined(EIGEN_GPUCC) +template<> EIGEN_DEVICE_FUNC EIGEN_ALWAYS_INLINE +float cosh(const float &x) { return ::coshf(x); } + +template<> EIGEN_DEVICE_FUNC EIGEN_ALWAYS_INLINE +double cosh(const double &x) { return ::cosh(x); } +#endif + +template +EIGEN_DEVICE_FUNC EIGEN_ALWAYS_INLINE +T sinh(const T &x) { + EIGEN_USING_STD(sinh); + return static_cast(sinh(x)); +} + +#if defined(SYCL_DEVICE_ONLY) +SYCL_SPECIALIZE_FLOATING_TYPES_UNARY(sinh, sinh) +#endif + +#if defined(EIGEN_GPUCC) +template<> EIGEN_DEVICE_FUNC EIGEN_ALWAYS_INLINE +float sinh(const float &x) { return ::sinhf(x); } + +template<> EIGEN_DEVICE_FUNC EIGEN_ALWAYS_INLINE +double sinh(const double &x) { return ::sinh(x); } +#endif + +template +EIGEN_DEVICE_FUNC EIGEN_ALWAYS_INLINE +T tanh(const T &x) { + EIGEN_USING_STD(tanh); + return tanh(x); +} + +#if (!defined(EIGEN_GPUCC)) && EIGEN_FAST_MATH && !defined(SYCL_DEVICE_ONLY) +EIGEN_DEVICE_FUNC EIGEN_ALWAYS_INLINE +float tanh(float x) { return internal::generic_fast_tanh_float(x); } +#endif + +#if defined(SYCL_DEVICE_ONLY) +SYCL_SPECIALIZE_FLOATING_TYPES_UNARY(tanh, tanh) +#endif + +#if defined(EIGEN_GPUCC) +template<> EIGEN_DEVICE_FUNC EIGEN_ALWAYS_INLINE +float tanh(const float &x) { return ::tanhf(x); } + +template<> EIGEN_DEVICE_FUNC EIGEN_ALWAYS_INLINE +double tanh(const double &x) { return ::tanh(x); } +#endif + +template +EIGEN_DEVICE_FUNC EIGEN_ALWAYS_INLINE +T fmod(const T& a, const T& b) { + EIGEN_USING_STD(fmod); + return fmod(a, b); +} + +#if defined(SYCL_DEVICE_ONLY) +SYCL_SPECIALIZE_FLOATING_TYPES_BINARY(fmod, fmod) +#endif + +#if defined(EIGEN_GPUCC) +template <> +EIGEN_DEVICE_FUNC EIGEN_ALWAYS_INLINE +float fmod(const float& a, const float& b) { + return ::fmodf(a, b); } +template <> +EIGEN_DEVICE_FUNC EIGEN_ALWAYS_INLINE +double fmod(const double& a, const double& b) { + return ::fmod(a, b); +} +#endif + +#if defined(SYCL_DEVICE_ONLY) +#undef SYCL_SPECIALIZE_SIGNED_INTEGER_TYPES_BINARY +#undef SYCL_SPECIALIZE_SIGNED_INTEGER_TYPES_UNARY +#undef SYCL_SPECIALIZE_UNSIGNED_INTEGER_TYPES_BINARY +#undef SYCL_SPECIALIZE_UNSIGNED_INTEGER_TYPES_UNARY +#undef SYCL_SPECIALIZE_INTEGER_TYPES_BINARY +#undef SYCL_SPECIALIZE_UNSIGNED_INTEGER_TYPES_UNARY +#undef SYCL_SPECIALIZE_FLOATING_TYPES_BINARY +#undef SYCL_SPECIALIZE_FLOATING_TYPES_UNARY +#undef SYCL_SPECIALIZE_FLOATING_TYPES_UNARY_FUNC_RET_TYPE +#undef SYCL_SPECIALIZE_GEN_UNARY_FUNC +#undef SYCL_SPECIALIZE_UNARY_FUNC +#undef SYCL_SPECIALIZE_GEN1_BINARY_FUNC +#undef SYCL_SPECIALIZE_GEN2_BINARY_FUNC +#undef SYCL_SPECIALIZE_BINARY_FUNC +#endif + } // end namespace numext namespace internal { +template +EIGEN_DEVICE_FUNC bool isfinite_impl(const std::complex& x) +{ + return (numext::isfinite)(numext::real(x)) && (numext::isfinite)(numext::imag(x)); +} + +template +EIGEN_DEVICE_FUNC bool isnan_impl(const std::complex& x) +{ + return (numext::isnan)(numext::real(x)) || (numext::isnan)(numext::imag(x)); +} + +template +EIGEN_DEVICE_FUNC bool isinf_impl(const std::complex& x) +{ + return ((numext::isinf)(numext::real(x)) || (numext::isinf)(numext::imag(x))) && (!(numext::isnan)(x)); +} + /**************************************************************************** * Implementation of fuzzy comparisons * ****************************************************************************/ @@ -649,18 +1879,17 @@ template struct scalar_fuzzy_default_impl { typedef typename NumTraits::Real RealScalar; - template + template EIGEN_DEVICE_FUNC static inline bool isMuchSmallerThan(const Scalar& x, const OtherScalar& y, const RealScalar& prec) { - using std::abs; - return abs(x) <= abs(y) * prec; + return numext::abs(x) <= numext::abs(y) * prec; } + EIGEN_DEVICE_FUNC static inline bool isApprox(const Scalar& x, const Scalar& y, const RealScalar& prec) { - using std::min; - using std::abs; - return abs(x - y) <= (min)(abs(x), abs(y)) * prec; + return numext::abs(x - y) <= numext::mini(numext::abs(x), numext::abs(y)) * prec; } + EIGEN_DEVICE_FUNC static inline bool isApproxOrLessThan(const Scalar& x, const Scalar& y, const RealScalar& prec) { return x <= y || isApprox(x, y, prec); @@ -671,15 +1900,17 @@ template struct scalar_fuzzy_default_impl { typedef typename NumTraits::Real RealScalar; - template + template EIGEN_DEVICE_FUNC static inline bool isMuchSmallerThan(const Scalar& x, const Scalar&, const RealScalar&) { return x == Scalar(0); } + EIGEN_DEVICE_FUNC static inline bool isApprox(const Scalar& x, const Scalar& y, const RealScalar&) { return x == y; } + EIGEN_DEVICE_FUNC static inline bool isApproxOrLessThan(const Scalar& x, const Scalar& y, const RealScalar&) { return x <= y; @@ -690,38 +1921,38 @@ template struct scalar_fuzzy_default_impl { typedef typename NumTraits::Real RealScalar; - template + template EIGEN_DEVICE_FUNC static inline bool isMuchSmallerThan(const Scalar& x, const OtherScalar& y, const RealScalar& prec) { return numext::abs2(x) <= numext::abs2(y) * prec * prec; } + EIGEN_DEVICE_FUNC static inline bool isApprox(const Scalar& x, const Scalar& y, const RealScalar& prec) { - using std::min; - return numext::abs2(x - y) <= (min)(numext::abs2(x), numext::abs2(y)) * prec * prec; + return numext::abs2(x - y) <= numext::mini(numext::abs2(x), numext::abs2(y)) * prec * prec; } }; template struct scalar_fuzzy_impl : scalar_fuzzy_default_impl::IsComplex, NumTraits::IsInteger> {}; -template +template EIGEN_DEVICE_FUNC inline bool isMuchSmallerThan(const Scalar& x, const OtherScalar& y, - typename NumTraits::Real precision = NumTraits::dummy_precision()) + const typename NumTraits::Real &precision = NumTraits::dummy_precision()) { return scalar_fuzzy_impl::template isMuchSmallerThan(x, y, precision); } -template +template EIGEN_DEVICE_FUNC inline bool isApprox(const Scalar& x, const Scalar& y, - typename NumTraits::Real precision = NumTraits::dummy_precision()) + const typename NumTraits::Real &precision = NumTraits::dummy_precision()) { return scalar_fuzzy_impl::isApprox(x, y, precision); } -template +template EIGEN_DEVICE_FUNC inline bool isApproxOrLessThan(const Scalar& x, const Scalar& y, - typename NumTraits::Real precision = NumTraits::dummy_precision()) + const typename NumTraits::Real &precision = NumTraits::dummy_precision()) { return scalar_fuzzy_impl::isApproxOrLessThan(x, y, precision); } @@ -736,31 +1967,89 @@ template<> struct random_impl { return random(0,1)==0 ? false : true; } + + static inline bool run(const bool& a, const bool& b) + { + return random(a, b)==0 ? false : true; + } }; template<> struct scalar_fuzzy_impl { typedef bool RealScalar; - - template + + template EIGEN_DEVICE_FUNC static inline bool isMuchSmallerThan(const bool& x, const bool&, const bool&) { return !x; } - + + EIGEN_DEVICE_FUNC static inline bool isApprox(bool x, bool y, bool) { return x == y; } + EIGEN_DEVICE_FUNC static inline bool isApproxOrLessThan(const bool& x, const bool& y, const bool&) { return (!x) || y; } - + }; - +} // end namespace internal + +// Default implementations that rely on other numext implementations +namespace internal { + +// Specialization for complex types that are not supported by std::expm1. +template +struct expm1_impl > { + EIGEN_DEVICE_FUNC static inline std::complex run( + const std::complex& x) { + EIGEN_STATIC_ASSERT_NON_INTEGER(RealScalar) + RealScalar xr = x.real(); + RealScalar xi = x.imag(); + // expm1(z) = exp(z) - 1 + // = exp(x + i * y) - 1 + // = exp(x) * (cos(y) + i * sin(y)) - 1 + // = exp(x) * cos(y) - 1 + i * exp(x) * sin(y) + // Imag(expm1(z)) = exp(x) * sin(y) + // Real(expm1(z)) = exp(x) * cos(y) - 1 + // = exp(x) * cos(y) - 1. + // = expm1(x) + exp(x) * (cos(y) - 1) + // = expm1(x) + exp(x) * (2 * sin(y / 2) ** 2) + RealScalar erm1 = numext::expm1(xr); + RealScalar er = erm1 + RealScalar(1.); + RealScalar sin2 = numext::sin(xi / RealScalar(2.)); + sin2 = sin2 * sin2; + RealScalar s = numext::sin(xi); + RealScalar real_part = erm1 - RealScalar(2.) * er * sin2; + return std::complex(real_part, er * s); + } +}; + +template +struct rsqrt_impl { + EIGEN_DEVICE_FUNC + static EIGEN_ALWAYS_INLINE T run(const T& x) { + return T(1)/numext::sqrt(x); + } +}; + +#if defined(EIGEN_GPU_COMPILE_PHASE) +template +struct conj_impl, true> +{ + EIGEN_DEVICE_FUNC + static inline std::complex run(const std::complex& x) + { + return std::complex(numext::real(x), -numext::imag(x)); + } +}; +#endif + } // end namespace internal } // end namespace Eigen diff --git a/extern/eigen/Eigen/src/Core/MathFunctionsImpl.h b/extern/eigen/Eigen/src/Core/MathFunctionsImpl.h new file mode 100644 index 00000000..4eaaaa78 --- /dev/null +++ b/extern/eigen/Eigen/src/Core/MathFunctionsImpl.h @@ -0,0 +1,200 @@ +// This file is part of Eigen, a lightweight C++ template library +// for linear algebra. +// +// Copyright (C) 2014 Pedro Gonnet (pedro.gonnet@gmail.com) +// Copyright (C) 2016 Gael Guennebaud +// +// This Source Code Form is subject to the terms of the Mozilla +// Public License v. 2.0. If a copy of the MPL was not distributed +// with this file, You can obtain one at http://mozilla.org/MPL/2.0/. + +#ifndef EIGEN_MATHFUNCTIONSIMPL_H +#define EIGEN_MATHFUNCTIONSIMPL_H + +namespace Eigen { + +namespace internal { + +/** \internal \returns the hyperbolic tan of \a a (coeff-wise) + Doesn't do anything fancy, just a 13/6-degree rational interpolant which + is accurate up to a couple of ulps in the (approximate) range [-8, 8], + outside of which tanh(x) = +/-1 in single precision. The input is clamped + to the range [-c, c]. The value c is chosen as the smallest value where + the approximation evaluates to exactly 1. In the reange [-0.0004, 0.0004] + the approxmation tanh(x) ~= x is used for better accuracy as x tends to zero. + + This implementation works on both scalars and packets. +*/ +template +T generic_fast_tanh_float(const T& a_x) +{ + // Clamp the inputs to the range [-c, c] +#ifdef EIGEN_VECTORIZE_FMA + const T plus_clamp = pset1(7.99881172180175781f); + const T minus_clamp = pset1(-7.99881172180175781f); +#else + const T plus_clamp = pset1(7.90531110763549805f); + const T minus_clamp = pset1(-7.90531110763549805f); +#endif + const T tiny = pset1(0.0004f); + const T x = pmax(pmin(a_x, plus_clamp), minus_clamp); + const T tiny_mask = pcmp_lt(pabs(a_x), tiny); + // The monomial coefficients of the numerator polynomial (odd). + const T alpha_1 = pset1(4.89352455891786e-03f); + const T alpha_3 = pset1(6.37261928875436e-04f); + const T alpha_5 = pset1(1.48572235717979e-05f); + const T alpha_7 = pset1(5.12229709037114e-08f); + const T alpha_9 = pset1(-8.60467152213735e-11f); + const T alpha_11 = pset1(2.00018790482477e-13f); + const T alpha_13 = pset1(-2.76076847742355e-16f); + + // The monomial coefficients of the denominator polynomial (even). + const T beta_0 = pset1(4.89352518554385e-03f); + const T beta_2 = pset1(2.26843463243900e-03f); + const T beta_4 = pset1(1.18534705686654e-04f); + const T beta_6 = pset1(1.19825839466702e-06f); + + // Since the polynomials are odd/even, we need x^2. + const T x2 = pmul(x, x); + + // Evaluate the numerator polynomial p. + T p = pmadd(x2, alpha_13, alpha_11); + p = pmadd(x2, p, alpha_9); + p = pmadd(x2, p, alpha_7); + p = pmadd(x2, p, alpha_5); + p = pmadd(x2, p, alpha_3); + p = pmadd(x2, p, alpha_1); + p = pmul(x, p); + + // Evaluate the denominator polynomial q. + T q = pmadd(x2, beta_6, beta_4); + q = pmadd(x2, q, beta_2); + q = pmadd(x2, q, beta_0); + + // Divide the numerator by the denominator. + return pselect(tiny_mask, x, pdiv(p, q)); +} + +template +EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE +RealScalar positive_real_hypot(const RealScalar& x, const RealScalar& y) +{ + // IEEE IEC 6059 special cases. + if ((numext::isinf)(x) || (numext::isinf)(y)) + return NumTraits::infinity(); + if ((numext::isnan)(x) || (numext::isnan)(y)) + return NumTraits::quiet_NaN(); + + EIGEN_USING_STD(sqrt); + RealScalar p, qp; + p = numext::maxi(x,y); + if(p==RealScalar(0)) return RealScalar(0); + qp = numext::mini(y,x) / p; + return p * sqrt(RealScalar(1) + qp*qp); +} + +template +struct hypot_impl +{ + typedef typename NumTraits::Real RealScalar; + static EIGEN_DEVICE_FUNC + inline RealScalar run(const Scalar& x, const Scalar& y) + { + EIGEN_USING_STD(abs); + return positive_real_hypot(abs(x), abs(y)); + } +}; + +// Generic complex sqrt implementation that correctly handles corner cases +// according to https://en.cppreference.com/w/cpp/numeric/complex/sqrt +template +EIGEN_DEVICE_FUNC std::complex complex_sqrt(const std::complex& z) { + // Computes the principal sqrt of the input. + // + // For a complex square root of the number x + i*y. We want to find real + // numbers u and v such that + // (u + i*v)^2 = x + i*y <=> + // u^2 - v^2 + i*2*u*v = x + i*v. + // By equating the real and imaginary parts we get: + // u^2 - v^2 = x + // 2*u*v = y. + // + // For x >= 0, this has the numerically stable solution + // u = sqrt(0.5 * (x + sqrt(x^2 + y^2))) + // v = y / (2 * u) + // and for x < 0, + // v = sign(y) * sqrt(0.5 * (-x + sqrt(x^2 + y^2))) + // u = y / (2 * v) + // + // Letting w = sqrt(0.5 * (|x| + |z|)), + // if x == 0: u = w, v = sign(y) * w + // if x > 0: u = w, v = y / (2 * w) + // if x < 0: u = |y| / (2 * w), v = sign(y) * w + + const T x = numext::real(z); + const T y = numext::imag(z); + const T zero = T(0); + const T w = numext::sqrt(T(0.5) * (numext::abs(x) + numext::hypot(x, y))); + + return + (numext::isinf)(y) ? std::complex(NumTraits::infinity(), y) + : x == zero ? std::complex(w, y < zero ? -w : w) + : x > zero ? std::complex(w, y / (2 * w)) + : std::complex(numext::abs(y) / (2 * w), y < zero ? -w : w ); +} + +// Generic complex rsqrt implementation. +template +EIGEN_DEVICE_FUNC std::complex complex_rsqrt(const std::complex& z) { + // Computes the principal reciprocal sqrt of the input. + // + // For a complex reciprocal square root of the number z = x + i*y. We want to + // find real numbers u and v such that + // (u + i*v)^2 = 1 / (x + i*y) <=> + // u^2 - v^2 + i*2*u*v = x/|z|^2 - i*v/|z|^2. + // By equating the real and imaginary parts we get: + // u^2 - v^2 = x/|z|^2 + // 2*u*v = y/|z|^2. + // + // For x >= 0, this has the numerically stable solution + // u = sqrt(0.5 * (x + |z|)) / |z| + // v = -y / (2 * u * |z|) + // and for x < 0, + // v = -sign(y) * sqrt(0.5 * (-x + |z|)) / |z| + // u = -y / (2 * v * |z|) + // + // Letting w = sqrt(0.5 * (|x| + |z|)), + // if x == 0: u = w / |z|, v = -sign(y) * w / |z| + // if x > 0: u = w / |z|, v = -y / (2 * w * |z|) + // if x < 0: u = |y| / (2 * w * |z|), v = -sign(y) * w / |z| + + const T x = numext::real(z); + const T y = numext::imag(z); + const T zero = T(0); + + const T abs_z = numext::hypot(x, y); + const T w = numext::sqrt(T(0.5) * (numext::abs(x) + abs_z)); + const T woz = w / abs_z; + // Corner cases consistent with 1/sqrt(z) on gcc/clang. + return + abs_z == zero ? std::complex(NumTraits::infinity(), NumTraits::quiet_NaN()) + : ((numext::isinf)(x) || (numext::isinf)(y)) ? std::complex(zero, zero) + : x == zero ? std::complex(woz, y < zero ? woz : -woz) + : x > zero ? std::complex(woz, -y / (2 * w * abs_z)) + : std::complex(numext::abs(y) / (2 * w * abs_z), y < zero ? woz : -woz ); +} + +template +EIGEN_DEVICE_FUNC std::complex complex_log(const std::complex& z) { + // Computes complex log. + T a = numext::abs(z); + EIGEN_USING_STD(atan2); + T b = atan2(z.imag(), z.real()); + return std::complex(numext::log(a), b); +} + +} // end namespace internal + +} // end namespace Eigen + +#endif // EIGEN_MATHFUNCTIONSIMPL_H diff --git a/extern/eigen/Eigen/src/Core/Matrix.h b/extern/eigen/Eigen/src/Core/Matrix.h index 02be142d..f0e59a91 100644 --- a/extern/eigen/Eigen/src/Core/Matrix.h +++ b/extern/eigen/Eigen/src/Core/Matrix.h @@ -13,6 +13,45 @@ namespace Eigen { +namespace internal { +template +struct traits > +{ +private: + enum { size = internal::size_at_compile_time<_Rows,_Cols>::ret }; + typedef typename find_best_packet<_Scalar,size>::type PacketScalar; + enum { + row_major_bit = _Options&RowMajor ? RowMajorBit : 0, + is_dynamic_size_storage = _MaxRows==Dynamic || _MaxCols==Dynamic, + max_size = is_dynamic_size_storage ? Dynamic : _MaxRows*_MaxCols, + default_alignment = compute_default_alignment<_Scalar,max_size>::value, + actual_alignment = ((_Options&DontAlign)==0) ? default_alignment : 0, + required_alignment = unpacket_traits::alignment, + packet_access_bit = (packet_traits<_Scalar>::Vectorizable && (EIGEN_UNALIGNED_VECTORIZE || (actual_alignment>=required_alignment))) ? PacketAccessBit : 0 + }; + +public: + typedef _Scalar Scalar; + typedef Dense StorageKind; + typedef Eigen::Index StorageIndex; + typedef MatrixXpr XprKind; + enum { + RowsAtCompileTime = _Rows, + ColsAtCompileTime = _Cols, + MaxRowsAtCompileTime = _MaxRows, + MaxColsAtCompileTime = _MaxCols, + Flags = compute_matrix_flags<_Scalar, _Rows, _Cols, _Options, _MaxRows, _MaxCols>::ret, + Options = _Options, + InnerStrideAtCompileTime = 1, + OuterStrideAtCompileTime = (Options&RowMajor) ? ColsAtCompileTime : RowsAtCompileTime, + + // FIXME, the following flag in only used to define NeedsToAlign in PlainObjectBase + EvaluatorFlags = LinearAccessBit | DirectAccessBit | packet_access_bit | row_major_bit, + Alignment = actual_alignment + }; +}; +} + /** \class Matrix * \ingroup Core_Module * @@ -24,13 +63,13 @@ namespace Eigen { * The %Matrix class encompasses \em both fixed-size and dynamic-size objects (\ref fixedsize "note"). * * The first three template parameters are required: - * \tparam _Scalar \anchor matrix_tparam_scalar Numeric type, e.g. float, double, int or std::complex. - * User defined sclar types are supported as well (see \ref user_defined_scalars "here"). + * \tparam _Scalar Numeric type, e.g. float, double, int or std::complex. + * User defined scalar types are supported as well (see \ref user_defined_scalars "here"). * \tparam _Rows Number of rows, or \b Dynamic * \tparam _Cols Number of columns, or \b Dynamic * * The remaining template parameters are optional -- in most cases you don't have to worry about them. - * \tparam _Options \anchor matrix_tparam_options A combination of either \b #RowMajor or \b #ColMajor, and of either + * \tparam _Options A combination of either \b #RowMajor or \b #ColMajor, and of either * \b #AutoAlign or \b #DontAlign. * The former controls \ref TopicStorageOrders "storage order", and defaults to column-major. The latter controls alignment, which is required * for vectorization. It defaults to aligning matrices except for fixed sizes that aren't a multiple of the packet size. @@ -67,7 +106,7 @@ namespace Eigen { * \endcode * * This class can be extended with the help of the plugin mechanism described on the page - * \ref TopicCustomizingEigen by defining the preprocessor symbol \c EIGEN_MATRIX_PLUGIN. + * \ref TopicCustomizing_Plugins by defining the preprocessor symbol \c EIGEN_MATRIX_PLUGIN. * * Some notes: * @@ -97,32 +136,44 @@ namespace Eigen { * are the dimensions of the original matrix, while _Rows and _Cols are Dynamic. * * - * \see MatrixBase for the majority of the API methods for matrices, \ref TopicClassHierarchy, - * \ref TopicStorageOrders + * ABI and storage layout + * + * The table below summarizes the ABI of some possible Matrix instances which is fixed thorough the lifetime of Eigen 3. + * + * + * + * + * + * + *
Matrix typeEquivalent C structure
\code Matrix \endcode\code + * struct { + * T *data; // with (size_t(data)%EIGEN_MAX_ALIGN_BYTES)==0 + * Eigen::Index rows, cols; + * }; + * \endcode
\code + * Matrix + * Matrix \endcode\code + * struct { + * T *data; // with (size_t(data)%EIGEN_MAX_ALIGN_BYTES)==0 + * Eigen::Index size; + * }; + * \endcode
\code Matrix \endcode\code + * struct { + * T data[Rows*Cols]; // with (size_t(data)%A(Rows*Cols*sizeof(T)))==0 + * }; + * \endcode
\code Matrix \endcode\code + * struct { + * T data[MaxRows*MaxCols]; // with (size_t(data)%A(MaxRows*MaxCols*sizeof(T)))==0 + * Eigen::Index rows, cols; + * }; + * \endcode
+ * Note that in this table Rows, Cols, MaxRows and MaxCols are all positive integers. A(S) is defined to the largest possible power-of-two + * smaller to EIGEN_MAX_STATIC_ALIGN_BYTES. + * + * \see MatrixBase for the majority of the API methods for matrices, \ref TopicClassHierarchy, + * \ref TopicStorageOrders */ -namespace internal { -template -struct traits > -{ - typedef _Scalar Scalar; - typedef Dense StorageKind; - typedef DenseIndex Index; - typedef MatrixXpr XprKind; - enum { - RowsAtCompileTime = _Rows, - ColsAtCompileTime = _Cols, - MaxRowsAtCompileTime = _MaxRows, - MaxColsAtCompileTime = _MaxCols, - Flags = compute_matrix_flags<_Scalar, _Rows, _Cols, _Options, _MaxRows, _MaxCols>::ret, - CoeffReadCost = NumTraits::ReadCost, - Options = _Options, - InnerStrideAtCompileTime = 1, - OuterStrideAtCompileTime = (Options&RowMajor) ? ColsAtCompileTime : RowsAtCompileTime - }; -}; -} - template class Matrix : public PlainObjectBase > @@ -151,6 +202,7 @@ class Matrix * * \callgraph */ + EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Matrix& operator=(const Matrix& other) { return Base::_set(other); @@ -167,7 +219,8 @@ class Matrix * remain row-vectors and vectors remain vectors. */ template - EIGEN_STRONG_INLINE Matrix& operator=(const MatrixBase& other) + EIGEN_DEVICE_FUNC + EIGEN_STRONG_INLINE Matrix& operator=(const DenseBase& other) { return Base::_set(other); } @@ -179,12 +232,14 @@ class Matrix * \copydetails DenseBase::operator=(const EigenBase &other) */ template + EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Matrix& operator=(const EigenBase &other) { return Base::operator=(other); } template + EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Matrix& operator=(const ReturnByValue& func) { return Base::operator=(func); @@ -200,67 +255,137 @@ class Matrix * * \sa resize(Index,Index) */ - EIGEN_STRONG_INLINE Matrix() : Base() + EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE + Matrix() : Base() { Base::_check_template_params(); EIGEN_INITIALIZE_COEFFS_IF_THAT_OPTION_IS_ENABLED } // FIXME is it still needed - Matrix(internal::constructor_without_unaligned_array_assert) + EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE + explicit Matrix(internal::constructor_without_unaligned_array_assert) : Base(internal::constructor_without_unaligned_array_assert()) { Base::_check_template_params(); EIGEN_INITIALIZE_COEFFS_IF_THAT_OPTION_IS_ENABLED } -#ifdef EIGEN_HAVE_RVALUE_REFERENCES - Matrix(Matrix&& other) +#if EIGEN_HAS_RVALUE_REFERENCES + EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE + Matrix(Matrix&& other) EIGEN_NOEXCEPT_IF(std::is_nothrow_move_constructible::value) : Base(std::move(other)) { Base::_check_template_params(); - if (RowsAtCompileTime!=Dynamic && ColsAtCompileTime!=Dynamic) - Base::_set_noalias(other); } - Matrix& operator=(Matrix&& other) + EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE + Matrix& operator=(Matrix&& other) EIGEN_NOEXCEPT_IF(std::is_nothrow_move_assignable::value) { - other.swap(*this); + Base::operator=(std::move(other)); return *this; } #endif - /** \brief Constructs a vector or row-vector with given dimension. \only_for_vectors +#if EIGEN_HAS_CXX11 + /** \copydoc PlainObjectBase(const Scalar&, const Scalar&, const Scalar&, const Scalar&, const ArgTypes&... args) + * + * Example: \include Matrix_variadic_ctor_cxx11.cpp + * Output: \verbinclude Matrix_variadic_ctor_cxx11.out + * + * \sa Matrix(const std::initializer_list>&) + */ + template + EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE + Matrix(const Scalar& a0, const Scalar& a1, const Scalar& a2, const Scalar& a3, const ArgTypes&... args) + : Base(a0, a1, a2, a3, args...) {} + + /** \brief Constructs a Matrix and initializes it from the coefficients given as initializer-lists grouped by row. \cpp11 + * + * In the general case, the constructor takes a list of rows, each row being represented as a list of coefficients: + * + * Example: \include Matrix_initializer_list_23_cxx11.cpp + * Output: \verbinclude Matrix_initializer_list_23_cxx11.out + * + * Each of the inner initializer lists must contain the exact same number of elements, otherwise an assertion is triggered. + * + * In the case of a compile-time column vector, implicit transposition from a single row is allowed. + * Therefore VectorXd{{1,2,3,4,5}} is legal and the more verbose syntax + * RowVectorXd{{1},{2},{3},{4},{5}} can be avoided: * - * Note that this is only useful for dynamic-size vectors. For fixed-size vectors, - * it is redundant to pass the dimension here, so it makes more sense to use the default - * constructor Matrix() instead. + * Example: \include Matrix_initializer_list_vector_cxx11.cpp + * Output: \verbinclude Matrix_initializer_list_vector_cxx11.out + * + * In the case of fixed-sized matrices, the initializer list sizes must exactly match the matrix sizes, + * and implicit transposition is allowed for compile-time vectors only. + * + * \sa Matrix(const Scalar& a0, const Scalar& a1, const Scalar& a2, const Scalar& a3, const ArgTypes&... args) */ - EIGEN_STRONG_INLINE explicit Matrix(Index dim) - : Base(dim, RowsAtCompileTime == 1 ? 1 : dim, ColsAtCompileTime == 1 ? 1 : dim) + EIGEN_DEVICE_FUNC + explicit EIGEN_STRONG_INLINE Matrix(const std::initializer_list>& list) : Base(list) {} +#endif // end EIGEN_HAS_CXX11 + +#ifndef EIGEN_PARSED_BY_DOXYGEN + + // This constructor is for both 1x1 matrices and dynamic vectors + template + EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE + explicit Matrix(const T& x) { Base::_check_template_params(); - EIGEN_STATIC_ASSERT_VECTOR_ONLY(Matrix) - eigen_assert(dim >= 0); - eigen_assert(SizeAtCompileTime == Dynamic || SizeAtCompileTime == dim); - EIGEN_INITIALIZE_COEFFS_IF_THAT_OPTION_IS_ENABLED + Base::template _init1(x); } - #ifndef EIGEN_PARSED_BY_DOXYGEN template - EIGEN_STRONG_INLINE Matrix(const T0& x, const T1& y) + EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE + Matrix(const T0& x, const T1& y) { Base::_check_template_params(); Base::template _init2(x, y); } - #else + + +#else + /** \brief Constructs a fixed-sized matrix initialized with coefficients starting at \a data */ + EIGEN_DEVICE_FUNC + explicit Matrix(const Scalar *data); + + /** \brief Constructs a vector or row-vector with given dimension. \only_for_vectors + * + * This is useful for dynamic-size vectors. For fixed-size vectors, + * it is redundant to pass these parameters, so one should use the default constructor + * Matrix() instead. + * + * \warning This constructor is disabled for fixed-size \c 1x1 matrices. For instance, + * calling Matrix(1) will call the initialization constructor: Matrix(const Scalar&). + * For fixed-size \c 1x1 matrices it is therefore recommended to use the default + * constructor Matrix() instead, especially when using one of the non standard + * \c EIGEN_INITIALIZE_MATRICES_BY_{ZERO,\c NAN} macros (see \ref TopicPreprocessorDirectives). + */ + EIGEN_STRONG_INLINE explicit Matrix(Index dim); + /** \brief Constructs an initialized 1x1 matrix with the given coefficient + * \sa Matrix(const Scalar&, const Scalar&, const Scalar&, const Scalar&, const ArgTypes&...) */ + Matrix(const Scalar& x); /** \brief Constructs an uninitialized matrix with \a rows rows and \a cols columns. * * This is useful for dynamic-size matrices. For fixed-size matrices, * it is redundant to pass these parameters, so one should use the default constructor - * Matrix() instead. */ + * Matrix() instead. + * + * \warning This constructor is disabled for fixed-size \c 1x2 and \c 2x1 vectors. For instance, + * calling Matrix2f(2,1) will call the initialization constructor: Matrix(const Scalar& x, const Scalar& y). + * For fixed-size \c 1x2 or \c 2x1 vectors it is therefore recommended to use the default + * constructor Matrix() instead, especially when using one of the non standard + * \c EIGEN_INITIALIZE_MATRICES_BY_{ZERO,\c NAN} macros (see \ref TopicPreprocessorDirectives). + */ + EIGEN_DEVICE_FUNC Matrix(Index rows, Index cols); - /** \brief Constructs an initialized 2D vector with given coefficients */ + + /** \brief Constructs an initialized 2D vector with given coefficients + * \sa Matrix(const Scalar&, const Scalar&, const Scalar&, const Scalar&, const ArgTypes&...) */ Matrix(const Scalar& x, const Scalar& y); - #endif + #endif // end EIGEN_PARSED_BY_DOXYGEN - /** \brief Constructs an initialized 3D vector with given coefficients */ + /** \brief Constructs an initialized 3D vector with given coefficients + * \sa Matrix(const Scalar&, const Scalar&, const Scalar&, const Scalar&, const ArgTypes&...) + */ + EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Matrix(const Scalar& x, const Scalar& y, const Scalar& z) { Base::_check_template_params(); @@ -269,7 +394,10 @@ class Matrix m_storage.data()[1] = y; m_storage.data()[2] = z; } - /** \brief Constructs an initialized 4D vector with given coefficients */ + /** \brief Constructs an initialized 4D vector with given coefficients + * \sa Matrix(const Scalar&, const Scalar&, const Scalar&, const Scalar&, const ArgTypes&...) + */ + EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Matrix(const Scalar& x, const Scalar& y, const Scalar& z, const Scalar& w) { Base::_check_template_params(); @@ -280,76 +408,35 @@ class Matrix m_storage.data()[3] = w; } - explicit Matrix(const Scalar *data); - /** \brief Constructor copying the value of the expression \a other */ - template - EIGEN_STRONG_INLINE Matrix(const MatrixBase& other) - : Base(other.rows() * other.cols(), other.rows(), other.cols()) - { - // This test resides here, to bring the error messages closer to the user. Normally, these checks - // are performed deeply within the library, thus causing long and scary error traces. - EIGEN_STATIC_ASSERT((internal::is_same::value), - YOU_MIXED_DIFFERENT_NUMERIC_TYPES__YOU_NEED_TO_USE_THE_CAST_METHOD_OF_MATRIXBASE_TO_CAST_NUMERIC_TYPES_EXPLICITLY) - - Base::_check_template_params(); - Base::_set_noalias(other); - } /** \brief Copy constructor */ - EIGEN_STRONG_INLINE Matrix(const Matrix& other) - : Base(other.rows() * other.cols(), other.rows(), other.cols()) - { - Base::_check_template_params(); - Base::_set_noalias(other); - } - /** \brief Copy constructor with in-place evaluation */ - template - EIGEN_STRONG_INLINE Matrix(const ReturnByValue& other) - { - Base::_check_template_params(); - Base::resize(other.rows(), other.cols()); - other.evalTo(*this); - } + EIGEN_DEVICE_FUNC + EIGEN_STRONG_INLINE Matrix(const Matrix& other) : Base(other) + { } /** \brief Copy constructor for generic expressions. * \sa MatrixBase::operator=(const EigenBase&) */ template + EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Matrix(const EigenBase &other) - : Base(other.derived().rows() * other.derived().cols(), other.derived().rows(), other.derived().cols()) - { - Base::_check_template_params(); - Base::_resize_to_match(other); - // FIXME/CHECK: isn't *this = other.derived() more efficient. it allows to - // go for pure _set() implementations, right? - *this = other; - } + : Base(other.derived()) + { } - /** \internal - * \brief Override MatrixBase::swap() since for dynamic-sized matrices - * of same type it is enough to swap the data pointers. - */ - template - void swap(MatrixBase const & other) - { this->_swap(other.derived()); } - - inline Index innerStride() const { return 1; } - inline Index outerStride() const { return this->innerSize(); } + EIGEN_DEVICE_FUNC EIGEN_CONSTEXPR + inline Index innerStride() const EIGEN_NOEXCEPT { return 1; } + EIGEN_DEVICE_FUNC EIGEN_CONSTEXPR + inline Index outerStride() const EIGEN_NOEXCEPT { return this->innerSize(); } /////////// Geometry module /////////// template + EIGEN_DEVICE_FUNC explicit Matrix(const RotationBase& r); template + EIGEN_DEVICE_FUNC Matrix& operator=(const RotationBase& r); - #ifdef EIGEN2_SUPPORT - template - explicit Matrix(const eigen2_RotationBase& r); - template - Matrix& operator=(const eigen2_RotationBase& r); - #endif - // allow to extend Matrix outside Eigen #ifdef EIGEN_MATRIX_PLUGIN #include EIGEN_MATRIX_PLUGIN @@ -366,7 +453,7 @@ class Matrix * * \ingroup Core_Module * - * Eigen defines several typedef shortcuts for most common matrix and vector types. + * %Eigen defines several typedef shortcuts for most common matrix and vector types. * * The general patterns are the following: * @@ -379,6 +466,15 @@ class Matrix * There are also \c VectorSizeType and \c RowVectorSizeType which are self-explanatory. For example, \c Vector4cf is * a fixed-size vector of 4 complex floats. * + * With \cpp11, template alias are also defined for common sizes. + * They follow the same pattern as above except that the scalar type suffix is replaced by a + * template parameter, i.e.: + * - `MatrixSize` where `Size` can be \c 2,\c 3,\c 4 for fixed size square matrices or \c X for dynamic size. + * - `MatrixXSize` and `MatrixSizeX` where `Size` can be \c 2,\c 3,\c 4 for hybrid dynamic/fixed matrices. + * - `VectorSize` and `RowVectorSize` for column and row vectors. + * + * With \cpp11, you can also use fully generic column and row vector types: `Vector` and `RowVector`. + * * \sa class Matrix */ @@ -415,6 +511,55 @@ EIGEN_MAKE_TYPEDEFS_ALL_SIZES(std::complex, cd) #undef EIGEN_MAKE_TYPEDEFS #undef EIGEN_MAKE_FIXED_TYPEDEFS +#if EIGEN_HAS_CXX11 + +#define EIGEN_MAKE_TYPEDEFS(Size, SizeSuffix) \ +/** \ingroup matrixtypedefs */ \ +/** \brief \cpp11 */ \ +template \ +using Matrix##SizeSuffix = Matrix; \ +/** \ingroup matrixtypedefs */ \ +/** \brief \cpp11 */ \ +template \ +using Vector##SizeSuffix = Matrix; \ +/** \ingroup matrixtypedefs */ \ +/** \brief \cpp11 */ \ +template \ +using RowVector##SizeSuffix = Matrix; + +#define EIGEN_MAKE_FIXED_TYPEDEFS(Size) \ +/** \ingroup matrixtypedefs */ \ +/** \brief \cpp11 */ \ +template \ +using Matrix##Size##X = Matrix; \ +/** \ingroup matrixtypedefs */ \ +/** \brief \cpp11 */ \ +template \ +using Matrix##X##Size = Matrix; + +EIGEN_MAKE_TYPEDEFS(2, 2) +EIGEN_MAKE_TYPEDEFS(3, 3) +EIGEN_MAKE_TYPEDEFS(4, 4) +EIGEN_MAKE_TYPEDEFS(Dynamic, X) +EIGEN_MAKE_FIXED_TYPEDEFS(2) +EIGEN_MAKE_FIXED_TYPEDEFS(3) +EIGEN_MAKE_FIXED_TYPEDEFS(4) + +/** \ingroup matrixtypedefs + * \brief \cpp11 */ +template +using Vector = Matrix; + +/** \ingroup matrixtypedefs + * \brief \cpp11 */ +template +using RowVector = Matrix; + +#undef EIGEN_MAKE_TYPEDEFS +#undef EIGEN_MAKE_FIXED_TYPEDEFS + +#endif // EIGEN_HAS_CXX11 + } // end namespace Eigen #endif // EIGEN_MATRIX_H diff --git a/extern/eigen/Eigen/src/Core/MatrixBase.h b/extern/eigen/Eigen/src/Core/MatrixBase.h index e83ef4dc..45c3a596 100644 --- a/extern/eigen/Eigen/src/Core/MatrixBase.h +++ b/extern/eigen/Eigen/src/Core/MatrixBase.h @@ -41,9 +41,9 @@ namespace Eigen { * \endcode * * This class can be extended with the help of the plugin mechanism described on the page - * \ref TopicCustomizingEigen by defining the preprocessor symbol \c EIGEN_MATRIXBASE_PLUGIN. + * \ref TopicCustomizing_Plugins by defining the preprocessor symbol \c EIGEN_MATRIXBASE_PLUGIN. * - * \sa \ref TopicClassHierarchy + * \sa \blank \ref TopicClassHierarchy */ template class MatrixBase : public DenseBase @@ -52,7 +52,7 @@ template class MatrixBase #ifndef EIGEN_PARSED_BY_DOXYGEN typedef MatrixBase StorageBaseType; typedef typename internal::traits::StorageKind StorageKind; - typedef typename internal::traits::Index Index; + typedef typename internal::traits::StorageIndex StorageIndex; typedef typename internal::traits::Scalar Scalar; typedef typename internal::packet_traits::type PacketScalar; typedef typename NumTraits::Real RealScalar; @@ -66,7 +66,6 @@ template class MatrixBase using Base::MaxSizeAtCompileTime; using Base::IsVectorAtCompileTime; using Base::Flags; - using Base::CoeffReadCost; using Base::derived; using Base::const_cast_derived; @@ -77,6 +76,7 @@ template class MatrixBase using Base::coeffRef; using Base::lazyAssign; using Base::eval; + using Base::operator-; using Base::operator+=; using Base::operator-=; using Base::operator*=; @@ -98,25 +98,14 @@ template class MatrixBase /** \returns the size of the main diagonal, which is min(rows(),cols()). * \sa rows(), cols(), SizeAtCompileTime. */ - inline Index diagonalSize() const { return (std::min)(rows(),cols()); } + EIGEN_DEVICE_FUNC + inline Index diagonalSize() const { return (numext::mini)(rows(),cols()); } - /** \brief The plain matrix type corresponding to this expression. - * - * This is not necessarily exactly the return type of eval(). In the case of plain matrices, - * the return type of eval() is a const reference to a matrix, not a matrix! It is however guaranteed - * that the return type of eval() is either PlainObject or const PlainObject&. - */ - typedef Matrix::Scalar, - internal::traits::RowsAtCompileTime, - internal::traits::ColsAtCompileTime, - AutoAlign | (internal::traits::Flags&RowMajorBit ? RowMajor : ColMajor), - internal::traits::MaxRowsAtCompileTime, - internal::traits::MaxColsAtCompileTime - > PlainObject; + typedef typename Base::PlainObject PlainObject; #ifndef EIGEN_PARSED_BY_DOXYGEN /** \internal Represents a matrix with all coefficients equal to one another*/ - typedef CwiseNullaryOp,Derived> ConstantReturnType; + typedef CwiseNullaryOp,PlainObject> ConstantReturnType; /** \internal the return type of MatrixBase::adjoint() */ typedef typename internal::conditional::IsComplex, CwiseUnaryOp, ConstTransposeReturnType>, @@ -125,7 +114,7 @@ template class MatrixBase /** \internal Return type of eigenvalues() */ typedef Matrix, internal::traits::ColsAtCompileTime, 1, ColMajor> EigenvaluesReturnType; /** \internal the return type of identity */ - typedef CwiseNullaryOp,Derived> IdentityReturnType; + typedef CwiseNullaryOp,PlainObject> IdentityReturnType; /** \internal the return type of unit vectors */ typedef Block, SquareMatrixType>, internal::traits::RowsAtCompileTime, @@ -133,7 +122,7 @@ template class MatrixBase #endif // not EIGEN_PARSED_BY_DOXYGEN #define EIGEN_CURRENT_STORAGE_BASE_CLASS Eigen::MatrixBase -# include "../plugins/CommonCwiseUnaryOps.h" +#define EIGEN_DOC_UNARY_ADDONS(X,Y) # include "../plugins/CommonCwiseBinaryOps.h" # include "../plugins/MatrixCwiseUnaryOps.h" # include "../plugins/MatrixCwiseBinaryOps.h" @@ -141,41 +130,44 @@ template class MatrixBase # include EIGEN_MATRIXBASE_PLUGIN # endif #undef EIGEN_CURRENT_STORAGE_BASE_CLASS +#undef EIGEN_DOC_UNARY_ADDONS /** Special case of the template operator=, in order to prevent the compiler * from generating a default operator= (issue hit with g++ 4.1) */ + EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Derived& operator=(const MatrixBase& other); // We cannot inherit here via Base::operator= since it is causing // trouble with MSVC. template + EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Derived& operator=(const DenseBase& other); template + EIGEN_DEVICE_FUNC Derived& operator=(const EigenBase& other); template + EIGEN_DEVICE_FUNC Derived& operator=(const ReturnByValue& other); - template - Derived& lazyAssign(const ProductBase& other); - - template - Derived& lazyAssign(const MatrixPowerProduct& other); - template + EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Derived& operator+=(const MatrixBase& other); template + EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Derived& operator-=(const MatrixBase& other); template - const typename ProductReturnType::Type + EIGEN_DEVICE_FUNC + const Product operator*(const MatrixBase &other) const; template - const typename LazyProductReturnType::Type + EIGEN_DEVICE_FUNC + const Product lazyProduct(const MatrixBase &other) const; template @@ -188,85 +180,96 @@ template class MatrixBase void applyOnTheRight(const EigenBase& other); template - const DiagonalProduct + EIGEN_DEVICE_FUNC + const Product operator*(const DiagonalBase &diagonal) const; template - typename internal::scalar_product_traits::Scalar,typename internal::traits::Scalar>::ReturnType + EIGEN_DEVICE_FUNC + typename ScalarBinaryOpTraits::Scalar,typename internal::traits::Scalar>::ReturnType dot(const MatrixBase& other) const; - #ifdef EIGEN2_SUPPORT - template - Scalar eigen2_dot(const MatrixBase& other) const; - #endif - - RealScalar squaredNorm() const; - RealScalar norm() const; + EIGEN_DEVICE_FUNC RealScalar squaredNorm() const; + EIGEN_DEVICE_FUNC RealScalar norm() const; RealScalar stableNorm() const; RealScalar blueNorm() const; RealScalar hypotNorm() const; - const PlainObject normalized() const; - void normalize(); + EIGEN_DEVICE_FUNC const PlainObject normalized() const; + EIGEN_DEVICE_FUNC const PlainObject stableNormalized() const; + EIGEN_DEVICE_FUNC void normalize(); + EIGEN_DEVICE_FUNC void stableNormalize(); - const AdjointReturnType adjoint() const; - void adjointInPlace(); + EIGEN_DEVICE_FUNC const AdjointReturnType adjoint() const; + EIGEN_DEVICE_FUNC void adjointInPlace(); typedef Diagonal DiagonalReturnType; + EIGEN_DEVICE_FUNC DiagonalReturnType diagonal(); + typedef typename internal::add_const >::type ConstDiagonalReturnType; + EIGEN_DEVICE_FUNC ConstDiagonalReturnType diagonal() const; template struct DiagonalIndexReturnType { typedef Diagonal Type; }; template struct ConstDiagonalIndexReturnType { typedef const Diagonal Type; }; - template typename DiagonalIndexReturnType::Type diagonal(); - template typename ConstDiagonalIndexReturnType::Type diagonal() const; - + template + EIGEN_DEVICE_FUNC + typename DiagonalIndexReturnType::Type diagonal(); + + template + EIGEN_DEVICE_FUNC + typename ConstDiagonalIndexReturnType::Type diagonal() const; + typedef Diagonal DiagonalDynamicIndexReturnType; typedef typename internal::add_const >::type ConstDiagonalDynamicIndexReturnType; + EIGEN_DEVICE_FUNC DiagonalDynamicIndexReturnType diagonal(Index index); + EIGEN_DEVICE_FUNC ConstDiagonalDynamicIndexReturnType diagonal(Index index) const; - #ifdef EIGEN2_SUPPORT - template typename internal::eigen2_part_return_type::type part(); - template const typename internal::eigen2_part_return_type::type part() const; - - // huuuge hack. make Eigen2's matrix.part() work in eigen3. Problem: Diagonal is now a class template instead - // of an integer constant. Solution: overload the part() method template wrt template parameters list. - template class U> - const DiagonalWrapper part() const - { return diagonal().asDiagonal(); } - #endif // EIGEN2_SUPPORT - template struct TriangularViewReturnType { typedef TriangularView Type; }; template struct ConstTriangularViewReturnType { typedef const TriangularView Type; }; - template typename TriangularViewReturnType::Type triangularView(); - template typename ConstTriangularViewReturnType::Type triangularView() const; + template + EIGEN_DEVICE_FUNC + typename TriangularViewReturnType::Type triangularView(); + template + EIGEN_DEVICE_FUNC + typename ConstTriangularViewReturnType::Type triangularView() const; template struct SelfAdjointViewReturnType { typedef SelfAdjointView Type; }; template struct ConstSelfAdjointViewReturnType { typedef const SelfAdjointView Type; }; - template typename SelfAdjointViewReturnType::Type selfadjointView(); - template typename ConstSelfAdjointViewReturnType::Type selfadjointView() const; + template + EIGEN_DEVICE_FUNC + typename SelfAdjointViewReturnType::Type selfadjointView(); + template + EIGEN_DEVICE_FUNC + typename ConstSelfAdjointViewReturnType::Type selfadjointView() const; const SparseView sparseView(const Scalar& m_reference = Scalar(0), const typename NumTraits::Real& m_epsilon = NumTraits::dummy_precision()) const; - static const IdentityReturnType Identity(); - static const IdentityReturnType Identity(Index rows, Index cols); - static const BasisReturnType Unit(Index size, Index i); - static const BasisReturnType Unit(Index i); - static const BasisReturnType UnitX(); - static const BasisReturnType UnitY(); - static const BasisReturnType UnitZ(); - static const BasisReturnType UnitW(); - + EIGEN_DEVICE_FUNC static const IdentityReturnType Identity(); + EIGEN_DEVICE_FUNC static const IdentityReturnType Identity(Index rows, Index cols); + EIGEN_DEVICE_FUNC static const BasisReturnType Unit(Index size, Index i); + EIGEN_DEVICE_FUNC static const BasisReturnType Unit(Index i); + EIGEN_DEVICE_FUNC static const BasisReturnType UnitX(); + EIGEN_DEVICE_FUNC static const BasisReturnType UnitY(); + EIGEN_DEVICE_FUNC static const BasisReturnType UnitZ(); + EIGEN_DEVICE_FUNC static const BasisReturnType UnitW(); + + EIGEN_DEVICE_FUNC const DiagonalWrapper asDiagonal() const; const PermutationWrapper asPermutation() const; + EIGEN_DEVICE_FUNC Derived& setIdentity(); + EIGEN_DEVICE_FUNC Derived& setIdentity(Index rows, Index cols); + EIGEN_DEVICE_FUNC Derived& setUnit(Index i); + EIGEN_DEVICE_FUNC Derived& setUnit(Index newSize, Index i); bool isIdentity(const RealScalar& prec = NumTraits::dummy_precision()) const; bool isDiagonal(const RealScalar& prec = NumTraits::dummy_precision()) const; @@ -284,7 +287,7 @@ template class MatrixBase * fuzzy comparison such as isApprox() * \sa isApprox(), operator!= */ template - inline bool operator==(const MatrixBase& other) const + EIGEN_DEVICE_FUNC inline bool operator==(const MatrixBase& other) const { return cwiseEqual(other).all(); } /** \returns true if at least one pair of coefficients of \c *this and \a other are not exactly equal to each other. @@ -292,143 +295,142 @@ template class MatrixBase * fuzzy comparison such as isApprox() * \sa isApprox(), operator== */ template - inline bool operator!=(const MatrixBase& other) const + EIGEN_DEVICE_FUNC inline bool operator!=(const MatrixBase& other) const { return cwiseNotEqual(other).any(); } - NoAlias noalias(); + NoAlias EIGEN_DEVICE_FUNC noalias(); - inline const ForceAlignedAccess forceAlignedAccess() const; - inline ForceAlignedAccess forceAlignedAccess(); - template inline typename internal::add_const_on_value_type,Derived&>::type>::type forceAlignedAccessIf() const; - template inline typename internal::conditional,Derived&>::type forceAlignedAccessIf(); + // TODO forceAlignedAccess is temporarily disabled + // Need to find a nicer workaround. + inline const Derived& forceAlignedAccess() const { return derived(); } + inline Derived& forceAlignedAccess() { return derived(); } + template inline const Derived& forceAlignedAccessIf() const { return derived(); } + template inline Derived& forceAlignedAccessIf() { return derived(); } - Scalar trace() const; + EIGEN_DEVICE_FUNC Scalar trace() const; -/////////// Array module /////////// + template EIGEN_DEVICE_FUNC RealScalar lpNorm() const; - template RealScalar lpNorm() const; - - MatrixBase& matrix() { return *this; } - const MatrixBase& matrix() const { return *this; } + EIGEN_DEVICE_FUNC MatrixBase& matrix() { return *this; } + EIGEN_DEVICE_FUNC const MatrixBase& matrix() const { return *this; } /** \returns an \link Eigen::ArrayBase Array \endlink expression of this matrix * \sa ArrayBase::matrix() */ - ArrayWrapper array() { return derived(); } - const ArrayWrapper array() const { return derived(); } + EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE ArrayWrapper array() { return ArrayWrapper(derived()); } + /** \returns a const \link Eigen::ArrayBase Array \endlink expression of this matrix + * \sa ArrayBase::matrix() */ + EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE const ArrayWrapper array() const { return ArrayWrapper(derived()); } /////////// LU module /////////// - const FullPivLU fullPivLu() const; - const PartialPivLU partialPivLu() const; + inline const FullPivLU fullPivLu() const; + inline const PartialPivLU partialPivLu() const; - #if EIGEN2_SUPPORT_STAGE < STAGE20_RESOLVE_API_CONFLICTS - const LU lu() const; - #endif + inline const PartialPivLU lu() const; - #ifdef EIGEN2_SUPPORT - const LU eigen2_lu() const; - #endif - - #if EIGEN2_SUPPORT_STAGE > STAGE20_RESOLVE_API_CONFLICTS - const PartialPivLU lu() const; - #endif - - #ifdef EIGEN2_SUPPORT - template - void computeInverse(MatrixBase *result) const { - *result = this->inverse(); - } - #endif + EIGEN_DEVICE_FUNC + inline const Inverse inverse() const; - const internal::inverse_impl inverse() const; template - void computeInverseAndDetWithCheck( + inline void computeInverseAndDetWithCheck( ResultType& inverse, typename ResultType::Scalar& determinant, bool& invertible, const RealScalar& absDeterminantThreshold = NumTraits::dummy_precision() ) const; + template - void computeInverseWithCheck( + inline void computeInverseWithCheck( ResultType& inverse, bool& invertible, const RealScalar& absDeterminantThreshold = NumTraits::dummy_precision() ) const; + + EIGEN_DEVICE_FUNC Scalar determinant() const; /////////// Cholesky module /////////// - const LLT llt() const; - const LDLT ldlt() const; + inline const LLT llt() const; + inline const LDLT ldlt() const; /////////// QR module /////////// - const HouseholderQR householderQr() const; - const ColPivHouseholderQR colPivHouseholderQr() const; - const FullPivHouseholderQR fullPivHouseholderQr() const; - - #ifdef EIGEN2_SUPPORT - const QR qr() const; - #endif + inline const HouseholderQR householderQr() const; + inline const ColPivHouseholderQR colPivHouseholderQr() const; + inline const FullPivHouseholderQR fullPivHouseholderQr() const; + inline const CompleteOrthogonalDecomposition completeOrthogonalDecomposition() const; - EigenvaluesReturnType eigenvalues() const; - RealScalar operatorNorm() const; +/////////// Eigenvalues module /////////// -/////////// SVD module /////////// + inline EigenvaluesReturnType eigenvalues() const; + inline RealScalar operatorNorm() const; - JacobiSVD jacobiSvd(unsigned int computationOptions = 0) const; +/////////// SVD module /////////// - #ifdef EIGEN2_SUPPORT - SVD svd() const; - #endif + inline JacobiSVD jacobiSvd(unsigned int computationOptions = 0) const; + inline BDCSVD bdcSvd(unsigned int computationOptions = 0) const; /////////// Geometry module /////////// #ifndef EIGEN_PARSED_BY_DOXYGEN /// \internal helper struct to form the return type of the cross product template struct cross_product_return_type { - typedef typename internal::scalar_product_traits::Scalar,typename internal::traits::Scalar>::ReturnType Scalar; + typedef typename ScalarBinaryOpTraits::Scalar,typename internal::traits::Scalar>::ReturnType Scalar; typedef Matrix type; }; #endif // EIGEN_PARSED_BY_DOXYGEN template - typename cross_product_return_type::type + EIGEN_DEVICE_FUNC +#ifndef EIGEN_PARSED_BY_DOXYGEN + inline typename cross_product_return_type::type +#else + inline PlainObject +#endif cross(const MatrixBase& other) const; + template - PlainObject cross3(const MatrixBase& other) const; - PlainObject unitOrthogonal(void) const; - Matrix eulerAngles(Index a0, Index a1, Index a2) const; - - #if EIGEN2_SUPPORT_STAGE > STAGE20_RESOLVE_API_CONFLICTS - ScalarMultipleReturnType operator*(const UniformScaling& s) const; + EIGEN_DEVICE_FUNC + inline PlainObject cross3(const MatrixBase& other) const; + + EIGEN_DEVICE_FUNC + inline PlainObject unitOrthogonal(void) const; + + EIGEN_DEVICE_FUNC + inline Matrix eulerAngles(Index a0, Index a1, Index a2) const; + // put this as separate enum value to work around possible GCC 4.3 bug (?) - enum { HomogeneousReturnTypeDirection = ColsAtCompileTime==1?Vertical:Horizontal }; + enum { HomogeneousReturnTypeDirection = ColsAtCompileTime==1&&RowsAtCompileTime==1 ? ((internal::traits::Flags&RowMajorBit)==RowMajorBit ? Horizontal : Vertical) + : ColsAtCompileTime==1 ? Vertical : Horizontal }; typedef Homogeneous HomogeneousReturnType; - HomogeneousReturnType homogeneous() const; - #endif - + EIGEN_DEVICE_FUNC + inline HomogeneousReturnType homogeneous() const; + enum { SizeMinusOne = SizeAtCompileTime==Dynamic ? Dynamic : SizeAtCompileTime-1 }; typedef Block::ColsAtCompileTime==1 ? SizeMinusOne : 1, internal::traits::ColsAtCompileTime==1 ? 1 : SizeMinusOne> ConstStartMinusOne; - typedef CwiseUnaryOp::Scalar>, - const ConstStartMinusOne > HNormalizedReturnType; - - const HNormalizedReturnType hnormalized() const; + typedef EIGEN_EXPR_BINARYOP_SCALAR_RETURN_TYPE(ConstStartMinusOne,Scalar,quotient) HNormalizedReturnType; + EIGEN_DEVICE_FUNC + inline const HNormalizedReturnType hnormalized() const; ////////// Householder module /////////// + EIGEN_DEVICE_FUNC void makeHouseholderInPlace(Scalar& tau, RealScalar& beta); template + EIGEN_DEVICE_FUNC void makeHouseholder(EssentialPart& essential, Scalar& tau, RealScalar& beta) const; template + EIGEN_DEVICE_FUNC void applyHouseholderOnTheLeft(const EssentialPart& essential, const Scalar& tau, Scalar* workspace); template + EIGEN_DEVICE_FUNC void applyHouseholderOnTheRight(const EssentialPart& essential, const Scalar& tau, Scalar* workspace); @@ -436,8 +438,10 @@ template class MatrixBase ///////// Jacobi module ///////// template + EIGEN_DEVICE_FUNC void applyOnTheLeft(Index p, Index q, const JacobiRotation& j); template + EIGEN_DEVICE_FUNC void applyOnTheRight(Index p, Index q, const JacobiRotation& j); ///////// SparseCore module ///////// @@ -452,58 +456,38 @@ template class MatrixBase ///////// MatrixFunctions module ///////// typedef typename internal::stem_function::type StemFunction; - const MatrixExponentialReturnValue exp() const; +#define EIGEN_MATRIX_FUNCTION(ReturnType, Name, Description) \ + /** \returns an expression of the matrix Description of \c *this. \brief This function requires the unsupported MatrixFunctions module. To compute the coefficient-wise Description use ArrayBase::##Name . */ \ + const ReturnType Name() const; +#define EIGEN_MATRIX_FUNCTION_1(ReturnType, Name, Description, Argument) \ + /** \returns an expression of the matrix Description of \c *this. \brief This function requires the unsupported MatrixFunctions module. To compute the coefficient-wise Description use ArrayBase::##Name . */ \ + const ReturnType Name(Argument) const; + + EIGEN_MATRIX_FUNCTION(MatrixExponentialReturnValue, exp, exponential) + /** \brief Helper function for the unsupported MatrixFunctions module.*/ const MatrixFunctionReturnValue matrixFunction(StemFunction f) const; - const MatrixFunctionReturnValue cosh() const; - const MatrixFunctionReturnValue sinh() const; - const MatrixFunctionReturnValue cos() const; - const MatrixFunctionReturnValue sin() const; - const MatrixSquareRootReturnValue sqrt() const; - const MatrixLogarithmReturnValue log() const; - const MatrixPowerReturnValue pow(const RealScalar& p) const; - -#ifdef EIGEN2_SUPPORT - template - Derived& operator+=(const Flagged, 0, - EvalBeforeAssigningBit>& other); - - template - Derived& operator-=(const Flagged, 0, - EvalBeforeAssigningBit>& other); - - /** \deprecated because .lazy() is deprecated - * Overloaded for cache friendly product evaluation */ - template - Derived& lazyAssign(const Flagged& other) - { return lazyAssign(other._expression()); } - - template - const Flagged marked() const; - const Flagged lazy() const; - - inline const Cwise cwise() const; - inline Cwise cwise(); - - VectorBlock start(Index size); - const VectorBlock start(Index size) const; - VectorBlock end(Index size); - const VectorBlock end(Index size) const; - template VectorBlock start(); - template const VectorBlock start() const; - template VectorBlock end(); - template const VectorBlock end() const; - - Minor minor(Index row, Index col); - const Minor minor(Index row, Index col) const; + EIGEN_MATRIX_FUNCTION(MatrixFunctionReturnValue, cosh, hyperbolic cosine) + EIGEN_MATRIX_FUNCTION(MatrixFunctionReturnValue, sinh, hyperbolic sine) +#if EIGEN_HAS_CXX11_MATH + EIGEN_MATRIX_FUNCTION(MatrixFunctionReturnValue, atanh, inverse hyperbolic cosine) + EIGEN_MATRIX_FUNCTION(MatrixFunctionReturnValue, acosh, inverse hyperbolic cosine) + EIGEN_MATRIX_FUNCTION(MatrixFunctionReturnValue, asinh, inverse hyperbolic sine) #endif + EIGEN_MATRIX_FUNCTION(MatrixFunctionReturnValue, cos, cosine) + EIGEN_MATRIX_FUNCTION(MatrixFunctionReturnValue, sin, sine) + EIGEN_MATRIX_FUNCTION(MatrixSquareRootReturnValue, sqrt, square root) + EIGEN_MATRIX_FUNCTION(MatrixLogarithmReturnValue, log, logarithm) + EIGEN_MATRIX_FUNCTION_1(MatrixPowerReturnValue, pow, power to \c p, const RealScalar& p) + EIGEN_MATRIX_FUNCTION_1(MatrixComplexPowerReturnValue, pow, power to \c p, const std::complex& p) protected: - MatrixBase() : Base() {} + EIGEN_DEFAULT_COPY_CONSTRUCTOR(MatrixBase) + EIGEN_DEFAULT_EMPTY_CONSTRUCTOR_AND_DESTRUCTOR(MatrixBase) private: - explicit MatrixBase(int); - MatrixBase(int,int); - template explicit MatrixBase(const MatrixBase&); + EIGEN_DEVICE_FUNC explicit MatrixBase(int); + EIGEN_DEVICE_FUNC MatrixBase(int,int); + template EIGEN_DEVICE_FUNC explicit MatrixBase(const MatrixBase&); protected: // mixing arrays and matrices is not legal template Derived& operator+=(const ArrayBase& ) diff --git a/extern/eigen/Eigen/src/Core/NestByValue.h b/extern/eigen/Eigen/src/Core/NestByValue.h index a893b176..b4275768 100644 --- a/extern/eigen/Eigen/src/Core/NestByValue.h +++ b/extern/eigen/Eigen/src/Core/NestByValue.h @@ -13,25 +13,28 @@ namespace Eigen { +namespace internal { +template +struct traits > : public traits +{ + enum { + Flags = traits::Flags & ~NestByRefBit + }; +}; +} + /** \class NestByValue * \ingroup Core_Module * * \brief Expression which must be nested by value * - * \param ExpressionType the type of the object of which we are requiring nesting-by-value + * \tparam ExpressionType the type of the object of which we are requiring nesting-by-value * * This class is the return type of MatrixBase::nestByValue() * and most of the time this is the only way it is used. * * \sa MatrixBase::nestByValue() */ - -namespace internal { -template -struct traits > : public traits -{}; -} - template class NestByValue : public internal::dense_xpr_base< NestByValue >::type { @@ -40,58 +43,14 @@ template class NestByValue typedef typename internal::dense_xpr_base::type Base; EIGEN_DENSE_PUBLIC_INTERFACE(NestByValue) - inline NestByValue(const ExpressionType& matrix) : m_expression(matrix) {} - - inline Index rows() const { return m_expression.rows(); } - inline Index cols() const { return m_expression.cols(); } - inline Index outerStride() const { return m_expression.outerStride(); } - inline Index innerStride() const { return m_expression.innerStride(); } - - inline const CoeffReturnType coeff(Index row, Index col) const - { - return m_expression.coeff(row, col); - } - - inline Scalar& coeffRef(Index row, Index col) - { - return m_expression.const_cast_derived().coeffRef(row, col); - } - - inline const CoeffReturnType coeff(Index index) const - { - return m_expression.coeff(index); - } - - inline Scalar& coeffRef(Index index) - { - return m_expression.const_cast_derived().coeffRef(index); - } - - template - inline const PacketScalar packet(Index row, Index col) const - { - return m_expression.template packet(row, col); - } - - template - inline void writePacket(Index row, Index col, const PacketScalar& x) - { - m_expression.const_cast_derived().template writePacket(row, col, x); - } - - template - inline const PacketScalar packet(Index index) const - { - return m_expression.template packet(index); - } - - template - inline void writePacket(Index index, const PacketScalar& x) - { - m_expression.const_cast_derived().template writePacket(index, x); - } - - operator const ExpressionType&() const { return m_expression; } + EIGEN_DEVICE_FUNC explicit inline NestByValue(const ExpressionType& matrix) : m_expression(matrix) {} + + EIGEN_DEVICE_FUNC EIGEN_CONSTEXPR inline Index rows() const EIGEN_NOEXCEPT { return m_expression.rows(); } + EIGEN_DEVICE_FUNC EIGEN_CONSTEXPR inline Index cols() const EIGEN_NOEXCEPT { return m_expression.cols(); } + + EIGEN_DEVICE_FUNC operator const ExpressionType&() const { return m_expression; } + + EIGEN_DEVICE_FUNC const ExpressionType& nestedExpression() const { return m_expression; } protected: const ExpressionType m_expression; @@ -100,12 +59,27 @@ template class NestByValue /** \returns an expression of the temporary version of *this. */ template -inline const NestByValue +EIGEN_DEVICE_FUNC inline const NestByValue DenseBase::nestByValue() const { return NestByValue(derived()); } +namespace internal { + +// Evaluator of Solve -> eval into a temporary +template +struct evaluator > + : public evaluator +{ + typedef evaluator Base; + + EIGEN_DEVICE_FUNC explicit evaluator(const NestByValue& xpr) + : Base(xpr.nestedExpression()) + {} +}; +} + } // end namespace Eigen #endif // EIGEN_NESTBYVALUE_H diff --git a/extern/eigen/Eigen/src/Core/NoAlias.h b/extern/eigen/Eigen/src/Core/NoAlias.h index 768bfb18..570283d9 100644 --- a/extern/eigen/Eigen/src/Core/NoAlias.h +++ b/extern/eigen/Eigen/src/Core/NoAlias.h @@ -17,7 +17,7 @@ namespace Eigen { * * \brief Pseudo expression providing an operator = assuming no aliasing * - * \param ExpressionType the type of the object on which to do the lazy assignment + * \tparam ExpressionType the type of the object on which to do the lazy assignment * * This class represents an expression with special assignment operators * assuming no aliasing between the target expression and the source expression. @@ -30,62 +30,37 @@ namespace Eigen { template class StorageBase> class NoAlias { - typedef typename ExpressionType::Scalar Scalar; public: - NoAlias(ExpressionType& expression) : m_expression(expression) {} - - /** Behaves like MatrixBase::lazyAssign(other) - * \sa MatrixBase::lazyAssign() */ + typedef typename ExpressionType::Scalar Scalar; + + EIGEN_DEVICE_FUNC + explicit NoAlias(ExpressionType& expression) : m_expression(expression) {} + template + EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE ExpressionType& operator=(const StorageBase& other) - { return internal::assign_selector::run(m_expression,other.derived()); } - - /** \sa MatrixBase::operator+= */ + { + call_assignment_no_alias(m_expression, other.derived(), internal::assign_op()); + return m_expression; + } + template + EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE ExpressionType& operator+=(const StorageBase& other) { - typedef SelfCwiseBinaryOp, ExpressionType, OtherDerived> SelfAdder; - SelfAdder tmp(m_expression); - typedef typename internal::nested::type OtherDerivedNested; - typedef typename internal::remove_all::type _OtherDerivedNested; - internal::assign_selector::run(tmp,OtherDerivedNested(other.derived())); + call_assignment_no_alias(m_expression, other.derived(), internal::add_assign_op()); return m_expression; } - - /** \sa MatrixBase::operator-= */ + template + EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE ExpressionType& operator-=(const StorageBase& other) { - typedef SelfCwiseBinaryOp, ExpressionType, OtherDerived> SelfAdder; - SelfAdder tmp(m_expression); - typedef typename internal::nested::type OtherDerivedNested; - typedef typename internal::remove_all::type _OtherDerivedNested; - internal::assign_selector::run(tmp,OtherDerivedNested(other.derived())); + call_assignment_no_alias(m_expression, other.derived(), internal::sub_assign_op()); return m_expression; } -#ifndef EIGEN_PARSED_BY_DOXYGEN - template - EIGEN_STRONG_INLINE ExpressionType& operator+=(const ProductBase& other) - { other.derived().addTo(m_expression); return m_expression; } - - template - EIGEN_STRONG_INLINE ExpressionType& operator-=(const ProductBase& other) - { other.derived().subTo(m_expression); return m_expression; } - - template - EIGEN_STRONG_INLINE ExpressionType& operator+=(const CoeffBasedProduct& other) - { return m_expression.derived() += CoeffBasedProduct(other.lhs(), other.rhs()); } - - template - EIGEN_STRONG_INLINE ExpressionType& operator-=(const CoeffBasedProduct& other) - { return m_expression.derived() -= CoeffBasedProduct(other.lhs(), other.rhs()); } - - template - ExpressionType& operator=(const ReturnByValue& func) - { return m_expression = func; } -#endif - + EIGEN_DEVICE_FUNC ExpressionType& expression() const { return m_expression; @@ -100,10 +75,10 @@ class NoAlias * * More precisely, noalias() allows to bypass the EvalBeforeAssignBit flag. * Currently, even though several expressions may alias, only product - * expressions have this flag. Therefore, noalias() is only usefull when + * expressions have this flag. Therefore, noalias() is only useful when * the source expression contains a matrix product. * - * Here are some examples where noalias is usefull: + * Here are some examples where noalias is useful: * \code * D.noalias() = A * B; * D.noalias() += A.transpose() * B; @@ -124,9 +99,9 @@ class NoAlias * \sa class NoAlias */ template -NoAlias MatrixBase::noalias() +NoAlias EIGEN_DEVICE_FUNC MatrixBase::noalias() { - return derived(); + return NoAlias(derived()); } } // end namespace Eigen diff --git a/extern/eigen/Eigen/src/Core/NumTraits.h b/extern/eigen/Eigen/src/Core/NumTraits.h index bac9e50b..72eac5a9 100644 --- a/extern/eigen/Eigen/src/Core/NumTraits.h +++ b/extern/eigen/Eigen/src/Core/NumTraits.h @@ -12,24 +12,112 @@ namespace Eigen { +namespace internal { + +// default implementation of digits10(), based on numeric_limits if specialized, +// 0 for integer types, and log10(epsilon()) otherwise. +template< typename T, + bool use_numeric_limits = std::numeric_limits::is_specialized, + bool is_integer = NumTraits::IsInteger> +struct default_digits10_impl +{ + EIGEN_DEVICE_FUNC EIGEN_CONSTEXPR + static int run() { return std::numeric_limits::digits10; } +}; + +template +struct default_digits10_impl // Floating point +{ + EIGEN_DEVICE_FUNC EIGEN_CONSTEXPR + static int run() { + using std::log10; + using std::ceil; + typedef typename NumTraits::Real Real; + return int(ceil(-log10(NumTraits::epsilon()))); + } +}; + +template +struct default_digits10_impl // Integer +{ + EIGEN_DEVICE_FUNC EIGEN_CONSTEXPR + static int run() { return 0; } +}; + + +// default implementation of digits(), based on numeric_limits if specialized, +// 0 for integer types, and log2(epsilon()) otherwise. +template< typename T, + bool use_numeric_limits = std::numeric_limits::is_specialized, + bool is_integer = NumTraits::IsInteger> +struct default_digits_impl +{ + EIGEN_DEVICE_FUNC EIGEN_CONSTEXPR + static int run() { return std::numeric_limits::digits; } +}; + +template +struct default_digits_impl // Floating point +{ + EIGEN_DEVICE_FUNC EIGEN_CONSTEXPR + static int run() { + using std::log; + using std::ceil; + typedef typename NumTraits::Real Real; + return int(ceil(-log(NumTraits::epsilon())/log(static_cast(2)))); + } +}; + +template +struct default_digits_impl // Integer +{ + EIGEN_DEVICE_FUNC EIGEN_CONSTEXPR + static int run() { return 0; } +}; + +} // end namespace internal + +namespace numext { +/** \internal bit-wise cast without changing the underlying bit representation. */ + +// TODO: Replace by std::bit_cast (available in C++20) +template +EIGEN_STRONG_INLINE EIGEN_DEVICE_FUNC Tgt bit_cast(const Src& src) { +#if EIGEN_HAS_TYPE_TRAITS + // The behaviour of memcpy is not specified for non-trivially copyable types + EIGEN_STATIC_ASSERT(std::is_trivially_copyable::value, THIS_TYPE_IS_NOT_SUPPORTED); + EIGEN_STATIC_ASSERT(std::is_trivially_copyable::value && std::is_default_constructible::value, + THIS_TYPE_IS_NOT_SUPPORTED); +#endif + + EIGEN_STATIC_ASSERT(sizeof(Src) == sizeof(Tgt), THIS_TYPE_IS_NOT_SUPPORTED); + Tgt tgt; + EIGEN_USING_STD(memcpy) + memcpy(&tgt, &src, sizeof(Tgt)); + return tgt; +} +} // namespace numext + /** \class NumTraits * \ingroup Core_Module * * \brief Holds information about the various numeric (i.e. scalar) types allowed by Eigen. * - * \param T the numeric type at hand + * \tparam T the numeric type at hand * * This class stores enums, typedefs and static methods giving information about a numeric type. * * The provided data consists of: - * \li A typedef \a Real, giving the "real part" type of \a T. If \a T is already real, - * then \a Real is just a typedef to \a T. If \a T is \c std::complex then \a Real + * \li A typedef \c Real, giving the "real part" type of \a T. If \a T is already real, + * then \c Real is just a typedef to \a T. If \a T is \c std::complex then \c Real * is a typedef to \a U. - * \li A typedef \a NonInteger, giving the type that should be used for operations producing non-integral values, + * \li A typedef \c NonInteger, giving the type that should be used for operations producing non-integral values, * such as quotients, square roots, etc. If \a T is a floating-point type, then this typedef just gives * \a T again. Note however that many Eigen functions such as internal::sqrt simply refuse to * take integers. Outside of a few cases, Eigen doesn't do automatic type promotion. Thus, this typedef is * only intended as a helper for code that needs to explicitly promote types. + * \li A typedef \c Literal giving the type to use for numeric literals such as "2" or "0.5". For instance, for \c std::complex, Literal is defined as \c U. + * Of course, this type must be fully compatible with \a T. In doubt, just use \a T here. * \li A typedef \a Nested giving the type to use to nest a value inside of the expression tree. If you don't know what * this means, just use \a T here. * \li An enum value \a IsComplex. It is equal to 1 if \a T is a \c std::complex @@ -38,14 +126,27 @@ namespace Eigen { * and to \c 0 otherwise. * \li Enum values ReadCost, AddCost and MulCost representing a rough estimate of the number of CPU cycles needed * to by move / add / mul instructions respectively, assuming the data is already stored in CPU registers. - * Stay vague here. No need to do architecture-specific stuff. + * Stay vague here. No need to do architecture-specific stuff. If you don't know what this means, just use \c Eigen::HugeCost. * \li An enum value \a IsSigned. It is equal to \c 1 if \a T is a signed type and to 0 if \a T is unsigned. * \li An enum value \a RequireInitialization. It is equal to \c 1 if the constructor of the numeric type \a T must * be called, and to 0 if it is safe not to call it. Default is 0 if \a T is an arithmetic type, and 1 otherwise. - * \li An epsilon() function which, unlike std::numeric_limits::epsilon(), returns a \a Real instead of a \a T. + * \li An epsilon() function which, unlike std::numeric_limits::epsilon(), + * it returns a \a Real instead of a \a T. * \li A dummy_precision() function returning a weak epsilon value. It is mainly used as a default * value by the fuzzy comparison operators. * \li highest() and lowest() functions returning the highest and lowest possible values respectively. + * \li digits() function returning the number of radix digits (non-sign digits for integers, mantissa for floating-point). This is + * the analogue of std::numeric_limits::digits + * which is used as the default implementation if specialized. + * \li digits10() function returning the number of decimal digits that can be represented without change. This is + * the analogue of std::numeric_limits::digits10 + * which is used as the default implementation if specialized. + * \li min_exponent() and max_exponent() functions returning the highest and lowest possible values, respectively, + * such that the radix raised to the power exponent-1 is a normalized floating-point number. These are equivalent to + * std::numeric_limits::min_exponent/ + * std::numeric_limits::max_exponent. + * \li infinity() function returning a representation of positive infinity, if available. + * \li quiet_NaN function returning a non-signaling "not-a-number", if available. */ template struct GenericNumTraits @@ -67,22 +168,65 @@ template struct GenericNumTraits T >::type NonInteger; typedef T Nested; + typedef T Literal; + + EIGEN_DEVICE_FUNC EIGEN_CONSTEXPR + static inline Real epsilon() + { + return numext::numeric_limits::epsilon(); + } + + EIGEN_DEVICE_FUNC EIGEN_CONSTEXPR + static inline int digits10() + { + return internal::default_digits10_impl::run(); + } - static inline Real epsilon() { return std::numeric_limits::epsilon(); } + EIGEN_DEVICE_FUNC EIGEN_CONSTEXPR + static inline int digits() + { + return internal::default_digits_impl::run(); + } + + EIGEN_DEVICE_FUNC EIGEN_CONSTEXPR + static inline int min_exponent() + { + return numext::numeric_limits::min_exponent; + } + + EIGEN_DEVICE_FUNC EIGEN_CONSTEXPR + static inline int max_exponent() + { + return numext::numeric_limits::max_exponent; + } + + EIGEN_DEVICE_FUNC EIGEN_CONSTEXPR static inline Real dummy_precision() { // make sure to override this for floating-point types return Real(0); } - static inline T highest() { return (std::numeric_limits::max)(); } - static inline T lowest() { return IsInteger ? (std::numeric_limits::min)() : (-(std::numeric_limits::max)()); } - -#ifdef EIGEN2_SUPPORT - enum { - HasFloatingPoint = !IsInteger - }; - typedef NonInteger FloatingPoint; -#endif + + EIGEN_DEVICE_FUNC EIGEN_CONSTEXPR + static inline T highest() { + return (numext::numeric_limits::max)(); + } + + EIGEN_DEVICE_FUNC EIGEN_CONSTEXPR + static inline T lowest() { + return IsInteger ? (numext::numeric_limits::min)() + : static_cast(-(numext::numeric_limits::max)()); + } + + EIGEN_DEVICE_FUNC EIGEN_CONSTEXPR + static inline T infinity() { + return numext::numeric_limits::infinity(); + } + + EIGEN_DEVICE_FUNC EIGEN_CONSTEXPR + static inline T quiet_NaN() { + return numext::numeric_limits::quiet_NaN(); + } }; template struct NumTraits : GenericNumTraits @@ -91,17 +235,20 @@ template struct NumTraits : GenericNumTraits template<> struct NumTraits : GenericNumTraits { + EIGEN_DEVICE_FUNC EIGEN_CONSTEXPR static inline float dummy_precision() { return 1e-5f; } }; template<> struct NumTraits : GenericNumTraits { + EIGEN_DEVICE_FUNC EIGEN_CONSTEXPR static inline double dummy_precision() { return 1e-12; } }; template<> struct NumTraits : GenericNumTraits { + EIGEN_CONSTEXPR static inline long double dummy_precision() { return 1e-15l; } }; @@ -109,6 +256,7 @@ template struct NumTraits > : GenericNumTraits > { typedef _Real Real; + typedef typename NumTraits<_Real>::Literal Literal; enum { IsComplex = 1, RequireInitialization = NumTraits<_Real>::RequireInitialization, @@ -117,8 +265,12 @@ template struct NumTraits > MulCost = 4 * NumTraits::MulCost + 2 * NumTraits::AddCost }; + EIGEN_DEVICE_FUNC EIGEN_CONSTEXPR static inline Real epsilon() { return NumTraits::epsilon(); } + EIGEN_DEVICE_FUNC EIGEN_CONSTEXPR static inline Real dummy_precision() { return NumTraits::dummy_precision(); } + EIGEN_DEVICE_FUNC EIGEN_CONSTEXPR + static inline int digits10() { return NumTraits::digits10(); } }; template @@ -130,21 +282,54 @@ struct NumTraits > typedef typename NumTraits::NonInteger NonIntegerScalar; typedef Array NonInteger; typedef ArrayType & Nested; - + typedef typename NumTraits::Literal Literal; + enum { IsComplex = NumTraits::IsComplex, IsInteger = NumTraits::IsInteger, IsSigned = NumTraits::IsSigned, RequireInitialization = 1, - ReadCost = ArrayType::SizeAtCompileTime==Dynamic ? Dynamic : ArrayType::SizeAtCompileTime * NumTraits::ReadCost, - AddCost = ArrayType::SizeAtCompileTime==Dynamic ? Dynamic : ArrayType::SizeAtCompileTime * NumTraits::AddCost, - MulCost = ArrayType::SizeAtCompileTime==Dynamic ? Dynamic : ArrayType::SizeAtCompileTime * NumTraits::MulCost + ReadCost = ArrayType::SizeAtCompileTime==Dynamic ? HugeCost : ArrayType::SizeAtCompileTime * int(NumTraits::ReadCost), + AddCost = ArrayType::SizeAtCompileTime==Dynamic ? HugeCost : ArrayType::SizeAtCompileTime * int(NumTraits::AddCost), + MulCost = ArrayType::SizeAtCompileTime==Dynamic ? HugeCost : ArrayType::SizeAtCompileTime * int(NumTraits::MulCost) }; - + + EIGEN_DEVICE_FUNC EIGEN_CONSTEXPR static inline RealScalar epsilon() { return NumTraits::epsilon(); } + EIGEN_DEVICE_FUNC EIGEN_CONSTEXPR static inline RealScalar dummy_precision() { return NumTraits::dummy_precision(); } + + EIGEN_CONSTEXPR + static inline int digits10() { return NumTraits::digits10(); } +}; + +template<> struct NumTraits + : GenericNumTraits +{ + enum { + RequireInitialization = 1, + ReadCost = HugeCost, + AddCost = HugeCost, + MulCost = HugeCost + }; + + EIGEN_CONSTEXPR + static inline int digits10() { return 0; } + +private: + static inline std::string epsilon(); + static inline std::string dummy_precision(); + static inline std::string lowest(); + static inline std::string highest(); + static inline std::string infinity(); + static inline std::string quiet_NaN(); }; +// Empty specialization for void to allow template specialization based on NumTraits::Real with T==void and SFINAE. +template<> struct NumTraits {}; + +template<> struct NumTraits : GenericNumTraits {}; + } // end namespace Eigen #endif // EIGEN_NUMTRAITS_H diff --git a/extern/eigen/Eigen/src/Core/PartialReduxEvaluator.h b/extern/eigen/Eigen/src/Core/PartialReduxEvaluator.h new file mode 100644 index 00000000..29abf35b --- /dev/null +++ b/extern/eigen/Eigen/src/Core/PartialReduxEvaluator.h @@ -0,0 +1,232 @@ +// This file is part of Eigen, a lightweight C++ template library +// for linear algebra. +// +// Copyright (C) 2011-2018 Gael Guennebaud +// +// This Source Code Form is subject to the terms of the Mozilla +// Public License v. 2.0. If a copy of the MPL was not distributed +// with this file, You can obtain one at http://mozilla.org/MPL/2.0/. + +#ifndef EIGEN_PARTIALREDUX_H +#define EIGEN_PARTIALREDUX_H + +namespace Eigen { + +namespace internal { + + +/*************************************************************************** +* +* This file provides evaluators for partial reductions. +* There are two modes: +* +* - scalar path: simply calls the respective function on the column or row. +* -> nothing special here, all the tricky part is handled by the return +* types of VectorwiseOp's members. They embed the functor calling the +* respective DenseBase's member function. +* +* - vectorized path: implements a packet-wise reductions followed by +* some (optional) processing of the outcome, e.g., division by n for mean. +* +* For the vectorized path let's observe that the packet-size and outer-unrolling +* are both decided by the assignement logic. So all we have to do is to decide +* on the inner unrolling. +* +* For the unrolling, we can reuse "internal::redux_vec_unroller" from Redux.h, +* but be need to be careful to specify correct increment. +* +***************************************************************************/ + + +/* logic deciding a strategy for unrolling of vectorized paths */ +template +struct packetwise_redux_traits +{ + enum { + OuterSize = int(Evaluator::IsRowMajor) ? Evaluator::RowsAtCompileTime : Evaluator::ColsAtCompileTime, + Cost = OuterSize == Dynamic ? HugeCost + : OuterSize * Evaluator::CoeffReadCost + (OuterSize-1) * functor_traits::Cost, + Unrolling = Cost <= EIGEN_UNROLLING_LIMIT ? CompleteUnrolling : NoUnrolling + }; + +}; + +/* Value to be returned when size==0 , by default let's return 0 */ +template +EIGEN_DEVICE_FUNC +PacketType packetwise_redux_empty_value(const Func& ) { return pset1(0); } + +/* For products the default is 1 */ +template +EIGEN_DEVICE_FUNC +PacketType packetwise_redux_empty_value(const scalar_product_op& ) { return pset1(1); } + +/* Perform the actual reduction */ +template::Unrolling +> +struct packetwise_redux_impl; + +/* Perform the actual reduction with unrolling */ +template +struct packetwise_redux_impl +{ + typedef redux_novec_unroller Base; + typedef typename Evaluator::Scalar Scalar; + + template + EIGEN_DEVICE_FUNC static EIGEN_STRONG_INLINE + PacketType run(const Evaluator &eval, const Func& func, Index /*size*/) + { + return redux_vec_unroller::OuterSize>::template run(eval,func); + } +}; + +/* Add a specialization of redux_vec_unroller for size==0 at compiletime. + * This specialization is not required for general reductions, which is + * why it is defined here. + */ +template +struct redux_vec_unroller +{ + template + EIGEN_DEVICE_FUNC + static EIGEN_STRONG_INLINE PacketType run(const Evaluator &, const Func& f) + { + return packetwise_redux_empty_value(f); + } +}; + +/* Perform the actual reduction for dynamic sizes */ +template +struct packetwise_redux_impl +{ + typedef typename Evaluator::Scalar Scalar; + typedef typename redux_traits::PacketType PacketScalar; + + template + EIGEN_DEVICE_FUNC + static PacketType run(const Evaluator &eval, const Func& func, Index size) + { + if(size==0) + return packetwise_redux_empty_value(func); + + const Index size4 = (size-1)&(~3); + PacketType p = eval.template packetByOuterInner(0,0); + Index i = 1; + // This loop is optimized for instruction pipelining: + // - each iteration generates two independent instructions + // - thanks to branch prediction and out-of-order execution we have independent instructions across loops + for(; i(i+0,0),eval.template packetByOuterInner(i+1,0)), + func.packetOp(eval.template packetByOuterInner(i+2,0),eval.template packetByOuterInner(i+3,0)))); + for(; i(i,0)); + return p; + } +}; + +template< typename ArgType, typename MemberOp, int Direction> +struct evaluator > + : evaluator_base > +{ + typedef PartialReduxExpr XprType; + typedef typename internal::nested_eval::type ArgTypeNested; + typedef typename internal::add_const_on_value_type::type ConstArgTypeNested; + typedef typename internal::remove_all::type ArgTypeNestedCleaned; + typedef typename ArgType::Scalar InputScalar; + typedef typename XprType::Scalar Scalar; + enum { + TraversalSize = Direction==int(Vertical) ? int(ArgType::RowsAtCompileTime) : int(ArgType::ColsAtCompileTime) + }; + typedef typename MemberOp::template Cost CostOpType; + enum { + CoeffReadCost = TraversalSize==Dynamic ? HugeCost + : TraversalSize==0 ? 1 + : int(TraversalSize) * int(evaluator::CoeffReadCost) + int(CostOpType::value), + + _ArgFlags = evaluator::Flags, + + _Vectorizable = bool(int(_ArgFlags)&PacketAccessBit) + && bool(MemberOp::Vectorizable) + && (Direction==int(Vertical) ? bool(_ArgFlags&RowMajorBit) : (_ArgFlags&RowMajorBit)==0) + && (TraversalSize!=0), + + Flags = (traits::Flags&RowMajorBit) + | (evaluator::Flags&(HereditaryBits&(~RowMajorBit))) + | (_Vectorizable ? PacketAccessBit : 0) + | LinearAccessBit, + + Alignment = 0 // FIXME this will need to be improved once PartialReduxExpr is vectorized + }; + + EIGEN_DEVICE_FUNC explicit evaluator(const XprType xpr) + : m_arg(xpr.nestedExpression()), m_functor(xpr.functor()) + { + EIGEN_INTERNAL_CHECK_COST_VALUE(TraversalSize==Dynamic ? HugeCost : (TraversalSize==0 ? 1 : int(CostOpType::value))); + EIGEN_INTERNAL_CHECK_COST_VALUE(CoeffReadCost); + } + + typedef typename XprType::CoeffReturnType CoeffReturnType; + + EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE + const Scalar coeff(Index i, Index j) const + { + return coeff(Direction==Vertical ? j : i); + } + + EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE + const Scalar coeff(Index index) const + { + return m_functor(m_arg.template subVector(index)); + } + + template + EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE + PacketType packet(Index i, Index j) const + { + return packet(Direction==Vertical ? j : i); + } + + template + EIGEN_STRONG_INLINE EIGEN_DEVICE_FUNC + PacketType packet(Index idx) const + { + enum { PacketSize = internal::unpacket_traits::size }; + typedef Block PanelType; + + PanelType panel(m_arg, + Direction==Vertical ? 0 : idx, + Direction==Vertical ? idx : 0, + Direction==Vertical ? m_arg.rows() : Index(PacketSize), + Direction==Vertical ? Index(PacketSize) : m_arg.cols()); + + // FIXME + // See bug 1612, currently if PacketSize==1 (i.e. complex with 128bits registers) then the storage-order of panel get reversed + // and methods like packetByOuterInner do not make sense anymore in this context. + // So let's just by pass "vectorization" in this case: + if(PacketSize==1) + return internal::pset1(coeff(idx)); + + typedef typename internal::redux_evaluator PanelEvaluator; + PanelEvaluator panel_eval(panel); + typedef typename MemberOp::BinaryOp BinaryOp; + PacketType p = internal::packetwise_redux_impl::template run(panel_eval,m_functor.binaryFunc(),m_arg.outerSize()); + return p; + } + +protected: + ConstArgTypeNested m_arg; + const MemberOp m_functor; +}; + +} // end namespace internal + +} // end namespace Eigen + +#endif // EIGEN_PARTIALREDUX_H diff --git a/extern/eigen/Eigen/src/Core/PermutationMatrix.h b/extern/eigen/Eigen/src/Core/PermutationMatrix.h index 85ffae26..69401bf4 100644 --- a/extern/eigen/Eigen/src/Core/PermutationMatrix.h +++ b/extern/eigen/Eigen/src/Core/PermutationMatrix.h @@ -2,7 +2,7 @@ // for linear algebra. // // Copyright (C) 2009 Benoit Jacob -// Copyright (C) 2009-2011 Gael Guennebaud +// Copyright (C) 2009-2015 Gael Guennebaud // // This Source Code Form is subject to the terms of the Mozilla // Public License v. 2.0. If a copy of the MPL was not distributed @@ -13,14 +13,18 @@ namespace Eigen { -template class PermutedImpl; +namespace internal { + +enum PermPermProduct_t {PermPermProduct}; + +} // end namespace internal /** \class PermutationBase * \ingroup Core_Module * * \brief Base class for permutations * - * \param Derived the derived class + * \tparam Derived the derived class * * This class is the base class for all expressions representing a permutation matrix, * internally stored as a vector of integers. @@ -38,17 +42,6 @@ template -struct permut_matrix_product_retval; -template -struct permut_sparsematrix_product_retval; -enum PermPermProduct_t {PermPermProduct}; - -} // end namespace internal - template class PermutationBase : public EigenBase { @@ -60,19 +53,20 @@ class PermutationBase : public EigenBase typedef typename Traits::IndicesType IndicesType; enum { Flags = Traits::Flags, - CoeffReadCost = Traits::CoeffReadCost, RowsAtCompileTime = Traits::RowsAtCompileTime, ColsAtCompileTime = Traits::ColsAtCompileTime, MaxRowsAtCompileTime = Traits::MaxRowsAtCompileTime, MaxColsAtCompileTime = Traits::MaxColsAtCompileTime }; - typedef typename Traits::Scalar Scalar; - typedef typename Traits::Index Index; - typedef Matrix + typedef typename Traits::StorageIndex StorageIndex; + typedef Matrix DenseMatrixType; - typedef PermutationMatrix + typedef PermutationMatrix PlainPermutationType; + typedef PlainPermutationType PlainObject; using Base::derived; + typedef Inverse InverseReturnType; + typedef void Scalar; #endif /** Copies the other permutation into *this */ @@ -93,32 +87,21 @@ class PermutationBase : public EigenBase return derived(); } - #ifndef EIGEN_PARSED_BY_DOXYGEN - /** This is a special case of the templated operator=. Its purpose is to - * prevent a default operator= from hiding the templated operator=. - */ - Derived& operator=(const PermutationBase& other) - { - indices() = other.indices(); - return derived(); - } - #endif - /** \returns the number of rows */ - inline Index rows() const { return Index(indices().size()); } + inline EIGEN_DEVICE_FUNC Index rows() const { return Index(indices().size()); } /** \returns the number of columns */ - inline Index cols() const { return Index(indices().size()); } + inline EIGEN_DEVICE_FUNC Index cols() const { return Index(indices().size()); } /** \returns the size of a side of the respective square matrix, i.e., the number of indices */ - inline Index size() const { return Index(indices().size()); } + inline EIGEN_DEVICE_FUNC Index size() const { return Index(indices().size()); } #ifndef EIGEN_PARSED_BY_DOXYGEN template void evalTo(MatrixBase& other) const { other.setZero(); - for (int i=0; i /** Sets *this to be the identity permutation matrix */ void setIdentity() { - for(Index i = 0; i < size(); ++i) + StorageIndex n = StorageIndex(size()); + for(StorageIndex i = 0; i < n; ++i) indices().coeffRef(i) = i; } @@ -163,18 +147,18 @@ class PermutationBase : public EigenBase * * \returns a reference to *this. * - * \warning This is much slower than applyTranspositionOnTheRight(int,int): + * \warning This is much slower than applyTranspositionOnTheRight(Index,Index): * this has linear complexity and requires a lot of branching. * - * \sa applyTranspositionOnTheRight(int,int) + * \sa applyTranspositionOnTheRight(Index,Index) */ Derived& applyTranspositionOnTheLeft(Index i, Index j) { eigen_assert(i>=0 && j>=0 && i * * This is a fast operation, it only consists in swapping two indices. * - * \sa applyTranspositionOnTheLeft(int,int) + * \sa applyTranspositionOnTheLeft(Index,Index) */ Derived& applyTranspositionOnTheRight(Index i, Index j) { @@ -196,16 +180,16 @@ class PermutationBase : public EigenBase /** \returns the inverse permutation matrix. * - * \note \note_try_to_help_rvo + * \note \blank \note_try_to_help_rvo */ - inline Transpose inverse() const - { return derived(); } + inline InverseReturnType inverse() const + { return InverseReturnType(derived()); } /** \returns the tranpose permutation matrix. * - * \note \note_try_to_help_rvo + * \note \blank \note_try_to_help_rvo */ - inline Transpose transpose() const - { return derived(); } + inline InverseReturnType transpose() const + { return InverseReturnType(derived()); } /**** multiplication helpers to hopefully get RVO ****/ @@ -215,13 +199,13 @@ class PermutationBase : public EigenBase template void assignTranspose(const PermutationBase& other) { - for (int i=0; i void assignProduct(const Lhs& lhs, const Rhs& rhs) { eigen_assert(lhs.cols() == rhs.rows()); - for (int i=0; i /** \returns the product permutation matrix. * - * \note \note_try_to_help_rvo + * \note \blank \note_try_to_help_rvo */ template inline PlainPermutationType operator*(const PermutationBase& other) const @@ -237,18 +221,18 @@ class PermutationBase : public EigenBase /** \returns the product of a permutation with another inverse permutation. * - * \note \note_try_to_help_rvo + * \note \blank \note_try_to_help_rvo */ template - inline PlainPermutationType operator*(const Transpose >& other) const + inline PlainPermutationType operator*(const InverseImpl& other) const { return PlainPermutationType(internal::PermPermProduct, *this, other.eval()); } /** \returns the product of an inverse permutation with another permutation. * - * \note \note_try_to_help_rvo + * \note \blank \note_try_to_help_rvo */ template friend - inline PlainPermutationType operator*(const Transpose >& other, const PermutationBase& perm) + inline PlainPermutationType operator*(const InverseImpl& other, const PermutationBase& perm) { return PlainPermutationType(internal::PermPermProduct, other.eval(), perm); } /** \returns the determinant of the permutation matrix, which is either 1 or -1 depending on the parity of the permutation. @@ -284,39 +268,43 @@ class PermutationBase : public EigenBase }; +namespace internal { +template +struct traits > + : traits > +{ + typedef PermutationStorage StorageKind; + typedef Matrix<_StorageIndex, SizeAtCompileTime, 1, 0, MaxSizeAtCompileTime, 1> IndicesType; + typedef _StorageIndex StorageIndex; + typedef void Scalar; +}; +} + /** \class PermutationMatrix * \ingroup Core_Module * * \brief Permutation matrix * - * \param SizeAtCompileTime the number of rows/cols, or Dynamic - * \param MaxSizeAtCompileTime the maximum number of rows/cols, or Dynamic. This optional parameter defaults to SizeAtCompileTime. Most of the time, you should not have to specify it. - * \param IndexType the interger type of the indices + * \tparam SizeAtCompileTime the number of rows/cols, or Dynamic + * \tparam MaxSizeAtCompileTime the maximum number of rows/cols, or Dynamic. This optional parameter defaults to SizeAtCompileTime. Most of the time, you should not have to specify it. + * \tparam _StorageIndex the integer type of the indices * * This class represents a permutation matrix, internally stored as a vector of integers. * * \sa class PermutationBase, class PermutationWrapper, class DiagonalMatrix */ - -namespace internal { -template -struct traits > - : traits > -{ - typedef IndexType Index; - typedef Matrix IndicesType; -}; -} - -template -class PermutationMatrix : public PermutationBase > +template +class PermutationMatrix : public PermutationBase > { typedef PermutationBase Base; typedef internal::traits Traits; public: + typedef const PermutationMatrix& Nested; + #ifndef EIGEN_PARSED_BY_DOXYGEN typedef typename Traits::IndicesType IndicesType; + typedef typename Traits::StorageIndex StorageIndex; #endif inline PermutationMatrix() @@ -324,20 +312,16 @@ class PermutationMatrix : public PermutationBase::highest()); + } /** Copy constructor. */ template inline PermutationMatrix(const PermutationBase& other) : m_indices(other.indices()) {} - #ifndef EIGEN_PARSED_BY_DOXYGEN - /** Standard copy constructor. Defined only to prevent a default copy constructor - * from hiding the other templated constructor */ - inline PermutationMatrix(const PermutationMatrix& other) : m_indices(other.indices()) {} - #endif - /** Generic constructor from expression of the indices. The indices * array has the meaning that the permutations sends each integer i to indices[i]. * @@ -346,7 +330,7 @@ class PermutationMatrix : public PermutationBase - explicit inline PermutationMatrix(const MatrixBase& a_indices) : m_indices(a_indices) + explicit inline PermutationMatrix(const MatrixBase& indices) : m_indices(indices) {} /** Convert the Transpositions \a tr to a permutation matrix */ @@ -372,17 +356,6 @@ class PermutationMatrix : public PermutationBase - PermutationMatrix(const Transpose >& other) - : m_indices(other.nestedPermutation().size()) + PermutationMatrix(const InverseImpl& other) + : m_indices(other.derived().nestedExpression().size()) { - for (int i=0; i::highest()); + StorageIndex end = StorageIndex(m_indices.size()); + for (StorageIndex i=0; i PermutationMatrix(internal::PermPermProduct_t, const Lhs& lhs, const Rhs& rhs) @@ -413,18 +389,20 @@ class PermutationMatrix : public PermutationBase -struct traits,_PacketAccess> > - : traits > +template +struct traits,_PacketAccess> > + : traits > { - typedef IndexType Index; - typedef Map, _PacketAccess> IndicesType; + typedef PermutationStorage StorageKind; + typedef Map, _PacketAccess> IndicesType; + typedef _StorageIndex StorageIndex; + typedef void Scalar; }; } -template -class Map,_PacketAccess> - : public PermutationBase,_PacketAccess> > +template +class Map,_PacketAccess> + : public PermutationBase,_PacketAccess> > { typedef PermutationBase Base; typedef internal::traits Traits; @@ -432,14 +410,14 @@ class Map, #ifndef EIGEN_PARSED_BY_DOXYGEN typedef typename Traits::IndicesType IndicesType; - typedef typename IndicesType::Scalar Index; + typedef typename IndicesType::Scalar StorageIndex; #endif - inline Map(const Index* indicesPtr) + inline Map(const StorageIndex* indicesPtr) : m_indices(indicesPtr) {} - inline Map(const Index* indicesPtr, Index size) + inline Map(const StorageIndex* indicesPtr, Index size) : m_indices(indicesPtr,size) {} @@ -474,40 +452,36 @@ class Map, IndicesType m_indices; }; -/** \class PermutationWrapper - * \ingroup Core_Module - * - * \brief Class to view a vector of integers as a permutation matrix - * - * \param _IndicesType the type of the vector of integer (can be any compatible expression) - * - * This class allows to view any vector expression of integers as a permutation matrix. - * - * \sa class PermutationBase, class PermutationMatrix - */ - -struct PermutationStorage {}; - template class TranspositionsWrapper; namespace internal { template struct traits > { typedef PermutationStorage StorageKind; - typedef typename _IndicesType::Scalar Scalar; - typedef typename _IndicesType::Scalar Index; + typedef void Scalar; + typedef typename _IndicesType::Scalar StorageIndex; typedef _IndicesType IndicesType; enum { RowsAtCompileTime = _IndicesType::SizeAtCompileTime, ColsAtCompileTime = _IndicesType::SizeAtCompileTime, - MaxRowsAtCompileTime = IndicesType::MaxRowsAtCompileTime, - MaxColsAtCompileTime = IndicesType::MaxColsAtCompileTime, - Flags = 0, - CoeffReadCost = _IndicesType::CoeffReadCost + MaxRowsAtCompileTime = IndicesType::MaxSizeAtCompileTime, + MaxColsAtCompileTime = IndicesType::MaxSizeAtCompileTime, + Flags = 0 }; }; } +/** \class PermutationWrapper + * \ingroup Core_Module + * + * \brief Class to view a vector of integers as a permutation matrix + * + * \tparam _IndicesType the type of the vector of integer (can be any compatible expression) + * + * This class allows to view any vector expression of integers as a permutation matrix. + * + * \sa class PermutationBase, class PermutationMatrix + */ template class PermutationWrapper : public PermutationBase > { @@ -519,8 +493,8 @@ class PermutationWrapper : public PermutationBase -inline const internal::permut_matrix_product_retval -operator*(const MatrixBase& matrix, - const PermutationBase &permutation) +template +EIGEN_DEVICE_FUNC +const Product +operator*(const MatrixBase &matrix, + const PermutationBase& permutation) { - return internal::permut_matrix_product_retval - - (permutation.derived(), matrix.derived()); + return Product + (matrix.derived(), permutation.derived()); } /** \returns the matrix with the permutation applied to the rows. */ -template -inline const internal::permut_matrix_product_retval - +template +EIGEN_DEVICE_FUNC +const Product operator*(const PermutationBase &permutation, - const MatrixBase& matrix) + const MatrixBase& matrix) { - return internal::permut_matrix_product_retval - - (permutation.derived(), matrix.derived()); + return Product + (permutation.derived(), matrix.derived()); } -namespace internal { -template -struct traits > +template +class InverseImpl + : public EigenBase > { - typedef typename MatrixType::PlainObject ReturnType; -}; - -template -struct permut_matrix_product_retval - : public ReturnByValue > -{ - typedef typename remove_all::type MatrixTypeNestedCleaned; - typedef typename MatrixType::Index Index; - - permut_matrix_product_retval(const PermutationType& perm, const MatrixType& matrix) - : m_permutation(perm), m_matrix(matrix) - {} - - inline Index rows() const { return m_matrix.rows(); } - inline Index cols() const { return m_matrix.cols(); } - - template inline void evalTo(Dest& dst) const - { - const Index n = Side==OnTheLeft ? rows() : cols(); - // FIXME we need an is_same for expression that is not sensitive to constness. For instance - // is_same_xpr, Block >::value should be true. - if( is_same::value - && blas_traits::HasUsableDirectAccess - && blas_traits::HasUsableDirectAccess - && extract_data(dst) == extract_data(m_matrix)) - { - // apply the permutation inplace - Matrix mask(m_permutation.size()); - mask.fill(false); - Index r = 0; - while(r < m_permutation.size()) - { - // search for the next seed - while(r=m_permutation.size()) - break; - // we got one, let's follow it until we are back to the seed - Index k0 = r++; - Index kPrev = k0; - mask.coeffRef(k0) = true; - for(Index k=m_permutation.indices().coeff(k0); k!=k0; k=m_permutation.indices().coeff(k)) - { - Block(dst, k) - .swap(Block - (dst,((Side==OnTheLeft) ^ Transposed) ? k0 : kPrev)); - - mask.coeffRef(k) = true; - kPrev = k; - } - } - } - else - { - for(int i = 0; i < n; ++i) - { - Block - (dst, ((Side==OnTheLeft) ^ Transposed) ? m_permutation.indices().coeff(i) : i) - - = - - Block - (m_matrix, ((Side==OnTheRight) ^ Transposed) ? m_permutation.indices().coeff(i) : i); - } - } - } - - protected: - const PermutationType& m_permutation; - typename MatrixType::Nested m_matrix; -}; - -/* Template partial specialization for transposed/inverse permutations */ - -template -struct traits > > - : traits -{}; - -} // end namespace internal - -template -class Transpose > - : public EigenBase > > -{ - typedef Derived PermutationType; - typedef typename PermutationType::IndicesType IndicesType; typedef typename PermutationType::PlainPermutationType PlainPermutationType; + typedef internal::traits PermTraits; + protected: + InverseImpl() {} public: + typedef Inverse InverseType; + using EigenBase >::derived; #ifndef EIGEN_PARSED_BY_DOXYGEN - typedef internal::traits Traits; - typedef typename Derived::DenseMatrixType DenseMatrixType; + typedef typename PermutationType::DenseMatrixType DenseMatrixType; enum { - Flags = Traits::Flags, - CoeffReadCost = Traits::CoeffReadCost, - RowsAtCompileTime = Traits::RowsAtCompileTime, - ColsAtCompileTime = Traits::ColsAtCompileTime, - MaxRowsAtCompileTime = Traits::MaxRowsAtCompileTime, - MaxColsAtCompileTime = Traits::MaxColsAtCompileTime + RowsAtCompileTime = PermTraits::RowsAtCompileTime, + ColsAtCompileTime = PermTraits::ColsAtCompileTime, + MaxRowsAtCompileTime = PermTraits::MaxRowsAtCompileTime, + MaxColsAtCompileTime = PermTraits::MaxColsAtCompileTime }; - typedef typename Traits::Scalar Scalar; #endif - Transpose(const PermutationType& p) : m_permutation(p) {} - - inline int rows() const { return m_permutation.rows(); } - inline int cols() const { return m_permutation.cols(); } - #ifndef EIGEN_PARSED_BY_DOXYGEN template void evalTo(MatrixBase& other) const { other.setZero(); - for (int i=0; i friend - inline const internal::permut_matrix_product_retval - operator*(const MatrixBase& matrix, const Transpose& trPerm) + const Product + operator*(const MatrixBase& matrix, const InverseType& trPerm) { - return internal::permut_matrix_product_retval(trPerm.m_permutation, matrix.derived()); + return Product(matrix.derived(), trPerm.derived()); } /** \returns the matrix with the inverse permutation applied to the rows. */ template - inline const internal::permut_matrix_product_retval + const Product operator*(const MatrixBase& matrix) const { - return internal::permut_matrix_product_retval(m_permutation, matrix.derived()); + return Product(derived(), matrix.derived()); } - - const PermutationType& nestedPermutation() const { return m_permutation; } - - protected: - const PermutationType& m_permutation; }; template @@ -716,6 +594,12 @@ const PermutationWrapper MatrixBase::asPermutation() con return derived(); } +namespace internal { + +template<> struct AssignmentKind { typedef EigenBase2EigenBase Kind; }; + +} // end namespace internal + } // end namespace Eigen #endif // EIGEN_PERMUTATIONMATRIX_H diff --git a/extern/eigen/Eigen/src/Core/PlainObjectBase.h b/extern/eigen/Eigen/src/Core/PlainObjectBase.h index a4e4af4a..e2ddbd1d 100644 --- a/extern/eigen/Eigen/src/Core/PlainObjectBase.h +++ b/extern/eigen/Eigen/src/Core/PlainObjectBase.h @@ -13,10 +13,10 @@ #if defined(EIGEN_INITIALIZE_MATRICES_BY_ZERO) # define EIGEN_INITIALIZE_COEFFS -# define EIGEN_INITIALIZE_COEFFS_IF_THAT_OPTION_IS_ENABLED for(int i=0;i::quiet_NaN(); +# define EIGEN_INITIALIZE_COEFFS_IF_THAT_OPTION_IS_ENABLED for(Index i=0;i::quiet_NaN(); #else # undef EIGEN_INITIALIZE_COEFFS # define EIGEN_INITIALIZE_COEFFS_IF_THAT_OPTION_IS_ENABLED @@ -28,6 +28,7 @@ namespace internal { template struct check_rows_cols_for_overflow { template + EIGEN_DEVICE_FUNC static EIGEN_ALWAYS_INLINE void run(Index, Index) { } @@ -35,11 +36,12 @@ template struct check_rows_cols_for_overflow { template<> struct check_rows_cols_for_overflow { template + EIGEN_DEVICE_FUNC static EIGEN_ALWAYS_INLINE void run(Index rows, Index cols) { // http://hg.mozilla.org/mozilla-central/file/6c8a909977d3/xpcom/ds/CheckedInt.h#l242 // we assume Index is signed - Index max_index = (size_t(1) << (8 * sizeof(Index) - 1)) - 1; // assume Index is signed + Index max_index = (std::size_t(1) << (8 * sizeof(Index) - 1)) - 1; // assume Index is signed bool error = (rows == 0 || cols == 0) ? false : (rows > max_index / cols); if (error) @@ -56,33 +58,41 @@ template struct m } // end namespace internal -/** \class PlainObjectBase - * \brief %Dense storage base class for matrices and arrays. - * - * This class can be extended with the help of the plugin mechanism described on the page - * \ref TopicCustomizingEigen by defining the preprocessor symbol \c EIGEN_PLAINOBJECTBASE_PLUGIN. - * - * \sa \ref TopicClassHierarchy - */ #ifdef EIGEN_PARSED_BY_DOXYGEN -namespace internal { +namespace doxygen { -// this is a warkaround to doxygen not being able to understand the inheritence logic +// This is a workaround to doxygen not being able to understand the inheritance logic // when it is hidden by the dense_xpr_base helper struct. -template struct dense_xpr_base_dispatcher_for_doxygen;// : public MatrixBase {}; +// Moreover, doxygen fails to include members that are not documented in the declaration body of +// MatrixBase if we inherits MatrixBase >, +// this is why we simply inherits MatrixBase, though this does not make sense. + +/** This class is just a workaround for Doxygen and it does not not actually exist. */ +template struct dense_xpr_base_dispatcher; /** This class is just a workaround for Doxygen and it does not not actually exist. */ template -struct dense_xpr_base_dispatcher_for_doxygen > - : public MatrixBase > {}; +struct dense_xpr_base_dispatcher > + : public MatrixBase {}; /** This class is just a workaround for Doxygen and it does not not actually exist. */ template -struct dense_xpr_base_dispatcher_for_doxygen > - : public ArrayBase > {}; +struct dense_xpr_base_dispatcher > + : public ArrayBase {}; -} // namespace internal +} // namespace doxygen +/** \class PlainObjectBase + * \ingroup Core_Module + * \brief %Dense storage base class for matrices and arrays. + * + * This class can be extended with the help of the plugin mechanism described on the page + * \ref TopicCustomizing_Plugins by defining the preprocessor symbol \c EIGEN_PLAINOBJECTBASE_PLUGIN. + * + * \tparam Derived is the derived type, e.g., a Matrix or Array + * + * \sa \ref TopicClassHierarchy + */ template -class PlainObjectBase : public internal::dense_xpr_base_dispatcher_for_doxygen +class PlainObjectBase : public doxygen::dense_xpr_base_dispatcher #else template class PlainObjectBase : public internal::dense_xpr_base::type @@ -93,8 +103,8 @@ class PlainObjectBase : public internal::dense_xpr_base::type typedef typename internal::dense_xpr_base::type Base; typedef typename internal::traits::StorageKind StorageKind; - typedef typename internal::traits::Index Index; typedef typename internal::traits::Scalar Scalar; + typedef typename internal::packet_traits::type PacketScalar; typedef typename NumTraits::Real RealScalar; typedef Derived DenseType; @@ -108,33 +118,37 @@ class PlainObjectBase : public internal::dense_xpr_base::type using Base::IsVectorAtCompileTime; using Base::Flags; - template friend class Eigen::Map; - friend class Eigen::Map; typedef Eigen::Map MapType; - friend class Eigen::Map; typedef const Eigen::Map ConstMapType; - friend class Eigen::Map; - typedef Eigen::Map AlignedMapType; - friend class Eigen::Map; - typedef const Eigen::Map ConstAlignedMapType; + typedef Eigen::Map AlignedMapType; + typedef const Eigen::Map ConstAlignedMapType; template struct StridedMapType { typedef Eigen::Map type; }; template struct StridedConstMapType { typedef Eigen::Map type; }; - template struct StridedAlignedMapType { typedef Eigen::Map type; }; - template struct StridedConstAlignedMapType { typedef Eigen::Map type; }; + template struct StridedAlignedMapType { typedef Eigen::Map type; }; + template struct StridedConstAlignedMapType { typedef Eigen::Map type; }; protected: DenseStorage m_storage; public: - enum { NeedsToAlign = SizeAtCompileTime != Dynamic && (internal::traits::Flags & AlignedBit) != 0 }; + enum { NeedsToAlign = (SizeAtCompileTime != Dynamic) && (internal::traits::Alignment>0) }; EIGEN_MAKE_ALIGNED_OPERATOR_NEW_IF(NeedsToAlign) + EIGEN_DEVICE_FUNC Base& base() { return *static_cast(this); } + EIGEN_DEVICE_FUNC const Base& base() const { return *static_cast(this); } - EIGEN_STRONG_INLINE Index rows() const { return m_storage.rows(); } - EIGEN_STRONG_INLINE Index cols() const { return m_storage.cols(); } + EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE EIGEN_CONSTEXPR + Index rows() const EIGEN_NOEXCEPT { return m_storage.rows(); } + EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE EIGEN_CONSTEXPR + Index cols() const EIGEN_NOEXCEPT { return m_storage.cols(); } + /** This is an overloaded version of DenseCoeffsBase::coeff(Index,Index) const + * provided to by-pass the creation of an evaluator of the expression, thus saving compilation efforts. + * + * See DenseCoeffsBase::coeff(Index) const for details. */ + EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE const Scalar& coeff(Index rowId, Index colId) const { if(Flags & RowMajorBit) @@ -143,11 +157,21 @@ class PlainObjectBase : public internal::dense_xpr_base::type return m_storage.data()[rowId + colId * m_storage.rows()]; } + /** This is an overloaded version of DenseCoeffsBase::coeff(Index) const + * provided to by-pass the creation of an evaluator of the expression, thus saving compilation efforts. + * + * See DenseCoeffsBase::coeff(Index) const for details. */ + EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE const Scalar& coeff(Index index) const { return m_storage.data()[index]; } + /** This is an overloaded version of DenseCoeffsBase::coeffRef(Index,Index) const + * provided to by-pass the creation of an evaluator of the expression, thus saving compilation efforts. + * + * See DenseCoeffsBase::coeffRef(Index,Index) const for details. */ + EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Scalar& coeffRef(Index rowId, Index colId) { if(Flags & RowMajorBit) @@ -156,11 +180,19 @@ class PlainObjectBase : public internal::dense_xpr_base::type return m_storage.data()[rowId + colId * m_storage.rows()]; } + /** This is an overloaded version of DenseCoeffsBase::coeffRef(Index) const + * provided to by-pass the creation of an evaluator of the expression, thus saving compilation efforts. + * + * See DenseCoeffsBase::coeffRef(Index) const for details. */ + EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Scalar& coeffRef(Index index) { return m_storage.data()[index]; } + /** This is the const version of coeffRef(Index,Index) which is thus synonym of coeff(Index,Index). + * It is provided for convenience. */ + EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE const Scalar& coeffRef(Index rowId, Index colId) const { if(Flags & RowMajorBit) @@ -169,6 +201,9 @@ class PlainObjectBase : public internal::dense_xpr_base::type return m_storage.data()[rowId + colId * m_storage.rows()]; } + /** This is the const version of coeffRef(Index) which is thus synonym of coeff(Index). + * It is provided for convenience. */ + EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE const Scalar& coeffRef(Index index) const { return m_storage.data()[index]; @@ -209,11 +244,11 @@ class PlainObjectBase : public internal::dense_xpr_base::type } /** \returns a const pointer to the data array of this matrix */ - EIGEN_STRONG_INLINE const Scalar *data() const + EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE const Scalar *data() const { return m_storage.data(); } /** \returns a pointer to the data array of this matrix */ - EIGEN_STRONG_INLINE Scalar *data() + EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Scalar *data() { return m_storage.data(); } /** Resizes \c *this to a \a rows x \a cols matrix. @@ -232,22 +267,22 @@ class PlainObjectBase : public internal::dense_xpr_base::type * * \sa resize(Index) for vectors, resize(NoChange_t, Index), resize(Index, NoChange_t) */ - EIGEN_STRONG_INLINE void resize(Index nbRows, Index nbCols) - { - eigen_assert( EIGEN_IMPLIES(RowsAtCompileTime!=Dynamic,nbRows==RowsAtCompileTime) - && EIGEN_IMPLIES(ColsAtCompileTime!=Dynamic,nbCols==ColsAtCompileTime) - && EIGEN_IMPLIES(RowsAtCompileTime==Dynamic && MaxRowsAtCompileTime!=Dynamic,nbRows<=MaxRowsAtCompileTime) - && EIGEN_IMPLIES(ColsAtCompileTime==Dynamic && MaxColsAtCompileTime!=Dynamic,nbCols<=MaxColsAtCompileTime) - && nbRows>=0 && nbCols>=0 && "Invalid sizes when resizing a matrix or array."); - internal::check_rows_cols_for_overflow::run(nbRows, nbCols); + EIGEN_DEVICE_FUNC + EIGEN_STRONG_INLINE void resize(Index rows, Index cols) + { + eigen_assert( EIGEN_IMPLIES(RowsAtCompileTime!=Dynamic,rows==RowsAtCompileTime) + && EIGEN_IMPLIES(ColsAtCompileTime!=Dynamic,cols==ColsAtCompileTime) + && EIGEN_IMPLIES(RowsAtCompileTime==Dynamic && MaxRowsAtCompileTime!=Dynamic,rows<=MaxRowsAtCompileTime) + && EIGEN_IMPLIES(ColsAtCompileTime==Dynamic && MaxColsAtCompileTime!=Dynamic,cols<=MaxColsAtCompileTime) + && rows>=0 && cols>=0 && "Invalid sizes when resizing a matrix or array."); + internal::check_rows_cols_for_overflow::run(rows, cols); #ifdef EIGEN_INITIALIZE_COEFFS - Index size = nbRows*nbCols; + Index size = rows*cols; bool size_changed = size != this->size(); - m_storage.resize(size, nbRows, nbCols); + m_storage.resize(size, rows, cols); if(size_changed) EIGEN_INITIALIZE_COEFFS_IF_THAT_OPTION_IS_ENABLED #else - internal::check_rows_cols_for_overflow::run(nbRows, nbCols); - m_storage.resize(nbRows*nbCols, nbRows, nbCols); + m_storage.resize(rows*cols, rows, cols); #endif } @@ -262,6 +297,7 @@ class PlainObjectBase : public internal::dense_xpr_base::type * * \sa resize(Index,Index), resize(NoChange_t, Index), resize(Index, NoChange_t) */ + EIGEN_DEVICE_FUNC inline void resize(Index size) { EIGEN_STATIC_ASSERT_VECTOR_ONLY(PlainObjectBase) @@ -286,9 +322,10 @@ class PlainObjectBase : public internal::dense_xpr_base::type * * \sa resize(Index,Index) */ - inline void resize(NoChange_t, Index nbCols) + EIGEN_DEVICE_FUNC + inline void resize(NoChange_t, Index cols) { - resize(rows(), nbCols); + resize(rows(), cols); } /** Resizes the matrix, changing only the number of rows. For the parameter of type NoChange_t, just pass the special value \c NoChange @@ -299,9 +336,10 @@ class PlainObjectBase : public internal::dense_xpr_base::type * * \sa resize(Index,Index) */ - inline void resize(Index nbRows, NoChange_t) + EIGEN_DEVICE_FUNC + inline void resize(Index rows, NoChange_t) { - resize(nbRows, cols()); + resize(rows, cols()); } /** Resizes \c *this to have the same dimensions as \a other. @@ -312,6 +350,7 @@ class PlainObjectBase : public internal::dense_xpr_base::type * remain row-vectors and vectors remain vectors. */ template + EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE void resizeLike(const EigenBase& _other) { const OtherDerived& other = _other.derived(); @@ -336,12 +375,13 @@ class PlainObjectBase : public internal::dense_xpr_base::type * of rows and/or of columns, you can use conservativeResize(NoChange_t, Index) or * conservativeResize(Index, NoChange_t). * - * Matrices are resized relative to the top-left element. In case values need to be + * Matrices are resized relative to the top-left element. In case values need to be * appended to the matrix they will be uninitialized. */ - EIGEN_STRONG_INLINE void conservativeResize(Index nbRows, Index nbCols) + EIGEN_DEVICE_FUNC + EIGEN_STRONG_INLINE void conservativeResize(Index rows, Index cols) { - internal::conservative_resize_like_impl::run(*this, nbRows, nbCols); + internal::conservative_resize_like_impl::run(*this, rows, cols); } /** Resizes the matrix to \a rows x \a cols while leaving old values untouched. @@ -351,10 +391,11 @@ class PlainObjectBase : public internal::dense_xpr_base::type * * In case the matrix is growing, new rows will be uninitialized. */ - EIGEN_STRONG_INLINE void conservativeResize(Index nbRows, NoChange_t) + EIGEN_DEVICE_FUNC + EIGEN_STRONG_INLINE void conservativeResize(Index rows, NoChange_t) { // Note: see the comment in conservativeResize(Index,Index) - conservativeResize(nbRows, cols()); + conservativeResize(rows, cols()); } /** Resizes the matrix to \a rows x \a cols while leaving old values untouched. @@ -364,10 +405,11 @@ class PlainObjectBase : public internal::dense_xpr_base::type * * In case the matrix is growing, new columns will be uninitialized. */ - EIGEN_STRONG_INLINE void conservativeResize(NoChange_t, Index nbCols) + EIGEN_DEVICE_FUNC + EIGEN_STRONG_INLINE void conservativeResize(NoChange_t, Index cols) { // Note: see the comment in conservativeResize(Index,Index) - conservativeResize(rows(), nbCols); + conservativeResize(rows(), cols); } /** Resizes the vector to \a size while retaining old values. @@ -378,6 +420,7 @@ class PlainObjectBase : public internal::dense_xpr_base::type * * When values are appended, they will be uninitialized. */ + EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE void conservativeResize(Index size) { internal::conservative_resize_like_impl::run(*this, size); @@ -389,10 +432,11 @@ class PlainObjectBase : public internal::dense_xpr_base::type * of rows and/or of columns, you can use conservativeResize(NoChange_t, Index) or * conservativeResize(Index, NoChange_t). * - * Matrices are resized relative to the top-left element. In case values need to be + * Matrices are resized relative to the top-left element. In case values need to be * appended to the matrix they will copied from \c other. */ template + EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE void conservativeResizeLike(const DenseBase& other) { internal::conservative_resize_like_impl::run(*this, other); @@ -401,6 +445,7 @@ class PlainObjectBase : public internal::dense_xpr_base::type /** This is a special case of the templated operator=. Its purpose is to * prevent a default operator= from hiding the templated operator=. */ + EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Derived& operator=(const PlainObjectBase& other) { return _set(other); @@ -408,6 +453,7 @@ class PlainObjectBase : public internal::dense_xpr_base::type /** \sa MatrixBase::lazyAssign() */ template + EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Derived& lazyAssign(const DenseBase& other) { _resize_to_match(other); @@ -415,12 +461,18 @@ class PlainObjectBase : public internal::dense_xpr_base::type } template + EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Derived& operator=(const ReturnByValue& func) { resize(func.rows(), func.cols()); return Base::operator=(func); } + // Prevent user from trying to instantiate PlainObjectBase objects + // by making all its constructor protected. See bug 1074. + protected: + + EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE PlainObjectBase() : m_storage() { // _check_template_params(); @@ -430,53 +482,146 @@ class PlainObjectBase : public internal::dense_xpr_base::type #ifndef EIGEN_PARSED_BY_DOXYGEN // FIXME is it still needed ? /** \internal */ - PlainObjectBase(internal::constructor_without_unaligned_array_assert) + EIGEN_DEVICE_FUNC + explicit PlainObjectBase(internal::constructor_without_unaligned_array_assert) : m_storage(internal::constructor_without_unaligned_array_assert()) { // _check_template_params(); EIGEN_INITIALIZE_COEFFS_IF_THAT_OPTION_IS_ENABLED } #endif -#ifdef EIGEN_HAVE_RVALUE_REFERENCES - PlainObjectBase(PlainObjectBase&& other) +#if EIGEN_HAS_RVALUE_REFERENCES + EIGEN_DEVICE_FUNC + PlainObjectBase(PlainObjectBase&& other) EIGEN_NOEXCEPT : m_storage( std::move(other.m_storage) ) { } - PlainObjectBase& operator=(PlainObjectBase&& other) + EIGEN_DEVICE_FUNC + PlainObjectBase& operator=(PlainObjectBase&& other) EIGEN_NOEXCEPT { - using std::swap; - swap(m_storage, other.m_storage); + _check_template_params(); + m_storage = std::move(other.m_storage); return *this; } #endif /** Copy constructor */ + EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE PlainObjectBase(const PlainObjectBase& other) + : Base(), m_storage(other.m_storage) { } + EIGEN_DEVICE_FUNC + EIGEN_STRONG_INLINE PlainObjectBase(Index size, Index rows, Index cols) + : m_storage(size, rows, cols) + { +// _check_template_params(); +// EIGEN_INITIALIZE_COEFFS_IF_THAT_OPTION_IS_ENABLED + } + + #if EIGEN_HAS_CXX11 + /** \brief Construct a row of column vector with fixed size from an arbitrary number of coefficients. \cpp11 + * + * \only_for_vectors + * + * This constructor is for 1D array or vectors with more than 4 coefficients. + * There exists C++98 analogue constructors for fixed-size array/vector having 1, 2, 3, or 4 coefficients. + * + * \warning To construct a column (resp. row) vector of fixed length, the number of values passed to this + * constructor must match the the fixed number of rows (resp. columns) of \c *this. + */ + template + EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE + PlainObjectBase(const Scalar& a0, const Scalar& a1, const Scalar& a2, const Scalar& a3, const ArgTypes&... args) + : m_storage() + { + _check_template_params(); + EIGEN_STATIC_ASSERT_VECTOR_SPECIFIC_SIZE(PlainObjectBase, sizeof...(args) + 4); + m_storage.data()[0] = a0; + m_storage.data()[1] = a1; + m_storage.data()[2] = a2; + m_storage.data()[3] = a3; + Index i = 4; + auto x = {(m_storage.data()[i++] = args, 0)...}; + static_cast(x); + } + + /** \brief Constructs a Matrix or Array and initializes it by elements given by an initializer list of initializer + * lists \cpp11 + */ + EIGEN_DEVICE_FUNC + explicit EIGEN_STRONG_INLINE PlainObjectBase(const std::initializer_list>& list) : m_storage() { _check_template_params(); - lazyAssign(other); + + size_t list_size = 0; + if (list.begin() != list.end()) { + list_size = list.begin()->size(); + } + + // This is to allow syntax like VectorXi {{1, 2, 3, 4}} + if (ColsAtCompileTime == 1 && list.size() == 1) { + eigen_assert(list_size == static_cast(RowsAtCompileTime) || RowsAtCompileTime == Dynamic); + resize(list_size, ColsAtCompileTime); + std::copy(list.begin()->begin(), list.begin()->end(), m_storage.data()); + } else { + eigen_assert(list.size() == static_cast(RowsAtCompileTime) || RowsAtCompileTime == Dynamic); + eigen_assert(list_size == static_cast(ColsAtCompileTime) || ColsAtCompileTime == Dynamic); + resize(list.size(), list_size); + + Index row_index = 0; + for (const std::initializer_list& row : list) { + eigen_assert(list_size == row.size()); + Index col_index = 0; + for (const Scalar& e : row) { + coeffRef(row_index, col_index) = e; + ++col_index; + } + ++row_index; + } + } } + #endif // end EIGEN_HAS_CXX11 + /** \sa PlainObjectBase::operator=(const EigenBase&) */ template + EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE PlainObjectBase(const DenseBase &other) : m_storage() { _check_template_params(); - lazyAssign(other); + resizeLike(other); + _set_noalias(other); } - EIGEN_STRONG_INLINE PlainObjectBase(Index a_size, Index nbRows, Index nbCols) - : m_storage(a_size, nbRows, nbCols) + /** \sa PlainObjectBase::operator=(const EigenBase&) */ + template + EIGEN_DEVICE_FUNC + EIGEN_STRONG_INLINE PlainObjectBase(const EigenBase &other) + : m_storage() { -// _check_template_params(); -// EIGEN_INITIALIZE_COEFFS_IF_THAT_OPTION_IS_ENABLED + _check_template_params(); + resizeLike(other); + *this = other.derived(); + } + /** \brief Copy constructor with in-place evaluation */ + template + EIGEN_DEVICE_FUNC + EIGEN_STRONG_INLINE PlainObjectBase(const ReturnByValue& other) + { + _check_template_params(); + // FIXME this does not automatically transpose vectors if necessary + resize(other.rows(), other.cols()); + other.evalTo(this->derived()); } - /** \copydoc MatrixBase::operator=(const EigenBase&) + public: + + /** \brief Copies the generic expression \a other into *this. + * \copydetails DenseBase::operator=(const EigenBase &other) */ template + EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Derived& operator=(const EigenBase &other) { _resize_to_match(other); @@ -484,21 +629,15 @@ class PlainObjectBase : public internal::dense_xpr_base::type return this->derived(); } - /** \sa MatrixBase::operator=(const EigenBase&) */ - template - EIGEN_STRONG_INLINE PlainObjectBase(const EigenBase &other) - : m_storage(other.derived().rows() * other.derived().cols(), other.derived().rows(), other.derived().cols()) - { - _check_template_params(); - internal::check_rows_cols_for_overflow::run(other.derived().rows(), other.derived().cols()); - Base::operator=(other.derived()); - } - /** \name Map * These are convenience functions returning Map objects. The Map() static functions return unaligned Map objects, * while the AlignedMap() functions return aligned Map objects and thus should be called only with 16-byte-aligned * \a data pointers. * + * Here is an example using strides: + * \include Matrix_Map_stride.cpp + * Output: \verbinclude Matrix_Map_stride.out + * * \see class Map */ //@{ @@ -568,20 +707,28 @@ class PlainObjectBase : public internal::dense_xpr_base::type //@} using Base::setConstant; - Derived& setConstant(Index size, const Scalar& value); - Derived& setConstant(Index rows, Index cols, const Scalar& value); + EIGEN_DEVICE_FUNC Derived& setConstant(Index size, const Scalar& val); + EIGEN_DEVICE_FUNC Derived& setConstant(Index rows, Index cols, const Scalar& val); + EIGEN_DEVICE_FUNC Derived& setConstant(NoChange_t, Index cols, const Scalar& val); + EIGEN_DEVICE_FUNC Derived& setConstant(Index rows, NoChange_t, const Scalar& val); using Base::setZero; - Derived& setZero(Index size); - Derived& setZero(Index rows, Index cols); + EIGEN_DEVICE_FUNC Derived& setZero(Index size); + EIGEN_DEVICE_FUNC Derived& setZero(Index rows, Index cols); + EIGEN_DEVICE_FUNC Derived& setZero(NoChange_t, Index cols); + EIGEN_DEVICE_FUNC Derived& setZero(Index rows, NoChange_t); using Base::setOnes; - Derived& setOnes(Index size); - Derived& setOnes(Index rows, Index cols); + EIGEN_DEVICE_FUNC Derived& setOnes(Index size); + EIGEN_DEVICE_FUNC Derived& setOnes(Index rows, Index cols); + EIGEN_DEVICE_FUNC Derived& setOnes(NoChange_t, Index cols); + EIGEN_DEVICE_FUNC Derived& setOnes(Index rows, NoChange_t); using Base::setRandom; Derived& setRandom(Index size); Derived& setRandom(Index rows, Index cols); + Derived& setRandom(NoChange_t, Index cols); + Derived& setRandom(Index rows, NoChange_t); #ifdef EIGEN_PLAINOBJECTBASE_PLUGIN #include EIGEN_PLAINOBJECTBASE_PLUGIN @@ -596,6 +743,7 @@ class PlainObjectBase : public internal::dense_xpr_base::type * remain row-vectors and vectors remain vectors. */ template + EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE void _resize_to_match(const EigenBase& other) { #ifdef EIGEN_NO_AUTOMATIC_RESIZING @@ -603,8 +751,6 @@ class PlainObjectBase : public internal::dense_xpr_base::type : (rows() == other.rows() && cols() == other.cols()))) && "Size mismatch. Automatic resizing is disabled because EIGEN_NO_AUTOMATIC_RESIZING is defined"); EIGEN_ONLY_USED_FOR_DEBUG(other); - if(this->size()==0) - resizeLike(other); #else resizeLike(other); #endif @@ -624,25 +770,23 @@ class PlainObjectBase : public internal::dense_xpr_base::type * * \internal */ + // aliasing is dealt once in internal::call_assignment + // so at this stage we have to assume aliasing... and resising has to be done later. template + EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Derived& _set(const DenseBase& other) { - _set_selector(other.derived(), typename internal::conditional(int(OtherDerived::Flags) & EvalBeforeAssigningBit), internal::true_type, internal::false_type>::type()); + internal::call_assignment(this->derived(), other.derived()); return this->derived(); } - template - EIGEN_STRONG_INLINE void _set_selector(const OtherDerived& other, const internal::true_type&) { _set_noalias(other.eval()); } - - template - EIGEN_STRONG_INLINE void _set_selector(const OtherDerived& other, const internal::false_type&) { _set_noalias(other); } - /** \internal Like _set() but additionally makes the assumption that no aliasing effect can happen (which * is the case when creating a new matrix) so one can enforce lazy evaluation. * * \sa operator=(const MatrixBase&), _set() */ template + EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Derived& _set_noalias(const DenseBase& other) { // I don't think we need this resize call since the lazyAssign will anyways resize @@ -650,44 +794,181 @@ class PlainObjectBase : public internal::dense_xpr_base::type //_resize_to_match(other); // the 'false' below means to enforce lazy evaluation. We don't use lazyAssign() because // it wouldn't allow to copy a row-vector into a column-vector. - return internal::assign_selector::run(this->derived(), other.derived()); + internal::call_assignment_no_alias(this->derived(), other.derived(), internal::assign_op()); + return this->derived(); } template - EIGEN_STRONG_INLINE void _init2(Index nbRows, Index nbCols, typename internal::enable_if::type* = 0) + EIGEN_DEVICE_FUNC + EIGEN_STRONG_INLINE void _init2(Index rows, Index cols, typename internal::enable_if::type* = 0) { - EIGEN_STATIC_ASSERT(bool(NumTraits::IsInteger) && - bool(NumTraits::IsInteger), + const bool t0_is_integer_alike = internal::is_valid_index_type::value; + const bool t1_is_integer_alike = internal::is_valid_index_type::value; + EIGEN_STATIC_ASSERT(t0_is_integer_alike && + t1_is_integer_alike, FLOATING_POINT_ARGUMENT_PASSED__INTEGER_WAS_EXPECTED) - resize(nbRows,nbCols); + resize(rows,cols); + } + + template + EIGEN_DEVICE_FUNC + EIGEN_STRONG_INLINE void _init2(const T0& val0, const T1& val1, typename internal::enable_if::type* = 0) + { + EIGEN_STATIC_ASSERT_VECTOR_SPECIFIC_SIZE(PlainObjectBase, 2) + m_storage.data()[0] = Scalar(val0); + m_storage.data()[1] = Scalar(val1); } + template - EIGEN_STRONG_INLINE void _init2(const Scalar& val0, const Scalar& val1, typename internal::enable_if::type* = 0) + EIGEN_DEVICE_FUNC + EIGEN_STRONG_INLINE void _init2(const Index& val0, const Index& val1, + typename internal::enable_if< (!internal::is_same::value) + && (internal::is_same::value) + && (internal::is_same::value) + && Base::SizeAtCompileTime==2,T1>::type* = 0) { EIGEN_STATIC_ASSERT_VECTOR_SPECIFIC_SIZE(PlainObjectBase, 2) + m_storage.data()[0] = Scalar(val0); + m_storage.data()[1] = Scalar(val1); + } + + // The argument is convertible to the Index type and we either have a non 1x1 Matrix, or a dynamic-sized Array, + // then the argument is meant to be the size of the object. + template + EIGEN_DEVICE_FUNC + EIGEN_STRONG_INLINE void _init1(Index size, typename internal::enable_if< (Base::SizeAtCompileTime!=1 || !internal::is_convertible::value) + && ((!internal::is_same::XprKind,ArrayXpr>::value || Base::SizeAtCompileTime==Dynamic)),T>::type* = 0) + { + // NOTE MSVC 2008 complains if we directly put bool(NumTraits::IsInteger) as the EIGEN_STATIC_ASSERT argument. + const bool is_integer_alike = internal::is_valid_index_type::value; + EIGEN_UNUSED_VARIABLE(is_integer_alike); + EIGEN_STATIC_ASSERT(is_integer_alike, + FLOATING_POINT_ARGUMENT_PASSED__INTEGER_WAS_EXPECTED) + resize(size); + } + + // We have a 1x1 matrix/array => the argument is interpreted as the value of the unique coefficient (case where scalar type can be implicitly converted) + template + EIGEN_DEVICE_FUNC + EIGEN_STRONG_INLINE void _init1(const Scalar& val0, typename internal::enable_if::value,T>::type* = 0) + { + EIGEN_STATIC_ASSERT_VECTOR_SPECIFIC_SIZE(PlainObjectBase, 1) m_storage.data()[0] = val0; - m_storage.data()[1] = val1; + } + + // We have a 1x1 matrix/array => the argument is interpreted as the value of the unique coefficient (case where scalar type match the index type) + template + EIGEN_DEVICE_FUNC + EIGEN_STRONG_INLINE void _init1(const Index& val0, + typename internal::enable_if< (!internal::is_same::value) + && (internal::is_same::value) + && Base::SizeAtCompileTime==1 + && internal::is_convertible::value,T*>::type* = 0) + { + EIGEN_STATIC_ASSERT_VECTOR_SPECIFIC_SIZE(PlainObjectBase, 1) + m_storage.data()[0] = Scalar(val0); + } + + // Initialize a fixed size matrix from a pointer to raw data + template + EIGEN_DEVICE_FUNC + EIGEN_STRONG_INLINE void _init1(const Scalar* data){ + this->_set_noalias(ConstMapType(data)); + } + + // Initialize an arbitrary matrix from a dense expression + template + EIGEN_DEVICE_FUNC + EIGEN_STRONG_INLINE void _init1(const DenseBase& other){ + this->_set_noalias(other); + } + + // Initialize an arbitrary matrix from an object convertible to the Derived type. + template + EIGEN_DEVICE_FUNC + EIGEN_STRONG_INLINE void _init1(const Derived& other){ + this->_set_noalias(other); + } + + // Initialize an arbitrary matrix from a generic Eigen expression + template + EIGEN_DEVICE_FUNC + EIGEN_STRONG_INLINE void _init1(const EigenBase& other){ + this->derived() = other; + } + + template + EIGEN_DEVICE_FUNC + EIGEN_STRONG_INLINE void _init1(const ReturnByValue& other) + { + resize(other.rows(), other.cols()); + other.evalTo(this->derived()); + } + + template + EIGEN_DEVICE_FUNC + EIGEN_STRONG_INLINE void _init1(const RotationBase& r) + { + this->derived() = r; + } + + // For fixed-size Array + template + EIGEN_DEVICE_FUNC + EIGEN_STRONG_INLINE void _init1(const Scalar& val0, + typename internal::enable_if< Base::SizeAtCompileTime!=Dynamic + && Base::SizeAtCompileTime!=1 + && internal::is_convertible::value + && internal::is_same::XprKind,ArrayXpr>::value,T>::type* = 0) + { + Base::setConstant(val0); + } + + // For fixed-size Array + template + EIGEN_DEVICE_FUNC + EIGEN_STRONG_INLINE void _init1(const Index& val0, + typename internal::enable_if< (!internal::is_same::value) + && (internal::is_same::value) + && Base::SizeAtCompileTime!=Dynamic + && Base::SizeAtCompileTime!=1 + && internal::is_convertible::value + && internal::is_same::XprKind,ArrayXpr>::value,T*>::type* = 0) + { + Base::setConstant(val0); } template friend struct internal::matrix_swap_impl; - /** \internal generic implementation of swap for dense storage since for dynamic-sized matrices of same type it is enough to swap the - * data pointers. + public: + +#ifndef EIGEN_PARSED_BY_DOXYGEN + /** \internal + * \brief Override DenseBase::swap() since for dynamic-sized matrices + * of same type it is enough to swap the data pointers. */ template - void _swap(DenseBase const & other) + EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE + void swap(DenseBase & other) { enum { SwapPointers = internal::is_same::value && Base::SizeAtCompileTime==Dynamic }; - internal::matrix_swap_impl::run(this->derived(), other.const_cast_derived()); + internal::matrix_swap_impl::run(this->derived(), other.derived()); } - public: -#ifndef EIGEN_PARSED_BY_DOXYGEN + /** \internal + * \brief const version forwarded to DenseBase::swap + */ + template + EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE + void swap(DenseBase const & other) + { Base::swap(other.derived()); } + + EIGEN_DEVICE_FUNC static EIGEN_STRONG_INLINE void _check_template_params() { - EIGEN_STATIC_ASSERT((EIGEN_IMPLIES(MaxRowsAtCompileTime==1 && MaxColsAtCompileTime!=1, (Options&RowMajor)==RowMajor) - && EIGEN_IMPLIES(MaxColsAtCompileTime==1 && MaxRowsAtCompileTime!=1, (Options&RowMajor)==0) + EIGEN_STATIC_ASSERT((EIGEN_IMPLIES(MaxRowsAtCompileTime==1 && MaxColsAtCompileTime!=1, (int(Options)&RowMajor)==RowMajor) + && EIGEN_IMPLIES(MaxColsAtCompileTime==1 && MaxRowsAtCompileTime!=1, (int(Options)&RowMajor)==0) && ((RowsAtCompileTime == Dynamic) || (RowsAtCompileTime >= 0)) && ((ColsAtCompileTime == Dynamic) || (ColsAtCompileTime >= 0)) && ((MaxRowsAtCompileTime == Dynamic) || (MaxRowsAtCompileTime >= 0)) @@ -697,10 +978,20 @@ class PlainObjectBase : public internal::dense_xpr_base::type && (Options & (DontAlign|RowMajor)) == Options), INVALID_MATRIX_TEMPLATE_PARAMETERS) } -#endif -private: - enum { ThisConstantIsPrivateInPlainObjectBase }; + enum { IsPlainObjectBase = 1 }; +#endif + public: + // These apparently need to be down here for nvcc+icc to prevent duplicate + // Map symbol. + template friend class Eigen::Map; + friend class Eigen::Map; + friend class Eigen::Map; +#if EIGEN_MAX_ALIGN_BYTES>0 + // for EIGEN_MAX_ALIGN_BYTES==0, AlignedMax==Unaligned, and many compilers generate warnings for friend-ing a class twice. + friend class Eigen::Map; + friend class Eigen::Map; +#endif }; namespace internal { @@ -708,14 +999,19 @@ namespace internal { template struct conservative_resize_like_impl { - typedef typename Derived::Index Index; + #if EIGEN_HAS_TYPE_TRAITS + static const bool IsRelocatable = std::is_trivially_copyable::value; + #else + static const bool IsRelocatable = !NumTraits::RequireInitialization; + #endif static void run(DenseBase& _this, Index rows, Index cols) { if (_this.rows() == rows && _this.cols() == cols) return; EIGEN_STATIC_ASSERT_DYNAMIC_SIZE(Derived) - if ( ( Derived::IsRowMajor && _this.cols() == cols) || // row-major and we change only the number of rows - (!Derived::IsRowMajor && _this.rows() == rows) ) // column-major and we change only the number of columns + if ( IsRelocatable + && (( Derived::IsRowMajor && _this.cols() == cols) || // row-major and we change only the number of rows + (!Derived::IsRowMajor && _this.rows() == rows) )) // column-major and we change only the number of columns { internal::check_rows_cols_for_overflow::run(rows, cols); _this.derived().m_storage.conservativeResize(rows*cols,rows,cols); @@ -723,9 +1019,9 @@ struct conservative_resize_like_impl else { // The storage order does not allow us to use reallocation. - typename Derived::PlainObject tmp(rows,cols); - const Index common_rows = (std::min)(rows, _this.rows()); - const Index common_cols = (std::min)(cols, _this.cols()); + Derived tmp(rows,cols); + const Index common_rows = numext::mini(rows, _this.rows()); + const Index common_cols = numext::mini(cols, _this.cols()); tmp.block(0,0,common_rows,common_cols) = _this.block(0,0,common_rows,common_cols); _this.derived().swap(tmp); } @@ -743,8 +1039,9 @@ struct conservative_resize_like_impl EIGEN_STATIC_ASSERT_DYNAMIC_SIZE(Derived) EIGEN_STATIC_ASSERT_DYNAMIC_SIZE(OtherDerived) - if ( ( Derived::IsRowMajor && _this.cols() == other.cols()) || // row-major and we change only the number of rows - (!Derived::IsRowMajor && _this.rows() == other.rows()) ) // column-major and we change only the number of columns + if ( IsRelocatable && + (( Derived::IsRowMajor && _this.cols() == other.cols()) || // row-major and we change only the number of rows + (!Derived::IsRowMajor && _this.rows() == other.rows()) )) // column-major and we change only the number of columns { const Index new_rows = other.rows() - _this.rows(); const Index new_cols = other.cols() - _this.cols(); @@ -757,9 +1054,9 @@ struct conservative_resize_like_impl else { // The storage order does not allow us to use reallocation. - typename Derived::PlainObject tmp(other); - const Index common_rows = (std::min)(tmp.rows(), _this.rows()); - const Index common_cols = (std::min)(tmp.cols(), _this.cols()); + Derived tmp(other); + const Index common_rows = numext::mini(tmp.rows(), _this.rows()); + const Index common_cols = numext::mini(tmp.cols(), _this.cols()); tmp.block(0,0,common_rows,common_cols) = _this.block(0,0,common_rows,common_cols); _this.derived().swap(tmp); } @@ -772,14 +1069,18 @@ template struct conservative_resize_like_impl : conservative_resize_like_impl { - using conservative_resize_like_impl::run; - - typedef typename Derived::Index Index; + typedef conservative_resize_like_impl Base; + using Base::run; + using Base::IsRelocatable; + static void run(DenseBase& _this, Index size) { const Index new_rows = Derived::RowsAtCompileTime==1 ? 1 : size; const Index new_cols = Derived::RowsAtCompileTime==1 ? size : 1; - _this.derived().m_storage.conservativeResize(size,new_rows,new_cols); + if(IsRelocatable) + _this.derived().m_storage.conservativeResize(size,new_rows,new_cols); + else + Base::run(_this.derived(), new_rows, new_cols); } static void run(DenseBase& _this, const DenseBase& other) @@ -790,7 +1091,10 @@ struct conservative_resize_like_impl const Index new_rows = Derived::RowsAtCompileTime==1 ? 1 : other.rows(); const Index new_cols = Derived::RowsAtCompileTime==1 ? other.cols() : 1; - _this.derived().m_storage.conservativeResize(other.size(),new_rows,new_cols); + if(IsRelocatable) + _this.derived().m_storage.conservativeResize(other.size(),new_rows,new_cols); + else + Base::run(_this.derived(), new_rows, new_cols); if (num_new_elements > 0) _this.tail(num_new_elements) = other.tail(num_new_elements); @@ -800,7 +1104,8 @@ struct conservative_resize_like_impl template struct matrix_swap_impl { - static inline void run(MatrixTypeA& a, MatrixTypeB& b) + EIGEN_DEVICE_FUNC + static EIGEN_STRONG_INLINE void run(MatrixTypeA& a, MatrixTypeB& b) { a.base().swap(b); } @@ -809,6 +1114,7 @@ struct matrix_swap_impl template struct matrix_swap_impl { + EIGEN_DEVICE_FUNC static inline void run(MatrixTypeA& a, MatrixTypeB& b) { static_cast(a).m_storage.swap(static_cast(b).m_storage); diff --git a/extern/eigen/Eigen/src/Core/Product.h b/extern/eigen/Eigen/src/Core/Product.h new file mode 100644 index 00000000..70a6c106 --- /dev/null +++ b/extern/eigen/Eigen/src/Core/Product.h @@ -0,0 +1,191 @@ +// This file is part of Eigen, a lightweight C++ template library +// for linear algebra. +// +// Copyright (C) 2008-2011 Gael Guennebaud +// +// This Source Code Form is subject to the terms of the Mozilla +// Public License v. 2.0. If a copy of the MPL was not distributed +// with this file, You can obtain one at http://mozilla.org/MPL/2.0/. + +#ifndef EIGEN_PRODUCT_H +#define EIGEN_PRODUCT_H + +namespace Eigen { + +template class ProductImpl; + +namespace internal { + +template +struct traits > +{ + typedef typename remove_all::type LhsCleaned; + typedef typename remove_all::type RhsCleaned; + typedef traits LhsTraits; + typedef traits RhsTraits; + + typedef MatrixXpr XprKind; + + typedef typename ScalarBinaryOpTraits::Scalar, typename traits::Scalar>::ReturnType Scalar; + typedef typename product_promote_storage_type::ret>::ret StorageKind; + typedef typename promote_index_type::type StorageIndex; + + enum { + RowsAtCompileTime = LhsTraits::RowsAtCompileTime, + ColsAtCompileTime = RhsTraits::ColsAtCompileTime, + MaxRowsAtCompileTime = LhsTraits::MaxRowsAtCompileTime, + MaxColsAtCompileTime = RhsTraits::MaxColsAtCompileTime, + + // FIXME: only needed by GeneralMatrixMatrixTriangular + InnerSize = EIGEN_SIZE_MIN_PREFER_FIXED(LhsTraits::ColsAtCompileTime, RhsTraits::RowsAtCompileTime), + + // The storage order is somewhat arbitrary here. The correct one will be determined through the evaluator. + Flags = (MaxRowsAtCompileTime==1 && MaxColsAtCompileTime!=1) ? RowMajorBit + : (MaxColsAtCompileTime==1 && MaxRowsAtCompileTime!=1) ? 0 + : ( ((LhsTraits::Flags&NoPreferredStorageOrderBit) && (RhsTraits::Flags&RowMajorBit)) + || ((RhsTraits::Flags&NoPreferredStorageOrderBit) && (LhsTraits::Flags&RowMajorBit)) ) ? RowMajorBit + : NoPreferredStorageOrderBit + }; +}; + +} // end namespace internal + +/** \class Product + * \ingroup Core_Module + * + * \brief Expression of the product of two arbitrary matrices or vectors + * + * \tparam _Lhs the type of the left-hand side expression + * \tparam _Rhs the type of the right-hand side expression + * + * This class represents an expression of the product of two arbitrary matrices. + * + * The other template parameters are: + * \tparam Option can be DefaultProduct, AliasFreeProduct, or LazyProduct + * + */ +template +class Product : public ProductImpl<_Lhs,_Rhs,Option, + typename internal::product_promote_storage_type::StorageKind, + typename internal::traits<_Rhs>::StorageKind, + internal::product_type<_Lhs,_Rhs>::ret>::ret> +{ + public: + + typedef _Lhs Lhs; + typedef _Rhs Rhs; + + typedef typename ProductImpl< + Lhs, Rhs, Option, + typename internal::product_promote_storage_type::StorageKind, + typename internal::traits::StorageKind, + internal::product_type::ret>::ret>::Base Base; + EIGEN_GENERIC_PUBLIC_INTERFACE(Product) + + typedef typename internal::ref_selector::type LhsNested; + typedef typename internal::ref_selector::type RhsNested; + typedef typename internal::remove_all::type LhsNestedCleaned; + typedef typename internal::remove_all::type RhsNestedCleaned; + + EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE + Product(const Lhs& lhs, const Rhs& rhs) : m_lhs(lhs), m_rhs(rhs) + { + eigen_assert(lhs.cols() == rhs.rows() + && "invalid matrix product" + && "if you wanted a coeff-wise or a dot product use the respective explicit functions"); + } + + EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE EIGEN_CONSTEXPR + Index rows() const EIGEN_NOEXCEPT { return m_lhs.rows(); } + EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE EIGEN_CONSTEXPR + Index cols() const EIGEN_NOEXCEPT { return m_rhs.cols(); } + + EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE + const LhsNestedCleaned& lhs() const { return m_lhs; } + EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE + const RhsNestedCleaned& rhs() const { return m_rhs; } + + protected: + + LhsNested m_lhs; + RhsNested m_rhs; +}; + +namespace internal { + +template::ret> +class dense_product_base + : public internal::dense_xpr_base >::type +{}; + +/** Conversion to scalar for inner-products */ +template +class dense_product_base + : public internal::dense_xpr_base >::type +{ + typedef Product ProductXpr; + typedef typename internal::dense_xpr_base::type Base; +public: + using Base::derived; + typedef typename Base::Scalar Scalar; + + EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE operator const Scalar() const + { + return internal::evaluator(derived()).coeff(0,0); + } +}; + +} // namespace internal + +// Generic API dispatcher +template +class ProductImpl : public internal::generic_xpr_base, MatrixXpr, StorageKind>::type +{ + public: + typedef typename internal::generic_xpr_base, MatrixXpr, StorageKind>::type Base; +}; + +template +class ProductImpl + : public internal::dense_product_base +{ + typedef Product Derived; + + public: + + typedef typename internal::dense_product_base Base; + EIGEN_DENSE_PUBLIC_INTERFACE(Derived) + protected: + enum { + IsOneByOne = (RowsAtCompileTime == 1 || RowsAtCompileTime == Dynamic) && + (ColsAtCompileTime == 1 || ColsAtCompileTime == Dynamic), + EnableCoeff = IsOneByOne || Option==LazyProduct + }; + + public: + + EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Scalar coeff(Index row, Index col) const + { + EIGEN_STATIC_ASSERT(EnableCoeff, THIS_METHOD_IS_ONLY_FOR_INNER_OR_LAZY_PRODUCTS); + eigen_assert( (Option==LazyProduct) || (this->rows() == 1 && this->cols() == 1) ); + + return internal::evaluator(derived()).coeff(row,col); + } + + EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE Scalar coeff(Index i) const + { + EIGEN_STATIC_ASSERT(EnableCoeff, THIS_METHOD_IS_ONLY_FOR_INNER_OR_LAZY_PRODUCTS); + eigen_assert( (Option==LazyProduct) || (this->rows() == 1 && this->cols() == 1) ); + + return internal::evaluator(derived()).coeff(i); + } + + +}; + +} // end namespace Eigen + +#endif // EIGEN_PRODUCT_H diff --git a/extern/eigen/Eigen/src/Core/ProductBase.h b/extern/eigen/Eigen/src/Core/ProductBase.h deleted file mode 100644 index cf74470a..00000000 --- a/extern/eigen/Eigen/src/Core/ProductBase.h +++ /dev/null @@ -1,290 +0,0 @@ -// This file is part of Eigen, a lightweight C++ template library -// for linear algebra. -// -// Copyright (C) 2009-2010 Gael Guennebaud -// -// This Source Code Form is subject to the terms of the Mozilla -// Public License v. 2.0. If a copy of the MPL was not distributed -// with this file, You can obtain one at http://mozilla.org/MPL/2.0/. - -#ifndef EIGEN_PRODUCTBASE_H -#define EIGEN_PRODUCTBASE_H - -namespace Eigen { - -/** \class ProductBase - * \ingroup Core_Module - * - */ - -namespace internal { -template -struct traits > -{ - typedef MatrixXpr XprKind; - typedef typename remove_all<_Lhs>::type Lhs; - typedef typename remove_all<_Rhs>::type Rhs; - typedef typename scalar_product_traits::ReturnType Scalar; - typedef typename promote_storage_type::StorageKind, - typename traits::StorageKind>::ret StorageKind; - typedef typename promote_index_type::Index, - typename traits::Index>::type Index; - enum { - RowsAtCompileTime = traits::RowsAtCompileTime, - ColsAtCompileTime = traits::ColsAtCompileTime, - MaxRowsAtCompileTime = traits::MaxRowsAtCompileTime, - MaxColsAtCompileTime = traits::MaxColsAtCompileTime, - Flags = (MaxRowsAtCompileTime==1 ? RowMajorBit : 0) - | EvalBeforeNestingBit | EvalBeforeAssigningBit | NestByRefBit, - // Note that EvalBeforeNestingBit and NestByRefBit - // are not used in practice because nested is overloaded for products - CoeffReadCost = 0 // FIXME why is it needed ? - }; -}; -} - -#define EIGEN_PRODUCT_PUBLIC_INTERFACE(Derived) \ - typedef ProductBase Base; \ - EIGEN_DENSE_PUBLIC_INTERFACE(Derived) \ - typedef typename Base::LhsNested LhsNested; \ - typedef typename Base::_LhsNested _LhsNested; \ - typedef typename Base::LhsBlasTraits LhsBlasTraits; \ - typedef typename Base::ActualLhsType ActualLhsType; \ - typedef typename Base::_ActualLhsType _ActualLhsType; \ - typedef typename Base::RhsNested RhsNested; \ - typedef typename Base::_RhsNested _RhsNested; \ - typedef typename Base::RhsBlasTraits RhsBlasTraits; \ - typedef typename Base::ActualRhsType ActualRhsType; \ - typedef typename Base::_ActualRhsType _ActualRhsType; \ - using Base::m_lhs; \ - using Base::m_rhs; - -template -class ProductBase : public MatrixBase -{ - public: - typedef MatrixBase Base; - EIGEN_DENSE_PUBLIC_INTERFACE(ProductBase) - - typedef typename Lhs::Nested LhsNested; - typedef typename internal::remove_all::type _LhsNested; - typedef internal::blas_traits<_LhsNested> LhsBlasTraits; - typedef typename LhsBlasTraits::DirectLinearAccessType ActualLhsType; - typedef typename internal::remove_all::type _ActualLhsType; - typedef typename internal::traits::Scalar LhsScalar; - - typedef typename Rhs::Nested RhsNested; - typedef typename internal::remove_all::type _RhsNested; - typedef internal::blas_traits<_RhsNested> RhsBlasTraits; - typedef typename RhsBlasTraits::DirectLinearAccessType ActualRhsType; - typedef typename internal::remove_all::type _ActualRhsType; - typedef typename internal::traits::Scalar RhsScalar; - - // Diagonal of a product: no need to evaluate the arguments because they are going to be evaluated only once - typedef CoeffBasedProduct FullyLazyCoeffBaseProductType; - - public: - -#ifndef EIGEN_NO_MALLOC - typedef typename Base::PlainObject BasePlainObject; - typedef Matrix DynPlainObject; - typedef typename internal::conditional<(BasePlainObject::SizeAtCompileTime==Dynamic) || (BasePlainObject::SizeAtCompileTime*int(sizeof(Scalar)) < int(EIGEN_STACK_ALLOCATION_LIMIT)), - BasePlainObject, DynPlainObject>::type PlainObject; -#else - typedef typename Base::PlainObject PlainObject; -#endif - - ProductBase(const Lhs& a_lhs, const Rhs& a_rhs) - : m_lhs(a_lhs), m_rhs(a_rhs) - { - eigen_assert(a_lhs.cols() == a_rhs.rows() - && "invalid matrix product" - && "if you wanted a coeff-wise or a dot product use the respective explicit functions"); - } - - inline Index rows() const { return m_lhs.rows(); } - inline Index cols() const { return m_rhs.cols(); } - - template - inline void evalTo(Dest& dst) const { dst.setZero(); scaleAndAddTo(dst,Scalar(1)); } - - template - inline void addTo(Dest& dst) const { scaleAndAddTo(dst,Scalar(1)); } - - template - inline void subTo(Dest& dst) const { scaleAndAddTo(dst,Scalar(-1)); } - - template - inline void scaleAndAddTo(Dest& dst, const Scalar& alpha) const { derived().scaleAndAddTo(dst,alpha); } - - const _LhsNested& lhs() const { return m_lhs; } - const _RhsNested& rhs() const { return m_rhs; } - - // Implicit conversion to the nested type (trigger the evaluation of the product) - operator const PlainObject& () const - { - m_result.resize(m_lhs.rows(), m_rhs.cols()); - derived().evalTo(m_result); - return m_result; - } - - const Diagonal diagonal() const - { return FullyLazyCoeffBaseProductType(m_lhs, m_rhs); } - - template - const Diagonal diagonal() const - { return FullyLazyCoeffBaseProductType(m_lhs, m_rhs); } - - const Diagonal diagonal(Index index) const - { return FullyLazyCoeffBaseProductType(m_lhs, m_rhs).diagonal(index); } - - // restrict coeff accessors to 1x1 expressions. No need to care about mutators here since this isnt a Lvalue expression - typename Base::CoeffReturnType coeff(Index row, Index col) const - { -#ifdef EIGEN2_SUPPORT - return lhs().row(row).cwiseProduct(rhs().col(col).transpose()).sum(); -#else - EIGEN_STATIC_ASSERT_SIZE_1x1(Derived) - eigen_assert(this->rows() == 1 && this->cols() == 1); - Matrix result = *this; - return result.coeff(row,col); -#endif - } - - typename Base::CoeffReturnType coeff(Index i) const - { - EIGEN_STATIC_ASSERT_SIZE_1x1(Derived) - eigen_assert(this->rows() == 1 && this->cols() == 1); - Matrix result = *this; - return result.coeff(i); - } - - const Scalar& coeffRef(Index row, Index col) const - { - EIGEN_STATIC_ASSERT_SIZE_1x1(Derived) - eigen_assert(this->rows() == 1 && this->cols() == 1); - return derived().coeffRef(row,col); - } - - const Scalar& coeffRef(Index i) const - { - EIGEN_STATIC_ASSERT_SIZE_1x1(Derived) - eigen_assert(this->rows() == 1 && this->cols() == 1); - return derived().coeffRef(i); - } - - protected: - - LhsNested m_lhs; - RhsNested m_rhs; - - mutable PlainObject m_result; -}; - -// here we need to overload the nested rule for products -// such that the nested type is a const reference to a plain matrix -namespace internal { -template -struct nested, N, PlainObject> -{ - typedef typename GeneralProduct::PlainObject const& type; -}; -template -struct nested, N, PlainObject> -{ - typedef typename GeneralProduct::PlainObject const& type; -}; -} - -template -class ScaledProduct; - -// Note that these two operator* functions are not defined as member -// functions of ProductBase, because, otherwise we would have to -// define all overloads defined in MatrixBase. Furthermore, Using -// "using Base::operator*" would not work with MSVC. -// -// Also note that here we accept any compatible scalar types -template -const ScaledProduct -operator*(const ProductBase& prod, const typename Derived::Scalar& x) -{ return ScaledProduct(prod.derived(), x); } - -template -typename internal::enable_if::value, - const ScaledProduct >::type -operator*(const ProductBase& prod, const typename Derived::RealScalar& x) -{ return ScaledProduct(prod.derived(), x); } - - -template -const ScaledProduct -operator*(const typename Derived::Scalar& x,const ProductBase& prod) -{ return ScaledProduct(prod.derived(), x); } - -template -typename internal::enable_if::value, - const ScaledProduct >::type -operator*(const typename Derived::RealScalar& x,const ProductBase& prod) -{ return ScaledProduct(prod.derived(), x); } - -namespace internal { -template -struct traits > - : traits, - typename NestedProduct::_LhsNested, - typename NestedProduct::_RhsNested> > -{ - typedef typename traits::StorageKind StorageKind; -}; -} - -template -class ScaledProduct - : public ProductBase, - typename NestedProduct::_LhsNested, - typename NestedProduct::_RhsNested> -{ - public: - typedef ProductBase, - typename NestedProduct::_LhsNested, - typename NestedProduct::_RhsNested> Base; - typedef typename Base::Scalar Scalar; - typedef typename Base::PlainObject PlainObject; -// EIGEN_PRODUCT_PUBLIC_INTERFACE(ScaledProduct) - - ScaledProduct(const NestedProduct& prod, const Scalar& x) - : Base(prod.lhs(),prod.rhs()), m_prod(prod), m_alpha(x) {} - - template - inline void evalTo(Dest& dst) const { dst.setZero(); scaleAndAddTo(dst, Scalar(1)); } - - template - inline void addTo(Dest& dst) const { scaleAndAddTo(dst, Scalar(1)); } - - template - inline void subTo(Dest& dst) const { scaleAndAddTo(dst, Scalar(-1)); } - - template - inline void scaleAndAddTo(Dest& dst, const Scalar& a_alpha) const { m_prod.derived().scaleAndAddTo(dst,a_alpha * m_alpha); } - - const Scalar& alpha() const { return m_alpha; } - - protected: - const NestedProduct& m_prod; - Scalar m_alpha; -}; - -/** \internal - * Overloaded to perform an efficient C = (A*B).lazy() */ -template -template -Derived& MatrixBase::lazyAssign(const ProductBase& other) -{ - other.derived().evalTo(derived()); - return derived(); -} - -} // end namespace Eigen - -#endif // EIGEN_PRODUCTBASE_H diff --git a/extern/eigen/Eigen/src/Core/ProductEvaluators.h b/extern/eigen/Eigen/src/Core/ProductEvaluators.h new file mode 100644 index 00000000..8cf294b2 --- /dev/null +++ b/extern/eigen/Eigen/src/Core/ProductEvaluators.h @@ -0,0 +1,1179 @@ +// This file is part of Eigen, a lightweight C++ template library +// for linear algebra. +// +// Copyright (C) 2006-2008 Benoit Jacob +// Copyright (C) 2008-2010 Gael Guennebaud +// Copyright (C) 2011 Jitse Niesen +// +// This Source Code Form is subject to the terms of the Mozilla +// Public License v. 2.0. If a copy of the MPL was not distributed +// with this file, You can obtain one at http://mozilla.org/MPL/2.0/. + + +#ifndef EIGEN_PRODUCTEVALUATORS_H +#define EIGEN_PRODUCTEVALUATORS_H + +namespace Eigen { + +namespace internal { + +/** \internal + * Evaluator of a product expression. + * Since products require special treatments to handle all possible cases, + * we simply defer the evaluation logic to a product_evaluator class + * which offers more partial specialization possibilities. + * + * \sa class product_evaluator + */ +template +struct evaluator > + : public product_evaluator > +{ + typedef Product XprType; + typedef product_evaluator Base; + + EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE explicit evaluator(const XprType& xpr) : Base(xpr) {} +}; + +// Catch "scalar * ( A * B )" and transform it to "(A*scalar) * B" +// TODO we should apply that rule only if that's really helpful +template +struct evaluator_assume_aliasing, + const CwiseNullaryOp, Plain1>, + const Product > > +{ + static const bool value = true; +}; +template +struct evaluator, + const CwiseNullaryOp, Plain1>, + const Product > > + : public evaluator > +{ + typedef CwiseBinaryOp, + const CwiseNullaryOp, Plain1>, + const Product > XprType; + typedef evaluator > Base; + + EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE explicit evaluator(const XprType& xpr) + : Base(xpr.lhs().functor().m_other * xpr.rhs().lhs() * xpr.rhs().rhs()) + {} +}; + + +template +struct evaluator, DiagIndex> > + : public evaluator, DiagIndex> > +{ + typedef Diagonal, DiagIndex> XprType; + typedef evaluator, DiagIndex> > Base; + + EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE explicit evaluator(const XprType& xpr) + : Base(Diagonal, DiagIndex>( + Product(xpr.nestedExpression().lhs(), xpr.nestedExpression().rhs()), + xpr.index() )) + {} +}; + + +// Helper class to perform a matrix product with the destination at hand. +// Depending on the sizes of the factors, there are different evaluation strategies +// as controlled by internal::product_type. +template< typename Lhs, typename Rhs, + typename LhsShape = typename evaluator_traits::Shape, + typename RhsShape = typename evaluator_traits::Shape, + int ProductType = internal::product_type::value> +struct generic_product_impl; + +template +struct evaluator_assume_aliasing > { + static const bool value = true; +}; + +// This is the default evaluator implementation for products: +// It creates a temporary and call generic_product_impl +template +struct product_evaluator, ProductTag, LhsShape, RhsShape> + : public evaluator::PlainObject> +{ + typedef Product XprType; + typedef typename XprType::PlainObject PlainObject; + typedef evaluator Base; + enum { + Flags = Base::Flags | EvalBeforeNestingBit + }; + + EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE + explicit product_evaluator(const XprType& xpr) + : m_result(xpr.rows(), xpr.cols()) + { + ::new (static_cast(this)) Base(m_result); + +// FIXME shall we handle nested_eval here?, +// if so, then we must take care at removing the call to nested_eval in the specializations (e.g., in permutation_matrix_product, transposition_matrix_product, etc.) +// typedef typename internal::nested_eval::type LhsNested; +// typedef typename internal::nested_eval::type RhsNested; +// typedef typename internal::remove_all::type LhsNestedCleaned; +// typedef typename internal::remove_all::type RhsNestedCleaned; +// +// const LhsNested lhs(xpr.lhs()); +// const RhsNested rhs(xpr.rhs()); +// +// generic_product_impl::evalTo(m_result, lhs, rhs); + + generic_product_impl::evalTo(m_result, xpr.lhs(), xpr.rhs()); + } + +protected: + PlainObject m_result; +}; + +// The following three shortcuts are enabled only if the scalar types match exactly. +// TODO: we could enable them for different scalar types when the product is not vectorized. + +// Dense = Product +template< typename DstXprType, typename Lhs, typename Rhs, int Options, typename Scalar> +struct Assignment, internal::assign_op, Dense2Dense, + typename enable_if<(Options==DefaultProduct || Options==AliasFreeProduct)>::type> +{ + typedef Product SrcXprType; + static EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE + void run(DstXprType &dst, const SrcXprType &src, const internal::assign_op &) + { + Index dstRows = src.rows(); + Index dstCols = src.cols(); + if((dst.rows()!=dstRows) || (dst.cols()!=dstCols)) + dst.resize(dstRows, dstCols); + // FIXME shall we handle nested_eval here? + generic_product_impl::evalTo(dst, src.lhs(), src.rhs()); + } +}; + +// Dense += Product +template< typename DstXprType, typename Lhs, typename Rhs, int Options, typename Scalar> +struct Assignment, internal::add_assign_op, Dense2Dense, + typename enable_if<(Options==DefaultProduct || Options==AliasFreeProduct)>::type> +{ + typedef Product SrcXprType; + static EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE + void run(DstXprType &dst, const SrcXprType &src, const internal::add_assign_op &) + { + eigen_assert(dst.rows() == src.rows() && dst.cols() == src.cols()); + // FIXME shall we handle nested_eval here? + generic_product_impl::addTo(dst, src.lhs(), src.rhs()); + } +}; + +// Dense -= Product +template< typename DstXprType, typename Lhs, typename Rhs, int Options, typename Scalar> +struct Assignment, internal::sub_assign_op, Dense2Dense, + typename enable_if<(Options==DefaultProduct || Options==AliasFreeProduct)>::type> +{ + typedef Product SrcXprType; + static EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE + void run(DstXprType &dst, const SrcXprType &src, const internal::sub_assign_op &) + { + eigen_assert(dst.rows() == src.rows() && dst.cols() == src.cols()); + // FIXME shall we handle nested_eval here? + generic_product_impl::subTo(dst, src.lhs(), src.rhs()); + } +}; + + +// Dense ?= scalar * Product +// TODO we should apply that rule if that's really helpful +// for instance, this is not good for inner products +template< typename DstXprType, typename Lhs, typename Rhs, typename AssignFunc, typename Scalar, typename ScalarBis, typename Plain> +struct Assignment, const CwiseNullaryOp,Plain>, + const Product >, AssignFunc, Dense2Dense> +{ + typedef CwiseBinaryOp, + const CwiseNullaryOp,Plain>, + const Product > SrcXprType; + static EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE + void run(DstXprType &dst, const SrcXprType &src, const AssignFunc& func) + { + call_assignment_no_alias(dst, (src.lhs().functor().m_other * src.rhs().lhs())*src.rhs().rhs(), func); + } +}; + +//---------------------------------------- +// Catch "Dense ?= xpr + Product<>" expression to save one temporary +// FIXME we could probably enable these rules for any product, i.e., not only Dense and DefaultProduct + +template +struct evaluator_assume_aliasing::Scalar>, const OtherXpr, + const Product >, DenseShape > { + static const bool value = true; +}; + +template +struct evaluator_assume_aliasing::Scalar>, const OtherXpr, + const Product >, DenseShape > { + static const bool value = true; +}; + +template +struct assignment_from_xpr_op_product +{ + template + static EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE + void run(DstXprType &dst, const SrcXprType &src, const InitialFunc& /*func*/) + { + call_assignment_no_alias(dst, src.lhs(), Func1()); + call_assignment_no_alias(dst, src.rhs(), Func2()); + } +}; + +#define EIGEN_CATCH_ASSIGN_XPR_OP_PRODUCT(ASSIGN_OP,BINOP,ASSIGN_OP2) \ + template< typename DstXprType, typename OtherXpr, typename Lhs, typename Rhs, typename DstScalar, typename SrcScalar, typename OtherScalar,typename ProdScalar> \ + struct Assignment, const OtherXpr, \ + const Product >, internal::ASSIGN_OP, Dense2Dense> \ + : assignment_from_xpr_op_product, internal::ASSIGN_OP, internal::ASSIGN_OP2 > \ + {} + +EIGEN_CATCH_ASSIGN_XPR_OP_PRODUCT(assign_op, scalar_sum_op,add_assign_op); +EIGEN_CATCH_ASSIGN_XPR_OP_PRODUCT(add_assign_op,scalar_sum_op,add_assign_op); +EIGEN_CATCH_ASSIGN_XPR_OP_PRODUCT(sub_assign_op,scalar_sum_op,sub_assign_op); + +EIGEN_CATCH_ASSIGN_XPR_OP_PRODUCT(assign_op, scalar_difference_op,sub_assign_op); +EIGEN_CATCH_ASSIGN_XPR_OP_PRODUCT(add_assign_op,scalar_difference_op,sub_assign_op); +EIGEN_CATCH_ASSIGN_XPR_OP_PRODUCT(sub_assign_op,scalar_difference_op,add_assign_op); + +//---------------------------------------- + +template +struct generic_product_impl +{ + template + static EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE void evalTo(Dst& dst, const Lhs& lhs, const Rhs& rhs) + { + dst.coeffRef(0,0) = (lhs.transpose().cwiseProduct(rhs)).sum(); + } + + template + static EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE void addTo(Dst& dst, const Lhs& lhs, const Rhs& rhs) + { + dst.coeffRef(0,0) += (lhs.transpose().cwiseProduct(rhs)).sum(); + } + + template + static EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE void subTo(Dst& dst, const Lhs& lhs, const Rhs& rhs) + { dst.coeffRef(0,0) -= (lhs.transpose().cwiseProduct(rhs)).sum(); } +}; + + +/*********************************************************************** +* Implementation of outer dense * dense vector product +***********************************************************************/ + +// Column major result +template +void EIGEN_DEVICE_FUNC outer_product_selector_run(Dst& dst, const Lhs &lhs, const Rhs &rhs, const Func& func, const false_type&) +{ + evaluator rhsEval(rhs); + ei_declare_local_nested_eval(Lhs,lhs,Rhs::SizeAtCompileTime,actual_lhs); + // FIXME if cols is large enough, then it might be useful to make sure that lhs is sequentially stored + // FIXME not very good if rhs is real and lhs complex while alpha is real too + const Index cols = dst.cols(); + for (Index j=0; j +void EIGEN_DEVICE_FUNC outer_product_selector_run(Dst& dst, const Lhs &lhs, const Rhs &rhs, const Func& func, const true_type&) +{ + evaluator lhsEval(lhs); + ei_declare_local_nested_eval(Rhs,rhs,Lhs::SizeAtCompileTime,actual_rhs); + // FIXME if rows is large enough, then it might be useful to make sure that rhs is sequentially stored + // FIXME not very good if lhs is real and rhs complex while alpha is real too + const Index rows = dst.rows(); + for (Index i=0; i +struct generic_product_impl +{ + template struct is_row_major : internal::conditional<(int(T::Flags)&RowMajorBit), internal::true_type, internal::false_type>::type {}; + typedef typename Product::Scalar Scalar; + + // TODO it would be nice to be able to exploit our *_assign_op functors for that purpose + struct set { template EIGEN_DEVICE_FUNC void operator()(const Dst& dst, const Src& src) const { dst.const_cast_derived() = src; } }; + struct add { template EIGEN_DEVICE_FUNC void operator()(const Dst& dst, const Src& src) const { dst.const_cast_derived() += src; } }; + struct sub { template EIGEN_DEVICE_FUNC void operator()(const Dst& dst, const Src& src) const { dst.const_cast_derived() -= src; } }; + struct adds { + Scalar m_scale; + explicit adds(const Scalar& s) : m_scale(s) {} + template void EIGEN_DEVICE_FUNC operator()(const Dst& dst, const Src& src) const { + dst.const_cast_derived() += m_scale * src; + } + }; + + template + static EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE void evalTo(Dst& dst, const Lhs& lhs, const Rhs& rhs) + { + internal::outer_product_selector_run(dst, lhs, rhs, set(), is_row_major()); + } + + template + static EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE void addTo(Dst& dst, const Lhs& lhs, const Rhs& rhs) + { + internal::outer_product_selector_run(dst, lhs, rhs, add(), is_row_major()); + } + + template + static EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE void subTo(Dst& dst, const Lhs& lhs, const Rhs& rhs) + { + internal::outer_product_selector_run(dst, lhs, rhs, sub(), is_row_major()); + } + + template + static EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE void scaleAndAddTo(Dst& dst, const Lhs& lhs, const Rhs& rhs, const Scalar& alpha) + { + internal::outer_product_selector_run(dst, lhs, rhs, adds(alpha), is_row_major()); + } + +}; + + +// This base class provides default implementations for evalTo, addTo, subTo, in terms of scaleAndAddTo +template +struct generic_product_impl_base +{ + typedef typename Product::Scalar Scalar; + + template + static EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE void evalTo(Dst& dst, const Lhs& lhs, const Rhs& rhs) + { dst.setZero(); scaleAndAddTo(dst, lhs, rhs, Scalar(1)); } + + template + static EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE void addTo(Dst& dst, const Lhs& lhs, const Rhs& rhs) + { scaleAndAddTo(dst,lhs, rhs, Scalar(1)); } + + template + static EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE void subTo(Dst& dst, const Lhs& lhs, const Rhs& rhs) + { scaleAndAddTo(dst, lhs, rhs, Scalar(-1)); } + + template + static EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE void scaleAndAddTo(Dst& dst, const Lhs& lhs, const Rhs& rhs, const Scalar& alpha) + { Derived::scaleAndAddTo(dst,lhs,rhs,alpha); } + +}; + +template +struct generic_product_impl + : generic_product_impl_base > +{ + typedef typename nested_eval::type LhsNested; + typedef typename nested_eval::type RhsNested; + typedef typename Product::Scalar Scalar; + enum { Side = Lhs::IsVectorAtCompileTime ? OnTheLeft : OnTheRight }; + typedef typename internal::remove_all::type>::type MatrixType; + + template + static EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE void scaleAndAddTo(Dest& dst, const Lhs& lhs, const Rhs& rhs, const Scalar& alpha) + { + // Fallback to inner product if both the lhs and rhs is a runtime vector. + if (lhs.rows() == 1 && rhs.cols() == 1) { + dst.coeffRef(0,0) += alpha * lhs.row(0).conjugate().dot(rhs.col(0)); + return; + } + LhsNested actual_lhs(lhs); + RhsNested actual_rhs(rhs); + internal::gemv_dense_selector::HasUsableDirectAccess) + >::run(actual_lhs, actual_rhs, dst, alpha); + } +}; + +template +struct generic_product_impl +{ + typedef typename Product::Scalar Scalar; + + template + static EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE void evalTo(Dst& dst, const Lhs& lhs, const Rhs& rhs) + { + // Same as: dst.noalias() = lhs.lazyProduct(rhs); + // but easier on the compiler side + call_assignment_no_alias(dst, lhs.lazyProduct(rhs), internal::assign_op()); + } + + template + static EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE void addTo(Dst& dst, const Lhs& lhs, const Rhs& rhs) + { + // dst.noalias() += lhs.lazyProduct(rhs); + call_assignment_no_alias(dst, lhs.lazyProduct(rhs), internal::add_assign_op()); + } + + template + static EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE void subTo(Dst& dst, const Lhs& lhs, const Rhs& rhs) + { + // dst.noalias() -= lhs.lazyProduct(rhs); + call_assignment_no_alias(dst, lhs.lazyProduct(rhs), internal::sub_assign_op()); + } + + // This is a special evaluation path called from generic_product_impl<...,GemmProduct> in file GeneralMatrixMatrix.h + // This variant tries to extract scalar multiples from both the LHS and RHS and factor them out. For instance: + // dst {,+,-}= (s1*A)*(B*s2) + // will be rewritten as: + // dst {,+,-}= (s1*s2) * (A.lazyProduct(B)) + // There are at least four benefits of doing so: + // 1 - huge performance gain for heap-allocated matrix types as it save costly allocations. + // 2 - it is faster than simply by-passing the heap allocation through stack allocation. + // 3 - it makes this fallback consistent with the heavy GEMM routine. + // 4 - it fully by-passes huge stack allocation attempts when multiplying huge fixed-size matrices. + // (see https://stackoverflow.com/questions/54738495) + // For small fixed sizes matrices, howver, the gains are less obvious, it is sometimes x2 faster, but sometimes x3 slower, + // and the behavior depends also a lot on the compiler... This is why this re-writting strategy is currently + // enabled only when falling back from the main GEMM. + template + static EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE + void eval_dynamic(Dst& dst, const Lhs& lhs, const Rhs& rhs, const Func &func) + { + enum { + HasScalarFactor = blas_traits::HasScalarFactor || blas_traits::HasScalarFactor, + ConjLhs = blas_traits::NeedToConjugate, + ConjRhs = blas_traits::NeedToConjugate + }; + // FIXME: in c++11 this should be auto, and extractScalarFactor should also return auto + // this is important for real*complex_mat + Scalar actualAlpha = combine_scalar_factors(lhs, rhs); + + eval_dynamic_impl(dst, + blas_traits::extract(lhs).template conjugateIf(), + blas_traits::extract(rhs).template conjugateIf(), + func, + actualAlpha, + typename conditional::type()); + } + +protected: + + template + static EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE + void eval_dynamic_impl(Dst& dst, const LhsT& lhs, const RhsT& rhs, const Func &func, const Scalar& s /* == 1 */, false_type) + { + EIGEN_UNUSED_VARIABLE(s); + eigen_internal_assert(s==Scalar(1)); + call_restricted_packet_assignment_no_alias(dst, lhs.lazyProduct(rhs), func); + } + + template + static EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE + void eval_dynamic_impl(Dst& dst, const LhsT& lhs, const RhsT& rhs, const Func &func, const Scalar& s, true_type) + { + call_restricted_packet_assignment_no_alias(dst, s * lhs.lazyProduct(rhs), func); + } +}; + +// This specialization enforces the use of a coefficient-based evaluation strategy +template +struct generic_product_impl + : generic_product_impl {}; + +// Case 2: Evaluate coeff by coeff +// +// This is mostly taken from CoeffBasedProduct.h +// The main difference is that we add an extra argument to the etor_product_*_impl::run() function +// for the inner dimension of the product, because evaluator object do not know their size. + +template +struct etor_product_coeff_impl; + +template +struct etor_product_packet_impl; + +template +struct product_evaluator, ProductTag, DenseShape, DenseShape> + : evaluator_base > +{ + typedef Product XprType; + typedef typename XprType::Scalar Scalar; + typedef typename XprType::CoeffReturnType CoeffReturnType; + + EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE + explicit product_evaluator(const XprType& xpr) + : m_lhs(xpr.lhs()), + m_rhs(xpr.rhs()), + m_lhsImpl(m_lhs), // FIXME the creation of the evaluator objects should result in a no-op, but check that! + m_rhsImpl(m_rhs), // Moreover, they are only useful for the packet path, so we could completely disable them when not needed, + // or perhaps declare them on the fly on the packet method... We have experiment to check what's best. + m_innerDim(xpr.lhs().cols()) + { + EIGEN_INTERNAL_CHECK_COST_VALUE(NumTraits::MulCost); + EIGEN_INTERNAL_CHECK_COST_VALUE(NumTraits::AddCost); + EIGEN_INTERNAL_CHECK_COST_VALUE(CoeffReadCost); +#if 0 + std::cerr << "LhsOuterStrideBytes= " << LhsOuterStrideBytes << "\n"; + std::cerr << "RhsOuterStrideBytes= " << RhsOuterStrideBytes << "\n"; + std::cerr << "LhsAlignment= " << LhsAlignment << "\n"; + std::cerr << "RhsAlignment= " << RhsAlignment << "\n"; + std::cerr << "CanVectorizeLhs= " << CanVectorizeLhs << "\n"; + std::cerr << "CanVectorizeRhs= " << CanVectorizeRhs << "\n"; + std::cerr << "CanVectorizeInner= " << CanVectorizeInner << "\n"; + std::cerr << "EvalToRowMajor= " << EvalToRowMajor << "\n"; + std::cerr << "Alignment= " << Alignment << "\n"; + std::cerr << "Flags= " << Flags << "\n"; +#endif + } + + // Everything below here is taken from CoeffBasedProduct.h + + typedef typename internal::nested_eval::type LhsNested; + typedef typename internal::nested_eval::type RhsNested; + + typedef typename internal::remove_all::type LhsNestedCleaned; + typedef typename internal::remove_all::type RhsNestedCleaned; + + typedef evaluator LhsEtorType; + typedef evaluator RhsEtorType; + + enum { + RowsAtCompileTime = LhsNestedCleaned::RowsAtCompileTime, + ColsAtCompileTime = RhsNestedCleaned::ColsAtCompileTime, + InnerSize = EIGEN_SIZE_MIN_PREFER_FIXED(LhsNestedCleaned::ColsAtCompileTime, RhsNestedCleaned::RowsAtCompileTime), + MaxRowsAtCompileTime = LhsNestedCleaned::MaxRowsAtCompileTime, + MaxColsAtCompileTime = RhsNestedCleaned::MaxColsAtCompileTime + }; + + typedef typename find_best_packet::type LhsVecPacketType; + typedef typename find_best_packet::type RhsVecPacketType; + + enum { + + LhsCoeffReadCost = LhsEtorType::CoeffReadCost, + RhsCoeffReadCost = RhsEtorType::CoeffReadCost, + CoeffReadCost = InnerSize==0 ? NumTraits::ReadCost + : InnerSize == Dynamic ? HugeCost + : InnerSize * (NumTraits::MulCost + int(LhsCoeffReadCost) + int(RhsCoeffReadCost)) + + (InnerSize - 1) * NumTraits::AddCost, + + Unroll = CoeffReadCost <= EIGEN_UNROLLING_LIMIT, + + LhsFlags = LhsEtorType::Flags, + RhsFlags = RhsEtorType::Flags, + + LhsRowMajor = LhsFlags & RowMajorBit, + RhsRowMajor = RhsFlags & RowMajorBit, + + LhsVecPacketSize = unpacket_traits::size, + RhsVecPacketSize = unpacket_traits::size, + + // Here, we don't care about alignment larger than the usable packet size. + LhsAlignment = EIGEN_PLAIN_ENUM_MIN(LhsEtorType::Alignment,LhsVecPacketSize*int(sizeof(typename LhsNestedCleaned::Scalar))), + RhsAlignment = EIGEN_PLAIN_ENUM_MIN(RhsEtorType::Alignment,RhsVecPacketSize*int(sizeof(typename RhsNestedCleaned::Scalar))), + + SameType = is_same::value, + + CanVectorizeRhs = bool(RhsRowMajor) && (RhsFlags & PacketAccessBit) && (ColsAtCompileTime!=1), + CanVectorizeLhs = (!LhsRowMajor) && (LhsFlags & PacketAccessBit) && (RowsAtCompileTime!=1), + + EvalToRowMajor = (MaxRowsAtCompileTime==1&&MaxColsAtCompileTime!=1) ? 1 + : (MaxColsAtCompileTime==1&&MaxRowsAtCompileTime!=1) ? 0 + : (bool(RhsRowMajor) && !CanVectorizeLhs), + + Flags = ((int(LhsFlags) | int(RhsFlags)) & HereditaryBits & ~RowMajorBit) + | (EvalToRowMajor ? RowMajorBit : 0) + // TODO enable vectorization for mixed types + | (SameType && (CanVectorizeLhs || CanVectorizeRhs) ? PacketAccessBit : 0) + | (XprType::IsVectorAtCompileTime ? LinearAccessBit : 0), + + LhsOuterStrideBytes = int(LhsNestedCleaned::OuterStrideAtCompileTime) * int(sizeof(typename LhsNestedCleaned::Scalar)), + RhsOuterStrideBytes = int(RhsNestedCleaned::OuterStrideAtCompileTime) * int(sizeof(typename RhsNestedCleaned::Scalar)), + + Alignment = bool(CanVectorizeLhs) ? (LhsOuterStrideBytes<=0 || (int(LhsOuterStrideBytes) % EIGEN_PLAIN_ENUM_MAX(1,LhsAlignment))!=0 ? 0 : LhsAlignment) + : bool(CanVectorizeRhs) ? (RhsOuterStrideBytes<=0 || (int(RhsOuterStrideBytes) % EIGEN_PLAIN_ENUM_MAX(1,RhsAlignment))!=0 ? 0 : RhsAlignment) + : 0, + + /* CanVectorizeInner deserves special explanation. It does not affect the product flags. It is not used outside + * of Product. If the Product itself is not a packet-access expression, there is still a chance that the inner + * loop of the product might be vectorized. This is the meaning of CanVectorizeInner. Since it doesn't affect + * the Flags, it is safe to make this value depend on ActualPacketAccessBit, that doesn't affect the ABI. + */ + CanVectorizeInner = SameType + && LhsRowMajor + && (!RhsRowMajor) + && (int(LhsFlags) & int(RhsFlags) & ActualPacketAccessBit) + && (int(InnerSize) % packet_traits::size == 0) + }; + + EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE const CoeffReturnType coeff(Index row, Index col) const + { + return (m_lhs.row(row).transpose().cwiseProduct( m_rhs.col(col) )).sum(); + } + + /* Allow index-based non-packet access. It is impossible though to allow index-based packed access, + * which is why we don't set the LinearAccessBit. + * TODO: this seems possible when the result is a vector + */ + EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE + const CoeffReturnType coeff(Index index) const + { + const Index row = (RowsAtCompileTime == 1 || MaxRowsAtCompileTime==1) ? 0 : index; + const Index col = (RowsAtCompileTime == 1 || MaxRowsAtCompileTime==1) ? index : 0; + return (m_lhs.row(row).transpose().cwiseProduct( m_rhs.col(col) )).sum(); + } + + template + EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE + const PacketType packet(Index row, Index col) const + { + PacketType res; + typedef etor_product_packet_impl PacketImpl; + PacketImpl::run(row, col, m_lhsImpl, m_rhsImpl, m_innerDim, res); + return res; + } + + template + EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE + const PacketType packet(Index index) const + { + const Index row = (RowsAtCompileTime == 1 || MaxRowsAtCompileTime==1) ? 0 : index; + const Index col = (RowsAtCompileTime == 1 || MaxRowsAtCompileTime==1) ? index : 0; + return packet(row,col); + } + +protected: + typename internal::add_const_on_value_type::type m_lhs; + typename internal::add_const_on_value_type::type m_rhs; + + LhsEtorType m_lhsImpl; + RhsEtorType m_rhsImpl; + + // TODO: Get rid of m_innerDim if known at compile time + Index m_innerDim; +}; + +template +struct product_evaluator, LazyCoeffBasedProductMode, DenseShape, DenseShape> + : product_evaluator, CoeffBasedProductMode, DenseShape, DenseShape> +{ + typedef Product XprType; + typedef Product BaseProduct; + typedef product_evaluator Base; + enum { + Flags = Base::Flags | EvalBeforeNestingBit + }; + EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE + explicit product_evaluator(const XprType& xpr) + : Base(BaseProduct(xpr.lhs(),xpr.rhs())) + {} +}; + +/**************************************** +*** Coeff based product, Packet path *** +****************************************/ + +template +struct etor_product_packet_impl +{ + static EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE void run(Index row, Index col, const Lhs& lhs, const Rhs& rhs, Index innerDim, Packet &res) + { + etor_product_packet_impl::run(row, col, lhs, rhs, innerDim, res); + res = pmadd(pset1(lhs.coeff(row, Index(UnrollingIndex-1))), rhs.template packet(Index(UnrollingIndex-1), col), res); + } +}; + +template +struct etor_product_packet_impl +{ + static EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE void run(Index row, Index col, const Lhs& lhs, const Rhs& rhs, Index innerDim, Packet &res) + { + etor_product_packet_impl::run(row, col, lhs, rhs, innerDim, res); + res = pmadd(lhs.template packet(row, Index(UnrollingIndex-1)), pset1(rhs.coeff(Index(UnrollingIndex-1), col)), res); + } +}; + +template +struct etor_product_packet_impl +{ + static EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE void run(Index row, Index col, const Lhs& lhs, const Rhs& rhs, Index /*innerDim*/, Packet &res) + { + res = pmul(pset1(lhs.coeff(row, Index(0))),rhs.template packet(Index(0), col)); + } +}; + +template +struct etor_product_packet_impl +{ + static EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE void run(Index row, Index col, const Lhs& lhs, const Rhs& rhs, Index /*innerDim*/, Packet &res) + { + res = pmul(lhs.template packet(row, Index(0)), pset1(rhs.coeff(Index(0), col))); + } +}; + +template +struct etor_product_packet_impl +{ + static EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE void run(Index /*row*/, Index /*col*/, const Lhs& /*lhs*/, const Rhs& /*rhs*/, Index /*innerDim*/, Packet &res) + { + res = pset1(typename unpacket_traits::type(0)); + } +}; + +template +struct etor_product_packet_impl +{ + static EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE void run(Index /*row*/, Index /*col*/, const Lhs& /*lhs*/, const Rhs& /*rhs*/, Index /*innerDim*/, Packet &res) + { + res = pset1(typename unpacket_traits::type(0)); + } +}; + +template +struct etor_product_packet_impl +{ + static EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE void run(Index row, Index col, const Lhs& lhs, const Rhs& rhs, Index innerDim, Packet& res) + { + res = pset1(typename unpacket_traits::type(0)); + for(Index i = 0; i < innerDim; ++i) + res = pmadd(pset1(lhs.coeff(row, i)), rhs.template packet(i, col), res); + } +}; + +template +struct etor_product_packet_impl +{ + static EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE void run(Index row, Index col, const Lhs& lhs, const Rhs& rhs, Index innerDim, Packet& res) + { + res = pset1(typename unpacket_traits::type(0)); + for(Index i = 0; i < innerDim; ++i) + res = pmadd(lhs.template packet(row, i), pset1(rhs.coeff(i, col)), res); + } +}; + + +/*************************************************************************** +* Triangular products +***************************************************************************/ +template +struct triangular_product_impl; + +template +struct generic_product_impl + : generic_product_impl_base > +{ + typedef typename Product::Scalar Scalar; + + template + static void scaleAndAddTo(Dest& dst, const Lhs& lhs, const Rhs& rhs, const Scalar& alpha) + { + triangular_product_impl + ::run(dst, lhs.nestedExpression(), rhs, alpha); + } +}; + +template +struct generic_product_impl +: generic_product_impl_base > +{ + typedef typename Product::Scalar Scalar; + + template + static void scaleAndAddTo(Dest& dst, const Lhs& lhs, const Rhs& rhs, const Scalar& alpha) + { + triangular_product_impl::run(dst, lhs, rhs.nestedExpression(), alpha); + } +}; + + +/*************************************************************************** +* SelfAdjoint products +***************************************************************************/ +template +struct selfadjoint_product_impl; + +template +struct generic_product_impl + : generic_product_impl_base > +{ + typedef typename Product::Scalar Scalar; + + template + static EIGEN_DEVICE_FUNC + void scaleAndAddTo(Dest& dst, const Lhs& lhs, const Rhs& rhs, const Scalar& alpha) + { + selfadjoint_product_impl::run(dst, lhs.nestedExpression(), rhs, alpha); + } +}; + +template +struct generic_product_impl +: generic_product_impl_base > +{ + typedef typename Product::Scalar Scalar; + + template + static void scaleAndAddTo(Dest& dst, const Lhs& lhs, const Rhs& rhs, const Scalar& alpha) + { + selfadjoint_product_impl::run(dst, lhs, rhs.nestedExpression(), alpha); + } +}; + + +/*************************************************************************** +* Diagonal products +***************************************************************************/ + +template +struct diagonal_product_evaluator_base + : evaluator_base +{ + typedef typename ScalarBinaryOpTraits::ReturnType Scalar; +public: + enum { + CoeffReadCost = int(NumTraits::MulCost) + int(evaluator::CoeffReadCost) + int(evaluator::CoeffReadCost), + + MatrixFlags = evaluator::Flags, + DiagFlags = evaluator::Flags, + + _StorageOrder = (Derived::MaxRowsAtCompileTime==1 && Derived::MaxColsAtCompileTime!=1) ? RowMajor + : (Derived::MaxColsAtCompileTime==1 && Derived::MaxRowsAtCompileTime!=1) ? ColMajor + : MatrixFlags & RowMajorBit ? RowMajor : ColMajor, + _SameStorageOrder = _StorageOrder == (MatrixFlags & RowMajorBit ? RowMajor : ColMajor), + + _ScalarAccessOnDiag = !((int(_StorageOrder) == ColMajor && int(ProductOrder) == OnTheLeft) + ||(int(_StorageOrder) == RowMajor && int(ProductOrder) == OnTheRight)), + _SameTypes = is_same::value, + // FIXME currently we need same types, but in the future the next rule should be the one + //_Vectorizable = bool(int(MatrixFlags)&PacketAccessBit) && ((!_PacketOnDiag) || (_SameTypes && bool(int(DiagFlags)&PacketAccessBit))), + _Vectorizable = bool(int(MatrixFlags)&PacketAccessBit) + && _SameTypes + && (_SameStorageOrder || (MatrixFlags&LinearAccessBit)==LinearAccessBit) + && (_ScalarAccessOnDiag || (bool(int(DiagFlags)&PacketAccessBit))), + _LinearAccessMask = (MatrixType::RowsAtCompileTime==1 || MatrixType::ColsAtCompileTime==1) ? LinearAccessBit : 0, + Flags = ((HereditaryBits|_LinearAccessMask) & (unsigned int)(MatrixFlags)) | (_Vectorizable ? PacketAccessBit : 0), + Alignment = evaluator::Alignment, + + AsScalarProduct = (DiagonalType::SizeAtCompileTime==1) + || (DiagonalType::SizeAtCompileTime==Dynamic && MatrixType::RowsAtCompileTime==1 && ProductOrder==OnTheLeft) + || (DiagonalType::SizeAtCompileTime==Dynamic && MatrixType::ColsAtCompileTime==1 && ProductOrder==OnTheRight) + }; + + EIGEN_DEVICE_FUNC diagonal_product_evaluator_base(const MatrixType &mat, const DiagonalType &diag) + : m_diagImpl(diag), m_matImpl(mat) + { + EIGEN_INTERNAL_CHECK_COST_VALUE(NumTraits::MulCost); + EIGEN_INTERNAL_CHECK_COST_VALUE(CoeffReadCost); + } + + EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE const Scalar coeff(Index idx) const + { + if(AsScalarProduct) + return m_diagImpl.coeff(0) * m_matImpl.coeff(idx); + else + return m_diagImpl.coeff(idx) * m_matImpl.coeff(idx); + } + +protected: + template + EIGEN_STRONG_INLINE PacketType packet_impl(Index row, Index col, Index id, internal::true_type) const + { + return internal::pmul(m_matImpl.template packet(row, col), + internal::pset1(m_diagImpl.coeff(id))); + } + + template + EIGEN_STRONG_INLINE PacketType packet_impl(Index row, Index col, Index id, internal::false_type) const + { + enum { + InnerSize = (MatrixType::Flags & RowMajorBit) ? MatrixType::ColsAtCompileTime : MatrixType::RowsAtCompileTime, + DiagonalPacketLoadMode = EIGEN_PLAIN_ENUM_MIN(LoadMode,((InnerSize%16) == 0) ? int(Aligned16) : int(evaluator::Alignment)) // FIXME hardcoded 16!! + }; + return internal::pmul(m_matImpl.template packet(row, col), + m_diagImpl.template packet(id)); + } + + evaluator m_diagImpl; + evaluator m_matImpl; +}; + +// diagonal * dense +template +struct product_evaluator, ProductTag, DiagonalShape, DenseShape> + : diagonal_product_evaluator_base, OnTheLeft> +{ + typedef diagonal_product_evaluator_base, OnTheLeft> Base; + using Base::m_diagImpl; + using Base::m_matImpl; + using Base::coeff; + typedef typename Base::Scalar Scalar; + + typedef Product XprType; + typedef typename XprType::PlainObject PlainObject; + typedef typename Lhs::DiagonalVectorType DiagonalType; + + + enum { StorageOrder = Base::_StorageOrder }; + + EIGEN_DEVICE_FUNC explicit product_evaluator(const XprType& xpr) + : Base(xpr.rhs(), xpr.lhs().diagonal()) + { + } + + EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE const Scalar coeff(Index row, Index col) const + { + return m_diagImpl.coeff(row) * m_matImpl.coeff(row, col); + } + +#ifndef EIGEN_GPUCC + template + EIGEN_STRONG_INLINE PacketType packet(Index row, Index col) const + { + // FIXME: NVCC used to complain about the template keyword, but we have to check whether this is still the case. + // See also similar calls below. + return this->template packet_impl(row,col, row, + typename internal::conditional::type()); + } + + template + EIGEN_STRONG_INLINE PacketType packet(Index idx) const + { + return packet(int(StorageOrder)==ColMajor?idx:0,int(StorageOrder)==ColMajor?0:idx); + } +#endif +}; + +// dense * diagonal +template +struct product_evaluator, ProductTag, DenseShape, DiagonalShape> + : diagonal_product_evaluator_base, OnTheRight> +{ + typedef diagonal_product_evaluator_base, OnTheRight> Base; + using Base::m_diagImpl; + using Base::m_matImpl; + using Base::coeff; + typedef typename Base::Scalar Scalar; + + typedef Product XprType; + typedef typename XprType::PlainObject PlainObject; + + enum { StorageOrder = Base::_StorageOrder }; + + EIGEN_DEVICE_FUNC explicit product_evaluator(const XprType& xpr) + : Base(xpr.lhs(), xpr.rhs().diagonal()) + { + } + + EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE const Scalar coeff(Index row, Index col) const + { + return m_matImpl.coeff(row, col) * m_diagImpl.coeff(col); + } + +#ifndef EIGEN_GPUCC + template + EIGEN_STRONG_INLINE PacketType packet(Index row, Index col) const + { + return this->template packet_impl(row,col, col, + typename internal::conditional::type()); + } + + template + EIGEN_STRONG_INLINE PacketType packet(Index idx) const + { + return packet(int(StorageOrder)==ColMajor?idx:0,int(StorageOrder)==ColMajor?0:idx); + } +#endif +}; + +/*************************************************************************** +* Products with permutation matrices +***************************************************************************/ + +/** \internal + * \class permutation_matrix_product + * Internal helper class implementing the product between a permutation matrix and a matrix. + * This class is specialized for DenseShape below and for SparseShape in SparseCore/SparsePermutation.h + */ +template +struct permutation_matrix_product; + +template +struct permutation_matrix_product +{ + typedef typename nested_eval::type MatrixType; + typedef typename remove_all::type MatrixTypeCleaned; + + template + static EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE void run(Dest& dst, const PermutationType& perm, const ExpressionType& xpr) + { + MatrixType mat(xpr); + const Index n = Side==OnTheLeft ? mat.rows() : mat.cols(); + // FIXME we need an is_same for expression that is not sensitive to constness. For instance + // is_same_xpr, Block >::value should be true. + //if(is_same::value && extract_data(dst) == extract_data(mat)) + if(is_same_dense(dst, mat)) + { + // apply the permutation inplace + Matrix mask(perm.size()); + mask.fill(false); + Index r = 0; + while(r < perm.size()) + { + // search for the next seed + while(r=perm.size()) + break; + // we got one, let's follow it until we are back to the seed + Index k0 = r++; + Index kPrev = k0; + mask.coeffRef(k0) = true; + for(Index k=perm.indices().coeff(k0); k!=k0; k=perm.indices().coeff(k)) + { + Block(dst, k) + .swap(Block + (dst,((Side==OnTheLeft) ^ Transposed) ? k0 : kPrev)); + + mask.coeffRef(k) = true; + kPrev = k; + } + } + } + else + { + for(Index i = 0; i < n; ++i) + { + Block + (dst, ((Side==OnTheLeft) ^ Transposed) ? perm.indices().coeff(i) : i) + + = + + Block + (mat, ((Side==OnTheRight) ^ Transposed) ? perm.indices().coeff(i) : i); + } + } + } +}; + +template +struct generic_product_impl +{ + template + static EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE void evalTo(Dest& dst, const Lhs& lhs, const Rhs& rhs) + { + permutation_matrix_product::run(dst, lhs, rhs); + } +}; + +template +struct generic_product_impl +{ + template + static EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE void evalTo(Dest& dst, const Lhs& lhs, const Rhs& rhs) + { + permutation_matrix_product::run(dst, rhs, lhs); + } +}; + +template +struct generic_product_impl, Rhs, PermutationShape, MatrixShape, ProductTag> +{ + template + static EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE void evalTo(Dest& dst, const Inverse& lhs, const Rhs& rhs) + { + permutation_matrix_product::run(dst, lhs.nestedExpression(), rhs); + } +}; + +template +struct generic_product_impl, MatrixShape, PermutationShape, ProductTag> +{ + template + static EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE void evalTo(Dest& dst, const Lhs& lhs, const Inverse& rhs) + { + permutation_matrix_product::run(dst, rhs.nestedExpression(), lhs); + } +}; + + +/*************************************************************************** +* Products with transpositions matrices +***************************************************************************/ + +// FIXME could we unify Transpositions and Permutation into a single "shape"?? + +/** \internal + * \class transposition_matrix_product + * Internal helper class implementing the product between a permutation matrix and a matrix. + */ +template +struct transposition_matrix_product +{ + typedef typename nested_eval::type MatrixType; + typedef typename remove_all::type MatrixTypeCleaned; + + template + static EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE void run(Dest& dst, const TranspositionType& tr, const ExpressionType& xpr) + { + MatrixType mat(xpr); + typedef typename TranspositionType::StorageIndex StorageIndex; + const Index size = tr.size(); + StorageIndex j = 0; + + if(!is_same_dense(dst,mat)) + dst = mat; + + for(Index k=(Transposed?size-1:0) ; Transposed?k>=0:k +struct generic_product_impl +{ + template + static EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE void evalTo(Dest& dst, const Lhs& lhs, const Rhs& rhs) + { + transposition_matrix_product::run(dst, lhs, rhs); + } +}; + +template +struct generic_product_impl +{ + template + static EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE void evalTo(Dest& dst, const Lhs& lhs, const Rhs& rhs) + { + transposition_matrix_product::run(dst, rhs, lhs); + } +}; + + +template +struct generic_product_impl, Rhs, TranspositionsShape, MatrixShape, ProductTag> +{ + template + static EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE void evalTo(Dest& dst, const Transpose& lhs, const Rhs& rhs) + { + transposition_matrix_product::run(dst, lhs.nestedExpression(), rhs); + } +}; + +template +struct generic_product_impl, MatrixShape, TranspositionsShape, ProductTag> +{ + template + static EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE void evalTo(Dest& dst, const Lhs& lhs, const Transpose& rhs) + { + transposition_matrix_product::run(dst, rhs.nestedExpression(), lhs); + } +}; + +} // end namespace internal + +} // end namespace Eigen + +#endif // EIGEN_PRODUCT_EVALUATORS_H diff --git a/extern/eigen/Eigen/src/Core/Random.h b/extern/eigen/Eigen/src/Core/Random.h index 480fea40..dab2ac8e 100644 --- a/extern/eigen/Eigen/src/Core/Random.h +++ b/extern/eigen/Eigen/src/Core/Random.h @@ -16,8 +16,7 @@ namespace internal { template struct scalar_random_op { EIGEN_EMPTY_STRUCT_CTOR(scalar_random_op) - template - inline const Scalar operator() (Index, Index = 0) const { return random(); } + inline const Scalar operator() () const { return random(); } }; template @@ -28,12 +27,18 @@ struct functor_traits > /** \returns a random matrix expression * + * Numbers are uniformly spread through their whole definition range for integer types, + * and in the [-1:1] range for floating point scalar types. + * * The parameters \a rows and \a cols are the number of rows and of columns of * the returned matrix. Must be compatible with this MatrixBase type. * + * \not_reentrant + * * This variant is meant to be used for dynamic-size matrix types. For fixed-size types, * it is redundant to pass \a rows and \a cols as arguments, so Random() should be used * instead. + * * * Example: \include MatrixBase_random_int_int.cpp * Output: \verbinclude MatrixBase_random_int_int.out @@ -41,22 +46,28 @@ struct functor_traits > * This expression has the "evaluate before nesting" flag so that it will be evaluated into * a temporary matrix whenever it is nested in a larger expression. This prevents unexpected * behavior with expressions involving random matrices. + * + * See DenseBase::NullaryExpr(Index, const CustomNullaryOp&) for an example using C++11 random generators. * - * \sa MatrixBase::setRandom(), MatrixBase::Random(Index), MatrixBase::Random() + * \sa DenseBase::setRandom(), DenseBase::Random(Index), DenseBase::Random() */ template -inline const CwiseNullaryOp::Scalar>, Derived> +inline const typename DenseBase::RandomReturnType DenseBase::Random(Index rows, Index cols) { return NullaryExpr(rows, cols, internal::scalar_random_op()); } /** \returns a random vector expression + * + * Numbers are uniformly spread through their whole definition range for integer types, + * and in the [-1:1] range for floating point scalar types. * * The parameter \a size is the size of the returned vector. * Must be compatible with this MatrixBase type. * * \only_for_vectors + * \not_reentrant * * This variant is meant to be used for dynamic-size vector types. For fixed-size types, * it is redundant to pass \a size as argument, so Random() should be used @@ -69,10 +80,10 @@ DenseBase::Random(Index rows, Index cols) * a temporary vector whenever it is nested in a larger expression. This prevents unexpected * behavior with expressions involving random matrices. * - * \sa MatrixBase::setRandom(), MatrixBase::Random(Index,Index), MatrixBase::Random() + * \sa DenseBase::setRandom(), DenseBase::Random(Index,Index), DenseBase::Random() */ template -inline const CwiseNullaryOp::Scalar>, Derived> +inline const typename DenseBase::RandomReturnType DenseBase::Random(Index size) { return NullaryExpr(size, internal::scalar_random_op()); @@ -80,6 +91,9 @@ DenseBase::Random(Index size) /** \returns a fixed-size random matrix or vector expression * + * Numbers are uniformly spread through their whole definition range for integer types, + * and in the [-1:1] range for floating point scalar types. + * * This variant is only for fixed-size MatrixBase types. For dynamic-size types, you * need to use the variants taking size arguments. * @@ -89,11 +103,13 @@ DenseBase::Random(Index size) * This expression has the "evaluate before nesting" flag so that it will be evaluated into * a temporary matrix whenever it is nested in a larger expression. This prevents unexpected * behavior with expressions involving random matrices. + * + * \not_reentrant * - * \sa MatrixBase::setRandom(), MatrixBase::Random(Index,Index), MatrixBase::Random(Index) + * \sa DenseBase::setRandom(), DenseBase::Random(Index,Index), DenseBase::Random(Index) */ template -inline const CwiseNullaryOp::Scalar>, Derived> +inline const typename DenseBase::RandomReturnType DenseBase::Random() { return NullaryExpr(RowsAtCompileTime, ColsAtCompileTime, internal::scalar_random_op()); @@ -101,25 +117,34 @@ DenseBase::Random() /** Sets all coefficients in this expression to random values. * + * Numbers are uniformly spread through their whole definition range for integer types, + * and in the [-1:1] range for floating point scalar types. + * + * \not_reentrant + * * Example: \include MatrixBase_setRandom.cpp * Output: \verbinclude MatrixBase_setRandom.out * * \sa class CwiseNullaryOp, setRandom(Index), setRandom(Index,Index) */ template -inline Derived& DenseBase::setRandom() +EIGEN_DEVICE_FUNC inline Derived& DenseBase::setRandom() { return *this = Random(rows(), cols()); } /** Resizes to the given \a newSize, and sets all coefficients in this expression to random values. * + * Numbers are uniformly spread through their whole definition range for integer types, + * and in the [-1:1] range for floating point scalar types. + * * \only_for_vectors + * \not_reentrant * * Example: \include Matrix_setRandom_int.cpp * Output: \verbinclude Matrix_setRandom_int.out * - * \sa MatrixBase::setRandom(), setRandom(Index,Index), class CwiseNullaryOp, MatrixBase::Random() + * \sa DenseBase::setRandom(), setRandom(Index,Index), class CwiseNullaryOp, DenseBase::Random() */ template EIGEN_STRONG_INLINE Derived& @@ -131,22 +156,63 @@ PlainObjectBase::setRandom(Index newSize) /** Resizes to the given size, and sets all coefficients in this expression to random values. * - * \param nbRows the new number of rows - * \param nbCols the new number of columns + * Numbers are uniformly spread through their whole definition range for integer types, + * and in the [-1:1] range for floating point scalar types. + * + * \not_reentrant + * + * \param rows the new number of rows + * \param cols the new number of columns * * Example: \include Matrix_setRandom_int_int.cpp * Output: \verbinclude Matrix_setRandom_int_int.out * - * \sa MatrixBase::setRandom(), setRandom(Index), class CwiseNullaryOp, MatrixBase::Random() + * \sa DenseBase::setRandom(), setRandom(Index), class CwiseNullaryOp, DenseBase::Random() */ template EIGEN_STRONG_INLINE Derived& -PlainObjectBase::setRandom(Index nbRows, Index nbCols) +PlainObjectBase::setRandom(Index rows, Index cols) { - resize(nbRows, nbCols); + resize(rows, cols); return setRandom(); } +/** Resizes to the given size, changing only the number of columns, and sets all + * coefficients in this expression to random values. For the parameter of type + * NoChange_t, just pass the special value \c NoChange. + * + * Numbers are uniformly spread through their whole definition range for integer types, + * and in the [-1:1] range for floating point scalar types. + * + * \not_reentrant + * + * \sa DenseBase::setRandom(), setRandom(Index), setRandom(Index, NoChange_t), class CwiseNullaryOp, DenseBase::Random() + */ +template +EIGEN_STRONG_INLINE Derived& +PlainObjectBase::setRandom(NoChange_t, Index cols) +{ + return setRandom(rows(), cols); +} + +/** Resizes to the given size, changing only the number of rows, and sets all + * coefficients in this expression to random values. For the parameter of type + * NoChange_t, just pass the special value \c NoChange. + * + * Numbers are uniformly spread through their whole definition range for integer types, + * and in the [-1:1] range for floating point scalar types. + * + * \not_reentrant + * + * \sa DenseBase::setRandom(), setRandom(Index), setRandom(NoChange_t, Index), class CwiseNullaryOp, DenseBase::Random() + */ +template +EIGEN_STRONG_INLINE Derived& +PlainObjectBase::setRandom(Index rows, NoChange_t) +{ + return setRandom(rows, cols()); +} + } // end namespace Eigen #endif // EIGEN_RANDOM_H diff --git a/extern/eigen/Eigen/src/Core/Redux.h b/extern/eigen/Eigen/src/Core/Redux.h index 9b8662a6..b6790d11 100644 --- a/extern/eigen/Eigen/src/Core/Redux.h +++ b/extern/eigen/Eigen/src/Core/Redux.h @@ -23,22 +23,29 @@ namespace internal { * Part 1 : the logic deciding a strategy for vectorization and unrolling ***************************************************************************/ -template +template struct redux_traits { public: + typedef typename find_best_packet::type PacketType; enum { - PacketSize = packet_traits::size, - InnerMaxSize = int(Derived::IsRowMajor) - ? Derived::MaxColsAtCompileTime - : Derived::MaxRowsAtCompileTime + PacketSize = unpacket_traits::size, + InnerMaxSize = int(Evaluator::IsRowMajor) + ? Evaluator::MaxColsAtCompileTime + : Evaluator::MaxRowsAtCompileTime, + OuterMaxSize = int(Evaluator::IsRowMajor) + ? Evaluator::MaxRowsAtCompileTime + : Evaluator::MaxColsAtCompileTime, + SliceVectorizedWork = int(InnerMaxSize)==Dynamic ? Dynamic + : int(OuterMaxSize)==Dynamic ? (int(InnerMaxSize)>=int(PacketSize) ? Dynamic : 0) + : (int(InnerMaxSize)/int(PacketSize)) * int(OuterMaxSize) }; enum { - MightVectorize = (int(Derived::Flags)&ActualPacketAccessBit) + MightVectorize = (int(Evaluator::Flags)&ActualPacketAccessBit) && (functor_traits::PacketAccess), - MayLinearVectorize = MightVectorize && (int(Derived::Flags)&LinearAccessBit), - MaySliceVectorize = MightVectorize && int(InnerMaxSize)>=3*PacketSize + MayLinearVectorize = bool(MightVectorize) && (int(Evaluator::Flags)&LinearAccessBit), + MaySliceVectorize = bool(MightVectorize) && (int(SliceVectorizedWork)==Dynamic || int(SliceVectorizedWork)>=3) }; public: @@ -50,21 +57,36 @@ struct redux_traits public: enum { - Cost = ( Derived::SizeAtCompileTime == Dynamic - || Derived::CoeffReadCost == Dynamic - || (Derived::SizeAtCompileTime!=1 && functor_traits::Cost == Dynamic) - ) ? Dynamic - : Derived::SizeAtCompileTime * Derived::CoeffReadCost - + (Derived::SizeAtCompileTime-1) * functor_traits::Cost, + Cost = Evaluator::SizeAtCompileTime == Dynamic ? HugeCost + : int(Evaluator::SizeAtCompileTime) * int(Evaluator::CoeffReadCost) + (Evaluator::SizeAtCompileTime-1) * functor_traits::Cost, UnrollingLimit = EIGEN_UNROLLING_LIMIT * (int(Traversal) == int(DefaultTraversal) ? 1 : int(PacketSize)) }; public: enum { - Unrolling = Cost != Dynamic && Cost <= UnrollingLimit - ? CompleteUnrolling - : NoUnrolling + Unrolling = Cost <= UnrollingLimit ? CompleteUnrolling : NoUnrolling }; + +#ifdef EIGEN_DEBUG_ASSIGN + static void debug() + { + std::cerr << "Xpr: " << typeid(typename Evaluator::XprType).name() << std::endl; + std::cerr.setf(std::ios::hex, std::ios::basefield); + EIGEN_DEBUG_VAR(Evaluator::Flags) + std::cerr.unsetf(std::ios::hex); + EIGEN_DEBUG_VAR(InnerMaxSize) + EIGEN_DEBUG_VAR(OuterMaxSize) + EIGEN_DEBUG_VAR(SliceVectorizedWork) + EIGEN_DEBUG_VAR(PacketSize) + EIGEN_DEBUG_VAR(MightVectorize) + EIGEN_DEBUG_VAR(MayLinearVectorize) + EIGEN_DEBUG_VAR(MaySliceVectorize) + std::cerr << "Traversal" << " = " << Traversal << " (" << demangle_traversal(Traversal) << ")" << std::endl; + EIGEN_DEBUG_VAR(UnrollingLimit) + std::cerr << "Unrolling" << " = " << Unrolling << " (" << demangle_unrolling(Unrolling) << ")" << std::endl; + std::cerr << std::endl; + } +#endif }; /*************************************************************************** @@ -73,85 +95,86 @@ struct redux_traits /*** no vectorization ***/ -template +template struct redux_novec_unroller { enum { HalfLength = Length/2 }; - typedef typename Derived::Scalar Scalar; + typedef typename Evaluator::Scalar Scalar; - static EIGEN_STRONG_INLINE Scalar run(const Derived &mat, const Func& func) + EIGEN_DEVICE_FUNC + static EIGEN_STRONG_INLINE Scalar run(const Evaluator &eval, const Func& func) { - return func(redux_novec_unroller::run(mat,func), - redux_novec_unroller::run(mat,func)); + return func(redux_novec_unroller::run(eval,func), + redux_novec_unroller::run(eval,func)); } }; -template -struct redux_novec_unroller +template +struct redux_novec_unroller { enum { - outer = Start / Derived::InnerSizeAtCompileTime, - inner = Start % Derived::InnerSizeAtCompileTime + outer = Start / Evaluator::InnerSizeAtCompileTime, + inner = Start % Evaluator::InnerSizeAtCompileTime }; - typedef typename Derived::Scalar Scalar; + typedef typename Evaluator::Scalar Scalar; - static EIGEN_STRONG_INLINE Scalar run(const Derived &mat, const Func&) + EIGEN_DEVICE_FUNC + static EIGEN_STRONG_INLINE Scalar run(const Evaluator &eval, const Func&) { - return mat.coeffByOuterInner(outer, inner); + return eval.coeffByOuterInner(outer, inner); } }; // This is actually dead code and will never be called. It is required // to prevent false warnings regarding failed inlining though // for 0 length run() will never be called at all. -template -struct redux_novec_unroller +template +struct redux_novec_unroller { - typedef typename Derived::Scalar Scalar; - static EIGEN_STRONG_INLINE Scalar run(const Derived&, const Func&) { return Scalar(); } + typedef typename Evaluator::Scalar Scalar; + EIGEN_DEVICE_FUNC + static EIGEN_STRONG_INLINE Scalar run(const Evaluator&, const Func&) { return Scalar(); } }; /*** vectorization ***/ -template +template struct redux_vec_unroller { - enum { - PacketSize = packet_traits::size, - HalfLength = Length/2 - }; - - typedef typename Derived::Scalar Scalar; - typedef typename packet_traits::type PacketScalar; - - static EIGEN_STRONG_INLINE PacketScalar run(const Derived &mat, const Func& func) + template + EIGEN_DEVICE_FUNC + static EIGEN_STRONG_INLINE PacketType run(const Evaluator &eval, const Func& func) { + enum { + PacketSize = unpacket_traits::size, + HalfLength = Length/2 + }; + return func.packetOp( - redux_vec_unroller::run(mat,func), - redux_vec_unroller::run(mat,func) ); + redux_vec_unroller::template run(eval,func), + redux_vec_unroller::template run(eval,func) ); } }; -template -struct redux_vec_unroller +template +struct redux_vec_unroller { - enum { - index = Start * packet_traits::size, - outer = index / int(Derived::InnerSizeAtCompileTime), - inner = index % int(Derived::InnerSizeAtCompileTime), - alignment = (Derived::Flags & AlignedBit) ? Aligned : Unaligned - }; - - typedef typename Derived::Scalar Scalar; - typedef typename packet_traits::type PacketScalar; - - static EIGEN_STRONG_INLINE PacketScalar run(const Derived &mat, const Func&) + template + EIGEN_DEVICE_FUNC + static EIGEN_STRONG_INLINE PacketType run(const Evaluator &eval, const Func&) { - return mat.template packetByOuterInner(outer, inner); + enum { + PacketSize = unpacket_traits::size, + index = Start * PacketSize, + outer = index / int(Evaluator::InnerSizeAtCompileTime), + inner = index % int(Evaluator::InnerSizeAtCompileTime), + alignment = Evaluator::Alignment + }; + return eval.template packetByOuterInner(outer, inner); } }; @@ -159,53 +182,65 @@ struct redux_vec_unroller * Part 3 : implementation of all cases ***************************************************************************/ -template::Traversal, - int Unrolling = redux_traits::Unrolling +template::Traversal, + int Unrolling = redux_traits::Unrolling > struct redux_impl; -template -struct redux_impl +template +struct redux_impl { - typedef typename Derived::Scalar Scalar; - typedef typename Derived::Index Index; - static EIGEN_STRONG_INLINE Scalar run(const Derived& mat, const Func& func) + typedef typename Evaluator::Scalar Scalar; + + template + EIGEN_DEVICE_FUNC static EIGEN_STRONG_INLINE + Scalar run(const Evaluator &eval, const Func& func, const XprType& xpr) { - eigen_assert(mat.rows()>0 && mat.cols()>0 && "you are using an empty matrix"); + eigen_assert(xpr.rows()>0 && xpr.cols()>0 && "you are using an empty matrix"); Scalar res; - res = mat.coeffByOuterInner(0, 0); - for(Index i = 1; i < mat.innerSize(); ++i) - res = func(res, mat.coeffByOuterInner(0, i)); - for(Index i = 1; i < mat.outerSize(); ++i) - for(Index j = 0; j < mat.innerSize(); ++j) - res = func(res, mat.coeffByOuterInner(i, j)); + res = eval.coeffByOuterInner(0, 0); + for(Index i = 1; i < xpr.innerSize(); ++i) + res = func(res, eval.coeffByOuterInner(0, i)); + for(Index i = 1; i < xpr.outerSize(); ++i) + for(Index j = 0; j < xpr.innerSize(); ++j) + res = func(res, eval.coeffByOuterInner(i, j)); return res; } }; -template -struct redux_impl - : public redux_novec_unroller -{}; +template +struct redux_impl + : redux_novec_unroller +{ + typedef redux_novec_unroller Base; + typedef typename Evaluator::Scalar Scalar; + template + EIGEN_DEVICE_FUNC static EIGEN_STRONG_INLINE + Scalar run(const Evaluator &eval, const Func& func, const XprType& /*xpr*/) + { + return Base::run(eval,func); + } +}; -template -struct redux_impl +template +struct redux_impl { - typedef typename Derived::Scalar Scalar; - typedef typename packet_traits::type PacketScalar; - typedef typename Derived::Index Index; + typedef typename Evaluator::Scalar Scalar; + typedef typename redux_traits::PacketType PacketScalar; - static Scalar run(const Derived& mat, const Func& func) + template + static Scalar run(const Evaluator &eval, const Func& func, const XprType& xpr) { - const Index size = mat.size(); - eigen_assert(size && "you are using an empty matrix"); - const Index packetSize = packet_traits::size; - const Index alignedStart = internal::first_aligned(mat); + const Index size = xpr.size(); + + const Index packetSize = redux_traits::PacketSize; + const int packetAlignment = unpacket_traits::alignment; enum { - alignment = bool(Derived::Flags & DirectAccessBit) || bool(Derived::Flags & AlignedBit) - ? Aligned : Unaligned + alignment0 = (bool(Evaluator::Flags & DirectAccessBit) && bool(packet_traits::AlignedOnScalar)) ? int(packetAlignment) : int(Unaligned), + alignment = EIGEN_PLAIN_ENUM_MAX(alignment0, Evaluator::Alignment) }; + const Index alignedStart = internal::first_default_aligned(xpr); const Index alignedSize2 = ((size-alignedStart)/(2*packetSize))*(2*packetSize); const Index alignedSize = ((size-alignedStart)/(packetSize))*(packetSize); const Index alignedEnd2 = alignedStart + alignedSize2; @@ -213,34 +248,34 @@ struct redux_impl Scalar res; if(alignedSize) { - PacketScalar packet_res0 = mat.template packet(alignedStart); + PacketScalar packet_res0 = eval.template packet(alignedStart); if(alignedSize>packetSize) // we have at least two packets to partly unroll the loop { - PacketScalar packet_res1 = mat.template packet(alignedStart+packetSize); + PacketScalar packet_res1 = eval.template packet(alignedStart+packetSize); for(Index index = alignedStart + 2*packetSize; index < alignedEnd2; index += 2*packetSize) { - packet_res0 = func.packetOp(packet_res0, mat.template packet(index)); - packet_res1 = func.packetOp(packet_res1, mat.template packet(index+packetSize)); + packet_res0 = func.packetOp(packet_res0, eval.template packet(index)); + packet_res1 = func.packetOp(packet_res1, eval.template packet(index+packetSize)); } packet_res0 = func.packetOp(packet_res0,packet_res1); if(alignedEnd>alignedEnd2) - packet_res0 = func.packetOp(packet_res0, mat.template packet(alignedEnd2)); + packet_res0 = func.packetOp(packet_res0, eval.template packet(alignedEnd2)); } res = func.predux(packet_res0); for(Index index = 0; index < alignedStart; ++index) - res = func(res,mat.coeff(index)); + res = func(res,eval.coeff(index)); for(Index index = alignedEnd; index < size; ++index) - res = func(res,mat.coeff(index)); + res = func(res,eval.coeff(index)); } else // too small to vectorize anything. // since this is dynamic-size hence inefficient anyway for such small sizes, don't try to optimize. { - res = mat.coeff(0); + res = eval.coeff(0); for(Index index = 1; index < size; ++index) - res = func(res,mat.coeff(index)); + res = func(res,eval.coeff(index)); } return res; @@ -248,65 +283,110 @@ struct redux_impl }; // NOTE: for SliceVectorizedTraversal we simply bypass unrolling -template -struct redux_impl +template +struct redux_impl { - typedef typename Derived::Scalar Scalar; - typedef typename packet_traits::type PacketScalar; - typedef typename Derived::Index Index; + typedef typename Evaluator::Scalar Scalar; + typedef typename redux_traits::PacketType PacketType; - static Scalar run(const Derived& mat, const Func& func) + template + EIGEN_DEVICE_FUNC static Scalar run(const Evaluator &eval, const Func& func, const XprType& xpr) { - eigen_assert(mat.rows()>0 && mat.cols()>0 && "you are using an empty matrix"); - const Index innerSize = mat.innerSize(); - const Index outerSize = mat.outerSize(); + eigen_assert(xpr.rows()>0 && xpr.cols()>0 && "you are using an empty matrix"); + const Index innerSize = xpr.innerSize(); + const Index outerSize = xpr.outerSize(); enum { - packetSize = packet_traits::size + packetSize = redux_traits::PacketSize }; const Index packetedInnerSize = ((innerSize)/packetSize)*packetSize; Scalar res; if(packetedInnerSize) { - PacketScalar packet_res = mat.template packet(0,0); + PacketType packet_res = eval.template packet(0,0); for(Index j=0; j(j,i)); + packet_res = func.packetOp(packet_res, eval.template packetByOuterInner(j,i)); res = func.predux(packet_res); for(Index j=0; j::run(mat, func); + res = redux_impl::run(eval, func, xpr); } return res; } }; -template -struct redux_impl +template +struct redux_impl { - typedef typename Derived::Scalar Scalar; - typedef typename packet_traits::type PacketScalar; + typedef typename Evaluator::Scalar Scalar; + + typedef typename redux_traits::PacketType PacketType; enum { - PacketSize = packet_traits::size, - Size = Derived::SizeAtCompileTime, - VectorizedSize = (Size / PacketSize) * PacketSize + PacketSize = redux_traits::PacketSize, + Size = Evaluator::SizeAtCompileTime, + VectorizedSize = (int(Size) / int(PacketSize)) * int(PacketSize) }; - static EIGEN_STRONG_INLINE Scalar run(const Derived& mat, const Func& func) + + template + EIGEN_DEVICE_FUNC static EIGEN_STRONG_INLINE + Scalar run(const Evaluator &eval, const Func& func, const XprType &xpr) { - eigen_assert(mat.rows()>0 && mat.cols()>0 && "you are using an empty matrix"); - Scalar res = func.predux(redux_vec_unroller::run(mat,func)); - if (VectorizedSize != Size) - res = func(res,redux_novec_unroller::run(mat,func)); - return res; + EIGEN_ONLY_USED_FOR_DEBUG(xpr) + eigen_assert(xpr.rows()>0 && xpr.cols()>0 && "you are using an empty matrix"); + if (VectorizedSize > 0) { + Scalar res = func.predux(redux_vec_unroller::template run(eval,func)); + if (VectorizedSize != Size) + res = func(res,redux_novec_unroller::run(eval,func)); + return res; + } + else { + return redux_novec_unroller::run(eval,func); + } } }; +// evaluator adaptor +template +class redux_evaluator : public internal::evaluator<_XprType> +{ + typedef internal::evaluator<_XprType> Base; +public: + typedef _XprType XprType; + EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE + explicit redux_evaluator(const XprType &xpr) : Base(xpr) {} + + typedef typename XprType::Scalar Scalar; + typedef typename XprType::CoeffReturnType CoeffReturnType; + typedef typename XprType::PacketScalar PacketScalar; + + enum { + MaxRowsAtCompileTime = XprType::MaxRowsAtCompileTime, + MaxColsAtCompileTime = XprType::MaxColsAtCompileTime, + // TODO we should not remove DirectAccessBit and rather find an elegant way to query the alignment offset at runtime from the evaluator + Flags = Base::Flags & ~DirectAccessBit, + IsRowMajor = XprType::IsRowMajor, + SizeAtCompileTime = XprType::SizeAtCompileTime, + InnerSizeAtCompileTime = XprType::InnerSizeAtCompileTime + }; + + EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE + CoeffReturnType coeffByOuterInner(Index outer, Index inner) const + { return Base::coeff(IsRowMajor ? outer : inner, IsRowMajor ? inner : outer); } + + template + EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE + PacketType packetByOuterInner(Index outer, Index inner) const + { return Base::template packet(IsRowMajor ? outer : inner, IsRowMajor ? inner : outer); } + +}; + } // end namespace internal /*************************************************************************** @@ -317,51 +397,70 @@ struct redux_impl /** \returns the result of a full redux operation on the whole matrix or vector using \a func * * The template parameter \a BinaryOp is the type of the functor \a func which must be - * an associative operator. Both current STL and TR1 functor styles are handled. + * an associative operator. Both current C++98 and C++11 functor styles are handled. + * + * \warning the matrix must be not empty, otherwise an assertion is triggered. * * \sa DenseBase::sum(), DenseBase::minCoeff(), DenseBase::maxCoeff(), MatrixBase::colwise(), MatrixBase::rowwise() */ template template -EIGEN_STRONG_INLINE typename internal::result_of::Scalar)>::type +EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE typename internal::traits::Scalar DenseBase::redux(const Func& func) const { - typedef typename internal::remove_all::type ThisNested; - return internal::redux_impl - ::run(derived(), func); + eigen_assert(this->rows()>0 && this->cols()>0 && "you are using an empty matrix"); + + typedef typename internal::redux_evaluator ThisEvaluator; + ThisEvaluator thisEval(derived()); + + // The initial expression is passed to the reducer as an additional argument instead of + // passing it as a member of redux_evaluator to help + return internal::redux_impl::run(thisEval, func, derived()); } /** \returns the minimum of all coefficients of \c *this. - * \warning the result is undefined if \c *this contains NaN. + * In case \c *this contains NaN, NaNPropagation determines the behavior: + * NaNPropagation == PropagateFast : undefined + * NaNPropagation == PropagateNaN : result is NaN + * NaNPropagation == PropagateNumbers : result is minimum of elements that are not NaN + * \warning the matrix must be not empty, otherwise an assertion is triggered. */ template -EIGEN_STRONG_INLINE typename internal::traits::Scalar +template +EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE typename internal::traits::Scalar DenseBase::minCoeff() const { - return this->redux(Eigen::internal::scalar_min_op()); + return derived().redux(Eigen::internal::scalar_min_op()); } -/** \returns the maximum of all coefficients of \c *this. - * \warning the result is undefined if \c *this contains NaN. +/** \returns the maximum of all coefficients of \c *this. + * In case \c *this contains NaN, NaNPropagation determines the behavior: + * NaNPropagation == PropagateFast : undefined + * NaNPropagation == PropagateNaN : result is NaN + * NaNPropagation == PropagateNumbers : result is maximum of elements that are not NaN + * \warning the matrix must be not empty, otherwise an assertion is triggered. */ template -EIGEN_STRONG_INLINE typename internal::traits::Scalar +template +EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE typename internal::traits::Scalar DenseBase::maxCoeff() const { - return this->redux(Eigen::internal::scalar_max_op()); + return derived().redux(Eigen::internal::scalar_max_op()); } -/** \returns the sum of all coefficients of *this +/** \returns the sum of all coefficients of \c *this + * + * If \c *this is empty, then the value 0 is returned. * * \sa trace(), prod(), mean() */ template -EIGEN_STRONG_INLINE typename internal::traits::Scalar +EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE typename internal::traits::Scalar DenseBase::sum() const { if(SizeAtCompileTime==0 || (SizeAtCompileTime==Dynamic && size()==0)) return Scalar(0); - return this->redux(Eigen::internal::scalar_sum_op()); + return derived().redux(Eigen::internal::scalar_sum_op()); } /** \returns the mean of all coefficients of *this @@ -369,10 +468,17 @@ DenseBase::sum() const * \sa trace(), prod(), sum() */ template -EIGEN_STRONG_INLINE typename internal::traits::Scalar +EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE typename internal::traits::Scalar DenseBase::mean() const { - return Scalar(this->redux(Eigen::internal::scalar_sum_op())) / Scalar(this->size()); +#ifdef __INTEL_COMPILER + #pragma warning push + #pragma warning ( disable : 2259 ) +#endif + return Scalar(derived().redux(Eigen::internal::scalar_sum_op())) / Scalar(this->size()); +#ifdef __INTEL_COMPILER + #pragma warning pop +#endif } /** \returns the product of all coefficients of *this @@ -383,12 +489,12 @@ DenseBase::mean() const * \sa sum(), mean(), trace() */ template -EIGEN_STRONG_INLINE typename internal::traits::Scalar +EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE typename internal::traits::Scalar DenseBase::prod() const { if(SizeAtCompileTime==0 || (SizeAtCompileTime==Dynamic && size()==0)) return Scalar(1); - return this->redux(Eigen::internal::scalar_product_op()); + return derived().redux(Eigen::internal::scalar_product_op()); } /** \returns the trace of \c *this, i.e. the sum of the coefficients on the main diagonal. @@ -398,7 +504,7 @@ DenseBase::prod() const * \sa diagonal(), sum() */ template -EIGEN_STRONG_INLINE typename internal::traits::Scalar +EIGEN_DEVICE_FUNC EIGEN_STRONG_INLINE typename internal::traits::Scalar MatrixBase::trace() const { return derived().diagonal().sum(); diff --git a/extern/eigen/Eigen/src/Core/Ref.h b/extern/eigen/Eigen/src/Core/Ref.h index 7a3becaf..c2a37ead 100644 --- a/extern/eigen/Eigen/src/Core/Ref.h +++ b/extern/eigen/Eigen/src/Core/Ref.h @@ -10,80 +10,7 @@ #ifndef EIGEN_REF_H #define EIGEN_REF_H -namespace Eigen { - -template class RefBase; -template,OuterStride<> >::type > class Ref; - -/** \class Ref - * \ingroup Core_Module - * - * \brief A matrix or vector expression mapping an existing expressions - * - * \tparam PlainObjectType the equivalent matrix type of the mapped data - * \tparam Options specifies whether the pointer is \c #Aligned, or \c #Unaligned. - * The default is \c #Unaligned. - * \tparam StrideType optionally specifies strides. By default, Ref implies a contiguous storage along the inner dimension (inner stride==1), - * but accept a variable outer stride (leading dimension). - * This can be overridden by specifying strides. - * The type passed here must be a specialization of the Stride template, see examples below. - * - * This class permits to write non template functions taking Eigen's object as parameters while limiting the number of copies. - * A Ref<> object can represent either a const expression or a l-value: - * \code - * // in-out argument: - * void foo1(Ref x); - * - * // read-only const argument: - * void foo2(const Ref& x); - * \endcode - * - * In the in-out case, the input argument must satisfies the constraints of the actual Ref<> type, otherwise a compilation issue will be triggered. - * By default, a Ref can reference any dense vector expression of float having a contiguous memory layout. - * Likewise, a Ref can reference any column major dense matrix expression of float whose column's elements are contiguously stored with - * the possibility to have a constant space inbetween each column, i.e.: the inner stride mmust be equal to 1, but the outer-stride (or leading dimension), - * can be greater than the number of rows. - * - * In the const case, if the input expression does not match the above requirement, then it is evaluated into a temporary before being passed to the function. - * Here are some examples: - * \code - * MatrixXf A; - * VectorXf a; - * foo1(a.head()); // OK - * foo1(A.col()); // OK - * foo1(A.row()); // compilation error because here innerstride!=1 - * foo2(A.row()); // The row is copied into a contiguous temporary - * foo2(2*a); // The expression is evaluated into a temporary - * foo2(A.col().segment(2,4)); // No temporary - * \endcode - * - * The range of inputs that can be referenced without temporary can be enlarged using the last two template parameter. - * Here is an example accepting an innerstride!=1: - * \code - * // in-out argument: - * void foo3(Ref > x); - * foo3(A.row()); // OK - * \endcode - * The downside here is that the function foo3 might be significantly slower than foo1 because it won't be able to exploit vectorization, and will involved more - * expensive address computations even if the input is contiguously stored in memory. To overcome this issue, one might propose to overloads internally calling a - * template function, e.g.: - * \code - * // in the .h: - * void foo(const Ref& A); - * void foo(const Ref >& A); - * - * // in the .cpp: - * template void foo_impl(const TypeOfA& A) { - * ... // crazy code goes here - * } - * void foo(const Ref& A) { foo_impl(A); } - * void foo(const Ref >& A) { foo_impl(A); } - * \endcode - * - * - * \sa PlainObjectBase::Map(), \ref TopicStorageOrders - */ +namespace Eigen { namespace internal { @@ -95,25 +22,33 @@ struct traits > typedef _StrideType StrideType; enum { Options = _Options, - Flags = traits >::Flags | NestByRefBit + Flags = traits >::Flags | NestByRefBit, + Alignment = traits >::Alignment }; template struct match { enum { + IsVectorAtCompileTime = PlainObjectType::IsVectorAtCompileTime || Derived::IsVectorAtCompileTime, HasDirectAccess = internal::has_direct_access::ret, - StorageOrderMatch = PlainObjectType::IsVectorAtCompileTime || Derived::IsVectorAtCompileTime || ((PlainObjectType::Flags&RowMajorBit)==(Derived::Flags&RowMajorBit)), + StorageOrderMatch = IsVectorAtCompileTime || ((PlainObjectType::Flags&RowMajorBit)==(Derived::Flags&RowMajorBit)), InnerStrideMatch = int(StrideType::InnerStrideAtCompileTime)==int(Dynamic) || int(StrideType::InnerStrideAtCompileTime)==int(Derived::InnerStrideAtCompileTime) || (int(StrideType::InnerStrideAtCompileTime)==0 && int(Derived::InnerStrideAtCompileTime)==1), - OuterStrideMatch = Derived::IsVectorAtCompileTime + OuterStrideMatch = IsVectorAtCompileTime || int(StrideType::OuterStrideAtCompileTime)==int(Dynamic) || int(StrideType::OuterStrideAtCompileTime)==int(Derived::OuterStrideAtCompileTime), - AlignmentMatch = (_Options!=Aligned) || ((PlainObjectType::Flags&AlignedBit)==0) || ((traits::Flags&AlignedBit)==AlignedBit), + // NOTE, this indirection of evaluator::Alignment is needed + // to workaround a very strange bug in MSVC related to the instantiation + // of has_*ary_operator in evaluator. + // This line is surprisingly very sensitive. For instance, simply adding parenthesis + // as "DerivedAlignment = (int(evaluator::Alignment))," will make MSVC fail... + DerivedAlignment = int(evaluator::Alignment), + AlignmentMatch = (int(traits::Alignment)==int(Unaligned)) || (DerivedAlignment >= int(Alignment)), // FIXME the first condition is not very clear, it should be replaced by the required alignment ScalarTypeMatch = internal::is_same::value, MatchAtCompileTime = HasDirectAccess && StorageOrderMatch && InnerStrideMatch && OuterStrideMatch && AlignmentMatch && ScalarTypeMatch }; typedef typename internal::conditional::type type; }; - + }; template @@ -132,12 +67,12 @@ template class RefBase typedef MapBase Base; EIGEN_DENSE_PUBLIC_INTERFACE(RefBase) - inline Index innerStride() const + EIGEN_DEVICE_FUNC EIGEN_CONSTEXPR inline Index innerStride() const { return StrideType::InnerStrideAtCompileTime != 0 ? m_stride.inner() : 1; } - inline Index outerStride() const + EIGEN_DEVICE_FUNC EIGEN_CONSTEXPR inline Index outerStride() const { return StrideType::OuterStrideAtCompileTime != 0 ? m_stride.outer() : IsVectorAtCompileTime ? this->size() @@ -145,54 +80,212 @@ template class RefBase : this->rows(); } - RefBase() + EIGEN_DEVICE_FUNC RefBase() : Base(0,RowsAtCompileTime==Dynamic?0:RowsAtCompileTime,ColsAtCompileTime==Dynamic?0:ColsAtCompileTime), // Stride<> does not allow default ctor for Dynamic strides, so let' initialize it with dummy values: m_stride(StrideType::OuterStrideAtCompileTime==Dynamic?0:StrideType::OuterStrideAtCompileTime, StrideType::InnerStrideAtCompileTime==Dynamic?0:StrideType::InnerStrideAtCompileTime) {} - + EIGEN_INHERIT_ASSIGNMENT_OPERATORS(RefBase) protected: typedef Stride StrideBase; + // Resolves inner stride if default 0. + static EIGEN_DEVICE_FUNC EIGEN_CONSTEXPR Index resolveInnerStride(Index inner) { + return inner == 0 ? 1 : inner; + } + + // Resolves outer stride if default 0. + static EIGEN_DEVICE_FUNC EIGEN_CONSTEXPR Index resolveOuterStride(Index inner, Index outer, Index rows, Index cols, bool isVectorAtCompileTime, bool isRowMajor) { + return outer == 0 ? isVectorAtCompileTime ? inner * rows * cols : isRowMajor ? inner * cols : inner * rows : outer; + } + + // Returns true if construction is valid, false if there is a stride mismatch, + // and fails if there is a size mismatch. template - void construct(Expression& expr) + EIGEN_DEVICE_FUNC bool construct(Expression& expr) { + // Check matrix sizes. If this is a compile-time vector, we do allow + // implicitly transposing. + EIGEN_STATIC_ASSERT( + EIGEN_PREDICATE_SAME_MATRIX_SIZE(PlainObjectType, Expression) + // If it is a vector, the transpose sizes might match. + || ( PlainObjectType::IsVectorAtCompileTime + && ((int(PlainObjectType::RowsAtCompileTime)==Eigen::Dynamic + || int(Expression::ColsAtCompileTime)==Eigen::Dynamic + || int(PlainObjectType::RowsAtCompileTime)==int(Expression::ColsAtCompileTime)) + && (int(PlainObjectType::ColsAtCompileTime)==Eigen::Dynamic + || int(Expression::RowsAtCompileTime)==Eigen::Dynamic + || int(PlainObjectType::ColsAtCompileTime)==int(Expression::RowsAtCompileTime)))), + YOU_MIXED_MATRICES_OF_DIFFERENT_SIZES + ) + + // Determine runtime rows and columns. + Index rows = expr.rows(); + Index cols = expr.cols(); if(PlainObjectType::RowsAtCompileTime==1) { eigen_assert(expr.rows()==1 || expr.cols()==1); - ::new (static_cast(this)) Base(expr.data(), 1, expr.size()); + rows = 1; + cols = expr.size(); } else if(PlainObjectType::ColsAtCompileTime==1) { eigen_assert(expr.rows()==1 || expr.cols()==1); - ::new (static_cast(this)) Base(expr.data(), expr.size(), 1); + rows = expr.size(); + cols = 1; + } + // Verify that the sizes are valid. + eigen_assert( + (PlainObjectType::RowsAtCompileTime == Dynamic) || (PlainObjectType::RowsAtCompileTime == rows)); + eigen_assert( + (PlainObjectType::ColsAtCompileTime == Dynamic) || (PlainObjectType::ColsAtCompileTime == cols)); + + + // If this is a vector, we might be transposing, which means that stride should swap. + const bool transpose = PlainObjectType::IsVectorAtCompileTime && (rows != expr.rows()); + // If the storage format differs, we also need to swap the stride. + const bool row_major = ((PlainObjectType::Flags)&RowMajorBit) != 0; + const bool expr_row_major = (Expression::Flags&RowMajorBit) != 0; + const bool storage_differs = (row_major != expr_row_major); + + const bool swap_stride = (transpose != storage_differs); + + // Determine expr's actual strides, resolving any defaults if zero. + const Index expr_inner_actual = resolveInnerStride(expr.innerStride()); + const Index expr_outer_actual = resolveOuterStride(expr_inner_actual, + expr.outerStride(), + expr.rows(), + expr.cols(), + Expression::IsVectorAtCompileTime != 0, + expr_row_major); + + // If this is a column-major row vector or row-major column vector, the inner-stride + // is arbitrary, so set it to either the compile-time inner stride or 1. + const bool row_vector = (rows == 1); + const bool col_vector = (cols == 1); + const Index inner_stride = + ( (!row_major && row_vector) || (row_major && col_vector) ) ? + ( StrideType::InnerStrideAtCompileTime > 0 ? Index(StrideType::InnerStrideAtCompileTime) : 1) + : swap_stride ? expr_outer_actual : expr_inner_actual; + + // If this is a column-major column vector or row-major row vector, the outer-stride + // is arbitrary, so set it to either the compile-time outer stride or vector size. + const Index outer_stride = + ( (!row_major && col_vector) || (row_major && row_vector) ) ? + ( StrideType::OuterStrideAtCompileTime > 0 ? Index(StrideType::OuterStrideAtCompileTime) : rows * cols * inner_stride) + : swap_stride ? expr_inner_actual : expr_outer_actual; + + // Check if given inner/outer strides are compatible with compile-time strides. + const bool inner_valid = (StrideType::InnerStrideAtCompileTime == Dynamic) + || (resolveInnerStride(Index(StrideType::InnerStrideAtCompileTime)) == inner_stride); + if (!inner_valid) { + return false; + } + + const bool outer_valid = (StrideType::OuterStrideAtCompileTime == Dynamic) + || (resolveOuterStride( + inner_stride, + Index(StrideType::OuterStrideAtCompileTime), + rows, cols, PlainObjectType::IsVectorAtCompileTime != 0, + row_major) + == outer_stride); + if (!outer_valid) { + return false; } - else - ::new (static_cast(this)) Base(expr.data(), expr.rows(), expr.cols()); - - if(Expression::IsVectorAtCompileTime && (!PlainObjectType::IsVectorAtCompileTime) && ((Expression::Flags&RowMajorBit)!=(PlainObjectType::Flags&RowMajorBit))) - ::new (&m_stride) StrideBase(expr.innerStride(), StrideType::InnerStrideAtCompileTime==0?0:1); - else - ::new (&m_stride) StrideBase(StrideType::OuterStrideAtCompileTime==0?0:expr.outerStride(), - StrideType::InnerStrideAtCompileTime==0?0:expr.innerStride()); + + ::new (static_cast(this)) Base(expr.data(), rows, cols); + ::new (&m_stride) StrideBase( + (StrideType::OuterStrideAtCompileTime == 0) ? 0 : outer_stride, + (StrideType::InnerStrideAtCompileTime == 0) ? 0 : inner_stride ); + return true; } StrideBase m_stride; }; - +/** \class Ref + * \ingroup Core_Module + * + * \brief A matrix or vector expression mapping an existing expression + * + * \tparam PlainObjectType the equivalent matrix type of the mapped data + * \tparam Options specifies the pointer alignment in bytes. It can be: \c #Aligned128, , \c #Aligned64, \c #Aligned32, \c #Aligned16, \c #Aligned8 or \c #Unaligned. + * The default is \c #Unaligned. + * \tparam StrideType optionally specifies strides. By default, Ref implies a contiguous storage along the inner dimension (inner stride==1), + * but accepts a variable outer stride (leading dimension). + * This can be overridden by specifying strides. + * The type passed here must be a specialization of the Stride template, see examples below. + * + * This class provides a way to write non-template functions taking Eigen objects as parameters while limiting the number of copies. + * A Ref<> object can represent either a const expression or a l-value: + * \code + * // in-out argument: + * void foo1(Ref x); + * + * // read-only const argument: + * void foo2(const Ref& x); + * \endcode + * + * In the in-out case, the input argument must satisfy the constraints of the actual Ref<> type, otherwise a compilation issue will be triggered. + * By default, a Ref can reference any dense vector expression of float having a contiguous memory layout. + * Likewise, a Ref can reference any column-major dense matrix expression of float whose column's elements are contiguously stored with + * the possibility to have a constant space in-between each column, i.e. the inner stride must be equal to 1, but the outer stride (or leading dimension) + * can be greater than the number of rows. + * + * In the const case, if the input expression does not match the above requirement, then it is evaluated into a temporary before being passed to the function. + * Here are some examples: + * \code + * MatrixXf A; + * VectorXf a; + * foo1(a.head()); // OK + * foo1(A.col()); // OK + * foo1(A.row()); // Compilation error because here innerstride!=1 + * foo2(A.row()); // Compilation error because A.row() is a 1xN object while foo2 is expecting a Nx1 object + * foo2(A.row().transpose()); // The row is copied into a contiguous temporary + * foo2(2*a); // The expression is evaluated into a temporary + * foo2(A.col().segment(2,4)); // No temporary + * \endcode + * + * The range of inputs that can be referenced without temporary can be enlarged using the last two template parameters. + * Here is an example accepting an innerstride!=1: + * \code + * // in-out argument: + * void foo3(Ref > x); + * foo3(A.row()); // OK + * \endcode + * The downside here is that the function foo3 might be significantly slower than foo1 because it won't be able to exploit vectorization, and will involve more + * expensive address computations even if the input is contiguously stored in memory. To overcome this issue, one might propose to overload internally calling a + * template function, e.g.: + * \code + * // in the .h: + * void foo(const Ref& A); + * void foo(const Ref >& A); + * + * // in the .cpp: + * template void foo_impl(const TypeOfA& A) { + * ... // crazy code goes here + * } + * void foo(const Ref& A) { foo_impl(A); } + * void foo(const Ref >& A) { foo_impl(A); } + * \endcode + * + * See also the following stackoverflow questions for further references: + * - Correct usage of the Eigen::Ref<> class + * + * \sa PlainObjectBase::Map(), \ref TopicStorageOrders + */ template class Ref : public RefBase > { private: typedef internal::traits Traits; template - inline Ref(const PlainObjectBase& expr, - typename internal::enable_if::MatchAtCompileTime),Derived>::type* = 0); + EIGEN_DEVICE_FUNC inline Ref(const PlainObjectBase& expr, + typename internal::enable_if::MatchAtCompileTime),Derived>::type* = 0); public: typedef RefBase Base; @@ -201,24 +294,31 @@ template class Ref #ifndef EIGEN_PARSED_BY_DOXYGEN template - inline Ref(PlainObjectBase& expr, - typename internal::enable_if::MatchAtCompileTime),Derived>::type* = 0) + EIGEN_DEVICE_FUNC inline Ref(PlainObjectBase& expr, + typename internal::enable_if::MatchAtCompileTime),Derived>::type* = 0) { - EIGEN_STATIC_ASSERT(static_cast(Traits::template match::MatchAtCompileTime), STORAGE_LAYOUT_DOES_NOT_MATCH); - Base::construct(expr.derived()); + EIGEN_STATIC_ASSERT(bool(Traits::template match::MatchAtCompileTime), STORAGE_LAYOUT_DOES_NOT_MATCH); + // Construction must pass since we will not create temprary storage in the non-const case. + const bool success = Base::construct(expr.derived()); + EIGEN_UNUSED_VARIABLE(success) + eigen_assert(success); } template - inline Ref(const DenseBase& expr, - typename internal::enable_if::MatchAtCompileTime),Derived>::type* = 0) + EIGEN_DEVICE_FUNC inline Ref(const DenseBase& expr, + typename internal::enable_if::MatchAtCompileTime),Derived>::type* = 0) #else + /** Implicit constructor from any dense expression */ template inline Ref(DenseBase& expr) #endif { - EIGEN_STATIC_ASSERT(static_cast(internal::is_lvalue::value), THIS_EXPRESSION_IS_NOT_A_LVALUE__IT_IS_READ_ONLY); - EIGEN_STATIC_ASSERT(static_cast(Traits::template match::MatchAtCompileTime), STORAGE_LAYOUT_DOES_NOT_MATCH); - enum { THIS_EXPRESSION_IS_NOT_A_LVALUE__IT_IS_READ_ONLY = Derived::ThisConstantIsPrivateInPlainObjectBase}; - Base::construct(expr.const_cast_derived()); + EIGEN_STATIC_ASSERT(bool(internal::is_lvalue::value), THIS_EXPRESSION_IS_NOT_A_LVALUE__IT_IS_READ_ONLY); + EIGEN_STATIC_ASSERT(bool(Traits::template match::MatchAtCompileTime), STORAGE_LAYOUT_DOES_NOT_MATCH); + EIGEN_STATIC_ASSERT(!Derived::IsPlainObjectBase,THIS_EXPRESSION_IS_NOT_A_LVALUE__IT_IS_READ_ONLY); + // Construction must pass since we will not create temporary storage in the non-const case. + const bool success = Base::construct(expr.const_cast_derived()); + EIGEN_UNUSED_VARIABLE(success) + eigen_assert(success); } EIGEN_INHERIT_ASSIGNMENT_OPERATORS(Ref) @@ -236,36 +336,39 @@ template class Ref< EIGEN_DENSE_PUBLIC_INTERFACE(Ref) template - inline Ref(const DenseBase& expr, - typename internal::enable_if::ScalarTypeMatch),Derived>::type* = 0) + EIGEN_DEVICE_FUNC inline Ref(const DenseBase& expr, + typename internal::enable_if::ScalarTypeMatch),Derived>::type* = 0) { // std::cout << match_helper::HasDirectAccess << "," << match_helper::OuterStrideMatch << "," << match_helper::InnerStrideMatch << "\n"; // std::cout << int(StrideType::OuterStrideAtCompileTime) << " - " << int(Derived::OuterStrideAtCompileTime) << "\n"; // std::cout << int(StrideType::InnerStrideAtCompileTime) << " - " << int(Derived::InnerStrideAtCompileTime) << "\n"; construct(expr.derived(), typename Traits::template match::type()); } - - inline Ref(const Ref& other) : Base(other) { + + EIGEN_DEVICE_FUNC inline Ref(const Ref& other) : Base(other) { // copy constructor shall not copy the m_object, to avoid unnecessary malloc and copy } template - inline Ref(const RefBase& other) { + EIGEN_DEVICE_FUNC inline Ref(const RefBase& other) { construct(other.derived(), typename Traits::template match::type()); } protected: template - void construct(const Expression& expr,internal::true_type) + EIGEN_DEVICE_FUNC void construct(const Expression& expr,internal::true_type) { - Base::construct(expr); + // Check if we can use the underlying expr's storage directly, otherwise call the copy version. + if (!Base::construct(expr)) { + construct(expr, internal::false_type()); + } } template - void construct(const Expression& expr, internal::false_type) + EIGEN_DEVICE_FUNC void construct(const Expression& expr, internal::false_type) { - m_object.lazyAssign(expr); + internal::call_assignment_no_alias(m_object,expr,internal::assign_op()); Base::construct(m_object); } diff --git a/extern/eigen/Eigen/src/Core/Replicate.h b/extern/eigen/Eigen/src/Core/Replicate.h index ac4537c1..ab5be7e6 100644 --- a/extern/eigen/Eigen/src/Core/Replicate.h +++ b/extern/eigen/Eigen/src/Core/Replicate.h @@ -10,22 +10,7 @@ #ifndef EIGEN_REPLICATE_H #define EIGEN_REPLICATE_H -namespace Eigen { - -/** - * \class Replicate - * \ingroup Core_Module - * - * \brief Expression of the multiple replication of a matrix or vector - * - * \param MatrixType the type of the object we are replicating - * - * This class represents an expression of the multiple replication of a matrix or vector. - * It is the return type of DenseBase::replicate() and most of the time - * this is the only way it is used. - * - * \sa DenseBase::replicate() - */ +namespace Eigen { namespace internal { template @@ -35,10 +20,7 @@ struct traits > typedef typename MatrixType::Scalar Scalar; typedef typename traits::StorageKind StorageKind; typedef typename traits::XprKind XprKind; - enum { - Factor = (RowFactor==Dynamic || ColFactor==Dynamic) ? Dynamic : RowFactor*ColFactor - }; - typedef typename nested::type MatrixTypeNested; + typedef typename ref_selector::type MatrixTypeNested; typedef typename remove_reference::type _MatrixTypeNested; enum { RowsAtCompileTime = RowFactor==Dynamic || int(MatrixType::RowsAtCompileTime)==Dynamic @@ -53,12 +35,29 @@ struct traits > IsRowMajor = MaxRowsAtCompileTime==1 && MaxColsAtCompileTime!=1 ? 1 : MaxColsAtCompileTime==1 && MaxRowsAtCompileTime!=1 ? 0 : (MatrixType::Flags & RowMajorBit) ? 1 : 0, - Flags = (_MatrixTypeNested::Flags & HereditaryBits & ~RowMajorBit) | (IsRowMajor ? RowMajorBit : 0), - CoeffReadCost = _MatrixTypeNested::CoeffReadCost + + // FIXME enable DirectAccess with negative strides? + Flags = IsRowMajor ? RowMajorBit : 0 }; }; } +/** + * \class Replicate + * \ingroup Core_Module + * + * \brief Expression of the multiple replication of a matrix or vector + * + * \tparam MatrixType the type of the object we are replicating + * \tparam RowFactor number of repetitions at compile time along the vertical direction, can be Dynamic. + * \tparam ColFactor number of repetitions at compile time along the horizontal direction, can be Dynamic. + * + * This class represents an expression of the multiple replication of a matrix or vector. + * It is the return type of DenseBase::replicate() and most of the time + * this is the only way it is used. + * + * \sa DenseBase::replicate() + */ template class Replicate : public internal::dense_xpr_base< Replicate >::type { @@ -68,10 +67,12 @@ template class Replicate typedef typename internal::dense_xpr_base::type Base; EIGEN_DENSE_PUBLIC_INTERFACE(Replicate) + typedef typename internal::remove_all::type NestedExpression; template - inline explicit Replicate(const OriginalMatrixType& a_matrix) - : m_matrix(a_matrix), m_rowFactor(RowFactor), m_colFactor(ColFactor) + EIGEN_DEVICE_FUNC + inline explicit Replicate(const OriginalMatrixType& matrix) + : m_matrix(matrix), m_rowFactor(RowFactor), m_colFactor(ColFactor) { EIGEN_STATIC_ASSERT((internal::is_same::type,OriginalMatrixType>::value), THE_MATRIX_OR_EXPRESSION_THAT_YOU_PASSED_DOES_NOT_HAVE_THE_EXPECTED_TYPE) @@ -79,44 +80,23 @@ template class Replicate } template - inline Replicate(const OriginalMatrixType& a_matrix, Index rowFactor, Index colFactor) - : m_matrix(a_matrix), m_rowFactor(rowFactor), m_colFactor(colFactor) + EIGEN_DEVICE_FUNC + inline Replicate(const OriginalMatrixType& matrix, Index rowFactor, Index colFactor) + : m_matrix(matrix), m_rowFactor(rowFactor), m_colFactor(colFactor) { EIGEN_STATIC_ASSERT((internal::is_same::type,OriginalMatrixType>::value), THE_MATRIX_OR_EXPRESSION_THAT_YOU_PASSED_DOES_NOT_HAVE_THE_EXPECTED_TYPE) } + EIGEN_DEVICE_FUNC EIGEN_CONSTEXPR inline Index rows() const { return m_matrix.rows() * m_rowFactor.value(); } + EIGEN_DEVICE_FUNC EIGEN_CONSTEXPR inline Index cols() const { return m_matrix.cols() * m_colFactor.value(); } - inline Scalar coeff(Index rowId, Index colId) const - { - // try to avoid using modulo; this is a pure optimization strategy - const Index actual_row = internal::traits::RowsAtCompileTime==1 ? 0 - : RowFactor==1 ? rowId - : rowId%m_matrix.rows(); - const Index actual_col = internal::traits::ColsAtCompileTime==1 ? 0 - : ColFactor==1 ? colId - : colId%m_matrix.cols(); - - return m_matrix.coeff(actual_row, actual_col); - } - template - inline PacketScalar packet(Index rowId, Index colId) const - { - const Index actual_row = internal::traits::RowsAtCompileTime==1 ? 0 - : RowFactor==1 ? rowId - : rowId%m_matrix.rows(); - const Index actual_col = internal::traits::ColsAtCompileTime==1 ? 0 - : ColFactor==1 ? colId - : colId%m_matrix.cols(); - - return m_matrix.template packet(actual_row, actual_col); - } - + EIGEN_DEVICE_FUNC const _MatrixTypeNested& nestedExpression() const - { - return m_matrix; + { + return m_matrix; } protected: @@ -135,27 +115,12 @@ template class Replicate */ template template -const Replicate +EIGEN_DEVICE_FUNC const Replicate DenseBase::replicate() const { return Replicate(derived()); } -/** - * \return an expression of the replication of \c *this - * - * Example: \include MatrixBase_replicate_int_int.cpp - * Output: \verbinclude MatrixBase_replicate_int_int.out - * - * \sa VectorwiseOp::replicate(), DenseBase::replicate(), class Replicate - */ -template -const typename DenseBase::ReplicateReturnType -DenseBase::replicate(Index rowFactor,Index colFactor) const -{ - return Replicate(derived(),rowFactor,colFactor); -} - /** * \return an expression of the replication of each column (or row) of \c *this * @@ -165,7 +130,7 @@ DenseBase::replicate(Index rowFactor,Index colFactor) const * \sa VectorwiseOp::replicate(), DenseBase::replicate(), class Replicate */ template -const typename VectorwiseOp::ReplicateReturnType +EIGEN_DEVICE_FUNC const typename VectorwiseOp::ReplicateReturnType VectorwiseOp::replicate(Index factor) const { return typename VectorwiseOp::ReplicateReturnType diff --git a/extern/eigen/Eigen/src/Core/Reshaped.h b/extern/eigen/Eigen/src/Core/Reshaped.h new file mode 100644 index 00000000..52de73b6 --- /dev/null +++ b/extern/eigen/Eigen/src/Core/Reshaped.h @@ -0,0 +1,454 @@ +// This file is part of Eigen, a lightweight C++ template library +// for linear algebra. +// +// Copyright (C) 2008-2017 Gael Guennebaud +// Copyright (C) 2014 yoco +// +// This Source Code Form is subject to the terms of the Mozilla +// Public License v. 2.0. If a copy of the MPL was not distributed +// with this file, You can obtain one at http://mozilla.org/MPL/2.0/. + +#ifndef EIGEN_RESHAPED_H +#define EIGEN_RESHAPED_H + +namespace Eigen { + +/** \class Reshaped + * \ingroup Core_Module + * + * \brief Expression of a fixed-size or dynamic-size reshape + * + * \tparam XprType the type of the expression in which we are taking a reshape + * \tparam Rows the number of rows of the reshape we are taking at compile time (optional) + * \tparam Cols the number of columns of the reshape we are taking at compile time (optional) + * \tparam Order can be ColMajor or RowMajor, default is ColMajor. + * + * This class represents an expression of either a fixed-size or dynamic-size reshape. + * It is the return type of DenseBase::reshaped(NRowsType,NColsType) and + * most of the time this is the only way it is used. + * + * However, in C++98, if you want to directly maniputate reshaped expressions, + * for instance if you want to write a function returning such an expression, you + * will need to use this class. In C++11, it is advised to use the \em auto + * keyword for such use cases. + * + * Here is an example illustrating the dynamic case: + * \include class_Reshaped.cpp + * Output: \verbinclude class_Reshaped.out + * + * Here is an example illustrating the fixed-size case: + * \include class_FixedReshaped.cpp + * Output: \verbinclude class_FixedReshaped.out + * + * \sa DenseBase::reshaped(NRowsType,NColsType) + */ + +namespace internal { + +template +struct traits > : traits +{ + typedef typename traits::Scalar Scalar; + typedef typename traits::StorageKind StorageKind; + typedef typename traits::XprKind XprKind; + enum{ + MatrixRows = traits::RowsAtCompileTime, + MatrixCols = traits::ColsAtCompileTime, + RowsAtCompileTime = Rows, + ColsAtCompileTime = Cols, + MaxRowsAtCompileTime = Rows, + MaxColsAtCompileTime = Cols, + XpxStorageOrder = ((int(traits::Flags) & RowMajorBit) == RowMajorBit) ? RowMajor : ColMajor, + ReshapedStorageOrder = (RowsAtCompileTime == 1 && ColsAtCompileTime != 1) ? RowMajor + : (ColsAtCompileTime == 1 && RowsAtCompileTime != 1) ? ColMajor + : XpxStorageOrder, + HasSameStorageOrderAsXprType = (ReshapedStorageOrder == XpxStorageOrder), + InnerSize = (ReshapedStorageOrder==int(RowMajor)) ? int(ColsAtCompileTime) : int(RowsAtCompileTime), + InnerStrideAtCompileTime = HasSameStorageOrderAsXprType + ? int(inner_stride_at_compile_time::ret) + : Dynamic, + OuterStrideAtCompileTime = Dynamic, + + HasDirectAccess = internal::has_direct_access::ret + && (Order==int(XpxStorageOrder)) + && ((evaluator::Flags&LinearAccessBit)==LinearAccessBit), + + MaskPacketAccessBit = (InnerSize == Dynamic || (InnerSize % packet_traits::size) == 0) + && (InnerStrideAtCompileTime == 1) + ? PacketAccessBit : 0, + //MaskAlignedBit = ((OuterStrideAtCompileTime!=Dynamic) && (((OuterStrideAtCompileTime * int(sizeof(Scalar))) % 16) == 0)) ? AlignedBit : 0, + FlagsLinearAccessBit = (RowsAtCompileTime == 1 || ColsAtCompileTime == 1) ? LinearAccessBit : 0, + FlagsLvalueBit = is_lvalue::value ? LvalueBit : 0, + FlagsRowMajorBit = (ReshapedStorageOrder==int(RowMajor)) ? RowMajorBit : 0, + FlagsDirectAccessBit = HasDirectAccess ? DirectAccessBit : 0, + Flags0 = traits::Flags & ( (HereditaryBits & ~RowMajorBit) | MaskPacketAccessBit), + + Flags = (Flags0 | FlagsLinearAccessBit | FlagsLvalueBit | FlagsRowMajorBit | FlagsDirectAccessBit) + }; +}; + +template class ReshapedImpl_dense; + +} // end namespace internal + +template class ReshapedImpl; + +template class Reshaped + : public ReshapedImpl::StorageKind> +{ + typedef ReshapedImpl::StorageKind> Impl; + public: + //typedef typename Impl::Base Base; + typedef Impl Base; + EIGEN_GENERIC_PUBLIC_INTERFACE(Reshaped) + EIGEN_INHERIT_ASSIGNMENT_OPERATORS(Reshaped) + + /** Fixed-size constructor + */ + EIGEN_DEVICE_FUNC + inline Reshaped(XprType& xpr) + : Impl(xpr) + { + EIGEN_STATIC_ASSERT(RowsAtCompileTime!=Dynamic && ColsAtCompileTime!=Dynamic,THIS_METHOD_IS_ONLY_FOR_FIXED_SIZE) + eigen_assert(Rows * Cols == xpr.rows() * xpr.cols()); + } + + /** Dynamic-size constructor + */ + EIGEN_DEVICE_FUNC + inline Reshaped(XprType& xpr, + Index reshapeRows, Index reshapeCols) + : Impl(xpr, reshapeRows, reshapeCols) + { + eigen_assert((RowsAtCompileTime==Dynamic || RowsAtCompileTime==reshapeRows) + && (ColsAtCompileTime==Dynamic || ColsAtCompileTime==reshapeCols)); + eigen_assert(reshapeRows * reshapeCols == xpr.rows() * xpr.cols()); + } +}; + +// The generic default implementation for dense reshape simply forward to the internal::ReshapedImpl_dense +// that must be specialized for direct and non-direct access... +template +class ReshapedImpl + : public internal::ReshapedImpl_dense >::HasDirectAccess> +{ + typedef internal::ReshapedImpl_dense >::HasDirectAccess> Impl; + public: + typedef Impl Base; + EIGEN_INHERIT_ASSIGNMENT_OPERATORS(ReshapedImpl) + EIGEN_DEVICE_FUNC inline ReshapedImpl(XprType& xpr) : Impl(xpr) {} + EIGEN_DEVICE_FUNC inline ReshapedImpl(XprType& xpr, Index reshapeRows, Index reshapeCols) + : Impl(xpr, reshapeRows, reshapeCols) {} +}; + +namespace internal { + +/** \internal Internal implementation of dense Reshaped in the general case. */ +template +class ReshapedImpl_dense + : public internal::dense_xpr_base >::type +{ + typedef Reshaped ReshapedType; + public: + + typedef typename internal::dense_xpr_base::type Base; + EIGEN_DENSE_PUBLIC_INTERFACE(ReshapedType) + EIGEN_INHERIT_ASSIGNMENT_OPERATORS(ReshapedImpl_dense) + + typedef typename internal::ref_selector::non_const_type MatrixTypeNested; + typedef typename internal::remove_all::type NestedExpression; + + class InnerIterator; + + /** Fixed-size constructor + */ + EIGEN_DEVICE_FUNC + inline ReshapedImpl_dense(XprType& xpr) + : m_xpr(xpr), m_rows(Rows), m_cols(Cols) + {} + + /** Dynamic-size constructor + */ + EIGEN_DEVICE_FUNC + inline ReshapedImpl_dense(XprType& xpr, Index nRows, Index nCols) + : m_xpr(xpr), m_rows(nRows), m_cols(nCols) + {} + + EIGEN_DEVICE_FUNC Index rows() const { return m_rows; } + EIGEN_DEVICE_FUNC Index cols() const { return m_cols; } + + #ifdef EIGEN_PARSED_BY_DOXYGEN + /** \sa MapBase::data() */ + EIGEN_DEVICE_FUNC inline const Scalar* data() const; + EIGEN_DEVICE_FUNC inline Index innerStride() const; + EIGEN_DEVICE_FUNC inline Index outerStride() const; + #endif + + /** \returns the nested expression */ + EIGEN_DEVICE_FUNC + const typename internal::remove_all::type& + nestedExpression() const { return m_xpr; } + + /** \returns the nested expression */ + EIGEN_DEVICE_FUNC + typename internal::remove_reference::type& + nestedExpression() { return m_xpr; } + + protected: + + MatrixTypeNested m_xpr; + const internal::variable_if_dynamic m_rows; + const internal::variable_if_dynamic m_cols; +}; + + +/** \internal Internal implementation of dense Reshaped in the direct access case. */ +template +class ReshapedImpl_dense + : public MapBase > +{ + typedef Reshaped ReshapedType; + typedef typename internal::ref_selector::non_const_type XprTypeNested; + public: + + typedef MapBase Base; + EIGEN_DENSE_PUBLIC_INTERFACE(ReshapedType) + EIGEN_INHERIT_ASSIGNMENT_OPERATORS(ReshapedImpl_dense) + + /** Fixed-size constructor + */ + EIGEN_DEVICE_FUNC + inline ReshapedImpl_dense(XprType& xpr) + : Base(xpr.data()), m_xpr(xpr) + {} + + /** Dynamic-size constructor + */ + EIGEN_DEVICE_FUNC + inline ReshapedImpl_dense(XprType& xpr, Index nRows, Index nCols) + : Base(xpr.data(), nRows, nCols), + m_xpr(xpr) + {} + + EIGEN_DEVICE_FUNC + const typename internal::remove_all::type& nestedExpression() const + { + return m_xpr; + } + + EIGEN_DEVICE_FUNC + XprType& nestedExpression() { return m_xpr; } + + /** \sa MapBase::innerStride() */ + EIGEN_DEVICE_FUNC EIGEN_CONSTEXPR + inline Index innerStride() const + { + return m_xpr.innerStride(); + } + + /** \sa MapBase::outerStride() */ + EIGEN_DEVICE_FUNC EIGEN_CONSTEXPR + inline Index outerStride() const + { + return ((Flags&RowMajorBit)==RowMajorBit) ? this->cols() : this->rows(); + } + + protected: + + XprTypeNested m_xpr; +}; + +// Evaluators +template struct reshaped_evaluator; + +template +struct evaluator > + : reshaped_evaluator >::HasDirectAccess> +{ + typedef Reshaped XprType; + typedef typename XprType::Scalar Scalar; + // TODO: should check for smaller packet types + typedef typename packet_traits::type PacketScalar; + + enum { + CoeffReadCost = evaluator::CoeffReadCost, + HasDirectAccess = traits::HasDirectAccess, + +// RowsAtCompileTime = traits::RowsAtCompileTime, +// ColsAtCompileTime = traits::ColsAtCompileTime, +// MaxRowsAtCompileTime = traits::MaxRowsAtCompileTime, +// MaxColsAtCompileTime = traits::MaxColsAtCompileTime, +// +// InnerStrideAtCompileTime = traits::HasSameStorageOrderAsXprType +// ? int(inner_stride_at_compile_time::ret) +// : Dynamic, +// OuterStrideAtCompileTime = Dynamic, + + FlagsLinearAccessBit = (traits::RowsAtCompileTime == 1 || traits::ColsAtCompileTime == 1 || HasDirectAccess) ? LinearAccessBit : 0, + FlagsRowMajorBit = (traits::ReshapedStorageOrder==int(RowMajor)) ? RowMajorBit : 0, + FlagsDirectAccessBit = HasDirectAccess ? DirectAccessBit : 0, + Flags0 = evaluator::Flags & (HereditaryBits & ~RowMajorBit), + Flags = Flags0 | FlagsLinearAccessBit | FlagsRowMajorBit | FlagsDirectAccessBit, + + PacketAlignment = unpacket_traits::alignment, + Alignment = evaluator::Alignment + }; + typedef reshaped_evaluator reshaped_evaluator_type; + EIGEN_DEVICE_FUNC explicit evaluator(const XprType& xpr) : reshaped_evaluator_type(xpr) + { + EIGEN_INTERNAL_CHECK_COST_VALUE(CoeffReadCost); + } +}; + +template +struct reshaped_evaluator + : evaluator_base > +{ + typedef Reshaped XprType; + + enum { + CoeffReadCost = evaluator::CoeffReadCost /* TODO + cost of index computations */, + + Flags = (evaluator::Flags & (HereditaryBits /*| LinearAccessBit | DirectAccessBit*/)), + + Alignment = 0 + }; + + EIGEN_DEVICE_FUNC explicit reshaped_evaluator(const XprType& xpr) : m_argImpl(xpr.nestedExpression()), m_xpr(xpr) + { + EIGEN_INTERNAL_CHECK_COST_VALUE(CoeffReadCost); + } + + typedef typename XprType::Scalar Scalar; + typedef typename XprType::CoeffReturnType CoeffReturnType; + + typedef std::pair RowCol; + + inline RowCol index_remap(Index rowId, Index colId) const + { + if(Order==ColMajor) + { + const Index nth_elem_idx = colId * m_xpr.rows() + rowId; + return RowCol(nth_elem_idx % m_xpr.nestedExpression().rows(), + nth_elem_idx / m_xpr.nestedExpression().rows()); + } + else + { + const Index nth_elem_idx = colId + rowId * m_xpr.cols(); + return RowCol(nth_elem_idx / m_xpr.nestedExpression().cols(), + nth_elem_idx % m_xpr.nestedExpression().cols()); + } + } + + EIGEN_DEVICE_FUNC + inline Scalar& coeffRef(Index rowId, Index colId) + { + EIGEN_STATIC_ASSERT_LVALUE(XprType) + const RowCol row_col = index_remap(rowId, colId); + return m_argImpl.coeffRef(row_col.first, row_col.second); + } + + EIGEN_DEVICE_FUNC + inline const Scalar& coeffRef(Index rowId, Index colId) const + { + const RowCol row_col = index_remap(rowId, colId); + return m_argImpl.coeffRef(row_col.first, row_col.second); + } + + EIGEN_DEVICE_FUNC + EIGEN_STRONG_INLINE const CoeffReturnType coeff(Index rowId, Index colId) const + { + const RowCol row_col = index_remap(rowId, colId); + return m_argImpl.coeff(row_col.first, row_col.second); + } + + EIGEN_DEVICE_FUNC + inline Scalar& coeffRef(Index index) + { + EIGEN_STATIC_ASSERT_LVALUE(XprType) + const RowCol row_col = index_remap(Rows == 1 ? 0 : index, + Rows == 1 ? index : 0); + return m_argImpl.coeffRef(row_col.first, row_col.second); + + } + + EIGEN_DEVICE_FUNC + inline const Scalar& coeffRef(Index index) const + { + const RowCol row_col = index_remap(Rows == 1 ? 0 : index, + Rows == 1 ? index : 0); + return m_argImpl.coeffRef(row_col.first, row_col.second); + } + + EIGEN_DEVICE_FUNC + inline const CoeffReturnType coeff(Index index) const + { + const RowCol row_col = index_remap(Rows == 1 ? 0 : index, + Rows == 1 ? index : 0); + return m_argImpl.coeff(row_col.first, row_col.second); + } +#if 0 + EIGEN_DEVICE_FUNC + template + inline PacketScalar packet(Index rowId, Index colId) const + { + const RowCol row_col = index_remap(rowId, colId); + return m_argImpl.template packet(row_col.first, row_col.second); + + } + + template + EIGEN_DEVICE_FUNC + inline void writePacket(Index rowId, Index colId, const PacketScalar& val) + { + const RowCol row_col = index_remap(rowId, colId); + m_argImpl.const_cast_derived().template writePacket + (row_col.first, row_col.second, val); + } + + template + EIGEN_DEVICE_FUNC + inline PacketScalar packet(Index index) const + { + const RowCol row_col = index_remap(RowsAtCompileTime == 1 ? 0 : index, + RowsAtCompileTime == 1 ? index : 0); + return m_argImpl.template packet(row_col.first, row_col.second); + } + + template + EIGEN_DEVICE_FUNC + inline void writePacket(Index index, const PacketScalar& val) + { + const RowCol row_col = index_remap(RowsAtCompileTime == 1 ? 0 : index, + RowsAtCompileTime == 1 ? index : 0); + return m_argImpl.template packet(row_col.first, row_col.second, val); + } +#endif +protected: + + evaluator m_argImpl; + const XprType& m_xpr; + +}; + +template +struct reshaped_evaluator +: mapbase_evaluator, + typename Reshaped::PlainObject> +{ + typedef Reshaped XprType; + typedef typename XprType::Scalar Scalar; + + EIGEN_DEVICE_FUNC explicit reshaped_evaluator(const XprType& xpr) + : mapbase_evaluator(xpr) + { + // TODO: for the 3.4 release, this should be turned to an internal assertion, but let's keep it as is for the beta lifetime + eigen_assert(((internal::UIntPtr(xpr.data()) % EIGEN_PLAIN_ENUM_MAX(1,evaluator::Alignment)) == 0) && "data is not aligned"); + } +}; + +} // end namespace internal + +} // end namespace Eigen + +#endif // EIGEN_RESHAPED_H diff --git a/extern/eigen/Eigen/src/Core/ReturnByValue.h b/extern/eigen/Eigen/src/Core/ReturnByValue.h index f635598d..4dad13ea 100644 --- a/extern/eigen/Eigen/src/Core/ReturnByValue.h +++ b/extern/eigen/Eigen/src/Core/ReturnByValue.h @@ -13,11 +13,6 @@ namespace Eigen { -/** \class ReturnByValue - * \ingroup Core_Module - * - */ - namespace internal { template @@ -38,17 +33,22 @@ struct traits > * So internal::nested always gives the plain return matrix type. * * FIXME: I don't understand why we need this specialization: isn't this taken care of by the EvalBeforeNestingBit ?? + * Answer: EvalBeforeNestingBit should be deprecated since we have the evaluators */ template -struct nested, n, PlainObject> +struct nested_eval, n, PlainObject> { typedef typename traits::ReturnType type; }; } // end namespace internal +/** \class ReturnByValue + * \ingroup Core_Module + * + */ template class ReturnByValue - : internal::no_assignment_operator, public internal::dense_xpr_base< ReturnByValue >::type + : public internal::dense_xpr_base< ReturnByValue >::type, internal::no_assignment_operator { public: typedef typename internal::traits::ReturnType ReturnType; @@ -57,10 +57,13 @@ template class ReturnByValue EIGEN_DENSE_PUBLIC_INTERFACE(ReturnByValue) template + EIGEN_DEVICE_FUNC inline void evalTo(Dest& dst) const { static_cast(this)->evalTo(dst); } - inline Index rows() const { return static_cast(this)->rows(); } - inline Index cols() const { return static_cast(this)->cols(); } + EIGEN_DEVICE_FUNC EIGEN_CONSTEXPR + inline Index rows() const EIGEN_NOEXCEPT { return static_cast(this)->rows(); } + EIGEN_DEVICE_FUNC EIGEN_CONSTEXPR + inline Index cols() const EIGEN_NOEXCEPT { return static_cast(this)->cols(); } #ifndef EIGEN_PARSED_BY_DOXYGEN #define Unusable YOU_ARE_TRYING_TO_ACCESS_A_SINGLE_COEFFICIENT_IN_A_SPECIAL_EXPRESSION_WHERE_THAT_IS_NOT_ALLOWED_BECAUSE_THAT_WOULD_BE_INEFFICIENT @@ -72,27 +75,44 @@ template class ReturnByValue const Unusable& coeff(Index,Index) const { return *reinterpret_cast(this); } Unusable& coeffRef(Index) { return *reinterpret_cast(this); } Unusable& coeffRef(Index,Index) { return *reinterpret_cast(this); } - template Unusable& packet(Index) const; - template Unusable& packet(Index, Index) const; +#undef Unusable #endif }; template template -Derived& DenseBase::operator=(const ReturnByValue& other) +EIGEN_DEVICE_FUNC Derived& DenseBase::operator=(const ReturnByValue& other) { other.evalTo(derived()); return derived(); } +namespace internal { + +// Expression is evaluated in a temporary; default implementation of Assignment is bypassed so that +// when a ReturnByValue expression is assigned, the evaluator is not constructed. +// TODO: Finalize port to new regime; ReturnByValue should not exist in the expression world + template -template -Derived& DenseBase::lazyAssign(const ReturnByValue& other) +struct evaluator > + : public evaluator::ReturnType> { - other.evalTo(derived()); - return derived(); -} + typedef ReturnByValue XprType; + typedef typename internal::traits::ReturnType PlainObject; + typedef evaluator Base; + + EIGEN_DEVICE_FUNC explicit evaluator(const XprType& xpr) + : m_result(xpr.rows(), xpr.cols()) + { + ::new (static_cast(this)) Base(m_result); + xpr.evalTo(m_result); + } + +protected: + PlainObject m_result; +}; +} // end namespace internal } // end namespace Eigen diff --git a/extern/eigen/Eigen/src/Core/Reverse.h b/extern/eigen/Eigen/src/Core/Reverse.h index e30ae3d2..28cdd76a 100644 --- a/extern/eigen/Eigen/src/Core/Reverse.h +++ b/extern/eigen/Eigen/src/Core/Reverse.h @@ -12,21 +12,7 @@ #ifndef EIGEN_REVERSE_H #define EIGEN_REVERSE_H -namespace Eigen { - -/** \class Reverse - * \ingroup Core_Module - * - * \brief Expression of the reverse of a vector or matrix - * - * \param MatrixType the type of the object of which we are taking the reverse - * - * This class represents an expression of the reverse of a vector. - * It is the return type of MatrixBase::reverse() and VectorwiseOp::reverse() - * and most of the time this is the only way it is used. - * - * \sa MatrixBase::reverse(), VectorwiseOp::reverse() - */ +namespace Eigen { namespace internal { @@ -37,36 +23,43 @@ struct traits > typedef typename MatrixType::Scalar Scalar; typedef typename traits::StorageKind StorageKind; typedef typename traits::XprKind XprKind; - typedef typename nested::type MatrixTypeNested; + typedef typename ref_selector::type MatrixTypeNested; typedef typename remove_reference::type _MatrixTypeNested; enum { RowsAtCompileTime = MatrixType::RowsAtCompileTime, ColsAtCompileTime = MatrixType::ColsAtCompileTime, MaxRowsAtCompileTime = MatrixType::MaxRowsAtCompileTime, MaxColsAtCompileTime = MatrixType::MaxColsAtCompileTime, - - // let's enable LinearAccess only with vectorization because of the product overhead - LinearAccess = ( (Direction==BothDirections) && (int(_MatrixTypeNested::Flags)&PacketAccessBit) ) - ? LinearAccessBit : 0, - - Flags = int(_MatrixTypeNested::Flags) & (HereditaryBits | LvalueBit | PacketAccessBit | LinearAccess), - - CoeffReadCost = _MatrixTypeNested::CoeffReadCost + Flags = _MatrixTypeNested::Flags & (RowMajorBit | LvalueBit) }; }; -template struct reverse_packet_cond +template struct reverse_packet_cond { - static inline PacketScalar run(const PacketScalar& x) { return preverse(x); } + static inline PacketType run(const PacketType& x) { return preverse(x); } }; -template struct reverse_packet_cond +template struct reverse_packet_cond { - static inline PacketScalar run(const PacketScalar& x) { return x; } + static inline PacketType run(const PacketType& x) { return x; } }; -} // end namespace internal +} // end namespace internal +/** \class Reverse + * \ingroup Core_Module + * + * \brief Expression of the reverse of a vector or matrix + * + * \tparam MatrixType the type of the object of which we are taking the reverse + * \tparam Direction defines the direction of the reverse operation, can be Vertical, Horizontal, or BothDirections + * + * This class represents an expression of the reverse of a vector. + * It is the return type of MatrixBase::reverse() and VectorwiseOp::reverse() + * and most of the time this is the only way it is used. + * + * \sa MatrixBase::reverse(), VectorwiseOp::reverse() + */ template class Reverse : public internal::dense_xpr_base< Reverse >::type { @@ -74,12 +67,9 @@ template class Reverse typedef typename internal::dense_xpr_base::type Base; EIGEN_DENSE_PUBLIC_INTERFACE(Reverse) + typedef typename internal::remove_all::type NestedExpression; using Base::IsRowMajor; - // next line is necessary because otherwise const version of operator() - // is hidden by non-const version defined in this file - using Base::operator(); - protected: enum { PacketSize = internal::packet_traits::size, @@ -95,83 +85,22 @@ template class Reverse typedef internal::reverse_packet_cond reverse_packet; public: - inline Reverse(const MatrixType& matrix) : m_matrix(matrix) { } + EIGEN_DEVICE_FUNC explicit inline Reverse(const MatrixType& matrix) : m_matrix(matrix) { } EIGEN_INHERIT_ASSIGNMENT_OPERATORS(Reverse) - inline Index rows() const { return m_matrix.rows(); } - inline Index cols() const { return m_matrix.cols(); } + EIGEN_DEVICE_FUNC EIGEN_CONSTEXPR + inline Index rows() const EIGEN_NOEXCEPT { return m_matrix.rows(); } + EIGEN_DEVICE_FUNC EIGEN_CONSTEXPR + inline Index cols() const EIGEN_NOEXCEPT { return m_matrix.cols(); } - inline Index innerStride() const + EIGEN_DEVICE_FUNC inline Index innerStride() const { return -m_matrix.innerStride(); } - inline Scalar& operator()(Index row, Index col) - { - eigen_assert(row >= 0 && row < rows() && col >= 0 && col < cols()); - return coeffRef(row, col); - } - - inline Scalar& coeffRef(Index row, Index col) - { - return m_matrix.const_cast_derived().coeffRef(ReverseRow ? m_matrix.rows() - row - 1 : row, - ReverseCol ? m_matrix.cols() - col - 1 : col); - } - - inline CoeffReturnType coeff(Index row, Index col) const - { - return m_matrix.coeff(ReverseRow ? m_matrix.rows() - row - 1 : row, - ReverseCol ? m_matrix.cols() - col - 1 : col); - } - - inline CoeffReturnType coeff(Index index) const - { - return m_matrix.coeff(m_matrix.size() - index - 1); - } - - inline Scalar& coeffRef(Index index) - { - return m_matrix.const_cast_derived().coeffRef(m_matrix.size() - index - 1); - } - - inline Scalar& operator()(Index index) - { - eigen_assert(index >= 0 && index < m_matrix.size()); - return coeffRef(index); - } - - template - inline const PacketScalar packet(Index row, Index col) const - { - return reverse_packet::run(m_matrix.template packet( - ReverseRow ? m_matrix.rows() - row - OffsetRow : row, - ReverseCol ? m_matrix.cols() - col - OffsetCol : col)); - } - - template - inline void writePacket(Index row, Index col, const PacketScalar& x) - { - m_matrix.const_cast_derived().template writePacket( - ReverseRow ? m_matrix.rows() - row - OffsetRow : row, - ReverseCol ? m_matrix.cols() - col - OffsetCol : col, - reverse_packet::run(x)); - } - - template - inline const PacketScalar packet(Index index) const - { - return internal::preverse(m_matrix.template packet( m_matrix.size() - index - PacketSize )); - } - - template - inline void writePacket(Index index, const PacketScalar& x) - { - m_matrix.const_cast_derived().template writePacket(m_matrix.size() - index - PacketSize, internal::preverse(x)); - } - - const typename internal::remove_all::type& - nestedExpression() const + EIGEN_DEVICE_FUNC const typename internal::remove_all::type& + nestedExpression() const { return m_matrix; } @@ -187,36 +116,100 @@ template class Reverse * */ template -inline typename DenseBase::ReverseReturnType +EIGEN_DEVICE_FUNC inline typename DenseBase::ReverseReturnType DenseBase::reverse() { - return derived(); + return ReverseReturnType(derived()); } -/** This is the const version of reverse(). */ -template -inline const typename DenseBase::ConstReverseReturnType -DenseBase::reverse() const -{ - return derived(); -} + +//reverse const overload moved DenseBase.h due to a CUDA compiler bug /** This is the "in place" version of reverse: it reverses \c *this. * * In most cases it is probably better to simply use the reversed expression * of a matrix. However, when reversing the matrix data itself is really needed, * then this "in-place" version is probably the right choice because it provides - * the following additional features: + * the following additional benefits: * - less error prone: doing the same operation with .reverse() requires special care: * \code m = m.reverse().eval(); \endcode - * - this API allows to avoid creating a temporary (the current implementation creates a temporary, but that could be avoided using swap) + * - this API enables reverse operations without the need for a temporary * - it allows future optimizations (cache friendliness, etc.) * - * \sa reverse() */ + * \sa VectorwiseOp::reverseInPlace(), reverse() */ template -inline void DenseBase::reverseInPlace() +EIGEN_DEVICE_FUNC inline void DenseBase::reverseInPlace() +{ + if(cols()>rows()) + { + Index half = cols()/2; + leftCols(half).swap(rightCols(half).reverse()); + if((cols()%2)==1) + { + Index half2 = rows()/2; + col(half).head(half2).swap(col(half).tail(half2).reverse()); + } + } + else + { + Index half = rows()/2; + topRows(half).swap(bottomRows(half).reverse()); + if((rows()%2)==1) + { + Index half2 = cols()/2; + row(half).head(half2).swap(row(half).tail(half2).reverse()); + } + } +} + +namespace internal { + +template +struct vectorwise_reverse_inplace_impl; + +template<> +struct vectorwise_reverse_inplace_impl +{ + template + static void run(ExpressionType &xpr) + { + const int HalfAtCompileTime = ExpressionType::RowsAtCompileTime==Dynamic?Dynamic:ExpressionType::RowsAtCompileTime/2; + Index half = xpr.rows()/2; + xpr.topRows(fix(half)) + .swap(xpr.bottomRows(fix(half)).colwise().reverse()); + } +}; + +template<> +struct vectorwise_reverse_inplace_impl +{ + template + static void run(ExpressionType &xpr) + { + const int HalfAtCompileTime = ExpressionType::ColsAtCompileTime==Dynamic?Dynamic:ExpressionType::ColsAtCompileTime/2; + Index half = xpr.cols()/2; + xpr.leftCols(fix(half)) + .swap(xpr.rightCols(fix(half)).rowwise().reverse()); + } +}; + +} // end namespace internal + +/** This is the "in place" version of VectorwiseOp::reverse: it reverses each column or row of \c *this. + * + * In most cases it is probably better to simply use the reversed expression + * of a matrix. However, when reversing the matrix data itself is really needed, + * then this "in-place" version is probably the right choice because it provides + * the following additional benefits: + * - less error prone: doing the same operation with .reverse() requires special care: + * \code m = m.reverse().eval(); \endcode + * - this API enables reverse operations without the need for a temporary + * + * \sa DenseBase::reverseInPlace(), reverse() */ +template +EIGEN_DEVICE_FUNC void VectorwiseOp::reverseInPlace() { - derived() = derived().reverse().eval(); + internal::vectorwise_reverse_inplace_impl::run(m_matrix); } } // end namespace Eigen diff --git a/extern/eigen/Eigen/src/Core/Select.h b/extern/eigen/Eigen/src/Core/Select.h index 87993bbb..7c86bf87 100644 --- a/extern/eigen/Eigen/src/Core/Select.h +++ b/extern/eigen/Eigen/src/Core/Select.h @@ -10,7 +10,7 @@ #ifndef EIGEN_SELECT_H #define EIGEN_SELECT_H -namespace Eigen { +namespace Eigen { /** \class Select * \ingroup Core_Module @@ -43,23 +43,21 @@ struct traits > ColsAtCompileTime = ConditionMatrixType::ColsAtCompileTime, MaxRowsAtCompileTime = ConditionMatrixType::MaxRowsAtCompileTime, MaxColsAtCompileTime = ConditionMatrixType::MaxColsAtCompileTime, - Flags = (unsigned int)ThenMatrixType::Flags & ElseMatrixType::Flags & HereditaryBits, - CoeffReadCost = traits::type>::CoeffReadCost - + EIGEN_SIZE_MAX(traits::type>::CoeffReadCost, - traits::type>::CoeffReadCost) + Flags = (unsigned int)ThenMatrixType::Flags & ElseMatrixType::Flags & RowMajorBit }; }; } template -class Select : internal::no_assignment_operator, - public internal::dense_xpr_base< Select >::type +class Select : public internal::dense_xpr_base< Select >::type, + internal::no_assignment_operator { public: typedef typename internal::dense_xpr_base