Scene helper

class manim_extensions.compass.CompassScene(camera_class=<class 'manim.camera.moving_camera.MovingCamera'>, **kwargs)[source]

Bases: MovingCameraScene

A scene equipped with a compass, ruler, and pencil. Mainly implements compass placement, arc drawing, and ruler/pencil animations.

setup()[source]

CompassScene.setup example.

compass_move_niddle_tip_to(pos=array([0., 0., 0.]), run_time=1)[source]

Move the compass needle tip to pos.

rotate_compass_about_niddle_tip(angle_or_arc, arc=None, added_anims=None, **kwargs)[source]

Rotate angle around the compass needle tip (niddle_tip).

compass_split_span(span=3, run_time=1)[source]

Rotate the two compass legs uniformly outward/inward so the opened distance equals span.

split_cmpass_span(span=1, run_time=1)[source]

Fix niddle_tip, then move pen_tip along the line through niddle_tip and pen_tip to reach the given span.

set_compass(niddle_pos=None, pen_pos=None, run_time=1.0)[source]

Place the compass at the specified positions: move niddle_tip to niddle_pos and pen_tip to pen_pos.

Parameters:
  • niddle_pos (Point) – target position for the compass needle tip (niddle_tip)

  • pen_pos (Point) – target position for the compass pen tip (pen_tip)

draw_arc(niddle_point=array([0., 0., 0.]), pen_point=array([1., 0., 0.]), angle=1.0471975511965976, move_time=1.0, wait_time=1.0, run_time=1.0, arc_color=None, **kwargs)[source]

Draw an arc with the compass. The arc radius is computed from niddle_point and pen_point.

Parameters:
  • niddle_point – centre of the arc

  • pen_point – starting point of the arc

  • angle – central angle of the arc

  • move_time – time to move the compass into position

  • run_time – time to draw the arc

  • wait_time – wait time between the two animations

  • arc_color – colour of the arc

  • kwargs – other keyword arguments for the arc

  • return – The drawn arc

Return type:

Arc

flip_compass(run_time=1)[source]

Flip the compass.

put_compass_aside(aside_pos=array([1., 0., 0.]), span_buff=0.1, run_time=1.0)[source]

Put the compass aside.

Parameters:
  • aside_pos (Point) – position to place the compass

  • span_buff (float) – distance between the two compass tips when placed aside

  • run_time (float) – time required to place the compass

set_ruler(start=None, end=None, lag_ratio=0.5, run_time=1.0, with_pencil=True)[source]

Place the ruler so that one of its edges aligns with start and end.

Parameters:
  • start (Point) – start point of the ruler placement

  • end (Point) – end point of the ruler placement

  • lag_ratio (float) – lag ratio between the ruler and pencil placement animations

  • run_time (float) – time to place the ruler

  • with_pencil (bool) – whether to place the pencil at the same time

set_pencil(pos, run_time=1.0)[source]

Move the pencil nib to the specified position.

draw_line(start=None, end=None, run_time=1.0, with_pencil=True, color=ManimColor('#F7D96F'), **kwargs)[source]

Draw a straight line using the ruler.

Return type:

Line

put_pencil_away(pos=array([0., -3., 0.]), run_time=1)[source]

Translate the pencil as a whole to the specified position.

put_ruler_aside(aside_pos=array([0., -3., 0.]), horizontal_or_vertical=True, run_time=1.0)[source]

Put the ruler aside at aside_pos.

Parameters:
  • aside_pos (Point) – position where the ruler will be placed

  • horizontal_or_vertical (bool) – whether to place it horizontally

  • run_time (float) – time required to place the ruler