# Minimising the summation of distance between two curves by placing the arc at best distance from origin

11 views (last 30 days)
Praveen Patnaik on 12 Mar 2020
Edited: Praveen Patnaik on 15 Mar 2020
In this problem I have two curves ( one is a semi circle and the other is an arc)
• Semi circle --> Fixed curve & Arc-->Movable curve
• Arc (this arc is part of a smaller circle with center (a,b)) -->We can move this arc and have its centre placed in the best optimised way so that it would give least distance between two curves.
• Condition: The arc can only be moved in x direction and not in y direction so that we can get a new X cordinate value of arc such that summation of (distance)^2 between curves at diffrent points will be minimum.
• The distance from the arc will be taken from any tangent drawn on the arc to the semi circle. (The distance needs to be calculated between diffrent points ).   Matt J on 12 Mar 2020
The distance from the arc will be taken from any tangent drawn on the arc to the semi circle.
Note: that requirement is the same as saying that the line along which distance is measured is any line passing through a point on the smaller arc and its center (a,b).
Praveen Patnaik on 13 Mar 2020
the line will pass through the arc centre but distance that i need to calculate is between two curves....and that also at multiple points???
is there a way i can plot random points on the small arc and from there measure the distance between two curves and by using that find the best distance of small arc from origin?
Praveen Patnaik on 13 Mar 2020
Can you show it via a script??

Matt J on 12 Mar 2020
It's a non-differentiable, one dimensional cost function minimization. I would use fminbnd,

Matt J on 14 Mar 2020
the line will pass through the arc centre but distance that i need to calculate is between two curves....and that also at multiple points???
With each point on the small circle, you can associate a polar coordinate angle theta relative to its center (a,b). The line passing through the point and (a,b) has the parametric form
p(a,theta,t)=[a+t*cos(theta);b+t*sin(theta)];
The point p(a,theta,t) will lie on the larger circle (with radius Rbig) if it satisfies
(a+t*cos(theta)).^2 + ( b+t*sin(theta) ).^2=Rbig.^2
For each fixed theta, this is a quadratic equation in t, which you can solve either analytically, or with the roots() command. Once you find the t0 at which p(a,theta,t0) lies on the larger circle, the distance d(theta,a) between the two arcs is
d(theta,a)=abs(Rsmall - norm(p(t0,theta,a)-[a;b]) );
Summing this over all theta, you get an objective function that varies with a and can use fminbnd to minimize it.
Praveen Patnaik on 15 Mar 2020
Thanks Matt