|
|
> Is there a way to test a macro against an entire scene? I need this for a
> collision detection macro I am trying to make, my current method is to use
> trace() to find the distance from the center of the sphere and test that
> against the radius, is there a better way? Thanks for your time.
correct me if I'm wrong, but I believe this is impossible.
For example: take the following scene:
//a simple room
box {-1,1}
//calculate the intersection of the calculated path with the scene
#declare Normal=<0,0,0>;
#declare Location=trace(<0,0,0>,<-1,1,1>,Normal); //first vector: startpoint, second
vector: direction, third vector: normal of intersection
//add the sphere
sphere {Location-Normal*.5,.5}
//calculate the intersection of another calculated path with the scene
#declare Normal=<0,0,0>;
#declare Location=trace(<0,0,0>,<-1,1,1>,Normal);
//add the sphere
sphere {Location-Normal*.5,.5}
//end of scene-file
However, in order to calculate the location of the first sphere, the parser needs to
know
all the objects in the scene, so it first has to parse the rest of the scene-file.
But
then it reaches another trace-call. Now what? In order to compute the first trace,
it
has to know the second, but in order to calculate the second, it has to know the
first,
because both trace-calls alter the scene.
Well, it might not be impossible, it might not even be hard at all to solve this
problem,
but this is a very simple example of a problem that might come with a global
trace-function (or any other thing that tests for the entire scene)
I hope this makes some sense...
cu!
--
camera{location-z*3}#macro G(b,e)b+(e-b)*(C/50)#end#macro L(b,e,k,l)#local C=0
;#while(C<50)sphere{G(b,e),.1pigment{rgb G(k,l)}finish{ambient 1}}#local C=C+1
;#end#end L(y-x,y,x,x+y)L(y,-x-y,x+y,y)L(-x-y,-y,y,y+z)L(-y,y,y+z,x+y)L(0,x+y,
<.5,1,.5>,x)L(0,x-y,<.5,1,.5>,x) // ZK http://www.povplace.be.tf
Post a reply to this message
|
|