ribbon.spiralarchimedes module#
Classes for spirals described by the polar equation r = b * theta^n.
- class ribbon.spiralarchimedes.SpiralArchimedesBase(b, n, r0)[source]#
Bases:
SpiralPolarBaseBase class for archimedean spirals. Polar equation: r = b * theta^n.
The starting point is at r =
r0and theta =t0. The arclength s is measured from (r0,t0) in the direction of increasing radius.- Parameters:
- bfloat
Parameter in the polar equation. Must be > 0.
- nfloat
Exponent in the polar equation. Must be non-zero. If negative, then r0 must be > 0.
- r0float
The spiral curve segment begins at (r = r0). Must be a non-negative value.
- Attributes:
- tincrbool
Whether radius increases with increasing theta.
- r0, t0float
The spiral curve segment begins at (r = r0, theta = t0). r0 may not be negative.
- bfloat
Parameter in the polar equation. Must be > 0.
- nfloat
Exponent in the polar equation. Must be non-zero. If negative, then
r0must be > 0.
Methods
Returns the radial coordinates corresponding to the arclengths.
arclength_to_theta(s[, s0, t0])Returns the angular coordinates corresponding to the arclengths.
get_arclength(v[, var, v0])Returns the arclength at the given values of polar coordinates.
get_cart_coords(v[, var])Returns the cartesian coordinates at the given values of polar coordinates or arclengths.
get_curvature(v[, var])Returns the curvature at the given values of polar coordinates or arclengths.
get_polar_coords(v[, var])Returns the polar coordinates at the given values of theta, r, or arclengths.
get_tangent(v[, var])Returns the unit tangent vector at the given values of polar or arclength coordinates.
r_to_theta(r)Returns the angular coordinates corresponding to the given radial coordinates.
theta_to_r(theta)Returns the radial coordinates corresponding to the given angular coordinates.
- theta_to_r(theta)[source]#
Returns the radial coordinates corresponding to the given angular coordinates.
- Parameters:
- thetaarray_like
Angular coordinates in radians.
- Returns:
- float or ndarray
Radial coordinates (float if input is scalar, else ndarray)
- r_to_theta(r)[source]#
Returns the angular coordinates corresponding to the given radial coordinates.
- Parameters:
- rarray_like
Radial coordinates.
- Returns:
- float or ndarray
Angular coordinates in radians (float if input is scalar, else ndarray).
- arclength_to_theta(s, s0=0.0, t0=None)[source]#
Returns the angular coordinates corresponding to the arclengths.
- Parameters:
- sarray_like
Arclengths measured from the starting point (as set by the instance attribute
r0) along the direction of increasing radius.- s0float
Value of the arclength at angle t0.
- t0float | None
Measure arclength from this value of the angular coordinate. If
None, set tot0, which corresponds to the radial coordinater0.
- Returns:
- float or ndarray
Radial coordinates (float if input is scalar, else ndarray).
- get_tangent(v, var='s')[source]#
Returns the unit tangent vector at the given values of polar or arclength coordinates.
- Parameters:
- varray_like
Value of the polar coordinates or arclengths.
- var{‘r’, ‘theta’, ‘s’}
Descriptor for v. Radial coordinates —
'r', angular coordinates —'theta', and arclengths —'s'.
- Returns:
- ndarray
Unit tangent vectors. Shape is (2,) if v is scalar, else (n,2) where n is the length of v.
- arclength_to_r(s)#
Returns the radial coordinates corresponding to the arclengths.
- Parameters:
- sarray_like
Arclengths measured from the starting point (as set by the instance attribute
r0) along the direction of increasing radius.
- Returns:
- float or ndarray
Radial coordinates (float if input is scalar, else ndarray).
- get_arclength(v, var='theta', v0=None)#
Returns the arclength at the given values of polar coordinates.
- Parameters:
- varray_like
Value of the polar coordinates.
- var{‘r’, ‘theta’}
Descriptor for v. Radial coordinates —
'r', angular coordinates —'theta'.- v0float or None
Origin of the arclength. If
None, will be set toself.t0ifvar = 'theta'or toself.r0ifvar = 'r'.
- Returns:
- float or ndarray
Arclength (float if input is scalar, else ndarray).
- get_cart_coords(v, var='s')#
Returns the cartesian coordinates at the given values of polar coordinates or arclengths.
- Parameters:
- varray_like
Value of the polar coordinates or arclengths.
- var{‘r’, theta’, ‘s’}
Descriptor for v. Radial coordinates —
'r', angular coordinates —'theta', and arclengths —'s'.
- Returns:
- x, ytuple
Cartesian coordinates. If v is a scalar, x and y are floats, else they are 1D *ndarray*s.
- get_curvature(v, var='s')#
Returns the curvature at the given values of polar coordinates or arclengths.
- Parameters:
- varray_like
Value of the polar coordinates or arclengths.
- var{‘r’, ‘theta’, ‘s’}
Descriptor for v. Radial coordinates —
'r', angular coordinates —'theta', and arclengths —'s'.
- Returns:
- float or ndarray
Curvatures (float if input is scalar, else ndarray).
- get_polar_coords(v, var='s')#
Returns the polar coordinates at the given values of theta, r, or arclengths.
- Parameters:
- varray_like
Value of the polar coordinates or arclengths.
- var{‘r’, ‘theta’, ‘s’}
Descriptor for v. Radial coordinates —
'r', angular coordinates —'theta', and arclengths —'s'.
- Returns:
- r, thetatuple
Polar coordinates. If v is a scalar, r and theta are floats, else they are 1D *ndarray*s.
- class ribbon.spiralarchimedes.SpiralArchimedesGeneral(b, n, r0)[source]#
Bases:
SpiralArchimedesBaseClass implementing a general archimedean spiral with polar equation r = b * theta^n.
The starting point is at r =
r0and theta =t0. Ifn> 0,r0>= 0, otherwiser0> 0. The arclength s is measured from (r0,t0) in the direction of increasing radius.For all points on this spiral r must be >=
r0and s must be >= 0. Ifn> 0, theta must be >=t0, otherwise theta <=t0.Methods
Returns the radial coordinates corresponding to the arclengths.
arclength_to_theta(s[, s0, t0])Returns the angular coordinates corresponding to the arclengths.
get_arclength(v[, var, v0])Returns the arclength at the given values of polar coordinates.
get_cart_coords(v[, var])Returns the cartesian coordinates at the given values of polar coordinates or arclengths.
get_curvature(v[, var])Returns the curvature at the given values of polar coordinates or arclengths.
get_polar_coords(v[, var])Returns the polar coordinates at the given values of theta, r, or arclengths.
get_tangent(v[, var])Returns the unit tangent vector at the given values of polar or arclength coordinates.
r_to_theta(r)Returns the angular coordinates corresponding to the given radial coordinates.
theta_to_r(theta)Returns the radial coordinates corresponding to the given angular coordinates.
- arclength_to_r(s)#
Returns the radial coordinates corresponding to the arclengths.
- Parameters:
- sarray_like
Arclengths measured from the starting point (as set by the instance attribute
r0) along the direction of increasing radius.
- Returns:
- float or ndarray
Radial coordinates (float if input is scalar, else ndarray).
- arclength_to_theta(s, s0=0.0, t0=None)#
Returns the angular coordinates corresponding to the arclengths.
- Parameters:
- sarray_like
Arclengths measured from the starting point (as set by the instance attribute
r0) along the direction of increasing radius.- s0float
Value of the arclength at angle t0.
- t0float | None
Measure arclength from this value of the angular coordinate. If
None, set tot0, which corresponds to the radial coordinater0.
- Returns:
- float or ndarray
Radial coordinates (float if input is scalar, else ndarray).
- get_arclength(v, var='theta', v0=None)#
Returns the arclength at the given values of polar coordinates.
- Parameters:
- varray_like
Value of the polar coordinates.
- var{‘r’, ‘theta’}
Descriptor for v. Radial coordinates —
'r', angular coordinates —'theta'.- v0float or None
Origin of the arclength. If
None, will be set toself.t0ifvar = 'theta'or toself.r0ifvar = 'r'.
- Returns:
- float or ndarray
Arclength (float if input is scalar, else ndarray).
- get_cart_coords(v, var='s')#
Returns the cartesian coordinates at the given values of polar coordinates or arclengths.
- Parameters:
- varray_like
Value of the polar coordinates or arclengths.
- var{‘r’, theta’, ‘s’}
Descriptor for v. Radial coordinates —
'r', angular coordinates —'theta', and arclengths —'s'.
- Returns:
- x, ytuple
Cartesian coordinates. If v is a scalar, x and y are floats, else they are 1D *ndarray*s.
- get_curvature(v, var='s')#
Returns the curvature at the given values of polar coordinates or arclengths.
- Parameters:
- varray_like
Value of the polar coordinates or arclengths.
- var{‘r’, ‘theta’, ‘s’}
Descriptor for v. Radial coordinates —
'r', angular coordinates —'theta', and arclengths —'s'.
- Returns:
- float or ndarray
Curvatures (float if input is scalar, else ndarray).
- get_polar_coords(v, var='s')#
Returns the polar coordinates at the given values of theta, r, or arclengths.
- Parameters:
- varray_like
Value of the polar coordinates or arclengths.
- var{‘r’, ‘theta’, ‘s’}
Descriptor for v. Radial coordinates —
'r', angular coordinates —'theta', and arclengths —'s'.
- Returns:
- r, thetatuple
Polar coordinates. If v is a scalar, r and theta are floats, else they are 1D *ndarray*s.
- get_tangent(v, var='s')#
Returns the unit tangent vector at the given values of polar or arclength coordinates.
- Parameters:
- varray_like
Value of the polar coordinates or arclengths.
- var{‘r’, ‘theta’, ‘s’}
Descriptor for v. Radial coordinates —
'r', angular coordinates —'theta', and arclengths —'s'.
- Returns:
- ndarray
Unit tangent vectors. Shape is (2,) if v is scalar, else (n,2) where n is the length of v.
- r_to_theta(r)#
Returns the angular coordinates corresponding to the given radial coordinates.
- Parameters:
- rarray_like
Radial coordinates.
- Returns:
- float or ndarray
Angular coordinates in radians (float if input is scalar, else ndarray).
- theta_to_r(theta)#
Returns the radial coordinates corresponding to the given angular coordinates.
- Parameters:
- thetaarray_like
Angular coordinates in radians.
- Returns:
- float or ndarray
Radial coordinates (float if input is scalar, else ndarray)
- class ribbon.spiralarchimedes.SpiralArchimedes(b, r0)[source]#
Bases:
SpiralArchimedesBaseClass implementing an Archimedean spiral with polar equation r = b * theta.
The starting point is at r =
r0and theta =t0, wherer0>= 0. The arclength s is measured from (r0,t0) in the direction of increasing radius.For all points on this spiral r must be >=
r0, s must be >= 0, and theta must be >=t0.Methods
Returns the radial coordinates corresponding to the arclengths.
arclength_to_theta(s[, s0, t0])Returns the angular coordinates corresponding to the arclengths.
get_arclength(v[, var, v0])Returns the arclength at the given values of polar coordinates.
get_cart_coords(v[, var])Returns the cartesian coordinates at the given values of polar coordinates or arclengths.
get_curvature(v[, var])Returns the curvature at the given values of polar coordinates or arclengths.
get_polar_coords(v[, var])Returns the polar coordinates at the given values of theta, r, or arclengths.
get_tangent(v[, var])Returns the unit tangent vector at the given values of polar or arclength coordinates.
r_to_theta(r)Returns the angular coordinates corresponding to the given radial coordinates.
theta_to_r(theta)Returns the radial coordinates corresponding to the given angular coordinates.
- arclength_to_r(s)#
Returns the radial coordinates corresponding to the arclengths.
- Parameters:
- sarray_like
Arclengths measured from the starting point (as set by the instance attribute
r0) along the direction of increasing radius.
- Returns:
- float or ndarray
Radial coordinates (float if input is scalar, else ndarray).
- arclength_to_theta(s, s0=0.0, t0=None)#
Returns the angular coordinates corresponding to the arclengths.
- Parameters:
- sarray_like
Arclengths measured from the starting point (as set by the instance attribute
r0) along the direction of increasing radius.- s0float
Value of the arclength at angle t0.
- t0float | None
Measure arclength from this value of the angular coordinate. If
None, set tot0, which corresponds to the radial coordinater0.
- Returns:
- float or ndarray
Radial coordinates (float if input is scalar, else ndarray).
- get_arclength(v, var='theta', v0=None)#
Returns the arclength at the given values of polar coordinates.
- Parameters:
- varray_like
Value of the polar coordinates.
- var{‘r’, ‘theta’}
Descriptor for v. Radial coordinates —
'r', angular coordinates —'theta'.- v0float or None
Origin of the arclength. If
None, will be set toself.t0ifvar = 'theta'or toself.r0ifvar = 'r'.
- Returns:
- float or ndarray
Arclength (float if input is scalar, else ndarray).
- get_cart_coords(v, var='s')#
Returns the cartesian coordinates at the given values of polar coordinates or arclengths.
- Parameters:
- varray_like
Value of the polar coordinates or arclengths.
- var{‘r’, theta’, ‘s’}
Descriptor for v. Radial coordinates —
'r', angular coordinates —'theta', and arclengths —'s'.
- Returns:
- x, ytuple
Cartesian coordinates. If v is a scalar, x and y are floats, else they are 1D *ndarray*s.
- get_curvature(v, var='s')#
Returns the curvature at the given values of polar coordinates or arclengths.
- Parameters:
- varray_like
Value of the polar coordinates or arclengths.
- var{‘r’, ‘theta’, ‘s’}
Descriptor for v. Radial coordinates —
'r', angular coordinates —'theta', and arclengths —'s'.
- Returns:
- float or ndarray
Curvatures (float if input is scalar, else ndarray).
- get_polar_coords(v, var='s')#
Returns the polar coordinates at the given values of theta, r, or arclengths.
- Parameters:
- varray_like
Value of the polar coordinates or arclengths.
- var{‘r’, ‘theta’, ‘s’}
Descriptor for v. Radial coordinates —
'r', angular coordinates —'theta', and arclengths —'s'.
- Returns:
- r, thetatuple
Polar coordinates. If v is a scalar, r and theta are floats, else they are 1D *ndarray*s.
- get_tangent(v, var='s')#
Returns the unit tangent vector at the given values of polar or arclength coordinates.
- Parameters:
- varray_like
Value of the polar coordinates or arclengths.
- var{‘r’, ‘theta’, ‘s’}
Descriptor for v. Radial coordinates —
'r', angular coordinates —'theta', and arclengths —'s'.
- Returns:
- ndarray
Unit tangent vectors. Shape is (2,) if v is scalar, else (n,2) where n is the length of v.
- r_to_theta(r)#
Returns the angular coordinates corresponding to the given radial coordinates.
- Parameters:
- rarray_like
Radial coordinates.
- Returns:
- float or ndarray
Angular coordinates in radians (float if input is scalar, else ndarray).
- theta_to_r(theta)#
Returns the radial coordinates corresponding to the given angular coordinates.
- Parameters:
- thetaarray_like
Angular coordinates in radians.
- Returns:
- float or ndarray
Radial coordinates (float if input is scalar, else ndarray)
- class ribbon.spiralarchimedes.SpiralFermat(b, r0)[source]#
Bases:
SpiralArchimedesBaseClass implementing a general archimedean spiral with polar equation r = b * theta^(1/2).
The starting point is at r =
r0and theta =t0, wherer0>= 0. The arclength s is measured from (r0,t0) in the direction of increasing radius.For all points on this spiral r must be >=
r0, s must be >= 0, and theta must be >=t0.- Parameters:
- bfloat
Parameter in the polar equation. Must be > 0.
- r0float
The spiral curve segment begins at (r = r0). Must be a non-negative value.
Methods
Returns the radial coordinates corresponding to the arclengths.
arclength_to_theta(s[, s0, t0])Returns the angular coordinates corresponding to the arclengths.
get_arclength(v[, var, v0])Returns the arclength at the given values of polar coordinates.
get_cart_coords(v[, var])Returns the cartesian coordinates at the given values of polar coordinates or arclengths.
get_curvature(v[, var])Returns the curvature at the given values of polar coordinates or arclengths.
get_polar_coords(v[, var])Returns the polar coordinates at the given values of theta, r, or arclengths.
get_tangent(v[, var])Returns the unit tangent vector at the given values of polar or arclength coordinates.
r_to_theta(r)Returns the angular coordinates corresponding to the given radial coordinates.
theta_to_r(theta)Returns the radial coordinates corresponding to the given angular coordinates.
- arclength_to_r(s)#
Returns the radial coordinates corresponding to the arclengths.
- Parameters:
- sarray_like
Arclengths measured from the starting point (as set by the instance attribute
r0) along the direction of increasing radius.
- Returns:
- float or ndarray
Radial coordinates (float if input is scalar, else ndarray).
- arclength_to_theta(s, s0=0.0, t0=None)#
Returns the angular coordinates corresponding to the arclengths.
- Parameters:
- sarray_like
Arclengths measured from the starting point (as set by the instance attribute
r0) along the direction of increasing radius.- s0float
Value of the arclength at angle t0.
- t0float | None
Measure arclength from this value of the angular coordinate. If
None, set tot0, which corresponds to the radial coordinater0.
- Returns:
- float or ndarray
Radial coordinates (float if input is scalar, else ndarray).
- get_arclength(v, var='theta', v0=None)#
Returns the arclength at the given values of polar coordinates.
- Parameters:
- varray_like
Value of the polar coordinates.
- var{‘r’, ‘theta’}
Descriptor for v. Radial coordinates —
'r', angular coordinates —'theta'.- v0float or None
Origin of the arclength. If
None, will be set toself.t0ifvar = 'theta'or toself.r0ifvar = 'r'.
- Returns:
- float or ndarray
Arclength (float if input is scalar, else ndarray).
- get_cart_coords(v, var='s')#
Returns the cartesian coordinates at the given values of polar coordinates or arclengths.
- Parameters:
- varray_like
Value of the polar coordinates or arclengths.
- var{‘r’, theta’, ‘s’}
Descriptor for v. Radial coordinates —
'r', angular coordinates —'theta', and arclengths —'s'.
- Returns:
- x, ytuple
Cartesian coordinates. If v is a scalar, x and y are floats, else they are 1D *ndarray*s.
- get_curvature(v, var='s')#
Returns the curvature at the given values of polar coordinates or arclengths.
- Parameters:
- varray_like
Value of the polar coordinates or arclengths.
- var{‘r’, ‘theta’, ‘s’}
Descriptor for v. Radial coordinates —
'r', angular coordinates —'theta', and arclengths —'s'.
- Returns:
- float or ndarray
Curvatures (float if input is scalar, else ndarray).
- get_polar_coords(v, var='s')#
Returns the polar coordinates at the given values of theta, r, or arclengths.
- Parameters:
- varray_like
Value of the polar coordinates or arclengths.
- var{‘r’, ‘theta’, ‘s’}
Descriptor for v. Radial coordinates —
'r', angular coordinates —'theta', and arclengths —'s'.
- Returns:
- r, thetatuple
Polar coordinates. If v is a scalar, r and theta are floats, else they are 1D *ndarray*s.
- get_tangent(v, var='s')#
Returns the unit tangent vector at the given values of polar or arclength coordinates.
- Parameters:
- varray_like
Value of the polar coordinates or arclengths.
- var{‘r’, ‘theta’, ‘s’}
Descriptor for v. Radial coordinates —
'r', angular coordinates —'theta', and arclengths —'s'.
- Returns:
- ndarray
Unit tangent vectors. Shape is (2,) if v is scalar, else (n,2) where n is the length of v.
- r_to_theta(r)#
Returns the angular coordinates corresponding to the given radial coordinates.
- Parameters:
- rarray_like
Radial coordinates.
- Returns:
- float or ndarray
Angular coordinates in radians (float if input is scalar, else ndarray).
- theta_to_r(theta)#
Returns the radial coordinates corresponding to the given angular coordinates.
- Parameters:
- thetaarray_like
Angular coordinates in radians.
- Returns:
- float or ndarray
Radial coordinates (float if input is scalar, else ndarray)
- class ribbon.spiralarchimedes.SpiralHyperbolic(b, r0)[source]#
Bases:
SpiralArchimedesBaseClass implementing a general archimedean spiral with polar equation r = b * theta^(-1).
The starting point is at r =
r0and theta =t0, wherer0> 0. The arclength s is measured from (r0,t0) in the direction of increasing radius.For all points on this spiral r must be >=
r0, s must be >= 0, and theta must be <=t0.- Parameters:
- bfloat
Parameter in the polar equation. Must be > 0.
- r0float
The spiral curve segment begins at (r = r0). Must be a non-negative value.
Methods
Returns the radial coordinates corresponding to the arclengths.
arclength_to_theta(s[, s0, t0])Returns the angular coordinates corresponding to the arclengths.
get_arclength(v[, var, v0])Returns the arclength at the given values of polar coordinates.
get_cart_coords(v[, var])Returns the cartesian coordinates at the given values of polar coordinates or arclengths.
get_curvature(v[, var])Returns the curvature at the given values of polar coordinates or arclengths.
get_polar_coords(v[, var])Returns the polar coordinates at the given values of theta, r, or arclengths.
get_tangent(v[, var])Returns the unit tangent vector at the given values of polar or arclength coordinates.
r_to_theta(r)Returns the angular coordinates corresponding to the given radial coordinates.
theta_to_r(theta)Returns the radial coordinates corresponding to the given angular coordinates.
- arclength_to_r(s)#
Returns the radial coordinates corresponding to the arclengths.
- Parameters:
- sarray_like
Arclengths measured from the starting point (as set by the instance attribute
r0) along the direction of increasing radius.
- Returns:
- float or ndarray
Radial coordinates (float if input is scalar, else ndarray).
- arclength_to_theta(s, s0=0.0, t0=None)#
Returns the angular coordinates corresponding to the arclengths.
- Parameters:
- sarray_like
Arclengths measured from the starting point (as set by the instance attribute
r0) along the direction of increasing radius.- s0float
Value of the arclength at angle t0.
- t0float | None
Measure arclength from this value of the angular coordinate. If
None, set tot0, which corresponds to the radial coordinater0.
- Returns:
- float or ndarray
Radial coordinates (float if input is scalar, else ndarray).
- get_arclength(v, var='theta', v0=None)#
Returns the arclength at the given values of polar coordinates.
- Parameters:
- varray_like
Value of the polar coordinates.
- var{‘r’, ‘theta’}
Descriptor for v. Radial coordinates —
'r', angular coordinates —'theta'.- v0float or None
Origin of the arclength. If
None, will be set toself.t0ifvar = 'theta'or toself.r0ifvar = 'r'.
- Returns:
- float or ndarray
Arclength (float if input is scalar, else ndarray).
- get_cart_coords(v, var='s')#
Returns the cartesian coordinates at the given values of polar coordinates or arclengths.
- Parameters:
- varray_like
Value of the polar coordinates or arclengths.
- var{‘r’, theta’, ‘s’}
Descriptor for v. Radial coordinates —
'r', angular coordinates —'theta', and arclengths —'s'.
- Returns:
- x, ytuple
Cartesian coordinates. If v is a scalar, x and y are floats, else they are 1D *ndarray*s.
- get_curvature(v, var='s')#
Returns the curvature at the given values of polar coordinates or arclengths.
- Parameters:
- varray_like
Value of the polar coordinates or arclengths.
- var{‘r’, ‘theta’, ‘s’}
Descriptor for v. Radial coordinates —
'r', angular coordinates —'theta', and arclengths —'s'.
- Returns:
- float or ndarray
Curvatures (float if input is scalar, else ndarray).
- get_polar_coords(v, var='s')#
Returns the polar coordinates at the given values of theta, r, or arclengths.
- Parameters:
- varray_like
Value of the polar coordinates or arclengths.
- var{‘r’, ‘theta’, ‘s’}
Descriptor for v. Radial coordinates —
'r', angular coordinates —'theta', and arclengths —'s'.
- Returns:
- r, thetatuple
Polar coordinates. If v is a scalar, r and theta are floats, else they are 1D *ndarray*s.
- get_tangent(v, var='s')#
Returns the unit tangent vector at the given values of polar or arclength coordinates.
- Parameters:
- varray_like
Value of the polar coordinates or arclengths.
- var{‘r’, ‘theta’, ‘s’}
Descriptor for v. Radial coordinates —
'r', angular coordinates —'theta', and arclengths —'s'.
- Returns:
- ndarray
Unit tangent vectors. Shape is (2,) if v is scalar, else (n,2) where n is the length of v.
- r_to_theta(r)#
Returns the angular coordinates corresponding to the given radial coordinates.
- Parameters:
- rarray_like
Radial coordinates.
- Returns:
- float or ndarray
Angular coordinates in radians (float if input is scalar, else ndarray).
- theta_to_r(theta)#
Returns the radial coordinates corresponding to the given angular coordinates.
- Parameters:
- thetaarray_like
Angular coordinates in radians.
- Returns:
- float or ndarray
Radial coordinates (float if input is scalar, else ndarray)
- class ribbon.spiralarchimedes.SpiralLituus(b, r0)[source]#
Bases:
SpiralArchimedesBaseClass implementing a general archimedean spiral with polar equation r = b * theta^(-1/2).
The starting point is at r =
r0and theta =t0, wherer0> 0. The arclength s is measured from (r0,t0) in the direction of increasing radius.For all points on this spiral r must be >=
r0, s must be >= 0, and theta must be <=t0.- Parameters:
- bfloat
Parameter in the polar equation. Must be > 0.
- r0float
The spiral curve segment begins at (r = r0). Must be a non-negative value.
Methods
Returns the radial coordinates corresponding to the arclengths.
arclength_to_theta(s[, s0, t0])Returns the angular coordinates corresponding to the arclengths.
get_arclength(v[, var, v0])Returns the arclength at the given values of polar coordinates.
get_cart_coords(v[, var])Returns the cartesian coordinates at the given values of polar coordinates or arclengths.
get_curvature(v[, var])Returns the curvature at the given values of polar coordinates or arclengths.
get_polar_coords(v[, var])Returns the polar coordinates at the given values of theta, r, or arclengths.
get_tangent(v[, var])Returns the unit tangent vector at the given values of polar or arclength coordinates.
r_to_theta(r)Returns the angular coordinates corresponding to the given radial coordinates.
theta_to_r(theta)Returns the radial coordinates corresponding to the given angular coordinates.
- arclength_to_r(s)#
Returns the radial coordinates corresponding to the arclengths.
- Parameters:
- sarray_like
Arclengths measured from the starting point (as set by the instance attribute
r0) along the direction of increasing radius.
- Returns:
- float or ndarray
Radial coordinates (float if input is scalar, else ndarray).
- arclength_to_theta(s, s0=0.0, t0=None)#
Returns the angular coordinates corresponding to the arclengths.
- Parameters:
- sarray_like
Arclengths measured from the starting point (as set by the instance attribute
r0) along the direction of increasing radius.- s0float
Value of the arclength at angle t0.
- t0float | None
Measure arclength from this value of the angular coordinate. If
None, set tot0, which corresponds to the radial coordinater0.
- Returns:
- float or ndarray
Radial coordinates (float if input is scalar, else ndarray).
- get_arclength(v, var='theta', v0=None)#
Returns the arclength at the given values of polar coordinates.
- Parameters:
- varray_like
Value of the polar coordinates.
- var{‘r’, ‘theta’}
Descriptor for v. Radial coordinates —
'r', angular coordinates —'theta'.- v0float or None
Origin of the arclength. If
None, will be set toself.t0ifvar = 'theta'or toself.r0ifvar = 'r'.
- Returns:
- float or ndarray
Arclength (float if input is scalar, else ndarray).
- get_cart_coords(v, var='s')#
Returns the cartesian coordinates at the given values of polar coordinates or arclengths.
- Parameters:
- varray_like
Value of the polar coordinates or arclengths.
- var{‘r’, theta’, ‘s’}
Descriptor for v. Radial coordinates —
'r', angular coordinates —'theta', and arclengths —'s'.
- Returns:
- x, ytuple
Cartesian coordinates. If v is a scalar, x and y are floats, else they are 1D *ndarray*s.
- get_curvature(v, var='s')#
Returns the curvature at the given values of polar coordinates or arclengths.
- Parameters:
- varray_like
Value of the polar coordinates or arclengths.
- var{‘r’, ‘theta’, ‘s’}
Descriptor for v. Radial coordinates —
'r', angular coordinates —'theta', and arclengths —'s'.
- Returns:
- float or ndarray
Curvatures (float if input is scalar, else ndarray).
- get_polar_coords(v, var='s')#
Returns the polar coordinates at the given values of theta, r, or arclengths.
- Parameters:
- varray_like
Value of the polar coordinates or arclengths.
- var{‘r’, ‘theta’, ‘s’}
Descriptor for v. Radial coordinates —
'r', angular coordinates —'theta', and arclengths —'s'.
- Returns:
- r, thetatuple
Polar coordinates. If v is a scalar, r and theta are floats, else they are 1D *ndarray*s.
- get_tangent(v, var='s')#
Returns the unit tangent vector at the given values of polar or arclength coordinates.
- Parameters:
- varray_like
Value of the polar coordinates or arclengths.
- var{‘r’, ‘theta’, ‘s’}
Descriptor for v. Radial coordinates —
'r', angular coordinates —'theta', and arclengths —'s'.
- Returns:
- ndarray
Unit tangent vectors. Shape is (2,) if v is scalar, else (n,2) where n is the length of v.
- r_to_theta(r)#
Returns the angular coordinates corresponding to the given radial coordinates.
- Parameters:
- rarray_like
Radial coordinates.
- Returns:
- float or ndarray
Angular coordinates in radians (float if input is scalar, else ndarray).
- theta_to_r(theta)#
Returns the radial coordinates corresponding to the given angular coordinates.
- Parameters:
- thetaarray_like
Angular coordinates in radians.
- Returns:
- float or ndarray
Radial coordinates (float if input is scalar, else ndarray)