coords.Coords.spiral#
- Coords.spiral(dir=(0, 1, 2), scale=(1.0, 1.0, 1.0), rfunc=<function Coords.<lambda>>, zfunc=<function Coords.<lambda>>, angle_spec=0.017453292519943295)#
Perform a spiral transformation.
This is similar to
cylindrical_to_cartesian()but allows the specification of two functions defining extra transformation functions for the r and z directions to produce spiral and helical geometries.Parameters#
dir, scale, angle_spec: see
cylindrical_to_cartesian()- rfunc: callable, optional
Function r(theta) taking one float parameter and returning a float. The values
rfunc(theta)are added to the provided r. The theta values are according to angle_spec.- zfunc: callable, optional
Function z(theta) taking one float parameter and returning a float. The values
rfunc(theta)are added to the provided z. The theta values are according to angle_spec.
Notes#
The default rfunc converts points along the y-axis into an Archimedes spiral.
Examples#
Create an Archimedes spiral with two turns and a point every 10 degrees
>>> X = Coords([[0.0, 0.0, 0.0], ... [0.0, 90.0, 0.0], ... [0.0, 180.0, 0.0], ... [0.0, 270.0, 0.0], ... [0.0, 360.0, 0.0], ... [0.0, 450.0, 0.0], ... [0.0, 540.0, 0.0], ... [0.0, 630.0, 0.0], ... [0.0, 720.0, 0.0]]) >>> Y = X.spiral() >>> print(Y[::4]) # print one point every turn [[0. 0. 0.] [1. 0. 0.] [2. 0. 0.]]