Bezmerizing is a tiny quirky library with some potentially helpful classes and functions for working with Bezier curve functions, like:
- Finding points on the curve
- Calculating tangents
- Generating curves from lists of points with Catmull-Rom
- Producing lists of points offset at a certain distance from curve normals
Additionally, the fancy_curve()
function generates a polygon that traces
"around" a list of Bezier curves, with adjustable thickness along the curve.
From this repository:
pip install https://github.com/aparrish/bezmerizing/archive/main.zip
This version includes some breaking changes from previous versions.
- Added more mathy features for the Bézier curve classes (e.g., derivatives, normals, inflections, measure of flatness, curve splitting).
- Most objects now have a
.to_svg_path()
method, which returns the SVG path definition necessary to draw the shape in question. - The
.offsets()
methods now perform some simple normalization techniques on offset curves, including cusp trimming and recursive subdivision. - The
interp
parameter for Polyline curves has been removed. (Interpolation is always performed with scipy's CubicSpline class.) - Added methods to find the area and winding direction (clockwise or counterclockwise) of polylines.
- Added method to find intersections of polylines.
- Adopted
pyproject.toml
for all you people that run up-to-date Python versions. - Removed dependency on flat, along with
explicit integration features (such as the
Path
class). - Changed license to Anti-Capitalist Software License v1.4.
I've had Pomax's grand tome open in a tab for weeks, and I used Simon Cozens' beziers.py to sanity check some of my own implementations. Big thanks to whoever wrote these lecture notes and this Stack Exchange thread.
Much of the original Bezier math was adapted from p5.js.
See LICENSE
.