Skip to content

trying to increase braille lines precision #103

@rumly111

Description

@rumly111

In the function render_constellation we convert (to int) and round the coordinates with polar_to_win, and later pass these coordinates to draw_line_braille. I think in the middle of it we lose some precision, so it would be better to make the function draw_line_braille use "braille" coordinates by default, not ncurses coordinates. So we can do something like this:

if (config->braille)
{
    int br_ya, br_xa, br_yb, br_xb;
    polar_to_win(radius_a, theta_a, height * 4, width * 2, &br_ya, &br_xa);
    polar_to_win(radius_b, theta_b, height * 4, width * 2, &br_yb, &br_xb);
    draw_line_braille(win, br_ya, br_xa, br_yb, br_xb);
}

And we can throw out a bunch of code from the function draw_line_braille :

void draw_line_braille(WINDOW *win, int ya, int xa, int yb, int xb)
{
    // ncurses coordinates
    int curs_xa = xa / 2;
    int curs_ya = ya / 4;

    int dx = abs(xb - xa);
    int dy = abs(yb - ya);

    // the rest of the function remains the same
}

I tried it, and I think the "braille lines" are drawn more smoothly, but the stars of the constellations "jump around" too much, and it doesn't look too good. I believe somewhere the ncurses (!) coordinates of the stars might be calculated incorrectly, or it's a rounding error or something. The math is a bit complicated for me, so @da-luce if you have time, you can check out this problem.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions