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.2.3/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.2.3/docs/images/bernstein_basis.png

to define a curve as a linear combination:

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

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

https://raw.githubusercontent.com/dhermes/bezier/2020.2.3/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 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)
https://raw.githubusercontent.com/dhermes/bezier/2020.2.3/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.2.3.tar.gz (310.3 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.2.3-cp38-cp38-win_amd64.whl (721.3 kB view details)

Uploaded CPython 3.8Windows x86-64

bezier-2020.2.3-cp38-cp38-win32.whl (674.4 kB view details)

Uploaded CPython 3.8Windows x86

bezier-2020.2.3-cp38-cp38-manylinux2010_x86_64.whl (1.4 MB view details)

Uploaded CPython 3.8manylinux: glibc 2.12+ x86-64

bezier-2020.2.3-cp38-cp38-manylinux2010_i686.whl (1.1 MB view details)

Uploaded CPython 3.8manylinux: glibc 2.12+ i686

bezier-2020.2.3-cp38-cp38-macosx_10_9_x86_64.whl (1.6 MB view details)

Uploaded CPython 3.8macOS 10.9+ x86-64

bezier-2020.2.3-cp37-cp37m-win_amd64.whl (715.2 kB view details)

Uploaded CPython 3.7mWindows x86-64

bezier-2020.2.3-cp37-cp37m-win32.whl (667.8 kB view details)

Uploaded CPython 3.7mWindows x86

bezier-2020.2.3-cp37-cp37m-manylinux2010_x86_64.whl (1.4 MB view details)

Uploaded CPython 3.7mmanylinux: glibc 2.12+ x86-64

bezier-2020.2.3-cp37-cp37m-manylinux2010_i686.whl (1.1 MB view details)

Uploaded CPython 3.7mmanylinux: glibc 2.12+ i686

bezier-2020.2.3-cp37-cp37m-macosx_10_9_x86_64.whl (1.6 MB view details)

Uploaded CPython 3.7mmacOS 10.9+ x86-64

bezier-2020.2.3-cp36-cp36m-win_amd64.whl (715.2 kB view details)

Uploaded CPython 3.6mWindows x86-64

bezier-2020.2.3-cp36-cp36m-win32.whl (667.9 kB view details)

Uploaded CPython 3.6mWindows x86

bezier-2020.2.3-cp36-cp36m-manylinux2010_x86_64.whl (1.4 MB view details)

Uploaded CPython 3.6mmanylinux: glibc 2.12+ x86-64

bezier-2020.2.3-cp36-cp36m-manylinux2010_i686.whl (1.1 MB view details)

Uploaded CPython 3.6mmanylinux: glibc 2.12+ i686

bezier-2020.2.3-cp36-cp36m-macosx_10_9_x86_64.whl (1.6 MB view details)

Uploaded CPython 3.6mmacOS 10.9+ x86-64

File details

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

File metadata

  • Download URL: bezier-2020.2.3.tar.gz
  • Upload date:
  • Size: 310.3 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.2.3.tar.gz
Algorithm Hash digest
SHA256 0526631e41ac0416d4dd6be66105670bb1c1a342d4e7e82b3e9009231ac0e868
MD5 6d3e099ea124a0a3b69ef6aae04b1861
BLAKE2b-256 9acb4859a29397ba6d57ddabc54c03b65e85a86cbf77cb898ad1bb2cfab14c0c

See more details on using hashes here.

File details

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

File metadata

  • Download URL: bezier-2020.2.3-cp38-cp38-win_amd64.whl
  • Upload date:
  • Size: 721.3 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.2.3-cp38-cp38-win_amd64.whl
Algorithm Hash digest
SHA256 aa8fc849750d7e27958da52e1e1e26ffdf0bc76e91a93d78400b61e213e443ed
MD5 3bf27238b11a132f680990ba11d335ec
BLAKE2b-256 4893f85b6495247e10288cf16ab780b05cf0abbf4fd920e7b44cded91fd8d932

See more details on using hashes here.

File details

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

File metadata

  • Download URL: bezier-2020.2.3-cp38-cp38-win32.whl
  • Upload date:
  • Size: 674.4 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.2.3-cp38-cp38-win32.whl
Algorithm Hash digest
SHA256 211bb41549e182fecf1cb46c2e1dfabe9d5d0dbe97b5d331a99e63dc99f5c35f
MD5 41c00f6f281c0670a464532e18398357
BLAKE2b-256 4afbf418c439ce666cd5f6bb57d9e994e56d54568ab18f12ea63a9e6969a28d3

See more details on using hashes here.

File details

Details for the file bezier-2020.2.3-cp38-cp38-manylinux2010_x86_64.whl.

File metadata

  • Download URL: bezier-2020.2.3-cp38-cp38-manylinux2010_x86_64.whl
  • Upload date:
  • Size: 1.4 MB
  • Tags: CPython 3.8, manylinux: glibc 2.12+ 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.2.3-cp38-cp38-manylinux2010_x86_64.whl
Algorithm Hash digest
SHA256 0221ec6362e03044db803f713220266f1350f52c5c3a9509d1fabad2ed30cf2c
MD5 c03b6395659edb1f3a259b11750e75d7
BLAKE2b-256 01571038c40c2b57d705d91f5b9162751472462548f98cdf556158f169cb8bad

See more details on using hashes here.

File details

Details for the file bezier-2020.2.3-cp38-cp38-manylinux2010_i686.whl.

File metadata

  • Download URL: bezier-2020.2.3-cp38-cp38-manylinux2010_i686.whl
  • Upload date:
  • Size: 1.1 MB
  • Tags: CPython 3.8, manylinux: glibc 2.12+ i686
  • 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.2.3-cp38-cp38-manylinux2010_i686.whl
Algorithm Hash digest
SHA256 789d770d54a4b949c05a1a90010aa7510fd610c292fd36bf39a3c1eae53e8545
MD5 cbaa8269d977063d93b14a7dc7350d2e
BLAKE2b-256 95bda4d19b91fe42d4b188f0aa05a6e24af41a9d5060915efe64687f243abbf9

See more details on using hashes here.

File details

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

File metadata

  • Download URL: bezier-2020.2.3-cp38-cp38-macosx_10_9_x86_64.whl
  • Upload date:
  • Size: 1.6 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.2.3-cp38-cp38-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 49d823adb71731a8e16db988f5c15cf2e4597b0ce0d7e4285ef4758551bcbe42
MD5 7782244047a46ab948a7513f99fcc5d3
BLAKE2b-256 6fcaccc907eda5f2674a6389dd13486eb0177ea85409a9dd5aeba174f379c57a

See more details on using hashes here.

File details

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

File metadata

  • Download URL: bezier-2020.2.3-cp37-cp37m-win_amd64.whl
  • Upload date:
  • Size: 715.2 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.2.3-cp37-cp37m-win_amd64.whl
Algorithm Hash digest
SHA256 63c580911f5b30aa676824626e695ec1baae1ea3391096bfbbbc124a9f0779cd
MD5 145b980a6b3fa568ea3f8d2a93417159
BLAKE2b-256 8452ccc7a4093e8536a9b6b2eec32de6acbb5fe7748bc665b1eed41ef11050a1

See more details on using hashes here.

File details

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

File metadata

  • Download URL: bezier-2020.2.3-cp37-cp37m-win32.whl
  • Upload date:
  • Size: 667.8 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.2.3-cp37-cp37m-win32.whl
Algorithm Hash digest
SHA256 b663d868cb74c0db43185d475b78bcc3e30fc87233b866e2ac1c660ecd937c61
MD5 f0201bf4822b5e7811d94246bf7f3692
BLAKE2b-256 36fdef7f6f6685625f7e5f3d80343485b18fa5e3a6347975f51476ee75c80ad4

See more details on using hashes here.

File details

Details for the file bezier-2020.2.3-cp37-cp37m-manylinux2010_x86_64.whl.

File metadata

  • Download URL: bezier-2020.2.3-cp37-cp37m-manylinux2010_x86_64.whl
  • Upload date:
  • Size: 1.4 MB
  • Tags: CPython 3.7m, manylinux: glibc 2.12+ 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.2.3-cp37-cp37m-manylinux2010_x86_64.whl
Algorithm Hash digest
SHA256 0cb232e047bcf8156f6286e6fd8276303554747689f7fd2fdb4d48b8808b9485
MD5 c717764482e6da07fababc8e65f43f9c
BLAKE2b-256 63c53f0a9c03e6851f315006cc60f4e320e279f6413764df93d9cc320e7bf847

See more details on using hashes here.

File details

Details for the file bezier-2020.2.3-cp37-cp37m-manylinux2010_i686.whl.

File metadata

  • Download URL: bezier-2020.2.3-cp37-cp37m-manylinux2010_i686.whl
  • Upload date:
  • Size: 1.1 MB
  • Tags: CPython 3.7m, manylinux: glibc 2.12+ i686
  • 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.2.3-cp37-cp37m-manylinux2010_i686.whl
Algorithm Hash digest
SHA256 e5f9ed2c254488fbb025baa9411b7bcaaede8761f8136103458e8186b33cbab4
MD5 20a27a16cc2e20f439dab8c0d510e1a3
BLAKE2b-256 069924f058158cd63f700e186004231886c88241e04100e7b36e0af81f225168

See more details on using hashes here.

File details

Details for the file bezier-2020.2.3-cp37-cp37m-macosx_10_9_x86_64.whl.

File metadata

  • Download URL: bezier-2020.2.3-cp37-cp37m-macosx_10_9_x86_64.whl
  • Upload date:
  • Size: 1.6 MB
  • Tags: CPython 3.7m, 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.2.3-cp37-cp37m-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 56a13d962c2602daaa6eac6bdbcee50d8bcd3bc4c17feb9048462dd208c688b1
MD5 4a40253f91c32368c1602d39cb3946c6
BLAKE2b-256 cc0bb60505bcf6ec6261343972e7221245acee1a03ce197bcb1b73856cbee363

See more details on using hashes here.

File details

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

File metadata

  • Download URL: bezier-2020.2.3-cp36-cp36m-win_amd64.whl
  • Upload date:
  • Size: 715.2 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.2.3-cp36-cp36m-win_amd64.whl
Algorithm Hash digest
SHA256 381e96f9e92057036498821ad7e45bacfb5d5f5e56ab9ea547dfdb0cb89ee93e
MD5 cadc582b97d6f6c4b425b2d3a11d1b38
BLAKE2b-256 3c824af6f53cce53b91055abbd09066158bce392dab2ed89adb9cc34125b5060

See more details on using hashes here.

File details

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

File metadata

  • Download URL: bezier-2020.2.3-cp36-cp36m-win32.whl
  • Upload date:
  • Size: 667.9 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.2.3-cp36-cp36m-win32.whl
Algorithm Hash digest
SHA256 5dd23b15f286c541e5b0ad28607d516680ba8bba2fac470b83ed0f45262202c3
MD5 93a5db84ae155d668d13903d83e6ef0b
BLAKE2b-256 ec6191a0261f6ede97b78853dd0e58ac3dddce3f91513eb0978a318a290f3180

See more details on using hashes here.

File details

Details for the file bezier-2020.2.3-cp36-cp36m-manylinux2010_x86_64.whl.

File metadata

  • Download URL: bezier-2020.2.3-cp36-cp36m-manylinux2010_x86_64.whl
  • Upload date:
  • Size: 1.4 MB
  • Tags: CPython 3.6m, manylinux: glibc 2.12+ 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.2.3-cp36-cp36m-manylinux2010_x86_64.whl
Algorithm Hash digest
SHA256 16562d0d5906e7e270c8b22e98f7509c135908da144a6b84eaa14d4b1730cd2a
MD5 777174ff2925c5ed83ceab7b1bafc131
BLAKE2b-256 b2e0416107adeaf3bc05c414f6081193007b8ed765310af0185c33f71bc930d0

See more details on using hashes here.

File details

Details for the file bezier-2020.2.3-cp36-cp36m-manylinux2010_i686.whl.

File metadata

  • Download URL: bezier-2020.2.3-cp36-cp36m-manylinux2010_i686.whl
  • Upload date:
  • Size: 1.1 MB
  • Tags: CPython 3.6m, manylinux: glibc 2.12+ i686
  • 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.2.3-cp36-cp36m-manylinux2010_i686.whl
Algorithm Hash digest
SHA256 3472756ac857136865a5fa5f3fcf176ec0ef4c5d1343553f4aee76a0c3c1f408
MD5 3c313584e9486c896ed03fc4924c58f5
BLAKE2b-256 0ade309ffe6be7d1f660bb661dae2682eaff983e75785a57e7f0bea9d5010fc5

See more details on using hashes here.

File details

Details for the file bezier-2020.2.3-cp36-cp36m-macosx_10_9_x86_64.whl.

File metadata

  • Download URL: bezier-2020.2.3-cp36-cp36m-macosx_10_9_x86_64.whl
  • Upload date:
  • Size: 1.6 MB
  • Tags: CPython 3.6m, 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.2.3-cp36-cp36m-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 19101cf830f6316e2e8808816017b5661bbbea276f7099ff3a0b6712b6c95d6f
MD5 998afd36e65a591be46255853275f581
BLAKE2b-256 18dbb15ece2068ac42a80f84dd715cdefcb501d93c4e2aaee421f68cffa7422e

See more details on using hashes here.

Release history Release notifications | RSS feed

2024.6.20

16 files

2023.7.28

21 files

2021.2.12

16 files

2020.5.19

16 files

This release

2020.2.3 This release

16 files

2020.1.14

16 files

0.11.0

16 files

0.10.0

11 files

0.9.0

18 files

0.8.0

18 files

0.7.0

18 files

0.6.4

18 files

0.6.3

18 files

0.6.2

18 files

0.6.1

18 files

0.6.0

18 files

0.5.0

18 files

0.4.0

13 files

0.3.0

2 files

0.2.1

2 files

0.2.0

2 files

0.1.1

2 files

0.1.0

2 files

0.0.1

2 files

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