Path: news.mathworks.com!not-for-mail From: "Mahsa " <newsreader@mathworks.com> Newsgroups: comp.soft-sys.matlab Subject: How to rotate a (3-D) line in a plane by an angle of theta about the point of origin ? Date: Fri, 20 May 2011 15:56:05 +0000 (UTC) Organization: The MathWorks, Inc. Lines: 10 Message-ID: <ir62ul$31b$1@newscl01ah.mathworks.com> Reply-To: "Mahsa " <newsreader@mathworks.com> NNTP-Posting-Host: www-04-blr.mathworks.com Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit X-Trace: newscl01ah.mathworks.com 1305906965 3115 172.30.248.35 (20 May 2011 15:56:05 GMT) X-Complaints-To: news@mathworks.com NNTP-Posting-Date: Fri, 20 May 2011 15:56:05 +0000 (UTC) X-Newsreader: MATLAB Central Newsreader 2882983 Xref: news.mathworks.com comp.soft-sys.matlab:727890 Hello All, I have rays traveling in different directions, hitting spherical bubbles and moving on. However, upon hitting the bubbles, the direction of rays changes by an angle theta with respect to the normal at the point of intersection (ray with bubble). Despite the direction change, the new ray should be in the same plane as the original ray which as well passes through the center of the bubble. I have the equation of the original ray as I have the point (P1) and direction of emission, I calculate the point of intersection (P2) with the sphere. I know the center of the bubble (Pc), hence I have the equation of the plane as well . I also write an equation for the normal to the sphere at the point of intersection (Pc-P2), which I would like to rotate with an angle theta that I calculate elsewhere about point (P2). I do not know how to ask Matlab to calculate the equation of the new ray? Specially since this should happen in a loop, I can not do the calculation on pen and paper for once on pen and paper and be over with it On pen and paper, I make use of orthogonality of the normal to the plane of rays and the new ray and the angle theta (dot product) between the normal and the new ray and guessing a value for x for an unknown point, I calculate one point on the new line (ray). There should be a way to do it simpler and I was wondering if anyone knows something that could help me. Thanks in advance. Regards, Mahsa.