auromat.utils module¶
A collection of utility functions which should eventually become part
of the auromat.util
package.
-
auromat.utils.
angleBetween
(v1, v2)[source]¶ Return the angles in radians between two unit vector arrays. Angles are in [0,pi].
-
auromat.utils.
convexHull
(points)[source]¶ Return the convex hull spanning the given points.
Parameters: points – array of shape (n,2) Return type: array of shape (m,2)
-
auromat.utils.
extend
(instance, new_class)[source]¶ Apply inheritance after object creation.
See: https://stackoverflow.com/a/8545287
-
auromat.utils.
findNearest
(a, x)[source]¶ Find item in sorted list a that is closest to x and return its index.
If x has the same distance to both neighbors, the index of the left one is returned.
-
auromat.utils.
outline
(im)[source]¶ Finds the outline of a binary image, assuming that the inner structure is filled with True’s. The returned points are in clockwise order and can be used as a polygon. This works for concave forms as well.
Parameters: im – shape (h,w) Return type: ndarray of shape (n,2) in x,y order
-
auromat.utils.
pointsInsidePolygon
(points, polygon)[source]¶ Return for each point if it lies inside the given polygon.
Parameters: - points – shape (n,2)
- polygon – unclosed, shape (n,2)
Return type: boolean ndarray of shape (n,)
-
auromat.utils.
polygonArea
(poly, signed=False)[source]¶ Return area of an unclosed polygon.
See: http://www.mathopenref.com/coordpolygonarea.html Parameters: poly – (n,2)-array
-
auromat.utils.
polygonCentroid
(poly)[source]¶ Return centroid point of an unclosed polygon.
Parameters: poly – (n,2)-array Return type: tuple (x,y)
-
auromat.utils.
signedAngleBetween
(v1, v2)[source]¶ Return the angles in radians between two 2D vector arrays. Angles are in [-pi,pi].
See: http://stackoverflow.com/a/2150475