# maximum_bend_radii¶

ipkiss3.all.maximum_bend_radii(control_shape, rounding_algorithms=<class 'ipkiss.geometry.shapes.modifiers.ShapeRound'>, reverse_individual_bends=None)

Calculate the maximum bend radius for each turn to be made along a control shape

An open shape with N points has N-2 turns (the first turn is in the 2nd point and so forth), and thus returns N-2 radii.

For a closed shape, the first turn is in the 1st point (from the last to the 2nd) and so forth. A shape with N points has N turns and returns N radii

The return value can be passed directly to the bend_radii parameter of i3.RoundedTrace.Layout or i3.RoundedWaveguide.Layout

Parameters
control_shape: Shape or np.ndarray

The control shape which will be rounded

rounding_algorithms: List[ShapeRound, SplineRoundingAlgorithm()] or single value

The rounding algorithms to apply in each turn in the shape. When a single rounding algorithm is given it will be used for the whole shape

reverse_individual_bends: List[bool] or None

For each turn, whether to reverse the bend (applicable for asymmetric bends)

Returns
max_radii: List[float]

Returns the maximum bend radius in each turn.

Raises
Raises a ValueError if the shape contains an angle for which the required radius cannot be calculated.

Examples

```import ipkiss3.all as i3
control_shape = i3.Shape([(0.0, 0.0), (20.0, 0.0), (30.0, 10.0), (-10.0, 10.0), (-10.0, 40.0)])
rmax = i3.maximum_bend_radii(control_shape)  #  use the default circular rounding
waveguide =  i3.RoundedWaveguide()
waveguide_layout = waveguide.Layout(shape=control_shape, bend_radii=rmax)
waveguide_layout.visualize()
```
```import ipkiss3.all as i3
round_spline = i3.SplineRoundingAlgorithm(adiabatic_angles=(0, 30))
control_shape = i3.Shape([(0.0, 0.0), (100.0, 0.0), (100.0, 120.0), (200.0, 120.0),
(200.0, -100.0), (300.0, 75.0)])
rmax = i3.maximum_bend_radii(control_shape,
rounding_algorithms=round_spline,
reverse_individual_bends=[False, True, False, False])
waveguide = i3.RoundedWaveguide()
waveguide_layout = waveguide.Layout(shape=control_shape, rounding_algorithm=round_spline, bend_radii=rmax)
waveguide_layout.visualize()
```