Contact detection between two solid bodies
7 views (last 30 days)
Show older comments
Arvind Kumar Pathak
on 17 Apr 2017
Commented: Arvind Kumar Pathak
on 19 Apr 2017
Dear Sir/ Madam
I have the information of geometry of two solid bodies in the form of point clouds. these points having the coordinate value in X, Y and Z direction.
I want to detect the contact between two solid bodies whether they are in contact or not.
alsoI want to identify the contact points between two solid bodies when they are in contact.
Please help me. I am in so trouble
Thanks
7 Comments
Accepted Answer
KSSV
on 18 Apr 2017
Edited: KSSV
on 18 Apr 2017
%%surface 1
fid1 = fopen('22985_lun_R.txt') ;
S = textscan(fid1,'%s','delimiter','\n') ;
S = S{1} ;
coor1 = cell2mat(cellfun(@str2num,S(11:16819),'un',0)) ;
tri1 = cell2mat(cellfun(@str2num,S(16824:50437),'un',0)) ;
tri1 = tri1(:,1:end-1)+1 ;
x1 = coor1(:,1) ; y1 = coor1(:,2) ; z1 = coor1(:,3) ;
%%surface 2
fid1 = fopen('22985_sca_R.txt') ;
S = textscan(fid1,'%s','delimiter','\n') ;
S = S{1} ;
coor2 = cell2mat(cellfun(@str2num,S(11:14547),'un',0)) ;
tri2 = cell2mat(cellfun(@str2num,S(14552:43621),'un',0)) ;
tri2 = tri2(:,1:end-1)+1 ;
x2 = coor2(:,1) ; y2 = coor2(:,2) ; z2 = coor2(:,3) ;
figure(1)
trisurf(tri1,x1,y1,z1,z1)
hold on
trisurf(tri2,x2,y2,z2,z2)
hold off
%%Get intersection
S1.vertices = coor1 ;
S1.faces = tri1 ;
S2.vertices = coor2 ;
S2.faces = tri2 ;
[intMatrix, intSurface] = SurfaceIntersection(S1,S2) ;
download the function SurfaceIntersection from https://in.mathworks.com/matlabcentral/fileexchange/48613-surface-intersection. I have tried running it, but the function taking very high memory and I could not see the result. Try it and let me know.
Any ways, in the present case, the two surfaces are not intersection. I can see this from the generated picture. I suggest you to know about the function using small mesh first.
More Answers (0)
See Also
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!