|
|
|
|
|
|
| |
| |
|
|
|
|
| |
| |
|
|
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
|
|
| |
| |
|
|
|
|
| |
| |
|
|
"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
|
|
| |
| |
|
|
|
|
| |
| |
|
|
"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
|
|
| |
| |
|
|
|
|
| |
| |
|
|
"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
|
|
| |
| |
|
|
|
|
| |
| |
|
|
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
|
|
| |
| |
|
|
|
|
| |
| |
|
|
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
|
|
| |
| |
|
|
|
|
| |
| |
|
|
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
|
|
| |
| |
|
|
|
|
| |
| |
|
|
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 ..
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
|
|
| |
| |
|
|
|
|
| |
| |
|
|
"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
|
|
| |
| |
|
|
|
|
| |
| |
|
|
i think you must read again ...
i check the bounding of the intersection ... and not the intersection of 2
bounding ...
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
|
|
| |
| |
|
|
|
|
| |
|
|