How to plot a curve tangent to many ellipses.

Hi everybody,
In the attached figures, we have two kind of curve; 1- a big closed curve which is somehow a limaçon. 2- many ellipses which are the same by the formula but different by the center. In fact, we have the same rotated ellipses whose centers vary on the points on the limaçon. I added two figures in which the number of added ellipses are different (just to make more confortable to understand the question). Now, I want to add a new curve in the figure which is tangent to all the ellipses. For now, I have no idea how to do it.
Any help is appreciated in advance.
I should say that I can add as many as ellipses I want.

 Accepted Answer

You could also try,
P =[X Y];
P = unique(P,'row');
k=convhull(P);
Xh=P(k,1); Yh=P(k,2);
line(Xh,Yh)

4 Comments

It worked perfectly! Thank you so much! You made my day!
Hi Matt, I am back here for some more help. You solved the 2-D case by finding a curve which covers all the points. I would like to know if there is any technique through which I can do something similar in 3-D case? I have many 3-D points in the space and need some surface which covers all of them with minimum volume or something like that. In fact, the surface should contain the furthest points. Shall I open a new question or you may help me here?
You can probably take the convhull() as before to get the envelope points and use an alphaShape() as in this example to plot a surface:
I highly appreciate your suggestion. It worked very well.

Sign in to comment.

More Answers (2)

alphaShape.boundaryFacets might also be applicable,

7 Comments

Thanks for your help. I have not heard nor seen about these functions. I study them through the link you provided. I will let you know if I come across some problems. Meanwhile if you have something else which can help me is very welcome! Thanks again!
As you may see in the enclosed figures below, I first gathered the coordinates of all the points on all the ellipses in the vectors X and Y, and then tried
P =[X Y];
P = unique(P,'row');
shp = alphaShape(P); plot(shp)
which gave me the figure on the left. Afterwards, I tried
bf = boundaryFacets(shp);
plot(bf(:,1), bf(:,2));
which gave me the figure on the right. So far, I could not get to what I wanted. I just need a curve which is tangent to all the ellipses from outside (I added something by hand the the figure on the left side to make it clearer what I am looking for). Please let me know if you may have any idea by which I can get there.
Thanks Matt J, but my problem is not the holes. In fact, I only need the outer curve which is somehow highlighted in red in my above figure. So, my problem is everything else but the outer curve. Even in your mentioned example, there are many extra line in the figure. Imagine that in your mentioned example, I only need the biggest circle in the figure. Is three any approach by which I can have that outer curve?
Your problem is the holes. If you plug the holes, then the boundary of the alphaShape will include only the outer envelope.
Majid
Majid on 10 Mar 2021
Edited: Majid on 10 Mar 2021
Then, if this is the case, I am not getting your point! I am not so familiar with MATLAB functions in particular I know this function since I have seen your comment here. So, could you please let me know how can I get to the outer curve in more details?
PS: As I am not so familiar with MATLAB, I am trying to find out the coordinates of the points on the outer curve mathematically to be able to plot it in MATLAB. I think I will get there in a day.
As you may see in the enclosed figures below, I first gathered the coordinates of all the points on all the ellipses in the vectors X and Y, and then tried
It would be advisable to attach your X,Y vectors in a .mat file so that we can demonstrate more directly.

Sign in to comment.

Did you try boundary?

1 Comment

Thanks! It seems that the link provided by Matt J is about the concept you mentioned. I did not know about these functions, and so I had not tried it. But, I am on it.

Sign in to comment.

Asked:

on 8 Mar 2021

Commented:

on 23 Sep 2021

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!