Skip to content

Instantly share code, notes, and snippets.

View fogleman's full-sized avatar

Michael Fogleman fogleman

View GitHub Profile
@fogleman
fogleman / spatialhash.go
Created December 20, 2016 19:19
Simple Spatial Hash in Go
package path
type SpatialHash struct {
CellSize float64
Cells map[SpatialHashKey][]interface{}
}
type SpatialHashKey struct {
X, Y int
}
@fogleman
fogleman / index.html
Created December 21, 2016 03:43
Random Walkers
<!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;}</style>
</head>
<body>
<script src="https://cdnjs.cloudflare.com/ajax/libs/p5.js/0.5.5/p5.min.js"></script>
<script>
@fogleman
fogleman / index.html
Created December 21, 2016 21:10
Plotting
<!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="https://www.michaelfogleman.com/static/tree-paths.js"></script>
@fogleman
fogleman / index.html
Created December 21, 2016 22:06
Virtual Plotter
<!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="paths.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.

@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>
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
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>
@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 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>