Path: news.mathworks.com!not-for-mail
From: <HIDDEN>
Newsgroups: comp.soft-sys.matlab
Subject: Re: compute tangent vector to a 3d mesh
Date: Thu, 22 Jan 2009 20:31:02 +0000 (UTC)
Organization: The MathWorks, Inc.
Lines: 26
Message-ID: <glal26$8d8$1@fred.mathworks.com>
References: <de7daa1b-7618-44b9-8a01-b52355ab1b9d@r36g2000prf.googlegroups.com> <41b15a45-2966-4691-9d5e-b4a8cf757605@x16g2000prn.googlegroups.com>
Reply-To: <HIDDEN>
NNTP-Posting-Host: webapp-03-blr.mathworks.com
Content-Type: text/plain; charset="ISO-8859-1"
Content-Transfer-Encoding: 8bit
X-Trace: fred.mathworks.com 1232656262 8616 172.30.248.38 (22 Jan 2009 20:31:02 GMT)
X-Complaints-To: news@mathworks.com
NNTP-Posting-Date: Thu, 22 Jan 2009 20:31:02 +0000 (UTC)
X-Newsreader: MATLAB Central Newsreader 1187260
Xref: news.mathworks.com comp.soft-sys.matlab:513262

antonietta <mangomengo@gmail.com> wrote in message <41b15a45-2966-4691-9d5e-b4a8cf757605@x16g2000prn.googlegroups.com>...
> .......
> What about if I want to compute the surface tangent pointing from
> point P toward a generic point Pext? If P=[x,y,z] is a mesh point,  C=
> [x0,y0,z0] is the center of mass and N is the surface normal at point
> P. Pext =[x_ext,y_ext,z_ext] is a generic point in the space. Pext is
> NOT a point  of the mesh. I'm interested in computing the surface
> tangent pointing from P toward the projection of Pext on the tangent
> PLANE (at point P).
> .......

  It's done just the same as with your center of mass.  It works for any point other than one along the line of the normal line through P.  This assumes you know the coordinates of this generic point, Pext.

  You don't need to fool around with the projection of Pext onto the tangent plane.  The cross(cross(N,Pext-P),N) takes care of that.  The inner cross(N,Pext-P) will yield a vector in the tangent plane and at right angles to the direction of that projection.  The second cross product

 cross(cross(N,Pext-P),N) 

then gives the desired vector in the tangent plane in the direction of that projection.  The cross product is a marvelous tool to use for such problems as this in three-dimensional space.

  If you need projection P2, in and of itself, you can do this

 P2 = Pext - dot(Pext-P,N)/dot(N,N)*N;

Roger Stafford