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

data_primitive(display) Display data_primitive(display)

NAME

data_primitive - place an oriented, colored object at each unmasked point in input display_data object.

DESCRIPTION

The data_primitive object takes as input two display_data objects. The first, the data_in object, must contain at a minmum a list of points, but may also contain scalars, vectors, and normals. The second, the source object, defines an arbitrary geometry (e.g., points, lines, polygons, etc.) with possibly scalars, vectors, and normals. Data_primitive then copies the source geometry into each unmasked point of the input data_in.

The data_in and source data may be a modeller or visualization pipeline as long as it responds to the "data?" message by providing a display_data data pointer.

Various options exist for copying the source geometry. If vector or normal data is defined in the data_in, the geometry is aligned along the normal or vector, depending upon the value of the instance variable attach_to. In addition, the copied geometry can be scaled by the data_in scalar values, or by the magnitude of the data_in vectors, depending upon the value of the flag scale_by_scalar.

SUPERCLASS

display_filter

INSTANCE VARIABLES

source is the name of an object that responds to the message "data?" (e.g., display_data, display_filter, new_modeller). The source provides the geometric description.

scaling flag to indicate whether scaling is to be performed at all. If scaling is on, then the scale_by_scalar flag can be used to specify how to scale the data. If scaling is off, the data will be copied at each point, and no scaling will be performed. By default, scaling is off.

scale_by_scalar flag to indicate whether to scale the modeller by the vector magnitude or the scalar value. By default scale_by_scalar=0 and the model is scaled by the vector magnitude.

scale_factor the source object is scaled either by the value of scalar or the magnitude of the normal or vector times the scale_factor. Hence the scale_factor comtrols the size of the object.

range a specified (min,max) range used to cotrol the scaling of objects by the scalar data.

attach_to the source object can be oriented along either the vector or normal data. If attach_to=0, the source object is aligned along the vector. If attach_to=1, the source object is aligned along the normal.

MESSAGES

source? gets the name of the source display_data

source= name sets the name of the source

scaling_on! turn on scaling.

scaling_off! turn off scaling.

scaling[?,=] get/set the value of the scaling instance variable.

scale_by_scalar!, scale_by_scalar_on! sets the scaling of the object by the scalar values and specified range.

scale_by_vector!, scale_by_scalar_off! scale the source by vector data.

scale_by_scalar[?,=] get/set the value of the scale by scalar instance variable.

scale_factor? get the value of the scale_factor

scale_factor= value set the value of the scale_factor

range? get the current range.

range= (min,max) set the current range.

attach_to? get the (vector,normal) to align the source with.

attach_to= value set the source to align with the (vector,normal)

mask= (b1,b2,...bn) the points in the data_in can be masked so that the source object is not copied to them. Zero mask values bi are not copied onto.

EXAMPLE

In this example a display data is created consisting of points and lines. At each point a sphere is drawn. The points are connected together by line segments.

/* * Script creates display data and places cones at each point */ /* * Create display data and filter network */ display_data new: dd points=(-.5,-.5,-.5,.5,.5,.5,1,1,1) lines=(3,1,2,3) scalars=(.5,1,2) vectors=(1,0,0,0,1,0,0,0,1) ;

cone_modeller new:cm resolution=8 ; transform_filter new: xform data_in= cm scale=(.1,.2,.3) ; data_primitive new:cones data_in=dd source=xform scale_by_scalar! scale_factor=3 range=(0,2) ; display_all new: da data_in= cones range=(0,2) ; actor new:cone_actor modeller=da ;

/* * The thread to hold the cones together */ display_lines new: thread scalar_data_off! data_in=dd ; actor new: thread_actor color=(1,1,1)

modeller=thread ; /* * set up cameras and lights */ camera new: acamera view_up=(0,0,1) position=(1,0,0) x_range=(-1,1) y_range=(-1,1) z_range=(-1,1) default! on!;

light new: l1 position=([acamera position?]) on!;

/* * define the renderers */ environment new: _env variable="LYMB_RENDERER"; string new: current_renderer = [_env value?]; object# current_renderer new: main_renderer actors=([actor instances?]) cameras=acamera lights=l1;

/* * Draw the picture */ main_renderer render!;

SEE ALSO

display_data, display_filter, display_modeller, modeller


Please send comments and suggestions to
consult@rpi.edu