1
$\begingroup$

I am trying to compute the eccentricity of a polygon in Mathematica.

I see that I can do something similar with ComponentMeasurements, but I am not sure how to get a Graphics[Polygon[]] expression to play nicely with it.

$\endgroup$
1
$\begingroup$

This seems to work for me:

ComponentMeasurements[
 Graphics[
  Graphics[
   RegularPolygon[5]
   ]
  ]
 , "Eccentricity"]

However, I think you need to invert the colors. Using a test, you need:

ComponentMeasurements[
 Graphics[
  {White, Disk[{0, 0}, 1]}
  , Background -> Black]
 , "Eccentricity"]

to get 0

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.