knots.path.gen_curve4#

knots.path.gen_curve4(start_point: Pt, exit_angle: float, scale: float = 0.15) Generator[list[tuple[uint8, Pt]], tuple[Pt, float] | tuple[Pt, float, float], None][source]#

A helper to generate a sequence of quadratic Bezier segments.

The constraint imposed is that the tangent out of the start of a segment matches the tangent in from the previous.

All angles are in degrees relative to the horizontal axis.

The first yield will be an empty list.

The accumulation of the data yielded from this generator can be passed to path_data_to_path to get a matplotlib.path.Path object.

Parameters:
start_pointPt

The location of the first point of the first segment

exit_anglefloat

The angle the path should exit the first point in degrees

scalefloat, default: 0.15

This controls how “loopy” the path is. Smaller numbers stay closer to the direct line between the points and have sharper turns. Bigger numbers have gentler curves, but get farther from the direct line in the transverse direction.

Yields:
list[tuple[np.uint8, Pt]]

The next codes and locations for a Bezier segment

Receives:
end_pointPt

The end of the next segment to be generated.

entrance_anglefloat

The angle in degrees relative to the horizonatal axis the segment should approach the end_point from.