How to use the manimlib.utils.space_ops.angle_of_vector function in manimlib

To help you get started, we’ve selected a few manimlib examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github 3b1b / manim / manimlib / mobject / geometry.py View on Github external
def get_angle(self):
        return angle_of_vector(self.get_vector())
github 3b1b / manim / manimlib / scene / vector_space_scene.py View on Github external
def apply_transposed_matrix(self, transposed_matrix, **kwargs):
        func = self.get_transposed_matrix_transformation(transposed_matrix)
        if "path_arc" not in kwargs:
            net_rotation = np.mean([
                angle_of_vector(func(RIGHT)),
                angle_of_vector(func(UP)) - np.pi / 2
            ])
            kwargs["path_arc"] = net_rotation
        self.apply_function(func, **kwargs)
github 3b1b / manim / manimlib / mobject / geometry.py View on Github external
def stop_angle(self):
        return angle_of_vector(
            self.points[-1] - self.get_arc_center()
        ) % TAU
github 3b1b / manim / manimlib / scene / graph_scene.py View on Github external
def angle_of_tangent(self, x, graph, dx=0.01):
        vect = self.input_to_graph_point(
            x + dx, graph) - self.input_to_graph_point(x, graph)
        return angle_of_vector(vect)
github 3b1b / manim / manimlib / mobject / geometry.py View on Github external
def point_at_angle(self, angle):
        start_angle = angle_of_vector(
            self.points[0] - self.get_center()
        )
        return self.point_from_proportion(
            (angle - start_angle) / TAU
        )
github 3b1b / manim / manimlib / mobject / geometry.py View on Github external
def get_angle(self):
        return angle_of_vector(self.get_vector())
github 3b1b / manim / manimlib / mobject / mobject.py View on Github external
def put_start_and_end_on(self, start, end):
        curr_start, curr_end = self.get_start_and_end()
        curr_vect = curr_end - curr_start
        if np.all(curr_vect == 0):
            raise Exception("Cannot position endpoints of closed loop")
        target_vect = end - start
        self.scale(
            get_norm(target_vect) / get_norm(curr_vect),
            about_point=curr_start,
        )
        self.rotate(
            angle_of_vector(target_vect) -
            angle_of_vector(curr_vect),
            about_point=curr_start
        )
        self.shift(start - curr_start)
        return self
github 3b1b / manim / manimlib / scene / vector_space_scene.py View on Github external
def apply_transposed_matrix(self, transposed_matrix, **kwargs):
        func = self.get_transposed_matrix_transformation(transposed_matrix)
        if "path_arc" not in kwargs:
            net_rotation = np.mean([
                angle_of_vector(func(RIGHT)),
                angle_of_vector(func(UP)) - np.pi / 2
            ])
            kwargs["path_arc"] = net_rotation
        self.apply_function(func, **kwargs)
github 3b1b / manim / manimlib / mobject / geometry.py View on Github external
def position_tip(self, tip, at_start=False):
        # Last two control points, defining both
        # the end, and the tangency direction
        if at_start:
            anchor = self.get_start()
            handle = self.get_first_handle()
        else:
            handle = self.get_last_handle()
            anchor = self.get_end()
        tip.rotate(
            angle_of_vector(handle - anchor) -
            PI - tip.get_angle()
        )
        tip.shift(anchor - tip.get_tip_point())
        return tip
github 3b1b / manim / manimlib / mobject / svg / drawings.py View on Github external
def get_needle_angle(self):
        return angle_of_vector(
            self.get_needle_tip() - self.get_center()
        )