Checking for parallel vectors  something is wrong.

03252016, 11:47 AM
Post: #1




Checking for parallel vectors  something is wrong.
Hi there
In a code I'm working, at some point I have two vectors with these values: Vec: {0.0,1.0,0.0} VecRef: {1.0,0.0,0.0} and by computing the dot product e3d_vec:dot(Vec, VecRef) it's returning 0.0 (zero). By the Dot Product definition, I was expecting to get a value other than zero. It should happens only if both vectors were parallel to each other. (Am I wrong?) The two vectors cannot be parallel, so I test this value to try fix that  I need them to be perpendicular each other, being the Vec1 the reference one. Just in case needed, here is the code where I use it: Code: force_perpendicular(Vec, VecRef) > Any idea about what is wrong? My Wings3D Collection at G+ 

03252016, 11:43 PM
(This post was last modified: 03252016 11:49 PM by ggaliens.)
Post: #2




RE: Checking for parallel vectors  something is wrong.
More often than not ... if I need two vectors to be perpendicular ... I used the e3d_vec:cross( ) in order to ensure that.
For example ... I have a single vector ... and I need any of its perpendiclar vectors (family of vectors) ... I can take Vector A compute any old random vector which is not equal to A .... call it B. C = Then e3d_vec:cross(A,B) C will be perfectly perpendicular to A by definaition. And then you could of course compute the third mutually perp B prime B2 using {A,C} Not sure if this helps at all. If you believe MathcWorld ... then the ZERO VALUE for perpendiculars is correct. So e3d_vec seems correct. 

03252016, 11:58 PM
Post: #3




RE: Checking for parallel vectors  something is wrong.
The random vector doesn't interest me.
As I said, I have two vector  set by the user, where one is the reference and then I want to ensure the second one must be rotated from it by 90°. For that I'm using the cross operation  of course. I think I'm going to computer the degree between them. It will be a little more expensive computationally, but I will be sue about what I'm evaluating. Thanks. My Wings3D Collection at G+ 

03262016, 05:11 AM
Post: #4




RE: Checking for parallel vectors  something is wrong.
How could e3d_vec:degrees used one time
on user inputs be "expensive" ? I don't get it. Used in a big loop. Yes. Used 1000 times. Almost instant. 

03262016, 05:25 AM
Post: #5




RE: Checking for parallel vectors  something is wrong.
Not much I know. That is why I used "little".
As I'm going to use that during preview mode, I tend to use the "shortest path" I can take. Anyway, I need to go ahead and I will not spend time here. Thanks again. My Wings3D Collection at G+ 

03272016, 12:51 PM
Post: #6




RE: Checking for parallel vectors  something is wrong.
""By the Dot Product definition, I was expecting to get a value other than zero. It should happens only if both vectors were parallel to each other. (Am I wrong?)"
Yes ... you were wrong. 

03272016, 03:03 PM
Post: #7




RE: Checking for parallel vectors  something is wrong.
Yeah. I know now.
For some reason I read and understood this text in the wrong way : Quote:The dot product gives us a very nice method for determining if two vectors are perpendicular and it will give another method for determining when two vectors are parallel. Note as well that often we will use the term orthogonal in place of perpendicular.ref. link The Cross product have the behaviour I wanted: Quote:Now, let’s address the one time where the cross product will not be orthogonal to the original vectors. If the two vectors, and , are parallel then the angle between them is either 0 or 180 degrees. From (1) this implies that,ref. link Sometimes, to learn, we need to know where we are going wrong. Not only that we are wrong. My Wings3D Collection at G+ 

03282016, 11:48 AM
Post: #8




RE: Checking for parallel vectors  something is wrong.
orthogonal means perpendicular ... but you probably got that down by now.


« Next Oldest  Next Newest »

User(s) browsing this thread: 1 Guest(s)