I've been trying for the last day or two, to figure out vectors.
Wikipedia just left me completely baffled, with all it's dot products, and cross products, and unit vectors etc.
I know the X and Y components of vector A (the red line) - I know how to find it's length and angle too, if that helps.
I know angle A (the angle of the green line from 0 degrees, ie. right)
I need to find the vector (blue line) which is perpendicular to the green line, and which goes to the end of vector A.
I then need to find the point 25% of the way along it.
I then need to find the vector from the start of vector A, to that point.
IMPORTANTLY, it needs to work for *any* angle, and *any* vector. It needs to work in all 4 quadrants not just the one shown. I think this is why I couldn't make it work using trig.
Thanks for the links.
I have read *a lot* about it so I have the formulae now - it's just trying to figure out how to apply them to my problem.
Actually, I discovered what I really need is a little more complicated than I said before, so you can forget that until I work out exactly what I do need.
Disclaimer: Any sarcasm in my posts will not be mentioned as that would ruin the purpose. It is assumed that the reader is intelligent enough to tell the difference between what is sarcasm and what is not.
The sum of the 3 angles inside a triangle must be 180 degrees.
So, you know ANGLE A (from baseline to green line), and you know the angle of VECTOR A (from baseline to vector A). We'll call this latter one ANGLE B to avoid confusion.
Subtracting Angle A from Angle B will give you the bottom left angle within the triangle (the angle where the RED and GREEN lines meet).
We already know that the blue line we are trying to plot must be at 90 degrees of the GREEN line, so the remainder is the angle where the red line meets the blue line.
From there we can plot the blue line using straightforward SIN and COS, so that's half the work done.
Now to get the length of that line. This line is the ADJACENT.
So, we know all the angles involved, so we can construct a unit triangle using the sin/cos/tan functions.
We know the HYPOTENUSE (red line) length, so we'll call that length '1'.
We know the angle BLUE->RED so we can use COS as follows:
cos(angle(BLUE->RED)) * RED LINE LENGTH = BLUE LINE LENGTH
you can now plot whatever percentage of that distance you wish
Big thanks to everyone who helped - it's much appreciated
I originally started out trying to solve this using trigonometry, as a number of you have suggested.
With hindsight, I can see at least part of where I was going wrong:
Finding the difference between the two lines - I just tried to subtract one from the other, instead of using the proper formula. As an example of why this didn't work, Angle_A = 45, Angle_B = 315. If you subtract one from the other, you get either 270 or -270. The actual difference though, is 90 degrees.
If I'd remembered that then I probably would have been okay, apart from maybe having problems positive/negative angles somewhere down the line.
Anyway, I eventually got it to work using just vectors, so I can't be bothered to try and do it again with trig.