Пример #1
0
 def rotate(self, angle, axis=OUT, **kwargs):
     rot_matrix = rotation_matrix(angle, axis)
     self.apply_points_function_about_point(
         lambda points: np.dot(points, rot_matrix.T),
         **kwargs
     )
     return self
Пример #2
0
 def path(start_points, end_points, alpha):
     vects = end_points - start_points
     centers = start_points + 0.5 * vects
     if arc_angle != np.pi:
         centers += np.cross(unit_axis, vects / 2.0) / np.tan(arc_angle / 2)
     rot_matrix = rotation_matrix(alpha * arc_angle, unit_axis)
     return centers + np.dot(start_points - centers, rot_matrix.T)
Пример #3
0
 def rotate(self, angle, axis=OUT, **kwargs):
     rot_matrix = rotation_matrix(angle, axis)
     self.apply_points_function_about_point(
         lambda points: np.dot(points, rot_matrix.T),
         **kwargs
     )
     return self
Пример #4
0
 def rotate(self, angle, axis=OUT, **kwargs):
     """
     Rotate the Mobject, by default about its center
     """
     rot_matrix = rotation_matrix(angle, axis)
     self.apply_points_function_about_point(
         lambda points: np.dot(points, rot_matrix.T),
         **kwargs
     )
     return self
Пример #5
0
 def generate_rotation_matrix(self):
     phi = self.get_phi()
     theta = self.get_theta()
     gamma = self.get_gamma()
     matrices = [
         rotation_about_z(-theta - 90 * DEGREES),
         rotation_matrix(-phi, RIGHT),
         rotation_about_z(gamma),
     ]
     result = np.identity(3)
     for matrix in matrices:
         result = np.dot(matrix, result)
     return result
Пример #6
0
def rotate(points, angle=np.pi, axis=OUT):
    if axis is None:
        return points
    matrix = rotation_matrix(angle, axis)
    points = np.dot(points, np.transpose(matrix))
    return points
Пример #7
0
 def get_view_transformation_matrix(self):
     return (self.default_distance / self.get_distance()) * np.dot(
         rotation_matrix(self.get_phi(), LEFT),
         rotation_about_z(-self.get_theta() - np.pi / 2),
     )
Пример #8
0
def rotate(points, angle=np.pi, axis=OUT):
    if axis is None:
        return points
    matrix = rotation_matrix(angle, axis)
    points = np.dot(points, np.transpose(matrix))
    return points