Differences between revisions 1 and 4 (spanning 3 versions)
Revision 1 as of 2003-08-27 16:30:14
Size: 671
Editor: velociraptor
Comment:
Revision 4 as of 2003-08-28 16:25:50
Size: 821
Editor: velociraptor
Comment:
Deletions are marked like this. Additions are marked like this.
Line 3: Line 3:
/*
     First we must build the diff relation. It is interesting to not that this relation is what will limit the other relations
*/
begin%RECURSIVE%
Line 7: Line 5:
diff(x,y,z) :- x=0, y=0, z=0.
diff(x,y,z) :- diff(x1,y,z1), x-x1=1, z-z1=1.
diff(x,y,z) :- diff(x,y1,z1), y-y1=1, z1-z=1.
/*
     First we must build the diff relation. It is interesting
     to note that this relation is what will limit the other
     relations
*/
 
diff(x,y,z) :- x-y>=0, -x+y>=0, z>=0, -z>=0.
diff(x,y,z) :- diff(x1,y,z1), x-x1<=1, x-x1>=1, z-z1<=1, z-z1>=1.
diff(x,y,z) :- diff(x,y1,z1), y-y1<=1, y-y1>=1, z1-z<=1, z1-z>=1.
Line 12: Line 16:
line(0,1024, 0).
line(x,y,d) :- line(p1,p2,d1),
               diff(p,p1,z1), diff(p2,p,z),

               diff(x,p1,z2), diff(p,x,z2),
               diff(p2,y,z3), diff(y,p,z3),
line(0,6, 0).   /* Recursive line definition */
line(x,y,d) :- line(p1,p2,d1),                  diff(p,p1,z1), diff(p2,p,z),
               diff(x,p1,z2), diff(p,x,z2), 
               diff(p2,y,z3), diff(y,p,z3), 
Line 19: Line 25:
end%RECURSIV%

Given a line in one dimension from p1 to p2, we can find the line of length 1/2 (p2-p1) centered around the midpoint of the first line in MLPQ as follows:

begin%RECURSIVE%

/*  
     First we must build the diff relation. It is interesting  
     to note that this relation is what will limit the other  
     relations 
*/ 
 
diff(x,y,z) :- x-y>=0, -x+y>=0, z>=0, -z>=0. 
diff(x,y,z) :- diff(x1,y,z1), x-x1<=1, x-x1>=1, z-z1<=1, z-z1>=1. 
diff(x,y,z) :- diff(x,y1,z1), y-y1<=1, y-y1>=1, z1-z<=1, z1-z>=1.

/* Our initial line */
line(0,6, 0). 

/* Recursive line definition */
line(x,y,d) :- line(p1,p2,d1),  
               diff(p,p1,z1), diff(p2,p,z),  
               diff(x,p1,z2), diff(p,x,z2), 
               diff(p2,y,z3), diff(y,p,z3), 
               d-d1 = 1.

end%RECURSIV%

MlpqFractalProgram (last edited 2003-09-24 23:23:42 by yakko)