Skip to content

Commit

Permalink
Add 'within' function to SceneBox (nerfstudio-project#2991)
Browse files Browse the repository at this point in the history
Co-authored-by: Matias Turkulainen <[email protected]>
  • Loading branch information
2 people authored and ArpegorPSGH committed Jun 22, 2024
1 parent 2d3043c commit 823c600
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions nerfstudio/data/scene_box.py
Original file line number Diff line number Diff line change
Expand Up @@ -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]
Expand Down

0 comments on commit 823c600

Please sign in to comment.