Skip to main content

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/2020.1.14/docs/images/triangles6Q_and_7Q.png

Why Bézier?

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

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

to define a curve as a linear combination:

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

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

https://raw.githubusercontent.com/dhermes/bezier/2020.1.14/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, triangles, 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 triangles, 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
$ python3.8 -m pip install --upgrade bezier
$ # To install optional dependencies, e.g. SymPy
$ python    -m pip install --upgrade bezier[full]

To install a pure Python version (i.e. with no binary extension):

$ BEZIER_NO_EXTENSION=true \
>   python  -m pip install --upgrade bezier --no-binary=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/2020.1.14/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.

Citation

For publications that use bezier, there is a JOSS paper that can be cited. The following BibTeX entry can be used:

@article{Hermes2017,
  doi = {10.21105/joss.00267},
  url = {https://doi.org/10.21105%2Fjoss.00267},
  year = {2017},
  month = {Aug},
  publisher = {The Open Journal},
  volume = {2},
  number = {16},
  pages = {267},
  author = {Danny Hermes},
  title = {Helper for B{\'{e}}zier Curves, Triangles, and Higher Order Objects},
  journal = {The Journal of Open Source Software}
}

A particular version of this library can be cited via a Zenodo DOI; see a full list by version.

License

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

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

bezier-2020.1.14.tar.gz (376.9 kB view details)

Uploaded Source

Built Distributions

If you're not sure about the file name format, learn more about wheel file names.

bezier-2020.1.14-cp38-cp38-win_amd64.whl (741.6 kB view details)

Uploaded CPython 3.8Windows x86-64

bezier-2020.1.14-cp38-cp38-win32.whl (698.9 kB view details)

Uploaded CPython 3.8Windows x86

bezier-2020.1.14-cp38-cp38-manylinux1_x86_64.whl (992.1 kB view details)

Uploaded CPython 3.8

bezier-2020.1.14-cp38-cp38-manylinux1_i686.whl (770.8 kB view details)

Uploaded CPython 3.8

bezier-2020.1.14-cp38-cp38-macosx_10_9_x86_64.whl (1.8 MB view details)

Uploaded CPython 3.8macOS 10.9+ x86-64

bezier-2020.1.14-cp37-cp37m-win_amd64.whl (735.5 kB view details)

Uploaded CPython 3.7mWindows x86-64

bezier-2020.1.14-cp37-cp37m-win32.whl (692.4 kB view details)

Uploaded CPython 3.7mWindows x86

bezier-2020.1.14-cp37-cp37m-manylinux1_x86_64.whl (996.2 kB view details)

Uploaded CPython 3.7m

bezier-2020.1.14-cp37-cp37m-manylinux1_i686.whl (772.2 kB view details)

Uploaded CPython 3.7m

bezier-2020.1.14-cp37-cp37m-macosx_10_6_intel.whl (2.0 MB view details)

Uploaded CPython 3.7mmacOS 10.6+ Intel (x86-64, i386)

bezier-2020.1.14-cp36-cp36m-win_amd64.whl (735.5 kB view details)

Uploaded CPython 3.6mWindows x86-64

bezier-2020.1.14-cp36-cp36m-win32.whl (692.4 kB view details)

Uploaded CPython 3.6mWindows x86

bezier-2020.1.14-cp36-cp36m-manylinux1_x86_64.whl (998.5 kB view details)

Uploaded CPython 3.6m

bezier-2020.1.14-cp36-cp36m-manylinux1_i686.whl (773.7 kB view details)

Uploaded CPython 3.6m

bezier-2020.1.14-cp36-cp36m-macosx_10_6_intel.whl (2.0 MB view details)

Uploaded CPython 3.6mmacOS 10.6+ Intel (x86-64, i386)

File details

Details for the file bezier-2020.1.14.tar.gz.

File metadata

  • Download URL: bezier-2020.1.14.tar.gz
  • Upload date:
  • Size: 376.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.12.1 pkginfo/1.4.2 requests/2.19.1 setuptools/41.2.0 requests-toolbelt/0.8.0 tqdm/4.24.0 CPython/3.7.5

File hashes

Hashes for bezier-2020.1.14.tar.gz
Algorithm Hash digest
SHA256 74178eea1f6b69d83d02a12311cd8500b5b56ce87fab2a10c2f35d01344102b8
MD5 bd937e970f4629e4ce005cf8c9dc7d6b
BLAKE2b-256 fab92b3cca5da2e182d093fbbea8074810da55e9dca2edf96fec94ae6f33a884

See more details on using hashes here.

File details

Details for the file bezier-2020.1.14-cp38-cp38-win_amd64.whl.

File metadata

  • Download URL: bezier-2020.1.14-cp38-cp38-win_amd64.whl
  • Upload date:
  • Size: 741.6 kB
  • Tags: CPython 3.8, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.12.1 pkginfo/1.4.2 requests/2.19.1 setuptools/41.2.0 requests-toolbelt/0.8.0 tqdm/4.24.0 CPython/3.7.5

File hashes

Hashes for bezier-2020.1.14-cp38-cp38-win_amd64.whl
Algorithm Hash digest
SHA256 b1d17643eed64daa6aae7377bfafe9f8b40280c32da5fcca91d4bc5fdb3a9a65
MD5 6ed3f1ac8385617c42c194fd8b361913
BLAKE2b-256 a1ab36ebf737fb2e9e2a424d14be5f2423ec6082f494b8564d56a081391a3791

See more details on using hashes here.

File details

Details for the file bezier-2020.1.14-cp38-cp38-win32.whl.

File metadata

  • Download URL: bezier-2020.1.14-cp38-cp38-win32.whl
  • Upload date:
  • Size: 698.9 kB
  • Tags: CPython 3.8, Windows x86
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.12.1 pkginfo/1.4.2 requests/2.19.1 setuptools/41.2.0 requests-toolbelt/0.8.0 tqdm/4.24.0 CPython/3.7.5

File hashes

Hashes for bezier-2020.1.14-cp38-cp38-win32.whl
Algorithm Hash digest
SHA256 e62a6ece586017af26d4c8b289d6578eb0f51f6ce52d5f9886d902e7c5c5d6ec
MD5 7c06db3dcbec32f25475a33382e6930b
BLAKE2b-256 f630e0bc294188537468c6984b567a9498723192833e32a220b8f82faa5e0383

See more details on using hashes here.

File details

Details for the file bezier-2020.1.14-cp38-cp38-manylinux1_x86_64.whl.

File metadata

  • Download URL: bezier-2020.1.14-cp38-cp38-manylinux1_x86_64.whl
  • Upload date:
  • Size: 992.1 kB
  • Tags: CPython 3.8
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.12.1 pkginfo/1.4.2 requests/2.19.1 setuptools/41.2.0 requests-toolbelt/0.8.0 tqdm/4.24.0 CPython/3.7.5

File hashes

Hashes for bezier-2020.1.14-cp38-cp38-manylinux1_x86_64.whl
Algorithm Hash digest
SHA256 5d57e2705a4c138136a78dfacc979aa52c9f0bb822dd03291aa15679e36440ce
MD5 be39c18a1f47df6e6e15b3221354effb
BLAKE2b-256 0d40a2115aab45698df5a8151f6dae39f76762437e39093723c3e2d4050b83c8

See more details on using hashes here.

File details

Details for the file bezier-2020.1.14-cp38-cp38-manylinux1_i686.whl.

File metadata

  • Download URL: bezier-2020.1.14-cp38-cp38-manylinux1_i686.whl
  • Upload date:
  • Size: 770.8 kB
  • Tags: CPython 3.8
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.12.1 pkginfo/1.4.2 requests/2.19.1 setuptools/41.2.0 requests-toolbelt/0.8.0 tqdm/4.24.0 CPython/3.7.5

File hashes

Hashes for bezier-2020.1.14-cp38-cp38-manylinux1_i686.whl
Algorithm Hash digest
SHA256 71aab096fd3e2e083c39a69c4ae9297dfc79f1049be3f2eaa1fac56c560c7656
MD5 b49a16701d45dac01d8d9e4e2cb71079
BLAKE2b-256 be0e323e98844716eadace606abb3a75558bba7094c61f674f2bdf8306118249

See more details on using hashes here.

File details

Details for the file bezier-2020.1.14-cp38-cp38-macosx_10_9_x86_64.whl.

File metadata

  • Download URL: bezier-2020.1.14-cp38-cp38-macosx_10_9_x86_64.whl
  • Upload date:
  • Size: 1.8 MB
  • Tags: CPython 3.8, macOS 10.9+ x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.12.1 pkginfo/1.4.2 requests/2.19.1 setuptools/41.2.0 requests-toolbelt/0.8.0 tqdm/4.24.0 CPython/3.7.5

File hashes

Hashes for bezier-2020.1.14-cp38-cp38-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 f3425298b48661e15943d46e6f717b7894d4b23d7dfb784dc3f617f52ea5a1bd
MD5 2f6a30106fff7f50dd93b143c98c988a
BLAKE2b-256 4001f2b81dc86743e7110848b27274bdf413db869e3f461abf66f81cdcc4adee

See more details on using hashes here.

File details

Details for the file bezier-2020.1.14-cp37-cp37m-win_amd64.whl.

File metadata

  • Download URL: bezier-2020.1.14-cp37-cp37m-win_amd64.whl
  • Upload date:
  • Size: 735.5 kB
  • Tags: CPython 3.7m, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.12.1 pkginfo/1.4.2 requests/2.19.1 setuptools/41.2.0 requests-toolbelt/0.8.0 tqdm/4.24.0 CPython/3.7.5

File hashes

Hashes for bezier-2020.1.14-cp37-cp37m-win_amd64.whl
Algorithm Hash digest
SHA256 918bde12aa476caef4c81042a7a4a5dcae66779e90d4aca582d6b8529851bfa0
MD5 33907395caa331d5a914aa227a08a294
BLAKE2b-256 7dd6818030e2a14c5906c70ed3541d658c54e9dbf6256cfcf6e66ac3487895ff

See more details on using hashes here.

File details

Details for the file bezier-2020.1.14-cp37-cp37m-win32.whl.

File metadata

  • Download URL: bezier-2020.1.14-cp37-cp37m-win32.whl
  • Upload date:
  • Size: 692.4 kB
  • Tags: CPython 3.7m, Windows x86
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.12.1 pkginfo/1.4.2 requests/2.19.1 setuptools/41.2.0 requests-toolbelt/0.8.0 tqdm/4.24.0 CPython/3.7.5

File hashes

Hashes for bezier-2020.1.14-cp37-cp37m-win32.whl
Algorithm Hash digest
SHA256 8c79405f2dce2988707cb337b71d009ca74a2eb14cab2a5b37cb09f6320f11db
MD5 7528e0a13057fa62cd7830d572632eed
BLAKE2b-256 c2aee0aa65e096f56076e352bde11dbae9992ec3bb8c29868bd12c5bb8eceae9

See more details on using hashes here.

File details

Details for the file bezier-2020.1.14-cp37-cp37m-manylinux1_x86_64.whl.

File metadata

  • Download URL: bezier-2020.1.14-cp37-cp37m-manylinux1_x86_64.whl
  • Upload date:
  • Size: 996.2 kB
  • Tags: CPython 3.7m
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.12.1 pkginfo/1.4.2 requests/2.19.1 setuptools/41.2.0 requests-toolbelt/0.8.0 tqdm/4.24.0 CPython/3.7.5

File hashes

Hashes for bezier-2020.1.14-cp37-cp37m-manylinux1_x86_64.whl
Algorithm Hash digest
SHA256 39d0b60f8cb87c31df0ad5d6a7d3fdfd0a74891b0730662bf2c6a49851f26fff
MD5 42626f3d68c53bcd6293c87f8c3427e4
BLAKE2b-256 aab8647c064e4b6d26543c90dc8a954d6d4f4a516d884c69ded1aa780d96ff08

See more details on using hashes here.

File details

Details for the file bezier-2020.1.14-cp37-cp37m-manylinux1_i686.whl.

File metadata

  • Download URL: bezier-2020.1.14-cp37-cp37m-manylinux1_i686.whl
  • Upload date:
  • Size: 772.2 kB
  • Tags: CPython 3.7m
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.12.1 pkginfo/1.4.2 requests/2.19.1 setuptools/41.2.0 requests-toolbelt/0.8.0 tqdm/4.24.0 CPython/3.7.5

File hashes

Hashes for bezier-2020.1.14-cp37-cp37m-manylinux1_i686.whl
Algorithm Hash digest
SHA256 7caeca3a40e5ba7da49bcc72367c37bc048305c52ced825148cdd70217710757
MD5 79bcddb6fbccc19e91542c0ea27f145b
BLAKE2b-256 02f3a77460e71ec14d9806ba48d7e1ab7f9ad9d8a45a5229e22296050aefc0d6

See more details on using hashes here.

File details

Details for the file bezier-2020.1.14-cp37-cp37m-macosx_10_6_intel.whl.

File metadata

  • Download URL: bezier-2020.1.14-cp37-cp37m-macosx_10_6_intel.whl
  • Upload date:
  • Size: 2.0 MB
  • Tags: CPython 3.7m, macOS 10.6+ Intel (x86-64, i386)
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.12.1 pkginfo/1.4.2 requests/2.19.1 setuptools/41.2.0 requests-toolbelt/0.8.0 tqdm/4.24.0 CPython/3.7.5

File hashes

Hashes for bezier-2020.1.14-cp37-cp37m-macosx_10_6_intel.whl
Algorithm Hash digest
SHA256 6201cab643204fe99ca5660b3338249899b5ce104f3674960fa43e04faf880f4
MD5 a2d0998d81cacf14cd5d131acc0e6812
BLAKE2b-256 c1573458dd95b153348eec9e788af196680018aa6c40f3ce40bfe5ba84e1a85e

See more details on using hashes here.

File details

Details for the file bezier-2020.1.14-cp36-cp36m-win_amd64.whl.

File metadata

  • Download URL: bezier-2020.1.14-cp36-cp36m-win_amd64.whl
  • Upload date:
  • Size: 735.5 kB
  • Tags: CPython 3.6m, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.12.1 pkginfo/1.4.2 requests/2.19.1 setuptools/41.2.0 requests-toolbelt/0.8.0 tqdm/4.24.0 CPython/3.7.5

File hashes

Hashes for bezier-2020.1.14-cp36-cp36m-win_amd64.whl
Algorithm Hash digest
SHA256 86917a6c2bc8c35570234755753cf8b4f53b47aac1f8ba6e865805d7f5462f08
MD5 24cf6e536998eb859268c79bb71834b3
BLAKE2b-256 50b0e30caf36c9aa21a9cf0cbe89a6868d9a58882afae786c24c341fda179b03

See more details on using hashes here.

File details

Details for the file bezier-2020.1.14-cp36-cp36m-win32.whl.

File metadata

  • Download URL: bezier-2020.1.14-cp36-cp36m-win32.whl
  • Upload date:
  • Size: 692.4 kB
  • Tags: CPython 3.6m, Windows x86
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.12.1 pkginfo/1.4.2 requests/2.19.1 setuptools/41.2.0 requests-toolbelt/0.8.0 tqdm/4.24.0 CPython/3.7.5

File hashes

Hashes for bezier-2020.1.14-cp36-cp36m-win32.whl
Algorithm Hash digest
SHA256 9ae44914fa0ffba2dfe29b25e27be8508026f03dee90879b2d0438cb75e0546f
MD5 74442b00be8018b31c64e1889ee720c2
BLAKE2b-256 58643e58130675ed6e9118f9c9ee6a2cd305a50436bf84cda4d02802e0ffb11c

See more details on using hashes here.

File details

Details for the file bezier-2020.1.14-cp36-cp36m-manylinux1_x86_64.whl.

File metadata

  • Download URL: bezier-2020.1.14-cp36-cp36m-manylinux1_x86_64.whl
  • Upload date:
  • Size: 998.5 kB
  • Tags: CPython 3.6m
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.12.1 pkginfo/1.4.2 requests/2.19.1 setuptools/41.2.0 requests-toolbelt/0.8.0 tqdm/4.24.0 CPython/3.7.5

File hashes

Hashes for bezier-2020.1.14-cp36-cp36m-manylinux1_x86_64.whl
Algorithm Hash digest
SHA256 a16baebcbdeaae01f8b3561971c977d9adf518970b1545ed2bfb998a5b36eb02
MD5 010e05c47e6754bfb90f0532d06a3845
BLAKE2b-256 3ef1a9592f38c9610a40882d7536d76ab58d8ee44c8d71d84c0d6604eda6d6c0

See more details on using hashes here.

File details

Details for the file bezier-2020.1.14-cp36-cp36m-manylinux1_i686.whl.

File metadata

  • Download URL: bezier-2020.1.14-cp36-cp36m-manylinux1_i686.whl
  • Upload date:
  • Size: 773.7 kB
  • Tags: CPython 3.6m
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.12.1 pkginfo/1.4.2 requests/2.19.1 setuptools/41.2.0 requests-toolbelt/0.8.0 tqdm/4.24.0 CPython/3.7.5

File hashes

Hashes for bezier-2020.1.14-cp36-cp36m-manylinux1_i686.whl
Algorithm Hash digest
SHA256 e19f944ef9ecda1c5a2c1593b1a9e1ddb749c79f656376cacb188262ce80a360
MD5 59ea09b5231949d8a7c1faeedcddffd1
BLAKE2b-256 f6ae73ce833f60d26fbf75156189178f73dc09165e686f2b1a70548c52f3775a

See more details on using hashes here.

File details

Details for the file bezier-2020.1.14-cp36-cp36m-macosx_10_6_intel.whl.

File metadata

  • Download URL: bezier-2020.1.14-cp36-cp36m-macosx_10_6_intel.whl
  • Upload date:
  • Size: 2.0 MB
  • Tags: CPython 3.6m, macOS 10.6+ Intel (x86-64, i386)
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.12.1 pkginfo/1.4.2 requests/2.19.1 setuptools/41.2.0 requests-toolbelt/0.8.0 tqdm/4.24.0 CPython/3.7.5

File hashes

Hashes for bezier-2020.1.14-cp36-cp36m-macosx_10_6_intel.whl
Algorithm Hash digest
SHA256 34bf8b4ac3800f37bc859ba0eef933bcaaf9754db8d02f8df4d95d71f980c973
MD5 2d3e6d74dfb0d6a3603dabbb801e02b9
BLAKE2b-256 82896f3cb926aac0af5a1a7679250124c0e11786ccfe8306c5315923153619ae

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page