I have a basic rectangle, which I want to skew to give the illusion of perspective (I'm creating a Python program). Here's what I mean. The angles in the picture are just exemplary; I want this to be dynamic. However, the "offset" is always identical (so out of the four degrees, two of each are the same.)
How do I calculate the length of a, given c, b, d and every angle? This site claims that the equation to do so (using the available information) is
$a = \frac{b*sin(-\alpha-\beta+180) + c*sin(\alpha)}{sin(\alpha)}$
(Googleable:)
a = (b*sin(-alpha-beta+180) + c*sin(alpha))/(sin(alpha))
and gives the correct length for an exemplary rectangle I tried it with. (Since the site is in German, here is the relevant part.)
HOWEVER, feeding this equation into Google, Python, or even a different part of this very site, it gives a different result (one which does not "work out"). Yes, I checked for radiant/degree. I also tried different transcriptions of the equation.
All the other approaches I could find required knowledge of A, m or h (which all require a in some shape or form).
Anybody know either the correct equation to calculate a (knowing what I know, so, not h, m or A), or a different online calculator (which also gives the equation - again, I want to make it dynamic)?
Thanks a ton in advance!
(In case anybody wants to toy around with the equation; using possible numbers, it is
(250*sin(-45-45+180)+850*sin(45))/sin(45)
That way you don't have to transcribe it yourself. The correct result is 1203.553; however, I always get 1112.661 using the equation myself)
The correct formula is
$ a = c + b \cos \alpha + d \cos \beta $
where $\alpha $ is the angle between $b$ and $a$ , and $\beta$ is the angle between $d$ and $a$.
If $\alpha = \beta = 45^\circ $, and $b = d = 250$, and $ c = 850 $, then
$ a = 850 + 250 \sqrt{2} = 1203.55 $
which is the correct result.