3-D walk layout¶
The corkscrew: the 2-D walk lifted by a constant step in z.
lexograph.layout.walk3d.walk3d_layout(steps, *, turn=-90.0, z_step=1.0, scale=1.0, start=(0.0, 0.0, 0.0), heading=(1.0, 0.0))
¶
Walk the 2-D turtle in the xy-plane while climbing a constant step in z.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
steps
|
Iterable[float]
|
One forward (in-plane) step length per unit. |
required |
turn
|
float
|
Degrees to turn the in-plane heading after each step. |
-90.0
|
z_step
|
float
|
The constant vertical lift added per unit (the corkscrew pitch). |
1.0
|
scale
|
float
|
A multiplier applied to every in-plane step length. |
1.0
|
start
|
tuple[float, float, float]
|
The starting |
(0.0, 0.0, 0.0)
|
heading
|
tuple[float, float]
|
The initial in-plane heading; normalised internally. |
(1.0, 0.0)
|
Returns:
| Type | Description |
|---|---|
Coords
|
An |
Coords
|
|
Contract
- The result has exactly
N + 1rows forNsteps. - The
zcolumn increases by exactlyz_stepbetween consecutive rows. - The
xycolumns equal the 2-D walk with the same parameters.
Examples:
>>> walk3d_layout([1.0, 1.0], z_step=2.0).round(6).tolist()
[[0.0, 0.0, 0.0], [1.0, 0.0, 2.0], [1.0, -1.0, 4.0]]