POV-Ray : Newsgroups : povray.general : Smooth level for smooth_triangle. : Re: Smooth level for smooth_triangle. Server Time
27 Jul 2024 08:07:47 EDT (-0400)
  Re: Smooth level for smooth_triangle.  
From: Bald Eagle
Date: 19 Nov 2023 16:00:00
Message: <web.655a765e84c692a31f9dae3025979125@news.povray.org>
"GioSeregni" <gms### [at] hotmailcom> wrote:

> sure, last night I started with two faces, then three, then a cube (bad idea),

Well, it was a good idea, because it shows you what can happen  ;)


> I was thinking, for your idea, instead of the area, which means many operations,
> finding the center of the triangle, and comparing the size of the triangles
> using the center- 1 vertex distance.
> G.

Well, you can do whatever you like, but I'm not sure how much faster it will be,
or how much better it will be.

First you have to compute the center, and then you have to pick - what - the
maximum distance to 3 vertices?  What if you have 2 triangles that share the
only a single vertex?  |X|  Which of the 2 sides on the one triangle do you use
to scale the face normal by?

If you have vertices, A, B, and C, then you have vectors (A-B) and (C-B), and
the vector cross product of those will give you a vector perpendicular to the
surface (the face normal), AND it's length will be a scalar value proportional
to the surface area of the triangle, all in a single calculation.

What I usually do when experimenting with different methods, is either use a
#switch block to choose what method I'm using, or use macros with similar names
that do things a slightly different way.
#macro Method1 ()
#macro Method2 ()
#macro Method3 ()

and then I just change the name of what macro I'm calling to do the part of the
code where I'm doing the experimentation to see what will work best / fastest.


- BW


Post a reply to this message

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