/* paths.
Describing Paths for Roller Coaster Problems
Alan Bundy 7.4.81 */


/*DESCRIBING PATHS*/
/*----------------*/

/*PATH WITH MONOTONIC SLOPE*/
monopath(Path) :- dc slope(Path,left).
monopath(Path) :- dc slope(Path,right).
monopath(Path) :- dc slope(Path,hor).

/*POINT1 AND POINT2 ARE OPPOSITE ENDS OF PATH*/
farend(Path,Point1,Point2) :-
  dc end(Path,Point1,Par1), opposite(Par1,Par2),
  dc end(Path,Point2,Par2).

/*UPPER SIDE OF PATH*/
above(Path,Start,Side) :-
  monopath(Path), dc end(Path,Start,Side).

/*LOWER SIDE OF PATH*/
below(Path,Start,Side1) :-
  monopath(Path),
  dc end(Path,Start,Side2), opposite(Side1,Side2).

/*START IS THE TOP OF PATH*/
top(Path,Start) :- dc end(Path,Start,Par), dc slope(Path,Par).

/*USE TYPICAL POINT OF WHOLE CIRCLE*/
typical_point(Path,Point) :-
  bitof(Path,Circle), dc circle(Circle),
  cc typical_point(Circle,Point).


