Closed FeazAlkadi closed 6 years ago
This function is needs to be compiled. Travel to the mex/
folder and checkout the README there.
It might take a little effort to compile these on Windows, but you could have a look at compile_gptoolbox
.
You'll definitely need to install libigl and make sure those are properly included.
Thank you. I will see if i can compile it.
Can you tell me how to install libigl? Note: I'm wording on Matlab R2017b and Windows 7. (in case it matters)
Thank you
It’s a header only library so mostly you just need to download it
On Tue, Jan 2, 2018 at 12:57 PM FeazAlkadi notifications@github.com wrote:
Can you tell me how to install libigl? Note: I'm wording on Matlab R2017b and Windows 7.
Thank you
— You are receiving this because you commented.
Reply to this email directly, view it on GitHub https://github.com/alecjacobson/gptoolbox/issues/44#issuecomment-354831261, or mute the thread https://github.com/notifications/unsubscribe-auth/ACI0mU5h5dEHvjPaiR6nid6CnGqucg9pks5tGm3-gaJpZM4RQySn .
Is it this one? https://github.com/libigl/libigl/
I f yes, I already did downloaded it. and tried to run (_compile_gptoolboxmex) But I got this error! Error using find_first_path (line 8) Could not find path
Error in path_to_libigl (line 8) s = find_first_path({'/usr/local/igl/libigl/','/usr/local/libigl/'});
Error in gptoolbox_mexopts (line 51) use_libigl_static_library = exist([path_to_libigl '/lib/libigl.a'],'file')~=0;
Error in compile_gptoolbox_mex (line 1) [all_opts,use_libigl_static_library] = gptoolbox_mexopts();
so should I save it in a specific place on my PC ? Thanks a lot
Try this code, but adjust the path of "libgl" & "eigen" before you run the script.
clearvars
eigen_version='07105f7124f9';
path_to_eigen=['C:\dev\eigen-eigen-' eigen_version];
path_to_libigl='C:\dev\libigl';
%%
MEXOPTS={'-v','-largeArrayDims','-DMEX'};
EIGEN_INC= ['-I' path_to_eigen];
LIBIGL_INC=['-I' path_to_libigl '\include'];
LIBIGL_FLAGS='-DIGL_SKIP';
LIBIGL_LIB={'-DIGL_SKIP'};
LIBIGL_LIBMATLAB='-DIGL_SKIP';
LIBIGL_LIBCGAL='-DIGL_SKIP';
LIBIGL_LIBCORK='-DIGL_NO_CORK';
LIBIGL_BASE={LIBIGL_INC, LIBIGL_FLAGS,LIBIGL_LIB{:}, LIBIGL_LIBMATLAB};
mex( ...
MEXOPTS{:}, ...
LIBIGL_BASE{:},EIGEN_INC, ...
'signed_distance.cpp');
Works for me with MATLAB R2017b & Microsoft Visual C++ 2015 Professional.
Hi oqilipo It started to build with Microsoft compiler . But I got the next error: Error using mex signed_distance.cpp C:\Users\faa23\Desktop\MatlabCodes\libigl\include\igl/per_vertex_normals.h(11) : fatal error C1083: Cannot open include file: 'Eigen/Core': No such file or directory
Error in Untitled (line 22) mex( ...
Do you have any idea what is this error about ?
Thank you so much
Try this code, but adjust the path of "libgl" & "eigen" before you run the script.
First download "eigen". Link above ^^^^
I did downloaded it. and first part worked fine. clearvars
eigen_version='07105f7124f9'; path_to_eigen=['C:\dev\eigen-eigen-' eigen_version];
path_to_libigl='C:\dev\libigl';
The problem is in Line 22 i think
The problem is that the compiler does not find eigen:
Cannot open include file: 'Eigen/Core
Did you adjust version of eigen to the version you have downloaded:
eigen_version='07105f7124f9';
Did you adjust the path to the location on your computer.
path_to_eigen=['C:\dev\eigen-eigen-' eigen_version];
path_to_libigl='C:\dev\libigl';
I did all of that. I downloaded both, so they came as eigen-eigen-5a0156e40feb and libigl-master. So changed names as libigl and eigen to be easier ! then I put eigen_version as: eigen_version='5a0156e40feb'; I got eigen_version from the folder name before I change it, is that right?
then I put the path as: path_to_eigen=['C:\Users\faa23\Desktop\MatlabCodes\eigen' eigen_version]; path_to_libigl='C:\Users\faa23\Desktop\MatlabCodes\libigl';
But still get this error: Error using mex signed_distance.cpp C:\Users\faa23\Desktop\MatlabCodes\libigl\include\igl/per_vertex_normals.h(11) : fatal error C1083: Cannot open include file: 'Eigen/Core': No such file or directory
Error in Untitled (line 22) mex( ...
Did i do anything wrong?
path_to_eigen=['C:\Users\faa23\Desktop\MatlabCodes\eigen' eigen_version];
Most likely:
path_to_eigen=['C:\Users\faa23\Desktop\MatlabCodes\eigen-eigen-' eigen_version];
Do you think the path to Core is the problem here? maybe the Forward slash (Eigen/Core) should be a backslash(Eigen\Core) inside some function. I tried to find that to change it and see, but couldn't!
Try this code. If the assertion in line 7 fails, the path of eigen is wrong.
clearvars
eigen_version='5a0156e40feb';
path_to_eigen=['C:\Users\faa23\Desktop\MatlabCodes\eigen-eigen-' eigen_version];
% Check if the eigen path is correct
assert(exist([path_to_eigen '\Eigen\Core'],'file')==2)
path_to_libigl='C:\Users\faa23\Desktop\MatlabCodes\libigl';
%%
MEXOPTS={'-v','-largeArrayDims','-DMEX'};
EIGEN_INC= ['-I' path_to_eigen];
LIBIGL_INC=['-I' path_to_libigl '\include'];
LIBIGL_FLAGS='-DIGL_SKIP';
LIBIGL_LIB={'-DIGL_SKIP'};
LIBIGL_LIBMATLAB='-DIGL_SKIP';
LIBIGL_LIBCGAL='-DIGL_SKIP';
LIBIGL_LIBCORK='-DIGL_NO_CORK';
LIBIGL_BASE={LIBIGL_INC, LIBIGL_FLAGS,LIBIGL_LIB{:}, LIBIGL_LIBMATLAB};
mex( ...
MEXOPTS{:}, ...
LIBIGL_BASE{:},EIGEN_INC, ...
'signed_distance.cpp');
Unfortunately it does fail, I got the following error. !!!
Error using assertion_check (line 7) Assertion failed.
Is there any way to detect the mistake ? or fix it? do you think I should delete all other Microsoft Visual C++ except Microsoft Visual C++ 2015 Professional?
No, at the moment the problem is that the path of eigen is wrong.
Post the full path of the file .../Eigen/Core how it appears on your harddisk.
Here it is:
C:\Users\faa23\Desktop\3D_DiskTop\MatlabCodes\iges (original)\eigen-eigen-\Eigen I can't go inside Core, because its a file not a folder
so my code is path_to_eigen=['C:\Users\faa23\Desktop\3D_DiskTop\MatlabCodes\iges (original)\eigen-eigen-',eigen_version];
then edit the Matlab script:
path_to_eigen='C:\Users\faa23\Desktop\3D_DiskTop\MatlabCodes\iges (original)\eigen-eigen-';
and it should work
the path does work !!! Thank you so much
and its started building with Microsoft Windows SDK 7.1. Building with 'Microsoft Windows SDK 7.1 (C++)'.
BUT, now i got the following error .
Error using mex signed_distance.cpp c:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\INCLUDE\intrin.h(26) : fatal error C1083: Cannot open include file: 'ammintrin.h': No such file or directory
Error in Untitled (line 25) mex( ...
Do you have an idea why is it happening ?
Maybe try a different compiler first. Type in the command window in Matlab:
mex -setup:'C:\Program Files\MATLAB\R2017b\bin\win64\mexopts\msvcpp2015.xml' C++
I get the following :
Error using mex MEX cannot use compiler 'Microsoft Visual C++ 2015' because that compiler is not found.
so I will download it and see
use:
mex -setup C++
to see, which compilers are available on your system
Do you know where can i download Microsoft Visual C++ 2015 compiler ?
I run mex -setup C++ and got
MEX configured to use 'Microsoft Windows SDK 7.1 (C++)' for C++ language compilation. Warning: The MATLAB C and Fortran API has changed to support MATLAB variables with more than 2^32-1 elements. You will be required to update your code to utilize the new API. You can find more information about this at: http://www.mathworks.com/help/matlab/matlab_external/upgrading-mex-files-to-use-64-bit-api.html.
Seems like I don't have Microsoft Visual C++ 2015!
Yes, Microsoft Windows SDK 7.1 is not supported as of R2017b. See: https://www.mathworks.com/support/compilers.html
try this compiler, works for me: https://www.mathworks.com/matlabcentral/fileexchange/52848-matlab-support-for-mingw-w64-c-c++-compiler
the functions are runing now after installing Microsoft Visual C++ 2015 and I got the SF and SV which i was looking for in this example http://www.alecjacobson.com/weblog/?p=4708
But when i run the second section of the script to plot the STL and see it
clf; hold on; t = tsurf(F,V,'EdgeColor','none',fsoft, 'FaceVertexCData',repmat(blue,size(V,1),1),'FaceAlpha',1+(iso<0)(0.35-1),fphong); ts = tsurf(SF,SV,'EdgeAlpha',0.2+(iso<0)(0-0.2),fsoft,'FaceVertexCData',repmat(orange,size(SV,1),1),fphong,'FaceAlpha',1+(iso>0)(0.2-1)); apply_ambient_occlusion(ts); hold off; axis equal; view(-20,20) camlight; t.SpecularStrength = 0.04; l = light('Position',[5 -5 10],'Style','local'); add_shadow(t,l,'Color',0.8[1 1 1],'Fade','local','Ground',[0 0 -1 min([V(:,3);SV(:,3)])]); set(gca,'pos',[0 0 1 1]) set(gca,'Visible','off'); set(gcf,'Color','w'); drawnow;
I get this error
Error using matlab.graphics.primitive.Patch/set Error setting property 'FaceVertexCData' of class 'Patch': Value must be an Nx1 or Nx3 array of numeric type
Error in tsurf (line 130) set(t_copy,varargin{v:end});
Error in Untitled (line 29) t = tsurf(F,V,'EdgeColor','none',fsoft, 'FaceVertexCData',repmat('blue',size(V,1),1),'FaceAlpha',1+(iso<0)*(0.35-1),fphong);
Thought V,F,SV and SF are all Nx3 array of type double Do you have an idea what is going on???
And as usual i really appreciate your time
You may open a new issue for that problem and close this issue.
Thank you so much oqilipo for the help.
Hello Professor Jacobson, First of all, I would like to thank you for making the great gptoolbox.
I have a surface in STL file format and would like to offset it as in the following example:
(Offset surface of triangle mesh in matlab) http://www.alecjacobson.com/weblog/?p=4708
The thing is, when I run the example I get the following error:
Attempt to execute SCRIPT signed_distance as a function: C:\Users\faa23\Desktop\MatlabCodes\signed_distance.m
Error in Untitled4 (line 16) D = signed_distance(BC,V,F);
Can you please tell me what should I do to make it work?
Thank you so much