An open API service indexing awesome lists of open source software.

https://github.com/patsie75/awk-3d

Draw 3D objects on your terminal with awk
https://github.com/patsie75/awk-3d

Last synced: 7 months ago
JSON representation

Draw 3D objects on your terminal with awk

Awesome Lists containing this project

README

          

A new project I got into after a colleague challenged me to 'draw more graphs' in my awk one-liners


Well, not really a graph, but it did sattisfy him to see some 3D models bouncing around a terminal.


It can draw 3D models in your terminal, using a model file in the 'models' folder.

A model file understands four types of lines:

- var <key> <value>
- col <red>;<green>;&ltblue&gt
- vert <x-coord> <y-coord> <z-coord>
- tri <vertex1> <vertex2> <vertex3> [<color>]

The 'var' keyword sets a value to a variable (key). This variable can then be used in the 'vert' and 'edge' definitions


The 'col' keyword defines a 'color' the red, green and blue values range from 0 to 255


The 'vert' keyword defines a 'vertex' (a point in 3D space) with an X, a Y and a Z coordinate


The 'tri' keyword connects three vertices into a triangle (in a certain color)


This is a first attempt to draw things in 3D space, so I hope to spend some more time refining everything


Here's a screenshot:

![](https://raw.githubusercontent.com/patsie75/awk-3d/master/icosahedron.png)

See youtube for a moving example: https://youtu.be/snj8Nl8pC6E or https://youtu.be/cNM4f10IZWQ