[vtkusers] Normal of a point

tony hakki tony2007vtk at yahoo.com
Thu Jan 4 06:26:25 EST 2007


hi all;
I would like to calculate normal vectors of surface  points.  If  p0[3], p1[3], p2[3] are coordinates of a surface,   Is that code right? Could you please have a look? Thank you...
tony

double n[3], u[3], v[3],p0[3], p1[3], p2[3]
// Compute two vectors u and v in the cell.
u[0] = p1[0] - p0[0];
u[1] = p1[1] - p0[1];
u[2] = p1[2] - p0[2];
v[0] = p2[0] - p0[0];
v[1] = p2[1] - p0[1];
v[2] = p2[2] - p0[2];
// Compute the cell non-normalized normal.
n[0] = u[1] * v[2] - u[2] * v[1];
n[1] = u[2] * v[0] - u[0] * v[2];
n[2] = u[0] * v[1] - u[1] * v[0];

__________________________________________________
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20070104/c6b70a04/attachment.htm>


More information about the vtkusers mailing list