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

Helper for Bézier Curves, Triangles, and Higher Order Objects - Published in JOSS (2017)

https://github.com/dhermes/bezier

Science Score: 93.0%

This score indicates how likely this project is to be science-related based on various indicators:

  • CITATION.cff file
  • codemeta.json file
    Found codemeta.json file
  • .zenodo.json file
    Found .zenodo.json file
  • DOI references
    Found 11 DOI reference(s) in README and JOSS metadata
  • Academic publication links
    Links to: joss.theoj.org, zenodo.org
  • Committers with academic emails
  • Institutional organization owner
  • JOSS paper metadata
    Published in Journal of Open Source Software

Keywords from Contributors

parallel mesh

Scientific Fields

Mathematics Computer Science - 88% confidence
Engineering Computer Science - 60% confidence
Last synced: 4 months ago · JSON representation

Repository

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

Basic Info
  • Host: GitHub
  • Owner: dhermes
  • License: apache-2.0
  • Language: Python
  • Default Branch: main
  • Homepage:
  • Size: 27.1 MB
Statistics
  • Stars: 280
  • Watchers: 5
  • Forks: 39
  • Open Issues: 77
  • Releases: 23
Created about 9 years ago · Last pushed about 1 year ago
Metadata Files
Readme License Codemeta

README.rst

``bezier``
==========

    Helper for B |eacute| zier Curves, Triangles, and Higher Order Objects

|linux-build| |macos-build| |windows-build| |coverage|

|pypi| |versions|

|docs| |zenodo| |JOSS|

.. |eacute| unicode:: U+000E9 .. LATIN SMALL LETTER E WITH ACUTE
   :trim:

This library provides:

* Support for B |eacute| zier `Curves`_
* Support for B |eacute| zier `Triangles`_

Dive in and take a look!

.. image:: https://raw.githubusercontent.com/dhermes/bezier/main/docs/images/triangles6Q_and_7Q.png
   :align: center

Why B |eacute| zier?
--------------------

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

.. image:: https://raw.githubusercontent.com/dhermes/bezier/main/docs/images/bernstein_basis.png
   :align: center

to define a curve as a linear combination:

.. image:: https://raw.githubusercontent.com/dhermes/bezier/main/docs/images/bezier_defn.png
   :align: center

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

.. image:: https://raw.githubusercontent.com/dhermes/bezier/main/docs/images/sum_to_unity.png
   :align: center

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 |eacute| 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

.. _retrospective: https://dx.doi.org/10.1016/j.cagd.2012.03.001
.. _Bernstein basis: https://en.wikipedia.org/wiki/Bernstein_polynomial
.. _de Casteljau's algorithm: https://en.wikipedia.org/wiki/De_Casteljau%27s_algorithm
.. _FEM: https://en.wikipedia.org/wiki/Finite_element_method
.. _NURBS: https://en.wikipedia.org/wiki/Non-uniform_rational_B-spline

Installing
----------

The ``bezier`` Python package can be installed with `pip`_:

.. code-block:: console

   $ python     -m pip install --upgrade bezier
   $ python3.12 -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):

.. code-block:: console

   $ 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.

.. _pip: https://pip.pypa.io
.. _GitHub: https://github.com/dhermes/bezier/

Getting Started
---------------

For example, to create a curve:

.. code-block:: python

   >>> import bezier
   >>> import numpy as np
   >>> 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:

.. code-block:: python

   >>> 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):

.. code-block:: python

   >>> 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)

.. image:: https://raw.githubusercontent.com/dhermes/bezier/main/docs/images/curves1_and_13.png
   :align: center

For API-level documentation, check out the B |eacute| 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:

.. code-block:: rest

   @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`_.

.. _JOSS paper: https://joss.theoj.org/papers/10.21105/joss.00267
.. _list by version: https://zenodo.org/search?page=1&size=20&q=conceptrecid:%22838307%22&sort=-version&all_versions=True

License
-------

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

.. _Curves: https://bezier.readthedocs.io/en/latest/python/reference/bezier.curve.html
.. _Triangles: https://bezier.readthedocs.io/en/latest/python/reference/bezier.triangle.html
.. _package: https://bezier.readthedocs.io/en/latest/python/reference/bezier.html
.. _DEVELOPMENT doc: https://github.com/dhermes/bezier/blob/main/DEVELOPMENT.rst
.. _the LICENSE: https://github.com/dhermes/bezier/blob/main/LICENSE

.. |docs| image:: https://readthedocs.org/projects/bezier/badge/?version=latest
   :target: https://bezier.readthedocs.io/en/latest/
   :alt: Documentation Status
.. |linux-build| image:: https://github.com/dhermes/bezier/workflows/Linux/badge.svg?branch=main&event=push
   :target: https://github.com/dhermes/bezier/actions?query=workflow%3ALinux
   :alt: Linux Build (GitHub Actions)
.. |macos-build| image:: https://github.com/dhermes/bezier/workflows/macOS/badge.svg?branch=main&event=push
   :target: https://github.com/dhermes/bezier/actions?query=workflow%3AmacOS
   :alt: macOS Build (GitHub Actions)
.. |windows-build| image:: https://github.com/dhermes/bezier/workflows/Windows/badge.svg?branch=main&event=push
   :target: https://github.com/dhermes/bezier/actions?query=workflow%3AWindows
   :alt: Windows Build (GitHub Actions)
.. |pypi| image:: https://img.shields.io/pypi/v/bezier.svg
   :target: https://pypi.org/project/bezier/
   :alt: PyPI Latest
.. |versions| image:: https://img.shields.io/pypi/pyversions/bezier.svg
   :target: https://pypi.org/project/bezier/
   :alt: Package Versions
.. |coverage| image:: https://coveralls.io/repos/github/dhermes/bezier/badge.svg
   :target: https://coveralls.io/github/dhermes/bezier
   :alt: Code Coverage
.. |zenodo| image:: https://zenodo.org/badge/73047402.svg
   :target: https://zenodo.org/badge/latestdoi/73047402
   :alt: Zenodo DOI for ``bezier``
.. |JOSS| image:: https://joss.theoj.org/papers/10.21105/joss.00267/status.svg
   :target: https://dx.doi.org/10.21105/joss.00267
   :alt: "Journal of Open Source Science" DOI for ``bezier``

Owner

  • Name: Danny Hermes
  • Login: dhermes
  • Kind: user
  • Location: Greater Chicago Area
  • Company: Co-founder @hardfinhq

Head of Engineering, Software Engineer and PhD Mathematician

JOSS Publication

Helper for Bézier Curves, Triangles, and Higher Order Objects
Published
August 02, 2017
Volume 2, Issue 16, Page 267
Authors
Danny Hermes ORCID
University of California, Berkeley
Editor
Arfon Smith ORCID
Tags
algebra bezier curve parametric curve numerical software

CodeMeta (codemeta.json)

{
  "@context": "https://raw.githubusercontent.com/codemeta/codemeta/8bd28155b7a8a2097a57ac314b7bf234081bd310/codemeta.jsonld",
  "@type": "Code",
  "author": [
    {
      "@id": "https://orcid.org/0000-0001-7366-173X",
      "@type": "Person",
      "affiliation": "University of California, Berkeley",
      "email": "daniel.j.hermes@gmail.com",
      "name": "Danny Hermes"
    }
  ],
  "codeRepository": "https://github.com/dhermes/bezier",
  "dateCreated": "2017-05-22",
  "dateModified": "2017-05-22",
  "datePublished": "2017-05-22",
  "description": "Helper for Bézier Curves, Triangles, and Higher Order Objects",
  "identifier": "",
  "keywords": "Geometry, Curve, Bézier, Intersection, Python",
  "license": "Apache 2.0",
  "title": "Bézier",
  "version": "2024.6.20"
}

Papers & Mentions

Total mentions: 2

EvoLaps: a web interface to visualize continuous phylogeographic reconstructions
Last synced: 2 months ago
Protein velocity and acceleration from single-cell multiomics experiments
Last synced: 2 months ago

GitHub Events

Total
  • Issues event: 2
  • Watch event: 18
  • Delete event: 4
  • Issue comment event: 5
  • Pull request event: 8
  • Fork event: 1
  • Create event: 4
Last Year
  • Issues event: 2
  • Watch event: 18
  • Delete event: 4
  • Issue comment event: 5
  • Pull request event: 8
  • Fork event: 1
  • Create event: 4

Committers

Last synced: 5 months ago

All Time
  • Total Commits: 2,068
  • Total Committers: 11
  • Avg Commits per committer: 188.0
  • Development Distribution Score (DDS): 0.021
Past Year
  • Commits: 5
  • Committers: 2
  • Avg Commits per committer: 2.5
  • Development Distribution Score (DDS): 0.2
Top Committers
Name Email Commits
Danny Hermes d****s@g****m 2,024
Danny Hermes d****s@h****m 28
Danny Hermes d****s@b****m 5
dependabot[bot] 4****] 2
BryceStansfield b****e@b****m 2
Antony Lee a****e@g****m 2
sharonahermes 1****s 1
Ziqi Wang q****c@g****m 1
Kian-Meng Ang k****g@g****m 1
Benjamin Hackl d****l@b****t 1
Andrzej Górski a****3@g****m 1
Committer Domains (Top 20 + Academic)

Issues and Pull Requests

Last synced: 4 months ago

All Time
  • Total issues: 83
  • Total pull requests: 72
  • Average time to close issues: 10 months
  • Average time to close pull requests: 11 days
  • Total issue authors: 35
  • Total pull request authors: 7
  • Average comments per issue: 2.9
  • Average comments per pull request: 1.06
  • Merged pull requests: 48
  • Bot issues: 0
  • Bot pull requests: 21
Past Year
  • Issues: 2
  • Pull requests: 10
  • Average time to close issues: N/A
  • Average time to close pull requests: 12 days
  • Issue authors: 2
  • Pull request authors: 1
  • Average comments per issue: 0.0
  • Average comments per pull request: 1.1
  • Merged pull requests: 1
  • Bot issues: 0
  • Bot pull requests: 10
Top Authors
Issue Authors
  • dhermes (44)
  • piscvau (3)
  • Cilyan (2)
  • moi15moi (2)
  • abey79 (2)
  • epicwhale (1)
  • Darylgolden (1)
  • KIKI007 (1)
  • ariejdl (1)
  • mok33 (1)
  • seadhy (1)
  • jstncno (1)
  • saxenarohan97 (1)
  • lquenti (1)
  • dependabot[bot] (1)
Pull Request Authors
  • dhermes (53)
  • dependabot[bot] (33)
  • BryceStansfield (2)
  • henryiii (2)
  • behackl (1)
  • kianmeng (1)
  • KIKI007 (1)
Top Labels
Issue Labels
packaging (32) language: python (26) type: question (25) docs (15) language: fortran (12) type: enhancement (9) build (9) os: windows (6) os: mac-os (5) language: cmake (5) type: bug (5) hygiene (5) robustness (4) testing (4) numerical-stability (3) good first issue (3) help wanted (3) type: investigating (3) language: c/c++ (2) plotting (1) type: duplicate (1) os: linux (1) language: pypy (1) dependencies (1)
Pull Request Labels
dependencies (33) packaging (29) language: python (29) docs (15) os: windows (6) build (5) language: fortran (5) type: enhancement (4) os: linux (4) testing (3) hygiene (3) os: mac-os (2) plotting (2) type: bug (2) language: cmake (2) performance (1) robustness (1) language: c/c++ (1) do not merge (1) numerical-stability (1)

Packages

  • Total packages: 2
  • Total downloads:
    • pypi 541,419 last-month
  • Total docker downloads: 1,031
  • Total dependent packages: 16
    (may contain duplicates)
  • Total dependent repositories: 65
    (may contain duplicates)
  • Total versions: 27
  • Total maintainers: 1
pypi.org: bezier

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

  • Versions: 24
  • Dependent Packages: 16
  • Dependent Repositories: 65
  • Downloads: 541,419 Last month
  • Docker Downloads: 1,031
Rankings
Downloads: 0.7%
Dependent packages count: 1.0%
Dependent repos count: 1.8%
Docker downloads count: 2.3%
Average: 2.9%
Stargazers count: 4.5%
Forks count: 6.8%
Maintainers (1)
Last synced: 4 months ago
conda-forge.org: libbezier
  • Versions: 3
  • Dependent Packages: 0
  • Dependent Repositories: 0
Rankings
Stargazers count: 24.1%
Forks count: 29.4%
Dependent repos count: 34.0%
Average: 34.7%
Dependent packages count: 51.2%
Last synced: 4 months ago

Dependencies

docs/requirements.txt pypi
  • Sphinx >=4.4.0
  • numpy >=1.21.4
  • sphinx-docstring-typing >=0.0.4
  • sphinx_rtd_theme >=1.0.0
scripts/requirements.txt pypi
  • numpy >=1.21.4
  • pytest >=6.2.5
  • scipy >=1.7.2
  • sympy >=1.9