3 ms·
If you want to make your own, like Fabian Sanglard did, take this block of binary numbers and draw your initials (left-justified) with 1's: 00011100000100011
by chrissnell 13y ago
If you want to make your own, like Fabian Sanglard did, take this block of binary numbers and draw your initials (left-justified) with 1's:
0001110000010001110
0010000000000010000
0100000000010010000
0100000000010001100
0100000000010000100
0010000010010000010
0001110001100011100
That's my initials, cjs. If you unfocus your eyes, you can see the letters pretty clearly.
Take each line, top to bottom, and convert to decimal:
http://www.mathsisfun.com/binary-decimal-hexadecimal-converter.html http://www.mathsisfun.com/binary-decimal-hexadecimal-convert...
Edit Paul Heckbert's code (lines 12-13, the "G" array), replacing the numbers from right to left with the decimal values. In other words, the last number in the array is the top line of the binary block above.
Clean up the justification and you have your business card raytracer, courtesy of Mr. Heckbert.
I probably could have coded this in the time that it took me to draw my initials in binary pixels.
Also, here's a version with the camera moved slightly farther out so that the letters don't clip:
https://gist.github.com/chrissnell/6656963 https://gist.github.com/chrissnell/6656963
- logicallee 13y agothanks. what exactly were you referring to with "I probably could have coded this in the time that it took me to draw my initials in binary pixels."?
- chrissnell 13y agoI could have coded something to generate customized versions of the original source, given three ASCII initials.
- logicallee 13y agoCome on, Chris. I'm a big fan of the humblebrag, but you would still have to draw the binary pixel version of each letter (because C doesn't come with binary pixel array versions of the 26 letters) - so it would be 8 times as much work at an absolute minimum (26 characters versus the 3 that you did), even if the code to embed them in the array were a completely obvious 1-liner, and so was the code to clean up the justification. Let's not flatter ourselves :)
- chrissnell 13y agoDidn't mean to come off as arrogant but there are existing tools that would make this a lot easier. figlet(1) would make the pixel conversion pretty easy. Pixels to binary really isn't that hard. You could do it with a regex.
- derekp7 13y agoAnother way is to use the netpbm toolkit. First, use its ppmdraw command to rasterize each character to a canvas, then convert that canvas to xpm format (you have a separate canvas / picture for each character). The xpm format has the nice property that it is also a valid C structure. Real easy to then convert to whatever you want. Oh, and the netpbm toolkit has not only stand alone binaries, but it also has a C library for each of the conversions that it includes. Seems to be an older under-rated toolkit.
- skrebbel 13y agoRender a Small Fonts text to a text-based monochrome image format with e.g. Imagemagick, read file, and parse each line as binary. Reverse array and separate by commas.