[1]:
from manim import *
from manim_geometry import *

config.media_embed = True
config.media_width = "100%"
_RV = "-v WARNING -qm --progress_bar None --disable_caching"
_RI = "-v WARNING -s --progress_bar None --disable_caching"
Manim Community v0.18.0

Intersections

Line-Line intersection

[2]:
class Example(Scene):
  def construct(self):
    self.add(NumberPlane().fade(0.7))

    geos = Geos(self)
    init_geos = {
      "l1": Line(LEFT*3, RIGHT*3),
      "l2": Line(LEFT*3, RIGHT*3).rotate(30*DEGREES).shift(RIGHT),
      "l3": Line(LEFT*3, RIGHT*3).rotate(30*DEGREES).shift(LEFT),
      "dX": geos.intersection_lines("l1", "l2", color=RED),
      "dY": geos.intersection_lines("l1,l3", color=BLUE),
    }
    geos.create_geos(init_geos)

    self.add(geos.get_all_mobs_as_grp())

%manim $_RV Example
_images/CHP3_2_0.png

Circle-Circle intersection (Also work with Arcs)

[3]:
class Example(Scene):
  def construct(self):
    self.add(NumberPlane().fade(0.7))

    geos = Geos(self)
    init_geos = {
      "c1": geos.circle(LEFT, 3),
      "c2": geos.arc(RIGHT, 2, -PI/2, PI, color=RED),
      "c3": geos.circle(RIGHT, 3, color=BLUE),
      "c4": geos.arc(RIGHT*3, 2, -PI/2, -PI, color=GREEN),
      "d1,d2": geos.intersection_circles("c1", "c2", color=RED),
      "d3,d4": geos.intersection_circles("c1,c3", color=BLUE),
      "d5,d6": geos.intersection_circles("c2,c4", color=YELLOW),
      "l12": geos.segment("d1,d4")
    }
    geos.create_geos(init_geos, set_all_labels=True)

    self.add(geos.get_all_mobs_as_grp())

%manim $_RV Example
_images/CHP3_4_0.png

Circle-Line intersection

[4]:
class Example(Scene):
  def construct(self):
    self.add(NumberPlane().fade(0.7))

    geos = Geos(self)
    init_geos = {
      "c1": geos.circle(ORIGIN, 3),
      "l1": Line(LEFT*4, RIGHT*5).rotate(30*DEGREES).shift(LEFT),
      "l2": Line(LEFT*4, RIGHT*5).rotate(-30*DEGREES).shift(LEFT),
      "d1,d2": geos.intersection_circle_line("c1", "l1", color=ORANGE),
      "d3,d4": geos.intersection_circle_line("c1,l2", color=GREEN),
    }
    geos.create_geos(init_geos, set_all_labels=True)

    self.add(geos.get_all_mobs_as_grp())

%manim $_RV Example
_images/CHP3_6_0.png

Line bisector

Hint

This method returns a line, but instead of using the letter l I recommend using b, since it indicates that it is a “bisector”, there is no penalty for using l, but using the b will help you identify objects faster.

[5]:
class Example(Scene):
  def construct(self):
    self.add(NumberPlane().fade(0.7))

    geos = Geos(self)
    init_geos = {
      "d1,d2": GeosVGroup(Dot(LEFT), Dot(RIGHT)).rotate(30*DEGREES),
      "b1": geos.line_bisection_two_points("d1,d2", color=GREEN),
      "c1": geos.circle("d1", 2),
      "c2": geos.circle("d2", 2),
    }
    geos.create_geos(init_geos, set_all_labels=True)
    self.add(geos.get_all_mobs_as_grp())

%manim $_RV Example
_images/CHP3_8_0.png

Angle bisector

[6]:
class Example(Scene):
  def construct(self):
    self.add(NumberPlane().fade(0.7))

    geos = Geos(self)
    init_geos = {
      "d1,d2": GeosVGroup(Dot(LEFT), Dot(RIGHT)).rotate(30*DEGREES),
      "dU": Dot(UP),
      "iI_1": geos.nearest_angle_bisector("d1", "d2", "dU", color=ORANGE),
      "iI_2": geos.farthest_angle_bisector("d1,d2,dU", color=GREEN),
      "c1": geos.circle("d1", 2),
      "c2": geos.circle("d2", 2),
    }
    geos.create_geos(init_geos, set_all_labels=True)
    self.add(geos.get_all_mobs_as_grp())

%manim $_RV Example
_images/CHP3_10_0.png

Dot-Circle common chord

[7]:
class Example(Scene):
  def construct(self):
    self.add(NumberPlane().fade(0.7))

    geos = Geos(self)
    init_geos = {
      "d1,d2": GeosVGroup(Dot(LEFT), Dot(RIGHT*4)).rotate(30*DEGREES),
      "c1": geos.circle("d1", 2),
      "b12": geos.common_chord_partial("d2", "c1", color=YELLOW),
      # "b12": geos.dot_circle_common_chord("d2,c1"),
      "n12": geos.distance("d1,d2"),
      "c2": geos.circle("d2", radius="n12", stroke_opacity=0.3)
    }
    geos.create_geos(init_geos, set_all_labels=True)
    self.add(geos.get_all_mobs_as_grp())

%manim $_RV Example
_images/CHP3_12_0.png

Nearest/Farthest circle-line intersection

[8]:
class Example(Scene):
  def construct(self):
    self.add(NumberPlane().fade(0.7))

    geos = Geos(self)
    init_geos = {
      "c1": geos.circle(ORIGIN, 2),
      "l1": geos.line(LEFT*3, RIGHT*3),
      "l2": geos.geos_copy("l1", lambda m: m.rotate(PI/2)),
      "dL": geos.dot(LEFT),
      "dU": geos.dot(UP),
      "iI_L": geos.nearest_intersection_circle_line("c1", "l1", "dL", color=BLUE),
      "iI_R": geos.farthest_intersection_circle_line("c1,l1,dL", color=GREEN),
      "iI_U": geos.nearest_icl("c1,l2,dU", color=YELLOW), # nearest_intersection_circle_line
      "iI_D": geos.farthest_icl("c1,l2,dU", color=PINK),  # farthest_intersection_circle_line
    }
    geos.create_geos(
      init_geos,
      set_all_labels=True,
      label_direction=DL,
      label_buff=0
    )
    self.add(geos.get_all_mobs_as_grp())

%manim $_RV Example
_images/CHP3_14_0.png

Nearest/Farthest circle-circle intersection

[9]:
class Example(Scene):
  def construct(self):
    self.add(NumberPlane().fade(0.7))

    geos = Geos(self)
    init_geos = {
      "c1": geos.circle(LEFT*3, 2),
      "c2": geos.circle(RIGHT, 3),
      "c3": geos.circle(RIGHT*4.5, 2),
      "dU": Dot(UP),
      "d1": geos.nearest_intersection_circle_circle("c1","c2","dU"),
      "d2": geos.nearest_intersection_circle_circle("c2,c3,dU"),
      "d3": geos.farthest_intersection_circle_circle("c1","c2","dU"),
      "d4": geos.farthest_intersection_circle_circle("c2,c3,dU"),
    }
    geos.create_geos(
      init_geos,
      set_all_labels=True,
      label_direction=DL,
      label_buff=0
    )
    self.add(geos.get_all_mobs_as_grp())


%manim $_RV Example
_images/CHP3_16_0.png
[10]:
class Example(Scene):
  def construct(self):
    self.add(NumberPlane().fade(0.7))

    geos = Geos(self)
    init_geos = {
      "c1": geos.circle(LEFT*3, 2),
      "c2": geos.circle(RIGHT, 3),
      "c3": geos.circle(RIGHT*4.5, 2),
      "dU": Dot(UP),
      "d1": geos.nearest_icc("c1","c2","dU"),  # nearest_intersection_circle_circle
      "d2": geos.nearest_icc("c2,c3,dU"),
      "d3": geos.farthest_icc("c1","c2","dU"), # farthest_intersection_circle_circle
      "d4": geos.farthest_icc("c2,c3,dU"),
    }
    geos.create_geos(
      init_geos,
      set_all_labels=True,
      label_direction=DL,
      label_buff=0
    )
    self.add(geos.get_all_mobs_as_grp())

%manim $_RV Example
_images/CHP3_17_0.png
[ ]: