Skip to content

Instantly share code, notes, and snippets.

View jesstelford's full-sized avatar

Jess Telford jesstelford

View GitHub Profile
@jesstelford
jesstelford / gist:7829992
Last active December 30, 2015 12:39
A mirror of my post about efficient EPA collision detection

Original Post

G'Day all,

I'm at that stage in my physics engine where I need to get the Penetration Depth of two colliding polyhedra. So, I've written a GJK implementation based on Casey's geometric simplification (along with suggestions from Rory, etc, in this thread)

Now, I am using Jay's method of finding the penetration depth along the relative motion vector (as described here and here), but this fails when there is no relative velocity between the bodies. So, I am falling back on EPA.

@jesstelford
jesstelford / pr-compare.sh
Last active December 5, 2022 10:46
List the Pull Requests which have been merged into one branch but not another. Execute this from within a git directory that has it's `origin` remote set to github.
#!/bin/sh
if (( $# < 2 )) || (( $# > 3 ))
then
echo "$0 <are-in-this-branch> <are-not-in-this-branch> [<url-of-repo>]"
exit 1
fi
URLPREFIX=
if (( $# == 3 ))
then
URLPREFIX=$(echo "$3/pull/" | sed -e 's/[\/&]/\\&/g')
@jesstelford
jesstelford / index.html
Created September 24, 2013 16:00
Getting `Cannot read property '_thoraxBind' of undefined` errors in Thorax 2.0.1
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<title></title>
<script src="http://code.jquery.com/jquery-1.10.1.min.js"></script>
<script src="http://cdnjs.cloudflare.com/ajax/libs/handlebars.js/1.0.0/handlebars.min.js"></script>
<script src="http://cdnjs.cloudflare.com/ajax/libs/underscore.js/1.5.2/underscore-min.js"></script>
<script src="http://cdnjs.cloudflare.com/ajax/libs/backbone.js/1.0.0/backbone-min.js"></script>
--langdef=coffee
--langmap=coffee:.coffee
--regex-coffee=/(^|=[ \t])*class ([A-Za-z_][A-Za-z0-9_]+\.)*([A-Za-z_][A-Za-z0-9_]+)( extends ([A-Za-z][A-Za-z0-9_.]*)+)?$/\3/c,class/
--regex-coffee=/^[ \t]*(module\.)?(exports\.)?@?(([A-Za-z][A-Za-z0-9_.]*)+):.*[-=]>.*$/\3/m,method/
--regex-coffee=/^[ \t]*(module\.)?(exports\.)?(([A-Za-z][A-Za-z0-9_.]*)+)[ \t]*=.*[-=]>.*$/\3/f,function/
--regex-coffee=/^[ \t]*(([A-Za-z][A-Za-z0-9_.]*)+)[ \t]*=[^->\n]*$/\1/v,variable/
--regex-coffee=/^[ \t]*@(([A-Za-z][A-Za-z0-9_.]*)+)[ \t]*=[^->\n]*$/\1/f,field/
--regex-coffee=/^[ \t]*@(([A-Za-z][A-Za-z0-9_.]*)+):[^->\n]*$/\1/f,static field/
--regex-coffee=/^[ \t]*(([A-Za-z][A-Za-z0-9_.]*)+):[^->\n]*$/\1/f,field/
--regex-coffee=/((constructor|initialize):[ \t]*\()@(([A-Za-z][A-Za-z0-9_.]*)+)([ \t]*=[ \t]*[^,)]+)?/\3/f,field/
console.log('Before custom event handler');
$(document).on('customEvent', function(){
console.log('customEvent Caught');
});
console.log('Before custom event handler');
$('button').on('customEvent', function(){
console.log('customEvent Caught');
});
@jesstelford
jesstelford / jquery.textfill.js
Created February 1, 2012 00:57
jQuery Plugin to resize text to fit container
(function($) {
$.fn.textfill = function(maxFontSizePx, minFontSizePx, element) {
maxFontSizePx = parseInt(maxFontSizePx, 10);
minFontSizePx = parseInt(minFontSizePx, 10);
if (maxFontSizePx > 0 && minFontSizePx > maxFontSizePx) {
minFontSizePx = maxFontSizePx;
}
element = typeof(element) == "string" ? element : "span";
return this.each(function(){
var ourText = $(element, this),