POV-Ray : Newsgroups : povray.advanced-users : Calculating normal vectors for meshes : Re: Calculating normal vectors for meshes Server Time
29 Mar 2025 07:18:25 EDT (-0400)
  Re: Calculating normal vectors for meshes  
From: GioSeregni
Date: 15 Mar 2025 13:45:00
Message: <web.67d5bc81dd89838f1cecd2c359126100@news.povray.org>
yesbird <sya### [at] gmailcom> wrote:
> On 15/03/2025 11:57, Thomas de Groot wrote:
> > That mesh looks definitely to be corrupt and needs repairing first!
>
> Maybe, but POV-Ray renders it without problems and I don't see any
> issues in syntax. Moreover, I found alternative solution already.
> --
> YB

This is my easy code for the normals
easy to translate to any language

xVD=(FACE.y1-FACE.y0)*(FACE.z2-FACE.z0)-(FACE.z1-FACE.z0)*(FACE.y2-FACE.y0)
yVD=(FACE.z1-FACE.z0)*(FACE.x2-FACE.x0)-(FACE.x1-FACE.x0)*(FACE.z2-FACE.z0)
zVD=(FACE.x1-FACE.x0)*(FACE.y2-FACE.y0)-(FACE.y1-FACE.y0)*(FACE.x2-FACE.x0)
NoDivBy0=xVD*xVD+yVD*yVD+zVD*zVD
IF NoDivBy0=0 THEN NoDivBy0=0.000000000001
xND=xVD/sqr(NoDivBy0)
yND=yVD/sqr(NoDivBy0)
zND=zVD/sqr(NoDivBy0)


Post a reply to this message

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