r""" Concatenate a list of `Path`\s into a single `Path`, removing all `STOP`\s.
(cls, *args)
| 337 | |
| 338 | @classmethod |
| 339 | def make_compound_path(cls, *args): |
| 340 | r""" |
| 341 | Concatenate a list of `Path`\s into a single `Path`, removing all `STOP`\s. |
| 342 | """ |
| 343 | if not args: |
| 344 | return Path(np.empty([0, 2], dtype=np.float32)) |
| 345 | vertices = np.concatenate([path.vertices for path in args]) |
| 346 | codes = np.empty(len(vertices), dtype=cls.code_type) |
| 347 | i = 0 |
| 348 | for path in args: |
| 349 | size = len(path.vertices) |
| 350 | if path.codes is None: |
| 351 | if size: |
| 352 | codes[i] = cls.MOVETO |
| 353 | codes[i+1:i+size] = cls.LINETO |
| 354 | else: |
| 355 | codes[i:i+size] = path.codes |
| 356 | i += size |
| 357 | not_stop_mask = codes != cls.STOP # Remove STOPs, as internal STOPs are a bug. |
| 358 | return cls(vertices[not_stop_mask], codes[not_stop_mask]) |
| 359 | |
| 360 | def __repr__(self): |
| 361 | return f"Path({self.vertices!r}, {self.codes!r})" |