Public Group

#### Archived

This topic is now archived and is closed to further replies.

# The maths behind 3D

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

## Recommended Posts

##### Share on other sites
Vectors are just a representation of a point in three dimensions (because obviously, we live in a 3D world)

You can describe any point in 3D space with 3 coordinates, and they are normally called x, y, and z. When you sit in front of your computer, imagine it this way:

Take the lower left corner of your monitor: that is your x=0, y=0, z=0 point, or as a vector (0,0,0).
Now look to the bottom right of the monitor. Depending how large your monitor is, it''s going to be about 15" to the right (which is the positive x axis). So that point is (15,0,0)

The top left point is along the positive y axis, some odd 12" or so. So that point is (0,12,0).

Now comes the first important step - what is the coordinate of the top right corner? Well, it''s 15 to the right and 12 to the top, or (15, 12, 0). But we can get that from a simple addition as well:
(0,12,0) + (15, 0, 0) = (15, 12, 0) (in an addition, you add every component separately)

When you look at the back of the monitor then, you go along the positive z axis, and you may end up at a point (0, 0, 17) (bottom left in the rear) or (15, 12, 17) (top right in the rear)

It''s hard to describe it in words, but I hope you got some idea now. Transformation through matrices is a lot harder to grasp...

##### Share on other sites
I thought vertices represented a point in 3d space.. now I am really confused.. I get the explanation, I can understand that we work in 3 dimensions, I just can''t understand how the points work.. I can''t understand the basics..

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

=*=

##### Share on other sites
you might think about getting out a basic maths or physics book from a library. They will prolly explain it better than a website or tutorial thing. Don''t know any of the top of my head...

##### Share on other sites
I''ll have another crack at trying to explain it in a different way.

A point in 3d space is defined by 3 values, as you know: (x, y, z)

A vector in 3d space is also defined by 3 values: (x, y, z)

You''re probably thinking, well what is so great about vectors then, they''re exactly the same as points. Well, going from your definiton, vectors actually don''t define just a point in 3d space, they define a direction and magnitude. To explain this:

Take the point (1, 1, 0). Draw it on a piece of paper or something.

Now draw a line between (0,0,0) and this point (1,1,0) and draw an arrow head pointing to (1,1,0).

(1,1,0) is the point, the vector is this line with the arrowhead.

See the vector is pointing in a direction. It''s magnitude is the length of the line. (calculated by the distance formula between the points (1,1,0) and (0,0,0)).

Because the vector is this line, we can do a lot of meaningful operations on them. For example rotating the vector by 45 degrees will make it point straight up the y axis. It doesn''t make any sense to rotate a point, it will still lie at the same spot.

I hope that helps a bit. I didn''t do an vector math in school, so when i started to learn it by myself i remember having the trouble with what was the difference between a point and a vector, what do vectors do, all that stuff.

If u understand the above, then the next best step is probably to start learning about some operations like vector addition and subtraction. Even if u don''t fully get what i''ve written, then drawing the operations out on paper as you learn them may help to visualise vectors and understand them more and more.

##### Share on other sites
that's because a vector means more than one thing, position vectors and just plain vectors. A postio vector obviously is a point in space refering to a certain point in space, say 0,0,0 which is 0i+0j+0k in vector format. A standard vector is the directiony thingy. we'll take a point in space as P whihc is say 1i+1j+1k. the vector OA o being the origin is 1i+1j+1k as its the distance travelled from O to P. the magintude of the vector is the size of the vector. In 2d for example :

whoops they aren;t happy with ASCII art

and can be calculated using pythagarous(spl??) mag^2=i^2+j^2.

oh just to clarify there are several types of coordinate systems, two ones we are concerened with, cartesian and vector(and parametric but no one care about that ) cartesian is in(x,y,z) whilst vector is usually taken in the form (i+j+k)

[edited by - Foobat on November 19, 2002 10:21:04 AM]

[edited by - Foobat on November 19, 2002 10:24:28 AM]

##### Share on other sites
Sorry to be pedantic but that tutorial is wrong

"All vectors must start at the origin (0,0,0)"

which is in correct for example you have 2 position vectors A and B with position vectors 1i+1j+1k and 4i+4j+4k respectively. The vector AB clearly does start not from the origin. the vecotr AB is AO+OB. seee....

[edited by - Foobat on November 19, 2002 10:46:19 AM]

##### Share on other sites
Ill have a go at explaining vectors. Basically the vectors used in 3D rendering math are called cartecian vectors. Which means a vector can be defined by a x,y,z. So your probably thinking this is a point, to explain the diffrence ill give an example.
imagine the point <0,0,1>
and the vector <0,0,1>

the point is an actual point in space ( duh ), but the vector is actully pointing down the z-axis ( into the screen )so thats it direction. Its magnitude is is of 1.

Ok you know what a vector is now, ill show you the way I think of them. Now were gonna go to 2D to explain this. Let say you have the point <5,9> . You can draw a line to that point to show the vector. You relize that 5 means 5 points across the x-axis & 9 points up the y - axis. Draw lines from this point and you''ll have a triangle. when you hear right-angle triangle you should think trignometry & pythagoras theorem. By making it a triangle you can rotate the vector by doing this:
rember
hypotenuse^2 = a^2 + b^2 // Pythag theroem

therfor the hypotenuse for the <5,9> vector is:
=sqrt( 5^2 + 9^2 )
=sqrt( 25 + 81 )
=10.3

if you look back at the triangle I asked you to make that actully gives the magnitude of the vector. Now that you know the magnitude/hypotenuse you can rotate the vector using trig:
NewX=cos(RotationAngle)*10.3
NewY=sin(RotationAngle)*10.3

and that will rotate it anyway you want. The only other thing left is translation which is a simple:
NewX=x+translationX;
NewY=y+translationY;

Moving to 3D is just adding another dimension. If you ever get stuck take the equation down to 2D (ignore Z). If your stuck on that try 1D(ignore Y).

I hope this helped. I know it was alot. It would really be much better with pictures. If you really don''t get it I could write a little 1 page tutorial with pictures , but have a go at it. What I recon you should do is try make a 2D engine which just invovles having rendering 2D shapes rotating them and translating them.

WizHarD

##### Share on other sites
Right.. forgive me if I am really not getting this.. And you guys have been more help than I ever could of wished for so far. Thank-you, very much appreciated, all of you.

If I have a point,

4,4 and there is another point 10,6

the vector there is 6,2 , yes? because the vector, if relative to 4,4 would be the movement? Do I understand that correctly. The other values are vertices. So, being able to work out the length of the vector

sqrt(6 * 6 + 2 * 2)

What does that help me with? How does knowing how to manipulate that help me? What can getting the length of the vector help me with? I suppose I am just asking because I think that by asking questions you learn. And you guys all know what you are talking about. Thanks very much for the assistance.

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

=*=

1. 1
2. 2
Rutin
19
3. 3
4. 4
khawk
14
5. 5
A4L
13

• 13
• 26
• 10
• 11
• 44
• ### Forum Statistics

• Total Topics
633743
• Total Posts
3013644
×