def rounded_cube(x, y, z, r, segments=32, center=True): out = s.minkowski()( s.cube([x - 2 * r, y - 2 * r, z - 2 * r], center=center), s.sphere(r=r, segments=segments), ) return out
def minkowski_rounded_cube(size, corner_radius, segments=None, center=False): if isinstance(size, (int, float)): size = XYZ( size - 2 * corner_radius, size - 2 * corner_radius, size - 2 * corner_radius, ) else: size = XYZ(*size) - 2 * corner_radius return translate((corner_radius, corner_radius, corner_radius))(minkowski()(cube(size), sphere(corner_radius, segments=segments)))
def rounded_triangle_prism(a, b, c, thickness, corner_radius, segments=32): return minkowski()(triangle_prism(a, b, c, thickness - 2 * corner_radius), sphere(corner_radius, segments=segments))
def grow(thickness, target): radius = thickness / 2 return minkowski()(target, sphere(r=radius, segments=24))
def roundrect(vector: Vector2, radius: float): mod_vec = [v - radius * 2 for v in vector] return s.minkowski()( s.square(mod_vec), s.translate([radius, radius, 0])(s.circle(r=radius)) )
def projection(size, radius=3., center=True): return sp.minkowski()( sp.square([a - 2. * radius for a in size], center=center), sp.circle(r=radius, segments=16), )