Skip to main content

bezier

Helper for Bézier Curves, Triangles, and Higher Order Objects

CircleCI Build Travis Build AppVeyor CI Build Code Coverage

Documentation Status Zenodo DOI for ``bezier`` "Journal of Open Source Science" DOI for ``bezier``

This library provides:

Dive in and take a look!

https://raw.githubusercontent.com/dhermes/bezier/0.9.0/docs/images/surfaces6Q_and_7Q.png

Why Bézier?

A Bézier curve (and surface, etc.) is a parametric curve that uses the Bernstein basis:

https://raw.githubusercontent.com/dhermes/bezier/0.9.0/docs/images/bernstein_basis.png

to define a curve as a linear combination:

https://raw.githubusercontent.com/dhermes/bezier/0.9.0/docs/images/bezier_defn.png

This comes from the fact that the weights sum to one:

https://raw.githubusercontent.com/dhermes/bezier/0.9.0/docs/images/sum_to_unity.png

This can be generalized to higher order by considering three, four, etc. non-negative weights that sum to one (in the above we have the two non-negative weights s and 1 - s).

Due to their simple form, Bézier curves:

  • can easily model geometric objects as parametric curves, surfaces, etc.

  • can be computed in an efficient and numerically stable way via de Casteljau’s algorithm

  • can utilize convex optimization techniques for many algorithms (such as curve-curve intersection), since curves (and surfaces, etc.) are convex combinations of the basis

Many applications – as well as the history of their development – are described in “The Bernstein polynomial basis: A centennial retrospective”, for example;

  • aids physical analysis using finite element methods (FEM) on isogeometric models by using geometric shape functions called NURBS to represent data

  • used in robust control of dynamic systems; utilizes convexity to create a hull of curves

Installing

The bezier Python package can be installed with pip:

$ python    -m pip install --upgrade bezier
$ python2.7 -m pip install --upgrade bezier
$ python3.7 -m pip install --upgrade bezier

bezier is open-source, so you can alternatively grab the source code from GitHub and install from source.

Getting Started

For example, to create a curve:

>>> nodes1 = np.asfortranarray([
...     [0.0, 0.5, 1.0],
...     [0.0, 1.0, 0.0],
... ])
>>> curve1 = bezier.Curve(nodes1, degree=2)

The intersection (points) between two curves can also be determined:

>>> nodes2 = np.asfortranarray([
...     [0.0, 0.25,  0.5, 0.75, 1.0],
...     [0.0, 2.0 , -2.0, 2.0 , 0.0],
... ])
>>> curve2 = bezier.Curve.from_nodes(nodes2)
>>> intersections = curve1.intersect(curve2)
>>> intersections
array([[0.31101776, 0.68898224, 0. , 1. ],
       [0.31101776, 0.68898224, 0. , 1. ]])
>>> s_vals = np.asfortranarray(intersections[0, :])
>>> points = curve1.evaluate_multi(s_vals)
>>> points
array([[0.31101776, 0.68898224, 0. , 1. ],
       [0.42857143, 0.42857143, 0. , 0. ]])

and then we can plot these curves (along with their intersections):

>>> import matplotlib.pyplot as plt
>>> import seaborn
>>> seaborn.set()
>>>
>>> ax = curve1.plot(num_pts=256)
>>> _ = curve2.plot(num_pts=256, ax=ax)
>>> lines = ax.plot(
...     points[0, :], points[1, :],
...     marker="o", linestyle="None", color="black")
>>> _ = ax.axis("scaled")
>>> _ = ax.set_xlim(-0.125, 1.125)
>>> _ = ax.set_ylim(-0.0625, 0.625)
>>> plt.show()
https://raw.githubusercontent.com/dhermes/bezier/0.9.0/docs/images/curves1_and_13.png

For API-level documentation, check out the Bézier Python package documentation.

Development

To work on adding a feature or to run the functional tests, see the DEVELOPMENT doc for more information on how to get started.

License

bezier is made available under the Apache 2.0 License. For more details, see the LICENSE.

Metadata

Release files for bezier 0.9.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for bezier 0.9.0
File Size Uploaded Provenance Actions
bezier-0.9.0.tar.gz 372.4 kB Without provenance Details for bezier-0.9.0.tar.gz

Built distributions (wheels)

Table of built distributions (wheels) for bezier 0.9.0
File Actions
bezier-0.9.0-cp37-none-win_amd64.whl CPython 3.7 none Windows x86-64 Details for bezier-0.9.0-cp37-none-win_amd64.whl
bezier-0.9.0-cp37-none-win32.whl CPython 3.7 none Windows x86-32 Details for bezier-0.9.0-cp37-none-win32.whl
bezier-0.9.0-cp37-cp37m-manylinux1_x86_64.whl CPython 3.7 CPython 3.7 pymalloc Linux glibc 2.5+ x86-64 Details for bezier-0.9.0-cp37-cp37m-manylinux1_x86_64.whl
bezier-0.9.0-cp37-cp37m-manylinux1_i686.whl CPython 3.7 CPython 3.7 pymalloc Linux glibc 2.5+ x86-32 Details for bezier-0.9.0-cp37-cp37m-manylinux1_i686.whl
bezier-0.9.0-cp37-cp37m-macosx_10_6_intel.whl CPython 3.7 CPython 3.7 pymalloc macOS 10.6+ Intel (x86-64, i386) Details for bezier-0.9.0-cp37-cp37m-macosx_10_6_intel.whl
bezier-0.9.0-cp36-none-win_amd64.whl CPython 3.6 none Windows x86-64 Details for bezier-0.9.0-cp36-none-win_amd64.whl
bezier-0.9.0-cp36-none-win32.whl CPython 3.6 none Windows x86-32 Details for bezier-0.9.0-cp36-none-win32.whl
bezier-0.9.0-cp36-cp36m-manylinux1_x86_64.whl CPython 3.6 CPython 3.6 pymalloc Linux glibc 2.5+ x86-64 Details for bezier-0.9.0-cp36-cp36m-manylinux1_x86_64.whl
bezier-0.9.0-cp36-cp36m-manylinux1_i686.whl CPython 3.6 CPython 3.6 pymalloc Linux glibc 2.5+ x86-32 Details for bezier-0.9.0-cp36-cp36m-manylinux1_i686.whl
bezier-0.9.0-cp36-cp36m-macosx_10_6_intel.whl CPython 3.6 CPython 3.6 pymalloc macOS 10.6+ Intel (x86-64, i386) Details for bezier-0.9.0-cp36-cp36m-macosx_10_6_intel.whl
bezier-0.9.0-cp27-none-win_amd64.whl CPython 2.7 none Windows x86-64 Details for bezier-0.9.0-cp27-none-win_amd64.whl
bezier-0.9.0-cp27-none-win32.whl CPython 2.7 none Windows x86-32 Details for bezier-0.9.0-cp27-none-win32.whl
bezier-0.9.0-cp27-cp27mu-manylinux1_x86_64.whl CPython 2.7 CPython 2.7 pymalloc wide-unicode Linux glibc 2.5+ x86-64 Details for bezier-0.9.0-cp27-cp27mu-manylinux1_x86_64.whl
bezier-0.9.0-cp27-cp27mu-manylinux1_i686.whl CPython 2.7 CPython 2.7 pymalloc wide-unicode Linux glibc 2.5+ x86-32 Details for bezier-0.9.0-cp27-cp27mu-manylinux1_i686.whl
bezier-0.9.0-cp27-cp27m-manylinux1_x86_64.whl CPython 2.7 CPython 2.7 pymalloc Linux glibc 2.5+ x86-64 Details for bezier-0.9.0-cp27-cp27m-manylinux1_x86_64.whl
bezier-0.9.0-cp27-cp27m-manylinux1_i686.whl CPython 2.7 CPython 2.7 pymalloc Linux glibc 2.5+ x86-32 Details for bezier-0.9.0-cp27-cp27m-manylinux1_i686.whl
bezier-0.9.0-cp27-cp27m-macosx_10_6_intel.whl CPython 2.7 CPython 2.7 pymalloc macOS 10.6+ Intel (x86-64, i386) Details for bezier-0.9.0-cp27-cp27m-macosx_10_6_intel.whl

Total release size: 21.8 MB

Release files / bezier-0.9.0.tar.gz

Download URL bezier-0.9.0.tar.gz
Size 372.4 kB
Tags Source
SHA-256 checksum
How to use checksums
fd6c3c3986f9514748fa0481011da581188131fcf6ba68f3f1f570da9cf24f24
BLAKE2b-256 checksum
How to use checksums
6eeebcee913c6768fd68dff95a2ee8cb07c73223b3ca7da11d97e17ee9d2649e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/1.11.0 pkginfo/1.4.2 requests/2.19.1 setuptools/40.4.3 requests-toolbelt/0.8.0 tqdm/4.24.0 CPython/3.7.1

Release files / bezier-0.9.0-cp37-none-win_amd64.whl

Download URL bezier-0.9.0-cp37-none-win_amd64.whl
Size 732.7 kB
Tags CPython 3.7 Windows x86-64
SHA-256 checksum
How to use checksums
c7ccf2402d4a98d069aed83e2875dce15fcc128a2881c2307b12c71469c0d85b
BLAKE2b-256 checksum
How to use checksums
e5679eb682169d8e21e77852b1a7b27eaeca3ff371d996dbefb10c4dd377a833
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/1.11.0 pkginfo/1.4.2 requests/2.19.1 setuptools/40.4.3 requests-toolbelt/0.8.0 tqdm/4.24.0 CPython/3.7.1

Release files / bezier-0.9.0-cp37-none-win32.whl

Download URL bezier-0.9.0-cp37-none-win32.whl
Size 690.0 kB
Tags CPython 3.7 Windows x86-32
SHA-256 checksum
How to use checksums
655de185a55247b571cf517ad2e1e6f5b5d45b20fefde5b18c84e1e5ee05f6a0
BLAKE2b-256 checksum
How to use checksums
14278d2d5b5e1dc5bce1cd2f47d7c1d725cdbf92e3b16bde97b7c3b0304784cc
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/1.11.0 pkginfo/1.4.2 requests/2.19.1 setuptools/40.4.3 requests-toolbelt/0.8.0 tqdm/4.24.0 CPython/3.7.1

Release files / bezier-0.9.0-cp37-cp37m-manylinux1_x86_64.whl

Download URL bezier-0.9.0-cp37-cp37m-manylinux1_x86_64.whl
Size 1.6 MB
Tags CPython 3.7 CPython 3.7 pymalloc Linux glibc 2.5+ x86-64
SHA-256 checksum
How to use checksums
969ac9044cda81406a0008d0c1ec6ce241fe6f32d88794f38464e5cc4ca957c2
BLAKE2b-256 checksum
How to use checksums
fefde8fe1a69700a8797aa08385649256f547b542e9857d7a6608a24f0579d62
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/1.11.0 pkginfo/1.4.2 requests/2.19.1 setuptools/40.4.3 requests-toolbelt/0.8.0 tqdm/4.24.0 CPython/3.7.1

Release files / bezier-0.9.0-cp37-cp37m-manylinux1_i686.whl

Download URL bezier-0.9.0-cp37-cp37m-manylinux1_i686.whl
Size 1.3 MB
Tags CPython 3.7 CPython 3.7 pymalloc Linux glibc 2.5+ x86-32
SHA-256 checksum
How to use checksums
61e6a28e011fe94b4c1527e1690650d9c8c5dd95ab034888b1b557906ee7baf0
BLAKE2b-256 checksum
How to use checksums
7440e49e0b056f97fec19d7296df2d74e22297fa67323d98c34004d1a9618c0a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/1.11.0 pkginfo/1.4.2 requests/2.19.1 setuptools/40.4.3 requests-toolbelt/0.8.0 tqdm/4.24.0 CPython/3.7.1

Release files / bezier-0.9.0-cp37-cp37m-macosx_10_6_intel.whl

Download URL bezier-0.9.0-cp37-cp37m-macosx_10_6_intel.whl
Size 1.9 MB
Tags CPython 3.7 CPython 3.7 pymalloc macOS 10.6+ Intel (x86-64, i386)
SHA-256 checksum
How to use checksums
8b6752d14827b5916b4dfc58b3a8dea87255931a67abff71d0e7b53a4650644f
BLAKE2b-256 checksum
How to use checksums
bc75aa57c10b0d724747a9b831ef47342071187921c44ed8a621c290c9e25f5b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/1.11.0 pkginfo/1.4.2 requests/2.19.1 setuptools/40.4.3 requests-toolbelt/0.8.0 tqdm/4.24.0 CPython/3.7.1

Release files / bezier-0.9.0-cp36-none-win_amd64.whl

Download URL bezier-0.9.0-cp36-none-win_amd64.whl
Size 732.7 kB
Tags CPython 3.6 Windows x86-64
SHA-256 checksum
How to use checksums
b8d1a424d23912249d38fbc00d926d555f9bdffc96cea80a673e89aeec04c10b
BLAKE2b-256 checksum
How to use checksums
354f45d5ada687e0b726b2f140df265b0d3a3f872be6b775216c9af5cb9323e1
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/1.11.0 pkginfo/1.4.2 requests/2.19.1 setuptools/40.4.3 requests-toolbelt/0.8.0 tqdm/4.24.0 CPython/3.7.1

Release files / bezier-0.9.0-cp36-none-win32.whl

Download URL bezier-0.9.0-cp36-none-win32.whl
Size 690.0 kB
Tags CPython 3.6 Windows x86-32
SHA-256 checksum
How to use checksums
66e8de298a8c0c04ddf75784429d777de2ada295655f7661725807ec06afb304
BLAKE2b-256 checksum
How to use checksums
81001bd61c61a75b1138362105e897c4917597081f53d7ee7399bee02d4e9d50
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/1.11.0 pkginfo/1.4.2 requests/2.19.1 setuptools/40.4.3 requests-toolbelt/0.8.0 tqdm/4.24.0 CPython/3.7.1

Release files / bezier-0.9.0-cp36-cp36m-manylinux1_x86_64.whl

Download URL bezier-0.9.0-cp36-cp36m-manylinux1_x86_64.whl
Size 1.6 MB
Tags CPython 3.6 CPython 3.6 pymalloc Linux glibc 2.5+ x86-64
SHA-256 checksum
How to use checksums
e1dd76412c380374e2f67b78e41d90239c1d8fb9debbefc275e883c9a08b8a8c
BLAKE2b-256 checksum
How to use checksums
9d7d9976dd86885e92c9985aeee3648bfcadcce11986d05726a055ca301fa563
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/1.11.0 pkginfo/1.4.2 requests/2.19.1 setuptools/40.4.3 requests-toolbelt/0.8.0 tqdm/4.24.0 CPython/3.7.1

Release files / bezier-0.9.0-cp36-cp36m-manylinux1_i686.whl

Download URL bezier-0.9.0-cp36-cp36m-manylinux1_i686.whl
Size 1.3 MB
Tags CPython 3.6 CPython 3.6 pymalloc Linux glibc 2.5+ x86-32
SHA-256 checksum
How to use checksums
38d1e110479e3f0db012ac2f4f1988dce719c447532d5322f9880b546a572b8d
BLAKE2b-256 checksum
How to use checksums
5595305de843467096a8fe1991d81e0709e905eedf1fb0591edd6c3f61da2b43
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/1.11.0 pkginfo/1.4.2 requests/2.19.1 setuptools/40.4.3 requests-toolbelt/0.8.0 tqdm/4.24.0 CPython/3.7.1

Release files / bezier-0.9.0-cp36-cp36m-macosx_10_6_intel.whl

Download URL bezier-0.9.0-cp36-cp36m-macosx_10_6_intel.whl
Size 1.9 MB
Tags CPython 3.6 CPython 3.6 pymalloc macOS 10.6+ Intel (x86-64, i386)
SHA-256 checksum
How to use checksums
8851d4de4a1524c1b54f60177299d2378a6506038fa763c714091df420a3ee53
BLAKE2b-256 checksum
How to use checksums
2213c511a7f996884960b182814fa6dd7ae3fa2db5fd66706384dbb698eade46
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/1.11.0 pkginfo/1.4.2 requests/2.19.1 setuptools/40.4.3 requests-toolbelt/0.8.0 tqdm/4.24.0 CPython/3.7.1

Release files / bezier-0.9.0-cp27-none-win_amd64.whl

Download URL bezier-0.9.0-cp27-none-win_amd64.whl
Size 727.0 kB
Tags CPython 2.7 Windows x86-64
SHA-256 checksum
How to use checksums
96e646cc201c5a34b6467598b94ba2b0bdde668431b2094cb2bfb6efd7df4409
BLAKE2b-256 checksum
How to use checksums
7ea781bfc479bd8c27341f345733e6d4c823cb11ebda4b5e8df471918f5b4479
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/1.11.0 pkginfo/1.4.2 requests/2.19.1 setuptools/40.4.3 requests-toolbelt/0.8.0 tqdm/4.24.0 CPython/3.7.1

Release files / bezier-0.9.0-cp27-none-win32.whl

Download URL bezier-0.9.0-cp27-none-win32.whl
Size 691.4 kB
Tags CPython 2.7 Windows x86-32
SHA-256 checksum
How to use checksums
7878c95186f08a85558ad9446646c69d8dd6c6a82fe6c6892aab7c4545b76311
BLAKE2b-256 checksum
How to use checksums
56ed60578886d19dc41080621e126d77c0fbf1fef69a8b613b45fc7b48a58b65
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/1.11.0 pkginfo/1.4.2 requests/2.19.1 setuptools/40.4.3 requests-toolbelt/0.8.0 tqdm/4.24.0 CPython/3.7.1

Release files / bezier-0.9.0-cp27-cp27mu-manylinux1_x86_64.whl

Download URL bezier-0.9.0-cp27-cp27mu-manylinux1_x86_64.whl
Size 1.5 MB
Tags CPython 2.7 CPython 2.7 pymalloc wide-unicode Linux glibc 2.5+ x86-64
SHA-256 checksum
How to use checksums
572d31c27c399677332f93ab05199e0106716e0bd594d454b424977778718634
BLAKE2b-256 checksum
How to use checksums
1cca50087d97b289a4f1bb0a1f5632aab13e3fe39b6be473af2827c51b01af35
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/1.11.0 pkginfo/1.4.2 requests/2.19.1 setuptools/40.4.3 requests-toolbelt/0.8.0 tqdm/4.24.0 CPython/3.7.1

Release files / bezier-0.9.0-cp27-cp27mu-manylinux1_i686.whl

Download URL bezier-0.9.0-cp27-cp27mu-manylinux1_i686.whl
Size 1.3 MB
Tags CPython 2.7 CPython 2.7 pymalloc wide-unicode Linux glibc 2.5+ x86-32
SHA-256 checksum
How to use checksums
569d051cdaae96b0439d42649dd272e5d6f6a290b0e1bd0a277963e3729d6ee7
BLAKE2b-256 checksum
How to use checksums
213cf58714e29030f1ff23b8065063c8136e08b07e55a0df6bebcdc75f1865e3
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/1.11.0 pkginfo/1.4.2 requests/2.19.1 setuptools/40.4.3 requests-toolbelt/0.8.0 tqdm/4.24.0 CPython/3.7.1

Release files / bezier-0.9.0-cp27-cp27m-manylinux1_x86_64.whl

Download URL bezier-0.9.0-cp27-cp27m-manylinux1_x86_64.whl
Size 1.5 MB
Tags CPython 2.7 CPython 2.7 pymalloc Linux glibc 2.5+ x86-64
SHA-256 checksum
How to use checksums
8d62b67782cd046e7d1866f8c581874221f573a91487d0839227821d1e40d5de
BLAKE2b-256 checksum
How to use checksums
2e3dd2d17e817c2b68da4cef5206e17b836adf068adfba93084a8c948da9ff5e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/1.11.0 pkginfo/1.4.2 requests/2.19.1 setuptools/40.4.3 requests-toolbelt/0.8.0 tqdm/4.24.0 CPython/3.7.1

Release files / bezier-0.9.0-cp27-cp27m-manylinux1_i686.whl

Download URL bezier-0.9.0-cp27-cp27m-manylinux1_i686.whl
Size 1.3 MB
Tags CPython 2.7 CPython 2.7 pymalloc Linux glibc 2.5+ x86-32
SHA-256 checksum
How to use checksums
6a74b7adbac6d13ef71cdcf619b54542a9d3ebe0733828643ea4cc9fae57103d
BLAKE2b-256 checksum
How to use checksums
c5c807a3be80628869a540336181b4217baa93ed95d3a6d89348ab338a92289f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/1.11.0 pkginfo/1.4.2 requests/2.19.1 setuptools/40.4.3 requests-toolbelt/0.8.0 tqdm/4.24.0 CPython/3.7.1

Release files / bezier-0.9.0-cp27-cp27m-macosx_10_6_intel.whl

Download URL bezier-0.9.0-cp27-cp27m-macosx_10_6_intel.whl
Size 1.9 MB
Tags CPython 2.7 CPython 2.7 pymalloc macOS 10.6+ Intel (x86-64, i386)
SHA-256 checksum
How to use checksums
c8ba70c08abbdd9447b863f00ef61df1566fb41b3a6615625ed3792a992023ca
BLAKE2b-256 checksum
How to use checksums
6c47d5e70638100091026e2c14a0f7216d23e85ca73f70d0b9b20c1b525451bc
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/1.11.0 pkginfo/1.4.2 requests/2.19.1 setuptools/40.4.3 requests-toolbelt/0.8.0 tqdm/4.24.0 CPython/3.7.1

Security for bezier 0.9.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page