scimba_torch.geometry.utils

Some utility functions.

Functions

compute_bounding_box(points[, inflation])

Compute a bounding box for a vector of points.

read_points_normals_from_file(filename[, ...])

Reads points and normals from file.

write_points_normals_to_file(points, ...[, ...])

Writes the couple of points, normals to a text file.

compute_bounding_box(points, inflation=0.05)[source]

Compute a bounding box for a vector of points.

Parameters:
  • points (Tensor) – the vector of points, shape (batch, d).

  • inflation (float) – the factor for inflation.

Return type:

Tensor

Returns:

A bounding box of shape (d,2) containing all the points.

Raises:

ValueError – points is not a vector of n points of dim d

write_points_normals_to_file(points, normals, filename, delimiter=' ')[source]

Writes the couple of points, normals to a text file.

Parameters:
  • points (ndarray | Tensor) – the tensor of points; shape must be [n,d].

  • normals (ndarray | Tensor) – the tensor of normals; shape must be [n,d].

  • filename (str) – the file to write to.

  • delimiter (str) – the delimiter, default is whitespace.

Raises:

ValueError – input tensors does not have appropriated shape.

Return type:

None

read_points_normals_from_file(filename, delimiter=' ')[source]

Reads points and normals from file.

Parameters:
  • filename (str) – file to read from.

  • delimiter (str) – the delimiter, default is whitespace.

Return type:

tuple[Tensor, Tensor]

Returns:

a tuple of points, normals

Raises:

ValueError – input file does not have an even number of columns.