Skip to content

Instantly share code, notes, and snippets.

import cv2
import numpy as np
import math
import pygame
zs=200
#sample = light()
def cp(p):
vec2 Rotate(in vec2 p, in float r) {
float c = cos(r), s = sin(r);
return p * mat2(c, -s, s, c);
}
// Hashes from "Hash without Sine" by Dave_Hoskins (https://www.shadertoy.com/view/4djSRW)
float Hash21(in vec2 p) {
vec3 p3 = fract(p.xyx * 0.1031);
p3 += dot(p3, p3.yzx + 33.33);
return fract((p3.x + p3.y) * p3.z);
@tigercoding56
tigercoding56 / XC_encode.py
Created January 27, 2024 21:13
encoder for utility i am making for O.RKS , optimised for encoding XC workouts
import time
def encode(hour,minute,second,distance):#hour from 0-9 distance meters
hour=min(max(0,hour),9)*10000
minute=min(max(0,minute),60)*100
second=min(max(0,second),60)
distance=max(min(1609.344*32,distance),0)
return chr(hour+minute+second)+chr(int(distance))+chr(int(time.localtime().tm_year))+chr(int(time.localtime().tm_yday))
def decode(s):
time=ord(s[0])
dist=ord(s[1])
@tigercoding56
tigercoding56 / rcrect.py
Last active January 26, 2024 02:29
pyglet rectangle with rounded corners
import pyglet
if __name__=='__main__':
window=pyglet.window.Window()
class rcrect:
def __init__(self,x,y,h,w,r,color=[255,255,255,255]):
self.pos=[x,y]
self.x=x
self.y=y
self.h=h
self.w=w
@tigercoding56
tigercoding56 / gist:4391935c64fae79f182e303e98c4a23b
Created August 11, 2023 04:14
lobster3d functions (credit to https://pypi.org/project/Lobster-3dEngine/#files i just added function for merging multiple objects)
from math import sin, cos, tan, sqrt, pi
class Object:
def __init__(self, position, vertices, faces, colors):
self.position = position
self.vertices = vertices
self.faces = faces
self.colors = colors