POV-Ray : Newsgroups : povray.programming : An inside/outside test for triangles mesh : Re: An inside/outside test for triangles mesh Server Time
29 Jul 2024 06:26:47 EDT (-0400)
  Re: An inside/outside test for triangles mesh  
From: ingo
Date: 12 Mar 1999 15:55:49
Message: <36e97f55.0@news.povray.org>
Ron Parker heeft geschreven in bericht <36e9176a.0@news.povray.org>...
>Consider a mesh of a bowl.  Any point in the part where the Chocolate
>Frosted Sugar Bombs go would be considered "inside" by this method, as
>would a good number of points in the environment, including some below
>the surface of the table (due to the rim of the bowl).
>
>Even convex polyhedra would have problems.  Consider a football (without
>seams.)  It's convex, but the intersections of the prisms associated with
>triangles near opposite ends are outside the surface of the football.


I'm not hamperd by any knowledge of programming and raytracing theory, so if
what I try to say is bare nonsense have a good laugh, but please tell me
why.

I can imagine using planes instead of prisms to represent the triangles (in
a closed mesh). First use Ron's method to check if the mesh is closed. Then
for every triangle calculate the normal. Follow each normal in both
directions and count the intersections, to determine the inside (odd
number). Then replace the triangle by a plane with the "outside normal".
Then for every plane check wether all points of the mesh are on the inside
of the plane. Give these triangles the status intersection. All others get
the status union.
Now get the first triangle/plane with the status union, check what status
the neighbour triangles have. Is it union, put all these planes in a union
statement. Check the neighbours of the neighbours and so on until all
neighbour  triangles have the status intersection. Now go to the next "union
triangle" that is not in the first union already. Start a new union.
Repeat all this till there are no union triangles left. Now put all the
union blocks together with all triangles with status intersection in an
intersection block. The result should be a solid shape.
Does this make sense?
Something like this:

intersection{
      union{
         plane{-z, 0.5}
         plane{<-1,0,-1>,0}
         plane{< 1,0,-1>,0}
      }
      plane{-z, 1.5}
      plane{<-1,0,-1>,(4*sqrt(2)/2)}
      plane{< 1,0,-1>,(4*sqrt(2)/2)}
      plane{-x,3.5}
      plane{ x,3.5}
      plane{<-1,0, 1>,(4*sqrt(2)/2)}
      plane{< 1,0, 1>,(4*sqrt(2)/2)}
      plane{ z, 1.5}
      union{
         plane{ z, 0.5}
         plane{<-1,0, 1>,0}
         plane{< 1,0, 1>,0}
      }
   plane{y,1}
   plane{-y,1}
   pigment {rgb 0.8}
}

ingo
--
Met dank aan de muze met het glazen oog.


Post a reply to this message

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