ConvexHull inset_ch(ConvexHull ch, double dist) { ConvexHull ret; for(unsigned i = 0; i < ch.size(); i++) { Point bisect = (rot90(ch[i+1] - ch[i])); ret.merge(unit_vector(bisect)*dist+ch[i]); ret.merge(unit_vector(bisect)*dist+ch[i+1]); } return ret; }
ConvexHull rect2convexhull(Rect const & r) { ConvexHull ch; for(int i = 0; i < 4; i++) ch.merge(r.corner(i)); return ch; }