Skip to main content

Gordon Surface Library for CadQuery's OCP

This library provides a Python implementation for creating Gordon surfaces, 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.

The implementation is written entirely in Python and is adapted from the original C++ code in occ_gordon

It is currently used by build123d, but can also be used independently.

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.

pip install ocp_gordon

Dependencies

  • OCP (OpenCASCADE Python)
  • NumPy
  • SciPy

Usage

Here's a basic example of how to use the library:

# Assume you have profile_curves and guide_curves defined as lists of B-spline objects
# profile_curves = [...] # List of Geom_BSplineCurve objects
# guide_curves = [...]   # List of Geom_BSplineCurve objects

from ocp_gordon import interpolate_curve_network

gordon_surface = interpolate_curve_network(profile_curves, guide_curves, tolerance=3e-4)

For more detailed examples, please refer to the examples/ directory in the source code.

Test

To run tests, first install pytest, then:

python -m pytest

Notable Difference from C++ Code

  • In intersect_bsplines.py, the math_BFGS method is polyfilled and used in place of math_FRPR, as neither math_BFGS nor math_FRPR is usable in OCP due to the lack of math_Vector exposure. The intersect detection algorithm has been improved for both speed and reliability.
  • In the _solve() function of bspline_approx_interp.py, regularization has been added to prevent singular matrix issues, which can occur in cases such as when the input curve is a B-spline derived from a circle.
  • A new file, misc.py, has been introduced to implement missing OCP utilities. The primary additions include clone_bspline and math_BFGS.
  • Modified curve_network_sorter.py, bspline_algorithms.py, and interpolate_curve_network.py to allow a single point to be used as either a profile or a guide.
  • The reparameterization process is now skipped if the input profiles and guides are already iso-parametric, improving accuracy and performance for such cases.
  • In bspline_algorithms.py, the GeomConvert_ApproxCurve() function is utilized for improved representation of conic curves.

Caveats

Potential misalignments can occur between the generated Gordon surface and its input curves, especially at boundaries. This is primarily due to the approximation involved in the reparameterization process for non-iso-parametric inputs. For a detailed explanation and mitigation strategies, please refer to the Gordon Surface Misalignment wiki page.

License

This project is licensed under the Apache 2.0 License - see the LICENSE file for details.

Citing

The algorithm was originally described in:

Siggel M. et. al. (2019), TiGL: An Open Source Computational Geometry Library for Parametric Aircraft Design

@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}
}

Download files

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

Source Distribution

ocp_gordon-0.2.2.tar.gz (119.5 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

ocp_gordon-0.2.2-py3-none-any.whl (54.1 kB view details)

Uploaded Python 3

File details

Details for the file ocp_gordon-0.2.2.tar.gz.

File metadata

  • Download URL: ocp_gordon-0.2.2.tar.gz
  • Upload date:
  • Size: 119.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for ocp_gordon-0.2.2.tar.gz
Algorithm Hash digest
SHA256 403c2628a8de9b694f18ecd2d98c1956d3aaf7c869f72e3556575d33d8df03f1
MD5 29809766df96454cf3ae0abf36e2850b
BLAKE2b-256 87b401487c528cdaef6c4b795f633bece21de465d589a6852474df7ea05066b9

See more details on using hashes here.

Provenance

The following attestation bundles were made for ocp_gordon-0.2.2.tar.gz:

Publisher: release.yml on gongfan99/ocp_gordon

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file ocp_gordon-0.2.2-py3-none-any.whl.

File metadata

  • Download URL: ocp_gordon-0.2.2-py3-none-any.whl
  • Upload date:
  • Size: 54.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for ocp_gordon-0.2.2-py3-none-any.whl
Algorithm Hash digest
SHA256 6414e901a11065a56e839c81b56f418100b4d0b81eb5aa23bb1f8f72f97ff099
MD5 981f9d58b24e8ce8268aa41d5565a274
BLAKE2b-256 6cd1ee535cdbc502790dda6555e439ea8bcacdd38325859151769d109d307a94

See more details on using hashes here.

Provenance

The following attestation bundles were made for ocp_gordon-0.2.2-py3-none-any.whl:

Publisher: release.yml on gongfan99/ocp_gordon

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Release history Release notifications | RSS feed

This release

0.2.2 This release

2 files

0.2.1

2 files

0.2.0

2 files

0.1.18

2 files

0.1.17

2 files

0.1.16

2 files

0.1.15

2 files

0.1.14

2 files

0.1.13

2 files

0.1.12

2 files

0.1.11

2 files

0.1.10

2 files

0.1.9

2 files

0.1.5

2 files

0.1.4

2 files

0.1.3

2 files

0.1.1

2 files

0.1.0

2 files

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page