Upload
kyree-slocomb
View
212
Download
0
Embed Size (px)
Citation preview
Using AVS/Express in an Introductory Computer
Graphics Course
2
Course Structure
• Undergraduate course is a modular scheme
• Students study 8 modules per year, each one for 15 weeks, for 3 years
• Second year: Tools for Graphics and Visualisation
• Third year: Methods for Graphics and Visualisation
3
Tools for Graphics and Visualisation
• Uses 2D images to implement some of the standard algorithms in computer graphics:-– draw a circle– rotate, scale, and translate a 2D shape– window to viewport transformation– calculate co-ordinates of intersection of 2 lines– zoom in and out, & pan up/down/left/right – Bezier Curve drawing to fit 4 points
4
Visualisation component
• Create 3D shape from either: -
– 2D profile
– surface co-ordinates
• Use AVS/Express to visualise the 3D shape• Use AVS/Express to animate the 3D shape
5
Draw a Circle
• The co-ordinates of any point on the edge of a circle centred at the origin may be obtained from the following equations: -
• X = Radius*cosine() • Y = Radius*sine()• where is the angle in radians between the X axis
and a point on the circle (in an anti-clockwise direction)
6
Draw a Circle
=degrees*/180
X = Radius*cosine()
Y = Radius*sine()
X-axis
Y-axis
Radius
7
Create 3D solid from 2D profile
Profile
Y
X
Solid of revolutionof bottle
shape
Y
X
Z
8
Create 3d solid from 2D profile
• The students use the circle code to generate the X and Z co-ordinates (the Y co-ordinates remain constant for each point on the profile)
• They also have to generate an extra set of co-ordinates (exactly the same as the first set) to make AVS/Express join the last point up to the first one.
9
Surface Plot
• Specify a regular grid for the (x,y,z) co-ordinates
• Student has to generate a height for each co-ordinate based on a random number
10
a b
c
3D Surface
• Randomly modify its new height within limits
• Create a new mid-way point
• Make its height the average of the adjacent points
11
Include the diagonals
• Also along the diagonals based on the heights of the four corners (a, b, c, and d)
a b
d c
12
13
Field file for a bottle
# AVS field file
# bottle
ndim = 2
dim1 = 21
dim2 = 15
nspace = 3
veclen = 1
data = integer
field = irregular
14
Field file for bottle (continued)
coord 1 file=bottle.dat filetype=ascii skip=0 offset=0 stride=4
coord 2 file=bottle.dat filetype=ascii skip=0 offset=1 stride=4
coord 3 file=bottle.dat filetype=ascii skip=0 offset=2 stride=4
variable 1 file=bottle.dat filetype=ascii skip=0 offset=3 stride=4
15
16
3D axis with text title
Bottle
17
Used crop to reduce
the number of horizontal
steps drawn
Crop
18
Used crop to reduce
the number
of vertical points drawn
Crop
19
Used downsize to reduce
the number of steps drawn around
the circle
Downsize
20
Used downsize to reduce
the number
of profile points drawn
Downsize
21
22
Field file for 3D solid example
# AVS field file
ndim = 2
dim1 = 9
dim2 = 11
nspace = 3
veclen = 1
data = integer
field = irregular
23
Field file (continued)
coord 1 file=xmastree.dat filetype= ascii Skip=0 offset=0 stride=4
coord 2 file=xmastree.dat filetype= ascii Skip=0 offset=1 stride=4
coord 3 file=xmastree.dat filetype= ascii Skip=0 offset=2 stride=4
variable 1 file=xmastree.dat filetype=ascii Skip=0 offset=3 stride=4
24
25
Neither downsize nor crop used on the first image
26
Used downsize to reduce
the number of steps in each circle
Downsize
27
Used downsize to reduce
the number
of profile points
Downsize
28
Used crop to reduce
the number of horizontal
steps drawn
Crop
29
Here is a selection of some
other shapes created
by the students
30
“Brolly”
31
“Rings”
32
“Speaker”
33
Cross section of
a “speaker”
34
Two stroke
cylinder
35
Animation using AVS/Express
• Once an image has been created, the students can animate the image using the keyframe method of animation
• This creates a series of views (keyframes)
• AVS/Express can save images from a view
• Then add frames between the keyframes to produce the animated sequence
36
Key-frame animation
• Need two images which depict the start and end frames
• Create an animation sequence by adding frames between the two images
• The two images must have a reasonable level of coherence
37
AVS/Express
• AVS/Express interpolates images between a series of captured visualisations
• Student captures the keyframes
• Assigns each keyframe to a time step
• AVS/Express automatically adds the required number of frames between these keyframes to produce an animated sequence
38
Keyframes and interpolated frames
keyframes the user defines
interpolated frames added by AVS/Express
39
AVS animation features
• Simple to add/delete/move keyframes
• If not a regular time interval between keyframes, then specify the time of next frame before adding it
• Can create a cyclic animation
• Playback control offers forwards, backwards, and “bounce”
40
41
Keyframe Controls
42
Module Panel
Modules pull-down
menu
Playback the
animation
43
Finally . . .
Create 2D
profile
Create 3D data
Use AVS/Express
to animate the image
Use AVS/Express to visualise
the data
• This is how we teach visualisation in a level 2 module: -
• What could we do in the level 3 module?