Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add 'within' function to SceneBox #2991

Merged
merged 6 commits into from
Mar 11, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading