POV-Ray : Newsgroups : povray.advanced-users : Degenerate triangles mesh vs. union Server Time
30 Jul 2024 08:18:10 EDT (-0400)
  Degenerate triangles mesh vs. union (Message 1 to 6 of 6)  
From: Ken
Subject: Degenerate triangles mesh vs. union
Date: 15 Aug 1999 20:47:34
Message: <37B75FA1.A6612C96@pacbell.net>
In the sample below we have an example of degenerate triangles. The
indented triangles are those that Pov reports as being degenerate.
When rendered as a union the degenerate warnings appear. When commented
out those warnings disappear. When rendered as a mesh however Pov fails
to report them as being degenerate. This has been true since the mesh
wrapper was added in Pov v3.0x. Why are they not being reported as
degenerate triangles when used in a mesh ?

I have asked this before and have never received a response. Hopefully
someone has an idea now that I have provided an example to evaluate the
discrepancy with.

//union{
mesh{
   triangle{<0.1173,0.4003,0.0>,<0.0,0.4,0.0>,<0.0,0.4,0.0>}
triangle{<0.0,0.4003,-0.1173>,<0.1173,0.4003,0.0>,<0.0,0.4,0.0>}
   triangle{<0.0,0.4003,-0.1173>,<0.0,0.4,0.0>,<0.0,0.4,0.0>}
triangle{<-0.1173,0.4003,0.0>,<0.0,0.4003,-0.1173>,<0.0,0.4,0.0>}
   triangle{<-0.1173,0.4003,0.0>,<0.0,0.4,0.0>,<0.0,0.4,0.0>}
triangle{<0.0,0.4003,0.1173>,<-0.1173,0.4003,0.0>,<0.0,0.4,0.0>}
   triangle{<0.0,0.4003,0.1173>,<0.0,0.4,0.0>,<0.0,0.4,0.0>}
triangle{<0.1173,0.4003,0.0>,<0.0,0.4003,0.1173>,<0.0,0.4,0.0>}
}

-- 
Ken Tyler

See my 700+ Povray and 3D Rendering and Raytracing Links at:
http://home.pacbell.net/tylereng/index.html


Post a reply to this message

From: Jon A  Cruz
Subject: Re: Degenerate triangles mesh vs. union
Date: 15 Aug 1999 23:53:06
Message: <37B78BA4.BE52FC61@geocities.com>
Ken wrote:

>  In the sample below we have an example of degenerate triangles. The
> indented triangles are those that Pov reports as being degenerate.
> When rendered as a union the degenerate warnings appear. When commented
> out those warnings disappear. When rendered as a mesh however Pov fails
> to report them as being degenerate. This has been true since the mesh
> wrapper was added in Pov v3.0x. Why are they not being reported as
> degenerate triangles when used in a mesh ?
>
> I have asked this before and have never received a response. Hopefully
> someone has an idea now that I have provided an example to evaluate the
> discrepancy with.
>
> //union{
> mesh{
>    triangle{<0.1173,0.4003,0.0>,<0.0,0.4,0.0>,<0.0,0.4,0.0>}
> triangle{<0.0,0.4003,-0.1173>,<0.1173,0.4003,0.0>,<0.0,0.4,0.0>}
>    triangle{<0.0,0.4003,-0.1173>,<0.0,0.4,0.0>,<0.0,0.4,0.0>}
> triangle{<-0.1173,0.4003,0.0>,<0.0,0.4003,-0.1173>,<0.0,0.4,0.0>}
>    triangle{<-0.1173,0.4003,0.0>,<0.0,0.4,0.0>,<0.0,0.4,0.0>}
> triangle{<0.0,0.4003,0.1173>,<-0.1173,0.4003,0.0>,<0.0,0.4,0.0>}
>    triangle{<0.0,0.4003,0.1173>,<0.0,0.4,0.0>,<0.0,0.4,0.0>}
> triangle{<0.1173,0.4003,0.0>,<0.0,0.4003,0.1173>,<0.0,0.4,0.0>}
> }
>

Well, POV-Ray reports them as being degenerate because they are :-)

I'm not sure, but I just encountered this recently when I was doing some
macro work just the other day. Guess I have to look into the code and see.

My guess at the time was that the mesh was doing some conversions of
melding all the identical points whereas the union was keeping things as
separate triangles, and in the mesh process things were skipping a check
step that the union triangles were subject to. But as I said, this is just
a guess and I have to look at the code to be sure.



--
"My new computer's got the clocks, it rocks
But it was obsolete before I opened the box" - W.A.Y.


Post a reply to this message

From: Chris Colefax
Subject: Re: Degenerate triangles mesh vs. union
Date: 16 Aug 1999 02:46:06
Message: <37b7b3ae@news.povray.org>
Ken <tyl### [at] pacbellnet> wrote:
>  In the sample below we have an example of degenerate triangles. The
> indented triangles are those that Pov reports as being degenerate.
> When rendered as a union the degenerate warnings appear. When commented
> out those warnings disappear. When rendered as a mesh however Pov fails
> to report them as being degenerate. This has been true since the mesh
> wrapper was added in Pov v3.0x. Why are they not being reported as
> degenerate triangles when used in a mesh ?
>
> I have asked this before and have never received a response. Hopefully
> someone has an idea now that I have provided an example to evaluate the
> discrepancy with.

It would seem to be the simple fact that when parsing meshes POV-Ray ignores
degenerate triangles completely, whereas in the union each triangle is
parsed as an individual object and so degenerate cases do get reported (a
possibly dubious theory arrived at by the fact that creating a mesh composed
entirely of degenerate triangles simply reports "no triangles in mesh").

I can only imagine the rationale is that meshes are generally outputted by a
program (conversion or otherwise), and might very well contain many
triangles that POV-Ray can't use (in which case warnings would simply be
annoying, rather than useful).  Non-mesh triangles, on the other hand, would
usually be entered by hand, and as such a degenerate triangle is more likely
to be a genuine user mistake....perhaps?!


Post a reply to this message

From: Ken
Subject: Re: Degenerate triangles mesh vs. union
Date: 16 Aug 1999 02:58:00
Message: <37B7B672.5D15D58A@pacbell.net>
Chris Colefax wrote:
> 
> Ken <tyl### [at] pacbellnet> wrote:
> >  In the sample below we have an example of degenerate triangles. The
> > indented triangles are those that Pov reports as being degenerate.
> > When rendered as a union the degenerate warnings appear. When commented
> > out those warnings disappear. When rendered as a mesh however Pov fails
> > to report them as being degenerate. This has been true since the mesh
> > wrapper was added in Pov v3.0x. Why are they not being reported as
> > degenerate triangles when used in a mesh ?
> >
> > I have asked this before and have never received a response. Hopefully
> > someone has an idea now that I have provided an example to evaluate the
> > discrepancy with.
> 
> It would seem to be the simple fact that when parsing meshes POV-Ray ignores
> degenerate triangles completely, whereas in the union each triangle is
> parsed as an individual object and so degenerate cases do get reported (a
> possibly dubious theory arrived at by the fact that creating a mesh composed
> entirely of degenerate triangles simply reports "no triangles in mesh").

In essence then instead of warning the user to remove the degenerate triangles
pov simply handles it for you when meshes are used.
 
> I can only imagine the rationale is that meshes are generally outputted by a
> program (conversion or otherwise), and might very well contain many
> triangles that POV-Ray can't use (in which case warnings would simply be
> annoying, rather than useful).  Non-mesh triangles, on the other hand, would
> usually be entered by hand, and as such a degenerate triangle is more likely
> to be a genuine user mistake....perhaps?!

The one possible danger to this non reporting scenario would be scene debugging.
I have seen several macro's lately where triangles were created by whatever the
function of the macro was. If you make a mistake in your calculations and Pov
carefully removes your bad triangles for you it might be very difficult to figure
out why your shape is not being produced as you would expect it to. Good or bad
it is different and I thought it was worth mentioning.

-- 
Ken Tyler

See my 700+ Povray and 3D Rendering and Raytracing Links at:
http://home.pacbell.net/tylereng/index.html


Post a reply to this message

From: Noah A
Subject: Re: Degenerate triangles mesh vs. union
Date: 16 Aug 1999 16:22:40
Message: <37B87320.FB98329E@powersurfr.com>
i'm not worthey
i'm not worthey
i'm not worthey

if you get it good if you don't i don't wanna explain :)

Chris Colefax wrote:

> Ken <tyl### [at] pacbellnet> wrote:
> >  In the sample below we have an example of degenerate triangles. The
> > indented triangles are those that Pov reports as being degenerate.
> > When rendered as a union the degenerate warnings appear. When commented
> > out those warnings disappear. When rendered as a mesh however Pov fails
> > to report them as being degenerate. This has been true since the mesh
> > wrapper was added in Pov v3.0x. Why are they not being reported as
> > degenerate triangles when used in a mesh ?
> >
> > I have asked this before and have never received a response. Hopefully
> > someone has an idea now that I have provided an example to evaluate the
> > discrepancy with.
>
> It would seem to be the simple fact that when parsing meshes POV-Ray ignores
> degenerate triangles completely, whereas in the union each triangle is
> parsed as an individual object and so degenerate cases do get reported (a
> possibly dubious theory arrived at by the fact that creating a mesh composed
> entirely of degenerate triangles simply reports "no triangles in mesh").
>
> I can only imagine the rationale is that meshes are generally outputted by a
> program (conversion or otherwise), and might very well contain many
> triangles that POV-Ray can't use (in which case warnings would simply be
> annoying, rather than useful).  Non-mesh triangles, on the other hand, would
> usually be entered by hand, and as such a degenerate triangle is more likely
> to be a genuine user mistake....perhaps?!


Post a reply to this message

From: Ken
Subject: Re: Degenerate triangles mesh vs. union
Date: 9 Sep 1999 14:31:10
Message: <37D7FC8A.52590576@pacbell.net>
Ken wrote:
> 
>  In the sample below we have an example of degenerate triangles. The
> indented triangles are those that Pov reports as being degenerate.
> When rendered as a union the degenerate warnings appear. When commented
> out those warnings disappear. When rendered as a mesh however Pov fails
> to report them as being degenerate. This has been true since the mesh
> wrapper was added in Pov v3.0x. Why are they not being reported as
> degenerate triangles when used in a mesh ?
> 
> I have asked this before and have never received a response. Hopefully
> someone has an idea now that I have provided an example to evaluate the
> discrepancy with.
> 
> //union{
> mesh{
>    triangle{<0.1173,0.4003,0.0>,<0.0,0.4,0.0>,<0.0,0.4,0.0>}
> triangle{<0.0,0.4003,-0.1173>,<0.1173,0.4003,0.0>,<0.0,0.4,0.0>}
>    triangle{<0.0,0.4003,-0.1173>,<0.0,0.4,0.0>,<0.0,0.4,0.0>}
> triangle{<-0.1173,0.4003,0.0>,<0.0,0.4003,-0.1173>,<0.0,0.4,0.0>}
>    triangle{<-0.1173,0.4003,0.0>,<0.0,0.4,0.0>,<0.0,0.4,0.0>}
> triangle{<0.0,0.4003,0.1173>,<-0.1173,0.4003,0.0>,<0.0,0.4,0.0>}
>    triangle{<0.0,0.4003,0.1173>,<0.0,0.4,0.0>,<0.0,0.4,0.0>}
> triangle{<0.1173,0.4003,0.0>,<0.0,0.4003,0.1173>,<0.0,0.4,0.0>}
> }

 I have recieved a private reply to this that sound interesting and I
thought I might get your opinions on:

---------------------
hi,

 I looked into 3.02 sources (i suppose the newer ones are similar).
I think I found the reason of the missing warning: when parsing a
non-mesh triangle, the function Compute_Triangle (triangle.c) is
called at last.  This is the place where the "degenerate triangle" 
warning comes from.

A degenerated mesh triangle is discarded much sooner.
This is a fragment from parse.c:
EXPECT
  CASE(TRIANGLE_TOKEN)
    Parse_Begin();

    Parse_Vector(P1);  Parse_Comma();
    Parse_Vector(P2);  Parse_Comma();
    Parse_Vector(P3);
    if (!Mesh_Degenerate(P1, P2, P3))
    {
      ... save and compute triangle ...
    }
    
    Parse_End();
  END_CASE

Mesh_Degenerate() (in mesh.c) does not produce any warning and it is the
first and last function which ever sees the degenerated triangle.

I guess that precision could be another pitfall (if someone decides to
rewrite the code). Mesh triangle coordinates are stored as single floats,
whereas non-mesh triangles are stored as doubles. This could also lead to
similar problems.
--------------------------

Comments ?

-- 
Ken Tyler

See my 850+ Povray and 3D Rendering and Raytracing Links at:
http://home.pacbell.net/tylereng/index.html


Post a reply to this message

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