POV-Ray : Newsgroups : povray.binaries.images : For Hugo. Irregular mesh smoothing idea. : Re: Yeaah! I got it to work!! Server Time
16 Aug 2024 14:23:31 EDT (-0400)
  Re: Yeaah! I got it to work!!  
From: Tor Olav Kristensen
Date: 6 Mar 2002 18:40:55
Message: <3C86A730.785EA5C1@hotmail.com>
Josh Seagoe wrote:
> 

> > universal formula for area of triangle:
> >
> > S=sqrt(p*(p-a)*(p-b)*(p-c))
> >
> > where a,b,c are lengths of edges and p is half of perimeter = (a+b+c)/2
> >
> 
> Is that faster than using half the cross product of two of the sides?
> (cosidering vcross is internal...)
> 
> Something like:
> area = vlength(vcross(P1-P2,P3-P2))/2;

I have not looked at their mesh code yet,
but I assume that they are calculating
the normal vectors for the triangles by
just taking the cross product of a pair
of each triangle's "edge vectors".

And if this is the case, then I don't see
the point in first calculating this cross
product, normalize it and then multiply
it by your area expression.

I.e.:

vnormalize(vcross(P1 - P2, P3 - P2))
*vlength(vcross(P1 - P2, P3 - P2))/2

They could just use the cross product
directly:

vcross(P1 - P2, P3 - P2)/2

And they don't even have to divide it
by 2 prior to the summing. Because
every triangle normal will be "double"
length.

The final normalizing of the sum of
all the "weighted" normal vectors will
eliminate it anyway.


Tor Olav


Post a reply to this message

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