POV-Ray : Newsgroups : povray.advanced-users : should be normal weighted ? Server Time
11 Oct 2026 13:36:22 EDT (-0400)
  should be normal weighted ? (Message 1 to 23 of 23)  
From: Wlodzimierz ABX Skiba
Subject: should be normal weighted ?
Date: 4 Dec 2000 03:31:42
Message: <3a2b566e@news.povray.org>
I have point O and points P1, P2, ... PN
connected as traingles P1OP2, P2OP3, ..., PN-1OPN, PNOP1
I want calculate best normal at point O for all this triangles.
Should it be simple normalized summary of all normals
or waighted one depend of areas of each triangle ?
Maybe other way ?

ABX


Post a reply to this message

From: Warp
Subject: Re: should be normal weighted ?
Date: 4 Dec 2000 04:41:39
Message: <3a2b66d3@news.povray.org>
Wlodzimierz ABX Skiba <abx### [at] abxartpl> wrote:
: Should it be simple normalized summary of all normals
: or waighted one depend of areas of each triangle ?

  It depends on how you want it to look like.

  Try both methods with your object and choose the one you like the most.

-- 
main(i,_){for(_?--i,main(i+2,"FhhQHFIJD|FQTITFN]zRFHhhTBFHhhTBFysdB"[i]
):_;i&&_>1;printf("%s",_-70?_&1?"[]":" ":(_=0,"\n")),_/=2);} /*- Warp -*/


Post a reply to this message

From: Josh English
Subject: Re: should be normal weighted ?
Date: 4 Dec 2000 13:20:49
Message: <3A2BE07B.9EE186F8@spiritone.com>
Using Warps read me file for his mesh smoother, I find that normalizing
the normal vectors of each triangle, then averaging them, works the
best. Of course, if you are using the vcross command to find your
normals, remember that the length of the resultant vector has a length
of the dot product, which will be at it's maximum when the vectors are
orthogonal (ie, 90 degrees apart).

Since this doens't make a lot of sence, I'll try to have a few pictures
for you soon.

Josh

Wlodzimierz ABX Skiba wrote:

> I have point O and points P1, P2, ... PN
> connected as traingles P1OP2, P2OP3, ..., PN-1OPN, PNOP1
> I want calculate best normal at point O for all this triangles.
> Should it be simple normalized summary of all normals
> or waighted one depend of areas of each triangle ?
> Maybe other way ?
>
> ABX

--
Josh English -- Lexiphanic Lethomaniac
eng### [at] spiritonecom
The POV-Ray Cyclopedia http://www.spiritone.com/~english/cyclopedia/


Post a reply to this message

From: Ron Parker
Subject: Re: should be normal weighted ?
Date: 4 Dec 2000 13:38:39
Message: <slrn92np5i.mrd.ron.parker@fwi.com>
On Mon, 04 Dec 2000 10:20:43 -0800, Josh English wrote:
>Using Warps read me file for his mesh smoother, I find that normalizing
>the normal vectors of each triangle, then averaging them, works the
>best. Of course, if you are using the vcross command to find your
>normals, remember that the length of the resultant vector has a length
>of the dot product, which will be at it's maximum when the vectors are
>orthogonal (ie, 90 degrees apart).

It's not the same as the dot product.  The length of the cross product
vector is A*B*sin(t) and the dot product is A*B*cos(t).

-- 
Ron Parker   http://www2.fwi.com/~parkerr/traces.html
My opinions.  Mine.  Not anyone else's.


Post a reply to this message

From: Josh English
Subject: Re: should be normal weighted ?
Date: 4 Dec 2000 15:01:57
Message: <3A2BF82F.BC751AD@spiritone.com>
I thought that I read in the docs that the length was the dot product, but
in fact they say "The resulting vector is perpendicular to the two original
vectors and its length is proportional to the angle between them." In my
experiments, that distance did seem to be at its largest when the vectors
were orthogonal.

Thanks for the clarification.

Josh

Ron Parker wrote:

> On Mon, 04 Dec 2000 10:20:43 -0800, Josh English wrote:
> >Using Warps read me file for his mesh smoother, I find that normalizing
> >the normal vectors of each triangle, then averaging them, works the
> >best. Of course, if you are using the vcross command to find your
> >normals, remember that the length of the resultant vector has a length
> >of the dot product, which will be at it's maximum when the vectors are
> >orthogonal (ie, 90 degrees apart).
>
> It's not the same as the dot product.  The length of the cross product
> vector is A*B*sin(t) and the dot product is A*B*cos(t).
>
> --
> Ron Parker   http://www2.fwi.com/~parkerr/traces.html
> My opinions.  Mine.  Not anyone else's.

--
Josh English -- Lexiphanic Lethomaniac
eng### [at] spiritonecom
The POV-Ray Cyclopedia http://www.spiritone.com/~english/cyclopedia/


Post a reply to this message

From: Ron Parker
Subject: Re: should be normal weighted ?
Date: 4 Dec 2000 15:40:25
Message: <slrn92o09s.ms8.ron.parker@fwi.com>
On Mon, 04 Dec 2000 12:01:51 -0800, Josh English wrote:
>I thought that I read in the docs that the length was the dot product, but
>in fact they say "The resulting vector is perpendicular to the two original
>vectors and its length is proportional to the angle between them." In my
>experiments, that distance did seem to be at its largest when the vectors
>were orthogonal.

Proportional to the sine of the angle between them.  Remind me to check the
docs when I get home.  Sine has a maximum at 90 degrees, so your experiments
were correct.

-- 
Ron Parker   http://www2.fwi.com/~parkerr/traces.html
My opinions.  Mine.  Not anyone else's.


Post a reply to this message

From: Ken
Subject: Re: should be normal weighted ?
Date: 4 Dec 2000 15:51:49
Message: <3A2C04A9.5129AD6D@pacbell.net>
Ron Parker wrote:

> Remind me to check the docs when I get home.

Ron,

Check the docs when you get home.

-- 
Ken Tyler


Post a reply to this message

From: Wlodzimierz ABX Skiba
Subject: Re: should be normal weighted ?
Date: 5 Dec 2000 04:19:29
Message: <3a2cb321@news.povray.org>
Josh English wrote in message <3A2BE07B.9EE186F8@spiritone.com>...
> Using Warps read me file for his mesh smoother, I find that
normalizing
> the normal vectors of each triangle, then averaging them, works the
> best. Of course, if you are using the vcross command to find your
> normals, remember that the length of the resultant vector has a length
> of the dot product, which will be at it's maximum when the vectors are
> orthogonal (ie, 90 degrees apart).


thanks. little more about my problem
I play with specialized patch for non-linear deforms
I have builded mechanizm to implement different types of deformations
geometry is supported ok but problem is with normals
first I thought just simple - (un)deform IPoint and IPoint+INormal
and calculate new normal
but this isn't correct -
therefore I discover such method:
find INormal and IPoint
find N points around of IPoint (with very small distance)
points are on flat plane perpendicular to normal
(un)deform points
now they are not on plane
calculate new normal

this mean that my virtual smooth triangles are very small
I leave simple averaging normals
real problem will be with inherited nonlinear transformed textures....

ABX


Post a reply to this message

From: Ron Parker
Subject: Re: should be normal weighted ?
Date: 5 Dec 2000 05:52:46
Message: <3a2cc8fe$1@news.povray.org>
On 4 Dec 2000 15:40:25 -0500, Ron Parker wrote:
>On Mon, 04 Dec 2000 12:01:51 -0800, Josh English wrote:
>>I thought that I read in the docs that the length was the dot product, but
>>in fact they say "The resulting vector is perpendicular to the two original
>>vectors and its length is proportional to the angle between them." In my
>>experiments, that distance did seem to be at its largest when the vectors
>>were orthogonal.
>
>Proportional to the sine of the angle between them.  Remind me to check the
>docs when I get home.  Sine has a maximum at 90 degrees, so your experiments
>were correct.

Hm... it certainly does say "proportional to the angle".  That's a doc bug.

-- 
Ron Parker   http://www2.fwi.com/~parkerr/traces.html
My opinions.  Mine.  Not anyone else's.


Post a reply to this message

From: Warp
Subject: Re: should be normal weighted ?
Date: 5 Dec 2000 06:18:37
Message: <3a2ccf0d@news.povray.org>
Josh English <eng### [at] spiritonecom> wrote:
: Of course, if you are using the vcross command to find your
: normals, remember that the length of the resultant vector has a length
: of the dot product, which will be at it's maximum when the vectors are
: orthogonal (ie, 90 degrees apart).

  Actually, the length of the normal vector calculated using cross-product
of two vectors is (also) exactly the area of the parallelogram formed by the
two vectors.
  To get the area of the triangle formed by the two vectors, divide the
length of the cross-product by 2.

-- 
main(i,_){for(_?--i,main(i+2,"FhhQHFIJD|FQTITFN]zRFHhhTBFHhhTBFysdB"[i]
):_;i&&_>1;printf("%s",_-70?_&1?"[]":" ":(_=0,"\n")),_/=2);} /*- Warp -*/


Post a reply to this message

From: Josh English
Subject: Re: should be normal weighted ?
Date: 6 Dec 2000 12:09:28
Message: <3A2E72C7.E98DA9C8@spiritone.com>
I thought that the area of the parallelogram was equal to the dot product. I
seem to remember that we were able to find the area with some simple vector
calculation. Too bad my book is at home.

Josh

Warp wrote:

> Josh English <eng### [at] spiritonecom> wrote:
> : Of course, if you are using the vcross command to find your
> : normals, remember that the length of the resultant vector has a length
> : of the dot product, which will be at it's maximum when the vectors are
> : orthogonal (ie, 90 degrees apart).
>
>   Actually, the length of the normal vector calculated using cross-product
> of two vectors is (also) exactly the area of the parallelogram formed by the
> two vectors.
>   To get the area of the triangle formed by the two vectors, divide the
> length of the cross-product by 2.
>
> --
> main(i,_){for(_?--i,main(i+2,"FhhQHFIJD|FQTITFN]zRFHhhTBFHhhTBFysdB"[i]
> ):_;i&&_>1;printf("%s",_-70?_&1?"[]":" ":(_=0,"\n")),_/=2);} /*- Warp -*/

--
Josh English -- Lexiphanic Lethomaniac
eng### [at] spiritonecom
The POV-Ray Cyclopedia http://www.spiritone.com/~english/cyclopedia/


Post a reply to this message

From: Warp
Subject: Re: should be normal weighted ?
Date: 6 Dec 2000 12:37:40
Message: <3a2e7964@news.povray.org>
Josh English <eng### [at] spiritonecom> wrote:
: I thought that the area of the parallelogram was equal to the dot product.

  Nope.
  For example, the area of the parallelogram formed by the vectors
<1,0,0> and <2,0,0> is 0, but the dot-product of the vectors is 2.

-- 
main(i,_){for(_?--i,main(i+2,"FhhQHFIJD|FQTITFN]zRFHhhTBFHhhTBFysdB"[i]
):_;i&&_>1;printf("%s",_-70?_&1?"[]":" ":(_=0,"\n")),_/=2);} /*- Warp -*/


Post a reply to this message

From: Josh English
Subject: Re: should be normal weighted ?
Date: 6 Dec 2000 12:39:22
Message: <3A2E79CA.FED51176@spiritone.com>
I'm pretty sure I read something about this in Calc 3... I'll have to check
tonight when I get home.

Josh

Warp wrote:

> Josh English <eng### [at] spiritonecom> wrote:
> : I thought that the area of the parallelogram was equal to the dot product.
>
>   Nope.
>   For example, the area of the parallelogram formed by the vectors
> <1,0,0> and <2,0,0> is 0, but the dot-product of the vectors is 2.
>
> --
> main(i,_){for(_?--i,main(i+2,"FhhQHFIJD|FQTITFN]zRFHhhTBFHhhTBFysdB"[i]
> ):_;i&&_>1;printf("%s",_-70?_&1?"[]":" ":(_=0,"\n")),_/=2);} /*- Warp -*/

--
Josh English -- Lexiphanic Lethomaniac
eng### [at] spiritonecom
The POV-Ray Cyclopedia http://www.spiritone.com/~english/cyclopedia/


Post a reply to this message

From: Warp
Subject: Re: should be normal weighted ?
Date: 6 Dec 2000 12:43:05
Message: <3a2e7aa8@news.povray.org>
Josh English <eng### [at] spiritonecom> wrote:
: I'm pretty sure I read something about this in Calc 3... I'll have to check
: tonight when I get home.

  The area of the parallelogram is |uxv| (ie. the length of the cross-product
of the two vectors u and v).

-- 
main(i,_){for(_?--i,main(i+2,"FhhQHFIJD|FQTITFN]zRFHhhTBFHhhTBFysdB"[i]
):_;i&&_>1;printf("%s",_-70?_&1?"[]":" ":(_=0,"\n")),_/=2);} /*- Warp -*/


Post a reply to this message

From: Ron Parker
Subject: Re: should be normal weighted ?
Date: 6 Dec 2000 12:57:04
Message: <slrn92svfi.rfu.ron.parker@fwi.com>
On Wed, 06 Dec 2000 09:09:28 -0800, Josh English wrote:
>I thought that the area of the parallelogram was equal to the dot product. I
>seem to remember that we were able to find the area with some simple vector
>calculation. Too bad my book is at home.

Nope, the dot product is more closely related to the projection of one
vector onto another [the length of the projection of b onto a is 
vdot(a,b)/vlength(b)].  The length of the cross product is related to 
the orthogonal component [the length of the component of b orthogonal 
to a is vlength(vcross(a,b))/vlength(a)].

Since the area of a parallelogram is base (length of a) times height
(length of the component of b orthogonal to a) it turns out that the 
area of the parallelogram is exactly the length of the cross product.  
In my experience, this fact is rarely useful, but the two above often
are.

-- 
Ron Parker   http://www2.fwi.com/~parkerr/traces.html
My opinions.  Mine.  Not anyone else's.


Post a reply to this message

From: Warp
Subject: Re: should be normal weighted ?
Date: 6 Dec 2000 13:18:56
Message: <3a2e8310@news.povray.org>
Ron Parker <ron### [at] povrayorg> wrote:
: In my experience, this fact is rarely useful

  Perhaps it could be used, as proposed earlier, to calculate the weigthed
average of the normal vectors instead of just the average.
  It makes sense that the normal vector of a larger triangle has more
effect in the normal of the vertex than a smaller triangle.

  Of course doing it this way can result in degenerate triangles, which
is a problem.

-- 
main(i,_){for(_?--i,main(i+2,"FhhQHFIJD|FQTITFN]zRFHhhTBFHhhTBFysdB"[i]
):_;i&&_>1;printf("%s",_-70?_&1?"[]":" ":(_=0,"\n")),_/=2);} /*- Warp -*/


Post a reply to this message

From: Josh English
Subject: Re: should be normal weighted ?
Date: 7 Dec 2000 11:19:05
Message: <3A2FB865.A0DF3FC4@spiritone.com>
Thanks, that's what I was able to look up. The scary part was I couldn't find it
on the 'net anywhere, but I wasn't checking anything about the cross product.

I can't wait to teach this stuff, I'll really know it well, then

Josh

Warp wrote:

> Josh English <eng### [at] spiritonecom> wrote:
> : I'm pretty sure I read something about this in Calc 3... I'll have to check
> : tonight when I get home.
>
>   The area of the parallelogram is |uxv| (ie. the length of the cross-product
> of the two vectors u and v).
>
> --
> main(i,_){for(_?--i,main(i+2,"FhhQHFIJD|FQTITFN]zRFHhhTBFHhhTBFysdB"[i]
> ):_;i&&_>1;printf("%s",_-70?_&1?"[]":" ":(_=0,"\n")),_/=2);} /*- Warp -*/


Post a reply to this message

From: Josh English
Subject: Re: should be normal weighted ?
Date: 7 Dec 2000 13:01:32
Message: <3A2FD07C.7FA03F08@spiritone.com>
Better Nate than Lever... I have a small explination that hopefully will
help out here:

http://www.spiritone.com/~english/cyclopedia/smooth2.html

As always, send feedback and WTF's via email.

Josh

Josh English wrote:

> Using Warps read me file for his mesh smoother, I find that normalizing
> the normal vectors of each triangle, then averaging them, works the
> best. Of course, if you are using the vcross command to find your
> normals, remember that the length of the resultant vector has a length
> of the dot product, which will be at it's maximum when the vectors are
> orthogonal (ie, 90 degrees apart).
>
> Since this doens't make a lot of sence, I'll try to have a few pictures
> for you soon.
>
> Josh
>
> Wlodzimierz ABX Skiba wrote:
>
> > I have point O and points P1, P2, ... PN
> > connected as traingles P1OP2, P2OP3, ..., PN-1OPN, PNOP1
> > I want calculate best normal at point O for all this triangles.
> > Should it be simple normalized summary of all normals
> > or waighted one depend of areas of each triangle ?
> > Maybe other way ?
> >
> > ABX
>
> --
> Josh English -- Lexiphanic Lethomaniac
> eng### [at] spiritonecom
> The POV-Ray Cyclopedia http://www.spiritone.com/~english/cyclopedia/


Post a reply to this message

From: Warp
Subject: Re: should be normal weighted ?
Date: 7 Dec 2000 14:36:13
Message: <3a2fe6ad@news.povray.org>
Josh English <eng### [at] spiritonecom> wrote:
: Better Nate than Lever... I have a small explination that hopefully will
: help out here:

: http://www.spiritone.com/~english/cyclopedia/smooth2.html

  Note that if you use a weighted average to smooth the triangles, you can
get degenerate triangles. This is a bad problem.

  For example, suppose that you have a triangle with a normal vector
pointing at <0,1,0> and an adjacent triangle with its normal vector pointing
at <1,-1,0>. Let's say that the area of the first triangle is 10 square
units and the area of the second triangle is 1 square unit.
  If we calculate the normal vector of a common vertex using the weighted
average of the triangle normal vectors, it will be:

  <0,1,0>*10 + <1,-1,0>*1 = <1,9,0>

  If you apply that <1,9,0> as the normal vector to a vertex of the second
triangle, it will be degenerate. That's because the angle between the
normal vector of the second triangle and that <1,9,0> vector is larger
than 90 degrees.
  (It can be checked from the dot-product; if the dot-product of the
two vectors is negative, then the triangle is degenerate:
  <1,-1,0>.<1,9,0> = 1*1 + (-1)*9 + 0*0 = -8  )


  By the way: It's interesting to note that this same problem can appear
even if we use the average of the normalized normal vectors of the triangles.
  I have never thoight about that...

  However, I would say that the problem is less probable in the latter case.

-- 
main(i,_){for(_?--i,main(i+2,"FhhQHFIJD|FQTITFN]zRFHhhTBFHhhTBFysdB"[i]
):_;i&&_>1;printf("%s",_-70?_&1?"[]":" ":(_=0,"\n")),_/=2);} /*- Warp -*/


Post a reply to this message

From: Warp
Subject: Re: should be normal weighted ?
Date: 7 Dec 2000 14:37:24
Message: <3a2fe6f4@news.povray.org>
By the way, the link at the beginning of the page is wrong.
  It's not "PovUntils" :)

-- 
main(i,_){for(_?--i,main(i+2,"FhhQHFIJD|FQTITFN]zRFHhhTBFHhhTBFysdB"[i]
):_;i&&_>1;printf("%s",_-70?_&1?"[]":" ":(_=0,"\n")),_/=2);} /*- Warp -*/


Post a reply to this message

From: Josh English
Subject: Re: should be normal weighted ?
Date: 7 Dec 2000 16:19:43
Message: <3A2FFEEC.511BBC56@spiritone.com>
Warp wrote:

> Josh English <eng### [at] spiritonecom> wrote:
> : Better Nate than Lever... I have a small explination that hopefully will
> : help out here:
>
> : http://www.spiritone.com/~english/cyclopedia/smooth2.html
>
>   Note that if you use a weighted average to smooth the triangles, you can
> get degenerate triangles. This is a bad problem.
>
>   For example, suppose that you have a triangle with a normal vector
> pointing at <0,1,0> and an adjacent triangle with its normal vector pointing
> at <1,-1,0>. Let's say that the area of the first triangle is 10 square
> units and the area of the second triangle is 1 square unit.
>   If we calculate the normal vector of a common vertex using the weighted
> average of the triangle normal vectors, it will be:
>
>   <0,1,0>*10 + <1,-1,0>*1 = <1,9,0>
>
>   If you apply that <1,9,0> as the normal vector to a vertex of the second
> triangle, it will be degenerate. That's because the angle between the
> normal vector of the second triangle and that <1,9,0> vector is larger
> than 90 degrees.
>   (It can be checked from the dot-product; if the dot-product of the
> two vectors is negative, then the triangle is degenerate:
>   <1,-1,0>.<1,9,0> = 1*1 + (-1)*9 + 0*0 = -8  )

Thanks for the tip on that. I didn't associate negative dot products with
degenerate triangles. So is it always true that a negative dot product reflects
an obtuse angle?  A cursory check would make it seem that way.

>   By the way: It's interesting to note that this same problem can appear
> even if we use the average of the normalized normal vectors of the triangles.
>   I have never thoight about that...
>
>   However, I would say that the problem is less probable in the latter case.

No, sadly, it's not. I got several degenerate triangles, then I changed n to be
5 or 6, it worked, set it back to 4, and it worked. I have no idea why it did
that, though. This was when the normal at the apex of the triangles was along
<0,1,0>.

Josh


Post a reply to this message

From: Josh English
Subject: Re: should be normal weighted ?
Date: 7 Dec 2000 16:20:55
Message: <3A2FFF37.47FE1D19@spiritone.com>
OOPS. I was looking at my bookmarks screen one one machine and typing on the
other....

It's fixed.

By the way, thank you for that read me file, it made my life very easy on
several occasions.

Josh

Warp wrote:

>   By the way, the link at the beginning of the page is wrong.
>   It's not "PovUntils" :)
>
> --
> main(i,_){for(_?--i,main(i+2,"FhhQHFIJD|FQTITFN]zRFHhhTBFHhhTBFysdB"[i]
> ):_;i&&_>1;printf("%s",_-70?_&1?"[]":" ":(_=0,"\n")),_/=2);} /*- Warp -*/


Post a reply to this message

From: Wlodzimierz ABX Skiba
Subject: Re: should be normal weighted ?
Date: 8 Dec 2000 07:35:58
Message: <3a30d5ae@news.povray.org>
Warp wrote in message <3a2fe6ad@news.povray.org>...
>  By the way: It's interesting to note that this same problem can
appear
>even if we use the average of the normalized normal vectors of the
triangles.
>  I have never thoight about that...


than if this appear for both method (weighted and not)
than consider comparison for proper triangles
(picture sended at p.b.i)

ABX


Post a reply to this message

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