braille graphing utility: dots to cells

From: John Miller (jamiller@qualcomm.com)
Date: Fri Nov 11 1994 - 14:32:34 PST


Hello,
Here is a piece of C code that maps an array of 1's and 0's in graph to emboss
ready ASCII characters.
Storing computer code values for each cell is a straightforward step.
These values would reside in a 2-dimensional array referenced by Dr. Nemeth as
page and follow from assign_code's index value.

I provided code_table in order to illustrate dot combinations to ASCII character.
You will see the pattern Dr. Nemeth alludes to by sending it to a brasille
embosser.

The computer braille code table uses dots 1 through 6 only of 8 dot braille.
For refreshable braille, it would be useful to drive all 256
combinations of an 8 dot cell. The Braille Lite, for example, would be an
excellent demonstration device. Would one of you come forward with such a
table for the Braille Lite?

#define ROW_MAX 117
#define COL_MAX 90
#define CELL_ROW_MAX 37
#define CELL_COL_MAX 45
word graph[ROW_MAX][COL_MAX];
word page[CELL_ROW_MAX][CELL_COL_MAX];
void assign_code(word dot1, word dot2, word dot3, word dot4, word dot5, word dot6, char *code_ptr)
{ /* assign_code */
word index;
char code_table[LINE_MAX];
strcpy(code_table, " a1b'k2l`cif/msp\"e3h9o6r~djg>ntq,*5<-u8v.%{$+x!&;:4|0z7(_?w}#y)=" );
    index = (word) (dot1 + dot2 * (word) 2 + dot3 * (word) 4
        + dot4 * (word) 8 + dot5 * (word) 16 + dot6 * (word) 32);
    *code_ptr = code_table[index];
} /* assign_code */

void emboss_graph(FILE *out_file, word num_row, word num_col)
{ /* emboss_graph */
word row, col;
char code_char;
    for (row = 0; row < num_row-2; row +=3)
    { /* for row */
        for (col = 0; col < num_col-1; col += 2)
        { /* for col */
                assign_code(graph[row][col], graph[row+1][col], graph[row+2][col],
                graph[row][col+1], graph[row+1][col+1], graph[row+2][col+1], &code_char);
            fprintf(out_file, "%c", code_char);
        } /* for col */
        fprintf(out_file, "\n");
    } /* for row */
} /* emboss_graph */
------------------------------
John A. Miller bldg Q 264H
E-mail: jamiller@qualcomm.com
Phone: (619) 658-3876
------------------------------



This archive was generated by hypermail 2b29 : Sun Dec 02 2012 - 01:30:03 PST