Uh oh!
There was an error while loading. Please reload this page.
docs: dt_mesh returns plain distance, not squared distance - #85
Merged
Conversation
`api/distance.h`'s doc comment for `dt_mesh`'s `dist` output claimed "squared distances". It does not: the CPU suite pins the output against `std::sqrt(point_tri_sqdist(...))` (tests/lib-cpu/test_distance_mesh.cpp), i.e. the plain Euclidean point-to-triangle distance, signed when `_signed`. The neighbouring `dt_spline_*` docstrings say "best squared distance" and are correct -- their reference in tests/lib-cpu/test_distance_spline.cpp is an unrooted squared distance -- so only `dt_mesh` is corrected here. `dt_euclidean` / `dt_l1` document no output param at all (they are in-place) and are untouched. Doc-only; no behaviour change. Closes#74 Co-Authored-By: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_016AjQcY78NgbagPSbPJRr6Z
balbastyforce-pushed
the
docs/dt-mesh-plain-distance
branch
from
August 19, 2026 19:12
621db86 to
4975867CompareThe `lint (clang-format, changed lines)` job failed on this branch. The cause is not the new text: `@param _signed` (81 cols) and `@param naive` (90 cols) predate this change, and clang-format reflows the whole doc block once any line inside it is touched, so it proposed breaking those two at column 80 with continuations starting at ` * `. Wrapping them by hand instead keeps the block's hanging-indent alignment and leaves clang-format with nothing to change (`git clang-format main` is now clean on this branch). Still doc-only. Co-Authored-By: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_016AjQcY78NgbagPSbPJRr6Z
Uh oh!
There was an error while loading. Please reload this page.
This was referenced Aug 19, 2026
Closed
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 freeto 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.
Closes#74.
include/fastfields/api/distance.h's doc comment fordt_mesh'sdistoutput said "Output tensor for squared distances". It is not squared.
Verified against the CPU suite, which is the source of truth for op
semantics:
tests/lib-cpu/test_distance_mesh.cpppins the output againststd::sqrt(point_tri_sqdist(...))(line 182) and againststd::sqrt(best)for the brute-force reference (line 257) — i.e. the plainEuclidean point-to-triangle distance, negated inside the surface when
_signed.As the issue asks, the neighbours were checked while in there:
dt_spline_table/dt_spline_brent/dt_spline_gaussnewtonsay"best squared distance" and are correct — their reference in
tests/lib-cpu/test_distance_spline.cppaccumulates an unrooted squareddistance. Left alone.
dt_euclidean/dt_l1are in-place and document no output parameter,so there is nothing to drift. Left alone.
Doc-only: no code, no behaviour change. Only
codespelland thechanged-lines
clang-formatjob are triggered by this path.Generated by Claude Code