[R] vector normal to a plane

Uwe Ligges ligges at statistik.uni-dortmund.de
Fri May 28 22:40:22 CEST 2004


wwsprague at ucdavis.edu wrote:
> Hi All,
> 
> (I have a degree in math, but I am too embarassed to ask my colleagues, 
> so here goes:)
> 
> I would like to get a vector normal (orthogonal) to a plane formed by 
> two other vectors.  In matlab I do this:
> 
> v1 = [.4, .6, .8]; v2 = [.9, .7, .2]; nn = cross(v1,v2) (gives ~[-.48, 
> .65, -.24]

Huh?

I don't have access to Matlab. Can you tell me how cross() is defined in 
Matlab (it's not obvious to me - at least not at 10:40 pm - how can 
anything get negative)?


> 
> if I do R> cross(v1, v2), I get .94.  Huh?

Ha! ;-)

crossprod(v1, v2):
0.4*0.9 + 0.6*0.7 + 0.8*0.2 = 0.94

Uwe Ligges



> Thanks for all your help, again.
> 
> W
> 
> ______________________________________________
> R-help at stat.math.ethz.ch mailing list
> https://www.stat.math.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide! 
> http://www.R-project.org/posting-guide.html




More information about the R-help mailing list