/[escript]/trunk/doc/examples/pyvisi/movie.py
ViewVC logotype

Annotation of /trunk/doc/examples/pyvisi/movie.py

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1194 - (hide annotations)
Thu Jun 14 05:53:49 2007 UTC (15 years, 9 months ago) by jongui
File MIME type: text/x-python
File size: 1558 byte(s)
- Fixed a minor bug in the Camera module.
- Added some extra capability to the Movie module.
- The Camera module now has the capability to perform parallel projection by calling the 'parallelProjectionOn' method.
- The Camera at this stage is only capable of zooming towards the rendered object using 'dolly'. However, it appears that 'dolly' cannot be used to perform zooming out.
1 jongui 1191 # Import the necessary modules.
2     from esys.pyvisi import Scene, DataCollector, Map, Camera, Velocity, Legend
3     from esys.pyvisi import Movie, LocalPosition
4     from esys.pyvisi.constant import *
5     import os
6    
7     PYVISI_EXAMPLE_MESHES_PATH = "data_meshes"
8     PYVISI_EXAMPLE_IMAGES_PATH = "data_sample_images"
9     X_SIZE = 800
10     Y_SIZE = 800
11    
12     SCALAR_FIELD_POINT_DATA = "temp"
13     FILE_2D = "tempvel-"
14     IMAGE_NAME = "movie"
15     JPG_RENDERER = Renderer.ONLINE_JPG
16    
17     # Create a Scene.
18     s = Scene(renderer = JPG_RENDERER, num_viewport = 1, x_size = X_SIZE,
19     y_size = Y_SIZE)
20    
21     # Create a DataCollector reading from a XML file.
22     dc1 = DataCollector(source = Source.XML)
23     dc1.setActiveScalar(scalar = SCALAR_FIELD_POINT_DATA)
24    
25     # Create a Map.
26     m1 = Map(scene = s, data_collector = dc1,
27     viewport = Viewport.SOUTH_WEST, lut = Lut.COLOR, cell_to_point = False,
28     outline = True)
29    
30     # Create a Camera.
31     cam1 = Camera(scene = s, viewport = Viewport.SOUTH_WEST)
32    
33     # Create a movie.
34     mov = Movie()
35    
36     # Read in one file one after another and render the object.
37     for i in range(938, 949):
38     dc1.setFileName(file_name = os.path.join(PYVISI_EXAMPLE_MESHES_PATH, \
39     FILE_2D + "%06d.vtu") % i)
40    
41     s.render(image_name = os.path.join(PYVISI_EXAMPLE_IMAGES_PATH, \
42     IMAGE_NAME + "%06d.jpg") % i)
43    
44     # Generate the movie from the rendered images.
45     mov.makeMovie(input_directory = PYVISI_EXAMPLE_IMAGES_PATH,
46     first_image = IMAGE_NAME + "000938.jpg",
47 jongui 1194 last_image = IMAGE_NAME + "000948.jpg",
48 jongui 1191 movie = os.path.join(PYVISI_EXAMPLE_IMAGES_PATH, "movie.mpg"))
49    

  ViewVC Help
Powered by ViewVC 1.1.26