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

Unexpected Standard exception What() is:vector when calling mex principal_curvature #139

Open
paul0noah opened this issue Sep 16, 2022 · 2 comments

Comments

@paul0noah
Copy link

paul0noah commented Sep 16, 2022

Hi,
I want to use the mex files (especially principal_curvatures) in Matlab on my M1 Pro Macbook Pro. I am running Matlab 2019b.
I installed and build using the following steps:

  • download this repo
  • terminal at mex folder
  • ran cmake and make as described here: Compiling mex on M1 Mac #130 (successfull build)
  • add gptoolbox folders to matlab path

I have the following simple tetrahedron as a shape

V = [0.1 0 0;
0 1 0;
0.9 0 0;
0.5 0.5 0.5];
F = [1 2 3;
1 4 2;
1 3 4;
3 2 4];

When calling principal curvatures as follows:
[PD1,PD2,PV1,PV2] = principal_curvature(V, F-1);
Matlab returns:

Unexpected Standard exception from MEX file.
What() is:vector
..

Is there a fix for this?

@alecjacobson
Copy link
Owner

First, you should just call:

[PD1,PD2,PV1,PV2] = principal_curvature(V, F);

However, this will still crash on your example. I think this is an edge case of principal_curvature and maybe in turn igl::principal_curvature which works by fitting a small neighborhood of vertices. I'm guessing that having only 4 vertices total is making it confused. @sgsellan do you know?

@paul0noah
Copy link
Author

paul0noah commented Sep 16, 2022

Hi @alecjacobson ,
thanks for the fast reply!
I tested it with a larger shape and works indeed :)

I also did some digging:
Error occurs in these lines (std::vector is accessed out of range)

This is caused since

curvDir[i]

is never initialized due to some if (vv.size() < 6) in these lines.

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