Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

igl.trimesh_geodistance throws an exception when set to method = 'heat' #9

Open
ioannaMitropoulou opened this issue Jun 14, 2020 · 9 comments

Comments

@ioannaMitropoulou
Copy link

I run the example geodistance.py in the 'scripts' folder, with the igl.trimesh_geodistance set to method = 'heat'. It throws an exception for all the input geometry that I tried it with during the
igl::heat_geodesics_precompute(V, F, t, data);. Any ideas on how I can use this method?

Thanks,
Ioanna

@tomvanmele
Copy link
Member

can you provide more information about the input?
on my test samples the method works fine...

perhaps you should also update the repo regularly, because that example has been moved out of the scripts folder since almost a week...

there are docs now and you can find them here
https://blockresearchgroup.github.io/compas_libigl/index.html

@ioannaMitropoulou
Copy link
Author

ioannaMitropoulou commented Jun 15, 2020

Thanks for the tip, I updated the repository.
However, I still get the error.
I am using the example geodistance.py.

With the new updates I had to change the geodistance/__init__.py
line 38, from V, F = M to V, F = M.to_vertices_and_faces(), otherwise it throws a Python error.

Other than that I didn't change any of the inputs. Then it works well with the method = 'exact'

But when I change the method to
distance = igl.trimesh_geodistance(mesh, source, 'heat')

it throws an exception:
Capture

In the console, it says Error: Numerical issue

When I put the breakpoints to see where it is coming from, I find that it is thrown in the igl file heat_geodesics.cpp, in igl::heat_geodesics_precompute. There the exception is thrown in line 89 in the igl::min_quad_with_fixed_precompute

I am not sure what is the proper way to report this error, so I paste the stack below.

std::vector<std::vector<int,std::allocator<int> >,std::allocator<std::vector<int,std::allocator<int> > > >::operator[](const unsigned long long) vector:1500
igl::slice<double,double>(const Eigen::SparseMatrix<double,0,int> &,const Eigen::Matrix<int,-1,1,0,-1,1> &,const Eigen::Matrix<int,-1,1,0,-1,1> &,Eigen::SparseMatrix<double,0,int> &) slice.cpp:65
igl::slice<Eigen::SparseMatrix<double,0,int>,Eigen::Matrix<int,-1,1,0,-1,1>,Eigen::SparseMatrix<double,0,int> >(const Eigen::SparseMatrix<double,0,int> &,const Eigen::DenseBase<Eigen::Matrix<int,-1,1,0,-1,1> > &,const int,Eigen::SparseMatrix<double,0,int> &) slice.cpp:164
igl::min_quad_with_fixed_precompute<double,Eigen::Matrix<int,-1,1,0,-1,1> >(const Eigen::SparseMatrix<double,0,int> &,const Eigen::MatrixBase<Eigen::Matrix<int,-1,1,0,-1,1> > &,const Eigen::SparseMatrix<double,0,int> &,const bool,igl::min_quad_with_fixed_data<double> &) min_quad_with_fixed.cpp:137
igl::heat_geodesics_precompute<Eigen::Matrix<double,-1,-1,1,-1,-1>,Eigen::Matrix<int,-1,-1,1,-1,-1>,double>(const Eigen::MatrixBase<Eigen::Matrix<double,-1,-1,1,-1,-1> > &,const Eigen::MatrixBase<Eigen::Matrix<int,-1,-1,1,-1,-1> > &,const double,igl::HeatGeodesicsData<double> &) heat_geodesics.cpp:89
trimesh_geodistance_heat(Matrix<double,-1,-1,1,-1,-1>,Matrix<int,-1,-1,1,-1,-1>,int) geodistance.cpp:45
pybind11::detail::argument_loader<Eigen::Matrix<double,-1,-1,1,-1,-1>,Eigen::Matrix<int,-1,-1,1,-1,-1>,int>::call_impl<Eigen::Matrix<double,-1,1,0,-1,1>,Eigen::Matrix<double,-1,1,0,-1,1> (__cdecl*&)(Eigen::Matrix<double,-1,-1,1,-1,-1>,Eigen::Matrix<int,-1,-1,1,-1,-1>,int),0,1,2,pybind11::detail::void_type>(Eigen::Matrix<double,-1,1,0,-1,1> (*&)(Eigen::Matrix<double,-1,-1,1,-1,-1>, Eigen::Matrix<int,-1,-1,1,-1,-1>, int),integer_sequence<unsigned __int64,0,1,2>,pybind11::detail::void_type &&) cast.h:1960
pybind11::detail::argument_loader<Eigen::Matrix<double,-1,-1,1,-1,-1>,Eigen::Matrix<int,-1,-1,1,-1,-1>,int>::call<Eigen::Matrix<double,-1,1,0,-1,1>,pybind11::detail::void_type,Eigen::Matrix<double,-1,1,0,-1,1> (__cdecl*&)(Eigen::Matrix<double,-1,-1,1,-1,-1>,Eigen::Matrix<int,-1,-1,1,-1,-1>,int)>(Eigen::Matrix<double,-1,1,0,-1,1> (*&)(Eigen::Matrix<double,-1,-1,1,-1,-1>, Eigen::Matrix<int,-1,-1,1,-1,-1>, int)) cast.h:1937
<lambda_e8a7bd83d61d296c0a6b518f8aa5e02c>::operator()(pybind11::detail::function_call &) pybind11.h:159
<lambda_e8a7bd83d61d296c0a6b518f8aa5e02c>::<lambda_invoker_cdecl>(pybind11::detail::function_call &) pybind11.h:166
pybind11::cpp_function::dispatcher(_object *,_object *,_object *) pybind11.h:624
_PyMethodDef_RawFastCallKeywords(PyMethodDef *,_object *,_object *const *,long long,_object *) 0x00007ffc904371ea
call_function(_object ***,long long,_object *) 0x00007ffc90504192
_PyEval_EvalFrameDefault(_frame *,int) 0x00007ffc904ff2f6
_PyEval_EvalCodeWithName(_object *,_object *,_object *,_object *const *,long long,_object *const *,_object *const *,long long,int,_object *const *,long long,_object *,_object *,_object *,_object *) 0x00007ffc90502f75
_PyFunction_FastCallKeywords(_object *,_object *const *,long long,_object *) 0x00007ffc90436bfb
call_function(_object ***,long long,_object *) 0x00007ffc9050432f
_PyEval_EvalFrameDefault(_frame *,int) 0x00007ffc90501128
_PyEval_EvalCodeWithName(_object *,_object *,_object *,_object *const *,long long,_object *const *,_object *const *,long long,int,_object *const *,long long,_object *,_object *,_object *,_object *) 0x00007ffc90502f75
run_mod(_mod *,_object *,_object *,_object *,PyCompilerFlags *,_arena *) 0x00007ffc9055dced
PyRun_FileExFlags(_iobuf *,const char *,int,_object *,_object *,int,PyCompilerFlags *) 0x00007ffc9055d967
PyRun_SimpleFileExFlags(_iobuf *,const char *,int,PyCompilerFlags *) 0x00007ffc9055b8de
PyRun_AnyFileExFlags(_iobuf *,const char *,int,PyCompilerFlags *) 0x00007ffc9055a543
pymain_run_filename(_PyMain *,PyCompilerFlags *) 0x00007ffc903b89c0
pymain_run_python(_PyMain *) 0x00007ffc903bcf4a
pymain_main(_PyMain *) 0x00007ffc903bdb92
Py_Main(int,wchar_t **) 0x00007ffc903bdd97
__scrt_common_main_seh() 0x00007ff7fafd14f8
BaseThreadInitThunk 0x00007ffd36047bd4
RtlUserThreadStart 0x00007ffd3654ce51

@tomvanmele
Copy link
Member

With the new updates I had to change the geodistance/init.py
line 38, from V, F = M to V, F = M.to_vertices_and_faces(), otherwise it throws a Python error.

i believe that is because you don't have the very latest version of COMPAS...

if you can't update, better would be to convert your mesh to a tuple of vertices and faces before feeding it to the function, rather than change the line you mentioned in the function.

so do i understand correctly that you get this error with the tubemesh example in the repo?

@ioannaMitropoulou
Copy link
Author

Ok, thanks, I changed that and restored the __init__.py to its original version. Yes, the error comes with the tubemesh.obj . I also tried other meshes though and the same error comes up

@tomvanmele
Copy link
Member

can you try using source = 0 instead of source = mesh.get_any_vertex()

@ioannaMitropoulou
Copy link
Author

Thanks, I just tried that. Unfortunately, I still get the error for any source vertex index I pick.

@tomvanmele
Copy link
Member

do the other examples work?

@ioannaMitropoulou
Copy link
Author

ioannaMitropoulou commented Jun 15, 2020

Yes, all the other examples seem to work well.
(I only had to change the name of the function in curvature\__init__.py, line 35 from _trimesh_gaussian_curvature to _gaussian so that it matches the import.) Other than that I have no problem with the other examples

@tomvanmele
Copy link
Member

not sure what is going on. i cannot reproduce the error. will try on windows...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants