polygons.py 文件源码

python
阅读 24 收藏 0 点赞 0 评论 0

项目:pyhiro 作者: wanweiwei07 项目源码 文件源码
def polygon_obb(polygon):
    '''
    Find the oriented bounding box of a Shapely polygon. 

    The OBB is always aligned with an edge of the convex hull of the polygon.

    Arguments
    -------------
    polygons: shapely.geometry.Polygon

    Returns
    -------------
    transform: (3,3) float, transformation matrix
               which will move input polygon from its original position 
               to the first quadrant where the AABB is the OBB
    extents:   (2,) float, extents of transformed polygon
    '''
    points = np.asanyarray(polygon.exterior.coords)
    return bounds.oriented_bounds_2D(points)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号