Path: news.mathworks.com!not-for-mail
From: <HIDDEN>
Newsgroups: comp.soft-sys.matlab
Subject: Re: Matlab - transformation matrix - what is wrong?
Date: Fri, 18 Nov 2011 16:04:11 +0000 (UTC)
Organization: Xoran Technologies
Lines: 12
Message-ID: <ja5vlr$5g8$1@newscl01ah.mathworks.com>
References: <ja3d4u$o8j$1@dont-email.me> <ja3hvg$2to$1@newscl01ah.mathworks.com> <ja55if$3uf$1@dont-email.me> <ja5tit$r9n$1@newscl01ah.mathworks.com>
Reply-To: <HIDDEN>
NNTP-Posting-Host: www-06-blr.mathworks.com
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 8bit
X-Trace: newscl01ah.mathworks.com 1321632251 5640 172.30.248.38 (18 Nov 2011 16:04:11 GMT)
X-Complaints-To: news@mathworks.com
NNTP-Posting-Date: Fri, 18 Nov 2011 16:04:11 +0000 (UTC)
X-Newsreader: MATLAB Central Newsreader 1440443
Xref: news.mathworks.com comp.soft-sys.matlab:749781

"Matt J" wrote in message <ja5tit$r9n$1@newscl01ah.mathworks.com>...
>
> If that's all you require, why not use two cross products, as follows
> 
> if ~isequal(xvec,[1 0 0])
===============

That should be

if norm(xvec,[1,0,0])

And, obviously, you may want to modify the code to account for the cases where xvec is very close to the x-axis, but doesn't coincide with it.