feat(odf): read the enhanced geometry languages, formulas and path alike - #798
Merged
Conversation
andiwand
force-pushed
the
odf-drawings/shapes
branch
from
August 31, 2026 06:07
1a92fc7 to
3620672
Compare
andiwand
force-pushed
the
odf-drawings/enhanced-geometry
branch
from
August 31, 2026 06:07
19a4a54 to
004227b
Compare
andiwand
force-pushed
the
odf-drawings/shapes
branch
from
August 31, 2026 06:10
3620672 to
7b7778d
Compare
andiwand
force-pushed
the
odf-drawings/enhanced-geometry
branch
from
August 31, 2026 06:10
004227b to
a75a25e
Compare
andiwand
force-pushed
the
odf-drawings/shapes
branch
from
August 31, 2026 19:17
7b7778d to
c5ecb74
Compare
andiwand
force-pushed
the
odf-drawings/enhanced-geometry
branch
from
August 31, 2026 19:38
a75a25e to
16404bc
Compare
`draw:enhanced-geometry` is what makes a custom shape an arrow, a callout or a star, and it says so in two small languages: `draw:formula` (20.36) and `draw:enhanced-path` (19.145). Neither was read, so all 350 of them in the test corpus rendered as rectangles. `odf_enhanced_geometry.cpp` implements both as pure functions over strings — nothing is wired into the element model yet, that is the next change: - `evaluate_formula` is recursive descent over 20.36: `$N` modifiers, `?name` equation references resolved through a caller-supplied lookup, the named view-box values, and `abs sqrt sin cos tan atan min max atan2 if`. The trigonometric functions take radians; the corpus settles it by writing `sin(105*(pi/180))`. - `convert_enhanced_path` turns every command of 19.145 into an svg `d`. Two things worth knowing about the path conversion. An arc is emitted in segments of at most a half turn, which means the large-arc flag is never needed and `U 10800 10800 10800 10800 0 360` — a full turn, which a single svg `A` cannot express, and 116 of the corpus's commands — still draws. And `F` and `S` are read and dropped: painting one subpath with a different fill or stroke is more than one `d` can say. Tested from string literals; the geometry needs no fixture to exercise. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_017XABfEapaADjFQCt1vjmDF
andiwand
force-pushed
the
odf-drawings/enhanced-geometry
branch
from
August 31, 2026 19:41
16404bc to
e4f645c
Compare
This was referenced Aug 31, 2026
andiwand
added a commit
that referenced
this pull request
Aug 31, 2026
`PLAN.md` said to delete it once nothing was left under *Today*, and #771's four goals are on main: `draw:transform` (#796), the shape elements with no parser (#797), `draw:enhanced-geometry` (#798, #799) and the `draw:object` chart (#800). What remains of drawings is the unticked boxes in `README.md`; the two decisions the plan held that the checklist cannot express — preset `draw:type` shapes and connector routing — move to `AGENTS.md`. Co-authored-by: Claude Opus 5 (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.
🤖 Generated with Claude Code
Stage 3 of #771, on main now that #797 has landed.
draw:enhanced-geometryis what makes a custom shape an arrow, a callout or astar, and it says so in two small languages:
draw:formula(20.36) anddraw:enhanced-path(19.145). Neither was read, so all 350 of them in the testcorpus rendered as rectangles.
odf_enhanced_geometry.cppimplements both as pure functions over strings.Nothing is wired into the element model here — that is the next PR, which
keeps this one reviewable on its own and changes no output.
evaluate_formulais recursive descent over 20.36:$Nmodifiers,?nameequation references resolved through a caller-supplied lookup, the named
view-box values, and
abs sqrt sin cos tan atan min max atan2 if. Thetrigonometric functions take radians; the corpus settles it by writing
sin(105*(pi/180)).convert_enhanced_pathturns every command of 19.145 into an svgd.Both readers run off
odf_scanner.hpp, which isodf_geometry.cpp's scannerpromoted to a header now that it has a second user: a
std::string_viewcursorwhose reads are bounded by what remains, so no reader here holds a buffer or a
const char *. A comma is filler in a coordinate list and an argumentseparator in a formula, so
consumeskips only spaces.Two things worth knowing about the path conversion
large-arc flag is never needed and
U 10800 10800 10800 10800 0 360— a fullturn, which a single svg
Acannot express, and 116 of the corpus's commands— still draws.
FandSare read and dropped: painting one subpath with a different fillor stroke is more than one
dcan say.Verification
odf_enhanced_geometry_test.cpp, from string literals: the geometry needs nofixture to exercise. No rendered output changes, so no reference-output work
and no
CHANGELOG.mdentry — the next PR carries both.