A DiskGO.T
is a geometric object describing a disk.
INTERFACEDiskGO ; IMPORT GO, Point3, PointProp, RealProp, SurfaceGO; TYPE T <: Public; Public = SurfaceGO.T OBJECT METHODS init (prec := 10) : T; END;
disk.init(prec)
initializes a new diskdisk
, whose surface is approximated by a polygon withprec
edges, and returns it. The location, orientation, and radius of the disk is determined by the three propertiesCenter
,Normal
, andRadius
.
VAR Center : PointProp.Name; Normal : 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 byDiskGO.T
's:
Center
is the name of a property that describes the center of the disk. It associates with a \type{PointProp}{Val}. If noCenter
property is specified, the disk is centered around the origin.
Normal
is the name of a property that describes the normal vector of the disk. It associates with a \type{PointProp}{Val}. If noNormal
property is specified, the normal vector is taken to be (0,0,1).
Radius
is the name of a property that describes the radius of the disk. It associates with a \type{RealProp}{Val}. If noRadius
property is specified, the disk has a radius of 1.Assume that in a given context and at a given point in time, the property mapping is such that
Center
maps to a point property value which evaluates top
,Normal
maps to a point property value which evaluates ton
, andRadius
maps to a real property value which evaluates tor
.p
,n
, andr
define the position and shape of the disk in this context and at this time as shown below: \begin{center} \begin{tabular}{c} \psfig{figure=images/DiskGO.ps,silent=} \end{tabular} \end{center}
PROCEDURE New (p : Point3.T; n : Point3.T; r : REAL; prec := 10) : T;
New(p,n,r,prec)
creates a new disk, whose surface is approximated by a polygon withprec
edges, and returns it. It also attaches the following properties to the new cone: \begin{verbatim} (Center,PointProp.NewConst(p)) (Normal,PointProp.NewConst(n)) (Radius,RealProp.NewConst(r)) \end{verbatim}
The following three procedures provide sugaring to attach
Center
, Normal
, and Radius
properties with non-animated
property values to geometric objects:
PROCEDURE SetCenter (o : GO.T; p : Point3.T);
The expressionSetCenter(o,p)
is equivalent too.setProp(Center.bind(PointProp.NewConst(p)))
.
PROCEDURE SetNormal (o : GO.T; p : Point3.T);
The expressionSetNormal(o,p)
is equivalent too.setProp(Normal.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 DiskGO.