🎉 Celebrating 25 Years of GameDev.net! 🎉

Not many can claim 25 years on the Internet! Join us in celebrating this milestone. Learn more about our history, and thank you for being a part of our community!

Difference between a point and vector

Started by
15 comments, last by Mindwarp 22 years, 9 months ago
I am trying to understand the real difference between points and vectors... point is defined as: x,y,z right? vector is defined as: x,y,z? I have read a vector has a magnitude, which I really don''t understand.. but, I have been trying to figure this out for awhile now. Is it that if you define a vector, x,y,z, that it is a line that points to the origin? 0,0? Please help, Mindwarp
Advertisement
Vectors and points are very different things, they often seem similar to programmers because they are usually represented the same way in a programming context (a set of xyz coords). A point represents a location, a vector represents a direction and a magnitude. When you store a vector as x,y,z what you''re saying is that the vector represents the direction of a line beginning at 0,0,0 and ending at the point x,y,z with a magnitude of sqrt(x*x + y*y + z*z).

Another way of stating the difference is that because a vector is just a direction, the points where it begins and ends do not matter. The vector from 0,0,0 to x,y,z is the same as the vector from 1,1,1 to x+1,y+1,z+1 because their magnitudes and directions are the same. In programming you generally assume all vectors begin at 0,0,0 for simplicity.

In fact you don''t even need to use xyz coords to represent vectors, because you can represent direction in other ways, such as angles. But I don''t feel like going into much more depth about that because xyz coords are generally the most useful way to do vectors in programming land. Learning vectors in programming land sucks because they seem identical to points. Learn them in math land instead. Read about them on the web or in a book that is _not_ oriented towards programming and you''ll probably understand much better.

Hope that helps. I never really liked explaining math concepts in words.
A three dimensional point, containing x,y,z, and a 3d vector, containing x,y,z. The two structures contain the same information, and you could in fact use the same structure to store both.

The difference is mostly one of semantics. When speaking of points, we are normally speaking of an absolute location. When speaking of vectors, we are speaking of a change in something, usually position, but also velocity, acceleration, and so on.

You can describe a point in terms of a vector. You can say that it is a vector that describes how far away to move from the origin to place whatever you happen to be placing there. A point is a "position vector" when looked at in this way.

Here''s another example, using simpler vectors. Whenever anybody has trouble with 3d math and vectors, its always a good idea to look at something similar that follows the same rules.

The simplest vector and points with any meaning are one dimensional vectors and one dimensional points. These simple have an X value. They obey most of the same maths as higher order vectors. A point in 1d space might be 2. We all know where 2 is on the number line, and its an absolute position. A 1d vector would be something like +2. We can store the information the same way, but we use +2 to add to something else, whereas 2 just sits there on the number line.

Get off my lawn!

Vectors don''t have a location. They only represent a magnitude and a direction.

Points do not have a direction. They only represent a location with respect to some given fiducial point.

When you actually need to do calculations with points and vectors, you need to pick a coordinate system to refer to them in. If you happen to pick the cartesian coordinate system, you''ll be using x, y, z values to represent a point relative to the origin.

You''ll also be using x, y, z values to specify the components of your vectors. That is, if you were to place the "tail" of your vector at the origin, the components (x, y, z values) would specify where the "head" would be.

Remember, there''s always an underlying meaning to things like points and vectors. They''re not just an ordered set of three numbers.
quote: Original post by TANSTAAFL
The difference is mostly one of semantics.

...and here I was thinking that the difference was mostly one of mathematics!

Timkin

If we want to get completely mathematically technical (and i just though we were discussion the computer representations of POINT and VECTOR, rather than abstract mathematics), a point is just a zero dimensional object in n-space, and has not a damned thing to do with x,y,z or q, and a vector is a quantity defined by a magnitude and direction.

When we are storing "points" in structures, we aren''t actually storing the point itself, but rather describing its location in some sort of graduated n-space(typically a 2d or 3d cartesian grid).

...if you want to get really technical about it.

Get off my lawn!

Since vector is defined as an ordered pair of points (start, end), it has location. You can describe vectors by its magnitude, direction AND origin. You can also use vector coordinates which are defined as difference between end and start point coordinates. Similarity between point and vector representation is purely accidential.

K.
quote: Original post by Grudzio
Since vector is defined as an ordered pair of points (start, end), it has location.

K.


Your kidding right? You do not define a vector as a pair of points. Start, end? Thats irrelevent, vectors do NOT HAVE A LOCATION. Vectors written in column form use 3 numbers to represent the deltas on the 3 cartesian axis, or the scalars of the i, j and k vectors.
Vectors do NOT have location, that completely goes against the definition of vector spaces, which only have vectors and scalars, and no points. It''s as simple as that. To get points, you have to move into Affine space.

Heres the definition of a vector taken from a good book of mine:
"Physicists use the term vector for any quantity with direction and magnetude. Physical quantities such as velocity and force, are vectors. A vector does not, however have a fixed position."
If at first you don't succeed, redefine success.
Another way at looking at the difference is with matrix multiplication. If your engine uses points or vectors then its almost guarenteed to need to multiply them by matrices at some point.
Now a standard matrix with position, scaling and rotation is a 4x4 matrix and to multiply that with a vector or a point then it needs to be a 4-dimensional vector or point. Its easy enough however as we just covert our 3 dimensional vector (x,y,z) to a 4 dimensional vector (x,y,z,w) and then multiply.
Now here is where the difference lies, for a point in space we want to include the translational part of the matrix so we make the w component 1.0. For a vector, since it has no position we DONT want to include the translation of the matrix so for vectors we make the w component 0.0. (if you wish to work through the matrix multiplication by hand then you can see that making the w component zero really does mean the translational part of the matrix gets zeroed).
Other than that, in actual programming terms there is very little difference between the 2 and usually the same functions/structures are used for both.
Conceptually think of a point as exactly that, it defines an infinately small point in space. A vector however describes how to get from one point in space (usually but not exclusively the origin) to another point in space.
Not sure how clearly i have explained this but i hope you understand

quote: Original post by python_regious

Vectors written in column form use 3 numbers to represent the deltas on the 3 cartesian axis, or the scalars of the i , j and k vectors.


And how do you calculate those deltas?

quote:
Vectors do NOT have location, that completely goes against the definition of vector spaces, which only have vectors and scalars, and no points.


I am talking about geometry and you about algebra. Vector space definition only says that if V is v.s. then pair (V,+) creates group and if v belongs to V, then v multiplied by scalar k also belongs to V. The geometrical interpretation is that elements of v. s. V are vectors with origin in (0,0,0). So it does not go against vector location.

quote:
Heres the definition of a vector taken from a good book of mine:
"Physicists use the term vector for any quantity with direction and magnetude. Physical quantities such as velocity and force, are vectors. A vector does not, however have a fixed position."


But, actually, it matters where you apply force. Take rigid body for exapmle. Depending on where force acts the body will rotate and move differently.

K.

This topic is closed to new replies.

Advertisement