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.
75 lines
2.2 KiB
75 lines
2.2 KiB
3 years ago
|
%% Build Cpp MEX File with CGAL library
|
||
|
opt_load = 1;
|
||
|
|
||
|
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'];
|
||
|
|
||
|
lib2 = ['-L', 'C:\dev\vcpkg\installed\x64-windows\lib\auxiliary\gmp\lib'];
|
||
|
lib21 = ['-l', 'libgmp-10.lib'];
|
||
|
lib22 = ['-l', 'libmpfr-4.lib'];
|
||
|
|
||
|
% mex('-v', include1, include3, lib2,lib21,lib2,lib22, 'mexDT.cpp');
|
||
|
mex('-v', include1, include3, lib2,lib21,lib2,lib22, 'mexCVT_nonregular.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 mexDT
|
||
|
x = 128; y = 128;
|
||
|
pnts = [-x, -y; x,-y; x, 0; 0, 0; 0, y; -x, y];
|
||
|
% triinfo = mexDT(pnts, 10);
|
||
|
% nodes = triinfo{1};
|
||
|
% faces = triinfo{2};
|
||
|
% figure;
|
||
|
% DT = triangulation(faces, nodes);
|
||
|
% triplot(DT);
|
||
|
|
||
|
%% test cvt_nonregular
|
||
|
load seeds
|
||
|
figure
|
||
|
|
||
|
% seeds(50,:) = [10,10];
|
||
|
% seeds(1,1) = -130;
|
||
|
|
||
|
[c_nodes] = mexCVT_nonregular(seeds, int32(1:size(seeds,1))', pnts);
|
||
|
polyvec = [];
|
||
|
for i = 1:size(c_nodes, 1)
|
||
|
nodes = c_nodes{i};
|
||
|
% scatter(nodes(:,1),nodes(:,2)); hold on;
|
||
|
% scatter(nodes(:,3),nodes(:,4)); hold on;
|
||
|
polyvec = [polyvec; polyshape(nodes(:,[1,2]))];
|
||
|
end
|
||
|
hold on; voronoi(seeds(:,1), seeds(:,2));
|
||
|
hold on; plot(polyvec);
|
||
|
|
||
|
%% test interPoly
|
||
|
% load datas
|
||
|
% tic
|
||
|
% res = mexInterPoly(MMCs_poly, poly_cell);
|
||
|
% toc
|
||
|
|
||
|
%% test mexCVT
|
||
|
load seeds
|
||
|
bnodes = seeds_minus;
|
||
|
|
||
|
figure
|
||
|
c_nodes = mexCVT_cell(bnodes, int32([2,5,6,1]'), 256, 128);
|
||
|
for i = 1:size(c_nodes, 1)
|
||
|
nodes = c_nodes{i};
|
||
|
scatter(nodes(:,1),nodes(:,2)); hold on;
|
||
|
scatter(nodes(:,3),nodes(:,4)); hold on;
|
||
|
end
|
||
|
|
||
|
% nodes = mexCVT(bnodes, int32([2,5,6,1]'), 256, 128);
|
||
|
% for j = 1:2
|
||
|
% scatter(nodes(:,1),nodes(:,2)); hold on;
|
||
|
% scatter(nodes(:,3),nodes(:,4)); hold on;
|
||
|
% end
|
||
|
hold on; voronoi(bnodes(:,1), bnodes(:,2));
|