![]() |
| | #1 |
| Registered User Join Date: Dec 2001
Posts: 47
| Points, vectors, matrices Right along with this is the difference between vectors and real values. Are real values points? I know dot products give you real values, and cross products give you another vector. Next is vectors to matrices. How a vector becomes a 3x3 matrix or what is contained in a 3x3 matrix is beyond me. And yes, I have books. They detail formulas out very nicely. But the holes in their explanations are described above. I mainly see sections on points, vectors, and matrices. But not how they go together or even if they do. This may be a lot of questions for one post, but then again, they may all get answered in one sentence. I don't know. If you know the answer to any or all, please point me in the right direction. subnet_rx "There are two types of langages, those that everyone *****es about, and those that no one uses." Last edited by subnet_rx; 01-02-2002 at 07:59 PM. |
| subnet_rx is offline | |
| | #2 |
| Registered User Join Date: Sep 2001
Posts: 752
| Hmm, I hope I correctly understand what you're asking here. From any vector in n dimensions, you can represent the magnitude of that point with one dimension, and the direction in in n-1 directions. For example, we might change the expression... (3, 4) (Cartesian) to (5, ACOS(3 / 5)) (Polar) These are how we traditionally represent vectors, although really any means that we can use as acceptable. For example, we might not want to use the ACOS(), we could just as well use... (5, 3/5) (Fantasy System) Which obviously conveys as much information as the prior ones (although such a system might have difficulty representing say, a .1degree angle) For 3-dimensional coordinates, we do largely the same thing... (2, 3, 6) (Cartesian) to (7, ACOS(2/7), ACOS(3/7)) (Polar) From any point, we can get a direction, and how many dimensions it takes to represent that direction is the number of dimensions of the point - 1 But that is all just coordinate systems. A vector doesn't have to be a magnitude and a direction, just as a point doesn't have to be rectangular coordinates. The only real difference in points and vectors is how they are used. For example, in telling the temperature, we would use a one-dimensional point... It is 75 degrees outside. (This is a point, 75) The temperature difference between outside and inside is 20 degrees. (This is a vector, 20) The difference between a point and a vector really is just a matter of context. You can change all your points to vectors from the origin and it won't make an ounce of difference. As for matrix multiplication and vectors... well, let's say I have a pyramid (4 sides, 4 corers) figure that I want to represent as 4 vectors (each vector will be pointing at a corner) These are the vectors... (2, 3, -5), (-2, 5, 6), (1, -4, 4), and (3, 4, -5) Notice that having the vectors point at the corners is one way in which we can represent any polygon as a set of vectors. Now if I want to turn this set of 4 3-dimensional vectors into a matrix, I just represent them vertically and put 'm next to each other... Code: //Matrix here... ( 2, -2, 1, 3) ( 3, 5, -4, 4) (-5, 6, 4, 5) // Each column is a vector, read from top to bottom Code: ( 1, 0, 0) ( 0, 0, -1) ( 0, 1, 0) There are some properties affecting vectors as matrices. First off, for every vector that goes into the equation, a vector will come out. The dimension of the vectors may change, for example, we might pass 3 dimensional vectors to be operated on, and come out with 4 dimensional, or even 1 dimensional vectors, but the number of vectors will not change. Second, when we run together the vectors like this, the vectors don't affect each other. The only reason we clump them together for matrix multiplication is that since we're usually performing the same operation on all the vectors representing a polygon, it's efficient to just perform all the operations at once.
__________________ Callou collei we'll code the way Of prime numbers and pings! Last edited by QuestionC; 01-03-2002 at 03:26 AM. |
| QuestionC is offline | |
| | #3 |
| Registered User Join Date: Dec 2001
Posts: 47
| yep, that's what I needed to know. Thanks a lot. One more question about a code example. for (xIdx = 0; xIdx < 36; xIdx++) // x-direction { for (yIdx = 0; yIdx < 18; yIdx++) // y-direction { // calculate texture coordinates for current quad texLeft = float(xIdx) / 35.0f; // left texture coordinate texBottom = float(yIdx) / 18.0f; // bottom texture coordinate texRight = float(xIdx+1) / 35.0f; // right texture coordinate texTop = float(yIdx+1) / 18.0f; // top texture coordinate Can someone tell me why they are dividing by 35 and 18 here? This is a 36x20 field of points. Last edited by subnet_rx; 01-03-2002 at 10:36 AM. |
| subnet_rx is offline | |
| | #4 | ||
| Registered User Join Date: Aug 2001 Location: Cairo, Egypt
Posts: 128
| Quote:
0 == xldx : texLeft = 0 35== xldx : texLeft = 1 texRight is texLeft + 1/35 always 0 == yldx :texBottom = 0 17 == yldx: texBottom = 1 textTop is textBottom + 1/18 always The texture coordinates for many systems are taken in the range of 0 - 1, the guy adjusted the code to achieve that. (Although it range from 0 - 1 1/35 & 0 - 1 1/18 here) ===================================== Intro to 3D graphics programming articles I - V (1 - 5) :http://www.gamedev.net/reference/art...article795.asp Matrix & Quaternion Faq : http://skal.planet-d.net/demo/matrixfaq.htm Quote:
Everyone (except GL) I've seen uses the other mode where : Code: (x , y , z , w) // Unit Vector of X axis (x , y , z , w)// Unit vector of Y axis (x , y , z , w)// Unit vector of Z axis (x , y , z , w)// Origin of coordinate system Here is a rotation by 90 degree around Y axis matrix (Z increases into the screen, Y increases upwards, X increases to the right : i.e A left hand system) Code: ( 0 , 0 , 1 , 0) // X axis now points into the screen ( 0 , 1 , 0 , 0) // Y axis unmodified ( -1, 0 , 0 , 0 )// Z axis points to the left (-ve old X) ( 0 , 0 , 0 ,1)// Origin is as is Paul nettle has made some nice explanation of matrices at : http://www.flipcode.com/cgi-bin/msg....m=askmid&id=-1 He did it in his Ask midnight column on flipcode.com
__________________ Muhammad Haggag | ||
| Coder is offline | |
| | #5 |
| Registered User Join Date: Aug 2001 Location: Cairo, Egypt
Posts: 128
| 3DICA22 : http://www.programmersheaven.com/sea...sp?FileID=6223 This is the best 3D mathematics & graphics tutorial I've seen. It'll explain the vectors, matrices as well as some other subjects - although not in complete detail - enough to get you started. Don't forget to visit www.gamedev.net , look at their articles sections : Graphics & Math
__________________ Muhammad Haggag |
| Coder is offline | |
| | #6 |
| Registered User Join Date: Dec 2001
Posts: 47
| yeah, I found one very good article on one guys view of matrices, and it told me a lot. My biggest problem is seeing the big picture. I can look at each piece of code and see what it is doing, but when I picture the entire process in my mind, I lose track. Thanks for the great explanations. |
| subnet_rx is offline | |
| | #7 |
| Blank Join Date: Aug 2001
Posts: 1,034
| A point is a vector. Here is an online linear algebra textbook. http://www.math.unl.edu/~tshores/linalgtext.html You should be able to make your way through most of it without calculus. |
| Nick is offline | |
| | #8 |
| Registered User Join Date: Dec 2001
Posts: 47
| It may actually be different in linear algebra, but in 3D, a point isn't a vector. A vector is the displacement between two points and unlike a point, does not have a fixed position in space. Although, you cannot tell them apart unless you start dealing with a fourth component of a vector, called a homogeneous coordinate. Umm, how'd I do? Am I learning? |
| subnet_rx is offline | |
| | #9 |
| .... Join Date: Aug 2001 Location: Groningen (NL)
Posts: 2,386
| Also in linear algebra a point isn't a vector. A vector has size and direction. A vector may be rotated in a vector-space. The way you can move the vector depends on the dimension of the space (1D, 2D, 3D, 4D etc.). |
| Shiro is offline | |
| | #10 |
| Blank Join Date: Aug 2001
Posts: 1,034
| A vector is basically for most purposes is just a list of numbers. Talking about a displacement vector d means admitting that a point is a vector. p' = d + p Which is vector addition. The magnitute and direction you can find by converting the point into polar coordinates. I was first tought how to add vectors by adding simple position vectors on paper. The book on the internet isn't as easy to read as the one I have in print but you can read the section about spanning sets, vector spaces, bases and dimensions. |
| Nick is offline | |
| | #11 |
| Blank Join Date: Aug 2001
Posts: 1,034
| Also another common use for vectors is the coefficents of a linear equation. Talking about magnitudes and direction here would be meaningless but you still can find a magnitute and direction. |
| Nick is offline | |
| | #12 | |
| Registered User Join Date: Sep 2001
Posts: 752
| Quote:
. Sorry about things I might have gotten wrong, I only really know linear algebra, but it isn't really that big a jump to see how you can do the same with 3d objects.
__________________ Callou collei we'll code the way Of prime numbers and pings! | |
| QuestionC is offline | |
| | #13 | |
| Registered User Join Date: Dec 2001
Posts: 47
| Quote:
| |
| subnet_rx is offline | |
| | #14 |
| Guest
Posts: n/a
| Point really isn't a vector. Not even in linear algebra. The vector as it's usually used in 3D graphics isn't the same as vector in linear algebra, but it's a "free vector" as we call it in Czech, because you can place it anywhere and it doesn't change its coordinates. Point is an abstract entity built over a 3D vector space. |
|
| | #15 |
| Blank Join Date: Aug 2001
Posts: 1,034
| But when you say 3D vector space your talking about a set of vectors (or in this case points) {span ((1, 0, 0), (0, 1, 0), (0, 0, 1)) } Ok I give up. A point isn't vector but a point can be represented as a vector. |
| Nick is offline | |
![]() |
| Thread Tools | |
| Display Modes | |
|
Similar Threads | ||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Help it won't compile!!!!! | esbo | C Programming | 58 | 01-04-2009 03:22 PM |
| I'm so close to finishing this...please help with logic error | crazychile | C Programming | 8 | 11-03-2008 09:48 PM |
| Vectors | naseerhaider | C++ Programming | 11 | 05-09-2008 08:21 AM |
| Yahtzee C++ programme help | kenneth_888 | C++ Programming | 13 | 09-05-2007 02:14 PM |
| CProg Fantasy Football version pi | Govtcheez | General Discussions | 155 | 12-26-2006 04:30 PM |