Add bindings for 10 high-impact missing libigl functions - #315
Merged
Conversation
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>
Merged
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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
igl::public headers against the set of functions already bound insrc/. Result: 280 unbound headers.Implemented (top 10)
polar_svd3x3(A)fit_rotations(S)point_simplex_squared_distance(p, V, Ele, i)quad_planarity(V, F)planarize_quad_mesh(Vin, F, maxIter, threshold)smooth_corner_adjacency(V, F, threshold)ramer_douglas_peucker(P, tol)connect_boundary_to_infinity(F)/(V, F)path_to_edges(I, make_loop=False)quad_edges(Q)Non-obvious wrapping details are documented in the commit message (non-deduced
DIMtemplate param onpoint_simplex_squared_distance; upstream int32-only instantiation ofquad_edges; output-type-tied-to-input onplanarize_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-sizeMatrix4f/Vector4f, some withHit/callback variants)frame_field_deformer,frame_to_cross_field,comb_line_field,line_field_mismatch,parallel_transport_angles— cross/frame-field designgrad_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 theTetrahedralizedGridTypeenum exposedrandom_points_on_mesh_intrinsic— templatedURBGparameteredge_midpoints,edge_vectors— depend on precomputed halfedge(E, oE)fromorient_halfedgesinternal_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 audienceExcluded as not straightforwardly bindable / redundant:
jet,parula— redundant with the already-boundcolormap()winding_number_antipodal— requires anIntersectorclass argumentforward_kinematics,deform_skeleton,directed_edge_orientations,dqs,direct_delta_mush—std::vector<Quaterniond/Affine3d>statestd::functioncallbacks orAABB/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, andtest_smooth_corner_adjacencytotests/test_all.py. Full suite passes locally:🤖 Generated with Claude Code