Let's say there are two given points $p_{tip}$ and $p_{base}$ which define the height of a triangle with $p_{tip}$ representing one of the vertices of that triangle and $p_{base}$ - the center of the opposite side of that vertex. In addition to that we also have an angle $\alpha$ which represents the angle between the two sides of the triangle at the vertex defined by $p_{tip}$:
The task is to find the coordinates of the other two vertices and thus create a triangle. The triangle is always isosceles.
There are two way to calculate the distance between the $p_{tip}$ and $p_{base}$ - I can calculate the Euclidean distance or use vector subtraction and then calculate the length of the resulting vector.
I picked the second (though I double checked with Euclidean distance ;)) since my way uses that difference vector anyway. So I have $\vec{p_{tip}} - \vec{p_{base}} = \vec{height}$ and $||\vec{height}||_{2} = \sqrt(\vec{height}_{x}^2 + \vec{height}_{y}^2)$.
Next I calculate the distance between $\vec{p_{base}}$ and each vertex using the sine and cosine theorem with $cos(\frac{\alpha}{2}) = \frac{height}{hypotenuse}$ and $sin(\frac{\alpha}{2}) = \frac{L}{hypotenuse}$ with $L=$distance between $\vec{p_{base}}$ and vertex. The height is equal to $||\vec{height}||_{2}$.
Then I normalize my vector $\vec{height}_{norm} = \frac{\vec{height}}{||\vec{height}||_{2}}$.
All that remains is to rotate this vector clock and counterclockwise
$\begin{matrix} cos(\frac{\alpha}{2}) & -sin(\frac{\alpha}{2}) \\ sin(\frac{\alpha}{2}) & cos(\frac{\alpha}{2}) \end{matrix}$
and
$\begin{matrix} cos(\frac{\alpha}{2}) & sin(\frac{\alpha}{2}) \\ -sin(\frac{\alpha}{2}) & cos(\frac{\alpha}{2}) \end{matrix}$
and multiply it by $L$ to get the respective vertex.
The problem that I can't figure out how translate and stretch my two tiny vectors (the result from the normalization and rotation) so that they can actually represent my vertices Below are two examples (I'm writing my stuff in Python using matplotlib for the plotting part):
Example 1:
- $\vec{p_{tip}} = (5, 10)$
- $\vec{p_{tip}} = (5, 0)$
- $\alpha = 30^\circ$
My calculations deliver (I use abs() for the results from my sine and cosine when calculating the lengths of the sides of my partial triangles which are defined by the points tip, base and the respective vertex):
Tip to base: (x: 0.000000, y: 10.000000, z: 0.000000)
Tip to base (normalized): (x: 0.000000, y: 1.000000, z: 0.000000)
Height (using vector length): 10.000000
Heigth (using Eucl.dist): 10.000000
Hypotenuse: 13.16330012724367
cos(alpha/2): 0.7596879128588213
sin(alpha/2): 0.650288
L: 8.559934
Vertex 1: (x: -0.650288, y: -0.759688, z: 0.000000)
Vertex 2: (x: 0.650288, y: -0.759688, z: 0.000000)
The plot looks like this:
(the two vertices are where my mouse cursor is :))
Example 2:
- $\vec{p_{tip}} = (0, 10)$
- $\vec{p_{tip}} = (10, 0)$
- $\alpha = 30^\circ$
Results in
Tip to base: (x: -10.000000, y: 10.000000, z: 0.000000)
Tip to base (normalized): (x: -0.707107, y: 0.707107, z: 0.000000)
Height (using vector length): 14.142136
Heigth (using Eucl.dist): 14.142136
Hypotenuse: 18.615717565535487
cos(alpha/2): 0.7596879128588213
sin(alpha/2): 0.650288
L: 12.105575
Vertex 1: (x: 0.077358, y: -0.997003, z: 0.000000)
Vertex 2: (x: 0.997003, y: -0.077358, z: 0.000000)
and a plot as seen below
As you can see both the rotation and direction of my vectors is ok (the green and red diamonds play the role of the arrow of the respective vectors).
If I multiply my tiny vectors with the $L$ I should at least get the length correct however this doesn't seem the case. I have even experimented with other values for the angle and for example for $\alpha = 10^\circ$ I get $L=47.807702$, which is impossible since I get a larger length of the cathetus lying opposite to the half of my angle ($5^\circ$) compared to what I get with a larger angle. I am completely stuck here. I know that this is supposed to be a really easy to solve problem but after wasting a lot of time I think that my brain won't budge any further.



The values of $\sin\alpha$ and $\cos\alpha$ you get are wrong. Are you using radians for the angles, as you should?
Moreover, your $\vec{heigth}$ vector must be rotated by $\pi/2$ (that is 90°), not by $\alpha/2$.