Size: 683
Comment:
|
Size: 821
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 9: | 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 14: | 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 20: | Line 24: |
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%