Advertisement

The maths behind 3D

Started by November 19, 2002 08:03 AM
45 comments, last by hammerstein_02 21 years, 11 months ago
If you have 2 position vectors and you wanted to know their distance from each other, you could subtract them and calculate the resulting vectors length.

If you have one vector represent where something is going and how fast it''s going, the length of that vector it the speed.

If you want a vector to have a length of one (making it a unit vector), you can divide it by it''s length.

If you want to make a vector a certin length, you can divide by it''s length and multiply it by the length you want.
Chess is played by three people. Two people play the game; the third provides moral support for the pawns. The object of the game is to kill your opponent by flinging captured pieces at his head. Since the only piece that can be killed is a pawn, the two armies agree to meet in a pawn-infested area (or even a pawn shop) and kill as many pawns as possible in the crossfire. If the game goes on for an hour, one player may legally attempt to gouge out the other player's eyes with his King.
of course i know in mathematics the IS a difference between vectors and vertices, but in my code i do this:

  typedef TVertex3D TVector3D;  
"Art is a lie that lets us recognize the truth." - Pablo Picasso
Advertisement
I don''t mean to be rude, but how exactly does that help me? I am trying to understand.. is my idea of the vectors correct or am I drifting off the mark? Thanks for the replies though, I think that this is helping me..

=*=
If things seem bad, think that they can get a whole load worse, and they don''t seem so bad anymore

=*=
Have a look at this one

[A HREF="http://www.flipcode.com/geometry/"]Geometry Primer[/A]

Hope this helps...
well, if your not really sure on 3D as someone else mentioned start in 2D. That way you can get the hang on vectors. WEll to name one use of vectors you can show the speed and direction(or velocity to all physics kids out there) of say... a space ship, so every time the animation loop completes a cycle it''ll draw the ship at the new location according to the vector. and you can work out lots of fun stuff like acceleration... okay i''m starting to sound a bit sad now.......
if you like programming, you like maths, you just don't know it yet
Right.. ok.. I know I need to start in 2d.. and I really feel stupid. But can anybody give me any practical examples. I have never felt this stupid. but if anyone can help me out I would be much appreciative.

The flipcode tut confused the hell out of me. I can't see the practical use of Vectors.. and I don't know if I am getting stuck on them unnecessarily. But can someone say tell me how I use a vector etc.. to move a shape on screen. in 2d.. would be great. Thanks.

=*=
If things seem bad, think that they can get a whole load worse, and they don't seem so bad anymore

=*=

[edited by - hammerstein_02 on November 19, 2002 2:39:32 PM]
Advertisement
Okay well someone already mentioned displaying velocity with it, so we''ll stick with that. In 2D:

Say we have an object at (2,0) with a velocity vector (1,2). It could have gotten this velocity vector because we hard coded it in there, or it collided with something, but that doesn''t matter, the point is you don''t have to magically derive it or anything.

So, in the game, we get to this object for processing and (we''ll forget about time-based movement for simplicity) we update it''s new position like this:

position += velocity -> (2,0) += (1,2) = (3,2)

So, in a sense we''re saying this object movies 1 unit on the positive x axis and 2 units up the positive y axis each frame. If you like the velocity vector is just a short little line pointing outward from the object, showing where it''s head. The length of the line is essentially the object''s speed (because the longer the line when we do the += it will move further) and the where the object is heading is simply where the vector is pointing.

If you''re now understanding vectors but can''t really see the uses for them then you just have to start reading up on operations on vectors and then you can start to read some things on how to use them. I guess you just have to trust us that they do have uses and keep ploughing through the operations and stuff
GSACP: GameDev Society Against Crap PostingTo join: Put these lines in your signature and don't post crap!
Ok, let me give it a try.
In physics, forces are vectors. What does that mean: it mean that a force has a SENSE (direction) and an intensity.
If you can''t understand 2D vectors, try with 1D vectors
An 1D vector is something like this (graphical representation)
-------->
or
<--------

So, it goes to left or right. Now, the number of ''-'' in it denotes it''s intensity.
--> has a smaller intenisty than ----------->

Now, if you want to combine two vectors: -----> and <--- you will get -->
If you add ---> and ----> you get ------->
I hope you understand what I meant...
Okay... I might be really unusual here.. I''m a girl and yes I''m into programming too.. I don''t quite understand the vector concepts relevance in 3D. Here''s a lil bit of my background, I''ve taken 5 years of Physics, and the Advanced Placement, Calculus Based Physics.. I think where I''m having a problem is relating the physics aspect of vectors to computer generated ones.. In Physics we don''t have vectors that are "3D" per say.. if anyone can explain how to get my head from Physics to Computers I''d gladly appreciate that.

"Promise to remember that you''''re braver than you believe, stronger than you seem, and smarter than you think....and remember that I''''ll always be with you...even when I''''m not."
-Christopher Robin to Pooh
"Promise to remember that you''re braver than you believe, stronger than you seem, and smarter than you think....and remember that I''ll always be with you...even when I''m not."-Christopher Robin to Pooh
girls ?!?!

we don''t serve your kind around here....... just kidding.

I don''t know much about physics though, but someone else will know.
GSACP: GameDev Society Against Crap PostingTo join: Put these lines in your signature and don't post crap!

This topic is closed to new replies.

Advertisement