de-CH
utf-8
math math-format graphie
Slow Straight-Line Connection Between Two Points
ku-01-01a
multiple
28560
randRangeNonZero(-8,8) randRangeExclude(-4,4,[X]) randRangeExclude(-4,4,[X,Y]) randRangeExclude(-4,4,[X,Y,P]) randRange(2,6) L*500

Define a straight line \gamma: [0,L] \to \mathbb R^2, \gamma(t) = { \color{teal}\begin{pmatrix} x(t) \\y(t) \end{pmatrix}} from the point \mathbf {\color{red}A} to the point \mathbf {\color{blue}B} an.

style({ stroke: "black", strokeWidth: 2 }); graphInit({ range: [[-11, 11], [-9, 9]], scale: [22, 22], axisArrows: "->", tickStep: 2, labelStep: 1 }); label([-2,0], "\\llap{-}2", "below"); label([0,-2], "\\llap{-}2", "left"); // Punkte circle([X, Y], 0.25, { fill: "red" }); label( [X, Y], "{\\color{red}\\mathbf A}", "right" ); circle([P, Q], 0.25, { fill: "blue" }); label( [P, Q], "{\\color{blue} \\mathbf B}", "above left" );

{\color{teal}x(t)} = X + fractionReduce(P-X,L) * t
{\color{teal}y(t)} = Y + fractionReduce(Q-Y,L) * t

The point \mathbf {\color{red}A} has the coordinates {\color{red}(X,Y)}, and \mathbf {\color{blue}B} is \color{blue} (P,Q).

For the straight-line connection from {\color{red}(X,Y)} to \color{blue} (P,Q) we need the direction vector.

line( [X,Y], [P,Q], { stroke: ORANGE, arrows: "->" } );

This is \color{orange}\begin{pmatrix} P-X\\Q-Y\end{pmatrix} .

Thus, we have the (obvious) parametrization

\gamma: [0,1] \to \mathbb R^2, \gamma(t) = { \color{red}\begin{pmatrix}X\\Y\end{pmatrix} }+ t \cdot { \color{orange}\begin{pmatrix} P-X\\Q-Y\end{pmatrix} }= { \color{teal} \begin{pmatrix} X + P-X \cdot t \\ Y + Q-Y \cdot t \end{pmatrix}} .

But the interval is not [0,1], it is \color{purple}[0,L]. Thus we have more time.

addMouseLayer(); graph.guessPoint = addMovablePoint({ coord: [X,Y], constraints: { fixed: true } }); graph.guessPoint.toFront(); graph.guessPoint.visibleShape.animateTo([P, Q], T, function(coord) { graph.guessPoint.coord = coord; graph.guessPoint.updateLineEnds(); });

In the parametrization above, we replace t by \dfrac t{L} and get

\gamma: [0,L] \to \mathbb R^2, \gamma(t) = { \color{red}\begin{pmatrix}X\\Y\end{pmatrix} }+ \dfrac t{L} \cdot { \color{orange}\begin{pmatrix} P-X\\Q-Y\end{pmatrix} }= { \color{teal} \begin{pmatrix} X + fractionReduce(P-X,L) \cdot t \\ Y + fractionReduce(Q-Y,L) \cdot t \end{pmatrix}} .