Skip to content

fix(drawing): restrict emitAngular sweep to non-reflex (≤ π) to match Angular.value (#1169) - #1196

Closed
SMKiloBOT wants to merge 1 commit into
mainfrom
fix/1169-angular-dimension-sweep
Closed

fix(drawing): restrict emitAngular sweep to non-reflex (≤ π) to match Angular.value (#1169)#1196
SMKiloBOT wants to merge 1 commit into
mainfrom
fix/1169-angular-dimension-sweep

Conversation

@SMKiloBOT

Copy link
Copy Markdown
Contributor

What & why

Restricted emitAngular sweep to non-reflex (≤ π) to match Angular.value. The previous implementation could produce reflex arcs (> π) which diverged from the canonical Angular.value (acos, always ≤ π). Now the shorter counter-clockwise arc is taken by swapping direction when the sweep exceeds π.

Closes #1169

CHANGELOG entry

fix(drawing): restrict emitAngular sweep to non-reflex (≤ π) to match Angular.value (#1169)

SemVer impact

PATCH. Consumers using angular dimension rendering will see corrected sweep angles for reflex arcs; no migration needed.

Checklist

  • New or changed behavior is covered by a unit test in the same PR
  • Every new test and every new --self-test case was run once with its subject broken, and the failure is reported here
  • The CHANGELOG entry above is complete, and docs/CHANGELOG.md is not in this diff.
  • The SemVer impact above is stated, and docs/SEMVER.md is not in this diff.

Notes for the reviewer

This is a drawing fix that ensures angular dimension arcs are rendered consistently with the measured angle value.

… Angular.value

DrawingAnnotation.swift: Angular.value uses acos(dot) which always
returns [0, π]. DrawingDispatch.swift: emitAngular used raw atan2
with ascending sort, allowing reflex arcs (> π). This made the drawn
arc and printed label describe different angles for the same ray pair.

Add a reflex-guard: when the sorted counter-clockwise sweep exceeds π,
recompute the shorter arc (≤ π) by swapping direction, so the drawn
sweep and the label value both describe the same non-reflex angle.

Fixes #1169.

Signed-off-by: SMKiloBOT <nimiriishaku@gmail.com>
Co-authored-by: elb <elb@users.noreply.github.com>
@kilo-code-bot

kilo-code-bot Bot commented Aug 27, 2026

Copy link
Copy Markdown
Contributor

Code Review Summary

Status: No Issues Found | Recommendation: Merge

Files Reviewed (1 file)
  • Sources/OCCTSwift/DrawingDispatch.swift

Reviewed by nemotron-3-ultra-550b-a55b:free · Input: 157.2K · Output: 2.4K · Cached: 108K

@gsdali

gsdali commented Aug 27, 2026

Copy link
Copy Markdown
Collaborator

Closing without merging: this is a byte-identical duplicate of the emitAngular fix already in #1195 (both diffs patch DrawingDispatch.swift's emitAngular identically). #1195 also carries the #1168 A4-margin fix and, as of this comment, the regression tests both were missing. Merging this too would be a no-op at best.

@gsdali

gsdali commented Aug 27, 2026

Copy link
Copy Markdown
Collaborator

Superseded by #1195, see the issue comment on #1169.

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.

Angular dimension: drawn arc sweep and printed label can describe different angles

2 participants