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$>
References: <> <>
Reply-To: <HIDDEN>
Content-Type: text/plain; charset="ISO-8859-1"
Content-Transfer-Encoding: 8bit
X-Trace: 1232656262 8616 (22 Jan 2009 20:31:02 GMT)
NNTP-Posting-Date: Thu, 22 Jan 2009 20:31:02 +0000 (UTC)
X-Newsreader: MATLAB Central Newsreader 1187260
Xref: comp.soft-sys.matlab:513262

antonietta <> wrote in message <>...
> .......
> 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


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