POV-Ray : Newsgroups : povray.general : img2mesh geometry improved : Re: img2mesh geometry improved Server Time
3 Oct 2025 01:54:27 EDT (-0400)
  Re: img2mesh geometry improved  
From: Bald Eagle
Date: 23 Sep 2025 10:15:00
Message: <web.68d2ab3b760e66751398638025979125@news.povray.org>
"ingo" <nomail@nomail> wrote:

> 1. First calculate the face normal, either by cross product of three edges or
> Newell's method
>
> Newell:
>   for i in 0..<vertices.len:
>     let curr = vertices[i]
>     let next = vertices[(i + 1) mod vertices.len]
>     normal.x += (curr.y - next.y) * (curr.z + next.z)
>     normal.y += (curr.z - next.z) * (curr.x + next.x)
>     normal.z += (curr.x - next.x) * (curr.y + next.y)
>   return normalize(normal)
>
> 2. Now calulate the vertex normals, there several weighting types can be used,
> based on properties of the adjacent polygons.
>    Weighted by area, weighted by angle or just average the face normals as they
> are.

You're making me want to revisit one of my other small projects:

https://news.povray.org/web.655dee4084c692a31f9dae3025979125%40news.povray.org

Too much to do, too little time.

- BW


Post a reply to this message

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