Compute the distance between the given point/polyhedron and this polyhedron.
dist = P.distance(x)
ret = P.distance(S)
dist = distance(P, x)
ret = distance(P, S)
P |
Polyhedron in any format Class: Polyhedron |
x |
Vector of size P.Dim Class: double vector |
S |
Polyhedron with the same dimension as P. Class: Polyhedron |
dist |
Distance between the point ![]() ![]() Class: double |
ret |
Optimal solution or [] if ![]() Class: struct |
ret.exitflag |
Integer value informing about the termination status of the optimization. Class: double |
ret.dist |
Distance from ![]() ![]() Class: double |
ret.x |
Point ![]() ![]() ![]() Class: double |
ret.y |
Point ![]() ![]() ![]() Class: double |
P = ExamplePoly.poly3d_sin;Choose a point and compute the distance:
y = [2;2];
d = P.distance(y);Plot the result
P.plot; hold on; pplot(y','or'); axis square; th=linspace(0,2*pi,100)'; pplot(d.dist*[sin(th) cos(th)]+repmat(y',100,1),'k');
P = ExamplePoly.poly3d_sin('d',3);
[U,s]=svd(randn(3));
S = ExamplePoly.poly3d_sin.affineMap(U(:,1:2)) + [2;2;2];Compute the distance:
ret = distance(P,S);Plot the result
plot([P S]); hold on; pplot([ret.x';ret.y'],'ok-'); axis square;
◀ | invaffinemap | le | ▶ |
© 2010-2013 Colin Neil Jones: EPF Lausanne, colin.jones@epfl.ch