POV-Ray : Newsgroups : povray.binaries.images : For Hugo. Irregular mesh smoothing idea. : Does this look right to you, ABX? Server Time
16 Aug 2024 16:16:31 EDT (-0400)
  Does this look right to you, ABX?  
From: Shay
Date: 6 Mar 2002 13:44:09
Message: <3c866379@news.povray.org>

news:5mdc8ukvplcavtnekp4f0cvtebe8rtlbob@4ax.com...
> #include "functions.inc"
> #local triangle_area_engine=function{(x+y+z)*(y+z-x)*(x+y-z)*(x+z-y)/16}
> #local triangle_area=
>   function(x1,y1,z1,x2,y2,z2,x3,y3,z3)
>     {sqrt(triangle_area_engine(
>         f_r(x2-x1,y2-y1,z2-z1),
>         f_r(x3-x2,y3-y2,z3-z2),
>         f_r(x3-x1,y3-y1,z3-z1)
>     ))};

I've haven't used any functions yet, so I would like to know if my version
of your function will work..
I see a slight problem with your function in that the lengths of most of the
triangle sides will be calculated twice.
The demonstration file I wrote finds all of the side lengths first and
stores them in an array. A #local statement at the beginning  of each "case"
macro could find the length of the diagonal. So, would this give an accurate
result?

 #include "functions.inc"
 #local triangle_area_engine=function{(x+y+z)*(y+z-x)*(x+y-z)*(x+z-y)/16}
 #local Triangle_Area =  triangle_area_engine(Side_1_Length, Side_2_Length,
Side_3_Length);

Seems right to me, but I might be missing something.

Thank you,
 -Shay


Post a reply to this message

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