Jump to content
  • Advertisement

Archived

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

angry

distance between vectors

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

If you intended to correct an error in the post then please contact us.

Recommended Posts

I haven''t done alot of maths lately which has made me fogot alot of things. However what I want to know is how to get the distance between vector and vector in 3D space. The idea I have looks something like this: |v3| = |(v2-v1)| Heh, I''m not good at writing math formulas, but hey it makes me look smarter So if you don''t understand it then: v3 = v2-v1; v3.length = sqrt(v3.x*v3.x+v3.y+v3.y+v3.z+v3.z); Is this correct?

Share this post


Link to post
Share on other sites
Advertisement
Distance between two vectors? Vectors are not fixed in space; they have magnitude and direction, but not position, so the concept of "distance" doesn''t seem to make much sense.

Share this post


Link to post
Share on other sites
correct, vectors do not have position so you can't have a distance between them. if you are talking about specific vectors anchored at specific points, then you just need to find the distance between the two points which is:

v = vector between 2 points
v = (p1.x - p2.x, p1.y - p2.y, p1.z - p2.z);
distance between the points = |v| = sqrt(v.x^2 + v.y^2 + v.z^2);

-me

[edited by - Palidine on November 11, 2003 11:46:39 PM]

Share this post


Link to post
Share on other sites
quote:

Distance between two vectors? Vectors are not fixed in space; they have magnitude and direction, but not position, so the concept of "distance" doesn't seem to make much sense.



I knew this would come up, and I thought about editing my post but I thought; "na, they can't be that priggish", well I was wrong.

quote:

You accidentally put "+" instead of "*" between the Y and the Z terms. Fix that, and you've got it.


typo

[edited by - angry on November 11, 2003 12:06:44 AM]

Share this post


Link to post
Share on other sites
Just for reference: Angel (Interactive Computer Graphics et al.) describes the difference between what you call a vector and a point as a true-vector and a position-vector.

A vector is simply a mathematical data structure - some people choose to think of it that way whilst others choose to think of it in more semantic terms: point and vector (where vector denotes a direction with magnitude). The fact is, if you regard a vector simply as a data structure then a vector can represent a position with respect to the origin in any 3D space.

Quite clearly, there are 2 schools of thought on this...

Share this post


Link to post
Share on other sites
Vectors do not even have to contain numbers! Vector spaces can be taken over lots of different fields.

Share this post


Link to post
Share on other sites
Just curious how you would define distance? Personally I would call distance a measure of how close two values are to one another. Also if a point is a position vector then how can there be a distance between points, but not vectors since a point is a vector.

Share this post


Link to post
Share on other sites
A point can be represented by a vector, but not the other way around. Distance can be defined in many ways ( in maths we call then metrics ), any distance or metric function must fulfil...

1) d(x,y) = 0 iff x = y
2) d(x,y) = d(y,x) for all x,y in the space
3) d(x,y) <= d(x,z) + d(z,y) for all x,y,z in the space

The Euclidean distance we most commonly use for vectors in an example of this

Share this post


Link to post
Share on other sites

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!