by Tim C. Lueth, SG-Lib Toolbox: SolidGeometry 5.6 - Surfaces
Introduced first in SolidGeometry 4.9, Creation date: 2020-01-17, Last change: 2025-09-14
See Also: , SGintersectFacetPoints
, SGfindjointDoFofSG
[DILM,FLAi,FLBi,DIL]=SGnearestpointsofSG(A,B,[slim,stol])
A: | Solid A | |
B: | Solid B | |
slim: | range limit for search; default is 10; inf works too. | |
stol: | tolerance wrt to minimal point; default is .1; 1 = 100 Percent of minimal distance is accepted |
DILM: | List [Avi Bvi dist nvec] of minimal distance point pairs | |
FLAi: | Facets a A with a least one point in DIL(:,1) | |
FLBi: | Facets a A with a least one point in DIL(:,2) | |
DIL: | Full List [Avi Bvi dist nvec] of minimal distance point pairs |
SG=SGsurfaces(SGsample(25));
SGnearestpointsofSG(SG{1},SG{2}); M=ans; mean(M(:,4:6)), std(M(:,4:6))
loadweb JACO_robot.mat; JC2=SGshortopti(JC2); JC3=SGshortopti(JC3);
R=rot(pi/10,pi/5,pi/3); JC2=SGtransR(SGshortopti(JC2),R); JC3=SGtransR(SGshortopti(JC3),R);
SGnearestpointsofSG(JC2,JC3);
C=SGboxsphere; D=SGtransrelSG(SGbox,C,'ontop',+5);
SGnearestpointsofSG(C,D); M=ans, mean(M(:,4:6)), std(M(:,4:6))