POV-Ray : Newsgroups : povray.general : Calculating the normals of a triangle : Re: Calculating the normals of a triangle Server Time
5 Aug 2024 18:17:41 EDT (-0400)
  Re: Calculating the normals of a triangle  
From: Tony LaVigne
Date: 11 Sep 2002 14:45:09
Message: <web.3d7f8d183836a27fc7e287770@news.povray.org>
Marcus Fritzsch wrote:
>Hi,
>
>i wrote a simple triangulation algo for a noise program to generate
>something like a hieghtfield, and i wanted to use this with
>smooth_triangles, does anybody knows how to calculate the normals of the
>three points from the known triangle?
>
>greetings, Marcus
>

to get the normal (N) of a straigh triangle, if your vertexes points are V0,
V1, V2,
#declare N= vcross(V1-V0,V2-V0);
the to make it a unit vector (Nu) try,
#declare Nu = vnormalize(vcross(V1-V0,V2-V0));

For a smooth Triangle each vertex will have a differant normal, in that case
you'd have to find two vectors that are tangent with the surface at the
vertex (just as  V1-V0 and V2-V0 are).  If you know of two other points
close to the vertex then you could get a normal that is close.   Best is to
take the derivites at the vertex (which is what the others are talking
about).

Tony


Post a reply to this message

Copyright 2003-2023 Persistence of Vision Raytracer Pty. Ltd.