SFML community forums
General => Feature requests => Topic started by: StormWingDelta on April 12, 2014, 11:45:38 pm
-
Someone missed the +, -, +=, and -= operators. ??? Not sure if bug, forgotten about, or oops. XD
These are missing on adding numbers to vectors.
-
Please check before posting.... the following code works just fine.
Vector2f a
= new Vector2f
(1,
1);Vector2f b
= new Vector2f
(2,
2);a
+= b
;
-
These 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...
-
If you could show me the line (https://github.com/SFML/SFML/blob/master/include/SFML/System/Vector2.hpp) where SFML (C++) implements that I would have no problem with this suggestion.
-
These 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.
-
These 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. >.>
-
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.
That would be a scalar multiplication.
You can find here (http://en.wikipedia.org/wiki/Vector_calculus) the mathematically valid vector operators. Adding a scalar and a vector together is not one of 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.
That's not simple, let alone intuitive. It doesn't make sense to provide vector operators that have no mathematical meaning, even it's technically possible. The idea of operators is to provide a nice syntax for common operations, so that it's immediately clear what the code does.
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. >.>
Maybe you should inform yourself a bit before posting a feature request :P
-
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.
That would be a scalar multiplication.
You can find here (http://en.wikipedia.org/wiki/Vector_calculus) the mathematically valid vector operators. Adding a scalar and a vector together is not one of them.
lol now that I remember it was probably an equation to turn what would normally be added into a multiplier for scaling. In any event oh well. XD