Skip to content

Instantly share code, notes, and snippets.

@febret
Created March 19, 2016 22:31
Show Gist options
  • Save febret/00268110c50a879b445b to your computer and use it in GitHub Desktop.
Save febret/00268110c50a879b445b to your computer and use it in GitHub Desktop.
Stereo perception test
from cyclops import *
from random import *
from math import *
l = Light.create()
l.setPosition(0, 2, 0)
l.setAmbient(Color(0.5, 0.5, 0.5, 1))
s1 = SphereShape.create(0.5, 2)
s2 = SphereShape.create(0.5, 2)
seed(10)
colors = ['green', 'blue','yellow', 'red','silver']
def next():
shuffle(colors)
c1 = colors[0]
c2 = colors[1]
z1 = -uniform(5, 10)
z2 = z1 + uniform(2, 5) * choice([-1, 1])
s1.setPosition(-1, 1.5, z1)
s1.setEffect('colored -d ' + c1)
s2.setPosition(1, 1.5, z2)
s2.setEffect('colored -d ' + c2)
if(z1 > z2): print('[' + c1 + ']')
else: print('[' + c2 + ']')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment