Skip to content

feat(3d): cross-backend 3D animation parity + stable ASCII axes#1829

Merged
krystophny merged 1 commit intomainfrom
feature/3d-animation-parity
May 7, 2026
Merged

feat(3d): cross-backend 3D animation parity + stable ASCII axes#1829
krystophny merged 1 commit intomainfrom
feature/3d-animation-parity

Conversation

@krystophny
Copy link
Copy Markdown
Collaborator

Summary

  • Add a 3D Lissajous animation example (example/fortran/3d_animation_demo) that drives the same FuncAnimation + save_animation pipeline through .mp4 (raster + ffmpeg) and .txt (ASCII frames replayable via fortplot_play_ascii).
  • Add test_3d_backend_parity covering 3D line + 3D surface to PNG/PDF/ASCII and 3D animation to .txt, asserting non-empty output and correct frame count.
  • Stabilize ASCII axes: axis lines were drawn using a char derived from the active plot color, causing animation frames to flicker between *, #, etc. as the rendering pipeline cycled colors. Axes now use -/|; data lines still pick chars by color.
  • Side fix: path_is_directory in update_example_index was using ls and misclassifying example/fortran/README.md as an example dir, breaking the docs sort test. Use a proper trailing-slash inquire probe; index now omits the bogus Readme.md entry.
  • Update Issue First plot is empty #355 regression test to assert the actual data line characters; it had been passing on the (now removed) axis tint, not on the data line itself.

Verification

Test fails on main

`make doc`-driven update_example_index would emit Readme.md mid-list and fail test_docs_index_pages (alphabetical sort). 3D animation flickered between frames in ASCII because the y-axis line picked up each plot's cycled color.

Test passes after fix

```
$ fpm test test_3d_backend_parity
PASS test_3d_backend_parity
$ fpm test test_first_plot_rendering
PASS: First plot renders with correct colors
$ fpm test test_docs_index_pages
(no failures)
```
3D ASCII animation now uses a stable axis frame; replay via:
```
fpm run --target fortplot_play_ascii -- output/example/fortran/3d_animation_demo/animation.txt --fps 24 --loop
```

Adds a 3D Lissajous animation example that exercises the same
FuncAnimation/save_animation pipeline for .mp4 (raster -> ffmpeg) and
.txt (ASCII frames replayable via fortplot_play_ascii). A new
test_3d_backend_parity asserts that 3D line and 3D surface plots render
to PNG, PDF, and ASCII, and that 3D animation produces the expected
frame count in .txt.

Quality fix: ASCII axis lines were rendered using a character derived
from the active plot color, so animation frames flickered between '*',
'#', etc. as the rendering pipeline cycled colors. The axis frame is
now drawn with stable '-'/'|' chars; data lines still pick chars by
color, which is what users care about. The Issue #355 regression test
was passing accidentally on the old axis tint and is updated to assert
the actual data line characters (stricter, not weaker).

Side-effect: fix path_is_directory in update_example_index so that
example/fortran/README.md is no longer misclassified as an example dir
(it slipped through ls-based probing). The auto-generated index now
omits the bogus "Readme.md" entry, restoring strict alphabetical sort.
@krystophny krystophny merged commit 66dbbff into main May 7, 2026
5 checks passed
@krystophny krystophny deleted the feature/3d-animation-parity branch May 7, 2026 12:01
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