Path: news.mathworks.com!not-for-mail
From: "Sebastian " <sebastianpszczolka@gmail.com>
Newsgroups: comp.soft-sys.matlab
Subject: Re: 3-D Plane Intersection: using intersection as  x-axis for 2-D plots on each plane
Date: Mon, 9 Jan 2012 20:39:09 +0000 (UTC)
Organization: The MathWorks, Inc.
Lines: 46
Message-ID: <jefj9d$g3m$1@newscl01ah.mathworks.com>
References: <je91u0$2ld$1@newscl01ah.mathworks.com> <jea5rc$di8$1@newscl01ah.mathworks.com> <jea7jl$ifo$1@newscl01ah.mathworks.com> <jeahid$gtm$1@newscl01ah.mathworks.com> <jebmn4$1g1$1@newscl01ah.mathworks.com> <jec7j4$ij0$1@newscl01ah.mathworks.com> <jecp5k$8ft$1@newscl01ah.mathworks.com> <jed6qg$grf$1@newscl01ah.mathworks.com> <jee4sc$bnd$1@newscl01ah.mathworks.com> <jefb2t$g55$1@newscl01ah.mathworks.com>
Reply-To: "Sebastian " <sebastianpszczolka@gmail.com>
NNTP-Posting-Host: www-01-blr.mathworks.com
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 8bit
X-Trace: newscl01ah.mathworks.com 1326141549 16502 172.30.248.46 (9 Jan 2012 20:39:09 GMT)
X-Complaints-To: news@mathworks.com
NNTP-Posting-Date: Mon, 9 Jan 2012 20:39:09 +0000 (UTC)
X-Newsreader: MATLAB Central Newsreader 3089754
Xref: news.mathworks.com comp.soft-sys.matlab:754213

"Roger Stafford" wrote in message <jefb2t$g55$1@newscl01ah.mathworks.com>...
> "Sebastian " <sebastianpszczolka@gmail.com> wrote in message <jee4sc$bnd$1@newscl01ah.mathworks.com>...
> > Thank you a lot. It is very helpful to understand how to do this.
> > I am new with that problem Can you give me simple example how to use this code because I tried did this in my way and I failed. 
> > Thank You a lot.
> - - - - - - - - -
>   Sebastian, I have a correction to make in yesterday's explanation.  Where I said "make u1, v1, and w1 row vectors" and "T1=[u1;v1;w1];" I should have said:
> 
>   "If we agree to make u1, v1, w1, P, and Q all column vectors, we can write the matlab expression
> 
>  T1 = [u1,v1,w1];"
> 
> My previous T1 was the inverse of what it should have been.  My apologies.
> 
>   As to your question about the formula for P0, what is the problem you have with it?  I did test it carefully and it is correct.  It consists of a numerator which is the difference between two vectors, and a scalar in the denominator.  In matlab it would be more efficient to write it like this:
> 
>  t = cross(N1,N2);
>  P0 = (cross(N2,t)*dot(N1,A1)-cross(N1,t)*dot(N2,A2))/dot(t,t);
> 
> It is easy to see that this satisfies the three required equations.
> 
>   You have asked for an example of this.  Suppose you wish to exhibit, three dimensionally, a plot of Y1 = sin(X1) for 0 <= X1 <= 2*pi on plane #1.  I'll generate two planes randomly.
> 
>  N1 = randn(3,1); A1 = randn(3,1); % The first plane
>  N2 = randn(3,1); A2 = randn(3,1); % The second plane
>  n = 200;
>  X1 = linspace(0,2*pi,n);
>  Y1 = sin(X1); % The sine function on plane 1
>  Z1 = zeros(1,n); % Place it on the plane
>  Q1 = [X1;Y1;Z1];
>  
>  t = cross(N1,N2);
>  P0 = (cross(N2,t)*dot(N1,A1)-cross(N1,t)*dot(N2,A2))/dot(t,t);
>  u1 = t/norm(t); % Get three orthogonal unit vectors
>  w1 = N1/norm(N1);
>  v1 = cross(w1,u1);
>  T1 = [u1,v1,w1]; % Prepare the transformation matrix
>  P = bsxfun(@plus,T1*Q1,P0); % Sine curve in three dimensions
>  plot3(P(1,:),P(2,:),P(3,:)) % Plot it
>  
>   (Note that instead of troubling to generate the zeros in Z1, you could just as well eliminate the third column of T1 and the third row of Q1.)
> 
> Roger Stafford


Thank you it is great