POV-Ray : Newsgroups : povray.advanced-users : Intersection Testing in #while loops. Server Time
2 Nov 2024 03:15:24 EDT (-0400)
  Intersection Testing in #while loops. (Message 1 to 4 of 4)  
From: Ken
Subject: Intersection Testing in #while loops.
Date: 10 Mar 2000 13:49:45
Message: <38C9444B.1A6E92FB@pacbell.net>
If I create a group of objects with a while loop

#declare Thing =
union {
 #declare a = 0;
   #while (a<10)
     #declare b = 0;
       #while (b<10)
         sphere{<a,b,0>,1}
       #declare b=b+1;
     #end
   #declare a=a+1;
 #end
}

and then intersected my new object Thing with a plane

intesection {
 object{ Thing }
  plane {y,0 }
}

would the intersection testing be done only to those objects that the
plane actually comes in contact with or would the intersection testing
be done against every object in the object Thing ?

-- 
Ken Tyler -  1300+ Povray, Graphics, 3D Rendering, and Raytracing Links:
http://home.pacbell.net/tylereng/index.html http://www.povray.org/links/


Post a reply to this message

From: PoD
Subject: Re: Intersection Testing in #while loops.
Date: 10 Mar 2000 14:33:50
Message: <38C9528C.CBB5E10E@merlin.net.au>
Ken wrote:
> 
> If I create a group of objects with a while loop
> 
> #declare Thing =
> union {
>  #declare a = 0;
>    #while (a<10)
>      #declare b = 0;
>        #while (b<10)
>          sphere{<a,b,0>,1}
>        #declare b=b+1;
>      #end
>    #declare a=a+1;
>  #end
> }
> 
> and then intersected my new object Thing with a plane
> 
> intesection {
>  object{ Thing }
>   plane {y,0 }
> }
> 
> would the intersection testing be done only to those objects that the
> plane actually comes in contact with or would the intersection testing
> be done against every object in the object Thing ?
> 
> --
> Ken Tyler -  1300+ Povray, Graphics, 3D Rendering, and Raytracing Links:
> http://home.pacbell.net/tylereng/index.html http://www.povray.org/links/

Good question. I suspect that all objects will be tested for
intersection.
It should be possible during parsing to test whether objects in an
intersection will actually intersect, at least for simple primitives.

PoD.


Post a reply to this message

From: Ron Parker
Subject: Re: Intersection Testing in #while loops.
Date: 10 Mar 2000 16:01:19
Message: <38c9629f$1@news.povray.org>
On Fri, 10 Mar 2000 10:51:55 -0800, Ken wrote:
>
>If I create a group of objects with a while loop
[...]
>and then intersected my new object Thing with a plane
>
>intesection {
> object{ Thing }
>  plane {y,0 }
>}
>
>would the intersection testing be done only to those objects that the
>plane actually comes in contact with or would the intersection testing
>be done against every object in the object Thing ?

Only the object it comes in contact with, in this case, but only because
you picked such an easy plane.

POV computes the bounding box of the intersection by intersecting the
bounding boxes of its constituents.  If a plane is axis-aligned, as 
yours is, its bounding box is the half-space that would be considered
its "inside".  So the intersection of the two bounding boxes is the 
half of the union's bounding box that is inside the plane.

Had you intersected with plane {x+y,0}, however, this optimization would
not have happened.  You could still attempt to bound it manually.

-- 
These are my opinions.  I do NOT speak for the POV-Team.
The superpatch: http://www2.fwi.com/~parkerr/superpatch/
My other stuff: http://www2.fwi.com/~parkerr/traces.html


Post a reply to this message

From: Ken
Subject: Re: Intersection Testing in #while loops.
Date: 11 Mar 2000 07:57:35
Message: <38CA4323.33636462@pacbell.net>
Ron Parker wrote:

> Only the object it comes in contact with, in this case, but only because
> you picked such an easy plane.
> 
> POV computes the bounding box of the intersection by intersecting the
> bounding boxes of its constituents.  If a plane is axis-aligned, as
> yours is, its bounding box is the half-space that would be considered
> its "inside".  So the intersection of the two bounding boxes is the
> half of the union's bounding box that is inside the plane.
> 
> Had you intersected with plane {x+y,0}, however, this optimization would
> not have happened.  You could still attempt to bound it manually.

I suspected this was the case since some CSG operations on groups
of objects seem to operate much faster than they do on others.

Thanks for the input,

-- 
Ken Tyler -  1300+ Povray, Graphics, 3D Rendering, and Raytracing Links:
http://home.pacbell.net/tylereng/index.html http://www.povray.org/links/


Post a reply to this message

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