Information Technology Reference
In-Depth Information
Figure 6.9.
Permissible vertices in polyhedral images
-
+
+
+
-
-
+
+
-
-
+
+
-
-
-
-
-
+
-
+
Figure 6.10.
Permissible vertices in Prolog
polyrules.pl
% All edges are assumed to leave the vertex in question.
% arrow(left,bottom,right)
arrow('+','-','+').
arrow('-','+','-').
arrow('<','+','>').
% fork(left,top,right)
fork('+','+','+').
fork('-','-','-').
fork('>','-','<').
fork('-','<','>'). fork('<','>','-').
% tvertex(left,bottom,right)
tvertex('>',_,'<').
% lvertex(left,right)
lvertex('<','>'). lvertex('<','-'). lvertex('>','<').
lvertex('>','+'). lvertex('-','>'). lvertex('+','<').
% Reversing the direction of an edge: only < and > change.
reverse('+','+').
reverse('-','-').
reverse('<','>').
reverse('>','<').
For the L-shaped object of figure 6.7, the solution predicate is shown in figure 6.11.
There are fifteen arguments, corresponding to the fifteen edges in the image. The
first eleven atoms in the body correspond to the eleven vertices in the image. Note
Search WWH ::




Custom Search