2D vector phisics problem (repost)

Started by
1 comment, last by NextEpisode1 13 years, 9 months ago
In my first post i gues i wasn't clear enough,since people told me about arrays , lists and operator overloading.

To be specific: I am not talking about data collections of any sort. Im talking about 2 dimensions geometrical vector that describes the trajectory and speed of an object.

Can any1 tell me a book related to it,or to post an example of some sort that can perform a simple geometrical vector operation.I dont know how to represent the actual vector in a system where point is described by (x,y).
#include <iostream>#include <string>int main(){ std::cout<<"I will kill your stack"; return main();}
Advertisement
I'd start with the basics here. (For now, you can probably skip the parts on matrices and instead concentrate on vector, but matrices are very helpful in games.) The actual representation of a 2D vector in code can be as simple as having two variables; an x and a y. For non-trivial programs, you'll want to wrap the concept of a Vector into a structure, class, or something like that. For example, in C++ you might have:
struct Vector {    float x;    float y;};

Then you might make operators or functions which act on the Vector to apply geometric operation.
Quote:Original post by Ezbez
I'd start with the basics here. (For now, you can probably skip the parts on matrices and instead concentrate on vector, but matrices are very helpful in games.) The actual representation of a 2D vector in code can be as simple as having two variables; an x and a y. For non-trivial programs, you'll want to wrap the concept of a Vector into a structure, class, or something like that. For example, in C++ you might have:
struct Vector {    float x;    float y;};

Then you might make operators or functions which act on the Vector to apply geometric operation.


There is hope for human kind :P, thanks vm dude , thats exactly what i wanted.
#include <iostream>#include <string>int main(){ std::cout<<"I will kill your stack"; return main();}

This topic is closed to new replies.

Advertisement