Fix: rectangles over-constrained after an edit (dragged sides collapsed)

Parallel and perpendicular residuals were the cross/dot product over the sum of
the line lengths, so the solver could satisfy them by shrinking a line to
nothing. Dragging a corner of a rotated (3-point) rectangle collapsed a side to
zero; every later dimension then conflicted. The residuals are now the sine or
cosine of the angle (over the product of the lengths), which shrinking can't
improve. Tests drag, dimension, pin and square center, 2-point and 3-point
rectangles and check their degrees of freedom; oracle unchanged at 53/66.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01AS5Tn3xieewUSg3uxrMVdL
This commit is contained in:
bherbruckandClaude Opus 5.5 committed 2026-10-08 03:03:27 +00:00
1 parent c2309eb43b
commit a6dc759a02
3 files changed
+111 -1

No files matched your search

+4
View File
@@ -1289,3 +1289,7 @@ fn solve_cmd(s: &mut Session, p: &Value) -> Result<Value> {
let ss = st.sketch(id).ok_or_else(|| EngineError::Other("the sketch has not been evaluated".into()))?;
Ok(json!({"status": ss.report.status, "dof": ss.report.dof, "failing": ss.report.failing, "profiles": ss.profiles.len()}))
}
#[cfg(test)]
#[path = "sketch_rect_tests.rs"]
mod rect_tests;