View Single Post
  #7  
Old 05-13-2008, 12:47 AM
aznan aznan is offline
Member
 
Join Date: Apr 2008
Posts: 11
Dammit! Okay, one final question:
I run my cave, close it, and run it again several times in a row, not touching the code between the runs. Some runs the stereo projection is good, while on others the right and left image gets swapped. This swapping is no longer affected by things that steals CPU time, like before. It seems to occur completley at random. Here is the current code I'm using:

Code:
def updateView(self):		
	pos = ppt.getPosition()
	
	# vector from head's position to the table
	invec = origo - vec.vector(pos)
	invec = vec.normalize(invec)
	
	# z vector on the imaginary plane where invec is the y vector
	upvec = [invec.data[0],math.sqrt(1-invec.data[1]*invec.data[1]),invec.data[2]]
	upvec = vec.normalize(vec.vector(upvec))
	
	# x vector on the imaginary plane where invec is the y vector
	svec = vec.normalize(vec.cross(invec, upvec))
	
	# calculate the eyes' positions by moving them along the x vector
	lpos = move(pos, svec, self.IPD/2)
	rpos = move(pos, svec, -self.IPD/2)
	
	# update viewing positions
	self.cave.update(leftPos=lpos, rightPos=rpos)
	viz.MainView.translate(pos)

def move(point, vector, distance):
	data = []
	for i in range(3):
		data.append(point[i] + vector[i]*distance)
	return data

vizact.ontimer(0,view.updateView)
Do you have any idea what might be causing this?
Reply With Quote