Citation
GUI Design for 3D Shape Modeling Software

Material Information

Title:
GUI Design for 3D Shape Modeling Software
Creator:
Patel, Mihir
Vermuri, Baba ( Mentor )
Place of Publication:
Gainesville, Fla.
Publisher:
University of Florida
Publication Date:
Language:
English

Subjects

Genre:
serial ( sobekcm )

Record Information

Source Institution:
University of Florida
Holding Location:
University of Florida
Rights Management:
All applicable rights reserved by the source institution and holding location.

Downloads

This item has the following downloads:


Full Text






Journ.31 of uni.nerr.3adua.3e Re--earch
,,Oluie 5, i ,Isue 5 - Fe '-ru.3ar, �'.ii-4


GUI Design for 3D Shape Modeling Software

Mihir Patel


ABSTRACT

This paper describes the problems and solutions associated with developing a Graphical User Interface(GUI) for a
three dimensional (3D) shape modeling software. The software for which the GUI, was built used dynamic subdivision
for generating 3D surfaces. Subdivision is a process which when applied recursively to any coarse surface with control
points generates a relatively smooth surface. The main problem that the paper focuses on is the one involved in combing
GLUT 3.7 (used for displaying 3D data)and FLTK 2.0 (for developing and displaying GUI components) Application
Programming Interfaces (APIs) in one single software.

BACKGROUND

"The concept of subdivision is ubiquitous in computer science. In visual computing areas, subdivision surfaces are
extensively used to model smooth shapes of arbitrary topology for computer graphics, animation, and geometric
design applications."[1] By applying a recursive subdivision scheme, with refinement rules at each level, one can achieve
a visually pleasing smooth surface.





/\' - ... . - _/_ . .. -





Figure la. The smoothing effect due to subdivision process1

Any three dimensional (3D) surface can be represented in form of triangles. As seen in Figure 1, by dividing each triangle
of the surface into four different triangles, the initial coarse surface can be transformed into a relatively smooth surface. As
the number of subdivisions increase, the surface gets smoother. In 1997, Chhandomay Mandal, a PhD. Student of Dr.
Vemuri (CISE, University of Florida) wrote a piece of software that used the modified versions of the subdivision process
known as "modified Butterfly subdivion" and "Catmull-Clark subdivision" to generate a smooth surface around a set of given
3-dimension points.

APPLICATIONS

There are a number of applications of subdivision process. One of the most important applications of subdivision is 3D
shape modeling. In Figure 2, the left part of the figure shows a piece of an image from a Magnetic Resonance Imaging
(MRI) scan of brain. Suppose the region enclosed in the red rectangle, is the region of interest (ROI). The 3D data
points enclosing the ROI are extracted to a file. By using the dynamic subdivision process, on the extracted 3D points, a
smooth surface can be formed around them. This allows the user to rotate and scale the ROI in 3D. The 3D model of the
ROI (right side of Figure 2) can be used for analyzing the ROI.





















Figure lb. MRI scan of a brain (LEft) and ROI's 3D model (Right)2


OBJECTIVE

The objective of this project was to develop a Graphical User Interface (GUI) for the piece of software mentioned above.
The major functionalities to be added in the GUI were as follows:

1. GUI should be user friendly.
2. GUI should allow saving the 3D model after subdivision.
3. GUI should allow loading of previously saved 3D models.
4. GUI should allow the user to interactively change the environment variables, and reflect the change in real-time.
5. GUI should allow the user to rotate the model in 3D.


DISCUSSION

The Two different approaches were taken towards achieving the goal.

1. Re-write the entire software in Java to use the GUI capabilities of Swing package and to make the software
platform-independent.
2. Develop the GUI components in C++ that would work with the existing software.

After spending about two months on the first approach, much success was not achieved, so second approach was taken. For
the GUI component, which was developed in C++, the following Application Program Interfaces (APIs) were used:

1. GLUT 3.7 for displaying 3D data
2. FLTK 2.0 for creating the GUI components (ex. Buttons, check-boxes, etc)

In order to achieve the goals that were set for the GUI, the first thing that needed to be done was to find out all the inputs
and outputs to the software. Also the software had a lot of options that the user could use to tweak the subdivision process,
but a lot of those options were closely related to the software more than the actual subdivision process. These options were
not of much use to someone who was not directly involved in the development of the software. The GUI component was
added in the software in such a way, that the existing user options were kept while new options were added. The
following section addresses some problems faced during the development and integration of the GUI component with
the software.


PROBLEMS

The first challenge in developing a compatible GUI component for the software was to be able to integrate two different
graphics APIs i.e. GLUT and FLTK. GLUT was used in the software to display the 3D data that is calculated while going
through the subdivision process, and FLTK was to be used for displaying the GUI objects i.e. the buttons, scroll bars, text-
input box, File-chooser, etc (see Figure 2). Both of these APIs require an event loop, which locks the program from
doing anything other than processing user-input via keyboard or mouse. Due to this event loop, once either of the APIs loop
was started, the program would never reach the part where the other APIs loop was to be started. This situation prevented
the program from displaying the later started APIs objects/components onto the display (computer monitor). For example, if
the GLUT's event loop is started then, the program would start displaying the 3D data and stay at that point forever or until it
is finished rendering the model. This prevented the program to reach code that started the FLTK's event loop, due to which
the GUI objects were never displayed.







SOLUTION

The above-mentioned problem could have been solved in a many different ways. The two ways that were analyzed are
given below:

1.
Threads approach
2.
Pause and run approach

By using a separate thread to display the components of the two APIs i.e. GLUT and FLTK, the problem could have been
solved. Due to the lack of knowledge of threads in C++, and also the complexity, and concurrency problems associated
with threads, the first approach was not implemented. The second approach seemed relatively simple in terms
of implementation complexity. In this approach, first the FLTK components were initialized and the FLTK's event loop
was started. The resulting screen is shown in Figure 2.


Figure 2. Initial FLTK screen.


The screen shown in Figure 2 is used to get the initial inputs necessary to start the subdivision process. Once the user clicks
on the button labeled "Cube Face File", "Cube Pos. File", or "Data-set File", the screen shown in Figure 3 is displayed.








Showr .|aat i F BavmisJ$ lj0


6.JI' 2 . l a i SMI . sD -2.4i
4.739 . IT. 1YS.UO -.4'
bulb aP. a 6 7 -j 4.Jfj i.O -I,|I
c uneFacecdar .n6uH IN. D4I7 -J o

cube ucdar .928 eo 2. 3nswo -e0 a
Cu2.beP I 141 1a. S i 45M -0.4I
I 54MJ41 17 1I227S -4.14
CubePft5 dar B'M.NM IS. S2770 -5.01
B.11 as s .,r1.o -L.o
culePli ar IM "4NI 577i2=0 n.u -a-
curelr el dal .Y'.7s141 14.5 "4PD -4.9'
cuDelCeiL-BI ,'.-ilS 3 0 :
cuolle dr'f- - - a.e, ouo h4.lil7

P Preview

Flieramer I 8.rr.l'nerapip1 y o tpan'norMne- i0 3ipirerc--crra n 'al

OK Cancel

Figure 3. FLTK File Chooser.


This FLTK window allows the user to select a file as an input. Once the user selects all the three files and sets the
other environment variables shown in Figure 2, the user has to click on the button labeled "Start Subdivision." After this
button is pressed, the program flushes away all the FLTK components it had initialized so far, but just before FLTK goes out
of scope, it starts the GLUT component initialization. After the GLUT component initialization ends, the GLUT event loop
is started, which displays the 3D data on the screen as shown in Figure 4 on the next page. At this point there are no
FLTK components that need to be displayed. As GLUT has entered its' event loop, it is continuously waiting for the user
input through the keyboard or the mouse. When the user press the key "2" on the keyboard, GLUT pauses its processes
and starts initializing FLTK components. After the FLTK component initialization, the FLTK event loop is started which results
in the screen shown in Figure 5. At this point, FLTK has the handle to the program, and GLUT components are in a pause/
sleep mode. The screen shown in Figure 5 gives the user options to change the environment variables. Once the user
changes the variables and click the button labeled "Continue", all the FLTK components are once again flushed out of
the program. Right after all the FLTK components are completely flushed out, the GLUT components gain the handle to
the program once again, and the subdivision environment reflects the changes made by the user.


DRAWBACKS


1. The first drawback of the solution is those every time, FLTK components are to be displayed, the program has to
dynamically allocate the memory and initialize them. Also every time, FLTK components are flushed away, the
program has to spend some time to de-allocate the memory for the components. The reason that this drawback can
be ignored is that the time involved in allocating and de-allocating memory, and to initialize the FLTK components is
on the order of milliseconds.
2. The second drawback is that the GLUT window that shows the 3D data and the FLTK window, which gives the user,
options to change the environment variables are not on a single canvas. The reason that the two windows could not
be shown at the same time is due to the fact that both GLUT and FLTK have the event loop, which prevented one of
the APIs' components from being displayed.





























Figure 4. GLUT displaying 3D data


Figure 5. FLTK Screen for Options


As seen in the Figure 5, the GUI also provides an option to save the 3D model. After the subdivision process is complete,
the user can click on the "Save Model" button, which will show a new window (Figure 6). In this new window, the user
can enter the level of subdivision desired and the name of the file to save the model in. Once the user enters the
information need to save the file, the software will save the 3D model in OBJ format. A 3D model saved in OBJ format can
be opened in most of the graphics suites. As part of this project another program (Loader program) was also written to load
the saved 3D models. The loader program was written in JAVA because the program can be embedded into a web page
for demonstration purposes. Once the loader program is run, the model is shown in a 3D environment. The user can rotate
and scale the model to view from different angles (see Figure 7 and 8).























Figure 6. Save Model Option.


Figure 7. Saved Model in Java Loader.


Figure 8. Saved Model from a different angle.


CONCLUSION





The final product met all the requirements, which were set for the GUI. Extra functionality was added which allowed the user
to demonstrate the subdivided model onto a webpage as a JAVA applet. This project can be further extended for
adding functionality for reading an MRI image instead of 3D points as input.

Figure 9 shows the inputs the user was expected to know at the time of using the software with old interface, but with
new interface, the user can intuitively use the software. This comparison shows the user friendliness achieved by the
new graphical interface.


Give the maximumwn level( >= 0) of subdivision desired,
3

Give tha level (0-3) of ap proxi nation for toenpuiati or
3

Give the maximrnu level (0-3) you might v ant to move up for increasing DOR
2 (3 in case you want to move up one step beyond the final fit, as in the
highest level editng example)

Give the file narnme w here face Info is stored.
SJdatacubeFace. dat

Give the file name w here vertex position s ar e star ed.
4da*tacubtPos.dat

Give the vetax scaling factor,
.35

Press T (Sht+T)
Enter time step value of 0,005

Press S (Sht+S)
Enter the follow Ing values :
,Jdataspock. dat (data stored in this file)
0 (squeeze Into unit cube)
1,0 (scaling : asis )

Press u (to start update)
Press r in every 6-7 lteiataons
Press I (sht+I) at iteration 30
0 (anter 0 to Inore.se a OF, moving up one levul)
Press r in every 6-7 iterartions
Press shrt+1) at Iteratin85
0 (enter 0 to increase DOF, moving up another level)
Press r in every 6-7 I trartions
Press u at Iterartion 125

This completes a nice fitting process
Figure 9. Old interface.


REFERENCES


1. Vemuri, Baba C., Mandal, Chandomay & Qin, Hong. Direct Manipulation of Butterfly Subdivision Surfaces: A
Physics based approach. University of Florida (CISE-TR-98-009)

2. Vemuri, Baba C., Mandal, Chhandomay & Qin, Hong. Dynamic Smooth Subdivision Surfaces for Data
Visualization. CISE Department, University of Florida. Available email: cmandal-qin-vemuri@cise.ufl.edu


--top--

Back to the Journal of Undergraduate Research


College of Liberal Arts and Sciences I University Scholars Program I University of Florida I


� University of Florida, Gainesville, FL 32611; (352) 846-2032.


UWl UNIVERSITY of
UL FLORIDA