A Python library for Gordon Surface interpolation using B-splines.
Project description
Gordon Surface Library
This library provides a Python implementation for creating Gordon surfaces, which are a method for interpolating a network of curves to generate a smooth surface. It is designed to be compatible with CadQuery's OCP and leverages B-spline mathematics.
It is a line by line translation from the original C++ code in occ_gordon
Features
- Gordon surface interpolation from profile and guide curves.
- Compatibility with B-spline representations.
- Integration with CadQuery's OCP (OpenCASCADE Python) for geometric primitives.
Installation
This package can be installed using pip. It is recommended to use a virtual environment.
pip install ocp_gordon
Dependencies
- OCP (OpenCASCADE Python)
- NumPy
- SciPy
Usage
Here's a basic example of how to use the library:
# This is a placeholder example. Actual usage may vary based on the library's API.
from ocp_gordon import interpolate_curve_network
# Assume you have profile_curves and guide_curves defined as lists of B-spline objects
# Example:
# profile_curves = [...] # List of Geom_BSplineCurve objects
# guide_curves = [...] # List of Geom_BSplineCurve objects
try:
gordon_surface: Geom_BSplineSurface = interpolate_curve_network(profile_curves, guide_curves)
# You can then use gordon_surface with CadQuery or other visualization tools
print("Gordon surface created successfully.")
except Exception as e:
print(f"An error occurred: {e}")
For more detailed examples, please refer to the examples/ directory in the source code.
Test
To run tests, first install pytest, then:
cd tests
python test_all.py
Notable Difference from C++ Code
- A major difference is that in
intersect_bsplines.py, a polyfilledmath_BFGSis used instead ofmath_FRPRbecause bothmath_BFGSandmath_FRPRare not usable in OCP because OCP does not implementmath_Vector. Theactivate()function in this file has also been changed since the original one does not work well. - In the
_solve()function inbspline_approx_interp.py, the regularization is added to prevent singular matrix which occurs in some cases for example when the input curve is a bspline converted from a circle. - A new file
misc.pyis added to implement some missing classes/functions from OCP. The major ones areclone_bsplineandmath_BFGS.
License
This project is licensed under the Apache 2.0 License - see the LICENSE file for details.
Citing
The algorithm was originally described in:
@article{siggel2019tigl,
title={TiGL: an open source computational geometry library for parametric aircraft design},
author={Siggel, Martin and Kleinert, Jan and Stollenwerk, Tobias and Maierl, Reinhold},
journal={Mathematics in Computer Science},
volume={13},
number={3},
pages={367--389},
year={2019},
publisher={Springer},
doi={10.1007/s11786-019-00401-y}
}
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 Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file ocp_gordon-0.1.0.tar.gz.
File metadata
- Download URL: ocp_gordon-0.1.0.tar.gz
- Upload date:
- Size: 62.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.11.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
28fd18ece6bffd781fef712ff037ee6edad55e48a6316f5b2c594b2fd0c1e2cc
|
|
| MD5 |
7bf69f3c67669e76138bcc50f706d142
|
|
| BLAKE2b-256 |
43d64e79d7971f5c6374dc357dc5f884d1db6f06b27b6632b6d61e5d6d5eb8a9
|
File details
Details for the file ocp_gordon-0.1.0-py3-none-any.whl.
File metadata
- Download URL: ocp_gordon-0.1.0-py3-none-any.whl
- Upload date:
- Size: 48.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.11.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
9b1acd6a983bd5b6d1e8bbdfd170e8abd00eedc1683c78cdb86e747eea380488
|
|
| MD5 |
90a34e908b5a9e4d780854cccb167daf
|
|
| BLAKE2b-256 |
aff72bfc3d133c2daeca97fc858c8156d9a148e561c9aaf4c4e256b05b7f4160
|