Public Group

# 2D vector phisics problem (repost)

This topic is 3080 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

## Recommended Posts

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).

##### Share on other sites
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.

##### Share on other sites
Quote:
 Original post by EzbezI'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.

1. 1
2. 2
Rutin
19
3. 3
khawk
18
4. 4
5. 5
A4L
11

• 9
• 12
• 16
• 26
• 10
• ### Forum Statistics

• Total Topics
633768
• Total Posts
3013753
×