예제 #1
0
	def update_slider(self, s, mode):
		newpos={}
		#relative mode, add the new slider movement to the old slider position
		if mode=='rel':
			for axis in self.axes:
				newpos[axis]+=s[axis]+self.tpos[axis]

		#absolute mode, set the new slider position to whatever we got sent in s
		elif mode=='abs':
			for axis in self.axes:
				newpos[axis]=s[axis]
		
		else:
			print("valid modes for update_slider are 'rel' and 'abs'")

		res = geo.get_sphere_intersect(self.pos_to_vect('a',s['a']),self.pos_to_vect('b',s['b']),self.pos_to_vect('c',s['c']),self.armlen['a'],self.armlen['b'],self.armlen['c'])
		
		#if the move is actually valid, update the "official" slider positions
		if (res is not False):
			self.endpoint.pos = res[0]

			for axis in self.axes:
				self.tpos[axis]=s[axis]
				self.arm[axis].pos=self.pos_to_vect(axis,s[axis])
				self.arm[axis].axis=res[0]-self.arm[axis].pos

		else:
			print("the position you want to move to is not reachable.  holding still")
예제 #2
0
	def endpoint_setup(self, rad):
		endpointpos = geo.get_sphere_intersect(self.vect_to_slider('a'), self.vect_to_slider('b'), self.vect_to_slider('c'),self.armlen['a'],self.armlen['b'],self.armlen['c'])
		self.endpoint = sphere (pos=endpointpos[0], radius = rad*.05, make_trail = False , retain = 2000)