Skip to content

Instantly share code, notes, and snippets.


Alexander Milevski w8r

View GitHub Profile
The MIT License (MIT)
Copyright (c) 2018 Ricky Reusser
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
View Cubic Catmull-Rom curve segment length approximation
// CatmullRomLength()
template <typename T>
T CatmullRomLength( const CVector2<T> &p0,
const CVector2<T> &p1,
const CVector2<T> &p2,
const CVector2<T> &p3,
petrsm / gist:d47be1fbd0f240b5051bdc81cb62f79e
Created Nov 22, 2017
2D point projection onto cubic (Catmull-Rom) curve
View gist:d47be1fbd0f240b5051bdc81cb62f79e
// CatmullRomCurveProjectPt()
template <typename T>
T CatmullRomCurveProjectPt( const CVector2<T> &p0,
const CVector2<T> &p1,
const CVector2<T> &p2,
const CVector2<T> &p3,
grahamboree / Quadtree.cs
Created Nov 15, 2017
Generic Loose Quadtree for Unity
View Quadtree.cs
using System.Collections.Generic;
using UnityEngine;
public interface QuadtreeItem {
Rect GetBounds();
public class QuadtreeNode<T> where T : QuadtreeItem {
const int MAX_DEPTH = 10;
bberak / Bunny.js
Created Oct 18, 2017
How to use regl in React or React Native
View Bunny.js
import React, { PureComponent } from "react";
import { StyleSheet } from "react-native";
import ReglView from "./ReglView";
import mat4 from "gl-mat4";
import bunny from "bunny";
export default class Bunny extends PureComponent {
drawCommand = regl => {
return regl({
vert: `
maxogden / bibtex.png
Last active Jul 31, 2020
How to make a scientific looking PDF from markdown (with bibliography)
rpgove / .block
Last active Jul 2, 2018
Force-directed layout
View .block
license: gpl-3.0
height: 600
armollica / .DS_Store
Last active Jul 16, 2018
World Tour along Flying Arcs
veltman /
Last active Nov 25, 2019
Smoother polygon transitions

Smooth transitioning US tour in the same vein as this example. Steps:

  1. Compares both shapes and adds evenly-spaced points to whichever polygon has fewer so that both have the same number of points
  2. Picks the winding of the first polygon that minimizes the sum of the squared distances between point pairs

Some possible improvements:

  • Adding additional points to both shapes first such that every segment longer than a certain distance is bisected
  • Tweaking the placement of added points with simulated annealing
  • Using a cost function that factors in self-intersections at the halfway mark in addition to distance traveled
marcin-chwedczuk / btree.js
Created May 30, 2016
BTree implementation in JavaScript
View btree.js
#!/usr/bin/env node
const NKEYS = 4;
function arrayOfSize(size) {
var a = Array(size);
for (var i = 0; i < size; i += 1)
a[i] = null;
You can’t perform that action at this time.