Skip to content

Instantly share code, notes, and snippets.

View fogleman's full-sized avatar

Michael Fogleman fogleman

View GitHub Profile
@fogleman
fogleman / orient.go
Created February 2, 2018 16:13
Model Orientation
package main
import (
"fmt"
"math"
"os"
"time"
"github.com/fogleman/fauxgl"
embree "github.com/fogleman/go-embree"
@fogleman
fogleman / astar.py
Created December 3, 2017 04:31
A* Search in Python
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 November 28, 2017 21:51
AxiDraw + OpenStreetMap
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 02:39
Google Autocomplete Apps
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
@fogleman
fogleman / index.html
Last active March 20, 2017 13:34
Drawing a Butterfly (Motion Planning Algorithm)
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<style>body {padding: 0; margin: 0; overflow: hidden;}</style>
</head>
<body>
<script src="https://cdnjs.cloudflare.com/ajax/libs/p5.js/0.5.5/p5.min.js"></script>
<script src="pieces.js"></script>
@fogleman
fogleman / index.html
Last active January 4, 2017 22:10
Constant Jerk Motion Planning
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<style>body {padding: 0; margin: 0; overflow: hidden;}</style>
</head>
<body>
<script src="https://cdnjs.cloudflare.com/ajax/libs/p5.js/0.5.5/p5.min.js"></script>
<script src="pieces.js"></script>
@fogleman
fogleman / index.html
Last active January 3, 2017 22:12
Constant Acceleration Motion Planning
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<style>body {padding: 0; margin: 0; overflow: hidden;}</style>
</head>
<body>
<script src="https://cdnjs.cloudflare.com/ajax/libs/p5.js/0.5.5/p5.min.js"></script>
<script src="pieces.js"></script>
from __future__ import division
def meet(x, vi, vf, a):
x1 = (2 * a * x + vi * vi - vf * vf) / (4 * a)
x2 = x - x1
v = (vi * vi + 2 * a * x1) ** 0.5
t1 = (v - vi) / a
t2 = (vf - v) / -a
cx1 = vi * t1 + 0.5 * a * t1 * t1
cx2 = v * t2 + 0.5 * -a * t2 * t2
@fogleman
fogleman / index.html
Created January 1, 2017 03:55
Position, Velocity, Acceleration, Jerk
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<style>body {padding: 0; margin: 0; overflow: hidden;}</style>
</head>
<body>
<script src="https://cdnjs.cloudflare.com/ajax/libs/dat-gui/0.6.2/dat.gui.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/p5.js/0.5.5/p5.min.js"></script>
@fogleman
fogleman / README.md
Last active December 8, 2018 09:32
Roulette (curve)

In the differential geometry of curves, a roulette is a kind of curve, generalizing cycloids, epicycloids, hypocycloids, trochoids, and involutes.

This p5.js sketch implements hypotrochoid and epicycloid roulettes.