examples: unify doc samples across bindings + fix 3 bugs#5971
Merged
Conversation
Align C/C#/Python doc samples to match cpp canonical (same inputs, same algorithm parameters, same output filenames) where fixture-safe. C samples lose CLI arg handling in favor of hardcoded filenames, matching cpp/py convention. Bugs surfaced during the audit: - MeshICP.dox.c: refMop was constructed from meshFloating instead of meshReference, so ICP was aligning a mesh onto itself. - MeshLoadSave.dox.cpp: error-check condition was inverted; the success path printed the error and exited 1. - GlobalRegistration.dox.py: p2pl_inaccuracy passed the point metric to getMeanSqDistToPlane instead of the plane metric. Other notable changes: - C# Collision / CollisionPrecise / CollisionSelf classes renamed to *Example so Program.cs reflection dispatcher can invoke them. - MeshFixDegeneracies.dox.cpp and Triangulation.dox.cpp now save their results (were pedagogically incomplete). - MeshDecimate.dox.cs switched to cpp canonical params; the existing S3 fixture was generated with the prior params, so the C# MeshDecimate test will fail until the fixture is refreshed. - MeshModification.dox.py now builds a torus programmatically (matching cpp) instead of loading mesh.stl; the corresponding parametrize entry in test_python_samples.py drops input_files. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
The original file had `MR_std_vector_MR_EdgeId_Size` / `_At` with capital S/A inside a dead `#else` branch that was never compiled. My rewrite inherited that typo and it broke the build on platforms that no longer silently warn. Use the real lowercase helpers `_size` / `_at`, matching the convention used across other c-examples (e.g. MeshStitchHole.dox.c). Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Fedr
approved these changes
Apr 24, 2026
oitel
reviewed
Apr 24, 2026
Contributor
There was a problem hiding this comment.
The change drops code examples that might be useful for users. Maybe better to update other languages' examples instead?
Contributor
Author
There was a problem hiding this comment.
this sample seems much more complicated than other langs, do we actually need it all? mb just add outNewFaces usage to all langs?
| p2pt_inaccuracy = icp.getMeanSqDistToPoint(value=p2pt_metric) | ||
| print(f"RMS point-to-point distance: {p2pt_metric} ± {p2pt_inaccuracy}") | ||
| p2pt_inaccuracy = icp.getMeanSqDistToPoint(p2pt_metric) | ||
| print(f"RMS point-to-point distance: {p2pt_metric} \u00b1 {p2pt_inaccuracy}") |
Contributor
There was a problem hiding this comment.
Why is the code point preferred over an explicit symbol?
oitel
approved these changes
Apr 24, 2026
…Holes Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
…x.py Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
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
Bugs fixed
examples/c-examples/MeshICP.dox.crefMopwas constructed frommeshFloatinginstead ofmeshReference, so ICP was aligning a mesh onto itself.meshReferencewas loaded but never used.examples/cpp-examples/MeshLoadSave.dox.cppif ( loadRes.has_value() )error-check condition was inverted — the success branch printed the error and exited 1.examples/python-examples/GlobalRegistration.dox.pyp2pl_inaccuracy = icp.getMeanSqDistToPlane(p2pt_metric)— passed the point metric where the plane metric belongs.Other notable changes
Collision/CollisionPrecise/CollisionSelfrenamed to*Exampleso theProgram.csreflection dispatcher can actually discover them (it filters onEndsWith("Example")).MeshFixDegeneracies.dox.cppandTriangulation.dox.cppnow save their results.MeshModification.dox.pynow builds a torus programmatically (matching cpp) instead of loadingmesh.stl; the parametrize entry intest_python_samples.pydropsinput_filesaccordingly.MeshDecimate.dox.csswitched to cpp canonical params (maxDeletedFaces=1000, maxError=0.05f, subdivideParts=64) plus thepackOptimally()pre-step.Known test breakage — requires S3 fixture refresh
The C#
MeshDecimatetest will fail against the current S3 autotest fixture (s3://data-autotest/test_data_2025-05-13/doc_samples/c-sharp/MeshDecimateExample/decimated_mesh.stl) because the canonical params produce a different mesh. The fixture needs to be regenerated with the updated sample and uploaded to a fresh dated snapshot, then the default URL in.github/actions/python-regression-tests/action.ymlbumped. Will be done manually before merge.Scope boundaries
This PR only touches changes that are fixture-independent (except for the one intentional break above). The following items are deferred to a follow-up because they would change existing fixture comparisons:
LaplacianExample→LaplacianDeformation,NoiseDenoiseExample→NoiseDenoise,Triangulation_v3→TriangulationdecimatedMesh.stl→decimated_mesh.stl).dox.cssamples to close parity with C++Test plan
getStatusInforename); GlobalRegistration output unchanged (only print-order + metric fix in stderr)\includewarnings🤖 Generated with Claude Code