0
$\begingroup$

I have three vectors:

  • $A(a_0,a_1)$
  • $B(b_0,b_1)$
  • $V(v_0,v_1)$

I need to scale the $V$ vector to touch the line between $A$ and $B$.

You can be sure that $V$ vector points between $A$ and $B$.

  • 0
    No, it's not homework and don't have any trouble with homework, i'm best at math in my class :) It's part of bigger problem, but we've learned only few thing from geometry in school yet.2011-10-08

1 Answers 1

1

I will assume that first vector is $\vec {OA}=a_0\vec i+a_1\vec j$, second $\vec {OB}=b_0\vec i+b_1\vec j$, and third $\vec {OV}=v_0\vec i+v_1\vec j$, where $\vec i$ and $\vec j$ are unit vectors.

Let's observe picture bellow.You can see that point $A$ and point $B$ lies on line which is defined by next equation:

$y-a_1=\frac{b_1-a_1}{b_0-a_0}(x-a_0)$

Since end point of vector $\vec {OV}$ needs to touch line between $A$ and $B$ point $(v_0,v_1)$ must satisfy equation of the line,so we can write following:

$v_1 =a_1+\frac{b_1-a_1}{b_0-a_0}(v_0-a_0)$,

You can choose arbitrary value of $v_0$ between $a_0$ and $b_0$ in order to calculate $v_1$

enter image description here

  • 0
    http://www.geogebra.org/cms/2011-10-08