String modifiers#
A string modifier reshapes a guide before turbines are placed. Breaks and
Meander never move turbines and are not recorded in metadata["modifiers"],
since rebuilding the guide from its seed replays them. Layout modifiers are in
Layout modifiers.
import matplotlib.pyplot as plt
import oowl
from oowl import boundaries as B
from oowl import layouts as L
from oowl import modifiers as M
from oowl import strings as S
Breaks removes n_breaks internal sections, each size times the original
arc length of its string, and String spreads the requested count over
the remaining path.
Meander offsets each segment along its normal by a smoothed random walk that
peaks at roughness times the segment arc length. Endpoints stay fixed, and
the walk is redrawn until the guide does not cross itself.
circle = B.Circle(area=40_000_000)
straight_guide = S.Parallel(S.Straight(), n_strings=5, relative_spacing=0.18, seed=6)
guides = {
"intact guide": straight_guide,
"3 breaks": straight_guide.modify(M.Breaks(n_breaks=3, size=0.15, seed=5)),
"meandered": straight_guide.modify(M.Meander(roughness=0.06, seed=4)),
}
fig, axes = plt.subplots(1, 3, figsize=(15, 5))
for ax, (name, guide) in zip(axes, guides.items()):
farm = oowl.Sampler(circle, L.String(guide, 60, seed=1)).sample()[0]
farm.plot(
ax=ax,
s=24,
title=f"{name}: closest pair {farm.minimum_spacing():.0f} m",
)
fig.tight_layout()