Comments (3)
Hi,
yes, I can reproduce it and it looks like a bug. What I have tried so far is changing the "first_dir" direction from (1,0,0) which is default to (1,1,0) and it suddenly gives the correct answer. I'm not sure how much time I can spend on this, but I will try to look into it. If you find out where could be the problem let me know.
Cheers,
Dan
from libccd.
Hi Dan,
I finally had some time to look into this. Unfortunately I have no solution yet, but some further information:
The following happens if USE_DOUBLE is OFF:
The segfault ultimately comes from the pointToSegement distance algorithm (https://github.com/danfis/libccd/blob/master/src/vec3.c#L103). The issue is that the points x0 and b are zero. These two points can be traced back to https://github.com/danfis/libccd/blob/master/src/ccd.c#L793 . These points are computed just above.
Note that in this case MPR fails as well (by giving completely wrong results)!
If USE_DOUBLE is ON:
The segfault occurs at https://github.com/danfis/libccd/blob/master/src/vec3.c#L314 which is called from https://github.com/danfis/libccd/blob/master/src/ccd.c#L193
One big difference between double on/off is that the simplex is of size 4 if double is used and 2 with float.
It seems I would need to understand more of the algorithm to actually debug this properly. I do not know whether I will find time for this in the near future. As we use the library in our simulation software it will remain on my TODO list, but the effort for fixing seems quite high unfortunately.
Please ignore all USE_DOUBLE OFF references, that was my mistake.
from libccd.
The simplexToPolytope4 function checks if the origin is on any face of the 4-simplex (i.e. tetrahedron). Now in the case that is investigated, this happens to be the case. However, this distance https://github.com/danfis/libccd/blob/master/src/ccd.c#L574 is -1.776357e-15 which is greater than DBL_EPSILON (at -2e-16 or so). Because the origin is slightly out of the tetrahedron this causes the FPE.
Actually if DBL_EPSILON is increased then no 4-simplex is created as the algorithm already gets a "touch" in the doSimplex3 routine where the ccdVec3PointTriDist2 function is called as well.
So the culprit clearly is this point to triangle distance function. This function only uses basic arithmetic but - and / are not well behaved in a floating point context. So what should be done? The simplest solution is to modify the ccdIsZero function that follows these function calls. If they operate on x*(return value) with 10 < x < 100 the issue would vanish. Obviously x could be determined by properly analysing the error propagation inside the ccdVec3PointTriDist2 function. But I don't see a big issue in conservatively setting it to 100. Opinions are welcome @danfis
from libccd.
Related Issues (20)
- nextSupport function does not compute the right answer HOT 4
- Edge/Vertex order in ccd_pt_face_t HOT 1
- ccd_pt_vertex_t.edges is incorrectly assigned HOT 1
- Installation Crashing from executing make HOT 7
- findPenetr() can divide by zero.
- ccdVec3PointTriDist2() divides by zero. HOT 3
- Example from the 'GJK - Intersection Test' section fails HOT 1
- 'pkg-config --libs' shouldn't return -lm
- Enable compilation for ICC
- ccdVec3PointTriDist2 computes different distance with / without witness points. HOT 3
- M_PI not defined on test_gjk_libccd-inl_epa.cpp
- Warning C4273"inconsistent dll linkage" when build Static Library
- Fatal error: LNK1120 unresolved externals when libccd maked as static library HOT 1
- Examples in README are difficult to read and don't define all symbols they use HOT 3
- ccdGJKPenetration: Access violation reading location 0x0000000000000000. occurred HOT 7
- MPR - Penetration depth with any vector, not with MDT-vector - it's possible?
- ccdMPRPenetration() bug, wrong dir penetration depth HOT 36
- use CMAKE_INSTALL_DOCDIR insted of ${CMAKE_INSTALL_DATAROOTDIR}/doc/ccd
- Question: EPA Position Computation
- autotools install does not install header files.
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from libccd.