예제 #1
0
 def __mouse2sphere(self, x, y):
     """
     private map mouse to ArcBall (sphere)
     """
     v = PVector()
     v.x = (x - self.center_x) / self.radius
     v.y = (y - self.center_y) / self.radius
     mag = v.x * v.x + v.y * v.y
     if mag > 1.0:
         v.normalize()
     else:
         v.z = sqrt(1.0 - mag)
     return v if (self.axis == -1) else (self.__constrain(v, self.axisSet[self.axis]))
예제 #2
0
 def __mouse2sphere(self, x, y):
     """
     private map mouse to ArcBall (sphere)
     """
     v = PVector()
     v.x = (x - self.center_x) / self.radius
     v.y = (y - self.center_y) / self.radius
     mag = v.x * v.x + v.y * v.y
     if (mag > 1.0):
         v.normalize()
     else:
         v.z = sqrt(1.0 - mag)
     if (self.axis != -1):
         v = self.__constrain(v, self.axis_set[self.axis])
     return v