Skip to content

Instantly share code, notes, and snippets.

@tsulej
tsulej / font2vertex.pde
Last active May 6, 2016 08:16
Create vertex shape from bitmap fonts
// create vertex glyphs from fonts
final static int stepsize = 10; // less - more accuracy
final static int beams = 20; // more - more accuracy
final static int NONE = -1;
final static int shape_type = NONE; // or any shape type used in beginShape() function
final static boolean curve = true; // only with shape NONE
HashMap<String, ArrayList<PVector>> letters = new HashMap<String, ArrayList<PVector>>();
// draw by stripes
// http://generateme.tumblr.com
PImage img;
// decay length each iteration
final static float decay_ratio = 0.99;
// initial length of stripe, used also a time
float len = 50;
// final length
@tsulej
tsulej / collatzviz.pde
Created May 19, 2016 21:12
Collatz conjecture vizualization
// collatz conjecture visualization
// generateme.tumblr.com
void setup() {
size(2048, 500);
background(20);
stroke(220, 100);
strokeWeight(0.6);
smooth(8);
}
@tsulej
tsulej / simplestsort.pde
Created June 14, 2016 17:13
Simplest pixel sort for processing 2.x
void setup() {
PImage img = loadImage("ares.jpg");
size(img.width,img.height);
image(img,0,0); // display pixels
loadPixels(); // create pixels array
int[] temp = new int[height]; // buffer for the line pixels
for(int y=0;y<height;y++) { // for each line
int pos = y*width; // where is my position in pixels
@tsulej
tsulej / random.clj
Last active June 15, 2016 21:03
Wrapper for RNGs from Apache Math
(ns g2d.utils.random
(:import [org.apache.commons.math3.random RandomGenerator ISAACRandom JDKRandomGenerator MersenneTwister
Well512a Well1024a Well19937a Well19937c Well44497a Well44497b]))
(set! *warn-on-reflection* true)
(defmacro next-random-value-fn
"generate function for next random value (long, int, double, gaussian) with scale and shift"
[func int?]
(let [r (vary-meta (gensym "r") assoc :tag 'RandomGenerator)
@tsulej
tsulej / caustics.pde
Created June 22, 2016 22:19
Caustics
// see: https://github.com/hamoid/Fun-Programming/blob/master/processing/ideas/2016/02/caustic/caustic.pde
void setup() {
size(1000,1000);
smooth(3);
background(240);
fill(10,20,30,10);
noStroke();
frameRate(1000);
}
PGraphics g ;
void setup() {
size(500,500);
smooth(8);
noStroke();
fill(0);
g = createGraphics(270,270);
g.beginDraw();
g.background(255);
// The Object 2
//
// GenerateMe submission to MCCC Sep 2016
// generateme.blog@gmail.com
// http://generateme.tumblr.com/
// http://folds2d.tumblr.com/
LowpassFilter lpf1, lpf2, lpf3;
@tsulej
tsulej / ball3d.pde
Created October 11, 2016 11:15
draw noisy ribbon on sphere - 3d study
// http://generateme.tumblr.com
final static int off = 1000; // set between 0 to 4500 to see related timeframes
final static boolean doblur = false ;
final static float ystep = TWO_PI/700.0;
final static float xstep = TWO_PI/500.0;
void setup() {
size(800,800,P3D);
smooth(8);
@tsulej
tsulej / createIndexFiles.sh
Last active November 14, 2016 22:51
Bash scripts for preparing images for deep neural network training
#!/bin/bash
# script creates train.txt and val.txt prepared by processImages.sh script
# it assumes that all images are processed and there are 10 images minimum in each category
results_folder="images"
rm train.txt
rm val.txt