Closed oqilipo closed 8 years ago
PS: The libigl tutorial works fine (Build with 32 & 64 bit)
Could you paste the verbose compilation flags when compiling the tutorial (when it works) and the flags that the mex is using (when it fails)?
We should be able to find a difference.
Like in the other Issue I changed to the latest stable version of eigen:
Version: Boost: 1.60 CGAL: 4.8 Eigen: 3.2.8 libigl: https://github.com/libigl/libigl/tree/4ccac53005994f695eea123cd85e92be27caecb2
Now it works!
mesh_boolean_compile.m:
arch = '64';
msvc = '14';
boost_version = '1_60';
path_to_boost='C:\dev\boost';
cgal_version='4.8';
path_to_cgal=['C:\dev\CGAL-' cgal_version];
path_to_cork='C:\dev\cork';
path_to_eigen='C:\dev\eigen';
path_to_gmp =['C:\dev\CGAL-' cgal_version '\auxiliary\gmp'];
path_to_libigl = 'C:\dev\libigl';
MEXOPTS={'-v','-largeArrayDims','-DMEX'};
MSSE42='CXXFLAGS=$CXXFLAGS -msse4.2';
STDCPP11='CXXFLAGS=$CXXFLAGS -std=c++11';
BOOST_INC=sprintf('-I%s',path_to_boost);
BOOST_LIB=strsplit(sprintf('-L%s/lib%s-msvc-%s.0 -lboost_thread-vc%s0-mt-%s.lib -lboost_system-vc%s0-mt-%s.lib',...
path_to_boost, arch, msvc, msvc,boost_version, msvc,boost_version));
CGAL_INC=sprintf('-I%s/include',path_to_cgal);
CGAL_LIB=strsplit(sprintf('-L%s/lib -lCGAL-vc%s0-mt-%s.lib -lCGAL_Core-vc%s0-mt-%s.lib',...
path_to_cgal, msvc,cgal_version, msvc,cgal_version));
CGAL_FLAGS='CXXFLAGS=\$CXXFLAGS -frounding-math';
CORK_INC=sprintf('-I%s/src',path_to_cork);
EIGEN_INC=sprintf('-I%s',path_to_eigen);
GMP_INC=sprintf('-I%s/include',path_to_gmp);
GMP_LIB=strsplit(sprintf('-L%s/lib -llibgmp-10.lib -llibmpfr-4.lib',path_to_gmp));
LIBIGL_INC=sprintf('-I%s/include',path_to_libigl);
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{:}, MSSE42, STDCPP11, ...
BOOST_INC,BOOST_LIB{:}, ...
CGAL_INC,CGAL_LIB{:},CGAL_FLAGS, ...
EIGEN_INC, ...
GMP_INC, GMP_LIB{:},...
LIBIGL_BASE{:}, LIBIGL_LIBCGAL, LIBIGL_LIBCORK, ...
'mesh_boolean.cpp');
the log: mesh_boolean_compile.txt
mesh_boolean_example.m:
close all; clearvars; opengl hardware;
addpath(genpath('../'));
addpath(genpath('../../../matGeom'));
V1=[0 0 0;1 1 0;1 0 1;0 1 1];
F1=[1 2 3;1 3 4;1 4 2;4 3 2];
V2=[0.2770 0 1.1710;...
-0.1710 1.0000 0.2770;...
0.7230 0 -0.1710;...
1.1710 1.0000 0.7230];
F2=F1;
%% Plotting
PatchProps.EdgeColor = 'none';
PatchProps.FaceAlpha = 0.5;
PatchProps.EdgeLighting = 'none';
PatchProps.FaceLighting = 'gouraud';
figure('Units','pixels','Color','w','ToolBar','figure','renderer','opengl',...
'position', [1 1 800 600]);
subplot(2,2,1)
PatchProps.FaceColor = 'g';
patch('Faces', F1, 'Vertices',V1, PatchProps)
PatchProps.FaceColor = 'y';
patch('Faces', F2, 'Vertices',V2, PatchProps)
[W,H] = mesh_boolean(V1,F1,V2,F2, 'union');
subplot(2,2,2)
title('MB: union')
PatchProps.FaceColor = 'r';
patch('Faces', H, 'Vertices', W, PatchProps)
[W,H] = mesh_boolean(V1,F1,V2,F2, 'intersect');
subplot(2,2,3)
title('MB: intersect')
PatchProps.FaceColor = 'r';
patch('Faces', H, 'Vertices', W, PatchProps)
[W,H] = mesh_boolean(V1,F1,V2,F2, 'minus');
subplot(2,2,4)
title('MB: minus')
PatchProps.FaceColor = 'r';
patch('Faces', H, 'Vertices', W, PatchProps)
for i=1:4
subplot(2,2,i)
axis on; axis equal
H_Light(1) = light; H_Light(2) = light('Position', -1*(get(H_Light(1),'Position')));
view(3)
end
Now I will test it on more complex meshes.
Thank you very much!
Excellent! So what was the trick?
On Sat, Jun 18, 2016 at 10:08 AM, oqilipo notifications@github.com wrote:
Like in the other Issue I changed to the latest stable version of eigen:
Now it works!
mesh_boolean_compile.m:
arch = '64'; msvc = '14';
boost_version = '1_60'; path_to_boost='C:\dev\boost'; cgal_version='4.8'; path_to_cgal=['C:\dev\CGAL-' cgal_version]; path_to_cork='C:\dev\cork'; path_to_eigen='C:\dev\eigen'; path_to_gmp =['C:\dev\CGAL-' cgal_version '\auxiliary\gmp']; path_to_libigl = 'C:\dev\libigl';
MEXOPTS={'-v','-largeArrayDims','-DMEX'}; MSSE42='CXXFLAGS=$CXXFLAGS -msse4.2'; STDCPP11='CXXFLAGS=$CXXFLAGS -std=c++11';
BOOST_INC=sprintf('-I%s',path_to_boost); BOOST_LIB=strsplit(sprintf('-L%s/lib%s-msvc-%s.0 -lboost_thread-vc%s0-mt-%s.lib -lboost_system-vc%s0-mt-%s.lib',... path_to_boost, arch, msvc, msvc,boost_version, msvc,boost_version));
CGAL_INC=sprintf('-I%s/include',path_to_cgal); CGAL_LIB=strsplit(sprintf('-L%s/lib -lCGAL-vc%s0-mt-%s.lib -lCGAL_Core-vc%s0-mt-%s.lib',... path_to_cgal, msvc,cgal_version, msvc,cgal_version)); CGAL_FLAGS='CXXFLAGS=\$CXXFLAGS -frounding-math';
CORK_INC=sprintf('-I%s/src',path_to_cork);
EIGEN_INC=sprintf('-I%s',path_to_eigen);
GMP_INC=sprintf('-I%s/include',path_to_gmp); GMP_LIB=strsplit(sprintf('-L%s/lib -llibgmp-10.lib -llibmpfr-4.lib',path_to_gmp));
LIBIGL_INC=sprintf('-I%s/ include',path_to_libigl); 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{:}, MSSE42, STDCPP11, ... BOOST_INC,BOOST_LIB{:}, ... CGAL_INC,CGAL_LIB{:},CGAL_FLAGS, ... EIGEN_INC, ... GMP_INC, GMP_LIB{:},... LIBIGL_BASE{:}, LIBIGL_LIBCGAL, LIBIGL_LIBCORK, ... 'mesh_boolean.cpp');
the log: mesh_boolean_compile.txt https://github.com/alecjacobson/gptoolbox/files/321646/mesh_boolean_compile.txt
mesh_boolean_example.m:
close all; clearvars; opengl hardware;
addpath(genpath('../')); addpath(genpath('../../../matGeom'));
V1=[0 0 0;1 1 0;1 0 1;0 1 1];
F1=[1 2 3;1 3 4;1 4 2;4 3 2];
V2=[0.2770 0 1.1710;... -0.1710 1.0000 0.2770;... 0.7230 0 -0.1710;... 1.1710 1.0000 0.7230];
F2=F1;
%% Plotting PatchProps.EdgeColor = 'none';
PatchProps.FaceAlpha = 0.5; PatchProps.EdgeLighting = 'none'; PatchProps.FaceLighting = 'gouraud';
figure('Units','pixels','Color','w','ToolBar','figure','renderer','opengl',... 'position', [1 1 800 600]);
subplot(2,2,1) PatchProps.FaceColor = 'g'; patch('Faces', F1, 'Vertices',V1, PatchProps) PatchProps.FaceColor = 'y'; patch('Faces', F2, 'Vertices',V2, PatchProps)
[W,H] = mesh_boolean(V1,F1,V2,F2, 'union'); subplot(2,2,2) title('MB: union') PatchProps.FaceColor = 'r'; patch('Faces', H, 'Vertices', W, PatchProps)
[W,H] = mesh_boolean(V1,F1,V2,F2, 'intersect'); subplot(2,2,3) title('MB: intersect') PatchProps.FaceColor = 'r'; patch('Faces', H, 'Vertices', W, PatchProps)
[W,H] = mesh_boolean(V1,F1,V2,F2, 'minus'); subplot(2,2,4) title('MB: minus') PatchProps.FaceColor = 'r'; patch('Faces', H, 'Vertices', W, PatchProps)
for i=1:4 subplot(2,2,i) axis on; axis equal H_Light(1) = light; H_Light(2) = light('Position', -1*(get(H_Light(1),'Position'))); view(3) end
[image: mesh_boolean_example] https://cloud.githubusercontent.com/assets/15254908/16169799/324a1aa6-353c-11e6-803f-30d42e92e27f.png
Now I will test it on more complex meshes.
Thank you very much!
— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/alecjacobson/gptoolbox/issues/13#issuecomment-226928626, or mute the thread https://github.com/notifications/unsubscribe/ACI0mW-3p4-re7CKl3XuL36TuDWk9wT5ks5qM6dhgaJpZM4Ibanh .
see above: I've changed from the github mirror to the latest stable version of eigen: Version 3.2.8
Thanks a lot for you help.
PS: Because I've got Matlab 2016a yesterday, I've tested the same code in 2016a and MATLAB is staying "busy" without any output. But this may be a new issue ;-)
I thought it would be better to open a another issue for this because the errors are different.
Hope this is OK for you.
At the moment I only have access to another windows machine with a different setup: Windows10 MATLAB 2015a VS2015
Version: Boost: 1.60 CGAL: 4.8 Eigen: https://github.com/RLovelett/eigen/tree/aa826f047e42ce239c9b6887fbb0f709844805f1 libigl: https://github.com/libigl/libigl/tree/4ccac53005994f695eea123cd85e92be27caecb2
code looks like:
produces error C2248
Full mex log: mesh_boolean_error.txt
Many thanks in advance