%global pypi_name fast-simplification %global mod_name fast_simplification Name: python-%{pypi_name} Version: 0.2.0 Release: 1%{?dist} Summary: Fast quadric mesh decimation for numpy triangle meshes License: MIT URL: https://github.com/pyvista/fast-simplification Source0: %{pypi_source %{mod_name}} BuildRequires: gcc-c++ BuildRequires: cmake BuildRequires: ninja-build BuildRequires: python3-devel BuildRequires: pyproject-rpm-macros %global _description %{expand: fast-simplification wraps Sven Forstmann's Fast-Quadric-Mesh-Simplification in nanobind: it decimates a triangle mesh given as numpy point and face arrays to a target face count or reduction ratio, and can record and replay the edge collapses. PyVista uses it for decimation; Hertzon uses it to simplify imported STL geometry.} %description %_description %package -n python3-%{pypi_name} Summary: %{summary} # Simplify.h (header-only, MIT) from # https://github.com/sp4cerat/Fast-Quadric-Mesh-Simplification, modified # upstream for the replay support; there is no Fedora package of it. Provides: bundled(fast-quadric-mesh-simplification) %description -n python3-%{pypi_name} %_description %prep %autosetup -n %{mod_name}-%{version} %generate_buildrequires export SETUPTOOLS_SCM_PRETEND_VERSION=%{version} %pyproject_buildrequires %build export SETUPTOOLS_SCM_PRETEND_VERSION=%{version} # nanobind strips the module in Release builds, leaving no debuginfo. %pyproject_wheel -C cmake.build-type=RelWithDebInfo %install %pyproject_install %pyproject_save_files %{mod_name} %check %pyproject_check_import # The sdist excludes upstream's tests (and they need pyvista). Decimate a # closed sphere-like mesh and check the result is smaller, valid and on it. cd %{_builddir} %{py3_test_envvars} %{python3} - <<'PYEOF' import numpy as np import fast_simplification as fs n = 40 th, ph = np.meshgrid(np.linspace(0, np.pi, n), np.linspace(0, 2 * np.pi, n, endpoint=False), indexing="ij") pts = np.c_[(np.sin(th) * np.cos(ph)).ravel(), (np.sin(th) * np.sin(ph)).ravel(), np.cos(th).ravel()] tri = [] for i in range(n - 1): for j in range(n): a, b = i * n + j, i * n + (j + 1) % n c, d = a + n, b + n tri += [[a, b, d], [a, d, c]] tri = np.array(tri, np.int32) p, f = fs.simplify(pts, tri, target_reduction=0.75) assert 0 < len(f) < 0.5 * len(tri), (len(f), len(tri)) assert f.min() >= 0 and f.max() < len(p) r = np.linalg.norm(p, axis=1) assert np.all(np.abs(r - 1) < 0.05), (r.min(), r.max()) p2, f2, col = fs.simplify(pts, tri, target_count=500, return_collapses=True) p3, f3, _ = fs.replay_simplification(pts, tri, col) assert len(f3) == len(f2) print("fast-simplification ok:", len(tri), "->", len(f)) PYEOF %files -n python3-%{pypi_name} -f %{pyproject_files} %license LICENSE %doc README.rst %changelog * Wed Oct 21 2026 Morgan Hough - 0.2.0-1 - Initial package (Hertzon dependency; PyVista decimation backend).