comp.lang.idl-pvwave archive
Messages from Usenet group comp.lang.idl-pvwave, compiled by Paulo Penteado

Home » Public Forums » archive » Re: Compute_Mesh_Normals returns normal vector [0, 0, 0]
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Switch to threaded view of this topic Create a new topic Submit Reply
Re: Compute_Mesh_Normals returns normal vector [0, 0, 0] [message #49115] Thu, 22 June 2006 10:40
James Kuyper is currently offline  James Kuyper
Messages: 425
Registered: March 2000
Senior Member
spidersapiens@gmail.com wrote:
> According to the online help, the function "Compute_Mesh_Normals"
> should return "a 3 x M array containing a unit normal for each vertex
> in the input array.". However when I used it in my program, it's
> returning a couple ZERO vector [0, 0, 0] though the rest are normal
> unit vectors. What does zero vector mean in this case or should I say
> this is an IDL bug?

I'm not familiar with the algorithm used, though I assume it involves
calculating cross-products of the edges which meet at the corresponding
edge. However, you can imagine which situations might produce such a
result without knowing the details of the algorithm.

If all of the edges are parallel to each other, all of the cross
products would produce a 0 vector. If three edges meet at a vertex, and
two of them are parallel to each other, a simple average would involve
one cross product of exactly 0, and two cross products that exactly
cancel each other. This is just the mathematical way of saying that the
two pairs of edges give exactly conficting hints about the direction of
the normal vector. The same can be said if four edges meet at a vertex,
and any two of them are parallel.

Therefore, the thing you need to do is find out what the edges of the
mesh are, that meet at the vertices where the normal vector comes out
0.
Re: Compute_Mesh_Normals returns normal vector [0, 0, 0] [message #49116 is a reply to message #49115] Thu, 22 June 2006 10:26 Go to previous message
Rick Towler is currently offline  Rick Towler
Messages: 821
Registered: August 1998
Senior Member
spidersapiens@gmail.com wrote:
> According to the online help, the function "Compute_Mesh_Normals"
> should return "a 3 x M array containing a unit normal for each vertex
> in the input array.". However when I used it in my program, it's
> returning a couple ZERO vector [0, 0, 0] though the rest are normal
> unit vectors. What does zero vector mean in this case or should I say
> this is an IDL bug?

Just a guess, but maybe a few of the verts are identical? I think for
this to happen nVerts_per_poly-1 vertices would have to be the same.
This might be in your data or it could be a subtle error in your
connectivity array. Or it could be neither of these :)

-Rick
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: Compute_Mesh_Normals returns normal vector [0, 0, 0]
Next Topic: Space Camper

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ] [ PDF ]

Current Time: Wed Oct 08 18:07:45 PDT 2025

Total time taken to generate the page: 0.00488 seconds