diff --git a/nerfstudio/data/scene_box.py b/nerfstudio/data/scene_box.py index bf36702045..4abf60ea00 100644 --- a/nerfstudio/data/scene_box.py +++ b/nerfstudio/data/scene_box.py @@ -34,6 +34,10 @@ class SceneBox: aabb[0] is the minimum (x,y,z) point. aabb[1] is the maximum (x,y,z) point.""" + def within(self, pts: Float[Tensor, "n 3"]): + """Returns a boolean mask indicating whether each point is within the box.""" + return torch.all(pts > self.aabb[0], dim=-1) & torch.all(pts < self.aabb[1], dim=-1) + def get_diagonal_length(self): """Returns the longest diagonal length.""" diff = self.aabb[1] - self.aabb[0]