Welcome, Guest. Please login or register. Did you miss your activation email?

Author Topic: Noticed something missing from the C# Vectors for SFML  (Read 4688 times)

0 Members and 2 Guests are viewing this topic.

StormWingDelta

  • Sr. Member
  • ****
  • Posts: 365
    • View Profile
Noticed something missing from the C# Vectors for SFML
« 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. 
« Last Edit: April 13, 2014, 01:28:38 am by StormWingDelta »
I have many ideas but need the help of others to find way to make use of them.

zsbzsb

  • Hero Member
  • *****
  • Posts: 1409
  • Active Maintainer of CSFML/SFML.NET
    • View Profile
    • My little corner...
    • Email
Re: Noticed something missing from the C# Vectors for SFML
« Reply #1 on: April 13, 2014, 01:49:40 am »
Please check before posting....  the following code works just fine.

Vector2f a = new Vector2f(1, 1);
Vector2f b = new Vector2f(2, 2);
a += b;
Motion / MotionNET - Complete video / audio playback for SFML / SFML.NET

NetEXT - An SFML.NET Extension Library based on Thor

G.

  • Hero Member
  • *****
  • Posts: 1593
    • View Profile
Re: Noticed something missing from the C# Vectors for SFML
« Reply #2 on: April 13, 2014, 01:55:35 am »
These are missing on adding numbers to vectors.
I think he means
Vector2f a = new Vector2f(1, 1);
a += 3;
My knowledge of vectors is limited, but I don't know if this really has a meaning...

zsbzsb

  • Hero Member
  • *****
  • Posts: 1409
  • Active Maintainer of CSFML/SFML.NET
    • View Profile
    • My little corner...
    • Email
Re: Noticed something missing from the C# Vectors for SFML
« Reply #3 on: April 13, 2014, 01:57:55 am »
If you could show me the line where SFML (C++) implements that I would have no problem with this suggestion.
« Last Edit: April 13, 2014, 02:15:59 am by zsbzsb »
Motion / MotionNET - Complete video / audio playback for SFML / SFML.NET

NetEXT - An SFML.NET Extension Library based on Thor

Edoren

  • Newbie
  • *
  • Posts: 3
    • View Profile
Re: Noticed something missing from the C# Vectors for SFML
« Reply #4 on: April 13, 2014, 02:40:04 am »
These are missing on adding numbers to vectors.
I think he means
Vector2f 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.

StormWingDelta

  • Sr. Member
  • ****
  • Posts: 365
    • View Profile
Re: Noticed something missing from the C# Vectors for SFML
« Reply #5 on: April 13, 2014, 05:39:57 am »
These are missing on adding numbers to vectors.
I think he means
Vector2f 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. >.>
I have many ideas but need the help of others to find way to make use of them.

Hiura

  • SFML Team
  • Hero Member
  • *****
  • Posts: 4321
    • View Profile
    • Email
Re: Noticed something missing from the C# Vectors for SFML
« Reply #6 on: April 13, 2014, 09:26:50 am »
Quote
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 the mathematically valid vector operators. Adding a scalar and a vector together is not one of them.
SFML / OS X developer

Nexus

  • SFML Team
  • Hero Member
  • *****
  • Posts: 6287
  • Thor Developer
    • View Profile
    • Bromeon
Re: Noticed something missing from the C# Vectors for SFML
« Reply #7 on: April 13, 2014, 03:09:46 pm »
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
Zloxx II: action platformer
Thor Library: particle systems, animations, dot products, ...
SFML Game Development:

StormWingDelta

  • Sr. Member
  • ****
  • Posts: 365
    • View Profile
Re: Noticed something missing from the C# Vectors for SFML
« Reply #8 on: April 13, 2014, 08:13:46 pm »
Quote
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 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
I have many ideas but need the help of others to find way to make use of them.