MathGroup Archive 2005

[Date Index] [Thread Index] [Author Index]

Search the Archive

Re: Normal Disappear Problem

Of course the sphere has a normal everywhere, but that doesn't mean a given method of computing the normal WORKS everywhere.

normVec[f_][u__] :=
  Block[{vars =
       Table[Unique["x"], {Length@{u}}], result}, result =
         Cross @@ Transpose[D[f @@ vars, {vars}]] /. Thread[vars -> {u}];
     Remove @@ vars;
f[u_, v_] = {Cos[u]Sin[v], Sin[u]Sin[v], Cos[v]};
normVec[f][u, v]

   (-Cos[u]^2)*Cos[v]*Sin[v] -

(I haven't normalized, but neither did you.)

If you substitute u = v = 0, that's certainly the zero vector:



Now consider the vectors used in the cross product:

showCross[f_][u__] := Block[{vars = Table[Unique["x"], {
         result}, result = cross @@ Transpose[D[f @@ vars, {vars}]] /. Thread[
       vars -> {u}];
     Remove @@ vars;


Clearly, that cross product is zero. But why is the first vector all zeroes?

Well, it's simply because:

D[f[u, v], {u}]
% /. v -> 0

{-Sin[u] Sin[v],Cos[u] Sin[v],0}


And that's for ALL values of u, so:



That doesn't look good, but think about it. You started with a "parameterization" of the unit sphere. But it's not a one-to-one mapping:



If the parameterization f is no good at a point, the normal can't be computed using f at that point.

Normalizing reveals the problem in a different way:

#/#.# &@normVec[f][u, v] // TrigExpand
% /. v -> 0



Everything fails when v = 0.

So.... What's the simpler, better method?

Normalizing actually helps:

#.# &@normVec[f][u, v] // TrigExpand // FullSimplify


normVec[f][u, v]/Sin[v] // TrigExpand

{-Cos[u] Sin[v], -Sin[u] Sin[v], -Cos[v]}

We'd probably reverse the sign, and get



In other words, the (outward-pointing) normal at f[u,v] is just f[u,v].


On Fri, 18 Mar 2005 05:35:18 -0500 (EST), gouqizi.lvcha at <gouqizi.lvcha at> wrote:

> Hi, All:
> I have the following parametric equation for an unit sphere:
> x = cos(u)sin(v)
> y = sin(u)sin(v)
> z = cos(v)
> 0<=u<2*Pi ; 0<=v<=Pi
> Then I use
> normal = (Dx/Du, Dy/Du, Dz/Du) CROSS (Dx/Dv, Dy/Dv, Dz/Dv) to get the
> normal vector.
> I get the follwoing after calculation (with normalization):
> normal =  [sin(v) ^2 cos(u), sin(v)^2  sin(u), cos(u)^2  cos(v) sin(v)
> +  sin(u)^2  cos(v) sin(v)]
> Now when u=0, v=0 , Normal = (0,0,0)! How can it be? We know the fact
> that a sphere should have normal everywhere.
> Rick

DrBob at

  • Prev by Date: plotting weighted graphs
  • Next by Date: Re: Re: J/Link problem on Mac OS X
  • Previous by thread: Re: Normal Disappear Problem
  • Next by thread: Re: Normal Disappear Problem