Vis5D API
Last updated: April 15, 1996
Introduction
The Vis5D API (Application Programmer's Interface) is a division between
Vis5D's user interface and its main core. This API allows system developers
to include Vis5D as a visualization subsystem of other systems, where the
other system invokes the Vis5D core through the API. Thus you can have
Vis5D functionality combined with a user interface consistent the rest of
your system.
All Vis5D API functions start with the prefix vis5d_. All API constants start
with the prefix VIS5D_.
All Vis5D API functions are of type integer, returning a non-negative value
if successful (all but a few return just 0 if successful), otherwise one of
these negative error values:
- VIS5D_BAD_CONTEXT - invalid context number
- VIS5D_BAD_CONSTANT - invalid VIS5D_* argument
- VIS5D_BAD_MODE - invalid mode argument
- VIS5D_BAD_VALUE - invalid floating point or integer argument
- VIS5D_BAD_VAR_NUMBER - invalid physical variable argument
- VIS5D_BAD_TIME_STEP - invalid timestep argument
- VIS5D_FAIL - the function failed and did not complete
- VIS5D_OUT_OF_MEMORY - function failed because of insufficient memory
The first argument to all API functions, except the global functions and
vis5d_alloc_context, is an integer context index between 0 and
VIS5D_MAX_CONTEXTS-1.
Each context has an independent memory pool.
Physical variable number arguments are always in the range [0,numvars-1] where
numvars is the value returned by vis5d_get_numvars(). Similarly, time step
arguments are always in the range [0,numvars-1] where numvars is the value
returned by vis5d_get_numvars().
There are three coordinate systems used by Vis5D:
- grid coordinates - these locate values in the 3-D data grid.
Coordinates are in terms of (row, column, level). Rows generally
increase from north to south, starting at zero. Columns increase from
west to east, starting at zero. Levels increase from bottom to top,
starting at zero.
- geographic coordinates - these are (latitude, longitude, altitude)
values. Latitudes increase to the north. Longitudes increase to the
west. Altitudes (heights) increase upward and zero is sea level.
- graphics coordinates - these are (X, Y, Z) values and are used in
Vis5D for drawing 3-D imagery. The center of the 3-D box is at
(0,0,0). X increases from west to east, Y increases from south to
north, and Z increases from low altitude to high altitude.
The extents of (X,Y,Z) coordinates for the box are returned by the
vis5d_get_box_bounds() function.
Outline
The Vis5D API functions can be catagorized as follows:
- Global Functions:
- Initialization Functions:
- vis5d_initialize
- vis5d_terminate
- vis5d_workers
- Miscellaneous Functions:
- vis5d_do_work
- vis5d_check_work
- vis5d_finish_work
- vis5d_colorbar_init_params
- vis5d_colorbar_recompute
- vis5d_colorbar_set_alpha
- Per-context Functions:
- Initialization Functions:
- Primary Initialization Functions:
- vis5d_alloc_context
- vis5d_destroy_context
- vis5d_init_begin
- vis5d_init_end
- vis5d_open_gridfile
- Window Functions:
- vis5d_init_window
- vis5d_init_gl_window
- vis5d_init_glx_window
- vis5d_init_opengl_window
- Map, Topography and Texture Map Functions:
- vis5d_init_map
- vis5d_init_topo
- vis5d_init_texture
- vis5d_init_firstarea
- vis5d_init_sequence
- Map Projection and Vertical Coordinate System:
- vis5d_init_log
- vis5d_init_box
- vis5d_init_projection
- vis5d_init_vertical
- Miscellaneous Functions:
- vis5d_init_memory
- vis5d_init_path
- Post-Initialization Functions:
- Time Functions:
- vis5d_get_numtimes
- vis5d_get_time_stamp
- vis5d_set_time_stamp
- vis5d_set_timestep
- vis5d_get_timestep
- Variable Functions:
- vis5d_get_numvars
- vis5d_find_var
- vis5d_get_var_name
- vis5d_get_var_units
- vis5d_get_var_type
- vis5d_get_var_info
- vis5d_get_var_range
- vis5d_set_wind_vars
- vis5d_get_wind_vars
- vis5d_reset_var_graphics
- Grid Functions:
- vis5d_get_size
- vis5d_get_grid
- vis5d_put_grid
- vis5d_get_grid_value
- vis5d_verylarge_mode
- Map Projection and Vertical Coordinate System Functions:
- vis5d_get_projection
- vis5d_get_vertical
- vis5d_get_curved
- Topography, Map and Texture Functions:
- vis5d_check_topo
- vis5d_check_map
- vis5d_check_texture
- vis5d_get_topo_range
- vis5d_recolor_topo
- vis5d_texture_image
- Cloning, External Functions, and Expression Functions:
- vis5d_make_clone_variable
- vis5d_compute_ext_func
- vis5d_compute_expression
- Rendering Functions:
- vis5d_signal_redraw
- vis5d_check_redraw
- vis5d_draw_frame
- vis5d_draw_3d_only
- vis5d_draw_2d_only
- vis5d_swap_frame
- vis5d_invalidate_frames
- vis5d_set_pointer
- vis5d_graphics_mode
- vis5d_enable_graphics
- vis5d_check_volume
- vis5d_set_volume
- vis5d_get_volume
- vis5d_set_color
- vis5d_get_color
- vis5d_get_color_table_address
- vis5d_set_cursor_color
- vis5d_get_colorbar_params
- vis5d_set_colorbar_params
- vis5d_alpha_mode
- vis5d_font
- vis5d_linewidth
- vis5d_gl_setup
- vis5d_get_box_bounds
- 3-D View Functions:
- vis5d_set_matrix
- vis5d_get_matrix
- vis5d_set_view
- vis5d_set_ortho_view
- vis5d_set_camera
- vis5d_get_camera
- Isosurface, Slice and Trajectory Functions:
- vis5d_make_isosurface
- vis5d_set_isosurface
- vis5d_get_isosurface
- vis5d_set_isosurface_color_var
- vis5d_get_isosurface_color_var
- vis5d_set_hslice
- vis5d_get_hslice
- vis5d_make_vslice
- vis5d_set_vslice
- vis5d_get_vslice
- vis5d_make_chslice
- vis5d_set_chslice
- vis5d_get_chslice
- vis5d_make_cvslice
- vis5d_set_cvslice
- vis5d_get_cvslice
- vis5d_make_hwindslice
- vis5d_set_hwindslice
- vis5d_get_hwindslice
- vis5d_make_vwindslice
- vis5d_set_vwindslice
- vis5d_get_vwindslice
- vis5d_make_streamslice
- vis5d_set_streamslice
- vis5d_get_streamslice
- vis5d_make_traj
- vis5d_set_traj
- vis5d_get_traj
- vis5d_set_trajectory_color_var
- vis5d_get_trajectory_color_var
- vis5d_delete_last_traj
- vis5d_delete_traj_set
- vis5d_make_timestep_graphics
- vis5d_free_graphics
- Text Label Functions:
- vis5d_make_label
- vis5d_new_label
- vis5d_edit_label
- vis5d_find_label
- vis5d_move_label
- vis5d_delete_label
- 3-D Cursor Functions:
- vis5d_set_cursor
- vis5d_get_cursor
- 3-D Viewing Window Functions:
- vis5d_get_window
- vis5d_resize_window
- vis5d_get_image_formats
- vis5d_save_window
- vis5d_print_window
- Coordinate Conversion Functions:
- vis5d_project
- vis5d_unproject
- vis5d_xyz_to_grid
- vis5d_grid_to_xyz
- vis5d_xyz_to_geo
- vis5d_geo_to_xyz
Function descriptions
Global Functions
int vis5d_initialize( int cavemode )
- This must be the first API function called. It takes one argument which
indicates if Vis5D is being used with the CAVE (1=yes, 0=no).
int vis5d_terminate( int close_window )
- This function should be called just before your application exits. The
close_window argument determines whether or not the associated GL
windows are destroyed or not. If non-zero, then the windows will be
destroyed.
int vis5d_workers( int nworkers )
- Specifies how many background threads should be created. The nworkers
argument should be non-negative (if it is 0, all computations are done
in foreground). Background threads compute isosurfaces, contour/colored
slices, and wind trajectories. Threads take advantage of multiple CPUs
when present.
int vis5d_do_work( void )
- If the nworkers argument of vis5d_workers() was 0, this function
must be called regularly (inside your event loop) to process jobs waiting
in the work queue. If the nworkers argument of vis5d_workers() was
positive, calling this function is a no-op.
int vis5d_check_work( int *pending )
- Checks if there are background jobs waiting in the work queue. A value
of 1 will be returned in pending if jobs are pending, or 0 will be
returned in pending if the queue is empty.
int vis5d_finish_work( void )
- This function blocks and returns when there are no more background jobs
pending.
int vis5d_colorbar_init_params( float params[], int rgb_flag, int alpha_flag )
- Reset the RGB and/or Alpha curve parameters to their defaults.
- params - array of curve parameters.
- rgb_flag - flag to set RGB values.
- alpha_flag - flag to set alpha values.
int vis5d_colorbar_recompute( unsigned int table[], int size,
float params[], int rgb_flag, int alpha_flag )
- Recompute the RGB and/or Alpha table entries from their parameters.
- table - table of RGBA values to set.
- size - size of table.
- params - array of curve parameters.
- rgb_flag - flag to set RGB values.
- alpha_flag - flag to set alpha values.
int vis5d_colorbar_set_alpha( float params[], float alpha )
- Set transparency values to constant value alpha, or to default curve
if alpha<0.
Per-Context Functions
A Vis5D context is initialized with the functions in this section. After a
context is allocated, the first initialization call must be to vis5d_init_begin()
and the last initialization call must be to vis5d_init_end(). In between, you
may call any other vis5d_init_* function. You'll usually call a
vis5d_init_*_window() function and you MUST also call vis5d_open_gridfile() to
specify what v5d file you want to view. For example:
c = vis5d_alloc_context();
vis5d_init_begin( c );
vis5d_init_...
vis5d_init_window( c, ... );
vis5d_open_gridfile( c, "LAMPS.v5d", 0 );
vis5d_init_end( c );
int vis5d_alloc_context( void )
- Allocate a new Vis5D context and return its integer index or VIS5D_FAIL
if no more contexts can be allocated. This function is not required;
contexts are identified by small integers and an applications may simply
allocate/manage these small integers itself.
int vis5d_destroy_context( int index, int close_window )
- Destroy a vis5d context. If the close_window argument is non-zero then
the associated GL window will also be destroyed.
int vis5d_init_begin( int index )
- Begin initialization of context number 'index'.
int vis5d_init_end( int index )
- This function is to be called after all other initializations functions.
At this time, Vis5D will take the information provided by the other init
functions and actually construct the context.
int vis5d_open_gridfile( int index, char *name, read_flag )
- Specify the file name of the Vis5D dataset to visualize. read_flag
indicates whether or not data should immediately be read from the file (1)
or if data should be read as needed later (0).
This function is unique among the initialization functions in that it may
also be called after vis5d_init_end (any number of times), causing the
current dataset to be discarded and replaced by the new one specified.
int vis5d_init_memory( int index, int mbs )
- Specify the size of memory (the mbs argument has the number of megabytes)
pool to allocate for the context.
int vis5d_init_window( int index, char *title, int x, int y, int width, int height )
- Create a 3-D graphics window for the given context. The arguments are the
window title string, the window position, and size (in pixels).
int vis5d_init_gl_window( int index, int winid )
- Attach a previously created IRIS GL window to a Vis5D context. winid is
the IRIS GL window identifier as returned by the GL winopen() function.
int vis5d_init_glx_window( int index, Window window, GLXconfig *ctx )
- Attach a "mixed-mode" IRIS GL window to a Vis5D context. The window
argument is an X window identifier and ctx is the GL/X context attribute
array used to create the window. See the man page for GLXgetconfig() for
more info.
int vis5d_init_opengl_window( int index, Window window, GLXContext ctx )
- Attach an OpenGL window to a Vis5D context. The window argument is the X
window identifier and ctx is the GLX context identifier.
iint vis5d_init_log( int index, float scale, float exponent)
- Specify the coefficients relating altitude to presure when using a
logrithmic vertical coordinate system.
int vis5d_init_box( int index, float alon, float alat, float ahgt )
- Specify the aspect ratio of the 3-D box. The ratio of lengths along the
longitude, latitude and height axes is specified by alon:alat:ahgt.
int vis5d_init_path( int index, char *pathname )
- Specify the directory to search for topograph (*.TOPO) and map outline
(OUTL*) files. The current directory is the default.
int vis5d_init_map( int index, char *mapname )
- Specify the file name of the map outline file to use. If this is
not called, the system will try to use default US or world map
outline files, depending on map extents.
int vis5d_init_topo( int index, char *toponame, int highres_flag )
- Specify the file name of the topography file to use and whether it should
be displayed in low or high resolution (highres_flag=0 means low
resolution, 1 means high resolution). If this is not called, no
topography will be used.
int vis5d_init_texture( int index, char *texturename )
- Specify the file name of an image to texture map over the topography.
int vis5d_init_firstarea( int index, int area )
- Specify the file number of the first of a consecutive sequence of McIDAS
area files to texture map over the topography.
int vis5d_init_sequence( int index, char *sequencename )
- Specify the name of a raw image sequence file to texture map over the
topography.
int vis5d_init_projection( int index, int projection, float *projargs )
- Specify a map projection to override the one found in the Vis5D datafile.
- projection - a map projection identifier such as PROJ_GENERIC,
PROJ_LINEAR, PROJ_LAMBERT, etc. as seen in api.h
- projargs - an optional array of projection parameters. If NULL, the
user will be prompted to enter values. See the main README file
for more details about map projection parameters
int vis5d_init_vertical( int index, int vertical, float *vertargs )
- Specify a vertical coordinate system to override the one found in the Vis5D
datafile.
- vertical - a vertical coordinate system identifier such as
VERT_GENERIC, VERT_EQUAL_KM, VERT_NONEQUAL_KM as seen in api.h
- vertargs - an optional array of vertical coordinate system parameters.
If NULL, the user will be prompted to enter values.
Post-Initialization Context Functions
After a Vis5D context has been initialized you may query the v5d file's
attributes and control the actual Vis5D visualization operations with these
functions.
Time Step Functions
int vis5d_get_numtimes( int index, int *numtimes )
- Returns the number of time steps in numtimes.
int vis5d_get_time_stamp( int index, int timestep, int *day, int *time )
- Returns the real world time and date associated with a timestep.
- timestep - the time step in [0,numtimes-1]
- day - date of the timestep in days since 1/1/1900
- time - time of the timestep in seconds since midnight
int vis5d_set_time_stamp( int index, int timestep, int day, int time )
- Set the real world time and date to associate with a timestep.
- timestep - the time step in [0,numtimes-1]
- day - date of the timestep in days since 1/1/1900
- time - time of the timestep in seconds since midnight
int vis5d_set_timestep( int index, int step_number )
- Set the current timestep. step_number is an integer in [0,numtimes-1].
int vis5d_get_timestep( int index, int *step_number )
- Return the current timestep number in step_number, which will be in [0,numtimes-1].
Physical Variable Functions
int vis5d_get_numvars( int index, int *numvars )
- Returns the number of physical variables in numvars.
int vis5d_find_var( int index, char *name )
- Return the number of the variable indicated by name. This is a
convenience function which could otherwise be done with
vis5d_get_numvars(), vis5d_get_var_name(), and strcmp().
- name - the name of variable to look up
- return the variable number or VIS5D_FAIL if name is not found
int vis5d_get_var_name( int index, int var, char *name )
- Returns the name of a variable.
- var - number of the variable in [0,numvars-1]
- name - the name of variable
int vis5d_get_var_name( int index, int var, char *name )
- Returns the name of a variable.
- var - number of the variable in [0,numvars-1]
- name - the name of variable
int vis5d_get_var_units( int index, int var, int *type )
- Returns the physical units of variable number var. For example, the
units for "U" are usually "m/s" (meters per second).
vis5d_get_var_info( int index, int var, void *info )
- Return extra information about variable number var.
- If the variable is a clone, info returns the integer number of variable
which it clones.
- If the variable is an external function, info returns a string which
is the function's filename.
- If the variable is an expression, info returns a string which is
the functions's expression.
int vis5d_get_var_range( int index, int var, float *min, float *max )
- Returns the minimum and maximum values of the specified variable.
- var - the variable number in [0,numvars-1]
- min - returns the minimum value
- max - returns the maximum value
int vis5d_set_wind_vars( int index, int u1, int v1, int w1, int u2, int v2, int w2, int utraj, int vtraj, wtraj )
- Specify the variables to use for the U, V, W components of wind slices
and trajectories.
- u1, v1, w1 - variables for first wind slice set
- u2, v2, w2 - variables for second wind slice set
- utraj, vtraj, wtraj - variables used for tracing trajectories
int vis5d_get_wind_vars( int index, int *u1, int *v1, int *w1, int *u2, int *v2, int *w2, int *utraj, int *vtraj, *wtraj )
- Return the number of the variables which correspond to the U, V, and W
components of wind vectors.
- u1, v1, w1 - returns variables for first wind slice set
- u2, v2, w2 - returns variables for second wind slice set
- utraj, vtraj, wtraj - returns variables used for tracing trajectories
3-D Grid Functions
int vis5d_get_size( int index, int *nr, int *nc, int nl[], int *maxnl, int *maxnlvar, int *windnl, int *windlow )
- Returns information about the size of the 3-D grids:
- nr - number of grid rows
- nc - number of grid columns
- nl - array of grid levels, one per variable
- maxnl - maximum of nl values
- maxnlvar - which variable corresponds to maxnl
- windnl - highest grid level with all wind variables
- windlow - lowest grid level with all wind variables
Note that these arguments are pointers. NULL pointers are legal (useful
for when you don't care to get all the attributes.)
int vis5d_get_grid( int index, int time, int var, float *grid )
- Get a 3-D grid.
- time - which timestep in [0,numtimes-1]
- var - which variable in [0,numvars-1]
- grid - address to store grid values
int vis5d_put_grid( int index, int time, int var, float *grid )
- Write a 3-D grid.
- time - which timestep in [0,numtimes-1]
- var - which variable in [0,numvars-1]
- grid - array of data to put into grid
int vis5d_get_grid_value( int index, int var, float row, float column, float level, float *value )
- Get a single grid value at current time step. If the row, column and level
parameters are not integers then the grid value will be computed as a weighted
average of the 8 nearest neighbors.
- var - which variable
- row - the row in [0,Nr-1]
- column - the column in [0,Nc-1]
- level - the level in [0,Nl-1]
- value - the returned grid value
int vis5d_verylarge_mode( int index, int mode )
- The "VeryLarge" option is useful for visualizing files which are much
larger than your system's RAM would normally accomodate. When VeryLarge
mode is enabled, graphics are only computed when needed (i.e. whenever
the current timestep is changed) and not automatically computed for all
timesteps.
- mode - one of
- VIS5D_OFF = turn off
- VIS5D_ON = turn on
- VIS5D_TOGGLE = toggle state
- VIS5D_GET = return current state
- Return current state of the VeryLarge option.
Map Projection and Vertical Coordinate System Functions:
int vis5d_get_projection( int index, int *projection, float projargs[] )
- Return the parameters which describe the current map projection.
- projection - the projection system ID number
- projargs - the parameters which describe the system, the number of
parameters may vary
int vis5d_get_vertical( int index, int *vertical, float vertargs[] )
- Return the parameters which describe the current vertical coordinate
system.
- vertical - the vertical coordinate system ID number
- vertargs - the parameters which describe the system, number of
parameters may vary
int vis5d_get_curved( int index, int *curved )
- Return whether or not the 3-D box will really be a box (curved=0) or the
box is actually a curved shape (curved=1).
Topography, Map and Texture Functions
int vis5d_check_topo( int index, int *topoflag )
- Return a flag indicating whether or not there is a topography to display.
int vis5d_check_map( int index, int *mapflag )
- Return a flag indicating whether or not there is a map to display.
int vis5d_check_texture( int index, int *textureflag )
- Return a flag indicating whether or not there are texture map(s) (images
mapped onto the topography) to display.
int vis5d_get_topo_range( int index, float *min, float *max )
- Returns the minimum and maximum topography heights (in KM) in the domain.
int vis5d_recolor_topo( int index, int reset )
- Recolor the topography according to the topography color table. If
reset
is non-zero, then the colortable will be reset to
its initial, default values.
int vis5d_texture_image( int index, int timestep, int width, int height, int components, void *image )
- Define a texture map to render over the topograpy. A different image can
be specified for each timestep.
- index - the context number
- timestep - which timestep
- width - width of texture image in pixels
- height - height of texture image in pixels
- components - how many color components per pixel: 1=grayscale, 3=RGB
- image - the 2-D array of pixels
Clones, External Functions, and Expression Functions
int vis5d_make_clone_variable( int index, int var_to_clone, char *newname, int *newvar )
- Clone a physical variable.
- var_to_clone - the number of the variable to clone
- newname - the name to give to the clone variable.
- newvar - returns the number of the new variable.
VIS5D_FAIL will be returned if newname is already in use.
int vis5d_compute_ext_func( int index, char *funcname, int *newvar )
- Call a user-written, external Fortran function to compute a new variable.
- name - the name of the function and variable to compute
- newvar - returns the number of the new variable.
If the function has been called before, the results of executing the
function will replace the values of the previous computation and no new
variable will be created.
int vis5d_compute_expression( int index, char *expression, char *newname, int *newvar, int *recompute, char *mess)
- Compute a new variable from an expression in terms of existing variables.
- expression - the expression to evaluate
- newname - name of variable which is the result of the expression
- newvar - returns the number of the new variable
- recompute - returns whether this variable was just recomputed
- mess - returns an error message in case of error
If the target variable of the function already exists, the results of
evaluating the expression will replace the values of the previous
computation and no new variable will be created.
Rendering Functions
int vis5d_signal_redraw( int index, int count )
- Sets the redraw flag to
count
.
When the API user wants the 3-D image
redrawn this function should be called. Vis5D core functions may also set
this flag.
int vis5d_check_redraw( int index, int *redraw )
- Check if a redraw is pending. This returns the value set by
vis5d_signal_redraw()
. If it's non-zero the user program
should call vis5d_draw_frame
soon.
int vis5d_draw_frame( int index, int animflag )
- Redraw the 3-D image. Then clear the redraw flag.
Note that the new image will not be displayed until vis5d_swap_frame is
called.
- animflag - used to specify if animation is currently taking place
int vis5d_draw_3d_only( int index, int animflag )
- Draw only the 3-D elements of a Vis5D scene. No graphics library
operations such as window clearing or matrix transformations are done.
- animflag - indicates if animation is currently enabled. This controls
whether contour slice numbers are displayed.
int vis5d_draw_2d_only( int index )
- Draw only the 2-D elements of a Vis5D scene. No graphics library
operations such as window clearing or matrix transformations are done.
int vis5d_swap_frame( int index, int animflag )
- Display the most recently drawn frame. This call usually follows
vis5d_draw_frame.
int vis5d_invalidate_frames( int index )
- Tells Vis5D to invalidate and discard any cached 3-D images.
int vis5d_set_pointer( int index, int x, int y )
- Draw an arrow pointer in the 3-D graphics window at position (x,y) where
(0,0) is the upper-left corner of the window. If (x,y) equals (-1,-1), the
default, then no pointer will be drawn.
This function is useful when the 3-D graphics window is on a different
display than the GUI.
int vis5d_graphics_mode( int index, int type, int mode )
- Specify miscellaneous graphics state.
- type - one of
- VIS5D_BOX = display the 3-D box
- VIS5D_CLOCK = display the clock
- VIS5D_MAP = display map lines
- VIS5D_TOPO = display topography
- VIS5D_PERSPECTIVE = render in perspective
- VIS5D_CONTOUR_NUMBERS = display contour slice numbers
- VIS5D_GRID_COORDS = display grid coordinates instead of
geographic coordinates
- VIS5D_PRETTY = use slow, high-quality rendering
- VIS5D_REVERSE = reverse black/white in the image
- VIS5D_INFO = display memory/work information
- VIS5D_PROBE = display the data probe
- VIS5D_CURSOR = display the 3-D cursor
- VIS5D_ANIMRECORD = enable stored frame animation
- mode - one of
- VIS5D_OFF = turn off
- VIS5D_ON = turn on
- VIS5D_TOGGLE = toggle state
- VIS5D_GET = return current state
Note, the return value is the current mode, not a VIS5D_ error value.
int vis5d_enable_graphics( int index, int type, int number, int mode )
- Specify which graphical elements are to be displayed.
- type - one of
- VIS5D_ISOSURF = isosurface
- VIS5D_HSLICE = horizontal contour slice
- VIS5D_VSLICE = vertical contour slice
- VIS5D_CHSLICE = horizontal color slice
- VIS5D_CVSLICE = vertical color slice
- VIS5D_VOLUME = volume rendering
- VIS5D_TRAJ = trajectory set
- VIS5D_HWIND = horizontal wind slice
- VIS5D_VWIND = vertical wind slice
- VIS5D_STREAM = horizontal streamline slice
- number -
- variable number, if type = VIS5D_ISOSURF, VIS5D_HSLICE,
VIS5D_VSLICE, VIS5D_CHSLICE, VIS5D_CVSLICE or VIS5D_VOLUME
- trajectory set number, if type = VIS5D_TRAJ
- slice number, if type = VIS5D_HWIND, VIS5D_VWIND or VIS5D_STREAM
- mode - one of
- VIS5D_OFF= turn off
- VIS5D_ON = turn on,
- VIS5D_TOGGLE = toggle current
- VIS5D_GET = just return value
Return 1 if graphic is finally displayed or 0 if not displayed.
int vis5d_check_volume( int index, int *volflag )
- Determine if 3-D volume rendering is available.
- volflag - returns 1 if volume rendering is available, 0 otherwise
int vis5d_set_volume( int index, int current_volume )
- current_volume specifies which volume to display or -1 which indicates no
volume is to be displayed.
int vis5d_get_volume( int index, int *current_volume )
- current_volume returns the number of the variable which is currently being
displayed as a volume or -1 if no volume is being displayed.
int vis5d_set_color( int index, int type, int number, float red, float green, float blue, float alpha )
- Set the color of a Vis5D graphic such as an isosurface, slice or
trajectory.
- type - one of
- VIS5D_ISOSURF = isosurface
- VIS5D_HSLICE = horizontal contour line slice
- VIS5D_VSLICE = vertical contour line slice
- VIS5D_CHSLICE = horizontal colored slice
- VIS5D_CVSLICE = vertical colored slice
- VIS5D_VOLUME = volume renering
- VIS5D_TRAJ = wind trajectory set
- VIS5D_HWIND = horizontal wind slice
- VIS5D_VWIND = vertical wind slice
- VIS5D_STREAM = horizontal streamline slice
- VIS5D_BOX = 3-D box
- VIS5D_BACKGROUND = window background color
- VIS5D_LABEL = color of text labels
- number -
- variable number, if type = VIS5D_ISOSURF, VIS5D_HSLICE,
VIS5D_VSLICE,VIS5D_CHSLICE or VIS5D_CVSLICE
- trajectory set if type = VIS5D_TRAJ
- slice number if type = VIS5D_HWIND, VIS5D_VWIND or VIS5D_STREAM
- red, green, blue, alpha - the color components as floating point
numbers in the interval [0,1]
int vis5d_get_color( int index, int type, int number, float *red, float *green, float *blue, float *alpha )
- Returns the color of a Vis5D graphic such as an isosurface, slice or
trajectory.
- type - one of
- VIS5D_ISOSURF = isosurface
- VIS5D_HSLICE = horizontal contour line slice
- VIS5D_VSLICE = vertical contour line slice
- VIS5D_CHSLICE = horizontal colored slice
- VIS5D_CVSLICE = vertical colored slice
- VIS5D_VOLUME = volume renering
- VIS5D_TRAJ = wind trajectory set
- VIS5D_HWIND = horizontal wind slice
- VIS5D_VWIND = vertical wind slice
- VIS5D_STREAM = horizontal streamline slice
- VIS5D_BOX = 3-D box
- VIS5D_BACKGROUND = window background color
- VIS5D_LABEL = color of text labels
- number -
- variable number, if type = VIS5D_ISOSURF, VIS5D_HSLICE,
VIS5D_VSLICE,VIS5D_CHSLICE or VIS5D_CVSLICE
- trajectory set if type = VIS5D_TRAJ
- slice number if type = VIS5D_HWIND, VIS5D_VWIND or VIS5D_STREAM THEN
- red, green, blue, alpha - returns the color components as floating
point numbers in the interval [0,1]
int vis5d_get_color_table_address( int index, int type, int number, unsigned int **colors )
- Returns the address of a color lookup table for an isosurface, colored
slice, volume, or the topography.
- type - one of VIS5D_ISOSURFACE, VIS5D_CHSLICE,
VIS5D_CVSLICE, VIS5D_VOLUME, or VIS5D_TOPO.
- number - the variable number if type is VIS5D_CHSLICE or VIS5D_CVSLICE
- colors - returns the address of the color table. There are 256
entries in all color tables
int vis5d_get_colorbar_params( int index, int type, int number, unsigned int **params )
- Returns the address of parameters for color lookup table for an isosurface,
colored slice, volume, trajectories or the topography.
- type - one of VIS5D_ISOSURFACE, VIS5D_CHSLICE, VIS5D_CVSLICE,
VIS5D_VOLUME, VIS5D_TRAJ or VIS5D_TOPO.
- number - the variable number if type isn't VIS5D_TOPO
- params - returns the address of the param array.
int vis5d_set_colorbar_params( int index, int type, int number, unsigned int params[] )
- Sets the values of parameters for color lookup table for an isosurface,
colored slice, volume, trajectories or the topography.
- type - one of VIS5D_ISOSURFACE, VIS5D_CHSLICE, VIS5D_CVSLICE,
VIS5D_VOLUME, VIS5D_TRAJ or VIS5D_TOPO.
- number - the variable number if type isn't VIS5D_TOPO
- params - returns the address of the param array.
int vis5d_set_cursor_color( int index, int traj_set )
- The color of the 3-D cursor is always the same as one of the trajectory
sets. This function is used to specify which trajectory set the cursor
color should track.
int vis5d_alpha_mode( int index, int mode )
- Specify how semi-transparent surfaces are to be rendered. If mode equals
zero then use the "screendoor" technique, otherwise use alpha blending.
int vis5d_font( int index, char *fontname, int size)
- Specify the font to use in the graphics window. The fontname is either an
X font or an IRIS GL Font Manager font name depending on what graphics
library is being used. The size argument is only used in the later case.
int vis5d_linewidth( int index, int width )
- Specify the width, in pixels, of line segments.
int vis5d_gl_setup( int index, long win_id, int width, int height )
- Prepare the context for a subsequent rendering
by providing information about the window in which to render.
(This allows an application to render a context into several
co-existing windows, for example.)
int vis5d_get_box_bounds( int index, float *xmin, float *xmax,
float *ymin, float *ymax, float *zmin, float *zmax )
- Returns the extents of the 3-D box in graphics coordinates.
3-D View Functions
int vis5d_set_matrix( int index, float ctm[4][4] )
- Set the current 3-D transformation matrix.
int vis5d_get_matrix( int index, float ctm[4][4] )
- Returns the current 3-D transformation matrix.
int vis5d_set_ortho_view( int index, int view )
- Set the current 3-D transformation matrix to view from a north, south,
east, west, top, or bottom vantage point.
- view - one of VIS5D_NORTH, VIS5D_SOUTH, VIS5D_EAST, VIS5D_WEST,
VIS5D_TOP, or VIS5D_BOTTOM.
int vis5d_set_view( int index, float xrot, float yrot, float zrot, float scale, float xtrans, float ytrans, float ztrans )
- Set the current 3-D transformation matrix with rotation, scale, and
translation values.
- xrot - rotation about the X axis in degrees
- yrot - rotation about the Y axis in degrees
- zrot - rotation about the Z axis in degrees
- scale - scale factor
- xtrans - translation along the X axis
- ytrans - translation along the Y axis
- ztrans - translation along the Z axis
int vis5d_set_camera( int index, int perspective, float frontclip, float zoom)
- Setup the parameters of the imaginary camera.
- perspective - 0=orthographic projection, non-zero=perspective
- frontclip - position of front clipping plane: 0=no clipping,
1=all clipped
- zoom - zoom (scale) factor, 1.0 is normal
int vis5d_get_camera( int index, int perspective, float frontclip, float zoom)
- Returns the parameters of the imaginary camera.
Make and Control Isosurface, Slices, Trajectories, etc.
int vis5d_make_isosurface( int index, int var, int time )
- Compute a time sequence of isosurfaces using the current isolevel.
- var - which variable
- time - which timestep to compute
int vis5d_set_isosurface( int index, int var, float isolevel )
- Set the current isolevel for a variable. The isolevel controls isosurface
generation.
int vis5d_get_isosurface( int index, int var, float *isolevel )
- Returns the current isolevel for a variable.
int vis5d_set_isosurface_color_var( int index, int iso_var, int colorvar )
- Specifies which variable is to be used to color and isosurface. A colored
isosurface is one which, instead of being mono-color, is colored per-vertex
by another variable according to a colormap.
- iso_var - which isosurface to color
- color_var - which variable to color the surface with, if -1 then use
mono-coloring.
int vis5d_get_isosurface_color_var( int index, int iso_var, int *colorvar )
- Returns the number of the variable used to color an isosurface.
- iso_var - which isosurface to query
- colorvar - returns the number of the variable used to color the
isosurface or -1 if mono-coloring.
int vis5d_make_hslice( int index, int var, int time )
- Compute a time sequence of horizontal contour line slice at the current
slice position.
- var - which variable
- time - which timestep to compute
int vis5d_set_hslice( int index, int var, float interval, float low, float high, float level )
- Set the current position and parameters of a horizontal contour line slice.
- var - which variable
- interval - isoline spacing
- low, high - range of values to contour
- level - grid level position of slice
int vis5d_get_hslice( int index, int var, float *interval, float *low, float float *level )
- Returns the current position and parameters of a horizontal contour line
slice.
- var - which variable
- interval - isoline spacing
- low, high - range of values to contour
- level - grid level position of slice
int vis5d_make_vslice( int index, int var, int time )
- Compute a time sequence of vertical contour line slice at the current slice
position.
- var - which variable
- time - which timestep to compute
int vis5d_set_vslice( int index, int var, float interval, float low, float high, float row0, float col0, float row1, float col1)
- Set current position and parameters of a vertical contour line slice.
interval - isoline spacing
- low, high - range of values to contour
- row0, col0 - grid row and column position of left side of slice
- row1, co1 - grid row and column position of right side of slice
int vis5d_get_vslice( int index, int var, float *interval, float *low, float high, float *row0, float *col0, float *row1, float *col1 )
- Returns current position and parameters of a vertical contour line slice.
- interval - isoline spacing
- low, high - range of values to contour
- row0, col0 - grid row and column position of left side of slice
- row1, co1 - grid row and column position of right side of slice
int vis5d_make_chslice( int index, int var, int time )
- Compute a time sequence of horizontal color slice at the current slice
position.
- var - which variable
- time - which timestep to compute
int vis5d_set_chslice( int index, int var, float level )
- Set the current position of a horizontal color slice.
- var - which variable
- level - grid level position of slice
int vis5d_get_chslice( int index, int var, float *level )
- Returns the current position of a horizontal color slice.
- var - which variable
- level - grid level position of slice
int vis5d_make_cvslice( int index, int var, int time )
- Compute a time sequence of vertical colored slices at the current slice
position.
- var - which variable
- time - which timestep to compute
int vis5d_set_cvslice( int index, int var, float row0, float col0, float row1, float col1 )
- Set the current position for a vertical colored slice.
- var - which variable
- row0, col0 - grid row and column position of left side of slice
- row1, co1 - grid row and column position of right side of slice
int vis5d_get_cvslice( int index, int var, float *row0, float *col0, float row1, float *col1 )
- Returns the current position for a vertical colored slice.
- var - which variable
- row0, col0 - grid row and column position of left side of slice
- row1, co1 - grid row and column position of right side of slice
int vis5d_make_hwindslice( int index, int slice, int time )
- Compute a time sequence of horizontal wind vector slices at the current
slice position.
- slice - which horizontal wind slice (0 or 1)
- time - which timestep to compute
int vis5d_set_hwindslice( int index, int slice, float density, float scale, float level )
- Set the current position of a horizontal wind vector slice.
- slice - which wind slice (0 or 1)
- density - density of vectors: 1 = default, .5 = half as many, etc
- scale - wind vector length scale, default is 1.0
- level - grid level position of slice
int vis5d_get_hwindslice( int index, int slice, float *density, float *scale, float *level )
- Returns current position and parameters of a horizontal wind vector slice:
- slice - which slice
- density - returns wind vector density
- scale - returns wind vector length scale factor
- level - returns position of slice as a grid level
int vis5d_make_vwindslice( int index, int slice, int time )
- Compute a time sequence of vertical wind vector slices at the current slice
position.
- slice - which vertical wind slice (0 or 1)
- time - which timestep to compute
int vis5d_set_vwindslice( int index, int slice, float density, float scale, float row0, float col0, float row1, float col1 )
- Set the current position and parameters for a vertical wind vector slice.
- slice - which wind slice, 0 or 1
- density - wind vector density: 1 = default, .5 = half as many
- scale - wind vector scaling factor, default is 1.0
- row0, col0 - grid row and column position of left side of slice
- row1, co1 - grid row and column position of right side of slice
int vis5d_get_vwindslice( int index, int slice ,float *density, float *scale, float *row0, float *col0, float *row1, float *col1 )
- Get the current position and parameters for a vertical wind vector slice.
- slice - which wind slice, 0 or 1
- density - returns wind vector density: 1 = default, .5 = half as many
- scale - returns wind vector scaling factor, default is 1.0
- row0, col0 - returns grid row and column position of left side of slice
- row1, co1 - returns grid row and column position of right side of slice
int vis5d_make_streamslice( int index, int slice, int time )
- Compute a time sequence of horizontal streamline slices at the current
slice position.
- slice - which horizontal streamline slice (0 or 1)
- time - which timestep to compute
int vis5d_set_streamslice( int index, int slice, float density, float level )
- Set the current position of a horizontal streamline slice.
- slice - which streamline slice (0 or 1)
- density - density of streamlines: 1 = default, .5 = half as many, etc
- level - grid level position of slice
int vis5d_get_streamslice( int index, int slice, float *density, float *level )
- Returns current position and parameters of a horizontal streamline slice:
- slice - which slice
- density - returns streamline density
- level - returns position of slice as a grid level
int vis5d_make_traj( int index, float row, float col, float lev, int time, int set )
- Compute a wind trajectory. Strictly speaking, a request for a trajectory
is put into the work queue.
- row, col, level - position in grid coordinates
- time - timestep number
- set - trajectory set number
int vis5d_set_traj( int index, float step, float length, int ribbon_flag )
- Set trajectory computation parameters:
- step - integration step size. 1.0 is normal. Use a smaller value
for finer integration, a larger value for coarser integration.
- length - trajectory length value. 1.0 is normal. Use a smaller
value for shorter trajectories, a larger value for longer trajectories.
- ribbon_flag - if non-zero, make ribbons, else make line segment
trajectories
int vis5d_get_traj( int index, float *step, float *length, int *ribbon_flag )
- Get trajectory computation parameters:
- step - returns integration step size UNITS???????
- length - returns trajectory length value UNITS??????
- ribbon_flag - return 1 for ribbons, 0 for line segment trajectories
int vis5d_set_trajectory_color_var( int index, int traj_set, int colorvar )
- Specifies which variable is to be used to color trajectories. A colored
trajectory is, instead of being mono-colored, colored per-vertex by
another variable according to a colormap. Current trajectories belonging
to the set will be recolored.
- traj_set - which trajectory set to color
- color_var - which variable to color the trajectory with, if -1 then
use mono-coloring.
int vis5d_get_trajectory_color_var( int index, int traj_set, int *colorvar )
- Returns the number of the variable used to color a trajectory set.
- traj_set - which trajectory set
- colorvar - returns the number of the variable used to color the
trajectory or -1 if mono-coloring.
int vis5d_delete_last_traj( int index )
- Delete the last trajectory made.
int vis5d_delete_traj_set( int index, int set )
- Delete a set of trajectories.
vis5d_init_graphics_pos( int index, int var )
- Reset the position and parameters of all graphics which correspond to the
given variable.
int vis5d_make_timestep_graphics( int index, int time )
- Recompute all displayed graphics (except trajectories) for a time step
- time - which timestep to recompute the graphics for
int vis5d_free_graphics( int index )
- Delete all graphics from memory. This can be useful when memory is
nearly exhausted or very fragmented.
Text Labels
int vis5d_make_label( int index, int x, int y, char *text )
- Make a complete text label at window coordinate (x,y). This function is
used for creating text labels non-interactivly.
int vis5d_new_label( int index, int x, int y, int *label_id )
- Start making a new text label at window coordinate (x,y). The label_id
will return a unique identifier for this label as accepted by the functions
below. This function is used for interactivly creating a text label. This
label is now considered the current label for editing, etc.
int vis5d_edit_label( int index, char chr )
- Append chr onto the current text label (see vis5d_new_label). If chr is a
backspace or delete character, the last character in the label will be
deleted.
int vis5d_find_label( int index, int x, int y, int *label_id )
- Determine which text label is nearest to window coordinate (x,y) and return
its unique identification number in label_id.
int vis5d_move_label( int index, int label_id, int x, int y )
- Move the text label identified by label_id to the new window position
(x,y).
int vis5d_delete_label( int index, int label_id )
- Delete the text label identified by label_id.
3-D Cursor Functions:
int vis5d_set_cursor( int index, float x, float y, float z )
- Set the cursor position. (x,y,z) is in graphics space.
int vis5d_get_cursor( int index, float *x, float *y, float *z )
- Returns the cursor's position as (x,y,z) in graphics space.
3-D Viewing Window Functions
int vis5d_get_window( int index, Window *window, int *width, int *height )
- Return the X window ID of the context's graphics window. Also return the
window size in pixels.
int vis5d_resize_window( int index, int width, int height )
- Call this function when the size of the 3-D window changes.
int vis5d_get_image_formats( int *formats )
- Returns a bitmask indicating which image file formats are supported by the
vis5d_save_window function. Formats supported may be the bitwise-OR of
zero or more of: VIS5D_XWD, VIS5D_GIF, VIS5D_RGB, VIS5D_POSTSCRIPT, or
VIS5D_COLOR_POSTSCRIPT
int vis5d_save_window( int index, char *filename, int format )
- Save the current 3-D image as an image file.
- filename - name of file to write
- format - one of VIS5D_XWD, VIS5D_GIF, VIS5D_RGB, VIS5D_POSTSCRIPT, or
VIS5D_COLOR_POSTSCRIPT
int vis5d_print_window( int index )
- Send the 3-D window image to the default printer. The printer must support
PostScript.
Coordinate Conversion
int vis5d_project( int index, float p[3], float *winx, float *winy )
- Project a point in 3-D graphics coordinates to 2-D window coordinates.
- p - the point in graphics space
- winx, winy - returns the projected point in window coordinates, in
pixels, where (0,0) is the upper-left corner of the window.
int vis5d_unproject( int index, float winx, float winy, float point[3], float dir[3] )
- "Unproject" a point from 2-D window coordinates to a parametric line in
graphics space.
- winx, winy - the window coordinate, in pixels, where (0,0) is the
upper-left corner of the window.
- point, dir - parametric equation of corresponding line in graphics
space: line = point + T*dir
int vis5d_xyz_to_grid( int index, int time, int var, float x, float y, float z, float *row, float *column, float *level )
- Convert a coordinate from graphics space to grid space. The timestep and
variable are needed in case of a projection which is dependent on timestep
and/or variable.
int vis5d_grid_to_xyz( int index, int time, int var, float row, float column, float level, float *x, float *y, float *z )
- Convert a coordinate from grid space to graphics space. The timestep and
variable are needed in case of a projection which is dependent on timestep
and/or variable.
int vis5d_xyz_to_geo( int index, int time, int var, float x, float y, float z, float *lat, float *lon, float *hgt )
- Convert a coordinate from graphics space to geographic space. The timestep
and variable are needed in case of a projection which is dependent on
timestep and/or variable.
int vis5d_geo_to_xyz( int index, int time, int var, float lat, float lon, float hgt, float *x, float *y, float *z )
- Convert a coordinate from graphics space to geographic space. The timestep
and variable are needed in case of a projection which is dependent on
timestep and/or variable.
Recently removed functions
int vis5d_init_trajvars( int index, char *uname, char *vname, char *wname )
- Functionality replaced by vis5d_set_wind_vars().
int vis5d_init_wind2( int index, char *u2name, char *v2name, char *w2name )
- Functionality replaced by vis5d_set_wind_vars().
int vis5d_get_graphics_color_address( int index, int type, int number, unsigned int **color)
- Replaced by the simpler vis5d_set_color() and vis5d_get_color() functions.
vis5d_get_expression( int index, int var, char *expression )
- Replaced by vis5d_get_var_info() function.
int vis5d_set_frontclip( int index, float position )
- Replaced by vis5d_set_camera().
int vis5d_set/get_zoom()
- Replaced by vis5d_set/get_camera().
Save and Restore
int vis5d_save( int index, int gfx, int traj )
- Replaced by tcl_save().
int vis5d_restore( int index, char *filename )
- Replaced by execute_script().
Other links:
Vis5D,
API document,
Scripting document,
Bill Hibbard,
Brian Paul.