Skip to content

Add bindings for 10 high-impact missing libigl functions - #315

Merged
alecjacobson merged 2 commits into
mainfrom
enumerate-missing-bindings
Aug 31, 2026
Merged

Add bindings for 10 high-impact missing libigl functions#315
alecjacobson merged 2 commits into
mainfrom
enumerate-missing-bindings

Conversation

@alecjacobson

Copy link
Copy Markdown
Contributor

Summary

I enumerated the currently-unbound libigl functions, ranked them, and implemented Python bindings (with call tests) for the top 10 that are both straightforward to bind and high-impact.

Method

  • Diffed all igl:: public headers against the set of functions already bound in src/. Result: 280 unbound headers.
  • Filtered out non-candidates (type/enum/macro headers, MATLAB-style numeric helpers already covered by NumPy, IO/OpenGL/internal utilities) → 116 plausibly-bindable functions.
  • Scored each on straightforwardness (1–5; 5 = dense Eigen / scalar types only, trivial wrapper) and impact (1–5; 5 = commonly-used core geometry op), reading each header to verify the actual signature.

Implemented (top 10)

function purpose impact
polar_svd3x3(A) closest rotation to a 3×3 matrix (fast SVD) ★★★★
fit_rotations(S) batched per-vertex rotation fitting (ARAP local step) ★★★★
point_simplex_squared_distance(p, V, Ele, i) point→simplex distance + closest point + barycentric coords ★★★★
quad_planarity(V, F) per-quad non-planarity measure ★★★★
planarize_quad_mesh(Vin, F, maxIter, threshold) planarize a quad mesh ★★★★
smooth_corner_adjacency(V, F, threshold) crease-aware per-corner adjacency (CSR) ★★★★
ramer_douglas_peucker(P, tol) piecewise-linear curve simplification ★★★
connect_boundary_to_infinity(F) / (V, F) close an open mesh via a point at infinity ★★★
path_to_edges(I, make_loop=False) vertex path/loop → edge list ★★★
quad_edges(Q) unique undirected edges of a quad mesh ★★★

Non-obvious wrapping details are documented in the commit message (non-deduced DIM template param on point_simplex_squared_distance; upstream int32-only instantiation of quad_edges; output-type-tied-to-input on planarize_quad_mesh).

Runners-up (rest of the top ~50, deferred)

Grouped by why they weren't in this batch:

High value but need more than a trivial wrapper (good follow-ups):

  • unproject_ray, unproject_onto_mesh, unproject_on_plane, unproject_on_line — viewer/camera math (fixed-size Matrix4f/Vector4f, some with Hit/callback variants)
  • frame_field_deformer, frame_to_cross_field, comb_line_field, line_field_mismatch, parallel_transport_angles — cross/frame-field design
  • grad_intrinsic, lscm_hessian, normal_derivative, covariance_scatter_matrix, arap_rhs, arap_linear_block, cr_vector_laplacian/cr_vector_mass/cr_vector_curvature_correction, scalar_to_cr_vector_gradient, group_sum_matrix — return sparse operators (bindable, just larger surface)
  • tetrahedralized_grid — needs the TetrahedralizedGridType enum exposed
  • random_points_on_mesh_intrinsic — templated URBG parameter
  • edge_midpoints, edge_vectors — depend on precomputed halfedge (E, oE) from orient_halfedges
  • internal_angles_intrinsic, mapping_energy_with_jacobians, linprog, svd3x3, seam_edges, round_cone_signed_distance, piecewise_constant_winding_number, triangles_from_strip, bone_parents, collapse_small_triangles, exploded_view, box_surface_area, box_simplices, faces_first, simplify_polyhedron, outer_element, eytzinger_aabb, triangle_triangle_intersect_shared_edge/_shared_vertex, point_in_circle, projection_constraint, kkt_inverse, project_isometrically_to_plane — lower impact and/or narrower audience

Excluded as not straightforwardly bindable / redundant:

  • jet, parula — redundant with the already-bound colormap()
  • winding_number_antipodal — requires an Intersector class argument
  • forward_kinematics, deform_skeleton, directed_edge_orientations, dqs, direct_delta_mushstd::vector<Quaterniond/Affine3d> state
  • decimation/optimization internals with std::function callbacks or AABB/quadric state (collapse_least_cost_edge, qslim_optimal_collapse_edge_callbacks, line_search, flip_avoiding_line_search, pso, random_search, shapeup, screen_space_selection, variable_radius_offset, topological_hole_fill, unzip_corners, extract_non_manifold_edge_curves, …)

Testing

Added test_polar_svd3x3_and_fit_rotations, test_point_simplex_squared_distance, test_quad_mesh_helpers, test_ramer_douglas_peucker, test_path_to_edges_and_connect_boundary, and test_smooth_corner_adjacency to tests/test_all.py. Full suite passes locally:

104 passed

🤖 Generated with Claude Code

Enumerated the ~280 unbound libigl headers, filtered to the ~116 that are
plausibly bindable geometry-processing functions, scored each on binding
difficulty and user impact, and bound the top 10 that are both straightforward
(dense Eigen / scalar types only) and high impact:

- polar_svd3x3: closest rotation to a 3x3 matrix (fast SVD)
- fit_rotations: batched per-vertex rotation fitting (ARAP local step)
- point_simplex_squared_distance: point-to-simplex distance + barycentric coords
- quad_planarity: per-quad non-planarity measure
- planarize_quad_mesh: planarize a quad mesh
- smooth_corner_adjacency: crease-aware per-corner adjacency (CSR)
- ramer_douglas_peucker: piecewise-linear curve simplification
- connect_boundary_to_infinity: close an open mesh via a point at infinity
- path_to_edges: vertex path/loop -> edge list
- quad_edges: unique undirected edges of a quad mesh

Notes on non-obvious wrapping:
- point_simplex_squared_distance takes a non-deduced `int DIM` template
  parameter, so the wrapper dispatches on V.cols() for the 2D/3D cases.
- quad_edges is only instantiated upstream for 32-bit int, so the wrapper casts
  int64 <-> int32 around the call.
- planarize_quad_mesh ties the output type to the (deduced) input type, so the
  wrapper passes a concrete copy of Vin.

Adds call tests for all 10 to tests/test_all.py. Full suite passes (104).

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@alecjacobson
alecjacobson merged commit 7c1bf41 into main Aug 31, 2026
40 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant