Skip to content

Instantly share code, notes, and snippets.

View johnniehard's full-sized avatar
🚀
Making it happen!

Johnnie Hård johnniehard

🚀
Making it happen!
View GitHub Profile
@johnniehard
johnniehard / ellipsoid.py
Created January 21, 2017 08:49
Transforming geodesic latitude, longitude coordinates to geocentric X, Y, Z coordinates and back again.
'''
Define an ellipsoid by its semi major axis (a) and flattening (f).
The definition of the ellipsoid is then saved in the instance object and the functions can be called with just the coordinates to be transformed.
'''
from math import *
class Ellipsoid:
def __init__(self, a, f):
self.a = a
# -*- coding: utf-8 -*-
## python 2.7
from math import *
while True:
try:
#n = '6103213499'
n = raw_input(u"Ange ett personnumer: ")
@johnniehard
johnniehard / datestamp.pde
Created October 19, 2015 10:56
For date stamping saved frames
void startRecording()
{
String folder = year() +""+ month() +""+ day() +""+ hour() +""+ minute();
record = true;
}
void record()
{
if(record) saveFrame(folder +"/"+ year() +""+ month() +""+ day() +""+ hour() +""+ minute() +""+ second() +""+ millis() +".png");
}
@johnniehard
johnniehard / image shuffler
Created November 6, 2014 13:43
Take parts of an image and shuffle them around
//ta delar ur en bild och shuffla runt dem
int col = 4; //even numbers
int row = 2;
int w;
int h;
PImage img;
PImage[] delar = new PImage[col*row];
@johnniehard
johnniehard / movers over image
Created October 19, 2014 09:55
Moving points that slow down on darker areas of an image.
PImage src;
Mover[] movers = new Mover[10000];
void setup(){
src = loadImage("YOUR_IMAGE.JPG");
src.resize(src.width/4, src.height/4);
size(src.width, src.height);
for(int i = 0; i < movers.length; i++){
movers[i] = new Mover(src, new PVector(random(width), random(height)));