kd-tree building - check all axes for best split, add additional shape-bbox check
extent Container bounds by Eps to fix invisible triangles on borders
new Camera constructor with more intuitive lookat/up vectors
fix camera axes (mirrored images)
better camera angle-of-view
change capitalization of addShape and addLight
from math import *
def dot(a,b):
sum = 0
for i in range(min(len(a),len(b))):
sum += a[i]*b[i]
return sum
def cross(a,b):
return (
a[1]*b[2] - a[2]*b[1],
a[2]*b[0] - a[0]*b[2],
a[0]*b[1] - a[1]*b[0]
)
def unit(a):
m = mag(a)
return (a[0]/m, a[1]/m, a[2]/m)
def mag(a):
return sqrt(mag2(a))
def mag2(a):
return a[0]*a[0] + a[1]*a[1] + a[2]*a[2]