Skip to content

Instantly share code, notes, and snippets.

View Matthias1590's full-sized avatar

Matthias Matthias1590

  • The Netherlands
  • 12:23 (UTC +02:00)
View GitHub Profile
@Matthias1590
Matthias1590 / wireframe.py
Last active February 20, 2023 19:14
Code to render a wireframe, inspired by: https://www.youtube.com/watch?v=hFRlnNci3Rs
# Wireframe renderer by Matthias (https://github.com/Matthias1590)
# Inspired by Mattbatwings' 3D Renderer video (https://www.youtube.com/watch?v=hFRlnNci3Rs)
from lamp_display import LampDisplay # Install via `pip install lamp_display`, source code available at https://github.com/Matthias1590/LampDisplay
from bresenham import bresenham # Install via `pip install bresenham`, if you want to use another line drawing algorithm you can replace the draw_line function
from functools import cache # Builtin
import numpy as np # Install via `pip install numpy`
# Wireframe constants
@Matthias1590
Matthias1590 / lerp.py
Created February 3, 2022 10:52
Recursive Lerp Function
def lerp(points: List[Point], t: float) -> Point:
if len(points) == 2:
return (1 - t) * points[0] + t * points[1]
return lerp([lerp(points[:-1], t), lerp(points[1:], t)])
@Matthias1590
Matthias1590 / hello_world.py
Last active November 5, 2021 14:36
A simple hello world program written in python..
print(*[chr(0x48656c6c6f2c20776f726c6421>>i*8&255)for i in range(103//8+1)][::-1],sep="")