You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
155 lines
4.6 KiB
155 lines
4.6 KiB
%% Build Cpp MEX File with CGAL library
|
|
dbstop if error
|
|
opt_load = 0;
|
|
|
|
if opt_load ==0
|
|
include1 = ['-I', 'C:\dev\vcpkg\installed\x64-windows\include'];
|
|
include2 = ['-I', 'C:\dev\vcpkg\installed\x64-windows\include\eigen3'];
|
|
include3 = ['-I', 'C:\dev\vcpkg\installed\x64-windows\lib\auxiliary\gmp\include'];
|
|
include4 = ['-I', 'F:\project\7-current_opt\CVT-KWP\include\'];
|
|
include5 = ['-I', 'C:\Program Files\OpenMesh 9.0\include'];
|
|
include6 = ['-I', 'F:\library\libigl\include'];
|
|
include7 = ['-I', 'F:\library\geogram-main\src\lib'];
|
|
include8 = ['-I', 'F:\project\7-current_opt\CVT-KWP\3rd\TetWild\include'];
|
|
|
|
% lib2 = ['-L', 'C:\dev\vcpkg\installed\x64-windows\lib\auxiliary\gmp\lib'];
|
|
% lib21 = ['-l', 'libgmp-10.lib'];
|
|
% lib22 = ['-l', 'libmpfr-4.lib'];
|
|
lib2 = ['-L', 'C:\dev\vcpkg\installed\x64-windows\lib'];
|
|
lib21 = ['-l', 'gmp.lib'];
|
|
lib22 = ['-l', 'mpfr.lib'];
|
|
|
|
lib1 = ['-L', 'C:\Program Files\OpenMesh 9.0\lib'];
|
|
lib11 = ['-l', 'OpenMeshCore.lib'];
|
|
lib12 = ['-l', 'OpenMeshTools.lib'];
|
|
lib3 = ['-L', 'F:\library\geogram-main\build\lib\Release'];
|
|
lib31 = ['-l', 'geogram.lib'];
|
|
lib32 = ['-l', 'geogram_gfx.lib'];
|
|
lib33 = ['-l', 'geogram_num_3rdparty.lib'];
|
|
lib34 = ['-l', 'exploragram.lib'];
|
|
|
|
|
|
mex('-v', include1, include2, include3, include4, include5, include6, include7, include8, ...
|
|
lib2,lib21,lib2,lib22, lib1,lib11,lib1,lib12, 'mexVoronoi.cpp');
|
|
% mex('-v', include1, include3, lib2,lib21,lib2,lib22, 'mexVD.cpp');
|
|
|
|
% mex -v CXXFLAGS="$CXXFLAGS -Wall" ...
|
|
% '-IC:\dev\vcpkg\installed\x64-windows\include' ...
|
|
% '-IC:\dev\vcpkg\installed\x64-windows\lib\auxiliary\gmp\include' ...
|
|
% '-LC:\dev\vcpkg\installed\x64-windows\lib\auxiliary\gmp\lib' ...
|
|
% '-llibgmp-10.lib' '-llibmpfr-4.lib' ...
|
|
% COMPFLAGS='$COMPFLAGS /openmp' ...
|
|
% 'mexCVT.cpp';
|
|
end
|
|
|
|
%% test info
|
|
mexVoronoi(ones(3))
|
|
|
|
% load seeds
|
|
% % figure
|
|
%
|
|
% % seeds(50,:) = seeds(50,:) + 3;
|
|
% % seeds(1,1) = -130;
|
|
%
|
|
% [c_nodes, c_norms] = mexVD_info(seeds, int32(1:size(seeds,1))', 256,128,128);
|
|
%
|
|
% for i = 1:size(c_nodes, 1)
|
|
% nodes = c_nodes{i};
|
|
% norms = c_norms{i};
|
|
%
|
|
% nodes1 = nodes;
|
|
% % nodes1 = merge_edges(nodes);
|
|
%
|
|
% figure(1); clf
|
|
% x = nodes1(:,[1,4]);
|
|
% y = nodes1(:,[2,5]);
|
|
% z = nodes1(:,[3,6]);
|
|
% plot3(x',y',z','LineWidth',2); hold on;
|
|
%
|
|
% cx = mean(nodes1(:, [1,4]), 2);
|
|
% cy = mean(nodes1(:, [2,5]), 2);
|
|
% cz = mean(nodes1(:, [3,6]), 2);
|
|
%
|
|
% quiver3(cx,cy,cz, norms(:,1), norms(:,2), norms(:,3)); hold on;
|
|
% quiver3(cx,cy,cz, norms(:,4), norms(:,5), norms(:,6)); hold on;
|
|
% end
|
|
|
|
%% test cvt_nonregular
|
|
% load seeds
|
|
% figure
|
|
%
|
|
% % seeds(50,:) = seeds(50,:) + 3;
|
|
% % seeds(1,1) = -130;
|
|
%
|
|
% [c_nodes, cenP] = mexVD(seeds, int32(1:size(seeds,1))', 256,128,128);
|
|
%
|
|
% for i = 1:size(c_nodes, 1)
|
|
% nodes = c_nodes{i};
|
|
%
|
|
% nodes1 = nodes;
|
|
% % nodes1 = merge_edges(nodes);
|
|
%
|
|
% % figure(1); clf
|
|
% x = nodes1(:,[1,4]);
|
|
% y = nodes1(:,[2,5]);
|
|
% z = nodes1(:,[3,6]);
|
|
% plot3(x',y',z','LineWidth',2); hold on;
|
|
% scatter3(cenP(i,1), cenP(i,2), cenP(i,3),'filled'); hold on;
|
|
% end
|
|
|
|
function new_segs = merge_edges(nodes)
|
|
% figure;
|
|
new_segs = [];
|
|
len = size(nodes, 1);
|
|
while len > 0
|
|
s1 = nodes(1, :);
|
|
v1 = s1(4:6) - s1(1:3);
|
|
nodes(1,:) = [];
|
|
|
|
s11 = reshape(s1, 3, 2);
|
|
|
|
found = 0;
|
|
j = 1;
|
|
len = size(nodes, 1);
|
|
while j <= len
|
|
|
|
s2 = nodes(j, :);
|
|
v2 = s2(4:6) - s2(1:3);
|
|
v3 = s1(1:3) - s2(1:3);
|
|
|
|
s22 = reshape(s2, 3, 2);
|
|
|
|
if norm(cross(v1, v2)) < 1e-5 && norm(cross(v3, v2)) < 1e-5
|
|
for ii = 1:2
|
|
for jj = 1:2
|
|
if abs(s11(1, ii) - s22(1,jj)) < 1e-5 && ...
|
|
abs(s11(2, ii) - s22(2,jj)) < 1e-5 && ...
|
|
abs(s11(3, ii) - s22(3,jj)) < 1e-5 && ~found
|
|
|
|
tmp = [s11(:, 3-ii), s22(:, 3-jj)];
|
|
s1 = tmp(:)';
|
|
|
|
found = 1;
|
|
nodes(j, :) = [];
|
|
end
|
|
end
|
|
end
|
|
end
|
|
s11 = reshape(s1, 3, 2);
|
|
len = size(nodes, 1);
|
|
|
|
if found==1
|
|
j = 1;
|
|
found = 0;
|
|
else
|
|
j = j+1;
|
|
end
|
|
end
|
|
new_segs = [new_segs; s1];
|
|
% x = s1([1,4]);
|
|
% y = s1(:,[2,5]);
|
|
% z = s1(:,[3,6]);
|
|
% plot3(x',y',z','LineWidth',2); hold on;
|
|
len = size(nodes, 1);
|
|
end
|
|
end
|