Copyright (C) 1994, Digital Equipment Corp.
Created by Marc Najork
A CylinderGO.T is a geometric object describing a cylinder.
INTERFACECylinderGO ; IMPORT GO, Point3, PointProp, RealProp, SurfaceGO; TYPE T <: Public; Public = SurfaceGO.T OBJECT METHODS init (prec := 30) : T; END;
cyl.init(prec)initializes a new cylindercyl, whose surface is composed ofprecrectangles, and returns it. The location and radius of the cylinder is determined by the three propertiesPoint1,Point2, andRadius.
VAR Point1 : PointProp.Name; Point2 : PointProp.Name; Radius : RealProp.Name;
In addition to the properties observed by all \type{GO}{T}'s and \type{SurfaceGO}{T}'s, there are three additional properties that are observed byCylinderGO.T's:
Point1is the name of a property that describes the first endpoint of the cylinder. It associates with a \type{PointProp}{Val}. If noPoint1property is specified, the cylinder starts at the origin.
Point2is the name of a property that describes the second endpoint of the cylinder. It associates with a \type{PointProp}{Val}. If noPoint2property is specified, the cylinder ends at point (1,0,0).
Radiusis the name of a property that describes the radius of the cylinder. It associates with a \type{RealProp}{Val}. If noRadiusproperty is specified, the cylinder has a radius of 1.Assume that in a given context and at a given point in time, the property mapping is such that
Point1maps to a point property value which evaluates top1,Point2maps to a point property value which evaluates top2, andRadiusmaps to a real property value which evaluates tor.p1,p2, andrdefine the position and shape of the cylinder in this context and at this time as shown below: \begin{center} \begin{tabular}{c} \psfig{figure=images/CylinderGO.ps,width=3in,silent=} \end{tabular} \end{center}
PROCEDURE New (p1, p2 : Point3.T; r : REAL; prec := 30) : T;
New(p1,p2,r,prec)creates a new cylinder, whose surface is composed ofprecrectangles, and returns it. It also attaches the following properties to the new cylinder: \begin{verbatim} (Point1,PointProp.NewConst(p1)) (Point2,PointProp.NewConst(p2)) (Radius,RealProp.NewConst(r)) \end{verbatim}
The following three procedures provide sugaring to attach
Point1, Point2, and Radius properties with non-animated
property values to geometric objects:
PROCEDURE SetPoint1 (o : GO.T; p : Point3.T);
The expressionSetPoint1(o,p)is equivalent too.setProp(Point1.bind(PointProp.NewConst(p))).
PROCEDURE SetPoint2 (o : GO.T; p : Point3.T);
The expressionSetPoint2(o,p)is equivalent too.setProp(Point2.bind(PointProp.NewConst(p)))).
PROCEDURE SetRadius (o : GO.T; r : REAL);
The expressionSetRadius(o,r)is equivalent too.setProp(Radius.bind(RealProp.NewConst(r)).
END CylinderGO.