Sample a random subset of this PointCloud. :param num_points: maximum number of points to sample. :param subsample_kwargs: arguments to self.subsample(). :return: a reduced PointCloud, or self if num_points is not less than the current number of poi
(self, num_points: int, **subsample_kwargs)
| 129 | ) |
| 130 | |
| 131 | def random_sample(self, num_points: int, **subsample_kwargs) -> "PointCloud": |
| 132 | """ |
| 133 | Sample a random subset of this PointCloud. |
| 134 | |
| 135 | :param num_points: maximum number of points to sample. |
| 136 | :param subsample_kwargs: arguments to self.subsample(). |
| 137 | :return: a reduced PointCloud, or self if num_points is not less than |
| 138 | the current number of points. |
| 139 | """ |
| 140 | if len(self.coords) <= num_points: |
| 141 | return self |
| 142 | indices = np.random.choice(len(self.coords), size=(num_points,), replace=False) |
| 143 | return self.subsample(indices, **subsample_kwargs) |
| 144 | |
| 145 | def farthest_point_sample( |
| 146 | self, num_points: int, init_idx: Optional[int] = None, **subsample_kwargs |
no test coverage detected