Skip to main content

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

CirleCI Build coverage Documentation Status

Install

$ pip install --upgrade bezier

Getting Started

For example, to create a curve:

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

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

>>> nodes2 = np.array([
...     [0.0 ,  0.0],
...     [0.25,  2.0],
...     [0.5 , -2.0],
...     [0.75,  2.0],
...     [1.0 ,  0.0],
... ])
>>> curve2 = bezier.Curve(nodes2)
>>> intersections = curve1.intersect(curve2)
>>> intersections
array([[ 0.311...,  0.428...],
       [ 0.688...,  0.428...],
       [ 0.      ,  0.      ],
       [ 1.      ,  0.      ]])

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

>>> import matplotlib.pyplot as plt
>>> import seaborn
>>>
>>> ax = curve1.plot(num_pts=256)
>>> curve2.plot(num_pts=256, ax=ax)
>>> ax.plot(intersections[:, 0], intersections[:, 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/bbd1ee88c3b379348c71b0942115f36c62b728d9/docs/images/test_curves1_and_13.png

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

Apache 2.0 - See the LICENSE for more information.

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.2.0.tar.gz (81.0 kB view details)

Uploaded Source

Built Distribution

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

bezier-0.2.0-py2.py3-none-any.whl (101.4 kB view details)

Uploaded Python 2Python 3

File details

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

File metadata

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

File hashes

Hashes for bezier-0.2.0.tar.gz
Algorithm Hash digest
SHA256 0e483f18ddb9ba61bb17868ae882f7efd7db73d42e0eb953c301a81928e42244
MD5 988986fa07a1a67d403fc68e3f1cb4f1
BLAKE2b-256 892917c5cb387f998bbf31e5db9a77e2dfb52259dfa53104ab6475a9272c64ff

See more details on using hashes here.

File details

Details for the file bezier-0.2.0-py2.py3-none-any.whl.

File metadata

File hashes

Hashes for bezier-0.2.0-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 d86fe6d1b8c815bbc719314ff2ce483782e36ddc7d37c9b4bb796700e809fbbc
MD5 ce032cf5fe8493ace2cf42040807b170
BLAKE2b-256 702c5d9e254bb0fbb94eb853e5e8a6b83201c6043730c9107bec5991feca5cc1

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

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

This release

0.2.0 This release

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