Skip to content

Instantly share code, notes, and snippets.

@KdotJPG
KdotJPG / OpenSimplex2S.java
Last active June 19, 2024 15:44
Visually isotropic coherent noise algorithm based on alternate constructions of the A* lattice.
/**
* K.jpg's OpenSimplex 2, smooth variant ("SuperSimplex")
*
* More language ports, as well as legacy 2014 OpenSimplex, can be found here:
* https://github.com/KdotJPG/OpenSimplex2
*/
public class OpenSimplex2S {
private static final long PRIME_X = 0x5205402B9270C86FL;
@hideaki-t
hideaki-t / unzip.py
Created May 18, 2014 07:34
unzipping a zip file with non-utf8 encoding by Python3
import zipfile
import sys
from pathlib import Path
def unzip(f, encoding, v):
with zipfile.ZipFile(f) as z:
for i in z.namelist():
n = Path(i.encode('cp437').decode(encoding))
if v:
@filharvey
filharvey / DistanceFieldFont
Last active February 29, 2020 09:35
DistanceFieldFont is an extension for starling and FeathersUI to use Distance Field Fonts instead of normal Bitmap fonts. You can read more on Distance Field Fonts here: http://www.valvesoftware.com/publications/2007/SIGGRAPH2007_AlphaTestedMagnification.pdf https://code.google.com/p/libgdx/wiki/DistanceFieldFonts Currently there is no easy way …
package starling.extensions.DistanceFieldFont
{
import flash.geom.Rectangle;
import flash.utils.Dictionary;
import starling.display.Image;
import starling.text.BitmapChar;
import starling.textures.Texture;
import starling.textures.TextureSmoothing;
import starling.utils.HAlign;
@BonsaiDen
BonsaiDen / bezierCurve.js
Created November 10, 2010 02:24
Bezier Curve in JS, includes arc-length parameterization stuff
function Bezier(a, b, c, d) {
this.a = a;
this.b = b;
this.c = c;
this.d = d;
this.len = 100;
this.arcLengths = new Array(this.len + 1);
this.arcLengths[0] = 0;