POV-Ray : Newsgroups : povray.general : Testing for intersection of two objects Server Time
17 Oct 2026 05:49:14 EDT (-0400)
  Testing for intersection of two objects (Message 1 to 21 of 21)  
From: Mike the Elder
Subject: Testing for intersection of two objects
Date: 24 Jul 2006 15:15:01
Message: <web.44c51bba804fff24aaf01cad0@news.povray.org>
Is there a reasonably simple way in POV-Ray to produce a Boolean value
representing whether or no two objects intersect?  As in...

#if ("object{Thing1} intersects object{Thing2}")
      // STUFF TO DO IF THEY INTERSECT
#else
      // STUFF TO DO IF THEY DON'T INTERSECT
#end

I would very much appreciate if some kind soul could point out the section
of the documentation and/or available resources that deal with this issue.

Thanks in advance.

Mike C.


Post a reply to this message

From: Zeger Knaepen
Subject: Re: Testing for intersection of two objects
Date: 24 Jul 2006 15:38:45
Message: <44c521c5$1@news.povray.org>
"Mike the Elder" <zer### [at] wyanorg> wrote in message 
news:web.44c51bba804fff24aaf01cad0@news.povray.org...
> Is there a reasonably simple way in POV-Ray to produce a Boolean value
> representing whether or no two objects intersect?  As in...
> 
> #if ("object{Thing1} intersects object{Thing2}")
>       // STUFF TO DO IF THEY INTERSECT
> #else
>       // STUFF TO DO IF THEY DON'T INTERSECT
> #end
> 
> I would very much appreciate if some kind soul could point out the 
section
> of the documentation and/or available resources that deal with this 
issue.

For some simple objects, this could be done, but most of the time it 
would be impossible to do accurately imho :-/
best you can do, is to check if the bounding boxes intersect

cu!
-- 
#macro G(b,e)b+(e-b)*C/50#end#macro _(b,e,k,l)#local C=0;#while(C<50)
sphere{G(b,e)+3*z.1pigment{rgb G(k,l)}finish{ambient 1}}#local C=C+1;
#end#end _(y-x,y,x,x+y)_(y,-x-y,x+y,y)_(-x-y,-y,y,y+z)_(-y,y,y+z,x+y)
_(0x+y.5+y/2x)_(0x-y.5+y/2x)            // ZK http://www.povplace.com


Post a reply to this message

From: Abe
Subject: Re: Testing for intersection of two objects
Date: 24 Jul 2006 16:15:00
Message: <web.44c529e1c08fcd85c5588fc70@news.povray.org>
"Mike the Elder" <zer### [at] wyanorg> wrote:
> Is there a reasonably simple way in POV-Ray to produce a Boolean value
> representing whether or no two objects intersect?  As in...
>
> #if ("object{Thing1} intersects object{Thing2}")
>       // STUFF TO DO IF THEY INTERSECT
> #else
>       // STUFF TO DO IF THEY DON'T INTERSECT
> #end
>
> I would very much appreciate if some kind soul could point out the section
> of the documentation and/or available resources that deal with this issue.
>
> Thanks in advance.
>
> Mike C.

I was interested in your problem and did a couple of quick tests. Testing
min_extent and max_extent on two spheres known to intersect produced
predictable results. When the spheres did not intersect, the results for
the intersection object were as follows.

min_extent = <-10000000000.000000,-10000000000.000000,-10000000000.000000>
max_extent = <10000000000.000000,10000000000.000000,10000000000.000000>

So it looks like this could be used as a test, although I don't really know
how robust it is.

Abe


Post a reply to this message

From: Trevor G Quayle
Subject: Re: Testing for intersection of two objects
Date: 24 Jul 2006 17:20:00
Message: <web.44c53894c08fcd85c150d4c10@news.povray.org>
"Mike the Elder" <zer### [at] wyanorg> wrote:
> Is there a reasonably simple way in POV-Ray to produce a Boolean value
> representing whether or no two objects intersect?  As in...
>
> #if ("object{Thing1} intersects object{Thing2}")
>       // STUFF TO DO IF THEY INTERSECT
> #else
>       // STUFF TO DO IF THEY DON'T INTERSECT
> #end
>
> I would very much appreciate if some kind soul could point out the section
> of the documentation and/or available resources that deal with this issue.
>
> Thanks in advance.
>
> Mike C.

Perhaps you can use CSG "intersect{}" and then chack min_extents,
max_extents.
Haver a look at this and see if you can get something to work out of it:

//START
global_settings {
  max_trace_level 15
  ambient_light 1
  adc_bailout 0.0001
}


camera {
  location  <0,3,-5>
  look_at   0
}


#declare LB=
sphere{0 50 hollow no_image
  texture{pigment{rgb 1} finish{ambient 20}}
}

light_source{0 rgb 1
  looks_like{LB}
  fade_power 2  fade_distance 300
  translate <0,100,-100>
}



#declare Obj1=sphere{<0,0,0> 1 pigment{rgb<1,0,0>}}
#declare Obj2=sphere{<-2.5,0,0> 1 pigment{rgb<0,1,0>}}
#declare Obj3=sphere{<1.5,0,0> 1 pigment{rgb<0,0,1>}}

object{Obj1}
object{Obj2}
object{Obj3}

#declare Int12=intersection{object{Obj1}object{Obj2}}
#declare Int13=intersection{object{Obj1}object{Obj3}}

#declare Siz12=vlength(min_extent(Int12)-max_extent(Int12));
#declare Siz13=vlength(min_extent(Int13)-max_extent(Int13));

text {ttf "arial.ttf",str(Siz12,0,3),0.1,0 scale 1/3 translate <-2.5,1.5,0>
pigment{rgb 1}}
text {ttf "arial.ttf",str(Siz13,0,3),0.1,0 scale 1/3 translate <1.5,1.5,0>
pigment{rgb 1}}
//END

-tgq


Post a reply to this message

From: Mike Williams
Subject: Re: Testing for intersection of two objects
Date: 24 Jul 2006 17:23:35
Message: <h0qrynASpTxEFw04@econym.demon.co.uk>
Wasn't it Abe who wrote:
>"Mike the Elder" <zer### [at] wyanorg> wrote:
>> Is there a reasonably simple way in POV-Ray to produce a Boolean value
>> representing whether or no two objects intersect?  As in...
>>
>> #if ("object{Thing1} intersects object{Thing2}")
>>       // STUFF TO DO IF THEY INTERSECT
>> #else
>>       // STUFF TO DO IF THEY DON'T INTERSECT
>> #end
>>
>> I would very much appreciate if some kind soul could point out the section
>> of the documentation and/or available resources that deal with this issue.
>>
>> Thanks in advance.
>>
>> Mike C.
>
>I was interested in your problem and did a couple of quick tests. Testing
>min_extent and max_extent on two spheres known to intersect produced
>predictable results. When the spheres did not intersect, the results for
>the intersection object were as follows.
>
>min_extent = <-10000000000.000000,-10000000000.000000,-10000000000.000000>
>max_extent = <10000000000.000000,10000000000.000000,10000000000.000000>
>
>So it looks like this could be used as a test, although I don't really know
>how robust it is.

POV calculates the intersection of the bounding boxes (because it can
calculate that) and uses that as the bounding box for the intersection
(which would be next to impossible to calculate in the general case). 

If you consider these non-intersecting spheres
intersection {
  sphere {0,1}
  sphere {0,1 translate <1.2,1.2,1.2>}
  pigment {rgb x}
}

Their bounding boxes do intersect at the corner, like this
intersection {
  box{-1,1}
  box {-1,1 translate <1.2,1.2,1.2>}
  pigment {rgb x}
}

So that method would be wrong in suggesting that the spheres
intersected.

-- 
Mike Williams
Gentleman of Leisure


Post a reply to this message

From: Warp
Subject: Re: Testing for intersection of two objects
Date: 24 Jul 2006 18:24:23
Message: <44c54897$1@news.povray.org>
Mike the Elder wrote:
> Is there a reasonably simple way in POV-Ray to produce a Boolean value
> representing whether or no two objects intersect?

   Don't pay too much attention to the other answers because in the
generic case what you ask is just not possible (not even in theory,
at least not in a reasonable time with perfect accuracy).

   You could use a *really* slow method of sampling points inside the
bounding box of one of the objects and seeing if a point is inside
both objects, but this would be very slow and quite inaccurate (you
could, of course, increase accuracy by taking more samples, but there
would still be a margin of error and the amount of time required
probably grows by the power of 3).


Post a reply to this message

From: Abe
Subject: Re: Testing for intersection of two objects
Date: 24 Jul 2006 20:10:01
Message: <web.44c5602fc08fcd85131048ba0@news.povray.org>
Mike Williams <nos### [at] econymdemoncouk> wrote:
> Wasn't it Abe who wrote:
> >"Mike the Elder" <zer### [at] wyanorg> wrote:
> >> Is there a reasonably simple way in POV-Ray to produce a Boolean value
> >> representing whether or no two objects intersect?  As in...
> >>
> >> #if ("object{Thing1} intersects object{Thing2}")
> >>       // STUFF TO DO IF THEY INTERSECT
> >> #else
> >>       // STUFF TO DO IF THEY DON'T INTERSECT
> >> #end
> >>
> >> I would very much appreciate if some kind soul could point out the section
> >> of the documentation and/or available resources that deal with this issue.
> >>
> >> Thanks in advance.
> >>
> >> Mike C.
> >
> >I was interested in your problem and did a couple of quick tests. Testing
> >min_extent and max_extent on two spheres known to intersect produced
> >predictable results. When the spheres did not intersect, the results for
> >the intersection object were as follows.
> >
> >min_extent = <-10000000000.000000,-10000000000.000000,-10000000000.000000>
> >max_extent = <10000000000.000000,10000000000.000000,10000000000.000000>
> >
> >So it looks like this could be used as a test, although I don't really know
> >how robust it is.
>
> POV calculates the intersection of the bounding boxes (because it can
> calculate that) and uses that as the bounding box for the intersection
> (which would be next to impossible to calculate in the general case).
>
> If you consider these non-intersecting spheres
> intersection {
>   sphere {0,1}
>   sphere {0,1 translate <1.2,1.2,1.2>}
>   pigment {rgb x}
> }
>
> Their bounding boxes do intersect at the corner, like this
> intersection {
>   box{-1,1}
>   box {-1,1 translate <1.2,1.2,1.2>}
>   pigment {rgb x}
> }
>
> So that method would be wrong in suggesting that the spheres
> intersected.
>
> --
> Mike Williams
> Gentleman of Leisure

Ha! An inconvenient exception. I think I'll choose to ignore it.
[retreats into own mental bounding box]


Post a reply to this message

From: NEWS
Subject: Re: Testing for intersection of two objects
Date: 25 Jul 2006 07:01:35
Message: <44c5fa0f$1@news.povray.org>
well , from what i have see

Povray uses a default value min_extent() of -1 , if the object exists or not
, and use a default value max_extent() of 1 if the object exist or not

then if i use this
#local U=intersection { box {0,1}  box {2,3}}

and

#local U2= object {U scale 1000}

if the object  U doesnt exists then we will always have

[max_entent(U2) - max_entent(U) ].x = 0     and
[max_entent(U2) - max_entent(U) ].y = 0     and
[max_entent(U2) - max_entent(U) ].z = 0

and


[min_entent(U2) - min_entent(U)].x =0 and
[min_entent(U2) - min_entent(U)].x =0 and
[min_entent(U2) - min_entent(U)].x =0




In brief ..scaling a non existing object will give the same min_extend value
and max_extend value that the non-scaled object .. if not then the object
always exists ..



























"Warp" <war### [at] tagpovrayorg> a écrit dans le message de
news:44c54897$1@news.povray.org...
> Mike the Elder wrote:
> > Is there a reasonably simple way in POV-Ray to produce a Boolean value
> > representing whether or no two objects intersect?
>
>    Don't pay too much attention to the other answers because in the
> generic case what you ask is just not possible (not even in theory,
> at least not in a reasonable time with perfect accuracy).
>
>    You could use a *really* slow method of sampling points inside the
> bounding box of one of the objects and seeing if a point is inside
> both objects, but this would be very slow and quite inaccurate (you
> could, of course, increase accuracy by taking more samples, but there
> would still be a margin of error and the amount of time required
> probably grows by the power of 3).


Post a reply to this message

From: Nekar
Subject: Re: Testing for intersection of two objects
Date: 25 Jul 2006 08:13:41
Message: <44c60af5@news.povray.org>
"NEWS" <pen### [at] caramailfr> wrote in message 
news:44c5fa0f$1@news.povray.org...
> well , from what i have see
>
> Povray uses a default value min_extent() of -1 , if the object exists or 
> not
> , and use a default value max_extent() of 1 if the object exist or not
>
> then if i use this
> #local U=intersection { box {0,1}  box {2,3}}
>
> and
>
> #local U2= object {U scale 1000}
>
> if the object  U doesnt exists then we will always have
>
> [max_entent(U2) - max_entent(U) ].x = 0     and
> [max_entent(U2) - max_entent(U) ].y = 0     and
> [max_entent(U2) - max_entent(U) ].z = 0
>
> and
>
>
> [min_entent(U2) - min_entent(U)].x =0 and
> [min_entent(U2) - min_entent(U)].x =0 and
> [min_entent(U2) - min_entent(U)].x =0
>
>
>
>
> In brief ..scaling a non existing object will give the same min_extend 
> value
> and max_extend value that the non-scaled object .. if not then the object
> always exists ..
>
>
Fine for boxes only. anything else will test wrong. The corners of two 
sphere's bounding boxes could intersect without the sphere's intersecting 
each other at all. May be it's possible to test it by using the mathematical 
formula for each object instead - I'm not sure.


-- 
-Nekar Xenos
"The truth is out there"


Post a reply to this message

From: NEWS
Subject: Re: Testing for intersection of two objects
Date: 25 Jul 2006 10:15:42
Message: <44c6278e$1@news.povray.org>
i think you must read again ...

i check the bounding  of the intersection ... and not the intersection of 2
bounding ...














"Nekar" <ger### [at] rpmmagcoza> a écrit dans le message de
news:44c60af5@news.povray.org...
>
> "NEWS" <pen### [at] caramailfr> wrote in message
> news:44c5fa0f$1@news.povray.org...
> > well , from what i have see
> >
> > Povray uses a default value min_extent() of -1 , if the object exists or
> > not
> > , and use a default value max_extent() of 1 if the object exist or not
> >
> > then if i use this
> > #local U=intersection { box {0,1}  box {2,3}}
> >
> > and
> >
> > #local U2= object {U scale 1000}
> >
> > if the object  U doesnt exists then we will always have
> >
> > [max_entent(U2) - max_entent(U) ].x = 0     and
> > [max_entent(U2) - max_entent(U) ].y = 0     and
> > [max_entent(U2) - max_entent(U) ].z = 0
> >
> > and
> >
> >
> > [min_entent(U2) - min_entent(U)].x =0 and
> > [min_entent(U2) - min_entent(U)].x =0 and
> > [min_entent(U2) - min_entent(U)].x =0
> >
> >
> >
> >
> > In brief ..scaling a non existing object will give the same min_extend
> > value
> > and max_extend value that the non-scaled object .. if not then the
object
> > always exists ..
> >
> >
> Fine for boxes only. anything else will test wrong. The corners of two
> sphere's bounding boxes could intersect without the sphere's intersecting
> each other at all. May be it's possible to test it by using the
mathematical
> formula for each object instead - I'm not sure.
>
>
> -- 
> -Nekar Xenos
> "The truth is out there"
>
>


Post a reply to this message

From: Mike Williams
Subject: Re: Testing for intersection of two objects
Date: 25 Jul 2006 10:56:57
Message: <BEkjeIAqCjxEFwTF@econym.demon.co.uk>
Wasn't it NEWS who wrote:
>i think you must read again ...
>
>i check the bounding  of the intersection ... and not the intersection of 2
>bounding ...

I think you missed this bit from earlier in the thread:

  POV calculates the intersection of the bounding boxes (because it can
  calculate that) and uses that as the bounding box for the intersection
  (which would be next to impossible to calculate in the general case). 

-- 
Mike Williams
Gentleman of Leisure


Post a reply to this message

From: Warp
Subject: Re: Testing for intersection of two objects
Date: 25 Jul 2006 11:10:23
Message: <44c6345f$1@news.povray.org>
NEWS wrote:
> i check the bounding  of the intersection ... and not the intersection of 2
> bounding ...

   That doesn't tell whether the objects are intersecting or not,
only if their bounding boxes are.

   There's no reasonable way for POV-Ray to tell for sure if two
objects are intersecting or not.


Post a reply to this message

From: Trevor G Quayle
Subject: Re: Testing for intersection of two objects
Date: 25 Jul 2006 12:20:00
Message: <web.44c64433c08fcd85c150d4c10@news.povray.org>
Warp <war### [at] tagpovrayorg> wrote:
> NEWS wrote:
> > i check the bounding  of the intersection ... and not the intersection of 2
> > bounding ...
>
>    That doesn't tell whether the objects are intersecting or not,
> only if their bounding boxes are.
>
>    There's no reasonable way for POV-Ray to tell for sure if two
> objects are intersecting or not.

What's the disadvantage of what I suggested?  Instead of checking for the
intersecting of bounding boxes, check the min and max extents of a CSG
intersection.  The only odd part is when I test it, when there is no
intersection, the min-max is not zero, but a very large number, but this
should still be usable, basically check the min-max of a CSG intersection
vs the min-max of a CSG union.

-tgq


Post a reply to this message

From: Charles C
Subject: Re: Testing for intersection of two objects
Date: 25 Jul 2006 13:10:00
Message: <web.44c64febc08fcd85b160ffde0@news.povray.org>
>    There's no reasonable way for POV-Ray to tell for sure if two
> objects are intersecting or not.

Ah, but there are always the unreasonably cumbersome ways to know whether it
is likely.... You can also render that CSG difference scaled to fit the
screen and have your pet monkey tell you whether it sees any color....  Or
you could make use of a trace, or feed the above rendering back in and use
eval_pigment instead of the monkey.

Who needs "reasonable"? :)

Charles


Post a reply to this message

From: Mike the Elder
Subject: Re: Testing for intersection of two objects
Date: 25 Jul 2006 13:50:01
Message: <web.44c65863c08fcd85aaf01cad0@news.povray.org>
Thanks to all who tried to help. If I come up with anything that works
fairly well,I will certainly post it.

To Charles: Sadly, my monkey is not availble to assist.  He was busy trying
to type out "Hamlet" and got as far as "... To be or not to be; that is the
qestibjdkjnmksyg..." when he threw up is arms in disgust and walked off to
get drunk with an infinite number of chums.

Best wishes to all,
-Mike C.


Post a reply to this message

From: Trevor G Quayle
Subject: Re: Testing for intersection of two objects
Date: 25 Jul 2006 15:30:00
Message: <web.44c67114c08fcd85c150d4c10@news.povray.org>
"Trevor G Quayle" <Tin### [at] hotmailcom> wrote:
> Warp <war### [at] tagpovrayorg> wrote:
> > NEWS wrote:
> > > i check the bounding  of the intersection ... and not the intersection of 2
> > > bounding ...
> >
> >    That doesn't tell whether the objects are intersecting or not,
> > only if their bounding boxes are.
> >
> >    There's no reasonable way for POV-Ray to tell for sure if two
> > objects are intersecting or not.
>
> What's the disadvantage of what I suggested?  Instead of checking for the
> intersecting of bounding boxes, check the min and max extents of a CSG
> intersection.  The only odd part is when I test it, when there is no
> intersection, the min-max is not zero, but a very large number, but this
> should still be usable, basically check the min-max of a CSG intersection
> vs the min-max of a CSG union.
>
> -tgq

ok, I did some more testing and it doesn't always work, I guess I just got
lucky with the first couple tests I tried...

-tgq


Post a reply to this message

From: Mike the Elder
Subject: Re: Testing for intersection of two objects
Date: 25 Jul 2006 15:50:00
Message: <web.44c674ddc08fcd85aaf01cad0@news.povray.org>
Testing the min_extent (or max_extent) of the intesetion of the two objects
seems to work pretty well.

In the example below, "TheBox" will intersect "TheSphere" iff "SphereRadius"
has a magnitude of 1 or more.

===============================================
#declare SphereRadius = 1;      //Just big enough
#declare TheBox = box{<1,1,1>,<-1,-1,-1>}
#declare TheSphere = sphere{<2,0,0>,SphereRadius}
#declare TestThing = intersection{object{TheBox} object{TheSphere}}

#if (min_extent(TestThing).x > -1000000)
        #warning "Yes, they intersect."
#else
        #warning "No, they do not intersect."
#end
===============================================
produces: "Parse Warning: Yes, they intersect."

AND

===============================================
#declare SphereRadius = .999999;       //Just too small
#declare TheBox = box{<1,1,1>,<-1,-1,-1>}
#declare TheSphere = sphere{<2,0,0>,SphereRadius}
#declare TestThing = intersection{object{TheBox} object{TheSphere}}

#if (min_extent(TestThing).x > -1000000)
        #warning "Yes, they intersect."
#else
        #warning "No, they do not intersect."
#end
===============================================
produces: "Parse Warning: No, they do not intersect."


In a further experiment, where one of the test objects was a slightly more
complex object (a union of several spheres) the results remained
consistent.  This method seems quite sufficient for my purpose.  (Which, by
the way, is filling a box with "packing peanuts" turned every which way so
that no two "peanuts" will occupy the same space.)

Thanks again to all who contributed.

-Mike C.


Post a reply to this message

From: Warp
Subject: Re: Testing for intersection of two objects
Date: 25 Jul 2006 19:37:23
Message: <44c6ab33$1@news.povray.org>
Mike the Elder wrote:
> Testing the min_extent (or max_extent) of the intesetion of the two objects
> seems to work pretty well.

   It works pretty well if it's enough to see if the bounding boxes
of the objects intersect.
   However, bounding box is not the same as the object. In some cases
the bounding boxes may intersect but the objects don't.


Post a reply to this message

From: Larry Hudson
Subject: Re: Testing for intersection of two objects
Date: 25 Jul 2006 20:46:26
Message: <44c6bb62$1@news.povray.org>
Mike the Elder wrote:
> To Charles: Sadly, my monkey is not availble to assist.  He was busy trying
> to type out "Hamlet" and got as far as "... To be or not to be; that is the
> qestibjdkjnmksyg..." when he threw up is arms in disgust and walked off to
> get drunk with an infinite number of chums.

And to meet up with Bob Newhart, I suppose??     ;-)

      -=- Larry -=-


Post a reply to this message

From: Mike the Elder
Subject: Re: Testing for intersection of two objects
Date: 26 Jul 2006 08:40:00
Message: <web.44c76258c08fcd85605cbb800@news.povray.org>
Warp <war### [at] tagpovrayorg> wrote:
> Mike the Elder wrote:
> > Testing the min_extent (or max_extent) of the intesetion of the two objects
> > seems to work pretty well.
>
>    It works pretty well if it's enough to see if the bounding boxes
> of the objects intersect.
>    However, bounding box is not the same as the object. In some cases
> the bounding boxes may intersect but the objects don't.

Warp is, of course, correct about this. Two shperes of radius 1 located at
<-1,-1,-1> and <1,1,1> read incorrectly as intersecting when it is just
their bounding boxes that touch.  For the "packing peanut" problem,
however, the min_extent test method, combined with some fudged tolerances
for moving each new "peanut" just a bit past the first point of positive
itersection testing SHOULD (I hope) provide a way of piling up a bunch of
them in a more efficient manner than placing hundres of them individually.
Designing the individual "peanut" in such a way that it mostly fills a box
sould also help.

Best Wishes All,
- MIke C.


Post a reply to this message

From: Tim Attwood
Subject: Re: Testing for intersection of two objects
Date: 27 Jul 2006 00:02:04
Message: <44c83abc$1@news.povray.org>
> you could make use of a trace, or feed the above rendering back in and use
> eval_pigment instead of the monkey.

Who needs a monkey when you have a computer?
This isn't perfect, as Warp pointed out, sometimes this method will fail
to detect intersecting objects. Mostly it works though.

#include "rand.inc"

#macro collision(A B rez)
   #local result = false;
   #if (((min_extent(A).x > max_extent(B).x ) |
         (min_extent(B).x > max_extent(A).x ) |
         (min_extent(A).y > max_extent(B).y ) |
         (min_extent(B).y > max_extent(A).y ) |
         (min_extent(A).z > max_extent(B).z ) |
         (min_extent(B).z > max_extent(A).z ))=false)
      #local AB = intersection{object{A} object{B}};
      #local Mn = min_extent(AB);
      #local Mx = max_extent(AB);
      #local S1 = seed(1);
      #local Pt = VRand_In_Box(Mn, Mx, S1);
      #local cnt = 0;
      #while ((result = false) & (cnt < rez))
         #local Pt = VRand_In_Box(Mn, Mx, S1);
         #if (inside(AB, Pt))
            #local result = true;
         #end
         #local cnt = cnt + 1;
      #end
   #end
   result
#end

#declare sample1 = union {
   box {<0,0,0>,<1,1,1>}
   sphere{<0,1,0>,0.1}
   pigment{Red}
};

#declare sample2 = union {
   box {<0,0,0>,<1,1,1>}
   sphere{<1,0,0>,0.1}
   sphere{<0,0,0>,0.1}
   pigment{Blue}
   translate <-1.05,0.25,0>
};

#local result = collision(sample1 sample2 1000);


Post a reply to this message

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