Home Home Faculty Home Faculty of Computer Science
Free University of Bozen - Bolzano

Database and Information Systems

ABOUT DIS
Staff
Guests
How to reach us
Open Positions

TEACHING
BSc: DB Stream
MSc: DB Stream

COURSES
Advanced Topics in Databases
Advanced Topics in Inf. Systems
Approximation: Theory and Algorithms
Data Management Systems
Data Structures and Algorithms
Data Warehousing/Mining
Distributed Databases
Mobile Services
Seminar in Databases
Temporal and Spatial Databases

RESEARCH
Publications
PhD Projects
Software
Scientific Services
Seminars

RESEARCH PROJECTS
eBZ – 2015
COSPA
3DVDM-DS
Eurescom P817
Chorochronos
XVDM

FACULTY
IT Services
Faculty Council
Regulations

LINKS
DBLP
OnlineLibraries@unibz
G

W
About
Requirements
Download
Installation
Running
New Module
How Tos
Credits
Links

Simplest Example of the calculateProperties Function

This web page describes how to visualize one tetrahedra with the help of the 3DVDM system. In this example we place the tetrahedra in the middle of the VR coordinate system. We allow the user to change two parameters of the visualization: (i) on/off the visualization and (ii) the size the visualized tetrahedra

Three blocks of code are used to visualize the tetrahedra: (i) the allocation of the memory (cf. lines 14-24 of the code below), (ii) the computation of the visualization parameters (cf. lines 25-41), and the transfer of the data to the VR++ module of the system (cf. line 52). The rest of the code is required to implement turning on/off of the visualization. For example, lines 10-41 implements the scenario, when the showObjects check box of the GUI is selected, and lines 42-51 implements the scenario, when the showObjects check box is not selected.

It is a good starting point to use selected parts of the following code to integrate new modules into the 3DVDM system. One should include copy and paste the allocation of memory part (yellow block), computation of the visualization parameters part (green block), and the transfer of data block into your newly created module, and change the lines to suite your needs.

     1	TaskState ExampleMapper::calculateProperties()
     2	{
     3	  float record[3];      // x,y,z of the visualized point
     4	  unsigned long object; // objectNumber
     5	  float shape = 1.0;    // tetrahedron pointing upwards
     6	  float rot_x, rot_y, rot_z;    // rotation of the object
     7	  float size_x, size_y, size_z; // the size of the object
     8	  float color, brightness, opacity; // color, brigh, opa of the object;
     9	
    10	  /* If the showObject check box is selected, then we
    11	     visualize one point in the center */
    12	  if ( showObjects == true ){
    13	
    14	    /* Allocating memory for one visualization primitive */
    15	    numberOfObjects = 1; // number of objects visualized
    16	    if (properties == NULL) {
    17	      properties       = new float[PROPERTIES*numberOfObjects];
    18	      propertiesBufferSize = numberOfObjects;
    19	    } else {
    20	      delete [] properties;
    21	      properties       = new float[PROPERTIES*numberOfObjects];
    22	      propertiesBufferSize = numberOfObjects;
    23	    }
    24	
    25	    /* visualization parameters of the tetrahedra in the center */
    26	    size_x = size_y = size_z = objectSize; // the size of the object comes
    27	                                           // from the menu
    28	    record[0] = record[1] = record[2] = 0.5; // the center point in [0..1]^3
    29	    rot_x = rot_y = rot_z = 0.0;
    30	    color = 1.0;      // red
    31	    brightness = 1.0; // super bright
    32	    opacity = 1.0;    // super oparcite
    33	    object = 0;       // Object ID
    34	
    35	    // Placing the tetrahedra into the properties variable
    36	    setObject( object, shape,
    37	        record[0], record[1], record[2],
    38	        rot_x, rot_y, rot_z,
    39	        size_x, size_y, size_z,
    40	        color, brightness, opacity );
    41	
    42	  } else {
    43	    /* If the showObjects check box is not selected, we deallocate memory
    44	       and show nothing */
    45	    numberOfObjects = 0;
    46	    if (properties != NULL) {
    47	      delete [] properties;
    48	      properties = NULL;
    49	    }
    50	  }
    51	
    52	  return SEND;
    53	}
    54