def offset_shape(shape: List[V], offset, inside=False) -> List[V]: """Offset a shape by <offset> mm.""" print(shape) return [ V(p[0], p[1]) for p in utils.offset_points( [v.as_tuple() for v in shape], offset, internal=inside # type: ignore ) ]
def offset_shape(shape, offset, inside=False): """ Offset a shape by <offset> mm. """ offset_3d_points = utils.offset_points( shape, offset, inside=inside ) return [[x, y] for x, y, z in offset_3d_points]
def test_offset_points_open(self): actual = euc_to_arr(offset_points(tri, offset=1, closed=False)) expected = [[0.0, 1.0], [7.585786437626904, 1.0], [-0.7071067811865479, 9.292893218813452]] self.assertEqual(expected, actual)
def test_offset_points_closed(self): actual = euc_to_arr(offset_points(tri, offset=1, closed=True)) expected = [[1.0, 1.0], [7.585786437626904, 1.0], [1.0, 7.585786437626905]] self.assertEqual(expected, actual)