On 08/14/2013 05:04 PM, Barend Gehrels wrote:
Hi Tanaka,

On 14-8-2013 11:55, Tanaka Simon wrote:
Hello,

I have a model::polygon, and i want to fit an ellipse to it (see link below). do you have suggestions of how to use (built-in) boost::geometry functionality as much as possible?

do you have alternative suggestions to characterize the polygon, e.g. to compute the principal axes of the inertia tensor? the solution is allowed to be heuristic.

Interesting problem. You could use distance (point-linestring) to get the distance from each point to the ellipse-as-a-linestring. Note that if you model the ellipse as a polygon, the distance is zero for all points inside, so I would use a linestring here. This ellipse can easily be generated from the definition of the ellipse.

To start with you could think of calculating the convex hull of the points. That gives a reasonable starting-shape. Its centroid should be located in the neighbourhood of the center of the ellipse. And then indeed you would need the diameter... You could use the point at the furthest location from the ellipse here as a starting point (then you also have some idea of the direction of the axis).

Regards, Barend



_______________________________________________
Geometry mailing list
Geometry@lists.boost.org
http://lists.boost.org/mailman/listinfo.cgi/geometry
thanks for your suggestion.
simon