POV-Ray : Newsgroups : povray.advanced-users : Degenerate triangles mesh vs. union : Re: Degenerate triangles mesh vs. union Server Time
30 Jul 2024 10:14:31 EDT (-0400)
  Re: Degenerate triangles mesh vs. union  
From: Ken
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.