Skip to content

Add relation inspector tool#42

Merged
vl3c merged 5 commits intomainfrom
feature/relation-inspector
Feb 16, 2026
Merged

Add relation inspector tool#42
vl3c merged 5 commits intomainfrom
feature/relation-inspector

Conversation

@vl3c
Copy link
Copy Markdown
Owner

@vl3c vl3c commented Feb 15, 2026

Summary

  • Add inspect_relation tool — a query-only geometric relation checker supporting 12 operations: parallel, perpendicular, collinear, concyclic, equal_length, similar, congruent, tangent, concurrent, point_on_line, point_on_circle, and auto
  • Pure static RelationInspector class following the GraphAnalyzer dispatch pattern with scale-aware tolerances and degenerate input guards
  • Canvas integration via inspect_relation() + _resolve_drawable_by_type(), registered in FunctionRegistry (not undoable)
  • AI tool schema with strict JSON validation (tool count 87 → 88)
  • 13 test classes / 35 Brython tests covering all operations, error cases, symmetry, near-threshold behavior, large-coordinate collinearity, and bounded segment tangency
  • Documentation updates: Example Prompts, Reference Manual, todo.txt

Codex review feedback addressed

  • Scale-invariant collinearity: cross product normalized by both vector magnitudes (cross / (|a| * |b|)) instead of single magnitude
  • Bounded segment tangency: perpendicular foot verified to lie on the segment; far-away segments on a tangent line correctly report false

Test plan

  • venv/bin/python -m pytest server_tests/ -v — 971 passed
  • venv/bin/python -m cli.main test client --start-server --timeout 600 --json — 2524 passed, 0 failures
  • venv/bin/python -m mypy static/client/utils/relation_inspector.py — no issues
  • Manual smoke test: create two parallel segments, ask AI "are s1 and s2 parallel?"

🤖 Generated with Claude Code

vl3c added 5 commits February 15, 2026 21:06
Pure static class with dict-dispatch handler registry supporting 12
operations: parallel, perpendicular, collinear, concyclic, equal_length,
similar, congruent, tangent, concurrent, point_on_line, point_on_circle,
and auto. Uses scale-aware relative tolerance, degenerate input guards
(zero-length segments, NaN/inf coordinates), and bounded segment tangency
checks.
Add inspect_relation() method on Canvas that resolves drawable names via
_resolve_drawable_by_type() and delegates to RelationInspector. Register
as a query-only tool (not in undoable functions).
Add strict JSON schema with 12-value operation enum and typed arrays for
objects/object_types. Update expected tool count (87 -> 88) and hash.
13 test classes with 35 tests covering all 12 operations, error cases,
symmetry, near-threshold behavior, scale-invariant collinearity at large
coordinates, and bounded segment tangency edge cases.
Add Example Prompts section, Reference Manual entry with supported
operations and usage examples, and mark relation inspector as done
in todo.txt.
@vl3c vl3c merged commit b631db4 into main Feb 16, 2026
1 check passed
@vl3c vl3c deleted the feature/relation-inspector branch February 16, 2026 18:21
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