Hello. I have attached an image that explains what I'm trying to accomplish. I have a vector, whose coordinates and magnitude (length) are known, and I'd like to calculate the coordinates of a point laying along the vector direction, as shown in the image. Is that possible?
Thanks for any help.
Find point along vector direction
if you already know the length just divide by that length and then multiply by n. That will give you a vector with the same direction but length n.
what japro said.
Depending on the orientation of your direction vector w, you either end up at point p1, or p2 with
Depending on the orientation of your direction vector w, you either end up at point p1, or p2 with
what japro said.
Depending on the orientation of your direction vector w you'll end up at either point p1 or point p2, with
where |w| is the length of your vector w.
Since you can go along the direction vector w in either orientation, both p1 and p2 are points at a distance n from A.
p2 is the point you describe in your sketch (against the orientation of w, hence the minus).
Depending on the orientation of your direction vector w you'll end up at either point p1 or point p2, with
where |w| is the length of your vector w.
Since you can go along the direction vector w in either orientation, both p1 and p2 are points at a distance n from A.
p2 is the point you describe in your sketch (against the orientation of w, hence the minus).
In the vector library I'm using there is no vector division operator, so I was wondering if a division performed like this is correct:
vector3_t initialVector;
vector3_t resultingVector;
resultingVector.x = initialVector.x/initialVector.Length();
resultingVector.y = initialVector.y/initialVector.Length();
resultingVector.z = initialVector.z/initialVector.Length();
Thanks
vector3_t initialVector;
vector3_t resultingVector;
resultingVector.x = initialVector.x/initialVector.Length();
resultingVector.y = initialVector.y/initialVector.Length();
resultingVector.z = initialVector.z/initialVector.Length();
Thanks
In the vector library I'm using there is no vector division operator, so I was wondering if a division performed like this is correct:
vector3_t initialVector;
vector3_t resultingVector;
resultingVector.x = initialVector.x/initialVector.Length();
resultingVector.y = initialVector.y/initialVector.Length();
resultingVector.z = initialVector.z/initialVector.Length();
Thanks
As long as initialVector.Length() != 0 that is correct, but there's probably a normalize() function in there that'll do the same job and maybe even more efficiently.
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement