Jump to content
  • Advertisement
Sign in to follow this  
guyaton

find a vector perpendicular to vector

This topic is 5404 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

Advertisement
Very simple mathamatics here, all you need to is find the slope of the vector (& the midpoint if you are talking about line segments), then multiply the slope by -1.

Share this post


Link to post
Share on other sites
this is only possible in 2 dimensions, in which case its a simple matter of rotating the vector 90 deg, which can be done like this:

output.x = -input.y;
output.y = input.x;

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
Quote:
Original post by Eelco
this is only possible in 2 dimensions

It is certainly possible in 3D, only the solution will be any vector lying in a plane perpendicular to the original vector.

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
say your vector is v(x, y, z)
easy take and arbitrary vector say r(y, z, x)

the the cross product will generate a vector perpedicular to both

p = cross (v, r)

further more anorther cross product and to get the basis for cordenate system

t = cross (v * p)

know you have not one but two vectors perpendicular to the first,

Share this post


Link to post
Share on other sites
Given (x,y,z) then (-(y*y+z*z)/x,y,z), (x,-(x*x+z*z)/y,z) and (x,y,-(x*x+y*y)/z) are all orthogonal (perpendicular) to it assuming x, y nor z are zero. If (x,y,z)=(0,0,0) then any vector is orthogonal to it. If (x,y,z)!=(0,0,0) then at least one component is not zero so one of the three vectors will work.

Share this post


Link to post
Share on other sites
Quote:
Original post by Anonymous Poster
Quote:
Original post by Eelco
this is only possible in 2 dimensions

It is certainly possible in 3D, only the solution will be any vector lying in a plane perpendicular to the original vector.

so the solution to the 3d version of the problem is a plane, not a vector. no unique solution might aswell be no solution at all for all practical intents and purposes.

Share this post


Link to post
Share on other sites
Quote:
Original post by Anonymous Poster
say your vector is v(x, y, z)
easy take and arbitrary vector say r(y, z, x)

the the cross product will generate a vector perpedicular to both
...


So do not choose r == v by accident, since the result will be vector (0/0/0).

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
Quote:
Original post by Eelco
so the solution to the 3d version of the problem is a plane, not a vector. no unique solution might aswell be no solution at all for all practical intents and purposes.

Wrong, since the question was simply to find a vector perpendicular to the first, not to find the ONLY vector perpendicular to the first. There can very well be a practical purpose to finding such a vector. (Btw, the 2D case does not give a unique solution either, even though they all lie along the same line.)

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

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

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!