godlike / epona Goto Github PK
View Code? Open in Web Editor NEWCollection of algebraic methods and data structures for collision detection
License: MIT License
Collection of algebraic methods and data structures for collision detection
License: MIT License
Related issue to Godlike/Pegasus#136
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 }
};
Write world space to model space conversion function and model space to world space conversion function for a single vertex.
Add export macros or set (CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS ON)
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);
Rewrite all floating point calculations with float instead of double in order to improve vectorization.
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;
}
clang
fails when compiling Release
build
Improve cache friendliness, make it more data oriented.
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.
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));
Only one person should be required in order to approve a pull request.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.