torchcurves.functional.uniform_augmented_knots#

torchcurves.functional.uniform_augmented_knots(n_control_points, degree, dtype=torch.float32, device=None, k_min=-1, k_max=1)#

Generate an augmented knot vector with uniform spacing in [-1, 1] for B-spline curves.

This function returns a 1D tensor containing knot values. The internal knots are computed uniformly in the interval [-1, 1] for the given number of control points and degree. The head and tail, each containing (degree + 1) identical knots, produce an augmented knot vector with repeated boundary knots.

Parameters:
  • n_control_points (int) – The total number of control points for the B-spline. Must be at least (degree + 1) to have a valid knot vector.

  • degree (int) – The degree of the B-spline.

  • dtype (torch.dtype, optional) – The desired data type of the output tensor. Defaults to torch.float32.

  • device (torch.device or str) – The device on which the knot vector will reside.

  • k_min (float, optional) – The minimum value for the internal knots. Defaults to -1.0.

  • k_max (float, optional) – The maximum value for the internal knots. Defaults to 1.0.

Returns:

A 1D tensor of knots consisting of head knots, uniformly spaced

internal knots, and tail knots, all in the range [-1.0, 1.0].

Return type:

torch.Tensor

Raises:

ValueError – If the number of control points is less than (degree + 1), indicating that there are not enough points to form a valid knot vector.