GithubHelp home page GithubHelp logo

Comments (5)

oqilipo avatar oqilipo commented on July 4, 2024

PS: The libigl tutorial works fine (Build with 32 & 64 bit)

from gptoolbox.

alecjacobson avatar alecjacobson commented on July 4, 2024

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.

from gptoolbox.

oqilipo avatar oqilipo commented on July 4, 2024

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

mesh_boolean_example

Now I will test it on more complex meshes.

Thank you very much!

from gptoolbox.

alecjacobson avatar alecjacobson commented on July 4, 2024

Excellent! So what was the trick?

On Sat, Jun 18, 2016 at 10:08 AM, oqilipo [email protected] 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
#13 (comment),
or mute the thread
https://github.com/notifications/unsubscribe/ACI0mW-3p4-re7CKl3XuL36TuDWk9wT5ks5qM6dhgaJpZM4Ibanh
.

from gptoolbox.

oqilipo avatar oqilipo commented on July 4, 2024

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

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.