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.

57 lines
1.6 KiB

3 years ago
%--------------------------
% @Author: Jingqiao Hu
% @Date: 2022-05-12 14:45:10
% @LastEditTime: 2022-05-12 15:42:02
%--------------------------
datapath = 'data/sphere/deform/model_100.txt';
fileID = fopen(datapath, 'r');
info = fscanf(fileID, '%f');
MMC = reshape(info, 7, [])';
fclose(fileID);
path0 = 'data/sphere/deform/fullscale/';
[ref_nodes, def_nodes] = read_nodes(path0);
minx = min(ref_nodes(:,1)); maxx = max(ref_nodes(:,1));
miny = min(ref_nodes(:,2)); maxy = max(ref_nodes(:,2));
minz = min(ref_nodes(:,3)); maxz = max(ref_nodes(:,3));
gx = linspace(minx, maxx, 5);
gy = linspace(miny, maxy, 5);
gz = linspace(minz, maxz, 2);
for i = 1 : length(gx)-1
for j = 1 : length(gy)-1
for k = 1 : length(gz)-1
[idx,~] = find(ref_nodes(:,1) >= gx(i) & ref_nodes(:,1) <= gx(i+1) & ...
ref_nodes(:,2) >= gy(j) & ref_nodes(:,2) <= gy(j+1) & ...
ref_nodes(:,3) >= gz(k) & ref_nodes(:,3) <= gz(k+1));
ref = ref_nodes(idx, :);
def = def_nodes(idx, :);
recover_def_mmc_surf(ref_nodes, def_nodes, MMCs, optDesign)
end
end
end
path1 = 'data/sphere/deform/CBN/';
[ref_nodes, def_nodes] = read_nodes(path1);
function [ref_nodes, def_nodes] = read_nodes(path0)
datapath = [path0,'TV.txt'];
fileID = fopen(datapath, 'r');
info = fscanf(fileID, '%f');
ref_nodes = reshape(info, 3, [])';
fclose(fileID);
datapath = [path0,'TV_deformed.txt'];
fileID = fopen(datapath, 'r');
info = fscanf(fileID, '%f');
def_nodes = reshape(info, 3, [])';
fclose(fileID);
end