Skip to content

Instantly share code, notes, and snippets.

@tmpvar
tmpvar / .gitignore
Last active October 9, 2024 04:35
angelscript compiled with emscripten
build
bin
@tmpvar
tmpvar / evaluate-cpu.cpp
Created September 27, 2021 07:47
single threaded cpu based sdf -> octree evaluator
// a single threaded SDF->octree evaluator on the cpu.
#pragma CFLAGS=-I ../../include -march=native
#include <stdio.h>
#include <glm/glm.hpp>
#include <types.h>
using namespace glm;
@tmpvar
tmpvar / dda-cursor.h
Last active October 11, 2024 00:25
Branchless 3D DDA cursor
#include <glm/glm.hpp>
using namespace glm;
struct DDACursor {
vec3 mask;
vec3 mapPos;
vec3 rayStep;
vec3 rayDir;
vec3 rayPos;
vec3 sideDist;
@tmpvar
tmpvar / .gitignore
Created February 26, 2021 04:21
c bidirectional linkage (exe <-> dll)
build
@tmpvar
tmpvar / 2d-pbd.js
Last active September 16, 2019 04:02
2d-pbd experiment - run with budo
const ctx = require('fc')(render, 1)
const center = require('ctx-translate-center')
const {vec2, vec3, mat2, mat3 } = require('gl-matrix')
const renderGrid = require('ctx-render-grid-lines')
const segseg = require('segseg')
const ndarray = require('ndarray')
const raySlab = require('ray-aabb-slab')
const particles = []
const constraints = []
@tmpvar
tmpvar / keybase.md
Created September 19, 2017 14:59
keybase.md

Keybase proof

I hereby claim:

  • I am tmpvar on github.
  • I am tmpvar (https://keybase.io/tmpvar) on keybase.
  • I have a public key ASDnoLe66_72oRYokyihcVYh5fOCT6WzjzKDPNYZPT-QXQo

To claim this, I am signing this object:

@tmpvar
tmpvar / index.js
Last active May 20, 2016 17:20
requirebin sketch
var fc = require('fc')
var center = require('ctx-translate-center')
var grid = require('ctx-render-grid-lines')
var circle = require('ctx-circle')
var ndarray = require('ndarray')
var fillArray = require('ndarray-fill')
var marchingSquares = require('marching-squares')
var surfaceNets = require('surface-nets')
// where size is the bin size from 0..1
function createBinner(radius, width, height) {
@tmpvar
tmpvar / index.js
Created April 8, 2016 23:09
requirebin sketch
var fc = require('fc')
var center = require('ctx-translate-center')
var grid = require('ctx-render-grid-lines')
var circle = require('ctx-circle')
var ndarray = require('ndarray')
var fillArray = require('ndarray-fill')
// where size is the bin size from 0..1
function createBinner(radius, width, height) {
var cx = Math.ceil(width/radius)
@tmpvar
tmpvar / index.js
Last active April 3, 2016 01:08
requirebin sketch
var fc = require('fc');
var center = require('ctx-translate-center');
var poly = require('ctx-render-polyline');
var points = require('ctx-render-points');
var circle = require('ctx-circle');
var bounds2 = require('2d-bounds');
var gridlines = require('ctx-render-grid-lines');
var isect = require('robust-segment-intersect');
var createSDF = require('sdf-polygon-2d');
var area = require('2d-polygon-area');
@tmpvar
tmpvar / index.js
Created April 2, 2016 05:07
requirebin sketch
var toPoly = require('pslg-to-poly')
var points = [
// loop 1
[-115, 100],
[ 103, 100],
[ 107, 50],
[-100, -100],
// loop 2