GithubHelp home page GithubHelp logo

godlike / epona Goto Github PK

View Code? Open in Web Editor NEW
0.0 6.0 0.0 166 KB

Collection of algebraic methods and data structures for collision detection

License: MIT License

CMake 2.78% C++ 97.13% Shell 0.09%
convex-hull jacobi hyperplane heds linear-algebra quickhull

epona's Introduction

Epona

Join discord chat.

Linux Build Status

Windows Build status

epona's People

Contributors

ilia-glushchenko avatar mrdmitry avatar vitali-parkhomenko avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

epona's Issues

Local build fails on g++ and clang++

I am not sure what's the difference in the setup between my local build and travis pr build

Tested on g++-5, g++-6, g++7, clang++-5.0, clang++-6.0 and got similar errors. Different system headers?

g++ output:

FAILED: /usr/bin/c++  -DEPONA_DEBUG -I../ -I../Epona/include -I../Epona/third_party/glm -Wall -Werror -pedantic -Wall -Werror -pedantic -g -g3 -ggdb3 -O0 -g3 -ggdb3 -O0   -std=gnu++1z -MD -MT Epona/CMakeFiles/EponaMath.dir/sources/Analysis.cpp.o -MF Epona/CMakeFiles/EponaMath.dir/sources/Analysis.cpp.o.d -o Epona/CMakeFiles/EponaMath.dir/sources/Analysis.cpp.o -c ../Epona/sources/Analysis.cpp
In file included from /usr/include/c++/7/cassert:44:0,
                 from ../Epona/third_party/glm/glm/detail/../detail/../detail/../detail/func_exponential.inl:8,
                 from ../Epona/third_party/glm/glm/detail/../detail/../detail/../exponential.hpp:108,
                 from ../Epona/third_party/glm/glm/detail/../detail/../detail/func_geometric.inl:4,
                 from ../Epona/third_party/glm/glm/detail/../detail/../geometric.hpp:116,
                 from ../Epona/third_party/glm/glm/detail/../detail/func_matrix.inl:4,
                 from ../Epona/third_party/glm/glm/detail/../matrix.hpp:164,
                 from ../Epona/third_party/glm/glm/detail/type_mat2x2.inl:4,
                 from ../Epona/third_party/glm/glm/detail/type_mat2x2.hpp:181,
                 from ../Epona/third_party/glm/glm/mat2x2.hpp:8,
                 from ../Epona/third_party/glm/glm/glm.hpp:100,
                 from ../Epona/include/Epona/FloatingPoint.hpp:9,
                 from ../Epona/sources/Analysis.cpp:6:
../Epona/sources/Analysis.cpp: In function ‘glm::vec3 epona::CalculateBarycentricCoordinates(glm::vec3, glm::vec3, glm::vec3, glm::vec3)’:
../Epona/sources/Analysis.cpp:42:13: error: ‘isnan’ was not declared in this scope
     assert(!isnan(coordinates.x) && !isnan(coordinates.y) && !isnan(coordinates.z));
             ^
../Epona/sources/Analysis.cpp:42:13: note: suggested alternatives:
In file included from ../Epona/third_party/glm/glm/detail/_fixes.hpp:4:0,
                 from ../Epona/third_party/glm/glm/glm.hpp:79,
                 from ../Epona/include/Epona/FloatingPoint.hpp:9,
                 from ../Epona/sources/Analysis.cpp:6:
/usr/include/c++/7/cmath:639:5: note:   ‘std::isnan’
     isnan(_Tp __x)
     ^~~~~
In file included from ../Epona/third_party/glm/glm/gtx/../gtx/../gtc/quaternion.hpp:434:0,
                 from ../Epona/third_party/glm/glm/gtx/../gtx/quaternion.hpp:19,
                 from ../Epona/third_party/glm/glm/gtx/norm.hpp:18,
                 from ../Epona/include/Epona/Analysis.hpp:13,
                 from ../Epona/sources/Analysis.cpp:7:
../Epona/third_party/glm/glm/gtx/../gtx/../gtc/quaternion.inl:780:37: note:   ‘glm::isnan’
  GLM_FUNC_QUALIFIER vec<4, bool, Q> isnan(tquat<T, Q> const& q)
                                     ^~~~~
In file included from /usr/include/c++/7/cassert:44:0,
                 from ../Epona/third_party/glm/glm/detail/../detail/../detail/../detail/func_exponential.inl:8,
                 from ../Epona/third_party/glm/glm/detail/../detail/../detail/../exponential.hpp:108,
                 from ../Epona/third_party/glm/glm/detail/../detail/../detail/func_geometric.inl:4,
                 from ../Epona/third_party/glm/glm/detail/../detail/../geometric.hpp:116,
                 from ../Epona/third_party/glm/glm/detail/../detail/func_matrix.inl:4,
                 from ../Epona/third_party/glm/glm/detail/../matrix.hpp:164,
                 from ../Epona/third_party/glm/glm/detail/type_mat2x2.inl:4,
                 from ../Epona/third_party/glm/glm/detail/type_mat2x2.hpp:181,
                 from ../Epona/third_party/glm/glm/mat2x2.hpp:8,
                 from ../Epona/third_party/glm/glm/glm.hpp:100,
                 from ../Epona/include/Epona/FloatingPoint.hpp:9,
                 from ../Epona/sources/Analysis.cpp:6:
../Epona/sources/Analysis.cpp:43:13: error: ‘isinf’ was not declared in this scope
     assert(!isinf(coordinates.x) && !isinf(coordinates.y) && !isinf(coordinates.z));
             ^
../Epona/sources/Analysis.cpp:43:13: note: suggested alternatives:
In file included from ../Epona/third_party/glm/glm/detail/_fixes.hpp:4:0,
                 from ../Epona/third_party/glm/glm/glm.hpp:79,
                 from ../Epona/include/Epona/FloatingPoint.hpp:9,
                 from ../Epona/sources/Analysis.cpp:6:
/usr/include/c++/7/cmath:612:5: note:   ‘std::isinf’
     isinf(_Tp __x)
     ^~~~~
In file included from ../Epona/third_party/glm/glm/gtx/../gtx/../gtc/quaternion.hpp:434:0,
                 from ../Epona/third_party/glm/glm/gtx/../gtx/quaternion.hpp:19,
                 from ../Epona/third_party/glm/glm/gtx/norm.hpp:18,
                 from ../Epona/include/Epona/Analysis.hpp:13,
                 from ../Epona/sources/Analysis.cpp:7:
../Epona/third_party/glm/glm/gtx/../gtx/../gtc/quaternion.inl:788:37: note:   ‘glm::isinf’
  GLM_FUNC_QUALIFIER vec<4, bool, Q> isinf(tquat<T, Q> const& q)

clang output:

FAILED: /usr/bin/clang++-6.0  -DEPONA_DEBUG -I../ -I../Epona/include -I../Epona/third_party/glm -Wno-error=unused-command-line-argument -Wall -Werror -pedantic -Wno-error=unused-command-line-argument -Wall -Werror -pedantic -g -g3 -ggdb3 -O0 -g3 -ggdb3 -O0   -std=gnu++1z -MD -MT Epona/CMakeFiles/EponaMath.dir/sources/Analysis.cpp.o -MF Epona/CMakeFiles/EponaMath.dir/sources/Analysis.cpp.o.d -o Epona/CMakeFiles/EponaMath.dir/sources/Analysis.cpp.o -c ../Epona/sources/Analysis.cpp
../Epona/sources/Analysis.cpp:42:13: error: use of undeclared identifier 'isnan'
    assert(!isnan(coordinates.x) && !isnan(coordinates.y) && !isnan(coordinates.z));
            ^
../Epona/sources/Analysis.cpp:42:38: error: use of undeclared identifier 'isnan'
    assert(!isnan(coordinates.x) && !isnan(coordinates.y) && !isnan(coordinates.z));
                                     ^
../Epona/sources/Analysis.cpp:42:63: error: use of undeclared identifier 'isnan'
    assert(!isnan(coordinates.x) && !isnan(coordinates.y) && !isnan(coordinates.z));
                                                              ^
../Epona/sources/Analysis.cpp:43:13: error: use of undeclared identifier 'isinf'
    assert(!isinf(coordinates.x) && !isinf(coordinates.y) && !isinf(coordinates.z));
            ^
../Epona/sources/Analysis.cpp:43:38: error: use of undeclared identifier 'isinf'
    assert(!isinf(coordinates.x) && !isinf(coordinates.y) && !isinf(coordinates.z));
                                     ^
../Epona/sources/Analysis.cpp:43:63: error: use of undeclared identifier 'isinf'
    assert(!isinf(coordinates.x) && !isinf(coordinates.y) && !isinf(coordinates.z));

Floating point IsEqual returns false positive result

IsEqual does not account for the different signs, so it would return true if you would call it with -1 and +1.

Propose solution:

inline bool IsEqual(double lhs, double rhs)
{
    return glm::abs(lhs - rhs) < g_floatingPointThreshold;
}

Use modern CMake features

Move add_library block to the beginning of the file, unify add_library blocks by using ${PROJECT_NAME}
Add library aliases for configuration-level library checking
Use PUBLIC, INTERFACE and PRIVATE sections of target_ directives to allow CMake inherit options from linked libraries

Overall using modern CMake features reduces amount of boilerplate user code required to use the library and makes it easier to read CMake files when looking for some specific library options.

QuickhullConvexHull returns incorrect faces data

For the given data QuickhullConvexHull returns invalid face data.

std::vector<glm::dvec3> g_vertices = { 
    { 0.00000000000000000, -0.94377566217683917, 0.00000000000000000 },
    { 0.00000000000000000, 0.056224337823160830, 0.00000000000000000 },
    { 1.0000000000000000, -0.94377566217683917, 0.00000000000000000 },
    { 1.0000000000000000, 0.056224337823160830, 0.00000000000000000 },
    { 0.00000000000000000, -0.94377566217683917, 1.0000000000000000 },
    { 0.00000000000000000, 0.056224337823160830, 1.0000000000000000 },
    { 1.0000000000000000, -0.94377566217683917, 1.0000000000000000 },
    { 1.0000000000000000, 0.056224337823160830, 1.0000000000000000 },
    { 0.00000000000000000, -1.9437756621768392, 0.00000000000000000 },
    { 0.00000000000000000, -0.94377566217683917, 0.00000000000000000 },
    { 1.0000000000000000, -1.9437756621768392, 0.00000000000000000 },
    { 1.0000000000000000, -0.94377566217683917, 0.00000000000000000 },
    { 0.00000000000000000, -1.9437756621768392, 1.0000000000000000 },
    { 0.00000000000000000, -0.94377566217683917, 1.0000000000000000 },
    { 1.0000000000000000, -1.9437756621768392, 1.0000000000000000 },
    { 1.0000000000000000, -0.94377566217683917, 1.0000000000000000 },
    { -1.0000000000000000, -0.94377566217683917, 0.00000000000000000 },
    { -1.0000000000000000, 0.056224337823160830, 0.00000000000000000 },
    { 0.00000000000000000, -0.94377566217683917, 0.00000000000000000 },
    { 0.00000000000000000, 0.056224337823160830, 0.00000000000000000 },
    { -1.0000000000000000, -0.94377566217683917, 1.0000000000000000 },
    { -1.0000000000000000, 0.056224337823160830, 1.0000000000000000 },
    { 0.00000000000000000, -0.94377566217683917, 1.0000000000000000 },
    { 0.00000000000000000, 0.056224337823160830, 1.0000000000000000 },
    { -1.0000000000000000, -1.9437756621768392, 0.00000000000000000 },
    { -1.0000000000000000, -0.94377566217683917, 0.00000000000000000 },
    { 0.00000000000000000, -1.9437756621768392, 0.00000000000000000 },
    { 0.00000000000000000, -0.94377566217683917, 0.00000000000000000 },
    { -1.0000000000000000, -1.9437756621768392, 1.0000000000000000 },
    { -1.0000000000000000, -0.94377566217683917, 1.0000000000000000 },
    { 0.00000000000000000, -1.9437756621768392, 1.0000000000000000 },
    { 0.00000000000000000, -0.94377566217683917, 1.0000000000000000 },
    { 0.00000000000000000, -0.94377566217683917, -1.0000000000000000 },
    { 0.00000000000000000, 0.056224337823160830, -1.0000000000000000 },
    { 1.0000000000000000, -0.94377566217683917, -1.0000000000000000 },
    { 1.0000000000000000, 0.056224337823160830, -1.0000000000000000 },
    { 0.00000000000000000, -0.94377566217683917, 0.00000000000000000 },
    { 0.00000000000000000, 0.056224337823160830, 0.00000000000000000 },
    { 1.0000000000000000, -0.94377566217683917, 0.00000000000000000 },
    { 1.0000000000000000, 0.056224337823160830, 0.00000000000000000 },
    { 0.00000000000000000, -1.9437756621768392, -1.0000000000000000 },
    { 0.00000000000000000, -0.94377566217683917, -1.0000000000000000 },
    { 1.0000000000000000, -1.9437756621768392, -1.0000000000000000 },
    { 1.0000000000000000, -0.94377566217683917, -1.0000000000000000 },
    { 0.00000000000000000, -1.9437756621768392, 0.00000000000000000 },
    { 0.00000000000000000, -0.94377566217683917, 0.00000000000000000 },
    { 1.0000000000000000, -1.9437756621768392, 0.00000000000000000 },
    { 1.0000000000000000, -0.94377566217683917, 0.00000000000000000 },
    { -1.0000000000000000, -0.94377566217683917, -1.0000000000000000 },
    { -1.0000000000000000, 0.056224337823160830, -1.0000000000000000 },
    { 0.00000000000000000, -0.94377566217683917, -1.0000000000000000 },
    { 0.00000000000000000, 0.056224337823160830, -1.0000000000000000 },
    { -1.0000000000000000, -0.94377566217683917, 0.00000000000000000 },
    { -1.0000000000000000, 0.056224337823160830, 0.00000000000000000 },
    { 0.00000000000000000, -0.94377566217683917, 0.00000000000000000 },
    { 0.00000000000000000, 0.056224337823160830, 0.00000000000000000 },
    { -1.0000000000000000, -1.9437756621768392, -1.0000000000000000 },
    { -1.0000000000000000, -0.94377566217683917, -1.0000000000000000 },
    { 0.00000000000000000, -1.9437756621768392, -1.0000000000000000 },
    { 0.00000000000000000, -0.94377566217683917, -1.0000000000000000 },
    { -1.0000000000000000, -1.9437756621768392, 0.00000000000000000 },
    { -1.0000000000000000, -0.94377566217683917, 0.00000000000000000 },
    { 0.00000000000000000, -1.9437756621768392, 0.00000000000000000 },
    { 0.00000000000000000, -0.94377566217683917, 0.00000000000000000 } 
};

Crash observed when EPONA_DEBUG is defined

If EPONA_DEBUG is defined but no debug callback was set, application crashes with the following message:

terminate called after throwing an instance of 'std::bad_function_call'
  what():  bad_function_call
Aborted (core dumped)

gdb indicates the problem as follows:

// /usr/include/c++/7/bits/std_function.h

       template<typename _Res, typename... _ArgTypes>
         _Res
         function<_Res(_ArgTypes...)>::
         operator()(_ArgTypes... __args) const
         {
           if (_M_empty())
/* crash */  __throw_bad_function_call();
           return _M_invoker(_M_functor, std::forward<_ArgTypes>(__args)...);
         }

This call was a result of Epona/debug/DebugIMplementation.hpp:44:

GetQuickhullConvexHullCallback<VertexBuffer>()(convexHull, vertexBuffer);

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.