We are about to switch to a new forum software. Until then we have removed the registration on this forum.
Hello, I'm looking to inscribe ellipses in arbitrary polygons, along the lines of http://faculty.mae.carleton.ca/John_Hayes/Papers/InscribingEllipse.pdf , but not constrained to quadrilaterals. Kind of a long shot, but has anyone happened to code up this particular concept? cheers...
Answers
I'll give it a try, just to clarify though, you want the largest area of an ellipse that can fit in a given polygon?
thanks! Yes, the largest area of an ellipse that can fit in a given polygon is exactly what I'm looking for. I would be super excited to see what you might come up with—this problem takes significantly more computational geometry than I have. At the same time, it feels tantalizingly solvable...
also, this would be for convex shapes only...
haha, that makes it much easier, I had made an entire pathfinding program to find my way through screwy polygons, haven't had much time recently but I should be able to finish it this weekend... maybe, but anyway basically i run a function several times in different areas around the shape, and the function expands an ellipse, tilts moves and shifts it until the amount of precision needed is past anything useful. then it returns the coordinates of the ellipse, I'll post the code as soon as it's done
oh man, that sounds awesome! sorry I wasn't more precise in the initial description!
The article shows how to calculate the centre of the ellipse, see fig 2 and the first paragraph of part 4
It has taken me about 4-5 hours research and programming but EUREKA the sketch below will calculate the largest inscribed ellipse to fit inside a convex quadrilateral.
Here is the output
Here is the code
wow, this is awesome! If we ever meet in the real world, I'll buy you lunch, or drinks, your choice. Hell, I'll buy you both! This code will absolutely be extremely useful to me. That said, and feeling sheepish for pointing this out, what I am ultimately looking for is inscribing the ellipse within arbitrary convex polygons, not only quadrilaterals. My original post is probably confusing in that though I mention arbitrary polygons, I linked to a paper specifically about quads. Again, thanks so much for taking all that time to code this up!
The paper stated it requires a numerical approach or polygons with >=5 edges which would be much slower and I am not sure where to start, more research probably :)
Don't worry about the time I spent on this I enjoyed the challenge and I was really pleased with the outcome.
again, I really appreciate it, and this will still be extremely helpful :)
OK I did some research of polygons with >= 5 sides. Most info was about inscribing polygons inside ellipses and I found nothing I could use.
Perhaps someone else can help :)
ok, thanks so much for looking into it, much appreciated!