Contact detection between two solid bodies
조회 수: 2 (최근 30일)
이전 댓글 표시
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
채택된 답변
KSSV
2017년 4월 18일
편집: KSSV
2017년 4월 18일
%%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.
추가 답변 (0개)
참고 항목
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!