Re: Normal vector on a surface
- To: mathgroup at smc.vnet.net
- Subject: [mg29294] Re: Normal vector on a surface
- From: Albert Retey <albert.retey at visualanalysis.com>
- Date: Tue, 12 Jun 2001 04:18:16 -0400 (EDT)
- Organization: Visual Analysis AG
- References: <9fsil6$so5$1@smc.vnet.net>
- Sender: owner-wri-mathgroup at wolfram.com
Hi Matthias, > Now I want to calculate (how?) and draw (how?) several "Normalenvektors" > (sorry, I do not know the English termini technici) which should sit smugly > - like palisades - on the plane tangential to the surface. I think it is as simple as "normal vector" :-) > The "Normalenvektor" N in point P - according to Bronstein-Semendjajew - is > a unity vector perpendicular to the tangential plane; its accompanying > vectors e1 and e2 on the plane form a "right-handed system". N, e1 and e2 > are referred to as the "accompanying tripod". - I understand the words but > not their meaning. One simple way to determine the normal vector of a surface is to find two (linear independent) tangential vectors to the surface. Then find a vector that is perpendicular to those two and has length one. If you have expressed the surface as z=z[x,y], as in your case, the most simple choice for the two tangential vectors is the ones in "x-" and "y-direction", that is e1 and e2 (If you choose other coordinates, e1 and e2 might change, but not the normal vector). The fact that these three vectors should form a right-handed-system is then just a convention, because there are actually two choices of sign: for your surface the normal vectors could either point "up" or "down". Here is a simple way to calculate and visualize the normal vectors of your surface (basically using the definitions in Bronstein): In[200]:= surf[x1_,y1_]:= 19.74211746962547-61.78321746073334*x1+70.84823523445556* x1^2-34.64681309362152*x1^3+5.822595947190386*x1^4-61.783217460733795* y1+188.56171712734522*x1*y1-208.7457484391798*x1^2* y1+99.21114279328117*x1^3*y1-16.223098505477388*x1^4* y1+70.8482352344551*y1^2-208.7457484391805*x1*y1^2+225.08774661852397* x1^2*y1^2-103.5151716236312*x1^3*y1^2+16.351931921608763*x1^4* y1^2-34.64681309362163*y1^3+99.21114279328117*x1* y1^3-103.51517162363109*x1^2*y1^3+45.654124756950296*x1^3* y1^3-6.928857192755963*x1^4*y1^3+5.822595947190411* y1^4-16.22309850547743*x1*y1^4+16.351931921608763*x1^2* y1^4-6.928857192755952*x1^3*y1^4+1.0137658500940734*x1^4*y1^4; In[202]:= surfplot= Plot3D[surf[x,y],{x,1,3},{y,1,3},PlotRange->All,PlotPoints->100, Mesh->False]; (* This are the tangential vectors r_u and r_v in Bronstein, for the special case u=x and v=y *) In[203]:= rx[x_,y_]:={1,0,D[surf[x,y],x]} ry[x_,y_]:={0,1,D[surf[x,y],y]} (* the cross product (will be perpendicular to rx and ry) *) In[205]:= rxcrossry[x_,y_]:=Cross[rx[x,y],ry[x,y]] (* divide by length for normalization *) In[206]:= normalvector[x_,y_]:= Evaluate[rxcrossry[x,y]/Sqrt[rxcrossry[x,y].rxcrossry[x,y]]] (* make a table of normal vectors in the form appropriate for ListPlotVectorField *) In[207]:= normvectable= Flatten[Table[{{xx,yy,surface[xx,yy]},normalvector[xx,yy]},{xx,1,3, 0.3},{yy,1,3,0.3}],1]; In[208]:= <<Graphics`PlotField3D` In[209]:= ?ListPlotVectorField3D "ListPlotVectorField3D[{{pt,vec},...},(options)] plots a list \ of vectors in three dimensions, each vector based at a corresponding point \ pt." (* I tried to make the plot look somewhat better by scaling the length and plot the vectors in red = Hue[1] *) In[210]:= normvecplot=ListPlotVectorField3D[normvectable,VectorHeads->True, ScaleFactor->0.3,ColorFunction->(Hue[1]&)]; In[211]:= Show[surfplot,normvecplot,AspectRatio->1]; You will see that the vectors plotted do not exactly meet what you probably expect concerning perpendicularity, I guess it should be possible to find a ViewPoint that makes the plot look somewhat better... Hope that helps, Albert -- Visual Analysis AG Internet: www.visualanalysis.com Neumarkter Str. 87 Telefon: 089 / 431 981 36 D-81673 Muenchen Telefax: 089 / 431 981 1