This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<html><head><title> 165888,79872 </title></head><body><table cellspacing="0" cellpadding="0"> | |
<tr> | |
<td><img src="http://imgs.xkcd.com/clickdrag/48n0e.png" alt=""/> | |
<td><img src="http://imgs.xkcd.com/clickdrag/48n1e.png" alt=""/> | |
<td><img src="http://imgs.xkcd.com/clickdrag/48n2e.png" alt=""/> | |
<td><img src="http://imgs.xkcd.com/clickdrag/48n3e.png" alt=""/> | |
<td><img src="http://imgs.xkcd.com/clickdrag/48n4e.png" alt=""/> | |
<td><img src="http://imgs.xkcd.com/clickdrag/48n5e.png" alt=""/> | |
<td><img src="http://imgs.xkcd.com/clickdrag/48n6e.png" alt=""/> | |
<td><img src="http://imgs.xkcd.com/clickdrag/48n7e.png" alt=""/> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from PIL import Image, ImageDraw, ImageSequence | |
from random import random as rnd | |
from math import sqrt | |
def vec3_scale(v,f): | |
return (v[0]*f,v[1]*f,v[2]*f) | |
def vec3_add(a,b): | |
return (a[0]+b[0],a[1]+b[1],a[2]+b[2]) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public final class IntrusiveList<T> { | |
/** private constructor used by makeList() */ | |
private IntrusiveList() { | |
t = null; // is null so we know this must be the head/tail | |
prev = next = this; // cyclic | |
} | |
/** returns a new head/tail pointer */ | |
public static <T> IntrusiveList<T> makeList() { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from PIL import Image, ImageDraw, ImageSequence | |
from random import random as rnd | |
from math import sqrt | |
def vec3_scale(v,f): | |
return (v[0]*f,v[1]*f,v[2]*f) | |
def vec3_add(a,b): | |
return (a[0]+b[0],a[1]+b[1],a[2]+b[2]) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import signal, time, traceback, threading | |
def start(interval=0.1): | |
global _interval, _samples | |
_samples = [] | |
signal.signal(signal.SIGALRM,_sample) | |
signal.setitimer(signal.ITIMER_REAL,interval,interval) | |
def stop(): | |
global _samples |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
digraph luffarschack { | |
node [shape=none]; | |
"baabb--ba-" [label=<<TABLE BORDER="1" BGCOLOR="white"> | |
<TR><TD BGCOLOR="red"></TD><TD BGCOLOR="red"></TD><TD BGCOLOR="blue"></TD></TR> | |
<TR><TD BGCOLOR="blue"></TD><TD BGCOLOR="white"></TD><TD BGCOLOR="white"></TD></TR> | |
<TR><TD BGCOLOR="blue"></TD><TD BGCOLOR="red"></TD><TD BGCOLOR="white"></TD></TR> | |
</TABLE>>]; | |
"baabb--ba-" -> "abbaa-a-b-"; | |
"baabb--ba-" -> "ab-aaba--b"; | |
"baabb--ba-" -> "abbaaba---"; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import sys | |
queue = ["a"+"-"*9] | |
boards = {queue[0]:set()} | |
ends = set() | |
next = {"a":"b","b":"a"} | |
def won(side,board): | |
line = side*3 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function Sphere(iterations) { | |
// returns an object with a 'draw' method | |
// we cache ready-built spheres | |
if(!Sphere.spheres) | |
Sphere.spheres = []; | |
if(iterations in Sphere.spheres) | |
return Sphere.spheres[iterations]; | |
// we have to create it... | |
var vertices = [], | |
vIndex = {}, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
The scene has a perspective projection. | |
I want to know if a fragment is inside the cone formed by the camera and a sphere. | |
sphereCentre is set by mvMatrix*vec3(0,0,0) and radius is 1; I am drawing a unit sphere. | |
The camera is at 0,0,0 in view space. | |
The fragment shader just passes the scene position to the fragment shader: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function emitCube(blf,trb,array,ofs) { | |
ofs = ofs || 0; | |
var left = blf[0], right = trb[0], | |
bottom = blf[1], top = trb[1], | |
front = blf[2], back = trb[2], | |
tlb = [left,top,back], | |
trf = [right,top,front], | |
tlf = [left,top,front], | |
brb = [right,bottom,back], | |
blb = [left,bottom,back], |