0 Members and 1 Guest are viewing this topic.
These are missing on adding numbers to vectors.
Quote from: StormWingDelta on April 12, 2014, 11:45:38 pmThese are missing on adding numbers to vectors. I think he meansVector2f a = new Vector2f(1, 1);a += 3;My knowledge of vectors is limited, but I don't know if this really has a meaning...
Quote from: G. on April 13, 2014, 01:55:35 amQuote from: StormWingDelta on April 12, 2014, 11:45:38 pmThese are missing on adding numbers to vectors. I think he meansVector2f a = new Vector2f(1, 1);a += 3;My knowledge of vectors is limited, but I don't know if this really has a meaning...No, you can't add a scalar to a vector, just multiply or divide them.
If I remember right a simple way to add a scaler would be to get the Magnitude than add to that and have the equation spit out the new vector from that new magnitude.
Just guessing right now since I saw it in Pre Cal but didn't think anything of it. Also saw it in a few vector libs but can't find them anymore. >.>
QuoteIf I remember right a simple way to add a scaler would be to get the Magnitude than add to that and have the equation spit out the new vector from that new magnitude.That would be a scalar multiplication.You can find here the mathematically valid vector operators. Adding a scalar and a vector together is not one of them.