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://cdn.rawgit.com/dhermes/bezier/0.6.2/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://cdn.rawgit.com/dhermes/bezier/0.6.2/docs/images/bernstein_basis.png

to define a curve as a linear combination:

https://cdn.rawgit.com/dhermes/bezier/0.6.2/docs/images/bezier_defn.png

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

https://cdn.rawgit.com/dhermes/bezier/0.6.2/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

bezier can be installed with pip:

$ python    -m pip install --upgrade bezier
$ python2.7 -m pip install --upgrade bezier
$ python3.6 -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.0],
...     [0.5, 1.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.0],
...     [0.25,  2.0],
...     [0.5 , -2.0],
...     [0.75,  2.0],
...     [1.0 ,  0.0],
... ])
>>> curve2 = bezier.Curve.from_nodes(nodes2)
>>> intersections = curve1.intersect(curve2)
>>> intersections
array([[0.31101776, 0.31101776],
       [0.68898224, 0.68898224],
       [0.        , 0.        ],
       [1.        , 1.        ]])
>>> s_vals = intersections[:, 0]
>>> points = curve1.evaluate_multi(s_vals)
>>> points
array([[0.31101776, 0.42857143],
       [0.68898224, 0.42857143],
       [0.        , 0.        ],
       [1.        , 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://cdn.rawgit.com/dhermes/bezier/0.6.2/docs/images/curves1_and_13.png

For API-level documentation, check out the Bézier 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.

Download files

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

Source Distribution

bezier-0.6.2.tar.gz (348.4 kB view details)

Uploaded Source

Built Distributions

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

bezier-0.6.2-cp36-none-win_amd64.whl (685.8 kB view details)

Uploaded CPython 3.6Windows x86-64

bezier-0.6.2-cp36-none-win32.whl (689.1 kB view details)

Uploaded CPython 3.6Windows x86

bezier-0.6.2-cp36-cp36m-manylinux1_x86_64.whl (1.5 MB view details)

Uploaded CPython 3.6m

bezier-0.6.2-cp36-cp36m-manylinux1_i686.whl (1.3 MB view details)

Uploaded CPython 3.6m

bezier-0.6.2-cp36-cp36m-macosx_10_6_intel.whl (2.8 MB view details)

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

bezier-0.6.2-cp35-none-win_amd64.whl (681.9 kB view details)

Uploaded CPython 3.5Windows x86-64

bezier-0.6.2-cp35-none-win32.whl (686.0 kB view details)

Uploaded CPython 3.5Windows x86

bezier-0.6.2-cp35-cp35m-manylinux1_x86_64.whl (1.5 MB view details)

Uploaded CPython 3.5m

bezier-0.6.2-cp35-cp35m-manylinux1_i686.whl (1.3 MB view details)

Uploaded CPython 3.5m

bezier-0.6.2-cp35-cp35m-macosx_10_6_intel.whl (2.8 MB view details)

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

bezier-0.6.2-cp27-none-win_amd64.whl (688.6 kB view details)

Uploaded CPython 2.7Windows x86-64

bezier-0.6.2-cp27-none-win32.whl (692.0 kB view details)

Uploaded CPython 2.7Windows x86

bezier-0.6.2-cp27-cp27mu-manylinux1_x86_64.whl (1.4 MB view details)

Uploaded CPython 2.7mu

bezier-0.6.2-cp27-cp27mu-manylinux1_i686.whl (1.3 MB view details)

Uploaded CPython 2.7mu

bezier-0.6.2-cp27-cp27m-manylinux1_x86_64.whl (1.4 MB view details)

Uploaded CPython 2.7m

bezier-0.6.2-cp27-cp27m-manylinux1_i686.whl (1.3 MB view details)

Uploaded CPython 2.7m

bezier-0.6.2-cp27-cp27m-macosx_10_6_intel.whl (2.8 MB view details)

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

File details

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

File metadata

  • Download URL: bezier-0.6.2.tar.gz
  • Upload date:
  • Size: 348.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for bezier-0.6.2.tar.gz
Algorithm Hash digest
SHA256 a9406322c49dd1024acd40dcd1fa2bf56dae69c83c80b4d83bceda1d65b36674
MD5 d9637064c1361ede17064552b13b654b
BLAKE2b-256 3df7a6415aebe95fc86ec5b72ae64e4850dfd3ea76fa6103e2d55c7f36fa2304

See more details on using hashes here.

File details

Details for the file bezier-0.6.2-cp36-none-win_amd64.whl.

File metadata

File hashes

Hashes for bezier-0.6.2-cp36-none-win_amd64.whl
Algorithm Hash digest
SHA256 effc02e4e5a1f01efab5851391c7ca9c82eefed69fde0ee2e5c67cefdb3124ce
MD5 21035201358438a330d5c8b2bad21065
BLAKE2b-256 fea2256ef62649e5ba9f2de6fcbafc56fa8883227bac5ab3f1c57043eadfad2e

See more details on using hashes here.

File details

Details for the file bezier-0.6.2-cp36-none-win32.whl.

File metadata

File hashes

Hashes for bezier-0.6.2-cp36-none-win32.whl
Algorithm Hash digest
SHA256 7911ece9e220e1d9451a3be87c0b807b3cae50e883afdd0be52a9bbc3a037846
MD5 6748816d2a818ca1ed31da73e7f59a8b
BLAKE2b-256 4f2d4e7acd82b90a76ce515f1f68c1fd5d9227d3a8e87cdd40ab5bb8d42a6c49

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for bezier-0.6.2-cp36-cp36m-manylinux1_x86_64.whl
Algorithm Hash digest
SHA256 98ae1c4a5051b7fc95f0e2c59870f78d3390b0aa203cbcb87075b8ea19dad969
MD5 73f26a3c95601ac0b6229696cd70f716
BLAKE2b-256 9782c15d87b6e50bfff2d6744ef47d581ff59fe1e0ccf56aed7aae7c1a3febe6

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for bezier-0.6.2-cp36-cp36m-manylinux1_i686.whl
Algorithm Hash digest
SHA256 1907dad40c15965c13730d616b11b697714738fce40b34ea4515df3edfa15b2a
MD5 6bc9116e7816b6564fbe14aac817ee5b
BLAKE2b-256 e83d693832dd00a2b81c4c2355eca362cbc76509d5fe6dd49508ecb691b907f6

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for bezier-0.6.2-cp36-cp36m-macosx_10_6_intel.whl
Algorithm Hash digest
SHA256 01d559210694d0f1c9184c9b6764d4f4855ea05ce448a635d0f641f48476f7b3
MD5 634b494341fb5ebbaa52a769fcda3612
BLAKE2b-256 e3d1a9483c17f42b7b6e8bc44f508323714287f957711012072ad69afbca46ea

See more details on using hashes here.

File details

Details for the file bezier-0.6.2-cp35-none-win_amd64.whl.

File metadata

File hashes

Hashes for bezier-0.6.2-cp35-none-win_amd64.whl
Algorithm Hash digest
SHA256 0def6fe144d4c857166caae9b705a241cf427dc4b8016fca2fa68935e0383256
MD5 62c3f1f32647428e57df61f0f0fc2a62
BLAKE2b-256 451601dc65e68bfcfb9429a2abadf70343fc5fa8831c4e0b92dca9d2f2cecdc4

See more details on using hashes here.

File details

Details for the file bezier-0.6.2-cp35-none-win32.whl.

File metadata

File hashes

Hashes for bezier-0.6.2-cp35-none-win32.whl
Algorithm Hash digest
SHA256 ae5294ac9e89deda30ea7f88c1c89c062c050cf3d01dfde0683be11dd4325c82
MD5 ad68198665ce0a723e7a859b4fd9c8f8
BLAKE2b-256 443fe99030d3d1a92e97eda12e8349ab3550595efda3c77a36314db29a96fd78

See more details on using hashes here.

File details

Details for the file bezier-0.6.2-cp35-cp35m-manylinux1_x86_64.whl.

File metadata

File hashes

Hashes for bezier-0.6.2-cp35-cp35m-manylinux1_x86_64.whl
Algorithm Hash digest
SHA256 38bc966a98b724a253446bb12c67e8f3ddd5d47fc3934b6970f48ba520ae5faa
MD5 d5ed13e190491fc3807bb24a633bc02b
BLAKE2b-256 a6d30edda9c43bb7f154e48b9ba0650af35f96ec35be312d29a5240f85e2cfed

See more details on using hashes here.

File details

Details for the file bezier-0.6.2-cp35-cp35m-manylinux1_i686.whl.

File metadata

File hashes

Hashes for bezier-0.6.2-cp35-cp35m-manylinux1_i686.whl
Algorithm Hash digest
SHA256 4eb57e23cf38a3efef11641197855e77b8a958ab6eb8dbf609bd8bb762c20acb
MD5 25d99c47a4190b9199ae0fd4d17c61a7
BLAKE2b-256 2f0d485ef934e2cfcd01ea3af604a00529d8c305b0acc844a1be6e9034d505b3

See more details on using hashes here.

File details

Details for the file bezier-0.6.2-cp35-cp35m-macosx_10_6_intel.whl.

File metadata

File hashes

Hashes for bezier-0.6.2-cp35-cp35m-macosx_10_6_intel.whl
Algorithm Hash digest
SHA256 06e2b665bca01f06b54af336ea9b06679e264124ead50e372f49f380a09467d2
MD5 336ca65b5c7fd0c0b2da4e1bcc495a7e
BLAKE2b-256 3f53a7c9a446a48c42259a421d56632ff58a999540de525b1f82db8a231c3886

See more details on using hashes here.

File details

Details for the file bezier-0.6.2-cp27-none-win_amd64.whl.

File metadata

File hashes

Hashes for bezier-0.6.2-cp27-none-win_amd64.whl
Algorithm Hash digest
SHA256 333c37e5bd24a1522618a9d32c22871257197bf4b986b032f3e98229a1ef6f3d
MD5 772741507a489d5f2ae0a13e0ed05ce8
BLAKE2b-256 12bc96c4995a3641e17872181308f972837c0bbba99fd48946d83b14a279d6b2

See more details on using hashes here.

File details

Details for the file bezier-0.6.2-cp27-none-win32.whl.

File metadata

File hashes

Hashes for bezier-0.6.2-cp27-none-win32.whl
Algorithm Hash digest
SHA256 5125f5d43a6e256d735b08edfd21dca03873577f970f7af3e6335d59130ed39e
MD5 b650dc35146b3fe3a89d74410b0b1e40
BLAKE2b-256 265af3db2866f1a21c2da62d5dfef1082a7ef7019d8016b450fd6f2123790f9a

See more details on using hashes here.

File details

Details for the file bezier-0.6.2-cp27-cp27mu-manylinux1_x86_64.whl.

File metadata

File hashes

Hashes for bezier-0.6.2-cp27-cp27mu-manylinux1_x86_64.whl
Algorithm Hash digest
SHA256 9e5164d64347046586edee80d50914127b7022c7f34f58299dd6fc07009b7f2c
MD5 41d4100da92ee767d4223b5409f6af26
BLAKE2b-256 7e95d0f052b36e0d42a0d85742ca13adf1a644c56c12d86144a00528b140c61f

See more details on using hashes here.

File details

Details for the file bezier-0.6.2-cp27-cp27mu-manylinux1_i686.whl.

File metadata

File hashes

Hashes for bezier-0.6.2-cp27-cp27mu-manylinux1_i686.whl
Algorithm Hash digest
SHA256 1831f53a9a6e57696c0a1b29d0334d7193d1462a827bf017053bc924eff6365d
MD5 5b65d400fb2478b57bfef8ce8a58fd99
BLAKE2b-256 5b1267b2f9dfc692b24561a66137df50a9d642077e97f0b8ca6f9c007203c295

See more details on using hashes here.

File details

Details for the file bezier-0.6.2-cp27-cp27m-manylinux1_x86_64.whl.

File metadata

File hashes

Hashes for bezier-0.6.2-cp27-cp27m-manylinux1_x86_64.whl
Algorithm Hash digest
SHA256 45a6e7459f33cca4153698748f0d3153e1e5521e5796d4a775dd493e063c04a1
MD5 cb61790603fe7f1d6f402f7878b19d00
BLAKE2b-256 48287482a5109e600f2a91262b5917e6c2a327793b6aa3b690d8c17dccfcc692

See more details on using hashes here.

File details

Details for the file bezier-0.6.2-cp27-cp27m-manylinux1_i686.whl.

File metadata

File hashes

Hashes for bezier-0.6.2-cp27-cp27m-manylinux1_i686.whl
Algorithm Hash digest
SHA256 8c2a4b3d5c1c47d1e86cc0e60bb17290644d841f005d5c9058470ac6e7ecf07e
MD5 f4828f526e4ddbc4fc82b409f858a024
BLAKE2b-256 3c38aa910dd90a7d1df0cf0ed5f7d80ab7e90517dcbae2b49d9e6a60ee72e425

See more details on using hashes here.

File details

Details for the file bezier-0.6.2-cp27-cp27m-macosx_10_6_intel.whl.

File metadata

File hashes

Hashes for bezier-0.6.2-cp27-cp27m-macosx_10_6_intel.whl
Algorithm Hash digest
SHA256 7143141e0b950d43e32d39d519434e4e3c96ed0a2dfb0fd40e6cdf9e70a57b97
MD5 165221f0bc5f61b24223695b45e73b22
BLAKE2b-256 fd51a888ddd0002cb205ed9fde844666c763a62e456179bdb70d7cdac121d0f1

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

2020.2.3

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

This release

0.6.2 This release

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