Let say I have this diagram,
How to find the direction vector passing through the intersection point of two straight lines?
Update: new vector is the bisector of two lines and vector may be arbitrary.
Let say I have this diagram,
How to find the direction vector passing through the intersection point of two straight lines?
Update: new vector is the bisector of two lines and vector may be arbitrary.
It seems that what OP really wants is, given direction vectors $(1,a)$ and $(1,b)$, find the direction vector of their angle bisector.
I'm going to assume $0\le a\le b\lt\infty$, and let OP figure out the necessary modifications if any for other parameter ranges.
Let $\alpha$ be the angle the 1st direction vector makes with the $x$-axis, and let $\beta$ be the angle the 2nd direction vector makes with the $x$-axis. Then we have $\tan\alpha=a$, and $\tan\beta=b$. The bisector makes an angle $(\alpha+\beta)/2$ with the $x$-axis, so its direction vector is $(1,\tan((\alpha+\beta)/2))$. By the half-angle formula for the tangent (see, e.g., http://en.wikipedia.org/wiki/Tangent_half-angle_formula) we have $\tan\left({\alpha+\beta\over2}\right)={\tan(\alpha+\beta)\over1+\sqrt{1+\tan^2(\alpha+\beta)}}$ Combine this with the addition formula for the tangent, $\tan(\alpha+\beta)={\tan\alpha+\tan\beta\over1-\tan\alpha\tan\beta}$ and the values $\tan\alpha=a$ and $\tan\beta=b$ already mentioned, and you have a formula for the direction vector $(1,\tan((\alpha+\beta)/2))$ of the bisector. I think that second component simplifies to ${a+b\over1-ab+\sqrt{(a^2+1)(b^2+1)}}$
You can do this by calculating the angle between the two and then finding the appropriate direction vector. Using that the angle between line passing through the points $(0,0)$ and $(x,y)$ and between the $x$-axis is given by $\arctan\frac{y}{x}$.
Then the angle between the given two lines will be: $\arctan\frac{3}{2}-\arctan\frac{4}{8}$ (do you see why?)
So, the angle between the desired line and the $x$-axis will be: $\frac{1}{2}\left(\arctan\frac{3}{2}-\arctan\frac{1}{2}\right)+\arctan\frac{1}{2}=\frac{1}{2}\left(\arctan\frac{3}{2}+\arctan\frac{1}{2}\right)$ Once again - do you see it?
Now, the direction vector will be $(1,y)$, where $y=\tan\left[\frac{1}{2}\left(\arctan\frac{3}{2}+\arctan\frac{1}{2}\right)\right]$.
You can calculate it with a calculator or using the identities of the $\tan$ and $\arctan$ functions.
Edit: The $\arctan$ function returns values between $-\frac{\pi}{2}$ and $\frac{\pi}{2}$ rad ($-90$ and $90$ degrees). So, if a point $(x,y)$ is in the first or fourth quadrant, then the angle between the line and the $x$-axis will be in that interval and will be exactly $\arctan\frac yx$. But if it's not, then you have to "repair" the angle: If $(x,y)$ is in the second quadrant (i.e. x<0, y>0) then the angle should be between $\frac{\pi}{2}$ and $\pi$ rad. The correct way to get the angle will be $\pi+\arctan\frac yx$.
If $(x,y)$ is in the third quadrant (i.e. $x<0, y<0$) then the angle should be between $-\pi$ and $-\frac{\pi}{2}$ rad. The correct way to get the angle will be $-\pi+\arctan\frac yx$.
(If you're used to calculating in degrees, replace $\pi$ by $180$ degrees everywhere).
Edit 2: If you want to calculate the angle of a line passing through two given points $(x_1,y_1)$, $(x_2,y_2)$ with the $x$-axis, You should replace each $\arctan\frac yx$ with $\arctan\frac {y_2-y_1}{x_2-x_1}$
Let's denote direction vector as $v$ ,then :
$v=\left(1,\tan\left(\frac{\arctan{\frac{3}{2}}+\arctan{\frac{1}{2}}}{2}\right)\right)\approx(1,0.8828)$
Normalize the two given vectors, i.e. compute $e_a:={a\over |a|}={1\over\sqrt{13}}(2,3)\ ,\quad e_b:={b\over|b|}={1\over\sqrt{5}}(2,1)\ .$ Then the angle bisector will pass through the point $p:=e_a+e_b=\Bigl({2\over\sqrt{13}}+{2\over\sqrt{5}},{3\over\sqrt{13}}+{1\over\sqrt{5}}\Bigr)\doteq(1.44913,1.27926)$ whose argument is $\arctan(0.882782)=0.723221=41.44^\circ$.
The following figure shows the geometric intuition behind the above computation: