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:26:28 EDT (-0400)
  Re: Yeaah! I got it to work!!  
From: Shay
Date: 6 Mar 2002 10:10:11
Message: <3c863153@news.povray.org>
Hugo <hua### [at] post3teledk> wrote in message
news:3c8626aa$1@news.povray.org...
> It is with pleasure I can announce that the normal-smoothing routine in my
> macro now works

Excellent. Like I said, can't wait to use it.

Regarding the heightfield only method for finding the area of the triangle:

The formula I used was Area = (Side_1_Length * Side_2_Length *
sin(Included_Angle))/2
A 100x100 array of vertices would require finding 39,204 angles!!
With a heightfield, however, the verices are only moved up and down, so the
angle at any corner of a square will always be pi/2 radians. The sin of pi/2
radians is 1, so the sin(Included_Angle) part can be dropped!!

For a mesh with different angles at the corners of a "square," an angle must
be found for each triangle. There are two ways I can think of to do this.
Both are slow, but one should shurely be faster than the other.

The first way is to use PoV's vangle() macro. This macro requires vectors as
inputs, so in addition to finding the lengths of the square sides, you will
also have to find the vectors.

The second and probably faster way is to use your own math. In addition to
the lengths of the sides of the square, you will need to find the lengths of
the [/] and [\] diagonals. You can then find the angle with something like
this:
#declare Included_Angle = acos  ((Side_1_Length^2 + Side_2_Length^2 -
Diagonal^2) / (2 * Side_1_Length * Side_2_Length));
(above is NOT TESTED! And I am using my WORK brain.)

 -Shay


Post a reply to this message

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