Vector fields


cartesian_vector_field(p)

Vector field defined by its components in the cartesian coordinate system (x, y, z). The components of the output vector field are cartesian (x, y, z). Args: p: Array of Cartesian components with shape (3, N), where N is the number of coordinate points. Rows are (u_x, u_y, u_z).

Returns:
  • ndarray

    Vector field with shape (3, N).

spherical_vector_field(p)

Vector field defined by its components in the spherical coordinate system (r, phi, theta). The components of the output vector field are cartesian (x, y, z).

Parameters:
  • p (array_like_type) –

    Array of spherical components with shape (3, N), where N is the number of coordinate points. Rows are (r, phi, theta) — radius, azimuthal angle, polar angle (in radians).

Returns:
  • ndarray

    Vector field with shape (3, N), in Cartesian coordinates.

cylindrical_vector_field(p)

Vector field defined by its components in the cylindrical coordinate system (r, phi, z). The components of the output vector field are cartesian (x, y, z).

Parameters:
  • p (array_like_type) –

    Array of cylindrical components with shape (3, N), where N is the number of coordinate points. Rows are (r, phi, z) — radius, azimuthal angle (in radians), and z-component.

Returns:
  • ndarray

    Vector field with shape (3, N), in Cartesian coordinates.

radial_vector_field_spherical(r)

Vector field where all the vectors are pointing radially outwards from the origin. Point cloud specifying the positions of points at which the vector field is evaluated is taken as the input. The components of the output vector field are cartesian (x, y, z).

Parameters:
  • r (array_like_type) –

    Coordinates of points on which the vector field is evaluated. Shape must be (D, N), where D is the dimension (D = 3) and N is the number of coordinate points.

Returns:
  • ndarray

    Vector field with shape (3, N), unit-normalized.

radial_vector_field_cylindrical(r)

Vector field where all the vectors are pointing radially outwards from the line x=0, y=0 (z-axis). Point cloud specifying the positions of points at which the vector field is evaluated is taken as the input. The components of the output vector field are cartesian (x, y, z).

Parameters:
  • r (array_like_type) –

    Coordinates of points on which the vector field is evaluated. Shape must be (D, N), where D is the dimension (D = 3) and N is the number of coordinate points.

Returns:
  • ndarray

    Vector field with shape (3, N), unit-normalized.

hyperbolic_vector_field_cylindrical(r)

Hyperbolic vector field centered at the line x=0, y=0 (z-axis). Point cloud specifying the positions of points at which the vector field is evaluated is taken as the input. The components of the output vector field are cartesian (x, y, z).

Parameters:
  • r (array_like_type) –

    Coordinates of points on which the vector field is evaluated. Shape must be (D, N), where D is the dimension (D = 3) and N is the number of coordinate points.

Returns:
  • ndarray

    Vector field with shape (3, N).

awn_vector_field_cylindrical(r, gamma)

Azimuthal winding vector field on the cylinder: the in-plane direction is gamma * arctan2(y, x). The z-component is zero.

Parameters:
  • r (array_like_type) –

    Coordinates of points on which the vector field is evaluated. Shape must be (D, N), where D is the dimension (D = 3) and N is the number of coordinate points.

  • gamma (scalar_like_type) –

    Winding number multiplier.

Returns:
  • ndarray

    Vector field with shape (3, N).

vortex_vector_field_cylindrical(r)

Cylindrical vortex vector field: at each point, the vector is tangent to a circle in the xy-plane centered on the z-axis. The z-component is zero.

Parameters:
  • r (array_like_type) –

    Coordinates of points on which the vector field is evaluated. Shape must be (D, N), where D is the dimension (D = 3) and N is the number of coordinate points.

Returns:
  • ndarray

    Vector field with shape (3, N), unit-normalized.

aar_vector_field_cylindrical(r, alpha)

Axially aligned radial vector field on the cylinder: cylindrical radial vector field rotated by a fixed angle alpha about the z-axis.

Parameters:
  • r (array_like_type) –

    Coordinates of points on which the vector field is evaluated. Shape must be (D, N), where D is the dimension (D = 3) and N is the number of coordinate points.

  • alpha (scalar_like_type) –

    Rotation angle in radians.

Returns:
  • ndarray

    Vector field with shape (3, N).

aav_vector_field_cylindrical(r, alpha)

Axially aligned vortex vector field on the cylinder: cylindrical vortex vector field rotated by a fixed angle alpha about the z-axis.

Parameters:
  • r (array_like_type) –

    Coordinates of points on which the vector field is evaluated. Shape must be (D, N), where D is the dimension (D = 3) and N is the number of coordinate points.

  • alpha (scalar_like_type) –

    Rotation angle in radians.

Returns:
  • ndarray

    Vector field with shape (3, N).

x_vector_field(r)

Vector field where only the X component (cartesian coordinates) is non-zero. Point cloud specifying the positions of points at which the vector field is evaluated is taken as the input. The components of the output vector field are cartesian (x, y, z).

Parameters:
  • r (array_like_type) –

    Coordinates of points on which the vector field is evaluated. Shape must be (D, N), where D is the dimension (D = 3) and N is the number of coordinate points.

Returns:
  • ndarray

    Vector field with shape (3, N), each column equal to (1, 0, 0).

y_vector_field(r)

Vector field where only the Y component (cartesian coordinates) is non-zero. Point cloud specifying the positions of points at which the vector field is evaluated is taken as the input. The components of the output vector field are cartesian (x, y, z).

Parameters:
  • r (array_like_type) –

    Coordinates of points on which the vector field is evaluated. Shape must be (D, N), where D is the dimension (D = 3) and N is the number of coordinate points.

Returns:
  • ndarray

    Vector field with shape (3, N), each column equal to (0, 1, 0).

z_vector_field(r)

Vector field where only the Z component (cartesian coordinates) is non-zero. Point cloud specifying the positions of points at which the vector field is evaluated is taken as the input. The components of the output vector field are cartesian (x, y, z).

Parameters:
  • r (array_like_type) –

    Coordinates of points on which the vector field is evaluated. Shape must be (D, N), where D is the dimension (D = 3) and N is the number of coordinate points.

Returns:
  • ndarray

    Vector field with shape (3, N), each column equal to (0, 0, 1).

from_sdf(sdf_, co_resolution)

Vector field constructed from an SDF. Point cloud specifying the value of the SDF is taken as an input. The components of the output vector field are cartesian (x, y, z).

Parameters:
  • sdf_ (array_like_type) –

    Signed distance field evaluated on a rectilinear grid, flattened to shape (N,), where N is the total number of points.

  • co_resolution (tuple | list | array_like_type) –

    Number of points along each axis in the grid on which the SDF is evaluated.

Returns:
  • ndarray

    Vector field with shape (D, N), unit-normalized. D is the number of

  • ndarray

    dimensions inferred from co_resolution.