<<<<<<<<<<<<<<<<<

Cube_modeller(modeller) LYMB Cube_modeller(modeller)

NAME

Cube_modeller - a geometric representation of a cube

DESCRIPTION

The cube_modeller class implements a geometric representation of a three-dimensional cube. It allows the user to manipulate a cube without seeing the details of its internal representation. The cube_modeller can be rendered directly on the graphics display. The default cube has sides of length 1.0 and is centered at the origin (coordinates span from -0.5 to 0.5 in x, y and x).

SUPERCLASS

modeller

INSTANCE VARIABLES

vertices The eight coordinate triplets for the corners of the cube. By default they have the values and positions shown below: ^ Y vertices=( | 0.5, 0.5, 0.5, -- p1 p8 +------+ p5 0.5, -0.5, 0.5, -- p2 /| /| -0.5, -0.5, 0.5, -- p3 / | / | -0.5, 0.5, 0.5, -- p4 p4 +------+p1| 0.5, 0.5, -0.5, -- p5 |p7+---|--+ p6 --> X 0.5, -0.5, -0.5, -- p6 | / | / -0.5, -0.5, -0.5, -- p7 |/ |/ -0.5, 0.5, -0.5 -- p8 p3 +------+ p2 ); / / Z

MESSAGES

vertices[=?] Set/get the values of the vertices.

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 cube 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 cube's vertices. This is used by the inherited "bounding_box?" method.

EXAMPLES

The following LYMB script creates a cube model and uses the actor's transformation to tranform it into an non- square rectangular parallelepiped.

cube_modeller new: cube_model;

actor new: cube modeller=cube_model scale=(1,0.7,1.3) ;

The following LYMB script uses the "vertices=" message to set the cube's geometry directly. This demonstrates how the bounding box of a model can be easily turned into another model. Note that in the first cube_modeller instance, the vertices are obtained from the bounding box of the byu model, while in the second case they are obtained from the actor. Thus, the modelling_coords_box will be displayed in the modelling coordinates of the shuttle model, while the world_coords_model will be displayed around the shuttle.

byu new: shuttle_model geometry_file="shuttle.g" ; actor new: shuttle modeller=shuttle_model scale=0.5 position=(-10,4,20) rotate_y:30 ;

cube_modeller new: bbox_mc_model vertices=[shuttle_model bounding_box?] ; actor new: modelling_coords_box modeller=bbox_mc_model ;

cube_modeller new: bbox_wc_model vertices=[shuttle bounding_box?] ; actor new: world_coords_box modeller=bbox_wc_model ;

SEE ALSO

actor, modeller, byu, cylinder_modeller, hershey_text, points_modeller, polyline_modeller, sphere_modeller


Please send comments and suggestions to
consult@rpi.edu