Skip to content

Instantly share code, notes, and snippets.

@staltz
staltz / introrx.md
Last active May 6, 2024 01:44
The introduction to Reactive Programming you've been missing
@iluvcapra
iluvcapra / cycloid_gear.scad
Last active May 20, 2023 01:30
OpenSCAD cycloid gear
function epicycloid(t, rmaj, rmin) = [ (rmaj+rmin) * cos(t) - rmin * cos(((rmaj+rmin)/rmin)*t),
(rmaj+rmin) * sin(t) - rmin * sin(((rmaj+rmin)/rmin)*t) ];
function hypocycloid(t, rmaj, rmin) = [ (rmaj-rmin) * cos(t) + rmin * cos(((rmaj-rmin)/rmin)*t),
(rmaj-rmin) * sin(t) - rmin * sin(((rmaj-rmin)/rmin)*t) ];
module CycloidTooth(
rmaj = 30,
rmin = 20,
circ_pitch = 10.0,
@nervoussystem
nervoussystem / volume.js
Last active April 22, 2016 14:20
Calculate the volume of a mesh stored in a VBO-like structure (vertex data in an array and triangle data in another array). Uses gl-matrix
var volume = 0;
var v1 = vec3.create(),
v2 = vec3.create(),
v3 = vec3.create();
var i,index1,index2,index3;
for(i=0;i<numIndices;) {
index1 = indices[i++]*3;
index2 = indices[i++]*3;
index3 = indices[i++]*3;