A SphereGO.T
is a geometric object describing a sphere.
INTERFACESphereGO ; IMPORT GO, Point3, PointProp, RealProp, SurfaceGO; TYPE T <: Public; Public = SurfaceGO.T OBJECT METHODS init (prec := 30) : T; END;
sph.init(prec)
initializes a new spheresph
, whose surface is composed ofprec
strips ofprec
triangles, and returns it. The location and radius of the sphere are determined by the two propertiesCenter
andRadius
.
VAR Center : PointProp.Name; Radius : RealProp.Name;In addition to the properties observed by all \type{GO}{T}'s and \type{SurfaceGO}{T}'s, there are two additional properties that are observed by
SphereGO.T
's:
Center
is the name of a property that describes the center of the sphere.
It associates with a \type{PointProp}{Val}. If no Center
property
is specified, the sphere is centered at the origin.
Radius
is the name of a property that describes the radius of the sphere.
It associates with a \type{RealProp}{Val}. If no Radius
property
is specified, the sphere has a radius of 1.
PROCEDURE New (center : Point3.T; radius : REAL; prec := 30) : T;
New(center,radius,prec)
creates a new sphere, whose surface is composed ofprec
strips ofprec
triangles, and returns it. It also attaches the following properties to the new sphere: \begin{verbatim} (Center,PointProp.NewConst(center)) (Radius,RealProp.NewConst(radius)) \end{verbatim}
The following two procedures provide sugaring to attach
Center
and Radius
properties with non-animated
property values to geometric objects:
PROCEDURE SetCenter (o : GO.T; center : Point3.T);
The expressionSetCenter(o,p)
is equivalent too.setProp(Center.bind(PointProp.NewConst(p))
.
PROCEDURE SetRadius (o : GO.T; radius : REAL);
The expressionSetRadius(o,r)
is equivalent too.setProp(Radius.bind(RealProp.NewConst(r)))
.
END SphereGO.