Strings#
Ordered line guides and their composable modifiers. String modifiers are
documented with the shared Modifiers API because they follow the same
.modify(...) protocol as boundary and layout modifiers.
|
One or more ordered logical strings made from continuous segments. |
|
A straight string guide. |
|
A circular arc whose chord is horizontal before rotation. |
|
A smooth random guide constructed from low-frequency harmonics. |
|
One string through given vertices, in the order given. |
|
A base guide with an ordered chain of geometry modifiers. |
|
Several guides combined into one guide for one farm. |
|
Parallel copies of one logical string, centered on the original. |
|
Randomly oriented organic strings scattered without touching. |
Composable guide geometry for turbine-string layouts.
- class oowl.strings.Arc(radius=1.0, *, span=90.0, rotation=0.0, center=(0.0, 0.0))[source]#
A circular arc whose chord is horizontal before rotation.
spanis the arc’s angle in degrees. A positive span bends toward +y and a negative one toward -y. The arc’s midpoint sits atcenter, androtationturns it counterclockwise in degrees.
- class oowl.strings.Composite(base, modifiers)[source]#
A base guide with an ordered chain of geometry modifiers.
- Parameters:
base (StringGuide)
modifiers (Iterable[StringModifier])
- modify(*modifiers)[source]#
Return a new composite with
modifiersappended to this chain.- Parameters:
modifiers (StringModifier)
- Return type:
- class oowl.strings.Multi(strings)[source]#
Several guides combined into one guide for one farm.
- Parameters:
strings (Sequence[StringGuide])
- class oowl.strings.Organic(length=1.0, *, roughness=0.25, n_harmonics=4, rotation=0.0, center=(0.0, 0.0), seed=None)[source]#
A smooth random guide constructed from low-frequency harmonics.
The lateral offset along the normalized length \(s\) is
\[y(s)=\sum_{k=1}^{n} a_k \frac{\sin(k\pi s)}{k^2},\]with standard normal \(a_k\) and
n = n_harmonics. It is scaled so the peak offset isroughness * length.rotationandcenterplace it as inStraight. Withoutseed, aStringlayout draws a new shape for every farm.
- class oowl.strings.Parallel(string, n_strings, *, relative_spacing=0.2, rotation_spread=0.0, longitudinal_jitter=0.0, spacing_jitter=0.0, seed=None)[source]#
Parallel copies of one logical string, centered on the original.
Neighboring copies sit
relative_spacingtimes the string length apart, normal to its chord, and each gap varies uniformly by up tospacing_jitterof itself. Each copy shifts along the chord by up tolongitudinal_jittertimes the length and turns about the string’s centroid by a normal angle withrotation_spreaddegrees of standard deviation.
- class oowl.strings.Polyline(coordinates)[source]#
One string through given vertices, in the order given.
coordinatesis an(N, 2)array of at least two points, such as a cable route or a measured turbine row. It is kept as given, since aStringlayout sets the scale and position. As inPolygon, input is never repaired, so a point repeated consecutively is refused rather than dropped. Scalar or non-numericcoordinatesraiseTypeError. A wrong shape, fewer than two points, non-finite values, a repeated point or a length that overflows raiseValueError. Like theexteriorofPolygon, the repr lists up to four vertices and gives a longer array by its shape.- Parameters:
coordinates (ArrayLike)
- class oowl.strings.Scattered(n_strings, *, length=1.0, length_variation=0.35, roughness=0.25, n_harmonics=4, relative_spacing=0.15, seed=None)[source]#
Randomly oriented organic strings scattered without touching.
Each of
n_stringsOrganicstrings, with the givenroughnessandn_harmonics, islengthtimes a uniform factor within1 ± length_variation, and keeps at leastrelative_spacing * lengthfrom the others. Strings are placed uniformly in a square that grows whenever a string does not fit, and the result is centered on the origin.
- class oowl.strings.Straight(length=1.0, *, rotation=0.0, center=(0.0, 0.0))[source]#
A straight string guide.
The line of
lengthruns along x, turns counterclockwise byrotationdegrees and is centered oncenter.
- class oowl.strings.StringGuide(strings)[source]#
One or more ordered logical strings made from continuous segments.
A guide only fixes the shape and relative size of turbine strings.
Stringplaces turbines along it and sets the scale. Guides combine withMultiandParalleland change withmodify(). A random guide or modifier given noseeddraws one, and aStringlayout redraws it from its own seed, so every sampled farm gets its own guide. A givenseedkeeps its shape.- Parameters:
strings (tuple[_LogicalString, ...])
- property geometry: LineString | MultiLineString#
Shapely geometry of every segment.
- modify(*modifiers)[source]#
Return a composite guide with modifiers applied in order.
- Parameters:
modifiers (StringModifier)
- Return type:
- plot(ax=None, **kwargs)[source]#
Plot the guide and return its Matplotlib axes.
- Parameters:
ax (matplotlib.axes.Axes | None)
kwargs (Any)
- Return type: