Skip to content

draw constellation lines with braille characters#98

Open
rumly111 wants to merge 1 commit intoda-luce:mainfrom
rumly111:main
Open

draw constellation lines with braille characters#98
rumly111 wants to merge 1 commit intoda-luce:mainfrom
rumly111:main

Conversation

@rumly111
Copy link

Using braille characters we can basically split each terminal cell to 2x8 "subpixels", and use those "dots" to draw lines etc.

Added param --braille (--unicode is also needed), here is the result:
optimized

@rumly111
Copy link
Author

here is a better quality gif:
a2

@da-luce
Copy link
Owner

da-luce commented Mar 14, 2026

This looks great! Have only done a brief skim so far but in about two weeks I'll have some more free time and will work to get this in :)

}

#define MAX_COLS 1024
#define MAX_ROWS 1024
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just skimming, but on large terminals, would a buff overflow be possible here?

Since we're always rendering constant number of constellation lines each frame, it might be safer to dynamically allocate a buffer based on the current terminal size. Doing that each frame might be expensive but then again I'm not sure without bench marking

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

well that's what google gpt recommended me for safe big numbers :) Even with font size 10 px you need 10000x10000 display resolution, which is way above 4k monitors. dynamic allocation just complicates things.

.aspect_ratio = 0.0,
.quit_on_any = false,
.unicode = false,
.braille = false,
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thinking about how the flags will work here; technically enabling braille is displaying some unicode characters, which one might expect to find under the unicode flag.

I think a better solution for the future will be to have distinct flags for different element styles, e.g.:

  • Constellation style: ASCII, smooth, braille
  • Star style: ASCII, circle, braille

Seems out of scope for this PR, just noting to self.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

hmm, I just wanted something to work, so didn't bother with args logic. for example if I set --braille, it could automatically enables --unicode etc, but the user should think of it himself. anyway, your idea of having a separate "braille" rendering mode is not bad, and here is a library for C that works with "braille graphics" : https://github.com/Huulivoide/libdrawille . I looked at the bresenham line drawing algorithm there.

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.

2 participants