A ConeGO.T
is a geometric object describing a cone.
INTERFACEConeGO ; IMPORT GO, Point3, PointProp, RealProp, SurfaceGO; TYPE T <: Public; Public = SurfaceGO.T OBJECT METHODS init (prec := 30) : T; END;
cone.init(prec)
initializes a new conecone
, whose surface is composed ofprec
triangles, and returns it. The location and radius of the cone is determined by the three propertiesBase
,Tip
, andRadius
.
VAR Base : PointProp.Name; Tip : 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 byConeGO.T
's:
Base
is the name of a property that describes the center of the base of the cone. It associates with a \type{PointProp}{Val}. If noBase
property is specified, the base of the cone lies at the origin.
Tip
is the name of a property that describes the tip of the cone. It associates with a \type{PointProp}{Val}. If noTip
property is specified, the tip of the cone is at point (1,0,0).
Radius
is the name of a property that describes the radius of the cone. It associates with a \type{RealProp}{Val}. If noRadius
property is specified, the cone has a radius of 1.Assume that in a given context and at a given point in time, the property mapping is such that
Base
maps to a point property value which evaluates tobase
,Tip
maps to a point property value which evaluates totip
, andRadius
maps to a real property value which evaluates tor
.base
,tip
, andr
define the position and shape of the cone in this c ontext and at this time as shown below: \begin{center} \begin{tabular}{c} \psfig{figure=images/ConeGO.ps,silent=} \end{tabular} \end{center}
PROCEDURE New (base, tip : Point3.T; r : REAL; prec := 30) : T;
New(base,tip,r,prec)
creates a new cone, whose surface is composed ofprec
triangles, and returns it. It also attaches the following properties to the new cone: \begin{verbatim} (Base,PointProp.NewConst(base)) (Tip,PointProp.NewConst(tip)) (Radius,RealProp.NewConst(r)) \end{verbatim}
The following three procedures provide sugaring to attach
Base
, Tip
, and Radius
properties with non-animated
property values to geometric objects:
PROCEDURE SetBase (o : GO.T; p : Point3.T);
The expressionSetBase(o,p)
is equivalent too.setProp(Base.bind(PointProp.NewConst(p)))
.
PROCEDURE SetTip (o : GO.T; p : Point3.T);
The expressionSetTip(o,p)
is equivalent too.setProp(Tip.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 ConeGO.