Skip to content

knightspore/go-experiments

Repository files navigation

🥽 Go Experiments

This is a repository to keep all of my Go experiments in one place. Especially when working through tutorials, the project can feel easy to discard yet often contains useful scaffolding or re-usable functions for later projects.

Feel free to clone, fork, or even contribute if you wish!

Bresenham's Line Algorithm Implemented in Go

An implementation of Bresenham's line algorithm written in go, based on the example described in the Wikipedia Entry.

In addition to the core line drawing functionality, this package also includes:

  • Methods for creating 2D and 3D coordinates in primitives.go
  • A method for transforming 3D coordinates into 2D (barely) in primitives.go
  • A method for creating polygons in polygon.go
  • Support for rendering polygons to the terminal using termbox-go
  • A method for loading .obj 3D model files into a Polygon (see example below)

Also provided is a method for loading a .obj 3d model file into a Polygon - an example of which is described below.

Examples

To run the example, clone the directory and run go mod tidy, and then go run .. This will run the example in main.go using termbox. This will render the 3d model of a rock in your terminal.

Improvements

Feel free to contribute if you would like to take a shot at improving upon, or adding to this little experiment.

Some Ideas:

  • Improve the 3d -> 2d co-ordinate function
  • Add support for different color models and color gradients to the rendered polygons
  • Look at memory handling to print more complex models
  • Add support for more advanced 3D file formats, such as STL or PLY\
  • Expand to include circles or ellipses with Bresenham's Algorithm

MIDI Experiments

Basic MIDI I/O in Golang using GoMidi. Parts extractable for re-use in other sound-based applications.

OpenGL Experiments

Experimenting further with graphics / rendering on a low level. Using Go-GL and lots of referencing Wikipedia and old websites documenting 2d / 3d game development principles.

Random Book

I have a long reading list and struggle to choose what to read next. This is a simple random book selector, inspired by this mob pairing randomizer.

Record Audio Parts (🚧 WIP)

Beginnings of an idea I had around a transcription program, which could be used to record talks, lectures, etc.

The idea is roughly as follows:

  • start recording
    • record 30s audio chunks
    • pass them into OpenAI Whisper to extract transcriptions
    • clean up transcriptions with the help of GPT-3 (maybe?)
  • end recording
    • join audio files into one recording
    • join subtitles generated by whisper
    • store audio + subtitles together for re-watching

About

Spikes, experiments, code snippets, etc. in Go

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published