Reputation: 1965
I have a triangle mesh stl/wrl file that I would like to dense the mesh by adding points. For example, each triangle can be divided into 4 smaller triangle. How can this mesh interpolation be performed?
I could not find such thing in meshlab,and since my shape is quite big, iterating over all of the triangle meshes will take too much time...
Upvotes: 1
Views: 1775
Reputation: 1169
Just in case someone stumbles across this question, there is such a functionality available in Meshlab now. Open your file, go to
Filters > Remeshing, Simplification and Reconstruction > Refine User-Defined
and click on "Apply". In my case, I also had to change the "and" in the "boolean function" field to "&&", otherwise an error message appeared.
Worked like a charm:
Upvotes: 2
Reputation: 1965
Found the (lazy) answer -densing the grid while iterating over the entire volume:
[tri,pts]; % tri is triples of indices from pts
triperms=[1 1; 1 2; 1 3; 2 2 ;2 3 ; 3 3];
newTri = [1 2 3;2 4 5;3 5 6;2 5 3];
triI = [];
ptsI=[];
for i=1:size(tri,1)
facetPts = pts(tri(i,:)',:);
newPts=squeeze(mean(reshape(facetPts(triperms,:),[6 2 3]),2));
indx = size(ptsI,1);
ptsI(indx+(1:6),:)=newPts;
triI(end+1:end+4,:)=indx+newTri;
end
Upvotes: 1