# 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) #

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:

Gaussians

nerfstudio.utils.math.conical_frustum_to_gaussian(origins: Tensor, directions: Tensor, starts: Tensor, ends: Tensor, radius: Tensor) #

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:

Gaussians

nerfstudio.utils.math.cylinder_to_gaussian(origins: Tensor, directions: Tensor, starts: Tensor, ends: Tensor, radius: Tensor) #

Approximates cylinders with a Gaussian distributions.

Parameters:
• origins – Origins of cylinders.

• directions – Direction (axis) of cylinders.

• starts – Start of cylinders.

• ends – End of cylinders.

Returns:

Approximation of cylinders

Return type:

Gaussians

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