Math#
Math Helper Functions
- class nerfstudio.utils.math.Gaussians(mean: Tensor, cov: Tensor)#
Bases:
object
Stores Gaussians
- Parameters:
mean – Mean of multivariate Gaussian
cov – Covariance of multivariate Gaussian.
- nerfstudio.utils.math.components_from_spherical_harmonics(levels: int, directions: Tensor) Tensor #
Returns value for each component of spherical harmonics.
- Parameters:
levels – Number of spherical harmonic levels to compute.
directions – Spherical harmonic coefficients
- nerfstudio.utils.math.compute_3d_gaussian(directions: Tensor, means: Tensor, dir_variance: Tensor, radius_variance: Tensor) Gaussians #
Compute guassian along ray.
- Parameters:
directions – Axis of Gaussian.
means – Mean of Gaussian.
dir_variance – Variance along direction axis.
radius_variance – Variance tangent to direction axis.
- Returns:
Oriented 3D gaussian.
- Return type:
- nerfstudio.utils.math.conical_frustum_to_gaussian(origins: Tensor, directions: Tensor, starts: Tensor, ends: Tensor, radius: Tensor) Gaussians #
Approximates conical frustums with a Gaussian distributions.
Uses stable parameterization described in mip-NeRF publication.
- Parameters:
origins – Origins of cones.
directions – Direction (axis) of frustums.
starts – Start of conical frustums.
ends – End of conical frustums.
radius – Radii of cone a distance of 1 from the origin.
- Returns:
Approximation of conical frustums
- Return type:
- nerfstudio.utils.math.cylinder_to_gaussian(origins: Tensor, directions: Tensor, starts: Tensor, ends: Tensor, radius: Tensor) Gaussians #
Approximates cylinders with a Gaussian distributions.
- Parameters:
origins – Origins of cylinders.
directions – Direction (axis) of cylinders.
starts – Start of cylinders.
ends – End of cylinders.
radius – Radii of cylinders.
- Returns:
Approximation of cylinders
- Return type:
- nerfstudio.utils.math.expected_sin(x_means: Tensor, x_vars: Tensor) Tensor #
Computes the expected value of sin(y) where y ~ N(x_means, x_vars)
- Parameters:
x_means – Mean values.
x_vars – Variance of values.
- Returns:
The expected value of sin.
- Return type:
torch.Tensor
- nerfstudio.utils.math.intersect_aabb(origins, directions, aabb)#
pytorch implementation of ray intersection with AABB box :param origin: N,3 tensor of 3d positions :param direction: N,3 tensor of normalized directions :param aabb: 6,1 array of aabb box in the form of [x_min, y_min, z_min, x_max, y_max, z_max] :return: t_min, t_max - two tensors of shapes N,1 representing the intersection signed distance from the origin. t_min is clipped to 0 in case it is negative, in case of no intersection t_min is 1e10.