MENU

1. Overviews

2. Project Design

3. Problems and Solutions

4. Demonstration

5. Conclusion

 
Next 
 

 


ABSTRACT

    The purpose of this project is to develop a general-purpose graphical simulation system.  It provides users an environment to conduct simple 3D simulation.  To experiment with a simulation model, users must create a simulation scene, construct or use existing objects, then put them into the scene to run.  By adjusting the proper behaviors of the objects, the system can run under different scenarios and accomplish specific results.

    The three-dimensional graphics techniques in the system implements OpenGL library.  OpenGL supplies a lot of graphics commands, which produce very impressive 3D objects.  This project also provides a script language for users to design their simulation models.  They can use simple object-definition statements to create objects with polygons, boxes and other elements, then incorporate them with certain behaviors for them to move or act.  After loading a script file into the system, users can execute the scenario and watch the system perform an animated simulation.  Users can also modify the behaviors of the objects until they serve the purpose of the model.

    Since the composition of an object is object-based, the architecture of the project should be object-oriented.  This project is developed under Microsoft Visual C++ 4.0.  It uses Visual C++ and Microsoft Foundation Class (MFC) to design the major application architecture and user interface, implements the object classes and functions using C++, and invokes OpenGL commands and C functions to display three-dimensional objects and perform animation and interaction.
 
 
Menu
Previous
Next
 
 



1. OVERVIEWS


1.1 Basic Ideas - 3D Graphical Simulation & Animation



1.2 Purpose: Dynamic Object Design

- Allowing users to create new objects

- Importing a scene or scheme (simulation model) to perform animated simulation

- A scene is constructed by a script language called SGL (Simple GL)

- Object-based make-up language, allow complex object construction

- Simple object behaviors

- Simple, flexible, independent, extensible

 

1.3 Comparisons: Static and Dynamic Object Designs

- Providing the “methods” of drawing objects instead the objects

- Primitive drawing: points, polygons, boxes, cones, spheres, cylinders, etc.

- Using the SGL script language to construct simulation models

- Allowing various object creations

- Composer, browser and network transmission

- Dynamic object creation, runtime interpretation, lightweight design

Menu
Previous
Next
 
 



2. PROJECT DESIGN


2.1 The Functionalities of the Project

- System Environment: OpenGL states

- Simulation Model Hierarchy: Scene (simulation model), objects, and elements

(Polygons and points, boxes, cylinders, cones, spheres, and tori).

- Hierarchical Drawing Architecture (Object-Oriented Structure)

- Central Timer Controls (Animation)

- Runtime Interpretation and Execution (Tokenizer and Parser)

 

 

2.2 The SGL Script Language & Grammar

 Example: TestAll.sgl

Scene
begin
 Object
 begin
  ID            TestObject
  Time_Interval 0
  Rotate        0.00,    0.00,   0.00
  Translate     0.00,    0.00,   0.00
  Move          0.00,    0.00,   0.00
  Circle        0.00,    0.00,   0.00
  Scale         1.00
  Box
  begin
   Color     1.00,    0.00,   0.00
   Rotate    0.00,    0.00,   0.00
   Translate 5.00,    0.00,   0.00
   Width     2.00
   Height    1.00
   Depth     1.00
  end
  Polygon
  begin
   Color     0.00,    0.00,   1.00
   Rotate    0.00,    0.00,   0.00
   Translate 5.00,    0.00,   0.00
   Vertex   -2.00,    5.00,   0.00
   Vertex    2.00,    5.00,   0.00
   Vertex    2.00,   10.00,   0.00
  end
  ...
 end
end
 
Source Codes Execute



2.3 The Life-Cycle of a Simulation Model

 
 
 
 
Menu
Previous
Next
 




3. PROBLEMS & SOLUTIONS


3.1 Displaying Techniques: Scene-Object Hierarchical Architecture

 
 
 
 
 
 


3.2 Object Behavior Definition and Implementation

- Straight movements on x-, y- and z-axes (C3DObject ::mX, ::mY, ::mZ)

- Circling movements around x-, y- and z-axes (C3DObject ::cX, ::cY, ::cZ)

 
class C3DObject 
{ 
protected: 
    C3DElementNode *current, *last; 
    ... 
public: 
    // Object Properties 
    CString  ID; 
    long  timeInterval, currentTime; 
    float  rX, rY, rZ;  // Object Rotation 
    float  tX, tY, tZ;  // Object Translation 
    float  s;           // Object Scale 
    float  mX, mY, mZ;  // Object Movement 
    float  cX, cY, cZ;  // Object Circling Movement 
    float  mX, mY, mZ;  // Object Movement 
    float  cX, cY, cZ;  // Object Circling Movement 
    int nElement;
    C3DElementNode *theElements;
public:
    ...
};



3.3 Polymorphism

 
class C3DElement 

{ 

 ... 

 virtual void Draw () {}; 

}; 
class C3DPolygon: public C3DElement 

 ... 
 void Draw (); 
}; 

class C3DBox: public C3DElement 

 ... 
 void Draw (); 
}; 
... 

// Polymorphism 
C3DElement  *element; 
C3DPolygon  *polygon; 
C3DBox  *box; 
... 

polygon = * ((C3DPolygon*) element); 
box  = * ((C3DBox*) element); 
... 

 
 
 
 
 
 
 
 
Menu
Previous
Next
 
 



4. DEMONSTRATION


4.1 Design


4.2 Execute

 
 
Menu
 Previous 
Next
 
 



5. CONCLUSION


5.1 What I learn

- Visual C++ & MFC

- Advanced OOP & C++

 

5.2 Future Improvement and Implementation

- Supporting More OpenGL Features

- Supporting More Objects

- Implementation of Complex Behaviors

- Implementation of Complex Objects

- Special-Purpose Simulation System

- Statistics Simulation

- Entertainment

 

5.3 Other Simulation Systems

- Special Purpose

Virtual Reality: Aircraft, Automobile, Spacecraft

Human-Hazardous Situations

 

- Research and Statistics

Metropolis Traffic Simulation, Evolution Simulation System

Physics, chemistry, aerodynamics, anthropology, paleontology, and others

 

- Examples

 
 
 
 
 
 
Menu
Previous
Next
 



About This Project

 
Primary Adviosr: Dr. Ehab Hassanein
Secondary Advisor: Dr. Hubert Kordylewski
Student: Jin-Ghee Lu (Gene)
Date: May 4, 1998
 
 
Menu
 



Related Sites

 
The Official OpenGL Site
The VRML Consortium Site
Silicon Graphics Inc.
Microsoft's What is DirectX?
The SGI's Open Inventor Site
 
 
Menu
 

Prepared by Jin-Ghee Lu
Knowledge Systems Institute Graduate School
May 3, 1998