GithubHelp home page GithubHelp logo

STL-offset issue about gptoolbox HOT 28 CLOSED

alecjacobson avatar alecjacobson commented on July 24, 2024
STL-offset issue

from gptoolbox.

Comments (28)

alecjacobson avatar alecjacobson commented on July 24, 2024

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.

from gptoolbox.

FeazAlkadi avatar FeazAlkadi commented on July 24, 2024

Thank you. I will see if i can compile it.

from gptoolbox.

FeazAlkadi avatar FeazAlkadi commented on July 24, 2024

Can you tell me how to install libigl?
Note: I'm wording on Matlab R2017b and Windows 7. (in case it matters)

Thank you

from gptoolbox.

alecjacobson avatar alecjacobson commented on July 24, 2024

from gptoolbox.

FeazAlkadi avatar FeazAlkadi commented on July 24, 2024

Is it this one?
https://github.com/libigl/libigl/

I f yes, I already did downloaded it. and tried to run (compile_gptoolbox_mex)
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

from gptoolbox.

oqilipo avatar oqilipo commented on July 24, 2024

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.

from gptoolbox.

FeazAlkadi avatar FeazAlkadi commented on July 24, 2024

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

from gptoolbox.

oqilipo avatar oqilipo commented on July 24, 2024

Try this code, but adjust the path of "libgl" & "eigen" before you run the script.

First download "eigen". Link above ^^^^

from gptoolbox.

FeazAlkadi avatar FeazAlkadi commented on July 24, 2024

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

from gptoolbox.

oqilipo avatar oqilipo commented on July 24, 2024

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';

from gptoolbox.

FeazAlkadi avatar FeazAlkadi commented on July 24, 2024

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?

from gptoolbox.

oqilipo avatar oqilipo commented on July 24, 2024

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];

from gptoolbox.

FeazAlkadi avatar FeazAlkadi commented on July 24, 2024

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!

from gptoolbox.

oqilipo avatar oqilipo commented on July 24, 2024

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');

from gptoolbox.

FeazAlkadi avatar FeazAlkadi commented on July 24, 2024

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?

from gptoolbox.

oqilipo avatar oqilipo commented on July 24, 2024

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.

from gptoolbox.

FeazAlkadi avatar FeazAlkadi commented on July 24, 2024

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];

from gptoolbox.

oqilipo avatar oqilipo commented on July 24, 2024

then edit the Matlab script:

path_to_eigen='C:\Users\faa23\Desktop\3D_DiskTop\MatlabCodes\iges (original)\eigen-eigen-';

and it should work

from gptoolbox.

FeazAlkadi avatar FeazAlkadi commented on July 24, 2024

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 ?

from gptoolbox.

oqilipo avatar oqilipo commented on July 24, 2024

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++

from gptoolbox.

FeazAlkadi avatar FeazAlkadi commented on July 24, 2024

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

from gptoolbox.

oqilipo avatar oqilipo commented on July 24, 2024

use:

mex -setup C++ 

to see, which compilers are available on your system

from gptoolbox.

FeazAlkadi avatar FeazAlkadi commented on July 24, 2024

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!

from gptoolbox.

oqilipo avatar oqilipo commented on July 24, 2024

Yes, Microsoft Windows SDK 7.1 is not supported as of R2017b.
See: https://www.mathworks.com/support/compilers.html

from gptoolbox.

oqilipo avatar oqilipo commented on July 24, 2024

try this compiler, works for me:
https://www.mathworks.com/matlabcentral/fileexchange/52848-matlab-support-for-mingw-w64-c-c++-compiler

from gptoolbox.

FeazAlkadi avatar FeazAlkadi commented on July 24, 2024

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

from gptoolbox.

oqilipo avatar oqilipo commented on July 24, 2024

You may open a new issue for that problem and close this issue.

from gptoolbox.

FeazAlkadi avatar FeazAlkadi commented on July 24, 2024

Thank you so much oqilipo for the help.

from gptoolbox.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    πŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.