When I try to get_horizontal_line
from one dot to another it goes from the y-axes. I want that the dashedline comes from the point [1;1]
to point [3;1]
. Because now it comes from [0;1]
to[3;1]
directly from the axis coordinate.
I don't know how to get lines not from the axis but from the point. Also here is my code:
from manim import *
class KvadratickaFunkcia(Scene):
def construct(self):
suradnicovaOs = Axes(
x_range=[-8,8,1],
y_range=[-8,8,1],
tips=False,
x_length=10,
y_length=10,
axis_config=
{
"stroke_color": GREY_A,
"include_numbers": True,
}
)
#vzorec x-2
posunParabolyVzorecMinus2a = MathTex("{y = (x-2)^2+0}", font_size=50).to_edge(UL).set_color(YELLOW)
posunParabolyVzorecMinus2a[0][5].set_color(RED)
posunParabolyVzorecMinus2a[0][9].set_color(RED)
#vzorec parabola y: (y-2)**2+0
parabolaMinus2a = suradnicovaOs.plot(lambda y: (y-2)**2+0 )
#body 1,2,3
bodMinus2a= Dot(suradnicovaOs.coords_to_point(1, 1), color=YELLOW)
bodkociarkaMinus2a = suradnicovaOs.get_horizontal_line(suradnicovaOs.c2p(3,1))
bodMinus2a2 = Dot(suradnicovaOs.coords_to_point(2, 0), color=YELLOW)
bodkociarkaMinus2a2 = suradnicovaOs.get_vertical_line(suradnicovaOs.c2p(1,1))
bodMinus2a3 = Dot(suradnicovaOs.coords_to_point(3, 1), color=YELLOW)
bodkociarkaMinus2a3 = suradnicovaOs.get_vertical_line(suradnicovaOs.c2p(3,1))
VsetkyBodyMinus123AA = VGroup(bodMinus2a,bodMinus2a2,bodMinus2a3,bodkociarkaMinus2a,bodkociarkaMinus2a2,bodkociarkaMinus2a3)
self.play(Write(suradnicovaOs), run_time=3)
self.play(Create(posunParabolyVzorecMinus2a))
self.play(Create(VsetkyBodyMinus123AA))
self.wait()
self.play(FadeIn(parabolaMinus2a))
image of my problem: