[ieee 2009 4th international symposium on computational intelligence and intelligent informatics....

4
978-1-4244-5382-5/09/$26.00 ©2009 IEEE Algorithm for Virtual Reality MARIUS-CONSTANTIN POPESCU Faculty of Electromechanical and Environmental Engineering, University of Craiova, ROMANIA. VALENTINA EMILIA BALAS Faculty of Engineering, “Aurel Vlaicu” University of Arad, ROMANIA. MARIUS MIRCEA BALAS Faculty of Engineering, “Aurel Vlaicu” University of Arad, ROMANIA. ONISIFOR OLARU University „Constantin Brancusi” Tg. Jiu, ROMANIA [email protected] , [email protected] ; [email protected] Abstract- POV-Ray is a freeware, stand-alone, world-class renderer that creates three-dimensional photo-realistic images taking as input a text file with the scene described in a script language known as POV-Ray Scene Description Language (SDL). Image synthesis languages like POV-Ray do not give detailed description of the surfaces of the objects they generate, and therefore it is quite difficult to use them for engineering computations. Rather than trying to solve the problem of data translation, we propose to apply the fictitious domain method in the numerical solution. We explain what the difficulties are and give some solutions with an illustration of a finite element computation for a three-dimensional acoustic scattering problem. Bishop3D is an interactive modeler and animation tool designed and built to work with POV-Ray. I. INTRODUCTION The algorithms of Virtual Reality (VR) [1],[11] have to do compromise between realistic rendering and speed. Constructive Solid Geometry is quite popular in VR and consequently the domain of integration of the PDE is not given by its boundary but by set operations on simple elementary volumes, typically unions and intersections and sometimes extrusion. Fig. 1. Interface - the modeller is the main module of the program and probably where you will do the most part of the work. Bishop3-D allows you to model the scenes interactively and it will automatically generate the correspondent POV-Ray SDL script. It offers native keyframe animation support, POV-Ray SDL import and a powerful texture editor. Bishop3-D communicates with POV-Ray via POV-Ray's extension interface, providing a seamless integration between the modeler and the renderer. You can start render jobs and see the results without ever leaving Bishop3D. Consider for example the following scene (see Fig.2) described in the POV-Ray language [8]: It is a set of spheres and cylinders with some realistic texture; notice that there is no information about their intersection. This is seen only in the rendering phase which is based on the zbuffer algorithm (zbuff [] is initially filled with large values): This C-program displays 3-D objects fτ!(ξ[τ]; ψ[τ]; ζ[τ])g on a screen of size hmax × vmax. By displaying all objects this way each new voxel (3-D point) of an object lights a pixel (2- D point) only if it is in front of all previously displayed voxels that fall on the same pixel. The engineering data on the other #declare altere = union{cylinder {<-1.5,0,0> <1.5,0,0>,.35} sphere{<-1.5,0,0>, 0.5} sphere{<1.5,0,0>,.5}} union{object{altere rotate z*90} object{altere scale 1} object{altere rotatey*90} sphere{<0,0,0>, 0.6 }} for(t=0;tmax;t++) if(z[t]<=zbuff[x[t]][y[t]]) { putpixel(x[t],y[t],z[t]); zbuff[x[t]][y[t]]=z[t]; } ISCIII 2009 4 th International Symposium on Computational Intelligence and Intelligent Informatics 21–25 October 2009 Egypt 125

Upload: o

Post on 03-Mar-2017

216 views

Category:

Documents


4 download

TRANSCRIPT

Page 1: [IEEE 2009 4th International Symposium on Computational Intelligence and Intelligent Informatics. ISCIII 2009 - Luxor (2009.10.21-2009.10.25)] 2009 4th International Symposium on Computational

978-1-4244-5382-5/09/$26.00 ©2009 IEEE

Algorithm for Virtual Reality

MARIUS-CONSTANTIN POPESCU Faculty of Electromechanical and Environmental Engineering, University of Craiova, ROMANIA.

VALENTINA EMILIA BALAS Faculty of Engineering, “Aurel Vlaicu” University of Arad, ROMANIA.

MARIUS MIRCEA BALAS Faculty of Engineering, “Aurel Vlaicu” University of Arad, ROMANIA.

ONISIFOR OLARU University „Constantin Brancusi” Tg. Jiu, ROMANIA [email protected] , [email protected]; [email protected]

Abstract- POV-Ray is a freeware, stand-alone, world-class renderer that creates three-dimensional photo-realistic images taking as input a text file with the scene described in a script language known as POV-Ray Scene Description Language (SDL). Image synthesis languages like POV-Ray do not give detailed description of the surfaces of the objects they generate, and therefore it is quite difficult to use them for engineering computations. Rather than trying to solve the problem of data translation, we propose to apply the fictitious domain method in the numerical solution. We explain what the difficulties are and give some solutions with an illustration of a finite element computation for a three-dimensional acoustic scattering problem. Bishop3D is an interactive modeler and animation tool designed and built to work with POV-Ray.

I. INTRODUCTION

The algorithms of Virtual Reality (VR) [1],[11] have to do compromise between realistic rendering and speed. Constructive Solid Geometry is quite popular in VR and consequently the domain of integration of the PDE is not given by its boundary but by set operations on simple elementary volumes, typically unions and intersections and sometimes extrusion.

Fig. 1. Interface - the modeller is the main module of the program and

probably where you will do the most part of the work.

Bishop3-D allows you to model the scenes interactively and it will automatically generate the correspondent POV-Ray SDL script. It offers native keyframe animation support, POV-Ray SDL import and a powerful texture editor. Bishop3-D communicates with POV-Ray via POV-Ray's extension interface, providing a seamless integration between the modeler and the renderer. You can start render jobs and see the results without ever leaving Bishop3D. Consider for example the following scene (see Fig.2) described in the POV-Ray language [8]:

It is a set of spheres and cylinders with some realistic texture; notice that there is no information about their intersection. This is seen only in the rendering phase which is based on the zbuffer algorithm (zbuff [] is initially filled with large values):

This C-program displays 3-D objects fτ!(ξ[τ]; ψ[τ]; ζ[τ])g on a screen of size hmax× vmax. By displaying all objects this way each new voxel (3-D point) of an object lights a pixel (2-D point) only if it is in front of all previously displayed voxels that fall on the same pixel. The engineering data on the other

#declare altere = union{cylinder {<-1.5,0,0> <1.5,0,0>,.35} sphere{<-1.5,0,0>, 0.5} sphere{<1.5,0,0>,.5}} union{object{altere rotate z*90} object{altere scale 1} object{altere rotatey*90} sphere{<0,0,0>, 0.6 }}

for(t=0;tmax;t++) if(z[t]<=zbuff[x[t]][y[t]]) { putpixel(x[t],y[t],z[t]); zbuff[x[t]][y[t]]=z[t]; }

ISCIII 2009 • 4th International Symposium on Computational Intelligence and Intelligent Informatics • 21–25 October 2009 Egypt

125

Page 2: [IEEE 2009 4th International Symposium on Computational Intelligence and Intelligent Informatics. ISCIII 2009 - Luxor (2009.10.21-2009.10.25)] 2009 4th International Symposium on Computational

hand use Bezier or B-spline patches from which it is easier to derive a triangulation of the surfaces in the scenes, a necessary step for the generation of three-dimensional meshes. The problem that this note addresses is the solution of a partial differential equation in a domain given by set operations on a large number of elementary shapes such as spheres, cones, cylinders and boxes. In a series of notes, [5–7] and one of the authors have shown that CSG opens new vista e for the speed up of computations by domain decomposition. We will use these results also in a subsequent work while here we simply solve the direct problem in three dimensions.

II. HELMHOLTZ EQUATION 3-D

We consider the scattering of a time-harmonic acoustic plane wave exp(ι ⋅ω ξ) by a geometry created using the CSG of the POV-Ray program (Fig.2). Such scattering can be modelled by the three-dimensional Helmholtz equation with an absorbing boundary condition on a rectangular artificial boundary.

a)

b) Fig. 2. a) a scene displayed by POV-Ray. The objects are never intersected, it is the graphic rendering that takes care of the problem; b) the trace of the

real part of the scattered acoustic field on the surface of the geometry. Here, we use an impedance boundary condition on the surface of the geometry:

( ) ( ) ∏∈=ω−Δ− ,\,02 Dxxuxu

( ) ( ) ( ) ,, Dxxgxuin

xu ∂∈=ω−∂

∂ (1)

B ( ) ∏∂∈= .,0 xxu

We denote the obstacle by D and the surrounding rectangle by

∏ . The parameter ω is the wave number, which determines

the wavelength of the scattered wave, while the operator B corresponds to the chosen absorbing boundary condition.

III. LOCALLY FITTED MESHES

We apply the piecewise linear finite element method with mass lumping to obtain a linear system Au=f , corresponding to equation (1). We need to construct a tetrahedral mesh into the computational domain ∏ \ D, and, for this purpose, we use

locally perturbed orthogonal meshes called locally fitted meshes [4, 9]. The use of such meshes is motivated by the fact that they allow us to realize the GMRES method in allow-dimensional subspace [2, 4].

a)

b) Fig. 3. A locally fitted quadrilateral mesh: the nearby vertices are moved on the boundary of the polygonal domain so that the quadrangulation becomes

admissible. Locally fitted meshes are obtained by first creating an orthogonal grid ∏ h for the domain ∏ . We modify

∏ h such that the nodes, which are neigh boring D∂ are

M.-C. Popescu, V. E. Balas, M. M. Balas, O. Olaru • Algorithm for Virtual Reality

126

Page 3: [IEEE 2009 4th International Symposium on Computational Intelligence and Intelligent Informatics. ISCIII 2009 - Luxor (2009.10.21-2009.10.25)] 2009 4th International Symposium on Computational

shifted locally onto the boundary of D. This perturbation changes the grid cells only in the neighbourhood of the

surface and results in a deformed grid ~

∏ h . The old

orthogonal mesh will be used later to construct a preconditioner. So we require that there is a one-to-one

correspondence between the nodes of ∏ h and ~

∏ h . The

modified cells are then divided into tetrahedrons according to the shape of the obstacle, which leads to a second-order approximation for smooth boundaries. The practical realization of the generator of 3-D locally fitted meshes requires the user to provide a Cfunction, which tells if a certain coordinate ξ is inside or outside of the geometry D. Such a characteristic function is easily constructed for a geometry created by the POV-Ray program.

IV. ALGEBRAIC DOMAIN METHOD

The solution of the linear system thus constructed is a formidable task because the number of mesh point is large. Following [4] we use an algebraic fictitious domain method. It is based on the idea of replacing the linear system Αυ=f resulting from the discretization on the admissible mesh by

an equivalent, but enlarged system fuA~~~ = for the values of

υ on all the vertices of ∏ not just those of ∏ \ D. The

benefit of this approach is that there are wider possibilities to construct efficient preconditioners for the enlarged system than for the original one. For instance, the finite difference scheme on the original orthogonal mesh of ∏ gives a

matrix B witch is a good preconditioned for A~

; then an iterative scheme like

( ) mmm uAfuuB ~~~~~ 1 −=−+ (2)

is very fast. A detailed description of the implementation of the fictitious domain solver for the 3D Helmholtz equation is given in [2].

V. INTERFACING VR

To use the virtual reality description of the computational domain (Fig.2 and the program of Section 1), one has to generate a characteristic function for the object D. The construction of this function was done in two steps, first by writing an interpreter for the language describing the scene and then by constructing the characteristic functions of all the elementary objects of the scene. The virtual reality language chosen was POV-Ray [11] because it is stable and portable but it can also be done with vrml as easily. Also VRML just implements the set union but no set intersection. Moreover, one can use it as a visualization tool thanks to the iso-surface patch [10]. To parse the program of Section 1 is easy but

POV-Ray has also conditional statements, loops, symbolic variables, functions, etc.; so we have used lex and yacc because both of them generate C or C++ parsers. In the C++ produced, an abstract Shape class is defined; it provides a standard interface to every kind of shapes. Its children are specialization such as Sphere or Cube (primitives), but also boolean operations such as Union and Intersection. The same kind of design is used for geometrical transformations of POV-Ray, (scale, rotate or translate). As every primitive shape is simple (sphere, cube, cone,…), one can easily associate to it its characteristic function. This is done by specializing the virtual function of the class Shape for each of them. To know if a vertex is in an object one has to compute the inverse of each transformation associated to it and then check if the antecedent is in the primitive Shape. This implementation makes the formulation very close to the mathematics, and as the results of boolean operations are shapes, complex objects descriptions and their characteristic function evaluation may be recursive. There is a problem however with two-dimensional structures like polygonal facets. A. CTransfert Class - this class, common server and client, manages the transfer information (messages actions, tables of measures) between the server and the patient. His role will be to serialize the information in the form of a compressed frame that the client will decode. The main methods of this class Class2Byte and Byte2Class. The first serialized all of the information in the fields of the class (action, size and content of tables of measures, display format, News...) in a first stream, then this will compress flows. The Byte2Class method is the reverse of the previous one, which will decompress the flow specified before completing all fields in the class with the values in the frame. The table’s measures, if any, will also be established so that the main class can access. The main method of class, TraiteDemande responsible action to address sent by the client. It returns a feed store and its length, corresponding to the answer frame to be sent to the patient. If an acquisition is made of measures, the method fills an array of complex Class CTransfert. There are also actions settings current settings of the device, contained in the fields which will be sent to the device to match demand in real setting. Indeed, for certain input parameters, the user manually enters a value. According to the button pressed, our class will simulate the actual behavior of the device and must accurately update the contents of current setting. Once the treated TraiteDemande launches flow generation, conducted in the classroom CTransfert, then returns the flow compressed the main class. TmainForm Class - class that declares the main menu of the application server, menu items and manages the events that occur in the form. Be careful methods AppSocketPatient-Connect, AdminSocket PatientConnect, AppSocketPatient-Read, Admin SocketPatientRead which are methods of learning peeled event when receiving a connection from a client or receiving a string representing a client's message. It was decided to separate information about the connections, logins ... (Admin) messages of each device (App) into two sockets to facilitate

ISCIII 2009 • 4th International Symposium on Computational Intelligence and Intelligent Informatics • 21–25 October 2009 Egypt

127

Page 4: [IEEE 2009 4th International Symposium on Computational Intelligence and Intelligent Informatics. ISCIII 2009 - Luxor (2009.10.21-2009.10.25)] 2009 4th International Symposium on Computational

management. At each new connection, the server verifies that it is a valid user with the password he compares to the list included in the file "serveur.ini." If it finds a match and if this login is not already connected, it sends a message to the opening of the connection. Otherwise, it returns a message of non-authorization and closes the socket connection. Each action received for the patient order, then we run the method of TraiteDemande of the Camera class: this action is decoded and the response to the motion is generated in the form of data stream. Once the action is treated on referral response sockets patient transmitter and receiver doctor. Another important method is the ChangeEtatPatient called in a double click on the login of a patient, and that changes the status of user choice and, if necessary, other users (because he can not have more than one user issuer at a time). C. Patient. TMainForm Class - class that declares the main menu application main patient, menu items and manages the events that occur in the form. thereafter. B. Server. Device Class. It realizes the interface between the main class and class transfer, managing the applications and by providing the class transfer relevant information to form the frame.

VI. NUMERICAL RESULTS

We used an efficient parallel implementation of the method introduced in [3], which enables us to solve large-scale 3-D scattering problems in which the number of wavelengths along the geometry may be up to 100. The computation was performed in an Origin 1500 parallel computer. In our test case, the wavelength was λ =1 and the rectangle enclosing the geometry was given by the two corners (-3,-3,-3) and (3; 3; 3). The object’s diameter is 4. The locally fitted mesh was created such that there were 20 mesh nodes per wavelength, and we computed the final solution values on each mesh node in the rectangle ∏ (1213

complex numbers). Thus, by linear interpolation, we obtained a numerical solution for the whole computational domain. There were 8855 nodes on the surface of the geometry, while the iterations were performed in a subspace of dimension 40730: The dimension of the total system was 121× 121× 121=1,8 million nodes. Sufficient accuracy was reached with 64 GMRES iterations. The wall clock time for the iterative solution with 16 processors of SGI Origin 2000 was 60 seconds. Various initializations took 30 seconds.

VII. CONCLUSIONS

The purpose of this paper is to make an electromagnetic calculus based on a geometrical description of a database structure, which is the result of image integration. The object goes through a lot of assembly operations. We will not look for the construction of a triangulation on a surface, which implies a useless technical and informatics effort, but we will

construct a function which can indicate the object. This function can make a syntactical analysis of the used descriptive language of our scenario (in this case in POV-Ray). For equations with partial derivates (1) we could use a terminating element method, preconditioned by a method of the fictive domain. The principle of this method is to protect the grid of the fictive domain in order to bring it within equity with studied geometry, with variation writing and formulation, on an equivalent grid and in such manner that it balances out. We will be using type 2 iterations. The solutions (Fig.3) illustrate the method, where there is no deterioration of the quality of the results, because the numerical method can estimate the optimal error.

REFERENCES

[1] Hartman J., Wernecke J., The VRML 2.0 Handbook, Addison-Wesley, 1996.

[2] Heikkola E., Kuznetsov E., Lipnikov K., Fictitious domain methods for the numerical solution of three-dimensional acoustic scattering problems, J. Comput. Acoustics 7, pp.161–183, 1999.

[3] Heikkola E., Rossi T., Toivanen J., Efficient iterative solution of high frequency acoustic scattering problems, in: Proc. of the Third SIAM Conference on the Numerical Aspects of Wave Propagation, SIAM, 2000.

[4] Kuznetsov Y., Lipnikov K., 3D, Helmholtz wave equation by fictitious domain method, Russian J. Numer. Anal. Math. Model. 13, pp.371–387, 1998.

[5] Lions J.L., Pironneau O., Algorithmes parallèles pour la solution de problèmes aux limites, C. R. Acad. Sci. Paris, Série I 327, pp.947–352, 1998.

[6] Lions J.L., Pironneau O., Domain decomposition methods for CAD, C.R. Acad. Sci. Paris, Série I 328, pp.73–80, 1999.

[7] Popescu M.C., Petri or A., 2D Optimal Control Algorithms Implementation, Journal WSEAS Transactions on System and Control, Issue 1, Volume 1, pp.94-99, Venice, Italy, 2006.

[8] Popescu M.C., Aplica ii in informatica, Editura Universitaria Craiova, 2009.

[9] Popescu M.C., Comanda i optimizarea proceselor, Editura Universitaria Craiova, 2007.

[10] Suzuki R., A patch to POV-Ray for iso-surfaces, in: http://www.public.usit.net/rsuzuki/e/povray/iso/index.htm

l [11] Wardley A., Persistence of Vision, POV-Ray in http://www.povray.org/

M.-C. Popescu, V. E. Balas, M. M. Balas, O. Olaru • Algorithm for Virtual Reality

128