Skip to content

Instantly share code, notes, and snippets.

Michael Fogleman fogleman

Block or report user

Report or block fogleman

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@fogleman
fogleman / main.cpp
Last active Jul 13, 2019
Gray-Scott Reaction-Diffusion with OpenCL
View main.cpp
#define CL_SILENCE_DEPRECATION
// #if defined(__APPLE__) || defined(__MACOSX)
// #include <OpenCL/cl.hpp>
// #else
// #include <CL/cl.hpp>
// #endif
#include "cl.hpp"
View warp.py
import cairocffi as cairo
import numpy as np
import random
def random_coefs(order, sigma):
return [random.gauss(0, sigma) for _ in range(order)]
def random_transform():
y_dx = random_coefs(5, 0.3)
y_dy = random_coefs(5, 0.3)
@fogleman
fogleman / heightmap2stl.py
Created Aug 22, 2018
Heightmap to 3D Mesh
View heightmap2stl.py
from PIL import Image
from pyhull.delaunay import DelaunayTri
from shapely import geometry
from skimage import measure
from scipy import interpolate
import math
import numpy as np
import struct
import sys
@fogleman
fogleman / floats.c
Created Jul 30, 2018
How many floats between -1 and 1?
View floats.c
#include <stdint.h>
#include <stdio.h>
typedef union {
uint32_t a;
float b;
} float_or_int;
int main() {
float_or_int u;
View complex.go
package main
import (
"image"
"image/color"
"math"
"math/cmplx"
"github.com/fogleman/fauxgl"
"github.com/fogleman/gg"
@fogleman
fogleman / isoline.go
Created Feb 16, 2018
Heightmap to Isolines
View isoline.go
package main
import (
"fmt"
"image"
"image/draw"
"image/png"
"math"
"os"
@fogleman
fogleman / orient.go
Created Feb 2, 2018
Model Orientation
View orient.go
package main
import (
"fmt"
"math"
"os"
"time"
"github.com/fogleman/fauxgl"
embree "github.com/fogleman/go-embree"
@fogleman
fogleman / astar.py
Created Dec 3, 2017
A* Search in Python
View astar.py
import heapq
def estimated_distance(node, target):
x1, y1 = node
x2, y2 = target
dx, dy = abs(x1 - x2), abs(y1 - y2)
dist = dx + dy
return dist
def shortest_path(graph, source, target, heuristic_func=None):
@fogleman
fogleman / osm.py
Created Nov 28, 2017
AxiDraw + OpenStreetMap
View osm.py
from imposm.parser import OSMParser
from shapely import geometry, ops
import axi
import math
import sys
# put your lat/lng here
LAT, LNG = 0, 0
@fogleman
fogleman / apps.txt
Created May 4, 2017
Google Autocomplete Apps
View apps.txt
app that ages you
app that answers questions
app that adds music to videos
app that automatically saves money
app that adds text to pictures
app that allows you to write on pdf
app that asks you questions
app that answers math word problems
app that allows you to use school wifi
app that allows you to draw on photos
You can’t perform that action at this time.