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

to define a curve as a linear combination:

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

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

https://raw.githubusercontent.com/dhermes/bezier/2020.5.19/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.5.19/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.5.19.tar.gz (313.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.5.19-cp38-cp38-win_amd64.whl (668.2 kB view details)

Uploaded CPython 3.8Windows x86-64

bezier-2020.5.19-cp38-cp38-win32.whl (669.5 kB view details)

Uploaded CPython 3.8Windows x86

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

Uploaded CPython 3.8manylinux: glibc 2.12+ x86-64

bezier-2020.5.19-cp38-cp38-manylinux2010_i686.whl (1.4 MB view details)

Uploaded CPython 3.8manylinux: glibc 2.12+ i686

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

Uploaded CPython 3.8macOS 10.9+ x86-64

bezier-2020.5.19-cp37-cp37m-win_amd64.whl (662.8 kB view details)

Uploaded CPython 3.7mWindows x86-64

bezier-2020.5.19-cp37-cp37m-win32.whl (663.5 kB view details)

Uploaded CPython 3.7mWindows x86

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

Uploaded CPython 3.7mmanylinux: glibc 2.12+ x86-64

bezier-2020.5.19-cp37-cp37m-manylinux2010_i686.whl (1.3 MB view details)

Uploaded CPython 3.7mmanylinux: glibc 2.12+ i686

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

Uploaded CPython 3.7mmacOS 10.9+ x86-64

bezier-2020.5.19-cp36-cp36m-win_amd64.whl (662.6 kB view details)

Uploaded CPython 3.6mWindows x86-64

bezier-2020.5.19-cp36-cp36m-win32.whl (663.5 kB view details)

Uploaded CPython 3.6mWindows x86

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

Uploaded CPython 3.6mmanylinux: glibc 2.12+ x86-64

bezier-2020.5.19-cp36-cp36m-manylinux2010_i686.whl (1.3 MB view details)

Uploaded CPython 3.6mmanylinux: glibc 2.12+ i686

bezier-2020.5.19-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.5.19.tar.gz.

File metadata

  • Download URL: bezier-2020.5.19.tar.gz
  • Upload date:
  • Size: 313.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/45.2.0 requests-toolbelt/0.9.1 tqdm/4.46.0 CPython/3.8.2

File hashes

Hashes for bezier-2020.5.19.tar.gz
Algorithm Hash digest
SHA256 ff75337e5bb4385376aeaa48fc941bcd61b528df43a1e938bfb07fe7d924b19c
MD5 05fe68705916aff33bef74be356027dc
BLAKE2b-256 b90cb1982f93c36fc06850a3880bb693bf24a047946633ca7403664836b9da9e

See more details on using hashes here.

File details

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

File metadata

  • Download URL: bezier-2020.5.19-cp38-cp38-win_amd64.whl
  • Upload date:
  • Size: 668.2 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.5.19-cp38-cp38-win_amd64.whl
Algorithm Hash digest
SHA256 74288525eba81da27cb55aacb6032aa980f18681cd81b5c7fc3efae86daa2efd
MD5 4dc7f56a5904ea62dd924dfd6231339f
BLAKE2b-256 41f44603f6b88edc2d12dfc72422cca41e3c7fc8819da945d1227d188152cb8a

See more details on using hashes here.

File details

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

File metadata

  • Download URL: bezier-2020.5.19-cp38-cp38-win32.whl
  • Upload date:
  • Size: 669.5 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.5.19-cp38-cp38-win32.whl
Algorithm Hash digest
SHA256 3d673914d68dbeb6935c90447a3bfaa0db0401b14133dbb858450e891780d2d0
MD5 3f6038739dcd6d6058d6f48d7653f114
BLAKE2b-256 a9be80efe2d7376ae6d8d6942628be25304e9c693374cf4168fb33e6ecc1eed7

See more details on using hashes here.

File details

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

File metadata

  • Download URL: bezier-2020.5.19-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.5.19-cp38-cp38-manylinux2010_x86_64.whl
Algorithm Hash digest
SHA256 55d4a16ce258f71cbf429f06aaef2def88104c714a4ce3ed78040aba94b490e8
MD5 97497c60ee246b7236cf1ad8bb66f511
BLAKE2b-256 eaecabad1abd0ccdc3f649e323ffbc038fe10f531cd0a55563c2d3ef233811a6

See more details on using hashes here.

File details

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

File metadata

  • Download URL: bezier-2020.5.19-cp38-cp38-manylinux2010_i686.whl
  • Upload date:
  • Size: 1.4 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.5.19-cp38-cp38-manylinux2010_i686.whl
Algorithm Hash digest
SHA256 0df69cc1aee7f6ef6273bb8a138fbea0bb15e49420951469b0e958eabd16abf6
MD5 9cfb843bf0c3dbb66027efd531032b5d
BLAKE2b-256 e2b4f204bb782f6bf04f20873c709784d947b57c25fdccfc6d72a4f7b3153b29

See more details on using hashes here.

File details

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

File metadata

  • Download URL: bezier-2020.5.19-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.5.19-cp38-cp38-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 c2f79194a18b7470c833d73c331b1cddea1935f4d364b43501afffbabcf21bf9
MD5 41507994b8eed1e5e03a5a71e81f0091
BLAKE2b-256 08a5208730415ad012162ce25edd285f76225158bd2a79b355d40446022a1cf7

See more details on using hashes here.

File details

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

File metadata

  • Download URL: bezier-2020.5.19-cp37-cp37m-win_amd64.whl
  • Upload date:
  • Size: 662.8 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.5.19-cp37-cp37m-win_amd64.whl
Algorithm Hash digest
SHA256 34a397826321015c25550a35f791c9356b0244d27de9df92d490f885b3b4cbca
MD5 ebc055153bb44c58d4f827f1d04cbb17
BLAKE2b-256 334e050e5804d9f048c42260e2080e03791b2a7dd56c928bf22d95c71d4003b9

See more details on using hashes here.

File details

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

File metadata

  • Download URL: bezier-2020.5.19-cp37-cp37m-win32.whl
  • Upload date:
  • Size: 663.5 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.5.19-cp37-cp37m-win32.whl
Algorithm Hash digest
SHA256 2dbab0a4b084bc830d912604c29d5f1c7fcb63d844031045837ee4802ecd2bda
MD5 02c1bf842ea1451edc7932b9a1977830
BLAKE2b-256 ffdaa834c90b9b9b7f2b5e6363bb7a6a8b4f0436bad3c454b3957269adaf6a8e

See more details on using hashes here.

File details

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

File metadata

  • Download URL: bezier-2020.5.19-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.5.19-cp37-cp37m-manylinux2010_x86_64.whl
Algorithm Hash digest
SHA256 88c142070d99789793735b3427863a8d7a16ef1d3e8d5a97724d7c5e77c50942
MD5 c8ba99365d24e6768f386a2e41ec90e4
BLAKE2b-256 d7d51aa44ca9346f87ad252bbbf42fbe1c72ffa52b8fe9236295b42bb0b341a5

See more details on using hashes here.

File details

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

File metadata

  • Download URL: bezier-2020.5.19-cp37-cp37m-manylinux2010_i686.whl
  • Upload date:
  • Size: 1.3 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.5.19-cp37-cp37m-manylinux2010_i686.whl
Algorithm Hash digest
SHA256 b95e6ad3d7c7f293165ce35e4e57c7c2f8f826c140bb09442383eb1ecf6b47df
MD5 e8295fbaeb72e038a972a21db30c7758
BLAKE2b-256 f6956b6eeb864eb13ae8d7294604506f38f6a240658ace18279f74ae50578b87

See more details on using hashes here.

File details

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

File metadata

  • Download URL: bezier-2020.5.19-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.5.19-cp37-cp37m-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 622bbbd3dc341c97212b271012759824cd0c4e8eb6d51449995e444f8bc66182
MD5 089be0a72e7bb97626ec0d03d5772a3f
BLAKE2b-256 3bec362f7d9e09e01884b296e7f157e28d5915131573a7c05559609aabae1410

See more details on using hashes here.

File details

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

File metadata

  • Download URL: bezier-2020.5.19-cp36-cp36m-win_amd64.whl
  • Upload date:
  • Size: 662.6 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.5.19-cp36-cp36m-win_amd64.whl
Algorithm Hash digest
SHA256 06d0aa3d841cab32261807cfe0e7ebcf3045ebc99eb0c127657d0a2f852a33ff
MD5 6dd53a6b21bba5db5f4e03bbeaffb434
BLAKE2b-256 ccae530f339d5afcfb81c9087dcebfdbb49dc90164682ef613d7d54d25d18921

See more details on using hashes here.

File details

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

File metadata

  • Download URL: bezier-2020.5.19-cp36-cp36m-win32.whl
  • Upload date:
  • Size: 663.5 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.5.19-cp36-cp36m-win32.whl
Algorithm Hash digest
SHA256 d1ad580e11f7ba3420f4f18a577f35376b6e67e39bae2aadf6b26900b2502871
MD5 5418fedbdc60b4fcb774aafdf693907f
BLAKE2b-256 1d527e95ca347f8c6f82f9cff22114c1aa47efe740c96f2215f2c636526fbdc3

See more details on using hashes here.

File details

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

File metadata

  • Download URL: bezier-2020.5.19-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.5.19-cp36-cp36m-manylinux2010_x86_64.whl
Algorithm Hash digest
SHA256 ecd9fa0eaafe3da0ab25db16ea945efc9b4685e9c306a0d0ae22ca3a1439c79c
MD5 e08d89dafbdaf02cd96b1b4d582b4903
BLAKE2b-256 392c5e002f45ddb1c531e9f8cf54fe6dd018da28ed4a1071ababd5333c16819d

See more details on using hashes here.

File details

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

File metadata

  • Download URL: bezier-2020.5.19-cp36-cp36m-manylinux2010_i686.whl
  • Upload date:
  • Size: 1.3 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.5.19-cp36-cp36m-manylinux2010_i686.whl
Algorithm Hash digest
SHA256 663f9367a071090a8a9c026851cdb31ab0fccdb1cdbf5de49822395ed9086a72
MD5 f3fd252259b17a4a92455e21bd1c063f
BLAKE2b-256 97eb1c4c22d4a23c142e535b3f1adadb6e29aad592a668e792dddb606ca118ae

See more details on using hashes here.

File details

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

File metadata

  • Download URL: bezier-2020.5.19-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.5.19-cp36-cp36m-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 a5dc30e6d23a8db1ce418dd3979352ac8a23befc9bea5550dd13945e14029f2e
MD5 1f6efaad947b76a6edb9e4c0b386c4e1
BLAKE2b-256 697db183231fed94b743608f96f769404b4e4c804d9cffca9df147c09cfe8db8

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