Line

Qualified name: manim.mobject.geometry.Line

class Line(start=array([- 1., 0., 0.]), end=array([1., 0., 0.]), buff=0, path_arc=None, **kwargs)[source]

Bases: manim.mobject.geometry.TipableVMobject

Methods

account_for_buff

generate_points

Initializes points and therefore the shape.

get_angle

get_projection

Returns the projection of a point onto a line.

get_slope

get_unit_vector

get_vector

init_points

Initializes points and therefore the shape.

pointify

put_start_and_end_on

Sets starts and end coordinates of a line.

set_angle

set_length

set_opacity

set_path_arc

set_points_by_ends

set_start_and_end_attrs

Attributes

animate

Used to animate the application of a method.

animation_overrides

depth

The depth of the mobject.

height

The height of the mobject.

width

The width of the mobject.

generate_points()[source]

Initializes points and therefore the shape.

Gets called upon creation. This is an empty method that can be implemented by subclasses.

get_projection(point)[source]

Returns the projection of a point onto a line.

Parameters

point (Sequence[float]) – The point to which the line is projected.

Return type

Sequence[float]

init_points()

Initializes points and therefore the shape.

Gets called upon creation. This is an empty method that can be implemented by subclasses.

put_start_and_end_on(start, end)[source]

Sets starts and end coordinates of a line. .. rubric:: Examples

Example: LineExample

from manim import *

class LineExample(Scene):
    def construct(self):
        d = VGroup()
        for i in range(0,10):
            d.add(Dot())
        d.arrange_in_grid(buff=1)
        self.add(d)
        l= Line(d[0], d[1])
        self.add(l)
        self.wait()
        l.put_start_and_end_on(d[1].get_center(), d[2].get_center())
        self.wait()
        l.put_start_and_end_on(d[4].get_center(), d[7].get_center())
        self.wait()
Parameters
  • start (Sequence[float]) –

  • end (Sequence[float]) –