NURBS curve and surface evaluation library in native Python
Project description
# Non-Uniform Rational Basis Spline (NURBS) Python Package
- [![DOI](https://zenodo.org/badge/DOI/10.5281/zenodo.815011.svg)](https://doi.org/10.5281/zenodo.815011)
[![Documentation Status](https://readthedocs.org/projects/nurbs-python/badge/?version=latest)](http://nurbs-python.readthedocs.io/en/latest/?badge=latest)
## Introduction
This project aims to implement the NURBS curve and surface computation algorithms in native Python with [minimum possible dependencies](#minimum-requirements).
Currently, the Curve and Surface classes can be used for data storage and evaluation of B-Spline and NURBS curves and surfaces. Additionally, Grid class can be used to generate simple 2D control point grids for use with the Surface class.
## For Researchers
I would be glad if you cite this repository using the DOI provided as a badge at the top.
## Example Scripts
Please see [NURBS-Python Examples](https://github.com/orbingol/NURBS-Python_Examples) repository for example scripts and figures.
## Description of the Package
### Algorithms
NURBS-Python currently implements the following algorithms from The NURBS Book by Piegl & Tiller:
Algorithm A2.1: FindSpan
Algorithm A2.2: BasisFuns
Algorithm A2.3: DersBasisFuns
Algorithm A3.1: CurvePoint
Algorithm A3.2: CurveDerivsAlg1
Algorithm A3.3: CurveDerivCpts
Algorithm A3.4: CurveDerivsAlg2
Algorithm A3.5: SurfacePoint
Algorithm A3.6: SurfaceDerivsAlg1
Algorithm A4.1: CurvePoint (from weighted control points)
Algorithm A4.3: SurfacePoint (from weighted control points)
### Data Structure
The data structure in Curve and Surface classes is implemented using [Python properties](https://docs.python.org/2/library/functions.html#property). The following table shows the properties defined in these classes:
### Evaluation Methods
After setting the required parameters, the curve or the surface can be evaluated using evaluate() or evaluate_rational() methods. Then, the evaluated curve points can be obtained from curvepts property and the evaluated surface points can be obtained from surfpts property. The curve and surface derivatives can be evaluated using derivatives() method. An easy way to get 1st derivatives using tangent() method is available in both classes.
Surface class has methods for transposing the surface by swapping U and V directions, tranpose(), and finding surface normals, normal().
### Reading Control Points
Both classes have read_ctrlpts() and read_ctrlptsw() methods for reading control points and weighted control points, respectively, from a text file. The details on the file format are explained in [FORMATS.md](FORMATS.md) file.
### Additional Features
utilities module has some extra features for several mathematical operations:
autogen_knotvector() generates a uniform knot vector according to the input degree and number of control points
normalize_knotvector() normalizes the knot vector between 0 and 1
cross_vector() computes the cross production of the input vectors
normalize_vector() generates a unit vector from the input vector
Other functions in the utilities module are used as helper functions in evaluation methods of Curve and Surface classes.
### 2D Grid Generation
Grid module is capable of generating simple 2D control point grids for use with the Surface class. Please check [ex_grid01.py](https://github.com/orbingol/NURBS-Python_Examples/blob/master/ex_grid01.py) file and the documentation for details on how to use the Grid class and its features.
## Minimum Requirements
One of the major goals of this project is implementing all these algorithms with minimum dependencies. Currently, the NURBS package can run with plain Python and therefore, it has no extra dependencies, like NumPy or similar. The code was tested with Python versions 2.7.12 and 3.5.3.
On the other hand, the plotting part of the examples requires Matplotlib installed in your Python distribution. If you don’t need any plotting, you basically won’t need Matplotlib at all.
## Issues and Reporting
If you have any questions related to the NURBS-Python package, please don’t hesitate to contact the author by email or creating a new issue.
## Author
Onur Rauf Bingol ([@orbingol](https://github.com/orbingol))
## Contributors
John-Eric Dufour ([@jedufour](https://github.com/jedufour)), bug fixing and contribution of surface example 3
Jan Heczko ([@heczis](https://github.com/heczis)), bug fixing
## License
[MIT](LICENSE)
## Acknowledgments
I would like to thank my PhD adviser, [Dr. Adarsh Krishnamurthy](https://www.me.iastate.edu/faculty/?user_page=adarsh), for his guidance and supervision throughout the course of this project. If you are interested in this Python package, please have a look at [our research group’s web page](http://web.me.iastate.edu/idealab/) for more projects and contact information.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distributions
Built Distributions
File details
Details for the file NURBS_Python-2.3.7-py3-none-any.whl
.
File metadata
- Download URL: NURBS_Python-2.3.7-py3-none-any.whl
- Upload date:
- Size: 22.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | e35f29efb6398ceb630c5ecc2a9a9f0add8ba95981774b46fb200ecaeffc7e6d |
|
MD5 | c1f1df3395feca364208170a58510474 |
|
BLAKE2b-256 | dca5923592cfde301229d974e3003fdc2d5d64c5169b1d68c2433c9098416045 |
File details
Details for the file NURBS_Python-2.3.7-py2-none-any.whl
.
File metadata
- Download URL: NURBS_Python-2.3.7-py2-none-any.whl
- Upload date:
- Size: 22.9 kB
- Tags: Python 2
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | cfd75b194608bd1ea7769a1e5700bcfce768793006dff8a0cf1617901bc6e901 |
|
MD5 | f46234d126c21077adaf23cbb3d2fb09 |
|
BLAKE2b-256 | adf78ca7979b5ebf37a908971bbe3d18d5db01a44468fa8526e7e6bec979c73e |