Skip to content

Instantly share code, notes, and snippets.

View Craigson's full-sized avatar

Craig Pickard Craigson

View GitHub Profile
@Craigson
Craigson / gist:66fd314b9bc25db11ed0
Created January 2, 2015 21:23
Cinder Baic Animation
#include "cinder/app/AppNative.h"
#include "cinder/gl/gl.h"
#include "cinder/Rand.h"
#define CIRCLE_COUNT 100;
using namespace ci;
using namespace ci::app;
using namespace std;
@Craigson
Craigson / gist:68cf4c528af54b3dd3ba
Created January 31, 2015 02:22
Perlin noise - 2D array of spheresGrid griddle; void setup() { size(800, 800, P3D); background(255); griddle = new Grid(4,40, 40, 700, 700); } void draw() { background(255); lights(); camera(); griddle.display(); griddle.update(); }
Grid griddle;
void setup() {
size(800, 800, P3D);
background(255);
griddle = new Grid(4,40, 40, 700, 700);
}
void draw() {
@Craigson
Craigson / Grid Balls
Created January 31, 2015 22:04
Grid Balls - a 2D array of spheres
Grid griddle; //declare the grid object
void setup() {
size(800, 800, P3D);
//initialise the grid object Grid(radius, rows, cols, width, height)
griddle = new Grid(3, 35, 35, 600, 600);
}
void draw() {
@Craigson
Craigson / Grid balls with GUI
Last active August 29, 2015 14:14
A 2D array of 3D spheres with a GUI for adjusting parameters
import controlP5.*;
//import processing.opengl.*;
import peasy.test.*;
import peasy.org.apache.commons.math.*;
import peasy.*;
import peasy.org.apache.commons.math.geometry.*;
ControlP5 cp5; //declare the controlp5 object
PeasyCam cam; //declare the peasy cam object
@Craigson
Craigson / drag patches
Created February 6, 2015 23:39
Multiple particles that experience a drag force when passing through "patches" with a higher density than the surrounding environment
Mover [] movers;
Patch [] patches;
float count = 0;
void setup() {
size(1200, 675);
movers = new Mover[150]; //create an array of movers
patches = new Patch[10]; //create an array of friction patches
for (int i = 0; i < movers.length; i++) {
movers[i] = new Mover();
@Craigson
Craigson / steering movers with repulsion
Created February 6, 2015 23:52
Movers with the ability to steer and a mutual repulsion force, traveling through regions in which a drag force is applied
Mover [] movers;
Patch [] patches;
float count = 0;
void setup() {
size(1200, 675);
movers = new Mover[150]; //create an array of movers
patches = new Patch[10]; //create an array of friction patches
for (int i = 0; i < movers.length; i++) {
movers[i] = new Mover();
@Craigson
Craigson / Flake
Created February 7, 2015 16:30
Snowflakes fall and experience a drag force when they pass over the background PImage
class Flake {
PVector loc, vel, acc; //create Pvectors for location, velocity and acceleration
float mass, radius, lifespan;
float x, xoff; //variables for perlin noise
boolean isTrapped = false; //boolean variable for determining whether the flake is over a letter
float c = 0.0001; //this is the drag co-efficient of the word
float theta, dTheta; //variables for rotating the polygon
Flake() {
@Craigson
Craigson / CracklePop Python
Last active August 29, 2015 14:15
Code snippet for HackerSchool application - Written in Python
#Written by Craig Pickard for HackerSchool Application for Summer Batch 1, 2015
#Language: Python
#This code prints out the integers 1-100 (inclusive), replacing every integer value that's divisible by 3 with the string #"Crackle", every integer that's divisible by 5 with the string "Pop", and every integer that's divisible by both 3 and 5 with
#the word "CracklePop".
snapList = []
for i in range (1,101):
if i % 3 == 0 and i % 5 == 0:
snapList.append("CracklePop")
@Craigson
Craigson / CracklePop Processing
Created February 10, 2015 22:39
Code snippet for HackerSchool application - Written in Processing
/*
Written by Craig Pickard for HackerSchool Application for Summer Batch 1, 2015
Language: Processing
This code prints out integers 1-100 (inclusive), replacing every integer value that's divisible by 3 with the string "Crackle",
every integer that's divisible by 5 with the word "Pop", and every integer that's divisible by both 3 and 5 with
the string "CracklePop".
*/
void setup() {
@Craigson
Craigson / CracklePop Javascript
Created February 10, 2015 22:40
Code snippet for HackerSchool application - Written in Javascript
/*
Written by Craig Pickard for HackerSchool Application for Summer Batch 1, 2015
Language: Javascript
This code prints out integers 1-100 (inclusive), replacing every integer value that's divisible by 3 with the string "Crackle",
every integer that's divisible by 5 with the word "Pop", and every integer that's divisible by both 3 and 5 with
the string "CracklePop".
*/
var snapList = [];