コード例 #1
0
 def __init__(self, *vmobjects: VMobject, **kwargs) -> None:
     if len(vmobjects) < 2:
         raise ValueError("At least 2 mobjects needed for Union.")
     super().__init__(**kwargs)
     paths = []
     for vmobject in vmobjects:
         paths.append(self._convert_vmobject_to_skia_path(vmobject))
     outpen = SkiaPath()
     union(paths, outpen.getPen())
     self._convert_skia_path_to_vmobject(outpen)
コード例 #2
0
ファイル: boolean_ops.py プロジェクト: yk616/manim
 def __init__(self, *vmobjects: VMobject, **kwargs):
     if len(vmobjects) < 2:
         raise ValueError("At least 2 mobjects needed for Union.")
     super().__init__(**kwargs)
     outpen = pathops.Path()
     paths = [
         _convert_vmobject_to_skia_path(vmobject) for vmobject in vmobjects
     ]
     pathops.union(paths, outpen.getPen())
     _convert_skia_path_to_vmobject(outpen, self)
コード例 #3
0
 def remove_overlap(cls, layer):
     from pathops import union
     import ufoLib2
     from glyphsLib.builder import UFOBuilder, GlyphsBuilder
     ufo_glyph = ufoLib2.objects.Glyph()
     UFOBuilder(Glyphs.font).to_ufo_paths(ufo_glyph, layer)
     contours = list(ufo_glyph)
     ufo_glyph.clearContours()
     pen = ufo_glyph.getPen()
     try:
         union(contours, pen)
         layer.paths = []
         GlyphsBuilder(ufos=[ufoLib2.objects.Font()]).to_glyphs_paths(
             ufo_glyph, layer)
     except Exception as e:
         print("Overlap removal failed. Carrying on anyway.")
     return layer