On Sun, May 15, 2022, 11:45 AM Undiscussed Horrific Abuse, One Victim of Many <gmkarl@gmail.com> wrote:
$ tput cup 2 2 | hd
00000000  1b 5b 33 3b 33 48                                 |.[3;3H|
00000006
$ tput cup 4 5 | hd
00000000  1b 5b 35 3b 36 48                                 |.[5;6H|
00000006

printf("\x1b\x5b%d;%dH", y, x);

#include <stdio.h>

typedef struct pt {
  int x;
  int y;
} pt;

void plot(int x, int y, char c)
{
  printf("\x1b\x5b%d;%dH%c", y, x, c);
}


pt pt1 = {20,10};
pt pt2 = {40,30};
pt pt3 = {0,30};


void line(pt a, pt b)
{
  pt change = {b.x - a.x, b.y - a.y};
  int ctx = change.x > 0 ? change.x : -change.x;
  int cty = change.y > 0 ? change.y : -change.y;
  int ct = ctx > cty ? ctx : cty;
  for (int t = 0; t <= ct; ++ t) {
    plot(a.x + change.x * t / ct, a.y + change.y * t / ct, '*');
  }
}

int main()
{
  line(pt1, pt2);
  line(pt2, pt3);
  line(pt3, pt1);
}