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

rotational_snap_filter(display)Filterrotational_snap_filter(display)

NAME

spherical_snap_filter - creates a closed surface by shooting rays through sphere into source display data. Other than sphere display data can be used also.

DESCRIPTION

Spherical_snap_filter takes as input a display_data object containing a sphere geometry. It starts with one of sphere triangles and shoots rays unto source display data. Then it proceeds recursively into neighboring triangles until it traverses the whole sphere geometry. The resulting display data is approximation of the source geometry with a sphere-like triangular mesh. All holes in original source data are "sealed".

SUPERCLASS

adjacency_filter

INSTANCE VARIABLES

center A variable specifying the position of the sphere center from which the projection onto source display data is made. Script should take care of calculating center value based on the source bounding_box data.

start_node A variable specifying the node number in sphere to start processing. The valid numbers are from 1 to the maximum node value in the sphere geometry. If start node is not specified, the default is 0. In this case algorithm starts with node 1 and shoots the rays from the center of the sphere through the node into source. If ray is found, the recursion starts from the element containing this node. If there is no intersection, program continues with other nodes until an intersection is found and then starts from corresponding triangle. If no intersection is found, program prints a message to this effect and returns without generating output data.

smoothness This parameter should be greater than 0 and less then 1. It is used to seal the holes in the original source geometry. The usage is as follows. Whenever a ray is projected into the new node of the sphere, the distance D to the previous intersection is passes as a parameter to the intersection routine. If there is no intersection, we assume there is one in this direction at the distance D. If there is one with the a distance D1, we test if D1

/ D is between smoothness and 1/smoothness. In this case we use this intersection point for the output geometry. Otherwise, we take a point in the ray distance D from the origin. A good geometry approximating source geometry is produced by varying center and smoothness variable and, of course, the resolution of the sphere triangularization. Default is 0.8.

inside This parameter allows to do the projection backwards, i.e., project from a sphere of large radius unto the source geometry from outside. Default is 1, inside is on. The value of 0 corresponds to outside projection.

MESSAGES

center=argument Sets the value of the center to the argument. Argument should be somewhere inside the source geometry volume. The first approximation can be the center of bounding_box of the source geometry.

center? Returns the value of the center.

generate_data! Generates output data.

inside=argument Sets the value of inside to the argument. One is inside, zero is outside.

inside? Returns the value of the inside.

inside_off! Project from the surface of the large sphere onto the center of the sphere.

inside_on! Projects from the center of the sphere.

smoothness=argument Sets the value of smoothness. Argument should be less than 1 and greater than 0.

smoothness? Returns the value of smoothness.

start_node=argument Sets the value of start_node to the argument. Argument should be between 1 and maximum node number in the sphere geometry.

start_node? Returns the value of start_node.

EXAMPLE

/* * Demonstration of spherical_snap_filter */

/* * A skull display data is used as source geometry */

cdf_display_data_reader new: skull_reader filename="/home/lishakill/projects/lymb_dev/lymb/scripts/filters/skull.cdf" read! ;

sphere_modeller new:asphere resolution=3 generate_data! ;

/* * A sphere modeller generates duplicate nodes, so we clean the data. */

clean_data new:clean data_in=asphere tolerance= 0.001 ;

clean print:(no_points);

display_polygons new: polys data_in=`skull_reader' generate_data! ;

display_data_geometry new:ddg tolerance=.001 data=[polys data?] ;

spherical_snap_filter new: asnap sources= ddg center=[polys center?] data_in= clean smoothness=.6 ;

display_all new: ad1 data_in= skull_reader ;

/* * This is original skull actor. */

actor new: a1 modeller= ad1 color=(1,0,0) ;

display_all new: ad2 data_in= asnap ;

/* * This is brain object generated by spherical_snap_filter. */

actor new: a2 modeller= ad2 color=(0,1,0) ;

/* * This is a sphere used to do the projection. */

actor new: a3 modeller= asphere color=(0,0,1) ;

renderer new:aren actors=(a1,a2,a3) render! ;

SEE ALSO

adjacency_filter, rotational_snap_filter, display_filter, display_data, sphere_modeller


Please send comments and suggestions to
consult@rpi.edu