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 00:37:43 EDT (-0400)
  Re: An inside/outside test for triangles mesh  
From: Ron Parker
Date: 5 Mar 1999 08:39:48
Message: <36dfdea4.0@news.povray.org>
On Thu, 04 Mar 1999 23:29:46 -0500, Nathan Kopp <Nat### [at] Koppcom> wrote:
>I like this.

For more details, look for a posting I made to cgrr sometime in the past couple
of months that talks about this in excruciating detail.

>> A side note, and hopefully Nathan will see this too and make sure he's dealing
>> with it correctly: CSG requires more than just an insideness test.  It also
>> requires that the All_Intersections method really return all intersections,
>> because if the closest one fails it wants to find the next-closest.  Internally
>> bounded meshes DO NOT do this by default, because of the optimization I noted
>> above.
>
>What part of CSG requires that All_Intersections push everything onto the depth
>stack (it's been a while)?  (I knew that mesh optimized that, since I had to
>skip that part in order to count every intersection.)

That would be this part, in csg.c:

static int All_CSG_Intersect_Intersections (OBJECT *Object, RAY *Ray, 
	ISTACK *Depth_Stack)
{

[...]

      if (All_Intersections (Current_Sib, Ray, Local_Stack))
      {
        while ((Sibling_Intersection = pop_entry(Local_Stack)) != NULL)

I wouldn't have known about it myself if I hadn't seen it pointed out in the
isosurface documentation.  Normally, I wouldn't read the docs, but I was in
the process of formatting them for the Superpatch docs at the time...

>What about using the already existing surface
>normals (stored in the mesh structure)?  Of course, that would require any
>user-specified normals to always point 'out'.  Just a thought.

Of course.  I think reorientation should take place after normal calculation,
however the normal calculation takes place.  If two adjacent triangles have
opposing normals, flip one.  Do this until the whole mesh is consistent (there
are obviously more efficient ways to do this.  I explained one in the cgrr post
I mentioned above.)  The result is that all normals are either pointing inward
or outward, except that you have to treat unconnected (but closed) meshes
specially to ensure consistency between components.  The final step is to ensure
that a point that is known to be outside tests as outside; if not, flip the 
inverse flag.


Post a reply to this message

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