0001 function [FV] = mesh_vertex_smooth(FV,index,origin),
0002
0003
0004
0005
0006
0007
0008 fprintf('this is in development\n');
0009 return
0010
0011
0012 xo = origin(1); yo = origin(2); zo = origin(3);
0013
0014 v = FV.vertices(index,:);
0015 x = FV.vertices(index,1);
0016 y = FV.vertices(index,2);
0017 z = FV.vertices(index,3);
0018
0019
0020 r = sqrt( (x-xo)^2 + (y-yo)^2 + (z-zo)^2 );
0021
0022
0023 v_unit_vector = ( v - origin ) / r;
0024
0025
0026 l = (x-xo)/r;
0027 m = (y-yo)/r;
0028 n = (z-zo)/r;
0029
0030
0031 vi = find(FV.edge(index,:));
0032 neighbour_vertices = FV.vertices(vi,:);
0033 X = neighbour_vertices(:,1);
0034 Y = neighbour_vertices(:,2);
0035 Z = neighbour_vertices(:,3);
0036
0037
0038 r_neighbours = sqrt( (X-xo).^2 + (Y-yo).^2 + (Z-zo).^2 );
0039 r_neighbours_mean = mean(r_neighbours);
0040
0041
0042
0043
0044 r_diff = r - r_neighbours_mean;
0045
0046
0047
0048 sn = r_diff * v_unit_vector;
0049
0050
0051
0052 edge_distance = FV.edge(index,vi);
0053 edge_distance_mean = mean(edge_distance);
0054
0055
0056 if r_diff,
0057 radius_of_curvature = (edge_distance_mean ^ 2) / (2 * r_diff);
0058 else
0059 radius_of_curvature = 10000;
0060 end
0061
0062
0063 radius_min = 3.33;
0064 radius_max = 10.00;
0065
0066
0067
0068 E = mean([(1 / radius_min), (1 / radius_max)]);
0069 F = 6 * ( (1 / radius_min) - (1 / radius_max) );
0070
0071 Fsigmoid = (1 + tanh( F * (1 / radius_of_curvature - E))) / 2;
0072
0073
0074 move_vector = Fsigmoid * sn;
0075
0076 FV.vertices(index,:) = v + move_vector;
0077
0078 return