ribbon.spiralcartesian module#

Classes for spirals described by a Césaro equation \(\kappa = f(s)\), where \(\kappa\) is the curvature and \(s\) is the arclength.

class ribbon.spiralcartesian.SpiralCartesianBase[source]#

Bases: ABC

Methods

get_cart_coords(s)

Returns the cartesian coordinates at the given values of arclengths.

get_curvature(s)

Returns the curvature at the given values of arclengths.

get_tangent(s)

Returns the unit tangent vector at the given values of polar or arclength coordinates.

abstractmethod get_tangent(s)[source]#

Returns the unit tangent vector at the given values of polar or arclength coordinates.

Parameters:
sarray_like

Value of the polar coordinates or arclengths.

Returns:
ndarray

Unit tangent vectors. Shape is (2,) if s is scalar, else (n,2) where n is the length of s.

abstractmethod get_curvature(s)[source]#

Returns the curvature at the given values of arclengths.

Parameters:
sarray_like

Arclengths.

Returns:
float or ndarray

Curvatures (float if input is scalar, else ndarray).

abstractmethod get_cart_coords(s)[source]#

Returns the cartesian coordinates at the given values of arclengths.

Parameters:
sarray_like

Arclengths.

Returns:
x, ytuple

Cartesian coordinates. If s is a scalar, x and y are floats, else they are 1D ndarray.

class ribbon.spiralcartesian.SpiralPolynomial(coeffs)[source]#

Bases: SpiralCartesianBase

The Césaro equation \(\kappa = f(s)\), where \(f(s)\) is a polynomial in \(s\).

Parameters:
coeffsarray_like

Coefficients of the polynomial in order of ascending power, i.e. coeffs[i] is the coefficient of s^i.

Methods

get_cart_coords(s)

Returns the cartesian coordinates at the given values of arclengths.

get_curvature(s)

Returns the curvature at the given values of arclengths.

get_tangent(s)

Returns the unit tangent vector at the given values of polar or arclength coordinates.

Warning

Polynomials with degree greater than 2 often result in self-intersecting, or at least self-touching spirals.

get_tangent(s)[source]#

Returns the unit tangent vector at the given values of polar or arclength coordinates.

Parameters:
sarray_like

Value of the polar coordinates or arclengths.

Returns:
ndarray

Unit tangent vectors. Shape is (2,) if s is scalar, else (n,2) where n is the length of s.

get_curvature(s)[source]#

Returns the curvature at the given values of arclengths.

Parameters:
sarray_like

Arclengths.

Returns:
float or ndarray

Curvatures (float if input is scalar, else ndarray).

get_cart_coords(s)[source]#

Returns the cartesian coordinates at the given values of arclengths.

Parameters:
sarray_like

Arclengths.

Returns:
x, ytuple

Cartesian coordinates. If s is a scalar, x and y are floats, else they are 1D ndarray.

class ribbon.spiralcartesian.SpiralCornu(a)[source]#

Bases: SpiralCartesianBase

The Césaro equation is \(\kappa = as\), where \(a > 0\).

Parameters:
afloat

Proportionality constant between curvature and arclength. Must be > 0.

Methods

get_cart_coords(s)

Returns the cartesian coordinates at the given values of arclengths.

get_curvature(s)

Returns the curvature at the given values of arclengths.

get_tangent(s)

Returns the unit tangent vector at the given values of polar or arclength coordinates.

get_tangent(s)[source]#

Returns the unit tangent vector at the given values of polar or arclength coordinates.

Parameters:
sarray_like

Value of the polar coordinates or arclengths.

Returns:
ndarray

Unit tangent vectors. Shape is (2,) if s is scalar, else (n,2) where n is the length of s.

get_curvature(s)[source]#

Returns the curvature at the given values of arclengths.

Parameters:
sarray_like

Arclengths.

Returns:
float or ndarray

Curvatures (float if input is scalar, else ndarray).

get_cart_coords(s)[source]#

Returns the cartesian coordinates at the given values of arclengths.

Parameters:
sarray_like

Arclengths.

Returns:
x, ytuple

Cartesian coordinates. If s is a scalar, x and y are floats, else they are 1D ndarray.

class ribbon.spiralcartesian.SpiralNielsen(a, b)[source]#

Bases: SpiralCartesianBase

The Césaro equation is \(\kappa = a e^{bs}\), where \(a > 0, b \neq 0\).

Parameters:
afloat

Parameter in the Césaro equation. Must be > 0.

bfloat

Parameter in the Césaro equation. Must be non-zero.

Methods

get_cart_coords(s)

Returns the cartesian coordinates at the given values of arclengths.

get_curvature(s)

Returns the curvature at the given values of arclengths.

get_tangent(s)

Returns the unit tangent vector at the given values of polar or arclength coordinates.

get_tangent(s)[source]#

Returns the unit tangent vector at the given values of polar or arclength coordinates.

Parameters:
sarray_like

Value of the polar coordinates or arclengths.

Returns:
ndarray

Unit tangent vectors. Shape is (2,) if s is scalar, else (n,2) where n is the length of s.

get_curvature(s)[source]#

Returns the curvature at the given values of arclengths.

Parameters:
sarray_like

Arclengths.

Returns:
float or ndarray

Curvatures (float if input is scalar, else ndarray).

get_cart_coords(s)[source]#

Returns the cartesian coordinates at the given values of arclengths.

Parameters:
sarray_like

Arclengths.

Returns:
x, ytuple

Cartesian coordinates. If s is a scalar, x and y are floats, else they are 1D ndarray.