/* INF1 : Inference rules concerning the lengths, areas etc. of
		various kinds of body

						Updated: 10 February 81
*/



			% The length of a line is the distance between 
			% the end points

line_length(Lne,B-A)
    <-- line_sys(Lne,Lend,Rend) & on(Pt,Lne) &
	separation(Pt,Lend,A,Dir) & separation(Pt,Rend,B,Dir).
			% needs generalizing to any point


			% The length of a ring based on its radius

line_length(Ring,2*pi*R)
    <--	ring(Ring) &
	radius(Ring,R).



			% The area of a rectangle is the product of the 
			% lengths of the sides

area(Rect,(D-C)*(B-A))
    <-- rectangle(Rect) & 
	quad_sys(Rect,Top,Bottom,Left,Right) &
	perp_dist(Pt,Top,D,[90,0]) & perp_dist(Pt,Bottom,C,[90,0]) &
	perp_dist(Pt,Left,A,[0,0]) & perp_dist(Pt,Right,B,[0,0]).



			% The area of a parallelogram is the product of the 
			% lengths of a side and the width

area(Para,(D-C)*(B/sin(E)-A/sin(E)))
    <-- parallelogram(Para) & 
	quad_sys(Para,Top,Bottom,Left,Right) &
	perp_dist(Pt,Top,D,[90,0]) & perp_dist(Pt,Bottom,C,[90,0]) &
	perp_dist(Pt,Left,A,[E-90,0]) & perp_dist(Pt,Right,B,[E-90,0]).



			% The area of a disc

area(Disc,pi*R^2)
    <--	disc(Disc) &
	radius(Disc,R).


			% The surface area of a sphere

area(Shll,4*pi*R^2)
    <-- shell(Shll) &
	radius(Shll,R).


			% The surface area of a cylinder

area(Cyl,2*pi*R*H)
    <-- tube(Cyl) &
	radius(Cyl,R) &
	height(Cyl,H).


			% The volume of a sphere.

vol(Sph,(4/3)*pi*R^3)
    <-- sphere(Sph) &
	radius(Sph,R).


			% The volume of a cylinder

vol(Cyl,pi*R^2*H)
    <-- cylinder(Cyl) &
	radius(Cyl,R) &
	height(Cyl,H).


			% The volume of a cone

vol(Cne,(1/3)*pi*R^2*H)
    <-- cone(Cne) &
	radius(Cne,R) &
	height(Cne,H).




