Skip to main content

Library for manipulating and rendering non-uniform B-splines

Project description

BSpy

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

The Manifold abstract base class for Hyperplane and Spline.

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), and to geodesics. Spline has methods to create points, lines, circular arcs, spheres, cones, cylinders, tori, ruled surfaces, surfaces of revolution, and four-sided patches. 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 Hyperplane class has methods to create individual hyperplanes in any dimension, along with axis-aligned hyperplanes and hypercubes.

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 slice solids. Solids can be saved and loaded in json format.

The SplineBlock class has methods to represent and process an array-like collection of splines, including ones to compute the contours and zeros of a spline block, as well as a variety of methods to evaluate a spline block and its derivatives. Spline blocks are useful for efficiently manipulating and solving systems of equations with splines.

The SplineOpenGLFrame class is an OpenGLFrame with custom shaders to render spline curves and surfaces. 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 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)

Project details


Download files

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

Source Distribution

bspy-4.2.tar.gz (108.9 kB view details)

Uploaded Source

Built Distribution

bspy-4.2-py3-none-any.whl (114.4 kB view details)

Uploaded Python 3

File details

Details for the file bspy-4.2.tar.gz.

File metadata

  • Download URL: bspy-4.2.tar.gz
  • Upload date:
  • Size: 108.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.9.13

File hashes

Hashes for bspy-4.2.tar.gz
Algorithm Hash digest
SHA256 d1a7b70dc422d878e38a9f550bb949d04dcf7e81e5c1bdcd866c100effaa78cb
MD5 8d30551c59c89dd1c1d29cb20ca5fb03
BLAKE2b-256 d1a9651e120a4a67493d1dd840238f5872347a879baf304d359765238fab07cb

See more details on using hashes here.

File details

Details for the file bspy-4.2-py3-none-any.whl.

File metadata

  • Download URL: bspy-4.2-py3-none-any.whl
  • Upload date:
  • Size: 114.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.9.13

File hashes

Hashes for bspy-4.2-py3-none-any.whl
Algorithm Hash digest
SHA256 bc095d077d95a0283c7769c2be332feef4212125ea9d4dc79d81e7603a68bcb9
MD5 b2997adf269b17d5b7e2acee60986b81
BLAKE2b-256 2175257f10b53deb9032ea4bcc02677a9a8fc6ef9fad8e63bfb794beb742731e

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page