Comments (5)
Thanks for reporting. It's an interesting case - and my apologise for the cryptic message/variable names. It could be a bug or a particular case that stresses the algorithm beyond the set tolerances.
The warning is triggered inside S3D
: the function that computes the point of a tetrahedron closest to the origin. To speed up the solution, this function uses information from the past GJK-iteration(s). This means that the search is not brute-force, but the problem is simple enough to be compared to the exact solution and debug from there.
You can either:
- If you're happy with the results given, instead of commenting out that warning, adjust the values of
eps_rel22
oreps_tot22
. Relax these tolerances until the warning disappears. This will terminate GJK earlier and hopefully will give good results. No guarantees tho. - Debug. Enter the function
S3D
and post here the coordinates of the four vertices (s1
,s2
,s3
ands4
) of the tetrahedron. Or add few lines of code that print to console these coordinates when the warning is triggered. We'll take it from there.
from opengjk.
Mattia,
My preference is to go with Option 2. I'd like to know if the warning is being displayed for good reason before discounting it. A quick question regarding s1 through s4: Are these the vertices of the tetrahedrons that the GJK algorithm generates internally as it searches the minkowski difference for the origin, or are they the vertices of the source polyhedron being tested? I ask for clarification because the polyhedrons I'm checking for convergence are themselves tetrahedrons. I don't have much experience programming in C (I'm using the MATLAB installation), and converting vectors (3D coords of each vertex) to strings for use in Mexprintf seems nontrivial. My apologies for the inconvenience my inexperience causes.
from opengjk.
from opengjk.
Mattia,
I've checked when the error message arises, and found some interesting results. Here are the vertex coordinates of two tetrahedra that produce this error:
E_target=[3.5074, 3.3263, 0;
2.5000, 5.0000, 0;
1.7122, 2.7488, 2.7488;
3.3789, 2.9915, 2.9915];
E_test=[3.3789, 2.9915, 2.9915;
3.5074, 0, 1.6737;
1.7122, 2.7488, 2.7488;
3.5017, 1.6638, 0];
The UNEXPECTED VALUES message appears when evaluating a Minkowski Difference tetrahedron with vertices located at
s1: 1.666693, 0.242770, 0.242770
s2: -1.666693, -0.242770, -0.242770
s3: -0.122842, 1.327708, 2.991528
s4: 0.128510, 0.334741, -2.991528
"target" in red, "test" in grey, and s1-s4 in green.
However, there's a further complicating factor: the message only appears when evaluating in a while loop. My code checks collision between the "target" tetrahedron and all neighbors of the "test" tetrahedron (the test tetrahedron is an element of a mesh). Collision is checked repeatedly among the neighbors of neighbors until no new collisions are found. As a consequence, the collision check happens several dozen times in a row. The UNEXPECTED VALUES message appears in the context of this repeated checking.
I mention this because the UNEXPECTED VALUES message does NOT appear if I write a separate script that checks nothing but the above-specified "target" and "test" tetrahedrons in isolation. Unfortunately, I believe this to be a memory handling error. I believe this because I tried commenting the message out and running openGJK in the full context of my application. This application iterates the above neighbor-collision check for a mesh of "target" elements. I do this for several pairs of meshes. This means running openGJK several thousand times. On the 14th mesh-to-mesh collision analysis, MATLAB encounters an access violation error and crashes:
The full text of the crash report is included at the end of this comment. If I had to guess, the presence of this warning message in the context of a loop, but not in isolation, is the early warning sign of whatever's going wrong, which progresses until provoking a crash if the program is called enough times in a row.
MATLAB crash file:C:\Users\nwood\AppData\Local\Temp\matlab_crash_dump.2508-1:
Access violation detected at 2022-02-07 09:33:12 -0500
Configuration:
Crash Decoding : Disabled - No sandbox or build area path
Crash Mode : continue (default)
Default Encoding : windows-1252
Deployed : false
Graphics Driver : NVIDIA Corporation NVIDIA GeForce GTX 1650/PCIe/SSE2 Version 4.6.0 NVIDIA 496.76
Graphics card 1 : NVIDIA ( 0x10de ) NVIDIA GeForce GTX 1650 Version 30.0.14.9676 (2021-11-9)
Graphics card 2 : NVIDIA ( 0x10de ) NVIDIA GeForce GTX 1070 Version 30.0.14.9676 (2021-11-9)
Graphics card 3 : Citrix Systems Inc. ( 0x5853 ) Citrix Indirect Display Adapter Version 12.40.44.247 (2019-1-23)
Java Version : Java 1.8.0_202-b08 with Oracle Corporation Java HotSpot(TM) 64-Bit Server VM mixed mode
MATLAB Architecture : win64
MATLAB Entitlement ID : 1334657
MATLAB Root : C:\Program Files\MATLAB\R2020b
MATLAB Version : 9.9.0.1538559 (R2020b) Update 3
OpenGL : hardware
Operating System : Microsoft Windows 10 Home
Process ID : 2508
Processor ID : x86 Family 143 Model 113 Stepping 0, AuthenticAMD
Session Key : 55a00498-7965-4960-b106-490327c7ff92
Window System : Version 10.0 (Build 19042)
Fault Count: 1
Abnormal termination:
Access violation
Current Thread: 'MCR 0 interpreter thread' id 11908
Register State (from fault):
RAX = 0000000000000030 RBX = 0000000000000000
RCX = 00000016d9ff6d90 RDX = 00000016d9ff6d60
RSP = 00000016d9ff6bc0 RBP = 00000016d9ff6c40
RSI = 0000000000000004 RDI = 0000000000000000
R8 = 00000016d9ff6e20 R9 = 0000000000000040
R10 = 00000000000002c0 R11 = bd00840a12548001
R12 = 000001cdbc37ff20 R13 = 0000000000000000
R14 = 0000000000000000 R15 = 000001cdb683a120
RIP = 00000000002746d5 EFL = 00010206
CS = 0033 FS = 0053 GS = 002b
Stack Trace (from fault):
[ 0] 0x00000000002746d5 F:\mirror\work mirror\work files\adaptive mesh 3D\troubleshoot supermesh\openGJK.mexw64+00018133
[ 1] 0x00000000002755b2 F:\mirror\work mirror\work files\adaptive mesh 3D\troubleshoot supermesh\openGJK.mexw64+00021938 mexFunction+00000466
[ 2] 0x00007ff8e72ea289 C:\Program Files\MATLAB\R2020b\bin\win64\libmex.dll+00565897 mexfile::Inspector::needs_upgrade+00015977
[ 3] 0x00007ff8e72eb67b C:\Program Files\MATLAB\R2020b\bin\win64\libmex.dll+00571003 MexRetrieveVersion+00003579
[ 4] 0x00007ff8e72eb7ec C:\Program Files\MATLAB\R2020b\bin\win64\libmex.dll+00571372 MexRetrieveVersion+00003948
[ 5] 0x00007ff8e72eb9b4 C:\Program Files\MATLAB\R2020b\bin\win64\libmex.dll+00571828 MexRetrieveVersion+00004404
[ 6] 0x00007ff8e72cc209 C:\Program Files\MATLAB\R2020b\bin\win64\libmex.dll+00442889 mexUnlock_800+00023993
[ 7] 0x00007ff8e79226c1 bin\win64\pgo\m_dispatcher.dll+00665281 Mfh_file::dispatch_file_common+00000165
[ 8] 0x00007ff8e7921d62 bin\win64\pgo\m_dispatcher.dll+00662882 Mfh_error::lookup+00006498
[ 9] 0x00007ff8e7922615 bin\win64\pgo\m_dispatcher.dll+00665109 Mfh_file::dispatch+00000045
[ 10] 0x00007ff8e48e8208 bin\win64\pgo\m_lxe.dll+00557576 CGGBuiltinImpl+00181784
[ 11] 0x00007ff8e48cb484 bin\win64\pgo\m_lxe.dll+00439428 CGGBuiltinImpl+00063636
[ 12] 0x00007ff8e49e7861 bin\win64\pgo\m_lxe.dll+01603681 mwboost::serialization::singleton<mwboost::serialization::extended_type_info_typeidMathWorks::lxe::PreLineExecutionEvent >::singleton<mwboost::serialization::extended_type_info_typeidMathWorks::lxe::PreLineExecutionEvent >+00649937
[ 13] 0x00007ff8e48c9cfb bin\win64\pgo\m_lxe.dll+00433403 CGGBuiltinImpl+00057611
[ 14] 0x00007ff8e48c7eb9 bin\win64\pgo\m_lxe.dll+00425657 CGGBuiltinImpl+00049865
[ 15] 0x00007ff8e48cd185 bin\win64\pgo\m_lxe.dll+00446853 CGGBuiltinImpl+00071061
[ 16] 0x00007ff8e48cc19c bin\win64\pgo\m_lxe.dll+00442780 CGGBuiltinImpl+00066988
[ 17] 0x00007ff8e4a82fdd bin\win64\pgo\m_lxe.dll+02240477 mwboost::archive::detail::oserializermwboost::archive::binaryTerm_oarchive,MathWorks::lxe::MatlabIrTree::oserializermwboost::archive::binaryTerm_oarchive,MathWorks::lxe::MatlabIrTree+00023157
[ 18] 0x00007ff8e48cbff0 bin\win64\pgo\m_lxe.dll+00442352 CGGBuiltinImpl+00066560
[ 19] 0x00007ff8e4a2964d bin\win64\pgo\m_lxe.dll+01873485 mwboost::archive::detail::oserializermwboost::archive::binaryTerm_oarchive,MathWorks::lxe::ClosedAbstractionFunctionDescriptorOwningIrTree::oserializermwboost::archive::binaryTerm_oarchive,MathWorks::lxe::ClosedAbstractionFunctionDescriptorOwningIrTree+00050949
[ 20] 0x00007ff8e79226c1 bin\win64\pgo\m_dispatcher.dll+00665281 Mfh_file::dispatch_file_common+00000165
[ 21] 0x00007ff8e7921d62 bin\win64\pgo\m_dispatcher.dll+00662882 Mfh_error::lookup+00006498
[ 22] 0x00007ff8e7922615 bin\win64\pgo\m_dispatcher.dll+00665109 Mfh_file::dispatch+00000045
[ 23] 0x00007ff8e48e875f bin\win64\pgo\m_lxe.dll+00558943 CGGBuiltinImpl+00183151
[ 24] 0x00007ff8e48e7e37 bin\win64\pgo\m_lxe.dll+00556599 CGGBuiltinImpl+00180807
[ 25] 0x00007ff8e48cb484 bin\win64\pgo\m_lxe.dll+00439428 CGGBuiltinImpl+00063636
[ 26] 0x00007ff8e4a0bb61 bin\win64\pgo\m_lxe.dll+01751905 MathWorks::lxe::ShutdownLxeEngine+00033653
[ 27] 0x00007ff8e48cf20d bin\win64\pgo\m_lxe.dll+00455181 CGGBuiltinImpl+00079389
[ 28] 0x00007ff8e48ce4dd bin\win64\pgo\m_lxe.dll+00451805 CGGBuiltinImpl+00076013
[ 29] 0x00007ff8e48bd187 bin\win64\pgo\m_lxe.dll+00381319 CGGBuiltinImpl+00005527
[ 30] 0x00007ff8e48bcd8f bin\win64\pgo\m_lxe.dll+00380303 CGGBuiltinImpl+00004511
[ 31] 0x00007ff8e48c8b2c bin\win64\pgo\m_lxe.dll+00428844 CGGBuiltinImpl+00053052
[ 32] 0x00007ff8e48cd185 bin\win64\pgo\m_lxe.dll+00446853 CGGBuiltinImpl+00071061
[ 33] 0x00007ff8e48cc19c bin\win64\pgo\m_lxe.dll+00442780 CGGBuiltinImpl+00066988
[ 34] 0x00007ff8e49e2c1f bin\win64\pgo\m_lxe.dll+01584159 mwboost::serialization::singleton<mwboost::serialization::extended_type_info_typeidMathWorks::lxe::PreLineExecutionEvent >::singleton<mwboost::serialization::extended_type_info_typeidMathWorks::lxe::PreLineExecutionEvent >+00630415
[ 35] 0x00007ff8e49e2b07 bin\win64\pgo\m_lxe.dll+01583879 mwboost::serialization::singleton<mwboost::serialization::extended_type_info_typeidMathWorks::lxe::PreLineExecutionEvent >::singleton<mwboost::serialization::extended_type_info_typeidMathWorks::lxe::PreLineExecutionEvent >+00630135
[ 36] 0x00007ff8e49e2a16 bin\win64\pgo\m_lxe.dll+01583638 mwboost::serialization::singleton<mwboost::serialization::extended_type_info_typeidMathWorks::lxe::PreLineExecutionEvent >::singleton<mwboost::serialization::extended_type_info_typeidMathWorks::lxe::PreLineExecutionEvent >+00629894
[ 37] 0x00007ff8e4a22d7c bin\win64\pgo\m_lxe.dll+01846652 mwboost::archive::detail::oserializermwboost::archive::binaryTerm_oarchive,MathWorks::lxe::ClosedAbstractionFunctionDescriptorOwningIrTree::oserializermwboost::archive::binaryTerm_oarchive,MathWorks::lxe::ClosedAbstractionFunctionDescriptorOwningIrTree+00024116
[ 38] 0x00007ff8e4a22d2a bin\win64\pgo\m_lxe.dll+01846570 mwboost::archive::detail::oserializermwboost::archive::binaryTerm_oarchive,MathWorks::lxe::ClosedAbstractionFunctionDescriptorOwningIrTree::oserializermwboost::archive::binaryTerm_oarchive,MathWorks::lxe::ClosedAbstractionFunctionDescriptorOwningIrTree+00024034
[ 39] 0x00007ff8e63b69ba bin\win64\pgo\m_lxe.dll+28666298 MathWorks::lxe::profiler::IMexProfilingSupport::~IMexProfilingSupport+00058926
[ 40] 0x00007ff8e739b609 C:\Program Files\MATLAB\R2020b\bin\win64\libmwbridge.dll+00177673 mnGetPrompt+00031273
[ 41] 0x00007ff8e7c111ff C:\Program Files\MATLAB\R2020b\bin\win64\iqm.dll+00463359 iqm::Iqm::instance+00001023
[ 42] 0x00007ff8e7c838b7 C:\Program Files\MATLAB\R2020b\bin\win64\iqm.dll+00932023 iqm::UserEvalPlugin::execute+00001351
[ 43] 0x00007ff8e7c37a3f C:\Program Files\MATLAB\R2020b\bin\win64\iqm.dll+00621119 iqm::Iqm::setupIqmFcnPtrs+00113615
[ 44] 0x00007ff8e7c431b0 C:\Program Files\MATLAB\R2020b\bin\win64\iqm.dll+00668080 iqm::Iqm::setupIqmFcnPtrs+00160576
[ 45] 0x00007ff8e7c06fc3 C:\Program Files\MATLAB\R2020b\bin\win64\iqm.dll+00421827 iqm::Iqm::create+00007235
[ 46] 0x00007ff8e7387a3e C:\Program Files\MATLAB\R2020b\bin\win64\libmwbridge.dll+00096830 ioReadLine+00000478
[ 47] 0x00007ff8e738781c C:\Program Files\MATLAB\R2020b\bin\win64\libmwbridge.dll+00096284 ioReadLine+00000188
[ 48] 0x00007ff8e739ba50 C:\Program Files\MATLAB\R2020b\bin\win64\libmwbridge.dll+00178768 mnGetCommandLineBuffer+00000304
[ 49] 0x00007ff8e739beda C:\Program Files\MATLAB\R2020b\bin\win64\libmwbridge.dll+00179930 mnParser+00000506
[ 50] 0x00007ff8e7a462f4 C:\Program Files\MATLAB\R2020b\bin\win64\mcr.dll+00549620 mcr_set_enableReadingFromStdin+00016084
[ 51] 0x00007ff8e79de7ad C:\Program Files\MATLAB\R2020b\bin\win64\mcr.dll+00124845 mcrFunctionSignature::set_signature+00103437
[ 52] 0x00007ff8e79fbaea C:\Program Files\MATLAB\R2020b\bin\win64\mcr.dll+00244458 mcrFunctionSignature::set_signature+00223050
[ 53] 0x00007ff8e7c64504 C:\Program Files\MATLAB\R2020b\bin\win64\iqm.dll+00804100 iqm::PackagedTaskPlugin::execute+00000084
[ 54] 0x00007ff8e7a403ce C:\Program Files\MATLAB\R2020b\bin\win64\mcr.dll+00525262 services::lmgr::exception::LicensingStartupException::~LicensingStartupException+00009822
[ 55] 0x00007ff8e7c37a3f C:\Program Files\MATLAB\R2020b\bin\win64\iqm.dll+00621119 iqm::Iqm::setupIqmFcnPtrs+00113615
[ 56] 0x00007ff8e7c07c42 C:\Program Files\MATLAB\R2020b\bin\win64\iqm.dll+00425026 iqm::Iqm::create+00010434
[ 57] 0x00007ff8e7c07421 C:\Program Files\MATLAB\R2020b\bin\win64\iqm.dll+00422945 iqm::Iqm::create+00008353
[ 58] 0x00007ff8e7a160dc C:\Program Files\MATLAB\R2020b\bin\win64\mcr.dll+00352476 mcrInstantiationError::operator=+00011756
[ 59] 0x00007ff8e7a16a3c C:\Program Files\MATLAB\R2020b\bin\win64\mcr.dll+00354876 mcrInstantiationError::operator=+00014156
[ 60] 0x00007ff8e7a143cc C:\Program Files\MATLAB\R2020b\bin\win64\mcr.dll+00345036 mcrInstantiationError::operator=+00004316
[ 61] 0x00007ff96f79a2a3 C:\Program Files\MATLAB\R2020b\bin\win64\mwboost_thread-vc141-mt-x64-1_70.dll+00041635 mwboost:
[ 62] 0x00007ff97c631bb2 C:\Windows\System32\ucrtbase.dll+00138162 configthreadlocale+00000146
[ 63] 0x00007ff97d137034 C:\Windows\System32\KERNEL32.DLL+00094260 BaseThreadInitThunk+00000020
[ 64] 0x00007ff97ed62651 C:\Windows\SYSTEM32\ntdll.dll+00337489 RtlUserThreadStart+00000033
This error was detected while a MEX-file was running. If the MEX-file
is not an official MathWorks function, please examine its source code
for errors. Please consult the External Interfaces Guide for information
on debugging MEX-files.
from opengjk.
Sorry for the late reply. I don't have access to a Matlab license anymore and I cannot test the solution.
I did use the C code many times in many for loops and I doubt there is a problem on that front.. perhaps the Matlab wrapper could be a source of memory errors.
The Mex wrapper is far from great, but I cannot see any memory leak there. My understanding is that mxCreateDoubleMatrix
is used correctly because is used against plhs
(see documentation). Therefore we don't need mxDestroyArray
.
From the he picture of your polyhedra it seems that they touch on an edge. Very little however. Perhaps that's where relaxing tolerances can help you get going.
from opengjk.
Related Issues (20)
- SoftwareX publication under review HOT 1
- Possible linker issue on Ubuntu 18.04 - Undefined Reference HOT 4
- [Feature Request] Returning Additional Information HOT 6
- False negative for penetrating boxes HOT 5
- contact information HOT 2
- bug in ADAPTIVEFP branch HOT 4
- Meaning of Minimal Distance for Collision HOT 1
- Adding Support for Spheres and Cylinders HOT 3
- Attempted to write a file into source HOT 1
- Feature: Witness points for distance query HOT 3
- Error in build: Invalid numeric armument '/Wunused-macros' HOT 3
- what algorithm is used by function hff? HOT 1
- User suggestion to speedup S2D
- Is this a numerical issue? HOT 5
- enhancement HOT 5
- Cannot make it work for Matlab under Ubunto20 HOT 1
- Error Using mex - Matlab under Linux HOT 3
- Compilation issues on CentOS 7 HOT 2
- Installation script for Linux installing openGJK to /usr/local HOT 1
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 opengjk.