Cylinder_modeller(modeller) LYMB Cylinder_modeller(modeller)
NAME
cylinder_modeller - a geometric representation of a cylinder
DESCRIPTION
The cylinder_modeller class implements a geometric representation of a cylinder. It allows the user to manipulate
a cylinder without seeing the details of its internal representation. The cylinder_modeller can be rendered
directly on the graphics display. The default cylinder has
a radius and height of 1.0, and is centered at the origin.
It is oriented along the y-axis. The cylinder_model is a
variable resolution modeller. By default it has a very
coarse approximation to a cylinder, using only 3 rectangles for its sides. The resolution instance variable can
be used to set the number of polygons used for the body of
the cylinder. A value less than 3 results in three polygons.
SUPERCLASS
modeller
INSTANCE VARIABLES
num_vertices
The number of vertices in the cylinder geometry.
num_polygons
The number of polygons in the cylinder geometry.
This is just the number of polygons on the cylinder's surface plus two more for the ends of the
cylinder.
radius
The radius of the cylinder
height
The height of the cylinder
MESSAGES
num_vertices?
Get the number of vertices. Although the class
interface allows this value to be set, it should
not be since it is a value computed by the cylinder_modeller when it builds itself.
num_polygons?
Get the number of polygons. Like num_vertices, this
value should not be set since it is computed by the
cylinder_modeller when it builds itself.
open!
Sends the geomtry to the rendering primitive.
renderer_name?
Returns the suffix of the class name used to draw
the model on the graphics display.
generate_data!
Builds the geometric representation of the cylinder
required by the rendering primitive.
return_data!
Returns the data built by generate_data! instead of
sending it to the rendering primitive. This allows
another class in the system to use this geometry.
bounds?
Returns the minimum and maximum x, y and z values
of the cylinder's vertices. This is used by the
inherited "bounding_box?" method.
calculate!
Recomputes all the vertices and polygons of the
cylinder according to the current value of "resolution", an inherited variable.
radius[=?]
Sets/Gets the radius of the cylinder. message.
height[=?]
Sets/Gets the height of of the cylinder. message.
EXAMPLES
The following LYMB script creates two cylinder models, one
with the default resolution of 1 (3 body polygons) and the
other with a resolution of 20. In addition, the second
cylinder uses the "height=" and "radius=" messages to
tranform it into a very long, thin cylinder.
cylinder_modeller new: cylinder_model1;
cylinder_modeller new: cylinder_model2
resolution=20
height=10
radius=0.2
;
actor new: prism
modeller=cylinder_model1
;
actor new: pencil
modeller=cylinder_model2
;
SEE ALSO
actor, modeller, byu, cube_modeller, hershey_text,
points_modeller, polyline_modeller, sphere_modeller
Please send comments and suggestions toconsult@rpi.edu