polar-computing / 3DSeals

0 stars 2 forks source link

Polygons and coordinates #10

Open aborowicz opened 8 years ago

aborowicz commented 8 years ago

Currently we output from watershed an array of points for each patch.

If we hand these to shapely's polygon, we get a nice polygon. To compare however, we need polygons to be in cartesian coordinates.

Problem: all the polar-to-cartesian conversions I've done, when handed to shapely, produce a completely wrong polygon with many self-intersections.

image image

aborowicz commented 8 years ago

Possibly not necessary to convert coordinates. See function poly_relocate inside of img_geometry.py. This function re-centers polygons on (0,0), allowing for comparison.

aborowicz commented 8 years ago

Rounding may be a very slight issue. Currently x and y of the centroid are float64, and these values are used to correct all other points via subtraction (i.e. subtract the centroid x from every x value of the polygon, etc) but we end up with centroids that are e -15 or something. Probably not enough to cause a problem, but perhaps need to not use float64 .