mirror of
https://github.com/nerfstudio-project/nerfstudio.git
synced 2026-12-06 15:59:16 +08:00
Add 'within' function to SceneBox (#2991)
Co-authored-by: Matias Turkulainen <30566358+maturk@users.noreply.github.com>
This commit is contained in:
1 parent
9960de0e84
commit
946151ac45
1 file changed
+4
@@ -34,6 +34,10 @@ class SceneBox:
|
|||||||
aabb[0] is the minimum (x,y,z) point.
|
aabb[0] is the minimum (x,y,z) point.
|
||||||
aabb[1] is the maximum (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):
|
def get_diagonal_length(self):
|
||||||
"""Returns the longest diagonal length."""
|
"""Returns the longest diagonal length."""
|
||||||
diff = self.aabb[1] - self.aabb[0]
|
diff = self.aabb[1] - self.aabb[0]
|
||||||
|
|||||||
Reference in new issue
Block a user