Project the points according to renderer matrix.
(self)
| 526 | super().set_segments([]) |
| 527 | |
| 528 | def do_3d_projection(self): |
| 529 | """ |
| 530 | Project the points according to renderer matrix. |
| 531 | """ |
| 532 | segments = self._segments3d |
| 533 | |
| 534 | # Handle ragged inputs, but prefer a faster path for same-length segments |
| 535 | segment_lengths = [len(segment) for segment in segments] |
| 536 | ragged = len(set(segment_lengths)) > 1 |
| 537 | if ragged: |
| 538 | # Branch masked / non-masked for speed |
| 539 | if any(np.ma.isMA(segment) for segment in segments): |
| 540 | segments = np.ma.concatenate(segments) |
| 541 | else: |
| 542 | segments = np.concatenate(segments) |
| 543 | else: |
| 544 | segments = np.asanyarray(segments) |
| 545 | |
| 546 | # Handle empty segments |
| 547 | if segments.size == 0: |
| 548 | LineCollection.set_segments(self, []) |
| 549 | return np.nan |
| 550 | |
| 551 | mask = False |
| 552 | if np.ma.isMA(segments) and segments.mask is not np.ma.nomask: |
| 553 | mask = segments.mask |
| 554 | |
| 555 | scale_mask = _scale_invalid_mask(segments[..., 0], |
| 556 | segments[..., 1], |
| 557 | segments[..., 2], |
| 558 | self.axes) |
| 559 | if np.any(scale_mask): |
| 560 | mask |= np.broadcast_to(scale_mask[..., np.newaxis], |
| 561 | (*scale_mask.shape, 3)) |
| 562 | |
| 563 | if self._axlim_clip: |
| 564 | viewlim_mask = _viewlim_mask(segments[..., 0], |
| 565 | segments[..., 1], |
| 566 | segments[..., 2], |
| 567 | self.axes) |
| 568 | if np.any(viewlim_mask): |
| 569 | # broadcast mask to 3D |
| 570 | viewlim_mask = np.broadcast_to(viewlim_mask[..., np.newaxis], |
| 571 | (*viewlim_mask.shape, 3)) |
| 572 | mask = mask | viewlim_mask |
| 573 | |
| 574 | xyzs = proj3d._scale_proj_transform_vectors(segments, self.axes) |
| 575 | if mask is not False: |
| 576 | xyzs = np.ma.array(xyzs, mask=mask) |
| 577 | segments_2d = xyzs[..., 0:2] |
| 578 | if ragged: |
| 579 | segments_2d = np.split(segments_2d, np.cumsum(segment_lengths[:-1])) |
| 580 | LineCollection.set_segments(self, segments_2d) |
| 581 | |
| 582 | # FIXME |
| 583 | if len(xyzs) > 0: |
| 584 | minz = min(xyzs[..., 2].min(), 1e9) |
| 585 | else: |
nothing calls this directly
no test coverage detected