Click here to Skip to main content
Click here to Skip to main content

Universal Framework for Science and Engineering - Part 7: Virtual Reality at Once

, 19 Nov 2010 CPOL
Rate this:
Please Sign up or sign in to vote.
An article on framework applications to virtual reality

Other useful resources:

Result of influence of physical field

Contents

Objective of this Update

This framework is originated from 2002. Since 2002, the OpenGL 3D graphics had been used. Recently WPF 3D graphics version has been developed. This version of the article contains WPF version of framework. This version is shortly described in chapter 8 (WPF 3D Graphics).

08/21/2010: I have extended WPF 3D graphics version. Now WPF version implements interaction of field with surface (see 5.2, 8).

11/19/2010: I have added texture support to WPF version of WPF 3D graphics.

Objective of Previous Update

The former update of this article had a very disappointing OpenGL bug. This bug had not been occurring on my computer. However, it made this software inaccessible for a lot of my readers. This bug has been fixed! I did not change the following text except for one picture in Chapter 6. However, the software has substantial changes. Unfortunately, the update of the software documentation is not yet prepared.

Introduction

It is not easy to study any science-intensive software. My software is not only science-intensive, but it is also interdisciplinary. Why do we need interdisciplinary software? Let the mechanical engineers be engaged by mechanics and the electricians be engaged by electricity. However, I know some engineering problems that include mechanics, electricity, heat, elasticity phenomena and also require the usage of star catalogues. For example, an aircraft or spacecraft may be equipped with radio systems, laser altimeters and astronavigation systems. Merging such problems into a single software framework enables us to solve these problems more effectively. The best understanding of my framework, I've found among advanced mathematicians and IT specialists. Both of them have a good understanding of high levels of abstraction. Otherwise, lots of engineers underestimate IT specialists. For example, many engineers do not know about the high levels of abstraction in electronic commerce. Lots of Russian residents think that commerce is:

  • Weighing;
  • Paying cash;
  • Wrapping.

Many engineers have almost similar opinions about electronic commerce software. Many radio-physics engineers think that the magnetic strength field of a dipole antenna is:

Dipole formula

Good IT specialists consider any physical field as an object. According to this opinion, it should be necessary to develop an abstract physical field. "I do not need any abstract field. I'm engaged by concrete practical problems. So I do not need arrays of variable lengths and I use Delphi and Fortran," answers the radio-physics engineer. However, this radio-physics engineer solves new concrete practical problems from the zero point.

This article is a single step on a very difficult road of propaganda for this universal engineering framework. The best propaganda should be easy to understand. The human mind grasps virtual reality much better than abstract theories or equations. Sometimes even I have doubts about my own software. However, when I see the good behavior of 3D shapes, my doubts vanish. If you try my software, then you will notice that the mechanical motions and interactions of 3D shapes with physical fields are correct. The first picture in this paper indicates such an interaction. This framework enables us to construct complicated pictures of virtual reality at once. It is like The Incredible Machine, but requires a stronger understanding of engineering problems.

Indeed, this software is not software, but rather a philosophy of scientific research. Now I do not know the details of its future development. Some of its elements seem very bad. Later I'll improve them, but for now I do not know the optimal ways for this improvement. This article is a survey. The documentation of this software contains the systematic description. This documentation shall be improved and extended. So, let us start.

What is New

Now that I'm engaged by a very interesting job, I have little time for writing profound descriptions of the framework. Also, I cannot find assistants. Any person who can catch the problem usually has their own excellent work. However, the framework is being intensively developed and I would like developers to know about its new updates. Therefore, instead of a profound description, I've put in brief remarks about changes to the framework.

1. Time Derivations

The new version of the formula editor contains a new operation:

Time derivation

Let us consider the usage of this operation. For example, we have the following picture:

Time derivation

The Init component has the following property editor:

Property editor of Init

Init has a single formula and accepts Derivation order 3. This means that any client of Init may use derivations of the formula by order up to 3. Der is a client of Init. Its editor of properties is exhibited below:

Property editor of Der

We have two formulas with one input variable, x. This variable is in fact Formula 1 of Init. The variable is provided by Init. So, we can calculate such derivations of formulas that require derivations of x of orders that do not exceed 3.

2. New Layout

Editors of properties in previous versions can be opened at separate windows only. Now you can find them on the desktop.

New layout

Now views of cameras are placed directly on the desktop. A right mouse-click on a caption (for example Left) shows the old layout in a separate window:

New layout

Also, a new version of the software contains dockable controls developed by Weifen Luo.

3. Other Features in Brief

The present day version of the framework contains lots of new components: magnetic field, measurements of a 3D field, inertial navigation systems, etc. Now there exists a website devoted to the framework. I and my colleagues are more engineers and scientists than software developers or architects. A lot of our work does not correspond to The Code Project. If you wish to know about this work, you can visit the framework website. This article contains a new chapter devoted to videonavigation.

Background

This framework seems very unusual. Other similar frameworks are adopted to specialists of domains. For example, LabView is oriented to dataflow. A typical dataflow diagram looks like:

Standard data flow representation

This diagram means that the signal flows from Filter 1 to Filter 2 and then to Filter 3. The situation is quite clear. However, if the software functionality is not limited to data flows, then a more appropriate language is a language of associations. In this language, as well as in my software, this diagram looks like:

Associations of data flow

The directions of arrows are inverted. This picture means that Filter 2 is a consumer of the signal of Filter 1. Filter 1 does not know about Filter 2, but Filter 2 knows about Filter 1. This is known to any IT specialist, although I hope that this article would be read by a wider audience than IT specialists. We may also imagine the situation that is presented in the following picture:

Complicated associations

This R 1 link means that Plane 1 is a consumer of the radiation of Radar. Link F 1 means that Radar is a consumer of the 6D position of Plane 1. Radar, as a source of radiation, does know about Plane 1. Otherwise, Plane 1 does not know about Radar as a 6D position. Similarly, we may consider Plane 2 as a consumer of the radiation of Plane 1. The notation of associations may be considered as an egoism of the software developer. However, specialists of electric circuits found that the letter i of the imaginary unit is an egoism of a mathematician, since this letter is used for instantaneous currents. However, the imaginary unit is not used by specialists of electric circuits only. It is used by specialists of aerodynamics, quantum chemistry, semiconductors, control systems, etc. Otherwise, my software is quite flexible and it is very easy to invert the directions of the arrows. This software is far from perfect. I intend to do revisions. However, now it is discussed for a little group of users. Maybe the motion of 3D shapes will attract more people to it. This propaganda shall be continued.

1. 6D Motion

This software originated as a version of dataflow. However, an excellent application of dataflow is animation. Really, equations of the motion of air and space objects are known, and the usage of advanced dataflow may sufficiently improve any software devoted to 6D motion. This software has an abstract 3D graphics layer. An OpenGL implementation has been developed. I've found that DirectX leads to memory overflow when many 3D graphics windows are used. Maybe I'll develop a DirectX implementation later. This chapter uses the following ingredients (components):

  • Finite formulas Finite formulas;
  • System of ordinary differential equationODE;
  • Rigid reference frameRigid reference frame;
  • Moved reference frameMoved frame;
  • CameraCamera;
  • 3D Shape3D Shape;.

Finite formulas are used for the kinematic trajectories of vehicles. If we wish to use the ordinary differential equations of vehicle dynamics, we should use second components. Rigid reference frames are used for the installation of cameras on them, while moved ones are used for the installation of vehicles. However, we can install a camera on the moved reference frame. Now I'll exhibit some examples.

1.1 Immelmann Turn

For me, the Immelmann turn is like "Hello world." The following scenario is a more impressive than a realistic one. Real planes and pilots do not allow such acceleration. To create this scenario, I chose analytic formulas of 6D motion. One of these formulas looks like:

Kinematics formula

Sometimes people tell me, "Only you can construct formulas for such advanced maneuvers. Hence your framework is not applicable." However, my practice has lots of examples for replacing 200 members by 2 - 3 guys. A potentially excellent application of this framework is a competition between guys for formulas for maneuvers of planes. This competition does not include finite formulas only. They can include differential equations. More complicated competitions may include acceleration limits, robot pilots and air fights. It is a real fight of minds. Now let us return to the Immelmann turn. This scenario is presented on the following picture:

Immelmann

This picture has the following meaning: we have a set of kinematic formulas that are stored on the Motion component. We also have a moved frame Plane Frame. This frame has the following properties:

Moved frame editor of properties

...i.e. co-ordinate X corresponds to Formula_1 of Motion, ... , component Q3 of orientation quaternion corresponds to Formula_7 of Motion. The Plane has been installed on the Plane Frame. We also have two rigid frames: Forward frame and Left frame. The properties editor of the rigid reference frame looks like:

Rigid frame editor of properties

It contains the transformation matrix and the co-ordinates. We can construct a tree of frames as it is presented below:

Tree of frames

This diagram means that the 6D state frame 1.1 is considered relative to Frame 1, etc. The usage of such diagrams is one of the reasons for the application of associations in this framework.

If you wish to try this sample:

Then set the Step and Step Count text fields on the main form to 1 and 150, respectively. Open the Forw and Left cameras (right click on the squares). Move the opened windows to (almost) full common visibility of them and click the Start button on one of the windows. You will see the Immelmann turn from different positions:

Forward camera

Left camera

1.2 Group of Planes

As well as the Immelmann turn, we can construct a group of moved 3D objects. If you wish to try the 4 planes sample:

Then set the Step and Step Count text fields on the main form to 1 and 70, respectively.

Group of planes

This situation contains a group of planes and several cameras. It is a very good exercise to set cameras for the necessary view. Two cameras have been installed on the planes. I doubted that these cameras would show the correct picture, but after some thought, I understood their moves. Indeed, this framework is an excellent tool for training 3D-imagination skills.

1.3 Plane + Follow-up System

In Part 3, I considered a two-channel follow-up system of radar antenna. I've said that it is possible to install a virtual camera on the antenna. I've implemented it. I've extended the scenario of Part 3 by adding a plane and cameras. If you wish to try the 4 planes sample, then:

Set the Step and Step Count text fields on the main form to 0.1 and 80, respectively. The following graph shows the residuals of the control system.

Oscillation process

The red curve is an azimuth residual and the blue curve is an elevation angle one. We can find this oscillatory process through the Following camera that has been installed on the antenna.

2. Deformations

This chapter uses additional components:

  • Transformer of 3D shape 3D shape transformer;
  • Transformer of bitmap Bitmap transformer.

As well as any transformer, the 3D shape is a consumer of data. It transforms the shape surface by the following rule:

u = f(w);

...where u = (x, y, z) and w = (x', y', z') are 3D vectors. Since this framework in fact contains the dataflow, we can use any data transformer for the definition of f. However, we should define what is x. This framework operates with a notion of aliases. For example, the finite formulas component has the constants x, y, z and a:

Finite formulas

Every constant may be an alias and it may be used as the input data of a 3D shape transformation. Otherwise, the editor of the properties of the 3D shape transformer looks like:

3D Shape transformation

The picture above has the following meaning. Components of w=(x', y', z') to F.x, F.y, and F.z, or x, y and z of F. Otherwise, components ofu = (x, y, z) correspond to Formula_1, ... , Formula_3 of F. So, we can deform the 3D shapes. Similarly, we can deform 2D bitmaps.

2.1 Deformation of Plane

If a plane has a vertical acceleration, then its wing is being deformed. The grotesque picture is shown below:

Normal state of plane
Normal state
Deformed state of plane
Deformed state

If you wish to try this sample, then:

This sample looks like:

Deformation of plane

This picture contains a prototype Plane and the result of the deformation, the Deformed Plane. F contains the formulas of deformation. Also, we have two cameras and a reference frame that define a 6D position of cameras.

2.2 Torus

This sample is rather an example of analytical geometry. It shows that this framework may also be used as training software. In this sample, a square:

Square

...was deformed to a torus:

Torus

If you wish to try this sample, then:

2.3 Deformation of View

There exists an engineering problem when we deform a view. For example, sometimes it is necessary to simulate a view through a curved mineral glass or a view in a distorting mirror. The transformer of a bitmap is used for solving this problem. As well as any typical object of this framework, the camera implements a set of interfaces. One of them is the "Bitmap provider."

The transformer of the bitmap Bitmap transformer may be connected to any "Bitmap provider." The editor of properties of the transformer of the bitmap looks like:

Transformation of torus view

In this picture, the camera view of the torus has been used as a prototype. We have performed the following transformation of coordinates of the bitmap:

Transformation law of view

If you wish try this sample, you should perform the downloads from 2.2.

3. 6D Dynamics

3.1 Introduction

Solid body dynamics are described by systems of ordinary differential equations (ODE). This software contains an ODE solver. However, I've found that this solver is very complicated for users who wish to simulate 6D dynamics.

So I've developed a special solver, 6D dynamics, for 6D dynamics. It is not easy to use it, but later I'll develop a simpler component. This component does not operate with the ODE, but it uses the forces and torques. Its editor of properties looks like:

6D dynamics editor of properties

Forces and torques are decomposed by the components of the absolute reference frame and relative reference frame:

Decomposition of forces and torques

There is a rigid connection between a solid body and relative frame. This decomposition is very convenient. For example, it is convenient to describe the tractive force of an aircraft engine using a relative reference frame. However, an absolute reference frame is useful for the description of gravity forces. The description of the 6D dynamics of solid bodies requires feedback. Forces and torques act on solid bodies. Values of forces and torques depend on the motion parameters of the body. Otherwise, derivations of motion parameters depend on forces and torques. This feedback is presented on the following picture:

6D dynamics feedback

It had been used as a mechanism of aliases for the implementation of this feedback. A more profound description of aliases can be found in the documentation. Usage of aliases enables linking aliases with motion parameters. It is shown below:

6D dynamics feedback

3.2 Example: Dynamics of an Aircraft

Let us consider an example of aircraft dynamics. An aircraft is forced by gravitational force, reactive force and aerodynamic force. Moreover, the aerodynamic momentum adds to the forces on the aircraft. The gravitational force and tractive ones are very trivial and we consider aerodynamic forces and torques. They are described by the drag coefficient and the lift coefficient. These coefficients depend on the angle of attack. At transonic velocity, these coefficients strongly depend on the Mach number. Aerodynamic torques also may be described by coefficients and those may depend on the angle of attack and the Mach number. Usually, these coefficients are obtained experimentally and defined by tables. I've created a scenario with forces and moments that depend on the angle of attack and the Mach number. Maybe I would be criticized by specialists of aerodynamics. However, I am ready for further discussion of the subject and improving this scenario. This scenario is shown on the following picture:

6D dynamics scenario

This scenario contains different calculations and uses 2D tables 2D tableof aerodynamic coefficients. For example, the drag coefficient is defined by the following 2D table:

Drag coefficient table

This table describes the dependency of the drag coefficient on the angle of attack and the Mach number.

4. Containers

Some engineering devices contain a set of components that are not rigidly linked. It is convenient to merge such devices into containers. One example of containers is presented below. The conventional layout helicopter has the following components:

  • Fuselage;
  • Main rotor;
  • Tail rotor.

For pitch (tilting forward and back) or roll (tilting sideways), the angle of attack of the main rotor blades is altered or cycled during the rotation, creating a differential of lift at different points of the rotary wing (see Controlling flight). So we have a very complicated motion of blades. This framework uses the following scenario of this motion:

Full picture of helicopter

For convenience, we've merged these components into a single one (named Helicopter) and then we've installed cameras around it:

Container of helicopter

You can observe the helicopter through these cameras:

Different views of helicopter

You can notice the helicopter-specific motion of the blades.

5. Physical Fields

Virtual reality does not only show things that could be seen by the eye. It also represents invisible physical phenomena. Heat distribution, electromagnetic waves and lots other phenomena are not visible. Good examples of visualization can be found at:

There exist thousands of other examples. Since this framework is universal, it should operate with every kind of physical field. Fields may live at 1D, 2D, 3D or 4D space (time). Now, a Euclidean space of any dimension is implemented as an environment of a physical field. My software does not yet admit the Pseudo-Riemannian manifold as an environment of a physical field. However, I already do not like the Pseudo-Riemannian manifold and prefer Noncommutative geometry. My first step in noncommutative geometry can be found here. My great wish is the adoption of this framework to Noncommutative geometry.

Let us return to physical fields in Euclidean spaces. Physics have scalar, vector, tensor and other types of fields. An important aspect of modelling is a law of field transformation during co-ordinate system transformation. A good review of this subject can be found in this article.

5.1 Implementation of Physical Fields

Any field implements the following interface:

namespace PhysicalField
{
    ///<summary>
    /// Physical Field
    ///<summary>
    public interface IPhysicalField
    {
        ///<summary>
        /// Dimension of space
        ///<summary>
        int SpaceDimension
        { get; }
        ///<summary>
        /// Dimension of space
        ///<summary>
        int Count
        { get; }
        ///<summary> /// Type of n-th component
        ///<summary>
        ///<param name="n">Component number</param>
        ///
        ///<returns>Type of n-th component</returns>
        object GetType(int n);
        ///<summary>
        /// Type of transformation of n - th component
        ///<summary>
        ///<param name="n">Component number</param>
        ///
        ///<returns>Transformation type</returns>
        object GetTransformationType(int n);
        ///<summary>
        /// Calculates field
        ///<summary>
        ///<param name="position">Position</param>
        ///
        ///<returns>Array of components of field</returns>
        object[] this[double[] position]
        { get; }
    }
}

A field may contain a set of components of different types. Types may be scalar, vector, or tensor ones. Every component has its own type of transformation. The method object[] this[double[] position] calculates the field value at a position on a Euclidean space. The usage of the set components has the following reason. Electromagnetic fields of infrared and radio diapason may be considered as fields of different natures. We can separate different frequency bands, so the separation of fields may be very convenient. This software contains the dataflow and data processing. It is an excellent material for implementation of the field. Also, for 6D dynamics, we use the following architecture of feedback:

Feedback of physical field

The user interface of the field property editor looks like:

Properties of field

This editor has a number of components. Coordinates are defined by aliases. Field parameters are defined through data processing. We can use a matrix and vector formulas for the definition of a field. The following formula with a vector product will be used below:

Field formula

...and corresponds to the electric field strength of a dipole antenna.

5.2 Interaction Between a Field and a Surface

The interaction between a field and a surface is presented in the following picture:

Interaction between field and surface

A surface is divided by elements. Every element of a surface has material and derived parameters. Material parameters may be:

  • A vector that characterizes surface anisotropy (surface may have a set of such vectors);
  • A normal vector;
  • Surface conductance (surface may have a set of such parameters for different frequency bands);
  • A heat-transfer factor.

Derived parameters may be:

  • Surface current (surface may have a set of currents for different frequency bands);
  • Surface temperature;

Derived parameters of the element of a surface depend on the field value near the element and at material parameters of the element. The mechanism of aliases is used for the calculation of derived parameters. The user interface editor of surface properties is presented on the following picture:

Surface propreties

This picture contains the aliases of field and material parameters. Also, it contains a derived parameter. This software supports the visualization of derived parameters:

Surface visualization

Output parameters are used as colors of visualization. A sample scenario of interaction between fields and surfaces is presented below:

Interaction between surface and field

This sample contains a Field that is the electric field strength of a dipole antenna. The Surface contains a material parameter. It is a vector of normal. The derived parameter is a surface current. The module of the surface current is visualized. If you press the Update button on the surface property editor, then you can see the following picture:

Result of influence of physical field

...through the Camera.

6. Stars

Originally, I used star catalogues for my own research in astronomy. Later, I found that catalogues with the framework make excellent materials for solving engineering problems. Lots of engineering devices use astronomical instruments. Moreover, star catalogues may be used for virtual reality. Let us consider the construction of a set of stars step-by-step.

Step 1. SQL Query

It uses the Query component SQL Query icon for this purpose. Its property editor is presented below:

Properties of SQL Query

Now this framework supports the SQL Server driver, the Oracle driver and the ODBC driver.

Step 2. Transformation

A catalogue of stars operates with parallaxes, the star's magnitudes and other parameters. We should transform them to geometric coordinates and also visible colors and sizes. We use data transformation for this purpose.

Step 3. Creation of a Set of Visible Images

We use a special component for this purpose. Its property editor is presented below:

Editor of properties of array of stars

This UI is clear.

Step 4. Installation of (Moved) Cameras

We can install cameras on the (moved) reference frame and observe the stars through them. The resulting picture looks like:

Picture of stars

A sample of the visualization of stars is presented below:

Sample of visulization of stars

It contains all the ingredients of steps 1 - 4. For the motion of pictures, enter the Step and Step Count and then press the Start button:

Start

7. Videonavigation

If we have a several sets of photos of a 3D object, we can obtain its 6D position. In this example, this problem is solved in the following way. From the photos and virtual cameras, we obtain the contours of the object as it is presented on the following picture:

Picture before iteration

The red contour corresponds to the photo and the blue one corresponds to the virtual 3D object. Then we perform virtual 6D motion of the object to match both contours. In result, we have a matching that looks like:

Picture after iteration

For solving this problem, we shall use the following combination of components:

Picture after iteration

8. WPF 3D Graphics

Recently, the WPF version of the framework has been developed. Here you can download the new version of code and examples.

Almost all these samples are mirrors of OpenGL samples. However the Framework is being continuously developed. Now it is compatible with Simulink. In this version, Simulink PID controllers are being used in follow - up system sample. You can find more information about it in my article Grandiose Projects 3. Compatibility with Simulink. The following picture represents WPF version of "Interaction of Field with Surface" sample.

Picture after iteration

Points of Interests

Ilja Muromets is a Russian national hero and a resident of the territory of the present Ukraine. He was very ill and was even paralysed up to the age of 33 years. Then he became a very strong man and he defeated the well-equipped, hard-skilled troops of the Tatars, Mongols, Khazars and the Hitlerite aggressors. Now I'm in a similar situation. Behind the iron curtain of the USSR, the shortage of information and hardware had made me paralysed. Now, my own powerful computers are looking for dark matter in space, using catalogues with lots of stars. These catalogues may be downloaded by anybody. Many scientific papers and databases are accessible. Recent technologies enable everybody to make great scientific discoveries at home. Now we have fantastic 3D graphics. I was even named 3D Monster for my 3D graphics. The voice of one man is the voice of no one. Of course, one man cannot produce commercial software. But he can generate excellent ideas for it.

8.1 Support of textures

Current version of framework (11/19/2010) supports textures. You can download current version by following link.

Textures could be used in the following way. User should create XAML file with ModelVisual3D object. This object references to 2D graphics files. The XAML file and 2D graphics files should be put into a single directory. Sample of such directory user can be downloaded below:

The user should use the following component:

3D component

User sets this component on desktop and opens XAML file.

The following picture presents the above sample:

Texture support sample

This sample contains cube with textures and 4 virtual cameras with different background colors. These cameras look at the cube. This sample could be animated.

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

Share

About the Author

Petr Ivankov
Architect
Russian Federation Russian Federation
Ph. D. Petr Ivankov worked as scientific researcher at Russian Mission Control Centre since 1978 up to 2000. Now he is engaged by Aviation training simulators http://dinamika-avia.com/ . His additional interests are:
 
1) Noncommutative geometry
 
http://front.math.ucdavis.edu/author/P.Ivankov
 
2) Literary work (Russian only)
 
http://zhurnal.lib.ru/editors/3/3d_m/
 
3) Scientific articles
http://arxiv.org/find/all/1/au:+Ivankov_Petr/0/1/0/all/0/1

Comments and Discussions

 
General[Message Removed] PinmemberKatekortez25-Oct-08 10:29 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.

| Advertise | Privacy | Terms of Use | Mobile
Web03 | 2.8.141220.1 | Last Updated 19 Nov 2010
Article Copyright 2006 by Petr Ivankov
Everything else Copyright © CodeProject, 1999-2014
Layout: fixed | fluid