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 the Visualization of a Triangle

This web page describes how to visualize a line with the help of the 3DVDM system. In this example we draw a triangle between three verteces: (0, 0, 0), (1, 0, 0), and (0, 1, 0). We allow the user to change one parameters of the visualization: to turn on/off the visualization.

Three blocks of code are used to visualize the tetrahedra: (i) the allocation of the memory (cf. lines 14-21 of the code below), (ii) the computation of the visualization parameters (cf. lines 22-38), and the transfer of the data to the VR++ module of the system (cf. line 45). The rest of the code is required to implement turning on/off of the visualization. For example, lines 13-38 implements the scenario, when the showObjects check box of the GUI is selected, and lines 39-44 implements the scenario, when the showObjects check box is not selected.

     1  TaskState ExampleMapper::calculateProperties()
     2  { 
     3      // Triangle object
     4      float vertex_1[3];
     5      float vertex_2[3];
     6      float vertex_3[3];
     7      float color_1;
     8      float color_2;
     9      float color_3;
    10      float transparency;
    11      unsigned long object_triangle; // the counter of the triangles
    12
    13    if (showObjects == true){
    14      numberOfTriangles = 1;
    15      if (triangleProperties == NULL){
    16        triangleProperties = new float[TRIANGLE_PROPERTIES*numberOfTriangles];
    17      } else {
    18        delete [] lineProperties;
    19        triangleProperties = new float[TRIANGLE_PROPERTIES*numberOfTriangles];
    20      }
    21
    22      // Coordinates of the triangle
    23      vertex_1[0] = 0.0; vertex_1[1] = 0.0; vertex_1[2] = 0.0;
    24      vertex_2[0] = 1.0; vertex_2[1] = 0.0; vertex_2[2] = 0.0;
    25      vertex_3[0] = 0.0; vertex_3[1] = 1.0; vertex_3[2] = 0.0;
    26
    27      // Color of the triangle
    28      color_1 = 0.7;
    29      color_2 = 0.3;
    30      color_3 = 0.1;
    31      transparency = 1.0;
    32      
    33      // Triangle counter
    34      object_triangle = 0;
    35
    36      setTriangle(object_triangle, vertex_1, vertex_2, vertex_3,
    37          color_1, color_2, color_3, transparency);
    38
    39    } else {
    40      numberOfTriangles = 0;
    41      delete [] triangleProperties;
    42      triangleProperties = NULL;
    43
    44    }
    45	  return SEND;
    46  }
    47
    48