Steps in making the DX2Web module |
Overview
The first step in working on this project was gathering
information and getting a grasp of what we needed to know. Our
background for this project included two key classes:
In CS417/418 we were first introduced to DataExplorer and the DX
programming environment. In CS410 we were challenged with several
extension projects in C programming. CS410 is required for
computer undergraduates at Cornell and CS417/418 fulfills an
upper level computer science course/practicum
requirement.
The four main information sources we used were:
The DX user manual and the programming reference helped us
understand the method of making modules for DX and the various
functions necessary to retrieve and modify DX data. The WebOOGL
home page helped us understand the WebOOGL graphics library and
how to set up Geomview. Finally Alerk Amin's code helped to
serve as a backbone on which we fleshed out the conversion
routines of the DX2Web module.
One of the most fundamental challenges to the project was
understanding the DX data model. DX stores various data in the
form of objects. Objects can be further broken down into
several types:
- Fields
- Arrays
- Groups
- Transforms
- Screens
- Lights
- and many others
The most important types are the Fields, arrays and Group. The bulk of the
data is stored in memory as array objects.
Groups are collections of objects. Anytime the collect module is
used in DX a group is created out of the objects that flow into
the collect module.
Fields are the fundamental objects in the Data Explorer data
model. They represent a mapping from some domain to some data
space, consisting of a series of positions and a series of
connections which define the graphical object you want
displayed. In addition fields can have other components which are
simply arrays of data. these components can represent anything-
- data: arbitrary user's data
- colors: surface colors
- opacities: transparency of a surface or volume
- tangents: curve tangents
- normals: curve or surface normals
- and many others
The DX data module allows you to manipulate these components
using built in functions such as DXGetObjectClass to
achieve the desired graphical effect.
Alerk Amin's CS490 project involved transforming a DX object to
a Rayshade object. This was very similar to what we wanted to
achieve so we decided to reapply the code to this project. The
source code is somewhat complicated so the best idea would be
to go through the comments line by line to get a better
understanding of what exactly happens however a general
overview will also help.
The source code follows theses general steps:
- Get the current object
- Find out the class of the object
- If the object is a group enumerate it and pass the pieces
to step 1
- Else if the object is a field then
- Get the connects, colors, and positions of the field
- Change the format to a WebOOGL format
- Export those to an external file
Notice the recursion in step 3. This recursion allows the
DX2Web module to parse every field for the necessary data by
breaking the objects down into groups and fields and then
recursively iterating through all of them.
The first step in testing the project was to manually convert a
simple object from DX to WebOOGl. We created a Perl script to
convert a sphere created in DX to the WebOOGL format and
outputted the result into an 10,000 face (THIS IS A BIG FILE - 900K) OFF file .
We next tried to view the object in WebOOGL, rotate it, scale
it, and translate it.
The second test was to modify Alerks source code to handle a
simple object. We modified the write_quads function and tried
to run it through with the following figure. (insert two_cube
image here)
From this we learned that Alerk's DX code could not handle
transforms because the two cubes were actually duplicates of
the same cube translated.
Finally we finished modifying the code and tested the module on
a multi-faced pair of objects. A sphere and a torus in one
image. When that finally worked the resulting image looked much
the same as the DX image
NOTE: The colors and resolutions of the following images are slightly skewed because we reduced the resolutions using XV
Image produced in DX | Image produced in Geomview |
| |
Our documentation has evolved along with the project and has
been in the works from the beginning. We then went back over
the documentation and corrected any areas that were in error
and filled in any gaps in what was needed.
Any comments of suggestions? dkw1@cornell.edu or fl10@cornell.edu