Skip to content

Instantly share code, notes, and snippets.

View zahlenteufel's full-sized avatar

Gastón Bengolea Monzón zahlenteufel

View GitHub Profile
@zahlenteufel
zahlenteufel / KMP Drawer.md
Last active August 29, 2015 13:57
KMP Automaton Drawer with Graphviz

#KMP Drawer with Graphviz

Given a pattern string, it generates the Graphviz dot script to draw the implicit automaton that uses the KMP string matching algorithm.

To compile:

g++ -std=c++0x -Wall kmpdraw.cpp -o kmpdraw

Example:

@zahlenteufel
zahlenteufel / Lupa.m
Last active December 14, 2019 10:13
Magnifier Glass effect in MATLAB
original_image = imread('butterfly.jpg');
[n m c] = size(original_image);
assert(c == 3);
angles = linspace(0, 20 * pi, 1000);
for i=1:length(angles)
radius = 200;
c = 0.5 + sin(angles(i)) / 2;
[x y] = meshgrid(1:m, 1:n);
@zahlenteufel
zahlenteufel / Apollonius.java
Last active October 7, 2015 06:08
Cono de Apolonio
SpecialPlane horPlane = new SpecialPlane(0,0.2, new PVector(253, 184, 19));
SpecialPlane parPlane = new SpecialPlane(1, 0.5, new PVector(246, 139, 31));
SpecialPlane obPlane = new SpecialPlane(0.5, 0.3, new PVector(241, 112, 34));
VPlane vertPlane = new VPlane(-0.4, new PVector(238, 246, 108));
boolean[] visible = {true, true, true, true, true}; // which parts of the cone are visible
float rotY = 0, rotX = 0;
PVector[][] ps = generatePoints(100);
void setup() {