I understand that you want to upsample the number of points and update the mesh without altering its shape. You can expand on your idea of adding the incentre points of the triangles and further adding them in the mesh.
Using the toy example just to give the idea:
% Original data
nodes = [0 0 0; 0 1 0; 1 0 0; 1/2 1/2 1];
mesh = [1 2 3; 1 3 4; 2 3 4; 1 2 4];
% Plot the mesh
figure;
trisurf(mesh, nodes(:, 1), nodes(:, 2), nodes(:, 3), 'FaceColor', 'cyan');
axis equal;
xlabel('X');
ylabel('Y');
zlabel('Z');
% taking the left triangular face as it was visible (nodes 1,2,4)
% For automation use nodes(mesh(i,:),:) where i is loop variable
triangle = nodes(mesh(4, :), :)
edges = triangle([2 3 1], :) - triangle;
edge_lengths = vecnorm(edges, 2, 2)
perimeter = sum(edge_lengths);
weights = edge_lengths / perimeter;
incenters = sum(triangle .* weights, 1)
% Adding the 5th node (incenter point)
nodes=[nodes;incenters]
% Adding corresponding triangulations in the mesh
% Using old nodes: 1,2,4 and the new node 5(incenter node)
mesh = [mesh;1,2,5;
2,4,5;
4,1,5]
figure;
trisurf(mesh, nodes(:, 1), nodes(:, 2), nodes(:, 3), 'FaceColor', 'cyan');
axis equal;
xlabel('X');
ylabel('Y');
zlabel('Z');
The above code just gives the idea, how you can add further points. The code can be automated to add as many points as you desire.
The output of the code is as follows:
Original mesh:
Updated mesh:
Hope this helps!!