Skip to main content

BSpy

Library for manipulating and rendering B-spline curves, surfaces, and multidimensional manifolds with non-uniform knots in each dimension.

The Spline class has a method to fit multidimensional data for scalar and vector functions of single and multiple variables. It also can fit splines to functions, to solutions for ordinary differential equations (ODEs), geodesics, offsets, and lines of curvature. Spline has methods to create points, lines, circular arcs, spheres, cones, cylinders, tori, ruled surfaces, surfaces of revolution, four-sided patches, and compositions of splines. Other methods add, subtract, and multiply splines, as well as confine spline curves to a given range. There are methods to evaluate spline values, derivatives, normals, integrals, continuity, curvature, and the Jacobian, as well as methods that return spline representations of derivatives, normals, integrals, graphs, and convolutions. In addition, there are methods to manipulate the domain of splines, including trim, join, split, reparametrize, transpose, reverse, add and remove knots, elevate and extrapolate, and fold and unfold. There are methods to manipulate the range of splines, including dot product, cross product, translate, rotate, scale, and transform. Finally, there are methods to compute the zeros and contours of a spline and to intersect two splines. Splines can be saved and loaded in json format.

The SplineBlock class has methods to process an array-like collection of splines that represent a system of equations. There are highly-optimized methods to compute the contours and zeros of a spline block, as well as a variety of methods to manipulate and evaluate a spline block and its derivatives.

The BSpyConvert package converts BSpy splines and solid models to and from OpenCascade (OCCT) equivalents and a variety of geometry and CAD file formats, including STEP, IGES, and STL.

The Hyperplane class has methods to create individual hyperplanes in any dimension, along with axis-aligned hyperplanes and hypercubes.

The Manifold abstract base class for Hyperplane and Spline.

The Solid class has methods to construct n-dimensional solids from trimmed Manifold boundaries. Each solid consists of a list of boundaries and a Boolean value that indicates if the solid contains infinity. Each Boundary consists of a manifold (currently a Hyperplane or Spline) and a domain solid that trims the manifold. Solids have methods to form the intersection, union, difference, and complement of solids. There are methods to compute point containment, winding numbers, surface integrals, and volume integrals. There are also methods to translate, transform, and compute cutouts of solids. Solids can be saved and loaded in json format.

The SplineOpenGLFrame class is an OpenGLFrame with custom shaders to render spline curves, surfaces, and solids. Spline surfaces with more than 3 dependent variables will have their added dimensions rendered as colors (up to 6 dependent variables are supported). Only tested on Windows systems.

The Viewer class is a tkinter.Tk app that hosts a SplineOpenGLFrame, a tree view full of solids and splines, and a set of controls to adjust and view the selected solids and splines. Only tested on Windows systems.

The Graphics class is a graphics engine to display solids and splines. It launches a Viewer and issues commands to the viewer for use in jupyter notebooks and other scripting environments. Only tested on Windows systems.

Viewer rendering the Utah teapot

The full documentation for BSpy can be found here, its GitHub project can be found here, a test suite can be found here, and a set of examples, including a jupyter notebook, can be found here.

Release 3.0 breaking changes

  • Removed accuracy as a member of Spline
  • Spline.common_basis is now a static method (see documentation for details)
  • Spline.least_squares changed arguments (see documentation for details)
  • Spline.load always returns a list of splines

Release 4.0 breaking changes

  • Removed Spline blossom method
  • Removed DrawableSpline class
  • Changed bspyApp class name to Viewer
  • Changed Viewer listbox to use extended selection (shift and ctrl keys)
  • Changed bspyGraphics class name to Graphics
  • Moved DrawableSpine methods for adjusting spline appearance to Viewer (see documentation for details)
  • Spline.bspline_values changed arguments (see documentation for details)
  • Spline.intersect changed return values (see documentation for details)

Release 5.0 breaking changes

  • Renamed Boundary.domain member to Boundary.trim
  • Renamed Solid.slice method to Solid.compute_cutout
  • Renamed Manifold.complete_slice method to Manifold.complete_cutout (also applies to Hyperplane and Spline classes)
  • Renamed Manifold.flip_normal method to Manifold.negate_normal (also applies to Hyperplane and Spline classes)

Metadata

Release files for bspy 5.0.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for bspy 5.0.1
File Size Uploaded Provenance Actions
bspy-5.0.1.tar.gz 118.2 kB Without provenance Details for bspy-5.0.1.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for bspy 5.0.1
File Interpreter ABI Platform Actions
bspy-5.0.1-py3-none-any.whl Python 3 none any Details for bspy-5.0.1-py3-none-any.whl

Total release size: 242.6 kB

Release files / bspy-5.0.1.tar.gz

Download URL bspy-5.0.1.tar.gz
Size 118.2 kB
Tags Source
SHA-256 checksum
How to use checksums
9999b80d45c8a39f9a32b6dc4f18ab2217ffacf0450dcdb8d7e276655f73851b
BLAKE2b-256 checksum
How to use checksums
77fb3489a6c94c4b5be67ca174980f9457401ed1d9192d6b30f68417eb50dbd9
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.9.13

Release files / bspy-5.0.1-py3-none-any.whl

Download URL bspy-5.0.1-py3-none-any.whl
Size 124.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
06b183062a29a06324a72200adda1b3437074ef8381715d8618b748f54211974
BLAKE2b-256 checksum
How to use checksums
f0c5ca89ead1f9a35b9b03a3823e8cf23b27481ae1d92b6cd8a6a3d02184c88a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.9.13

Security for bspy 5.0.1

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

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