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

The calculateProperties Function of a Scatterplot Module

This web page describes how to implement simple scatter plot functionality in the 3DVDM system.

There are four main parts in the implementation: (i) the constraints on the input data (cf. the yellow block, lines 10-13 in the code below), (ii) allocation of memory for the visualization primitives (green block, lines 14-24), (iii) computation of the visualization primitives (the magenta block, lines 25-42), and the transfer of the visualization primitives (the red block, lines 43-45).

calculateProperties Function is called whenever a user toggles any of the elements of the GUI. The scatter plot can be calculate only if three variables of the input dataset is selected. The yellow block of the code ensures that the execution scatter plot computation is continued only if X, Y, and Z attributes of the input data selected.

The green block of the code (re)allocates memory for the visualization objects. The number of objects is determined from the number of points in the dataset (line 15)

This implementation of the scatter plot visualizes the data points as tetrahedra. Magenta block computes the parameters of the tetrahedra and inserts the parameters into the properties array. The (x,y,z) coordinates of the tetrahedra are taken from the input dataset (lines 33-35).

The red block sends the visualization to the VR++ module.

define X        0
#define Y        1
#define Z        2
#define COLOR    3
#define BRIGHTNESS       4
#define OPACITY  5
#define SHAPE    6
#define SIZE     7
#define X_ROT    8
#define Y_ROT    9
#define Z_ROT   10

     1	TaskState ExampleMapper::calculateProperties()
     2	{
     3	  float x, y, z;          // x,y,z of the visualized point
     4	  long objectID;          // 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	  /* At least X,Y, and Z attribute must be selected in the GUI */
    11	  if (mappings[Z] <= 0)
    12	    return RECEIVE;
    13	
    14	  /* Allocating memory for the visualization primitives */
    15	  numberOfObjects = dataSet->getRows();
    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	  /* Calculating visualization primitives */
    26	  size_x = size_y = size_z = objectSize; // the size of the object comes
    27	  rot_x = rot_y = rot_z = 0.0;           // rotation
    28	  color = 1.0;                           // red
    29	  brightness = 1.0;                      // super bright
    30	  opacity = 1.0;                         // super oparcite
    31	  for (objectID = 0; objectID < numberOfObjects; objectID++) {
    32	    // Placing the tetrahedra into the properties variable
    33	    x = dataSet->getRescaledValue(objectID, mappings[X]-1);
    34	    y = dataSet->getRescaledValue(objectID, mappings[Y]-1);
    35	    z = dataSet->getRescaledValue(objectID, mappings[Z]-1);
    36	    setObject( objectID, shape,
    37	        x, y, z,
    38	        rot_x, rot_y, rot_z,
    39	        size_x, size_y, size_z,
    40	        color, brightness, opacity );
    41	  }
    42	
    43	  // Sending the properties to the VR++ module
    44	  return SEND;
    45	}